Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix jetton sample #742

Merged
merged 1 commit into from
Aug 30, 2024
Merged
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
13 changes: 7 additions & 6 deletions docs/develop/dapps/asset-processing/jettons.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,21 @@ the `Jetton master contract` provides the get method `get_wallet_address(slice o
<TabItem value="js" label="js">

```js
import TonWeb from "tonweb";
import TonWeb from 'tonweb';
const tonweb = new TonWeb();
const jettonMinter = new TonWeb.token.jetton.JettonMinter(tonweb.provider, {address: "<JETTON_MASTER_ADDRESS>"});
const address = await jettonMinter.getJettonWalletAddress(new TonWeb.utils.Address("<OWNER_WALLET_ADDRESS>"));
const jettonMinter = new TonWeb.token.jetton.JettonMinter(tonweb.provider, { address: '<JETTON_MASTER_ADDRESS>' });
const jettonWalletAddress = await jettonMinter.getJettonWalletAddress(new TonWeb.utils.Address('<OWNER_WALLET_ADDRESS>'));

// It is important to always check that wallet indeed is attributed to desired Jetton Master:
const jettonWallet = new TonWeb.token.jetton.JettonWallet(tonweb.provider, {
address: jettonWalletAddress
});
const jettonData = await jettonWallet.getData();
if (jettonData.jettonMinterAddress.toString(false) !== new TonWeb.utils.Address(info.address).toString(false)) {
if (jettonData.jettonMinterAddress.toString(false) !== jettonMinter.address.toString(false)) {
throw new Error('jetton minter address from jetton wallet doesnt match config');
}

console.log('Jetton wallet address:', address.toString(true, true, true));
console.log('Jetton wallet address:', jettonWalletAddress.toString(true, true, true));
```

</TabItem>
Expand Down Expand Up @@ -1199,4 +1200,4 @@ You can find a list of SDKs for various languages (js, python, golang, C#, Rust,

* [Payments Processing](/develop/dapps/asset-processing/)
* [NFT processing on TON](/develop/dapps/asset-processing/nfts)
* [Metadata parsing on TON](/develop/dapps/asset-processing/metadata)
* [Metadata parsing on TON](/develop/dapps/asset-processing/metadata)
Loading