Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Unhydrated wallets and address.getTransfers (#28) #28

Merged
merged 11 commits into from
May 24, 2024

Conversation

erdimaden
Copy link
Contributor

@erdimaden erdimaden commented May 24, 2024

What changed and why?

We now support unhydrated Wallets, which handle read-only operations like checking balances and addresses. These wallets do not include a masterWallet unless initialized with a seed via the setSeed method. The Address class has been updated to support this feature, similar to our Ruby SDK.

Additionally:

  • Fixed deriveAddress test case and addressIndex issues
  • Added address.getTransfers method to return a list of transfers
  • Created generateWalletFromSeed function to generate addresses and wallets from a given seed

Qualified Impact

@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch 3 times, most recently from 2172228 to d24000f Compare May 24, 2024 05:18
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from d24000f to 549eb3a Compare May 24, 2024 05:19
@erdimaden erdimaden changed the title Implementing UnhydratedWallet class [WIP] Implementing UnhydratedWallet class May 24, 2024
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from bd9ad92 to f69bd85 Compare May 24, 2024 07:42
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from 0490bf4 to 2d00a53 Compare May 24, 2024 08:38
@@ -134,8 +163,10 @@ export class Address {
intervalSeconds = 0.2,
timeoutSeconds = 10,
): Promise<Transfer> {
if (!this.key) {
Copy link
Contributor Author

@erdimaden erdimaden May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for createTransfer when a key is not loaded that we throw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have a test for createTransfer. I use an UnhydratedWallet to initiate a createTransfer request without a key on the Address Class. Does this approach work for you?

Comment on lines 260 to 265
const baseWallet = HDKey.fromMasterSeed(bip39.mnemonicToSeedSync(seed));
const wallet1 = baseWallet.derive("m/44'/60'/0'/0/0");
const address1 = getAddressFromHDKey(wallet1);

const wallet2 = baseWallet.derive("m/44'/60'/0'/0/1");
const address2 = getAddressFromHDKey(wallet2);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deriveAddress function needs real wallets and addresses to operate.

@erdimaden erdimaden marked this pull request as ready for review May 24, 2024 09:46
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch 5 times, most recently from 7fce280 to 19f213d Compare May 24, 2024 11:01
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from 19f213d to b87207c Compare May 24, 2024 11:42
@erdimaden erdimaden changed the title [WIP] Implementing UnhydratedWallet class Implementing UnhydratedWallet class May 24, 2024
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch 2 times, most recently from 6c063d7 to ebd3302 Compare May 24, 2024 18:09
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from ebd3302 to f7af680 Compare May 24, 2024 18:11
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from db6929d to 0930583 Compare May 24, 2024 18:15
@erdimaden erdimaden force-pushed the feat/psdk-178_unhydrated_wallets branch from 603ca87 to 5c66c0b Compare May 24, 2024 19:17
@erdimaden erdimaden changed the title Implementing UnhydratedWallet class Implementing Unhydrated wallets and address.getTransfers (#28) May 24, 2024
@erdimaden erdimaden merged commit 7955e87 into master May 24, 2024
6 checks passed
@erdimaden erdimaden deleted the feat/psdk-178_unhydrated_wallets branch June 21, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants