Create the swap
Depository action fields
The response includesdeposit_actions. For the contract action:
string
Depository contract address and, for ERC-20 deposits, the approval spender.
string
Encoded deposit call to submit unchanged.
string[] | null
Function argument values in call order. Use them to reconstruct the contract call when needed.
string
Native transaction value in base units. This is normally
0 for an ERC-20 call.string | null
Gas estimate returned by the API, when available.
Approve and submit the deposit action
- EVM (viem)
- Tron (TronWeb)
viem
amount_in_base_units is sent as value. Never replace the swap ID, receiver, or target embedded in call_data.feeLimit and gas values are caps, not estimates — set them according to your execution policy. Do not reorder or replace the returned arguments.
Detect the deposit
Store the submitted transaction hash, then useGET /swaps/by_transaction_hash/{hash} or GET /swaps/{id}. The swap then follows the normal lifecycle.
See the Privy server wallets recipe for batching approval and deposit in a sponsored server-wallet flow.