Skip to main content
@hot-labs/omni-sdk wraps the bridge for TypeScript apps: it builds the source-chain transactions (EVM, TON, Stellar, Solana, Gonka), parses deposits, builds and publishes withdraw intents, and finishes both sides. It talks to https://mpc.hex-api.app by default: the same API this tab documents, so the relay credits deposits and clears withdrawals for you and pays their NEAR gas.

Setup

mpcApi overrides the bridge API (default ["https://mpc.hex-api.app"]). api is used only for swap quotes and token lists.

Deposit

finishDeposit asks the relay (POST /relay/deposit) to credit the deposit: it checks it on the source chain, signs it and sends mt_deposit_call, paying the gas. Only if the relay cannot (a legacy receiver, a chain it does not relay) does the SDK fall back to a signature (POST /deposit/sign) and send the call through executeNearTransaction.

Withdraw

The SDK publishes the withdraw intent, reads the omni nonce and records the withdrawal in the bridge registry (POST /bridge/withdrawals), so a stuck one can be found and finished. With gasless: true the user pays the payout’s gas in the token, the withdrawal is paid out for them, and withdrawToken resolves once it is (with nothing). Otherwise it answers { nonce, tx, sender } and you pay it out yourself:
or let the relay do it: POST /relay/withdraw { chain_id, receiver } pays out every pending withdrawal of a receiver on EVM, TON, Stellar and Gonka (see the API reference).

Finish pending withdrawals

Moving from the old endpoints

Updating the SDK is enough: its defaults already point here.