Build adjust
build_adjustBuild the steps that add collateral ('push': requires collateralToken, amount, borrowToken, leverage) or withdraw it ('pull': requires token, tokenOut, and exactly one of withdrawAmount or withdrawAll). Fields of the other direction are refused, not ignored. Returns UNSIGNED transaction steps for the owner to sign in order; this server never holds keys or sends transactions. The build expires after 180 seconds (expiresAt, unix ms): build immediately before signing, not as a plan for later. Builds are single-use: rebuilding an open predicts a different position address, so never replay one. A successful build does not guarantee a successful transaction: pass steps to simulate and check ok before asking anyone to sign. tokenIn (zap-in) is build-only: quote in the collateral token, then set tokenIn here to add the swap. With tokenIn set, amount is in tokenIn decimals. A zap-in is simulated by the build itself, and a failure gets 422 simulation_reverted. Any build the owner funds (open, adjust push, manual repay), zap-in or not, gets 422 insufficient_balance (token, required, available) when the owner holds less than it pulls.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | EOA that owns the position and signs the steps. The smart account is derived from it server-side. | |
| token | No | 'pull': position collateral token | |
| amount | No | 'push' only: amount to add | |
| chainId | Yes | EVM chain id | |
| tokenIn | No | 'push' only | |
| leverage | No | Target leverage as a plain number between 1 and 100: 3 means 3x (not 1e18 fixed-point) | |
| slippage | No | Slippage tolerance as a decimal: 0.005 means 0.5% (not 1e18 fixed-point) | |
| tokenOut | No | 'pull': token to receive | |
| direction | Yes | ||
| strategyId | Yes | Strategy id from list_strategies (`strategyId`) | |
| borrowToken | No | 'push' only | |
| withdrawAll | No | 'pull' only | |
| approvalMode | No | 'push' only | |
| forceSwapper | No | 'push' only. Retry only: route the swap through the swapper instead of the routing engine. Set it when simulate reports a build as failing, then rebuild. | |
| maxPriceImpact | No | 'push' zap-in only: decimal price-impact ceiling | |
| tokenInSwapper | No | 'push' only | |
| withdrawAmount | No | 'pull' only: collateral to withdraw, in base units | |
| collateralToken | No | 'push' only | |
| positionAddress | Yes | Position (vault) address |