💡RPC API Operation Manual
Wallet testing
Operation
Command
Note
Create new wallet
tcli create wallet -n $wallet_name
Open wallet
tcli open wallet -n $wallet_name
Unlock wallet
tcli wallet unlock -n $wallet_name --password $password
You can use the ut alias command to quickly unlock the test wallet in the environment
List wallet
tcli wallet list
Return wallet list
List all wallet public keys
tcli wallet keys
List all wallet keys
tcli wallet private_keys -n test --password $password
Return all wallet keys
Create key
tcli create key --to-console
Return key info
Import private key
tcli wallet import -n $wallet_name --private-key $priv_key
Return key info
Account testing
Operation
Command
Note
Get account info
tcli get account $account_name
E.g. tcli get account amax
Register account
tcli system newaccount $creator --transfer $acct $pubkey \ --stake-net "0.1 AMAX" --stake-cpu "0.1 AMAX" --buy-ram-kbytes 10240 \ -p ${creator}@active
The quantity of staked token: NET and CPU, which can be adjusted according to the actual situation; Amount of RAM purchased: can be adjusted according to actual conditions;
Buy RAM for the targeting account
tcli system buyram $buyer $receiver -k 40960
E.g. tcli system buyram armoniaadmin aplinknewbie -k 40960
Get account balance
tcli get currency balance $token_contract $account $symbol
E.g. tcli get currency balance amax.token usera AMAX
Transaction testing
Operation
Command
Note
Transfer AMAX
tcli transfer $from $to $quantity $memo tcli push action amax.token transfer '["$from","$to","$quantity","$memo"]' -p $from
tcli transfer amax armoniaadmin "100 AMAX" "test" tcli transfer armoniaadmin usera "10.08 AMAX" "" tcli push action amax.token transfer '["amax","armoniaadmin","100 AMAX","test"]' -p amax tcli push action amax.token transfer '["armoniaadmin","usera","10.08 AMAX",""]' -p armoniaadmin
Transfer other tokens
tcli transfer -c amax.mtoken $from $to $quantity $memo tcli push action amax.mtoken transfer '["$from","$to","$quantity","$memo"]' -p $from
tcli transfer -c amax.mtoken armoniaadmin usera "10 MUSDT" "test" tcli transfer -c amax.mtoken usera userb "1.08 USDT" "" tcli push action amax.mtoken transfer '["armoniaadmin","usera","10 MUSDT","test"]' -p armoniaadmin tcli push action amax.mtoken transfer '["usera","userb","1.08 AMAX",""]' -p userb
Create new token
tcli push action $token_contract create '[ "$symbol", "$total_supply" ]' -p $token_contract@active
tcli push action amax.token create '[ "amax", "1000000000.00000000 XYZ" ]' -p amax.token@active
Issue new token
tcli push action $token_contract issue '[ "$symbol", "$total_supply", "" ]' -p $token_contract@active
tcli push action amax.token issue '[ "amax", "900000000.00000000 AMAX", "" ]' -p amax@active
Contract testing
Operation
Command
Note
Deploy contract
tcli set contract $con ./build/contracts/$contract_dir -p ${con}@active
You must create a contract account in advance $con
Update contract
ditto
Call contract
tcli push action $contract_name $action_name $params -p $issuer
E.g. tcli push action currencyview view '["armoniaadmin"]' -p usera
Data query
Operation
Command
Note
Query token data
tcli get currency stats $token_contract $symbol
tcli get currency stats amax.token AMAX tcli get currency stats aplink.token APL
View contract ABI structure information
amcli get abi $contract
mcli get abi amax.xchain
View table data - primary key index
amcli get table $code $scope $table $options
mcli get table amax.xchain amax.xchain global mcli get table amax.xchain amax.xchain xinaddrmap mcli get table amax.xchain amax.xchain coins -l 1 -r mcli get table amax.xchain amax.xchain xinorders -l1 mcli get table amax.xchain amax.xchain xinorders -l1 -r
View table data - foreign key index
amcli get table $code $scope $table --index $indexNum --key-type $keyType $options
mcli get table amax.xchain amax.xchain xinorders --index 2 --key-type i64 -r -l1
Last updated