|
|
|
import * as main from "../contracts/main";
|
|
|
|
import { Address, toNano, TupleSlice, WalletContract } from "ton";
|
|
|
|
// import { sendInternalMessageWithWallet } from "../test/helpers";
|
|
|
|
import {hex as item_code} from "../build/nft-item.compiled.json";
|
|
|
|
import { Builder, Cell, Slice } from "ton";
|
|
|
|
import BN from "bn.js";
|
|
|
|
|
|
|
|
// return the init Cell of the contract storage (according to load_data() contract method)
|
|
|
|
export function initData() {
|
|
|
|
let isTestnet = false;
|
|
|
|
return main.collectionData({
|
|
|
|
ownerAddress: Address.parseFriendly("EQB_hLB81P0BuBqcitfwoLRd2QX4l4SY-w2fWob9xdWNQgSx").address,
|
|
|
|
code: Cell.fromBoc(item_code)[0],
|
|
|
|
zone: isTestnet ? "example.ton" : "nftcoffee.ton",
|
|
|
|
ownerKey: new BN(0) // 63181357919630091755807889549433422416741950993093777020964723182484811889834
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// return the op that should be sent to the contract on deployment, can be "null" to send an empty message
|
|
|
|
export function initMessage() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// optional end-to-end sanity test for the actual on-chain contract to see it is actually working on-chain
|
|
|
|
// export async function postDeployTest(walletContract: WalletContract, secretKey: Buffer, contractAddress: Address) {
|
|
|
|
// const call = await walletContract.client.callGetMethod(contractAddress, "counter");
|
|
|
|
// const counter = new TupleSlice(call.stack).readBigNumber();
|
|
|
|
// console.log(` # Getter 'counter' = ${counter.toString()}`);
|
|
|
|
//
|
|
|
|
// const message = main.increment();
|
|
|
|
// await sendInternalMessageWithWallet({ walletContract, secretKey, to: contractAddress, value: toNano(0.02), body: message });
|
|
|
|
// console.log(` # Sent 'increment' op message`);
|
|
|
|
//
|
|
|
|
// const call2 = await walletContract.client.callGetMethod(contractAddress, "counter");
|
|
|
|
// const counter2 = new TupleSlice(call2.stack).readBigNumber();
|
|
|
|
// console.log(` # Getter 'counter' = ${counter2.toString()}`);
|
|
|
|
// }
|