Executing a Quote

After receiving a quote from the API, you'll need to handle the transaction execution process. This involves managing token approvals (if needed) and executing the main transfer transaction.

Prerequisites

  • Ability to sign transactions (via blockchain libraries, SDKs, etc.)

  • A valid quote response from the API

Quote Response Types from Request Quote

Direct Transfer Response :

{
  message: "Direct transfer transaction prepared",
  transactionId: string,
  type: "Direct",
  approvalTxParams: null
  transferTxParams: {
    to: string,
    data: string,
    value: string,
    gas: string
  },
}

Swap Transactions Response:

Response Field Details

Common Fields

  • transactionId: Unique identifier for tracking the transfer

  • type: Indicates transfer type ("Direct" or "Provider")

  • gas: Estimated gas limit in hexadecimal

Transaction Parameters

  • to: Target contract or recipient address

  • data: Encoded transaction data (empty for native transfers)

  • value: Amount in wei (used for native token transfers)

Approval Parameters

  • Present only when token approval is needed

  • Contains parameters for approving token spending

  • Must be executed before the main transfer

Basic Implementation

Best Practices

  • Approval Handling

    • Always check for approvalTxParams before proceeding

    • Wait for approval confirmation before executing the main transfer

    • Handle approval failures appropriately

  • Transaction Execution

    • Use proper gas estimation from the quote

    • Handle both direct and cross-chain transfers

    • Monitor transaction status until completion

  • User Experience

    • Show clear loading states during transactions

    • Provide feedback during approval and transfer steps

    • Handle errors gracefully with user-friendly messages

  • Security

    • Validate all transaction parameters

    • Never modify gas limits without proper estimation

    • Always wait for transaction confirmations

Complete Implementation with Error Handling and Status Monitoring:

Error Handling

The implementation handles common errors including:

  • User rejection

  • Insufficient funds

  • Network issues

  • Failed transactions

  • Timeout errors

Status Monitoring

The transaction status can be one of:

  • Pending Transaction is in progress

  • Completed Transaction successfully completed

  • Failed Transaction failed

Learn more about Transaction Status endpoint here.

Last updated