prepare_marginfi_borrow
Build an unsigned borrow transaction on MarginFi using your collateral. Pre-flight validation prevents failed transactions when free collateral is zero.
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"wallet": "<wallet>",
"amount": "<amount>"
},
"name": "prepare_marginfi_borrow"
}
}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. |