/ton3-core

Primary LanguageTypeScriptMIT LicenseMIT

💎 ton3-core

npm GitHub top language Coverage Status TON

ton3-core is a core package of ton3 inspired by tonweb to work with TON blockchain.
Visit documentation to see API reference.

⚠️ Work in progress, API can (and most likely will) be changed! This is not production ready version yet.

How to install

npm i ton3-core

Simple usage

import { BOC, Builder, Mnemonic } from 'ton3-core'

const mnemonic = new Mnemonic()

console.log(mnemonic.words) // prints mnemonic phrase
console.log(mnemonic.keys.private) // prints private key
console.log(mnemonic.keys.public) // prints public key

const text = 'Hello, World!'
const cell = new Builder()
    .storeString(text)
    .cell()

const boc = BOC.toBytesStandard(cell)
const result = BOC.fromStandard(boc)
    .parse()
    .loadString()

console.log(text === result) // true

Features and status

Feature Status
Ordinary BOC (de)serialization
Builder, Cell, Slice
Hashmap (dictionary) (de)serialization
Mnemonic/keypair with bip39 + ed25519
Coins (class for Toncoin, Nanocoin e.t.c.)
Address (class for TON address)
Message layouts (such as MessageX e.t.c.)
Old "tonweb" style mnemonic support
~100% tests coverage
Pre-release code review

License

MIT License