-
Notifications
You must be signed in to change notification settings - Fork 39
/
contract.deploy.ts
37 lines (33 loc) · 1.61 KB
/
contract.deploy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as fs from "fs";
import * as path from "path";
import { Address, contractAddress } from "@ton/core";
import { SampleTactContract } from "./output/sample_SampleTactContract";
import { prepareTactDeployment } from "@tact-lang/deployer";
(async () => {
// Parameters
let testnet = true;
let packageName = "sample_SampleTactContract.pkg";
let owner = Address.parse("kQBM7QssP28PhrctDOyd47_zpFfDiQvv5V9iXizNopb1d2LB");
let init = await SampleTactContract.init(owner);
// Load required data
let address = contractAddress(0, init);
let data = init.data.toBoc();
let pkg = fs.readFileSync(path.resolve(__dirname, "output", packageName));
// Prepareing
console.log("Uploading package...");
let prepare = await prepareTactDeployment({ pkg, data, testnet });
// Deploying
console.log("============================================================================================");
console.log("Contract Address");
console.log("============================================================================================");
console.log();
console.log(address.toString({ testOnly: testnet }));
console.log();
console.log("============================================================================================");
console.log("Please, follow deployment link");
console.log("============================================================================================");
console.log();
console.log(prepare);
console.log();
console.log("============================================================================================");
})();