bnb-chain / greenfield-cmd

support cmd tool for Greenfield
GNU Lesser General Public License v3.0
27 stars 12 forks source link

feat: support multi account #94

Closed flywukong closed 1 year ago

flywukong commented 1 year ago

Description

1)support multi-account management

2)support "set-default" command to set the default account with which to send the request

3) remove debug log printing which print by go-sdk

Rationale

enhance account management

Example

root@ testnet-test % ./gnfd-cmd account ls
run command error: keystore not exists

root @ testnet-test % ./gnfd-cmd account new
Please enter the passphrase now:
created new account: {0xC7805a0c085c1D96e1BDc5Fcc1F7534982F177EE}

root@testnet-test % ./gnfd-cmd account new
Please enter the passphrase now:
created new account: {0x75345BC9FfFAe09486dE7EC954bAfAEcE29b9b24}

root@testnet-test % ./gnfd-cmd account import key.txt
Please enter the passphrase now:
key address: 0xCEE3823C39Fcc9845D7C7144A836562F37995085, encrypted key file: /Users/user/.gnfd-cmd/keystore/2023-10-11T08-36-54.999924000Z--cee3823c39fcc9845d7c7144a836562f37995085

root@ testnet-test % ./gnfd-cmd account ls
Account: { 0xC7805a0c085c1D96e1BDc5Fcc1F7534982F177EE },  Keystore : /Users/user/.gnfd-cmd/keystore/2023-10-11T08-36-40.926382000Z--c7805a0c085c1d96e1bdc5fcc1f7534982f177ee
Account: { 0x75345BC9FfFAe09486dE7EC954bAfAEcE29b9b24 },  Keystore : /Users/user/.gnfd-cmd/keystore/2023-10-11T08-36-44.626883000Z--75345bc9fffae09486de7ec954bafaece29b9b24
Account: { 0xCEE3823C39Fcc9845D7C7144A836562F37995085 },  Keystore : /Users/user/.gnfd-cmd/keystore/2023-10-11T08-36-54.999924000Z--cee3823c39fcc9845d7c7144a836562f37995085

root@ testnet-test % ./gnfd-cmd account set-default CEE3823C39Fcc9845D7C7144A836562F37995085
the default account has been set to CEE3823C39Fcc9845D7C7144A836562F37995085

Changes

Notable changes: