|
|
import { beginCell, contractAddress, toNano, TonClient, TonClient4, Address, WalletContractV4, internal, fromNano, Cell} from "ton"; |
|
|
import {mnemonicToPrivateKey} from "ton-crypto"; |
|
|
import {buildOnchainMetadata} from "./utils/helpers"; |
|
|
import {TONB} from "./output/jetton_TONB"; |
|
|
import {client, wallet_data, workchain, owner, jettonParams, default_content} from "./utils/config"; |
|
|
|
|
|
|
|
|
(async () => { //need changes for jetton |
|
|
|
|
|
//create client for testnet sandboxv4 API - alternative endpoint |
|
|
const client4 = new TonClient4({ |
|
|
endpoint: "https://sandbox-v4.tonhubapi.com" |
|
|
}) |
|
|
let {my_wallet, secretKey} = await wallet_data(); |
|
|
|
|
|
// Get deployment wallet balance |
|
|
let balance: bigint = await my_wallet.getBalance(); |
|
|
// Compute init data for deployment |
|
|
let init = await TONB.init(owner, default_content); |
|
|
let destination_address = contractAddress(workchain, init); |
|
|
|
|
|
|
|
|
let deployAmount = toNano('0.2'); |
|
|
let supply = 500; |
|
|
let amount = BigInt(supply * Math.pow(10, 9)); |
|
|
|
|
|
|
|
|
// send a message on new address contract to deploy it |
|
|
let seqno: number = await my_wallet.getSeqno(); |
|
|
|
|
|
|
|
|
console.log('🛠️Preparing new outgoing massage from deployment wallet. Seqno = ', seqno); |
|
|
console.log('Current deployment wallet balance = ', fromNano(balance).toString(), '💎TON'); |
|
|
console.log('Totally supply for deployed Token = ', supply, ', amount = ', amount.toString()); |
|
|
await my_wallet.sendTransfer({ |
|
|
seqno, |
|
|
secretKey, |
|
|
messages: [internal({ |
|
|
value: deployAmount, |
|
|
to: destination_address, |
|
|
init: { |
|
|
code : init.code, |
|
|
data : init.data |
|
|
} |
|
|
})] |
|
|
}); |
|
|
console.log('======deployment message sent to ', destination_address, ' ======'); |
|
|
})();
|
|
|
|