Wallet derive address#3382
Conversation
| const main = async () => { | ||
| const { name, path, storageType, addressIndexes } = program; | ||
| let { change } = program; | ||
| change = (change === 'true'); |
There was a problem hiding this comment.
I think this is a bit verbose, did you ever think about destructuring this in line 19? i.e.
const { name, path, storageType, addressIndexes , change=(change === 'true')} = program;
There was a problem hiding this comment.
it looks like destructuring it will not result change to boolean true/false, which has it be boolean. Another way that I can think of is to check if change is defined to avoid the program to crash and do JSON.parse(change).
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| await wallet.register({ baseUrl: wallet.baseUrl }); | ||
|
|
||
| if (addressIndexes) { | ||
| indexes = JSON.parse(addressIndexes).indexes; |
There was a problem hiding this comment.
since you have dot notation here, it seems you expect addressIndexes to be an object though I'm not sure it is.
|
|
||
| for (let i = 0; i < indexes.length; i++) { | ||
| address = wallet.deriveAddress(indexes[i], change); | ||
| if (address) { |
There was a problem hiding this comment.
If you're setting the address right before this than would you expect address to be defined? -- and if there is a problem deriving one address, is it skipping to line 61?
| console.log('Addresses & Indexes: ', addressesAndIndex); | ||
| } | ||
| } catch (e) { | ||
| console.error(e); |
There was a problem hiding this comment.
Maybe a clearer error to the user here/another try block somewhere since there is more code than in the original util.
| .version(require('../package.json').version) | ||
| .option('--name <name>', 'REQUIRED - Wallet Name') | ||
| .option('--change [change]', 'optional - should derive change addresses') | ||
| .option('--addressIndexes [addressIndexes]', 'optional - takes one or more indexes') |
There was a problem hiding this comment.
I believe the request was for a range (i.e. 4-20) vs an array (i.e. [4, 34, 40, 6]) I'm not sure the use case for deriving from an array of indexes but it's just a thought.
|
This has been replaced by #3460. It can be closed. |
|
replaced by #3460 |
|
Good day,Do you buy bitcore?
…On Tue, Oct 18, 2022, 2:58 PM Elliott Alexander ***@***.***> wrote:
This has been replaced by #3460
<#3460>. It can be closed.
—
Reply to this email directly, view it on GitHub
<#3382 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2TLXDQ77KU4CXJGXA4EFRLWD2UG3ANCNFSM5ZQYCKZQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
deriving addresses with change option