Before You Start
Complete the shared setup requirements. This path requires no Orbs runtime package, but the TypeScript examples use Viem for wallet and contract operations. Initialize the account, chain, and Viem clients at the top of the create-order file. Supply the chain-specific wrapped-token address and a validated OrderInput from your host form.
Implement in this order: configuration fetch, strategy derivation, the two Create Order reference files, history, then cancellation. The host owns strategy math, protocol field validation, HTTP requests, and wallet transactions.
Start with the shared Partner Configuration and Input Tokens requirements, then implement these API operations.
The API-only integration uses these HTTP and on-chain operations:
| Operation | Contract |
|---|---|
| Fetch configuration | GET https://order-sink-v2.orbs.network/config?partner={partner}&chain={chainId} with Accept: application/json. |
| Create order | POST https://order-sink-v2.orbs.network/orders/new with JSON { signature, order, status: "pending" }. order must be the exact EIP-712 message that produced signature. |
| Fetch history | GET https://order-sink-v2.orbs.network/orders?swapper={account}&chainId={chainId}&partner={partner}. Returns all matching v2 orders in one request. |
| Cancel | Send the on-chain transaction cancel([metadata.repermitDigest]) to domain.verifyingContract; cancellation is not an Order Sink HTTP request. |
Function Contracts
The two Create Order files are create-order-flow.ts and order-types.ts. They provide the following functions; equivalent HTTP and wallet operations can be implemented in another language.
| Function | Contract |
|---|---|
fetchDefaultPermitData(partnerId, chainId) | Fetches the partner-chain configuration; returns PermitData containing domain, types, primaryType, and the base order. |
buildOrderFromDerivedValues({ orderInput, permitData, inputTokenAddress }) | Uses the supplied permit data, validates the schedule, and returns { order, permitData }. |
signOrder({ orderInput, permitData, inputTokenAddress }) | Builds the order, signs its EIP-712 payload, and returns { order, signature }. |
submitOrdersSinkOrder({ orderInput, wTokenAddress }) | Prepares funds, calls signOrder, and returns the accepted OrderResponse. Its internal submitOrder(order, signature) helper posts the unchanged signed message to Order Sink. |
Use your DEX partner ID in each fetchDefaultPermitData call for creation and cancellation, and the partner query parameter for history; use "external" if you do not have one. The host supplies the active account and chain to each operation.
The RePermit contract, reactor, executor, exchange adapter, and fee reference addresses come from the fetched partner configuration. Do not hardcode them in the integration.