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.

49 lines
1.8 KiB

import { beginCell, contractAddress, toNano, TonClient, TonClient4, Address, WalletContractV4, internal, fromNano, Cell} from "ton";
2 years ago
import {mnemonicToPrivateKey} from "ton-crypto";
import {buildOnchainMetadata} from "./utils/helpers";
2 years ago
import {TONB} from "./output/jetton_TONB";
import {client, wallet_data, workchain, owner, jettonParams, default_content} from "./utils/config";
2 years ago
2 years ago
2 years ago
(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();
2 years ago
// Get deployment wallet balance
let balance: bigint = await my_wallet.getBalance();
2 years ago
// Compute init data for deployment
let init = await TONB.init(owner, default_content);
2 years ago
let destination_address = contractAddress(workchain, init);
2 years ago
let deployAmount = toNano('0.5');
let supply = 500;
let amount = BigInt(supply * Math.pow(10, 9));
2 years ago
2 years ago
// send a message on new address contract to deploy it
let seqno: number = await my_wallet.getSeqno();
2 years ago
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({
2 years ago
seqno,
secretKey,
messages: [internal({
value: deployAmount,
to: destination_address,
init: {
code : init.code,
data : init.data
}
2 years ago
})]
});
console.log('======deployment message sent to ', destination_address, ' ======');
})();