Prerequisites
- A wallet on the source chain (any wallet that can sign EIP-191
personal_signmessages) - The source asset approved to the TWAP service’s enclave address (see
GET /addressbelow) - The
eciesEncrypthelper and endpoint URLs from endpoints and helpers
https://twap.tachyon.pe (replace ${TWAP_URL} in the snippets below).
1. Fetch the TWAP service’s ECIES public key
2. Fetch the TEE wallet address (for approval)
approve their source asset to this address so the service can pull funds on order creation.
3. Build the order
period≥ 5 secondsendTime>startTimerecipients.length === amounts.length, both > 0amountPerPeriod> 0totalAmountIn≥amountPerPeriodchainIn/chainOutmust match the service’s configured chain names
4. Encrypt the order
Serialize to JSON and encrypt with the service’s ECIES pubkey:5. Sign the matching personal-sign message
Pick any canonical message, the service verifies that the personal-sign recovery matchesorder.user. A common pattern:
6. Submit
- Verifies the signature recovers to
order.user - Decrypts the order
- Pulls
totalAmountInin a single on-chaintransferFromfromorder.userto its TEE wallet - Schedules the first tranche (either immediately if
startTimehas passed, or atstartTime)
7. Poll order status
BridgeIntent on the source chain bridge contract. Track individual tranche settlement through the relayer’s GET /intent-details/:intentId using each intentId from order.intentIds.
8. Cancel (optional)
Solver reward and expected output
Per tranche, the service:- Deducts 5% of
amountPerPeriodas the solver reward (included asrewardon theBridgeIntent) - Sets
expectedAmountBon theBridgeIntentto the sum oforder.amounts[](your minimum acceptable output on destination) - Sets auction duration to
period / 2(minimum 20 seconds)
Recipients on destination
Recipients are stored encrypted in the relayer viaPOST /store-recipients after each createIntent call. The winning solver fetches them via GET /get-recipients/:intentId (which only returns the decrypted list to the auction winner) and delivers to those addresses on the destination chain.
Open the hosted TWAP app
Walk through this flow without writing code.