BUILD A STONfi QUOTE VIEWER BEFORE YOU BUILD A SWAP
Most swap tutorials rush toward signing. A useful first step is to build a read-only quote viewer with TypeScript. You learn how STONfi’s Omniston behaves before funds enter the picture.
📡 THE QUOTE IS A STREAM, NOT A SNAPSHOT
Omniston’s requestForQuote() is not a normal REST request that returns one price and ends. It opens a live stream. ack confirms the RFQ was opened, quoteUpdated delivers current quotes, noQuote means no connected source can fill the request, and unsubscribed means the stream has ended.
The first quote is not automatically the final quote. Later updates reflect liquidity changes, so always keep newest event. The application should render the latest result rather than cache the first one and treat it as permanent.
🔢 METADATA AND UNITS ARE PART OF THE QUOTE
Omniston works with blockchain base units, while users think in normal token amounts. STONfi’s API provides metadata such as symbols and decimals, so the viewer can convert values correctly.
Precision is not universal. The source notes that many TON jettons use 9 decimals, while USDT on TON uses 6. JavaScript Number is another trap: large base-unit values can lose precision beyond 2^53. BigInt for arithmetic and strings for transport keep these values exact.
🧠 WHY THIS SMALL PROJECT MATTERS
A read-only viewer can become the practical foundation for a swap interface, price monitor, arbitrage scanner, Telegram bot or data feed. Once the quote lifecycle, settlement types and amount conversions are understood, adding a wallet becomes a separate step.
The architecture behind this flow: STONfi’s API tells you what the assets are, while Omniston finds executable pricing across STONfi pools, other TON DEXs and RFQ resolvers.
Build the read-only layer first. Add execution only after the quote lifecycle makes sense.
NFA - DYOR
$BTC
Most swap tutorials rush toward signing. A useful first step is to build a read-only quote viewer with TypeScript. You learn how STONfi’s Omniston behaves before funds enter the picture.
📡 THE QUOTE IS A STREAM, NOT A SNAPSHOT
Omniston’s requestForQuote() is not a normal REST request that returns one price and ends. It opens a live stream. ack confirms the RFQ was opened, quoteUpdated delivers current quotes, noQuote means no connected source can fill the request, and unsubscribed means the stream has ended.
The first quote is not automatically the final quote. Later updates reflect liquidity changes, so always keep newest event. The application should render the latest result rather than cache the first one and treat it as permanent.
🔢 METADATA AND UNITS ARE PART OF THE QUOTE
Omniston works with blockchain base units, while users think in normal token amounts. STONfi’s API provides metadata such as symbols and decimals, so the viewer can convert values correctly.
Precision is not universal. The source notes that many TON jettons use 9 decimals, while USDT on TON uses 6. JavaScript Number is another trap: large base-unit values can lose precision beyond 2^53. BigInt for arithmetic and strings for transport keep these values exact.
🧠 WHY THIS SMALL PROJECT MATTERS
A read-only viewer can become the practical foundation for a swap interface, price monitor, arbitrage scanner, Telegram bot or data feed. Once the quote lifecycle, settlement types and amount conversions are understood, adding a wallet becomes a separate step.
The architecture behind this flow: STONfi’s API tells you what the assets are, while Omniston finds executable pricing across STONfi pools, other TON DEXs and RFQ resolvers.
Build the read-only layer first. Add execution only after the quote lifecycle makes sense.
NFA - DYOR
$BTC
