How Omniston works
Protocol-level Omniston concepts for RFQs, settlement modes, orders, executions, HTLC-based cross-chain settlement, timings, and fees.
Omniston provides a single RFQ-based integration for swaps on TON and cross-chain swaps.
For swaps on TON, Omniston returns quotes from connected liquidity sources, including AMM DEXs and RFQ resolvers.
For cross-chain swaps, the trader sends an RFQ, resolvers return quotes, and the selected resolver settles the trade so the output asset is delivered on the destination blockchain. HTLC-based settlement uses hashlocks and timelocks to make the cross-chain flow verifiable and atomic.
In cross-chain flows, the selected resolver provides the destination-side liquidity. The protocol links the source-side and destination-side legs with HTLC rules, so integrators do not need to pre-fund destination-side inventory on every chain they support.
See the glossary for role and object definitions.
Conceptual Model
Actors:
Trader - sends an RFQ, accepts a quote, and funds a position or signs an order.
Resolver - returns a Quote and performs the required settlement actions. In cross-chain flows, the resolver also provides the destination-side liquidity for the selected route.
Integrator - a partner that receives the configured integrator fee in the Output asset on the destination blockchain.
Core objects and how they chain together:
The Trader sends an RFQ (request for quote).
Resolvers return Quote updates for that RFQ.
In order settlement, an Order is created from the selected Quote and has its own lifecycle.
An Order may contain multiple Executions. Each Execution represents one fill attempt or fill fragment, such as a partial fill.
Input position and Output position represent the protocol state of the Input asset and Output asset for a given Execution. Output position is used in HTLC-based cross-chain settlement and is not used for intrachain swaps.
Swap settlement does not create a persistent Order object in the API flow. It uses immediate swap routes instead. Order settlement introduces Order, Execution, reservations, and cancellation semantics.
Settlement Modes
Swap settlement
Order settlement
When settlement happens
Immediately through one or more swap routes made of chunks and steps.
An Order is created first, and resolvers fill it over time.
Trader action
Accepts a quote with a swap payload and follows the swap transaction flow.
Creates or registers an Order, either escrow-backed or signed-order / gasless.
Resolver role
Provides liquidity according to the selected route.
Follows the selected protocol's reservation, completion, and rollback rules for Executions.
Why data shapes differ
A quote carries routes, slippage hints, and gas estimates.
A quote carries OrderSettlementData: protocol contracts, HTLC parameters, deadlines, and optional exclusivity.
Enable the supported settlement modes in the RFQ, then follow the settlement branch returned in the selected quote. Order settlement covers escrow-backed and signed orders, including HTLC cross-chain settlement.
Intrachain Swaps vs Cross-chain Swaps
In an intrachain swap, the trader sends and receives assets on the same blockchain. In a cross-chain swap, the trader sends the input asset on the source blockchain and receives the output asset on the destination blockchain.
HTLC-specific fields are used only for cross-chain swaps, where the source blockchain and destination blockchain differ.
In intrachain swaps, there is no cross-chain HTLC leg, so HTLC-only fields such as output positions, secret hashes, and security deposits are not included.
HTLC-based cross-chain settlement uses:
Secret hashes based on protocol-generated secrets or trader-provided hashes.
A distinct Output position on the destination blockchain, with its own ExecutionPhase lifecycle alongside the Input position.
Completion and rollback windows, plus security deposits on source and/or destination where applicable.
Cross-chain Execution Model
The trader and resolver fund different sides of a cross-chain execution:
the trader funds the source-side leg
the selected resolver funds the destination-side leg
the HTLC rules link both legs so the flow can move toward completion or timed rollback
Clients use one RFQ and settlement model. Resolvers supply destination-side liquidity for the selected route.
Atomic Outcomes in HTLC Settlement
For app logic, treat an HTLC-based cross-chain execution as converging to one of these outcomes:
The destination-side leg completes and the secret is disclosed at the required phase
The trader receives the destination-side assets and the resolver can complete the linked source-side claim.
The destination-side leg is not completed in time
The source-side position follows its refund or rollback path under the HTLC deadlines.
A cross-chain execution rolls back after liquidity was locked
The locked positions are unwound according to the same HTLC windows for that execution.
Chains and asset identities
See Supported chains and assets for chain IDs and asset addresses.
Lifecycle and Timing
The main timers have different meanings:
quote_validity_timeout- protocol parameter visible in resolver events: the maximum duration after quote generation during which the trader must make a valid deposit.trade_start_deadline- latest timestamp, in UTC seconds, for funds to reach the protocol contract or for order signing. Settlement after this deadline is at the resolver's discretion.exclusivity_timeout- maximum duration from trader position creation to resolver reservation, including the required security deposit.cancellation_available_timestamp- on order updates: time after which the trader may cancel the unfilled remainder. Any exclusivity period also ends at this timestamp.
Simplified order-settlement timeline:
RFQ -> quote accepted -> trader opens a position or signs an order -> exclusivity window -> optional public fill phase -> per-Execution completion or rollback timestamps -> terminal Execution state.
Authoritative Streams After Submit
Use different streams for different stages:
RFQ stream (
requestForQuote()/useRfq) is for pricing and reservation updates before you commit to a route.swapTrack()tracks swap settlement.orderTrack()tracks order settlement.
RFQ keep-alives and quote refreshes cover pricing before submission. After submitting the transaction or signed order, track settlement with the corresponding stream.
Execution Phases
ExecutionPhase represents the lifecycle state of a position. Phases exist separately for the Input position and, in HTLC-based cross-chain settlement, for the Output position.
Non-final phase groups:
Created - position exists; the resolver holding its reservation follows the protocol's settlement rules.
Ready for private completion (HTLC) - on-chain finality reached; completion is available to the reserved resolver.
Ready for public completion (HTLC) - private window ended; completion is available to other authorized resolvers.
Ready for private rollback - rollback is available to the reserved resolver.
Ready for public rollback - public rollback; only the Input position enters this phase per schema comments.
Final states are Completed (successful settlement) and Rolled back (assets returned per rules).
HTLC-only phases and Output position fields are absent for intrachain swaps by design.
Amounts and Fees
At quote level:
input_units- total Input asset the trader sends, including fees charged in that leg where applicable.output_units- net Output asset the trader receives after integrator and protocol fees.resolver_sends_units(order settlement) - total Output asset the resolver must move, including protocol and integrator fees. It is greater than the trader's net output when fees are non-zero, and equal when fees are zero.integrator_fee_units/protocol_fee_units- fee portions taken in Output asset as quoted.
On each Execution, the same distinction appears: output_units vs resolver_sends_units for that slice of the trade.
Secrets and Disclosure in HTLC
HTLC-based cross-chain settlement depends on hashlocks:
secret_hashon an Execution is HTLC-only and is not included in intrachain swaps.Order details (
VersionedHtlcOrderDetails) carrysecret_hashes, destination receive address, and optionaltrader_dst_disclose_addresswhen disclosure must happen at an address distinct from the destination payout address.
Secrets may be generated by the protocol or provided by the trader as ordered secret hashes, aligned with execution/chunk indexing and the quote's hashing function. The secret preimage is disclosed later to complete the cryptographic leg that unlocks funds according to protocol rules.
Secret fields are present on HTLC cross-chain executions and omitted for intrachain swaps.
When to Call orderDiscloseHtlcSecret()
In cross-chain HTLC flows, calling orderDiscloseHtlcSecret() requires both of the following conditions to be met for the same Execution:
The Input position has been created. Its
ExecutionPhase, reported inexecution.inputPositionPhase, isEXECUTION_PHASE_READY_FOR_PRIVATE_COMPLETIONorEXECUTION_PHASE_READY_FOR_PUBLIC_COMPLETION.The Output position has been created. Its
ExecutionPhase, reported inexecution.outputPositionPhase, isEXECUTION_PHASE_READY_FOR_PRIVATE_COMPLETIONorEXECUTION_PHASE_READY_FOR_PUBLIC_COMPLETION.
The two phase values do not have to match. Disclose the secret only after both conditions are met.
After orderDiscloseHtlcSecret() returns, continue tracking the trade with orderTrack(). The RPC response acknowledges disclosure; Order status and Execution phases report settlement progress.
Reading Completion in Order Settlement
For order settlement, the primary completion signal is Order.status.
Treat these values as the main user-facing outcomes:
TRADE_STATUS_FULLY_FILLEDTRADE_STATUS_PARTIALLY_FILLEDTRADE_STATUS_CANCELLEDTRADE_STATUS_FAILED
For cross-chain HTLC flows, correlate Order.status with per-execution phases:
use
Order.statusas the headline trade resultuse Input position and Output position phases to drive operational steps such as secret disclosure, support diagnostics, and advanced UI
Keep the last order snapshot when the stream emits unsubscribed. This event closes the subscription; settlement outcome is recorded in Order.status.
Settlement field reference
For contract addresses, HTLC parameters, and deadlines, see API model v1beta8. To implement the flow, use the JS/TS or React guide.
Last updated