From 919673c3c66ea48a581f392b75b3a077250ad842 Mon Sep 17 00:00:00 2001 From: Shreyas K S Date: Tue, 13 Sep 2022 15:28:02 +0530 Subject: [PATCH 1/7] add commands for interacting with bts using near cli --- doc/near/bts.md | 38 ++++++++++++++++++++++++++++++++++++++ doc/near/testnet.md | 10 ++++++++++ 2 files changed, 48 insertions(+) create mode 100644 doc/near/bts.md create mode 100644 doc/near/testnet.md diff --git a/doc/near/bts.md b/doc/near/bts.md new file mode 100644 index 000000000..6233faaad --- /dev/null +++ b/doc/near/bts.md @@ -0,0 +1,38 @@ +## Requirements + +* **NEAR CLI** + The NEAR [Command Line Interface (CLI)](https://github.com/near/near-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](https://github.com/near/near-api-js) + + + #### Installation + ```npm install -g near-cli``` +* **NEAR Wallet** + - Testnet: https://wallet.testnet.near.org/ + - Mainnet: https://wallet.near.org/ + +* **Authorize CLI** + ```near login``` +## API +*Path to BTS Rust ReadMe* + +## Usage + +**Transfer NEAR** +- Deposit +```NEAR_ENV=testnet near call deposit --amount --accountId ``` +- Transfer +```NEAR_ENV=testnet near call transfer '{"coin_name": "", "destination": "btp:///
", "amount": ""}' --gas 300000000000000 --accountId ``` + +**Receiving Cross-Chain Native Coins** +- Withdraw +```NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId ``` + +**Reclaiming Failed Transfer** +- Reclaim +```NEAR_ENV=testnet near call reclaim '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId ``` + +## Environment + +- [Testnet](./testnet.md) + + diff --git a/doc/near/testnet.md b/doc/near/testnet.md new file mode 100644 index 000000000..b6df28740 --- /dev/null +++ b/doc/near/testnet.md @@ -0,0 +1,10 @@ +## Testnet + +### BTS +bts.iconbridge.testnet +### Registered Tokens + +| Coin/Token|Coin Name| Network| Denomination| NEP141 Contract | +|:---------|:--------|:--------|:------------|:----------| +| NEAR | btp-0x1.near-NEAR | 0x1.near | 24 | N/A | +| ICX | btp-0x2.icon-ICX | 0x2.icon | 18 | btp-icx.bts.iconbridge.testnet | From 25756f21c4f2d8a74ff370a0b323d2990046f09c Mon Sep 17 00:00:00 2001 From: Shreyas K S Date: Tue, 13 Sep 2022 15:32:57 +0530 Subject: [PATCH 2/7] fix syntax --- doc/near/bts.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/near/bts.md b/doc/near/bts.md index 6233faaad..3f078893d 100644 --- a/doc/near/bts.md +++ b/doc/near/bts.md @@ -19,17 +19,25 @@ **Transfer NEAR** - Deposit -```NEAR_ENV=testnet near call deposit --amount --accountId ``` +```console +NEAR_ENV=testnet near call deposit --amount --accountId +``` - Transfer -```NEAR_ENV=testnet near call transfer '{"coin_name": "", "destination": "btp:///
", "amount": ""}' --gas 300000000000000 --accountId ``` +```console +NEAR_ENV=testnet near call transfer '{"coin_name": "", "destination": "btp:///
", "amount": ""}' --gas 300000000000000 --accountId +``` **Receiving Cross-Chain Native Coins** - Withdraw -```NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId ``` +```console +NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId +``` **Reclaiming Failed Transfer** - Reclaim -```NEAR_ENV=testnet near call reclaim '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId ``` +```console +NEAR_ENV=testnet near call reclaim '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId +``` ## Environment From f0a8995d97f7bf2012f1e1053c601ac52f2ae9ed Mon Sep 17 00:00:00 2001 From: Shreyas K S Date: Tue, 13 Sep 2022 15:34:26 +0530 Subject: [PATCH 3/7] fix syntax --- doc/near/bts.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/near/bts.md b/doc/near/bts.md index 3f078893d..026f9f6a6 100644 --- a/doc/near/bts.md +++ b/doc/near/bts.md @@ -5,13 +5,17 @@ #### Installation - ```npm install -g near-cli``` + ```console + npm install -g near-cli + ``` * **NEAR Wallet** - Testnet: https://wallet.testnet.near.org/ - Mainnet: https://wallet.near.org/ * **Authorize CLI** - ```near login``` + ```console + near login + ``` ## API *Path to BTS Rust ReadMe* From 0d1c41c3ecbe8c214e25d893139868cb4a6bd16a Mon Sep 17 00:00:00 2001 From: Muhammed Irfan Date: Mon, 19 Sep 2022 17:01:37 +0530 Subject: [PATCH 4/7] Update bts.md --- doc/near/bts.md | 129 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 117 insertions(+), 12 deletions(-) diff --git a/doc/near/bts.md b/doc/near/bts.md index 026f9f6a6..3aea36790 100644 --- a/doc/near/bts.md +++ b/doc/near/bts.md @@ -17,30 +17,135 @@ near login ``` ## API -*Path to BTS Rust ReadMe* -## Usage +### Balance + +#### Usable Balance +**Method** +- balance_of + +| Parameters | Type | Info | +|:---------|:--------|:--------| +| account_id | string | should be a valid account id | +| coin_name | string | | + +**CLI Command** +```console +NEAR_ENV=testnet near view balance_of '{"account_id": "", "coin_name": ""}' +``` + +#### Refundable Balance +**Method** +- refundable_balance_of + +| Parameters | Type | Info | +|:---------|:--------|:--------| +| account_id | string | should be a valid account id | +| coin_name | string | | + +**CLI Command** +```console +NEAR_ENV=testnet near view refundable_balance_of '{"account_id": "", "coin_name": ""}' +``` + +#### Locked Balance +**Method** +- locked_balance_of +| Parameters | Type | Info | +|:---------|:--------|:--------| +| account_id | string | should be a valid account id | +| coin_name | string | | + +**CLI Command** +```console +NEAR_ENV=testnet near view locked_balance_of '{"account_id": "", "coin_name": ""}' +``` + +### Deposit + +#### Deposit NEAR to BTS +**Method** +- deposit -**Transfer NEAR** -- Deposit +**CLI Command** ```console NEAR_ENV=testnet near call deposit --amount --accountId ``` -- Transfer +#### Deposit Cross-Chain Native Coin to BTS +**Method** +- ft_transfer_call +| Parameters | Type | Info | +|:---------|:--------|:--------| +| receiver_id | string | should be a valid account id | +| amount | string | | +| msg | string | | + +**CLI Command** +```console +NEAR_ENV=testnet near call ft_transfer_call '{"receiver_id": "", "amount": "", "msg": ""}' --accountId --amount <1 yoctoNEAR in highest Denomination ie 0.000000000000000000000001> +``` + +### Withdraw +**Method** +- withdraw +| Parameters | Type | Info | +|:---------|:--------|:--------| +| coin_name | string | | +| amount | string | | + +**CLI Command** +```console +NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount":""}' --amount <1 yoctoNEAR in highest Denomination ie 0.000000000000000000000001> --gas 300000000000000 --accountId +``` + +### Transfer +**Method** +- transfer +| Parameters | Type | Info | +|:---------|:--------|:--------| +| coin_name | string | | +| destination | string | valid btp address | +| amount | string | | + +**CLI Command** ```console -NEAR_ENV=testnet near call transfer '{"coin_name": "", "destination": "btp:///
", "amount": ""}' --gas 300000000000000 --accountId +NEAR_ENV=testnet near call transfer '{"coin_name": "", "destination": "btp:///
", "amount": ""}' --gas 300000000000000 --accountId ``` -**Receiving Cross-Chain Native Coins** -- Withdraw + +## Usage + +### Transfer NEAR to Cross-Chain +1. Deposit NEAR to BTS [here](#deposit-near-to-bts) +2. Transfer [here](#transfer) +3. Check locked balance for the transfered amount [here](#balance) + +### Receiving NEAR from Cross-Chain +1. Check usable balance amount to withdraw [here](#balance) +2. Withdraw [here](#withdraw) +3. Check balance +```console +NEAR_ENV=testnet near state +``` + +### Transfer Cross-Chain Native Coins to Cross-Chain +1. Deposit Cross-Chain Native Coin to BTS [here](#deposit-cross-chain-native-coin-to-bts) +2. Transfer [here](#transfer) +3. Check locked Balance for the transfered amount [here](#locked-balance) + +### Receiving Cross-Chain from Cross-Chain +1. Check usable balance amount to withdraw [here](#usable-balance) +2. Withdraw [here](#withdraw) +3. Check balance ```console -NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId +NEAR_ENV=testnet near view ft_balance_of '{"account_id": ""' ``` -**Reclaiming Failed Transfer** -- Reclaim +### Reclaiming Failed Transfer +1. Check refundable balance to reclaim [here](#refundable-balance) +2. Reclaim ```console -NEAR_ENV=testnet near call reclaim '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId +NEAR_ENV=testnet near call reclaim '{"coin_name": "", "amount":""}' --amount 0.000000000000000000000001 --gas 300000000000000 --accountId ``` ## Environment From 85cbab8d46d4d1f13d493603c655eee58a7b804d Mon Sep 17 00:00:00 2001 From: Muhammed Irfan Date: Mon, 19 Sep 2022 17:11:33 +0530 Subject: [PATCH 5/7] fix formating --- doc/near/bts.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/near/bts.md b/doc/near/bts.md index 3aea36790..684feac82 100644 --- a/doc/near/bts.md +++ b/doc/near/bts.md @@ -51,6 +51,7 @@ NEAR_ENV=testnet near view refundable_balance_of '{"account_id": " deposit --amount --accountId < #### Deposit Cross-Chain Native Coin to BTS **Method** - ft_transfer_call + | Parameters | Type | Info | |:---------|:--------|:--------| | receiver_id | string | should be a valid account id | @@ -88,6 +90,7 @@ NEAR_ENV=testnet near call ft_transfer_call '{"receiver_id": " ### Withdraw **Method** - withdraw + | Parameters | Type | Info | |:---------|:--------|:--------| | coin_name | string | | @@ -101,6 +104,7 @@ NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount" ### Transfer **Method** - transfer + | Parameters | Type | Info | |:---------|:--------|:--------| | coin_name | string | | From 10c8f0f6274659d1279eff57aef42676dfee1d73 Mon Sep 17 00:00:00 2001 From: Muhammed Irfan Date: Fri, 7 Oct 2022 21:43:27 +0530 Subject: [PATCH 6/7] add get fee method --- doc/near/bts.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/near/bts.md b/doc/near/bts.md index 684feac82..a2de9b2b3 100644 --- a/doc/near/bts.md +++ b/doc/near/bts.md @@ -101,6 +101,22 @@ NEAR_ENV=testnet near call ft_transfer_call '{"receiver_id": " NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount":""}' --amount <1 yoctoNEAR in highest Denomination ie 0.000000000000000000000001> --gas 300000000000000 --accountId ``` +### Fee + +#### Get Fee +**Method** +- get_fee + +| Parameters | Type | Info | +|:---------|:--------|:--------| +| coin_name | string | | +| amount | string | | + +**CLI Command** +```console +NEAR_ENV=testnet near view get_fee '{"coin_name": "", "amount": ""}' +``` + ### Transfer **Method** - transfer @@ -121,8 +137,9 @@ NEAR_ENV=testnet near call transfer '{"coin_name": "", "destina ### Transfer NEAR to Cross-Chain 1. Deposit NEAR to BTS [here](#deposit-near-to-bts) -2. Transfer [here](#transfer) -3. Check locked balance for the transfered amount [here](#balance) +2. Query Transfer Fee [here] (#get-fee) +3. Transfer [here](#transfer) +4. Check locked balance for the transfered amount [here](#balance) ### Receiving NEAR from Cross-Chain 1. Check usable balance amount to withdraw [here](#balance) @@ -134,8 +151,9 @@ NEAR_ENV=testnet near state ### Transfer Cross-Chain Native Coins to Cross-Chain 1. Deposit Cross-Chain Native Coin to BTS [here](#deposit-cross-chain-native-coin-to-bts) -2. Transfer [here](#transfer) -3. Check locked Balance for the transfered amount [here](#locked-balance) +2. Query Transfer Fee [here] (#get-fee) +3. Transfer [here](#transfer) +4. Check locked Balance for the transfered amount [here](#locked-balance) ### Receiving Cross-Chain from Cross-Chain 1. Check usable balance amount to withdraw [here](#usable-balance) From 06f1c54ed86b7d12b52ed7c207542df64b3125ae Mon Sep 17 00:00:00 2001 From: Muhammed Irfan Date: Thu, 20 Oct 2022 01:10:25 +0530 Subject: [PATCH 7/7] add description --- docs/api/near/bts.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/api/near/bts.md b/docs/api/near/bts.md index e682efc37..9f7958979 100644 --- a/docs/api/near/bts.md +++ b/docs/api/near/bts.md @@ -26,8 +26,8 @@ | Parameters | Type | Info | |:---------|:--------|:--------| -| account_id | string | should be a valid account id | -| coin_name | string | | +| account_id | string | Valid near account id | +| coin_name | string | Name of coin | **CLI Command** ```console @@ -40,8 +40,8 @@ NEAR_ENV=testnet near view balance_of '{"account_id": "", "coi | Parameters | Type | Info | |:---------|:--------|:--------| -| account_id | string | should be a valid account id | -| coin_name | string | | +| account_id | string | Valid near account id | +| coin_name | string | Name of coin | **CLI Command** ```console @@ -54,8 +54,8 @@ NEAR_ENV=testnet near view refundable_balance_of '{"account_id": " deposit --amount --accountId < | Parameters | Type | Info | |:---------|:--------|:--------| -| receiver_id | string | should be a valid account id | -| amount | string | | +| receiver_id | string | Valid near account id | +| amount | string | Amount to deposit | | msg | string | | **CLI Command** @@ -93,8 +93,8 @@ NEAR_ENV=testnet near call ft_transfer_call '{"receiver_id": " | Parameters | Type | Info | |:---------|:--------|:--------| -| coin_name | string | | -| amount | string | | +| coin_name | string | Name of coin to withdraw | +| amount | string | Amount to withdraw | **CLI Command** ```console @@ -109,8 +109,8 @@ NEAR_ENV=testnet near call withdraw '{"coin_name": "", "amount" | Parameters | Type | Info | |:---------|:--------|:--------| -| coin_name | string | | -| amount | string | | +| coin_name | string | Name of coin to transfer | +| amount | string | Amount to transfer | **CLI Command** ```console @@ -123,9 +123,9 @@ NEAR_ENV=testnet near view get_fee '{"coin_name": "", "amount": | Parameters | Type | Info | |:---------|:--------|:--------| -| coin_name | string | | -| destination | string | valid btp address | -| amount | string | | +| coin_name | string | Name of coin to transfer | +| destination | string | BTP Address of destination | +| amount | string | Amount to transfer | **CLI Command** ```console