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.
How it works
Quote execution follows a straightforward process:
1. Receive and process the quote response
2. Execute token approval transaction if required
3. Execute the main transfer transaction
4. Monitor transaction status until completion
Prerequisites
Before executing a quote, you need:
A valid quote response from a previous call to
POST https://api.orda.network/v1.1/quoteThe ability to sign blockchain transactions (via libraries such as ethers.js or web3.js)
A connected wallet or key management system
The execution process involves two potential steps:
Step 1: Handle Token Approval (if needed)
If the quote response includes approvalTxParams, you must:
Execute the approval transaction using the provided parameters
Wait for the approval to be confirmed on the blockchain
Handle any approval-related errors appropriately
Step 2: Execute Main Transaction
After handling any approval requirements:
For Direct transfers, use
transferTxParamsFor Provider transfers, use
transactionRequestWait for transaction confirmation
Monitor the transaction status using the transaction ID
Here's a simplified example of the core implementation logic:
// If approval is needed, execute it first and wait for confirmation
if (quote.approvalTxParams) {
const approvalTx = await sendTransaction(quote.approvalTxParams);
await waitForConfirmation(approvalTx);
}
// Execute the main transaction
const txParams = quote.type === 'Direct'
? quote.transferTxParams
: quote.transactionRequest;
const tx = await sendTransaction(txParams);
// Monitor status until completion
await monitorTransaction(quote.transactionId);typescript
Best Practices
Approval Handling
Always check for
approvalTxParamsbefore proceedingWait 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
Common issues
User interaction errors:
User rejection of transactions is a common occurrence. Implement proper error handling to detect when users decline to sign transactions and provide appropriate guidance.
Blockchain-related errors:
Insufficient funds: Ensure users have enough native tokens for gas fees plus transaction amount
Network congestion: Consider implementing dynamic gas price strategies during high-
congestion periods
Failed transactions: Parse error messages from the blockchain to provide useful feedback
Integration issues:
Quote expiration: Ensure quotes are executed within their validity window
Incorrect parameter handling: Double-check parameter mapping, especially when dealing
with hexadecimal values
Status monitoring failures: Implement proper retry logic for status monitoring
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.
Next steps
After executing a quote, you can:
1. Implement webhook notifications to receive real-time updates about transaction status
2. Build a transaction history interface to show users their past transactions
3. Integrate with the Monitoring Status endpoint for detailed monitoring
For implementation details, request format examples, and additional sample code, refer to our API Reference.
Last updated