
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
[](https://www.npmjs.com/package/ton)
Cross-platform client for TON blockchain.
yarn add @ton/ton @ton/crypto @ton/core 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, WalletContractV4, internal } from "@ton/ton";
import { mnemonicNew, mnemonicToPrivateKey } from "@ton/crypto";
// Create Client
const client = new TonClient({
endpoint: 'https://toncenter.com/api/v2/jsonRPC',
});
// Generate new key
const mnemonic = await mnemonicNew();
const keyPair = await mnemonicToPrivateKey(mnemonic);
// Create wallet contract
const wallet = WalletContractV4.create({
workchain: 0, // basechain
publicKey: keyPair.publicKey,
});
const contract = client.open(wallet);
// Get balance
const balance = await contract.getBalance();
// Create a transfer
const seqno = await contract.getSeqno();
const transfer = await contract.createTransfer({
seqno,
secretKey: keyPair.secretKey,
messages: [internal({
value: '1.5',
to: 'EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N',
body: 'Hello world',
})]
});
We use biome as our formatter. It's prettier compatible and fast
yarn run format
By default tests are running using multiple worker threads. It's faster, but
undesirable during debugging. SINGLETHREADED env variable covers this case
SINGLETHREADED=1 yarn run test
We use test coverage to eliminate blind spots in our tests.
The goal is to make all functions runned at least once
yarn run coverage
Coverage report is build to the /coverage directory
Open /coverage/index.html to check the report
This library is developed by the Whales Corp. and maintained by Dan Volkov.
MIT
FAQs
[](https://www.npmjs.com/package/ton)
The npm package @ton/ton receives a total of 206,685 weekly downloads. As such, @ton/ton popularity was classified as popular.
We found that @ton/ton demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.