Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
How to handle contractErrorActions when trade() fails.
trade()
result.action
TRY_ANOTHER_ROUTE
data
protocol: bestReturnSource
INCREASE_SLIPPAGE
INCREASE_ALLOWANCE
if (result.status !== TxnStatus.success && result.action === "TRY_ANOTHER_ROUTE") { const fallbackData = request.data.map((d, i) => { const pairKey = Object.keys(quotes)[i]; const fallbackSource = quotes[pairKey]?.bestReturnSource; return fallbackSource ? { ...d, protocol: fallbackSource } : d; }); result = await dZap.trade({ request: { ...request, data: fallbackData }, signer }); }