@wireio/stake 0.4.3 → 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.
Files changed (129) hide show
  1. package/lib/stake.browser.js +12820 -6787
  2. package/lib/stake.browser.js.map +1 -1
  3. package/lib/stake.d.ts +353 -209
  4. package/lib/stake.js +12940 -6886
  5. package/lib/stake.js.map +1 -1
  6. package/lib/stake.m.js +12820 -6787
  7. package/lib/stake.m.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/assets/ethereum/ABI/common/Base58.sol/Base58.dbg.json +4 -0
  10. package/src/assets/ethereum/ABI/common/Base58.sol/Base58.json +164 -0
  11. package/src/assets/ethereum/ABI/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.dbg.json +4 -0
  12. package/src/assets/ethereum/ABI/common/OpenZepArtifacts.sol/__Dummy_OZ_UUPS__.json +76 -0
  13. package/src/assets/ethereum/ABI/common/RestrictedCallers.sol/RestrictedCallers.dbg.json +4 -0
  14. package/src/assets/ethereum/ABI/common/RestrictedCallers.sol/RestrictedCallers.json +10 -0
  15. package/src/assets/ethereum/ABI/common/iodata.sol/iodata.dbg.json +4 -0
  16. package/src/assets/ethereum/ABI/common/iodata.sol/iodata.json +618 -0
  17. package/src/assets/ethereum/ABI/common/iodata_util.sol/iodata_util.dbg.json +4 -0
  18. package/src/assets/ethereum/ABI/common/iodata_util.sol/iodata_util.json +40 -0
  19. package/src/assets/ethereum/ABI/common/sysio_data.sol/sysio_data.dbg.json +4 -0
  20. package/src/assets/ethereum/ABI/common/sysio_data.sol/sysio_data.json +10 -0
  21. package/src/assets/ethereum/ABI/common/sysio_errors.sol/sysio_errors.dbg.json +4 -0
  22. package/src/assets/ethereum/ABI/common/sysio_errors.sol/sysio_errors.json +10 -0
  23. package/src/assets/ethereum/ABI/common/sysio_merkle.sol/sysio_merkle.dbg.json +4 -0
  24. package/src/assets/ethereum/ABI/common/sysio_merkle.sol/sysio_merkle.json +233 -0
  25. package/src/assets/ethereum/ABI/common/sysio_name.sol/sysio_name.dbg.json +4 -0
  26. package/src/assets/ethereum/ABI/common/sysio_name.sol/sysio_name.json +49 -0
  27. package/src/assets/ethereum/ABI/common/sysio_pubkey.sol/sysio_pubkey.dbg.json +4 -0
  28. package/src/assets/ethereum/ABI/common/sysio_pubkey.sol/sysio_pubkey.json +64 -0
  29. package/src/assets/ethereum/ABI/common/sysio_read.sol/sysio_read.dbg.json +4 -0
  30. package/src/assets/ethereum/ABI/common/sysio_read.sol/sysio_read.json +1458 -0
  31. package/src/assets/ethereum/ABI/common/sysio_tester.sol/SysioTester.dbg.json +4 -0
  32. package/src/assets/ethereum/ABI/common/sysio_tester.sol/SysioTester.json +1532 -0
  33. package/src/assets/ethereum/ABI/common/sysio_verify.sol/sysio_verify.dbg.json +4 -0
  34. package/src/assets/ethereum/ABI/common/sysio_verify.sol/sysio_verify.json +1525 -0
  35. package/src/assets/ethereum/ABI/common/sysio_write.sol/sysio_write.dbg.json +4 -0
  36. package/src/assets/ethereum/ABI/common/sysio_write.sol/sysio_write.json +1076 -0
  37. package/src/assets/ethereum/ABI/liqEth/BeaconState.sol/BeaconState.dbg.json +1 -1
  38. package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.dbg.json +1 -1
  39. package/src/assets/ethereum/ABI/liqEth/DepositManager.sol/DepositManager.json +28 -2
  40. package/src/assets/ethereum/ABI/liqEth/LiqEthAuthority.sol/LiqEthAuthority.dbg.json +1 -1
  41. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IAccounting.dbg.json +1 -1
  42. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositContract.dbg.json +1 -1
  43. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IDepositManager.dbg.json +1 -1
  44. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/ILiqEthUpgradeable.dbg.json +1 -1
  45. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20.dbg.json +1 -1
  46. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IRewardsERC20Pausable.dbg.json +1 -1
  47. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IStakingModule.dbg.json +1 -1
  48. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IValidatorBalanceVerifier.dbg.json +1 -1
  49. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/IWithdrawalRecord.dbg.json +1 -1
  50. package/src/assets/ethereum/ABI/liqEth/LiqEthCommon.sol/LiqEthCommon.dbg.json +1 -1
  51. package/src/assets/ethereum/ABI/liqEth/LiqEthManaged.sol/LiqEthManaged.dbg.json +1 -1
  52. package/src/assets/ethereum/ABI/liqEth/RewardsERC20.sol/RewardsERC20Upgradeable.dbg.json +1 -1
  53. package/src/assets/ethereum/ABI/liqEth/RewardsERC20Pausable.sol/RewardsERC20PausableUpgradeable.dbg.json +1 -1
  54. package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.dbg.json +1 -1
  55. package/src/assets/ethereum/ABI/liqEth/Yield.sol/YieldOracle.json +2 -2
  56. package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.dbg.json +1 -1
  57. package/src/assets/ethereum/ABI/liqEth/accounting.sol/Accounting.json +2 -15
  58. package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +1 -1
  59. package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.dbg.json +1 -1
  60. package/src/assets/ethereum/ABI/liqEth/stakingModule.sol/StakingModule.json +6 -25
  61. package/src/assets/ethereum/ABI/liqEth/withdrawalQueue.sol/WithdrawalQueue.dbg.json +1 -1
  62. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.dbg.json +1 -1
  63. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/Uint64BE.json +2 -2
  64. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.dbg.json +1 -1
  65. package/src/assets/ethereum/ABI/liqEth/withdrawalVault.sol/WithdrawalVault.json +6 -25
  66. package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.dbg.json +1 -1
  67. package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.dbg.json +1 -1
  68. package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json +26 -26
  69. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +1 -1
  70. package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +1 -1
  71. package/src/assets/ethereum/ABI/outpost/OPP.sol/OPP.dbg.json +1 -1
  72. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPP.dbg.json +1 -1
  73. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPEndpoint.dbg.json +1 -1
  74. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPInbound.dbg.json +1 -1
  75. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPReceiver.dbg.json +1 -1
  76. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/IOPPSender.dbg.json +1 -1
  77. package/src/assets/ethereum/ABI/outpost/OPPCommon.sol/OPPCommon.dbg.json +1 -1
  78. package/src/assets/ethereum/ABI/outpost/OPPEndpoint.sol/OPPEndpoint.dbg.json +1 -1
  79. package/src/assets/ethereum/ABI/outpost/OPPEndpointManaged.sol/OPPEndpointManaged.dbg.json +1 -1
  80. package/src/assets/ethereum/ABI/outpost/OPPEndpointOwnable.sol/OPPEndpointOwnable.dbg.json +1 -1
  81. package/src/assets/ethereum/ABI/outpost/OPPErrors.sol/OPPErrors.dbg.json +1 -1
  82. package/src/assets/ethereum/ABI/outpost/OPPInbound.sol/OPPInbound.dbg.json +1 -1
  83. package/src/assets/ethereum/ABI/outpost/OPPReceiver.sol/OPPReceiver.dbg.json +1 -1
  84. package/src/assets/ethereum/ABI/outpost/OPPSender.sol/OPPSender.dbg.json +1 -1
  85. package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +1 -1
  86. package/src/assets/ethereum/ABI/outpost/OutpostManaged.sol/OutpostManaged.dbg.json +1 -1
  87. package/src/assets/ethereum/ABI/outpost/OutpostManager.sol/OutpostManager.dbg.json +1 -1
  88. package/src/assets/ethereum/ABI/outpost/OutpostManagerAuthority.sol/OutpostManagerAuthority.dbg.json +1 -1
  89. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostManager.dbg.json +1 -1
  90. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/IOutpostUpgradeable.dbg.json +1 -1
  91. package/src/assets/ethereum/ABI/outpost/OutpostManagerCommon.sol/OutpostManagerCommon.dbg.json +1 -1
  92. package/src/assets/ethereum/ABI/outpost/OutpostOwnable.sol/OutpostOwnable.dbg.json +1 -1
  93. package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.dbg.json +1 -1
  94. package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.json +2 -2
  95. package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.dbg.json +1 -1
  96. package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.json +9 -9
  97. package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +1 -1
  98. package/src/assets/ethereum/ABI/outpost/interfaces/IPretoken.sol/IPretoken.dbg.json +1 -1
  99. package/src/assets/ethereum/ABI/outpost/interfaces/IWarrant.sol/IWarrant.dbg.json +1 -1
  100. package/src/assets/ethereum/ABI/outpost/token/ERC721EthEquivalentVotesUpgradeable.sol/ERC721EthEquivalentVotesUpgradeable.dbg.json +1 -1
  101. package/src/assets/ethereum/ABI/outpost/token/IERC721EthEquivalent.sol/IERC721EthEquivalent.dbg.json +1 -1
  102. package/src/assets/solana/idl/liqsol_core.json +132 -182
  103. package/src/assets/solana/types/liqsol_core.ts +132 -182
  104. package/src/networks/ethereum/clients/convert.client.ts +2 -2
  105. package/src/networks/ethereum/clients/pretoken.client.ts +8 -9
  106. package/src/networks/ethereum/clients/stake.client.ts +4 -7
  107. package/src/networks/ethereum/contract.ts +112 -59
  108. package/src/networks/ethereum/ethereum.ts +144 -56
  109. package/src/networks/ethereum/types.ts +26 -17
  110. package/src/networks/ethereum/utils.ts +8 -8
  111. package/src/networks/solana/clients/deposit.client.ts +25 -7
  112. package/src/networks/solana/clients/distribution.client.ts +119 -1
  113. package/src/networks/solana/clients/outpost.client.ts +34 -28
  114. package/src/networks/solana/constants.ts +0 -3
  115. package/src/networks/solana/solana.ts +145 -12
  116. package/src/networks/solana/types.ts +132 -9
  117. package/src/networks/solana/utils.ts +14 -7
  118. package/src/types.ts +19 -11
  119. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.dbg.json +0 -4
  120. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/BeaconRoots.json +0 -10
  121. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.dbg.json +0 -4
  122. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZ.json +0 -10
  123. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZExtras.dbg.json +0 -4
  124. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZExtras.json +0 -10
  125. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZVec48.dbg.json +0 -4
  126. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/SSZVec48.json +0 -10
  127. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.dbg.json +0 -4
  128. package/src/assets/ethereum/ABI/liqEth/ValidatorBalanceVerifier.sol/ValidatorBalanceVerifier.json +0 -291
  129. package/src/staker/types.ts +0 -62
