TonFun
  • Welcome
  • Basics
    • Glossary
    • Architecture
      • BclMaster
      • JettonMaster
      • JettonWallet
      • JettonMaster storage layout
    • API
    • SDK
      • changelog
  • SDK Api reference
    • BclSDK
      • classes
        • BclSDK
      • type-aliases
        • AnyApiProvider
    • client
      • adapters
        • functions
          • normalizeCoin
          • normalizeCoinEvent
        • type-aliases
          • AnyObject
      • BclClient
        • classes
          • BclClient
        • type-aliases
          • TransactionStatus
      • ofetchHttpProvider
        • classes
          • OfetchHttpProvider
      • types
        • type-aliases
          • BclEvent
          • BclEventBuy
          • BclEventDeployment
          • BclEventSell
          • BclEventSendLiq
          • ClientOptions
          • Coin
          • CoinMetadata
          • Event
          • GetCoinsResponse
          • GetEventsResponse
    • index
      • functions
        • crc32
        • crc32str
        • packReferralConfig
        • unpackReferralConfig
      • type-aliases
        • ReferralConfig
      • variables
        • Constants
    • provider
      • httpProviderBase
        • interfaces
          • HttpProviderBase
      • simpleTonapiProvider
        • functions
          • createProvider
          • simpleTonapiProvider
      • tonConnectSender
        • functions
          • tonConnectSender
        • type-aliases
          • TonConnectLikeObject
    • wrappers
      • BclJetton
        • classes
          • BclJetton
        • functions
          • parseBclEvent
        • type-aliases
          • BclData
          • BuyOptions
          • ContractEvent
          • EventBuy
          • EventSell
          • EventSendLiq
      • BclMaster
        • classes
          • BclMaster
        • type-aliases
          • DeployCoinInput
          • DeployCoinOpts
          • MasterData
      • BclWallet
        • classes
          • BclWallet
Powered by GitBook
On this page
  • Overview
  • Installation
  • Configuration
  • Test environment
  • SDK Reference
  1. Basics

SDK

PreviousAPINextchangelog

Last updated 6 months ago

This section contains information about SDK for tonfun protocol

Overview

SDK is written in TypeScript. It's designed to be a layer between your code, contracts and tonfun backend. It could be used both on backend and frontend.

SDK is build using package and contains wrapper for all contracts. It also relies on for transaction status fetching and on our backed for obtaining coins information.

Installation

npm install ton-bcl-sdk

yarn add ton-bcl-sdk

Configuration

You can create instance of SDK this way:

import {Api, HttpClient} from "tonapi-sdk-js";
import {Address} from "@ton/core";
import { BclSDK, simpleTonapiProvider } from "ton-bcl-sdk";

const TONAPI_TOKEN = 'YOUR_TONAPI_TOKEN'

let sdk = BclSDK.create({
    apiProvider: simpleTonapiProvider(new Api(
        new HttpClient({
            baseUrl: 'https://tonapi.io',
            baseApiParams: {
                headers: {
                    "Content-type": "application/json",
                    Authorization: `Bearer ${TONAPI_TOKEN}`
                },
            },
        })
    )),
    clientOptions: {
        endpoint: 'https://test-indexer-3a4wy.ondigitalocean.app/api/v1',
    },
    masterAddress: Address.parse('EQBSMwczMFUb789uqNvebKBvemkRaAQJdzTFq6565Ef9rW2k')
});

Test environment

For test environment you can use this parameters:

  • BCL Master address - EQBSMwczMFUb789uqNvebKBvemkRaAQJdzTFq6565Ef9rW2k

  • TonFun api address - https://test-indexer-3a4wy.ondigitalocean.app/api/v1

Test coin parameters:

  • commission is 1%

  • emission that is sold is 800M

  • emission that is minted to STON.fi is 200M

  • total emission is 1000M

  • it costs ~3 TON to buyout whole 800M tokens

  • trading close fee is 0 TON

SDK Reference

You can find detailed SDK reference

@ton
TonApi
here