You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
1.7 KiB

import { beginCell, contractAddress, toNano, TonClient, TonClient4, Address, WalletContractV4, internal, fromNano, Cell} from "ton";
import {Foundation} from "./output/jetton_Foundation";
import {client, staking_addr, wallet_data, workchain} from "./utils/config";
import { createDistribution, createAddressList, 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 Foundation.init(
createDistribution([my_wallet.address], [100n]),
createAddressList([my_wallet.address]),
contractAddress(workchain, await getTONBState(undefined, staking_addr)));
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, ' ======');
})();