The Tonfura SDK is the most comprehensive, stable, and powerful TypeScript SDK available today to interact with the TON blockchain.
The SDK leverages Tonfura's hardened node infrastructure, guaranteeing best-in-class node reliability, scalability, and data correctness, and is undergoing active development by Tonfura's engineers.
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.
The Tonfura SDK currently supports the following namespaces:
core
: All commonly-used Ton's API methodstransact
: All Tonfura Transaction API methods
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 toDEFAULT_API_KEY
: a rate-limited public key.network
: Name of the network. Defaults toNetwork.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 thenetwork
andapiKey
fields.
The Core
contains all commonly-used ton's methods.
The Transact
contains methods used for simulating and sending transactions.
HTTP status code | Code | Message | Description |
---|---|---|---|
400 | -32700 | Parse error | Invalid JSON |
400 | -32600 | Invalid Request | API key is empty |
401 | -32600 | Invalid Request | Invalid API key |
402 | -32600 | Invalid Request | Quota exceeded |
400 | -32600 | Invalid Request | Network mismatch |
429 | -32600 | Invalid Request | Rate limiting exceeded |
200 | -32601 | Method not found | Method not found |
200 | -32602 | Invalid params | Invalid params |
500 | -32603 | Internal error | Internal error |
200 | -32000 | Server error | Resource not found |