Using Permit to Skip separate approval step
Use EIP-2612 (ERC-20) or EIP-4494 (NFT) permit signatures with the KSZapRouterPositionPermit contract to approve and zap in a single transaction.
Using Permit to Skip Separate Approval Step
By default, a zap requires the user to send a separate approval transaction before the zap itself. Permit lets you skip that step by attaching an off-chain signature to the BuildRoute request — the router verifies and applies the approval atomically as part of the zap.
Permit is supported for two asset types:
ERC-20 input token
EIP-2612
Zap In with a fungible token that supports permit()
Position NFT
EIP-4494
Zap Out or Zap Migrate where the router needs to transfer the user's position NFT
Prerequisites
Use the
KSZapRouterPositionPermitcontract address for the target chain. See Contracts & Addresses.The ERC-20 token must implement
permit(owner, spender, value, deadline, v, r, s)(EIP-2612).The NFT contract must implement
permit(spender, tokenId, deadline, sig)(EIP-4494).
How It Works
Sign a permit message off-chain with the user's wallet (no gas).
Pass the permit signature(s) in the
BuildRouterequest body, keyed by token address or NFT token ID.The router applies the permit and executes the zap in one transaction.
Permit Payload Format
The permit field in any BuildRoute request body is a map from token address (for ERC-20) or NFT token ID (for position NFTs) to the hex-encoded permit signature:
You can include multiple permits in one request if the operation requires approvals for more than one asset:
Step 1 — Sign the Permit
ERC-20 (EIP-2612)
Position NFT (EIP-4494)
Step 2 — Build the Route with the Permit
Pass the signature(s) in the permit map, keyed by the token address (ERC-20) or the token ID as a string (NFT):
ERC-20 example (Zap In):
NFT example (Zap Out or Zap Migrate):
Step 3 — Send the Transaction
Use calldata, value, and routerAddress from the BuildRoute response to submit:
If the token or NFT contract does not implement the expected permit standard correctly, the transaction will revert. Verify permit support before using this flow.
Last updated
Was this helpful?