@wireio/stake 2.4.2 → 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.
@@ -16062,10 +16062,12 @@ let ConvertClient$1 = class ConvertClient {
16062
16062
  }
16063
16063
  let slotTimeSec = 0.4;
16064
16064
  try {
16065
- const samples = await conn.getRecentPerformanceSamples(1);
16065
+ const samples = await conn.getRecentPerformanceSamples(60);
16066
16066
  if (samples?.length) {
16067
- const s = samples[0];
16068
- slotTimeSec = s.numSlots > 0 ? s.samplePeriodSecs / s.numSlots : slotTimeSec;
16067
+ const valid = samples.filter((s) => s.numSlots > 0);
16068
+ if (valid.length) {
16069
+ slotTimeSec = valid.reduce((sum, s) => sum + s.samplePeriodSecs / s.numSlots, 0) / valid.length;
16070
+ }
16069
16071
  }
16070
16072
  } catch (_) {
16071
16073
  }
@@ -16990,7 +16992,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
16990
16992
  }
16991
16993
  async getPendingWithdraws(address) {
16992
16994
  this.ensureUser();
16993
- const owner = address ?? this.squadsVaultPDA ?? this.anchor.wallet.publicKey;
16995
+ const owner = address ? new PublicKey(address) : this.squadsVaultPDA ?? this.anchor.wallet.publicKey;
16994
16996
  return await this.convertClient.fetchWithdrawReceipts(owner);
16995
16997
  }
16996
16998
  async claimWithdraw(tokenId) {
@@ -17051,9 +17053,9 @@ const _SolanaStakingClient = class _SolanaStakingClient {
17051
17053
  throw err;
17052
17054
  }
17053
17055
  }
17054
- async getPortfolio() {
17056
+ async getPortfolio(address) {
17055
17057
  try {
17056
- const user = !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
17058
+ const user = address ? new PublicKey(address) : !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
17057
17059
  const reservePoolPDA = this.program.deriveReservePoolPda();
17058
17060
  const vaultPDA = this.program.deriveVaultPda();
17059
17061
  const liqsolMint = this.program.deriveLiqsolMintPda();
@@ -42700,10 +42702,10 @@ class EthereumStakingClient {
42700
42702
  const result = await this.convertClient.performWithdraw(address, amountWei);
42701
42703
  return result.txHash;
42702
42704
  }
42703
- async getPendingWithdraws() {
42705
+ async getPendingWithdraws(address) {
42704
42706
  this.ensureUser();
42705
- const address = await this.address;
42706
- return await this.receiptClient.fetchWithdrawReceipts(address);
42707
+ const owner = address ?? await this.address;
42708
+ return await this.receiptClient.fetchWithdrawReceipts(owner);
42707
42709
  }
42708
42710
  async claimWithdraw(tokenId) {
42709
42711
  this.ensureUser();
@@ -42738,10 +42740,10 @@ class EthereumStakingClient {
42738
42740
  let result = await this.validatorClient.validatorDepositAndLockBond();
42739
42741
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
42740
42742
  }
42741
- async getPortfolio() {
42743
+ async getPortfolio(address) {
42742
42744
  try {
42743
42745
  if (!this.signer) return Promise.resolve(null);
42744
- const walletAddress = await this.address;
42746
+ const walletAddress = address ?? await this.address;
42745
42747
  const nativeBalance = await this.provider.getBalance(walletAddress);
42746
42748
  const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
42747
42749
  const nativeSymbol = this.network?.nativeCurrency?.symbol ?? "ETH";