Documentation v1.0 has been released! Staking Guide, Protocols, Glossary, FAQ, and Support sections have been added.

HYSP Vault (Solana)

Learn how to connect HYSP vaults on Solana through Everstake Wallet SDK.

Getting Started

The HYSP Solana SDK provides a simple interface for interacting with yield vaults on Solana. It includes read helpers (APY/holdings/price-per-share, balances) and prepares unsigned transactions for deposits and withdrawals.

Installation

npm install @everstake/wallet-sdk-hysp-solana

Quick Start

import { HyspSolana } from '@everstake/wallet-sdk-hysp-solana';
import { address } from '@solana/kit';
import { Decimal } from 'decimal.js';

// Initialize with token symbol
const hysp = new HyspSolana('USDC');

// Or with custom RPC
const hyspCustom = new HyspSolana('USDC', 'https://your-rpc-endpoint.com');

// User address
const userAddress = address('YourWalletAddressHere');

// Get vault information
const holdings = await hysp.getVaultHoldings();
const apys = await hysp.getVaultAPYs();

// Create deposit transaction (unsigned)
const depositTx = await hysp.deposit(userAddress, new Decimal('100'));

// Create withdraw transaction (unsigned)
const withdrawTx = await hysp.withdraw(userAddress, new Decimal('50'));

The SDK returns unsigned transactions; your application is responsible for signing and sending them.

Available Methods

Below are the primary methods exposed by the SDK, with short descriptions to help you choose the right call in your flow

Information Methods

  • getVaultHoldings()β€” Returns vault assets/positions to help with monitoring and display.

  • getVaultAPYs() β€” Fetches current APY data for the vault.

  • getExchangeRate() β€” Returns the tokens-per-share (price-per-share) used to convert shares β†”οΈŽ token amount.

  • getUserShares() β€” Retrieves a user’s raw share balance in the vault.

  • getUserBalance() β€” Convenience helper that multiplies shares Γ— price-per-share for a user-displayable token balance.

Transaction Methods

  • deposit() β€” Builds an unsigned deposit transaction message; sign and broadcast in your app.

  • withdraw() β€” Builds an unsigned withdraw (redemption) transaction message; sign and broadcast in your app.

  • Adding Custom Instructions β€” You can also compose multiple operations by appending additional instructions in your own code to create atomic, single-transaction flows (e.g., withdraw then transfer).


Get Exchange Rate

The getExchangeRate() method retrieves the current tokens-per-share (price-per-share) for the vault. Use it to convert between shares and the display token amount.

Code Example

Calculate Token Value

Tip: To skip manual math, use getUserBalance(), which returns the display token balance directly.


Get User Shares

The getUserShares() method returns the user’s raw vault share balance (receipt token). Use this when you need the underlying share amount; to display token value, either multiply by the exchange rate or call getUserBalance().

Code Example

Note: getUserShares() returns shares, not the token value.

Use getExchangeRate() to convert, or call getUserBalance() to get the display token amount directly.


Get User Balance

The getUserBalance() method returns the user’s display token balance (shares Γ— price-per-share).

Code Example

See also: getUserShares() and getExchangeRate() if you need raw shares or the conversion rate.


Get Vault APYs

The getVaultAPYs() method retrieves the vault’s yield / APY information as exposed by the underlying venue.

Code Example

Notes: The returned APY shape is defined by the venue SDK and includes the current APY the vault reports.


Get Vault Holdings

The getVaultHoldings() method returns a snapshot of the vault’s current assets/performance metrics and related fields as defined by the venue’s VaultHoldings type.

Code Example


Get Vault Liquidity Amount

The getVaultLiquidityAmount() method retrieves the current available liquidity in the vault.

Code Example


Get Vault Liquidity Amount

The getVaultLiquidityAmount() method retrieves the current available liquidity in reserves.

Code Example


Deposit

The deposit() method builds an unsigned transaction to deposit tokens into a vault. Your app is responsible for signing and sending the returned transaction message.

Code Example


Withdraw

The withdraw() method creates a transaction to withdraw tokens from a vault by burning shares.

Withdraw Code Example

Withdraw All Shares Code Example


Add Custom Instructions

The deposit() and withdraw() methods support adding custom Solana instructions via the afterInstructions parameter. This lets you compose atomic flows (e.g., withdraw then transfer USDC) in a single transaction.

Withdraw and Transfer Code Example

Multiple Instructions

Last updated

Was this helpful?