10000 Convert --initialBalance from NEAR tokens to integer units by vgrichina · Pull Request #227 · near/near-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Convert --initialBalance from NEAR tokens to integer units #227

Merged
merged 4 commits into from
Dec 23, 2019

Conversation

vgrichina
Copy link
Contributor

No description provided.

.option('initialBalance', {
desc: 'Number of tokens to transfer to newly created account',
type: 'string',
default: '0.1'
Copy link
Contributor

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?

Copy link
Contributor Author

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).

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author
@vgrichina vgrichina Dec 23, 2019

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);

Copy link
Contributor

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 = {
Copy link
Contributor

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!

@janedegtiareva janedegtiareva merged commit fc430fc into master Dec 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0