Build Leverage Transaction
build_leverage_txBuild the UNSIGNED transaction to open a leveraged position, for the given wallet to sign. Non-custodial: this server never signs, sends, or holds keys. The canonical output is the executable { approvals[], tx{to,data,value} } — sign and broadcast it directly (approvals first), plus the same position preview as simulate_leverage. meta.signingUrl is an optional one-click link for a human to sign in their own wallet. The embedded swap calldata is time-sensitive (see meta.expiresAt) — rebuild if stale.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount of payToken in human units (e.g. '10000' for 10,000 USDC). | |
| chainId | No | Chain to target. Supported: 1, 4663. Default: 1. | |
| leverage | No | Target leverage, e.g. 3. Provide this OR desiredLtv. | |
| payToken | Yes | Address of the token you pay in. May be the collateral (opened directly) or any other token (zapped: swapped to collateral first). Native ETH = the zero address 0x0000…0000. | |
| slippage | No | Swap slippage as a ratio (0.005 = 0.5%). Default 0.005, capped at 0.01. | |
| desiredLtv | No | Target LTV percent, e.g. '66.67'. Provide this OR leverage. | |
| strategyId | Yes | Morpho market id of the strategy (from list_strategies / get_strategy). | |
| userAddress | Yes | The wallet address that will sign and send. Approvals and onBehalfOf are built for it. |