This quickstart is for applications that want to drive an Oryn swap flow directly through the current APIs.
The stable public SDK is planned. For now, use the orderbook and relayer APIs directly, then move to the SDK once the same primitives are packaged.
1. Get a quote
Request a quote for the user’s intent. The quote should give your app:
quote_id
- source asset and amount
- destination asset and amount
- route type
- fee basis points
- expiry
The orderbook later consumes this quote. Do not modify quoted assets or amounts locally.
2. Generate a secret
Generate a 32-byte random secret in the client or a trusted signing environment, then hash it with SHA-256.
const secret = crypto.getRandomValues(new Uint8Array(32));
const digest = await crypto.subtle.digest("SHA-256", secret);
const commitmentHash = `0x${[...new Uint8Array(digest)]
.map((byte) => byte.toString(16).padStart(2, "0"))
.join("")}`;
Do not reuse secrets across orders. Do not log the raw secret.
3. Create the order
curl -X POST http://localhost:4433/orders \
-H "content-type: application/json" \
-d '{
"user_id": "user_123",
"quote_id": "550e8400-e29b-41d4-a716-446655440000",
"source": {
"asset": "avalanche_testnet:usdc",
"recipient": "0x1234567890abcdef1234567890abcdef12345678",
"amount": "1000000"
},
"destination": {
"asset": "echo_testnet:usdc",
"recipient": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
"amount": "995000"
},
"commitment_hash": "0xaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd"
}'
Save these fields from the response:
| Field | Use |
|---|
order_id | Polling and relayer claim submission. |
source_intent.swap_id | Source-side escrow address. |
destination_intent.swap_id | Destination-side escrow address. |
destination_intent.l1_hop | Whether a hop claim payload is required. |
4. Initiate the source side
Choose the initiation path that matches your UX:
| UX | Contract path |
|---|
| User pre-funds predicted vault | createEscrow |
| User sends native token in one transaction | createEscrowNative |
| User signs EIP-2612 permit | createEscrowPermit |
| Relayer submits creator-signed authorization | createEscrowSigned |
5. Claim the destination side
For direct routes:
curl -X POST http://localhost:8081/claims \
-H "content-type: application/json" \
-d '{
"order_id": "ord_123",
"secret": "0x0000000000000000000000000000000000000000000000000000000000000001"
}'
For Avalanche hop routes, include the recipient-signed hop payload. See Claim Flow.
6. Poll order state
curl http://localhost:4433/orders/ord_123
Track both sides of the order. Direct routes complete when the expected claim transactions appear. Hop routes may also need bridge dispatch state.