package/lib/stake.d.ts CHANGED
@@ -23,8 +23,13 @@ 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
+ /**
29
+ * Protocol fee charged for deposit from Native to LIQ
30
+ * in Solana: amount in lamports
31
+ * in Ethereum: amount in wei
32
+ */
28
33
  getDepositFee(amount: bigint): Promise<bigint>;
29
34
  /**
30
35
  * Program-level prelaunch WIRE/tranche snapshot for this chain.
@@ -38,8 +43,16 @@ interface IStakingClient {
38
43
  windowBefore?: number;
39
44
  windowAfter?: number;
40
45
  }): Promise<TrancheSnapshot | null>;
41
- getSystemAPY(): Promise<number>;
42
- 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>;
43
56
  }
44
57
  /**
45
58
  * Cross-chain portfolio view for a single account/wallet.
@@ -179,9 +192,8 @@ interface TrancheSnapshot {
179
192
  currentTranche: number;
180
193
  /** Current tranche price in USD (1e8 scale) */
181
194
  currentPriceUsd: bigint;
182
- /** Tranche curve config (per-chain) */
183
195
  supplyGrowthBps: number;
184
- priceGrowthBps: number;
196
+ priceGrowthCents: number;
185
197
  totalPretokensSold: bigint;
186
198
  /** Current tranche supply state (1e8 scale) */
