Socean Stake is a liquid staking protocol built on Solana that delivers the highest risk-free yields on Solana through Socean’s algorithmic delegation strategy. Users can stake their SOL tokens with the Socean Stake Pool and receive scnSOL tokens in return. These scnSOL tokens can be used across Solana’s DeFi ecosystem or can be swapped back to SOL anytime.
This SDK provide a client to interact with the staking protocol and allows you to stake and unstake through socean stake pool within your applications.
Contents:
$ npm install @soceanfi/stake-pool-sdk
$ yarn add @soceanfi/stake-pool-sdk
Import the main client class Socean
and initialize it with the desired cluster type:
import { Socean } from "@soceanfi/stake-pool-sdk";
// initializes for mainnet-beta
const socean = new Socean("mainnet-beta");
// or for testnet
const socean = new Socean(); // or give 'testnet' as the argument
// you can also use a custom rpc endpoint
const socean = new Socean("mainnet-beta", "https://myawesomerpc.com:8899");
// or you can also use your own Connection object
const connection = new Connection(clusterApiUrl("mainnet-beta"));
const socean = new Socean("mainnet-beta", connection);
const stakePoolAccount = socean.getStakePoolAccount();
Frontend (react example):
import { Socean, Numberu64 } from "@soceanfi/stake-pool-sdk";
import { useWallet } from "@solana/wallet-adapter-react";
import { FC } from "react";
const socean = new Socean("mainnet-beta");
const StakeOneLamportWithSoceanButton: FC = () => {
const wallet = useWallet();
const onClick = async () => {
const signatures = await socean.depositSol(wallet, new Numberu64(1));
};
return <button onClick={onClick}>Stake one lamport with Socean</button>;
};
Frontend (react example):
import { Socean, Numberu64 } from "@soceanfi/stake-pool-sdk";
import { useWallet } from "@solana/wallet-adapter-react";
import { FC } from "react";
const socean = new Socean("mainnet-beta");
const WithdrawOneDropletFromSoceanButton: FC = () => {
const wallet = useWallet();
const onClick = async () => {
const { transactionSignatures, stakeAccounts } = await socean.withdrawStake(
wallet,
new Numberu64(1),
);
};
return (
<button onClick={onClick}>
Withdraw one droplet (1 / 10 ** 9 scnSOL) from Socean
</button>
);
};
Generated using TypeDoc