cURL
curl --request POST \
--url https://api.example.com/rpc/Trails/BuildOIFRefundTransaction \
--header 'Content-Type: application/json' \
--data '
{
"intentId": "<string>"
}
'import requests
url = "https://api.example.com/rpc/Trails/BuildOIFRefundTransaction"
payload = { "intentId": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({intentId: '<string>'})
};
fetch('https://api.example.com/rpc/Trails/BuildOIFRefundTransaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/rpc/Trails/BuildOIFRefundTransaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'intentId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/rpc/Trails/BuildOIFRefundTransaction"
payload := strings.NewReader("{\n \"intentId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/rpc/Trails/BuildOIFRefundTransaction")
.header("Content-Type", "application/json")
.body("{\n \"intentId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/BuildOIFRefundTransaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"intentId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"intentId": "<string>",
"to": "<string>",
"data": "<string>",
"value": "<string>",
"chainId": 123,
"ready": true,
"status": "<string>",
"orderId": "<string>",
"orderExpiresAt": "<string>"
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Intents (Advanced)
BuildOIFRefundTransaction
POST
/
rpc
/
Trails
/
BuildOIFRefundTransaction
cURL
curl --request POST \
--url https://api.example.com/rpc/Trails/BuildOIFRefundTransaction \
--header 'Content-Type: application/json' \
--data '
{
"intentId": "<string>"
}
'import requests
url = "https://api.example.com/rpc/Trails/BuildOIFRefundTransaction"
payload = { "intentId": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({intentId: '<string>'})
};
fetch('https://api.example.com/rpc/Trails/BuildOIFRefundTransaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/rpc/Trails/BuildOIFRefundTransaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'intentId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/rpc/Trails/BuildOIFRefundTransaction"
payload := strings.NewReader("{\n \"intentId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/rpc/Trails/BuildOIFRefundTransaction")
.header("Content-Type", "application/json")
.body("{\n \"intentId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/BuildOIFRefundTransaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"intentId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"intentId": "<string>",
"to": "<string>",
"data": "<string>",
"value": "<string>",
"chainId": 123,
"ready": true,
"status": "<string>",
"orderId": "<string>",
"orderExpiresAt": "<string>"
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Overview
TheBuildOIFRefundTransaction 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
toaddress — 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):
truewhen 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
Was this page helpful?