Skip to content

Commit

Permalink
fix jetton sample (#742)
Browse files Browse the repository at this point in the history
#637

Co-authored-by: Aliaksandr Bahdanau <a.bahdanau@pixelplex.io>
  • Loading branch information
pixelplex and a-bahdanau authored Aug 30, 2024
1 parent 5ccce61 commit c4c9abf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 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

0 comments on commit c4c9abf

Please sign in to comment.