Skip to main content
POST
/
rpc
/
Trails
/
BuildOIFRefundTransaction
cURL
curl --request POST \
  --url https://trails-api.sequence.app/rpc/Trails/BuildOIFRefundTransaction \
  --header 'Content-Type: application/json' \
  --data '
{
  "intentId": "<string>"
}
'
{
  "intentId": "<string>",
  "to": "<string>",
  "data": "<string>",
  "value": "<string>",
  "chainId": 123,
  "ready": true,
  "status": "<string>",
  "orderId": "<string>",
  "orderExpiresAt": "<string>"
}

Overview

The BuildOIFRefundTransaction endpoint returns the direct on-chain transaction needed to refund an expired or unfilled OIF (Open Intents Framework) order through its input settler. After the order’s orderExpiresAt deadline passes without a solver fill, any wallet can broadcast this transaction to return funds to the user.

Use Cases

  • Refund an OIF order whose solver did not fill before expiry
  • Self-serve recovery from a stranded OIF deposit

Request Parameters

Required Fields

  • intentId (string): The intent whose OIF order should be refunded.

Response

  • intentId (string)
  • orderId (string, optional): The on-chain OIF order ID, when known.
  • to (string): Transaction to address — the input settler contract.
  • data (string): Transaction calldata.
  • value (string): Transaction value (bigint).
  • chainId (number): Chain to broadcast on.
  • orderExpiresAt (string, optional): The expiry timestamp; the refund cannot be submitted until after this time.
  • ready (boolean): true when the order is in a state where the refund can be submitted now.
  • status (string): Current order state.

Example

const response = await fetch('https://trails-api.sequence.app/rpc/Trails/BuildOIFRefundTransaction', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY'
  },
  body: JSON.stringify({ intentId: 'intent_abc123' })
});

const tx = await response.json();

if (!tx.ready) {
  console.log('OIF order is not yet refundable. Status:', tx.status, 'expires:', tx.orderExpiresAt);
  return;
}

const hash = await walletClient.sendTransaction({
  to: tx.to,
  data: tx.data,
  value: BigInt(tx.value),
  chainId: tx.chainId
});
OIF refunds are only available for intents that used the OIF route provider. See Route Providers — OIF for routing details.

Next Steps

GetIntent

Inspect the intent’s state and OIF order details

AbortIntent

Notify Trails after broadcasting the refund

Body

application/json
intentId
string
required

Response

OK

intentId
string
required
to
string
required
data
string
required
value
string
required
chainId
number
required
ready
boolean
required
status
string
required
orderId
string
orderExpiresAt
string