-
Notifications
You must be signed in to change notification settings - Fork 93
Convert --initialBalance from NEAR tokens to integer units #227
Conversation
This also changes default value to 0.1 NEAR
.option('initialBalance', { | ||
desc: 'Number of tokens to transfer to newly created account', | ||
type: 'string', | ||
default: '0.1' |
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.
why we change it to 0.1?
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.
So that if you have created your master account in wallet, you can create multiple accounts in shell without completely draining master account balance (it's 10 NEAR by default).
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.
I think it is not a good way to do so. give more instructions to user what create_account
command is from and how to use it make it more clear.
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.
do you suggest not having default amount at all? or different default amount?
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.
maybe not having default amount but required amount from user is better. since 0.1 or even less is not good number to guess how many account user want.
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.
maybe not having default amount but required amount from user is better.
I agree there is some trade off between discoverability and convenience here. However I highly prefer tools where you can succeed most of the time with reasonable details. We need to make sure to have --initialBalance
example in docs though /cc @amgando
keyPair = await KeyPair.fromRandom('ed25519'); | ||
publicKey = keyPair.getPublicKey(); | ||
} | ||
await near.createAccount(options.accountId, publicKey); |
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.
I wanna know the function createAccount here is never received the arg initialBalance, how could it really pass the commend arg initialBalance to create new account with specific token?
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.
see above:
// NOTE: initialBalance is passed as part of config here
let near = await connect(options);
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.
got it
const connect = require('../utils/connect'); | ||
const { KeyPair, utils } = require('nearlib'); | ||
|
||
module.exports = { |
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.
+1 to pulling out commands into separate files!
No description provided.