Skip to content
docs

LiquidStakingProtocolNear

Defined in: protocol-staking-liquid-near/src/protocol.ts:100

Liquid NEAR staking through the LiNEAR contract family (LiNEAR, Rhea rNEAR): deposit_and_stake mints the token, unstake starts the delayed exit (4+ epochs, exact epoch from the contract), withdraw_all pays out once unlocked and the contract holds the NEAR. See the package README.

Never builds ft_transfer_call or ft_transfer into the contract (it has no ft_on_transfer: tokens sent that way are lost), and nothing but function calls to the pinned contract. Writes refuse a paused contract (or a paused feature their calls need) or one whose code hash is not pinned. Every quote returns the exact transactions; a write given expected refuses when its fresh plan differs.

new LiquidStakingProtocolNear(account, config): LiquidStakingProtocolNear

Defined in: protocol-staking-liquid-near/src/protocol.ts:112

IWalletAccountReadOnly | IWalletAccount

LiquidStakingNearConfig

LiquidStakingProtocolNear

StakingProtocol.constructor

protected readonly _account: IWalletAccountReadOnly | IWalletAccount

Defined in: core/dist/index-i6xtgDlq.d.ts:317

StakingProtocol._account


protected readonly _config: LiquidStakingNearConfig

Defined in: core/dist/index-i6xtgDlq.d.ts:318

StakingProtocol._config


readonly aprWindowEpochs: number

Defined in: protocol-staking-liquid-near/src/protocol.ts:103


readonly gas: object

Defined in: protocol-staking-liquid-near/src/protocol.ts:102

stake: bigint

unstake: bigint

withdraw: bigint


readonly reserve: bigint

Defined in: protocol-staking-liquid-near/src/protocol.ts:101


protected readonly rpc: NearRpc | undefined

Defined in: protocol-staking-liquid-near/src/protocol.ts:105

get network(): NearNetwork

Defined in: protocol-staking-liquid-near/src/protocol.ts:137

The configured network, else the account’s (near:testnet → testnet, anything else → mainnet).

NearNetwork


get pool(): ResolvedLiquidPool

Defined in: protocol-staking-liquid-near/src/protocol.ts:142

Contract, symbol and pinned code hashes on the current network (throws ‘unsupported-network’).

ResolvedLiquidPool

claimWithdrawals(options?): Promise<LiquidClaimResult>

Defined in: protocol-staking-liquid-near/src/protocol.ts:656

Withdraws the unstaked NEAR (withdraw_all) once unlocked and payable.

LiquidClaimOptions = {}

Promise<LiquidClaimResult>

StakingProtocol.claimWithdrawals


describeActivity(tx, ctx): ActivityItem | null

Defined in: protocol-staking-liquid-near/src/protocol.ts:663

Labels LiNEAR-family staking transactions offline; see activity.ts.

ChainTx

DescribeActivityContext

ActivityItem | null

StakingProtocol.describeActivity


getAccountDetails(): Promise<LiquidAccountDetails>

Defined in: protocol-staking-liquid-near/src/protocol.ts:352

The account in the contract: tokens, their NEAR value, unstaked NEAR, exact unlock epoch, registration.

Promise<LiquidAccountDetails>


getApr(): Promise<number>

Defined in: protocol-staking-liquid-near/src/protocol.ts:376

APR in percent: the apr hook, else the token price’s growth over aprWindowEpochs (default 24, ~7 days), annualized by the two blocks’ timestamps. The past price comes from the archival RPC; when that fails, from a 2-epoch window on the regular RPC. Cached for 10 minutes.

Promise<number>

StakingProtocol.getApr


getEpoch(): Promise<NearEpoch>

Defined in: protocol-staking-liquid-near/src/protocol.ts:293

The epoch clock: height, start, measured duration (~6.9 h on mainnet), estimated end.

Promise<NearEpoch>


getMaxStakeable(): Promise<bigint>

Defined in: protocol-staking-liquid-near/src/protocol.ts:360

What stake can send now: available − reserve − the stake’s upfront gas (never below 0).

Promise<bigint>


getPoolInfo(): Promise<LiquidPoolInfo>

Defined in: protocol-staking-liquid-near/src/protocol.ts:298

Contract state: price, totals, pause flag, live code hash, liquidity, fee. Read fresh every time.

Promise<LiquidPoolInfo>


getStakedBalance(): Promise<LiquidStakedBalance>

Defined in: protocol-staking-liquid-near/src/protocol.ts:437

The position, Tonstakers-style: balance = tokens held, rate = price (yoctoNEAR per token, 10^24 = 1:1), total = their NEAR value; unstaked and withdrawable (unlocked and payable from the contract’s liquid balance now) beside.

Promise<LiquidStakedBalance>

StakingProtocol.getStakedBalance


getWithdrawalRequests(): Promise<LiquidWithdrawalRequestsView>

Defined in: protocol-staking-liquid-near/src/protocol.ts:452

The account’s unstaked NEAR as one request (a contract keeps one unstaked balance per account): id poolRequestId(contract), unlockEpoch exact from the contract. claimable needs the epoch reached, the contract’s liquid balance to cover it (awaitingLiquidity otherwise) and withdrawals not paused (paused). timestamp is 0: the contract does not keep the unstake time.

Promise<LiquidWithdrawalRequestsView>

StakingProtocol.getWithdrawalRequests


quoteClaimWithdrawals(options?): Promise<LiquidClaimQuote>

Defined in: protocol-staking-liquid-near/src/protocol.ts:651

The claim’s transaction (withdraw_all) and fee; nothing is signed.

LiquidClaimOptions = {}

Promise<LiquidClaimQuote>

StakingProtocol.quoteClaimWithdrawals


quoteRequestWithdrawal(options): Promise<LiquidUnstakeQuote>

Defined in: protocol-staking-liquid-near/src/protocol.ts:608

The unstake’s transaction, fee and unlock estimate; nothing is signed. amount is in token base units.

LiquidUnstakeOptions

Promise<LiquidUnstakeQuote>

StakingProtocol.quoteRequestWithdrawal


quoteStake(options): Promise<LiquidStakeQuote>

Defined in: protocol-staking-liquid-near/src/protocol.ts:536

The stake’s transaction, fee, tokens expected and APR; nothing is signed.

LiquidStakeOptions

Promise<LiquidStakeQuote>

StakingProtocol.quoteStake


requestWithdrawal(options): Promise<LiquidUnstakeResult>

Defined in: protocol-staking-liquid-near/src/protocol.ts:618

Unstakes amount token base units (unstake with their NEAR value), or 'all' (unstake_all). An unlocked balance is withdrawn in the same transaction first. Once it is final, getAccountDetails().unlockEpoch is the exact epoch the NEAR unlocks at; reads use final blocks, so right after the send they still show the previous one (show the result’s unlock meanwhile).

LiquidUnstakeOptions

Promise<LiquidUnstakeResult>

StakingProtocol.requestWithdrawal


protected requireSigningAccount(methodName): IWalletAccount

Defined in: core/dist/index-i6xtgDlq.d.ts:330

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

string

IWalletAccount

StakingProtocol.requireSigningAccount


stake(options): Promise<LiquidStakeResult>

Defined in: protocol-staking-liquid-near/src/protocol.ts:544

Stakes exactly amount yoctoNEAR (deposit_and_stake) for the token. There is no “stake everything”: pass the amount (at most getMaxStakeable()).

LiquidStakeOptions

Promise<LiquidStakeResult>

StakingProtocol.stake