Skip to content

CLI Examples

hashmesan edited this page Jul 13, 2021 · 1 revision

Usage

hashmesan@linux:~$ smartvault -e testnet3 
Usage: smartvault [options] [command]

Options:
  -V, --version                                           output the version number
  -e --env <env>                                          environment mainnet0, testnet0, testnet3 (default: "mainnet0")
  -h, --help                                              display help for command

Commands:
  new [options] <name>                                    creates a new wallet
  recover <name> <code1> <code2> <code3> <code4> <code5>  recover wallet
  list                                                    list all wallets
  balance <address>                                       get balance
  transfer [options] [to] [amount]                        Transfer funds
  info <address>                                          Display wallet info
  set_daily_limit [options] <amount>                      set daily limit
  set_drain_address [options] <address>                   set drain address
  upgrade [options]                                       upgrades contract to latest
  debug-break [options]                                   forces a revert
  help [command]                                          display help for command

New wallet

hashmesan@linux:~$ smartvault -e testnet3 new -r one1hfpqaawhy5mpmr7utr93unax9mdfajvsd7dvu3 hmac001.crazy.one
Connecting to  https://api.s3.b.hmny.io
DEBUG: 997432
Generated leaves depth=8 0%
Generated leaves depth=8 20%
Generated leaves depth=8 40%
Generated leaves depth=8 60%
Generated leaves depth=8 80%
Generated leaves depth=8 100%
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █ ▀█ ▀▀▀▄█▀ █▀▀▀█▀▄▄██  █▀█ ▄▄▄▄▄ █
█ █   █ ██▀▀▀▀█ █▀█ ▄▀  ▀█ ▀█▄  ▀██ █   █ █
█ █▄▄▄█ █ ▄ ▀▀█▄▄  ▄▄ ▄ █▀▄██▀ ▄█▄█ █▄▄▄█ █
█▄▄▄▄▄▄▄█ █▄▀▄█▄█▄█ █▄█ ▀ █ █ █ ▀▄█▄▄▄▄▄▄▄█
█▄  ▀▀▄▄█▄█▄ █▄█▄▀█▀  ██▀ █▀▀▀▀█▀ ▄  ▄██▄▄█
█▄▀▄▀▀▄▄▄ █ █ ▄ ▄ ▄  █▄▀ ██▄ █▄ ▄▀█ ▀▀ ▄▀▄█
██▄█▄ ▄▄▀▀▄ ▄▄▄ ▄▀▄ ▄█▄ ▄▀██▄██  ▀▀ ▄▀▀▄█▄█
██▀    ▄ █ █▀ ▄▄▀ █▄▀ ██  █▄ █▄▀ ▄▄█ ▄▀██▄█
█▀▄▀▀ ▄▄▀ ▄▀█▀▀ ▀█▀█▀▀▀▀▀ █▀  ██▀▀█ ▄█▄▄█▄█
█▄▀ █ ▀▄ ▄█▄▄▀▀█ ▄▀█  ▀█ ▀▄█  █ ▄█ ▄▀▀▀▄█▄█
█▄ ▀█▄ ▄██  ▄█▄███▄█▄█▄█▀▄▀▀▀▀█▀▄▀█▄▀▄█▀▀ █
█▄▀▀▀▀▀▄ █▀█▄██▀▄█▄▀▄█▄█▄ ▄ ▄▀▄ ▄▄▀▀▀ ▀▄▀ █
█▀▀ ▀██▄▀█▀█ █▄█▄▀█▀ ▄██ ██▄▀▄██▀▀▀ ▄█ ▄███
██▄█▄ ▄▄▀▀▄ ▄▄▄ ▄▀▄ ▄█▄ ▄▀██▄██  ▀▀ ▄▀▀▄█▄█
██▄█▄ ▄▄▀▀▄ ▄▄▄ ▄▀▄ ▄█▄ ▄▀██▄██  ▀▀ ▄▀▀▄█▄█
██▄█▄ ▄▄▀▀▄ ▄▄▄ ▄▀▄ ▄█▄ ▄▀██▄██  ▀▀ ▄▀▀▄█▄█
██▄█▄ ▄▄▀▀▄ ▄▄▄ ▄▀▄ ▄█▄ ▄▀██▄██  ▀▀ ▄▀▀▄█▄█
██▄█▄ ▄▄▀▀▄ ▄▄▄ ▄▀▄ ▄█▄ ▄▀██▄██  ▀▀ ▄▀▀▄█▄█
█ █   █ ██▄▄▄█▄█▄█ ███▄█▀ ▀▀ ▀██▄▄ ▄   █▄▀█
█ █▄▄▄█ █ ▄█▄█▄▀▄█▄▀▄██▄▄▀█▀▄▀▄▄ ▄▀█▄▄ ▄█▄█
█▄▄▄▄▄▄▄█▄██▄█▄█▄██▄▄██▄▄▄██▄██▄█▄▄▄▄█▄▄█▄█

Enter the 6-digit OTP: 188823
OTP code do not match.
Enter the 6-digit OTP: 997432
Make your first deposit. Fees will be deducted from your deposits
Your wallet address is: one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn or 0xBb916593d5A7f0804F2B267073ddF7D8FC170b02
Registration Fee: 1.000000000000000047
Network Fee: 0.00123
Total Fee: 1.001230000000000047
Got deposit  1100000000000000000
STATUS:  Generated hashes 0%
STATUS:  Generated hashes 20%
STATUS:  Generated hashes 40%
STATUS:  Generated hashes 60%
STATUS:  Generated hashes 80%
STATUS:  Generated hashes 100%
STATUS:  Deploying wallet, waiting for tx
STATUS:  Uploading hashes to IPFS... 
STATUS:  Uploaded Hashes to IPFS Hash=QmVn2aAJZWTieBtEDcUL3PiwUZXSCDdF4k7eX1Ve3BzubQ (655555 Bytes)
STATUS:  Successful stored hash on contract.
Wallet created!
Wrote to  .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one

