You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,7 +104,7 @@ The above output demonstrates that the `transfer-coin` example executes the foll
96
104
* The funding and creation of Alice's account from a faucet.
97
105
* The creation of Bob's account from a faucet.
98
106
* The transferring of 1000 coins from Alice to Bob.
99
-
* The 4 coins of gas paid for by Alice to make that tansfer.
107
+
* The 4 coins of gas paid for by Alice to make that transfer.
100
108
* Another transfer of 1000 coins from Alice to Bob.
101
109
* The additional 4 coins of gas paid for by Alice to make that transfer.
102
110
@@ -106,9 +114,26 @@ Next, see below a walk-through of the Python SDK functions that are used to acco
106
114
107
115
The `transfer-coin` example code uses helper functions to interact with the [REST API][rest_spec]. This section reviews each of the calls and gives insights into functionality.
108
116
109
-
:::tip See the example full listing
110
-
See the [`transfer-coin`](https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/python/sdk/examples/transfer-coin.py) for the complete code as you follow the below steps.
117
+
<TabsgroupId="sdk-examples">
118
+
<TabItemvalue="typescript"label="Typescript">
119
+
120
+
:::tip See the full example
121
+
See [`transfer-coin`](https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/typescript/sdk/examples/typescript/transfer_coin.ts) for the complete code as you follow the below steps.
111
122
:::
123
+
</TabItem>
124
+
<TabItemvalue="python"label="Python">
125
+
126
+
:::tip See the full example
127
+
See [`transfer-coin`](https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/python/sdk/examples/transfer-coin.py) for the complete code as you follow the below steps.
128
+
:::
129
+
</TabItem>
130
+
<TabItemvalue="rust"label="Rust">
131
+
132
+
:::tip See the full example
133
+
See [`transfer-coin`](https://github.com/aptos-labs/aptos-core/blob/main/sdk/examples/transfer-coin.rs) for the complete code as you follow the below steps.
134
+
:::
135
+
</TabItem>
136
+
</Tabs>
112
137
113
138
### Step 4.1: Initializing the Clients
114
139
@@ -148,15 +173,27 @@ The [`common.py`](https://github.com/aptos-labs/aptos-core/tree/main/ecosystem/p
Behind the scenes the Rust SDK generates, signs, and submits a transaction:
350
+
```rust
351
+
:!:static/sdks/rust/src/coin_client.rs section_1
352
+
```
353
+
354
+
Breaking the above down into pieces:
355
+
1. First, we fetch the chain ID, necessary for building the transaction payload.
356
+
1.`transfer` internally is a `EntryFunction` in the [Coin Move module](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/coin.move#L412), i.e. an entry function in Move that is directly callable.
357
+
1. The Move function is stored on the coin module: `0x1::coin`.
358
+
1. Because the Coin module can be used by other coins, the transfer must explicitly use a `TypeTag` to define which coin to transfer.
359
+
1. The transaction arguments, such as `to_account` and `amount`, must be encoded as BCS to use with the `TransactionBuilder`.
360
+
361
+
296
362
</TabItem>
297
363
</Tabs>
298
364
@@ -319,11 +385,16 @@ The transaction hash can be used to query the status of a transaction:
319
385
</TabItem>
320
386
<TabItemvalue="rust"label="Rust">
321
387
322
-
In progress.
388
+
The transaction hash can be used to query the status of a transaction:
0 commit comments