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.

60 lines
2.7 KiB

import { TonClient, Address, WalletContractV3R2, WalletContractV4, TonClient4 } 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'
})
export const client4 = new TonClient4({
endpoint: "https://sandbox-v4.tonhubapi.com"
})
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 const staking_addr = Address.parse('EQC5Y865mUcSTsSpJYbli0KmSiriJUBFHlKmvNqkS7T5V567');
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: "TON Banking",
description: "TON Banking (demo-1)",
2 years ago
// 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.
2 years ago
// export let owner = Address.parse('EQAuAiFGgkxoQvBWXjXQcLYb8BW4fO6UJkt6_uCONJ2y5VUk');
export let owner = Address.parse('EQD7zbEMaWC2yMgSJXmIF7HbLr1yuBo2GnZF_CJNkUiGSe32')
// Create content Cell
export let default_content = buildOnchainMetadata(jettonParams);