Options
All
  • Public
  • Public/Protected
  • All
Menu

@soceanfi/stake-pool-sdk

Index

Type aliases

ClusterType: "mainnet-beta" | "testnet" | "devnet"
DepositReceipt: { dropletsFeePaid: Numberu64; dropletsReceived: Numberu64; lamportsStaked: Numberu64; referralFeePaid: Numberu64 }

Breakdown of a single deposit into the stake pool

Type declaration

  • dropletsFeePaid: Numberu64

    Total number of droplets paid by the user in deposit fees, including referralFeePaid

  • dropletsReceived: Numberu64

    Number of droplets (1 / 10 ** 9 scnSOL) the user should receive in return for the deposit, with deposit fees deducted

  • lamportsStaked: Numberu64

    Number of lamports that was staked/deposited

  • referralFeePaid: Numberu64

    Number of droplets paid by the user in referral fees. This is a part of dropletsFeePaid, i.e. deposit fee paid to socean = dropletsFeePaid - referralFeePaid

TransactionSequence: TransactionWithSigners[][]

Array of transaction arrays where all transactions in the inner array must be confirmed before proceeding to the next inner array

TransactionSequenceSignatures: string[][]

Array of string arrays where each element corresponds to a transaction in a TransactionSequence

ValidatorAllStakeAccounts: { main: PublicKey; transient: PublicKey }

Type declaration

  • main: PublicKey
  • transient: PublicKey
ValidatorWithdrawalReceipt: { stakeAccount: PublicKey; withdrawalReceipt: WithdrawalReceipt }

A withdrawal receipt for a single stake account in the stake pool

  • the stakeAccount to make the withdrawal from

Type declaration

  • stakeAccount: PublicKey

    The stake account to make this withdrawal from. Can be a validator stake account, transient stake account, or the pool's reserve stake account.

  • withdrawalReceipt: WithdrawalReceipt

    The calculated withdrawal receipt for this stake account

WithdrawalReceipt: { dropletsFeePaid: Numberu64; dropletsUnstaked: Numberu64; lamportsReceived: Numberu64 }

Breakdown of a single withdrawal from a single stake account in the stake pool

Type declaration

  • dropletsFeePaid: Numberu64

    Number of droplets paid by the user in withdrawal fees

  • dropletsUnstaked: Numberu64

    Number of droplets that was unstaked/withdrawn

  • lamportsReceived: Numberu64

    Number of lamports the user should receive from the withdrawal, with withdrawal fees deducted

Functions

  • Calculates and returns the expected amount of droplets (1 / 10 ** 9 scnSOL) to be received by the user for staking SOL, with deposit fees factored in. Note: if an epoch boundary crosses and the stake pool is updated, the scnSOL supply will no longer match and the result of this function will be incorrect

    Parameters

    • lamportsToStake: Numberu64

      amount of SOL to be staked, in lamports

    • stakePool: StakePool

      the stake pool to stake to

    Returns DepositReceipt

    the amount of droplets (1 / 10 ** 9 scnSOL) to be received by the user

  • Parameters

    • dropletsToReceive: Numberu64
    • stakePool: StakePool

    Returns DepositReceipt

  • Calculates and returns the expected amount of droplets (1 / 10 ** 9 scnSOL) to be received by the user for staking stake account(s), with deposit fees factored in. Note: if an epoch boundary crosses and the stake pool is updated, the scnSOL supply will no longer match and the result of this function will be incorrect

    Parameters

    • lamportsToStake: Numberu64

      SOL value of the stake accounts to be staked, in lamports

    • stakePool: StakePool

      the stake pool to stake to

    Returns DepositReceipt

    the amount of droplets (1 / 10 ** 9 scnSOL) to be received by the user

  • Calculates the withdrawal procedure - how many lamports to split and withdraw from each validator stake account given a desired number of droplets to withdraw.

    returns:

    Array of ValidatorWithdrawalReceipt, where Sum of all their dropletsUnstaked must = withdrawalAmountDroplets Pass this array directly to getWithdrawStakeTransactions()

          Returns array with single elem if withdrawing from reserve account
    
    throws

    WithdrawalUnserviceableError if a suitable withdraw procedure is not found

    Parameters

    Returns Promise<ValidatorWithdrawalReceipt[]>

  • Signs and sends TransactionSequence, awaiting confirmations for each inner array of transactions before proceeding to the next one

    throws

    RpcError

    throws

    WalletPublicKeyUnavailableError

    Parameters

    • walletAdapter: WalletAdapter

      wallet signing the transaction

    • transactionSequence: TransactionSequence

      TransactionSequence to sign and send

    • connection: Connection

      solana connection

    • confirmOptions: ConfirmOptions = TRANSACTION_SEQUENCE_DEFAULT_CONFIRM_OPTIONS

      transaction confirm options for each transaction

    Returns Promise<TransactionSequenceSignatures>

    TransactionSequenceSignatures for all transactions in the TransactionSequence

  • Sums up the total number of droplets unstaked given an array of ValidatorWithdrawalReceipts

    Parameters

    Returns Numberu64

  • Sums up the total number of lamports withdrawn given an array of ValidatorWithdrawalReceipts

    Parameters

    Returns Numberu64

  • Sums up the total number of droplets (1 / 10 ** 9 scnSOL) paid in withdrawal fees given an array of ValidatorWithdrawalReceipts

    Parameters

    Returns Numberu64

Generated using TypeDoc