How to Install and Configure the STON.fi SDK for TypeScript Apps
The STON.fi SDK is a thin TypeScript wrapper around STON.fi contracts, but a real integration also needs the STON.fi API, a TON RPC client and TON Connect. Together they let you discover routes, open contracts and prepare safe transaction parameters.
🔥 What the SDK Actually Does
- Builds Router and Pool contract wrappers
- Prepares swap, deposit and withdrawal parameters
- Opens LP Account and Vault contracts
- Turns API Router metadata into the correct classes
🚀 Core Packages to Add
1. Run npm install @ston-fi/sdk @ston-fi/api @ton/ton
2. Add @tonconnect/ui-react when users must sign from a browser wallet
3. Skip @ston-fi/omniston-sdk unless you need aggregation instead of direct STON.fi access
⚡ Fast Project Setup
1. Create a Vite React TypeScript project
2. Install the packages and start the dev server once before adding blockchain code
3. Configure strict TypeScript and add the Buffer polyfill only if Vite needs it
4. Store the TON RPC endpoint in an environment variable
5. Export a shared tonClient and stonApiClient from one module
🧠 Why Dynamic Discovery Wins
Ask the STON.fi API to simulate the swap, read the returned Router metadata, feed it to dexFactory() and open the contract with the TON client. This keeps mainnet routes current and avoids mixing testnet data or outdated addresses.
The cleanest setup keeps four layers independent so you can test API responses, contract creation, parameter building and wallet approval one by one.
Ready to wire up your first STON.fi swap foundation this week? 👇
Tell us which part of the install still feels unclear.
Not investment advice - research on your own! 🚀
$GRAM
The STON.fi SDK is a thin TypeScript wrapper around STON.fi contracts, but a real integration also needs the STON.fi API, a TON RPC client and TON Connect. Together they let you discover routes, open contracts and prepare safe transaction parameters.
🔥 What the SDK Actually Does
- Builds Router and Pool contract wrappers
- Prepares swap, deposit and withdrawal parameters
- Opens LP Account and Vault contracts
- Turns API Router metadata into the correct classes
🚀 Core Packages to Add
1. Run npm install @ston-fi/sdk @ston-fi/api @ton/ton
2. Add @tonconnect/ui-react when users must sign from a browser wallet
3. Skip @ston-fi/omniston-sdk unless you need aggregation instead of direct STON.fi access
⚡ Fast Project Setup
1. Create a Vite React TypeScript project
2. Install the packages and start the dev server once before adding blockchain code
3. Configure strict TypeScript and add the Buffer polyfill only if Vite needs it
4. Store the TON RPC endpoint in an environment variable
5. Export a shared tonClient and stonApiClient from one module
🧠 Why Dynamic Discovery Wins
Ask the STON.fi API to simulate the swap, read the returned Router metadata, feed it to dexFactory() and open the contract with the TON client. This keeps mainnet routes current and avoids mixing testnet data or outdated addresses.
The cleanest setup keeps four layers independent so you can test API responses, contract creation, parameter building and wallet approval one by one.
Ready to wire up your first STON.fi swap foundation this week? 👇
Tell us which part of the install still feels unclear.
Not investment advice - research on your own! 🚀
$GRAM