blueprint.config.ts
file and paste your Chainstack endpoint. In this tutorial, we work with the testnet:
contracts
folder. We need jetton-minter-discoverable.fc
, jetton-wallet.fc
and jetton-utils.fc
, discovery-params.fc
, op-codes.fc
, params.fc
. Let’s briefly walk through them.
The minter contract allows the admin (the contract owner) to manage the minting process and total tupply. Additionally, it implements the TEP89 feature for Jetton wallet discovery, which simplifies obtaining a Jetton wallet address by other smart contracts. Previously, this was challenging because contracts couldn’t use get methods on other contracts directly.
The wallet contract manages Jetton token transfers, storage, and burning for a specific user. It tracks the wallet balance, owner’s address, and Jetton master details, updating the data after transfers or burns.
The jetton-utils.fc
file contains functions that help in creating and managing a Jetton wallet, making sure that all the necessary data is packed and that the correct address for the wallet is calculated.
The discovery-params.fc
, op-code.fc
files contain the standard operational codes for the minter and wallet contracts. Additionally, the function is_resolvable
checks if a given address is within the same workchain as the contract. It extracts the workchain ID from the address and compares it with the current contract’s workchain ID. The params.fc
also contains the same check that is used by the wallet contract.
Before proceeding, please make sure your contracts include required imports.
jetton-minter-discoverable.fc
jetton-wallet.fc
jetton-utils.fc
params.fc
wrappers
create or update the compile files:
JettonMinter.compile.ts
JettonWallet.compile.ts
build
:
wrappers
folder contains such interface classes for all contracts (implementing Contract
from @ton/core
), including serialization primitives, getter wrappers and compilation functions.
Let’s copy the wrappers, JettonMinter.ts
, JettonWallet.ts
, JettonConstants.ts
and ui-utils.ts
, from the existing implementation to our project’s folder wrappers
. You can also copy the shortened versions of the same files from our repository. Additionally, ui-utils.ts
has a few adjustments there.
scripts
folder, create deployJettonMinter.ts
with the following code: