@wireio/stake 0.7.3 → 0.9.0

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.
@@ -12,68 +12,6 @@ var metadata$3 = {
12
12
  description: "Created with Anchor"
13
13
  };
14
14
  var instructions$3 = [
15
- {
16
- name: "accumulate_unstake_request",
17
- docs: [
18
- "Accumulate unstake requests to be processed in next allocation cycle",
19
- "Multiple requests can be accumulated before calculating allocations",
20
- "Returns the target epoch when this unstake request will be processed",
21
- "We should not be able to call this without development feature enabled",
22
- ""
23
- ],
24
- discriminator: [
25
- 24,
26
- 73,
27
- 69,
28
- 139,
29
- 36,
30
- 209,
31
- 105,
32
- 252
33
- ],
34
- accounts: [
35
- {
36
- name: "admin",
37
- writable: true,
38
- signer: true
39
- },
40
- {
41
- name: "stake_allocation_state",
42
- docs: [
43
- "Stake allocation state - to accumulate pending unstake requests"
44
- ],
45
- writable: true
46
- },
47
- {
48
- name: "stake_metrics",
49
- docs: [
50
- "Stake metrics - to validate total unstake amount is available"
51
- ]
52
- },
53
- {
54
- name: "maintenance_ledger",
55
- docs: [
56
- "Maintenance ledger - to determine target processing epoch"
57
- ]
58
- },
59
- {
60
- name: "global_config",
61
- docs: [
62
- "Global config for min_unstake_request setting"
63
- ]
64
- },
65
- {
66
- name: "clock"
67
- }
68
- ],
69
- args: [
70
- {
71
- name: "amount",
72
- type: "u64"
73
- }
74
- ],
75
- returns: "u64"
76
- },
77
15
  {
78
16
  name: "add_top_performers_batch",
79
17
  docs: [
@@ -127,74 +65,6 @@ var instructions$3 = [
127
65
  args: [
128
66
  ]
129
67
  },
130
- {
131
- name: "add_validator_v2",
132
- docs: [
133
- "Add a new validator bbypassing the looking at leaderboard and getting validators form there"
134
- ],
135
- discriminator: [
136
- 217,
137
- 158,
138
- 30,
139
- 19,
140
- 123,
141
- 99,
142
- 110,
143
- 30
144
- ],
145
- accounts: [
146
- {
147
- name: "authority",
148
- writable: true,
149
- signer: true
150
- },
151
- {
152
- name: "active_list",
153
- docs: [
154
- "Active list - will add the validator here"
155
- ],
156
- writable: true
157
- },
158
- {
159
- name: "validator_info",
160
- docs: [
161
- "Create the validator info account"
162
- ],
163
- writable: true
164
- },
165
- {
166
- name: "validator_transient",
167
- docs: [
168
- "Create the validator transient account"
169
- ],
170
- writable: true
171
- },
172
- {
173
- name: "stake_allocation_state",
174
- docs: [
175
- "Stake allocation state - to update total_active_vpp when adding validator"
176
- ],
177
- writable: true
178
- },
179
- {
180
- name: "system_program"
181
- }
182
- ],
183
- args: [
184
- {
185
- name: "vote_account",
186
- type: "pubkey"
187
- },
188
- {
189
- name: "name",
190
- type: "string"
191
- },
192
- {
193
- name: "performance_score",
194
- type: "u8"
195
- }
196
- ]
197
- },
198
68
  {
199
69
  name: "aggregate_stake_metrics",
200
70
  docs: [
@@ -234,43 +104,6 @@ var instructions$3 = [
234
104
  args: [
235
105
  ]
236
106
  },
237
- {
238
- name: "blacklist_validator",
239
- docs: [
240
- "Blacklist a validator (user-facing, maintenance will handle graveyard movement)",
241
- "UnderPerforming is set automatically when score is updated",
242
- "Another serious emergency stop function"
243
- ],
244
- discriminator: [
245
- 125,
246
- 42,
247
- 36,
248
- 229,
249
- 27,
250
- 38,
251
- 226,
252
- 62
253
- ],
254
- accounts: [
255
- {
256
- name: "validator_info",
257
- writable: true
258
- },
259
- {
260
- name: "stake_allocation_state",
261
- docs: [
262
- "Stake allocation state - to update total_active_vpp when VPP changes"
263
- ],
264
- writable: true
265
- }
266
- ],
267
- args: [
268
- {
269
- name: "vote_account",
270
- type: "pubkey"
271
- }
272
- ]
273
- },
274
107
  {
275
108
  name: "bond_role",
276
109
  discriminator: [
@@ -2860,147 +2693,6 @@ var instructions$3 = [
2860
2693
  }
2861
2694
  ]
2862
2695
  },
2863
- {
2864
- name: "reset_distribution_state",
2865
- discriminator: [
2866
- 159,
2867
- 183,
2868
- 162,
2869
- 74,
2870
- 228,
2871
- 135,
2872
- 157,
2873
- 79
2874
- ],
2875
- accounts: [
2876
- {
2877
- name: "admin",
2878
- signer: true
2879
- },
2880
- {
2881
- name: "distribution_state",
2882
- writable: true
2883
- }
2884
- ],
2885
- args: [
2886
- ]
2887
- },
2888
- {
2889
- name: "reset_global_state",
2890
- discriminator: [
2891
- 252,
2892
- 41,
2893
- 117,
2894
- 110,
2895
- 248,
2896
- 165,
2897
- 48,
2898
- 88
2899
- ],
2900
- accounts: [
2901
- {
2902
- name: "admin",
2903
- signer: true
2904
- },
2905
- {
2906
- name: "global_config"
2907
- },
2908
- {
2909
- name: "global_state",
2910
- writable: true
2911
- },
2912
- {
2913
- name: "pool_authority"
2914
- },
2915
- {
2916
- name: "liqsol_mint"
2917
- },
2918
- {
2919
- name: "liqsol_pool_ata",
2920
- writable: true
2921
- },
2922
- {
2923
- name: "token_program"
2924
- },
2925
- {
2926
- name: "associated_token_program"
2927
- }
2928
- ],
2929
- args: [
2930
- ]
2931
- },
2932
- {
2933
- name: "reset_price_history",
2934
- discriminator: [
2935
- 213,
2936
- 231,
2937
- 155,
2938
- 139,
2939
- 248,
2940
- 60,
2941
- 67,
2942
- 199
2943
- ],
2944
- accounts: [
2945
- {
2946
- name: "admin",
2947
- writable: true,
2948
- signer: true
2949
- },
2950
- {
2951
- name: "global_config"
2952
- },
2953
- {
2954
- name: "tranche_state",
2955
- writable: true
2956
- },
2957
- {
2958
- name: "price_history",
2959
- writable: true
2960
- },
2961
- {
2962
- name: "system_program"
2963
- }
2964
- ],
2965
- args: [
2966
- ]
2967
- },
2968
- {
2969
- name: "reset_tranche_state",
2970
- discriminator: [
2971
- 106,
2972
- 102,
2973
- 143,
2974
- 40,
2975
- 152,
2976
- 173,
2977
- 165,
2978
- 168
2979
- ],
2980
- accounts: [
2981
- {
2982
- name: "admin",
2983
- writable: true,
2984
- signer: true
2985
- },
2986
- {
2987
- name: "global_config"
2988
- },
2989
- {
2990
- name: "tranche_state",
2991
- writable: true
2992
- },
2993
- {
2994
- name: "price_history",
2995
- writable: true
2996
- },
2997
- {
2998
- name: "system_program"
2999
- }
3000
- ],
3001
- args: [
3002
- ]
3003
- },
3004
2696
  {
3005
2697
  name: "set_admin",
3006
2698
  discriminator: [
@@ -3023,8 +2715,7 @@ var instructions$3 = [
3023
2715
  signer: true
3024
2716
  },
3025
2717
  {
3026
- name: "new_authority",
3027
- signer: true
2718
+ name: "new_authority"
3028
2719
  }
3029
2720
  ],
3030
2721
  args: [
@@ -3052,52 +2743,12 @@ var instructions$3 = [
3052
2743
  signer: true
3053
2744
  },
3054
2745
  {
3055
- name: "new_authority",
3056
- signer: true
2746
+ name: "new_authority"
3057
2747
  }
3058
2748
  ],
3059
2749
  args: [
3060
2750
  ]
3061
2751
  },
3062
- {
3063
- name: "set_last_state_change_epoch",
3064
- docs: [
3065
- "Admin function to directly set last_state_change_epoch (useful for testing cooldowns)"
3066
- ],
3067
- discriminator: [
3068
- 94,
3069
- 57,
3070
- 139,
3071
- 195,
3072
- 123,
3073
- 224,
3074
- 227,
3075
- 106
3076
- ],
3077
- accounts: [
3078
- {
3079
- name: "validator_info",
3080
- writable: true
3081
- },
3082
- {
3083
- name: "stake_allocation_state",
3084
- docs: [
3085
- "Stake allocation state - to update total_active_vpp when VPP changes"
3086
- ],
3087
- writable: true
3088
- }
3089
- ],
3090
- args: [
3091
- {
3092
- name: "vote_account",
3093
- type: "pubkey"
3094
- },
3095
- {
3096
- name: "epoch",
3097
- type: "u16"
3098
- }
3099
- ]
3100
- },
3101
2752
  {
3102
2753
  name: "set_paused",
3103
2754
  discriminator: [
@@ -3587,35 +3238,6 @@ var instructions$3 = [
3587
3238
  }
3588
3239
  ]
3589
3240
  },
3590
- {
3591
- name: "test_clear_active_list",
3592
- discriminator: [
3593
- 17,
3594
- 195,
3595
- 59,
3596
- 174,
3597
- 184,
3598
- 137,
3599
- 149,
3600
- 144
3601
- ],
3602
- accounts: [
3603
- {
3604
- name: "active_list",
3605
- writable: true
3606
- },
3607
- {
3608
- name: "processing_state",
3609
- writable: true
3610
- },
3611
- {
3612
- name: "authority",
3613
- signer: true
3614
- }
3615
- ],
3616
- args: [
3617
- ]
3618
- },
3619
3241
  {
3620
3242
  name: "update_config_bool",
3621
3243
  discriminator: [
@@ -4293,8 +3915,118 @@ var events = [
4293
3915
  var errors$3 = [
4294
3916
  {
4295
3917
  code: 6000,
4296
- name: "AccountBorrowFailed",
4297
- msg: "Util Acc borrow Failed"
3918
+ name: "DestinationAccountDoesNotExist",
3919
+ msg: "Destination stake account does not exist"
3920
+ },
3921
+ {
3922
+ code: 6001,
3923
+ name: "SourceAccountDoesNotExist",
3924
+ msg: "Source stake account does not exist"
3925
+ },
3926
+ {
3927
+ code: 6002,
3928
+ name: "InvalidDestinationOwner",
3929
+ msg: "Destination account not owned by stake program"
3930
+ },
3931
+ {
3932
+ code: 6003,
3933
+ name: "InvalidSourceOwner",
3934
+ msg: "Source account not owned by stake program"
3935
+ },
3936
+ {
3937
+ code: 6004,
3938
+ name: "ClockBorrowFailed",
3939
+ msg: "Failed to borrow clock data"
3940
+ },
3941
+ {
3942
+ code: 6005,
3943
+ name: "ClockDeserializeFailed",
3944
+ msg: "Failed to deserialize clock"
3945
+ },
3946
+ {
3947
+ code: 6006,
3948
+ name: "DestinationAnalysisFailed",
3949
+ msg: "Failed to analyze destination stake account"
3950
+ },
3951
+ {
3952
+ code: 6007,
3953
+ name: "SourceAnalysisFailed",
3954
+ msg: "Failed to analyze source stake account"
3955
+ },
3956
+ {
3957
+ code: 6008,
3958
+ name: "DestinationStillActivating",
3959
+ msg: "Destination stake is still activating"
3960
+ },
3961
+ {
3962
+ code: 6009,
3963
+ name: "DestinationDeactivating",
3964
+ msg: "Destination stake is deactivating"
3965
+ },
3966
+ {
3967
+ code: 6010,
3968
+ name: "SourceStillActivating",
3969
+ msg: "Source stake is still activating"
3970
+ },
3971
+ {
3972
+ code: 6011,
3973
+ name: "SourceDeactivating",
3974
+ msg: "Source stake is deactivating"
3975
+ },
3976
+ {
3977
+ code: 6012,
3978
+ name: "DestinationBorrowFailed",
3979
+ msg: "Failed to borrow destination account data"
3980
+ },
3981
+ {
3982
+ code: 6013,
3983
+ name: "DestinationParseFailed",
3984
+ msg: "Failed to parse destination stake state"
3985
+ },
3986
+ {
3987
+ code: 6014,
3988
+ name: "SourceBorrowFailed",
3989
+ msg: "Failed to borrow source account data"
3990
+ },
3991
+ {
3992
+ code: 6015,
3993
+ name: "SourceParseFailed",
3994
+ msg: "Failed to parse source stake state"
3995
+ },
3996
+ {
3997
+ code: 6016,
3998
+ name: "DifferentValidators",
3999
+ msg: "Stakes are delegated to different validators"
4000
+ },
4001
+ {
4002
+ code: 6017,
4003
+ name: "DifferentStakers",
4004
+ msg: "Stakes have different staker authorities"
4005
+ },
4006
+ {
4007
+ code: 6018,
4008
+ name: "DifferentWithdrawers",
4009
+ msg: "Stakes have different withdrawer authorities"
4010
+ },
4011
+ {
4012
+ code: 6019,
4013
+ name: "AuthoritiesNotFound",
4014
+ msg: "Could not extract authorities from accounts"
4015
+ },
4016
+ {
4017
+ code: 6020,
4018
+ name: "MergeInstructionFailed",
4019
+ msg: "Merge instruction failed"
4020
+ },
4021
+ {
4022
+ code: 6021,
4023
+ name: "EpochRewardsActive",
4024
+ msg: "Epoch rewards distribution is active - stake operations blocked"
4025
+ },
4026
+ {
4027
+ code: 6022,
4028
+ name: "DifferentCreditsObserved",
4029
+ msg: "Stakes have different credits_observed - cannot merge until both earn same rewards"
4298
4030
  }
4299
4031
  ];
4300
4032
  var types$5 = [
@@ -6747,153 +6479,6 @@ var instructions$1 = [
6747
6479
  args: [
6748
6480
  ]
6749
6481
  },
6750
- {
6751
- name: "test_clear_leaderboard",
6752
- discriminator: [
6753
- 118,
6754
- 207,
6755
- 26,
6756
- 205,
6757
- 180,
6758
- 7,
6759
- 75,
6760
- 244
6761
- ],
6762
- accounts: [
6763
- {
6764
- name: "leaderboard_state",
6765
- writable: true
6766
- },
6767
- {
6768
- name: "authority",
6769
- signer: true
6770
- }
6771
- ],
6772
- args: [
6773
- ]
6774
- },
6775
- {
6776
- name: "test_force_register_validator",
6777
- discriminator: [
6778
- 136,
6779
- 156,
6780
- 132,
6781
- 32,
6782
- 96,
6783
- 240,
6784
- 7,
6785
- 115
6786
- ],
6787
- accounts: [
6788
- {
6789
- name: "registrant",
6790
- writable: true,
6791
- signer: true
6792
- },
6793
- {
6794
- name: "vote_account"
6795
- },
6796
- {
6797
- name: "validator_record",
6798
- writable: true
6799
- },
6800
- {
6801
- name: "leaderboard_state",
6802
- writable: true
6803
- },
6804
- {
6805
- name: "system_program"
6806
- },
6807
- {
6808
- name: "clock"
6809
- }
6810
- ],
6811
- args: [
6812
- {
6813
- name: "vpp",
6814
- type: "u8"
6815
- }
6816
- ]
6817
- },
6818
- {
6819
- name: "test_force_update_vpp",
6820
- discriminator: [
6821
- 67,
6822
- 51,
6823
- 28,
6824
- 174,
6825
- 200,
6826
- 214,
6827
- 203,
6828
- 162
6829
- ],
6830
- accounts: [
6831
- {
6832
- name: "registrant",
6833
- writable: true,
6834
- signer: true
6835
- },
6836
- {
6837
- name: "vote_account"
6838
- },
6839
- {
6840
- name: "validator_record",
6841
- writable: true
6842
- },
6843
- {
6844
- name: "leaderboard_state",
6845
- writable: true
6846
- }
6847
- ],
6848
- args: [
6849
- {
6850
- name: "vpp",
6851
- type: "u8"
6852
- }
6853
- ]
6854
- },
6855
- {
6856
- name: "test_seed_random_validators",
6857
- discriminator: [
6858
- 48,
6859
- 155,
6860
- 181,
6861
- 112,
6862
- 163,
6863
- 242,
6864
- 43,
6865
- 146
6866
- ],
6867
- accounts: [
6868
- {
6869
- name: "registrant",
6870
- writable: true,
6871
- signer: true
6872
- },
6873
- {
6874
- name: "leaderboard_state",
6875
- writable: true
6876
- }
6877
- ],
6878
- args: [
6879
- {
6880
- name: "count",
6881
- type: "u16"
6882
- },
6883
- {
6884
- name: "seed",
6885
- type: "u64"
6886
- },
6887
- {
6888
- name: "min_vpp",
6889
- type: "u8"
6890
- },
6891
- {
6892
- name: "max_vpp",
6893
- type: "u8"
6894
- }
6895
- ]
6896
- },
6897
6482
  {
6898
6483
  name: "update_commission",
6899
6484
  discriminator: [
@@ -7807,7 +7392,7 @@ const deriveEphemeralStakeAddress = async (user, seed) => {
7807
7392
  return PublicKey.createWithSeed(user, seedStr, StakeProgram.programId);
7808
7393
  };
7809
7394
  const CHAINLINK_FEED = new PublicKey(
7810
- "99B2bTijsU6f1GCT73HmdR7HCFFjGMBcPZY6jZ96ynrR"
7395
+ "CH31Xns5z3M1cTAbKW34jcxPPciazARpijcHj9rxtemt"
7811
7396
  );
7812
7397
  const CHAINLINK_PROGRAM = new PublicKey(
7813
7398
  "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny"
@@ -8981,191 +8566,222 @@ const _SolanaStakingClient = class _SolanaStakingClient {
8981
8566
  if (amountLamports <= BigInt(0)) {
8982
8567
  throw new Error("Deposit amount must be greater than zero.");
8983
8568
  }
8984
- const tx = await this.depositClient.buildDepositTx(amountLamports);
8985
- const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
8986
- const signed = await this.signTransaction(prepared);
8987
- return await this.sendAndConfirmHttp(signed, {
8988
- blockhash,
8989
- lastValidBlockHeight
8990
- });
8569
+ try {
8570
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8571
+ const ix = await this.depositClient.buildDepositTx(amountLamports);
8572
+ const tx = new Transaction().add(cuIx, ix);
8573
+ const prepared = await this.prepareTx(tx);
8574
+ const signed = await this.signTransaction(prepared.tx);
8575
+ return this.sendAndConfirmHttp(signed, prepared);
8576
+ } catch (err) {
8577
+ throw new Error(`Failed to deposit Solana: ${err}`);
8578
+ }
8991
8579
  }
8992
8580
  async withdraw(amountLamports) {
8993
8581
  this.ensureUser();
8994
8582
  if (amountLamports <= BigInt(0)) {
8995
8583
  throw new Error("Withdraw amount must be greater than zero.");
8996
8584
  }
8997
- const tx = await this.depositClient.buildWithdrawTx(amountLamports);
8998
- const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
8999
- const signed = await this.signTransaction(prepared);
9000
- return await this.sendAndConfirmHttp(signed, {
9001
- blockhash,
9002
- lastValidBlockHeight
9003
- });
8585
+ try {
8586
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8587
+ const ix = await this.depositClient.buildWithdrawTx(amountLamports);
8588
+ const tx = new Transaction().add(cuIx, ix);
8589
+ const prepared = await this.prepareTx(tx);
8590
+ const signed = await this.signTransaction(prepared.tx);
8591
+ return this.sendAndConfirmHttp(signed, prepared);
8592
+ } catch (err) {
8593
+ throw new Error(`Failed to withdraw Solana: ${err}`);
8594
+ }
9004
8595
  }
9005
8596
  async stake(amountLamports) {
9006
8597
  this.ensureUser();
9007
8598
  if (!amountLamports || amountLamports <= BigInt(0)) {
9008
8599
  throw new Error("Stake amount must be greater than zero.");
9009
8600
  }
9010
- const user = this.solPubKey;
9011
- const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9012
- const ix = await this.outpostClient.buildStakeIx(amountLamports, user);
9013
- const tx = new Transaction().add(cuIx, ix);
9014
- const prepared = await this.prepareTx(tx);
9015
- const signed = await this.signTransaction(prepared.tx);
9016
- return this.sendAndConfirmHttp(signed, prepared);
8601
+ try {
8602
+ const user = this.solPubKey;
8603
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8604
+ const ix = await this.outpostClient.buildStakeIx(amountLamports, user);
8605
+ const tx = new Transaction().add(cuIx, ix);
8606
+ const prepared = await this.prepareTx(tx);
8607
+ const signed = await this.signTransaction(prepared.tx);
8608
+ return this.sendAndConfirmHttp(signed, prepared);
8609
+ } catch (err) {
8610
+ throw new Error(`Failed to stake Solana: ${err}`);
8611
+ }
9017
8612
  }
9018
8613
  async unstake(amountLamports) {
9019
8614
  this.ensureUser();
9020
8615
  if (!amountLamports || amountLamports <= BigInt(0)) {
9021
8616
  throw new Error("Unstake amount must be greater than zero.");
9022
8617
  }
9023
- const user = this.solPubKey;
9024
- const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9025
- const ix = await this.outpostClient.buildUnstakeIx(amountLamports, user);
9026
- const tx = new Transaction().add(cuIx, ix);
9027
- const prepared = await this.prepareTx(tx);
9028
- const signed = await this.signTransaction(prepared.tx);
9029
- return this.sendAndConfirmHttp(signed, prepared);
8618
+ try {
8619
+ const user = this.solPubKey;
8620
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8621
+ const ix = await this.outpostClient.buildUnstakeIx(amountLamports, user);
8622
+ const tx = new Transaction().add(cuIx, ix);
8623
+ const prepared = await this.prepareTx(tx);
8624
+ const signed = await this.signTransaction(prepared.tx);
8625
+ return this.sendAndConfirmHttp(signed, prepared);
8626
+ } catch (err) {
8627
+ throw new Error(`Failed to unstake Solana: ${err}`);
8628
+ }
9030
8629
  }
9031
8630
  async buy(amountLamports) {
9032
8631
  this.ensureUser();
9033
8632
  if (!amountLamports || amountLamports <= BigInt(0)) {
9034
8633
  throw new Error("liqSOL pretoken purchase requires a positive amount.");
9035
8634
  }
9036
- const user = this.solPubKey;
9037
- const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9038
- const ix = await this.tokenClient.buildPurchaseIx(amountLamports, user);
9039
- const tx = new Transaction().add(cuIx, ix);
9040
- const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
9041
- const signed = await this.signTransaction(prepared);
9042
- return await this.sendAndConfirmHttp(signed, {
9043
- blockhash,
9044
- lastValidBlockHeight
9045
- });
8635
+ try {
8636
+ const user = this.solPubKey;
8637
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8638
+ const ix = await this.tokenClient.buildPurchaseIx(amountLamports, user);
8639
+ const tx = new Transaction().add(cuIx, ix);
8640
+ const prepared = await this.prepareTx(tx);
8641
+ const signed = await this.signTransaction(prepared.tx);
8642
+ return this.sendAndConfirmHttp(signed, prepared);
8643
+ } catch (err) {
8644
+ throw new Error(`Failed to buy liqSOL pretokens: ${err}`);
8645
+ }
9046
8646
  }
9047
8647
  async getPortfolio() {
9048
8648
  if (!this.pubKey) throw new Error("User pubKey is undefined");
9049
- const user = this.solPubKey;
9050
- const reservePoolPDA = deriveReservePoolPda();
9051
- const vaultPDA = deriveVaultPda();
9052
- const liqsolMint = deriveLiqsolMintPda();
9053
- const userLiqsolAta = getAssociatedTokenAddressSync(
9054
- liqsolMint,
9055
- user,
9056
- false,
9057
- TOKEN_2022_PROGRAM_ID,
9058
- ASSOCIATED_TOKEN_PROGRAM_ID
9059
- );
9060
- const [nativeLamports, actualBalResp, snapshot] = await Promise.all([
9061
- this.connection.getBalance(user, "confirmed"),
9062
- this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
9063
- this.outpostClient.fetchWireState(user).catch(() => null)
9064
- ]);
9065
- const LIQSOL_DECIMALS = 9;
9066
- const actualAmountStr = actualBalResp?.value?.amount ?? "0";
9067
- const globalState = snapshot?.globalState ?? null;
9068
- const outpostAccount = snapshot?.outpostAccount ?? null;
9069
- const trancheState = snapshot?.trancheState ?? null;
9070
- const userPretokenRecord = snapshot?.userPretokenRecord ?? null;
9071
- const stakedLiqsolStr = outpostAccount?.stakedLiqsol?.toString?.() ?? "0";
9072
- const wirePretokensStr = userPretokenRecord?.totalPretokensPurchased?.toString?.() ?? "0";
9073
- const currentIndexStr = globalState?.currentIndex?.toString?.() ?? "0";
9074
- const totalSharesStr = globalState?.totalShares?.toString?.() ?? "0";
9075
- const userSharesStr = outpostAccount?.stakedShares?.toString?.() ?? "0";
9076
- const stakedLiqsol = BigInt(stakedLiqsolStr);
9077
- const currentIndex = BigInt(currentIndexStr);
9078
- const totalShares = BigInt(totalSharesStr);
9079
- const userShares = BigInt(userSharesStr);
9080
- let estimatedClaim = BigInt(0);
9081
- let estimatedYield = BigInt(0);
9082
- if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
9083
- estimatedClaim = userShares * currentIndex / INDEX_SCALE$1;
9084
- if (estimatedClaim > stakedLiqsol) {
9085
- estimatedYield = estimatedClaim - stakedLiqsol;
8649
+ try {
8650
+ const user = this.solPubKey;
8651
+ const reservePoolPDA = deriveReservePoolPda();
8652
+ const vaultPDA = deriveVaultPda();
8653
+ const liqsolMint = deriveLiqsolMintPda();
8654
+ const userLiqsolAta = getAssociatedTokenAddressSync(
8655
+ liqsolMint,
8656
+ user,
8657
+ false,
8658
+ TOKEN_2022_PROGRAM_ID,
8659
+ ASSOCIATED_TOKEN_PROGRAM_ID
8660
+ );
8661
+ const [nativeLamports, actualBalResp, snapshot] = await Promise.all([
8662
+ this.connection.getBalance(user, "confirmed"),
8663
+ this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
8664
+ this.outpostClient.fetchWireState(user).catch(() => null)
8665
+ ]);
8666
+ const LIQSOL_DECIMALS = 9;
8667
+ const actualAmountStr = actualBalResp?.value?.amount ?? "0";
8668
+ const globalState = snapshot?.globalState ?? null;
8669
+ const outpostAccount = snapshot?.outpostAccount ?? null;
8670
+ const trancheState = snapshot?.trancheState ?? null;
8671
+ const userPretokenRecord = snapshot?.userPretokenRecord ?? null;
8672
+ const stakedLiqsolStr = outpostAccount?.stakedLiqsol?.toString?.() ?? "0";
8673
+ const wirePretokensStr = userPretokenRecord?.totalPretokensPurchased?.toString?.() ?? "0";
8674
+ const currentIndexStr = globalState?.currentIndex?.toString?.() ?? "0";
8675
+ const totalSharesStr = globalState?.totalShares?.toString?.() ?? "0";
8676
+ const userSharesStr = outpostAccount?.stakedShares?.toString?.() ?? "0";
8677
+ const stakedLiqsol = BigInt(stakedLiqsolStr);
8678
+ const currentIndex = BigInt(currentIndexStr);
8679
+ const totalShares = BigInt(totalSharesStr);
8680
+ const userShares = BigInt(userSharesStr);
8681
+ let estimatedClaim = BigInt(0);
8682
+ let estimatedYield = BigInt(0);
8683
+ if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
8684
+ estimatedClaim = userShares * currentIndex / INDEX_SCALE$1;
8685
+ if (estimatedClaim > stakedLiqsol) {
8686
+ estimatedYield = estimatedClaim - stakedLiqsol;
8687
+ }
9086
8688
  }
8689
+ return {
8690
+ native: {
8691
+ amount: BigInt(nativeLamports),
8692
+ symbol: "SOL",
8693
+ decimals: 9
8694
+ },
8695
+ liq: {
8696
+ amount: BigInt(actualAmountStr),
8697
+ symbol: "LiqSOL",
8698
+ decimals: LIQSOL_DECIMALS,
8699
+ ata: userLiqsolAta
8700
+ },
8701
+ staked: {
8702
+ amount: stakedLiqsol,
8703
+ symbol: "LiqSOL",
8704
+ decimals: LIQSOL_DECIMALS
8705
+ },
8706
+ wire: {
8707
+ amount: BigInt(wirePretokensStr),
8708
+ symbol: "$WIRE",
8709
+ decimals: 8
8710
+ },
8711
+ yield: {
8712
+ currentIndex,
8713
+ indexScale: INDEX_SCALE$1,
8714
+ totalShares,
8715
+ userShares,
8716
+ estimatedClaim,
8717
+ estimatedYield
8718
+ },
8719
+ extras: {
8720
+ userLiqsolAta: userLiqsolAta.toBase58(),
8721
+ reservePoolPDA: reservePoolPDA.toBase58(),
8722
+ vaultPDA: vaultPDA.toBase58(),
8723
+ globalIndex: globalState?.currentIndex?.toString(),
8724
+ totalShares: globalState?.totalShares?.toString(),
8725
+ currentTrancheNumber: trancheState?.currentTrancheNumber?.toString(),
8726
+ currentTranchePriceUsd: trancheState?.currentTranchePriceUsd?.toString()
8727
+ },
8728
+ chainID: this.network.chainId
8729
+ };
8730
+ } catch (err) {
8731
+ throw new Error(`Failed to get Solana portfolio: ${err}`);
9087
8732
  }
9088
- return {
9089
- native: {
9090
- amount: BigInt(nativeLamports),
9091
- symbol: "SOL",
9092
- decimals: 9
9093
- },
9094
- liq: {
9095
- amount: BigInt(actualAmountStr),
9096
- symbol: "LiqSOL",
9097
- decimals: LIQSOL_DECIMALS,
9098
- ata: userLiqsolAta
9099
- },
9100
- staked: {
9101
- amount: stakedLiqsol,
9102
- symbol: "LiqSOL",
9103
- decimals: LIQSOL_DECIMALS
9104
- },
9105
- wire: {
9106
- amount: BigInt(wirePretokensStr),
9107
- symbol: "$WIRE",
9108
- decimals: 8
9109
- },
9110
- yield: {
9111
- currentIndex,
9112
- indexScale: INDEX_SCALE$1,
9113
- totalShares,
9114
- userShares,
9115
- estimatedClaim,
9116
- estimatedYield
9117
- },
9118
- extras: {
9119
- userLiqsolAta: userLiqsolAta.toBase58(),
9120
- reservePoolPDA: reservePoolPDA.toBase58(),
9121
- vaultPDA: vaultPDA.toBase58(),
9122
- globalIndex: globalState?.currentIndex?.toString(),
9123
- totalShares: globalState?.totalShares?.toString(),
9124
- currentTrancheNumber: trancheState?.currentTrancheNumber?.toString(),
9125
- currentTranchePriceUsd: trancheState?.currentTranchePriceUsd?.toString()
9126
- },
9127
- chainID: this.network.chainId
9128
- };
9129
8733
  }
9130
8734
  async getUserRecord() {
9131
8735
  if (!this.pubKey) throw new Error("User pubKey is undefined");
9132
8736
  return this.distributionClient.getUserRecord(this.solPubKey);
9133
8737
  }
9134
8738
  async getTrancheSnapshot(options) {
9135
- const {
9136
- chainID = SolChainID.WireTestnet,
9137
- windowBefore,
9138
- windowAfter
9139
- } = options ?? {};
9140
- const [globalState, trancheState] = await Promise.all([
9141
- this.tokenClient.fetchGlobalState(),
9142
- this.tokenClient.fetchTrancheState()
9143
- ]);
9144
- const { price: solPriceUsd, timestamp } = await this.tokenClient.getSolPriceUsdSafe();
9145
- return buildSolanaTrancheSnapshot({
9146
- chainID,
9147
- globalState,
9148
- trancheState,
9149
- solPriceUsd,
9150
- nativePriceTimestamp: timestamp,
9151
- ladderWindowBefore: windowBefore,
9152
- ladderWindowAfter: windowAfter
9153
- });
8739
+ try {
8740
+ const {
8741
+ chainID = SolChainID.WireTestnet,
8742
+ windowBefore,
8743
+ windowAfter
8744
+ } = options ?? {};
8745
+ const [globalState, trancheState] = await Promise.all([
8746
+ this.tokenClient.fetchGlobalState(),
8747
+ this.tokenClient.fetchTrancheState()
8748
+ ]);
8749
+ const { price: solPriceUsd, timestamp } = await this.tokenClient.getSolPriceUsdSafe();
8750
+ return buildSolanaTrancheSnapshot({
8751
+ chainID,
8752
+ globalState,
8753
+ trancheState,
8754
+ solPriceUsd,
8755
+ nativePriceTimestamp: timestamp,
8756
+ ladderWindowBefore: windowBefore,
8757
+ ladderWindowAfter: windowAfter
8758
+ });
8759
+ } catch (err) {
8760
+ throw new Error(`Failed to build Solana tranche snapshot: ${err}`);
8761
+ }
9154
8762
  }
9155
8763
  async getSystemAPY() {
9156
- const ratePerEpoch = await this.getEpochRateDecimalFromProgram();
9157
- const epochsPerYear = await this.getEpochsPerYearFromCluster();
9158
- const apyDecimal = Math.pow(1 + ratePerEpoch, epochsPerYear) - 1;
9159
- const apyPercent = apyDecimal * 100;
9160
- return apyPercent;
8764
+ try {
8765
+ const ratePerEpoch = await this.getEpochRateDecimalFromProgram();
8766
+ const epochsPerYear = await this.getEpochsPerYearFromCluster();
8767
+ const apyDecimal = Math.pow(1 + ratePerEpoch, epochsPerYear) - 1;
8768
+ const apyPercent = apyDecimal * 100;
8769
+ return apyPercent;
8770
+ } catch (err) {
8771
+ throw new Error(`Failed to compute Solana system APY: ${err}`);
8772
+ }
9161
8773
  }
9162
8774
  async getEpochRateDecimalFromProgram() {
9163
- const liqSolCoreProgram = this.program.getProgram("liqsolCore");
9164
- const stakeMetricsPda = deriveStakeMetricsPda();
9165
- const stakeMetrics = await liqSolCoreProgram.account.stakeMetrics.fetch(stakeMetricsPda);
9166
- const raw = BigInt(stakeMetrics.solSystemPayRate.toString());
9167
- const rateDecimal = Number(raw) / Number(PAY_RATE_SCALE_FACTOR);
9168
- return rateDecimal;
8775
+ try {
8776
+ const liqSolCoreProgram = this.program.getProgram("liqsolCore");
8777
+ const stakeMetricsPda = deriveStakeMetricsPda();
8778
+ const stakeMetrics = await liqSolCoreProgram.account.stakeMetrics.fetch(stakeMetricsPda);
8779
+ const raw = BigInt(stakeMetrics.solSystemPayRate.toString());
8780
+ const rateDecimal = Number(raw) / Number(PAY_RATE_SCALE_FACTOR);
8781
+ return rateDecimal;
8782
+ } catch (err) {
8783
+ throw new Error(`Failed to read stakeMetrics from program: ${err}`);
8784
+ }
9169
8785
  }
9170
8786
  async getEpochsPerYearFromCluster() {
9171
8787
  const now = Date.now();
@@ -34883,10 +34499,6 @@ const CONTRACTS = {
34883
34499
  address: ADDRESSES.ReceiptNFT,
34884
34500
  abi: ReceiptNFTArtifact.abi
34885
34501
  },
34886
- MockAggregator: {
34887
- address: ADDRESSES.MockAggregator,
34888
- abi: AggregatorArtifact.abi
34889
- },
34890
34502
  Pool: {
34891
34503
  address: ADDRESSES.Pool,
34892
34504
  abi: PoolArtifact.abi
@@ -34926,6 +34538,10 @@ const CONTRACTS = {
34926
34538
  Depositor: {
34927
34539
  address: ADDRESSES.Depositor,
34928
34540
  abi: DepositorArtifact.abi
34541
+ },
34542
+ MockAggregator: {
34543
+ address: ADDRESSES.MockAggregator,
34544
+ abi: AggregatorArtifact.abi
34929
34545
  }
34930
34546
  };
34931
34547
  class EthereumContractService {
@@ -35493,18 +35109,22 @@ class OPPClient {
35493
35109
  };
35494
35110
  }
35495
35111
  async getMessages(address) {
35496
- const oppMessageFilter = this.contract.OPP.filters.OPPMessage();
35497
- const events = await this.contract.OPP.queryFilter(oppMessageFilter, 0, "latest");
35498
- const allAssertions = [];
35499
- for (const event of events) {
35500
- const assertions = await this.extractAssertionsFromEvent(event);
35501
- allAssertions.push(...assertions);
35112
+ try {
35113
+ const oppMessageFilter = this.contract.OPP.filters.OPPMessage();
35114
+ const events = await this.contract.OPP.queryFilter(oppMessageFilter, 0, "latest");
35115
+ const allAssertions = [];
35116
+ for (const event of events) {
35117
+ const assertions = await this.extractAssertionsFromEvent(event);
35118
+ allAssertions.push(...assertions);
35119
+ }
35120
+ const normalized = address ? address.toLowerCase() : null;
35121
+ const filtered = allAssertions.filter(
35122
+ (a) => a.from && a.from.toLowerCase() === normalized || a.to && a.to.toLowerCase() === normalized
35123
+ );
35124
+ return filtered.reverse();
35125
+ } catch (error) {
35126
+ return [];
35502
35127
  }
35503
- const normalized = address ? address.toLowerCase() : null;
35504
- const filtered = allAssertions.filter(
35505
- (a) => a.from && a.from.toLowerCase() === normalized || a.to && a.to.toLowerCase() === normalized
35506
- );
35507
- return filtered.reverse();
35508
35128
  }
35509
35129
  async extractAssertionsFromEvent(event) {
35510
35130
  const header = event.args.header;
@@ -35740,7 +35360,12 @@ class ReceiptClient {
35740
35360
  return this.fetchPreLaunchReceipts(address);
35741
35361
  }
35742
35362
  async stakeReceipts(address) {
35743
- return this.fetchPreLaunchReceipts(address, ReceiptNFTKind.STAKE);
35363
+ try {
35364
+ const receipts = await this.fetchPreLaunchReceipts(address, ReceiptNFTKind.STAKE);
35365
+ return receipts;
35366
+ } catch (err) {
35367
+ return [];
35368
+ }
35744
35369
  }
35745
35370
  async pretokenReceipts(address) {
35746
35371
  return this.fetchPreLaunchReceipts(address, ReceiptNFTKind.PRETOKEN_PURCHASE);
@@ -35870,80 +35495,81 @@ class EthereumStakingClient {
35870
35495
  async buy(amount) {
35871
35496
  this.ensureUser();
35872
35497
  const buyer = await this.signer.getAddress();
35873
- const network = await this.provider.getNetwork();
35874
- const chainId = network.chainId;
35875
- const allowedTestChains = new Set([560048]);
35876
- if (allowedTestChains.has(chainId)) await this.updateMockAggregatorPrice();
35877
35498
  let result = await this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
35878
35499
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
35879
35500
  }
35880
35501
  async getPortfolio() {
35881
- if (!this.signer) return Promise.resolve(null);
35882
- const walletAddress = await this.signer.getAddress();
35883
- const nativeBalance = await this.provider.getBalance(walletAddress);
35884
- const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
35885
- const nativeSymbol = this.network?.nativeCurrency?.symbol ?? "ETH";
35886
- const liqBalance = await this.contract.LiqEthToken.balanceOf(walletAddress);
35887
- const liqSymbol = "Liq" + (this.network?.nativeCurrency?.symbol ?? "ETH");
35888
- let stakeReceipts = await this.receiptClient.stakeReceipts(walletAddress);
35889
- let stakeBalanceBN = BigNumber.from(0);
35890
- for (let r of stakeReceipts) {
35891
- stakeBalanceBN = stakeBalanceBN.add(BigNumber.from(r.receipt.principal.amount));
35892
- }
35893
- let stakeSharesBN = BigNumber.from(0);
35894
- for (let r of stakeReceipts) {
35895
- stakeSharesBN = stakeSharesBN.add(BigNumber.from(r.receipt.shares.amount));
35896
- }
35897
- const wireBalance = await this.contract.Pretoken.balanceOf(walletAddress);
35898
- let currentIndex = BigInt(0);
35899
- let totalShares = BigInt(0);
35900
- let userShares = BigInt(0);
35901
- const indexScale = BigInt(1e27);
35902
35502
  try {
35903
- const [indexBn, totalSharesBn] = await Promise.all([
35904
- this.contract.Depositor.index().catch(() => BigNumber.from(0)),
35905
- this.contract.Depositor.totalShares().catch(() => BigNumber.from(0))
35906
- ]);
35907
- const userSharesBn = stakeSharesBN;
35908
- currentIndex = BigInt(indexBn.toString());
35909
- totalShares = BigInt(totalSharesBn.toString());
35910
- userShares = BigInt(userSharesBn.toString());
35911
- } catch {
35503
+ if (!this.signer) return Promise.resolve(null);
35504
+ const walletAddress = await this.signer.getAddress();
35505
+ const nativeBalance = await this.provider.getBalance(walletAddress);
35506
+ const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
35507
+ const nativeSymbol = this.network?.nativeCurrency?.symbol ?? "ETH";
35508
+ const liqBalance = await this.contract.LiqEthToken.balanceOf(walletAddress);
35509
+ const liqSymbol = "Liq" + (this.network?.nativeCurrency?.symbol ?? "ETH");
35510
+ let stakeReceipts = await this.receiptClient.stakeReceipts(walletAddress);
35511
+ let stakeBalanceBN = BigNumber.from(0);
35512
+ for (let r of stakeReceipts) {
35513
+ stakeBalanceBN = stakeBalanceBN.add(BigNumber.from(r.receipt.principal.amount));
35514
+ }
35515
+ let stakeSharesBN = BigNumber.from(0);
35516
+ for (let r of stakeReceipts) {
35517
+ stakeSharesBN = stakeSharesBN.add(BigNumber.from(r.receipt.shares.amount));
35518
+ }
35519
+ const wireBalance = await this.contract.Pretoken.balanceOf(walletAddress);
35520
+ let currentIndex = BigInt(0);
35521
+ let totalShares = BigInt(0);
35522
+ let userShares = BigInt(0);
35523
+ const indexScale = BigInt(1e27);
35524
+ try {
35525
+ const [indexBn, totalSharesBn] = await Promise.all([
35526
+ this.contract.Depositor.index().catch(() => BigNumber.from(0)),
35527
+ this.contract.Depositor.totalShares().catch(() => BigNumber.from(0))
35528
+ ]);
35529
+ const userSharesBn = stakeSharesBN;
35530
+ currentIndex = BigInt(indexBn.toString());
35531
+ totalShares = BigInt(totalSharesBn.toString());
35532
+ userShares = BigInt(userSharesBn.toString());
35533
+ } catch (error) {
35534
+ console.log("Error fetching staking index/shares:", error);
35535
+ }
35536
+ let estimatedClaim = BigInt(0);
35537
+ let estimatedYield = BigInt(0);
35538
+ const portfolio = {
35539
+ native: {
35540
+ amount: nativeBalance.toBigInt(),
35541
+ decimals: nativeDecimals,
35542
+ symbol: nativeSymbol
35543
+ },
35544
+ liq: {
35545
+ amount: liqBalance.toBigInt(),
35546
+ decimals: nativeDecimals,
35547
+ symbol: liqSymbol
35548
+ },
35549
+ staked: {
35550
+ amount: stakeBalanceBN.toBigInt(),
35551
+ decimals: nativeDecimals,
35552
+ symbol: liqSymbol
35553
+ },
35554
+ wire: {
35555
+ amount: wireBalance.toBigInt(),
35556
+ decimals: 18,
35557
+ symbol: "$WIRE"
35558
+ },
35559
+ yield: {
35560
+ currentIndex,
35561
+ indexScale,
35562
+ totalShares,
35563
+ userShares,
35564
+ estimatedClaim,
35565
+ estimatedYield
35566
+ },
35567
+ chainID: this.network.chainId
35568
+ };
35569
+ return portfolio;
35570
+ } catch (error) {
35571
+ throw error;
35912
35572
  }
35913
- let estimatedClaim = BigInt(0);
35914
- let estimatedYield = BigInt(0);
35915
- const portfolio = {
35916
- native: {
35917
- amount: nativeBalance.toBigInt(),
35918
- decimals: nativeDecimals,
35919
- symbol: nativeSymbol
35920
- },
35921
- liq: {
35922
- amount: liqBalance.toBigInt(),
35923
- decimals: nativeDecimals,
35924
- symbol: liqSymbol
35925
- },
35926
- staked: {
35927
- amount: stakeBalanceBN.toBigInt(),
35928
- decimals: nativeDecimals,
35929
- symbol: liqSymbol
35930
- },
35931
- wire: {
35932
- amount: wireBalance.toBigInt(),
35933
- decimals: 18,
35934
- symbol: "$WIRE"
35935
- },
35936
- yield: {
35937
- currentIndex,
35938
- indexScale,
35939
- totalShares,
35940
- userShares,
35941
- estimatedClaim,
35942
- estimatedYield
35943
- },
35944
- chainID: this.network.chainId
35945
- };
35946
- return portfolio;
35947
35573
  }
35948
35574
  async fetchPrelaunchReceipts(address) {
35949
35575
  this.ensureUser();
@@ -35987,7 +35613,7 @@ class EthereumStakingClient {
35987
35613
  }
35988
35614
  async getTrancheSnapshot(options) {
35989
35615
  const {
35990
- chainID = EvmChainID.Hoodi,
35616
+ chainID = EvmChainID.Ethereum,
35991
35617
  windowBefore,
35992
35618
  windowAfter
35993
35619
  } = options ?? {};
@@ -36008,10 +35634,8 @@ class EthereumStakingClient {
36008
35634
  ]);
36009
35635
  const totalTrancheSupply = BigInt(totalSupplyBn.toString()) / BigInt(1e10);
36010
35636
  const currentTrancheSupply = BigInt(trancheSupplyBn.toString()) / BigInt(1e10);
36011
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
36012
35637
  let ethPriceUsdBn = await this.contract.EthUsdPriceConsumer.getPrice18Decimals();
36013
35638
  let ethPriceUsd = BigInt(ethPriceUsdBn.toString()) / BigInt(1e10);
36014
- let nativePriceTimestamp = Number(updatedAt);
36015
35639
  const initialTrancheSupply = BigInt(INITIAL_TRANCHE_SUPPLY) * BigInt(1e8);
36016
35640
  return buildEthereumTrancheSnapshot({
36017
35641
  chainID,
@@ -36027,7 +35651,6 @@ class EthereumStakingClient {
36027
35651
  minPriceUsd,
36028
35652
  maxPriceUsd,
36029
35653
  ethPriceUsd,
36030
- nativePriceTimestamp,
36031
35654
  ladderWindowBefore: windowBefore,
36032
35655
  ladderWindowAfter: windowAfter
36033
35656
  });
@@ -36060,34 +35683,6 @@ class EthereumStakingClient {
36060
35683
  }
36061
35684
  return bufferWei;
36062
35685
  }
36063
- async updateMockAggregatorPrice() {
36064
- const aggregator = this.contract.MockAggregator;
36065
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = await aggregator.latestRoundData();
36066
- const now = (await this.provider.getBlock("latest")).timestamp;
36067
- const ageSec = Number(now) - Number(updatedAt);
36068
- const ONE_HOUR = 1 * 3600;
36069
- if (ageSec > ONE_HOUR) {
36070
- const network = await this.provider.getNetwork();
36071
- const chainId = network.chainId;
36072
- const allowedTestChains = new Set([560048]);
36073
- if (!allowedTestChains.has(chainId)) {
36074
- console.warn(`MockAggregator is stale (${ageSec}s) but chainId ${chainId} is not a test/local network \u2014 skipping update.`);
36075
- return;
36076
- }
36077
- const res = await fetch("https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd");
36078
- const data = await res.json();
36079
- const ethUsd = data.ethereum.usd;
36080
- const currentEthPrice = ethers.utils.parseUnits(ethUsd.toString(), 8);
36081
- try {
36082
- const tx = await aggregator.updateAnswer(currentEthPrice);
36083
- const txreceipt = await tx.wait(1);
36084
- } catch (err) {
36085
- console.error("MockAggregator updateAnswer failed", err?.message || err);
36086
- }
36087
- } else {
36088
- console.log(`MockAggregator updated ${ageSec}s ago \u2014 no update needed`);
36089
- }
36090
- }
36091
35686
  }
36092
35687
 
36093
35688
  class Staker {
@@ -36097,8 +35692,8 @@ class Staker {
36097
35692
  if (!Array.isArray(config)) config = [config];
36098
35693
  config.forEach((cfg) => {
36099
35694
  switch (cfg.network.chainId) {
35695
+ case SolChainID.Mainnet:
36100
35696
  case SolChainID.Devnet:
36101
- case SolChainID.WireTestnet:
36102
35697
  this.clients.set(cfg.network.chainId, new SolanaStakingClient(cfg));
36103
35698
  break;
36104
35699
  case EvmChainID.Ethereum:
@@ -36142,7 +35737,6 @@ const CONTRACT_NAMES = [
36142
35737
  "Base58",
36143
35738
  "sysio_merkle",
36144
35739
  "ReceiptNFT",
36145
- "MockAggregator",
36146
35740
  "Pool",
36147
35741
  "OutpostManager",
36148
35742
  "sysio_write",
@@ -36152,7 +35746,8 @@ const CONTRACT_NAMES = [
36152
35746
  "OPP",
36153
35747
  "Pretoken",
36154
35748
  "OPPInbound",
36155
- "Depositor"
35749
+ "Depositor",
35750
+ "MockAggregator"
36156
35751
  ];
36157
35752
 
36158
35753
  var types$1 = /*#__PURE__*/Object.freeze({