Prepare enable/disable collateral
prepare_set_collateralBuild an unsigned transaction to change whether a supplied asset is used as collateral (v3 or v4). On v4 'enable' sets the state; on v3 it toggles the current state, and a toggle that would invert a stated 'enable' is refused. The wallet must already hold a supply in that reserve: this sets a flag on it, nothing moves. Disabling can leave a position liquidatable, so it is simulated first: a health factor under 1 after is refused, just above 1 carries a warning to relay, and a build whose simulation could not run says so under 'warnings'. Enabling needs no check. Non-custodial.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | v3 only: underlying token address. | |
| enable | No | v4: true to enable, false to disable (default true). v3 toggles the current state; send it on v3 as the intended end state, and a toggle that would produce the opposite is refused. | |
| market | No | v3 only: market pool address. | |
| sender | Yes | Sender wallet address, 0x-prefixed (40 hex chars). | |
| chainId | No | v3 only: chain id (positive integer). | |
| reserve | No | v4 only: the opaque reserveId, copied verbatim from a get_markets row or a get_position_items item in this session (e.g. 'MTo6MHg5NGU3...Ojo1') - it cannot be constructed or recalled, so fetch one before the first call rather than after a refusal. The 'spokeId' from get_user_positions is NOT this: it is the same encoding one segment short, names the spoke rather than a reserve inside it, and is rejected. A token symbol such as 'USDC' is rejected too. | |
| version | Yes | Protocol version (v3 or v4; required, no 'all' for actions). |