Skip to content
docs

NativeStakingProtocolSolana

Defined in: protocol-staking-native-solana/src/protocol.ts:287

Native staking on Solana: SOL delegated straight to validators the app chooses, through the Stake program. No pool, no token, no third-party program: each position is a stake account owned by the wallet (staker and withdrawer are always the wallet’s address).

  • stake creates a stake account at a seed-derived address (create_with_seed(wallet, "stake:<i>"), so only the wallet signs and the position can be rebuilt from the wallet alone), initializes it and delegates it, in one transaction. It becomes active at the next epoch boundary (~2 days).
  • requestWithdrawal deactivates whole accounts and, for a partial amount, splits it into a new account first. The SOL can be withdrawn once the cool-down ends (next epoch boundary).
  • claimWithdrawals withdraws every lamport of fully inactive accounts back to the wallet.
  • delegate re-delegates an inactive account, or undoes a deactivation made in the same epoch; merge joins two compatible accounts.

Fail-closed before anything is signed: the validator must be in the configured list (or the app chose 'any'), voting, and within maxCommission; amounts respect the minimum delegation and the rent; the wallet keeps feeReserve for later fees. Statuses (activating / active / deactivating / inactive) are computed from the StakeHistory sysvar exactly as the program does.

new NativeStakingProtocolSolana(account, config): NativeStakingProtocolSolana

Defined in: protocol-staking-native-solana/src/protocol.ts:301

IWalletAccountReadOnly | IWalletAccount

NativeStakingConfig

NativeStakingProtocolSolana

StakingProtocol.constructor

protected readonly _account: IWalletAccountReadOnly | IWalletAccount

Defined in: core/dist/index-QWdcwE6y.d.ts:309

StakingProtocol._account


protected readonly _config: NativeStakingConfig

Defined in: core/dist/index-QWdcwE6y.d.ts:310

StakingProtocol._config


readonly defaultValidator: string | undefined

Defined in: protocol-staking-native-solana/src/protocol.ts:290


readonly feeReserve: bigint

Defined in: protocol-staking-native-solana/src/protocol.ts:294


readonly maxAccounts: number

Defined in: protocol-staking-native-solana/src/protocol.ts:293


readonly maxCommission: number

Defined in: protocol-staking-native-solana/src/protocol.ts:291


readonly seedPrefix: string

Defined in: protocol-staking-native-solana/src/protocol.ts:292


readonly validators: "any" | readonly ValidatorConfig[]

Defined in: protocol-staking-native-solana/src/protocol.ts:289

The configured validators, or 'any'.

claimWithdrawals(options?): Promise<NativeClaimResult>

Defined in: protocol-staking-native-solana/src/protocol.ts:884

Withdraws every lamport of fully inactive stake accounts to the wallet (the accounts close).

NativeClaimOptions = {}

Promise<NativeClaimResult>

StakingProtocol.claimWithdrawals


delegate(options): Promise<DelegateResult>

Defined in: protocol-staking-native-solana/src/protocol.ts:926

Delegates an inactive stake account (to validator, or the default), or — for an account deactivated in the current epoch — puts it back on its validator, undoing the unstake.

DelegateOptions

Promise<DelegateResult>


describeActivity(tx, ctx): ActivityItem | null

Defined in: protocol-staking-native-solana/src/protocol.ts:978

Labels Stake-program transactions (stake, unstake, claim, delegate, merge) offline; see activity.ts.

ChainTx

DescribeActivityContext

ActivityItem | null

StakingProtocol.describeActivity


getApr(options?): Promise<number>

Defined in: protocol-staking-native-solana/src/protocol.ts:655

APR in percent for a validator (validator, else the default or the first eligible one): the enrich figure when it gives one, else validator inflation × supply ÷ staked SOL × (1 − commission). With 'any' and no validator: the cluster-wide figure before commission.

string

Promise<number>

StakingProtocol.getApr


getEpochInfo(): Promise<EpochClock>

Defined in: protocol-staking-native-solana/src/protocol.ts:345

The epoch clock, with a projected end of the current epoch.

Promise<EpochClock>


getMaxStakeable(): Promise<bigint>

Defined in: protocol-staking-native-solana/src/protocol.ts:533

The most stake can take now: balance − account rent − fee reserve (0 when below the minimum delegation).

Promise<bigint>


getRewards(options?): Promise<NativeRewards>

Defined in: protocol-staking-native-solana/src/protocol.ts:667

Inflation rewards the wallet’s delegated stake accounts earned in the last epochs completed epochs (default 5). An epoch the node no longer serves is reported with its error, not dropped.

number

Promise<NativeRewards>


getStakeAccountAddress(index): Promise<string>

Defined in: protocol-staking-native-solana/src/protocol.ts:392

Address of the wallet’s stake account in seed slot index.

number

Promise<string>


getStakeAccounts(): Promise<StakeAccountInfo[]>

Defined in: protocol-staking-native-solana/src/protocol.ts:506

The wallet’s stake accounts: its seed slots, plus (with discover) accounts other wallets made for it. Each with its status, amounts, when it settles and what the wallet may do with it.

Promise<StakeAccountInfo[]>


getStakedBalance(): Promise<StakedBalance & object>

Defined in: protocol-staking-native-solana/src/protocol.ts:517

The position: balance is the stake delegated and not being withdrawn (principal plus compounded rewards), total every lamport in the wallet’s stake accounts. There is no wrapped form (rate 0). Only accounts the wallet can withdraw count; managedOnly sums those it is just the stake authority of.

Promise<StakedBalance & object>

StakingProtocol.getStakedBalance


getStakeParams(): Promise<{ minimumDelegation: bigint; rentExempt: bigint; }>

Defined in: protocol-staking-native-solana/src/protocol.ts:353

Rent of a stake account and the minimum delegation, lamports (cached for 10 minutes).

Promise<{ minimumDelegation: bigint; rentExempt: bigint; }>


getValidator(voteAccount): Promise<ValidatorInfo>

Defined in: protocol-staking-native-solana/src/protocol.ts:610

One validator, live: commission, stake, delinquency, APR, and whether the module may delegate to it.

string

Promise<ValidatorInfo>


getWithdrawalRequests(): Promise<NativeWithdrawalRequestsView>

Defined in: protocol-staking-native-solana/src/protocol.ts:831

Stake accounts that are cooling down or ready to claim. id is accountId; amount the account’s lamports (all of it returns on claim, rent included); timestamp is 0 (the chain does not record when a deactivation was sent).

Promise<NativeWithdrawalRequestsView>

StakingProtocol.getWithdrawalRequests


listValidators(options?): Promise<ValidatorInfo[]>

Defined in: protocol-staking-native-solana/src/protocol.ts:620

The validators to offer: the configured list in its order, or in 'any' mode the cluster’s voting validators by stake (limit to cut it). Each says whether it can take stake now and why not.

number

Promise<ValidatorInfo[]>


merge(options): Promise<MergeResult>

Defined in: protocol-staking-native-solana/src/protocol.ts:971

Merges source into destination (the source closes). Frees a seed slot and keeps the position tidy.

MergeOptions

Promise<MergeResult>


quoteClaimWithdrawals(options?): Promise<NativeClaimQuote>

Defined in: protocol-staking-native-solana/src/protocol.ts:878

Network fee and amount of a claim; nothing is signed.

NativeClaimOptions = {}

Promise<NativeClaimQuote>

StakingProtocol.quoteClaimWithdrawals


quoteDelegate(options): Promise<DelegateQuote>

Defined in: protocol-staking-native-solana/src/protocol.ts:917

Network fee of delegate; nothing is signed.

DelegateOptions

Promise<DelegateQuote>


quoteMerge(options): Promise<MergeQuote>

Defined in: protocol-staking-native-solana/src/protocol.ts:965

Network fee of merge; nothing is signed.

MergeOptions

Promise<MergeQuote>


quoteRequestWithdrawal(options): Promise<NativeUnstakeQuote>

Defined in: protocol-staking-native-solana/src/protocol.ts:811

Network fee and plan of an unstake; nothing is signed.

NativeUnstakeOptions

Promise<NativeUnstakeQuote>

StakingProtocol.quoteRequestWithdrawal


quoteStake(options): Promise<NativeStakeQuote>

Defined in: protocol-staking-native-solana/src/protocol.ts:743

Network fee and details of a stake; nothing is signed.

NativeStakeOptions

Promise<NativeStakeQuote>

StakingProtocol.quoteStake


requestWithdrawal(options): Promise<NativeUnstakeResult>

Defined in: protocol-staking-native-solana/src/protocol.ts:820

Unstakes amount lamports of delegated stake: deactivates whole accounts (an exact match first, then the largest that fit) and splits the remainder off one account. Claim after the cool-down.

NativeUnstakeOptions

Promise<NativeUnstakeResult>

StakingProtocol.requestWithdrawal


protected requireSigningAccount(methodName): IWalletAccount

Defined in: core/dist/index-QWdcwE6y.d.ts:322

The account, narrowed to a signing one, or a ReadOnlyAccountError naming the caller.

string

IWalletAccount

StakingProtocol.requireSigningAccount


stake(options): Promise<NativeStakeResult>

Defined in: protocol-staking-native-solana/src/protocol.ts:749

Stakes amount lamports with a validator: a new stake account, initialized and delegated in one transaction.

NativeStakeOptions

Promise<NativeStakeResult>

StakingProtocol.stake