187
199
  currentTrancheSupply: bigint;
@@ -248,7 +260,7 @@ declare class Staker {
248
260
  setChain(chainID: ChainID): boolean;
249
261
  }
250
262
 
251
- declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "StakingModule", "WithdrawalQueue", "WithdrawalVault", "Depositor", "ReceiptNFT", "OutpostManager", "BAR", "OPP", "OPPCommon", "OPPInbound", "Pretoken", "Aggregator", "EthUsdPriceConsumer", "Pool"];
263
+ declare const CONTRACT_NAMES: readonly ["LiqEthAuthority", "BeaconState", "WithdrawalQueue", "LiqEthToken", "Accounting", "DepositManager", "WithdrawalVault", "StakingModule", "YieldOracle", "OutpostManagerAuthority", "iodata", "Base58", "sysio_merkle", "ReceiptNFT", "MockAggregator", "Pool", "OutpostManager", "sysio_write", "EthUsdPriceConsumer", "BAR", "OPPCommon", "OPP", "Pretoken", "OPPInbound", "Depositor"];
252
264
  type ContractName = typeof CONTRACT_NAMES[number];
253
265
  type AddressBook = Record<ContractName, string>;
254
266
  interface Result {
@@ -332,6 +344,7 @@ declare namespace types$1 {
332
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 };
333
345
  }
334
346
 
