@wireio/stake 2.4.3 → 2.4.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
@@ -46,7 +46,7 @@ interface IStakingClient {
46
46
  /** Enumerate withdrawal receipt NFTs held by the user (queued/ready/claimed). */
47
47
  getPendingWithdraws(address?: string): Promise<WithdrawReceipt$1[]>;
48
48
  /** Fetch the complete user portfolio */
49
- getPortfolio(): Promise<Portfolio | null>;
49
+ getPortfolio(address?: string): Promise<Portfolio | null>;
50
50
  getSystemAPY(): Promise<number>;
51
51
  /**
52
52
  * Program-level prelaunch WIRE/tranche snapshot for this chain.
@@ -505,7 +505,7 @@ declare class EthereumStakingClient implements IStakingClient {
505
505
  * actual = liqETH token balance (ERC-20)
506
506
  * tracked = liqETH tracked balance (protocol/accounting view)
507
507
  */
508
- getPortfolio(): Promise<Portfolio | null>;
508
+ getPortfolio(address?: string): Promise<Portfolio | null>;
509
509
  /**
510
510
  * ETH Prelaunch function to list the Stake ReceiptNFTs owned by a specific user
511
511
  * @param address address to query the receipts for
@@ -16868,7 +16868,7 @@ declare class SolanaStakingClient implements IStakingClient {
16868
16868
  * - yield: on-chain index/shares plus an estimated accrued liqSOL yield
16869
16869
  * - extras: useful internal addresses and raw state for debugging/UX
16870
16870
  */
16871
- getPortfolio(): Promise<Portfolio>;
16871
+ getPortfolio(address?: string): Promise<Portfolio>;
16872
16872
  /**
16873
16873
  * Convenience helper to fetch the distribution userRecord for the current user.
16874
16874
  * Used by balance-correction flows and debugging.
package/lib/stake.js CHANGED
@@ -16169,10 +16169,12 @@ let ConvertClient$1 = class ConvertClient {
16169
16169
  }
16170
16170
  let slotTimeSec = 0.4;
16171
16171
  try {
16172
- const samples = yield conn.getRecentPerformanceSamples(1);
16172
+ const samples = yield conn.getRecentPerformanceSamples(60);
16173
16173
  if (samples == null ? void 0 : samples.length) {
16174
- const s = samples[0];
16175
- slotTimeSec = s.numSlots > 0 ? s.samplePeriodSecs / s.numSlots : slotTimeSec;
16174
+ const valid = samples.filter((s) => s.numSlots > 0);
16175
+ if (valid.length) {
16176
+ slotTimeSec = valid.reduce((sum, s) => sum + s.samplePeriodSecs / s.numSlots, 0) / valid.length;
16177
+ }
16176
16178
  }
16177
16179
  } catch (_) {
16178
16180
  }
@@ -17382,11 +17384,11 @@ const _SolanaStakingClient = class _SolanaStakingClient {
17382
17384
  }
17383
17385
  });
17384
17386
  }
17385
- getPortfolio() {
17387
+ getPortfolio(address) {
17386
17388
  return __async$9(this, null, function* () {
17387
17389
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
17388
17390
  try {
17389
- const user = !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
17391
+ const user = address ? new web3_js.PublicKey(address) : !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
17390
17392
  const reservePoolPDA = this.program.deriveReservePoolPda();
17391
17393
  const vaultPDA = this.program.deriveVaultPda();
17392
17394
  const liqsolMint = this.program.deriveLiqsolMintPda();
@@ -43364,12 +43366,12 @@ class EthereumStakingClient {
43364
43366
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
43365
43367
  });
43366
43368
  }
43367
- getPortfolio() {
43369
+ getPortfolio(address) {
43368
43370
  return __async(this, null, function* () {
43369
43371
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
43370
43372
  try {
43371
43373
  if (!this.signer) return Promise.resolve(null);
43372
- const walletAddress = yield this.address;
43374
+ const walletAddress = address != null ? address : yield this.address;
43373
43375
  const nativeBalance = yield this.provider.getBalance(walletAddress);
43374
43376
  const nativeDecimals = (_c = (_b = (_a = this.network) == null ? void 0 : _a.nativeCurrency) == null ? void 0 : _b.decimals) != null ? _c : 18;
43375
43377
  const nativeSymbol = (_f = (_e = (_d = this.network) == null ? void 0 : _d.nativeCurrency) == null ? void 0 : _e.symbol) != null ? _f : "ETH";