Usage

How to install and use @tetherto/wdk-protocol-swap-stonfi-ton for swapping tokens on TON

Installation

To install the @tetherto/wdk-protocol-swap-stonfi-ton package, follow these steps:

npm install @tetherto/wdk-protocol-swap-stonfi-ton

Quick Start

Setting Up a Swap Service

import StonFiProtocolTon from '@tetherto/wdk-protocol-swap-stonfi-ton'
import { WalletAccountTon } from '@tetherto/wdk-wallet-ton'

// Create a wallet account first
const account = new WalletAccountTon(seedPhrase, {
  tonApiKey: 'YOUR_TON_API_KEY',
  tonApiEndpoint: 'YOUR_TON_API_ENDPOINT'
})

// Create swap service
const swapProtocol = new StonFiProtocolTon(account, {
  swapMaxFee: 1000000000n // Optional: Max swap fee
})

Basic Swap Operation

Getting Swap Quotes

Supported Network

TON Blockchain

  • TON (TON Network) - Native blockchain for StonFi DEX

Swap Operations

Standard TON Account

Gasless TON Account

Jetton to Jetton Swap

Exact Output Swap

Error Handling

Complete Examples

Complete Swap Setup

Multiple Token Swaps

Swap with Checks


Need Help?