Get Information

hashmesan@linux:~$ smartvault -e testnet3 info one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn
Connecting to  https://api.s3.b.hmny.io
Version: 0x4ad4Ed6D85620Bb3392861E3376fE8335c217267
Spending Limit: 0 / 0.00000000000001 ONE
OTP Tokens: counter=0 max=4096
# of Guardians: 0
IPFS Merkle Backup: QmVn2aAJZWTieBtEDcUL3PiwUZXSCDdF4k7eX1Ve3BzubQ
Drain Address: 0xbA420EF5D725361d8fDc58Cb1e4fa62EDa9EC990
Balance: 0.098769999999864291 ONE

Send Payment

hashmesan@linux:~$  smartvault -e testnet3 transfer --from one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn one1hfpqaawhy5mpmr7utr93unax9mdfajvsd7dvu3 0.01234
Connecting to  https://api.s3.b.hmny.io
loading.. .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one
Success! TX=0x2feb0954eba1121038dd28c71b1ab45db13b26531092c676c7b5c3e179b04d6e

Upgrade

The function set_daily_limit is missing from current wallet version. After upgrade, the function is available.

hashmesan@linux:~$ smartvault -e testnet3 set_daily_limit --from one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn 100
Connecting to  https://api.s3.b.hmny.io
loading.. .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one
Error:  Transaction: 0x87b77450a1e4c79d655ecabe3ac269156f901ca5d465275bf05430142d6bceb2 exited with an error (status 0). Reason given: unknown method.
     Please check that the transaction:
     - satisfies all conditions set by Solidity `require` statements.
     - does not trigger a Solidity `revert` statement.

hashmesan@linux:~$ smartvault -e testnet3 upgrade --from one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn
Connecting to  https://api.s3.b.hmny.io
loading.. .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one
Current version:  0x4ad4Ed6D85620Bb3392861E3376fE8335c217267
Latest version:  0x037ae824BfD3D0D9A7962496c92a4CBBE6E04666
Do you want to upgrade? (Y/N): y
Success! TX=0x792c0136933f7265a3b278e200b872f1c6691ca8ea391fae7b968d91cf87a61a

hashmesan@linux:~$  smartvault -e testnet3 set_daily_limit --from one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn 100
Connecting to  https://api.s3.b.hmny.io
loading.. .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one
Success! TX=0xd85c6ae25469d8c1650e1e6d8cbdd37bdfacfb9a66e3b5dc2418c682853c667f

hashmesan@linux:~$  smartvault -e testnet3 info one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn
Connecting to  https://api.s3.b.hmny.io
Version: 0x037ae824BfD3D0D9A7962496c92a4CBBE6E04666
Spending Limit: 0 / 100 ONE    
OTP Tokens: counter=0 max=4096
# of Guardians: 0
IPFS Merkle Backup: QmVn2aAJZWTieBtEDcUL3PiwUZXSCDdF4k7eX1Ve3BzubQ
Drain Address: 0xbA420EF5D725361d8fDc58Cb1e4fa62EDa9EC990
Balance: 0.499999999999763397 ONE

Set Drain Address

hashmesan@linux:~$ smartvault -e testnet3 set_drain_address --from one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn one1hfpqaawhy5mpmr7utr93unax9mdfajvsd7dvu3 
Connecting to  https://api.s3.b.hmny.io
loading.. .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one

Success! TX=0x2d726122eb43428480e670ffbb2f4ea6b19a5fd63ba5a3b1a214c704f4db3715

Recover wallet

hashmesan@linux:~$ smartvault -e testnet3 recover hmac001.crazy.one 188823 997432 167318 224051 742869
Connecting to  https://api.s3.b.hmny.io
recoverWallet hmac001.crazy.one
STATUS:  Found at address=0xBb916593d5A7f0804F2B267073ddF7D8FC170b02
STATUS:  Wallet owned by 0xF66271487f9285936752e41d18D70ee8AC75c5eD counter=0 hashStorageId=QmVn2aAJZWTieBtEDcUL3PiwUZXSCDdF4k7eX1Ve3BzubQ
STATUS:  Generated new owner key=0x58BF823946464b315896578d2d7cCD3455a49a53
STATUS:  Loaded merkle hashes len=655361
STATUS:  Generated proof(14) counter=0
STATUS:  Submitted recovery commitHash=0x63b5cb976e0c3af895fe331c3fe4e9170fe7069ebcc4904b831e139e9e5d23fe
STATUS:  Submitted recovery reveal
STATUS:  Successfully recovered to new address=0x58BF823946464b315896578d2d7cCD3455a49a53
Wrote to  .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one

hashmesan@linux:~$  smartvault -e testnet3 transfer --from one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn one1hfpqaawhy5mpmr7utr93unax9mdfajvsd7dvu3 0.01234
Connecting to  https://api.s3.b.hmny.io
loading.. .smartvault/testnet3/.smartvault-one1hwgkty745lcgqnetyec88h0hmr7pwzcz820tfn-hmac001.crazy.one

Success! TX=0x74de404f0220be78408640f31779f619b5552c2893ceca3ba7929dce1b21fccf
Clone this wiki locally