TONX API SDK

The TONX API SDK is the most comprehensive, stable, and powerful TypeScript SDK available today to interact with the TON blockchain.

The SDK leverages TONX API's hardened node infrastructure, guaranteeing best-in-class node reliability, scalability, and data correctness, and is undergoing active development by TONX API's engineers.

Table of Contents

Getting started

npm install tonfura-sdk

After installing the app, you can then import and use the SDK:

import { Network, Tonfura } from 'tonfura-sdk';

// Optional config object, but defaults to the API key 'DEFAULT_API_KEY' and Network 'mainnet'.
const settings = {
  apiKey: 'DEFAULT_API_KEY', // Replace with your Tonfura API key.
  network: Network.Mainnet // Replace with your network.
};

const tonfura = new Tonfura(settings);

The Tonfura object returned by new Tonfura() provides access to the Tonfura API. An optional config object can be passed in when initializing to set your API key, change the network, or specify the max number of retries.

Using the TONX API SDK

The TonFura SDK currently supports the following namespaces:

  • core: All commonly-used Ton's API methods
  • transact: All Tonfura Transaction API methods

TONX API Settings

An TonfuraSettings object can be passed on instantiation to the Tonfura object, with the following optional parameters:

  • apiKey: API key that can be found in the Tonfura dashboard. Defaults to DEFAULT_API_KEY: a rate-limited public key.
  • network: Name of the network. Defaults to Network.Mainnet
  • maxRetries: The maximum number of retries to attempt if a request fails. Defaults to 5.
  • url: Optional URL endpoint to use for all requests. Setting this field will override the URL generated by the network andapiKey fields.

TONX API Core

The Core contains all commonly-used ton's methods.

Check out more methods

TONX API Transact

The Transact contains methods used for simulating and sending transactions.

Check out more methods

Error Handling

HTTP status codeCodeMessageDescription
400-32700Parse errorInvalid JSON
400-32600Invalid RequestAPI key is empty
401-32600Invalid RequestInvalid API key
402-32600Invalid RequestQuota exceeded
400-32600Invalid RequestNetwork mismatch
429-32600Invalid RequestRate limiting exceeded
200-32601Method not foundMethod not found
200-32602Invalid paramsInvalid params
500-32603Internal errorInternal error
200-32000Server errorResource not found