@wireio/stake 2.5.0 → 2.5.1
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 +17 -9
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +8 -0
- package/lib/stake.js +27 -17
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +17 -9
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/networks/solana/clients/outpost.client.ts +31 -1
- package/src/networks/solana/solana.ts +0 -9
package/lib/stake.browser.js
CHANGED
|
@@ -16380,6 +16380,22 @@ class OutpostClient {
|
|
|
16380
16380
|
const bal = await this.connection.getTokenAccountBalance(ata);
|
|
16381
16381
|
return new BN(bal.value.amount);
|
|
16382
16382
|
}
|
|
16383
|
+
async fetchOutpostAccount(address) {
|
|
16384
|
+
try {
|
|
16385
|
+
return await this.program.account.outpostAccount.fetchNullable(address);
|
|
16386
|
+
} catch (e) {
|
|
16387
|
+
if (!(e instanceof RangeError)) throw e;
|
|
16388
|
+
const info = await this.connection.getAccountInfo(address);
|
|
16389
|
+
if (!info) return null;
|
|
16390
|
+
const EXPECTED_SIZE = info.data.length + 3;
|
|
16391
|
+
const padded = Buffer.alloc(EXPECTED_SIZE);
|
|
16392
|
+
info.data.copy(padded);
|
|
16393
|
+
return this.program.coder.accounts.decode(
|
|
16394
|
+
"outpostAccount",
|
|
16395
|
+
padded
|
|
16396
|
+
);
|
|
16397
|
+
}
|
|
16398
|
+
}
|
|
16383
16399
|
async fetchWireState(user) {
|
|
16384
16400
|
const userPk = user ?? this.wallet.publicKey;
|
|
16385
16401
|
if (!userPk) throw new Error("OutpostClient.fetchWireState: wallet not connected");
|
|
@@ -16394,7 +16410,7 @@ class OutpostClient {
|
|
|
16394
16410
|
userLiqsolBalance
|
|
16395
16411
|
] = await Promise.all([
|
|
16396
16412
|
safeFetch(this.program.account.globalState.fetch(pdas.globalState), "globalState"),
|
|
16397
|
-
safeFetch(this.
|
|
16413
|
+
safeFetch(this.fetchOutpostAccount(pdas.outpostAccount), "outpostAccount"),
|
|
16398
16414
|
safeFetch(this.program.account.distributionState.fetchNullable(pdas.distributionState), "distributionState"),
|
|
16399
16415
|
safeFetch(this.program.account.userPretokenRecord.fetchNullable(pdas.userPretokenRecord), "userPretokenRecord"),
|
|
16400
16416
|
safeFetch(this.program.account.trancheState.fetchNullable(pdas.trancheState), "trancheState"),
|
|
@@ -17077,14 +17093,6 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
17077
17093
|
const userPretokenRecord = snapshot?.userPretokenRecord ?? null;
|
|
17078
17094
|
const stakedLiqsolStr = outpostAccount?.stakedLiqsol?.toString?.() ?? "0";
|
|
17079
17095
|
const wirePretokensStr = userPretokenRecord?.totalPretokensPurchased?.toString?.() ?? "0";
|
|
17080
|
-
console.log("userPretokenRecord", userPretokenRecord);
|
|
17081
|
-
console.log("address", address);
|
|
17082
|
-
console.log("userPretokenRecord?.totalPretokensPurchased?.toString", userPretokenRecord?.totalPretokensPurchased?.toString);
|
|
17083
|
-
if (userPretokenRecord) {
|
|
17084
|
-
for (const [key, value] of Object.entries(userPretokenRecord)) {
|
|
17085
|
-
console.log(`userPretokenRecord.${key}: ${value?.toString?.() ?? value}`);
|
|
17086
|
-
}
|
|
17087
|
-
}
|
|
17088
17096
|
const currentIndexStr = globalState?.currentIndex?.toString?.() ?? "0";
|
|
17089
17097
|
const totalSharesStr = globalState?.totalShares?.toString?.() ?? "0";
|
|
17090
17098
|
const userSharesStr = outpostAccount?.stakedShares?.toString?.() ?? "0";
|