@dzapio/sdk to avoid typos and ensure correct values in API calls.
Services
Use withgetAllowance, approve, and sign when specifying the DZap service:
Services.swap; use Services.trade for swap/bridge.
TxnStatus
Returned on transaction and approval results. Use for status checks:if (result.status === TxnStatus.success) { ... }
ApprovalModes
Use withgetAllowance and approve (parameter name is mode, not permitType):
PermitTypes
Use withsign() for permit signatures (parameter name is permitType):
contractErrorActions (trade failure actions)
When a trade fails, the response may includeaction with one of:
TRY_ANOTHER_ROUTE by rebuilding the trade request with protocol: bestReturnSource and calling trade() again.
Native token address
Skip approval for the native token (e.g. ETH). Use this address for comparisons:getAllowance or approve:
Next steps
- Types reference - Request/response interfaces
- Errors reference - Status codes and error handling