cURL
curl --request POST \
--url https://api.example.com/rpc/Trails/QuoteIntent \
--header 'Content-Type: application/json' \
--data '
{
"ownerAddress": "<string>",
"originChainId": 123,
"originTokenAddress": "<string>",
"destinationChainId": 123,
"destinationTokenAddress": "<string>",
"destinationToAddress": "<string>",
"destinationApproveAddress": "<string>",
"destinationCallData": "<string>",
"destinationCallValue": 123,
"originTokenAmount": 123,
"destinationTokenAmount": 123,
"onlyNativeGasFee": true,
"options": {
"swapProviderFallback": true,
"bridgeProviderFallback": true,
"slippageTolerance": 123,
"trailsAddressOverrides": {
"sequenceWalletFactoryAddress": "<string>",
"sequenceWalletMainModuleAddress": "<string>",
"sequenceWalletMainModuleUpgradableAddress": "<string>",
"sequenceWalletGuestModuleAddress": "<string>",
"sequenceWalletUtilsAddress": "<string>"
},
"disablePassthrough": true
}
}
'import requests
url = "https://api.example.com/rpc/Trails/QuoteIntent"
payload = {
"ownerAddress": "<string>",
"originChainId": 123,
"originTokenAddress": "<string>",
"destinationChainId": 123,
"destinationTokenAddress": "<string>",
"destinationToAddress": "<string>",
"destinationApproveAddress": "<string>",
"destinationCallData": "<string>",
"destinationCallValue": 123,
"originTokenAmount": 123,
"destinationTokenAmount": 123,
"onlyNativeGasFee": True,
"options": {
"swapProviderFallback": True,
"bridgeProviderFallback": True,
"slippageTolerance": 123,
"trailsAddressOverrides": {
"sequenceWalletFactoryAddress": "<string>",
"sequenceWalletMainModuleAddress": "<string>",
"sequenceWalletMainModuleUpgradableAddress": "<string>",
"sequenceWalletGuestModuleAddress": "<string>",
"sequenceWalletUtilsAddress": "<string>"
},
"disablePassthrough": True
}
}
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({
ownerAddress: '<string>',
originChainId: 123,
originTokenAddress: '<string>',
destinationChainId: 123,
destinationTokenAddress: '<string>',
destinationToAddress: '<string>',
destinationApproveAddress: '<string>',
destinationCallData: '<string>',
destinationCallValue: 123,
originTokenAmount: 123,
destinationTokenAmount: 123,
onlyNativeGasFee: true,
options: {
swapProviderFallback: true,
bridgeProviderFallback: true,
slippageTolerance: 123,
trailsAddressOverrides: {
sequenceWalletFactoryAddress: '<string>',
sequenceWalletMainModuleAddress: '<string>',
sequenceWalletMainModuleUpgradableAddress: '<string>',
sequenceWalletGuestModuleAddress: '<string>',
sequenceWalletUtilsAddress: '<string>'
},
disablePassthrough: true
}
})
};
fetch('https://api.example.com/rpc/Trails/QuoteIntent', 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/QuoteIntent",
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([
'ownerAddress' => '<string>',
'originChainId' => 123,
'originTokenAddress' => '<string>',
'destinationChainId' => 123,
'destinationTokenAddress' => '<string>',
'destinationToAddress' => '<string>',
'destinationApproveAddress' => '<string>',
'destinationCallData' => '<string>',
'destinationCallValue' => 123,
'originTokenAmount' => 123,
'destinationTokenAmount' => 123,
'onlyNativeGasFee' => true,
'options' => [
'swapProviderFallback' => true,
'bridgeProviderFallback' => true,
'slippageTolerance' => 123,
'trailsAddressOverrides' => [
'sequenceWalletFactoryAddress' => '<string>',
'sequenceWalletMainModuleAddress' => '<string>',
'sequenceWalletMainModuleUpgradableAddress' => '<string>',
'sequenceWalletGuestModuleAddress' => '<string>',
'sequenceWalletUtilsAddress' => '<string>'
],
'disablePassthrough' => true
]
]),
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/QuoteIntent"
payload := strings.NewReader("{\n \"ownerAddress\": \"<string>\",\n \"originChainId\": 123,\n \"originTokenAddress\": \"<string>\",\n \"destinationChainId\": 123,\n \"destinationTokenAddress\": \"<string>\",\n \"destinationToAddress\": \"<string>\",\n \"destinationApproveAddress\": \"<string>\",\n \"destinationCallData\": \"<string>\",\n \"destinationCallValue\": 123,\n \"originTokenAmount\": 123,\n \"destinationTokenAmount\": 123,\n \"onlyNativeGasFee\": true,\n \"options\": {\n \"swapProviderFallback\": true,\n \"bridgeProviderFallback\": true,\n \"slippageTolerance\": 123,\n \"trailsAddressOverrides\": {\n \"sequenceWalletFactoryAddress\": \"<string>\",\n \"sequenceWalletMainModuleAddress\": \"<string>\",\n \"sequenceWalletMainModuleUpgradableAddress\": \"<string>\",\n \"sequenceWalletGuestModuleAddress\": \"<string>\",\n \"sequenceWalletUtilsAddress\": \"<string>\"\n },\n \"disablePassthrough\": true\n }\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/QuoteIntent")
.header("Content-Type", "application/json")
.body("{\n \"ownerAddress\": \"<string>\",\n \"originChainId\": 123,\n \"originTokenAddress\": \"<string>\",\n \"destinationChainId\": 123,\n \"destinationTokenAddress\": \"<string>\",\n \"destinationToAddress\": \"<string>\",\n \"destinationApproveAddress\": \"<string>\",\n \"destinationCallData\": \"<string>\",\n \"destinationCallValue\": 123,\n \"originTokenAmount\": 123,\n \"destinationTokenAmount\": 123,\n \"onlyNativeGasFee\": true,\n \"options\": {\n \"swapProviderFallback\": true,\n \"bridgeProviderFallback\": true,\n \"slippageTolerance\": 123,\n \"trailsAddressOverrides\": {\n \"sequenceWalletFactoryAddress\": \"<string>\",\n \"sequenceWalletMainModuleAddress\": \"<string>\",\n \"sequenceWalletMainModuleUpgradableAddress\": \"<string>\",\n \"sequenceWalletGuestModuleAddress\": \"<string>\",\n \"sequenceWalletUtilsAddress\": \"<string>\"\n },\n \"disablePassthrough\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/QuoteIntent")
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 \"ownerAddress\": \"<string>\",\n \"originChainId\": 123,\n \"originTokenAddress\": \"<string>\",\n \"destinationChainId\": 123,\n \"destinationTokenAddress\": \"<string>\",\n \"destinationToAddress\": \"<string>\",\n \"destinationApproveAddress\": \"<string>\",\n \"destinationCallData\": \"<string>\",\n \"destinationCallValue\": 123,\n \"originTokenAmount\": 123,\n \"destinationTokenAmount\": 123,\n \"onlyNativeGasFee\": true,\n \"options\": {\n \"swapProviderFallback\": true,\n \"bridgeProviderFallback\": true,\n \"slippageTolerance\": 123,\n \"trailsAddressOverrides\": {\n \"sequenceWalletFactoryAddress\": \"<string>\",\n \"sequenceWalletMainModuleAddress\": \"<string>\",\n \"sequenceWalletMainModuleUpgradableAddress\": \"<string>\",\n \"sequenceWalletGuestModuleAddress\": \"<string>\",\n \"sequenceWalletUtilsAddress\": \"<string>\"\n },\n \"disablePassthrough\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"intent": {
"id": 123,
"projectId": 123,
"intentId": "<string>",
"status": "QUOTED",
"quoteRequest": {
"ownerAddress": "<string>",
"originChainId": 123,
"originTokenAddress": "<string>",
"destinationChainId": 123,
"destinationTokenAddress": "<string>",
"destinationToAddress": "<string>",
"destinationApproveAddress": "<string>",
"destinationCallData": "<string>",
"destinationCallValue": 123,
"originTokenAmount": 123,
"destinationTokenAmount": 123,
"tradeType": "EXACT_INPUT",
"fundMethod": "WALLET",
"mode": "SWAP",
"onlyNativeGasFee": true,
"options": {
"intentProtocol": "v1",
"swapProvider": "AUTO",
"bridgeProvider": "AUTO",
"swapProviderFallback": true,
"bridgeProviderFallback": true,
"preference": "RECOMMENDED",
"slippageTolerance": 123,
"trailsAddressOverrides": {
"sequenceWalletFactoryAddress": "<string>",
"sequenceWalletMainModuleAddress": "<string>",
"sequenceWalletMainModuleUpgradableAddress": "<string>",
"sequenceWalletGuestModuleAddress": "<string>",
"sequenceWalletUtilsAddress": "<string>"
},
"disablePassthrough": true
},
"settlement": {
"provider": "stripe",
"amountCents": 123,
"checkoutRef": "<string>",
"currency": "<string>",
"chainId": 123,
"orderRef": "<string>"
}
},
"ownerAddress": "<string>",
"originChainId": 123,
"destinationChainId": 123,
"originTokenAddress": "<string>",
"destinationTokenAddress": "<string>",
"originIntentAddress": "<string>",
"salt": 123,
"depositTransaction": {
"toAddress": "<string>",
"tokenAddress": "<string>",
"amount": 123,
"chainId": 123,
"to": "<string>",
"data": "<string>",
"value": 123,
"decimals": 123
},
"originCalls": {
"chainId": 123,
"calls": [
{
"to": "<string>",
"value": 123,
"data": "<string>",
"gasLimit": 123,
"delegateCall": true,
"onlyFallback": true,
"behaviorOnError": 123
}
],
"space": 123,
"nonce": 123
},
"originPrecondition": {
"type": "<string>",
"chainId": 123,
"ownerAddress": "<string>",
"tokenAddress": "<string>",
"minAmount": 123
},
"originMetaTxn": {
"id": "<string>",
"chainId": 123,
"walletAddress": "<string>",
"contract": "<string>",
"input": "<string>",
"bridgeGas": 123
},
"quote": {
"routeProviders": [
"AUTO"
],
"routeProvidersRequestIds": [
"<string>"
],
"routeProvidersFeeUsd": [
123
],
"fromAmount": 123,
"fromAmountMin": 123,
"fromAmountUsd": 123,
"fromAmountMinUsd": 123,
"toAmount": 123,
"toAmountMin": 123,
"toAmountUsd": 123,
"toAmountMinUsd": 123,
"maxSlippage": 123,
"priceImpact": 123,
"priceImpactUsd": 123,
"priceImpactDetails": {
"executionPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"marketPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"providerFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"trailsFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"netPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
}
},
"estimatedDuration": 123
},
"fees": {
"originGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
},
"provider": {
"quoteProvider": "<string>",
"quoteProviderFee": 123,
"quoteProviderFeeUsd": 123,
"trailsFee": 123,
"trailsFeeUsd": 123,
"quoteProviderWithTrailsFee": 123,
"providerWithTrailsFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123
},
"feeTokenAddress": "<string>",
"feeTokenAmount": 123,
"feeTokenUsd": 123,
"feeTokenTotal": 123,
"gasFeeTotal": 123,
"gasFeeUsd": 123,
"trailsFeeTotal": 123,
"trailsFeeUsd": 123,
"collectorFeeTotal": 123,
"collectorFeeUsd": 123,
"providerFeeTotal": 123,
"providerFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"destinationGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
}
},
"trailsVersion": "<string>",
"trailsContracts": {
"trailsIntentEntrypointAddress": "<string>",
"trailsRouterAddress": "<string>",
"trailsRouterShimAddress": "<string>",
"trailsUtilsAddress": "<string>"
},
"expiresAt": "<string>",
"isTestnet": true,
"destinationIntentAddress": "<string>",
"edge": {
"edgeId": "<string>",
"rail": "SOLANA",
"mode": "ORIGIN",
"edgeStatus": "PENDING",
"originChainId": 123,
"relayRequestId": "<string>",
"edgeTokenAmount": 123,
"edgeTokenAddress": "<string>",
"edgeUserAddress": "<string>",
"initTransactionHash": "<string>",
"initChainId": 123,
"fillTransactionHash": "<string>",
"fillChainId": 123,
"refundTransactionHash": "<string>",
"refundChainId": 123,
"edgeTokenMetadata": {
"chainId": 123,
"tokenAddress": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"logoUri": "<string>"
},
"createdAt": "<string>"
},
"passthrough": true,
"destinationCalls": {
"chainId": 123,
"calls": [
{
"to": "<string>",
"value": 123,
"data": "<string>",
"gasLimit": 123,
"delegateCall": true,
"onlyFallback": true,
"behaviorOnError": 123
}
],
"space": 123,
"nonce": 123
},
"destinationPrecondition": {
"type": "<string>",
"chainId": 123,
"ownerAddress": "<string>",
"tokenAddress": "<string>",
"minAmount": 123
},
"destinationMetaTxn": {
"id": "<string>",
"chainId": 123,
"walletAddress": "<string>",
"contract": "<string>",
"input": "<string>",
"bridgeGas": 123
},
"gasFeeOptions": {
"gasEstimate": {
"totalGas": 123,
"gasPrice": "<string>",
"nativeCost": "<string>",
"nativeCostUsd": 123
},
"feeOptions": [
{
"tokenAddress": "<string>",
"tokenSymbol": "<string>",
"tokenDecimals": 123,
"amount": 123,
"amountUsd": 123,
"feeCollectorAddress": "<string>",
"is2612": true,
"isPassthroughEligible": true
}
],
"expiresAt": "<string>",
"feeCollectorAddress": "<string>"
},
"intentProtocol": "v1",
"timedRefundUnlockTimestamp": 123,
"pausableSapientSignerAddress": "<string>",
"updatedAt": "<string>",
"createdAt": "<string>"
},
"gasFeeOptions": {
"gasEstimate": {
"totalGas": 123,
"gasPrice": "<string>",
"nativeCost": "<string>",
"nativeCostUsd": 123
},
"feeOptions": [
{
"tokenAddress": "<string>",
"tokenSymbol": "<string>",
"tokenDecimals": 123,
"amount": 123,
"amountUsd": 123,
"feeCollectorAddress": "<string>",
"is2612": true,
"isPassthroughEligible": true
}
],
"expiresAt": "<string>",
"feeCollectorAddress": "<string>"
},
"originConfiguration": {},
"destinationConfiguration": {},
"transactionStates": [
{
"id": "<string>",
"label": "<string>",
"chainId": 123,
"description": "<string>",
"transactionHash": "<string>"
}
],
"passthrough": {
"eligible": true,
"passthroughTransaction": {
"toAddress": "<string>",
"tokenAddress": "<string>",
"amount": 123,
"chainId": 123,
"to": "<string>",
"data": "<string>",
"value": 123,
"decimals": 123
},
"transactionStates": [
{
"id": "<string>",
"label": "<string>",
"chainId": 123,
"description": "<string>",
"transactionHash": "<string>"
}
],
"quote": {
"routeProviders": [
"AUTO"
],
"routeProvidersRequestIds": [
"<string>"
],
"routeProvidersFeeUsd": [
123
],
"fromAmount": 123,
"fromAmountMin": 123,
"fromAmountUsd": 123,
"fromAmountMinUsd": 123,
"toAmount": 123,
"toAmountMin": 123,
"toAmountUsd": 123,
"toAmountMinUsd": 123,
"maxSlippage": 123,
"priceImpact": 123,
"priceImpactUsd": 123,
"priceImpactDetails": {
"executionPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"marketPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"providerFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"trailsFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"netPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
}
},
"estimatedDuration": 123
},
"fees": {
"originGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
},
"provider": {
"quoteProvider": "<string>",
"quoteProviderFee": 123,
"quoteProviderFeeUsd": 123,
"trailsFee": 123,
"trailsFeeUsd": 123,
"quoteProviderWithTrailsFee": 123,
"providerWithTrailsFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123
},
"feeTokenAddress": "<string>",
"feeTokenAmount": 123,
"feeTokenUsd": 123,
"feeTokenTotal": 123,
"gasFeeTotal": 123,
"gasFeeUsd": 123,
"trailsFeeTotal": 123,
"trailsFeeUsd": 123,
"collectorFeeTotal": 123,
"collectorFeeUsd": 123,
"providerFeeTotal": 123,
"providerFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"destinationGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
}
}
},
"settlement": {
"provider": "stripe",
"reference": "<string>",
"currency": "<string>",
"amountCents": 123,
"amountUsd": "<string>",
"livemode": true,
"chainId": 123
}
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Intents
QuoteIntent
POST
/
rpc
/
Trails
/
QuoteIntent
cURL
curl --request POST \
--url https://api.example.com/rpc/Trails/QuoteIntent \
--header 'Content-Type: application/json' \
--data '
{
"ownerAddress": "<string>",
"originChainId": 123,
"originTokenAddress": "<string>",
"destinationChainId": 123,
"destinationTokenAddress": "<string>",
"destinationToAddress": "<string>",
"destinationApproveAddress": "<string>",
"destinationCallData": "<string>",
"destinationCallValue": 123,
"originTokenAmount": 123,
"destinationTokenAmount": 123,
"onlyNativeGasFee": true,
"options": {
"swapProviderFallback": true,
"bridgeProviderFallback": true,
"slippageTolerance": 123,
"trailsAddressOverrides": {
"sequenceWalletFactoryAddress": "<string>",
"sequenceWalletMainModuleAddress": "<string>",
"sequenceWalletMainModuleUpgradableAddress": "<string>",
"sequenceWalletGuestModuleAddress": "<string>",
"sequenceWalletUtilsAddress": "<string>"
},
"disablePassthrough": true
}
}
'import requests
url = "https://api.example.com/rpc/Trails/QuoteIntent"
payload = {
"ownerAddress": "<string>",
"originChainId": 123,
"originTokenAddress": "<string>",
"destinationChainId": 123,
"destinationTokenAddress": "<string>",
"destinationToAddress": "<string>",
"destinationApproveAddress": "<string>",
"destinationCallData": "<string>",
"destinationCallValue": 123,
"originTokenAmount": 123,
"destinationTokenAmount": 123,
"onlyNativeGasFee": True,
"options": {
"swapProviderFallback": True,
"bridgeProviderFallback": True,
"slippageTolerance": 123,
"trailsAddressOverrides": {
"sequenceWalletFactoryAddress": "<string>",
"sequenceWalletMainModuleAddress": "<string>",
"sequenceWalletMainModuleUpgradableAddress": "<string>",
"sequenceWalletGuestModuleAddress": "<string>",
"sequenceWalletUtilsAddress": "<string>"
},
"disablePassthrough": True
}
}
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({
ownerAddress: '<string>',
originChainId: 123,
originTokenAddress: '<string>',
destinationChainId: 123,
destinationTokenAddress: '<string>',
destinationToAddress: '<string>',
destinationApproveAddress: '<string>',
destinationCallData: '<string>',
destinationCallValue: 123,
originTokenAmount: 123,
destinationTokenAmount: 123,
onlyNativeGasFee: true,
options: {
swapProviderFallback: true,
bridgeProviderFallback: true,
slippageTolerance: 123,
trailsAddressOverrides: {
sequenceWalletFactoryAddress: '<string>',
sequenceWalletMainModuleAddress: '<string>',
sequenceWalletMainModuleUpgradableAddress: '<string>',
sequenceWalletGuestModuleAddress: '<string>',
sequenceWalletUtilsAddress: '<string>'
},
disablePassthrough: true
}
})
};
fetch('https://api.example.com/rpc/Trails/QuoteIntent', 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/QuoteIntent",
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([
'ownerAddress' => '<string>',
'originChainId' => 123,
'originTokenAddress' => '<string>',
'destinationChainId' => 123,
'destinationTokenAddress' => '<string>',
'destinationToAddress' => '<string>',
'destinationApproveAddress' => '<string>',
'destinationCallData' => '<string>',
'destinationCallValue' => 123,
'originTokenAmount' => 123,
'destinationTokenAmount' => 123,
'onlyNativeGasFee' => true,
'options' => [
'swapProviderFallback' => true,
'bridgeProviderFallback' => true,
'slippageTolerance' => 123,
'trailsAddressOverrides' => [
'sequenceWalletFactoryAddress' => '<string>',
'sequenceWalletMainModuleAddress' => '<string>',
'sequenceWalletMainModuleUpgradableAddress' => '<string>',
'sequenceWalletGuestModuleAddress' => '<string>',
'sequenceWalletUtilsAddress' => '<string>'
],
'disablePassthrough' => true
]
]),
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/QuoteIntent"
payload := strings.NewReader("{\n \"ownerAddress\": \"<string>\",\n \"originChainId\": 123,\n \"originTokenAddress\": \"<string>\",\n \"destinationChainId\": 123,\n \"destinationTokenAddress\": \"<string>\",\n \"destinationToAddress\": \"<string>\",\n \"destinationApproveAddress\": \"<string>\",\n \"destinationCallData\": \"<string>\",\n \"destinationCallValue\": 123,\n \"originTokenAmount\": 123,\n \"destinationTokenAmount\": 123,\n \"onlyNativeGasFee\": true,\n \"options\": {\n \"swapProviderFallback\": true,\n \"bridgeProviderFallback\": true,\n \"slippageTolerance\": 123,\n \"trailsAddressOverrides\": {\n \"sequenceWalletFactoryAddress\": \"<string>\",\n \"sequenceWalletMainModuleAddress\": \"<string>\",\n \"sequenceWalletMainModuleUpgradableAddress\": \"<string>\",\n \"sequenceWalletGuestModuleAddress\": \"<string>\",\n \"sequenceWalletUtilsAddress\": \"<string>\"\n },\n \"disablePassthrough\": true\n }\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/QuoteIntent")
.header("Content-Type", "application/json")
.body("{\n \"ownerAddress\": \"<string>\",\n \"originChainId\": 123,\n \"originTokenAddress\": \"<string>\",\n \"destinationChainId\": 123,\n \"destinationTokenAddress\": \"<string>\",\n \"destinationToAddress\": \"<string>\",\n \"destinationApproveAddress\": \"<string>\",\n \"destinationCallData\": \"<string>\",\n \"destinationCallValue\": 123,\n \"originTokenAmount\": 123,\n \"destinationTokenAmount\": 123,\n \"onlyNativeGasFee\": true,\n \"options\": {\n \"swapProviderFallback\": true,\n \"bridgeProviderFallback\": true,\n \"slippageTolerance\": 123,\n \"trailsAddressOverrides\": {\n \"sequenceWalletFactoryAddress\": \"<string>\",\n \"sequenceWalletMainModuleAddress\": \"<string>\",\n \"sequenceWalletMainModuleUpgradableAddress\": \"<string>\",\n \"sequenceWalletGuestModuleAddress\": \"<string>\",\n \"sequenceWalletUtilsAddress\": \"<string>\"\n },\n \"disablePassthrough\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/QuoteIntent")
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 \"ownerAddress\": \"<string>\",\n \"originChainId\": 123,\n \"originTokenAddress\": \"<string>\",\n \"destinationChainId\": 123,\n \"destinationTokenAddress\": \"<string>\",\n \"destinationToAddress\": \"<string>\",\n \"destinationApproveAddress\": \"<string>\",\n \"destinationCallData\": \"<string>\",\n \"destinationCallValue\": 123,\n \"originTokenAmount\": 123,\n \"destinationTokenAmount\": 123,\n \"onlyNativeGasFee\": true,\n \"options\": {\n \"swapProviderFallback\": true,\n \"bridgeProviderFallback\": true,\n \"slippageTolerance\": 123,\n \"trailsAddressOverrides\": {\n \"sequenceWalletFactoryAddress\": \"<string>\",\n \"sequenceWalletMainModuleAddress\": \"<string>\",\n \"sequenceWalletMainModuleUpgradableAddress\": \"<string>\",\n \"sequenceWalletGuestModuleAddress\": \"<string>\",\n \"sequenceWalletUtilsAddress\": \"<string>\"\n },\n \"disablePassthrough\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"intent": {
"id": 123,
"projectId": 123,
"intentId": "<string>",
"status": "QUOTED",
"quoteRequest": {
"ownerAddress": "<string>",
"originChainId": 123,
"originTokenAddress": "<string>",
"destinationChainId": 123,
"destinationTokenAddress": "<string>",
"destinationToAddress": "<string>",
"destinationApproveAddress": "<string>",
"destinationCallData": "<string>",
"destinationCallValue": 123,
"originTokenAmount": 123,
"destinationTokenAmount": 123,
"tradeType": "EXACT_INPUT",
"fundMethod": "WALLET",
"mode": "SWAP",
"onlyNativeGasFee": true,
"options": {
"intentProtocol": "v1",
"swapProvider": "AUTO",
"bridgeProvider": "AUTO",
"swapProviderFallback": true,
"bridgeProviderFallback": true,
"preference": "RECOMMENDED",
"slippageTolerance": 123,
"trailsAddressOverrides": {
"sequenceWalletFactoryAddress": "<string>",
"sequenceWalletMainModuleAddress": "<string>",
"sequenceWalletMainModuleUpgradableAddress": "<string>",
"sequenceWalletGuestModuleAddress": "<string>",
"sequenceWalletUtilsAddress": "<string>"
},
"disablePassthrough": true
},
"settlement": {
"provider": "stripe",
"amountCents": 123,
"checkoutRef": "<string>",
"currency": "<string>",
"chainId": 123,
"orderRef": "<string>"
}
},
"ownerAddress": "<string>",
"originChainId": 123,
"destinationChainId": 123,
"originTokenAddress": "<string>",
"destinationTokenAddress": "<string>",
"originIntentAddress": "<string>",
"salt": 123,
"depositTransaction": {
"toAddress": "<string>",
"tokenAddress": "<string>",
"amount": 123,
"chainId": 123,
"to": "<string>",
"data": "<string>",
"value": 123,
"decimals": 123
},
"originCalls": {
"chainId": 123,
"calls": [
{
"to": "<string>",
"value": 123,
"data": "<string>",
"gasLimit": 123,
"delegateCall": true,
"onlyFallback": true,
"behaviorOnError": 123
}
],
"space": 123,
"nonce": 123
},
"originPrecondition": {
"type": "<string>",
"chainId": 123,
"ownerAddress": "<string>",
"tokenAddress": "<string>",
"minAmount": 123
},
"originMetaTxn": {
"id": "<string>",
"chainId": 123,
"walletAddress": "<string>",
"contract": "<string>",
"input": "<string>",
"bridgeGas": 123
},
"quote": {
"routeProviders": [
"AUTO"
],
"routeProvidersRequestIds": [
"<string>"
],
"routeProvidersFeeUsd": [
123
],
"fromAmount": 123,
"fromAmountMin": 123,
"fromAmountUsd": 123,
"fromAmountMinUsd": 123,
"toAmount": 123,
"toAmountMin": 123,
"toAmountUsd": 123,
"toAmountMinUsd": 123,
"maxSlippage": 123,
"priceImpact": 123,
"priceImpactUsd": 123,
"priceImpactDetails": {
"executionPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"marketPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"providerFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"trailsFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"netPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
}
},
"estimatedDuration": 123
},
"fees": {
"originGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
},
"provider": {
"quoteProvider": "<string>",
"quoteProviderFee": 123,
"quoteProviderFeeUsd": 123,
"trailsFee": 123,
"trailsFeeUsd": 123,
"quoteProviderWithTrailsFee": 123,
"providerWithTrailsFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123
},
"feeTokenAddress": "<string>",
"feeTokenAmount": 123,
"feeTokenUsd": 123,
"feeTokenTotal": 123,
"gasFeeTotal": 123,
"gasFeeUsd": 123,
"trailsFeeTotal": 123,
"trailsFeeUsd": 123,
"collectorFeeTotal": 123,
"collectorFeeUsd": 123,
"providerFeeTotal": 123,
"providerFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"destinationGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
}
},
"trailsVersion": "<string>",
"trailsContracts": {
"trailsIntentEntrypointAddress": "<string>",
"trailsRouterAddress": "<string>",
"trailsRouterShimAddress": "<string>",
"trailsUtilsAddress": "<string>"
},
"expiresAt": "<string>",
"isTestnet": true,
"destinationIntentAddress": "<string>",
"edge": {
"edgeId": "<string>",
"rail": "SOLANA",
"mode": "ORIGIN",
"edgeStatus": "PENDING",
"originChainId": 123,
"relayRequestId": "<string>",
"edgeTokenAmount": 123,
"edgeTokenAddress": "<string>",
"edgeUserAddress": "<string>",
"initTransactionHash": "<string>",
"initChainId": 123,
"fillTransactionHash": "<string>",
"fillChainId": 123,
"refundTransactionHash": "<string>",
"refundChainId": 123,
"edgeTokenMetadata": {
"chainId": 123,
"tokenAddress": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"logoUri": "<string>"
},
"createdAt": "<string>"
},
"passthrough": true,
"destinationCalls": {
"chainId": 123,
"calls": [
{
"to": "<string>",
"value": 123,
"data": "<string>",
"gasLimit": 123,
"delegateCall": true,
"onlyFallback": true,
"behaviorOnError": 123
}
],
"space": 123,
"nonce": 123
},
"destinationPrecondition": {
"type": "<string>",
"chainId": 123,
"ownerAddress": "<string>",
"tokenAddress": "<string>",
"minAmount": 123
},
"destinationMetaTxn": {
"id": "<string>",
"chainId": 123,
"walletAddress": "<string>",
"contract": "<string>",
"input": "<string>",
"bridgeGas": 123
},
"gasFeeOptions": {
"gasEstimate": {
"totalGas": 123,
"gasPrice": "<string>",
"nativeCost": "<string>",
"nativeCostUsd": 123
},
"feeOptions": [
{
"tokenAddress": "<string>",
"tokenSymbol": "<string>",
"tokenDecimals": 123,
"amount": 123,
"amountUsd": 123,
"feeCollectorAddress": "<string>",
"is2612": true,
"isPassthroughEligible": true
}
],
"expiresAt": "<string>",
"feeCollectorAddress": "<string>"
},
"intentProtocol": "v1",
"timedRefundUnlockTimestamp": 123,
"pausableSapientSignerAddress": "<string>",
"updatedAt": "<string>",
"createdAt": "<string>"
},
"gasFeeOptions": {
"gasEstimate": {
"totalGas": 123,
"gasPrice": "<string>",
"nativeCost": "<string>",
"nativeCostUsd": 123
},
"feeOptions": [
{
"tokenAddress": "<string>",
"tokenSymbol": "<string>",
"tokenDecimals": 123,
"amount": 123,
"amountUsd": 123,
"feeCollectorAddress": "<string>",
"is2612": true,
"isPassthroughEligible": true
}
],
"expiresAt": "<string>",
"feeCollectorAddress": "<string>"
},
"originConfiguration": {},
"destinationConfiguration": {},
"transactionStates": [
{
"id": "<string>",
"label": "<string>",
"chainId": 123,
"description": "<string>",
"transactionHash": "<string>"
}
],
"passthrough": {
"eligible": true,
"passthroughTransaction": {
"toAddress": "<string>",
"tokenAddress": "<string>",
"amount": 123,
"chainId": 123,
"to": "<string>",
"data": "<string>",
"value": 123,
"decimals": 123
},
"transactionStates": [
{
"id": "<string>",
"label": "<string>",
"chainId": 123,
"description": "<string>",
"transactionHash": "<string>"
}
],
"quote": {
"routeProviders": [
"AUTO"
],
"routeProvidersRequestIds": [
"<string>"
],
"routeProvidersFeeUsd": [
123
],
"fromAmount": 123,
"fromAmountMin": 123,
"fromAmountUsd": 123,
"fromAmountMinUsd": 123,
"toAmount": 123,
"toAmountMin": 123,
"toAmountUsd": 123,
"toAmountMinUsd": 123,
"maxSlippage": 123,
"priceImpact": 123,
"priceImpactUsd": 123,
"priceImpactDetails": {
"executionPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"marketPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"providerFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"trailsFeesPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
},
"netPriceImpact": {
"priceImpact": 123,
"priceImpactUsd": 123
}
},
"estimatedDuration": 123
},
"fees": {
"originGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
},
"provider": {
"quoteProvider": "<string>",
"quoteProviderFee": 123,
"quoteProviderFeeUsd": 123,
"trailsFee": 123,
"trailsFeeUsd": 123,
"quoteProviderWithTrailsFee": 123,
"providerWithTrailsFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123
},
"feeTokenAddress": "<string>",
"feeTokenAmount": 123,
"feeTokenUsd": 123,
"feeTokenTotal": 123,
"gasFeeTotal": 123,
"gasFeeUsd": 123,
"trailsFeeTotal": 123,
"trailsFeeUsd": 123,
"collectorFeeTotal": 123,
"collectorFeeUsd": 123,
"providerFeeTotal": 123,
"providerFeeUsd": 123,
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"destinationGas": {
"chainId": 123,
"totalGasLimit": 123,
"gasPrice": 123,
"nativeTokenSymbol": "<string>",
"chainGasUsageStatus": "NORMAL",
"totalFeeAmount": 123,
"totalFeeUsd": 123,
"metaTxnFeeDetails": {
"metaTxnId": "<string>",
"estimatedGasLimit": 123,
"feeNative": 123
},
"metaTxnGasQuote": "<string>",
"nativeTokenPriceUsd": 123
}
}
},
"settlement": {
"provider": "stripe",
"reference": "<string>",
"currency": "<string>",
"amountCents": 123,
"amountUsd": "<string>",
"livemode": true,
"chainId": 123
}
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Overview
TheQuoteIntent endpoint allows you to request a quote for a cross-chain intent transaction. It provides comprehensive information about the transaction including gas fees, optimal routing, and price impact.
Use Cases
- Get a quote for swapping tokens across different chains
- Estimate fees before executing a cross-chain transaction
- Compare different routing options
- Calculate price impact and slippage
Request Parameters
Required Fields
- ownerAddress (string): The wallet address initiating the transaction
- originChainId (number): Source chain ID where the transaction originates
- originTokenAddress (string): Contract address of the source token
- destinationChainId (number): Target chain ID for the transaction
- destinationTokenAddress (string): Contract address of the destination token
- destinationToAddress (string): Recipient address on the destination chain
Optional Fields
- tradeType (TradeType): Either
EXACT_INPUTorEXACT_OUTPUT - destinationTokenAmount (bigint): Amount of destination tokens (only for EXACT_OUTPUT)
- originTokenAmount (bigint): Amount of origin tokens (only for EXACT_INPUT)
- destinationToAddress (string): Recipient address on the destination chain (defaults to
ownerAddress) - destinationApproveAddress (string): Contract address to pre-approve on the destination chain before executing
destinationCallData - destinationCallData (string): Custom calldata for contract interactions on destination chain
- destinationCallValue (number): Value (in wei) to send with the destination call
- fundMethod (FundMethod): Hint for the funding method —
WALLET,DIRECT_TRANSFER,ONRAMP_MESH,ONRAMP_MELD, orONRAMP_STRIPE - settlement (QuoteSettlementParams): Stripe settlement quote params — arms the quote so the processor (e.g. a Stripe PaymentIntent) settles USDC on the settlement chain
- onlyNativeGasFee (boolean): When
true, restricts gas fee options to the origin chain’s native token only - options (QuoteIntentRequestOptions):
- bridgeProvider (RouteProvider): Preferred bridge provider —
AUTO(default),RELAY,CCTP,LZ_OFT,SUSHI,ZEROX,LIFI,WETH - bridgeProviderFallback (boolean): If
true, fall back to another provider if the preferred bridge provider is unavailable - swapProvider (RouteProvider): Preferred same-chain swap provider —
AUTO(default),RELAY,SUSHI,ZEROX - swapProviderFallback (boolean): If
true, fall back to another provider if the preferred swap provider is unavailable - preference (RoutePreference): Route optimisation target —
RECOMMENDED(default),FASTEST,CHEAPEST,TRUSTLESS - intentProtocol (IntentProtocolVersion): Force a specific intent protocol version —
v1_5. (v1is deprecated: writes requesting it fail withIntentProtocolDeprecated.) - slippageTolerance (number): Maximum acceptable slippage as a fraction of 1 (e.g.
0.005for 0.5%,0.1for 10%). Accepted range:0.0001to0.2. When omitted, Auto picks it from the order’s USD value: 10% under 1 USD, 3% under 10 USD, 1% under 100 USD, otherwise 0.5% (also 0.5% when the order can’t be priced) - disablePassthrough (boolean): When
true, never return a passthrough-eligible quote; same-chain same-token wallet quotes run the normal intent flow - trailsAddressOverrides (TrailsAddressOverrides): Custom Sequence wallet addresses for the intent
- bridgeProvider (RouteProvider): Preferred bridge provider —
Response
The response includes:- intent (Intent): Complete intent object with transaction details
- originTokenMetadata (TokenMetadata): Resolved metadata for the origin token —
chainId,tokenAddress,name,symbol,decimalsand an optionallogoUri - destinationTokenMetadata (TokenMetadata): Resolved metadata for the destination token, same fields
- gasFeeOptions (GasFeeOptions): Available gas fee payment options
Both metadata objects are always present on a successful quote, and
decimals is always set, so you can format the quoted amounts without a separate GetTokenList lookup. A quote whose token metadata can’t be resolved is rejected rather than returned with missing precision. tokenAddress is the token address the quote uses, not the metadata source’s own identity, so a native asset keeps the address you sent.Intent Object Details
The intent object contains:- Unique intent ID
- Transaction status
- Deposit transaction details
- Cross-chain calls to execute
- Quote information (rates, slippage, price impact)
- Fee breakdown (gas fees, provider fees)
- Expiration timestamp
Example
const quoteRequest = {
ownerAddress: "0x0709CF2d5D4f3D38f5948d697fE64d7FB3639Eb1",
originChainId: 1, // Ethereum
originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
originTokenAmount: 100000000, // 100 USDC (6 decimals)
destinationChainId: 8453, // Base
destinationTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
destinationToAddress: "0x0709CF2d5D4f3D38f5948d697fE64d7FB3639Eb1",
tradeType: "EXACT_INPUT",
options: {
slippageTolerance: 0.005, // 0.5%
bridgeProvider: "RELAY"
}
};
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/QuoteIntent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify(quoteRequest)
});
const quote = await response.json();
console.log('Quote:', quote);
Quote Expiration
Quotes expire 15 minutes after being issued. You must call
ExecuteIntent (or ExecuteIntentEdge for a Solana/Tron origin) before the quote expires, or you’ll need to request a new quote.Next Steps
After receiving a quote:- Review the quote details, fees, and estimated amounts.
- Call
ExecuteIntentwith theintent.intentIdfrom the response to execute directly fromQUOTED. For a Solana or Tron origin, callExecuteIntentEdgefirst to arm fill monitoring, then have the user deposit on the edge chain.
CommitIntent is deprecated for new integrations. Existing callers may still commit before executing; new integrations should skip it and call ExecuteIntent directly on the quoted intent. See CommitIntent for details.Body
application/json
Was this page helpful?