Skip to content

Commit 0709f96

Browse files
committed
add ts examples
1 parent 78b12fb commit 0709f96

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/pages/developers/chains/ton.mdx

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ The `evm_recipient` specifies the address on ZetaChain that will receive the
2222
deposited TON. This can be either an externally-owned account (EOA) or a
2323
universal app address.
2424

25+
Here's an example of how to construct the deposit message in TypeScript:
26+
27+
```typescript
28+
const opDeposit = 101;
29+
const body = beginCell().storeUint(opDeposit, 32).storeUint(0, 64).storeUint(zevmRecipient, 160).endCell();
30+
```
31+
2532
After the deposit is processed, the receiver receives the [ZRC-20
2633
version](/developers/tokens/zrc20) of the deposited TON.
2734

@@ -44,5 +51,18 @@ The `evm_recipient` must be the address of a universal app contract.
4451
The `call_data` cell contains the payload that will be passed to the `onCall`
4552
function of the universal app contract.
4653

54+
Here's an example of how to construct the deposit-and-call message in
55+
TypeScript:
56+
57+
```typescript
58+
const opDepositAndCall = 102;
59+
const body = beginCell()
60+
.storeUint(opDepositAndCall, 32)
61+
.storeUint(0, 64)
62+
.storeUint(zevmRecipient, 160)
63+
.storeRef(callDataCell) // callDataCell should be a cell containing the payload
64+
.endCell();
65+
```
66+
4767
After the cross-chain transaction is processed, the `onCall` function of the
4868
universal app contract is executed.

0 commit comments

Comments
 (0)