@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.
- package/lib/stake.browser.js +13 -11
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +6 -6
- package/lib/stake.js +13 -11
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +13 -11
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/networks/ethereum/ethereum.ts +5 -6
- package/src/networks/solana/clients/convert.client.ts +5 -3
- package/src/networks/solana/solana.ts +6 -4
- package/src/types.ts +2 -2
package/package.json
CHANGED
|
@@ -107,11 +107,10 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
107
107
|
* @param amount Amount in wei (or something convertible to BigNumber).
|
|
108
108
|
* @returns transaction hash
|
|
109
109
|
*/
|
|
110
|
-
async getPendingWithdraws(): Promise<WithdrawReceipt[]> {
|
|
110
|
+
async getPendingWithdraws(address?: string): Promise<WithdrawReceipt[]> {
|
|
111
111
|
this.ensureUser();
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
return await this.receiptClient.fetchWithdrawReceipts(address);
|
|
112
|
+
const owner = address ?? await this.address!;
|
|
113
|
+
return await this.receiptClient.fetchWithdrawReceipts(owner);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
/**
|
|
@@ -203,12 +202,12 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
203
202
|
* actual = liqETH token balance (ERC-20)
|
|
204
203
|
* tracked = liqETH tracked balance (protocol/accounting view)
|
|
205
204
|
*/
|
|
206
|
-
async getPortfolio(): Promise<Portfolio | null> {
|
|
205
|
+
async getPortfolio(address?: string): Promise<Portfolio | null> {
|
|
207
206
|
|
|
208
207
|
try {
|
|
209
208
|
if (!this.signer) return Promise.resolve(null);
|
|
210
209
|
|
|
211
|
-
const walletAddress = await this.address!;
|
|
210
|
+
const walletAddress = address ?? await this.address!;
|
|
212
211
|
|
|
213
212
|
// 1) Native ETH balance
|
|
214
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
|
|
@@ -274,9 +274,10 @@ export class SolanaStakingClient implements IStakingClient {
|
|
|
274
274
|
* Enumerate withdrawal receipt NFTs held by the user (queued/ready/claimed).
|
|
275
275
|
* Mirrors the ETH getPendingWithdraws helper for UI parity.
|
|
276
276
|
*/
|
|
277
|
-
async getPendingWithdraws(address?:
|
|
277
|
+
async getPendingWithdraws(address?: string): Promise<WithdrawReceipt[]> {
|
|
278
278
|
this.ensureUser();
|
|
279
|
-
const owner = address
|
|
279
|
+
const owner = address ? new SolPubKey(address) :
|
|
280
|
+
this.squadsVaultPDA ?? this.anchor.wallet.publicKey;
|
|
280
281
|
return await this.convertClient.fetchWithdrawReceipts(owner);
|
|
281
282
|
}
|
|
282
283
|
|
|
@@ -388,10 +389,11 @@ export class SolanaStakingClient implements IStakingClient {
|
|
|
388
389
|
* - yield: on-chain index/shares plus an estimated accrued liqSOL yield
|
|
389
390
|
* - extras: useful internal addresses and raw state for debugging/UX
|
|
390
391
|
*/
|
|
391
|
-
async getPortfolio(): Promise<Portfolio> {
|
|
392
|
+
async getPortfolio(address?: string): Promise<Portfolio> {
|
|
392
393
|
// if (!this.pubKey) throw new Error('User pubKey is undefined');
|
|
393
394
|
try {
|
|
394
|
-
const user =
|
|
395
|
+
const user = address ? new SolPubKey(address) :
|
|
396
|
+
!!this.squadsX ? this.squadsVaultPDA! : this.solPubKey;
|
|
395
397
|
|
|
396
398
|
const reservePoolPDA = this.program.deriveReservePoolPda();
|
|
397
399
|
const vaultPDA = this.program.deriveVaultPda();
|
package/src/types.ts
CHANGED
|
@@ -47,10 +47,10 @@ export interface IStakingClient {
|
|
|
47
47
|
claimLiqsolRewards?(): Promise<string>
|
|
48
48
|
|
|
49
49
|
/** Enumerate withdrawal receipt NFTs held by the user (queued/ready/claimed). */
|
|
50
|
-
getPendingWithdraws(): Promise<WithdrawReceipt[]>
|
|
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>;
|