StatusCodes (enum)
Returned in responses (e.g. approval, trade) for programmatic handling:Trade failure actions (contractErrorActions)
Whentrade() fails, check result.action and handle accordingly:
| Action | Meaning | Suggested handling |
|---|---|---|
TRY_ANOTHER_ROUTE | Recommended route failed | Rebuild data with protocol: bestReturnSource from the quote and call trade() again. |
INCREASE_SLIPPAGE | Slippage too low | Ask user to increase slippage and retry. |
INCREASE_ALLOWANCE | Allowance insufficient | Re-run allowance/approval flow and retry. |
DZapTransactionResponse
Thetrade() response shape:
status === TxnStatus.success before using txnHash. Use errorMsg for user-facing messages.
Next steps
- Enums reference - Services, TxnStatus, ApprovalModes
- Execute trade - Error handling and TRY_ANOTHER_ROUTE retry