@wireio/stake 0.2.1 → 0.2.3

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
@@ -6,7 +6,16 @@ var anchor = require('@coral-xyz/anchor');
6
6
  var splToken = require('@solana/spl-token');
7
7
  var ethers = require('ethers');
8
8
 
9
- var address$2 = "HR3t8mA25TdJpwLph2h2L7KhK7ynWoAByYYzgUAfd5rk";
9
+ var PurchaseAsset = ((PurchaseAsset2) => {
10
+ PurchaseAsset2["SOL"] = "SOL";
11
+ PurchaseAsset2["LIQSOL"] = "LIQSOL";
12
+ PurchaseAsset2["ETH"] = "ETH";
13
+ PurchaseAsset2["LIQETH"] = "LIQETH";
14
+ PurchaseAsset2["YIELD"] = "YIELD";
15
+ return PurchaseAsset2;
16
+ })(PurchaseAsset || {});
17
+
18
+ var address$2 = "BBkVcNWNQz1vZ6esv5US4QnNFWPRqxWbdpJHur9GVXSu";
10
19
  var metadata$2 = {
11
20
  name: "liqsol_core",
12
21
  version: "0.1.0",
@@ -3186,58 +3195,8 @@ var events = [
3186
3195
  var errors$2 = [
3187
3196
  {
3188
3197
  code: 6000,
3189
- name: "NoRewardsToClaim",
3190
- msg: "No rewards to claim"
3191
- },
3192
- {
3193
- code: 6001,
3194
- name: "InsufficientBalance",
3195
- msg: "Insufficient balance"
3196
- },
3197
- {
3198
- code: 6002,
3199
- name: "InsufficientFunds",
3200
- msg: "Insufficient funds"
3201
- },
3202
- {
3203
- code: 6003,
3204
- name: "Unauthorized",
3205
- msg: "Unauthorized - caller is not the distribution authority"
3206
- },
3207
- {
3208
- code: 6004,
3209
- name: "InvalidMint",
3210
- msg: "Invalid mint"
3211
- },
3212
- {
3213
- code: 6005,
3214
- name: "InvalidOwner",
3215
- msg: "Invalid owner"
3216
- },
3217
- {
3218
- code: 6006,
3219
- name: "InvalidUserRecord",
3220
- msg: "Invalid user record"
3221
- },
3222
- {
3223
- code: 6007,
3224
- name: "InvalidWithdrawal",
3225
- msg: "Invalid withdrawal - balance increased instead of decreased"
3226
- },
3227
- {
3228
- code: 6008,
3229
- name: "InvalidProgramId",
3230
- msg: "Invalid program ID"
3231
- },
3232
- {
3233
- code: 6009,
3234
- name: "InstructionIntrospectionFailed",
3235
- msg: "Instruction introspection failed"
3236
- },
3237
- {
3238
- code: 6010,
3239
- name: "ReceiptFulfilled",
3240
- msg: "Receipt already fulfilled"
3198
+ name: "AccountBorrowFailed",
3199
+ msg: "Util Acc borrow Failed"
3241
3200
  }
3242
3201
  ];
3243
3202
  var types$4 = [
@@ -4521,7 +4480,7 @@ var liqsolCoreIDL = {
4521
4480
  types: types$4
4522
4481
  };
4523
4482
 
4524
- var address$1 = "HEAKvfg2X7K4zbGDiAbfuu5abxQyk1HbKVgskZZFXrUx";
4483
+ var address$1 = "6cDoerqdV6UQDsGvUEq5Qj5HRxxyDxSuUaB2J6iK8cio";
4525
4484
  var metadata$1 = {
4526
4485
  name: "liqsol_token",
4527
4486
  version: "0.1.0",
@@ -4710,7 +4669,7 @@ var liqsolTokenJson = {
4710
4669
  types: types$3
4711
4670
  };
4712
4671
 
4713
- var address = "BcMW7wN54FexYaB7Xujvag5uUQ1WoDoGbzVg1VEXPBhV";
4672
+ var address = "C4ddPrB1ALYpW4G1Qz4ffvETBA8YGUL7TVZaLiE6bb1q";
4714
4673
  var metadata = {
4715
4674
  name: "validator_leaderboard",
4716
4675
  version: "0.1.0",
@@ -5295,7 +5254,7 @@ var validatorLeaderboardJson = {
5295
5254
  types: types$2
5296
5255
  };
5297
5256
 
5298
- var __async$a = (__this, __arguments, generator) => {
5257
+ var __async$b = (__this, __arguments, generator) => {
5299
5258
  return new Promise((resolve, reject) => {
5300
5259
  var fulfilled = (value) => {
5301
5260
  try {
@@ -5348,7 +5307,8 @@ const PDA_SEEDS = {
5348
5307
  USER_WARRANT_RECORD: "user_warrant_record",
5349
5308
  BAR_STATE_SEED: "bar_state",
5350
5309
  BONDED_ACTOR_SEED: "bonded_actor",
5351
- BOND_LEVEL_SEED: "bond_level"
5310
+ BOND_LEVEL_SEED: "bond_level",
5311
+ PRICE_HISTORY: "price_history"
5352
5312
  };
5353
5313
  const deriveLiqsolMintPda = () => web3_js.PublicKey.findProgramAddressSync(
5354
5314
  [Buffer.from(PDA_SEEDS.LIQSOL_MINT)],
@@ -5450,7 +5410,11 @@ const deriveBondedActorPda = (actor) => web3_js.PublicKey.findProgramAddressSync
5450
5410
  [Buffer.from(PDA_SEEDS.BONDED_ACTOR_SEED), actor.toBuffer()],
5451
5411
  LIQSOL_CORE
5452
5412
  )[0];
5453
- const deriveEphemeralStakeAddress = (user, seed) => __async$a(null, null, function* () {
5413
+ const derivePriceHistoryPda = () => web3_js.PublicKey.findProgramAddressSync(
5414
+ [Buffer.from(PDA_SEEDS.PRICE_HISTORY)],
5415
+ LIQSOL_CORE
5416
+ )[0];
5417
+ const deriveEphemeralStakeAddress = (user, seed) => __async$b(null, null, function* () {
5454
5418
  const seedStr = `ephemeral_${seed}`;
5455
5419
  return yield web3_js.PublicKey.createWithSeed(user, seedStr, web3_js.StakeProgram.programId);
5456
5420
  });
@@ -5512,7 +5476,7 @@ class SolanaProgramService {
5512
5476
  }
5513
5477
 
5514
5478
  var __pow = Math.pow;
5515
- var __async$9 = (__this, __arguments, generator) => {
5479
+ var __async$a = (__this, __arguments, generator) => {
5516
5480
  return new Promise((resolve, reject) => {
5517
5481
  var fulfilled = (value) => {
5518
5482
  try {
@@ -5542,7 +5506,7 @@ let DepositClient$1 = class DepositClient {
5542
5506
  return this.provider.wallet;
5543
5507
  }
5544
5508
  buildDepositTx(_0) {
5545
- return __async$9(this, arguments, function* (amount, user = this.wallet.publicKey) {
5509
+ return __async$a(this, arguments, function* (amount, user = this.wallet.publicKey) {
5546
5510
  const depositAuthority = deriveDepositAuthorityPda();
5547
5511
  const liqsolMint = deriveLiqsolMintPda();
5548
5512
  const liqsolMintAuthority = deriveLiqsolMintAuthorityPda();
@@ -5599,7 +5563,7 @@ let DepositClient$1 = class DepositClient {
5599
5563
  }
5600
5564
  };
5601
5565
 
5602
- var __async$8 = (__this, __arguments, generator) => {
5566
+ var __async$9 = (__this, __arguments, generator) => {
5603
5567
  return new Promise((resolve, reject) => {
5604
5568
  var fulfilled = (value) => {
5605
5569
  try {
@@ -5629,7 +5593,7 @@ class DistributionClient {
5629
5593
  return this.provider.connection;
5630
5594
  }
5631
5595
  getDistributionState() {
5632
- return __async$8(this, null, function* () {
5596
+ return __async$9(this, null, function* () {
5633
5597
  const pda = deriveDistributionStatePda();
5634
5598
  try {
5635
5599
  return yield this.program.account.distributionState.fetch(pda);
@@ -5639,7 +5603,7 @@ class DistributionClient {
5639
5603
  });
5640
5604
  }
5641
5605
  getUserRecord(user) {
5642
- return __async$8(this, null, function* () {
5606
+ return __async$9(this, null, function* () {
5643
5607
  const pda = deriveUserRecordPda(user);
5644
5608
  try {
5645
5609
  return yield this.program.account.userRecord.fetchNullable(pda);
@@ -5649,7 +5613,7 @@ class DistributionClient {
5649
5613
  });
5650
5614
  }
5651
5615
  getActualBalancesByOwner() {
5652
- return __async$8(this, null, function* () {
5616
+ return __async$9(this, null, function* () {
5653
5617
  var _a;
5654
5618
  const liqsolMint = deriveLiqsolMintPda();
5655
5619
  const mintStr = liqsolMint.toBase58();
@@ -5678,7 +5642,7 @@ class DistributionClient {
5678
5642
  });
5679
5643
  }
5680
5644
  getTrackedBalances() {
5681
- return __async$8(this, null, function* () {
5645
+ return __async$9(this, null, function* () {
5682
5646
  var _a;
5683
5647
  const records = yield this.program.account.userRecord.all();
5684
5648
  const map = new Map();
@@ -5700,7 +5664,7 @@ class DistributionClient {
5700
5664
  });
5701
5665
  }
5702
5666
  deriveMismatchCandidates() {
5703
- return __async$8(this, null, function* () {
5667
+ return __async$9(this, null, function* () {
5704
5668
  var _a;
5705
5669
  const [actualByOwner, trackedByOwner] = yield Promise.all([
5706
5670
  this.getActualBalancesByOwner(),
@@ -5719,7 +5683,7 @@ class DistributionClient {
5719
5683
  });
5720
5684
  }
5721
5685
  buildUpdateUserIx(targetUser) {
5722
- return __async$8(this, null, function* () {
5686
+ return __async$9(this, null, function* () {
5723
5687
  const walletPk = this.provider.wallet.publicKey;
5724
5688
  const distributionStatePDA = deriveDistributionStatePda();
5725
5689
  const userRecordPDA = deriveUserRecordPda(targetUser);
@@ -5756,7 +5720,7 @@ class DistributionClient {
5756
5720
  });
5757
5721
  }
5758
5722
  buildCorrectRegisterTx() {
5759
- return __async$8(this, arguments, function* (opts = {}) {
5723
+ return __async$9(this, arguments, function* (opts = {}) {
5760
5724
  var _a, _b, _c;
5761
5725
  const walletPk = this.provider.wallet.publicKey;
5762
5726
  const callerStr = walletPk.toBase58();
@@ -5842,7 +5806,7 @@ class DistributionClient {
5842
5806
  }
5843
5807
  }
5844
5808
 
5845
- var __async$7 = (__this, __arguments, generator) => {
5809
+ var __async$8 = (__this, __arguments, generator) => {
5846
5810
  return new Promise((resolve, reject) => {
5847
5811
  var fulfilled = (value) => {
5848
5812
  try {
@@ -5869,7 +5833,7 @@ class LeaderboardClient {
5869
5833
  this.program = svc.getProgram("validatorLeaderboard");
5870
5834
  }
5871
5835
  getState() {
5872
- return __async$7(this, null, function* () {
5836
+ return __async$8(this, null, function* () {
5873
5837
  const pda = deriveLeaderboardStatePda();
5874
5838
  try {
5875
5839
  return yield this.program.account.leaderboardState.fetch(pda);
@@ -5879,7 +5843,7 @@ class LeaderboardClient {
5879
5843
  });
5880
5844
  }
5881
5845
  getValidatorRecord(voteAccount) {
5882
- return __async$7(this, null, function* () {
5846
+ return __async$8(this, null, function* () {
5883
5847
  const pda = deriveValidatorRecordPda(voteAccount);
5884
5848
  try {
5885
5849
  return yield this.program.account.validatorRecord.fetchNullable(pda);
@@ -5889,7 +5853,7 @@ class LeaderboardClient {
5889
5853
  });
5890
5854
  }
5891
5855
  getTopValidators(limit = 20) {
5892
- return __async$7(this, null, function* () {
5856
+ return __async$8(this, null, function* () {
5893
5857
  const records = yield this.program.account.validatorRecord.all();
5894
5858
  const sorted = records.sort(
5895
5859
  (a, b) => {
@@ -5904,7 +5868,7 @@ class LeaderboardClient {
5904
5868
  }
5905
5869
  }
5906
5870
 
5907
- var __async$6 = (__this, __arguments, generator) => {
5871
+ var __async$7 = (__this, __arguments, generator) => {
5908
5872
  return new Promise((resolve, reject) => {
5909
5873
  var fulfilled = (value) => {
5910
5874
  try {
@@ -5930,9 +5894,9 @@ function getLiqsolCoreProgram(connection) {
5930
5894
  return _liqsolCoreProgram;
5931
5895
  }
5932
5896
  const tmpKeypair = web3_js.Keypair.generate();
5933
- const wallet = { publicKey: tmpKeypair.publicKey, signAllTransactions: () => __async$6(null, null, function* () {
5897
+ const wallet = { publicKey: tmpKeypair.publicKey, signAllTransactions: () => __async$7(null, null, function* () {
5934
5898
  return [];
5935
- }), signTransaction: () => __async$6(null, null, function* () {
5899
+ }), signTransaction: () => __async$7(null, null, function* () {
5936
5900
  return tmpKeypair;
5937
5901
  }) };
5938
5902
  const provider = new anchor.AnchorProvider(connection, wallet, {
@@ -5946,7 +5910,7 @@ function getLiqsolCoreProgram(connection) {
5946
5910
  return program;
5947
5911
  }
5948
5912
  function getUserLiqSolBalance(connection, user) {
5949
- return __async$6(this, null, function* () {
5913
+ return __async$7(this, null, function* () {
5950
5914
  const liqsolMint = deriveLiqsolMintPda();
5951
5915
  const ata = yield splToken.getAssociatedTokenAddress(
5952
5916
  liqsolMint,
@@ -5963,7 +5927,7 @@ function getUserLiqSolBalance(connection, user) {
5963
5927
  });
5964
5928
  }
5965
5929
  function getBucketLiqSolBalance(connection) {
5966
- return __async$6(this, null, function* () {
5930
+ return __async$7(this, null, function* () {
5967
5931
  const liqsolMint = deriveLiqsolMintPda();
5968
5932
  const bucketAuthority = deriveBucketAuthorityPda();
5969
5933
  const ata = yield splToken.getAssociatedTokenAddress(
@@ -5981,7 +5945,7 @@ function getBucketLiqSolBalance(connection) {
5981
5945
  });
5982
5946
  }
5983
5947
  function getReservePoolBalance(connection) {
5984
- return __async$6(this, null, function* () {
5948
+ return __async$7(this, null, function* () {
5985
5949
  const reservePool = deriveReservePoolPda();
5986
5950
  try {
5987
5951
  const lamports = yield connection.getBalance(reservePool);
@@ -5992,7 +5956,7 @@ function getReservePoolBalance(connection) {
5992
5956
  });
5993
5957
  }
5994
5958
  function getStakeControllerStateRaw(connection) {
5995
- return __async$6(this, null, function* () {
5959
+ return __async$7(this, null, function* () {
5996
5960
  var _a;
5997
5961
  const pda = deriveStakeControllerStatePda();
5998
5962
  const info = yield connection.getAccountInfo(pda);
@@ -6000,7 +5964,7 @@ function getStakeControllerStateRaw(connection) {
6000
5964
  });
6001
5965
  }
6002
5966
  function getPayoutStateRaw(connection) {
6003
- return __async$6(this, null, function* () {
5967
+ return __async$7(this, null, function* () {
6004
5968
  var _a;
6005
5969
  const pda = derivePayoutStatePda();
6006
5970
  const info = yield connection.getAccountInfo(pda);
@@ -6008,7 +5972,7 @@ function getPayoutStateRaw(connection) {
6008
5972
  });
6009
5973
  }
6010
5974
  function getUserRecordRaw(connection, user) {
6011
- return __async$6(this, null, function* () {
5975
+ return __async$7(this, null, function* () {
6012
5976
  var _a;
6013
5977
  const pda = deriveUserRecordPda(user);
6014
5978
  const info = yield connection.getAccountInfo(pda);
@@ -6016,7 +5980,7 @@ function getUserRecordRaw(connection, user) {
6016
5980
  });
6017
5981
  }
6018
5982
  function getAveragePayRate(_0) {
6019
- return __async$6(this, arguments, function* (connection, lookback = DEFAULT_PAY_RATE_LOOKBACK) {
5983
+ return __async$7(this, arguments, function* (connection, lookback = DEFAULT_PAY_RATE_LOOKBACK) {
6020
5984
  var _a, _b, _c, _d;
6021
5985
  const program = getLiqsolCoreProgram(connection);
6022
5986
  const payRateHistoryPda = derivePayRateHistoryPda();
@@ -6090,7 +6054,7 @@ function previewDepositEffects(params) {
6090
6054
  };
6091
6055
  }
6092
6056
  function buildOutpostAccounts(connection, user) {
6093
- return __async$6(this, null, function* () {
6057
+ return __async$7(this, null, function* () {
6094
6058
  const globalState = deriveOutpostGlobalStatePda();
6095
6059
  const poolAuthority = deriveOutpostPoolAuthorityPda();
6096
6060
  const liqsolMint = deriveLiqsolMintPda();
@@ -6121,8 +6085,17 @@ function buildOutpostAccounts(connection, user) {
6121
6085
  false,
6122
6086
  splToken.TOKEN_2022_PROGRAM_ID
6123
6087
  );
6124
- const chainLinkFeed = CHAINLINK_FEED;
6125
- const chainLinkProgram = CHAINLINK_PROGRAM;
6088
+ let chainLinkFeed = CHAINLINK_FEED;
6089
+ let chainLinkProgram = CHAINLINK_PROGRAM;
6090
+ try {
6091
+ const program = getLiqsolCoreProgram(connection);
6092
+ const ts = yield program.account.trancheState.fetch(trancheState);
6093
+ if (ts.chainlinkFeed && ts.chainlinkProgram) {
6094
+ chainLinkFeed = ts.chainlinkFeed;
6095
+ chainLinkProgram = ts.chainlinkProgram;
6096
+ }
6097
+ } catch (e) {
6098
+ }
6126
6099
  return {
6127
6100
  user,
6128
6101
  globalState,
@@ -6146,7 +6119,7 @@ function buildOutpostAccounts(connection, user) {
6146
6119
  });
6147
6120
  }
6148
6121
  function getEpochSnapshot(connection) {
6149
- return __async$6(this, null, function* () {
6122
+ return __async$7(this, null, function* () {
6150
6123
  var _a;
6151
6124
  const info = yield connection.getEpochInfo();
6152
6125
  let slotTimeMs = Number((_a = process.env.SLOT_TIME_MS_FALLBACK) != null ? _a : 400);
@@ -6177,7 +6150,7 @@ function msToEpochEnd(snapshot) {
6177
6150
  return remainingSlots * snapshot.slotMs;
6178
6151
  }
6179
6152
  function scheduledInstruction(connection, config, instruction) {
6180
- return __async$6(this, null, function* () {
6153
+ return __async$7(this, null, function* () {
6181
6154
  var _a, _b;
6182
6155
  const early = (_a = config.early) != null ? _a : 0.1;
6183
6156
  const late = (_b = config.late) != null ? _b : 0.9;
@@ -6224,14 +6197,14 @@ function generateTestKeypair() {
6224
6197
  return web3_js.Keypair.generate();
6225
6198
  }
6226
6199
  function airdropSol(connection, publicKey, amountSol) {
6227
- return __async$6(this, null, function* () {
6200
+ return __async$7(this, null, function* () {
6228
6201
  const lamports = solToLamports(amountSol);
6229
6202
  const sig = yield connection.requestAirdrop(publicKey, Number(lamports));
6230
6203
  yield connection.confirmTransaction(sig, "confirmed");
6231
6204
  });
6232
6205
  }
6233
6206
  function waitForConfirmation(connection, signature) {
6234
- return __async$6(this, null, function* () {
6207
+ return __async$7(this, null, function* () {
6235
6208
  yield connection.confirmTransaction(signature, "confirmed");
6236
6209
  });
6237
6210
  }
@@ -6239,14 +6212,14 @@ function sleep(ms) {
6239
6212
  return new Promise((resolve) => setTimeout(resolve, ms));
6240
6213
  }
6241
6214
  function waitUntilSafeToExecuteFunction(_0) {
6242
- return __async$6(this, arguments, function* (connection, config = {}) {
6243
- yield scheduledInstruction(connection, config, () => __async$6(null, null, function* () {
6215
+ return __async$7(this, arguments, function* (connection, config = {}) {
6216
+ yield scheduledInstruction(connection, config, () => __async$7(null, null, function* () {
6244
6217
  return;
6245
6218
  }));
6246
6219
  });
6247
6220
  }
6248
6221
 
6249
- var __async$5 = (__this, __arguments, generator) => {
6222
+ var __async$6 = (__this, __arguments, generator) => {
6250
6223
  return new Promise((resolve, reject) => {
6251
6224
  var fulfilled = (value) => {
6252
6225
  try {
@@ -6299,7 +6272,7 @@ const _OutpostClient = class _OutpostClient {
6299
6272
  return `${intPart}.${decPart}`;
6300
6273
  }
6301
6274
  previewExpectedShares(params) {
6302
- return __async$5(this, null, function* () {
6275
+ return __async$6(this, null, function* () {
6303
6276
  var _a;
6304
6277
  const user = (_a = params.user) != null ? _a : this.wallet.publicKey;
6305
6278
  const accounts = yield buildOutpostAccounts(this.connection, user);
@@ -6318,14 +6291,14 @@ const _OutpostClient = class _OutpostClient {
6318
6291
  });
6319
6292
  }
6320
6293
  doesUserAtaExist() {
6321
- return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6294
+ return __async$6(this, arguments, function* (user = this.wallet.publicKey) {
6322
6295
  const accounts = yield buildOutpostAccounts(this.connection, user);
6323
6296
  const info = yield this.connection.getAccountInfo(accounts.userAta);
6324
6297
  return !!info;
6325
6298
  });
6326
6299
  }
6327
6300
  buildCreateUserAtaIx() {
6328
- return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6301
+ return __async$6(this, arguments, function* (user = this.wallet.publicKey) {
6329
6302
  const accounts = yield buildOutpostAccounts(this.connection, user);
6330
6303
  return splToken.createAssociatedTokenAccountInstruction(
6331
6304
  this.wallet.publicKey,
@@ -6338,7 +6311,7 @@ const _OutpostClient = class _OutpostClient {
6338
6311
  });
6339
6312
  }
6340
6313
  maybeBuildCreateUserAtaIx() {
6341
- return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6314
+ return __async$6(this, arguments, function* (user = this.wallet.publicKey) {
6342
6315
  const accounts = yield buildOutpostAccounts(this.connection, user);
6343
6316
  const info = yield this.connection.getAccountInfo(accounts.userAta);
6344
6317
  if (info) return [];
@@ -6346,7 +6319,7 @@ const _OutpostClient = class _OutpostClient {
6346
6319
  });
6347
6320
  }
6348
6321
  getWireStateSnapshot() {
6349
- return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6322
+ return __async$6(this, arguments, function* (user = this.wallet.publicKey) {
6350
6323
  const accounts = yield buildOutpostAccounts(this.connection, user);
6351
6324
  const [
6352
6325
  globalState,
@@ -6383,25 +6356,25 @@ const _OutpostClient = class _OutpostClient {
6383
6356
  });
6384
6357
  }
6385
6358
  getWireReceipt() {
6386
- return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6359
+ return __async$6(this, arguments, function* (user = this.wallet.publicKey) {
6387
6360
  const accounts = yield buildOutpostAccounts(this.connection, user);
6388
6361
  return this.program.account.wireReceipt.fetchNullable(accounts.wireReceipt);
6389
6362
  });
6390
6363
  }
6391
6364
  getTrancheState() {
6392
- return __async$5(this, null, function* () {
6365
+ return __async$6(this, null, function* () {
6393
6366
  const accounts = yield buildOutpostAccounts(this.connection, this.wallet.publicKey);
6394
6367
  return this.program.account.trancheState.fetchNullable(accounts.trancheState);
6395
6368
  });
6396
6369
  }
6397
6370
  getUserWarrantRecord() {
6398
- return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6371
+ return __async$6(this, arguments, function* (user = this.wallet.publicKey) {
6399
6372
  const accounts = yield buildOutpostAccounts(this.connection, user);
6400
6373
  return this.program.account.userWarrantRecord.fetchNullable(accounts.userWarrantRecord);
6401
6374
  });
6402
6375
  }
6403
6376
  buildStakeLiqsolIx(_0) {
6404
- return __async$5(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6377
+ return __async$6(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6405
6378
  const a = yield buildOutpostAccounts(this.connection, userPubKey);
6406
6379
  const amount = new anchor.BN(amountLamports.toString());
6407
6380
  return this.program.methods.stakeLiqsol(amount).accounts({
@@ -6425,7 +6398,7 @@ const _OutpostClient = class _OutpostClient {
6425
6398
  });
6426
6399
  }
6427
6400
  buildWithdrawStakeIx(_0) {
6428
- return __async$5(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6401
+ return __async$6(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6429
6402
  const a = yield buildOutpostAccounts(this.connection, userPubKey);
6430
6403
  const amount = new anchor.BN(amountLamports.toString());
6431
6404
  return this.program.methods.withdrawStake(amount).accounts({
@@ -6448,7 +6421,7 @@ const _OutpostClient = class _OutpostClient {
6448
6421
  });
6449
6422
  }
6450
6423
  buildPurchaseWithLiqsolIx(_0) {
6451
- return __async$5(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6424
+ return __async$6(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6452
6425
  const a = yield buildOutpostAccounts(this.connection, userPubKey);
6453
6426
  const amount = new anchor.BN(amountLamports.toString());
6454
6427
  return this.program.methods.purchaseWithLiqsol(amount).accounts({
@@ -6476,7 +6449,7 @@ const _OutpostClient = class _OutpostClient {
6476
6449
  });
6477
6450
  }
6478
6451
  buildPurchaseWithSolIx(_0) {
6479
- return __async$5(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6452
+ return __async$6(this, arguments, function* (amountLamports, userPubKey = this.wallet.publicKey) {
6480
6453
  const a = yield buildOutpostAccounts(this.connection, userPubKey);
6481
6454
  const amount = new anchor.BN(amountLamports.toString());
6482
6455
  return this.program.methods.purchaseWithSol(amount).accounts({
@@ -6502,7 +6475,7 @@ const _OutpostClient = class _OutpostClient {
6502
6475
  });
6503
6476
  }
6504
6477
  buildPurchaseFromYieldIx() {
6505
- return __async$5(this, arguments, function* (userPubKey = this.wallet.publicKey) {
6478
+ return __async$6(this, arguments, function* (userPubKey = this.wallet.publicKey) {
6506
6479
  const a = yield buildOutpostAccounts(this.connection, userPubKey);
6507
6480
  return this.program.methods.purchaseWarrantsFromYield().accounts({
6508
6481
  user: a.user,
@@ -6526,7 +6499,7 @@ const _OutpostClient = class _OutpostClient {
6526
6499
  });
6527
6500
  }
6528
6501
  sendIx(ix, opts) {
6529
- return __async$5(this, null, function* () {
6502
+ return __async$6(this, null, function* () {
6530
6503
  var _a;
6531
6504
  const tx = new web3_js.Transaction();
6532
6505
  if ((_a = opts == null ? void 0 : opts.additionalIxs) == null ? void 0 : _a.length) {
@@ -6543,7 +6516,7 @@ const _OutpostClient = class _OutpostClient {
6543
6516
  });
6544
6517
  }
6545
6518
  stakeLiqsol(params) {
6546
- return __async$5(this, null, function* () {
6519
+ return __async$6(this, null, function* () {
6547
6520
  var _a, _b;
6548
6521
  const user = (_a = params.user) != null ? _a : this.wallet.publicKey;
6549
6522
  const pre = [];
@@ -6555,7 +6528,7 @@ const _OutpostClient = class _OutpostClient {
6555
6528
  });
6556
6529
  }
6557
6530
  withdrawStake(params) {
6558
- return __async$5(this, null, function* () {
6531
+ return __async$6(this, null, function* () {
6559
6532
  var _a, _b;
6560
6533
  const user = (_a = params.user) != null ? _a : this.wallet.publicKey;
6561
6534
  const pre = [];
@@ -6567,7 +6540,7 @@ const _OutpostClient = class _OutpostClient {
6567
6540
  });
6568
6541
  }
6569
6542
  purchaseWithLiqsol(params) {
6570
- return __async$5(this, null, function* () {
6543
+ return __async$6(this, null, function* () {
6571
6544
  var _a, _b;
6572
6545
  const user = (_a = params.user) != null ? _a : this.wallet.publicKey;
6573
6546
  const pre = [];
@@ -6579,7 +6552,7 @@ const _OutpostClient = class _OutpostClient {
6579
6552
  });
6580
6553
  }
6581
6554
  purchaseWithSol(params) {
6582
- return __async$5(this, null, function* () {
6555
+ return __async$6(this, null, function* () {
6583
6556
  var _a;
6584
6557
  const user = (_a = params.user) != null ? _a : this.wallet.publicKey;
6585
6558
  const ix = yield this.buildPurchaseWithSolIx(params.amount, user);
@@ -6587,7 +6560,7 @@ const _OutpostClient = class _OutpostClient {
6587
6560
  });
6588
6561
  }
6589
6562
  purchaseFromYield(params) {
6590
- return __async$5(this, null, function* () {
6563
+ return __async$6(this, null, function* () {
6591
6564
  var _a;
6592
6565
  const user = (_a = params == null ? void 0 : params.user) != null ? _a : this.wallet.publicKey;
6593
6566
  const ix = yield this.buildPurchaseFromYieldIx(user);
@@ -6595,7 +6568,7 @@ const _OutpostClient = class _OutpostClient {
6595
6568
  });
6596
6569
  }
6597
6570
  getTokenBalanceSafe(ata) {
6598
- return __async$5(this, null, function* () {
6571
+ return __async$6(this, null, function* () {
6599
6572
  try {
6600
6573
  const bal = yield this.connection.getTokenAccountBalance(ata);
6601
6574
  return new anchor.BN(bal.value.amount);
@@ -6608,6 +6581,165 @@ const _OutpostClient = class _OutpostClient {
6608
6581
  _OutpostClient.INDEX_SCALE = new anchor.BN("1000000000000");
6609
6582
  let OutpostClient = _OutpostClient;
6610
6583
 
6584
+ var __async$5 = (__this, __arguments, generator) => {
6585
+ return new Promise((resolve, reject) => {
6586
+ var fulfilled = (value) => {
6587
+ try {
6588
+ step(generator.next(value));
6589
+ } catch (e) {
6590
+ reject(e);
6591
+ }
6592
+ };
6593
+ var rejected = (value) => {
6594
+ try {
6595
+ step(generator.throw(value));
6596
+ } catch (e) {
6597
+ reject(e);
6598
+ }
6599
+ };
6600
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
6601
+ step((generator = generator.apply(__this, __arguments)).next());
6602
+ });
6603
+ };
6604
+ class TokenClient {
6605
+ constructor(provider) {
6606
+ this.provider = provider;
6607
+ const svc = new SolanaProgramService(provider);
6608
+ this.program = svc.getProgram("liqsolCore");
6609
+ }
6610
+ get wallet() {
6611
+ return this.provider.wallet;
6612
+ }
6613
+ getAccounts(user) {
6614
+ return __async$5(this, null, function* () {
6615
+ return buildOutpostAccounts(this.provider.connection, user);
6616
+ });
6617
+ }
6618
+ fetchGlobalState() {
6619
+ return __async$5(this, null, function* () {
6620
+ const { globalState } = yield this.getAccounts(this.provider.wallet.publicKey);
6621
+ return this.program.account.globalState.fetch(globalState);
6622
+ });
6623
+ }
6624
+ fetchTrancheState() {
6625
+ return __async$5(this, null, function* () {
6626
+ const { trancheState } = yield this.getAccounts(this.provider.wallet.publicKey);
6627
+ return this.program.account.trancheState.fetch(trancheState);
6628
+ });
6629
+ }
6630
+ fetchWireReceipt(user) {
6631
+ return __async$5(this, null, function* () {
6632
+ const { wireReceipt } = yield this.getAccounts(user);
6633
+ return this.program.account.wireReceipt.fetch(wireReceipt);
6634
+ });
6635
+ }
6636
+ fetchUserWarrantRecord(user) {
6637
+ return __async$5(this, null, function* () {
6638
+ const { userWarrantRecord } = yield this.getAccounts(user);
6639
+ return this.program.account.userWarrantRecord.fetch(userWarrantRecord);
6640
+ });
6641
+ }
6642
+ buildPurchaseWithSolIx(_0) {
6643
+ return __async$5(this, arguments, function* (amountLamports, user = this.wallet.publicKey) {
6644
+ const a = yield this.getAccounts(user);
6645
+ return this.program.methods.purchaseWithSol(new anchor.BN(amountLamports.toString())).accounts({
6646
+ user: a.user,
6647
+ liqsolMint: a.liqsolMint,
6648
+ globalState: a.globalState,
6649
+ poolAuthority: a.poolAuthority,
6650
+ liqsolPoolAta: a.liqsolPoolAta,
6651
+ liqsolPoolUserRecord: a.poolUserRecord,
6652
+ distributionState: a.distributionState,
6653
+ payRateHistory: a.payRateHistory,
6654
+ bucketAuthority: a.bucketAuthority,
6655
+ bucketTokenAccount: a.bucketTokenAccount,
6656
+ solBucket: a.solBucket,
6657
+ warrantDepositRecord: a.wireReceipt,
6658
+ trancheState: a.trancheState,
6659
+ userWarrantRecord: a.userWarrantRecord,
6660
+ chainlinkFeed: a.chainLinkFeed,
6661
+ chainlinkProgram: a.chainLinkProgram,
6662
+ tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
6663
+ systemProgram: web3_js.SystemProgram.programId
6664
+ }).instruction();
6665
+ });
6666
+ }
6667
+ buildPurchaseWithLiqsolIx(_0) {
6668
+ return __async$5(this, arguments, function* (amountLamports, user = this.wallet.publicKey) {
6669
+ const a = yield this.getAccounts(user);
6670
+ return this.program.methods.purchaseWithLiqsol(new anchor.BN(amountLamports.toString())).accounts({
6671
+ user: a.user,
6672
+ liqsolMint: a.liqsolMint,
6673
+ globalState: a.globalState,
6674
+ buyerAta: a.userAta,
6675
+ poolAuthority: a.poolAuthority,
6676
+ liqsolPoolAta: a.liqsolPoolAta,
6677
+ warrantDepositRecord: a.wireReceipt,
6678
+ liqsolPoolUserRecord: a.poolUserRecord,
6679
+ distributionState: a.distributionState,
6680
+ payRateHistory: a.payRateHistory,
6681
+ bucketAuthority: a.bucketAuthority,
6682
+ bucketTokenAccount: a.bucketTokenAccount,
6683
+ solBucket: a.solBucket,
6684
+ trancheState: a.trancheState,
6685
+ userWarrantRecord: a.userWarrantRecord,
6686
+ chainlinkFeed: a.chainLinkFeed,
6687
+ chainlinkProgram: a.chainLinkProgram,
6688
+ tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
6689
+ associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
6690
+ systemProgram: web3_js.SystemProgram.programId
6691
+ }).instruction();
6692
+ });
6693
+ }
6694
+ buildPurchaseFromYieldIx() {
6695
+ return __async$5(this, arguments, function* (user = this.wallet.publicKey) {
6696
+ const a = yield this.getAccounts(user);
6697
+ return this.program.methods.purchaseWarrantsFromYield().accounts({
6698
+ user: a.user,
6699
+ globalState: a.globalState,
6700
+ liqsolMint: a.liqsolMint,
6701
+ poolAuthority: a.poolAuthority,
6702
+ liqsolPoolAta: a.liqsolPoolAta,
6703
+ solBucket: a.solBucket,
6704
+ liqsolPoolUserRecord: a.poolUserRecord,
6705
+ distributionState: a.distributionState,
6706
+ payRateHistory: a.payRateHistory,
6707
+ bucketAuthority: a.bucketAuthority,
6708
+ bucketTokenAccount: a.bucketTokenAccount,
6709
+ tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
6710
+ systemProgram: web3_js.SystemProgram.programId,
6711
+ trancheState: a.trancheState,
6712
+ userWarrantRecord: a.userWarrantRecord,
6713
+ chainlinkFeed: a.chainLinkFeed,
6714
+ chainlinkProgram: a.chainLinkProgram
6715
+ }).instruction();
6716
+ });
6717
+ }
6718
+ getSolPriceUsd() {
6719
+ return __async$5(this, null, function* () {
6720
+ const priceHistoryPda = derivePriceHistoryPda();
6721
+ const history = yield this.program.account.priceHistory.fetch(
6722
+ priceHistoryPda
6723
+ );
6724
+ console.log("PRICE HISTORY", history);
6725
+ const { windowSize, prices, nextIndex, count } = history;
6726
+ if (!prices || prices.length === 0 || count === 0) {
6727
+ throw new Error("Price history is empty \u2013 no SOL price available");
6728
+ }
6729
+ const capacity = prices.length || windowSize;
6730
+ if (capacity === 0) {
6731
+ throw new Error("Price history capacity is zero \u2013 check account layout");
6732
+ }
6733
+ const lastIndex = nextIndex === 0 ? capacity - 1 : nextIndex - 1;
6734
+ const priceUsd = prices[lastIndex];
6735
+ if (!anchor.BN.isBN(priceUsd)) {
6736
+ throw new Error("Latest price entry is not a BN \u2013 check IDL/decoder");
6737
+ }
6738
+ return priceUsd;
6739
+ });
6740
+ }
6741
+ }
6742
+
6611
6743
  var __async$4 = (__this, __arguments, generator) => {
6612
6744
  return new Promise((resolve, reject) => {
6613
6745
  var fulfilled = (value) => {
@@ -6664,6 +6796,7 @@ class SolanaStakingClient {
6664
6796
  this.distributionClient = new DistributionClient(this.anchor);
6665
6797
  this.leaderboardClient = new LeaderboardClient(this.anchor);
6666
6798
  this.outpostClient = new OutpostClient(this.anchor);
6799
+ this.tokenClient = new TokenClient(this.anchor);
6667
6800
  }
6668
6801
  get solPubKey() {
6669
6802
  return new web3_js.PublicKey(this.pubKey.data.array);
@@ -6711,9 +6844,46 @@ class SolanaStakingClient {
6711
6844
  return result.signature;
6712
6845
  });
6713
6846
  }
6847
+ buy(amountLamports, purchaseAsset) {
6848
+ return __async$4(this, null, function* () {
6849
+ const user = this.solPubKey;
6850
+ let ix;
6851
+ let preIxs = [];
6852
+ switch (purchaseAsset) {
6853
+ case PurchaseAsset.SOL: {
6854
+ if (!amountLamports || amountLamports <= BigInt(0))
6855
+ throw new Error("SOL pretoken purchase requires a positive amount.");
6856
+ ix = yield this.tokenClient.buildPurchaseWithSolIx(amountLamports, user);
6857
+ break;
6858
+ }
6859
+ case PurchaseAsset.LIQSOL: {
6860
+ if (!amountLamports || amountLamports <= BigInt(0))
6861
+ throw new Error("liqSOL pretoken purchase requires a positive amount.");
6862
+ preIxs = yield this.outpostClient.maybeBuildCreateUserAtaIx(user);
6863
+ ix = yield this.tokenClient.buildPurchaseWithLiqsolIx(amountLamports, user);
6864
+ break;
6865
+ }
6866
+ case PurchaseAsset.YIELD: {
6867
+ ix = yield this.tokenClient.buildPurchaseFromYieldIx(user);
6868
+ break;
6869
+ }
6870
+ case PurchaseAsset.ETH:
6871
+ case PurchaseAsset.LIQETH: {
6872
+ throw new Error("ETH / LIQETH pretoken purchases are not supported on Solana.");
6873
+ }
6874
+ default:
6875
+ throw new Error(`Unsupported pretoken purchase asset: ${String(purchaseAsset)}`);
6876
+ }
6877
+ const tx = new web3_js.Transaction().add(...preIxs, ix);
6878
+ const prepared = yield this.prepareTx(tx);
6879
+ const signed = yield this.signTransaction(prepared.tx);
6880
+ const res = yield this.sendAndConfirmHttp(signed, prepared);
6881
+ return res.signature;
6882
+ });
6883
+ }
6714
6884
  getPortfolio() {
6715
6885
  return __async$4(this, null, function* () {
6716
- var _a, _b, _c;
6886
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6717
6887
  const user = this.solPubKey;
6718
6888
  const reservePoolPDA = deriveReservePoolPda();
6719
6889
  const vaultPDA = deriveVaultPda();
@@ -6735,7 +6905,11 @@ class SolanaStakingClient {
6735
6905
  const actualAmountStr = (_b = (_a = actualBalResp == null ? void 0 : actualBalResp.value) == null ? void 0 : _a.amount) != null ? _b : "0";
6736
6906
  const trackedAmountStr = (userRecord == null ? void 0 : userRecord.trackedBalance) ? userRecord.trackedBalance.toString() : "0";
6737
6907
  const wireReceipt = (_c = snapshot == null ? void 0 : snapshot.wireReceipt) != null ? _c : null;
6908
+ const userWarrantRecord = (_d = snapshot == null ? void 0 : snapshot.userWarrantRecord) != null ? _d : null;
6909
+ const trancheState = (_e = snapshot == null ? void 0 : snapshot.trancheState) != null ? _e : null;
6910
+ const globalState = (_f = snapshot == null ? void 0 : snapshot.globalState) != null ? _f : null;
6738
6911
  const stakedAmountStr = (wireReceipt == null ? void 0 : wireReceipt.stakedLiqsol) ? wireReceipt.stakedLiqsol.toString() : "0";
6912
+ const wireSharesStr = (userWarrantRecord == null ? void 0 : userWarrantRecord.totalWarrantsPurchased) ? userWarrantRecord.totalWarrantsPurchased.toString() : "0";
6739
6913
  return {
6740
6914
  native: {
6741
6915
  amount: BigInt(nativeLamports),
@@ -6753,6 +6927,11 @@ class SolanaStakingClient {
6753
6927
  symbol: "LiqSOL",
6754
6928
  decimals: LIQSOL_DECIMALS
6755
6929
  },
6930
+ wire: {
6931
+ amount: BigInt(wireSharesStr),
6932
+ symbol: "$WIRE",
6933
+ decimals: 8
6934
+ },
6756
6935
  tracked: {
6757
6936
  amount: BigInt(trackedAmountStr),
6758
6937
  symbol: "LiqSOL",
@@ -6762,19 +6941,92 @@ class SolanaStakingClient {
6762
6941
  userLiqsolAta: userLiqsolAta.toBase58(),
6763
6942
  reservePoolPDA: reservePoolPDA.toBase58(),
6764
6943
  vaultPDA: vaultPDA.toBase58(),
6765
- wireReceipt
6944
+ wireReceipt,
6945
+ userWarrantRecord,
6946
+ globalIndex: (_g = globalState == null ? void 0 : globalState.currentIndex) == null ? void 0 : _g.toString(),
6947
+ totalShares: (_h = globalState == null ? void 0 : globalState.totalShares) == null ? void 0 : _h.toString(),
6948
+ currentTrancheNumber: (_i = trancheState == null ? void 0 : trancheState.currentTrancheNumber) == null ? void 0 : _i.toString(),
6949
+ currentTranchePriceUsd: (_j = trancheState == null ? void 0 : trancheState.currentTranchePriceUsd) == null ? void 0 : _j.toString()
6766
6950
  },
6767
6951
  chainID: this.network.chainId
6768
6952
  };
6769
6953
  });
6770
6954
  }
6955
+ getTrancheSnapshot() {
6956
+ return __async$4(this, null, function* () {
6957
+ const snapshot = yield this.outpostClient.getWireStateSnapshot(this.solPubKey);
6958
+ const global = snapshot.globalState;
6959
+ const tranche = snapshot.trancheState;
6960
+ if (!global || !tranche) return null;
6961
+ return {
6962
+ chainID: this.network.chainId,
6963
+ totalShares: BigInt(global.totalShares.toString()),
6964
+ currentIndex: BigInt(global.currentIndex.toString()),
6965
+ currentTrancheNumber: BigInt(tranche.currentTrancheNumber.toString()),
6966
+ currentTrancheSupply: BigInt(tranche.currentTrancheSupply.toString()),
6967
+ totalWarrantsSold: BigInt(tranche.totalWarrantsSold.toString()),
6968
+ currentTranchePriceUsd: BigInt(tranche.currentTranchePriceUsd.toString())
6969
+ };
6970
+ });
6971
+ }
6972
+ getBuyQuote(amount, purchaseAsset) {
6973
+ return __async$4(this, null, function* () {
6974
+ if (amount <= BigInt(0) && purchaseAsset !== PurchaseAsset.YIELD)
6975
+ throw new Error("Buy amount must be greater than zero for non-YIELD purchases.");
6976
+ const user = this.solPubKey;
6977
+ const snapshot = yield this.outpostClient.getWireStateSnapshot(user);
6978
+ const tranche = snapshot.trancheState;
6979
+ if (!tranche) {
6980
+ throw new Error("TrancheState not initialized; cannot quote WIRE purchase.");
6981
+ }
6982
+ const wirePriceUsd = tranche.currentTranchePriceUsd;
6983
+ const wireDecimals = 8;
6984
+ let notionalUsd;
6985
+ let wireSharesBn;
6986
+ switch (purchaseAsset) {
6987
+ case PurchaseAsset.SOL: {
6988
+ const solPriceUsd = yield this.tokenClient.getSolPriceUsd();
6989
+ notionalUsd = new anchor.BN(amount).mul(solPriceUsd).div(new anchor.BN(1e9));
6990
+ wireSharesBn = this.calculateExpectedWarrants(notionalUsd, wirePriceUsd);
6991
+ break;
6992
+ }
6993
+ case PurchaseAsset.LIQSOL: {
6994
+ const liqsolPriceUsd = yield this.tokenClient.getSolPriceUsd();
6995
+ notionalUsd = new anchor.BN(amount).mul(liqsolPriceUsd).div(new anchor.BN(1e9));
6996
+ wireSharesBn = this.calculateExpectedWarrants(notionalUsd, wirePriceUsd);
6997
+ break;
6998
+ }
6999
+ case PurchaseAsset.YIELD: {
7000
+ const solPriceUsd = yield this.tokenClient.getSolPriceUsd();
7001
+ notionalUsd = new anchor.BN(amount).mul(solPriceUsd).div(new anchor.BN(1e9));
7002
+ wireSharesBn = this.calculateExpectedWarrants(notionalUsd, wirePriceUsd);
7003
+ break;
7004
+ }
7005
+ case PurchaseAsset.ETH:
7006
+ case PurchaseAsset.LIQETH:
7007
+ throw new Error("getBuyQuote for ETH/LIQETH is not supported on Solana.");
7008
+ default:
7009
+ throw new Error(`Unsupported purchase asset: ${String(purchaseAsset)}`);
7010
+ }
7011
+ return {
7012
+ purchaseAsset,
7013
+ amountIn: amount,
7014
+ wireShares: BigInt(wireSharesBn.toString()),
7015
+ wireDecimals,
7016
+ wirePriceUsd: BigInt(wirePriceUsd.toString()),
7017
+ notionalUsd: BigInt(notionalUsd.toString())
7018
+ };
7019
+ });
7020
+ }
7021
+ calculateExpectedWarrants(notionalUsd, wirePriceUsd) {
7022
+ const SCALE = new anchor.BN("100000000");
7023
+ return notionalUsd.mul(SCALE).div(wirePriceUsd);
7024
+ }
6771
7025
  getUserRecord() {
6772
7026
  return __async$4(this, null, function* () {
6773
7027
  return this.distributionClient.getUserRecord(this.solPubKey);
6774
7028
  });
6775
7029
  }
6776
- getProtocolFee() {
6777
- }
6778
7030
  correctBalance(amount) {
6779
7031
  return __async$4(this, null, function* () {
6780
7032
  var _a;
@@ -24258,14 +24510,14 @@ const ADDRESSES = {
24258
24510
  StakingModule: "0xBd13C85fdefBBc63904e7301aCdeFE87c9C93234",
24259
24511
  WithdrawalQueue: "0xD9A1D38ae4A636DEf20B02F35387a6b126D73fAe",
24260
24512
  WithdrawalVault: "0x150334D09a1d3d30EE93d5e6009EB897B5dDF5b2",
24261
- Depositor: "0x0876f5f411651dFc67386Bc3D36315a3B2249F2e",
24262
- ReceiptNFT: "0x726c91fB3218A745Bfec0302B4cBaeBeaA023a6d",
24263
- OutpostManager: "0xB6Eb20f7916295853a318581eCB51Be4eeb107Fe",
24264
- BAR: "0x1936EB941361da83EE0E68FB7Bd0DF210f090B5C",
24265
- OPP: "0x2e4cc69D6F8CEC3eEec81F3051AD90fEa71e5D57",
24266
- OPPCommon: "0xA79fB9e563cF70190346D66eA20A1F2E09e0f732",
24267
- OPPInbound: "0xd63644d0e8c3610eEf9f0Fd5Ea884b962762c469",
24268
- Warrant: "0x8613F6Bb9ad883e81338EF97A06c53459250c625"
24513
+ Depositor: "0x6aE1D7095B81970654Bd51bCAD42825C6E579088",
24514
+ ReceiptNFT: "0x38eAEa05cB1FFD0c8426A3f9e77815a251DdC197",
24515
+ OutpostManager: "0x6512bB8E7f8418A8e3bB73c49E33EcC30F53f221",
24516
+ BAR: "0x00c128A37598d018Eb8ca4f516688695D83bD413",
24517
+ OPP: "0x8C5710103Ec6a7608dAC539DC232d3822bA3d14C",
24518
+ OPPCommon: "0x52C1d7F02B35176F79b03F6eF7E5b74b27d1dB8c",
24519
+ OPPInbound: "0x39feC7536BaEd4E376b1B5cf2f2e8182ab203418",
24520
+ Warrant: "0x9190bBcaB5cfeb4b7b6DE5Ae21105F3114753F10"
24269
24521
  };
24270
24522
  const CONTRACTS = {
24271
24523
  Accounting: {
@@ -24735,6 +24987,12 @@ class EthereumStakingClient {
24735
24987
  };
24736
24988
  });
24737
24989
  }
24990
+ buy(amount, purchaseAsset) {
24991
+ throw new Error("Method not yet implemented.");
24992
+ }
24993
+ getBuyQuote(amount, purchaseAsset) {
24994
+ throw new Error("Method not yet implemented.");
24995
+ }
24738
24996
  getPortfolio() {
24739
24997
  return __async(this, null, function* () {
24740
24998
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -24766,11 +25024,21 @@ class EthereumStakingClient {
24766
25024
  decimals: nativeDecimals,
24767
25025
  symbol: liqSymbol
24768
25026
  },
25027
+ wire: {
25028
+ amount: BigInt(0),
25029
+ decimals: 0,
25030
+ symbol: "$WIRE"
25031
+ },
24769
25032
  chainID: this.network.chainId
24770
25033
  };
24771
25034
  return portfolio;
24772
25035
  });
24773
25036
  }
25037
+ getTrancheSnapshot() {
25038
+ return __async(this, null, function* () {
25039
+ return null;
25040
+ });
25041
+ }
24774
25042
  requestWithdraw(amountWei) {
24775
25043
  return __async(this, null, function* () {
24776
25044
  var _a, _b, _c;
@@ -24885,12 +25153,12 @@ const CONTRACT_NAMES = [
24885
25153
  ];
24886
25154
 
24887
25155
  var types$1 = /*#__PURE__*/Object.freeze({
24888
- __proto__: null,
24889
- CONTRACT_NAMES: CONTRACT_NAMES
25156
+ __proto__: null,
25157
+ CONTRACT_NAMES: CONTRACT_NAMES
24890
25158
  });
24891
25159
 
24892
25160
  var types = /*#__PURE__*/Object.freeze({
24893
- __proto__: null
25161
+ __proto__: null
24894
25162
  });
24895
25163
 
24896
25164
  exports.ADDRESSES = ADDRESSES;
@@ -24916,9 +25184,11 @@ exports.OutpostClient = OutpostClient;
24916
25184
  exports.PAY_RATE_SCALE_FACTOR = PAY_RATE_SCALE_FACTOR;
24917
25185
  exports.PDA_SEEDS = PDA_SEEDS;
24918
25186
  exports.PROGRAM_IDS = PROGRAM_IDS;
25187
+ exports.PurchaseAsset = PurchaseAsset;
24919
25188
  exports.SOL = types;
24920
25189
  exports.SolanaStakingClient = SolanaStakingClient;
24921
25190
  exports.Staker = Staker;
25191
+ exports.TokenClient = TokenClient;
24922
25192
  exports.VALIDATOR_LEADERBOARD = VALIDATOR_LEADERBOARD;
24923
25193
  exports.airdropSol = airdropSol;
24924
25194
  exports.buildOutpostAccounts = buildOutpostAccounts;
@@ -24938,6 +25208,7 @@ exports.deriveOutpostPoolAuthorityPda = deriveOutpostPoolAuthorityPda;
24938
25208
  exports.derivePayRateHistoryPda = derivePayRateHistoryPda;
24939
25209
  exports.derivePayoutStatePda = derivePayoutStatePda;
24940
25210
  exports.derivePoolUserRecordPda = derivePoolUserRecordPda;
25211
+ exports.derivePriceHistoryPda = derivePriceHistoryPda;
24941
25212
  exports.deriveReservePoolPda = deriveReservePoolPda;
24942
25213
  exports.deriveSolBucketPda = deriveSolBucketPda;
24943
25214
  exports.deriveStakeControllerStatePda = deriveStakeControllerStatePda;