For the complete documentation index, see llms.txt. This page is also available as Markdown.

Marinade Ts/Js SDK

This is a marinade typescript and anchor based SDK to interact with Marinade from any Front-End App

Which SDK Do I Need

Product
Package
Repository

mSOL liquid staking, Instant Unstake, legacy mSOL/SOL liquidity pool (inactive)

@marinade.finance/marinade-ts-sdk

Marinade Native

@marinade.finance/native-staking-sdk

Marinade Select, existing positions only

@marinade.finance/native-staking-sdk

Validator bonds, SAM bidding, PSR

@marinade.finance/validator-bonds-cli


Install

npm install @marinade.finance/marinade-ts-sdk
yarn add @marinade.finance/marinade-ts-sdk

Check the package page for the current version rather than pinning one from this doc.


Quickstart

import { Marinade, MarinadeConfig } from '@marinade.finance/marinade-ts-sdk'
import { Connection } from '@solana/web3.js'

const config = new MarinadeConfig({
  connection: new Connection('https://api.mainnet-beta.solana.com'),
  publicKey: wallet.publicKey,
})
const marinade = new Marinade(config)

// Stake SOL, receive mSOL
const { transaction } = await marinade.deposit(amountLamports)

The SDK also exposes liquidUnstake, orderUnstake, addLiquidity and removeLiquidity, plus protocol state through marinade.getMarinadeState().

For the same operations from a terminal, use marinade-ts-cli.


Integration Example

An Anchor CPI integration example is available:


If you have questions or troubles, please join our Discord. Marinade contributors will be there to help you.

Last updated

Was this helpful?