This package is a part of ton3.
⚠️ Work in progress, API can (and most likely will) be changed! This is not production ready version yet.
npm i ton3-providers
import { Mnemonic, Address, Coins, Builder, BOC } from 'ton3-core'
import { ProviderRESTV2 } from 'ton3-providers'
import { Wallets } from 'ton3-contracts'
const highloadWalletExample = async () => {
const provider = new ProviderRESTV2('https://testnet.toncenter.com/api/v2')
const client = await provider.client()
const mnemonic = new Mnemonic()
const highload = new Wallets.ContractHighloadWalletV2(0, mnemonic.keys.public)
console.log(mnemonic.words) // Get mnemonic phrase
console.log(highload.address.toString()) // Get contract address
// You need to deposit 1 ton to your contract address before deployment
// Contract deployment
const deploy = highload
.createDeployMessage()
.sign(mnemonic.keys.private)
const { data: deployData } = await client.sendBoc(null, { boc: BOC.toBase64Standard(deploy) })
console.log(deployData)
// Create and send payments
const transfers = Array(5).fill(null).reduce((acc, _el) => acc.concat({
destination: new Address('xxx'),
amount: new Coins('0.01'),
body: new Builder().storeUint(0, 32).storeString('My message').cell(),
mode: 3
}), [])
const payments = highload
.createTransferMessage(transfers)
.sign(mnemonic.keys.private)
const { data: paymentsData } = await client.sendBoc(null, { boc: BOC.toBase64Standard(payments) })
console.log(paymentsData)
}
MIT License