Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@
"standard/tokens/jettons/comparison",
"standard/tokens/jettons/how-to-mint",
"standard/tokens/jettons/how-to-transfer",
"standard/tokens/jettons/how-to-get-wallet-data",
"standard/tokens/jettons/how-to-get-supply-data",
"standard/tokens/jettons/API",
"standard/tokens/jettons/mintless/overview",
"standard/tokens/jettons/mintless/how-to-deploy"

]
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/tonviewer/get-wallet-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions standard/tokens/jettons/how-to-get-wallet-data.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: "How to get Jetton wallet data"
sidebarTitle: "Get Jetton wallet data"
---

import { Image } from '/snippets/image.jsx';

To retrieve the Jetton wallet's account jetton amount, owner identification information, and other details related to a specific Jetton wallet contract,
use the `get_wallet_data()` [get method](/guidebook/first-smart-contract#6-2-reading-contract-data-with-get-methods) within the Jetton wallet contract.

This method returns the following data:

| Name | Type | Description |
| ----------------------- | ---------------- | ---------------------------------------------- |
| `balance` | `VarUInteger 16` | the amount of nano tokens on the Jetton wallet |
| `owner` | `MsgAddress` | the address of owner's regular wallet |
| `jetton_master_address` | `MsgAddress` | the address of the Jetton master contract |
| `jetton_wallet_code` | `Cell` | a code of the Jetton wallet |

You can call the `get_wallet_data()` method from your favorite IDE:

```javascript
import { Address, TonClient } from "@ton/ton"

async function main() {
const client = new TonClient({
endpoint: 'https://toncenter.com/api/v2/jsonRPC',
});

const JettonWalletAddress = Address
.parse('EQDmVdCZ2SALvyfCDVlPLr0hoPhUxgjNFtTAxemz9V_C5wbN');

const data = await client.runMethod(JettonWalletAddress,
'get_wallet_data');

const Stack = data.stack;

console.log("Balance in nano tokens: ", Stack.readNumber());

// wallet address
console.log("Owner: ", Stack.readAddress().toString({ bounceable: false }));

console.log("Jetton Master address: ", Stack.readAddress().toString());

// default boc encoding in viewers
console.log("Jetton Wallet code: ", Stack.readCell().toBoc().toString('hex'));
}

void main();
```

Or call it through a web service, such as [Tonviewer](https://tonviewer.com/EQDmVdCZ2SALvyfCDVlPLr0hoPhUxgjNFtTAxemz9V_C5wbN?section=method):

<Image
src="/resources/images/tonviewer/get-wallet-data.png"
darkSrc="/resources/images/tonviewer/get-wallet-data-dark.png"
/>

Finally, you can get this information using the [API](https://toncenter.com/api/v3/jetton/wallets).
3 changes: 2 additions & 1 deletion standard/tokens/jettons/mintless/how-to-deploy.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "How to Deploy Mintless Jetton"
title: "How to deploy mintless Jetton"
sidebarTitle: "Deploy mintless Jetton"
---

import { Aside } from "/snippets/aside.jsx"
Expand Down