@wireio/stake 2.2.1 → 2.3.0

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
@@ -28,6 +28,8 @@ declare enum SupportedSolChainID {
28
28
  Mainnet = "mainnet-beta",
29
29
  Devnet = "devnet"
30
30
  }
31
+ type ChainSymbol = 'ETH' | 'SOL';
32
+ type WithdrawStatus = 'queued' | 'ready' | 'claimed';
31
33
  interface IStakingClient {
32
34
  pubKey?: PublicKey;
33
35
  network: ExternalNetwork;
@@ -37,6 +39,10 @@ interface IStakingClient {
37
39
  stake(amount: bigint): Promise<string>;
38
40
  unstake(amount: bigint): Promise<string>;
39
41
  buy(amount: bigint): Promise<string>;
42
+ /** Claim a withdrawal receipt (burn NFT + receive ETH/SOL) via claim_withdraw. */
43
+ claimWithdraw(tokenId: bigint): Promise<string>;
44
+ /** Enumerate withdrawal receipt NFTs held by the user (queued/ready/claimed). */
45
+ getPendingWithdraws(): Promise<WithdrawReceipt$1[]>;
40
46
  /** Fetch the complete user portfolio */
41
47
  getPortfolio(): Promise<Portfolio | null>;
42
48
  getSystemAPY(): Promise<number>;
@@ -251,6 +257,33 @@ declare enum ReceiptNFTKind {
251
257
  STAKE = 0,
252
258
  PRETOKEN_PURCHASE = 1
253
259
  }
260
+ /**
261
+ * Unified cross-chain withdraw receipt (ETH + SOL).
262
+ *
263
+ * tokenId – NFT id (ERC721 on ETH, PDA-seeded mint on SOL)
264
+ * receipt – chain-specific data normalized for UI
265
+ */
266
+ interface WithdrawReceipt$1 {
267
+ tokenId: bigint;
268
+ receipt: {
269
+ /** Display balance (wei or lamports) with symbol/decimals. */
270
+ amount: BalanceView;
271
+ /** Claimable time in ms since epoch (readyAt on ETH; ETA from epoch on SOL). */
272
+ readyAt: number;
273
+ /** Chain discriminator. */
274
+ chain: ChainSymbol;
275
+ /** Solana-only: epoch when claimable. */
276
+ epoch?: bigint;
277
+ /** queued | ready | claimed */
278
+ status?: WithdrawStatus;
279
+ /** NFT mint (SOL) or ERC721 contract address (ETH queue address). */
280
+ mint?: string;
281
+ /** Owner token account (SOL) for the NFT. */
282
+ ownerAta?: string;
283
+ /** Optional explicit contract address for ETH queue NFT. */
284
+ contractAddress?: string;
285
+ };
286
+ }
254
287
 
255
288
  declare class Staker {
256
289
  selectedChainID?: ChainID;
@@ -325,6 +358,9 @@ interface SharesBurnedEvent {
325
358
  shares: BigNumber;
326
359
  tokenValue: BigNumber;
327
360
  }
361
+ /**
362
+ * Legacy stake/pretoken receipt (kept for compatibility; not used in withdraw UI).
363
+ */
328
364
  interface preLaunchReceipt {
329
365
  tokenId: bigint;
330
366
  receipt: {
@@ -341,13 +377,11 @@ interface ClaimedEvent {
341
377
  user: string;
342
378
  amount: BigNumber;
343
379
  }
344
- interface WithdrawReceipt {
345
- tokenId: bigint;
346
- receipt: {
347
- ethAmount: BigNumber;
348
- ethBalance: BalanceView;
349
- readyAt: number;
350
- };
380
+ type WithdrawReceipt = WithdrawReceipt$1;
381
+ interface ValidatorDepositedEvent {
382
+ sender: string;
383
+ amount: BigNumber;
384
+ shares: BigNumber;
351
385
  }
352
386
 
353
387
  type types$1_AddressBook = AddressBook;
@@ -359,6 +393,7 @@ type types$1_DepositResult = DepositResult;
359
393
  type types$1_SharesBurnedEvent = SharesBurnedEvent;
360
394
  type types$1_StakedEvent = StakedEvent;
361
395
  type types$1_StakedResult = StakedResult;
396
+ type types$1_ValidatorDepositedEvent = ValidatorDepositedEvent;
362
397
  type types$1_WithdrawReceipt = WithdrawReceipt;
363
398
  type types$1_WithdrawRequestedEvent = WithdrawRequestedEvent;
364
399
  type types$1_WithdrawResult = WithdrawResult;
@@ -367,7 +402,7 @@ type types$1_WithdrawnStakeResult = WithdrawnStakeResult;
367
402
  type types$1_preLaunchReceipt = preLaunchReceipt;
368
403
  declare namespace types$1 {
369
404
  export { types$1_CONTRACT_NAMES as CONTRACT_NAMES };
370
- export type { types$1_AddressBook as AddressBook, types$1_ClaimedEvent as ClaimedEvent, 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_WithdrawReceipt as WithdrawReceipt, 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 };
405
+ export type { types$1_AddressBook as AddressBook, types$1_ClaimedEvent as ClaimedEvent, 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_ValidatorDepositedEvent as ValidatorDepositedEvent, types$1_WithdrawReceipt as WithdrawReceipt, 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 };
371
406
  }
372
407
 
373
408
  declare const INITIAL_TRANCHE_SUPPLY = 35000;
@@ -382,6 +417,7 @@ declare class EthereumStakingClient implements IStakingClient {
382
417
  private stakeClient;
383
418
  private oppClient;
384
419
  private receiptClient;
420
+ private validatorClient;
385
421
  get contract(): {
386
422
  LiqEthAuthority: ethers.Contract;
387
423
  BeaconState: ethers.Contract;
@@ -428,7 +464,7 @@ declare class EthereumStakingClient implements IStakingClient {
428
464
  * @param amount Amount in wei (or something convertible to BigNumber).
429
465
  * @returns transaction hash
430
466
  */
431
- loadPendingWithdraws(): Promise<WithdrawReceipt[]>;
467
+ getPendingWithdraws(): Promise<WithdrawReceipt[]>;
432
468
  /**
433
469
  * Withdraw native ETH from the liqETH protocol via the liqeth safeBurn function, which burns the LiqETH and adds the user to the withdrawal queue.
434
470
  * @param tokenId The ID of the withdrawal request NFT
@@ -450,6 +486,10 @@ declare class EthereumStakingClient implements IStakingClient {
450
486
  */
451
487
  unstakePrelaunch(tokenId: bigint, recipient: string): Promise<string>;
452
488
  buy(amount: bigint): Promise<string>;
489
+ /**
490
+ * Validator functions
491
+ */
492
+ validatorDeposit(): Promise<string>;
453
493
  /**
454
494
  * Resolve the user's ETH + liqETH balances.
455
495
  *
@@ -1287,6 +1327,24 @@ type ValidatorRecord = {
1287
1327
  */
1288
1328
  bump: number;
1289
1329
  };
1330
+ /**
1331
+ * IDL: `receiptData`
1332
+ *
1333
+ * Withdrawal receipt data structure tracking pending withdrawals.
1334
+ * Each receipt represents a user's request to withdraw liqSOL,
1335
+ * with the withdrawal contingent on sufficient encumbered funds
1336
+ * being available at the serviceable epoch.
1337
+ */
1338
+ type ReceiptData = {
1339
+ /** Unique receipt identifier (monotonically increasing, u64) */
1340
+ receiptId: bigint;
1341
+ /** Amount of liqSOL requested for withdrawal (Token-2022 raw amount, u64) */
1342
+ liqports: bigint;
1343
+ /** Epoch at which this receipt becomes claimable (u64) */
1344
+ epoch: bigint;
1345
+ /** Flag indicating whether this receipt has been fulfilled/claimed (bool) */
1346
+ fulfilled: boolean;
1347
+ };
1290
1348
 
1291
1349
  type types_DistributionState = DistributionState;
1292
1350
  type types_DistributionUserRecord = DistributionUserRecord;
@@ -1300,6 +1358,7 @@ type types_ParsedAccountInfo = ParsedAccountInfo;
1300
1358
  type types_PayRateEntry = PayRateEntry;
1301
1359
  type types_PayRateHistory = PayRateHistory;
1302
1360
  type types_PriceHistory = PriceHistory;
1361
+ type types_ReceiptData = ReceiptData;
1303
1362
  type types_Role = Role;
1304
1363
  type types_SharesPreview = SharesPreview;
1305
1364
  type types_SolanaTransaction = SolanaTransaction;
@@ -1312,7 +1371,7 @@ type types_WalletLike = WalletLike;
1312
1371
  type types_WireReceipt = WireReceipt;
1313
1372
  type types_WireState = WireState;
1314
1373
  declare namespace types {
1315
- 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 };
1374
+ 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_ReceiptData as ReceiptData, 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 };
1316
1375
  }
1317
1376
 
1318
1377
  /**
@@ -15375,7 +15434,14 @@ declare class SolanaProgramService {
15375
15434
  deriveEphemeralStakeAddress(user: PublicKey$1, seed: number): Promise<PublicKey$1>;
15376
15435
  }
15377
15436
 
15378
- declare class DepositClient {
15437
+ /**
15438
+ * ConvertClient (Solana):
15439
+ * - deposit SOL -> liqSOL
15440
+ * - request withdraw (liqSOL burn -> NFT receipt)
15441
+ * - list withdrawal receipts owned by a user
15442
+ * - build claim_withdraw instruction
15443
+ */
15444
+ declare class ConvertClient {
15379
15445
  private readonly provider;
15380
15446
  private readonly pgs;
15381
15447
  private program;
@@ -15383,20 +15449,25 @@ declare class DepositClient {
15383
15449
  get wallet(): WalletLike;
15384
15450
  constructor(provider: AnchorProvider, pgs: SolanaProgramService);
15385
15451
  /**
15386
- * Build a deposit transaction:
15387
- * SOL -> liqSOL via liqsol_core::deposit.
15452
+ * Build a deposit instruction (SOL -> liqSOL).
15388
15453
  */
15389
15454
  buildDepositTx(amount: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
15390
15455
  /**
15391
- * Build a withdraw-request transaction:
15392
- * liqSOL -> SOL via liqsol_core::requestWithdraw.
15393
- *
15394
- * This:
15395
- * - burns liqSOL from the user
15396
- * - increments totalEncumberedFunds in global state
15397
- * - mints an NFT receipt (liqReceiptData + NFT ATA for owner)
15456
+ * Build a withdraw-request instruction (liqSOL burn -> NFT receipt).
15398
15457
  */
15399
15458
  buildWithdrawTx(amount: bigint, user?: PublicKey$1): Promise<TransactionInstruction>;
15459
+ /**
15460
+ * Enumerate withdrawal receipt NFTs owned by `owner`.
15461
+ */
15462
+ fetchWithdrawReceipts(owner: PublicKey$1): Promise<WithdrawReceipt$1[]>;
15463
+ /**
15464
+ * Build the claim_withdraw instruction for a given receiptId.
15465
+ */
15466
+ buildClaimWithdrawTx(receiptId: bigint, user: PublicKey$1): Promise<TransactionInstruction>;
15467
+ /**
15468
+ * Estimate ready time for target epoch using recent slot time.
15469
+ */
15470
+ private estimateEpochEta;
15400
15471
  }
15401
15472
 
15402
15473
  /**
@@ -15605,6 +15676,7 @@ interface ScheduleConfig {
15605
15676
  late?: number;
15606
15677
  }
15607
15678
  declare function ceilDiv(n: BN, d: BN): BN;
15679
+ declare function normalizeToBigInt(x: any): bigint;
15608
15680
 
15609
15681
  /**
15610
15682
  * OutpostClient
@@ -15747,7 +15819,7 @@ declare class SolanaStakingClient implements IStakingClient {
15747
15819
  pubKey?: PublicKey;
15748
15820
  connection: Connection;
15749
15821
  anchor: AnchorProvider;
15750
- depositClient: DepositClient;
15822
+ convertClient: ConvertClient;
15751
15823
  distributionClient: DistributionClient;
15752
15824
  leaderboardClient: LeaderboardClient;
15753
15825
  outpostClient: OutpostClient;
@@ -15776,6 +15848,15 @@ declare class SolanaStakingClient implements IStakingClient {
15776
15848
  * Actual SOL payout happens later via the operator-side flow.
15777
15849
  */
15778
15850
  withdraw(amountLamports: bigint): Promise<string>;
15851
+ /**
15852
+ * Enumerate withdrawal receipt NFTs held by the user (queued/ready/claimed).
15853
+ * Mirrors the ETH getPendingWithdraws helper for UI parity.
15854
+ */
15855
+ getPendingWithdraws(): Promise<WithdrawReceipt$1[]>;
15856
+ /**
15857
+ * Claim a withdrawal receipt (burn NFT + receive SOL) via claim_withdraw.
15858
+ */
15859
+ claimWithdraw(tokenId: bigint): Promise<string>;
15779
15860
  /**
15780
15861
  * Stake liqSOL into Outpost (liqSOL → pool) via liqsol_core::synd.
15781
15862
  */
@@ -15911,5 +15992,5 @@ declare class SolanaStakingClient implements IStakingClient {
15911
15992
  private getSingleTxFeeLamports;
15912
15993
  }
15913
15994
 
15914
- export { ADDRESSES, ADDRESS_BOOK_BY_CHAIN, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS_BY_CHAIN, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, HOODI_ADDRESSES, INDEX_SCALE, INITIAL_TRANCHE_SUPPLY, LAMPORTS_PER_SOL, LeaderboardClient, MAINNET_ADDRESSES, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS_BY_CHAIN, PurchaseAsset, ReceiptNFTKind, SCALE, types as SOL, SolanaStakingClient, Staker, SupportedEvmChainID, SupportedSolChainID, TokenClient, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, ceilDiv, deriveEphemeralStakeAddress, generateRandomDepositAmount, generateTestKeypair, getEpochSnapshot, getErrorMessage, getProgramIds, lamportsToSol, msToEpochEnd, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
15915
- export type { BalanceView, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, SolanaProgramIds, SquadsXConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, YieldView };
15995
+ export { ADDRESSES, ADDRESS_BOOK_BY_CHAIN, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS_BY_CHAIN, ConvertClient, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, HOODI_ADDRESSES, INDEX_SCALE, INITIAL_TRANCHE_SUPPLY, LAMPORTS_PER_SOL, LeaderboardClient, MAINNET_ADDRESSES, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS_BY_CHAIN, PurchaseAsset, ReceiptNFTKind, SCALE, types as SOL, SolanaStakingClient, Staker, SupportedEvmChainID, SupportedSolChainID, TokenClient, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, ceilDiv, deriveEphemeralStakeAddress, generateRandomDepositAmount, generateTestKeypair, getEpochSnapshot, getErrorMessage, getProgramIds, lamportsToSol, msToEpochEnd, normalizeToBigInt, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
15996
+ export type { BalanceView, ChainSymbol, ContractConfig, ContractOptions, Contracts, EpochSnapshot, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, SolanaProgramIds, SquadsXConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, WithdrawReceipt$1 as WithdrawReceipt, WithdrawStatus, YieldView };