# @ton/ton

> [![Version npm](https://img.shields.io/npm/v/ton.svg?logo=npm)](https://www.npmjs.com/package/ton)

Latest version **16.3.0** (published 2026-06-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ton/ton
pnpm add @ton/ton
yarn add @ton/ton
bun add @ton/ton
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 16.3.0 |
| Published | 2026-06-01 |
| First published | 2023-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 339.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 239 |
| Author | Whales Corp. |
| Maintainers | tsivarev, klpx, danil42russia, tolk-vm, ton-ci, it-tonstudio-io |

## Links

- npm: https://www.npmjs.com/package/@ton/ton
- Repository: https://github.com/ton-org/ton
- Homepage: https://github.com/ton-org/ton#readme
- Issues: https://github.com/ton-org/ton/issues
- npm.io page: https://npm.io/package/@ton/ton

## Dependencies (3)

- [zod](https://npm.io/package/zod.md) ^3.21.4
- [axios](https://npm.io/package/axios.md) ^1.15.0
- [dataloader](https://npm.io/package/dataloader.md) ^2.0.0

## Recent versions

- 16.3.0 (latest) — 2026-06-01
- 16.2.4 — 2026-04-15
- 16.2.3 — 2026-03-31
- 16.2.2 — 2026-02-06
- 16.2.1 — 2026-02-06
- 16.2.0 — 2026-02-06
- 16.1.0 — 2025-12-02
- 16.0.0 — 2025-10-16
- 15.4.0 — 2025-10-03
- 15.3.1 — 2025-07-06
- 15.3.0 — 2025-06-18
- 15.2.1 — 2025-02-07
- 15.2.0 — 2025-01-31
- 15.1.0 — 2024-10-09
- 15.0.0 — 2024-08-16
- … 9 more at https://npm.io/package/@ton/ton/versions

## README

# TON JS Client

[![Version npm](https://img.shields.io/npm/v/ton.svg?logo=npm)](https://www.npmjs.com/package/ton)

Cross-platform client for TON blockchain.

## Features

- 🚀 Create new wallets
- 🍰 Get balance
- ✈️ Transfers

## Install

```bash
yarn add @ton/ton @ton/crypto @ton/core buffer
```

#### Browser polyfill

```js
// Add before using library
require("buffer");
```

## Usage

To use this library you need HTTP API endpoint, you can use one of the public endpoints:

- Mainnet: https://toncenter.com/api/v2/jsonRPC
- Testnet: https://testnet.toncenter.com/api/v2/jsonRPC

```ts
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',
  })]
});
```

## Formatting

We use `biome` as our formatter. It's prettier compatible and fast

IDE Setup: [VSCode](https://marketplace.visualstudio.com/items?itemName=biomejs.biome), [Zed](https://biomejs.dev/reference/zed/)

```sh
yarn run format
```

## Testing

### Debugging in tests

By default tests are running using multiple worker threads. It's faster, but
undesirable during debugging. `SINGLETHREADED` env variable covers this case

```sh
SINGLETHREADED=1 yarn run test
```

### Coverage report

We use test coverage to eliminate blind spots in our tests.

#### How to?

The goal is to make all functions runned at least once

1. Build a coverage report

```sh
yarn run coverage
```

2. Coverage report is build to the `/coverage` directory

3. Open `/coverage/index.html` to check the report

## Acknowledgements

This library is developed by the [Whales Corp.](https://tonwhales.com/) and maintained by [Dan Volkov](https://github.com/dvlkv).

## License

MIT

---
_Source: https://npm.io/package/@ton/ton · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
