New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ton-api/client

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ton-api/client

Autogenerated SDK for tonapi.io

  • 0.2.0-beta.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6K
decreased by-12.13%
Maintainers
0
Weekly downloads
 
Created
Source

@ton-api/client

Overview

@ton-api/client is an automatically generated SDK that provides seamless access to the endpoints offered by tonapi.io. This client is specifically designed to integrate with the TON blockchain, offering type-safe interactions and full compatibility with @ton/core library.

Features

  • Full coverage of tonapi.io endpoints
  • Type-safe interactions with the API
  • Seamless integration with @ton/core

Additionally, @ton-api/ton-adapter enables users to work with contracts written for @ton/ton through @ton-api/client, ensuring seamless integration while maintaining their existing code structure.

Prerequisites

To use this SDK, you need to:

  1. Set up an account at tonconsole.com
  2. Obtain an API key for authentication

Installation

Install the package and its peer dependencies using npm, yarn, or pnpm:

npm install @ton-api/client @ton/core
# or
yarn add @ton-api/client @ton/core
# or
pnpm add @ton-api/client @ton/core

Quick Start

Here's a basic example to get you started:

import { TonApiClient } from '@ton-api/client';
import { Address } from '@ton/core';

// Initialize the TonApi
const ta = new TonApiClient({
    baseUrl: 'https://tonapi.io',
    apiKey: 'YOUR_API_KEY'
});

// Use the API
async function fetchAccountEvents() {
    const address = Address.parse('YOUR_ADDRESS_HERE');
    const events = await ta.accounts.getAccountEvents(address, { limit: 50 })
    
    console.log('Account events:', events)
}

fetchAccountEvents();

Documentation

For detailed API information and endpoint descriptions, please refer to the official documentation.

Usage Examples

Fetching NFT Collection

const collectionAddress = Address.parse('COLLECTION_ADDRESS_HERE');

ta.nft.getNftCollection(collectionAddress)
    .then(collection => console.log('NFT Collection:', collection))
    .catch(error => console.error('Error fetching NFT collection:', error));

Getting Jetton Information

const jettonAddress = Address.parse('JETTON_ADDRESS_HERE');

ta.jettons.getJettonInfo(jettonAddress)
    .then(jetton => console.log('Jetton Info:', jetton))
    .catch(error => console.error('Error fetching jetton info:', error));

License

MIT

Keywords

FAQs

Package last updated on 09 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc