Mint tgUSD
This guide demonstrates how to use USDT to mint tgUSD
Step 1: Import modules & Initialize Engine Contract
import { Address, Cell, TonClient4 } from '@ton/ton';
import { tgUSDEngine } from "@torch-finance/tgusd-sdk";
const tonClient = new TonClient4({
endpoint: 'https://mainnet-v4.tonhubapi.com',
});
// Engine Contract
const engineAddress = Address.parse("EQBugHw3qUX71i5_mbUMYUAUnxdy513v5zKeLZdVhCp1J8xI")
const engine = provider.open(tgUSDEngine.createFromAddress(engineAddress));Step 2: Request Mint Order Payload via API
HTTP Request
POST /mint
Request Parameters
Parameter
Type
Required
Description
userAddress
String
β Yes
minter address
collateralAssetID
String
β Yes
Asset ID of the collateral (must be generated using Asset.ID from Torch SDK)
collateralAmount
String
β Yes
The collateral amount needed for this minting process (ensure decimals are included)
Response Fields
Field
Type
Description
signature
String
Hex-encoded signature for on-chain verification
payload
String
Hex-encoded serialized payload
tgUSDAmount
String
The amount of tgUSD to be minted
collateralAmount
String
collateralAmount submitted by the minter
Example
The returned payload will expire after 300 seconds.
Step 3: Build Mint Payload
Last updated