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.

53 lines
2.4 KiB

2 years ago
import { TonClient, Address, WalletContractV3R2, WalletContractV4 } from "ton";
import { mnemonicToPrivateKey } from "ton-crypto";
import { buildOnchainMetadata } from "./helpers";
export const client = new TonClient({
endpoint: 'https://testnet.toncenter.com/api/v2/jsonRPC',
apiKey: 'bb38df0c2756c66e2ab49f064e2484ec444b01244d2bd49793bd5b58f61ae3d2'
})
let mnemonics = "basic security merge opera inject core melody polar become force cool glance history order warfare consider company slim twice balcony scare shoot winner rude";
2 years ago
let mnemonics2 = "road learn slow crucial mixed grunt copy ribbon coyote shrimp onion pledge any tornado rebel three glimpse winner bless thunder immune february coin egg"
// read more about wallet apps https://ton.org/docs/participate/wallets/apps#tonhub-test-environment
2 years ago
export async function wallet_data(w: number = 0) {
let keyPair = await mnemonicToPrivateKey(mnemonics.split(" "));
let secretKey = keyPair.secretKey;
//Create deployment wallet contract
let wallet_contract = WalletContractV3R2.create({ workchain, publicKey: keyPair.publicKey });
2 years ago
if (w == 1) {
keyPair = await mnemonicToPrivateKey(mnemonics2.split(" "));
secretKey = keyPair.secretKey;
wallet_contract = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey });
}
let my_wallet = client.open(wallet_contract);
return { my_wallet, secretKey, keyPair };
}
2 years ago
//workchain = 1 - masterchain (expensive operation cost, validator's election contract works here)
//workchain = 0 - basechain (normal operation cost, user's contracts works here)
export let workchain = 0; //we are working in basechain.
// This is example data - Modify these params for your own jetton
// - Data is stored on-chain (except for the image data itself)
export const jettonParams = {
2 years ago
name: "TONB DEMO",
description: "TON Banking",
// image: "https://ipfs.io/ipfs/QmbPZjC1tuP6ickCCBtoTCQ9gc3RpkbKx7C1LMYQdcLwti" // Image url
image: "https://cache.tonapi.io/imgproxy/gZXLNT_UkpFUSUUbTQsilCqwq_tXa4Kgmf55b5SmVQo/rs:fill:200:200:1/g:no/aHR0cHM6Ly90b24ub3JnL2Rvd25sb2FkL3Rvbl9zeW1ib2wucG5n.webp",
symbol: "TONB"
};
// Owner should usually be the deploying wallet's address.
export let owner = Address.parse('EQAuAiFGgkxoQvBWXjXQcLYb8BW4fO6UJkt6_uCONJ2y5VUk');
// Create content Cell
export let default_content = buildOnchainMetadata(jettonParams);