Browse Source

deployment-script-fix

master
AlexG 2 years ago
parent
commit
2e1c2ee8f3
  1. 20
      sources/jetton.deploy.ts

20
sources/jetton.deploy.ts

@ -1,4 +1,4 @@
import { beginCell, contractAddress, toNano, TonClient, TonClient4, Address, WalletContractV4, internal, fromNano} from "ton";
import { beginCell, contractAddress, toNano, TonClient, TonClient4, Address, WalletContractV4, internal, fromNano, Cell} from "ton";
import {mnemonicToPrivateKey} from "ton-crypto";
import {buildOnchainMetadata} from "./utils/jetton-helpers";
import {SampleJetton} from "./output/jetton_SampleJetton";
@ -18,7 +18,6 @@ import {SampleJetton} from "./output/jetton_SampleJetton";
})
// Insert your test wallet's 24 words, make sure you have some test Toncoins on its balance. Every deployment spent 0.5 test toncoin.
let mnemonics = "multiply voice predict admit hockey fringe flat bike napkin child quote piano year cloud bundle lunch....";
// read more about wallet apps https://ton.org/docs/participate/wallets/apps#tonhub-test-environment
let keyPair = await mnemonicToPrivateKey(mnemonics.split(" "));
@ -39,8 +38,8 @@ import {SampleJetton} from "./output/jetton_SampleJetton";
const jettonParams = {
name: "TactJet",
description: "My jetton",
image: "https://www.linkpicture.com/q/download_183.png" // Image url
description: "Test tact contract - 4",
image: "https://ipfs.io/ipfs/QmbPZjC1tuP6ickCCBtoTCQ9gc3RpkbKx7C1LMYQdcLwti" // Image url
};
// Owner should usually be the deploying wallet's address.
@ -52,14 +51,23 @@ import {SampleJetton} from "./output/jetton_SampleJetton";
// Compute init data for deployment
let init = await SampleJetton.init(owner, content);
let destination_address = contractAddress(workchain, init);
let deployAmount = toNano('0.5');
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 contract.getSeqno();
//TL-B mint#01fb345b amount:int257 = Mint
let msg = beginCell().storeBuffer(Buffer.from("01fb345b", "hex")).storeInt(amount, 257).endCell();
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 contract.sendTransfer({
seqno,
secretKey,
@ -70,7 +78,7 @@ import {SampleJetton} from "./output/jetton_SampleJetton";
code : init.code,
data : init.data
},
body: 'Deploy'
body: msg
})]
});
console.log('======deployment message sent to ', destination_address, ' ======');

Loading…
Cancel
Save