@wireio/stake 0.5.0 → 0.5.1
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/lib/stake.browser.js +656 -584
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +198 -199
- package/lib/stake.js +744 -658
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +656 -584
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Aggregator.sol/Aggregator.json +82 -0
- package/src/assets/solana/idl/liqsol_core.json +132 -182
- package/src/assets/solana/types/liqsol_core.ts +132 -182
- package/src/networks/ethereum/clients/pretoken.client.ts +2 -5
- package/src/networks/ethereum/clients/stake.client.ts +2 -5
- package/src/networks/ethereum/contract.ts +13 -13
- package/src/networks/ethereum/ethereum.ts +89 -13
- package/src/networks/ethereum/utils.ts +8 -8
- package/src/networks/solana/clients/deposit.client.ts +25 -7
- package/src/networks/solana/clients/distribution.client.ts +84 -1
- package/src/networks/solana/clients/outpost.client.ts +34 -28
- package/src/networks/solana/constants.ts +0 -3
- package/src/networks/solana/solana.ts +99 -90
- package/src/networks/solana/types.ts +3 -9
- package/src/networks/solana/utils.ts +14 -7
- package/src/types.ts +14 -10
- package/src/staker/types.ts +0 -62
package/lib/stake.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ interface IStakingClient {
|
|
|
23
23
|
unstake(amount: bigint): Promise<string>;
|
|
24
24
|
buy(amount: bigint): Promise<string>;
|
|
25
25
|
/** Fetch the complete user portfolio */
|
|
26
|
-
getPortfolio(): Promise<Portfolio>;
|
|
26
|
+
getPortfolio(): Promise<Portfolio | null>;
|
|
27
27
|
getSystemAPY(): Promise<number>;
|
|
28
28
|
/**
|
|
29
29
|
* Protocol fee charged for deposit from Native to LIQ
|
|
@@ -43,8 +43,16 @@ interface IStakingClient {
|
|
|
43
43
|
windowBefore?: number;
|
|
44
44
|
windowAfter?: number;
|
|
45
45
|
}): Promise<TrancheSnapshot | null>;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Estimate a conservative ETH(wei) / SOL(lamports) buffer to leave in the wallet
|
|
48
|
+
* so the user can pay fees for the current deposit and at least one
|
|
49
|
+
* more transaction, plus a bit extra for future interactions.
|
|
50
|
+
*/
|
|
51
|
+
estimateGasBuffer(options?: {
|
|
52
|
+
txCount?: number;
|
|
53
|
+
safetyMultiplier?: number;
|
|
54
|
+
minBuffer?: bigint;
|
|
55
|
+
}): Promise<bigint>;
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* Cross-chain portfolio view for a single account/wallet.
|
|
@@ -184,9 +192,8 @@ interface TrancheSnapshot {
|
|
|
184
192
|
currentTranche: number;
|
|
185
193
|
/** Current tranche price in USD (1e8 scale) */
|
|
186
194
|
currentPriceUsd: bigint;
|
|
187
|
-
/** Tranche curve config (per-chain) */
|
|
188
195
|
supplyGrowthBps: number;
|
|
189
|
-
|
|
196
|
+
priceGrowthCents: number;
|
|
190
197
|
totalPretokensSold: bigint;
|
|
191
198
|
/** Current tranche supply state (1e8 scale) */
|
|
192
199
|
currentTrancheSupply: bigint;
|
|
@@ -337,6 +344,7 @@ declare namespace types$1 {
|
|
|
337
344
|
export type { types$1_AddressBook as AddressBook, types$1_ContractName as ContractName, types$1_DepositEvent as DepositEvent, types$1_DepositResult as DepositResult, types$1_SharesBurnedEvent as SharesBurnedEvent, types$1_StakedEvent as StakedEvent, types$1_StakedResult as StakedResult, types$1_WithdrawRequestedEvent as WithdrawRequestedEvent, types$1_WithdrawResult as WithdrawResult, types$1_WithdrawnStakeEvent as WithdrawnStakeEvent, types$1_WithdrawnStakeResult as WithdrawnStakeResult, types$1_preLaunchReceipt as preLaunchReceipt };
|
|
338
345
|
}
|
|
339
346
|
|
|
347
|
+
declare const INITIAL_TRANCHE_SUPPLY = 35000;
|
|
340
348
|
declare class EthereumStakingClient implements IStakingClient {
|
|
341
349
|
private config;
|
|
342
350
|
private readonly provider;
|
|
@@ -412,7 +420,7 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
412
420
|
* actual = liqETH token balance (ERC-20)
|
|
413
421
|
* tracked = liqETH tracked balance (protocol/accounting view)
|
|
414
422
|
*/
|
|
415
|
-
getPortfolio(): Promise<Portfolio>;
|
|
423
|
+
getPortfolio(): Promise<Portfolio | null>;
|
|
416
424
|
/**
|
|
417
425
|
* ETH Prelaunch function to list the Stake ReceiptNFTs owned by a specific user
|
|
418
426
|
* @param address address to query the receipts for
|
|
@@ -435,6 +443,23 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
435
443
|
windowBefore?: number;
|
|
436
444
|
windowAfter?: number;
|
|
437
445
|
}): Promise<TrancheSnapshot>;
|
|
446
|
+
/**
|
|
447
|
+
* Estimate a conservative native ETH buffer (in wei) to leave in the wallet
|
|
448
|
+
* so the user can pay gas for the current deposit and at least one more tx.
|
|
449
|
+
*
|
|
450
|
+
* Typical usage in UI:
|
|
451
|
+
* const buffer = await client.estimateGasBuffer();
|
|
452
|
+
* const maxSpendable = balanceWei > buffer ? balanceWei - buffer : 0n;
|
|
453
|
+
*
|
|
454
|
+
* @param options.txCount How many transactions to cover (default 2: deposit + 1 more)
|
|
455
|
+
* @param options.safetyMultiplier Additional safety multiplier on top of txCount (default 1.5x)
|
|
456
|
+
* @param options.minBufferWei Optional override minimum buffer (defaults ~0.002 ETH)
|
|
457
|
+
*/
|
|
458
|
+
estimateGasBuffer(options?: {
|
|
459
|
+
txCount?: number;
|
|
460
|
+
safetyMultiplier?: number;
|
|
461
|
+
minBufferWei?: bigint;
|
|
462
|
+
}): Promise<bigint>;
|
|
438
463
|
private updateMockAggregatorPrice;
|
|
439
464
|
}
|
|
440
465
|
|
|
@@ -771,7 +796,7 @@ interface SharesPreview {
|
|
|
771
796
|
* - NFT withdrawal receipts
|
|
772
797
|
* - Encumbered funds for pending withdrawals
|
|
773
798
|
*/
|
|
774
|
-
type
|
|
799
|
+
type GlobalAccount = {
|
|
775
800
|
/** PDA bump */
|
|
776
801
|
bump: number;
|
|
777
802
|
/** Authority that can update serviceable epochs / receipts */
|
|
@@ -798,8 +823,6 @@ type Global = {
|
|
|
798
823
|
* - `wireState` lifecycle (preLaunch/postLaunch/refund)
|
|
799
824
|
*/
|
|
800
825
|
type GlobalState = {
|
|
801
|
-
/** Admin authority for pretokens/outpost config */
|
|
802
|
-
admin: PublicKey$1;
|
|
803
826
|
/** Deployment timestamp (Unix, seconds) */
|
|
804
827
|
deployedAt: BN;
|
|
805
828
|
/** Delay before refunds are permitted (seconds) */
|
|
@@ -1023,8 +1046,6 @@ type UserPretokenRecord = {
|
|
|
1023
1046
|
* All price/supply fields use 8-decimal precision (SCALE = 1e8).
|
|
1024
1047
|
*/
|
|
1025
1048
|
type TrancheState = {
|
|
1026
|
-
/** Admin authority for tranche parameters */
|
|
1027
|
-
admin: PublicKey$1;
|
|
1028
1049
|
/** Current tranche number */
|
|
1029
1050
|
currentTrancheNumber: BN;
|
|
1030
1051
|
/** Remaining supply in the current tranche (8-decimal i128) */
|
|
@@ -1037,8 +1058,8 @@ type TrancheState = {
|
|
|
1037
1058
|
initialTrancheSupply: BN;
|
|
1038
1059
|
/** Supply growth in basis points per tranche */
|
|
1039
1060
|
supplyGrowthBps: number;
|
|
1040
|
-
/** Price growth in
|
|
1041
|
-
|
|
1061
|
+
/** Price growth in cents per tranche (0.01 USD units) */
|
|
1062
|
+
priceGrowthCents: number;
|
|
1042
1063
|
/** Minimum valid SOL/USD price for Chainlink validation (8-decimal i128) */
|
|
1043
1064
|
minPriceUsd: BN;
|
|
1044
1065
|
/** Maximum valid SOL/USD price for Chainlink validation (8-decimal i128) */
|
|
@@ -1219,7 +1240,7 @@ type ValidatorRecord = {
|
|
|
1219
1240
|
|
|
1220
1241
|
type types_DistributionState = DistributionState;
|
|
1221
1242
|
type types_DistributionUserRecord = DistributionUserRecord;
|
|
1222
|
-
type
|
|
1243
|
+
type types_GlobalAccount = GlobalAccount;
|
|
1223
1244
|
type types_GlobalConfig = GlobalConfig;
|
|
1224
1245
|
type types_GlobalState = GlobalState;
|
|
1225
1246
|
type types_LeaderboardState = LeaderboardState;
|
|
@@ -1241,7 +1262,7 @@ type types_WalletLike = WalletLike;
|
|
|
1241
1262
|
type types_WireReceipt = WireReceipt;
|
|
1242
1263
|
type types_WireState = WireState;
|
|
1243
1264
|
declare namespace types {
|
|
1244
|
-
export type { types_DistributionState as DistributionState, types_DistributionUserRecord as DistributionUserRecord,
|
|
1265
|
+
export type { types_DistributionState as DistributionState, types_DistributionUserRecord as DistributionUserRecord, types_GlobalAccount as GlobalAccount, types_GlobalConfig as GlobalConfig, types_GlobalState as GlobalState, types_LeaderboardState as LeaderboardState, types_OutpostAccount as OutpostAccount, types_OutpostWireStateSnapshot as OutpostWireStateSnapshot, types_ParsedAccountInfo as ParsedAccountInfo, types_PayRateEntry as PayRateEntry, types_PayRateHistory as PayRateHistory, types_PriceHistory as PriceHistory, types_Role as Role, types_SharesPreview as SharesPreview, types_SolanaTransaction as SolanaTransaction, types_TrancheState as TrancheState, types_UserPretokenRecord as UserPretokenRecord, types_ValidatorRecord as ValidatorRecord, types_ValidatorReputation as ValidatorReputation, types_ValidatorState as ValidatorState, types_WalletLike as WalletLike, types_WireReceipt as WireReceipt, types_WireState as WireState };
|
|
1245
1266
|
}
|
|
1246
1267
|
|
|
1247
1268
|
declare class DepositClient {
|
|
@@ -1331,6 +1352,13 @@ declare class DistributionClient {
|
|
|
1331
1352
|
totalShares: BN;
|
|
1332
1353
|
ratio: number;
|
|
1333
1354
|
}>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Compute an average scaled pay rate over the most recent `windowSize`
|
|
1357
|
+
* valid entries in the pay-rate history circular buffer.
|
|
1358
|
+
*
|
|
1359
|
+
* Returns a BN scaled by 1e12 (same as on-chain).
|
|
1360
|
+
*/
|
|
1361
|
+
getAverageScaledPayRate(windowSize?: number): Promise<BN>;
|
|
1334
1362
|
}
|
|
1335
1363
|
|
|
1336
1364
|
/**
|
|
@@ -1964,26 +1992,14 @@ type LiqsolCore = {
|
|
|
1964
1992
|
"name": "processingState";
|
|
1965
1993
|
"writable": true;
|
|
1966
1994
|
},
|
|
1967
|
-
{
|
|
1968
|
-
"name": "controllerState";
|
|
1969
|
-
"docs": [
|
|
1970
|
-
"Stake controller state - used to verify authority"
|
|
1971
|
-
];
|
|
1972
|
-
},
|
|
1973
1995
|
{
|
|
1974
1996
|
"name": "globalConfig";
|
|
1975
|
-
"docs": [
|
|
1976
|
-
"Global config for cooldown_epochs"
|
|
1977
|
-
];
|
|
1978
1997
|
},
|
|
1979
1998
|
{
|
|
1980
1999
|
"name": "clock";
|
|
1981
2000
|
},
|
|
1982
2001
|
{
|
|
1983
|
-
"name": "
|
|
1984
|
-
"docs": [
|
|
1985
|
-
"Authority must match the stored authority in controller_state"
|
|
1986
|
-
];
|
|
2002
|
+
"name": "cranky";
|
|
1987
2003
|
"writable": true;
|
|
1988
2004
|
"signer": true;
|
|
1989
2005
|
}
|
|
@@ -2007,6 +2023,9 @@ type LiqsolCore = {
|
|
|
2007
2023
|
"name": "admin";
|
|
2008
2024
|
"signer": true;
|
|
2009
2025
|
},
|
|
2026
|
+
{
|
|
2027
|
+
"name": "globalConfig";
|
|
2028
|
+
},
|
|
2010
2029
|
{
|
|
2011
2030
|
"name": "globalState";
|
|
2012
2031
|
},
|
|
@@ -2049,6 +2068,9 @@ type LiqsolCore = {
|
|
|
2049
2068
|
"name": "admin";
|
|
2050
2069
|
"signer": true;
|
|
2051
2070
|
},
|
|
2071
|
+
{
|
|
2072
|
+
"name": "globalConfig";
|
|
2073
|
+
},
|
|
2052
2074
|
{
|
|
2053
2075
|
"name": "globalState";
|
|
2054
2076
|
"writable": true;
|
|
@@ -2708,14 +2730,17 @@ type LiqsolCore = {
|
|
|
2708
2730
|
"name": "globalConfig";
|
|
2709
2731
|
"writable": true;
|
|
2710
2732
|
},
|
|
2711
|
-
{
|
|
2712
|
-
"name": "controllerState";
|
|
2713
|
-
},
|
|
2714
2733
|
{
|
|
2715
2734
|
"name": "payer";
|
|
2716
2735
|
"writable": true;
|
|
2717
2736
|
"signer": true;
|
|
2718
2737
|
},
|
|
2738
|
+
{
|
|
2739
|
+
"name": "program";
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
"name": "programData";
|
|
2743
|
+
},
|
|
2719
2744
|
{
|
|
2720
2745
|
"name": "systemProgram";
|
|
2721
2746
|
}
|
|
@@ -3199,17 +3224,10 @@ type LiqsolCore = {
|
|
|
3199
3224
|
];
|
|
3200
3225
|
"accounts": [
|
|
3201
3226
|
{
|
|
3202
|
-
"name": "
|
|
3203
|
-
"docs": [
|
|
3204
|
-
"Stake controller state - used to verify admin authority"
|
|
3205
|
-
];
|
|
3227
|
+
"name": "globalConfig";
|
|
3206
3228
|
},
|
|
3207
3229
|
{
|
|
3208
|
-
"name": "
|
|
3209
|
-
"docs": [
|
|
3210
|
-
"Admin must match the stored authority in controller_state"
|
|
3211
|
-
];
|
|
3212
|
-
"writable": true;
|
|
3230
|
+
"name": "cranky";
|
|
3213
3231
|
"signer": true;
|
|
3214
3232
|
},
|
|
3215
3233
|
{
|
|
@@ -4235,6 +4253,9 @@ type LiqsolCore = {
|
|
|
4235
4253
|
"name": "admin";
|
|
4236
4254
|
"signer": true;
|
|
4237
4255
|
},
|
|
4256
|
+
{
|
|
4257
|
+
"name": "globalConfig";
|
|
4258
|
+
},
|
|
4238
4259
|
{
|
|
4239
4260
|
"name": "globalState";
|
|
4240
4261
|
"writable": true;
|
|
@@ -4276,6 +4297,9 @@ type LiqsolCore = {
|
|
|
4276
4297
|
"writable": true;
|
|
4277
4298
|
"signer": true;
|
|
4278
4299
|
},
|
|
4300
|
+
{
|
|
4301
|
+
"name": "globalConfig";
|
|
4302
|
+
},
|
|
4279
4303
|
{
|
|
4280
4304
|
"name": "trancheState";
|
|
4281
4305
|
"writable": true;
|
|
@@ -4308,6 +4332,9 @@ type LiqsolCore = {
|
|
|
4308
4332
|
"writable": true;
|
|
4309
4333
|
"signer": true;
|
|
4310
4334
|
},
|
|
4335
|
+
{
|
|
4336
|
+
"name": "globalConfig";
|
|
4337
|
+
},
|
|
4311
4338
|
{
|
|
4312
4339
|
"name": "trancheState";
|
|
4313
4340
|
"writable": true;
|
|
@@ -4322,6 +4349,62 @@ type LiqsolCore = {
|
|
|
4322
4349
|
];
|
|
4323
4350
|
"args": [];
|
|
4324
4351
|
},
|
|
4352
|
+
{
|
|
4353
|
+
"name": "setAdmin";
|
|
4354
|
+
"discriminator": [
|
|
4355
|
+
251,
|
|
4356
|
+
163,
|
|
4357
|
+
0,
|
|
4358
|
+
52,
|
|
4359
|
+
91,
|
|
4360
|
+
194,
|
|
4361
|
+
187,
|
|
4362
|
+
92
|
|
4363
|
+
];
|
|
4364
|
+
"accounts": [
|
|
4365
|
+
{
|
|
4366
|
+
"name": "globalConfig";
|
|
4367
|
+
"writable": true;
|
|
4368
|
+
},
|
|
4369
|
+
{
|
|
4370
|
+
"name": "admin";
|
|
4371
|
+
"signer": true;
|
|
4372
|
+
},
|
|
4373
|
+
{
|
|
4374
|
+
"name": "newAuthority";
|
|
4375
|
+
"signer": true;
|
|
4376
|
+
}
|
|
4377
|
+
];
|
|
4378
|
+
"args": [];
|
|
4379
|
+
},
|
|
4380
|
+
{
|
|
4381
|
+
"name": "setCranky";
|
|
4382
|
+
"discriminator": [
|
|
4383
|
+
232,
|
|
4384
|
+
48,
|
|
4385
|
+
178,
|
|
4386
|
+
74,
|
|
4387
|
+
194,
|
|
4388
|
+
60,
|
|
4389
|
+
143,
|
|
4390
|
+
164
|
|
4391
|
+
];
|
|
4392
|
+
"accounts": [
|
|
4393
|
+
{
|
|
4394
|
+
"name": "globalConfig";
|
|
4395
|
+
"writable": true;
|
|
4396
|
+
},
|
|
4397
|
+
{
|
|
4398
|
+
"name": "admin";
|
|
4399
|
+
"signer": true;
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
"name": "newAuthority";
|
|
4403
|
+
"signer": true;
|
|
4404
|
+
}
|
|
4405
|
+
];
|
|
4406
|
+
"args": [];
|
|
4407
|
+
},
|
|
4325
4408
|
{
|
|
4326
4409
|
"name": "setLastStateChangeEpoch";
|
|
4327
4410
|
"docs": [
|
|
@@ -4378,6 +4461,9 @@ type LiqsolCore = {
|
|
|
4378
4461
|
"name": "admin";
|
|
4379
4462
|
"signer": true;
|
|
4380
4463
|
},
|
|
4464
|
+
{
|
|
4465
|
+
"name": "globalConfig";
|
|
4466
|
+
},
|
|
4381
4467
|
{
|
|
4382
4468
|
"name": "globalState";
|
|
4383
4469
|
"writable": true;
|
|
@@ -4407,6 +4493,9 @@ type LiqsolCore = {
|
|
|
4407
4493
|
"name": "admin";
|
|
4408
4494
|
"signer": true;
|
|
4409
4495
|
},
|
|
4496
|
+
{
|
|
4497
|
+
"name": "globalConfig";
|
|
4498
|
+
},
|
|
4410
4499
|
{
|
|
4411
4500
|
"name": "globalState";
|
|
4412
4501
|
"writable": true;
|
|
@@ -4444,6 +4533,9 @@ type LiqsolCore = {
|
|
|
4444
4533
|
"name": "admin";
|
|
4445
4534
|
"signer": true;
|
|
4446
4535
|
},
|
|
4536
|
+
{
|
|
4537
|
+
"name": "globalConfig";
|
|
4538
|
+
},
|
|
4447
4539
|
{
|
|
4448
4540
|
"name": "globalState";
|
|
4449
4541
|
"writable": true;
|
|
@@ -4473,6 +4565,9 @@ type LiqsolCore = {
|
|
|
4473
4565
|
"name": "admin";
|
|
4474
4566
|
"signer": true;
|
|
4475
4567
|
},
|
|
4568
|
+
{
|
|
4569
|
+
"name": "globalConfig";
|
|
4570
|
+
},
|
|
4476
4571
|
{
|
|
4477
4572
|
"name": "globalState";
|
|
4478
4573
|
"writable": true;
|
|
@@ -4555,6 +4650,9 @@ type LiqsolCore = {
|
|
|
4555
4650
|
"name": "admin";
|
|
4556
4651
|
"signer": true;
|
|
4557
4652
|
},
|
|
4653
|
+
{
|
|
4654
|
+
"name": "globalConfig";
|
|
4655
|
+
},
|
|
4558
4656
|
{
|
|
4559
4657
|
"name": "globalState";
|
|
4560
4658
|
},
|
|
@@ -4610,6 +4708,9 @@ type LiqsolCore = {
|
|
|
4610
4708
|
},
|
|
4611
4709
|
{
|
|
4612
4710
|
"name": "syncLeaderboardScoresBatch";
|
|
4711
|
+
"docs": [
|
|
4712
|
+
"region: Validator Leaderboard Syncing"
|
|
4713
|
+
];
|
|
4613
4714
|
"discriminator": [
|
|
4614
4715
|
52,
|
|
4615
4716
|
11,
|
|
@@ -4872,13 +4973,7 @@ type LiqsolCore = {
|
|
|
4872
4973
|
"writable": true;
|
|
4873
4974
|
},
|
|
4874
4975
|
{
|
|
4875
|
-
"name": "
|
|
4876
|
-
},
|
|
4877
|
-
{
|
|
4878
|
-
"name": "authority";
|
|
4879
|
-
"docs": [
|
|
4880
|
-
"Authority must match StakeControllerState.authority"
|
|
4881
|
-
];
|
|
4976
|
+
"name": "admin";
|
|
4882
4977
|
"signer": true;
|
|
4883
4978
|
}
|
|
4884
4979
|
];
|
|
@@ -4915,13 +5010,7 @@ type LiqsolCore = {
|
|
|
4915
5010
|
"writable": true;
|
|
4916
5011
|
},
|
|
4917
5012
|
{
|
|
4918
|
-
"name": "
|
|
4919
|
-
},
|
|
4920
|
-
{
|
|
4921
|
-
"name": "authority";
|
|
4922
|
-
"docs": [
|
|
4923
|
-
"Authority must match StakeControllerState.authority"
|
|
4924
|
-
];
|
|
5013
|
+
"name": "admin";
|
|
4925
5014
|
"signer": true;
|
|
4926
5015
|
}
|
|
4927
5016
|
];
|
|
@@ -4958,13 +5047,7 @@ type LiqsolCore = {
|
|
|
4958
5047
|
"writable": true;
|
|
4959
5048
|
},
|
|
4960
5049
|
{
|
|
4961
|
-
"name": "
|
|
4962
|
-
},
|
|
4963
|
-
{
|
|
4964
|
-
"name": "authority";
|
|
4965
|
-
"docs": [
|
|
4966
|
-
"Authority must match StakeControllerState.authority"
|
|
4967
|
-
];
|
|
5050
|
+
"name": "admin";
|
|
4968
5051
|
"signer": true;
|
|
4969
5052
|
}
|
|
4970
5053
|
];
|
|
@@ -5001,13 +5084,7 @@ type LiqsolCore = {
|
|
|
5001
5084
|
"writable": true;
|
|
5002
5085
|
},
|
|
5003
5086
|
{
|
|
5004
|
-
"name": "
|
|
5005
|
-
},
|
|
5006
|
-
{
|
|
5007
|
-
"name": "authority";
|
|
5008
|
-
"docs": [
|
|
5009
|
-
"Authority must match StakeControllerState.authority"
|
|
5010
|
-
];
|
|
5087
|
+
"name": "admin";
|
|
5011
5088
|
"signer": true;
|
|
5012
5089
|
}
|
|
5013
5090
|
];
|
|
@@ -5044,6 +5121,9 @@ type LiqsolCore = {
|
|
|
5044
5121
|
"writable": true;
|
|
5045
5122
|
"signer": true;
|
|
5046
5123
|
},
|
|
5124
|
+
{
|
|
5125
|
+
"name": "globalConfig";
|
|
5126
|
+
},
|
|
5047
5127
|
{
|
|
5048
5128
|
"name": "trancheState";
|
|
5049
5129
|
"writable": true;
|
|
@@ -5062,7 +5142,7 @@ type LiqsolCore = {
|
|
|
5062
5142
|
"type": "u16";
|
|
5063
5143
|
},
|
|
5064
5144
|
{
|
|
5065
|
-
"name": "
|
|
5145
|
+
"name": "priceGrowthCents";
|
|
5066
5146
|
"type": "u16";
|
|
5067
5147
|
}
|
|
5068
5148
|
];
|
|
@@ -5085,6 +5165,9 @@ type LiqsolCore = {
|
|
|
5085
5165
|
"writable": true;
|
|
5086
5166
|
"signer": true;
|
|
5087
5167
|
},
|
|
5168
|
+
{
|
|
5169
|
+
"name": "globalConfig";
|
|
5170
|
+
},
|
|
5088
5171
|
{
|
|
5089
5172
|
"name": "trancheState";
|
|
5090
5173
|
"writable": true;
|
|
@@ -5549,118 +5632,8 @@ type LiqsolCore = {
|
|
|
5549
5632
|
"errors": [
|
|
5550
5633
|
{
|
|
5551
5634
|
"code": 6000;
|
|
5552
|
-
"name": "
|
|
5553
|
-
"msg": "
|
|
5554
|
-
},
|
|
5555
|
-
{
|
|
5556
|
-
"code": 6001;
|
|
5557
|
-
"name": "sourceAccountDoesNotExist";
|
|
5558
|
-
"msg": "Source stake account does not exist";
|
|
5559
|
-
},
|
|
5560
|
-
{
|
|
5561
|
-
"code": 6002;
|
|
5562
|
-
"name": "invalidDestinationOwner";
|
|
5563
|
-
"msg": "Destination account not owned by stake program";
|
|
5564
|
-
},
|
|
5565
|
-
{
|
|
5566
|
-
"code": 6003;
|
|
5567
|
-
"name": "invalidSourceOwner";
|
|
5568
|
-
"msg": "Source account not owned by stake program";
|
|
5569
|
-
},
|
|
5570
|
-
{
|
|
5571
|
-
"code": 6004;
|
|
5572
|
-
"name": "clockBorrowFailed";
|
|
5573
|
-
"msg": "Failed to borrow clock data";
|
|
5574
|
-
},
|
|
5575
|
-
{
|
|
5576
|
-
"code": 6005;
|
|
5577
|
-
"name": "clockDeserializeFailed";
|
|
5578
|
-
"msg": "Failed to deserialize clock";
|
|
5579
|
-
},
|
|
5580
|
-
{
|
|
5581
|
-
"code": 6006;
|
|
5582
|
-
"name": "destinationAnalysisFailed";
|
|
5583
|
-
"msg": "Failed to analyze destination stake account";
|
|
5584
|
-
},
|
|
5585
|
-
{
|
|
5586
|
-
"code": 6007;
|
|
5587
|
-
"name": "sourceAnalysisFailed";
|
|
5588
|
-
"msg": "Failed to analyze source stake account";
|
|
5589
|
-
},
|
|
5590
|
-
{
|
|
5591
|
-
"code": 6008;
|
|
5592
|
-
"name": "destinationStillActivating";
|
|
5593
|
-
"msg": "Destination stake is still activating";
|
|
5594
|
-
},
|
|
5595
|
-
{
|
|
5596
|
-
"code": 6009;
|
|
5597
|
-
"name": "destinationDeactivating";
|
|
5598
|
-
"msg": "Destination stake is deactivating";
|
|
5599
|
-
},
|
|
5600
|
-
{
|
|
5601
|
-
"code": 6010;
|
|
5602
|
-
"name": "sourceStillActivating";
|
|
5603
|
-
"msg": "Source stake is still activating";
|
|
5604
|
-
},
|
|
5605
|
-
{
|
|
5606
|
-
"code": 6011;
|
|
5607
|
-
"name": "sourceDeactivating";
|
|
5608
|
-
"msg": "Source stake is deactivating";
|
|
5609
|
-
},
|
|
5610
|
-
{
|
|
5611
|
-
"code": 6012;
|
|
5612
|
-
"name": "destinationBorrowFailed";
|
|
5613
|
-
"msg": "Failed to borrow destination account data";
|
|
5614
|
-
},
|
|
5615
|
-
{
|
|
5616
|
-
"code": 6013;
|
|
5617
|
-
"name": "destinationParseFailed";
|
|
5618
|
-
"msg": "Failed to parse destination stake state";
|
|
5619
|
-
},
|
|
5620
|
-
{
|
|
5621
|
-
"code": 6014;
|
|
5622
|
-
"name": "sourceBorrowFailed";
|
|
5623
|
-
"msg": "Failed to borrow source account data";
|
|
5624
|
-
},
|
|
5625
|
-
{
|
|
5626
|
-
"code": 6015;
|
|
5627
|
-
"name": "sourceParseFailed";
|
|
5628
|
-
"msg": "Failed to parse source stake state";
|
|
5629
|
-
},
|
|
5630
|
-
{
|
|
5631
|
-
"code": 6016;
|
|
5632
|
-
"name": "differentValidators";
|
|
5633
|
-
"msg": "Stakes are delegated to different validators";
|
|
5634
|
-
},
|
|
5635
|
-
{
|
|
5636
|
-
"code": 6017;
|
|
5637
|
-
"name": "differentStakers";
|
|
5638
|
-
"msg": "Stakes have different staker authorities";
|
|
5639
|
-
},
|
|
5640
|
-
{
|
|
5641
|
-
"code": 6018;
|
|
5642
|
-
"name": "differentWithdrawers";
|
|
5643
|
-
"msg": "Stakes have different withdrawer authorities";
|
|
5644
|
-
},
|
|
5645
|
-
{
|
|
5646
|
-
"code": 6019;
|
|
5647
|
-
"name": "authoritiesNotFound";
|
|
5648
|
-
"msg": "Could not extract authorities from accounts";
|
|
5649
|
-
},
|
|
5650
|
-
{
|
|
5651
|
-
"code": 6020;
|
|
5652
|
-
"name": "mergeInstructionFailed";
|
|
5653
|
-
"msg": "Merge instruction failed";
|
|
5654
|
-
},
|
|
5655
|
-
{
|
|
5656
|
-
"code": 6021;
|
|
5657
|
-
"name": "epochRewardsActive";
|
|
5658
|
-
"msg": "Epoch rewards distribution is active - stake operations blocked";
|
|
5659
|
-
},
|
|
5660
|
-
{
|
|
5661
|
-
"code": 6022;
|
|
5662
|
-
"name": "differentCreditsObserved";
|
|
5663
|
-
"msg": "Stakes have different credits_observed - cannot merge until both earn same rewards";
|
|
5635
|
+
"name": "accountBorrowFailed";
|
|
5636
|
+
"msg": "Util Acc borrow Failed";
|
|
5664
5637
|
}
|
|
5665
5638
|
];
|
|
5666
5639
|
"types": [
|
|
@@ -6046,8 +6019,7 @@ type LiqsolCore = {
|
|
|
6046
6019
|
{
|
|
6047
6020
|
"name": "globalConfig";
|
|
6048
6021
|
"docs": [
|
|
6049
|
-
"Zero-copy global config PDA"
|
|
6050
|
-
"Authority is taken from StakeControllerState, not stored here"
|
|
6022
|
+
"Zero-copy global config PDA"
|
|
6051
6023
|
];
|
|
6052
6024
|
"serialization": "bytemuckunsafe";
|
|
6053
6025
|
"repr": {
|
|
@@ -6069,6 +6041,23 @@ type LiqsolCore = {
|
|
|
6069
6041
|
];
|
|
6070
6042
|
};
|
|
6071
6043
|
},
|
|
6044
|
+
{
|
|
6045
|
+
"name": "admin";
|
|
6046
|
+
"type": "pubkey";
|
|
6047
|
+
},
|
|
6048
|
+
{
|
|
6049
|
+
"name": "cranky";
|
|
6050
|
+
"type": "pubkey";
|
|
6051
|
+
},
|
|
6052
|
+
{
|
|
6053
|
+
"name": "reservedPubkey";
|
|
6054
|
+
"type": {
|
|
6055
|
+
"array": [
|
|
6056
|
+
"pubkey",
|
|
6057
|
+
1
|
|
6058
|
+
];
|
|
6059
|
+
};
|
|
6060
|
+
},
|
|
6072
6061
|
{
|
|
6073
6062
|
"name": "minUserDeposit";
|
|
6074
6063
|
"docs": [
|
|
@@ -6255,10 +6244,6 @@ type LiqsolCore = {
|
|
|
6255
6244
|
"type": {
|
|
6256
6245
|
"kind": "struct";
|
|
6257
6246
|
"fields": [
|
|
6258
|
-
{
|
|
6259
|
-
"name": "admin";
|
|
6260
|
-
"type": "pubkey";
|
|
6261
|
-
},
|
|
6262
6247
|
{
|
|
6263
6248
|
"name": "deployedAt";
|
|
6264
6249
|
"type": "i64";
|
|
@@ -7219,13 +7204,6 @@ type LiqsolCore = {
|
|
|
7219
7204
|
"type": {
|
|
7220
7205
|
"kind": "struct";
|
|
7221
7206
|
"fields": [
|
|
7222
|
-
{
|
|
7223
|
-
"name": "admin";
|
|
7224
|
-
"docs": [
|
|
7225
|
-
"Admin authority (can update growth parameters and price bounds)"
|
|
7226
|
-
];
|
|
7227
|
-
"type": "pubkey";
|
|
7228
|
-
},
|
|
7229
7207
|
{
|
|
7230
7208
|
"name": "currentTrancheNumber";
|
|
7231
7209
|
"type": "u64";
|
|
@@ -7254,9 +7232,9 @@ type LiqsolCore = {
|
|
|
7254
7232
|
"type": "u16";
|
|
7255
7233
|
},
|
|
7256
7234
|
{
|
|
7257
|
-
"name": "
|
|
7235
|
+
"name": "priceGrowthCents";
|
|
7258
7236
|
"docs": [
|
|
7259
|
-
"Price growth in
|
|
7237
|
+
"Price growth in cents per tranche (0.01 USD units)"
|
|
7260
7238
|
];
|
|
7261
7239
|
"type": "u16";
|
|
7262
7240
|
},
|
|
@@ -7868,7 +7846,7 @@ declare function buildSolanaTrancheLadder(options: {
|
|
|
7868
7846
|
currentTrancheSupply: bigint;
|
|
7869
7847
|
currentPriceUsd: bigint;
|
|
7870
7848
|
supplyGrowthBps: number;
|
|
7871
|
-
|
|
7849
|
+
priceGrowthCents: number;
|
|
7872
7850
|
windowBefore?: number;
|
|
7873
7851
|
windowAfter?: number;
|
|
7874
7852
|
}): TrancheLadderItem[];
|
|
@@ -7992,6 +7970,7 @@ interface ScheduleConfig {
|
|
|
7992
7970
|
early?: number;
|
|
7993
7971
|
late?: number;
|
|
7994
7972
|
}
|
|
7973
|
+
declare function ceilDiv(n: BN, d: BN): BN;
|
|
7995
7974
|
|
|
7996
7975
|
/**
|
|
7997
7976
|
* OutpostClient
|
|
@@ -8120,6 +8099,7 @@ declare class TokenClient {
|
|
|
8120
8099
|
getSolPriceUsd(): Promise<bigint>;
|
|
8121
8100
|
}
|
|
8122
8101
|
|
|
8102
|
+
declare const SCALE: any;
|
|
8123
8103
|
/**
|
|
8124
8104
|
* Solana implementation of IStakingClient.
|
|
8125
8105
|
*
|
|
@@ -8217,6 +8197,26 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
8217
8197
|
windowBefore?: number;
|
|
8218
8198
|
windowAfter?: number;
|
|
8219
8199
|
}): Promise<TrancheSnapshot>;
|
|
8200
|
+
/**
|
|
8201
|
+
* Estimate a conservative SOL buffer (lamports) to leave in the wallet
|
|
8202
|
+
* so the user can pay fees for the current deposit and at least one
|
|
8203
|
+
* more transaction, plus a bit extra for future interactions.
|
|
8204
|
+
*
|
|
8205
|
+
* Intended usage in UI:
|
|
8206
|
+
* const bufferLamports = await client.estimateGasBuffer();
|
|
8207
|
+
* const maxSpendable = balanceLamports > bufferLamports
|
|
8208
|
+
* ? balanceLamports - bufferLamports
|
|
8209
|
+
* : 0n;
|
|
8210
|
+
*
|
|
8211
|
+
* @param options.txCount How many transactions to cover (default 2)
|
|
8212
|
+
* @param options.safetyMultiplier Extra safety multiplier (default 3x)
|
|
8213
|
+
* @param options.minBufferLamports Optional override minimum buffer (default ~0.01 SOL)
|
|
8214
|
+
*/
|
|
8215
|
+
estimateGasBuffer(options?: {
|
|
8216
|
+
txCount?: number;
|
|
8217
|
+
safetyMultiplier?: number;
|
|
8218
|
+
minBufferLamports?: bigint;
|
|
8219
|
+
}): Promise<bigint>;
|
|
8220
8220
|
/**
|
|
8221
8221
|
* Send a signed transaction over HTTP RPC and wait for confirmation.
|
|
8222
8222
|
* Throws if the transaction fails.
|
|
@@ -8245,7 +8245,6 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
8245
8245
|
* Ensures we have a Wire pubKey and an Anchor wallet pubKey, and that they match.
|
|
8246
8246
|
*/
|
|
8247
8247
|
ensureUser(): void;
|
|
8248
|
-
private ceilDiv;
|
|
8249
8248
|
}
|
|
8250
8249
|
|
|
8251
8250
|
/**
|
|
@@ -8399,5 +8398,5 @@ declare const INDEX_SCALE: bigint;
|
|
|
8399
8398
|
declare const lamportsToSol: (lamports: number | bigint) => number;
|
|
8400
8399
|
declare const solToLamports: (sol: number) => bigint;
|
|
8401
8400
|
|
|
8402
|
-
export { ADDRESSES, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, INDEX_SCALE, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, PurchaseAsset, ReceiptNFTKind, types as SOL, SolanaStakingClient, Staker, TRANSFER_HOOK, TokenClient, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, calculateExpectedFee, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveExtraAccountMetaListPda, deriveGlobalConfigPda, deriveLeaderboardStatePda, deriveLiqReceiptDataPda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveMaintenanceLedgerPda, deriveOutpostAccountPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePriceHistoryPda, deriveReservePoolPda, deriveStakeAllocationStatePda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveStakeMetricsPda, deriveTrancheStatePda, deriveUserPretokenRecordPda, deriveUserRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWithdrawGlobalPda, deriveWithdrawMintAuthorityPda, deriveWithdrawMintMetadataPda, deriveWithdrawNftMintPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
8401
|
+
export { ADDRESSES, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, INDEX_SCALE, INITIAL_TRANCHE_SUPPLY, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, PurchaseAsset, ReceiptNFTKind, SCALE, types as SOL, SolanaStakingClient, Staker, TRANSFER_HOOK, TokenClient, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, calculateExpectedFee, ceilDiv, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveExtraAccountMetaListPda, deriveGlobalConfigPda, deriveLeaderboardStatePda, deriveLiqReceiptDataPda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveMaintenanceLedgerPda, deriveOutpostAccountPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePriceHistoryPda, deriveReservePoolPda, deriveStakeAllocationStatePda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveStakeMetricsPda, deriveTrancheStatePda, deriveUserPretokenRecordPda, deriveUserRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWithdrawGlobalPda, deriveWithdrawMintAuthorityPda, deriveWithdrawMintMetadataPda, deriveWithdrawNftMintPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
8403
8402
|
export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, YieldView };
|