Exports
Functions
execute(config)
Execute a bridge transaction from a quote.ExecuteConfig
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
quote | Quote | Yes | - | Quote to execute |
signer | TransactionSigner | Yes | - | Wallet signer (viem WalletClient compatible) |
onStepChange | OnStepChange | No | - | Callback for step status updates |
onStatusChange | OnStatusChange | No | - | Callback for overall status updates |
onApprovalRequest | () => void | No | - | Callback before approval transaction |
onTransactionRequest | () => void | No | - | Callback before main transaction |
infiniteApproval | boolean | No | false | Allow infinite token approval |
emitter | SDKEventEmitter | No | - | Event emitter for SDK events |
ExecutionResult
| Property | Type | Description |
|---|---|---|
executionId | string | Unique execution ID for tracking |
status | 'pending' | 'executing' | 'completed' | 'failed' | Overall status |
steps | StepStatus[] | Array of step statuses |
txHash | string | undefined | Final transaction hash |
fromAmount | string | undefined | Input amount |
toAmount | string | undefined | Expected output amount |
receivedAmount | string | undefined | Actual received amount |
depositTxHash | string | null | Deposit transaction hash (if auto-deposit) |
error | Error | undefined | Error details (if failed) |
QuoteExpiredErrorif quote has expired (5 minute max age)InvalidQuoteErrorif quote is malformedTransactionFailedErrorif transaction fails on-chainUserRejectedErrorif user rejects transactionNetworkErrorif network request fails
Execution Flow
The execute function processes a quote through these stages:Example: Basic Execution
Example: With Progress Callbacks
Example: With Event Emitter
validateQuote(quote)
Validate a quote before execution.QuoteExpiredErrorif quote has expiredInvalidQuoteErrorif quote is malformed
- Quote is not null/undefined
- Quote has a valid ID
- Quote has at least one execution step
- Quote has fromAmount and toAmount
- Quote has not expired (expiresAt timestamp)
- Quote age does not exceed 5 minutes
Error Types
QuoteExpiredError
Thrown when a quote has exceeded its validity period.| Property | Type | Description |
|---|---|---|
quoteId | string | ID of the expired quote |
expiredAt | number | Timestamp when quote expired |
InvalidQuoteError
Thrown when a quote is malformed or missing required data.| Property | Type | Description |
|---|---|---|
reason | string | Why the quote is invalid |
null_quote- Quote is null or undefinedmissing_id- Quote has no IDno_steps- Quote has no execution stepsmissing_amounts- Quote is missing amount information
Types
TransactionSigner
Compatible with viem WalletClient and ethers Signer.TransactionRequest
ExecutionStatus
StepStatus
StepStatusPayload
Payload passed toonStepChange callback.
TransactionStatusPayload
Payload passed toonStatusChange callback.
Constants
Timing Constants
| Constant | Value | Description |
|---|---|---|
MAX_QUOTE_AGE_MS | 300000 | 5 minutes - maximum quote validity |
STATUS_POLL_INTERVAL_MS | 5000 | 5 seconds - polling interval |
MAX_EXECUTION_WAIT_MS | 600000 | 10 minutes - maximum wait time |
APPROVAL_CONFIRMATION_WAIT_MS | 3000 | 3 seconds - approval wait |
