@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.browser.js +9 -7
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +3 -3
- package/lib/stake.js +9 -7
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +9 -7
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/networks/ethereum/ethereum.ts +2 -2
- package/src/networks/solana/clients/convert.client.ts +5 -3
- package/src/networks/solana/solana.ts +3 -2
- package/src/types.ts +1 -1
package/package.json
CHANGED
|
@@ -202,12 +202,12 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
202
202
|
* actual = liqETH token balance (ERC-20)
|
|
203
203
|
* tracked = liqETH tracked balance (protocol/accounting view)
|
|
204
204
|
*/
|
|
205
|
-
async getPortfolio(): Promise<Portfolio | null> {
|
|
205
|
+
async getPortfolio(address?: string): Promise<Portfolio | null> {
|
|
206
206
|
|
|
207
207
|
try {
|
|
208
208
|
if (!this.signer) return Promise.resolve(null);
|
|
209
209
|
|
|
210
|
-
const walletAddress = await this.address!;
|
|
210
|
+
const walletAddress = address ?? await this.address!;
|
|
211
211
|
|
|
212
212
|
// 1) Native ETH balance
|
|
213
213
|
const nativeBalance = await this.provider.getBalance(walletAddress);
|
|
@@ -316,10 +316,12 @@ export class ConvertClient {
|
|
|
316
316
|
|
|
317
317
|
let slotTimeSec = 0.4;
|
|
318
318
|
try {
|
|
319
|
-
const samples = await conn.getRecentPerformanceSamples(
|
|
319
|
+
const samples = await conn.getRecentPerformanceSamples(60);
|
|
320
320
|
if (samples?.length) {
|
|
321
|
-
const
|
|
322
|
-
|
|
321
|
+
const valid = samples.filter(s => s.numSlots > 0);
|
|
322
|
+
if (valid.length) {
|
|
323
|
+
slotTimeSec = valid.reduce((sum, s) => sum + s.samplePeriodSecs / s.numSlots, 0) / valid.length;
|
|
324
|
+
}
|
|
323
325
|
}
|
|
324
326
|
} catch (_) {
|
|
325
327
|
// ignore
|
|
@@ -389,10 +389,11 @@ export class SolanaStakingClient implements IStakingClient {
|
|
|
389
389
|
* - yield: on-chain index/shares plus an estimated accrued liqSOL yield
|
|
390
390
|
* - extras: useful internal addresses and raw state for debugging/UX
|
|
391
391
|
*/
|
|
392
|
-
async getPortfolio(): Promise<Portfolio> {
|
|
392
|
+
async getPortfolio(address?: string): Promise<Portfolio> {
|
|
393
393
|
// if (!this.pubKey) throw new Error('User pubKey is undefined');
|
|
394
394
|
try {
|
|
395
|
-
const user =
|
|
395
|
+
const user = address ? new SolPubKey(address) :
|
|
396
|
+
!!this.squadsX ? this.squadsVaultPDA! : this.solPubKey;
|
|
396
397
|
|
|
397
398
|
const reservePoolPDA = this.program.deriveReservePoolPda();
|
|
398
399
|
const vaultPDA = this.program.deriveVaultPda();
|
package/src/types.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface IStakingClient {
|
|
|
50
50
|
getPendingWithdraws(address?: string): Promise<WithdrawReceipt[]>
|
|
51
51
|
|
|
52
52
|
/** Fetch the complete user portfolio */
|
|
53
|
-
getPortfolio(): Promise<Portfolio | null>;
|
|
53
|
+
getPortfolio(address?: string): Promise<Portfolio | null>;
|
|
54
54
|
|
|
55
55
|
// Estimated total APY for staking yeild
|
|
56
56
|
getSystemAPY(): Promise<number>;
|