@wireio/stake 2.2.1 → 2.2.2
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 +41 -0
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +13 -1
- package/lib/stake.js +161 -95
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +41 -0
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/networks/ethereum/clients/validator.client.ts +61 -0
- package/src/networks/ethereum/ethereum.ts +20 -0
- package/src/networks/ethereum/types.ts +9 -2
- package/src/types.ts +2 -0
package/lib/stake.js
CHANGED
|
@@ -28,7 +28,7 @@ function _interopNamespaceDefault(e) {
|
|
|
28
28
|
var multisig__namespace = /*#__PURE__*/_interopNamespaceDefault(multisig);
|
|
29
29
|
|
|
30
30
|
var __pow = Math.pow;
|
|
31
|
-
var __async$
|
|
31
|
+
var __async$h = (__this, __arguments, generator) => {
|
|
32
32
|
return new Promise((resolve, reject) => {
|
|
33
33
|
var fulfilled = (value) => {
|
|
34
34
|
try {
|
|
@@ -61,7 +61,7 @@ class DepositClient {
|
|
|
61
61
|
return this.provider.wallet;
|
|
62
62
|
}
|
|
63
63
|
buildDepositTx(_0) {
|
|
64
|
-
return __async$
|
|
64
|
+
return __async$h(this, arguments, function* (amount, user = this.wallet.publicKey) {
|
|
65
65
|
if (!user) {
|
|
66
66
|
throw new Error(
|
|
67
67
|
"DepositClient.buildDepositTx: wallet not connected"
|
|
@@ -128,7 +128,7 @@ class DepositClient {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
buildWithdrawTx(_0) {
|
|
131
|
-
return __async$
|
|
131
|
+
return __async$h(this, arguments, function* (amount, user = this.wallet.publicKey) {
|
|
132
132
|
if (!user) {
|
|
133
133
|
throw new Error(
|
|
134
134
|
"DepositClient.buildWithdrawTx: wallet not connected"
|
|
@@ -14638,7 +14638,7 @@ var devnetTransferHookIDL = {
|
|
|
14638
14638
|
types: types$2
|
|
14639
14639
|
};
|
|
14640
14640
|
|
|
14641
|
-
var __async$
|
|
14641
|
+
var __async$g = (__this, __arguments, generator) => {
|
|
14642
14642
|
return new Promise((resolve, reject) => {
|
|
14643
14643
|
var fulfilled = (value) => {
|
|
14644
14644
|
try {
|
|
@@ -14716,7 +14716,7 @@ const PDA_SEEDS = {
|
|
|
14716
14716
|
LIQ_RECEIPT_DATA: "liq_receipt_data",
|
|
14717
14717
|
WITHDRAW_MINT: "mint"
|
|
14718
14718
|
};
|
|
14719
|
-
const deriveEphemeralStakeAddress = (user, seed) => __async$
|
|
14719
|
+
const deriveEphemeralStakeAddress = (user, seed) => __async$g(null, null, function* () {
|
|
14720
14720
|
const seedStr = `ephemeral_${seed}`;
|
|
14721
14721
|
return web3_js.PublicKey.createWithSeed(user, seedStr, web3_js.StakeProgram.programId);
|
|
14722
14722
|
});
|
|
@@ -14735,7 +14735,7 @@ const INDEX_SCALE$1 = BigInt(1e12);
|
|
|
14735
14735
|
const lamportsToSol = (lamports) => Number(lamports) / LAMPORTS_PER_SOL;
|
|
14736
14736
|
const solToLamports = (sol) => BigInt(Math.round(sol * LAMPORTS_PER_SOL));
|
|
14737
14737
|
|
|
14738
|
-
var __async$
|
|
14738
|
+
var __async$f = (__this, __arguments, generator) => {
|
|
14739
14739
|
return new Promise((resolve, reject) => {
|
|
14740
14740
|
var fulfilled = (value) => {
|
|
14741
14741
|
try {
|
|
@@ -14889,7 +14889,7 @@ function buildSolanaTrancheSnapshot(options) {
|
|
|
14889
14889
|
};
|
|
14890
14890
|
}
|
|
14891
14891
|
function buildOutpostAccounts(connection, user, pgs) {
|
|
14892
|
-
return __async$
|
|
14892
|
+
return __async$f(this, null, function* () {
|
|
14893
14893
|
const globalState = pgs.deriveOutpostGlobalStatePda();
|
|
14894
14894
|
const poolAuthority = pgs.deriveOutpostPoolAuthorityPda();
|
|
14895
14895
|
const liqsolMint = pgs.deriveLiqsolMintPda();
|
|
@@ -14954,7 +14954,7 @@ function buildOutpostAccounts(connection, user, pgs) {
|
|
|
14954
14954
|
});
|
|
14955
14955
|
}
|
|
14956
14956
|
function getEpochSnapshot(connection) {
|
|
14957
|
-
return __async$
|
|
14957
|
+
return __async$f(this, null, function* () {
|
|
14958
14958
|
var _a;
|
|
14959
14959
|
const info = yield connection.getEpochInfo();
|
|
14960
14960
|
let slotTimeMs = Number((_a = process.env.SLOT_TIME_MS_FALLBACK) != null ? _a : 400);
|
|
@@ -14985,7 +14985,7 @@ function msToEpochEnd(snapshot) {
|
|
|
14985
14985
|
return remainingSlots * snapshot.slotMs;
|
|
14986
14986
|
}
|
|
14987
14987
|
function scheduledInstruction(connection, config, instruction) {
|
|
14988
|
-
return __async$
|
|
14988
|
+
return __async$f(this, null, function* () {
|
|
14989
14989
|
var _a, _b;
|
|
14990
14990
|
const early = (_a = config.early) != null ? _a : 0.1;
|
|
14991
14991
|
const late = (_b = config.late) != null ? _b : 0.9;
|
|
@@ -15032,14 +15032,14 @@ function generateTestKeypair() {
|
|
|
15032
15032
|
return web3_js.Keypair.generate();
|
|
15033
15033
|
}
|
|
15034
15034
|
function airdropSol(connection, publicKey, amountSol) {
|
|
15035
|
-
return __async$
|
|
15035
|
+
return __async$f(this, null, function* () {
|
|
15036
15036
|
const lamports = solToLamports(amountSol);
|
|
15037
15037
|
const sig = yield connection.requestAirdrop(publicKey, Number(lamports));
|
|
15038
15038
|
yield connection.confirmTransaction(sig, "confirmed");
|
|
15039
15039
|
});
|
|
15040
15040
|
}
|
|
15041
15041
|
function waitForConfirmation(connection, signature) {
|
|
15042
|
-
return __async$
|
|
15042
|
+
return __async$f(this, null, function* () {
|
|
15043
15043
|
yield connection.confirmTransaction(signature, "confirmed");
|
|
15044
15044
|
});
|
|
15045
15045
|
}
|
|
@@ -15047,8 +15047,8 @@ function sleep(ms) {
|
|
|
15047
15047
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
15048
15048
|
}
|
|
15049
15049
|
function waitUntilSafeToExecuteFunction(_0) {
|
|
15050
|
-
return __async$
|
|
15051
|
-
yield scheduledInstruction(connection, config, () => __async$
|
|
15050
|
+
return __async$f(this, arguments, function* (connection, config = {}) {
|
|
15051
|
+
yield scheduledInstruction(connection, config, () => __async$f(null, null, function* () {
|
|
15052
15052
|
return;
|
|
15053
15053
|
}));
|
|
15054
15054
|
});
|
|
@@ -15060,7 +15060,7 @@ function ceilDiv(n, d) {
|
|
|
15060
15060
|
return n.add(d.subn(1)).div(d);
|
|
15061
15061
|
}
|
|
15062
15062
|
|
|
15063
|
-
var __async$
|
|
15063
|
+
var __async$e = (__this, __arguments, generator) => {
|
|
15064
15064
|
return new Promise((resolve, reject) => {
|
|
15065
15065
|
var fulfilled = (value) => {
|
|
15066
15066
|
try {
|
|
@@ -15090,7 +15090,7 @@ class DistributionClient {
|
|
|
15090
15090
|
return this.provider.connection;
|
|
15091
15091
|
}
|
|
15092
15092
|
getDistributionState() {
|
|
15093
|
-
return __async$
|
|
15093
|
+
return __async$e(this, null, function* () {
|
|
15094
15094
|
const pda = this.pgs.deriveDistributionStatePda();
|
|
15095
15095
|
try {
|
|
15096
15096
|
return yield this.program.account.distributionState.fetch(pda);
|
|
@@ -15100,7 +15100,7 @@ class DistributionClient {
|
|
|
15100
15100
|
});
|
|
15101
15101
|
}
|
|
15102
15102
|
getPayRateHistory() {
|
|
15103
|
-
return __async$
|
|
15103
|
+
return __async$e(this, null, function* () {
|
|
15104
15104
|
const pda = this.pgs.derivePayRateHistoryPda();
|
|
15105
15105
|
try {
|
|
15106
15106
|
return yield this.program.account.payRateHistory.fetch(
|
|
@@ -15112,7 +15112,7 @@ class DistributionClient {
|
|
|
15112
15112
|
});
|
|
15113
15113
|
}
|
|
15114
15114
|
getGlobalConfig() {
|
|
15115
|
-
return __async$
|
|
15115
|
+
return __async$e(this, null, function* () {
|
|
15116
15116
|
const pda = this.pgs.deriveGlobalConfigPda();
|
|
15117
15117
|
try {
|
|
15118
15118
|
return yield this.program.account.globalConfig.fetch(
|
|
@@ -15124,7 +15124,7 @@ class DistributionClient {
|
|
|
15124
15124
|
});
|
|
15125
15125
|
}
|
|
15126
15126
|
getUserRecord(ownerOrAta) {
|
|
15127
|
-
return __async$
|
|
15127
|
+
return __async$e(this, null, function* () {
|
|
15128
15128
|
const liqsolMint = this.pgs.deriveLiqsolMintPda();
|
|
15129
15129
|
try {
|
|
15130
15130
|
const ata = splToken.getAssociatedTokenAddressSync(
|
|
@@ -15149,13 +15149,13 @@ class DistributionClient {
|
|
|
15149
15149
|
});
|
|
15150
15150
|
}
|
|
15151
15151
|
getUserShares(user) {
|
|
15152
|
-
return __async$
|
|
15152
|
+
return __async$e(this, null, function* () {
|
|
15153
15153
|
const record = yield this.getUserRecord(user);
|
|
15154
15154
|
return record ? record.shares : new anchor.BN(0);
|
|
15155
15155
|
});
|
|
15156
15156
|
}
|
|
15157
15157
|
getUserSharePosition(user) {
|
|
15158
|
-
return __async$
|
|
15158
|
+
return __async$e(this, null, function* () {
|
|
15159
15159
|
const [dist, userShares] = yield Promise.all([
|
|
15160
15160
|
this.getDistributionState(),
|
|
15161
15161
|
this.getUserShares(user)
|
|
@@ -15169,7 +15169,7 @@ class DistributionClient {
|
|
|
15169
15169
|
});
|
|
15170
15170
|
}
|
|
15171
15171
|
getAverageScaledPayRate(windowSize = 5) {
|
|
15172
|
-
return __async$
|
|
15172
|
+
return __async$e(this, null, function* () {
|
|
15173
15173
|
var _a, _b, _c, _d, _e;
|
|
15174
15174
|
const history = yield this.getPayRateHistory();
|
|
15175
15175
|
if (!history) {
|
|
@@ -15219,7 +15219,7 @@ class DistributionClient {
|
|
|
15219
15219
|
}
|
|
15220
15220
|
}
|
|
15221
15221
|
|
|
15222
|
-
var __async$
|
|
15222
|
+
var __async$d = (__this, __arguments, generator) => {
|
|
15223
15223
|
return new Promise((resolve, reject) => {
|
|
15224
15224
|
var fulfilled = (value) => {
|
|
15225
15225
|
try {
|
|
@@ -15246,7 +15246,7 @@ class LeaderboardClient {
|
|
|
15246
15246
|
this.program = pgs.getProgram("validatorLeaderboard");
|
|
15247
15247
|
}
|
|
15248
15248
|
getState() {
|
|
15249
|
-
return __async$
|
|
15249
|
+
return __async$d(this, null, function* () {
|
|
15250
15250
|
const pda = this.pgs.deriveLeaderboardStatePda();
|
|
15251
15251
|
try {
|
|
15252
15252
|
return yield this.program.account.leaderboardState.fetch(pda);
|
|
@@ -15256,7 +15256,7 @@ class LeaderboardClient {
|
|
|
15256
15256
|
});
|
|
15257
15257
|
}
|
|
15258
15258
|
getValidatorRecord(voteAccount) {
|
|
15259
|
-
return __async$
|
|
15259
|
+
return __async$d(this, null, function* () {
|
|
15260
15260
|
const pda = this.pgs.deriveValidatorRecordPda(voteAccount);
|
|
15261
15261
|
try {
|
|
15262
15262
|
return yield this.program.account.validatorRecord.fetchNullable(pda);
|
|
@@ -15266,7 +15266,7 @@ class LeaderboardClient {
|
|
|
15266
15266
|
});
|
|
15267
15267
|
}
|
|
15268
15268
|
getTopValidators(limit = 20) {
|
|
15269
|
-
return __async$
|
|
15269
|
+
return __async$d(this, null, function* () {
|
|
15270
15270
|
try {
|
|
15271
15271
|
const leaderboardPda = this.pgs.deriveLeaderboardStatePda();
|
|
15272
15272
|
const leaderboard = yield this.program.account.leaderboardState.fetch(leaderboardPda);
|
|
@@ -15305,7 +15305,7 @@ class LeaderboardClient {
|
|
|
15305
15305
|
}
|
|
15306
15306
|
}
|
|
15307
15307
|
|
|
15308
|
-
var __async$
|
|
15308
|
+
var __async$c = (__this, __arguments, generator) => {
|
|
15309
15309
|
return new Promise((resolve, reject) => {
|
|
15310
15310
|
var fulfilled = (value) => {
|
|
15311
15311
|
try {
|
|
@@ -15338,7 +15338,7 @@ class OutpostClient {
|
|
|
15338
15338
|
return this.provider.wallet;
|
|
15339
15339
|
}
|
|
15340
15340
|
buildAccounts(user) {
|
|
15341
|
-
return __async$
|
|
15341
|
+
return __async$c(this, null, function* () {
|
|
15342
15342
|
const userPk = user != null ? user : this.wallet.publicKey;
|
|
15343
15343
|
if (!userPk) {
|
|
15344
15344
|
throw new Error("OutpostClient.buildAccounts: wallet not connected");
|
|
@@ -15347,7 +15347,7 @@ class OutpostClient {
|
|
|
15347
15347
|
});
|
|
15348
15348
|
}
|
|
15349
15349
|
getTokenBalance(ata) {
|
|
15350
|
-
return __async$
|
|
15350
|
+
return __async$c(this, null, function* () {
|
|
15351
15351
|
try {
|
|
15352
15352
|
const bal = yield this.connection.getTokenAccountBalance(ata);
|
|
15353
15353
|
return new anchor.BN(bal.value.amount);
|
|
@@ -15357,7 +15357,7 @@ class OutpostClient {
|
|
|
15357
15357
|
});
|
|
15358
15358
|
}
|
|
15359
15359
|
fetchWireState(user) {
|
|
15360
|
-
return __async$
|
|
15360
|
+
return __async$c(this, null, function* () {
|
|
15361
15361
|
const userPk = user != null ? user : this.wallet.publicKey;
|
|
15362
15362
|
if (!userPk) {
|
|
15363
15363
|
throw new Error("OutpostClient.fetchWireState: wallet not connected");
|
|
@@ -15397,7 +15397,7 @@ class OutpostClient {
|
|
|
15397
15397
|
});
|
|
15398
15398
|
}
|
|
15399
15399
|
buildStakeIx(_0) {
|
|
15400
|
-
return __async$
|
|
15400
|
+
return __async$c(this, arguments, function* (amountLamports, user = this.wallet.publicKey) {
|
|
15401
15401
|
if (!user) {
|
|
15402
15402
|
throw new Error("OutpostClient.buildStakeIx: wallet not connected");
|
|
15403
15403
|
}
|
|
@@ -15426,7 +15426,7 @@ class OutpostClient {
|
|
|
15426
15426
|
});
|
|
15427
15427
|
}
|
|
15428
15428
|
buildUnstakeIx(amountLamports, user) {
|
|
15429
|
-
return __async$
|
|
15429
|
+
return __async$c(this, null, function* () {
|
|
15430
15430
|
const userPk = user != null ? user : this.wallet.publicKey;
|
|
15431
15431
|
if (!userPk) {
|
|
15432
15432
|
throw new Error("OutpostClient.buildUnstakeIx: wallet not connected");
|
|
@@ -15489,7 +15489,7 @@ class OutpostClient {
|
|
|
15489
15489
|
}
|
|
15490
15490
|
}
|
|
15491
15491
|
|
|
15492
|
-
var __async$
|
|
15492
|
+
var __async$b = (__this, __arguments, generator) => {
|
|
15493
15493
|
return new Promise((resolve, reject) => {
|
|
15494
15494
|
var fulfilled = (value) => {
|
|
15495
15495
|
try {
|
|
@@ -15522,30 +15522,30 @@ class TokenClient {
|
|
|
15522
15522
|
return this.provider.connection;
|
|
15523
15523
|
}
|
|
15524
15524
|
getAccounts(user) {
|
|
15525
|
-
return __async$
|
|
15525
|
+
return __async$b(this, null, function* () {
|
|
15526
15526
|
return buildOutpostAccounts(this.provider.connection, user, this.pgs);
|
|
15527
15527
|
});
|
|
15528
15528
|
}
|
|
15529
15529
|
fetchGlobalState() {
|
|
15530
|
-
return __async$
|
|
15530
|
+
return __async$b(this, null, function* () {
|
|
15531
15531
|
const { globalState } = yield this.getAccounts(this.wallet.publicKey);
|
|
15532
15532
|
return this.program.account.globalState.fetch(globalState);
|
|
15533
15533
|
});
|
|
15534
15534
|
}
|
|
15535
15535
|
fetchTrancheState() {
|
|
15536
|
-
return __async$
|
|
15536
|
+
return __async$b(this, null, function* () {
|
|
15537
15537
|
const { trancheState } = yield this.getAccounts(this.wallet.publicKey);
|
|
15538
15538
|
return this.program.account.trancheState.fetch(trancheState);
|
|
15539
15539
|
});
|
|
15540
15540
|
}
|
|
15541
15541
|
fetchOutpostAccount(user) {
|
|
15542
|
-
return __async$
|
|
15542
|
+
return __async$b(this, null, function* () {
|
|
15543
15543
|
const { outpostAccount } = yield this.getAccounts(user);
|
|
15544
15544
|
return this.program.account.outpostAccount.fetchNullable(outpostAccount);
|
|
15545
15545
|
});
|
|
15546
15546
|
}
|
|
15547
15547
|
fetchUserPretokenRecord(user) {
|
|
15548
|
-
return __async$
|
|
15548
|
+
return __async$b(this, null, function* () {
|
|
15549
15549
|
const { userPretokenRecord } = yield this.getAccounts(user);
|
|
15550
15550
|
return this.program.account.userPretokenRecord.fetchNullable(
|
|
15551
15551
|
userPretokenRecord
|
|
@@ -15553,7 +15553,7 @@ class TokenClient {
|
|
|
15553
15553
|
});
|
|
15554
15554
|
}
|
|
15555
15555
|
buildPurchaseIx(_0) {
|
|
15556
|
-
return __async$
|
|
15556
|
+
return __async$b(this, arguments, function* (amountLamports, user = this.wallet.publicKey) {
|
|
15557
15557
|
var _a, _b;
|
|
15558
15558
|
console.log("build purchase for", user.toBase58());
|
|
15559
15559
|
const a = yield this.getAccounts(user);
|
|
@@ -15588,7 +15588,7 @@ class TokenClient {
|
|
|
15588
15588
|
});
|
|
15589
15589
|
}
|
|
15590
15590
|
getSolPriceUsdSafe() {
|
|
15591
|
-
return __async$
|
|
15591
|
+
return __async$b(this, null, function* () {
|
|
15592
15592
|
try {
|
|
15593
15593
|
const price = yield this.getSolPriceUsd();
|
|
15594
15594
|
return { price, timestamp: void 0 };
|
|
@@ -15598,7 +15598,7 @@ class TokenClient {
|
|
|
15598
15598
|
});
|
|
15599
15599
|
}
|
|
15600
15600
|
getSolPriceUsd() {
|
|
15601
|
-
return __async$
|
|
15601
|
+
return __async$b(this, null, function* () {
|
|
15602
15602
|
const priceHistoryPda = this.pgs.derivePriceHistoryPda();
|
|
15603
15603
|
const history = yield this.program.account.priceHistory.fetch(
|
|
15604
15604
|
priceHistoryPda
|
|
@@ -15644,7 +15644,7 @@ var __spreadValues = (a, b) => {
|
|
|
15644
15644
|
return a;
|
|
15645
15645
|
};
|
|
15646
15646
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
15647
|
-
var __async$
|
|
15647
|
+
var __async$a = (__this, __arguments, generator) => {
|
|
15648
15648
|
return new Promise((resolve, reject) => {
|
|
15649
15649
|
var fulfilled = (value) => {
|
|
15650
15650
|
try {
|
|
@@ -15922,14 +15922,14 @@ class SolanaProgramService {
|
|
|
15922
15922
|
)[0];
|
|
15923
15923
|
}
|
|
15924
15924
|
deriveEphemeralStakeAddress(user, seed) {
|
|
15925
|
-
return __async$
|
|
15925
|
+
return __async$a(this, null, function* () {
|
|
15926
15926
|
const seedStr = `ephemeral_${seed}`;
|
|
15927
15927
|
return web3_js.PublicKey.createWithSeed(user, seedStr, web3_js.StakeProgram.programId);
|
|
15928
15928
|
});
|
|
15929
15929
|
}
|
|
15930
15930
|
}
|
|
15931
15931
|
|
|
15932
|
-
var __async$
|
|
15932
|
+
var __async$9 = (__this, __arguments, generator) => {
|
|
15933
15933
|
return new Promise((resolve, reject) => {
|
|
15934
15934
|
var fulfilled = (value) => {
|
|
15935
15935
|
try {
|
|
@@ -15991,12 +15991,12 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
15991
15991
|
const anchorWallet = adapter ? {
|
|
15992
15992
|
publicKey: solWalletPubkey,
|
|
15993
15993
|
signTransaction(tx) {
|
|
15994
|
-
return __async$
|
|
15994
|
+
return __async$9(this, null, function* () {
|
|
15995
15995
|
return adapter.signTransaction(tx);
|
|
15996
15996
|
});
|
|
15997
15997
|
},
|
|
15998
15998
|
signAllTransactions(txs) {
|
|
15999
|
-
return __async$
|
|
15999
|
+
return __async$9(this, null, function* () {
|
|
16000
16000
|
if (adapter.signAllTransactions) {
|
|
16001
16001
|
return adapter.signAllTransactions(txs);
|
|
16002
16002
|
}
|
|
@@ -16008,14 +16008,14 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16008
16008
|
} : {
|
|
16009
16009
|
publicKey: solWalletPubkey,
|
|
16010
16010
|
signTransaction(_tx) {
|
|
16011
|
-
return __async$
|
|
16011
|
+
return __async$9(this, null, function* () {
|
|
16012
16012
|
throw new Error(
|
|
16013
16013
|
"Wallet not connected: signTransaction not available"
|
|
16014
16014
|
);
|
|
16015
16015
|
});
|
|
16016
16016
|
},
|
|
16017
16017
|
signAllTransactions(_txs) {
|
|
16018
|
-
return __async$
|
|
16018
|
+
return __async$9(this, null, function* () {
|
|
16019
16019
|
throw new Error(
|
|
16020
16020
|
"Wallet not connected: signAllTransactions not available"
|
|
16021
16021
|
);
|
|
@@ -16051,7 +16051,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16051
16051
|
return config != null ? config : null;
|
|
16052
16052
|
}
|
|
16053
16053
|
deposit(amountLamports) {
|
|
16054
|
-
return __async$
|
|
16054
|
+
return __async$9(this, null, function* () {
|
|
16055
16055
|
this.ensureUser();
|
|
16056
16056
|
if (amountLamports <= BigInt(0))
|
|
16057
16057
|
throw new Error("Deposit amount must be greater than zero.");
|
|
@@ -16065,7 +16065,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16065
16065
|
});
|
|
16066
16066
|
}
|
|
16067
16067
|
withdraw(amountLamports) {
|
|
16068
|
-
return __async$
|
|
16068
|
+
return __async$9(this, null, function* () {
|
|
16069
16069
|
this.ensureUser();
|
|
16070
16070
|
if (amountLamports <= BigInt(0))
|
|
16071
16071
|
throw new Error("Withdraw amount must be greater than zero.");
|
|
@@ -16079,7 +16079,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16079
16079
|
});
|
|
16080
16080
|
}
|
|
16081
16081
|
stake(amountLamports) {
|
|
16082
|
-
return __async$
|
|
16082
|
+
return __async$9(this, null, function* () {
|
|
16083
16083
|
this.ensureUser();
|
|
16084
16084
|
if (!amountLamports || amountLamports <= BigInt(0))
|
|
16085
16085
|
throw new Error("Stake amount must be greater than zero.");
|
|
@@ -16093,7 +16093,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16093
16093
|
});
|
|
16094
16094
|
}
|
|
16095
16095
|
unstake(amountLamports) {
|
|
16096
|
-
return __async$
|
|
16096
|
+
return __async$9(this, null, function* () {
|
|
16097
16097
|
this.ensureUser();
|
|
16098
16098
|
if (!amountLamports || amountLamports <= BigInt(0))
|
|
16099
16099
|
throw new Error("Unstake amount must be greater than zero.");
|
|
@@ -16107,7 +16107,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16107
16107
|
});
|
|
16108
16108
|
}
|
|
16109
16109
|
buy(amountLamports) {
|
|
16110
|
-
return __async$
|
|
16110
|
+
return __async$9(this, null, function* () {
|
|
16111
16111
|
this.ensureUser();
|
|
16112
16112
|
if (!amountLamports || amountLamports <= BigInt(0))
|
|
16113
16113
|
throw new Error("liqSOL pretoken purchase requires a positive amount.");
|
|
@@ -16121,7 +16121,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16121
16121
|
});
|
|
16122
16122
|
}
|
|
16123
16123
|
getPortfolio() {
|
|
16124
|
-
return __async$
|
|
16124
|
+
return __async$9(this, null, function* () {
|
|
16125
16125
|
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;
|
|
16126
16126
|
try {
|
|
16127
16127
|
const user = !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
|
|
@@ -16211,7 +16211,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16211
16211
|
});
|
|
16212
16212
|
}
|
|
16213
16213
|
getUserRecord() {
|
|
16214
|
-
return __async$
|
|
16214
|
+
return __async$9(this, null, function* () {
|
|
16215
16215
|
if (!this.pubKey) throw new Error("User pubKey is undefined");
|
|
16216
16216
|
return this.distributionClient.getUserRecord(this.solPubKey);
|
|
16217
16217
|
});
|
|
@@ -16229,7 +16229,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16229
16229
|
return pda[0];
|
|
16230
16230
|
}
|
|
16231
16231
|
sendSquadsIxs(ix) {
|
|
16232
|
-
return __async$
|
|
16232
|
+
return __async$9(this, null, function* () {
|
|
16233
16233
|
var _a, _b, _c, _d;
|
|
16234
16234
|
if (!this.squadsX) throw new Error("Attempting to wrap Squads instruction without SquadsX config");
|
|
16235
16235
|
const multisigPda = this.squadsMultisigPDA;
|
|
@@ -16273,7 +16273,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16273
16273
|
});
|
|
16274
16274
|
}
|
|
16275
16275
|
buildAndSendIx(ix) {
|
|
16276
|
-
return __async$
|
|
16276
|
+
return __async$9(this, null, function* () {
|
|
16277
16277
|
const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
|
|
16278
16278
|
const ixs = Array.isArray(ix) ? ix : [ix];
|
|
16279
16279
|
const tx = new web3_js.Transaction().add(cuIx, ...ixs);
|
|
@@ -16283,7 +16283,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16283
16283
|
});
|
|
16284
16284
|
}
|
|
16285
16285
|
sendAndConfirmHttp(signed, _ctx) {
|
|
16286
|
-
return __async$
|
|
16286
|
+
return __async$9(this, null, function* () {
|
|
16287
16287
|
var _a, _b, _c;
|
|
16288
16288
|
this.ensureUser();
|
|
16289
16289
|
const rawTx = signed.serialize();
|
|
@@ -16313,19 +16313,19 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16313
16313
|
});
|
|
16314
16314
|
}
|
|
16315
16315
|
signTransaction(tx) {
|
|
16316
|
-
return __async$
|
|
16316
|
+
return __async$9(this, null, function* () {
|
|
16317
16317
|
this.ensureUser();
|
|
16318
16318
|
return this.anchor.wallet.signTransaction(tx);
|
|
16319
16319
|
});
|
|
16320
16320
|
}
|
|
16321
16321
|
sendTransaction(signed) {
|
|
16322
|
-
return __async$
|
|
16322
|
+
return __async$9(this, null, function* () {
|
|
16323
16323
|
this.ensureUser();
|
|
16324
16324
|
return this.anchor.sendAndConfirm(signed);
|
|
16325
16325
|
});
|
|
16326
16326
|
}
|
|
16327
16327
|
prepareTx(tx) {
|
|
16328
|
-
return __async$
|
|
16328
|
+
return __async$9(this, null, function* () {
|
|
16329
16329
|
const { blockhash, lastValidBlockHeight } = yield this.connection.getLatestBlockhash("confirmed");
|
|
16330
16330
|
tx.recentBlockhash = blockhash;
|
|
16331
16331
|
tx.feePayer = this.feePayer;
|
|
@@ -16343,7 +16343,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16343
16343
|
}
|
|
16344
16344
|
}
|
|
16345
16345
|
getTrancheSnapshot(chainID) {
|
|
16346
|
-
return __async$
|
|
16346
|
+
return __async$9(this, null, function* () {
|
|
16347
16347
|
try {
|
|
16348
16348
|
const [globalState, trancheState] = yield Promise.all([
|
|
16349
16349
|
this.tokenClient.fetchGlobalState(),
|
|
@@ -16364,7 +16364,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16364
16364
|
});
|
|
16365
16365
|
}
|
|
16366
16366
|
getSystemAPY() {
|
|
16367
|
-
return __async$
|
|
16367
|
+
return __async$9(this, null, function* () {
|
|
16368
16368
|
try {
|
|
16369
16369
|
const ratePerEpoch = yield this.getEpochRateDecimalFromProgram();
|
|
16370
16370
|
const epochsPerYear = yield this.getEpochsPerYearFromCluster();
|
|
@@ -16378,7 +16378,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16378
16378
|
});
|
|
16379
16379
|
}
|
|
16380
16380
|
getEpochRateDecimalFromProgram() {
|
|
16381
|
-
return __async$
|
|
16381
|
+
return __async$9(this, null, function* () {
|
|
16382
16382
|
const liqSolCoreProgram = this.program.getProgram("liqsolCore");
|
|
16383
16383
|
const payRateHistoryPda = this.program.derivePayRateHistoryPda();
|
|
16384
16384
|
const payRateHistory = yield liqSolCoreProgram.account.payRateHistory.fetch(payRateHistoryPda);
|
|
@@ -16409,7 +16409,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16409
16409
|
});
|
|
16410
16410
|
}
|
|
16411
16411
|
getEpochsPerYearFromCluster() {
|
|
16412
|
-
return __async$
|
|
16412
|
+
return __async$9(this, null, function* () {
|
|
16413
16413
|
const now = Date.now();
|
|
16414
16414
|
if (this.epochsPerYearCache && now - this.epochsPerYearCache.fetchedAt < _SolanaStakingClient.EPOCHS_PER_YEAR_TTL_MS) {
|
|
16415
16415
|
return this.epochsPerYearCache.value;
|
|
@@ -16442,7 +16442,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16442
16442
|
});
|
|
16443
16443
|
}
|
|
16444
16444
|
getDepositFee(amountLamports, windowSize = 5) {
|
|
16445
|
-
return __async$
|
|
16445
|
+
return __async$9(this, null, function* () {
|
|
16446
16446
|
var _a, _b, _c;
|
|
16447
16447
|
if (amountLamports <= BigInt(0)) {
|
|
16448
16448
|
return BigInt(0);
|
|
@@ -16470,7 +16470,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16470
16470
|
});
|
|
16471
16471
|
}
|
|
16472
16472
|
getDepositBuffer(options) {
|
|
16473
|
-
return __async$
|
|
16473
|
+
return __async$9(this, null, function* () {
|
|
16474
16474
|
var _a, _b, _c, _d;
|
|
16475
16475
|
this.ensureUser();
|
|
16476
16476
|
const balanceLamports = (_a = options == null ? void 0 : options.balanceOverrideLamports) != null ? _a : BigInt(yield this.connection.getBalance(this.feePayer, commitment));
|
|
@@ -16526,7 +16526,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16526
16526
|
});
|
|
16527
16527
|
}
|
|
16528
16528
|
getSingleTxFeeLamports() {
|
|
16529
|
-
return __async$
|
|
16529
|
+
return __async$9(this, null, function* () {
|
|
16530
16530
|
var _a;
|
|
16531
16531
|
const now = Date.now();
|
|
16532
16532
|
if (this.cachedTxFee && now - this.cachedTxFee.fetchedAt < _SolanaStakingClient.FEE_CACHE_TTL_MS) {
|
|
@@ -40568,7 +40568,7 @@ var ERC1155Artifact = {
|
|
|
40568
40568
|
deployedLinkReferences: deployedLinkReferences
|
|
40569
40569
|
};
|
|
40570
40570
|
|
|
40571
|
-
var __async$
|
|
40571
|
+
var __async$8 = (__this, __arguments, generator) => {
|
|
40572
40572
|
return new Promise((resolve, reject) => {
|
|
40573
40573
|
var fulfilled = (value) => {
|
|
40574
40574
|
try {
|
|
@@ -40788,7 +40788,7 @@ class EthereumContractService {
|
|
|
40788
40788
|
return new ethers.Contract(address, abi, this.signer);
|
|
40789
40789
|
}
|
|
40790
40790
|
getNetwork() {
|
|
40791
|
-
return __async$
|
|
40791
|
+
return __async$8(this, null, function* () {
|
|
40792
40792
|
var _a;
|
|
40793
40793
|
return (_a = this.provider) == null ? void 0 : _a.getNetwork();
|
|
40794
40794
|
});
|
|
@@ -40844,7 +40844,7 @@ class EthereumContractService {
|
|
|
40844
40844
|
}
|
|
40845
40845
|
}
|
|
40846
40846
|
|
|
40847
|
-
var __async$
|
|
40847
|
+
var __async$7 = (__this, __arguments, generator) => {
|
|
40848
40848
|
return new Promise((resolve, reject) => {
|
|
40849
40849
|
var fulfilled = (value) => {
|
|
40850
40850
|
try {
|
|
@@ -40888,7 +40888,7 @@ function formatContractErrors(err) {
|
|
|
40888
40888
|
}
|
|
40889
40889
|
}
|
|
40890
40890
|
function sendOPPFinalize(opp, gasLimit) {
|
|
40891
|
-
return __async$
|
|
40891
|
+
return __async$7(this, null, function* () {
|
|
40892
40892
|
var _a;
|
|
40893
40893
|
const overrides = {};
|
|
40894
40894
|
try {
|
|
@@ -41016,7 +41016,7 @@ function buildEthereumTrancheLadder(options) {
|
|
|
41016
41016
|
return ladder;
|
|
41017
41017
|
}
|
|
41018
41018
|
function buildEthereumTrancheSnapshot(options) {
|
|
41019
|
-
return __async$
|
|
41019
|
+
return __async$7(this, null, function* () {
|
|
41020
41020
|
const {
|
|
41021
41021
|
chainID,
|
|
41022
41022
|
ethPriceUsd,
|
|
@@ -41076,7 +41076,7 @@ function buildEthereumTrancheSnapshot(options) {
|
|
|
41076
41076
|
});
|
|
41077
41077
|
}
|
|
41078
41078
|
|
|
41079
|
-
var __async$
|
|
41079
|
+
var __async$6 = (__this, __arguments, generator) => {
|
|
41080
41080
|
return new Promise((resolve, reject) => {
|
|
41081
41081
|
var fulfilled = (value) => {
|
|
41082
41082
|
try {
|
|
@@ -41104,7 +41104,7 @@ class ConvertClient {
|
|
|
41104
41104
|
this.contractService = contract;
|
|
41105
41105
|
}
|
|
41106
41106
|
simulateDeposit(amount) {
|
|
41107
|
-
return __async$
|
|
41107
|
+
return __async$6(this, null, function* () {
|
|
41108
41108
|
const amountWei = ethers.BigNumber.isBigNumber(amount) ? amount : ethers.BigNumber.from(amount);
|
|
41109
41109
|
yield this.contract.DepositManager.callStatic.deposit({
|
|
41110
41110
|
value: amountWei
|
|
@@ -41112,7 +41112,7 @@ class ConvertClient {
|
|
|
41112
41112
|
});
|
|
41113
41113
|
}
|
|
41114
41114
|
performDeposit(amountWei) {
|
|
41115
|
-
return __async$
|
|
41115
|
+
return __async$6(this, null, function* () {
|
|
41116
41116
|
var _a, _b;
|
|
41117
41117
|
const minDeposit = yield this.contract.DepositManager.minDeposit();
|
|
41118
41118
|
if (amountWei.lt(minDeposit)) {
|
|
@@ -41148,7 +41148,7 @@ class ConvertClient {
|
|
|
41148
41148
|
});
|
|
41149
41149
|
}
|
|
41150
41150
|
performWithdraw(signerAddress, amountWei) {
|
|
41151
|
-
return __async$
|
|
41151
|
+
return __async$6(this, null, function* () {
|
|
41152
41152
|
var _a, _b;
|
|
41153
41153
|
let tx, receipt;
|
|
41154
41154
|
try {
|
|
@@ -41176,7 +41176,7 @@ class ConvertClient {
|
|
|
41176
41176
|
});
|
|
41177
41177
|
}
|
|
41178
41178
|
claimWithdraw(tokenId) {
|
|
41179
|
-
return __async$
|
|
41179
|
+
return __async$6(this, null, function* () {
|
|
41180
41180
|
var _a, _b;
|
|
41181
41181
|
let tx, receipt;
|
|
41182
41182
|
try {
|
|
@@ -41204,7 +41204,7 @@ class ConvertClient {
|
|
|
41204
41204
|
}
|
|
41205
41205
|
}
|
|
41206
41206
|
|
|
41207
|
-
var __async$
|
|
41207
|
+
var __async$5 = (__this, __arguments, generator) => {
|
|
41208
41208
|
return new Promise((resolve, reject) => {
|
|
41209
41209
|
var fulfilled = (value) => {
|
|
41210
41210
|
try {
|
|
@@ -41232,7 +41232,7 @@ class StakeClient {
|
|
|
41232
41232
|
this.contractService = contract;
|
|
41233
41233
|
}
|
|
41234
41234
|
simulateStake(amountWei) {
|
|
41235
|
-
return __async$
|
|
41235
|
+
return __async$5(this, null, function* () {
|
|
41236
41236
|
var _a;
|
|
41237
41237
|
try {
|
|
41238
41238
|
yield this.contract.Depositor.callStatic.stakeLiqETH(amountWei);
|
|
@@ -41243,7 +41243,7 @@ class StakeClient {
|
|
|
41243
41243
|
});
|
|
41244
41244
|
}
|
|
41245
41245
|
performStake(amountWei, signerAddress) {
|
|
41246
|
-
return __async$
|
|
41246
|
+
return __async$5(this, null, function* () {
|
|
41247
41247
|
var _a;
|
|
41248
41248
|
const depositor = this.contract.Depositor.address;
|
|
41249
41249
|
const liqRead = this.contract.LiqEthToken;
|
|
@@ -41286,7 +41286,7 @@ class StakeClient {
|
|
|
41286
41286
|
});
|
|
41287
41287
|
}
|
|
41288
41288
|
performWithdrawStake(tokenId, recipient) {
|
|
41289
|
-
return __async$
|
|
41289
|
+
return __async$5(this, null, function* () {
|
|
41290
41290
|
var _a;
|
|
41291
41291
|
const tx = yield this.contract.Depositor.withdrawStake(tokenId, recipient);
|
|
41292
41292
|
const receipt = yield tx.wait(1);
|
|
@@ -41309,7 +41309,7 @@ class StakeClient {
|
|
|
41309
41309
|
}
|
|
41310
41310
|
}
|
|
41311
41311
|
|
|
41312
|
-
var __async$
|
|
41312
|
+
var __async$4 = (__this, __arguments, generator) => {
|
|
41313
41313
|
return new Promise((resolve, reject) => {
|
|
41314
41314
|
var fulfilled = (value) => {
|
|
41315
41315
|
try {
|
|
@@ -41337,7 +41337,7 @@ class PretokenClient {
|
|
|
41337
41337
|
this.contractService = contract;
|
|
41338
41338
|
}
|
|
41339
41339
|
purchasePretokensWithLiqETH(amountLiq, buyer) {
|
|
41340
|
-
return __async$
|
|
41340
|
+
return __async$4(this, null, function* () {
|
|
41341
41341
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
41342
41342
|
const bal = yield this.contract.LiqEthToken.balanceOf(buyer);
|
|
41343
41343
|
const paused = yield this.contract.Depositor.paused();
|
|
@@ -41406,7 +41406,7 @@ class PretokenClient {
|
|
|
41406
41406
|
}
|
|
41407
41407
|
}
|
|
41408
41408
|
|
|
41409
|
-
var __async$
|
|
41409
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
41410
41410
|
return new Promise((resolve, reject) => {
|
|
41411
41411
|
var fulfilled = (value) => {
|
|
41412
41412
|
try {
|
|
@@ -41443,7 +41443,7 @@ class OPPClient {
|
|
|
41443
41443
|
return this.contractService.contract;
|
|
41444
41444
|
}
|
|
41445
41445
|
getStatus() {
|
|
41446
|
-
return __async$
|
|
41446
|
+
return __async$3(this, null, function* () {
|
|
41447
41447
|
const depositor = this.contract.Depositor;
|
|
41448
41448
|
const opp = this.contract.OPP;
|
|
41449
41449
|
const oppAddress = yield depositor.oppAddress();
|
|
@@ -41484,7 +41484,7 @@ class OPPClient {
|
|
|
41484
41484
|
});
|
|
41485
41485
|
}
|
|
41486
41486
|
getMessages(address) {
|
|
41487
|
-
return __async$
|
|
41487
|
+
return __async$3(this, null, function* () {
|
|
41488
41488
|
try {
|
|
41489
41489
|
const oppMessageFilter = this.contract.OPP.filters.OPPMessage();
|
|
41490
41490
|
const events = yield this.contract.OPP.queryFilter(oppMessageFilter, 0, "latest");
|
|
@@ -41504,7 +41504,7 @@ class OPPClient {
|
|
|
41504
41504
|
});
|
|
41505
41505
|
}
|
|
41506
41506
|
extractAssertionsFromEvent(event) {
|
|
41507
|
-
return __async$
|
|
41507
|
+
return __async$3(this, null, function* () {
|
|
41508
41508
|
var _a, _b;
|
|
41509
41509
|
const header = event.args.header;
|
|
41510
41510
|
const payloadAssertions = event.args.payload.assertions;
|
|
@@ -41739,7 +41739,7 @@ var ReceiptNFTKind = ((ReceiptNFTKind2) => {
|
|
|
41739
41739
|
return ReceiptNFTKind2;
|
|
41740
41740
|
})(ReceiptNFTKind || {});
|
|
41741
41741
|
|
|
41742
|
-
var __async$
|
|
41742
|
+
var __async$2 = (__this, __arguments, generator) => {
|
|
41743
41743
|
return new Promise((resolve, reject) => {
|
|
41744
41744
|
var fulfilled = (value) => {
|
|
41745
41745
|
try {
|
|
@@ -41767,12 +41767,12 @@ class ReceiptClient {
|
|
|
41767
41767
|
this.contractService = contract;
|
|
41768
41768
|
}
|
|
41769
41769
|
allReceipts(address) {
|
|
41770
|
-
return __async$
|
|
41770
|
+
return __async$2(this, null, function* () {
|
|
41771
41771
|
return this.fetchPreLaunchReceipts(address);
|
|
41772
41772
|
});
|
|
41773
41773
|
}
|
|
41774
41774
|
stakeReceipts(address) {
|
|
41775
|
-
return __async$
|
|
41775
|
+
return __async$2(this, null, function* () {
|
|
41776
41776
|
try {
|
|
41777
41777
|
const receipts = yield this.fetchPreLaunchReceipts(address, ReceiptNFTKind.STAKE);
|
|
41778
41778
|
return receipts;
|
|
@@ -41782,12 +41782,12 @@ class ReceiptClient {
|
|
|
41782
41782
|
});
|
|
41783
41783
|
}
|
|
41784
41784
|
pretokenReceipts(address) {
|
|
41785
|
-
return __async$
|
|
41785
|
+
return __async$2(this, null, function* () {
|
|
41786
41786
|
return this.fetchPreLaunchReceipts(address, ReceiptNFTKind.PRETOKEN_PURCHASE);
|
|
41787
41787
|
});
|
|
41788
41788
|
}
|
|
41789
41789
|
fetchPreLaunchReceipts(address, type) {
|
|
41790
|
-
return __async$
|
|
41790
|
+
return __async$2(this, null, function* () {
|
|
41791
41791
|
const receiptContract = this.contract.ReceiptNFT;
|
|
41792
41792
|
const tokenIds = yield this.getOwnedReceiptNFTsFor(address);
|
|
41793
41793
|
const results = [];
|
|
@@ -41824,7 +41824,7 @@ class ReceiptClient {
|
|
|
41824
41824
|
});
|
|
41825
41825
|
}
|
|
41826
41826
|
getOwnedReceiptNFTsFor(owner, fromBlock = 0, toBlock = "latest") {
|
|
41827
|
-
return __async$
|
|
41827
|
+
return __async$2(this, null, function* () {
|
|
41828
41828
|
var _a, _b;
|
|
41829
41829
|
const receiptContract = this.contract.ReceiptNFT;
|
|
41830
41830
|
const toLogs = yield receiptContract.queryFilter(
|
|
@@ -41852,7 +41852,7 @@ class ReceiptClient {
|
|
|
41852
41852
|
});
|
|
41853
41853
|
}
|
|
41854
41854
|
fetchWithdrawReceipts(address) {
|
|
41855
|
-
return __async$
|
|
41855
|
+
return __async$2(this, null, function* () {
|
|
41856
41856
|
const tokenIds = yield this.getOwnedWithdrawReceiptsFor(address);
|
|
41857
41857
|
const results = [];
|
|
41858
41858
|
for (const idBN of tokenIds) {
|
|
@@ -41879,7 +41879,7 @@ class ReceiptClient {
|
|
|
41879
41879
|
});
|
|
41880
41880
|
}
|
|
41881
41881
|
getOwnedWithdrawReceiptsFor(owner, fromBlock = 0, toBlock = "latest") {
|
|
41882
|
-
return __async$
|
|
41882
|
+
return __async$2(this, null, function* () {
|
|
41883
41883
|
var _a, _b;
|
|
41884
41884
|
const contract = this.contract.WithdrawalQueue;
|
|
41885
41885
|
const toLogs = yield contract.queryFilter(
|
|
@@ -41908,6 +41908,64 @@ class ReceiptClient {
|
|
|
41908
41908
|
}
|
|
41909
41909
|
}
|
|
41910
41910
|
|
|
41911
|
+
var __async$1 = (__this, __arguments, generator) => {
|
|
41912
|
+
return new Promise((resolve, reject) => {
|
|
41913
|
+
var fulfilled = (value) => {
|
|
41914
|
+
try {
|
|
41915
|
+
step(generator.next(value));
|
|
41916
|
+
} catch (e) {
|
|
41917
|
+
reject(e);
|
|
41918
|
+
}
|
|
41919
|
+
};
|
|
41920
|
+
var rejected = (value) => {
|
|
41921
|
+
try {
|
|
41922
|
+
step(generator.throw(value));
|
|
41923
|
+
} catch (e) {
|
|
41924
|
+
reject(e);
|
|
41925
|
+
}
|
|
41926
|
+
};
|
|
41927
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41928
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
41929
|
+
});
|
|
41930
|
+
};
|
|
41931
|
+
class ValidatorClient {
|
|
41932
|
+
get contract() {
|
|
41933
|
+
return this.contractService.contract;
|
|
41934
|
+
}
|
|
41935
|
+
constructor(contract) {
|
|
41936
|
+
this.contractService = contract;
|
|
41937
|
+
}
|
|
41938
|
+
validatorDepositAndLockBond() {
|
|
41939
|
+
return __async$1(this, null, function* () {
|
|
41940
|
+
var _a, _b;
|
|
41941
|
+
const amountWei = ethers.ethers.utils.parseEther("32");
|
|
41942
|
+
try {
|
|
41943
|
+
yield this.contract.DepositManager.callStatic.validatorDepositAndLockBond({ value: amountWei });
|
|
41944
|
+
} catch (err) {
|
|
41945
|
+
let errorObj = formatContractErrors(err);
|
|
41946
|
+
throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
|
|
41947
|
+
}
|
|
41948
|
+
const tx = yield this.contract.DepositManager.validatorDepositAndLockBond({ value: amountWei });
|
|
41949
|
+
const receipt = yield tx.wait(1);
|
|
41950
|
+
let staked;
|
|
41951
|
+
const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
|
|
41952
|
+
if (ev && ev.args) {
|
|
41953
|
+
const { sender, amount, shares } = ev.args;
|
|
41954
|
+
staked = {
|
|
41955
|
+
sender,
|
|
41956
|
+
amount: ethers.BigNumber.from(amount),
|
|
41957
|
+
shares: ethers.BigNumber.from(shares)
|
|
41958
|
+
};
|
|
41959
|
+
}
|
|
41960
|
+
return {
|
|
41961
|
+
txHash: tx.hash,
|
|
41962
|
+
receipt,
|
|
41963
|
+
staked
|
|
41964
|
+
};
|
|
41965
|
+
});
|
|
41966
|
+
}
|
|
41967
|
+
}
|
|
41968
|
+
|
|
41911
41969
|
var __async = (__this, __arguments, generator) => {
|
|
41912
41970
|
return new Promise((resolve, reject) => {
|
|
41913
41971
|
var fulfilled = (value) => {
|
|
@@ -41950,6 +42008,7 @@ class EthereumStakingClient {
|
|
|
41950
42008
|
this.stakeClient = new StakeClient(this.contractService);
|
|
41951
42009
|
this.oppClient = new OPPClient(this.contractService);
|
|
41952
42010
|
this.receiptClient = new ReceiptClient(this.contractService);
|
|
42011
|
+
this.validatorClient = new ValidatorClient(this.contractService);
|
|
41953
42012
|
} catch (error) {
|
|
41954
42013
|
throw error;
|
|
41955
42014
|
}
|
|
@@ -42022,6 +42081,13 @@ class EthereumStakingClient {
|
|
|
42022
42081
|
return result && result.txHash ? result.txHash : "Error - no resulting txHash";
|
|
42023
42082
|
});
|
|
42024
42083
|
}
|
|
42084
|
+
validatorDeposit() {
|
|
42085
|
+
return __async(this, null, function* () {
|
|
42086
|
+
this.ensureUser();
|
|
42087
|
+
let result = yield this.validatorClient.validatorDepositAndLockBond();
|
|
42088
|
+
return result && result.txHash ? result.txHash : "Error - no resulting txHash";
|
|
42089
|
+
});
|
|
42090
|
+
}
|
|
42025
42091
|
getPortfolio() {
|
|
42026
42092
|
return __async(this, null, function* () {
|
|
42027
42093
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|