Skip to content

Commit

Permalink
fix jetton sample
Browse files Browse the repository at this point in the history
  • Loading branch information
a-bahdanau committed Aug 27, 2024
1 parent aef1673 commit a933a10
Showing 1 changed file with 7 additions and 6 deletions.
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)

0 comments on commit a933a10

Please sign in to comment.