-
Notifications
You must be signed in to change notification settings - Fork 43
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
Conversation
2172228
to
d24000f
Compare
d24000f
to
549eb3a
Compare
bd9ad92
to
f69bd85
Compare
0490bf4
to
2d00a53
Compare
@@ -134,8 +163,10 @@ export class Address { | |||
intervalSeconds = 0.2, | |||
timeoutSeconds = 10, | |||
): Promise<Transfer> { | |||
if (!this.key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reference ruby implementation: https://github.com/coinbase/coinbase-sdk-ruby/blob/master/lib/coinbase/address.rb#L81
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
src/coinbase/tests/user_test.ts
Outdated
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); |
There was a problem hiding this comment.
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.
7fce280
to
19f213d
Compare
Updating test cases
19f213d
to
b87207c
Compare
6c063d7
to
ebd3302
Compare
ebd3302
to
f7af680
Compare
db6929d
to
0930583
Compare
603ca87
to
5c66c0b
Compare
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:
deriveAddress
test case andaddressIndex
issuesaddress.getTransfers
method to return a list of transfersgenerateWalletFromSeed
function to generate addresses and wallets from a given seedQualified Impact