@wireio/stake 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/stake.browser.js +1919 -481
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +224 -92
- package/lib/stake.js +2101 -597
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +1919 -481
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Aggregator.sol/Aggregator.json +82 -0
- package/src/networks/ethereum/clients/deposit.client.ts +76 -2
- package/src/networks/ethereum/clients/pretoken.client.ts +130 -0
- package/src/networks/ethereum/clients/stake.client.ts +87 -24
- package/src/networks/ethereum/contract.ts +13 -0
- package/src/networks/ethereum/ethereum.ts +234 -88
- package/src/networks/ethereum/types.ts +2 -0
- package/src/networks/ethereum/utils.ts +314 -0
- package/src/networks/solana/clients/token.client.ts +72 -98
- package/src/networks/solana/solana.ts +284 -184
- package/src/networks/solana/utils.ts +209 -5
- package/src/staker/types.ts +62 -0
- package/src/types.ts +80 -29
package/lib/stake.d.ts
CHANGED
|
@@ -31,7 +31,11 @@ interface IStakingClient {
|
|
|
31
31
|
* - `TrancheSnapshot` when the chain supports pretoken/tranches
|
|
32
32
|
* - `null` if this chain has no WIRE/pretoken integration
|
|
33
33
|
*/
|
|
34
|
-
getTrancheSnapshot(
|
|
34
|
+
getTrancheSnapshot(options?: {
|
|
35
|
+
chainID?: ChainID;
|
|
36
|
+
windowBefore?: number;
|
|
37
|
+
windowAfter?: number;
|
|
38
|
+
}): Promise<TrancheSnapshot | null>;
|
|
35
39
|
/** */
|
|
36
40
|
getBuyQuote(amount: bigint, asset: PurchaseAsset): Promise<PurchaseQuote>;
|
|
37
41
|
}
|
|
@@ -58,22 +62,63 @@ type BalanceView = {
|
|
|
58
62
|
symbol: string;
|
|
59
63
|
ata?: PublicKey$1;
|
|
60
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
|
+
interface TrancheLadderItem {
|
|
78
|
+
/** On-chain tranche id, 0-based (0,1,2,...) */
|
|
79
|
+
id: number;
|
|
80
|
+
/** Total capacity for this tranche (pretokens, 1e8 scale) */
|
|
81
|
+
capacity: bigint;
|
|
82
|
+
/** Sold amount in this tranche (1e8 scale) */
|
|
83
|
+
sold: bigint;
|
|
84
|
+
/** Remaining = capacity - sold (1e8 scale) */
|
|
85
|
+
remaining: bigint;
|
|
86
|
+
/** Price for this tranche in USD (1e8 scale) */
|
|
87
|
+
priceUsd: bigint;
|
|
88
|
+
}
|
|
61
89
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* All integer values are raw on-chain integers:
|
|
65
|
-
* - `currentTranchePriceUsd`: 1e8 USD
|
|
66
|
-
* - supplies / warrants / shares: 1e8 WIRE units (per liqsol_core/ETH analog)
|
|
67
|
-
* - index: same scale the program uses (INDEX_SCALE = 1e12 on Solana today)
|
|
90
|
+
* Unified pretoken/tranche snapshot for any chain.
|
|
91
|
+
* ETH / other chains just fill the same shape from their own contracts.
|
|
68
92
|
*/
|
|
69
93
|
interface TrancheSnapshot {
|
|
70
94
|
chainID: ChainID;
|
|
71
|
-
|
|
95
|
+
/** Global share index (1e12 on Sol today; other chains can use their own scale) */
|
|
72
96
|
currentIndex: bigint;
|
|
73
|
-
|
|
97
|
+
/** Total accounting shares (wire pretoken “shares”) */
|
|
98
|
+
totalShares: bigint;
|
|
99
|
+
/** Current tranche id as stored on chain (0-based) */
|
|
100
|
+
currentTranche: number;
|
|
101
|
+
/** Current tranche price in USD (1e8 scale) */
|
|
102
|
+
currentPriceUsd: bigint;
|
|
103
|
+
/** Optional min/max bounds for price validation (1e8 scale) */
|
|
104
|
+
minPriceUsd?: bigint;
|
|
105
|
+
maxPriceUsd?: bigint;
|
|
106
|
+
/** Tranche curve config (per-chain) */
|
|
107
|
+
supplyGrowthBps: number;
|
|
108
|
+
priceGrowthBps: number;
|
|
109
|
+
/** Current tranche supply state (1e8 scale) */
|
|
74
110
|
currentTrancheSupply: bigint;
|
|
111
|
+
initialTrancheSupply: bigint;
|
|
75
112
|
totalWarrantsSold: bigint;
|
|
76
|
-
|
|
113
|
+
/** Native token → USD price if available (SOL/USD, ETH/USD, etc, 1e8 scale) */
|
|
114
|
+
nativePriceUsd?: bigint;
|
|
115
|
+
/** Optional timestamp (sec) for the last recorded native price */
|
|
116
|
+
nativePriceTimestamp?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Local window of tranche “rows” centered around current.
|
|
119
|
+
* Used directly by the frontend for ladder graphs.
|
|
120
|
+
*/
|
|
121
|
+
ladder: TrancheLadderItem[];
|
|
77
122
|
}
|
|
78
123
|
declare enum PurchaseAsset {
|
|
79
124
|
SOL = "SOL",
|
|
@@ -85,8 +130,10 @@ declare enum PurchaseAsset {
|
|
|
85
130
|
interface PurchaseQuote {
|
|
86
131
|
purchaseAsset: PurchaseAsset;
|
|
87
132
|
amountIn: bigint;
|
|
133
|
+
/** Expected pretoken “shares” (pretokens) and decimals */
|
|
88
134
|
wireShares: bigint;
|
|
89
135
|
wireDecimals: number;
|
|
136
|
+
/** Current price + notional in USD (1e8 scale) */
|
|
90
137
|
wirePriceUsd: bigint;
|
|
91
138
|
notionalUsd: bigint;
|
|
92
139
|
}
|
|
@@ -111,7 +158,7 @@ declare class Staker {
|
|
|
111
158
|
setChain(chainID: ChainID): boolean;
|
|
112
159
|
}
|
|
113
160
|
|
|
114
|
-
declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "StakingModule", "WithdrawalQueue", "WithdrawalVault", "Depositor", "ReceiptNFT", "OutpostManager", "BAR", "OPP", "OPPCommon", "OPPInbound", "Warrant"];
|
|
161
|
+
declare const CONTRACT_NAMES: readonly ["Accounting", "DepositManager", "LiqEth", "StakingModule", "WithdrawalQueue", "WithdrawalVault", "Depositor", "ReceiptNFT", "OutpostManager", "BAR", "OPP", "OPPCommon", "OPPInbound", "Warrant", "Aggregator", "EthUsdPriceConsumer"];
|
|
115
162
|
type ContractName = typeof CONTRACT_NAMES[number];
|
|
116
163
|
type AddressBook = Record<ContractName, string>;
|
|
117
164
|
interface Result {
|
|
@@ -197,6 +244,7 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
197
244
|
private readonly contractService;
|
|
198
245
|
private depositClient;
|
|
199
246
|
private stakeClient;
|
|
247
|
+
private pretokenClient;
|
|
200
248
|
get contract(): {
|
|
201
249
|
Accounting: ethers.Contract;
|
|
202
250
|
DepositManager: ethers.Contract;
|
|
@@ -212,6 +260,8 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
212
260
|
OPPCommon: ethers.Contract;
|
|
213
261
|
OPPInbound: ethers.Contract;
|
|
214
262
|
Warrant: ethers.Contract;
|
|
263
|
+
Aggregator: ethers.Contract;
|
|
264
|
+
EthUsdPriceConsumer: ethers.Contract;
|
|
215
265
|
};
|
|
216
266
|
get network(): _wireio_core.ExternalNetwork;
|
|
217
267
|
constructor(config: StakerConfig);
|
|
@@ -222,13 +272,37 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
222
272
|
* @returns transaction hash
|
|
223
273
|
*/
|
|
224
274
|
deposit(amount: number | string | bigint | BigNumber): Promise<string>;
|
|
225
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Withdraw native ETH from the liqETH protocol via DepositManager.
|
|
277
|
+
* @param amount Amount in wei (or something convertible to BigNumber).
|
|
278
|
+
* Keep this as a bigint / string in the caller; avoid JS floats.
|
|
279
|
+
* @returns transaction hash
|
|
280
|
+
*/
|
|
281
|
+
withdraw(amount: bigint): Promise<string>;
|
|
282
|
+
/**
|
|
283
|
+
* Stake liqETH via DepositManager.
|
|
284
|
+
* @param amount Amount in wei
|
|
285
|
+
* Keep this as a bigint / string in the caller; avoid JS floats.
|
|
286
|
+
* @returns transaction hash
|
|
287
|
+
*/
|
|
226
288
|
stake(amount: bigint): Promise<string>;
|
|
227
289
|
unstake(): Promise<string>;
|
|
290
|
+
/**
|
|
291
|
+
* ETH Prelaunch function to unstake liqEth
|
|
292
|
+
* @param tokenId ReceiptNFT tokenId for the owned NFT that will be burned
|
|
293
|
+
* @param recipient Address to receive the liqEth funds linked to the burned NFT
|
|
294
|
+
* @returns the transaction hash
|
|
295
|
+
*/
|
|
228
296
|
unstakePrelaunch(tokenId: bigint, recipient: string): Promise<string>;
|
|
297
|
+
buy(amount: bigint): Promise<string>;
|
|
298
|
+
getOPPStatus(): Promise<any>;
|
|
299
|
+
/**
|
|
300
|
+
* ETH Prelaunch function to list the ReceiptNFTs owned by a specific user
|
|
301
|
+
* @param address address to query the receipts for
|
|
302
|
+
* @returns array of receipts
|
|
303
|
+
*/
|
|
229
304
|
fetchPrelaunchReceipts(address?: string): Promise<preLaunchReceipt[]>;
|
|
230
305
|
getEthStats(): Promise<any>;
|
|
231
|
-
buy(amount: bigint, purchaseAsset: PurchaseAsset): Promise<string>;
|
|
232
306
|
getBuyQuote(amount: bigint, purchaseAsset: PurchaseAsset): Promise<PurchaseQuote>;
|
|
233
307
|
/**
|
|
234
308
|
* Resolve the user's ETH + liqETH balances.
|
|
@@ -239,12 +313,14 @@ declare class EthereumStakingClient implements IStakingClient {
|
|
|
239
313
|
*/
|
|
240
314
|
getPortfolio(): Promise<Portfolio>;
|
|
241
315
|
/**
|
|
242
|
-
* Program-level prelaunch WIRE / tranche snapshot for
|
|
243
|
-
* Uses the same OutpostWireStateSnapshot primitive as getPortfolio().
|
|
244
|
-
* TODO! for eth
|
|
316
|
+
* Program-level prelaunch WIRE / tranche snapshot for Ethereum
|
|
245
317
|
*/
|
|
246
|
-
getTrancheSnapshot(
|
|
247
|
-
|
|
318
|
+
getTrancheSnapshot(options?: {
|
|
319
|
+
chainID?: ChainID;
|
|
320
|
+
windowBefore?: number;
|
|
321
|
+
windowAfter?: number;
|
|
322
|
+
}): Promise<TrancheSnapshot>;
|
|
323
|
+
private updateMockAggregatorPrice;
|
|
248
324
|
}
|
|
249
325
|
|
|
250
326
|
declare const ERC20Abi: ({
|
|
@@ -581,6 +657,17 @@ declare namespace types {
|
|
|
581
657
|
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 };
|
|
582
658
|
}
|
|
583
659
|
|
|
660
|
+
/**
|
|
661
|
+
* Solana implementation of IStakingClient.
|
|
662
|
+
*
|
|
663
|
+
* Responsibilities:
|
|
664
|
+
* - Wire together liqSOL deposit/withdraw
|
|
665
|
+
* - Outpost stake/unstake
|
|
666
|
+
* - Prelaunch WIRE (pretokens) buy flows
|
|
667
|
+
* - Unified portfolio + tranche snapshot + buy quotes
|
|
668
|
+
*
|
|
669
|
+
* This class composes lower-level clients; it does not know about UI.
|
|
670
|
+
*/
|
|
584
671
|
declare class SolanaStakingClient implements IStakingClient {
|
|
585
672
|
private config;
|
|
586
673
|
pubKey: PublicKey;
|
|
@@ -595,77 +682,110 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
595
682
|
get network(): ExternalNetwork;
|
|
596
683
|
constructor(config: StakerConfig);
|
|
597
684
|
/**
|
|
598
|
-
* Deposit SOL into liqSOL
|
|
599
|
-
*
|
|
600
|
-
* @return Transaction signature
|
|
685
|
+
* Deposit native SOL into liqSOL (liqsol_core::deposit).
|
|
686
|
+
* Handles tx build, sign, send, and confirmation.
|
|
601
687
|
*/
|
|
602
688
|
deposit(amountLamports: bigint): Promise<string>;
|
|
603
689
|
/**
|
|
604
690
|
* Withdraw SOL from liqSOL protocol.
|
|
605
|
-
*
|
|
691
|
+
* NOTE: placeholder until a withdraw flow is implemented in DepositClient.
|
|
606
692
|
*/
|
|
607
|
-
withdraw(
|
|
693
|
+
withdraw(_amountLamports: bigint): Promise<string>;
|
|
608
694
|
/**
|
|
609
695
|
* Stake liqSOL into Outpost (liqSOL -> pool).
|
|
610
|
-
*
|
|
611
|
-
* @param amountLamports Amount of liqSOL to stake (smallest unit)
|
|
696
|
+
* Ensures user ATA exists, then stakes via outpostClient.
|
|
612
697
|
*/
|
|
613
698
|
stake(amountLamports: bigint): Promise<string>;
|
|
614
699
|
/**
|
|
615
700
|
* Unstake liqSOL from Outpost (pool -> liqSOL).
|
|
616
|
-
*
|
|
617
|
-
* @param amountLamports Amount of liqSOL principal to unstake (smallest unit)
|
|
701
|
+
* Mirrors stake() but calls withdrawStake.
|
|
618
702
|
*/
|
|
619
703
|
unstake(amountLamports: bigint): Promise<string>;
|
|
620
|
-
/**
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
704
|
+
/**
|
|
705
|
+
* Buy prelaunch WIRE “pretokens” using a supported asset.
|
|
706
|
+
*
|
|
707
|
+
* - SOL: uses purchase_with_sol
|
|
708
|
+
* - LIQSOL: uses purchase_with_liqsol
|
|
709
|
+
* - YIELD: uses purchase_warrants_from_yield
|
|
710
|
+
*
|
|
711
|
+
* ETH / LIQETH are not valid on Solana.
|
|
626
712
|
*/
|
|
627
713
|
buy(amountLamports: bigint, purchaseAsset: PurchaseAsset): Promise<string>;
|
|
628
714
|
/**
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
715
|
+
* Aggregate view of the user’s balances on Solana:
|
|
716
|
+
* - native: SOL wallet balance
|
|
717
|
+
* - liq: liqSOL token balance (Token-2022 ATA)
|
|
718
|
+
* - staked: Outpost-staked liqSOL principal
|
|
719
|
+
* - tracked: distribution program trackedBalance (liqSOL)
|
|
720
|
+
* - wire: total prelaunch WIRE shares (warrants/pretokens, 1e8)
|
|
721
|
+
* - extras: useful internal addresses and raw state for debugging/UX
|
|
634
722
|
*/
|
|
635
723
|
getPortfolio(): Promise<Portfolio>;
|
|
636
724
|
/**
|
|
637
|
-
*
|
|
638
|
-
*
|
|
725
|
+
* Unified, chain-agnostic tranche snapshot for Solana.
|
|
726
|
+
*
|
|
727
|
+
* Uses:
|
|
728
|
+
* - liqsol_core.globalState (currentIndex, totalShares, etc.)
|
|
729
|
+
* - liqsol_core.trancheState (price, supply, total sold, etc.)
|
|
730
|
+
* - Chainlink/PriceHistory for SOL/USD (via TokenClient.getSolPriceUsdSafe)
|
|
731
|
+
*
|
|
732
|
+
* windowBefore/windowAfter control how many ladder rows we precompute
|
|
733
|
+
* around the current tranche for UI, but you can pass nothing if you
|
|
734
|
+
* only need current tranche info.
|
|
639
735
|
*/
|
|
640
|
-
getTrancheSnapshot(
|
|
641
|
-
|
|
736
|
+
getTrancheSnapshot(options?: {
|
|
737
|
+
chainID?: ChainID;
|
|
738
|
+
windowBefore?: number;
|
|
739
|
+
windowAfter?: number;
|
|
740
|
+
}): Promise<TrancheSnapshot>;
|
|
642
741
|
/**
|
|
643
|
-
*
|
|
644
|
-
* of already-computed USD notional:
|
|
742
|
+
* Approximate prelaunch WIRE quote for a given amount & asset.
|
|
645
743
|
*
|
|
646
|
-
*
|
|
744
|
+
* Uses TrancheSnapshot + SOL/USD price for:
|
|
745
|
+
* - SOL: amount is lamports
|
|
746
|
+
* - LIQSOL: amount is liqSOL base units (decimals = 9)
|
|
747
|
+
* - YIELD: amount is treated as SOL lamports-equivalent of yield
|
|
647
748
|
*
|
|
648
|
-
*
|
|
649
|
-
|
|
650
|
-
|
|
749
|
+
* NOTE: On-chain rounding may differ slightly (this is UI-only).
|
|
750
|
+
*/
|
|
751
|
+
getBuyQuote(amount: bigint, asset: PurchaseAsset, opts?: {
|
|
752
|
+
chainID?: ChainID;
|
|
753
|
+
}): Promise<PurchaseQuote>;
|
|
754
|
+
/**
|
|
755
|
+
* Convenience helper to fetch the distribution userRecord for the current user.
|
|
756
|
+
* Used by balance-correction flows and debugging.
|
|
651
757
|
*/
|
|
652
|
-
private calculateExpectedWarrants;
|
|
653
758
|
getUserRecord(): Promise<UserRecord | null>;
|
|
759
|
+
/**
|
|
760
|
+
* Run the "correct & register" flow on Solana:
|
|
761
|
+
* - builds the minimal transaction (maybe multi-user) to reconcile liqSOL
|
|
762
|
+
* - signs and sends the transaction if it can succeed
|
|
763
|
+
*/
|
|
654
764
|
correctBalance(amount?: bigint): Promise<string>;
|
|
765
|
+
/**
|
|
766
|
+
* Send a signed transaction over HTTP RPC and wait for confirmation.
|
|
767
|
+
* Throws if the transaction fails.
|
|
768
|
+
*/
|
|
655
769
|
private sendAndConfirmHttp;
|
|
770
|
+
/**
|
|
771
|
+
* Sign a single Solana transaction using the connected wallet adapter.
|
|
772
|
+
*/
|
|
656
773
|
signTransaction(tx: SolanaTransaction): Promise<SolanaTransaction>;
|
|
774
|
+
/**
|
|
775
|
+
* Generic "fire and forget" send helper if the caller already
|
|
776
|
+
* prepared and signed the transaction.
|
|
777
|
+
*/
|
|
657
778
|
sendTransaction(signed: SolanaTransaction): Promise<TransactionSignature>;
|
|
779
|
+
/**
|
|
780
|
+
* Attach recent blockhash + fee payer to a transaction.
|
|
781
|
+
* Required before signing and sending.
|
|
782
|
+
*/
|
|
658
783
|
prepareTx(tx: Transaction): Promise<{
|
|
659
784
|
tx: Transaction;
|
|
660
785
|
blockhash: string;
|
|
661
786
|
lastValidBlockHeight: number;
|
|
662
787
|
}>;
|
|
663
788
|
}
|
|
664
|
-
interface TxResult {
|
|
665
|
-
signature: string;
|
|
666
|
-
slot: number;
|
|
667
|
-
confirmed: boolean;
|
|
668
|
-
}
|
|
669
789
|
|
|
670
790
|
/**
|
|
671
791
|
* ---------------------------------------------------------------------------
|
|
@@ -5209,6 +5329,47 @@ type LiqsolCore = {
|
|
|
5209
5329
|
];
|
|
5210
5330
|
};
|
|
5211
5331
|
|
|
5332
|
+
/** BN | bigint -> bigint helper (keeps code readable) */
|
|
5333
|
+
declare function toBigint(x: any): bigint;
|
|
5334
|
+
/**
|
|
5335
|
+
* Convert token amount -> shares using the same rule as on-chain tests:
|
|
5336
|
+
* shares = ceil(amount * INDEX_SCALE / currentIndex)
|
|
5337
|
+
*/
|
|
5338
|
+
declare function tokensToShares(amount: bigint, currentIndex: bigint): bigint;
|
|
5339
|
+
/**
|
|
5340
|
+
* Build a local tranche ladder around the current tranche
|
|
5341
|
+
* using only on-chain config + current state.
|
|
5342
|
+
*
|
|
5343
|
+
* Rules (from liqsol_core tests):
|
|
5344
|
+
* - past tranches are fully sold
|
|
5345
|
+
* - current tranche has (initial - currentSupply) sold
|
|
5346
|
+
* - future tranches start with 0 sold
|
|
5347
|
+
* - supply/price grow by supplyGrowthBps/priceGrowthBps per tranche
|
|
5348
|
+
*/
|
|
5349
|
+
declare function buildSolanaTrancheLadder(options: {
|
|
5350
|
+
currentTranche: number;
|
|
5351
|
+
initialTrancheSupply: bigint;
|
|
5352
|
+
currentTrancheSupply: bigint;
|
|
5353
|
+
totalWarrantsSold: bigint;
|
|
5354
|
+
currentPriceUsd: bigint;
|
|
5355
|
+
supplyGrowthBps: number;
|
|
5356
|
+
priceGrowthBps: number;
|
|
5357
|
+
windowBefore?: number;
|
|
5358
|
+
windowAfter?: number;
|
|
5359
|
+
}): TrancheLadderItem[];
|
|
5360
|
+
/**
|
|
5361
|
+
* Turn raw liqsol_core accounts into a chain-agnostic TrancheSnapshot for SOL.
|
|
5362
|
+
* All math stays here; TokenClient just wires accounts + connection.
|
|
5363
|
+
*/
|
|
5364
|
+
declare function buildSolanaTrancheSnapshot(options: {
|
|
5365
|
+
chainID: ChainID;
|
|
5366
|
+
globalState: GlobalState;
|
|
5367
|
+
trancheState: TrancheState;
|
|
5368
|
+
solPriceUsd?: bigint;
|
|
5369
|
+
nativePriceTimestamp?: number;
|
|
5370
|
+
ladderWindowBefore?: number;
|
|
5371
|
+
ladderWindowAfter?: number;
|
|
5372
|
+
}): TrancheSnapshot;
|
|
5212
5373
|
declare function getLiqsolCoreProgram(connection: Connection): Program<LiqsolCore>;
|
|
5213
5374
|
declare function getUserLiqSolBalance(connection: Connection, user: PublicKey$1): Promise<number>;
|
|
5214
5375
|
declare function getBucketLiqSolBalance(connection: Connection): Promise<number>;
|
|
@@ -5532,58 +5693,29 @@ declare class OutpostClient {
|
|
|
5532
5693
|
private getTokenBalanceSafe;
|
|
5533
5694
|
}
|
|
5534
5695
|
|
|
5535
|
-
/**
|
|
5536
|
-
* Client for interacting with the Pretoken (Outpost) program on Solana.
|
|
5537
|
-
*
|
|
5538
|
-
* Provides account fetching and instruction building for pretoken operations.
|
|
5539
|
-
* Does NOT send or confirm transactions; keeps SDK composable.
|
|
5540
|
-
*
|
|
5541
|
-
* TODO: Update to $WIRE Token implementation Post-Launch
|
|
5542
|
-
*/
|
|
5543
5696
|
declare class TokenClient {
|
|
5544
5697
|
private readonly provider;
|
|
5545
5698
|
private readonly program;
|
|
5546
5699
|
get wallet(): WalletLike;
|
|
5547
5700
|
constructor(provider: AnchorProvider);
|
|
5548
|
-
/**
|
|
5549
|
-
* Single source of truth for outpost/pretoken accounts.
|
|
5550
|
-
* Uses your existing PDA + ATA derivations in buildOutpostAccounts().
|
|
5551
|
-
*/
|
|
5552
5701
|
getAccounts(user: PublicKey$1): Promise<OutpostAccounts>;
|
|
5553
|
-
/**
|
|
5554
|
-
* Lightweight, UI-friendly snapshot fetchers.
|
|
5555
|
-
* (No decoding assumptions beyond what Anchor already provides.)
|
|
5556
|
-
*/
|
|
5557
5702
|
fetchGlobalState(): Promise<GlobalState>;
|
|
5558
5703
|
fetchTrancheState(): Promise<TrancheState>;
|
|
5559
5704
|
fetchWireReceipt(user: PublicKey$1): Promise<WireReceipt>;
|
|
5560
5705
|
fetchUserWarrantRecord(user: PublicKey$1): Promise<UserWarrantRecord>;
|
|
5561
|
-
/**
|
|
5562
|
-
* purchase_with_sol(amount u64)
|
|
5563
|
-
*
|
|
5564
|
-
* amountLamports is bigint to match your SDK convention.
|
|
5565
|
-
*/
|
|
5566
5706
|
buildPurchaseWithSolIx(amountLamports: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
|
|
5567
|
-
/**
|
|
5568
|
-
* purchase_with_liqsol(amount u64)
|
|
5569
|
-
*
|
|
5570
|
-
* amount is liqSOL *raw base units* (Token-2022 amount).
|
|
5571
|
-
*/
|
|
5572
5707
|
buildPurchaseWithLiqsolIx(amountLamports: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
|
|
5573
|
-
/**
|
|
5574
|
-
* purchase_warrants_from_yield()
|
|
5575
|
-
*
|
|
5576
|
-
* No amount arg; it consumes tracked yield according to on-chain rules.
|
|
5577
|
-
*/
|
|
5578
5708
|
buildPurchaseFromYieldIx(user?: PublicKey$1): Promise<TransactionInstruction>;
|
|
5709
|
+
getSolPriceUsdSafe(): Promise<{
|
|
5710
|
+
price?: bigint;
|
|
5711
|
+
timestamp?: number;
|
|
5712
|
+
}>;
|
|
5579
5713
|
/**
|
|
5580
|
-
* Fetch
|
|
5581
|
-
*
|
|
5582
|
-
* This uses the same ring-buffer semantics as the on-chain program:
|
|
5583
|
-
* the latest price is the entry just before `nextIndex`.
|
|
5714
|
+
* Fetch latest SOL/USD price (1e8 scale) from liqsol_core.priceHistory.
|
|
5715
|
+
* Uses the ring-buffer semantics from earlier SDK code.
|
|
5584
5716
|
*/
|
|
5585
|
-
getSolPriceUsd(): Promise<
|
|
5717
|
+
getSolPriceUsd(): Promise<bigint>;
|
|
5586
5718
|
}
|
|
5587
5719
|
|
|
5588
|
-
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, 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, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
5589
|
-
export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig,
|
|
5720
|
+
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 };
|
|
5721
|
+
export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot };
|