347
+ declare const INITIAL_TRANCHE_SUPPLY = 35000;
335
348
  declare class EthereumStakingClient implements IStakingClient {
336
349
  private config;
337
350
  private readonly provider;
@@ -344,23 +357,31 @@ declare class EthereumStakingClient implements IStakingClient {
344
357
  private oppClient;
345
358
  private receiptClient;
346
359
  get contract(): {
360
+ LiqEthAuthority: ethers.Contract;
361
+ BeaconState: ethers.Contract;
362
+ WithdrawalQueue: ethers.Contract;
363
+ LiqEthToken: ethers.Contract;
347
364
  Accounting: ethers.Contract;
348
365
  DepositManager: ethers.Contract;
349
- LiqEth: ethers.Contract;
350
- StakingModule: ethers.Contract;
351
- WithdrawalQueue: ethers.Contract;
352
366
  WithdrawalVault: ethers.Contract;
353
- Depositor: ethers.Contract;
367
+ StakingModule: ethers.Contract;
368
+ YieldOracle: ethers.Contract;
369
+ OutpostManagerAuthority: ethers.Contract;
370
+ iodata: ethers.Contract;
371
+ Base58: ethers.Contract;
372
+ sysio_merkle: ethers.Contract;
354
373
  ReceiptNFT: ethers.Contract;
374
+ MockAggregator: ethers.Contract;
375
+ Pool: ethers.Contract;
355
376
  OutpostManager: ethers.Contract;
377
+ sysio_write: ethers.Contract;
378
+ EthUsdPriceConsumer: ethers.Contract;
356
379
  BAR: ethers.Contract;
357
- OPP: ethers.Contract;
358
380
  OPPCommon: ethers.Contract;
359
- OPPInbound: ethers.Contract;
381
+ OPP: ethers.Contract;
360
382
  Pretoken: ethers.Contract;
361
- Aggregator: ethers.Contract;
362
- EthUsdPriceConsumer: ethers.Contract;
363
- Pool: ethers.Contract;
383
+ OPPInbound: ethers.Contract;
384
+ Depositor: ethers.Contract;
364
385
  };
365
386
  get network(): _wireio_core.ExternalNetwork;
366
387
  constructor(config: StakerConfig);
@@ -399,7 +420,7 @@ declare class EthereumStakingClient implements IStakingClient {
399
420
  * actual = liqETH token balance (ERC-20)
400
421
  * tracked = liqETH tracked balance (protocol/accounting view)
401
422
  */
402
- getPortfolio(): Promise<Portfolio>;
423
+ getPortfolio(): Promise<Portfolio | null>;
403
424
  /**
404
425
  * ETH Prelaunch function to list the Stake ReceiptNFTs owned by a specific user
405
426
  * @param address address to query the receipts for
@@ -422,9 +443,32 @@ declare class EthereumStakingClient implements IStakingClient {
422
443
  windowBefore?: number;
423
444
  windowAfter?: number;
424
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>;
425
463
  private updateMockAggregatorPrice;
426
464
  }
427
465
 
466
+ /**
467
+ * @module EthereumContractService
468
+ *
469
+ * Provides a unified service for interacting with Ethereum smart contracts using ethers.js.
470
+ */
471
+
428
472
  declare const ERC20Abi: ({
429
473
  inputs: {
430
474
  internalType: string;
@@ -752,7 +796,7 @@ interface SharesPreview {
752
796
  * - NFT withdrawal receipts
753
797
  * - Encumbered funds for pending withdrawals
754
798
  */
755
- type Global = {
799
+ type GlobalAccount = {
756
800
  /** PDA bump */
757
801
  bump: number;
758
802
  /** Authority that can update serviceable epochs / receipts */
@@ -779,8 +823,6 @@ type Global = {
779
823
  * - `wireState` lifecycle (preLaunch/postLaunch/refund)
780
824
  */
781
825
  type GlobalState = {
782
- /** Admin authority for pretokens/outpost config */
783
- admin: PublicKey$1;
784
826
  /** Deployment timestamp (Unix, seconds) */
785
827
  deployedAt: BN;
786
828
  /** Delay before refunds are permitted (seconds) */
@@ -825,6 +867,108 @@ type GlobalState = {
825
867
  /** PDA bump */
826
868
  bump: number;
827
869
  };
870
+ /**
871
+ * IDL: `globalConfig`
872
+ *
873
+ * Zero-copy global config PDA.
874
+ * Authority is taken from StakeControllerState, not stored here.
875
+ */
876
+ type GlobalConfig = {
877
+ /** PDA bump */
878
+ bump: number;
879
+ /** 7-byte padding (unused) */
880
+ padding: number[];
881
+ /** Minimum SOL amount a user can deposit (lamports, u64) */
882
+ minUserDeposit: BN;
883
+ /** Minimum SOL amount for an unstake/withdrawal request (lamports, u64) */
884
+ minUnstakeRequest: BN;
885
+ /** Minimum stake delta to trigger a stake rebalance order (lamports, u64) */
886
+ minRebalanceStakeDelta: BN;
887
+ /** Minimum unstake delta to trigger an unstake rebalance order (lamports, u64) */
888
+ minRebalanceUnstakeDelta: BN;
889
+ /** Minimum transient stake to include in effective stake calculations (lamports, u64) */
890
+ transientThreshold: BN;
891
+ /**
892
+ * Minimum slots that must have elapsed in the epoch before late epoch operations can execute (u64)
893
+ */
894
+ minLateEpochSlotGate: BN;
895
+ /** Reserved u64[2] */
896
+ reservedU64: BN[];
897
+ /**
898
+ * Epochs a validator must wait in the graveyard before it is booted.
899
+ * This begins after the last recorded state change (u16)
900
+ */
901
+ cooldownEpochs: number;
902
+ /**
903
+ * Multiplier for deposit fee calculation (u16).
904
+ * Typically: avg_pay_rate * expected_warmup_epochs
905
+ */
906
+ depositFeeMultiplier: number;
907
+ /**
908
+ * Minimum VPP score required to enter the active validator set,
909
+ * fallback when the validator set is very small (u16)
910
+ */
911
+ minVppEntry: number;
912
+ /**
913
+ * VPP score threshold below which a validator is removed from active set,
914
+ * fallback threshold (u16)
915
+ */
916
+ minVppExit: number;
917
+ /**
918
+ * Max validators for "tiny" network band (uses fixed VPP thresholds) (u16)
919
+ */
920
+ tinyNetworkThreshold: number;
921
+ /**
922
+ * Max validators for "small" network band (uses percentile-based selection) (u16)
923
+ */
924
+ smallNetworkThreshold: number;
925
+ /**
926
+ * Max validators for "medium" network band (uses percentile-based selection) (u16)
927
+ */
928
+ mediumNetworkThreshold: number;
929
+ /**
930
+ * Fixed rank threshold to enter active set in large networks (0-indexed, u16)
931
+ */
932
+ largeNetworkEntryRank: number;
933
+ /**
934
+ * Fixed rank threshold to exit active set in large networks (0-indexed, u16)
935
+ */
936
+ largeNetworkExitRank: number;
937
+ /** Reserved u16[3] */
938
+ reservedU16: number[];
939
+ /**
940
+ * Percentile rank required to enter active set in small networks (u8)
941
+ */
942
+ smallNetworkEntryPercent: number;
943
+ /**
944
+ * Percentile rank below which validators exit in small networks (u8)
945
+ */
946
+ smallNetworkExitPercent: number;
947
+ /**
948
+ * Percentile rank required to enter active set in medium networks (u8)
949
+ */
950
+ mediumNetworkEntryPercent: number;
951
+ /**
952
+ * Percentile rank below which validators exit in medium networks (u8)
953
+ */
954
+ mediumNetworkExitPercent: number;
955
+ /** Reserved u8[2] */
956
+ reservedU8: number[];
957
+ /**
958
+ * Feature flags (u16 bitfield):
959
+ * Bit 0: DepositsEnabled
960
+ * Bit 1: WithdrawalsEnabled
961
+ * Bit 2: ClaimWithdrawalsEnabled
962
+ * Bit 3: ProcessStakeOrdersEnabled
963
+ * Bit 4: ProcessUnstakeOrdersEnabled
964
+ * Bit 5: ProcessPayCycleEnabled
965
+ * Bit 6: RebalancingEnabled
966
+ * Bits 7–15: Reserved
967
+ */
968
+ featureFlags: number;
969
+ /** Reserved flags (u16[1]) */
970
+ reservedFlags: number[];
971
+ };
828
972
  /**
829
973
  * ============================================================
830
974
  * Outpost / Pretoken Accounts
@@ -902,8 +1046,6 @@ type UserPretokenRecord = {
902
1046
  * All price/supply fields use 8-decimal precision (SCALE = 1e8).
903
1047
  */
904
1048
  type TrancheState = {
905
- /** Admin authority for tranche parameters */
906
- admin: PublicKey$1;
907
1049
  /** Current tranche number */
908
1050
  currentTrancheNumber: BN;
909
1051
  /** Remaining supply in the current tranche (8-decimal i128) */
@@ -916,8 +1058,8 @@ type TrancheState = {
916
1058
  initialTrancheSupply: BN;
917
1059
  /** Supply growth in basis points per tranche */
918
1060
  supplyGrowthBps: number;
919
- /** Price growth in basis points per tranche */
920
- priceGrowthBps: number;
1061
+ /** Price growth in cents per tranche (0.01 USD units) */
1062
+ priceGrowthCents: number;
921
1063
  /** Minimum valid SOL/USD price for Chainlink validation (8-decimal i128) */
922
1064
  minPriceUsd: BN;
923
1065
  /** Maximum valid SOL/USD price for Chainlink validation (8-decimal i128) */
@@ -1098,7 +1240,8 @@ type ValidatorRecord = {
1098
1240
 
1099
1241
  type types_DistributionState = DistributionState;
1100
1242
  type types_DistributionUserRecord = DistributionUserRecord;
1101
- type types_Global = Global;
1243
+ type types_GlobalAccount = GlobalAccount;
1244
+ type types_GlobalConfig = GlobalConfig;
1102
1245
  type types_GlobalState = GlobalState;
1103
1246
  type types_LeaderboardState = LeaderboardState;
1104
1247
  type types_OutpostAccount = OutpostAccount;
@@ -1119,7 +1262,7 @@ type types_WalletLike = WalletLike;
1119
1262
  type types_WireReceipt = WireReceipt;
1120
1263
  type types_WireState = WireState;
1121
1264
  declare namespace types {
1122
- export type { types_DistributionState as DistributionState, types_DistributionUserRecord as DistributionUserRecord, types_Global as Global, 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 };
1123
1266
  }
1124
1267
 
1125
1268
  declare class DepositClient {
@@ -1173,6 +1316,18 @@ declare class DistributionClient {
1173
1316
  * IDL account name: "distributionState"
1174
1317
  */
1175
1318
  getDistributionState(): Promise<DistributionState | null>;
1319
+ /**
1320
+ * Fetch the global payRateHistory account (circular buffer of scaled pay rates).
1321
+ *
1322
+ * IDL account name: "payRateHistory"
1323
+ */
1324
+ getPayRateHistory(): Promise<PayRateHistory | null>;
1325
+ /**
1326
+ * Fetch the globalConfig account (contains depositFeeMultiplier, etc).
1327
+ *
1328
+ * IDL account name: "globalConfig"
1329
+ */
1330
+ getGlobalConfig(): Promise<GlobalConfig | null>;
1176
1331
  /**
1177
1332
  * Fetch a user's distribution userRecord (or null if missing).
1178
1333
  *
@@ -1197,6 +1352,13 @@ declare class DistributionClient {
1197
1352
  totalShares: BN;
1198
1353
  ratio: number;
1199
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>;
1200
1362
  }
1201
1363
 
1202
1364
  /**
@@ -1830,26 +1992,14 @@ type LiqsolCore = {
1830
1992
  "name": "processingState";
1831
1993
  "writable": true;
1832
1994
  },
1833
- {
1834
- "name": "controllerState";
1835
- "docs": [
1836
- "Stake controller state - used to verify authority"
1837
- ];
1838
- },
1839
1995
  {
1840
1996
  "name": "globalConfig";
1841
- "docs": [
1842
- "Global config for cooldown_epochs"
1843
- ];
1844
1997
  },
1845
1998
  {
1846
1999
  "name": "clock";
1847
2000
  },
1848
2001
  {
1849
- "name": "authority";
1850
- "docs": [
1851
- "Authority must match the stored authority in controller_state"
1852
- ];
2002
+ "name": "cranky";
1853
2003
  "writable": true;
1854
2004
  "signer": true;
1855
2005
  }
@@ -1873,6 +2023,9 @@ type LiqsolCore = {
1873
2023
  "name": "admin";
1874
2024
  "signer": true;
1875
2025
  },
2026
+ {
2027
+ "name": "globalConfig";
2028
+ },
1876
2029
  {
1877
2030
  "name": "globalState";
1878
2031
  },
@@ -1915,6 +2068,9 @@ type LiqsolCore = {
1915
2068
  "name": "admin";
1916
2069
  "signer": true;
1917
2070
  },
2071
+ {
2072
+ "name": "globalConfig";
2073
+ },
1918
2074
  {
1919
2075
  "name": "globalState";
1920
2076
  "writable": true;
@@ -2574,14 +2730,17 @@ type LiqsolCore = {
2574
2730
  "name": "globalConfig";
2575
2731
  "writable": true;
2576
2732
  },
2577
- {
2578
- "name": "controllerState";
2579
- },
2580
2733
  {
2581
2734
  "name": "payer";
2582
2735
  "writable": true;
2583
2736
  "signer": true;
2584
2737
  },
2738
+ {
2739
+ "name": "program";
2740
+ },
2741
+ {
2742
+ "name": "programData";
2743
+ },
2585
2744
  {
2586
2745
  "name": "systemProgram";
2587
2746
  }
@@ -3065,17 +3224,10 @@ type LiqsolCore = {
3065
3224
  ];
3066
3225
  "accounts": [
3067
3226
  {
3068
- "name": "controllerState";
3069
- "docs": [
3070
- "Stake controller state - used to verify admin authority"
3071
- ];
3227
+ "name": "globalConfig";
3072
3228
  },
3073
3229
  {
3074
- "name": "admin";
3075
- "docs": [
3076
- "Admin must match the stored authority in controller_state"
3077
- ];
3078
- "writable": true;
3230
+ "name": "cranky";
3079
3231
  "signer": true;
3080
3232
  },
3081
3233
  {
@@ -4101,6 +4253,9 @@ type LiqsolCore = {
4101
4253
  "name": "admin";
4102
4254
  "signer": true;
4103
4255
  },
4256
+ {
4257
+ "name": "globalConfig";
4258
+ },
4104
4259
  {
4105
4260
  "name": "globalState";
4106
4261
  "writable": true;
@@ -4142,6 +4297,9 @@ type LiqsolCore = {
4142
4297
  "writable": true;
4143
4298
  "signer": true;
4144
4299
  },
4300
+ {
4301
+ "name": "globalConfig";
4302
+ },
4145
4303
  {
4146
4304
  "name": "trancheState";
4147
4305
  "writable": true;
@@ -4174,6 +4332,9 @@ type LiqsolCore = {
4174
4332
  "writable": true;
4175
4333
  "signer": true;
4176
4334
  },
4335
+ {
4336
+ "name": "globalConfig";
4337
+ },
4177
4338
  {
4178
4339
  "name": "trancheState";
4179
4340
  "writable": true;
@@ -4188,6 +4349,62 @@ type LiqsolCore = {
4188
4349
  ];
4189
4350
  "args": [];
4190
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
+ },
4191
4408
  {
4192
4409
  "name": "setLastStateChangeEpoch";
4193
4410
  "docs": [
@@ -4244,6 +4461,9 @@ type LiqsolCore = {
4244
4461
  "name": "admin";
4245
4462
  "signer": true;
4246
4463
  },
4464
+ {
4465
+ "name": "globalConfig";
4466
+ },
4247
4467
  {
4248
4468
  "name": "globalState";
4249
4469
  "writable": true;
@@ -4273,6 +4493,9 @@ type LiqsolCore = {
4273
4493
  "name": "admin";
4274
4494
  "signer": true;
4275
4495
  },
4496
+ {
4497
+ "name": "globalConfig";
4498
+ },
4276
4499
  {
4277
4500
  "name": "globalState";
4278
4501
  "writable": true;
@@ -4310,6 +4533,9 @@ type LiqsolCore = {
4310
4533
  "name": "admin";
4311
4534
  "signer": true;
4312
4535
  },
4536
+ {
4537
+ "name": "globalConfig";
4538
+ },
4313
4539
  {
4314
4540
  "name": "globalState";
4315
4541
  "writable": true;
@@ -4339,6 +4565,9 @@ type LiqsolCore = {
4339
4565
  "name": "admin";
4340
4566
  "signer": true;
4341
4567
  },
4568
+ {
4569
+ "name": "globalConfig";
4570
+ },
4342
4571
  {
4343
4572
  "name": "globalState";
4344
4573
  "writable": true;
@@ -4421,6 +4650,9 @@ type LiqsolCore = {
4421
4650
  "name": "admin";
4422
4651
  "signer": true;
4423
4652
  },
4653
+ {
4654
+ "name": "globalConfig";
4655
+ },
4424
4656
  {
4425
4657
  "name": "globalState";
4426
4658
  },
@@ -4476,6 +4708,9 @@ type LiqsolCore = {
4476
4708
  },
4477
4709
  {
4478
4710
  "name": "syncLeaderboardScoresBatch";
4711
+ "docs": [
4712
+ "region: Validator Leaderboard Syncing"
4713
+ ];
4479
4714
  "discriminator": [
4480
4715
  52,
4481
4716
  11,
@@ -4738,13 +4973,7 @@ type LiqsolCore = {
4738
4973
  "writable": true;
4739
4974
  },
4740
4975
  {
4741
- "name": "controllerState";
4742
- },
4743
- {
4744
- "name": "authority";
4745
- "docs": [
4746
- "Authority must match StakeControllerState.authority"
4747
- ];
4976
+ "name": "admin";
4748
4977
  "signer": true;
4749
4978
  }
4750
4979
  ];
@@ -4781,13 +5010,7 @@ type LiqsolCore = {
4781
5010
  "writable": true;
4782
5011
  },
4783
5012
  {
4784
- "name": "controllerState";
4785
- },
4786
- {
4787
- "name": "authority";
4788
- "docs": [
4789
- "Authority must match StakeControllerState.authority"
4790
- ];
5013
+ "name": "admin";
4791
5014
  "signer": true;
4792
5015
  }
4793
5016
  ];
@@ -4824,13 +5047,7 @@ type LiqsolCore = {
4824
5047
  "writable": true;
4825
5048
  },
4826
5049
  {
4827
- "name": "controllerState";
4828
- },
4829
- {
4830
- "name": "authority";
4831
- "docs": [
4832
- "Authority must match StakeControllerState.authority"
4833
- ];
5050
+ "name": "admin";
4834
5051
  "signer": true;
4835
5052
  }
4836
5053
  ];
@@ -4867,13 +5084,7 @@ type LiqsolCore = {
4867
5084
  "writable": true;
4868
5085
  },
4869
5086
  {
4870
- "name": "controllerState";
4871
- },
4872
- {
4873
- "name": "authority";
4874
- "docs": [
4875
- "Authority must match StakeControllerState.authority"
4876
- ];
5087
+ "name": "admin";
4877
5088
  "signer": true;
4878
5089
  }
4879
5090
  ];
@@ -4910,6 +5121,9 @@ type LiqsolCore = {
4910
5121
  "writable": true;
4911
5122
  "signer": true;
4912
5123
  },
5124
+ {
5125
+ "name": "globalConfig";
5126
+ },
4913
5127
  {
4914
5128
  "name": "trancheState";
4915
5129
  "writable": true;
@@ -4928,7 +5142,7 @@ type LiqsolCore = {
4928
5142
  "type": "u16";
4929
5143
  },
4930
5144
  {
4931
- "name": "priceGrowthBps";
5145
+ "name": "priceGrowthCents";
4932
5146
  "type": "u16";
4933
5147
  }
4934
5148
  ];
@@ -4951,6 +5165,9 @@ type LiqsolCore = {
4951
5165
  "writable": true;
4952
5166
  "signer": true;
4953
5167
  },
5168
+ {
5169
+ "name": "globalConfig";
5170
+ },
4954
5171
  {
4955
5172
  "name": "trancheState";
4956
5173
  "writable": true;
@@ -5415,118 +5632,8 @@ type LiqsolCore = {
5415
5632
  "errors": [
5416
5633
  {
5417
5634
  "code": 6000;
5418
- "name": "destinationAccountDoesNotExist";
5419
- "msg": "Destination stake account does not exist";
5420
- },
5421
- {
5422
- "code": 6001;
5423
- "name": "sourceAccountDoesNotExist";
5424
- "msg": "Source stake account does not exist";
5425
- },
5426
- {
5427
- "code": 6002;
5428
- "name": "invalidDestinationOwner";
5429
- "msg": "Destination account not owned by stake program";
5430
- },
5431
- {
5432
- "code": 6003;
5433
- "name": "invalidSourceOwner";
5434
- "msg": "Source account not owned by stake program";
5435
- },
5436
- {
5437
- "code": 6004;
5438
- "name": "clockBorrowFailed";
5439
- "msg": "Failed to borrow clock data";
5440
- },
5441
- {
5442
- "code": 6005;
5443
- "name": "clockDeserializeFailed";
5444
- "msg": "Failed to deserialize clock";
5445
- },
5446
- {
5447
- "code": 6006;
5448
- "name": "destinationAnalysisFailed";
5449
- "msg": "Failed to analyze destination stake account";
5450
- },
5451
- {
5452
- "code": 6007;
5453
- "name": "sourceAnalysisFailed";
5454
- "msg": "Failed to analyze source stake account";
5455
- },
5456
- {
5457
- "code": 6008;
5458
- "name": "destinationStillActivating";
5459
- "msg": "Destination stake is still activating";
5460
- },
5461
- {
5462
- "code": 6009;
5463
- "name": "destinationDeactivating";
5464
- "msg": "Destination stake is deactivating";
5465
- },
5466
- {
5467
- "code": 6010;
5468
- "name": "sourceStillActivating";
5469
- "msg": "Source stake is still activating";
5470
- },
5471
- {
5472
- "code": 6011;
5473
- "name": "sourceDeactivating";
5474
- "msg": "Source stake is deactivating";
5475
- },
5476
- {
5477
- "code": 6012;
5478
- "name": "destinationBorrowFailed";
5479
- "msg": "Failed to borrow destination account data";
5480
- },
5481
- {
5482
- "code": 6013;
5483
- "name": "destinationParseFailed";
5484
- "msg": "Failed to parse destination stake state";
5485
- },
5486
- {
5487
- "code": 6014;
5488
- "name": "sourceBorrowFailed";
5489
- "msg": "Failed to borrow source account data";
5490
- },
5491
- {
5492
- "code": 6015;
5493
- "name": "sourceParseFailed";
5494
- "msg": "Failed to parse source stake state";
5495
- },
5496
- {
5497
- "code": 6016;
5498
- "name": "differentValidators";
5499
- "msg": "Stakes are delegated to different validators";
5500
- },
5501
- {
5502
- "code": 6017;
5503
- "name": "differentStakers";
5504
- "msg": "Stakes have different staker authorities";
5505
- },
5506
- {
5507
- "code": 6018;
5508
- "name": "differentWithdrawers";
5509
- "msg": "Stakes have different withdrawer authorities";
5510
- },
5511
- {
5512
- "code": 6019;
5513
- "name": "authoritiesNotFound";
5514
- "msg": "Could not extract authorities from accounts";
5515
- },
5516
- {
5517
- "code": 6020;
5518
- "name": "mergeInstructionFailed";
5519
- "msg": "Merge instruction failed";
5520
- },
5521
- {
5522
- "code": 6021;
5523
- "name": "epochRewardsActive";
5524
- "msg": "Epoch rewards distribution is active - stake operations blocked";
5525
- },
5526
- {
5527
- "code": 6022;
5528
- "name": "differentCreditsObserved";
5529
- "msg": "Stakes have different credits_observed - cannot merge until both earn same rewards";
5635
+ "name": "accountBorrowFailed";
5636
+ "msg": "Util Acc borrow Failed";
5530
5637
  }
5531
5638
  ];
5532
5639
  "types": [
@@ -5912,8 +6019,7 @@ type LiqsolCore = {
5912
6019
  {
5913
6020
  "name": "globalConfig";
5914
6021
  "docs": [
5915
- "Zero-copy global config PDA",
5916
- "Authority is taken from StakeControllerState, not stored here"
6022
+ "Zero-copy global config PDA"
5917
6023
  ];
5918
6024
  "serialization": "bytemuckunsafe";
5919
6025
  "repr": {
@@ -5935,6 +6041,23 @@ type LiqsolCore = {
5935
6041
  ];
5936
6042
  };
5937
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
+ },
5938
6061
  {
5939
6062
  "name": "minUserDeposit";
5940
6063
  "docs": [
@@ -6121,10 +6244,6 @@ type LiqsolCore = {
6121
6244
  "type": {
6122
6245
  "kind": "struct";
6123
6246
  "fields": [
6124
- {
6125
- "name": "admin";
6126
- "type": "pubkey";
6127
- },
6128
6247
  {
6129
6248
  "name": "deployedAt";
6130
6249
  "type": "i64";
@@ -7085,13 +7204,6 @@ type LiqsolCore = {
7085
7204
  "type": {
7086
7205
  "kind": "struct";
7087
7206
  "fields": [
7088
- {
7089
- "name": "admin";
7090
- "docs": [
7091
- "Admin authority (can update growth parameters and price bounds)"
7092
- ];
7093
- "type": "pubkey";
7094
- },
7095
7207
  {
7096
7208
  "name": "currentTrancheNumber";
7097
7209
  "type": "u64";
@@ -7120,9 +7232,9 @@ type LiqsolCore = {
7120
7232
  "type": "u16";
7121
7233
  },
7122
7234
  {
7123
- "name": "priceGrowthBps";
7235
+ "name": "priceGrowthCents";
7124
7236
  "docs": [
7125
- "Price growth in basis points (e.g., 200 = 2%, max 10000)"
7237
+ "Price growth in cents per tranche (0.01 USD units)"
7126
7238
  ];
7127
7239
  "type": "u16";
7128
7240
  },
@@ -7734,7 +7846,7 @@ declare function buildSolanaTrancheLadder(options: {
7734
7846
  currentTrancheSupply: bigint;
7735
7847
  currentPriceUsd: bigint;
7736
7848
  supplyGrowthBps: number;
7737
- priceGrowthBps: number;
7849
+ priceGrowthCents: number;
7738
7850
  windowBefore?: number;
7739
7851
  windowAfter?: number;
7740
7852
  }): TrancheLadderItem[];
@@ -7858,6 +7970,7 @@ interface ScheduleConfig {
7858
7970
  early?: number;
7859
7971
  late?: number;
7860
7972
  }
7973
+ declare function ceilDiv(n: BN, d: BN): BN;
7861
7974
 
7862
7975
  /**
7863
7976
  * OutpostClient
@@ -7986,6 +8099,7 @@ declare class TokenClient {
7986
8099
  getSolPriceUsd(): Promise<bigint>;
7987
8100
  }
7988
8101
 
8102
+ declare const SCALE: any;
7989
8103
  /**
7990
8104
  * Solana implementation of IStakingClient.
7991
8105
  *
@@ -8057,7 +8171,17 @@ declare class SolanaStakingClient implements IStakingClient {
8057
8171
  */
8058
8172
  getUserRecord(): Promise<DistributionUserRecord | null>;
8059
8173
  getSystemAPY(): Promise<number>;
8060
- getDepositFee(amount: bigint): Promise<bigint>;
8174
+ /**
8175
+ * Estimate the protocol deposit fee in lamports for a given SOL amount,
8176
+ * based on recent pay rates and globalConfig.depositFeeMultiplier.
8177
+ *
8178
+ * - amountLamports: deposit notional in lamports
8179
+ * - windowSize: how many recent payRate entries to average (default 5)
8180
+ *
8181
+ * Returns 0n if payRateHistory or globalConfig is missing, or if
8182
+ * there are no valid pay-rate entries yet.
8183
+ */
8184
+ getDepositFee(amountLamports: bigint, windowSize?: number): Promise<bigint>;
8061
8185
  /**
8062
8186
  * Unified, chain-agnostic tranche snapshot for Solana.
8063
8187
  *
@@ -8073,6 +8197,26 @@ declare class SolanaStakingClient implements IStakingClient {
8073
8197
  windowBefore?: number;
8074
8198
  windowAfter?: number;
8075
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>;
8076
8220
  /**
8077
8221
  * Send a signed transaction over HTTP RPC and wait for confirmation.
8078
8222
  * Throws if the transaction fails.
@@ -8254,5 +8398,5 @@ declare const INDEX_SCALE: bigint;
8254
8398
  declare const lamportsToSol: (lamports: number | bigint) => number;
8255
8399
  declare const solToLamports: (sol: number) => bigint;
8256
8400
 
8257
- 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 };
8258
8402
  export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, YieldView };