@wireio/stake 1.5.69 → 1.6.69

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.js CHANGED
@@ -18327,7 +18327,7 @@ var devnetTransferHookIDL = {
18327
18327
  types: types$2
18328
18328
  };
18329
18329
 
18330
- var __async$j = (__this, __arguments, generator) => {
18330
+ var __async$k = (__this, __arguments, generator) => {
18331
18331
  return new Promise((resolve, reject) => {
18332
18332
  var fulfilled = (value) => {
18333
18333
  try {
@@ -18359,7 +18359,7 @@ const DEVNET_PROGRAM_IDS = {
18359
18359
  LIQSOL_TOKEN: new web3_js.PublicKey(liqsolTokenDevnetJson.address),
18360
18360
  VALIDATOR_LEADERBOARD: new web3_js.PublicKey(validatorLeaderboardDevnetJson.address),
18361
18361
  TRANSFER_HOOK: new web3_js.PublicKey(devnetTransferHookIDL.address),
18362
- ALT: new web3_js.PublicKey("3dm6p83nqBTLnbJBFEfbHJ988y6cfKtrGSoKJbGD3hqp")
18362
+ ALT: new web3_js.PublicKey("EG5pouZneDQxfw5coaWkkv5qeoJkRsgyMiq4r6bw7K2F")
18363
18363
  };
18364
18364
  const PROGRAM_IDS_BY_CHAIN = {
18365
18365
  [core.SolChainID.Mainnet]: MAINNET_PROGRAM_IDS,
@@ -18412,7 +18412,7 @@ const PDA_SEEDS = {
18412
18412
  EPOCH_MESSAGE: "epoch_message",
18413
18413
  OPP_BRIDGE_STATE: "opp_bridge_state"
18414
18414
  };
18415
- const deriveEphemeralStakeAddress = (user, seed) => __async$j(null, null, function* () {
18415
+ const deriveEphemeralStakeAddress = (user, seed) => __async$k(null, null, function* () {
18416
18416
  const seedStr = `ephemeral_${seed}`;
18417
18417
  return web3_js.PublicKey.createWithSeed(user, seedStr, web3_js.StakeProgram.programId);
18418
18418
  });
@@ -18431,7 +18431,7 @@ const INDEX_SCALE$1 = BigInt(1e12);
18431
18431
  const lamportsToSol = (lamports) => Number(lamports) / LAMPORTS_PER_SOL;
18432
18432
  const solToLamports = (sol) => BigInt(Math.round(sol * LAMPORTS_PER_SOL));
18433
18433
 
18434
- var __async$i = (__this, __arguments, generator) => {
18434
+ var __async$j = (__this, __arguments, generator) => {
18435
18435
  return new Promise((resolve, reject) => {
18436
18436
  var fulfilled = (value) => {
18437
18437
  try {
@@ -18585,7 +18585,7 @@ function buildSolanaTrancheSnapshot(options) {
18585
18585
  };
18586
18586
  }
18587
18587
  function buildOutpostAccounts(connection, user, pgs) {
18588
- return __async$i(this, null, function* () {
18588
+ return __async$j(this, null, function* () {
18589
18589
  const globalState = pgs.deriveOutpostGlobalStatePda();
18590
18590
  const poolAuthority = pgs.deriveOutpostPoolAuthorityPda();
18591
18591
  const liqsolMint = pgs.deriveLiqsolMintPda();
@@ -18675,7 +18675,7 @@ function buildOutpostAccounts(connection, user, pgs) {
18675
18675
  });
18676
18676
  }
18677
18677
  function getEpochSnapshot(connection) {
18678
- return __async$i(this, null, function* () {
18678
+ return __async$j(this, null, function* () {
18679
18679
  var _a;
18680
18680
  const info = yield connection.getEpochInfo();
18681
18681
  let slotTimeMs = Number((_a = process.env.SLOT_TIME_MS_FALLBACK) != null ? _a : 400);
@@ -18706,7 +18706,7 @@ function msToEpochEnd(snapshot) {
18706
18706
  return remainingSlots * snapshot.slotMs;
18707
18707
  }
18708
18708
  function scheduledInstruction(connection, config, instruction) {
18709
- return __async$i(this, null, function* () {
18709
+ return __async$j(this, null, function* () {
18710
18710
  var _a, _b;
18711
18711
  const early = (_a = config.early) != null ? _a : 0.1;
18712
18712
  const late = (_b = config.late) != null ? _b : 0.9;
@@ -18753,14 +18753,14 @@ function generateTestKeypair() {
18753
18753
  return web3_js.Keypair.generate();
18754
18754
  }
18755
18755
  function airdropSol(connection, publicKey, amountSol) {
18756
- return __async$i(this, null, function* () {
18756
+ return __async$j(this, null, function* () {
18757
18757
  const lamports = solToLamports(amountSol);
18758
18758
  const sig = yield connection.requestAirdrop(publicKey, Number(lamports));
18759
18759
  yield connection.confirmTransaction(sig, "confirmed");
18760
18760
  });
18761
18761
  }
18762
18762
  function waitForConfirmation(connection, signature) {
18763
- return __async$i(this, null, function* () {
18763
+ return __async$j(this, null, function* () {
18764
18764
  yield connection.confirmTransaction(signature, "confirmed");
18765
18765
  });
18766
18766
  }
@@ -18768,8 +18768,8 @@ function sleep(ms) {
18768
18768
  return new Promise((resolve) => setTimeout(resolve, ms));
18769
18769
  }
18770
18770
  function waitUntilSafeToExecuteFunction(_0) {
18771
- return __async$i(this, arguments, function* (connection, config = {}) {
18772
- yield scheduledInstruction(connection, config, () => __async$i(null, null, function* () {
18771
+ return __async$j(this, arguments, function* (connection, config = {}) {
18772
+ yield scheduledInstruction(connection, config, () => __async$j(null, null, function* () {
18773
18773
  return;
18774
18774
  }));
18775
18775
  });
@@ -18786,7 +18786,7 @@ function normalizeToBigInt(x) {
18786
18786
  if (typeof x === "number") return BigInt(x);
18787
18787
  throw new Error(`normalizeToBigInt: unsupported type ${typeof x}`);
18788
18788
  }
18789
- const safeFetch = (promise, label) => __async$i(null, null, function* () {
18789
+ const safeFetch = (promise, label) => __async$j(null, null, function* () {
18790
18790
  try {
18791
18791
  return yield promise;
18792
18792
  } catch (err) {
@@ -18796,7 +18796,7 @@ const safeFetch = (promise, label) => __async$i(null, null, function* () {
18796
18796
  });
18797
18797
 
18798
18798
  var __pow = Math.pow;
18799
- var __async$h = (__this, __arguments, generator) => {
18799
+ var __async$i = (__this, __arguments, generator) => {
18800
18800
  return new Promise((resolve, reject) => {
18801
18801
  var fulfilled = (value) => {
18802
18802
  try {
@@ -18829,7 +18829,7 @@ let ConvertClient$1 = class ConvertClient {
18829
18829
  return this.provider.wallet;
18830
18830
  }
18831
18831
  buildDepositTx(_0) {
18832
- return __async$h(this, arguments, function* (amount, user = this.wallet.publicKey) {
18832
+ return __async$i(this, arguments, function* (amount, user = this.wallet.publicKey) {
18833
18833
  const program = this.program;
18834
18834
  if (!user) throw new Error("ConvertClient.buildDepositTx: wallet not connected");
18835
18835
  if (!amount || amount <= BigInt(0))
@@ -18885,7 +18885,7 @@ let ConvertClient$1 = class ConvertClient {
18885
18885
  });
18886
18886
  }
18887
18887
  buildRegisterUserIx() {
18888
- return __async$h(this, arguments, function* (user = this.wallet.publicKey) {
18888
+ return __async$i(this, arguments, function* (user = this.wallet.publicKey) {
18889
18889
  const program = this.program;
18890
18890
  if (!user) throw new Error("ConvertClient.buildRegisterUserIx: wallet not connected");
18891
18891
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
@@ -18911,7 +18911,7 @@ let ConvertClient$1 = class ConvertClient {
18911
18911
  });
18912
18912
  }
18913
18913
  buildWithdrawTx(_0) {
18914
- return __async$h(this, arguments, function* (amount, user = this.wallet.publicKey) {
18914
+ return __async$i(this, arguments, function* (amount, user = this.wallet.publicKey) {
18915
18915
  const program = this.program;
18916
18916
  if (!user) throw new Error("ConvertClient.buildWithdrawTx: wallet not connected");
18917
18917
  if (!amount || amount <= BigInt(0))
@@ -18971,7 +18971,7 @@ let ConvertClient$1 = class ConvertClient {
18971
18971
  });
18972
18972
  }
18973
18973
  fetchWithdrawReceipts(owner) {
18974
- return __async$h(this, null, function* () {
18974
+ return __async$i(this, null, function* () {
18975
18975
  var _a, _b, _c, _d;
18976
18976
  const program = this.program;
18977
18977
  const globalPda = this.pgs.deriveWithdrawGlobalPda();
@@ -19036,7 +19036,7 @@ let ConvertClient$1 = class ConvertClient {
19036
19036
  });
19037
19037
  }
19038
19038
  buildClaimWithdrawTx(receiptId, user) {
19039
- return __async$h(this, null, function* () {
19039
+ return __async$i(this, null, function* () {
19040
19040
  const program = this.program;
19041
19041
  const mintAccount = this.pgs.deriveWithdrawNftMintPda(receiptId);
19042
19042
  const receiptData = this.pgs.deriveLiqReceiptDataPda(mintAccount);
@@ -19067,7 +19067,7 @@ let ConvertClient$1 = class ConvertClient {
19067
19067
  });
19068
19068
  }
19069
19069
  estimateEpochEta(targetEpoch) {
19070
- return __async$h(this, null, function* () {
19070
+ return __async$i(this, null, function* () {
19071
19071
  const conn = this.connection;
19072
19072
  const epochInfo = yield conn.getEpochInfo();
19073
19073
  const schedule = yield conn.getEpochSchedule();
@@ -19098,7 +19098,7 @@ let ConvertClient$1 = class ConvertClient {
19098
19098
  }
19099
19099
  };
19100
19100
 
19101
- var __async$g = (__this, __arguments, generator) => {
19101
+ var __async$h = (__this, __arguments, generator) => {
19102
19102
  return new Promise((resolve, reject) => {
19103
19103
  var fulfilled = (value) => {
19104
19104
  try {
@@ -19129,7 +19129,7 @@ class DistributionClient {
19129
19129
  return this.provider.connection;
19130
19130
  }
19131
19131
  getTokenBalance(ata) {
19132
- return __async$g(this, null, function* () {
19132
+ return __async$h(this, null, function* () {
19133
19133
  try {
19134
19134
  const bal = yield this.connection.getTokenAccountBalance(ata);
19135
19135
  return new anchor.BN(bal.value.amount);
@@ -19139,7 +19139,7 @@ class DistributionClient {
19139
19139
  });
19140
19140
  }
19141
19141
  getDistributionState() {
19142
- return __async$g(this, null, function* () {
19142
+ return __async$h(this, null, function* () {
19143
19143
  const pda = this.pgs.deriveDistributionStatePda();
19144
19144
  const program = this.program;
19145
19145
  try {
@@ -19150,7 +19150,7 @@ class DistributionClient {
19150
19150
  });
19151
19151
  }
19152
19152
  getPayRateHistory() {
19153
- return __async$g(this, null, function* () {
19153
+ return __async$h(this, null, function* () {
19154
19154
  const pda = this.pgs.derivePayRateHistoryPda();
19155
19155
  const program = this.program;
19156
19156
  try {
@@ -19163,7 +19163,7 @@ class DistributionClient {
19163
19163
  });
19164
19164
  }
19165
19165
  getGlobalConfig() {
19166
- return __async$g(this, null, function* () {
19166
+ return __async$h(this, null, function* () {
19167
19167
  const pda = this.pgs.deriveGlobalConfigPda();
19168
19168
  const program = this.program;
19169
19169
  try {
@@ -19176,7 +19176,7 @@ class DistributionClient {
19176
19176
  });
19177
19177
  }
19178
19178
  getUserRecord(ownerOrAta) {
19179
- return __async$g(this, null, function* () {
19179
+ return __async$h(this, null, function* () {
19180
19180
  const program = this.program;
19181
19181
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
19182
19182
  try {
@@ -19202,13 +19202,13 @@ class DistributionClient {
19202
19202
  });
19203
19203
  }
19204
19204
  getUserShares(user) {
19205
- return __async$g(this, null, function* () {
19205
+ return __async$h(this, null, function* () {
19206
19206
  const record = yield this.getUserRecord(user);
19207
19207
  return record ? record.shares : new anchor.BN(0);
19208
19208
  });
19209
19209
  }
19210
19210
  getUserSharePosition(user) {
19211
- return __async$g(this, null, function* () {
19211
+ return __async$h(this, null, function* () {
19212
19212
  const [dist, userShares] = yield Promise.all([
19213
19213
  this.getDistributionState(),
19214
19214
  this.getUserShares(user)
@@ -19222,7 +19222,7 @@ class DistributionClient {
19222
19222
  });
19223
19223
  }
19224
19224
  getClaimableLiqsol(user) {
19225
- return __async$g(this, null, function* () {
19225
+ return __async$h(this, null, function* () {
19226
19226
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
19227
19227
  const bucketAuthority = this.pgs.deriveBucketAuthorityPda();
19228
19228
  const userAta = splToken.getAssociatedTokenAddressSync(
@@ -19265,7 +19265,7 @@ class DistributionClient {
19265
19265
  });
19266
19266
  }
19267
19267
  buildClaimRewardsIx(user) {
19268
- return __async$g(this, null, function* () {
19268
+ return __async$h(this, null, function* () {
19269
19269
  const program = this.program;
19270
19270
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
19271
19271
  const distributionState = this.pgs.deriveDistributionStatePda();
@@ -19303,7 +19303,7 @@ class DistributionClient {
19303
19303
  });
19304
19304
  }
19305
19305
  getAverageScaledPayRate(windowSize = 5) {
19306
- return __async$g(this, null, function* () {
19306
+ return __async$h(this, null, function* () {
19307
19307
  var _a, _b, _c, _d, _e;
19308
19308
  const history = yield this.getPayRateHistory();
19309
19309
  if (!history) {
@@ -19353,7 +19353,7 @@ class DistributionClient {
19353
19353
  }
19354
19354
  }
19355
19355
 
19356
- var __async$f = (__this, __arguments, generator) => {
19356
+ var __async$g = (__this, __arguments, generator) => {
19357
19357
  return new Promise((resolve, reject) => {
19358
19358
  var fulfilled = (value) => {
19359
19359
  try {
@@ -19416,7 +19416,7 @@ class SolanaInstaswapClient {
19416
19416
  this.convertClient = new ConvertClient$1(provider, pgs);
19417
19417
  }
19418
19418
  submitCrossChain(params, hooks) {
19419
- return __async$f(this, null, function* () {
19419
+ return __async$g(this, null, function* () {
19420
19420
  var _a;
19421
19421
  const program = this.program;
19422
19422
  const user = this.provider.wallet.publicKey;
@@ -19480,7 +19480,7 @@ class SolanaInstaswapClient {
19480
19480
  });
19481
19481
  }
19482
19482
  depositToWire(params, hooks) {
19483
- return __async$f(this, null, function* () {
19483
+ return __async$g(this, null, function* () {
19484
19484
  var _a;
19485
19485
  const program = this.program;
19486
19486
  const user = this.provider.wallet.publicKey;
@@ -19561,7 +19561,7 @@ class SolanaInstaswapClient {
19561
19561
  });
19562
19562
  }
19563
19563
  getConnectedBalances(owner) {
19564
- return __async$f(this, null, function* () {
19564
+ return __async$g(this, null, function* () {
19565
19565
  var _a, _b, _c, _d;
19566
19566
  const resolvedOwner = this.resolveOwner(owner);
19567
19567
  const liqsolMint = this.pgs.deriveLiqsolMintPda();
@@ -19583,7 +19583,7 @@ class SolanaInstaswapClient {
19583
19583
  });
19584
19584
  }
19585
19585
  finalizeReadyEpoch(force = false) {
19586
- return __async$f(this, null, function* () {
19586
+ return __async$g(this, null, function* () {
19587
19587
  var _a;
19588
19588
  const program = this.program;
19589
19589
  const epochNumber = yield this.pgs.fetchOppEpochNumber(this.provider.connection);
@@ -19640,7 +19640,7 @@ class SolanaInstaswapClient {
19640
19640
  });
19641
19641
  }
19642
19642
  fetchPendingAttestations(epochNumber) {
19643
- return __async$f(this, null, function* () {
19643
+ return __async$g(this, null, function* () {
19644
19644
  const program = this.program;
19645
19645
  try {
19646
19646
  return yield program.account.pendingAttestations.fetch(
@@ -19656,7 +19656,7 @@ class SolanaInstaswapClient {
19656
19656
  return message.includes("EpochFinalizationRequired") || message.includes("Epoch finalization required") || message.includes("Outbound epoch is already ready");
19657
19657
  }
19658
19658
  runRpcWithRecovery(submit) {
19659
- return __async$f(this, null, function* () {
19659
+ return __async$g(this, null, function* () {
19660
19660
  try {
19661
19661
  return yield submit();
19662
19662
  } catch (error) {
@@ -19688,7 +19688,7 @@ class SolanaInstaswapClient {
19688
19688
  return (_a = anyBase58Match == null ? void 0 : anyBase58Match[1]) != null ? _a : null;
19689
19689
  }
19690
19690
  waitForSignatureSuccess(signature) {
19691
- return __async$f(this, null, function* () {
19691
+ return __async$g(this, null, function* () {
19692
19692
  for (let attempt = 0; attempt < 10; attempt += 1) {
19693
19693
  const response = yield this.provider.connection.getSignatureStatuses(
19694
19694
  [signature],
@@ -19738,12 +19738,12 @@ class SolanaInstaswapClient {
19738
19738
  return 0;
19739
19739
  }
19740
19740
  sleep(ms) {
19741
- return __async$f(this, null, function* () {
19741
+ return __async$g(this, null, function* () {
19742
19742
  yield new Promise((resolve) => setTimeout(resolve, ms));
19743
19743
  });
19744
19744
  }
19745
19745
  sendInstructions(ix) {
19746
- return __async$f(this, null, function* () {
19746
+ return __async$g(this, null, function* () {
19747
19747
  if (!this.submitInstructions) {
19748
19748
  throw new Error("Solana instruction submitter is not configured.");
19749
19749
  }
@@ -19752,7 +19752,7 @@ class SolanaInstaswapClient {
19752
19752
  }
19753
19753
  }
19754
19754
 
19755
- var __async$e = (__this, __arguments, generator) => {
19755
+ var __async$f = (__this, __arguments, generator) => {
19756
19756
  return new Promise((resolve, reject) => {
19757
19757
  var fulfilled = (value) => {
19758
19758
  try {
@@ -19779,7 +19779,7 @@ class LeaderboardClient {
19779
19779
  this.program = pgs.getProgram("validatorLeaderboard");
19780
19780
  }
19781
19781
  getState() {
19782
- return __async$e(this, null, function* () {
19782
+ return __async$f(this, null, function* () {
19783
19783
  const pda = this.pgs.deriveLeaderboardStatePda();
19784
19784
  try {
19785
19785
  return yield this.program.account.leaderboardState.fetch(pda);
@@ -19789,7 +19789,7 @@ class LeaderboardClient {
19789
19789
  });
19790
19790
  }
19791
19791
  getValidatorRecord(voteAccount) {
19792
- return __async$e(this, null, function* () {
19792
+ return __async$f(this, null, function* () {
19793
19793
  const pda = this.pgs.deriveValidatorRecordPda(voteAccount);
19794
19794
  try {
19795
19795
  return yield this.program.account.validatorRecord.fetchNullable(pda);
@@ -19799,7 +19799,7 @@ class LeaderboardClient {
19799
19799
  });
19800
19800
  }
19801
19801
  getTopValidators(limit = 20) {
19802
- return __async$e(this, null, function* () {
19802
+ return __async$f(this, null, function* () {
19803
19803
  try {
19804
19804
  const leaderboardPda = this.pgs.deriveLeaderboardStatePda();
19805
19805
  const leaderboard = yield this.program.account.leaderboardState.fetch(leaderboardPda);
@@ -19838,7 +19838,7 @@ class LeaderboardClient {
19838
19838
  }
19839
19839
  }
19840
19840
 
19841
- var __async$d = (__this, __arguments, generator) => {
19841
+ var __async$e = (__this, __arguments, generator) => {
19842
19842
  return new Promise((resolve, reject) => {
19843
19843
  var fulfilled = (value) => {
19844
19844
  try {
@@ -19899,7 +19899,7 @@ class OutpostClient {
19899
19899
  return this.provider.wallet;
19900
19900
  }
19901
19901
  buildAccounts(user) {
19902
- return __async$d(this, null, function* () {
19902
+ return __async$e(this, null, function* () {
19903
19903
  const userPk = user != null ? user : this.wallet.publicKey;
19904
19904
  if (!userPk) {
19905
19905
  throw new Error("OutpostClient.buildAccounts: wallet not connected");
@@ -19908,13 +19908,27 @@ class OutpostClient {
19908
19908
  });
19909
19909
  }
19910
19910
  getTokenBalance(ata) {
19911
- return __async$d(this, null, function* () {
19912
- const bal = yield this.connection.getTokenAccountBalance(ata);
19913
- return new anchor.BN(bal.value.amount);
19911
+ return __async$e(this, null, function* () {
19912
+ try {
19913
+ const bal = yield this.connection.getTokenAccountBalance(ata);
19914
+ return new anchor.BN(bal.value.amount);
19915
+ } catch (error) {
19916
+ if (this.isMissingTokenAccountError(error)) {
19917
+ return new anchor.BN(0);
19918
+ }
19919
+ throw error;
19920
+ }
19914
19921
  });
19915
19922
  }
19923
+ isMissingTokenAccountError(error) {
19924
+ var _a;
19925
+ const message = String(
19926
+ (_a = error == null ? void 0 : error.message) != null ? _a : ""
19927
+ ).toLowerCase();
19928
+ return message.includes("failed to get token account balance") && message.includes("could not find account");
19929
+ }
19916
19930
  fetchOutpostAccount(address) {
19917
- return __async$d(this, null, function* () {
19931
+ return __async$e(this, null, function* () {
19918
19932
  const program = this.program;
19919
19933
  try {
19920
19934
  return yield program.account.outpostAccount.fetchNullable(address);
@@ -19933,7 +19947,7 @@ class OutpostClient {
19933
19947
  });
19934
19948
  }
19935
19949
  fetchWireState(user) {
19936
- return __async$d(this, null, function* () {
19950
+ return __async$e(this, null, function* () {
19937
19951
  const program = this.program;
19938
19952
  const userPk = user != null ? user : this.wallet.publicKey;
19939
19953
  if (!userPk) throw new Error("OutpostClient.fetchWireState: wallet not connected");
@@ -19967,7 +19981,7 @@ class OutpostClient {
19967
19981
  });
19968
19982
  }
19969
19983
  buildStakeIx(_0) {
19970
- return __async$d(this, arguments, function* (amountLamports, user = this.wallet.publicKey, wireAccount) {
19984
+ return __async$e(this, arguments, function* (amountLamports, user = this.wallet.publicKey, wireAccount) {
19971
19985
  const program = this.program;
19972
19986
  if (!user) {
19973
19987
  throw new Error("OutpostClient.buildStakeIx: wallet not connected");
@@ -19987,7 +20001,7 @@ class OutpostClient {
19987
20001
  });
19988
20002
  }
19989
20003
  buildUnstakeIx(amountLamports, user) {
19990
- return __async$d(this, null, function* () {
20004
+ return __async$e(this, null, function* () {
19991
20005
  const program = this.program;
19992
20006
  const userPk = user != null ? user : this.wallet.publicKey;
19993
20007
  if (!userPk) {
@@ -20055,7 +20069,7 @@ class OutpostClient {
20055
20069
  }
20056
20070
  }
20057
20071
 
20058
- var __async$c = (__this, __arguments, generator) => {
20072
+ var __async$d = (__this, __arguments, generator) => {
20059
20073
  return new Promise((resolve, reject) => {
20060
20074
  var fulfilled = (value) => {
20061
20075
  try {
@@ -20088,33 +20102,33 @@ class TokenClient {
20088
20102
  return this.provider.connection;
20089
20103
  }
20090
20104
  getAccounts(user) {
20091
- return __async$c(this, null, function* () {
20105
+ return __async$d(this, null, function* () {
20092
20106
  return buildOutpostAccounts(this.provider.connection, user, this.pgs);
20093
20107
  });
20094
20108
  }
20095
20109
  fetchGlobalState() {
20096
- return __async$c(this, null, function* () {
20110
+ return __async$d(this, null, function* () {
20097
20111
  const program = this.program;
20098
20112
  const { globalState } = yield this.getAccounts(this.wallet.publicKey);
20099
20113
  return program.account.globalState.fetch(globalState);
20100
20114
  });
20101
20115
  }
20102
20116
  fetchTrancheState() {
20103
- return __async$c(this, null, function* () {
20117
+ return __async$d(this, null, function* () {
20104
20118
  const program = this.program;
20105
20119
  const { trancheState } = yield this.getAccounts(this.wallet.publicKey);
20106
20120
  return program.account.trancheState.fetch(trancheState);
20107
20121
  });
20108
20122
  }
20109
20123
  fetchOutpostAccount(user) {
20110
- return __async$c(this, null, function* () {
20124
+ return __async$d(this, null, function* () {
20111
20125
  const program = this.program;
20112
20126
  const { outpostAccount } = yield this.getAccounts(user);
20113
20127
  return program.account.outpostAccount.fetchNullable(outpostAccount);
20114
20128
  });
20115
20129
  }
20116
20130
  fetchUserPretokenRecord(user) {
20117
- return __async$c(this, null, function* () {
20131
+ return __async$d(this, null, function* () {
20118
20132
  const program = this.program;
20119
20133
  const { userPretokenRecord } = yield this.getAccounts(user);
20120
20134
  return program.account.userPretokenRecord.fetchNullable(
@@ -20123,7 +20137,7 @@ class TokenClient {
20123
20137
  });
20124
20138
  }
20125
20139
  buildPurchaseIx(_0) {
20126
- return __async$c(this, arguments, function* (amountLamports, user = this.wallet.publicKey) {
20140
+ return __async$d(this, arguments, function* (amountLamports, user = this.wallet.publicKey) {
20127
20141
  var _a, _b;
20128
20142
  const program = this.program;
20129
20143
  console.log("build purchase for", user.toBase58());
@@ -20163,7 +20177,7 @@ class TokenClient {
20163
20177
  });
20164
20178
  }
20165
20179
  getSolPriceUsdSafe() {
20166
- return __async$c(this, null, function* () {
20180
+ return __async$d(this, null, function* () {
20167
20181
  try {
20168
20182
  const price = yield this.getSolPriceUsd();
20169
20183
  return { price, timestamp: void 0 };
@@ -20173,7 +20187,7 @@ class TokenClient {
20173
20187
  });
20174
20188
  }
20175
20189
  getSolPriceUsd() {
20176
- return __async$c(this, null, function* () {
20190
+ return __async$d(this, null, function* () {
20177
20191
  const program = this.program;
20178
20192
  const priceHistoryPda = this.pgs.derivePriceHistoryPda();
20179
20193
  const history = yield program.account.priceHistory.fetch(
@@ -20220,7 +20234,7 @@ var __spreadValues$1 = (a, b) => {
20220
20234
  return a;
20221
20235
  };
20222
20236
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
20223
- var __async$b = (__this, __arguments, generator) => {
20237
+ var __async$c = (__this, __arguments, generator) => {
20224
20238
  return new Promise((resolve, reject) => {
20225
20239
  var fulfilled = (value) => {
20226
20240
  try {
@@ -20544,7 +20558,7 @@ class SolanaProgramService {
20544
20558
  )[0];
20545
20559
  }
20546
20560
  fetchOppEpochNumber(connection) {
20547
- return __async$b(this, null, function* () {
20561
+ return __async$c(this, null, function* () {
20548
20562
  const pda = this.deriveOppEpochStatePda();
20549
20563
  const info = yield connection.getAccountInfo(pda);
20550
20564
  if (!(info == null ? void 0 : info.data)) {
@@ -20566,14 +20580,14 @@ class SolanaProgramService {
20566
20580
  )[0];
20567
20581
  }
20568
20582
  deriveEphemeralStakeAddress(user, seed) {
20569
- return __async$b(this, null, function* () {
20583
+ return __async$c(this, null, function* () {
20570
20584
  const seedStr = `ephemeral_${seed}`;
20571
20585
  return web3_js.PublicKey.createWithSeed(user, seedStr, web3_js.StakeProgram.programId);
20572
20586
  });
20573
20587
  }
20574
20588
  }
20575
20589
 
20576
- var __async$a = (__this, __arguments, generator) => {
20590
+ var __async$b = (__this, __arguments, generator) => {
20577
20591
  return new Promise((resolve, reject) => {
20578
20592
  var fulfilled = (value) => {
20579
20593
  try {
@@ -20635,12 +20649,12 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20635
20649
  const anchorWallet = adapter ? {
20636
20650
  publicKey: solWalletPubkey,
20637
20651
  signTransaction(tx) {
20638
- return __async$a(this, null, function* () {
20652
+ return __async$b(this, null, function* () {
20639
20653
  return adapter.signTransaction(tx);
20640
20654
  });
20641
20655
  },
20642
20656
  signAllTransactions(txs) {
20643
- return __async$a(this, null, function* () {
20657
+ return __async$b(this, null, function* () {
20644
20658
  if (adapter.signAllTransactions) {
20645
20659
  return adapter.signAllTransactions(txs);
20646
20660
  }
@@ -20652,14 +20666,14 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20652
20666
  } : {
20653
20667
  publicKey: solWalletPubkey,
20654
20668
  signTransaction(_tx) {
20655
- return __async$a(this, null, function* () {
20669
+ return __async$b(this, null, function* () {
20656
20670
  throw new Error(
20657
20671
  "Wallet not connected: signTransaction not available"
20658
20672
  );
20659
20673
  });
20660
20674
  },
20661
20675
  signAllTransactions(_txs) {
20662
- return __async$a(this, null, function* () {
20676
+ return __async$b(this, null, function* () {
20663
20677
  throw new Error(
20664
20678
  "Wallet not connected: signAllTransactions not available"
20665
20679
  );
@@ -20700,14 +20714,14 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20700
20714
  return config != null ? config : null;
20701
20715
  }
20702
20716
  deposit(amountLamports) {
20703
- return __async$a(this, null, function* () {
20717
+ return __async$b(this, null, function* () {
20704
20718
  var _a;
20705
20719
  this.ensureUser();
20706
20720
  if (amountLamports <= BigInt(0))
20707
20721
  throw new Error("Deposit amount must be greater than zero.");
20708
20722
  try {
20709
20723
  const user = (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
20710
- const submit = (ix) => __async$a(this, null, function* () {
20724
+ const submit = (ix) => __async$b(this, null, function* () {
20711
20725
  return !!this.squadsX ? yield this.sendSquadsIxs(ix) : yield this.buildAndSendIx(ix);
20712
20726
  });
20713
20727
  try {
@@ -20729,7 +20743,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20729
20743
  });
20730
20744
  }
20731
20745
  withdraw(amountLamports) {
20732
- return __async$a(this, null, function* () {
20746
+ return __async$b(this, null, function* () {
20733
20747
  this.ensureUser();
20734
20748
  if (amountLamports <= BigInt(0))
20735
20749
  throw new Error("Withdraw amount must be greater than zero.");
@@ -20743,7 +20757,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20743
20757
  });
20744
20758
  }
20745
20759
  getPendingWithdraws(address) {
20746
- return __async$a(this, null, function* () {
20760
+ return __async$b(this, null, function* () {
20747
20761
  var _a;
20748
20762
  this.ensureUser();
20749
20763
  const owner = address ? new web3_js.PublicKey(address) : (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
@@ -20751,7 +20765,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20751
20765
  });
20752
20766
  }
20753
20767
  claimWithdraw(tokenId) {
20754
- return __async$a(this, null, function* () {
20768
+ return __async$b(this, null, function* () {
20755
20769
  var _a;
20756
20770
  this.ensureUser();
20757
20771
  const owner = (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
@@ -20764,14 +20778,84 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20764
20778
  }
20765
20779
  });
20766
20780
  }
20781
+ getLiqsolDestinationOwner(owner) {
20782
+ var _a;
20783
+ return (_a = owner != null ? owner : this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
20784
+ }
20785
+ getLiqsolDestinationAta(owner) {
20786
+ const destinationOwner = this.getLiqsolDestinationOwner(owner);
20787
+ const mint = this.program.deriveLiqsolMintPda();
20788
+ return splToken.getAssociatedTokenAddressSync(
20789
+ mint,
20790
+ destinationOwner,
20791
+ true,
20792
+ splToken.TOKEN_2022_PROGRAM_ID,
20793
+ splToken.ASSOCIATED_TOKEN_PROGRAM_ID
20794
+ );
20795
+ }
20796
+ getLiqsolDestinationAtaState(owner) {
20797
+ return __async$b(this, null, function* () {
20798
+ const destinationOwner = this.getLiqsolDestinationOwner(owner);
20799
+ const mint = this.program.deriveLiqsolMintPda();
20800
+ const ata = this.getLiqsolDestinationAta(destinationOwner);
20801
+ const accountInfo = yield this.connection.getAccountInfo(ata, "confirmed");
20802
+ return {
20803
+ owner: destinationOwner,
20804
+ mint,
20805
+ ata,
20806
+ exists: !!accountInfo
20807
+ };
20808
+ });
20809
+ }
20810
+ maybeBuildCreateLiqsolDestinationAtaIx(owner) {
20811
+ return __async$b(this, null, function* () {
20812
+ const state = yield this.getLiqsolDestinationAtaState(owner);
20813
+ if (state.exists) {
20814
+ return null;
20815
+ }
20816
+ return splToken.createAssociatedTokenAccountInstruction(
20817
+ this.feePayer,
20818
+ state.ata,
20819
+ state.owner,
20820
+ state.mint,
20821
+ splToken.TOKEN_2022_PROGRAM_ID,
20822
+ splToken.ASSOCIATED_TOKEN_PROGRAM_ID
20823
+ );
20824
+ });
20825
+ }
20826
+ ensureLiqsolDestinationAta(owner) {
20827
+ return __async$b(this, null, function* () {
20828
+ this.ensureUser();
20829
+ const createAtaIx = yield this.maybeBuildCreateLiqsolDestinationAtaIx(owner);
20830
+ if (!createAtaIx) {
20831
+ return null;
20832
+ }
20833
+ try {
20834
+ return yield this.buildAndSendIx(createAtaIx);
20835
+ } catch (error) {
20836
+ if (!this.isAtaAlreadyCreatedError(error)) {
20837
+ throw error;
20838
+ }
20839
+ return null;
20840
+ }
20841
+ });
20842
+ }
20843
+ prependLiqsolDestinationAtaIx(ix, owner) {
20844
+ return __async$b(this, null, function* () {
20845
+ const ixs = Array.isArray(ix) ? [...ix] : [ix];
20846
+ const createAtaIx = yield this.maybeBuildCreateLiqsolDestinationAtaIx(owner);
20847
+ return createAtaIx ? [createAtaIx, ...ixs] : ixs;
20848
+ });
20849
+ }
20767
20850
  claimLiqsolRewards() {
20768
- return __async$a(this, null, function* () {
20851
+ return __async$b(this, null, function* () {
20769
20852
  var _a;
20770
20853
  this.ensureUser();
20771
20854
  const owner = (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
20772
20855
  try {
20773
20856
  const ix = yield this.distributionClient.buildClaimRewardsIx(owner);
20774
- return !!this.squadsX ? yield this.sendSquadsIxs(ix) : yield this.buildAndSendIx(ix);
20857
+ const ixs = yield this.prependLiqsolDestinationAtaIx(ix, owner);
20858
+ return !!this.squadsX ? yield this.sendSquadsIxs(ixs) : yield this.buildAndSendIx(ixs);
20775
20859
  } catch (err) {
20776
20860
  console.log(`Failed to claim liqSOL rewards on Solana: ${err}`);
20777
20861
  throw err;
@@ -20779,7 +20863,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20779
20863
  });
20780
20864
  }
20781
20865
  stake(amountLamports, wireAccount) {
20782
- return __async$a(this, null, function* () {
20866
+ return __async$b(this, null, function* () {
20783
20867
  this.ensureUser();
20784
20868
  if (!amountLamports || amountLamports <= BigInt(0))
20785
20869
  throw new Error("Stake amount must be greater than zero.");
@@ -20797,13 +20881,16 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20797
20881
  });
20798
20882
  }
20799
20883
  unstake(amountLamports) {
20800
- return __async$a(this, null, function* () {
20884
+ return __async$b(this, null, function* () {
20885
+ var _a;
20801
20886
  this.ensureUser();
20802
20887
  if (!amountLamports || amountLamports <= BigInt(0))
20803
20888
  throw new Error("Unstake amount must be greater than zero.");
20804
20889
  try {
20890
+ const owner = (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
20805
20891
  const ix = yield this.outpostClient.buildUnstakeIx(amountLamports, this.squadsVaultPDA);
20806
- return !!this.squadsX ? yield this.sendSquadsIxs(ix) : yield this.buildAndSendIx(ix);
20892
+ const ixs = yield this.prependLiqsolDestinationAtaIx(ix, owner);
20893
+ return !!this.squadsX ? yield this.sendSquadsIxs(ixs) : yield this.buildAndSendIx(ixs);
20807
20894
  } catch (err) {
20808
20895
  console.log(`Failed to unstake Solana: ${err}`);
20809
20896
  throw err;
@@ -20811,7 +20898,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20811
20898
  });
20812
20899
  }
20813
20900
  buy(amountLamports) {
20814
- return __async$a(this, null, function* () {
20901
+ return __async$b(this, null, function* () {
20815
20902
  this.ensureUser();
20816
20903
  if (!amountLamports || amountLamports <= BigInt(0))
20817
20904
  throw new Error("liqSOL pretoken purchase requires a positive amount.");
@@ -20825,7 +20912,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20825
20912
  });
20826
20913
  }
20827
20914
  depositAndStake(amountLamports, wireAccount) {
20828
- return __async$a(this, null, function* () {
20915
+ return __async$b(this, null, function* () {
20829
20916
  var _a;
20830
20917
  this.ensureUser();
20831
20918
  if (!amountLamports || amountLamports <= BigInt(0))
@@ -20846,7 +20933,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20846
20933
  });
20847
20934
  }
20848
20935
  depositAndBuy(amountLamports) {
20849
- return __async$a(this, null, function* () {
20936
+ return __async$b(this, null, function* () {
20850
20937
  var _a;
20851
20938
  this.ensureUser();
20852
20939
  if (!amountLamports || amountLamports <= BigInt(0))
@@ -20863,7 +20950,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20863
20950
  });
20864
20951
  }
20865
20952
  unstakeAndWithdraw(amountLamports) {
20866
- return __async$a(this, null, function* () {
20953
+ return __async$b(this, null, function* () {
20867
20954
  var _a;
20868
20955
  this.ensureUser();
20869
20956
  if (!amountLamports || amountLamports <= BigInt(0))
@@ -20872,7 +20959,8 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20872
20959
  const user = (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
20873
20960
  const unstakeIx = yield this.outpostClient.buildUnstakeIx(amountLamports, user);
20874
20961
  const withdrawIx = yield this.convertClient.buildWithdrawTx(amountLamports, user);
20875
- return !!this.squadsX ? yield this.sendSquadsIxs([unstakeIx, withdrawIx]) : yield this.buildAndSendIx([unstakeIx, withdrawIx]);
20962
+ const ixs = yield this.prependLiqsolDestinationAtaIx([unstakeIx, withdrawIx], user);
20963
+ return !!this.squadsX ? yield this.sendSquadsIxs(ixs) : yield this.buildAndSendIx(ixs);
20876
20964
  } catch (err) {
20877
20965
  console.log(`Failed to unstake and withdraw: ${err}`);
20878
20966
  throw err;
@@ -20880,7 +20968,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20880
20968
  });
20881
20969
  }
20882
20970
  getPortfolio(address) {
20883
- return __async$a(this, null, function* () {
20971
+ return __async$b(this, null, function* () {
20884
20972
  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;
20885
20973
  try {
20886
20974
  const user = address ? new web3_js.PublicKey(address) : !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
@@ -20977,7 +21065,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20977
21065
  });
20978
21066
  }
20979
21067
  getUserRecord() {
20980
- return __async$a(this, null, function* () {
21068
+ return __async$b(this, null, function* () {
20981
21069
  if (!this.pubKey) throw new Error("User pubKey is undefined");
20982
21070
  return this.distributionClient.getUserRecord(this.solPubKey);
20983
21071
  });
@@ -20995,7 +21083,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
20995
21083
  return pda[0];
20996
21084
  }
20997
21085
  sendSquadsIxs(ix) {
20998
- return __async$a(this, null, function* () {
21086
+ return __async$b(this, null, function* () {
20999
21087
  var _a, _b, _c, _d;
21000
21088
  if (!this.squadsX) throw new Error("Attempting to wrap Squads instruction without SquadsX config");
21001
21089
  const ixs = Array.isArray(ix) ? ix : [ix];
@@ -21040,7 +21128,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21040
21128
  });
21041
21129
  }
21042
21130
  buildAndSendIx(ix) {
21043
- return __async$a(this, null, function* () {
21131
+ return __async$b(this, null, function* () {
21044
21132
  const ixs = Array.isArray(ix) ? ix : [ix];
21045
21133
  const computeLimitIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 6e5 });
21046
21134
  const computePriceIx = web3_js.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 2e3 });
@@ -21062,7 +21150,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21062
21150
  });
21063
21151
  }
21064
21152
  sendAndConfirmHttp(signed, _ctx) {
21065
- return __async$a(this, null, function* () {
21153
+ return __async$b(this, null, function* () {
21066
21154
  var _a, _b, _c;
21067
21155
  this.ensureUser();
21068
21156
  const rawTx = signed.serialize();
@@ -21092,19 +21180,19 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21092
21180
  });
21093
21181
  }
21094
21182
  signTransaction(tx) {
21095
- return __async$a(this, null, function* () {
21183
+ return __async$b(this, null, function* () {
21096
21184
  this.ensureUser();
21097
21185
  return this.anchor.wallet.signTransaction(tx);
21098
21186
  });
21099
21187
  }
21100
21188
  sendTransaction(signed) {
21101
- return __async$a(this, null, function* () {
21189
+ return __async$b(this, null, function* () {
21102
21190
  this.ensureUser();
21103
21191
  return this.anchor.sendAndConfirm(signed);
21104
21192
  });
21105
21193
  }
21106
21194
  prepareTx(tx) {
21107
- return __async$a(this, null, function* () {
21195
+ return __async$b(this, null, function* () {
21108
21196
  const { blockhash, lastValidBlockHeight } = yield this.connection.getLatestBlockhash("confirmed");
21109
21197
  tx.recentBlockhash = blockhash;
21110
21198
  tx.feePayer = this.feePayer;
@@ -21126,8 +21214,13 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21126
21214
  const normalized = message.toLowerCase();
21127
21215
  return normalized.includes("legacyuserrecordmigrationrequired") || normalized.includes("legacy user record must be migrated") || normalized.includes("custom program error: 0x1784");
21128
21216
  }
21217
+ isAtaAlreadyCreatedError(error) {
21218
+ const message = error instanceof Error ? error.message : String(error != null ? error : "");
21219
+ const normalized = message.toLowerCase();
21220
+ return normalized.includes("already in use") || normalized.includes("already exists");
21221
+ }
21129
21222
  getTrancheSnapshot(chainID) {
21130
- return __async$a(this, null, function* () {
21223
+ return __async$b(this, null, function* () {
21131
21224
  try {
21132
21225
  const [globalState, trancheState] = yield Promise.all([
21133
21226
  this.tokenClient.fetchGlobalState(),
@@ -21148,7 +21241,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21148
21241
  });
21149
21242
  }
21150
21243
  getSystemAPY() {
21151
- return __async$a(this, null, function* () {
21244
+ return __async$b(this, null, function* () {
21152
21245
  try {
21153
21246
  const ratePerEpoch = yield this.getEpochRateDecimalFromProgram();
21154
21247
  const epochsPerYear = yield this.getEpochsPerYearFromCluster();
@@ -21162,7 +21255,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21162
21255
  });
21163
21256
  }
21164
21257
  getEpochRateDecimalFromProgram() {
21165
- return __async$a(this, null, function* () {
21258
+ return __async$b(this, null, function* () {
21166
21259
  const liqSolCoreProgram = this.program.getProgram("liqsolCore");
21167
21260
  const payRateHistoryPda = this.program.derivePayRateHistoryPda();
21168
21261
  const payRateHistory = yield liqSolCoreProgram.account.payRateHistory.fetch(payRateHistoryPda);
@@ -21193,7 +21286,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21193
21286
  });
21194
21287
  }
21195
21288
  getEpochsPerYearFromCluster() {
21196
- return __async$a(this, null, function* () {
21289
+ return __async$b(this, null, function* () {
21197
21290
  const now = Date.now();
21198
21291
  if (this.epochsPerYearCache && now - this.epochsPerYearCache.fetchedAt < _SolanaStakingClient.EPOCHS_PER_YEAR_TTL_MS) {
21199
21292
  return this.epochsPerYearCache.value;
@@ -21226,7 +21319,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21226
21319
  });
21227
21320
  }
21228
21321
  getDepositFee(amountLamports, windowSize = 5) {
21229
- return __async$a(this, null, function* () {
21322
+ return __async$b(this, null, function* () {
21230
21323
  var _a, _b, _c;
21231
21324
  if (amountLamports <= BigInt(0)) {
21232
21325
  return BigInt(0);
@@ -21254,7 +21347,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21254
21347
  });
21255
21348
  }
21256
21349
  getDepositBuffer(options) {
21257
- return __async$a(this, null, function* () {
21350
+ return __async$b(this, null, function* () {
21258
21351
  var _a, _b, _c, _d;
21259
21352
  this.ensureUser();
21260
21353
  const balanceLamports = (_a = options == null ? void 0 : options.balanceOverrideLamports) != null ? _a : BigInt(yield this.connection.getBalance(this.feePayer, commitment));
@@ -21310,7 +21403,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
21310
21403
  });
21311
21404
  }
21312
21405
  getSingleTxFeeLamports() {
21313
- return __async$a(this, null, function* () {
21406
+ return __async$b(this, null, function* () {
21314
21407
  var _a;
21315
21408
  const now = Date.now();
21316
21409
  if (this.cachedTxFee && now - this.cachedTxFee.fetchedAt < _SolanaStakingClient.FEE_CACHE_TTL_MS) {
@@ -71379,7 +71472,7 @@ var HoodiERC1155Artifact = {
71379
71472
  deployedLinkReferences: deployedLinkReferences$1
71380
71473
  };
71381
71474
 
71382
- var __async$9 = (__this, __arguments, generator) => {
71475
+ var __async$a = (__this, __arguments, generator) => {
71383
71476
  return new Promise((resolve, reject) => {
71384
71477
  var fulfilled = (value) => {
71385
71478
  try {
@@ -71656,7 +71749,7 @@ class EthereumContractService {
71656
71749
  return new ethers.Contract(address, abi, this.signer);
71657
71750
  }
71658
71751
  getNetwork() {
71659
- return __async$9(this, null, function* () {
71752
+ return __async$a(this, null, function* () {
71660
71753
  var _a;
71661
71754
  return (_a = this.provider) == null ? void 0 : _a.getNetwork();
71662
71755
  });
@@ -71728,7 +71821,7 @@ var __spreadValues = (a, b) => {
71728
71821
  return a;
71729
71822
  };
71730
71823
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
71731
- var __async$8 = (__this, __arguments, generator) => {
71824
+ var __async$9 = (__this, __arguments, generator) => {
71732
71825
  return new Promise((resolve, reject) => {
71733
71826
  var fulfilled = (value) => {
71734
71827
  try {
@@ -71774,7 +71867,7 @@ function formatContractErrors(err) {
71774
71867
  }
71775
71868
  }
71776
71869
  function sendOPPFinalize(opp, gasLimit) {
71777
- return __async$8(this, null, function* () {
71870
+ return __async$9(this, null, function* () {
71778
71871
  var _a;
71779
71872
  const overrides = {};
71780
71873
  try {
@@ -71824,7 +71917,7 @@ function sendOPPFinalize(opp, gasLimit) {
71824
71917
  });
71825
71918
  }
71826
71919
  function resolveContractWriteOverrides(_0, _1) {
71827
- return __async$8(this, arguments, function* (contract, method, args = [], overrides = {}, options) {
71920
+ return __async$9(this, arguments, function* (contract, method, args = [], overrides = {}, options) {
71828
71921
  var _a, _b, _c;
71829
71922
  if (overrides["gasLimit"] != null) {
71830
71923
  return overrides;
@@ -71935,7 +72028,7 @@ function buildEthereumTrancheLadder(options) {
71935
72028
  return ladder;
71936
72029
  }
71937
72030
  function buildEthereumTrancheSnapshot(options) {
71938
- return __async$8(this, null, function* () {
72031
+ return __async$9(this, null, function* () {
71939
72032
  const {
71940
72033
  chainID,
71941
72034
  ethPriceUsd,
@@ -71995,7 +72088,7 @@ function buildEthereumTrancheSnapshot(options) {
71995
72088
  });
71996
72089
  }
71997
72090
 
71998
- var __async$7 = (__this, __arguments, generator) => {
72091
+ var __async$8 = (__this, __arguments, generator) => {
71999
72092
  return new Promise((resolve, reject) => {
72000
72093
  var fulfilled = (value) => {
72001
72094
  try {
@@ -72023,7 +72116,7 @@ class ConvertClient {
72023
72116
  this.contractService = contract;
72024
72117
  }
72025
72118
  simulateDeposit(amount) {
72026
- return __async$7(this, null, function* () {
72119
+ return __async$8(this, null, function* () {
72027
72120
  const amountWei = ethers.BigNumber.isBigNumber(amount) ? amount : ethers.BigNumber.from(amount);
72028
72121
  yield this.contract.DepositManager.callStatic.deposit({
72029
72122
  value: amountWei
@@ -72031,7 +72124,7 @@ class ConvertClient {
72031
72124
  });
72032
72125
  }
72033
72126
  performDeposit(amountWei) {
72034
- return __async$7(this, null, function* () {
72127
+ return __async$8(this, null, function* () {
72035
72128
  var _a, _b;
72036
72129
  const minDeposit = yield this.contract.DepositManager.minDeposit();
72037
72130
  if (amountWei.lt(minDeposit)) {
@@ -72070,7 +72163,7 @@ class ConvertClient {
72070
72163
  });
72071
72164
  }
72072
72165
  performWithdraw(signerAddress, amountWei) {
72073
- return __async$7(this, null, function* () {
72166
+ return __async$8(this, null, function* () {
72074
72167
  var _a, _b;
72075
72168
  let tx, receipt;
72076
72169
  try {
@@ -72098,7 +72191,7 @@ class ConvertClient {
72098
72191
  });
72099
72192
  }
72100
72193
  claimWithdraw(tokenId) {
72101
- return __async$7(this, null, function* () {
72194
+ return __async$8(this, null, function* () {
72102
72195
  var _a, _b;
72103
72196
  let tx, receipt;
72104
72197
  try {
@@ -73256,7 +73349,7 @@ var HoodiLiqEthBridgeArtifact = {
73256
73349
  deployedLinkReferences: deployedLinkReferences
73257
73350
  };
73258
73351
 
73259
- var __async$6 = (__this, __arguments, generator) => {
73352
+ var __async$7 = (__this, __arguments, generator) => {
73260
73353
  return new Promise((resolve, reject) => {
73261
73354
  var fulfilled = (value) => {
73262
73355
  try {
@@ -73292,7 +73385,7 @@ class EthereumInstaswapClient {
73292
73385
  this.rpcUrl = rpcUrl;
73293
73386
  }
73294
73387
  submitCrossChain(params, hooks) {
73295
- return __async$6(this, null, function* () {
73388
+ return __async$7(this, null, function* () {
73296
73389
  var _a;
73297
73390
  const signer = this.requireSigner();
73298
73391
  const owner = yield signer.getAddress();
@@ -73345,7 +73438,7 @@ class EthereumInstaswapClient {
73345
73438
  });
73346
73439
  }
73347
73440
  ensureLiqEthBalance(params) {
73348
- return __async$6(this, null, function* () {
73441
+ return __async$7(this, null, function* () {
73349
73442
  var _a, _b;
73350
73443
  const signer = this.requireSigner();
73351
73444
  const owner = yield signer.getAddress();
@@ -73372,7 +73465,7 @@ class EthereumInstaswapClient {
73372
73465
  });
73373
73466
  }
73374
73467
  depositToWire(params, hooks) {
73375
- return __async$6(this, null, function* () {
73468
+ return __async$7(this, null, function* () {
73376
73469
  var _a, _b;
73377
73470
  const signer = this.requireSigner();
73378
73471
  const quantity = ethers.BigNumber.from(params.quantityWei);
@@ -73418,7 +73511,7 @@ class EthereumInstaswapClient {
73418
73511
  };
73419
73512
  }
73420
73513
  getConnectedBalances(address) {
73421
- return __async$6(this, null, function* () {
73514
+ return __async$7(this, null, function* () {
73422
73515
  const owner = yield this.resolveAddress(address);
73423
73516
  const provider = this.getLocalRpcProvider();
73424
73517
  const liqEthRead = new ethers.ethers.Contract(
@@ -73437,7 +73530,7 @@ class EthereumInstaswapClient {
73437
73530
  });
73438
73531
  }
73439
73532
  runPreflight(depositorWrite, owner, amountIn, destinationChain, destinationAddress, minOut) {
73440
- return __async$6(this, null, function* () {
73533
+ return __async$7(this, null, function* () {
73441
73534
  try {
73442
73535
  yield depositorWrite.callStatic["instaswapCrossChain"](
73443
73536
  amountIn,
@@ -73464,7 +73557,7 @@ class EthereumInstaswapClient {
73464
73557
  });
73465
73558
  }
73466
73559
  reconcileOppEpochAtAddress(oppAddress) {
73467
- return __async$6(this, null, function* () {
73560
+ return __async$7(this, null, function* () {
73468
73561
  const oppRead = new ethers.ethers.Contract(
73469
73562
  oppAddress,
73470
73563
  this.contractService.getInterface("OPP"),
@@ -73485,7 +73578,7 @@ class EthereumInstaswapClient {
73485
73578
  });
73486
73579
  }
73487
73580
  depositNativeForLiqEth(amountWei) {
73488
- return __async$6(this, null, function* () {
73581
+ return __async$7(this, null, function* () {
73489
73582
  const tx = yield this.contractService.getWrite("DepositManager")["deposit"]({
73490
73583
  value: ethers.BigNumber.from(amountWei)
73491
73584
  });
@@ -73497,12 +73590,12 @@ class EthereumInstaswapClient {
73497
73590
  });
73498
73591
  }
73499
73592
  getLiqEthBalance(address) {
73500
- return __async$6(this, null, function* () {
73593
+ return __async$7(this, null, function* () {
73501
73594
  return this.contractService.getReadOnly("LiqEthToken")["balanceOf"](address);
73502
73595
  });
73503
73596
  }
73504
73597
  resolveAddress(address) {
73505
- return __async$6(this, null, function* () {
73598
+ return __async$7(this, null, function* () {
73506
73599
  if (address == null ? void 0 : address.trim()) {
73507
73600
  return address.trim();
73508
73601
  }
@@ -73619,7 +73712,7 @@ class EthereumInstaswapClient {
73619
73712
  }
73620
73713
  }
73621
73714
 
73622
- var __async$5 = (__this, __arguments, generator) => {
73715
+ var __async$6 = (__this, __arguments, generator) => {
73623
73716
  return new Promise((resolve, reject) => {
73624
73717
  var fulfilled = (value) => {
73625
73718
  try {
@@ -73647,7 +73740,7 @@ class StakeClient {
73647
73740
  this.contractService = contract;
73648
73741
  }
73649
73742
  performStake(amountWei, signerAddress) {
73650
- return __async$5(this, null, function* () {
73743
+ return __async$6(this, null, function* () {
73651
73744
  var _a, _b;
73652
73745
  const depositor = this.contract.Depositor.address;
73653
73746
  const liqRead = this.contract.LiqEthToken;
@@ -73700,7 +73793,7 @@ class StakeClient {
73700
73793
  });
73701
73794
  }
73702
73795
  performStakeToWire(amountWei, signerAddress, wireAccount) {
73703
- return __async$5(this, null, function* () {
73796
+ return __async$6(this, null, function* () {
73704
73797
  var _a, _b;
73705
73798
  const depositor = this.contract.Depositor.address;
73706
73799
  const liqRead = this.contract.LiqEthToken;
@@ -73755,7 +73848,7 @@ class StakeClient {
73755
73848
  });
73756
73849
  }
73757
73850
  performWithdrawStake(tokenId, recipient) {
73758
- return __async$5(this, null, function* () {
73851
+ return __async$6(this, null, function* () {
73759
73852
  var _a;
73760
73853
  const tx = yield this.contract.Depositor.withdrawStake(tokenId, recipient);
73761
73854
  const receipt = yield tx.wait(1);
@@ -73777,7 +73870,7 @@ class StakeClient {
73777
73870
  });
73778
73871
  }
73779
73872
  performDepositAndStake(amountWei) {
73780
- return __async$5(this, null, function* () {
73873
+ return __async$6(this, null, function* () {
73781
73874
  var _a, _b;
73782
73875
  try {
73783
73876
  yield this.contract.Depositor.callStatic.depositAndStake({ value: amountWei });
@@ -73808,7 +73901,7 @@ class StakeClient {
73808
73901
  });
73809
73902
  }
73810
73903
  performDepositAndStakeToWire(amountWei, wireAccount) {
73811
- return __async$5(this, null, function* () {
73904
+ return __async$6(this, null, function* () {
73812
73905
  var _a, _b;
73813
73906
  if (!(wireAccount == null ? void 0 : wireAccount.trim())) {
73814
73907
  throw new Error("StakeClient.performDepositAndStakeToWire: wireAccount is required");
@@ -73836,7 +73929,7 @@ class StakeClient {
73836
73929
  });
73837
73930
  }
73838
73931
  performDepositAndPurchase(amountWei) {
73839
- return __async$5(this, null, function* () {
73932
+ return __async$6(this, null, function* () {
73840
73933
  var _a;
73841
73934
  try {
73842
73935
  yield this.contract.Depositor.callStatic.depositAndPurchase({ value: amountWei });
@@ -73856,7 +73949,7 @@ class StakeClient {
73856
73949
  });
73857
73950
  }
73858
73951
  performUnstakeAndRequestWithdraw(tokenId) {
73859
- return __async$5(this, null, function* () {
73952
+ return __async$6(this, null, function* () {
73860
73953
  var _a;
73861
73954
  try {
73862
73955
  yield this.contract.Depositor.callStatic.unstakeAndRequestWithdraw(tokenId);
@@ -73876,7 +73969,7 @@ class StakeClient {
73876
73969
  }
73877
73970
  }
73878
73971
 
73879
- var __async$4 = (__this, __arguments, generator) => {
73972
+ var __async$5 = (__this, __arguments, generator) => {
73880
73973
  return new Promise((resolve, reject) => {
73881
73974
  var fulfilled = (value) => {
73882
73975
  try {
@@ -73904,7 +73997,7 @@ class PretokenClient {
73904
73997
  this.contractService = contract;
73905
73998
  }
73906
73999
  purchasePretokensWithLiqETH(amountLiq, buyer) {
73907
- return __async$4(this, null, function* () {
74000
+ return __async$5(this, null, function* () {
73908
74001
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
73909
74002
  const bal = yield this.contract.LiqEthToken.balanceOf(buyer);
73910
74003
  const paused = yield this.contract.Depositor.paused();
@@ -73978,7 +74071,7 @@ class PretokenClient {
73978
74071
  }
73979
74072
  }
73980
74073
 
73981
- var __async$3 = (__this, __arguments, generator) => {
74074
+ var __async$4 = (__this, __arguments, generator) => {
73982
74075
  return new Promise((resolve, reject) => {
73983
74076
  var fulfilled = (value) => {
73984
74077
  try {
@@ -74015,7 +74108,7 @@ class OPPClient {
74015
74108
  return this.contractService.contract;
74016
74109
  }
74017
74110
  getStatus() {
74018
- return __async$3(this, null, function* () {
74111
+ return __async$4(this, null, function* () {
74019
74112
  const depositor = this.contract.Depositor;
74020
74113
  const opp = this.contract.OPP;
74021
74114
  const oppAddress = yield depositor.oppAddress();
@@ -74056,7 +74149,7 @@ class OPPClient {
74056
74149
  });
74057
74150
  }
74058
74151
  getMessages(address) {
74059
- return __async$3(this, null, function* () {
74152
+ return __async$4(this, null, function* () {
74060
74153
  try {
74061
74154
  const oppMessageFilter = this.contract.OPP.filters.OPPMessage();
74062
74155
  const events = yield this.contract.OPP.queryFilter(oppMessageFilter, 0, "latest");
@@ -74076,7 +74169,7 @@ class OPPClient {
74076
74169
  });
74077
74170
  }
74078
74171
  extractAssertionsFromEvent(event) {
74079
- return __async$3(this, null, function* () {
74172
+ return __async$4(this, null, function* () {
74080
74173
  var _a, _b;
74081
74174
  const header = event.args.header;
74082
74175
  const payloadAssertions = event.args.payload.assertions;
@@ -74313,7 +74406,7 @@ var ReceiptNFTKind = ((ReceiptNFTKind2) => {
74313
74406
  return ReceiptNFTKind2;
74314
74407
  })(ReceiptNFTKind || {});
74315
74408
 
74316
- var __async$2 = (__this, __arguments, generator) => {
74409
+ var __async$3 = (__this, __arguments, generator) => {
74317
74410
  return new Promise((resolve, reject) => {
74318
74411
  var fulfilled = (value) => {
74319
74412
  try {
@@ -74341,12 +74434,12 @@ class ReceiptClient {
74341
74434
  this.contractService = contract;
74342
74435
  }
74343
74436
  allReceipts(address) {
74344
- return __async$2(this, null, function* () {
74437
+ return __async$3(this, null, function* () {
74345
74438
  return this.fetchPreLaunchReceipts(address);
74346
74439
  });
74347
74440
  }
74348
74441
  stakeReceipts(address) {
74349
- return __async$2(this, null, function* () {
74442
+ return __async$3(this, null, function* () {
74350
74443
  try {
74351
74444
  const receipts = yield this.fetchPreLaunchReceipts(address, ReceiptNFTKind.STAKE);
74352
74445
  return receipts;
@@ -74356,12 +74449,12 @@ class ReceiptClient {
74356
74449
  });
74357
74450
  }
74358
74451
  pretokenReceipts(address) {
74359
- return __async$2(this, null, function* () {
74452
+ return __async$3(this, null, function* () {
74360
74453
  return this.fetchPreLaunchReceipts(address, ReceiptNFTKind.PRETOKEN_PURCHASE);
74361
74454
  });
74362
74455
  }
74363
74456
  fetchPreLaunchReceipts(address, type) {
74364
- return __async$2(this, null, function* () {
74457
+ return __async$3(this, null, function* () {
74365
74458
  const receiptContract = this.contract.ReceiptNFT;
74366
74459
  const tokenIds = yield this.getOwnedReceiptNFTsFor(address);
74367
74460
  const results = [];
@@ -74398,7 +74491,7 @@ class ReceiptClient {
74398
74491
  });
74399
74492
  }
74400
74493
  fetchWithdrawReceipts(address) {
74401
- return __async$2(this, null, function* () {
74494
+ return __async$3(this, null, function* () {
74402
74495
  const tokenIds = yield this.getOwnedWithdrawReceiptsFor(address);
74403
74496
  const results = [];
74404
74497
  for (const idBN of tokenIds) {
@@ -74428,7 +74521,7 @@ class ReceiptClient {
74428
74521
  });
74429
74522
  }
74430
74523
  getOwnedWithdrawReceiptsFor(owner, fromBlock = 0, toBlock = "latest") {
74431
- return __async$2(this, null, function* () {
74524
+ return __async$3(this, null, function* () {
74432
74525
  var _a, _b;
74433
74526
  const contract = this.contract.WithdrawalQueue;
74434
74527
  const toLogs = yield contract.queryFilter(
@@ -74456,7 +74549,7 @@ class ReceiptClient {
74456
74549
  });
74457
74550
  }
74458
74551
  getOwnedReceiptNFTsFor(owner, fromBlock = 0, toBlock = "latest") {
74459
- return __async$2(this, null, function* () {
74552
+ return __async$3(this, null, function* () {
74460
74553
  var _a, _b;
74461
74554
  const receiptContract = this.contract.ReceiptNFT;
74462
74555
  const toLogs = yield receiptContract.queryFilter(
@@ -74485,7 +74578,7 @@ class ReceiptClient {
74485
74578
  }
74486
74579
  }
74487
74580
 
74488
- var __async$1 = (__this, __arguments, generator) => {
74581
+ var __async$2 = (__this, __arguments, generator) => {
74489
74582
  return new Promise((resolve, reject) => {
74490
74583
  var fulfilled = (value) => {
74491
74584
  try {
@@ -74513,7 +74606,7 @@ class ValidatorClient {
74513
74606
  this.contractService = contract;
74514
74607
  }
74515
74608
  validatorDepositAndLockBond() {
74516
- return __async$1(this, null, function* () {
74609
+ return __async$2(this, null, function* () {
74517
74610
  var _a, _b;
74518
74611
  const amountWei = ethers.ethers.utils.parseEther("32");
74519
74612
  try {
@@ -74543,7 +74636,7 @@ class ValidatorClient {
74543
74636
  }
74544
74637
  }
74545
74638
 
74546
- var __async = (__this, __arguments, generator) => {
74639
+ var __async$1 = (__this, __arguments, generator) => {
74547
74640
  return new Promise((resolve, reject) => {
74548
74641
  var fulfilled = (value) => {
74549
74642
  try {
@@ -74607,7 +74700,7 @@ class EthereumStakingClient {
74607
74700
  return (_a = this.signer) == null ? void 0 : _a.getAddress();
74608
74701
  }
74609
74702
  deposit(amount) {
74610
- return __async(this, null, function* () {
74703
+ return __async$1(this, null, function* () {
74611
74704
  this.ensureUser();
74612
74705
  const amountWei = ethers.BigNumber.isBigNumber(amount) ? amount : ethers.BigNumber.from(amount);
74613
74706
  const result = yield this.convertClient.performDeposit(amountWei);
@@ -74615,7 +74708,7 @@ class EthereumStakingClient {
74615
74708
  });
74616
74709
  }
74617
74710
  withdraw(amount) {
74618
- return __async(this, null, function* () {
74711
+ return __async$1(this, null, function* () {
74619
74712
  this.ensureUser();
74620
74713
  const address = yield this.address;
74621
74714
  const amountWei = ethers.BigNumber.from(amount);
@@ -74624,14 +74717,14 @@ class EthereumStakingClient {
74624
74717
  });
74625
74718
  }
74626
74719
  getPendingWithdraws(address) {
74627
- return __async(this, null, function* () {
74720
+ return __async$1(this, null, function* () {
74628
74721
  this.ensureUser();
74629
74722
  const owner = address != null ? address : yield this.address;
74630
74723
  return yield this.receiptClient.fetchWithdrawReceipts(owner);
74631
74724
  });
74632
74725
  }
74633
74726
  claimWithdraw(tokenId) {
74634
- return __async(this, null, function* () {
74727
+ return __async$1(this, null, function* () {
74635
74728
  this.ensureUser();
74636
74729
  const tokenIdBigNum = ethers.BigNumber.from(tokenId);
74637
74730
  const result = yield this.convertClient.claimWithdraw(tokenIdBigNum);
@@ -74639,7 +74732,7 @@ class EthereumStakingClient {
74639
74732
  });
74640
74733
  }
74641
74734
  stake(amount, wireAccount) {
74642
- return __async(this, null, function* () {
74735
+ return __async$1(this, null, function* () {
74643
74736
  this.ensureUser();
74644
74737
  const walletAddress = yield this.address;
74645
74738
  const amountWei = ethers.BigNumber.from(amount);
@@ -74648,12 +74741,12 @@ class EthereumStakingClient {
74648
74741
  });
74649
74742
  }
74650
74743
  unstake() {
74651
- return __async(this, null, function* () {
74744
+ return __async$1(this, null, function* () {
74652
74745
  throw new Error("Method not yet implemented.");
74653
74746
  });
74654
74747
  }
74655
74748
  depositAndStake(amount, wireAccount) {
74656
- return __async(this, null, function* () {
74749
+ return __async$1(this, null, function* () {
74657
74750
  this.ensureUser();
74658
74751
  if (!amount || amount <= BigInt(0))
74659
74752
  throw new Error("Amount must be greater than zero.");
@@ -74667,7 +74760,7 @@ class EthereumStakingClient {
74667
74760
  });
74668
74761
  }
74669
74762
  depositAndBuy(amountWei) {
74670
- return __async(this, null, function* () {
74763
+ return __async$1(this, null, function* () {
74671
74764
  this.ensureUser();
74672
74765
  if (!amountWei || amountWei <= BigInt(0))
74673
74766
  throw new Error("Amount must be greater than zero.");
@@ -74676,14 +74769,14 @@ class EthereumStakingClient {
74676
74769
  });
74677
74770
  }
74678
74771
  unstakeAndWithdraw(tokenId) {
74679
- return __async(this, null, function* () {
74772
+ return __async$1(this, null, function* () {
74680
74773
  this.ensureUser();
74681
74774
  const result = yield this.stakeClient.performUnstakeAndRequestWithdraw(ethers.BigNumber.from(tokenId));
74682
74775
  return result.txHash;
74683
74776
  });
74684
74777
  }
74685
74778
  unstakePrelaunch(tokenId, recipient) {
74686
- return __async(this, null, function* () {
74779
+ return __async$1(this, null, function* () {
74687
74780
  this.ensureUser();
74688
74781
  const tokenIdBigNum = ethers.BigNumber.from(tokenId);
74689
74782
  const result = yield this.stakeClient.performWithdrawStake(tokenIdBigNum, recipient);
@@ -74691,7 +74784,7 @@ class EthereumStakingClient {
74691
74784
  });
74692
74785
  }
74693
74786
  buy(amount) {
74694
- return __async(this, null, function* () {
74787
+ return __async$1(this, null, function* () {
74695
74788
  this.ensureUser();
74696
74789
  const buyer = yield this.address;
74697
74790
  let result = yield this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
@@ -74699,14 +74792,14 @@ class EthereumStakingClient {
74699
74792
  });
74700
74793
  }
74701
74794
  validatorDeposit() {
74702
- return __async(this, null, function* () {
74795
+ return __async$1(this, null, function* () {
74703
74796
  this.ensureUser();
74704
74797
  let result = yield this.validatorClient.validatorDepositAndLockBond();
74705
74798
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
74706
74799
  });
74707
74800
  }
74708
74801
  getPortfolio(address) {
74709
- return __async(this, null, function* () {
74802
+ return __async$1(this, null, function* () {
74710
74803
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
74711
74804
  try {
74712
74805
  if (!this.signer) return Promise.resolve(null);
@@ -74788,14 +74881,14 @@ class EthereumStakingClient {
74788
74881
  });
74789
74882
  }
74790
74883
  fetchPrelaunchReceipts(address) {
74791
- return __async(this, null, function* () {
74884
+ return __async$1(this, null, function* () {
74792
74885
  this.ensureUser();
74793
74886
  if (address === void 0) address = yield this.address;
74794
74887
  return yield this.receiptClient.stakeReceipts(address);
74795
74888
  });
74796
74889
  }
74797
74890
  getOPPMessages(address) {
74798
- return __async(this, null, function* () {
74891
+ return __async$1(this, null, function* () {
74799
74892
  this.ensureUser();
74800
74893
  if (!address) address = yield this.address;
74801
74894
  return yield this.oppClient.getMessages(address);
@@ -74809,7 +74902,7 @@ class EthereumStakingClient {
74809
74902
  }
74810
74903
  }
74811
74904
  getSystemAPY() {
74812
- return __async(this, null, function* () {
74905
+ return __async$1(this, null, function* () {
74813
74906
  const annualBpsBn = yield this.contract.DepositManager.dailyRateBPS();
74814
74907
  const annualBps = annualBpsBn.toNumber();
74815
74908
  const apyPercent = annualBps / 100;
@@ -74817,18 +74910,18 @@ class EthereumStakingClient {
74817
74910
  });
74818
74911
  }
74819
74912
  getDepositFee(amountWei) {
74820
- return __async(this, null, function* () {
74913
+ return __async$1(this, null, function* () {
74821
74914
  const feeBn = yield this.contract.DepositManager.procFee(amountWei);
74822
74915
  return BigInt(feeBn.toString());
74823
74916
  });
74824
74917
  }
74825
74918
  getOPPStatus() {
74826
- return __async(this, null, function* () {
74919
+ return __async$1(this, null, function* () {
74827
74920
  return yield this.oppClient.getStatus();
74828
74921
  });
74829
74922
  }
74830
74923
  getEthStats() {
74831
- return __async(this, null, function* () {
74924
+ return __async$1(this, null, function* () {
74832
74925
  let withdrawDelay = yield this.contract.WithdrawalQueue.withdrawDelay();
74833
74926
  let minDeposit = yield this.contract.DepositManager.minDeposit();
74834
74927
  let rewardCooldown = yield this.contract.DepositManager.rewardCooldown();
@@ -74840,7 +74933,7 @@ class EthereumStakingClient {
74840
74933
  });
74841
74934
  }
74842
74935
  getTrancheSnapshot(chainID) {
74843
- return __async(this, null, function* () {
74936
+ return __async$1(this, null, function* () {
74844
74937
  try {
74845
74938
  const blockNumber = yield this.provider.getBlockNumber();
74846
74939
  const blockTag = { blockTag: blockNumber };
@@ -74882,7 +74975,7 @@ class EthereumStakingClient {
74882
74975
  });
74883
74976
  }
74884
74977
  getDepositBuffer(options) {
74885
- return __async(this, null, function* () {
74978
+ return __async$1(this, null, function* () {
74886
74979
  var _a, _b, _c, _d, _e;
74887
74980
  this.ensureUser();
74888
74981
  const walletAddress = yield this.address;
@@ -74955,6 +75048,234 @@ class Staker {
74955
75048
  }
74956
75049
  }
74957
75050
 
75051
+ var __async = (__this, __arguments, generator) => {
75052
+ return new Promise((resolve, reject) => {
75053
+ var fulfilled = (value) => {
75054
+ try {
75055
+ step(generator.next(value));
75056
+ } catch (e) {
75057
+ reject(e);
75058
+ }
75059
+ };
75060
+ var rejected = (value) => {
75061
+ try {
75062
+ step(generator.throw(value));
75063
+ } catch (e) {
75064
+ reject(e);
75065
+ }
75066
+ };
75067
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75068
+ step((generator = generator.apply(__this, __arguments)).next());
75069
+ });
75070
+ };
75071
+ function getEthereumTransactionStatus(source, txId) {
75072
+ return __async(this, null, function* () {
75073
+ var _a, _b;
75074
+ const provider = isEthereumStakingClient(source) ? getEthereumProvider(source) : source;
75075
+ const tx = yield provider.getTransaction(txId).catch(() => null);
75076
+ const receipt = yield provider.getTransactionReceipt(txId).catch(() => null);
75077
+ if (!tx && !receipt) {
75078
+ return {
75079
+ chain: "eth",
75080
+ txId,
75081
+ state: "not_found",
75082
+ timestampMs: null
75083
+ };
75084
+ }
75085
+ if (!receipt) {
75086
+ return {
75087
+ chain: "eth",
75088
+ txId,
75089
+ state: "pending",
75090
+ timestampMs: null,
75091
+ confirmations: (_a = tx == null ? void 0 : tx.confirmations) != null ? _a : null
75092
+ };
75093
+ }
75094
+ const block = receipt.blockNumber != null ? yield provider.getBlock(receipt.blockNumber).catch(() => null) : null;
75095
+ return {
75096
+ chain: "eth",
75097
+ txId,
75098
+ state: receipt.status === 0 ? "failed" : "confirmed",
75099
+ timestampMs: (block == null ? void 0 : block.timestamp) ? block.timestamp * 1e3 : null,
75100
+ blockNumber: receipt.blockNumber,
75101
+ confirmations: (_b = tx == null ? void 0 : tx.confirmations) != null ? _b : null
75102
+ };
75103
+ });
75104
+ }
75105
+ function getSolanaTransactionStatus(source, txId) {
75106
+ return __async(this, null, function* () {
75107
+ var _a, _b;
75108
+ const connection = isSolanaStakingClient(source) ? source.connection : source;
75109
+ const statusResponse = yield connection.getSignatureStatuses(
75110
+ [txId],
75111
+ { searchTransactionHistory: true }
75112
+ ).catch(() => ({ value: [null] }));
75113
+ const status = statusResponse.value[0];
75114
+ const transaction = yield connection.getTransaction(txId, {
75115
+ commitment: "confirmed",
75116
+ maxSupportedTransactionVersion: 0
75117
+ }).catch(() => null);
75118
+ if (!status && !transaction) {
75119
+ return {
75120
+ chain: "sol",
75121
+ txId,
75122
+ state: "not_found",
75123
+ timestampMs: null
75124
+ };
75125
+ }
75126
+ const errorMessage = (status == null ? void 0 : status.err) ? JSON.stringify(status.err) : void 0;
75127
+ const isConfirmed = !!transaction || (status == null ? void 0 : status.confirmationStatus) === "confirmed" || (status == null ? void 0 : status.confirmationStatus) === "finalized";
75128
+ return {
75129
+ chain: "sol",
75130
+ txId,
75131
+ state: (status == null ? void 0 : status.err) ? "failed" : isConfirmed ? "confirmed" : "pending",
75132
+ timestampMs: (transaction == null ? void 0 : transaction.blockTime) ? transaction.blockTime * 1e3 : null,
75133
+ slot: (_a = transaction == null ? void 0 : transaction.slot) != null ? _a : status == null ? void 0 : status.slot,
75134
+ confirmations: (_b = status == null ? void 0 : status.confirmations) != null ? _b : null,
75135
+ errorMessage
75136
+ };
75137
+ });
75138
+ }
75139
+ function getStakingClientTransactionStatus(client, txId) {
75140
+ return __async(this, null, function* () {
75141
+ if (isEthereumStakingClient(client)) {
75142
+ return getEthereumTransactionStatus(client, txId);
75143
+ }
75144
+ return getSolanaTransactionStatus(client, txId);
75145
+ });
75146
+ }
75147
+ function submitEthereumStakeToWireFlow(client, amount, wireAccount) {
75148
+ return __async(this, null, function* () {
75149
+ var _a;
75150
+ ensureEthereumUser(client);
75151
+ const amountWei = ethers.BigNumber.isBigNumber(amount) ? amount : ethers.BigNumber.from(amount);
75152
+ const signerAddress = yield client.address;
75153
+ if (!signerAddress) {
75154
+ throw new Error("Ethereum signer address is unavailable.");
75155
+ }
75156
+ const contractService = getEthereumContractService(client);
75157
+ const depositor = client.contract.Depositor.address;
75158
+ const liqRead = client.contract.LiqEthToken;
75159
+ const liqWrite = contractService.getWrite("LiqEthToken");
75160
+ const steps = [];
75161
+ const [balance, allowance, paused] = yield Promise.all([
75162
+ liqRead.balanceOf(signerAddress),
75163
+ liqRead.allowance(signerAddress, depositor),
75164
+ client.contract.Depositor.paused()
75165
+ ]);
75166
+ if (paused) {
75167
+ throw new Error("StakeClient.performStakeToWire: Depositor is in a paused state");
75168
+ }
75169
+ if (!(wireAccount == null ? void 0 : wireAccount.trim())) {
75170
+ throw new Error("StakeClient.performStakeToWire: wireAccount is required");
75171
+ }
75172
+ if (balance.lt(amountWei)) {
75173
+ throw new Error("StakeClient.performStakeToWire: Insufficient LiqETH balance");
75174
+ }
75175
+ if (allowance.lt(amountWei)) {
75176
+ const approveTx = yield liqWrite.approve(depositor, amountWei);
75177
+ const approveReceipt = yield approveTx.wait(1);
75178
+ const updatedAllowance = yield liqRead.allowance(signerAddress, depositor);
75179
+ if (updatedAllowance.lt(amountWei)) {
75180
+ throw new Error("StakeClient.performStakeToWire: Liq allowance approval failed or allowance still insufficient after approve");
75181
+ }
75182
+ steps.push({
75183
+ stepId: "approve",
75184
+ label: "Approve LIQETH spend",
75185
+ txId: approveTx.hash,
75186
+ timestampMs: (approveReceipt == null ? void 0 : approveReceipt.blockNumber) != null ? yield getEthereumBlockTimestampMs(getEthereumProvider(client), approveReceipt.blockNumber) : null
75187
+ });
75188
+ }
75189
+ try {
75190
+ yield client.contract.Depositor.callStatic.stakeLiqETHToWire(amountWei, wireAccount);
75191
+ } catch (error) {
75192
+ const formatted = formatContractErrors(error);
75193
+ throw new Error(`StakeClient.performStakeToWire: ${(_a = formatted.name) != null ? _a : formatted.raw}`);
75194
+ }
75195
+ const txOverrides = yield resolveContractWriteOverrides(
75196
+ client.contract.Depositor,
75197
+ "stakeLiqETHToWire",
75198
+ [amountWei, wireAccount]
75199
+ );
75200
+ const stakeTx = yield client.contract.Depositor.stakeLiqETHToWire(
75201
+ amountWei,
75202
+ wireAccount,
75203
+ txOverrides
75204
+ );
75205
+ const stakeReceipt = yield stakeTx.wait(1);
75206
+ steps.push({
75207
+ stepId: "source",
75208
+ label: "Stake LIQETH to Wire",
75209
+ txId: stakeTx.hash,
75210
+ timestampMs: (stakeReceipt == null ? void 0 : stakeReceipt.blockNumber) != null ? yield getEthereumBlockTimestampMs(getEthereumProvider(client), stakeReceipt.blockNumber) : null
75211
+ });
75212
+ return {
75213
+ finalTxId: stakeTx.hash,
75214
+ steps
75215
+ };
75216
+ });
75217
+ }
75218
+ function submitEthereumDepositAndStakeToWireFlow(client, amount, wireAccount) {
75219
+ return __async(this, null, function* () {
75220
+ var _a;
75221
+ ensureEthereumUser(client);
75222
+ const amountWei = ethers.BigNumber.isBigNumber(amount) ? amount : ethers.BigNumber.from(amount);
75223
+ if (amountWei.lte(0)) {
75224
+ throw new Error("Amount must be greater than zero.");
75225
+ }
75226
+ const convertClient = getEthereumConvertClient(client);
75227
+ const depositResult = yield convertClient.performDeposit(amountWei);
75228
+ const steps = [{
75229
+ stepId: "deposit",
75230
+ label: "Deposit native ETH",
75231
+ txId: depositResult.txHash,
75232
+ timestampMs: ((_a = depositResult.receipt) == null ? void 0 : _a.blockNumber) != null ? yield getEthereumBlockTimestampMs(getEthereumProvider(client), depositResult.receipt.blockNumber) : null
75233
+ }];
75234
+ const stake = yield submitEthereumStakeToWireFlow(client, amountWei, wireAccount);
75235
+ return {
75236
+ finalTxId: stake.finalTxId,
75237
+ steps: [...steps, ...stake.steps]
75238
+ };
75239
+ });
75240
+ }
75241
+ function isEthereumStakingClient(value) {
75242
+ return value instanceof EthereumStakingClient;
75243
+ }
75244
+ function isSolanaStakingClient(value) {
75245
+ return value instanceof SolanaStakingClient;
75246
+ }
75247
+ function getEthereumProvider(client) {
75248
+ const provider = client.provider;
75249
+ if (!provider) {
75250
+ throw new Error("Ethereum provider is unavailable.");
75251
+ }
75252
+ return provider;
75253
+ }
75254
+ function getEthereumContractService(client) {
75255
+ const contractService = client.contractService;
75256
+ if (!contractService) {
75257
+ throw new Error("Ethereum contract service is unavailable.");
75258
+ }
75259
+ return contractService;
75260
+ }
75261
+ function getEthereumConvertClient(client) {
75262
+ const convertClient = client.convertClient;
75263
+ if (!(convertClient == null ? void 0 : convertClient.performDeposit)) {
75264
+ throw new Error("Ethereum convert client is unavailable.");
75265
+ }
75266
+ return convertClient;
75267
+ }
75268
+ function ensureEthereumUser(client) {
75269
+ const ensureUser = client.ensureUser;
75270
+ ensureUser == null ? void 0 : ensureUser.call(client);
75271
+ }
75272
+ function getEthereumBlockTimestampMs(provider, blockNumber) {
75273
+ return __async(this, null, function* () {
75274
+ const block = yield provider.getBlock(blockNumber).catch(() => null);
75275
+ return (block == null ? void 0 : block.timestamp) ? block.timestamp * 1e3 : null;
75276
+ });
75277
+ }
75278
+
74958
75279
  const CONTRACT_NAMES = [
74959
75280
  "LiqEthAuthority",
74960
75281
  "BeaconState",
@@ -75039,7 +75360,10 @@ exports.generateRandomDepositAmount = generateRandomDepositAmount;
75039
75360
  exports.generateTestKeypair = generateTestKeypair;
75040
75361
  exports.getEpochSnapshot = getEpochSnapshot;
75041
75362
  exports.getErrorMessage = getErrorMessage;
75363
+ exports.getEthereumTransactionStatus = getEthereumTransactionStatus;
75042
75364
  exports.getProgramIds = getProgramIds;
75365
+ exports.getSolanaTransactionStatus = getSolanaTransactionStatus;
75366
+ exports.getStakingClientTransactionStatus = getStakingClientTransactionStatus;
75043
75367
  exports.lamportsToSol = lamportsToSol;
75044
75368
  exports.msToEpochEnd = msToEpochEnd;
75045
75369
  exports.normalizeToBigInt = normalizeToBigInt;
@@ -75047,6 +75371,8 @@ exports.safeFetch = safeFetch;
75047
75371
  exports.scheduledInstruction = scheduledInstruction;
75048
75372
  exports.sleep = sleep;
75049
75373
  exports.solToLamports = solToLamports;
75374
+ exports.submitEthereumDepositAndStakeToWireFlow = submitEthereumDepositAndStakeToWireFlow;
75375
+ exports.submitEthereumStakeToWireFlow = submitEthereumStakeToWireFlow;
75050
75376
  exports.toBigint = toBigint;
75051
75377
  exports.tokensToShares = tokensToShares;
75052
75378
  exports.waitForConfirmation = waitForConfirmation;