@wireio/stake 1.9.69 → 1.11.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireio/stake",
3
- "version": "1.9.69",
3
+ "version": "1.11.69",
4
4
  "description": "LIQ Staking Module for Wire Network",
5
5
  "homepage": "https://gitea.gitgo.app/Wire/sdk-stake",
6
6
  "license": "FSL-1.1-Apache-2.0",
@@ -54,7 +54,7 @@ export class ConvertClient {
54
54
  amount: bigint,
55
55
  user = this.wallet.publicKey,
56
56
  ): Promise<TransactionInstruction> {
57
- const program: any = this.program;
57
+ const program = this.program;
58
58
  if (!user) throw new Error('ConvertClient.buildDepositTx: wallet not connected');
59
59
  if (!amount || amount <= BigInt(0))
60
60
  throw new Error('ConvertClient.buildDepositTx: amount must be greater than zero.');
@@ -118,7 +118,7 @@ export class ConvertClient {
118
118
  async buildRegisterUserIx(
119
119
  user = this.wallet.publicKey,
120
120
  ): Promise<TransactionInstruction> {
121
- const program: any = this.program;
121
+ const program = this.program;
122
122
  if (!user) throw new Error('ConvertClient.buildRegisterUserIx: wallet not connected');
123
123
 
124
124
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
@@ -154,7 +154,7 @@ export class ConvertClient {
154
154
  amount: bigint,
155
155
  user = this.wallet.publicKey,
156
156
  ): Promise<TransactionInstruction> {
157
- const program: any = this.program;
157
+ const program = this.program;
158
158
  if (!user) throw new Error('ConvertClient.buildWithdrawTx: wallet not connected');
159
159
  if (!amount || amount <= BigInt(0))
160
160
  throw new Error('ConvertClient.buildWithdrawTx: amount must be greater than zero.');
@@ -225,7 +225,7 @@ export class ConvertClient {
225
225
  * Enumerate withdrawal receipt NFTs owned by `owner`.
226
226
  */
227
227
  async fetchWithdrawReceipts(owner: PublicKey): Promise<WithdrawReceipt[]> {
228
- const program: any = this.program;
228
+ const program = this.program;
229
229
  const globalPda = this.pgs.deriveWithdrawGlobalPda();
230
230
  const globalAcct: GlobalAccount = await program.account.global.fetch(globalPda);
231
231
  const nextId = normalizeToBigInt(globalAcct.nextReceiptId);
@@ -243,7 +243,7 @@ export class ConvertClient {
243
243
  const receipts: WithdrawReceipt[] = [];
244
244
 
245
245
  for (const { pubkey, account } of tokenAccounts.value) {
246
- const info: any = account.data?.['parsed']?.info;
246
+ const info = account.data?.['parsed']?.info;
247
247
  if (!info) continue;
248
248
  const amount = info.tokenAmount;
249
249
  const decimals = Number(amount?.decimals ?? 0);
@@ -305,7 +305,7 @@ export class ConvertClient {
305
305
  receiptId: bigint,
306
306
  user: PublicKey,
307
307
  ): Promise<TransactionInstruction> {
308
- const program: any = this.program;
308
+ const program = this.program;
309
309
  const mintAccount = this.pgs.deriveWithdrawNftMintPda(receiptId);
310
310
  const receiptData = this.pgs.deriveLiqReceiptDataPda(mintAccount);
311
311
  const ownerAta = getAssociatedTokenAddressSync(
@@ -56,7 +56,7 @@ export class DistributionClient {
56
56
  */
57
57
  async getDistributionState(): Promise<DistributionState | null> {
58
58
  const pda = this.pgs.deriveDistributionStatePda();
59
- const program: any = this.program;
59
+ const program = this.program;
60
60
  try {
61
61
  return await program.account.distributionState.fetch(pda);
62
62
  } catch {
@@ -72,7 +72,7 @@ export class DistributionClient {
72
72
  */
73
73
  async getPayRateHistory(): Promise<PayRateHistory | null> {
74
74
  const pda = this.pgs.derivePayRateHistoryPda();
75
- const program: any = this.program;
75
+ const program = this.program;
76
76
  try {
77
77
  // Anchor types map directly onto our PayRateHistory TS type
78
78
  return (await program.account.payRateHistory.fetch(
@@ -90,7 +90,7 @@ export class DistributionClient {
90
90
  */
91
91
  async getGlobalConfig(): Promise<GlobalConfig | null> {
92
92
  const pda = this.pgs.deriveGlobalConfigPda();
93
- const program: any = this.program;
93
+ const program = this.program;
94
94
  try {
95
95
  return (await program.account.globalConfig.fetch(
96
96
  pda,
@@ -107,7 +107,7 @@ export class DistributionClient {
107
107
  async getUserRecord(
108
108
  ownerOrAta: PublicKey,
109
109
  ): Promise<DistributionUserRecord | null> {
110
- const program: any = this.program;
110
+ const program = this.program;
111
111
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
112
112
 
113
113
  // 1) Try treating ownerOrAta as a WALLET: derive its liqSOL ATA, then userRecord.
@@ -237,7 +237,7 @@ export class DistributionClient {
237
237
  * Build claim_rewards instruction for a wallet.
238
238
  */
239
239
  async buildClaimRewardsIx(user: PublicKey): Promise<TransactionInstruction> {
240
- const program: any = this.program;
240
+ const program = this.program;
241
241
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
242
242
  const distributionState = this.pgs.deriveDistributionStatePda();
243
243
  const bucketAuthority = this.pgs.deriveBucketAuthorityPda();
@@ -301,7 +301,7 @@ export class DistributionClient {
301
301
  ? history.maxEntries
302
302
  : entries.length;
303
303
 
304
- const rawTotalAdded: any = history.totalEntriesAdded ?? 0;
304
+ const rawTotalAdded = history.totalEntriesAdded ?? 0;
305
305
  const totalAddedBn = new BN(rawTotalAdded.toString());
306
306
 
307
307
  // No valid entries written yet
@@ -334,7 +334,7 @@ export class DistributionClient {
334
334
  const zero = new BN(0);
335
335
 
336
336
  for (let i = 0; i < COUNT; i++) {
337
- const entry: any = entries[idx];
337
+ const entry : any = entries[idx];
338
338
  if (entry) {
339
339
  // Support both camelCase and snake_case (for safety)
340
340
  const rawScaled =
@@ -97,7 +97,7 @@ export class SolanaInstaswapClient {
97
97
  params: SolanaInstaswapSubmitParams,
98
98
  hooks?: SolanaInstaswapSubmitHooks,
99
99
  ): Promise<string> {
100
- const program: any = this.program;
100
+ const program = this.program;
101
101
  const user = this.provider.wallet.publicKey;
102
102
  if (!user) {
103
103
  throw new Error('Connect a Solana wallet first.');
@@ -290,7 +290,7 @@ export class SolanaInstaswapClient {
290
290
  }
291
291
 
292
292
  private async finalizeReadyEpoch(force = false): Promise<boolean> {
293
- const program: any = this.program;
293
+ const program = this.program;
294
294
  const epochNumber = await this.pgs.fetchOppEpochNumber(this.provider.connection);
295
295
  const pendingAttestations = await this.fetchPendingAttestations(epochNumber);
296
296
  const attestations = pendingAttestations?.list ?? [];
@@ -361,7 +361,7 @@ export class SolanaInstaswapClient {
361
361
  }
362
362
 
363
363
  private async fetchPendingAttestations(epochNumber: number): Promise<any | null> {
364
- const program: any = this.program;
364
+ const program = this.program;
365
365
  try {
366
366
  return await program.account.pendingAttestations.fetch(
367
367
  this.pgs.derivePendingAttestationsPda(epochNumber),
@@ -142,7 +142,7 @@ export class OutpostClient {
142
142
  * coder decode the padded buffer.
143
143
  */
144
144
  private async fetchOutpostAccount(address: PublicKey) {
145
- const program: any = this.program;
145
+ const program = this.program;
146
146
  try {
147
147
  return await program.account.outpostAccount.fetchNullable(address);
148
148
  } catch (e) {
@@ -169,7 +169,7 @@ export class OutpostClient {
169
169
  * Fetch the core "Wire state" for Outpost / pretokens for a given user.
170
170
  */
171
171
  async fetchWireState(user?: PublicKey): Promise<OutpostWireStateSnapshot> {
172
- const program: any = this.program;
172
+ const program = this.program;
173
173
  const userPk = user ?? this.wallet.publicKey;
174
174
  if (!userPk) throw new Error('OutpostClient.fetchWireState: wallet not connected');
175
175
 
@@ -222,7 +222,7 @@ export class OutpostClient {
222
222
  user: PublicKey = this.wallet.publicKey,
223
223
  wireAccount?: string,
224
224
  ): Promise<TransactionInstruction> {
225
- const program: any = this.program;
225
+ const program = this.program;
226
226
  if (!user) {
227
227
  throw new Error('OutpostClient.buildStakeIx: wallet not connected');
228
228
  }
@@ -260,7 +260,7 @@ export class OutpostClient {
260
260
  amountLamports: bigint,
261
261
  user?: PublicKey,
262
262
  ): Promise<TransactionInstruction> {
263
- const program: any = this.program;
263
+ const program = this.program;
264
264
  const userPk = user ?? this.wallet.publicKey;
265
265
  if (!userPk) {
266
266
  throw new Error('OutpostClient.buildUnstakeIx: wallet not connected');
@@ -54,13 +54,13 @@ export class TokenClient {
54
54
  }
55
55
 
56
56
  async fetchGlobalState(): Promise<GlobalState> {
57
- const program: any = this.program;
57
+ const program = this.program;
58
58
  const { globalState } = await this.getAccounts(this.wallet.publicKey);
59
59
  return program.account.globalState.fetch(globalState);
60
60
  }
61
61
 
62
62
  async fetchTrancheState(): Promise<TrancheState> {
63
- const program: any = this.program;
63
+ const program = this.program;
64
64
  const { trancheState } = await this.getAccounts(this.wallet.publicKey);
65
65
  return program.account.trancheState.fetch(trancheState);
66
66
  }
@@ -70,7 +70,7 @@ export class TokenClient {
70
70
  * Returns null if the user has never interacted with Outpost.
71
71
  */
72
72
  async fetchOutpostAccount(user: PublicKey): Promise<OutpostAccount | null> {
73
- const program: any = this.program;
73
+ const program = this.program;
74
74
  const { outpostAccount } = await this.getAccounts(user);
75
75
  return program.account.outpostAccount.fetchNullable(outpostAccount);
76
76
  }
@@ -82,7 +82,7 @@ export class TokenClient {
82
82
  async fetchUserPretokenRecord(
83
83
  user: PublicKey,
84
84
  ): Promise<UserPretokenRecord | null> {
85
- const program: any = this.program;
85
+ const program = this.program;
86
86
  const { userPretokenRecord } = await this.getAccounts(user);
87
87
  return program.account.userPretokenRecord.fetchNullable(
88
88
  userPretokenRecord,
@@ -103,7 +103,7 @@ export class TokenClient {
103
103
  amountLamports: bigint,
104
104
  user = this.wallet.publicKey,
105
105
  ): Promise<TransactionInstruction> {
106
- const program: any = this.program;
106
+ const program = this.program;
107
107
  console.log('build purchase for', user.toBase58());
108
108
 
109
109
  const a = await this.getAccounts(user);
@@ -187,7 +187,7 @@ export class TokenClient {
187
187
  * Uses the ring-buffer semantics from capital-staking.
188
188
  */
189
189
  async getSolPriceUsd(): Promise<bigint> {
190
- const program: any = this.program;
190
+ const program = this.program;
191
191
  const priceHistoryPda = this.pgs.derivePriceHistoryPda();
192
192
  const history = (await program.account.priceHistory.fetch(
193
193
  priceHistoryPda,
@@ -37,7 +37,7 @@ const DEVNET_PROGRAM_IDS: SolanaProgramIds = {
37
37
  LIQSOL_TOKEN: new PublicKey(devnetLiqSolTokenIDL.address),
38
38
  VALIDATOR_LEADERBOARD: new PublicKey(devnetValidatorLeaderboardIDL.address),
39
39
  TRANSFER_HOOK: new PublicKey(devnetTransferHookIDL.address),
40
- ALT: new PublicKey("EG5pouZneDQxfw5coaWkkv5qeoJkRsgyMiq4r6bw7K2F")
40
+ ALT: new PublicKey("9WhQt82Ym5LDDaGEB6eV86MUV6BtUxZQbw1R4uuhVPSt")
41
41
  };
42
42
 
43
43
  export const PROGRAM_IDS_BY_CHAIN: Record<SupportedSolChainID, SolanaProgramIds> = {