@wireio/stake 0.5.0 → 0.5.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/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
- getSystemAPY(): Promise<number>;
47
- getDepositFee(amount: bigint): Promise<bigint>;
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
- priceIncrementUsd: number;
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 Global = {
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 basis points per tranche */
1041
- priceGrowthBps: number;
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 types_Global = Global;
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, types_Global as Global, 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 };
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": "authority";
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": "controllerState";
3203
- "docs": [
3204
- "Stake controller state - used to verify admin authority"
3205
- ];
3227
+ "name": "globalConfig";
3206
3228
  },
3207
3229
  {
3208
- "name": "admin";
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": "controllerState";
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": "controllerState";
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": "controllerState";
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": "controllerState";
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": "priceGrowthBps";
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": "destinationAccountDoesNotExist";
5553
- "msg": "Destination stake account does not exist";
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": "priceGrowthBps";
7235
+ "name": "priceGrowthCents";
7258
7236
  "docs": [
7259
- "Price growth in basis points (e.g., 200 = 2%, max 10000)"
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
- priceGrowthBps: number;
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
@@ -8121,17 +8100,954 @@ declare class TokenClient {
8121
8100
  }
8122
8101
 
8123
8102
  /**
8124
- * Solana implementation of IStakingClient.
8125
- *
8126
- * Responsibilities:
8127
- * - liqSOL deposit (SOL -> liqSOL)
8128
- * - withdraw requests (liqSOL -> NFT receipt / encumbered SOL)
8129
- * - Pretoken (WIRE) buys via liqSOL
8130
- * - Unified portfolio + tranche snapshot + balance correction (later)
8103
+ * Program IDL in camelCase format in order to be used in JS/TS.
8131
8104
  *
8132
- * This composes lower-level clients; it does not know about UI.
8105
+ * Note that this is only a type helper and is not the actual IDL. The original
8106
+ * IDL can be found at `target/idl/liqsol_token.json`.
8133
8107
  */
8134
- declare class SolanaStakingClient implements IStakingClient {
8108
+ type LiqsolToken = {
8109
+ "address": "5MRFSLCkXPEzfR6gkcZCVttq9g83mMUHyTZ85Z3TSpvU";
8110
+ "metadata": {
8111
+ "name": "liqsolToken";
8112
+ "version": "0.1.0";
8113
+ "spec": "0.1.0";
8114
+ "description": "Liquidity Staking Token Program";
8115
+ };
8116
+ "instructions": [
8117
+ {
8118
+ "name": "createMintAccount";
8119
+ "discriminator": [
8120
+ 76,
8121
+ 184,
8122
+ 50,
8123
+ 62,
8124
+ 162,
8125
+ 141,
8126
+ 47,
8127
+ 103
8128
+ ];
8129
+ "accounts": [
8130
+ {
8131
+ "name": "payer";
8132
+ "writable": true;
8133
+ "signer": true;
8134
+ },
8135
+ {
8136
+ "name": "mintAuthority";
8137
+ },
8138
+ {
8139
+ "name": "receiver";
8140
+ },
8141
+ {
8142
+ "name": "mint";
8143
+ "docs": [
8144
+ "The mint PDA - deterministic address for liqSOL token"
8145
+ ];
8146
+ "writable": true;
8147
+ },
8148
+ {
8149
+ "name": "mintTokenAccount";
8150
+ "writable": true;
8151
+ },
8152
+ {
8153
+ "name": "systemProgram";
8154
+ },
8155
+ {
8156
+ "name": "associatedTokenProgram";
8157
+ },
8158
+ {
8159
+ "name": "tokenProgram";
8160
+ }
8161
+ ];
8162
+ "args": [
8163
+ {
8164
+ "name": "args";
8165
+ "type": {
8166
+ "defined": {
8167
+ "name": "createMintAccountArgs";
8168
+ };
8169
+ };
8170
+ }
8171
+ ];
8172
+ },
8173
+ {
8174
+ "name": "mintForAuthorizedProgram";
8175
+ "discriminator": [
8176
+ 116,
8177
+ 208,
8178
+ 64,
8179
+ 189,
8180
+ 2,
8181
+ 60,
8182
+ 50,
8183
+ 41
8184
+ ];
8185
+ "accounts": [
8186
+ {
8187
+ "name": "mint";
8188
+ "writable": true;
8189
+ },
8190
+ {
8191
+ "name": "recipientTokenAccount";
8192
+ "writable": true;
8193
+ },
8194
+ {
8195
+ "name": "programAuthority";
8196
+ "docs": [
8197
+ "The calling program's authority PDA that proves authorization to mint"
8198
+ ];
8199
+ "writable": true;
8200
+ "signer": true;
8201
+ },
8202
+ {
8203
+ "name": "mintAuthority";
8204
+ },
8205
+ {
8206
+ "name": "instructions";
8207
+ },
8208
+ {
8209
+ "name": "tokenProgram";
8210
+ }
8211
+ ];
8212
+ "args": [
8213
+ {
8214
+ "name": "args";
8215
+ "type": {
8216
+ "defined": {
8217
+ "name": "mintTokenArgs";
8218
+ };
8219
+ };
8220
+ }
8221
+ ];
8222
+ }
8223
+ ];
8224
+ "errors": [
8225
+ {
8226
+ "code": 6000;
8227
+ "name": "invalidMintAuthority";
8228
+ "msg": "Invalid mint authority";
8229
+ },
8230
+ {
8231
+ "code": 6001;
8232
+ "name": "unauthorizedProgram";
8233
+ "msg": "Unauthorized program attempting to mint";
8234
+ },
8235
+ {
8236
+ "code": 6002;
8237
+ "name": "cannotDetermineCallingProgram";
8238
+ "msg": "Cannot determine calling program";
8239
+ },
8240
+ {
8241
+ "code": 6003;
8242
+ "name": "directCallNotAllowed";
8243
+ "msg": "Direct calls not allowed, must be called via CPI";
8244
+ },
8245
+ {
8246
+ "code": 6004;
8247
+ "name": "invalidProgramId";
8248
+ "msg": "Invalid program ID";
8249
+ },
8250
+ {
8251
+ "code": 6005;
8252
+ "name": "unauthorizedAuthority";
8253
+ "msg": "Unauthorized authority PDA";
8254
+ }
8255
+ ];
8256
+ "types": [
8257
+ {
8258
+ "name": "createMintAccountArgs";
8259
+ "type": {
8260
+ "kind": "struct";
8261
+ "fields": [
8262
+ {
8263
+ "name": "name";
8264
+ "type": "string";
8265
+ },
8266
+ {
8267
+ "name": "symbol";
8268
+ "type": "string";
8269
+ },
8270
+ {
8271
+ "name": "uri";
8272
+ "type": "string";
8273
+ }
8274
+ ];
8275
+ };
8276
+ },
8277
+ {
8278
+ "name": "mintTokenArgs";
8279
+ "type": {
8280
+ "kind": "struct";
8281
+ "fields": [
8282
+ {
8283
+ "name": "amount";
8284
+ "type": "u64";
8285
+ }
8286
+ ];
8287
+ };
8288
+ }
8289
+ ];
8290
+ };
8291
+
8292
+ /**
8293
+ * Program IDL in camelCase format in order to be used in JS/TS.
8294
+ *
8295
+ * Note that this is only a type helper and is not the actual IDL. The original
8296
+ * IDL can be found at `target/idl/validator_leaderboard.json`.
8297
+ */
8298
+ type ValidatorLeaderboard = {
8299
+ "address": "5v7mWL1735qp2Th9B5WNf7spGynR5ZaxwyCYoQw13DP2";
8300
+ "metadata": {
8301
+ "name": "validatorLeaderboard";
8302
+ "version": "0.1.0";
8303
+ "spec": "0.1.0";
8304
+ "description": "Created with Anchor";
8305
+ };
8306
+ "instructions": [
8307
+ {
8308
+ "name": "initializeLeaderboard";
8309
+ "discriminator": [
8310
+ 47,
8311
+ 23,
8312
+ 34,
8313
+ 39,
8314
+ 46,
8315
+ 108,
8316
+ 91,
8317
+ 176
8318
+ ];
8319
+ "accounts": [
8320
+ {
8321
+ "name": "authority";
8322
+ "writable": true;
8323
+ "signer": true;
8324
+ },
8325
+ {
8326
+ "name": "leaderboardState";
8327
+ "writable": true;
8328
+ },
8329
+ {
8330
+ "name": "systemProgram";
8331
+ }
8332
+ ];
8333
+ "args": [];
8334
+ },
8335
+ {
8336
+ "name": "reallocLeaderboard";
8337
+ "discriminator": [
8338
+ 2,
8339
+ 70,
8340
+ 106,
8341
+ 94,
8342
+ 81,
8343
+ 225,
8344
+ 113,
8345
+ 152
8346
+ ];
8347
+ "accounts": [
8348
+ {
8349
+ "name": "leaderboardState";
8350
+ "writable": true;
8351
+ },
8352
+ {
8353
+ "name": "payer";
8354
+ "writable": true;
8355
+ "signer": true;
8356
+ },
8357
+ {
8358
+ "name": "systemProgram";
8359
+ }
8360
+ ];
8361
+ "args": [];
8362
+ },
8363
+ {
8364
+ "name": "testClearLeaderboard";
8365
+ "discriminator": [
8366
+ 118,
8367
+ 207,
8368
+ 26,
8369
+ 205,
8370
+ 180,
8371
+ 7,
8372
+ 75,
8373
+ 244
8374
+ ];
8375
+ "accounts": [
8376
+ {
8377
+ "name": "leaderboardState";
8378
+ "writable": true;
8379
+ },
8380
+ {
8381
+ "name": "authority";
8382
+ "signer": true;
8383
+ }
8384
+ ];
8385
+ "args": [];
8386
+ },
8387
+ {
8388
+ "name": "testForceRegisterValidator";
8389
+ "discriminator": [
8390
+ 136,
8391
+ 156,
8392
+ 132,
8393
+ 32,
8394
+ 96,
8395
+ 240,
8396
+ 7,
8397
+ 115
8398
+ ];
8399
+ "accounts": [
8400
+ {
8401
+ "name": "registrant";
8402
+ "writable": true;
8403
+ "signer": true;
8404
+ },
8405
+ {
8406
+ "name": "voteAccount";
8407
+ },
8408
+ {
8409
+ "name": "validatorRecord";
8410
+ "writable": true;
8411
+ },
8412
+ {
8413
+ "name": "leaderboardState";
8414
+ "writable": true;
8415
+ },
8416
+ {
8417
+ "name": "systemProgram";
8418
+ },
8419
+ {
8420
+ "name": "clock";
8421
+ }
8422
+ ];
8423
+ "args": [
8424
+ {
8425
+ "name": "vpp";
8426
+ "type": "u8";
8427
+ }
8428
+ ];
8429
+ },
8430
+ {
8431
+ "name": "testForceUpdateVpp";
8432
+ "discriminator": [
8433
+ 67,
8434
+ 51,
8435
+ 28,
8436
+ 174,
8437
+ 200,
8438
+ 214,
8439
+ 203,
8440
+ 162
8441
+ ];
8442
+ "accounts": [
8443
+ {
8444
+ "name": "registrant";
8445
+ "writable": true;
8446
+ "signer": true;
8447
+ },
8448
+ {
8449
+ "name": "voteAccount";
8450
+ },
8451
+ {
8452
+ "name": "validatorRecord";
8453
+ "writable": true;
8454
+ },
8455
+ {
8456
+ "name": "leaderboardState";
8457
+ "writable": true;
8458
+ }
8459
+ ];
8460
+ "args": [
8461
+ {
8462
+ "name": "vpp";
8463
+ "type": "u8";
8464
+ }
8465
+ ];
8466
+ },
8467
+ {
8468
+ "name": "testSeedRandomValidators";
8469
+ "discriminator": [
8470
+ 48,
8471
+ 155,
8472
+ 181,
8473
+ 112,
8474
+ 163,
8475
+ 242,
8476
+ 43,
8477
+ 146
8478
+ ];
8479
+ "accounts": [
8480
+ {
8481
+ "name": "registrant";
8482
+ "writable": true;
8483
+ "signer": true;
8484
+ },
8485
+ {
8486
+ "name": "leaderboardState";
8487
+ "writable": true;
8488
+ }
8489
+ ];
8490
+ "args": [
8491
+ {
8492
+ "name": "count";
8493
+ "type": "u16";
8494
+ },
8495
+ {
8496
+ "name": "seed";
8497
+ "type": "u64";
8498
+ },
8499
+ {
8500
+ "name": "minVpp";
8501
+ "type": "u8";
8502
+ },
8503
+ {
8504
+ "name": "maxVpp";
8505
+ "type": "u8";
8506
+ }
8507
+ ];
8508
+ },
8509
+ {
8510
+ "name": "updateCommission";
8511
+ "discriminator": [
8512
+ 2,
8513
+ 202,
8514
+ 72,
8515
+ 156,
8516
+ 19,
8517
+ 253,
8518
+ 91,
8519
+ 174
8520
+ ];
8521
+ "accounts": [
8522
+ {
8523
+ "name": "registrant";
8524
+ "writable": true;
8525
+ "signer": true;
8526
+ },
8527
+ {
8528
+ "name": "voteAccount";
8529
+ },
8530
+ {
8531
+ "name": "validatorRecord";
8532
+ "writable": true;
8533
+ },
8534
+ {
8535
+ "name": "systemProgram";
8536
+ }
8537
+ ];
8538
+ "args": [];
8539
+ },
8540
+ {
8541
+ "name": "updateMevCommission";
8542
+ "discriminator": [
8543
+ 107,
8544
+ 65,
8545
+ 238,
8546
+ 108,
8547
+ 183,
8548
+ 47,
8549
+ 236,
8550
+ 203
8551
+ ];
8552
+ "accounts": [
8553
+ {
8554
+ "name": "signer";
8555
+ "signer": true;
8556
+ },
8557
+ {
8558
+ "name": "validatorRecord";
8559
+ "writable": true;
8560
+ },
8561
+ {
8562
+ "name": "tipDistributionAccount";
8563
+ }
8564
+ ];
8565
+ "args": [];
8566
+ },
8567
+ {
8568
+ "name": "updateValidator";
8569
+ "discriminator": [
8570
+ 105,
8571
+ 192,
8572
+ 4,
8573
+ 98,
8574
+ 236,
8575
+ 115,
8576
+ 108,
8577
+ 192
8578
+ ];
8579
+ "accounts": [
8580
+ {
8581
+ "name": "registrant";
8582
+ "writable": true;
8583
+ "signer": true;
8584
+ },
8585
+ {
8586
+ "name": "voteAccount";
8587
+ },
8588
+ {
8589
+ "name": "validatorRecord";
8590
+ "writable": true;
8591
+ },
8592
+ {
8593
+ "name": "leaderboardState";
8594
+ "writable": true;
8595
+ },
8596
+ {
8597
+ "name": "systemProgram";
8598
+ }
8599
+ ];
8600
+ "args": [
8601
+ {
8602
+ "name": "vpp";
8603
+ "type": "u8";
8604
+ },
8605
+ {
8606
+ "name": "proposedRank";
8607
+ "type": "u16";
8608
+ }
8609
+ ];
8610
+ }
8611
+ ];
8612
+ "accounts": [
8613
+ {
8614
+ "name": "leaderboardState";
8615
+ "discriminator": [
8616
+ 211,
8617
+ 181,
8618
+ 29,
8619
+ 120,
8620
+ 189,
8621
+ 4,
8622
+ 106,
8623
+ 111
8624
+ ];
8625
+ },
8626
+ {
8627
+ "name": "validatorRecord";
8628
+ "discriminator": [
8629
+ 105,
8630
+ 248,
8631
+ 112,
8632
+ 34,
8633
+ 71,
8634
+ 224,
8635
+ 21,
8636
+ 71
8637
+ ];
8638
+ }
8639
+ ];
8640
+ "errors": [
8641
+ {
8642
+ "code": 6000;
8643
+ "name": "missingPreviousValidator";
8644
+ "msg": "Missing previous validator account";
8645
+ },
8646
+ {
8647
+ "code": 6001;
8648
+ "name": "missingNextValidator";
8649
+ "msg": "Missing next validator account";
8650
+ },
8651
+ {
8652
+ "code": 6002;
8653
+ "name": "invalidVppScore";
8654
+ "msg": "Invalid VPP score provided.";
8655
+ },
8656
+ {
8657
+ "code": 6003;
8658
+ "name": "invalidInsertPosition";
8659
+ "msg": "Invalid insertion position.";
8660
+ },
8661
+ {
8662
+ "code": 6004;
8663
+ "name": "invalidCurrentPrev";
8664
+ "msg": "Invalid current previous validator.";
8665
+ },
8666
+ {
8667
+ "code": 6005;
8668
+ "name": "invalidCurrentNext";
8669
+ "msg": "Invalid current next validator.";
8670
+ },
8671
+ {
8672
+ "code": 6006;
8673
+ "name": "invalidHeadValidator";
8674
+ "msg": "Head validator cannot have a previous validator";
8675
+ },
8676
+ {
8677
+ "code": 6007;
8678
+ "name": "invalidTailValidator";
8679
+ "msg": "Tail validator cannot have a next validator";
8680
+ },
8681
+ {
8682
+ "code": 6008;
8683
+ "name": "validatorNotInLeaderboard";
8684
+ "msg": "Cannot remove validator that is not in the leaderboard";
8685
+ },
8686
+ {
8687
+ "code": 6009;
8688
+ "name": "validatorAlreadyExists";
8689
+ "msg": "Validator already exists in the leaderboard";
8690
+ },
8691
+ {
8692
+ "code": 6010;
8693
+ "name": "overflow";
8694
+ "msg": "Arithmetic overflow";
8695
+ },
8696
+ {
8697
+ "code": 6011;
8698
+ "name": "invalidVoteAccount";
8699
+ "msg": "Invalid vote account - must be owned by vote program";
8700
+ },
8701
+ {
8702
+ "code": 6012;
8703
+ "name": "vppVerificationFailed";
8704
+ "msg": "VPP verification failed";
8705
+ },
8706
+ {
8707
+ "code": 6013;
8708
+ "name": "vppUnchanged";
8709
+ "msg": "VPP score unchanged - update not needed";
8710
+ },
8711
+ {
8712
+ "code": 6014;
8713
+ "name": "invalidAccountCount";
8714
+ "msg": "Invalid account count for top 10 verification";
8715
+ },
8716
+ {
8717
+ "code": 6015;
8718
+ "name": "invalidVppOrdering";
8719
+ "msg": "Validators not in correct VPP order";
8720
+ },
8721
+ {
8722
+ "code": 6016;
8723
+ "name": "brokenLinkage";
8724
+ "msg": "Broken linked list continuity";
8725
+ },
8726
+ {
8727
+ "code": 6017;
8728
+ "name": "commissionNotUpdated";
8729
+ "msg": "Commission must be updated for current epoch before updating validator";
8730
+ },
8731
+ {
8732
+ "code": 6018;
8733
+ "name": "mevCommissionNotUpdated";
8734
+ "msg": "MEV commission must be updated for current epoch before updating validator";
8735
+ },
8736
+ {
8737
+ "code": 6019;
8738
+ "name": "invalidCurrentNeighbor";
8739
+ "msg": "Current neighbor account doesn't match validator's stored links";
8740
+ },
8741
+ {
8742
+ "code": 6020;
8743
+ "name": "nonAdjacentInsertionPosition";
8744
+ "msg": "Insertion position accounts are not actually adjacent in leaderboard";
8745
+ },
8746
+ {
8747
+ "code": 6021;
8748
+ "name": "staleAccountReference";
8749
+ "msg": "Account reference is outdated due to concurrent update";
8750
+ },
8751
+ {
8752
+ "code": 6022;
8753
+ "name": "invalidStakeAmount";
8754
+ "msg": "Invalid stake amount - exceeds maximum allowed";
8755
+ },
8756
+ {
8757
+ "code": 6023;
8758
+ "name": "invalidTipDistributionAccount";
8759
+ "msg": "Invalid Tip Distribution Account provided";
8760
+ },
8761
+ {
8762
+ "code": 6024;
8763
+ "name": "invalidRankPosition";
8764
+ "msg": "Proposed rank position violates sorted ordering";
8765
+ },
8766
+ {
8767
+ "code": 6025;
8768
+ "name": "leaderboardFull";
8769
+ "msg": "Leaderboard is full - cannot add more validators";
8770
+ },
8771
+ {
8772
+ "code": 6026;
8773
+ "name": "validatorNotInRankings";
8774
+ "msg": "Validator not found in rankings";
8775
+ },
8776
+ {
8777
+ "code": 6027;
8778
+ "name": "arithmeticOverflow";
8779
+ "msg": "Arithmetic overflow";
8780
+ }
8781
+ ];
8782
+ "types": [
8783
+ {
8784
+ "name": "leaderboardState";
8785
+ "docs": [
8786
+ "Central leaderboard state using parallel arrays for efficient ranking and CPI access",
8787
+ "Stores VPP scores and sorted rankings for up to 1024 validators",
8788
+ "Uses zero-copy for efficient access from other programs via CPI"
8789
+ ];
8790
+ "serialization": "bytemuck";
8791
+ "repr": {
8792
+ "kind": "c";
8793
+ };
8794
+ "type": {
8795
+ "kind": "struct";
8796
+ "fields": [
8797
+ {
8798
+ "name": "scores";
8799
+ "docs": [
8800
+ "VPP scores indexed by registry_index (0-100 range)",
8801
+ "registry_index is assigned on first validator registration and never changes"
8802
+ ];
8803
+ "type": {
8804
+ "array": [
8805
+ "u8",
8806
+ 1024
8807
+ ];
8808
+ };
8809
+ },
8810
+ {
8811
+ "name": "sortedIndices";
8812
+ "docs": [
8813
+ "Validator indices sorted by VPP score descending",
8814
+ "sorted_indices[0] = registry_index of highest VPP validator",
8815
+ "sorted_indices[1] = registry_index of 2nd highest VPP validator, etc."
8816
+ ];
8817
+ "type": {
8818
+ "array": [
8819
+ "u16",
8820
+ 1024
8821
+ ];
8822
+ };
8823
+ },
8824
+ {
8825
+ "name": "voteAccounts";
8826
+ "docs": [
8827
+ "Vote account pubkeys indexed by registry_index",
8828
+ "Allows CPI callers to get vote accounts for top N validators"
8829
+ ];
8830
+ "type": {
8831
+ "array": [
8832
+ {
8833
+ "defined": {
8834
+ "name": "pubkeyBytes";
8835
+ };
8836
+ },
8837
+ 1024
8838
+ ];
8839
+ };
8840
+ },
8841
+ {
8842
+ "name": "numValidators";
8843
+ "docs": [
8844
+ "Number of active validators currently in the leaderboard"
8845
+ ];
8846
+ "type": "u16";
8847
+ },
8848
+ {
8849
+ "name": "bump";
8850
+ "docs": [
8851
+ "PDA bump seed"
8852
+ ];
8853
+ "type": "u8";
8854
+ },
8855
+ {
8856
+ "name": "padding";
8857
+ "docs": [
8858
+ "Reserved space for future upgrades"
8859
+ ];
8860
+ "type": {
8861
+ "array": [
8862
+ "u8",
8863
+ 5
8864
+ ];
8865
+ };
8866
+ }
8867
+ ];
8868
+ };
8869
+ },
8870
+ {
8871
+ "name": "pubkeyBytes";
8872
+ "docs": [
8873
+ "Fixed-size representation of a `Pubkey` that satisfies Anchor's zero-copy rules.",
8874
+ "Stores the raw 32-byte array and offers helpers to convert to/from `Pubkey`."
8875
+ ];
8876
+ "serialization": "bytemuck";
8877
+ "repr": {
8878
+ "kind": "transparent";
8879
+ };
8880
+ "type": {
8881
+ "kind": "struct";
8882
+ "fields": [
8883
+ {
8884
+ "name": "bytes";
8885
+ "type": {
8886
+ "array": [
8887
+ "u8",
8888
+ 32
8889
+ ];
8890
+ };
8891
+ }
8892
+ ];
8893
+ };
8894
+ },
8895
+ {
8896
+ "name": "validatorRecord";
8897
+ "docs": [
8898
+ "Per-validator record account storing commission data and metadata"
8899
+ ];
8900
+ "type": {
8901
+ "kind": "struct";
8902
+ "fields": [
8903
+ {
8904
+ "name": "voteAccount";
8905
+ "docs": [
8906
+ "The validator's vote account pubkey"
8907
+ ];
8908
+ "type": "pubkey";
8909
+ },
8910
+ {
8911
+ "name": "registryIndex";
8912
+ "docs": [
8913
+ "Immutable index into LeaderboardState arrays",
8914
+ "Assigned on first registration, never changes"
8915
+ ];
8916
+ "type": "u16";
8917
+ },
8918
+ {
8919
+ "name": "creditsObserved";
8920
+ "docs": [
8921
+ "Current cumulative credits from vote account"
8922
+ ];
8923
+ "type": "u64";
8924
+ },
8925
+ {
8926
+ "name": "commissionHistory";
8927
+ "docs": [
8928
+ "Circular buffer of past 10 commission values (0-100)",
8929
+ "Used to penalize validators who increase commission"
8930
+ ];
8931
+ "type": {
8932
+ "array": [
8933
+ "u8",
8934
+ 10
8935
+ ];
8936
+ };
8937
+ },
8938
+ {
8939
+ "name": "commissionIndex";
8940
+ "docs": [
8941
+ "Current index in commission_history circular buffer (0-9)"
8942
+ ];
8943
+ "type": "u8";
8944
+ },
8945
+ {
8946
+ "name": "lastCommissionUpdate";
8947
+ "docs": [
8948
+ "Last epoch when commission was updated"
8949
+ ];
8950
+ "type": "u64";
8951
+ },
8952
+ {
8953
+ "name": "epoch";
8954
+ "docs": [
8955
+ "Last epoch this validator was updated"
8956
+ ];
8957
+ "type": "u64";
8958
+ },
8959
+ {
8960
+ "name": "slot";
8961
+ "docs": [
8962
+ "Last slot this validator was updated"
8963
+ ];
8964
+ "type": "u64";
8965
+ },
8966
+ {
8967
+ "name": "wireOperator";
8968
+ "docs": [
8969
+ "Whether this validator is a Wire operator (5% bonus)"
8970
+ ];
8971
+ "type": "bool";
8972
+ },
8973
+ {
8974
+ "name": "mevCommission";
8975
+ "docs": [
8976
+ "Current MEV commission in basis points"
8977
+ ];
8978
+ "type": "u16";
8979
+ },
8980
+ {
8981
+ "name": "mevCommissionHistory";
8982
+ "docs": [
8983
+ "Circular buffer of past 10 MEV commission values"
8984
+ ];
8985
+ "type": {
8986
+ "array": [
8987
+ "u16",
8988
+ 10
8989
+ ];
8990
+ };
8991
+ },
8992
+ {
8993
+ "name": "mevCommissionIndex";
8994
+ "docs": [
8995
+ "Current index in mev_commission_history circular buffer (0-9)"
8996
+ ];
8997
+ "type": "u8";
8998
+ },
8999
+ {
9000
+ "name": "lastMevCommissionUpdate";
9001
+ "docs": [
9002
+ "Last epoch when MEV commission was updated"
9003
+ ];
9004
+ "type": "u64";
9005
+ },
9006
+ {
9007
+ "name": "bump";
9008
+ "docs": [
9009
+ "PDA bump seed"
9010
+ ];
9011
+ "type": "u8";
9012
+ }
9013
+ ];
9014
+ };
9015
+ }
9016
+ ];
9017
+ };
9018
+
9019
+ type Entry<IDL> = {
9020
+ idl: IDL & {
9021
+ address: string;
9022
+ };
9023
+ address: string;
9024
+ };
9025
+ declare const PROGRAMS: {
9026
+ readonly liqsolCore: Entry<LiqsolCore>;
9027
+ readonly liqsolToken: Entry<LiqsolToken>;
9028
+ readonly validatorLeaderboard: Entry<ValidatorLeaderboard>;
9029
+ };
9030
+ type SolanaProgramName = keyof typeof PROGRAMS;
9031
+ declare class SolanaProgramService {
9032
+ private provider;
9033
+ constructor(provider: AnchorProvider);
9034
+ getProgram<K extends SolanaProgramName>(name: K): Program<(typeof PROGRAMS)[K]['idl']>;
9035
+ listProgramNames(): SolanaProgramName[];
9036
+ }
9037
+
9038
+ declare const SCALE: any;
9039
+ /**
9040
+ * Solana implementation of IStakingClient.
9041
+ *
9042
+ * Responsibilities:
9043
+ * - liqSOL deposit (SOL -> liqSOL)
9044
+ * - withdraw requests (liqSOL -> NFT receipt / encumbered SOL)
9045
+ * - Pretoken (WIRE) buys via liqSOL
9046
+ * - Unified portfolio + tranche snapshot + balance correction (later)
9047
+ *
9048
+ * This composes lower-level clients; it does not know about UI.
9049
+ */
9050
+ declare class SolanaStakingClient implements IStakingClient {
8135
9051
  private config;
8136
9052
  pubKey?: PublicKey;
8137
9053
  connection: Connection;
@@ -8141,6 +9057,7 @@ declare class SolanaStakingClient implements IStakingClient {
8141
9057
  leaderboardClient: LeaderboardClient;
8142
9058
  outpostClient: OutpostClient;
8143
9059
  tokenClient: TokenClient;
9060
+ program: SolanaProgramService;
8144
9061
  get solPubKey(): PublicKey$1;
8145
9062
  get network(): ExternalNetwork;
8146
9063
  constructor(config: StakerConfig);
@@ -8190,7 +9107,28 @@ declare class SolanaStakingClient implements IStakingClient {
8190
9107
  * Used by balance-correction flows and debugging.
8191
9108
  */
8192
9109
  getUserRecord(): Promise<DistributionUserRecord | null>;
9110
+ /**
9111
+ * Returns the system APY (percent) for Solana,
9112
+ * using compound interest per epoch and a
9113
+ * cluster-derived epochs-per-year.
9114
+ */
8193
9115
  getSystemAPY(): Promise<number>;
9116
+ /**
9117
+ * Reads the liqsol_core stakeMetrics account and returns the
9118
+ * Solana per-epoch system rate as a **decimal** (not BPS),
9119
+ * de-scaled using PAY_RATE_SCALE_FACTOR (1e12).
9120
+ */
9121
+ private getEpochRateDecimalFromProgram;
9122
+ private epochsPerYearCache?;
9123
+ private static readonly EPOCHS_PER_YEAR_TTL_MS;
9124
+ /**
9125
+ * Derive "epochs per year" from the live Solana cluster.
9126
+ *
9127
+ * Uses:
9128
+ * - getRecentPerformanceSamples() to estimate slots/second
9129
+ * - getEpochInfo() to read slotsInEpoch
9130
+ */
9131
+ private getEpochsPerYearFromCluster;
8194
9132
  /**
8195
9133
  * Estimate the protocol deposit fee in lamports for a given SOL amount,
8196
9134
  * based on recent pay rates and globalConfig.depositFeeMultiplier.
@@ -8217,6 +9155,26 @@ declare class SolanaStakingClient implements IStakingClient {
8217
9155
  windowBefore?: number;
8218
9156
  windowAfter?: number;
8219
9157
  }): Promise<TrancheSnapshot>;
9158
+ /**
9159
+ * Estimate a conservative SOL buffer (lamports) to leave in the wallet
9160
+ * so the user can pay fees for the current deposit and at least one
9161
+ * more transaction, plus a bit extra for future interactions.
9162
+ *
9163
+ * Intended usage in UI:
9164
+ * const bufferLamports = await client.estimateGasBuffer();
9165
+ * const maxSpendable = balanceLamports > bufferLamports
9166
+ * ? balanceLamports - bufferLamports
9167
+ * : 0n;
9168
+ *
9169
+ * @param options.txCount How many transactions to cover (default 2)
9170
+ * @param options.safetyMultiplier Extra safety multiplier (default 3x)
9171
+ * @param options.minBufferLamports Optional override minimum buffer (default ~0.01 SOL)
9172
+ */
9173
+ estimateGasBuffer(options?: {
9174
+ txCount?: number;
9175
+ safetyMultiplier?: number;
9176
+ minBufferLamports?: bigint;
9177
+ }): Promise<bigint>;
8220
9178
  /**
8221
9179
  * Send a signed transaction over HTTP RPC and wait for confirmation.
8222
9180
  * Throws if the transaction fails.
@@ -8245,7 +9203,6 @@ declare class SolanaStakingClient implements IStakingClient {
8245
9203
  * Ensures we have a Wire pubKey and an Anchor wallet pubKey, and that they match.
8246
9204
  */
8247
9205
  ensureUser(): void;
8248
- private ceilDiv;
8249
9206
  }
8250
9207
 
8251
9208
  /**
@@ -8399,5 +9356,5 @@ declare const INDEX_SCALE: bigint;
8399
9356
  declare const lamportsToSol: (lamports: number | bigint) => number;
8400
9357
  declare const solToLamports: (sol: number) => bigint;
8401
9358
 
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 };
9359
+ 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
9360
  export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, YieldView };