-
- The NEAR Command Line Interface (CLI) is a tool that enables to interact with the NEAR network directly from the shell. Under the hood, NEAR CLI utilizes the NEAR JavaScript API
- Installation
npm install -g near-cli
-
- Testnet: https://wallet.testnet.near.org/
- Mainnet: https://wallet.near.org/
-
near login
Method
- balance_of
Parameters | Type | Info |
---|---|---|
account_id | string | Valid near account id |
coin_name | string | Name of coin |
CLI Command
NEAR_ENV=testnet near view <BTS> balance_of '{"account_id": "<ACCOUNT ID>", "coin_name": "<Coin Name>"}'
Method
- refundable_balance_of
Parameters | Type | Info |
---|---|---|
account_id | string | Valid near account id |
coin_name | string | Name of coin |
CLI Command
NEAR_ENV=testnet near view <BTS> refundable_balance_of '{"account_id": "<ACCOUNT ID>", "coin_name": "<Coin Name>"}'
Method
- locked_balance_of
Parameters | Type | Info |
---|---|---|
account_id | string | Valid near account id |
coin_name | string | Name of coin |
CLI Command
NEAR_ENV=testnet near view <BTS> locked_balance_of '{"account_id": "<ACCOUNT ID>", "coin_name": "<Coin Name>"}'
Method
- deposit
CLI Command
NEAR_ENV=testnet near call <BTS> deposit --amount <AMOUNT in NEAR> --accountId <ACCOUNT ID>
Method
- ft_transfer_call
Parameters | Type | Info |
---|---|---|
receiver_id | string | Valid near account id |
amount | string | Amount to deposit |
msg | string |
CLI Command
NEAR_ENV=testnet near call <NEP141 Contract> ft_transfer_call '{"receiver_id": "<BTS>", "amount": "<AMOUNT>", "msg": ""}' --accountId <ACCOUNT ID> --amount <1 yoctoNEAR in highest Denomination ie 0.000000000000000000000001>
Method
- withdraw
Parameters | Type | Info |
---|---|---|
coin_name | string | Name of coin to withdraw |
amount | string | Amount to withdraw |
CLI Command
NEAR_ENV=testnet near call <BTS> withdraw '{"coin_name": "<COIN NAME>", "amount":"<Amount in lowest Denomination>"}' --amount <1 yoctoNEAR in highest Denomination ie 0.000000000000000000000001> --gas 300000000000000 --accountId <ACCOUNT ID>
Method
- get_fee
Parameters | Type | Info |
---|---|---|
coin_name | string | Name of coin to transfer |
amount | string | Amount to transfer |
CLI Command
NEAR_ENV=testnet near view <BTS> get_fee '{"coin_name": "<Coin Name>", "amount": "<Amount in lowest Denomination, For NEAR in yoctoNEAR ie 1 NEAR = 1^24 yoctoNEAR>"}'
Method
- transfer
Parameters | Type | Info |
---|---|---|
coin_name | string | Name of coin to transfer |
destination | string | BTP Address of destination |
amount | string | Amount to transfer |
CLI Command
NEAR_ENV=testnet near call <BTS> transfer '{"coin_name": "<Coin Name>", "destination": "btp://<Network>/<Address>", "amount": "<Amount in lowest Denomination, For NEAR in yoctoNEAR ie 1 NEAR = 1^24 yoctoNEAR>"}' --gas 300000000000000 --accountId <ACCOUNT ID>
- Deposit NEAR to BTS here
Example
NEAR_ENV=testnet near call bts.iconbridge-6.testnet deposit --amount 10 --accountId dev-20211206025826-24100687319598
- Query Transfer Fee here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet get_fee '{"coin_name": "btp-0x2.near-NEAR", "amount": "10000000000000000000000000"}'
- Transfer here
Example
NEAR_ENV=testnet near call bts.iconbridge-6.testnet transfer '{"coin_name": "btp-0x2.near-NEAR", "destination": "btp://0x2.icon/hx54d9ba221fbe8a475a8bf38c7d048675b5d7b85a", "amount": "10000000000000000000000000"}' --gas 300000000000000 --accountId dev-20211206025826-24100687319598
- Check locked balance for the transfered amount here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet locked_balance_of '{"account_id": "dev-20211206025826-24100687319598", "coin_name": "btp-0x2.near-NEAR"}'
- Check usable balance amount to withdraw here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet balance_of '{"account_id": "dev-20211206025826-24100687319598", "coin_name": "btp-0x2.near-NEAR"}'
- Withdraw here
Example
NEAR_ENV=testnet near call bts.iconbridge-6.testnet withdraw '{"coin_name": "btp-0x2.near-NEAR", "amount":"10000000000000000000000000"}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId dev-20211206025826-24100687319598
- Check balance
Example
NEAR_ENV=testnet near state dev-20211206025826-24100687319598
- Deposit Cross-Chain Native Coin to BTS here
Example
NEAR_ENV=testnet near call btp-icx.bts.iconbridge-6.testnet ft_transfer_call '{"receiver_id": "bts.iconbridge-6.testnet", "amount": "10000000000000000000000000", "msg": ""}' --accountId dev-20211206025826-24100687319598 --amount 0.000000000000000000000001
- Query Transfer Fee here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet get_fee '{"coin_name": "btp-0x2.icon-ICX", "amount": "10000000000000000000000000"}'
- Transfer here
Example
NEAR_ENV=testnet near call bts.iconbridge-6.testnet transfer '{"coin_name": "btp-0x2.icon-ICX", "destination": "btp://0x2.icon/hx54d9ba221fbe8a475a8bf38c7d048675b5d7b85a", "amount": "10000000000000000000000000"}' --gas 300000000000000 --accountId dev-20211206025826-24100687319598
- Check locked Balance for the transfered amount here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet locked_balance_of '{"account_id": "dev-20211206025826-24100687319598", "coin_name": "btp-0x2.icon-ICX"}'
- Check usable balance amount to withdraw here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet balance_of '{"account_id": "dev-20211206025826-24100687319598", "coin_name": "btp-0x2.icon-ICX"}'
- Withdraw here
Example
NEAR_ENV=testnet near call bts.iconbridge-6.testnet withdraw '{"coin_name": "btp-0x2.icon-ICX", "amount":"10000000000000000000000000"}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId dev-20211206025826-24100687319598
- Check balance
Example
NEAR_ENV=testnet near view btp-icx.bts.iconbridge-6.testnet ft_balance_of '{"account_id": "dev-20211206025826-24100687319598"'
- Check refundable balance to reclaim here
Example
NEAR_ENV=testnet near view bts.iconbridge-6.testnet refundable_balance_of '{"account_id": "dev-20211206025826-24100687319598", "coin_name": "btp-0x2.icon-ICX"}'
- Reclaim
Example
NEAR_ENV=testnet near call bts.iconbridge-6.testnet reclaim '{"coin_name": "btp-0x2.icon-ICX", "amount":"10000000000000000000000000"}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId dev-20211206025826-24100687319598