@hubra-labs/rasol-max
v0.5.9
Published
TypeScript SDK for raSOL max — a leveraged liquid-staking strategy on Solana mainnet. Read strategy metrics, build deposit + withdraw transactions.
Maintainers
Readme
@hubra-labs/rasol-max
TypeScript SDK for raSOL max — a leveraged liquid-staking strategy on Solana mainnet.
raSOL max takes liquid-staked SOL (raSOL) and levers it for amplified
staking yield. Depositors receive a raSOL max LP token that tracks the
strategy's net asset value; the position is maintained on-chain, so
holders earn the leveraged return without managing it themselves.
This SDK is the read + transaction-building layer for depositors: read live strategy metrics (TVL, current leverage, net APY) and build the deposit and withdraw transactions.
Install
npm install @hubra-labs/rasol-max
# peer deps:
npm install @solana/kit @solana-program/token @voltr/vault-sdkQuickstart
import { createSolanaRpc } from "@solana/kit";
import { RasolMaxClient } from "@hubra-labs/rasol-max";
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const client = new RasolMaxClient({ rpc });
// 1. Read strategy state
const data = await client.getStrategyData();
console.log({
tvlRasol: data.tvlRasol,
leverageBps: data.leverageBps,
borrowAprBps: data.borrowAprBps,
strategyApyBps: data.strategyApyBps,
paused: data.paused,
});
// 2. Crank (permissionless NAV refresh)
const crankIx = await client.buildCrankIx();
// sign + send via your tx transport
// 3. Deposit (raSOL → raSOLmax LP)
const depositIxs = await client.buildDeposit({
owner: yourSigner, // TransactionSigner from @solana/kit
amount: 100_000_000n, // 0.1 raSOL
});
// 4. Withdraw (raSOLmax LP → raSOL)
const { instructions } = await client.buildWithdraw({
owner: yourSigner,
lpAmount: 50_000_000n,
});Status
| Surface | Status | Notes |
|---|---|---|
| getStrategyData() | ✅ | NAV, leverage, borrow APR, supply APR, simple APY. |
| buildCrankIx() | ✅ | Permissionless. |
| buildDeposit() | ✅ | Deposit ix(s), with an optional crank prefix. |
| quoteWithdraw() | ✅ | Returns the routing decision without building the tx. |
| buildWithdraw() | ✅ | Resolves the withdrawal route and returns the instruction set; some routes return the adapter ALT to compress with. |
Architecture
The adapter (Rust, Anchor) lives at
Hubra-labs/rasol-max-adapter.
This SDK wraps the on-chain surface in three pieces:
Withdraw routing
buildWithdraw() resolves a route internally and returns the
instruction set to sign. The caller does not pick the route; pass
owner and lpAmount and use the returned instructions (and
lookupTable, when present).
ALT compression
Some routes return an address-lookup-table address in
result.lookupTable. When present, compress your transaction message
with it before signing:
import {
compressTransactionMessageUsingAddressLookupTables,
fetchAddressLookupTable,
} from "@solana/kit";
const { instructions, lookupTable } = await client.buildWithdraw({ owner, lpAmount });
if (lookupTable) {
const alt = await fetchAddressLookupTable(rpc, lookupTable);
const message = compressTransactionMessageUsingAddressLookupTables(
baseMessage,
{ [lookupTable]: alt.data.addresses },
);
}Without ALT compression a routed withdrawal can exceed the 1232-byte transaction size limit. The SDK does not auto-extend the ALT.
NAV mirror
The off-chain computeNav() is a literal port of nav.rs::compute_nav_from_amounts:
NAV (raSOL) = strategy_collateral_ata.amount
+ strategy_ctoken_ata.amount × cToken→raSOL
+ obligation.deposited_amount × cToken→raSOL
− obligation.borrowed_sol × SOL→raSOLvault_strategy_asset_ata is deliberately excluded (Voltr-side
transit ATA; counting it double-counts in-flight withdraw payouts).
Throws InsolventError when debt > assets (mirrors the on-chain
H-C guard).
Versioning
| SDK | Adapter program | Notes |
|---|---|---|
| 0.3.x | LST3EutZgtbsLp3RqagSfjTB6kB8BwEQjexEkqBZiRr | v2 pilot |
Major version bumps on any adapter program-ID rotation. Minor bumps for new ixs / new SDK surface. Patch for read-path / typecode fixes.
License
Apache-2.0.
