|
|
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"; |
|
|
import { getTONBState } from "./utils/interactions"; |
|
|
|
|
|
|
|
|
(async () => { |
|
|
|
|
|
//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 getTONBState(); |
|
|
let destination_address = contractAddress(workchain, init); |
|
|
|
|
|
|
|
|
let deployAmount = toNano('0.2'); |
|
|
|
|
|
|
|
|
// 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'); |
|
|
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, ' ======'); |
|
|
})();
|
|
|
|