@fotonjs/api
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@fotonjs/api

A library to fetch the data from TON using Ton Center API.

By default, the requests are limited to 1 request per second. If you want more throughput, get the access key from the @tonapibot in Telegram. The following plans are available:

  • Free without access key: 1rps
  • Free with access key: 10rps
  • Plus for 2.5 TON/month: 25rps
  • Advanced for 25 TON/month: 100rps

Usage

To install the library, run:

npm install @fotonjs/api

Then, create an API Client – the interface with all RPC methods:

import { createClient } from '@fotonjs/api';

const apiClient = createClient({
  api: 'mainnet',
  authToken: 'your-token',
});

Call any of the RPC methods with the Client:

const account = await apiClient.account({
  address: '0:123...',
});

if (account.data) {
  console.log(account.data.balance);
} else {
  console.error(account.error);
}

Package Sidebar

Install

npm i @fotonjs/api

Weekly Downloads

6

Version

0.0.3

License

ISC

Unpacked Size

276 kB

Total Files

7

Last publish

Collaborators

  • vanishmax