Cross-platform client for TON blockchain.
- 🚀 Create new wallets
- 🍰 Get balance
✈️ Transfers
yarn add ton buffer
// Add before using library
require("buffer");
To use this library you need HTTP API endpoint, you can use one of the public endpoints:
import { TonClient } from "ton";
// Create Client
const client = new TonClient({
endpoint: 'https://toncenter.com/api/v2/jsonRPC',
});
// Open Wallet
const wallet = await client.openWallet('<public-key>');
console.log(wallet.address);
console.log(await wallet.getBalance());
// Transfering coins
let seqno = await wallet.getSeqNo();
// In case of failure you can safely retry calling this method
await wallet.transfer({ to: 'some-address', amount: 10.0, seqno, secretKey: '<secret>' });
MIT