prepare_marginfi_borrow
Prepare an unsigned borrow transaction from your MarginFi collateral with automatic oracle updates and on-chain health enforcement.
Instructions
Build an unsigned MarginFi BORROW tx against the user's supplied collateral. Pre-flight refuses if the account has zero free collateral. The SDK computes the required oracle-refresh instructions and the health-factor gate is enforced on-chain — but this tool is the right place to surface a clear error rather than burning SOL on a reverting tx. DURABLE NONCE + prepare_marginfi_init prerequisites identical to prepare_marginfi_supply. BLIND-SIGN on Ledger.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet | Yes | Base58 Solana mainnet address (ed25519 pubkey, 43 or 44 chars). | |
| symbol | No | Canonical token symbol (USDC, SOL, USDT, JUP, BONK, JTO, mSOL, jitoSOL). The builder resolves this to the underlying mint; MarginFi treats SOL as wSOL internally with auto-wrap/unwrap. Pass `mint` instead if your token isn't in the canonical list. | |
| mint | No | Base58 SPL mint address. Used as an override or when the token isn't in the canonical SOLANA_TOKENS table. Exactly one of `symbol` or `mint` must be passed. | |
| accountIndex | No | MarginfiAccount slot (0 = first, 1 = second, ...). Most users stay on 0. Use a different index to segregate positions across multiple MarginfiAccounts owned by the same wallet. | |
| amount | Yes | Human-readable decimal amount to borrow. Pre-flight refuses if the account has zero free collateral. |