Skip to main content
POST
/
rpc
/
Trails
/
QuoteIntent
Quote Intent
curl --request POST \
  --url https://trails-api.sequence.app/rpc/Trails/QuoteIntent \
  --header 'Content-Type: application/json' \
  --header 'X-Access-Key: <api-key>' \
  --data '
{
  "ownerAddress": "<string>",
  "originChainId": 123,
  "originTokenAddress": "<string>",
  "destinationChainId": 123,
  "destinationTokenAddress": "<string>",
  "destinationToAddress": "<string>",
  "destinationCallData": "<string>",
  "destinationCallValue": 123,
  "originTokenAmount": 123,
  "destinationTokenAmount": 123,
  "tradeType": "EXACT_INPUT",
  "onlyNativeGasFee": true,
  "options": {
    "swapProvider": "AUTO",
    "bridgeProvider": "AUTO",
    "slippageTolerance": 123,
    "trailsAddressOverrides": {
      "sequenceWalletFactoryAddress": "<string>",
      "sequenceWalletMainModuleAddress": "<string>",
      "sequenceWalletMainModuleUpgradableAddress": "<string>",
      "sequenceWalletGuestModuleAddress": "<string>",
      "sequenceWalletUtilsAddress": "<string>"
    }
  }
}
'
{
  "intent": {
    "id": 123,
    "projectId": 123,
    "intentId": "<string>",
    "status": "QUOTED",
    "quoteRequest": {
      "ownerAddress": "<string>",
      "originChainId": 123,
      "originTokenAddress": "<string>",
      "destinationChainId": 123,
      "destinationTokenAddress": "<string>",
      "destinationToAddress": "<string>",
      "destinationCallData": "<string>",
      "destinationCallValue": 123,
      "originTokenAmount": 123,
      "destinationTokenAmount": 123,
      "tradeType": "EXACT_INPUT",
      "onlyNativeGasFee": true,
      "options": {
        "swapProvider": "AUTO",
        "bridgeProvider": "AUTO",
        "slippageTolerance": 123,
        "trailsAddressOverrides": {
          "sequenceWalletFactoryAddress": "<string>",
          "sequenceWalletMainModuleAddress": "<string>",
          "sequenceWalletMainModuleUpgradableAddress": "<string>",
          "sequenceWalletGuestModuleAddress": "<string>",
          "sequenceWalletUtilsAddress": "<string>"
        }
      }
    },
    "ownerAddress": "<string>",
    "originChainId": 123,
    "destinationChainId": 123,
    "originIntentAddress": "<string>",
    "salt": 123,
    "depositTransaction": {
      "toAddress": "<string>",
      "tokenAddress": "<string>",
      "amount": 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>"
    },
    "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
        }
      }
    },
    "fees": {
      "originGas": {
        "chainId": 123,
        "totalGasLimit": 123,
        "gasPrice": 123,
        "nativeTokenSymbol": "<string>",
        "chainGasUsageStatus": "NORMAL",
        "totalFeeAmount": 123,
        "totalFeeUsd": "<string>",
        "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": "<string>",
        "metaTxnFeeDetails": {
          "metaTxnId": "<string>",
          "estimatedGasLimit": 123,
          "feeNative": 123
        },
        "metaTxnGasQuote": "<string>",
        "nativeTokenPriceUsd": 123
      }
    },
    "trailsVersion": "<string>",
    "trailsContracts": {
      "trailsIntentEntrypointAddress": "<string>",
      "trailsRouterAddress": "<string>",
      "trailsRouterShimAddress": "<string>"
    },
    "expiresAt": "<string>",
    "destinationIntentAddress": "<string>",
    "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>"
    },
    "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
      }
    ],
    "expiresAt": "<string>",
    "feeCollectorAddress": "<string>"
  }
}

Overview

The QuoteIntent 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_INPUT or EXACT_OUTPUT
  • destinationTokenAmount (bigint): Amount of destination tokens (only for EXACT_OUTPUT)
  • originTokenAmount (bigint): Amount of origin tokens (only for EXACT_INPUT)
  • destinationCallData (string): Custom calldata for contract interactions on destination chain
  • destinationCallValue (string): Value to send with the destination call
  • options (QuoteIntentRequestOptions):
    • bridgeProvider (RouteProvider): Preferred bridge provider (NONE, RELAY, CCTP, LIFI, SUSHI, ZEROX)
    • swapProvider (RouteProvider): Preferred swap provider, only for for same chain swaps (NONE, RELAY, CCTP, LIFI, SUSHI, ZEROX)
    • slippageTolerance (number): Maximum acceptable slippage percentage as a fraction of 1 (e.g. 0.005 for 0.5%)
    • trailsAddressOverrides (TrailsAddressOverrides): Custom Sequence wallet addresses

Response

The response includes:
  • intent (Intent): Complete intent object with transaction details
  • gasFeeOptions (GasFeeOptions): Available gas fee payment options

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);

Next Steps

After receiving a quote:
  1. Review the quote details, fees, and estimated amounts
  2. Use CommitIntent to commit the intent if the quote is acceptable

Authorizations

X-Access-Key
string
header
required

API Key for authenticating requests, get an access key at https://trails.build and request early access

Body

application/json
ownerAddress
string
required
originChainId
number
required
originTokenAddress
string
required
destinationChainId
number
required
destinationTokenAddress
string
required
destinationToAddress
string
destinationCallData
string
destinationCallValue
number
originTokenAmount
number
destinationTokenAmount
number
tradeType
enum<string>

Represented as string on the server side

Available options:
EXACT_INPUT,
EXACT_OUTPUT
onlyNativeGasFee
boolean
options
object

Response

Successful response

intent
object
required
gasFeeOptions
object
required