# ton

> ## 🚨 Repository Deprecated and Moved! 🚨

Latest version **13.9.0** (published 2023-10-25) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 13.9.0 |
| Published | 2023-10-25 |
| First published | 2012-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 312.3 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 82 |
| Author | Whales Corp. |
| Maintainers | mrmld, tonwhales |

## Links

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

## Dependencies (5)

- [zod](https://npm.io/package/zod.md) ^3.21.4
- [axios](https://npm.io/package/axios.md) ^0.25.0
- [teslabot](https://npm.io/package/teslabot.md) ^1.3.0
- [dataloader](https://npm.io/package/dataloader.md) ^2.0.0
- [symbol.inspect](https://npm.io/package/symbol.inspect.md) 1.0.1

## Recent versions

- 13.9.0 (latest) — 2023-10-25
- 13.8.0 — 2023-10-24
- 13.7.0 — 2023-10-24
- 13.6.1 — 2023-08-24
- 13.6.0 — 2023-08-17
- 13.5.0 — 2023-05-10
- 13.4.1 — 2023-03-02
- 13.4.0 — 2023-03-01
- 13.3.0 — 2023-01-05
- 13.2.0 — 2022-12-31
- 13.1.0 — 2022-12-30
- 13.0.0 — 2022-12-29
- 12.3.3 — 2022-12-22
- 12.3.2 — 2022-12-20
- 12.3.1 — 2022-12-20
- … 164 more at https://npm.io/package/ton/versions

## README

# TON JS Client

## 🚨 Repository Deprecated and Moved! 🚨

**This repository has been deprecated and is no longer actively maintained.** We have moved our project to a new repository, which you can find here: [ton-org/ton](https://github.com/ton-org/ton). The new NPM package is available here: [@ton/ton](https://www.npmjs.com/package/@ton/ton)

Please make sure to update your bookmarks and star the new repository to stay up-to-date with the latest developments and updates. This repository will be archived and eventually removed.

**Thank you for your continued support!**
___________

[![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-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

```js
import { TonClient, WalletContractV4, internal } from "ton";
import { mnemonicNew, mnemonicToPrivateKey } from "ton-crypto";

// Create Client
const client = new TonClient({
  endpoint: 'https://toncenter.com/api/v2/jsonRPC',
});

// Generate new key
let mnemonics = await mnemonicNew();
let keyPair = await mnemonicToPrivateKey(mnemonics);

// Create wallet contract
let workchain = 0; // Usually you need a workchain 0
let wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey });
let contract = client.open(wallet);

// Get balance
let balance: bigint = await contract.getBalance();

// Create a transfer
let seqno: number = await contract.getSeqno();
let transfer = await contract.createTransfer({
  seqno,
  secretKey: keyPair.secretKey,
  messages: [internal({
    value: '1.5',
    to: 'EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N',
    body: 'Hello world',
  })]
});

```

## Docs

[Documentation](https://ton-community.github.io/ton/)

## 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 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
