How to Set Up the STON.fi SDK for TON Swap and Liquidity Apps

The STON.fi SDK is a TypeScript and JavaScript library that wraps STON.fi smart contracts, including Router, Pool, LP Account, Vault, and pTON contracts, to simplify DeFi integrations on the TON blockchain. A complete integration typically requires four components working together: the STON.fi API for asset discovery and trade simulation, the SDK for generating contract instances and transaction parameters, a TON RPC client for reading blockchain state, and TON Connect for wallet approval. Developers should install @ston-fi/sdk alongside @ston-fi/api and @ton/ton, adding a TON Connect package when user-facing wallet signing is needed. The SDK's current v2 release introduces support for single-sided liquidity, Vault operations, and improved gas handling, while still retaining v1 classes for backward compatibility. Keeping each component's responsibilities separate — contract interaction, API data, RPC access, and wallet signing — is recommended to make integrations easier to test and maintain.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in