Skip to main content
Execute complex DeFi operations by building transaction data and sending it with your wallet signer. The SDK handles transaction building, gas estimation, and execution automatically.
The zap method combines transaction building and execution into a single operation. This approach simplifies complex DeFi workflows while maintaining full control over transaction parameters.
Before executing zaps, tokens typically require approval to allow the DZap contracts to spend them on your behalf. Learn more about gas-optimized approval mechanisms in the Approval Mechanisms section.

Zap Execution

Execute a zap using the zap method:

Parameters

The zap function expects an object with these parameters:

Required Parameters

ZapBuildTxnRequest Structure

Additional Type Definitions

Complete Example with Quotes and Approvals

Here’s a full example that gets quotes, handles approvals, and executes a zap:

Best Practices

  1. Always get quotes first to understand the expected outcome and fees
  2. Validate balances before execution to ensure sufficient funds
  3. Check allowances and execute approvals/permits if needed
  4. Implement proper error handling with retry logic for failed zaps
  5. Use appropriate slippage settings based on market conditions and complexity
  6. Monitor transaction status for zap completion and position updates

Next Steps

Always ensure users have sufficient balance for both the zap amount and gas fees before execution. Zap operations can be complex and may require multiple transactions.
Use the buildZapTxn method first to understand the steps involved before executing. This helps with user experience and debugging complex zap operations.
Last modified on July 14, 2026