write_account_add_liquidity
Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write_account_deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read_wallet_allowances), then approve if needed (write_wallet_approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read_guides('strategies'). The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain_id | No | Chain ID: 8453 (Base), 130 (Unichain), 10 (Optimism), or 4663 (Robinhood) | |
| deposits | No | Wallet tokens to deposit. Approve each token first (write.wallet.approve). Omit to use only account collateral. | |
| leverage | No | 0 = no borrow, 2 = 2x leverage. Margin accounts only. | |
| slippage | No | Basis points, 100 = 1% | |
| positions | Yes | LP positions to mint. For a single position, pass one entry. | |
| wallet_address | Yes | Wallet address of the account owner | |
| account_address | Yes | Arcadia account address | |
| use_account_assets | No | If true, use ALL existing account collateral for LP minting. Fetched automatically. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | No | ||
| before | No | ||
| description | No | ||
| transaction | Yes | ||
| tenderly_sim_url | No | ||
| tenderly_sim_status | No | ||
| expected_value_change | No |