@anywalletkit/protocol-staking-liquid-near 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -10
- package/dist/index.cjs +106 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -11
- package/dist/index.d.ts +68 -11
- package/dist/index.js +106 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,14 @@ interface LiquidPoolConfig {
|
|
|
10
10
|
name?: string;
|
|
11
11
|
/** code_hash values accepted for writes. Required: a contract upgrade is refused until the app pins the new build. */
|
|
12
12
|
codeHashes: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* `deposit_and_stake` keeps storage_balance_bounds.min (0.00125 NEAR) of an unregistered account's
|
|
15
|
+
* first deposit, as rNEAR does (LiNEAR does not). Default: the built-in preset's value when
|
|
16
|
+
* `contract` is a preset's account (a re-pin after an upgrade), else true: quotes then never show
|
|
17
|
+
* more tokens than the contract mints, and a first stake that leaves less than MIN_STAKE after the
|
|
18
|
+
* fee is refused (at or below the fee the contract itself would fail it).
|
|
19
|
+
*/
|
|
20
|
+
firstStakePaysStorage?: boolean;
|
|
13
21
|
}
|
|
14
22
|
/** Configuration of {@link LiquidStakingProtocolNear}. Only `pool` is required. */
|
|
15
23
|
interface LiquidStakingNearConfig {
|
|
@@ -49,8 +57,15 @@ interface LiquidPoolInfo {
|
|
|
49
57
|
/** Token supply (`get_summary.total_share_amount`). */
|
|
50
58
|
totalShares: bigint;
|
|
51
59
|
validators: number;
|
|
52
|
-
/** `is_paused`; a missing
|
|
60
|
+
/** `is_paused`, or 'ALL' in `pa_all_paused`; a missing `is_paused` counts as paused. */
|
|
53
61
|
paused: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Features the contract has paused on their own (`pa_all_paused` of a near-plugins contract such as
|
|
64
|
+
* rNEAR: 'internal_deposit', 'internal_stake', 'internal_unstake', 'internal_withdraw'). A write
|
|
65
|
+
* that calls one is refused with 'contract-paused'. Empty when nothing is paused or the contract has
|
|
66
|
+
* no per-feature pause (LiNEAR).
|
|
67
|
+
*/
|
|
68
|
+
pausedFeatures: string[];
|
|
54
69
|
codeHash: string;
|
|
55
70
|
/** The live code hash is one the module (or the app's config) pins. */
|
|
56
71
|
codeHashKnown: boolean;
|
|
@@ -104,7 +119,7 @@ interface LiquidStakedBalance extends StakedBalance {
|
|
|
104
119
|
withdrawable: bigint;
|
|
105
120
|
price: bigint;
|
|
106
121
|
}
|
|
107
|
-
type LiquidStakingWarningCode = 'resets-unbonding-timer' | 'withdraws-unlocked-first' | 'relocks-unlocked' | 'unlock-may-be-later';
|
|
122
|
+
type LiquidStakingWarningCode = 'resets-unbonding-timer' | 'withdraws-unlocked-first' | 'relocks-unlocked' | 'unlock-may-be-later' | 'pays-storage';
|
|
108
123
|
interface LiquidStakingWarning {
|
|
109
124
|
code: LiquidStakingWarningCode;
|
|
110
125
|
message: string;
|
|
@@ -127,7 +142,12 @@ interface LiquidStakeQuote {
|
|
|
127
142
|
/** NEAR the stake leaves on the account: the configured reserve, but at least one unstake's `upfront`. */
|
|
128
143
|
reserve: bigint;
|
|
129
144
|
amount: bigint;
|
|
130
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* NEAR the contract keeps from `amount` for the account's NEP-145 registration: storage_balance_bounds.min
|
|
147
|
+
* (0.00125 NEAR) on a first stake into rNEAR, else 0. Warning 'pays-storage' when above 0.
|
|
148
|
+
*/
|
|
149
|
+
storageFee: bigint;
|
|
150
|
+
/** Tokens expected for `amount − storageFee` at the current price (rounded down). */
|
|
131
151
|
shares: bigint;
|
|
132
152
|
price: bigint;
|
|
133
153
|
apr: number | null;
|
|
@@ -182,6 +202,8 @@ interface LiquidWithdrawalRequest extends WithdrawalRequest {
|
|
|
182
202
|
unlockEpoch: bigint;
|
|
183
203
|
/** Unlocked, but the contract's liquidity is below amount + `kept`: waiting for the epoch_withdraw bot. */
|
|
184
204
|
awaitingLiquidity: boolean;
|
|
205
|
+
/** The contract has withdrawals paused (`is_paused`, or 'internal_withdraw' in `pa_all_paused`): not claimable until it resumes. */
|
|
206
|
+
paused: boolean;
|
|
185
207
|
unlock: UnlockEstimate | null;
|
|
186
208
|
}
|
|
187
209
|
type LiquidWithdrawalRequestsView = Omit<WithdrawalRequestsView, 'requests'> & {
|
|
@@ -232,15 +254,26 @@ declare const UNSTAKED_DUST = 1000000n;
|
|
|
232
254
|
* ~52 NEAR for rNEAR, ~133 NEAR for LiNEAR), so what it can pay is balance − max(1 NEAR, storage).
|
|
233
255
|
*/
|
|
234
256
|
declare const CONTRACT_MIN_RESERVE_BALANCE: bigint;
|
|
235
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* NEP-145 registration, the same on every family contract (storage_balance_bounds.min, 0.00125 NEAR).
|
|
259
|
+
* `deposit_and_stake` registers an unregistered staker itself; rNEAR keeps this much of that first
|
|
260
|
+
* deposit for it (it stakes `amount − min`), LiNEAR stakes the whole amount. The module reads the
|
|
261
|
+
* live bound; this is the value on 2026-11-08.
|
|
262
|
+
*/
|
|
236
263
|
declare const STORAGE_DEPOSIT = 1250000000000000000000n;
|
|
237
264
|
/**
|
|
238
265
|
* NEAR left on the account by `stake`: 0.02 NEAR. `stake` never leaves less than the upfront gas of
|
|
239
266
|
* one unstake (about 0.035 NEAR at today's prices, see fees.ts), so the stake can always be left.
|
|
240
267
|
*/
|
|
241
268
|
declare const DEFAULT_RESERVE: bigint;
|
|
242
|
-
/** Smallest stake the module sends: 0.001 NEAR. */
|
|
269
|
+
/** Smallest stake the module sends: 0.001 NEAR, staked after any storage fee (an rNEAR first stake needs 0.00225 NEAR). */
|
|
243
270
|
declare const MIN_STAKE: bigint;
|
|
271
|
+
/**
|
|
272
|
+
* Pause keys each call checks on a contract with per-feature pauses (rNEAR's near-plugins Pausable,
|
|
273
|
+
* read with `pa_all_paused`): the call fails while any of its keys, or 'ALL', is paused. LiNEAR has
|
|
274
|
+
* one `is_paused` flag for everything.
|
|
275
|
+
*/
|
|
276
|
+
declare const PAUSE_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
244
277
|
/**
|
|
245
278
|
* Prepaid gas per call. All of it is bought upfront at min_gas_purchase_price (the unburnt part is
|
|
246
279
|
* refunded), so it is kept near what the calls use. Burnt on mainnet (whole transaction):
|
|
@@ -269,6 +302,10 @@ declare const DEFAULT_ARCHIVAL_RPC: Record<NearNetwork, string>;
|
|
|
269
302
|
interface LiquidPreset {
|
|
270
303
|
symbol: string;
|
|
271
304
|
name: string;
|
|
305
|
+
/** `deposit_and_stake` keeps storage_balance_bounds.min of an unregistered account's first deposit. */
|
|
306
|
+
firstStakePaysStorage: boolean;
|
|
307
|
+
/** Per-feature pauses (near-plugins Pausable, read with `pa_all_paused`) beside `is_paused`. */
|
|
308
|
+
featurePauses: boolean;
|
|
272
309
|
contracts: Partial<Record<NearNetwork, {
|
|
273
310
|
contract: string;
|
|
274
311
|
codeHashes: readonly string[];
|
|
@@ -279,6 +316,8 @@ declare const LIQUID_PRESETS: {
|
|
|
279
316
|
readonly linear: {
|
|
280
317
|
readonly symbol: "LINEAR";
|
|
281
318
|
readonly name: "LiNEAR";
|
|
319
|
+
readonly firstStakePaysStorage: false;
|
|
320
|
+
readonly featurePauses: false;
|
|
282
321
|
readonly contracts: {
|
|
283
322
|
readonly mainnet: {
|
|
284
323
|
readonly contract: "linear-protocol.near";
|
|
@@ -293,6 +332,8 @@ declare const LIQUID_PRESETS: {
|
|
|
293
332
|
readonly rnear: {
|
|
294
333
|
readonly symbol: "rNEAR";
|
|
295
334
|
readonly name: "Rhea Liquid Near Staking Token";
|
|
335
|
+
readonly firstStakePaysStorage: true;
|
|
336
|
+
readonly featurePauses: true;
|
|
296
337
|
readonly contracts: {
|
|
297
338
|
readonly mainnet: {
|
|
298
339
|
readonly contract: "lst.rhealab.near";
|
|
@@ -310,6 +351,10 @@ interface ResolvedLiquidPool {
|
|
|
310
351
|
symbol: string;
|
|
311
352
|
name: string;
|
|
312
353
|
codeHashes: readonly string[];
|
|
354
|
+
/** See {@link LiquidPoolConfig.firstStakePaysStorage}. */
|
|
355
|
+
firstStakePaysStorage: boolean;
|
|
356
|
+
/** `pa_all_paused` is read (rNEAR, and any custom contract: one without the method has no per-feature pause). */
|
|
357
|
+
featurePauses: boolean;
|
|
313
358
|
preset: LiquidPresetName | null;
|
|
314
359
|
}
|
|
315
360
|
/** Validates a custom pool config (account id, symbol, at least one pinned code hash). */
|
|
@@ -326,8 +371,9 @@ declare function poolRequestId(contract: string): bigint;
|
|
|
326
371
|
*
|
|
327
372
|
* Never builds `ft_transfer_call` or `ft_transfer` into the contract (it has no `ft_on_transfer`:
|
|
328
373
|
* tokens sent that way are lost), and nothing but function calls to the pinned contract. Writes
|
|
329
|
-
* refuse a paused contract or one whose code hash is not
|
|
330
|
-
* transactions; a write given `expected` refuses when its
|
|
374
|
+
* refuse a paused contract (or a paused feature their calls need) or one whose code hash is not
|
|
375
|
+
* pinned. Every quote returns the exact transactions; a write given `expected` refuses when its
|
|
376
|
+
* fresh plan differs.
|
|
331
377
|
*/
|
|
332
378
|
declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNearConfig> {
|
|
333
379
|
readonly reserve: bigint;
|
|
@@ -355,7 +401,7 @@ declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNea
|
|
|
355
401
|
private me;
|
|
356
402
|
private view;
|
|
357
403
|
private epochNumbers;
|
|
358
|
-
/** Spendable NEAR of the account: amount −
|
|
404
|
+
/** Spendable NEAR of the account: amount − max(0, storage − locked), never below 0 (0 for an account that does not exist yet). */
|
|
359
405
|
private available;
|
|
360
406
|
/** Fee (upper bound) and upfront charge of the transactions at the current prices (see fees.ts). */
|
|
361
407
|
private costs;
|
|
@@ -363,6 +409,17 @@ declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNea
|
|
|
363
409
|
private reserveAt;
|
|
364
410
|
private tx;
|
|
365
411
|
private assertWritable;
|
|
412
|
+
/** The paused features a plan's calls check (see PAUSE_KEYS); empty when every call goes through. */
|
|
413
|
+
private static pausedFor;
|
|
414
|
+
/** Withdrawals are stopped: the whole contract or its withdraw feature is paused. */
|
|
415
|
+
private static withdrawPaused;
|
|
416
|
+
/** Refuses transactions that call a feature the contract has paused on its own (rNEAR's per-feature pause): they would fail and burn the gas. */
|
|
417
|
+
private static assertNotPaused;
|
|
418
|
+
/**
|
|
419
|
+
* NEAR the contract keeps from a stake for the account's NEP-145 registration: storage_balance_bounds.min
|
|
420
|
+
* when the contract charges it (rNEAR) and the account is not registered yet, else 0. Read live.
|
|
421
|
+
*/
|
|
422
|
+
private storageFee;
|
|
366
423
|
private readAccount;
|
|
367
424
|
private contractUnlock;
|
|
368
425
|
/**
|
|
@@ -398,8 +455,8 @@ declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNea
|
|
|
398
455
|
/**
|
|
399
456
|
* The account's unstaked NEAR as one request (a contract keeps one unstaked balance per account):
|
|
400
457
|
* id `poolRequestId(contract)`, `unlockEpoch` exact from the contract. `claimable` needs the epoch
|
|
401
|
-
* reached
|
|
402
|
-
* `timestamp` is 0: the contract does not keep the unstake time.
|
|
458
|
+
* reached, the contract's liquid balance to cover it (`awaitingLiquidity` otherwise) and withdrawals
|
|
459
|
+
* not paused (`paused`). `timestamp` is 0: the contract does not keep the unstake time.
|
|
403
460
|
*/
|
|
404
461
|
getWithdrawalRequests(): Promise<LiquidWithdrawalRequestsView>;
|
|
405
462
|
/** Plans with fresh reads, compares with `expected`, then sends each transaction in order. */
|
|
@@ -562,4 +619,4 @@ declare function describeLiquidNearStakingActivity(tx: ChainTx, ctx: DescribeAct
|
|
|
562
619
|
}>;
|
|
563
620
|
}): ActivityItem | null;
|
|
564
621
|
|
|
565
|
-
export { type BlockTime, CONTRACT_MIN_RESERVE_BALANCE, DEFAULT_APR_WINDOW_EPOCHS, DEFAULT_ARCHIVAL_RPC, DEFAULT_GAS, DEFAULT_RESERVE, EPOCH_LENGTH, type EpochNumbers, GAS_PRICE_MARGIN_DEN, GAS_PRICE_MARGIN_NUM, type GasCost, GasPricer, type GasPrices, LIQUID_PRESETS, LIQUID_WRITE_METHODS, LST_DECIMALS, type LiquidAccountDetails, type LiquidClaimOptions, type LiquidClaimQuote, type LiquidClaimResult, type LiquidPoolConfig, type LiquidPoolInfo, type LiquidPreset, type LiquidPresetName, type LiquidStakeOptions, type LiquidStakeQuote, type LiquidStakeResult, type LiquidStakedBalance, LiquidStakingError, type LiquidStakingErrorCode, type LiquidStakingNearConfig, LiquidStakingProtocolNear, type LiquidStakingWarning, type LiquidStakingWarningCode, type LiquidUnstakeOptions, type LiquidUnstakeQuote, type LiquidUnstakeResult, type LiquidWithdrawalRequest, type LiquidWithdrawalRequestsView, type LiquidWriteOptions, MIN_EPOCHS_TO_UNLOCK, MIN_GAS_PURCHASE_PRICE_FALLBACK, MIN_STAKE, MODULE_NAME, NEAR_MAINNET, NEAR_TESTNET, type NearEpoch, type NearNetwork, type NearTransactionsSender, PRICE_SCALE, type ReadEpochOptions, type ResolvedLiquidPool, STORAGE_DEPOSIT, TGAS, TYPICAL_EPOCH_MS, UNSTAKED_DUST, type UnlockEstimate, YOCTO_PER_NEAR, aprFromPrices, assertLiquidPlan, blockAt, canSendBatch, costOf, LiquidStakingProtocolNear as default, describeLiquidNearStakingActivity, epochStartsAt, fc, finalBlock, gasOf, nearForShares, poolRequestId, readEpoch, readEpochNumbers, resolvePool, resolveRpc, sameTransactions, sharesForNear, validatePoolConfig, valueAtPrice };
|
|
622
|
+
export { type BlockTime, CONTRACT_MIN_RESERVE_BALANCE, DEFAULT_APR_WINDOW_EPOCHS, DEFAULT_ARCHIVAL_RPC, DEFAULT_GAS, DEFAULT_RESERVE, EPOCH_LENGTH, type EpochNumbers, GAS_PRICE_MARGIN_DEN, GAS_PRICE_MARGIN_NUM, type GasCost, GasPricer, type GasPrices, LIQUID_PRESETS, LIQUID_WRITE_METHODS, LST_DECIMALS, type LiquidAccountDetails, type LiquidClaimOptions, type LiquidClaimQuote, type LiquidClaimResult, type LiquidPoolConfig, type LiquidPoolInfo, type LiquidPreset, type LiquidPresetName, type LiquidStakeOptions, type LiquidStakeQuote, type LiquidStakeResult, type LiquidStakedBalance, LiquidStakingError, type LiquidStakingErrorCode, type LiquidStakingNearConfig, LiquidStakingProtocolNear, type LiquidStakingWarning, type LiquidStakingWarningCode, type LiquidUnstakeOptions, type LiquidUnstakeQuote, type LiquidUnstakeResult, type LiquidWithdrawalRequest, type LiquidWithdrawalRequestsView, type LiquidWriteOptions, MIN_EPOCHS_TO_UNLOCK, MIN_GAS_PURCHASE_PRICE_FALLBACK, MIN_STAKE, MODULE_NAME, NEAR_MAINNET, NEAR_TESTNET, type NearEpoch, type NearNetwork, type NearTransactionsSender, PAUSE_KEYS, PRICE_SCALE, type ReadEpochOptions, type ResolvedLiquidPool, STORAGE_DEPOSIT, TGAS, TYPICAL_EPOCH_MS, UNSTAKED_DUST, type UnlockEstimate, YOCTO_PER_NEAR, aprFromPrices, assertLiquidPlan, blockAt, canSendBatch, costOf, LiquidStakingProtocolNear as default, describeLiquidNearStakingActivity, epochStartsAt, fc, finalBlock, gasOf, nearForShares, poolRequestId, readEpoch, readEpochNumbers, resolvePool, resolveRpc, sameTransactions, sharesForNear, validatePoolConfig, valueAtPrice };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ interface LiquidPoolConfig {
|
|
|
10
10
|
name?: string;
|
|
11
11
|
/** code_hash values accepted for writes. Required: a contract upgrade is refused until the app pins the new build. */
|
|
12
12
|
codeHashes: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* `deposit_and_stake` keeps storage_balance_bounds.min (0.00125 NEAR) of an unregistered account's
|
|
15
|
+
* first deposit, as rNEAR does (LiNEAR does not). Default: the built-in preset's value when
|
|
16
|
+
* `contract` is a preset's account (a re-pin after an upgrade), else true: quotes then never show
|
|
17
|
+
* more tokens than the contract mints, and a first stake that leaves less than MIN_STAKE after the
|
|
18
|
+
* fee is refused (at or below the fee the contract itself would fail it).
|
|
19
|
+
*/
|
|
20
|
+
firstStakePaysStorage?: boolean;
|
|
13
21
|
}
|
|
14
22
|
/** Configuration of {@link LiquidStakingProtocolNear}. Only `pool` is required. */
|
|
15
23
|
interface LiquidStakingNearConfig {
|
|
@@ -49,8 +57,15 @@ interface LiquidPoolInfo {
|
|
|
49
57
|
/** Token supply (`get_summary.total_share_amount`). */
|
|
50
58
|
totalShares: bigint;
|
|
51
59
|
validators: number;
|
|
52
|
-
/** `is_paused`; a missing
|
|
60
|
+
/** `is_paused`, or 'ALL' in `pa_all_paused`; a missing `is_paused` counts as paused. */
|
|
53
61
|
paused: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Features the contract has paused on their own (`pa_all_paused` of a near-plugins contract such as
|
|
64
|
+
* rNEAR: 'internal_deposit', 'internal_stake', 'internal_unstake', 'internal_withdraw'). A write
|
|
65
|
+
* that calls one is refused with 'contract-paused'. Empty when nothing is paused or the contract has
|
|
66
|
+
* no per-feature pause (LiNEAR).
|
|
67
|
+
*/
|
|
68
|
+
pausedFeatures: string[];
|
|
54
69
|
codeHash: string;
|
|
55
70
|
/** The live code hash is one the module (or the app's config) pins. */
|
|
56
71
|
codeHashKnown: boolean;
|
|
@@ -104,7 +119,7 @@ interface LiquidStakedBalance extends StakedBalance {
|
|
|
104
119
|
withdrawable: bigint;
|
|
105
120
|
price: bigint;
|
|
106
121
|
}
|
|
107
|
-
type LiquidStakingWarningCode = 'resets-unbonding-timer' | 'withdraws-unlocked-first' | 'relocks-unlocked' | 'unlock-may-be-later';
|
|
122
|
+
type LiquidStakingWarningCode = 'resets-unbonding-timer' | 'withdraws-unlocked-first' | 'relocks-unlocked' | 'unlock-may-be-later' | 'pays-storage';
|
|
108
123
|
interface LiquidStakingWarning {
|
|
109
124
|
code: LiquidStakingWarningCode;
|
|
110
125
|
message: string;
|
|
@@ -127,7 +142,12 @@ interface LiquidStakeQuote {
|
|
|
127
142
|
/** NEAR the stake leaves on the account: the configured reserve, but at least one unstake's `upfront`. */
|
|
128
143
|
reserve: bigint;
|
|
129
144
|
amount: bigint;
|
|
130
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* NEAR the contract keeps from `amount` for the account's NEP-145 registration: storage_balance_bounds.min
|
|
147
|
+
* (0.00125 NEAR) on a first stake into rNEAR, else 0. Warning 'pays-storage' when above 0.
|
|
148
|
+
*/
|
|
149
|
+
storageFee: bigint;
|
|
150
|
+
/** Tokens expected for `amount − storageFee` at the current price (rounded down). */
|
|
131
151
|
shares: bigint;
|
|
132
152
|
price: bigint;
|
|
133
153
|
apr: number | null;
|
|
@@ -182,6 +202,8 @@ interface LiquidWithdrawalRequest extends WithdrawalRequest {
|
|
|
182
202
|
unlockEpoch: bigint;
|
|
183
203
|
/** Unlocked, but the contract's liquidity is below amount + `kept`: waiting for the epoch_withdraw bot. */
|
|
184
204
|
awaitingLiquidity: boolean;
|
|
205
|
+
/** The contract has withdrawals paused (`is_paused`, or 'internal_withdraw' in `pa_all_paused`): not claimable until it resumes. */
|
|
206
|
+
paused: boolean;
|
|
185
207
|
unlock: UnlockEstimate | null;
|
|
186
208
|
}
|
|
187
209
|
type LiquidWithdrawalRequestsView = Omit<WithdrawalRequestsView, 'requests'> & {
|
|
@@ -232,15 +254,26 @@ declare const UNSTAKED_DUST = 1000000n;
|
|
|
232
254
|
* ~52 NEAR for rNEAR, ~133 NEAR for LiNEAR), so what it can pay is balance − max(1 NEAR, storage).
|
|
233
255
|
*/
|
|
234
256
|
declare const CONTRACT_MIN_RESERVE_BALANCE: bigint;
|
|
235
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* NEP-145 registration, the same on every family contract (storage_balance_bounds.min, 0.00125 NEAR).
|
|
259
|
+
* `deposit_and_stake` registers an unregistered staker itself; rNEAR keeps this much of that first
|
|
260
|
+
* deposit for it (it stakes `amount − min`), LiNEAR stakes the whole amount. The module reads the
|
|
261
|
+
* live bound; this is the value on 2026-11-08.
|
|
262
|
+
*/
|
|
236
263
|
declare const STORAGE_DEPOSIT = 1250000000000000000000n;
|
|
237
264
|
/**
|
|
238
265
|
* NEAR left on the account by `stake`: 0.02 NEAR. `stake` never leaves less than the upfront gas of
|
|
239
266
|
* one unstake (about 0.035 NEAR at today's prices, see fees.ts), so the stake can always be left.
|
|
240
267
|
*/
|
|
241
268
|
declare const DEFAULT_RESERVE: bigint;
|
|
242
|
-
/** Smallest stake the module sends: 0.001 NEAR. */
|
|
269
|
+
/** Smallest stake the module sends: 0.001 NEAR, staked after any storage fee (an rNEAR first stake needs 0.00225 NEAR). */
|
|
243
270
|
declare const MIN_STAKE: bigint;
|
|
271
|
+
/**
|
|
272
|
+
* Pause keys each call checks on a contract with per-feature pauses (rNEAR's near-plugins Pausable,
|
|
273
|
+
* read with `pa_all_paused`): the call fails while any of its keys, or 'ALL', is paused. LiNEAR has
|
|
274
|
+
* one `is_paused` flag for everything.
|
|
275
|
+
*/
|
|
276
|
+
declare const PAUSE_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
244
277
|
/**
|
|
245
278
|
* Prepaid gas per call. All of it is bought upfront at min_gas_purchase_price (the unburnt part is
|
|
246
279
|
* refunded), so it is kept near what the calls use. Burnt on mainnet (whole transaction):
|
|
@@ -269,6 +302,10 @@ declare const DEFAULT_ARCHIVAL_RPC: Record<NearNetwork, string>;
|
|
|
269
302
|
interface LiquidPreset {
|
|
270
303
|
symbol: string;
|
|
271
304
|
name: string;
|
|
305
|
+
/** `deposit_and_stake` keeps storage_balance_bounds.min of an unregistered account's first deposit. */
|
|
306
|
+
firstStakePaysStorage: boolean;
|
|
307
|
+
/** Per-feature pauses (near-plugins Pausable, read with `pa_all_paused`) beside `is_paused`. */
|
|
308
|
+
featurePauses: boolean;
|
|
272
309
|
contracts: Partial<Record<NearNetwork, {
|
|
273
310
|
contract: string;
|
|
274
311
|
codeHashes: readonly string[];
|
|
@@ -279,6 +316,8 @@ declare const LIQUID_PRESETS: {
|
|
|
279
316
|
readonly linear: {
|
|
280
317
|
readonly symbol: "LINEAR";
|
|
281
318
|
readonly name: "LiNEAR";
|
|
319
|
+
readonly firstStakePaysStorage: false;
|
|
320
|
+
readonly featurePauses: false;
|
|
282
321
|
readonly contracts: {
|
|
283
322
|
readonly mainnet: {
|
|
284
323
|
readonly contract: "linear-protocol.near";
|
|
@@ -293,6 +332,8 @@ declare const LIQUID_PRESETS: {
|
|
|
293
332
|
readonly rnear: {
|
|
294
333
|
readonly symbol: "rNEAR";
|
|
295
334
|
readonly name: "Rhea Liquid Near Staking Token";
|
|
335
|
+
readonly firstStakePaysStorage: true;
|
|
336
|
+
readonly featurePauses: true;
|
|
296
337
|
readonly contracts: {
|
|
297
338
|
readonly mainnet: {
|
|
298
339
|
readonly contract: "lst.rhealab.near";
|
|
@@ -310,6 +351,10 @@ interface ResolvedLiquidPool {
|
|
|
310
351
|
symbol: string;
|
|
311
352
|
name: string;
|
|
312
353
|
codeHashes: readonly string[];
|
|
354
|
+
/** See {@link LiquidPoolConfig.firstStakePaysStorage}. */
|
|
355
|
+
firstStakePaysStorage: boolean;
|
|
356
|
+
/** `pa_all_paused` is read (rNEAR, and any custom contract: one without the method has no per-feature pause). */
|
|
357
|
+
featurePauses: boolean;
|
|
313
358
|
preset: LiquidPresetName | null;
|
|
314
359
|
}
|
|
315
360
|
/** Validates a custom pool config (account id, symbol, at least one pinned code hash). */
|
|
@@ -326,8 +371,9 @@ declare function poolRequestId(contract: string): bigint;
|
|
|
326
371
|
*
|
|
327
372
|
* Never builds `ft_transfer_call` or `ft_transfer` into the contract (it has no `ft_on_transfer`:
|
|
328
373
|
* tokens sent that way are lost), and nothing but function calls to the pinned contract. Writes
|
|
329
|
-
* refuse a paused contract or one whose code hash is not
|
|
330
|
-
* transactions; a write given `expected` refuses when its
|
|
374
|
+
* refuse a paused contract (or a paused feature their calls need) or one whose code hash is not
|
|
375
|
+
* pinned. Every quote returns the exact transactions; a write given `expected` refuses when its
|
|
376
|
+
* fresh plan differs.
|
|
331
377
|
*/
|
|
332
378
|
declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNearConfig> {
|
|
333
379
|
readonly reserve: bigint;
|
|
@@ -355,7 +401,7 @@ declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNea
|
|
|
355
401
|
private me;
|
|
356
402
|
private view;
|
|
357
403
|
private epochNumbers;
|
|
358
|
-
/** Spendable NEAR of the account: amount −
|
|
404
|
+
/** Spendable NEAR of the account: amount − max(0, storage − locked), never below 0 (0 for an account that does not exist yet). */
|
|
359
405
|
private available;
|
|
360
406
|
/** Fee (upper bound) and upfront charge of the transactions at the current prices (see fees.ts). */
|
|
361
407
|
private costs;
|
|
@@ -363,6 +409,17 @@ declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNea
|
|
|
363
409
|
private reserveAt;
|
|
364
410
|
private tx;
|
|
365
411
|
private assertWritable;
|
|
412
|
+
/** The paused features a plan's calls check (see PAUSE_KEYS); empty when every call goes through. */
|
|
413
|
+
private static pausedFor;
|
|
414
|
+
/** Withdrawals are stopped: the whole contract or its withdraw feature is paused. */
|
|
415
|
+
private static withdrawPaused;
|
|
416
|
+
/** Refuses transactions that call a feature the contract has paused on its own (rNEAR's per-feature pause): they would fail and burn the gas. */
|
|
417
|
+
private static assertNotPaused;
|
|
418
|
+
/**
|
|
419
|
+
* NEAR the contract keeps from a stake for the account's NEP-145 registration: storage_balance_bounds.min
|
|
420
|
+
* when the contract charges it (rNEAR) and the account is not registered yet, else 0. Read live.
|
|
421
|
+
*/
|
|
422
|
+
private storageFee;
|
|
366
423
|
private readAccount;
|
|
367
424
|
private contractUnlock;
|
|
368
425
|
/**
|
|
@@ -398,8 +455,8 @@ declare class LiquidStakingProtocolNear extends StakingProtocol<LiquidStakingNea
|
|
|
398
455
|
/**
|
|
399
456
|
* The account's unstaked NEAR as one request (a contract keeps one unstaked balance per account):
|
|
400
457
|
* id `poolRequestId(contract)`, `unlockEpoch` exact from the contract. `claimable` needs the epoch
|
|
401
|
-
* reached
|
|
402
|
-
* `timestamp` is 0: the contract does not keep the unstake time.
|
|
458
|
+
* reached, the contract's liquid balance to cover it (`awaitingLiquidity` otherwise) and withdrawals
|
|
459
|
+
* not paused (`paused`). `timestamp` is 0: the contract does not keep the unstake time.
|
|
403
460
|
*/
|
|
404
461
|
getWithdrawalRequests(): Promise<LiquidWithdrawalRequestsView>;
|
|
405
462
|
/** Plans with fresh reads, compares with `expected`, then sends each transaction in order. */
|
|
@@ -562,4 +619,4 @@ declare function describeLiquidNearStakingActivity(tx: ChainTx, ctx: DescribeAct
|
|
|
562
619
|
}>;
|
|
563
620
|
}): ActivityItem | null;
|
|
564
621
|
|
|
565
|
-
export { type BlockTime, CONTRACT_MIN_RESERVE_BALANCE, DEFAULT_APR_WINDOW_EPOCHS, DEFAULT_ARCHIVAL_RPC, DEFAULT_GAS, DEFAULT_RESERVE, EPOCH_LENGTH, type EpochNumbers, GAS_PRICE_MARGIN_DEN, GAS_PRICE_MARGIN_NUM, type GasCost, GasPricer, type GasPrices, LIQUID_PRESETS, LIQUID_WRITE_METHODS, LST_DECIMALS, type LiquidAccountDetails, type LiquidClaimOptions, type LiquidClaimQuote, type LiquidClaimResult, type LiquidPoolConfig, type LiquidPoolInfo, type LiquidPreset, type LiquidPresetName, type LiquidStakeOptions, type LiquidStakeQuote, type LiquidStakeResult, type LiquidStakedBalance, LiquidStakingError, type LiquidStakingErrorCode, type LiquidStakingNearConfig, LiquidStakingProtocolNear, type LiquidStakingWarning, type LiquidStakingWarningCode, type LiquidUnstakeOptions, type LiquidUnstakeQuote, type LiquidUnstakeResult, type LiquidWithdrawalRequest, type LiquidWithdrawalRequestsView, type LiquidWriteOptions, MIN_EPOCHS_TO_UNLOCK, MIN_GAS_PURCHASE_PRICE_FALLBACK, MIN_STAKE, MODULE_NAME, NEAR_MAINNET, NEAR_TESTNET, type NearEpoch, type NearNetwork, type NearTransactionsSender, PRICE_SCALE, type ReadEpochOptions, type ResolvedLiquidPool, STORAGE_DEPOSIT, TGAS, TYPICAL_EPOCH_MS, UNSTAKED_DUST, type UnlockEstimate, YOCTO_PER_NEAR, aprFromPrices, assertLiquidPlan, blockAt, canSendBatch, costOf, LiquidStakingProtocolNear as default, describeLiquidNearStakingActivity, epochStartsAt, fc, finalBlock, gasOf, nearForShares, poolRequestId, readEpoch, readEpochNumbers, resolvePool, resolveRpc, sameTransactions, sharesForNear, validatePoolConfig, valueAtPrice };
|
|
622
|
+
export { type BlockTime, CONTRACT_MIN_RESERVE_BALANCE, DEFAULT_APR_WINDOW_EPOCHS, DEFAULT_ARCHIVAL_RPC, DEFAULT_GAS, DEFAULT_RESERVE, EPOCH_LENGTH, type EpochNumbers, GAS_PRICE_MARGIN_DEN, GAS_PRICE_MARGIN_NUM, type GasCost, GasPricer, type GasPrices, LIQUID_PRESETS, LIQUID_WRITE_METHODS, LST_DECIMALS, type LiquidAccountDetails, type LiquidClaimOptions, type LiquidClaimQuote, type LiquidClaimResult, type LiquidPoolConfig, type LiquidPoolInfo, type LiquidPreset, type LiquidPresetName, type LiquidStakeOptions, type LiquidStakeQuote, type LiquidStakeResult, type LiquidStakedBalance, LiquidStakingError, type LiquidStakingErrorCode, type LiquidStakingNearConfig, LiquidStakingProtocolNear, type LiquidStakingWarning, type LiquidStakingWarningCode, type LiquidUnstakeOptions, type LiquidUnstakeQuote, type LiquidUnstakeResult, type LiquidWithdrawalRequest, type LiquidWithdrawalRequestsView, type LiquidWriteOptions, MIN_EPOCHS_TO_UNLOCK, MIN_GAS_PURCHASE_PRICE_FALLBACK, MIN_STAKE, MODULE_NAME, NEAR_MAINNET, NEAR_TESTNET, type NearEpoch, type NearNetwork, type NearTransactionsSender, PAUSE_KEYS, PRICE_SCALE, type ReadEpochOptions, type ResolvedLiquidPool, STORAGE_DEPOSIT, TGAS, TYPICAL_EPOCH_MS, UNSTAKED_DUST, type UnlockEstimate, YOCTO_PER_NEAR, aprFromPrices, assertLiquidPlan, blockAt, canSendBatch, costOf, LiquidStakingProtocolNear as default, describeLiquidNearStakingActivity, epochStartsAt, fc, finalBlock, gasOf, nearForShares, poolRequestId, readEpoch, readEpochNumbers, resolvePool, resolveRpc, sameTransactions, sharesForNear, validatePoolConfig, valueAtPrice };
|