From 69dfb37dc1169a1466297b61ea5d7acd7b2ac901 Mon Sep 17 00:00:00 2001 From: ghimire007 <69514062+ghimire007@users.noreply.github.com> Date: Tue, 5 Sep 2023 09:50:50 +1000 Subject: [PATCH] Update token-tx.md --- docs/sdk/rust/promises/token-tx.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/sdk/rust/promises/token-tx.md b/docs/sdk/rust/promises/token-tx.md index ac4fc193a3f..4f3f74b463e 100644 --- a/docs/sdk/rust/promises/token-tx.md +++ b/docs/sdk/rust/promises/token-tx.md @@ -2,6 +2,9 @@ sidebar_position: 2 --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # Sending $NEAR You might want to send tokens from a contract for many reasons. @@ -47,7 +50,29 @@ Most of this is boilerplate you're probably familiar with by now – imports, s * Returning `Promise`: This allows NEAR Explorer, near-cli, near-api-js, and other tooling to correctly determine if a whole chain of transactions is successful. If your function does not return `Promise`, tools like near-cli will return immediately after your function call. And then even if the `transfer` fails, your function call will be considered successful. You can see an example of this behavior [here](https://github.com/near-examples/xcc-advanced). -Using near-cli, someone could invoke this function with a call like: +Using near-cli or near-cli-rs, someone could invoke this function with a call like: + + + + + +```bash +near call pay '{"amount": "1000000000000000000000000", "to": "example.near"}' --accountId benjiman.near +``` + + + + + + +```bash +near contract call-function as-transaction pay json-args '{"amount": "1000000000000000000000000", "to": "example.near"}' prepaid-gas '30 TeraGas' attached-deposit '0 NEAR' sign-as benjiman.near network-config testnet sign-with-keychain send +``` + + + + + + - near call $CONTRACT pay '{"amount": "1000000000000000000000000", "to": "example.near"}' --accountId benjiman.near