@wireio/stake 0.2.2 → 0.2.4

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
@@ -1,5 +1,5 @@
1
1
  import * as _wireio_core from '@wireio/core';
2
- import { PublicKey, ExternalNetwork, ChainID } from '@wireio/core';
2
+ import { ExternalNetwork, PublicKey, ChainID } from '@wireio/core';
3
3
  import { BaseSignerWalletAdapter } from '@solana/wallet-adapter-base';
4
4
  import * as _solana_web3_js from '@solana/web3.js';
5
5
  import { PublicKey as PublicKey$1, Transaction, VersionedTransaction, TokenAmount, Connection, TransactionSignature, Keypair, TransactionInstruction } from '@solana/web3.js';
@@ -8,6 +8,11 @@ import { JsonFragment } from '@ethersproject/abi';
8
8
  import { ErrorDescription } from '@ethersproject/abi/lib/interface';
9
9
  import { BN, AnchorProvider, Program } from '@coral-xyz/anchor';
10
10
 
11
+ type StakerConfig = {
12
+ network: ExternalNetwork;
13
+ provider: BaseSignerWalletAdapter | ethers.providers.Web3Provider;
14
+ pubKey: PublicKey;
15
+ };
11
16
  interface IStakingClient {
12
17
  pubKey: PublicKey;
13
18
  network: ExternalNetwork;
@@ -16,15 +21,24 @@ interface IStakingClient {
16
21
  withdraw(amount: bigint): Promise<string>;
17
22
  stake(amount: bigint): Promise<string>;
18
23
  unstake(amount: bigint): Promise<string>;
19
- /** Register any untracked LIQ staked tokens */
20
- /** Fetch the portfolio for the LIQ stake user */
24
+ buy(amount: bigint, asset: PurchaseAsset): Promise<string>;
25
+ /** Fetch the complete user portfolio */
21
26
  getPortfolio(): Promise<Portfolio>;
27
+ /**
28
+ * Program-level prelaunch WIRE/tranche snapshot for this chain.
29
+ *
30
+ * Returns:
31
+ * - `TrancheSnapshot` when the chain supports pretoken/tranches
32
+ * - `null` if this chain has no WIRE/pretoken integration
33
+ */
34
+ getTrancheSnapshot(options?: {
35
+ chainID?: ChainID;
36
+ windowBefore?: number;
37
+ windowAfter?: number;
38
+ }): Promise<TrancheSnapshot | null>;
39
+ /** */
40
+ getBuyQuote(amount: bigint, asset: PurchaseAsset): Promise<PurchaseQuote>;
22
41
  }
23
- type StakerConfig = {
24
- network: ExternalNetwork;
25
- provider: BaseSignerWalletAdapter | ethers.providers.Web3Provider;
26
- pubKey: PublicKey;
27
- };
28
42
  interface Portfolio {
29
43
  /** Native balance on chain: ETH, SOL */
30
44
  native: BalanceView;
@@ -32,6 +46,8 @@ interface Portfolio {
32
46
  liq: BalanceView;
33
47
  /** Outpost Staked balance */
34
48
  staked: BalanceView;
49
+ /** Prelaunch WIRE “shares” (warrants/pretokens) */
50
+ wire: BalanceView;
35
51
  /** SOL ONLY!
36
52
  * Tracked liqSOL balance from distribution program */
37
53
  tracked?: BalanceView;
@@ -43,9 +59,73 @@ interface Portfolio {
43
59
  type BalanceView = {
44
60
  amount: bigint;
45
61
  decimals: number;
46
- symbol?: string;
62
+ symbol: string;
47
63
  ata?: PublicKey$1;
48
64
  };
65
+ interface TrancheLadderItem {
66
+ /** On-chain tranche id, 0-based (0,1,2,...) */
67
+ id: number;
68
+ /** Total capacity for this tranche (pretokens, 1e8 scale) */
69
+ capacity: bigint;
70
+ /** Sold amount in this tranche (1e8 scale) */
71
+ sold: bigint;
72
+ /** Remaining = capacity - sold (1e8 scale) */
73
+ remaining: bigint;
74
+ /** Price for this tranche in USD (1e8 scale) */
75
+ priceUsd: bigint;
76
+ }
77
+ /**
78
+ * Unified pretoken/tranche snapshot for any chain.
79
+ * ETH / other chains just fill the same shape from their own contracts.
80
+ */
81
+ interface TrancheSnapshot {
82
+ chainID: ChainID;
83
+ /** Global share index (1e12 on Sol today; other chains can use their own scale) */
84
+ currentIndex: bigint;
85
+ /** Total accounting shares (wire pretoken “shares”) */
86
+ totalShares: bigint;
87
+ /** Current tranche id as stored on chain (0-based) */
88
+ currentTranche: number;
89
+ /** Current tranche price in USD (1e8 scale) */
90
+ currentPriceUsd: bigint;
91
+ /** Optional min/max bounds for price validation (1e8 scale) */
92
+ minPriceUsd?: bigint;
93
+ maxPriceUsd?: bigint;
94
+ /** Tranche curve config (per-chain) */
95
+ supplyGrowthBps: number;
96
+ priceGrowthBps: number;
97
+ /** Current tranche supply state (1e8 scale) */
98
+ currentTrancheSupply: bigint;
99
+ initialTrancheSupply: bigint;
100
+ totalWarrantsSold: bigint;
101
+ /** Native token → USD price if available (SOL/USD, ETH/USD, etc, 1e8 scale) */
102
+ nativePriceUsd?: bigint;
103
+ /** Optional timestamp (sec) for the last recorded native price */
104
+ nativePriceTimestamp?: number;
105
+ /**
106
+ * Local window of tranche “rows” centered around current.
107
+ * Used directly by the frontend for ladder graphs.
108
+ */
109
+ ladder: TrancheLadderItem[];
110
+ }
111
+ /** Purchase asset selection used by staking client(s) */
112
+ declare enum PurchaseAsset {
113
+ SOL = "SOL",
114
+ LIQSOL = "LIQSOL",
115
+ ETH = "ETH",
116
+ LIQETH = "LIQETH",
117
+ YIELD = "YIELD"
118
+ }
119
+ interface PurchaseQuote {
120
+ purchaseAsset: PurchaseAsset;
121
+ amountIn: bigint;
122
+ /** Expected pretoken “shares” (pretokens) and decimals */
123
+ wireShares: bigint;
124
+ wireDecimals: number;
125
+ /** Current price + notional in USD (1e8 scale) */
126
+ wirePriceUsd: bigint;
127
+ notionalUsd: bigint;
128
+ }
49
129
 
50
130
  declare class Staker {
51
131
  selectedChainID?: ChainID;
@@ -184,6 +264,8 @@ declare class EthereumStakingClient implements IStakingClient {
184
264
  unstakePrelaunch(tokenId: bigint, recipient: string): Promise<string>;
185
265
  fetchPrelaunchReceipts(address?: string): Promise<preLaunchReceipt[]>;
186
266
  getEthStats(): Promise<any>;
267
+ buy(amount: bigint, purchaseAsset: PurchaseAsset): Promise<string>;
268
+ getBuyQuote(amount: bigint, purchaseAsset: PurchaseAsset): Promise<PurchaseQuote>;
187
269
  /**
188
270
  * Resolve the user's ETH + liqETH balances.
189
271
  *
@@ -192,6 +274,12 @@ declare class EthereumStakingClient implements IStakingClient {
192
274
  * tracked = liqETH tracked balance (protocol/accounting view)
193
275
  */
194
276
  getPortfolio(): Promise<Portfolio>;
277
+ /**
278
+ * Program-level prelaunch WIRE / tranche snapshot for Solana.
279
+ * Uses the same OutpostWireStateSnapshot primitive as getPortfolio().
280
+ * TODO! for eth
281
+ */
282
+ getTrancheSnapshot(): Promise<TrancheSnapshot | null>;
195
283
  private requestWithdraw;
196
284
  }
197
285
 
@@ -502,6 +590,13 @@ type WireReceipt = {
502
590
  purchasedSolShares: BN;
503
591
  bump: number;
504
592
  };
593
+ type PriceHistory = {
594
+ windowSize: number;
595
+ prices: BN[];
596
+ count: number;
597
+ nextIndex: number;
598
+ bump: number;
599
+ };
505
600
 
506
601
  type types_CorrectRegisterBuildResult = CorrectRegisterBuildResult;
507
602
  type types_CorrectRegisterPlan = CorrectRegisterPlan;
@@ -510,6 +605,7 @@ type types_GlobalState = GlobalState;
510
605
  type types_MismatchCandidate = MismatchCandidate;
511
606
  type types_OutpostWireStateSnapshot = OutpostWireStateSnapshot;
512
607
  type types_ParsedAccountInfo = ParsedAccountInfo;
608
+ type types_PriceHistory = PriceHistory;
513
609
  type types_SharesPreview = SharesPreview;
514
610
  type types_SolanaTransaction = SolanaTransaction;
515
611
  type types_TrancheState = TrancheState;
@@ -518,9 +614,20 @@ type types_UserWarrantRecord = UserWarrantRecord;
518
614
  type types_WalletLike = WalletLike;
519
615
  type types_WireReceipt = WireReceipt;
520
616
  declare namespace types {
521
- export type { types_CorrectRegisterBuildResult as CorrectRegisterBuildResult, types_CorrectRegisterPlan as CorrectRegisterPlan, types_DistributionState as DistributionState, types_GlobalState as GlobalState, types_MismatchCandidate as MismatchCandidate, types_OutpostWireStateSnapshot as OutpostWireStateSnapshot, types_ParsedAccountInfo as ParsedAccountInfo, types_SharesPreview as SharesPreview, types_SolanaTransaction as SolanaTransaction, types_TrancheState as TrancheState, types_UserRecord as UserRecord, types_UserWarrantRecord as UserWarrantRecord, types_WalletLike as WalletLike, types_WireReceipt as WireReceipt };
617
+ export type { types_CorrectRegisterBuildResult as CorrectRegisterBuildResult, types_CorrectRegisterPlan as CorrectRegisterPlan, types_DistributionState as DistributionState, types_GlobalState as GlobalState, types_MismatchCandidate as MismatchCandidate, types_OutpostWireStateSnapshot as OutpostWireStateSnapshot, types_ParsedAccountInfo as ParsedAccountInfo, types_PriceHistory as PriceHistory, types_SharesPreview as SharesPreview, types_SolanaTransaction as SolanaTransaction, types_TrancheState as TrancheState, types_UserRecord as UserRecord, types_UserWarrantRecord as UserWarrantRecord, types_WalletLike as WalletLike, types_WireReceipt as WireReceipt };
522
618
  }
523
619
 
620
+ /**
621
+ * Solana implementation of IStakingClient.
622
+ *
623
+ * Responsibilities:
624
+ * - Wire together liqSOL deposit/withdraw
625
+ * - Outpost stake/unstake
626
+ * - Prelaunch WIRE (pretokens) buy flows
627
+ * - Unified portfolio + tranche snapshot + buy quotes
628
+ *
629
+ * This class composes lower-level clients; it does not know about UI.
630
+ */
524
631
  declare class SolanaStakingClient implements IStakingClient {
525
632
  private config;
526
633
  pubKey: PublicKey;
@@ -530,56 +637,115 @@ declare class SolanaStakingClient implements IStakingClient {
530
637
  private distributionClient;
531
638
  private leaderboardClient;
532
639
  private outpostClient;
640
+ private tokenClient;
533
641
  get solPubKey(): PublicKey$1;
534
642
  get network(): ExternalNetwork;
535
643
  constructor(config: StakerConfig);
536
644
  /**
537
- * Deposit SOL into liqSOL protocol (liqsol_core deposit flow).
538
- * @param amountLamports Amount of SOL to deposit (smallest unit)
539
- * @return Transaction signature
645
+ * Deposit native SOL into liqSOL (liqsol_core::deposit).
646
+ * Handles tx build, sign, send, and confirmation.
540
647
  */
541
648
  deposit(amountLamports: bigint): Promise<string>;
542
649
  /**
543
650
  * Withdraw SOL from liqSOL protocol.
544
- * (Wire up once you have DepositClient.buildWithdrawTx or equivalent.)
651
+ * NOTE: placeholder until a withdraw flow is implemented in DepositClient.
545
652
  */
546
- withdraw(amountLamports: bigint): Promise<string>;
653
+ withdraw(_amountLamports: bigint): Promise<string>;
547
654
  /**
548
655
  * Stake liqSOL into Outpost (liqSOL -> pool).
549
- * Matches deposit flow: build -> prepare -> sign -> send/confirm.
550
- * @param amountLamports Amount of liqSOL to stake (smallest unit)
656
+ * Ensures user ATA exists, then stakes via outpostClient.
551
657
  */
552
658
  stake(amountLamports: bigint): Promise<string>;
553
659
  /**
554
660
  * Unstake liqSOL from Outpost (pool -> liqSOL).
555
- * Matches deposit flow: build -> prepare -> sign -> send/confirm.
556
- * @param amountLamports Amount of liqSOL principal to unstake (smallest unit)
661
+ * Mirrors stake() but calls withdrawStake.
557
662
  */
558
663
  unstake(amountLamports: bigint): Promise<string>;
559
664
  /**
560
- * native = SOL in wallet
561
- * liq = liqSOL token balance (from Token-2022 ATA)
562
- * staked = Outpost staked liqSOL principal (from wireReceipt.stakedLiqsol)
563
- * tracked = liqSOL tracked balance (from Distribution.userRecord)
665
+ * Buy prelaunch WIRE “pretokens” using a supported asset.
666
+ *
667
+ * - SOL: uses purchase_with_sol
668
+ * - LIQSOL: uses purchase_with_liqsol
669
+ * - YIELD: uses purchase_warrants_from_yield
670
+ *
671
+ * ETH / LIQETH are not valid on Solana.
672
+ */
673
+ buy(amountLamports: bigint, purchaseAsset: PurchaseAsset): Promise<string>;
674
+ /**
675
+ * Aggregate view of the user’s balances on Solana:
676
+ * - native: SOL wallet balance
677
+ * - liq: liqSOL token balance (Token-2022 ATA)
678
+ * - staked: Outpost-staked liqSOL principal
679
+ * - tracked: distribution program trackedBalance (liqSOL)
680
+ * - wire: total prelaunch WIRE shares (warrants/pretokens, 1e8)
681
+ * - extras: useful internal addresses and raw state for debugging/UX
564
682
  */
565
683
  getPortfolio(): Promise<Portfolio>;
684
+ /**
685
+ * Unified, chain-agnostic tranche snapshot for Solana.
686
+ *
687
+ * Uses:
688
+ * - liqsol_core.globalState (currentIndex, totalShares, etc.)
689
+ * - liqsol_core.trancheState (price, supply, total sold, etc.)
690
+ * - Chainlink/PriceHistory for SOL/USD (via TokenClient.getSolPriceUsdSafe)
691
+ *
692
+ * windowBefore/windowAfter control how many ladder rows we precompute
693
+ * around the current tranche for UI, but you can pass nothing if you
694
+ * only need current tranche info.
695
+ */
696
+ getTrancheSnapshot(options?: {
697
+ chainID?: ChainID;
698
+ windowBefore?: number;
699
+ windowAfter?: number;
700
+ }): Promise<TrancheSnapshot>;
701
+ /**
702
+ * Approximate prelaunch WIRE quote for a given amount & asset.
703
+ *
704
+ * Uses TrancheSnapshot + SOL/USD price for:
705
+ * - SOL: amount is lamports
706
+ * - LIQSOL: amount is liqSOL base units (decimals = 9)
707
+ * - YIELD: amount is treated as SOL lamports-equivalent of yield
708
+ *
709
+ * NOTE: On-chain rounding may differ slightly (this is UI-only).
710
+ */
711
+ getBuyQuote(amount: bigint, asset: PurchaseAsset, opts?: {
712
+ chainID?: ChainID;
713
+ }): Promise<PurchaseQuote>;
714
+ /**
715
+ * Convenience helper to fetch the distribution userRecord for the current user.
716
+ * Used by balance-correction flows and debugging.
717
+ */
566
718
  getUserRecord(): Promise<UserRecord | null>;
567
- getProtocolFee(): void;
719
+ /**
720
+ * Run the "correct & register" flow on Solana:
721
+ * - builds the minimal transaction (maybe multi-user) to reconcile liqSOL
722
+ * - signs and sends the transaction if it can succeed
723
+ */
568
724
  correctBalance(amount?: bigint): Promise<string>;
725
+ /**
726
+ * Send a signed transaction over HTTP RPC and wait for confirmation.
727
+ * Throws if the transaction fails.
728
+ */
569
729
  private sendAndConfirmHttp;
730
+ /**
731
+ * Sign a single Solana transaction using the connected wallet adapter.
732
+ */
570
733
  signTransaction(tx: SolanaTransaction): Promise<SolanaTransaction>;
734
+ /**
735
+ * Generic "fire and forget" send helper if the caller already
736
+ * prepared and signed the transaction.
737
+ */
571
738
  sendTransaction(signed: SolanaTransaction): Promise<TransactionSignature>;
739
+ /**
740
+ * Attach recent blockhash + fee payer to a transaction.
741
+ * Required before signing and sending.
742
+ */
572
743
  prepareTx(tx: Transaction): Promise<{
573
744
  tx: Transaction;
574
745
  blockhash: string;
575
746
  lastValidBlockHeight: number;
576
747
  }>;
577
748
  }
578
- interface TxResult {
579
- signature: string;
580
- slot: number;
581
- confirmed: boolean;
582
- }
583
749
 
584
750
  /**
585
751
  * ---------------------------------------------------------------------------
@@ -630,6 +796,7 @@ declare const PDA_SEEDS: {
630
796
  readonly BAR_STATE_SEED: "bar_state";
631
797
  readonly BONDED_ACTOR_SEED: "bonded_actor";
632
798
  readonly BOND_LEVEL_SEED: "bond_level";
799
+ readonly PRICE_HISTORY: "price_history";
633
800
  };
634
801
  /**
635
802
  * Helpers for PDA derivation so clients don’t duplicate logic.
@@ -662,6 +829,7 @@ declare const deriveUserWarrantRecordPda: (user: PublicKey$1) => PublicKey$1;
662
829
  declare const deriveBarConfigPda: () => PublicKey$1;
663
830
  declare const deriveBondLevelPda: (bondLevelId: number[]) => PublicKey$1;
664
831
  declare const deriveBondedActorPda: (actor: PublicKey$1) => PublicKey$1;
832
+ declare const derivePriceHistoryPda: () => PublicKey$1;
665
833
  /**
666
834
  * Ephemeral stake account address used per-deposit.
667
835
  * On-chain convention: seed = `ephemeral_<u32>` under StakeProgram.programId.
@@ -692,7 +860,7 @@ declare const solToLamports: (sol: number) => bigint;
692
860
  * IDL can be found at `target/idl/liqsol_core.json`.
693
861
  */
694
862
  type LiqsolCore = {
695
- "address": "HR3t8mA25TdJpwLph2h2L7KhK7ynWoAByYYzgUAfd5rk";
863
+ "address": "BBkVcNWNQz1vZ6esv5US4QnNFWPRqxWbdpJHur9GVXSu";
696
864
  "metadata": {
697
865
  "name": "liqsolCore";
698
866
  "version": "0.1.0";
@@ -3844,58 +4012,8 @@ type LiqsolCore = {
3844
4012
  "errors": [
3845
4013
  {
3846
4014
  "code": 6000;
3847
- "name": "noRewardsToClaim";
3848
- "msg": "No rewards to claim";
3849
- },
3850
- {
3851
- "code": 6001;
3852
- "name": "insufficientBalance";
3853
- "msg": "Insufficient balance";
3854
- },
3855
- {
3856
- "code": 6002;
3857
- "name": "insufficientFunds";
3858
- "msg": "Insufficient funds";
3859
- },
3860
- {
3861
- "code": 6003;
3862
- "name": "unauthorized";
3863
- "msg": "Unauthorized - caller is not the distribution authority";
3864
- },
3865
- {
3866
- "code": 6004;
3867
- "name": "invalidMint";
3868
- "msg": "Invalid mint";
3869
- },
3870
- {
3871
- "code": 6005;
3872
- "name": "invalidOwner";
3873
- "msg": "Invalid owner";
3874
- },
3875
- {
3876
- "code": 6006;
3877
- "name": "invalidUserRecord";
3878
- "msg": "Invalid user record";
3879
- },
3880
- {
3881
- "code": 6007;
3882
- "name": "invalidWithdrawal";
3883
- "msg": "Invalid withdrawal - balance increased instead of decreased";
3884
- },
3885
- {
3886
- "code": 6008;
3887
- "name": "invalidProgramId";
3888
- "msg": "Invalid program ID";
3889
- },
3890
- {
3891
- "code": 6009;
3892
- "name": "instructionIntrospectionFailed";
3893
- "msg": "Instruction introspection failed";
3894
- },
3895
- {
3896
- "code": 6010;
3897
- "name": "receiptFulfilled";
3898
- "msg": "Receipt already fulfilled";
4015
+ "name": "accountBorrowFailed";
4016
+ "msg": "Util Acc borrow Failed";
3899
4017
  }
3900
4018
  ];
3901
4019
  "types": [
@@ -5171,6 +5289,47 @@ type LiqsolCore = {
5171
5289
  ];
5172
5290
  };
5173
5291
 
5292
+ /** BN | bigint -> bigint helper (keeps code readable) */
5293
+ declare function toBigint(x: any): bigint;
5294
+ /**
5295
+ * Convert token amount -> shares using the same rule as on-chain tests:
5296
+ * shares = ceil(amount * INDEX_SCALE / currentIndex)
5297
+ */
5298
+ declare function tokensToShares(amount: bigint, currentIndex: bigint): bigint;
5299
+ /**
5300
+ * Build a local tranche ladder around the current tranche
5301
+ * using only on-chain config + current state.
5302
+ *
5303
+ * Rules (from liqsol_core tests):
5304
+ * - past tranches are fully sold
5305
+ * - current tranche has (initial - currentSupply) sold
5306
+ * - future tranches start with 0 sold
5307
+ * - supply/price grow by supplyGrowthBps/priceGrowthBps per tranche
5308
+ */
5309
+ declare function buildSolanaTrancheLadder(options: {
5310
+ currentTranche: number;
5311
+ initialTrancheSupply: bigint;
5312
+ currentTrancheSupply: bigint;
5313
+ totalWarrantsSold: bigint;
5314
+ currentPriceUsd: bigint;
5315
+ supplyGrowthBps: number;
5316
+ priceGrowthBps: number;
5317
+ windowBefore?: number;
5318
+ windowAfter?: number;
5319
+ }): TrancheLadderItem[];
5320
+ /**
5321
+ * Turn raw liqsol_core accounts into a chain-agnostic TrancheSnapshot for SOL.
5322
+ * All math stays here; TokenClient just wires accounts + connection.
5323
+ */
5324
+ declare function buildSolanaTrancheSnapshot(options: {
5325
+ chainID: ChainID;
5326
+ globalState: GlobalState;
5327
+ trancheState: TrancheState;
5328
+ solPriceUsd?: bigint;
5329
+ nativePriceTimestamp?: number;
5330
+ ladderWindowBefore?: number;
5331
+ ladderWindowAfter?: number;
5332
+ }): TrancheSnapshot;
5174
5333
  declare function getLiqsolCoreProgram(connection: Connection): Program<LiqsolCore>;
5175
5334
  declare function getUserLiqSolBalance(connection: Connection, user: PublicKey$1): Promise<number>;
5176
5335
  declare function getBucketLiqSolBalance(connection: Connection): Promise<number>;
@@ -5494,5 +5653,29 @@ declare class OutpostClient {
5494
5653
  private getTokenBalanceSafe;
5495
5654
  }
5496
5655
 
5497
- 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, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, types as SOL, SolanaStakingClient, Staker, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, calculateExpectedFee, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveLeaderboardStatePda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePoolUserRecordPda, deriveReservePoolPda, deriveSolBucketPda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveTrancheStatePda, deriveUserRecordPda, deriveUserUserRecordPda, deriveUserWarrantRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWireReceiptPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, waitForConfirmation, waitUntilSafeToExecuteFunction };
5498
- export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OutpostAccounts, Portfolio, ScheduleConfig, StakerConfig, TxResult };
5656
+ declare class TokenClient {
5657
+ private readonly provider;
5658
+ private readonly program;
5659
+ get wallet(): WalletLike;
5660
+ constructor(provider: AnchorProvider);
5661
+ getAccounts(user: PublicKey$1): Promise<OutpostAccounts>;
5662
+ fetchGlobalState(): Promise<GlobalState>;
5663
+ fetchTrancheState(): Promise<TrancheState>;
5664
+ fetchWireReceipt(user: PublicKey$1): Promise<WireReceipt>;
5665
+ fetchUserWarrantRecord(user: PublicKey$1): Promise<UserWarrantRecord>;
5666
+ buildPurchaseWithSolIx(amountLamports: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
5667
+ buildPurchaseWithLiqsolIx(amountLamports: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
5668
+ buildPurchaseFromYieldIx(user?: PublicKey$1): Promise<TransactionInstruction>;
5669
+ getSolPriceUsdSafe(): Promise<{
5670
+ price?: bigint;
5671
+ timestamp?: number;
5672
+ }>;
5673
+ /**
5674
+ * Fetch latest SOL/USD price (1e8 scale) from liqsol_core.priceHistory.
5675
+ * Uses the ring-buffer semantics from earlier SDK code.
5676
+ */
5677
+ getSolPriceUsd(): Promise<bigint>;
5678
+ }
5679
+
5680
+ 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, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, PurchaseAsset, types as SOL, SolanaStakingClient, Staker, TokenClient, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, calculateExpectedFee, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveLeaderboardStatePda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePoolUserRecordPda, derivePriceHistoryPda, deriveReservePoolPda, deriveSolBucketPda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveTrancheStatePda, deriveUserRecordPda, deriveUserUserRecordPda, deriveUserWarrantRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWireReceiptPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
5681
+ export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot };