prepare_marginfi_repay
Repay outstanding debt in a MarginFi bank by building an unsigned transaction. Supports partial or full repayment via the repayAll flag.
Instructions
Build an unsigned MarginFi REPAY tx against outstanding debt in the named bank. Pass repayAll: true to repay the full outstanding debt (also clears the balance slot). 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 repay against outstanding debt in this bank. | |
| repayAll | No | Set true to repay the full outstanding debt in this bank (SDK also clears the balance slot — cheaper for the user if they're closing out). Omit for partial. |