Skip to content

Commit

Permalink
Merge pull request #7 from ghimire007/patch-9
Browse files Browse the repository at this point in the history
Update token-tx.md
  • Loading branch information
ghimire007 authored Sep 3, 2023
2 parents 6c9e2fa + cb39986 commit 5cd20d3
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions docs/sdk/js/promises/token-tx.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ Most of this is boilerplate you're probably familiar with by now – imports, s

- Returning the `NearPromise`: 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.

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:

<Tabs className="language-tabs" groupId="code-tabs">
<TabItem value="Near-CLI">


```bash
near call <contract> pay '{"amount": "1000000000000000000000000", "to": "example.near"}' --accountId benjiman.near
```



</TabItem>
<TabItem value="Near-CLI-rs">

```bash
near contract call-function as-transaction <contract> 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
```



</TabItem>
</Tabs>

near call $CONTRACT pay '{"amount": "1000000000000000000000000", "to": "example.near"}' --accountId root.near

0 comments on commit 5cd20d3

Please sign in to comment.