Skip to content

Commit 55c18c7

Browse files
authored
feat: how to get wallet data page (#596)
1 parent 01dbc1b commit 55c18c7

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@
310310
"standard/tokens/jettons/how-to-burning",
311311
"standard/tokens/jettons/how-to-find",
312312
"standard/tokens/jettons/how-to-transfer",
313+
"standard/tokens/jettons/how-to-get-wallet-data",
313314
"standard/tokens/jettons/how-to-get-supply-data",
314315
"standard/tokens/jettons/API",
315316
"standard/tokens/jettons/mintless/overview",
187 KB
Loading
182 KB
Loading
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "How to get Jetton wallet data"
3+
sidebarTitle: "Get Jetton wallet data"
4+
---
5+
6+
import { Image } from '/snippets/image.jsx';
7+
8+
To retrieve the Jetton wallet's account jetton amount, owner identification information, and other details related to a specific Jetton wallet contract,
9+
use the `get_wallet_data()` [get method](/guidebook/first-smart-contract#6-2-reading-contract-data-with-get-methods) within the Jetton wallet contract.
10+
11+
This method returns the following data:
12+
13+
| Name | Type | Description |
14+
| ----------------------- | ---------------- | ---------------------------------------------- |
15+
| `balance` | `VarUInteger 16` | the amount of nano tokens on the Jetton wallet |
16+
| `owner` | `MsgAddress` | the address of owner's regular wallet |
17+
| `jetton_master_address` | `MsgAddress` | the address of the Jetton master contract |
18+
| `jetton_wallet_code` | `Cell` | a code of the Jetton wallet |
19+
20+
You can call the `get_wallet_data()` method from your favorite IDE:
21+
22+
```javascript
23+
import { Address, TonClient } from "@ton/ton";
24+
25+
async function main() {
26+
const client = new TonClient({
27+
endpoint: "https://toncenter.com/api/v2/jsonRPC",
28+
});
29+
30+
const JettonwalletAddress = Address.parse(
31+
"EQDmVdCZ2SALvyfCDVlPLr0hoPhUxgjNFtTAxemz9V_C5wbN",
32+
);
33+
34+
const data = await client.runMethod(JettonwalletAddress, "get_wallet_data");
35+
36+
const Stack = data.stack;
37+
38+
console.log("Balance in nano tokens: ", Stack.readNumber());
39+
40+
// wallet address
41+
console.log("Owner: ", Stack.readAddress().toString({ bounceable: false }));
42+
43+
console.log("Jetton Master address: ", Stack.readAddress().toString());
44+
45+
// default boc encoding in viewers
46+
console.log("Jetton Wallet code: ", Stack.readCell().toBoc().toString('hex'));
47+
}
48+
49+
void main();
50+
```
51+
52+
Or call it through a web service, such as [Tonviewer](https://tonviewer.com/EQDmVdCZ2SALvyfCDVlPLr0hoPhUxgjNFtTAxemz9V_C5wbN?section=method):
53+
54+
<Image
55+
src="/resources/images/tonviewer/get-wallet-data.png"
56+
darkSrc="/resources/images/tonviewer/get-wallet-data-dark.png"
57+
/>
58+
59+
Finally, you can get this information using the [API](https://toncenter.com/api/v3/jetton/wallets).

standard/tokens/jettons/mintless/how-to-deploy.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: "How to Deploy Mintless Jetton"
2+
title: "How to deploy mintless Jetton"
3+
sidebarTitle: "Deploy mintless Jetton"
34
---
45

56
import { Aside } from "/snippets/aside.jsx"

0 commit comments

Comments
 (0)