Build Manage Transaction
build_manage_txBuild the UNSIGNED transaction to adjust or close an OPEN position, for the given wallet to sign. Non-custodial (never signs/holds keys). Canonical output is the executable { approvals[], tx{to,data,value} } (sign/broadcast directly); meta.signingUrl is an optional link for a human to sign in their own wallet. Actions: 'close' (unwind fully), 'increase_leverage' (borrow to a higher LTV), 'add_collateral' (top up — pay in collateral or any token), 'remove_collateral' (withdraw), 'repay' (pay down debt; set full=true to clear it), 'borrow' (draw more loan token). Get the position id from get_positions. Swap calldata (close/increase/zap paths) is time-sensitive — see meta.expiresAt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | On-chain position index, from get_positions (its `id`). | |
| full | No | repay only: clear the entire remaining debt. | |
| action | Yes | What to do to the position. | |
| amount | No | Human-units amount. Required for add_collateral/remove_collateral/repay/borrow. | |
| chainId | No | Chain to target. Supported: 1, 4663. Default: 1. | |
| leverage | No | increase_leverage: target leverage. Provide this OR desiredLtv. | |
| payToken | No | Token to pay in (add_collateral/repay). Collateral/loan = direct; any other = zapped. ETH = zero address. | |
| slippage | No | Swap slippage ratio (0.005 = 0.5%). Default 0.005, capped at 0.01. | |
| desiredLtv | No | increase_leverage: target LTV percent (e.g. '80'). Provide this OR leverage. | |
| userAddress | Yes | Wallet that owns the position and will sign. |