@wireio/stake 0.7.3 → 1.0.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.
package/lib/stake.m.js CHANGED
@@ -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,50 +2743,10 @@ var instructions$3 = [
3052
2743
  signer: true
3053
2744
  },
3054
2745
  {
3055
- name: "new_authority",
3056
- signer: true
3057
- }
3058
- ],
3059
- args: [
3060
- ]
3061
- },
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
2746
+ name: "new_authority"
3088
2747
  }
3089
2748
  ],
3090
2749
  args: [
3091
- {
3092
- name: "vote_account",
3093
- type: "pubkey"
3094
- },
3095
- {
3096
- name: "epoch",
3097
- type: "u16"
3098
- }
3099
2750
  ]
3100
2751
  },
3101
2752
  {
@@ -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,227 @@ 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 tx = await this.depositClient.buildDepositTx(amountLamports);
8571
+ const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
8572
+ const signed = await this.signTransaction(prepared);
8573
+ return await this.sendAndConfirmHttp(signed, {
8574
+ blockhash,
8575
+ lastValidBlockHeight
8576
+ });
8577
+ } catch (err) {
8578
+ throw new Error(`Failed to deposit Solana: ${err}`);
8579
+ }
8991
8580
  }
8992
8581
  async withdraw(amountLamports) {
8993
8582
  this.ensureUser();
8994
8583
  if (amountLamports <= BigInt(0)) {
8995
8584
  throw new Error("Withdraw amount must be greater than zero.");
8996
8585
  }
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
- });
8586
+ try {
8587
+ const tx = await this.depositClient.buildWithdrawTx(amountLamports);
8588
+ const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
8589
+ const signed = await this.signTransaction(prepared);
8590
+ return await this.sendAndConfirmHttp(signed, {
8591
+ blockhash,
8592
+ lastValidBlockHeight
8593
+ });
8594
+ } catch (err) {
8595
+ throw new Error(`Failed to withdraw Solana: ${err}`);
8596
+ }
9004
8597
  }
9005
8598
  async stake(amountLamports) {
9006
8599
  this.ensureUser();
9007
8600
  if (!amountLamports || amountLamports <= BigInt(0)) {
9008
8601
  throw new Error("Stake amount must be greater than zero.");
9009
8602
  }
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);
8603
+ try {
8604
+ const user = this.solPubKey;
8605
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8606
+ const ix = await this.outpostClient.buildStakeIx(amountLamports, user);
8607
+ const tx = new Transaction().add(cuIx, ix);
8608
+ const prepared = await this.prepareTx(tx);
8609
+ const signed = await this.signTransaction(prepared.tx);
8610
+ return this.sendAndConfirmHttp(signed, prepared);
8611
+ } catch (err) {
8612
+ throw new Error(`Failed to stake Solana: ${err}`);
8613
+ }
9017
8614
  }
9018
8615
  async unstake(amountLamports) {
9019
8616
  this.ensureUser();
9020
8617
  if (!amountLamports || amountLamports <= BigInt(0)) {
9021
8618
  throw new Error("Unstake amount must be greater than zero.");
9022
8619
  }
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);
8620
+ try {
8621
+ const user = this.solPubKey;
8622
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8623
+ const ix = await this.outpostClient.buildUnstakeIx(amountLamports, user);
8624
+ const tx = new Transaction().add(cuIx, ix);
8625
+ const prepared = await this.prepareTx(tx);
8626
+ const signed = await this.signTransaction(prepared.tx);
8627
+ return this.sendAndConfirmHttp(signed, prepared);
8628
+ } catch (err) {
8629
+ throw new Error(`Failed to unstake Solana: ${err}`);
8630
+ }
9030
8631
  }
9031
8632
  async buy(amountLamports) {
9032
8633
  this.ensureUser();
9033
8634
  if (!amountLamports || amountLamports <= BigInt(0)) {
9034
8635
  throw new Error("liqSOL pretoken purchase requires a positive amount.");
9035
8636
  }
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
- });
8637
+ try {
8638
+ const user = this.solPubKey;
8639
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8640
+ const ix = await this.tokenClient.buildPurchaseIx(amountLamports, user);
8641
+ const tx = new Transaction().add(cuIx, ix);
8642
+ const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
8643
+ const signed = await this.signTransaction(prepared);
8644
+ return await this.sendAndConfirmHttp(signed, {
8645
+ blockhash,
8646
+ lastValidBlockHeight
8647
+ });
8648
+ } catch (err) {
8649
+ throw new Error(`Failed to buy liqSOL pretokens: ${err}`);
8650
+ }
9046
8651
  }
9047
8652
  async getPortfolio() {
9048
8653
  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;
8654
+ try {
8655
+ const user = this.solPubKey;
8656
+ const reservePoolPDA = deriveReservePoolPda();
8657
+ const vaultPDA = deriveVaultPda();
8658
+ const liqsolMint = deriveLiqsolMintPda();
8659
+ const userLiqsolAta = getAssociatedTokenAddressSync(
8660
+ liqsolMint,
8661
+ user,
8662
+ false,
8663
+ TOKEN_2022_PROGRAM_ID,
8664
+ ASSOCIATED_TOKEN_PROGRAM_ID
8665
+ );
8666
+ const [nativeLamports, actualBalResp, snapshot] = await Promise.all([
8667
+ this.connection.getBalance(user, "confirmed"),
8668
+ this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
8669
+ this.outpostClient.fetchWireState(user).catch(() => null)
8670
+ ]);
8671
+ const LIQSOL_DECIMALS = 9;
8672
+ const actualAmountStr = actualBalResp?.value?.amount ?? "0";
8673
+ const globalState = snapshot?.globalState ?? null;
8674
+ const outpostAccount = snapshot?.outpostAccount ?? null;
8675
+ const trancheState = snapshot?.trancheState ?? null;
8676
+ const userPretokenRecord = snapshot?.userPretokenRecord ?? null;
8677
+ const stakedLiqsolStr = outpostAccount?.stakedLiqsol?.toString?.() ?? "0";
8678
+ const wirePretokensStr = userPretokenRecord?.totalPretokensPurchased?.toString?.() ?? "0";
8679
+ const currentIndexStr = globalState?.currentIndex?.toString?.() ?? "0";
8680
+ const totalSharesStr = globalState?.totalShares?.toString?.() ?? "0";
8681
+ const userSharesStr = outpostAccount?.stakedShares?.toString?.() ?? "0";
8682
+ const stakedLiqsol = BigInt(stakedLiqsolStr);
8683
+ const currentIndex = BigInt(currentIndexStr);
8684
+ const totalShares = BigInt(totalSharesStr);
8685
+ const userShares = BigInt(userSharesStr);
8686
+ let estimatedClaim = BigInt(0);
8687
+ let estimatedYield = BigInt(0);
8688
+ if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
8689
+ estimatedClaim = userShares * currentIndex / INDEX_SCALE$1;
8690
+ if (estimatedClaim > stakedLiqsol) {
8691
+ estimatedYield = estimatedClaim - stakedLiqsol;
8692
+ }
9086
8693
  }
8694
+ return {
8695
+ native: {
8696
+ amount: BigInt(nativeLamports),
8697
+ symbol: "SOL",
8698
+ decimals: 9
8699
+ },
8700
+ liq: {
8701
+ amount: BigInt(actualAmountStr),
8702
+ symbol: "LiqSOL",
8703
+ decimals: LIQSOL_DECIMALS,
8704
+ ata: userLiqsolAta
8705
+ },
8706
+ staked: {
8707
+ amount: stakedLiqsol,
8708
+ symbol: "LiqSOL",
8709
+ decimals: LIQSOL_DECIMALS
8710
+ },
8711
+ wire: {
8712
+ amount: BigInt(wirePretokensStr),
8713
+ symbol: "$WIRE",
8714
+ decimals: 8
8715
+ },
8716
+ yield: {
8717
+ currentIndex,
8718
+ indexScale: INDEX_SCALE$1,
8719
+ totalShares,
8720
+ userShares,
8721
+ estimatedClaim,
8722
+ estimatedYield
8723
+ },
8724
+ extras: {
8725
+ userLiqsolAta: userLiqsolAta.toBase58(),
8726
+ reservePoolPDA: reservePoolPDA.toBase58(),
8727
+ vaultPDA: vaultPDA.toBase58(),
8728
+ globalIndex: globalState?.currentIndex?.toString(),
8729
+ totalShares: globalState?.totalShares?.toString(),
8730
+ currentTrancheNumber: trancheState?.currentTrancheNumber?.toString(),
8731
+ currentTranchePriceUsd: trancheState?.currentTranchePriceUsd?.toString()
8732
+ },
8733
+ chainID: this.network.chainId
8734
+ };
8735
+ } catch (err) {
8736
+ throw new Error(`Failed to get Solana portfolio: ${err}`);
9087
8737
  }
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
8738
  }
9130
8739
  async getUserRecord() {
9131
8740
  if (!this.pubKey) throw new Error("User pubKey is undefined");
9132
8741
  return this.distributionClient.getUserRecord(this.solPubKey);
9133
8742
  }
9134
8743
  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
- });
8744
+ try {
8745
+ const {
8746
+ chainID = SolChainID.WireTestnet,
8747
+ windowBefore,
8748
+ windowAfter
8749
+ } = options ?? {};
8750
+ const [globalState, trancheState] = await Promise.all([
8751
+ this.tokenClient.fetchGlobalState(),
8752
+ this.tokenClient.fetchTrancheState()
8753
+ ]);
8754
+ const { price: solPriceUsd, timestamp } = await this.tokenClient.getSolPriceUsdSafe();
8755
+ return buildSolanaTrancheSnapshot({
8756
+ chainID,
8757
+ globalState,
8758
+ trancheState,
8759
+ solPriceUsd,
8760
+ nativePriceTimestamp: timestamp,
8761
+ ladderWindowBefore: windowBefore,
8762
+ ladderWindowAfter: windowAfter
8763
+ });
8764
+ } catch (err) {
8765
+ throw new Error(`Failed to build Solana tranche snapshot: ${err}`);
8766
+ }
9154
8767
  }
9155
8768
  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;
8769
+ try {
8770
+ const ratePerEpoch = await this.getEpochRateDecimalFromProgram();
8771
+ const epochsPerYear = await this.getEpochsPerYearFromCluster();
8772
+ const apyDecimal = Math.pow(1 + ratePerEpoch, epochsPerYear) - 1;
8773
+ const apyPercent = apyDecimal * 100;
8774
+ return apyPercent;
8775
+ } catch (err) {
8776
+ throw new Error(`Failed to compute Solana system APY: ${err}`);
8777
+ }
9161
8778
  }
9162
8779
  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;
8780
+ try {
8781
+ const liqSolCoreProgram = this.program.getProgram("liqsolCore");
8782
+ const stakeMetricsPda = deriveStakeMetricsPda();
8783
+ const stakeMetrics = await liqSolCoreProgram.account.stakeMetrics.fetch(stakeMetricsPda);
8784
+ const raw = BigInt(stakeMetrics.solSystemPayRate.toString());
8785
+ const rateDecimal = Number(raw) / Number(PAY_RATE_SCALE_FACTOR);
8786
+ return rateDecimal;
8787
+ } catch (err) {
8788
+ throw new Error(`Failed to read stakeMetrics from program: ${err}`);
8789
+ }
9169
8790
  }
9170
8791
  async getEpochsPerYearFromCluster() {
9171
8792
  const now = Date.now();
@@ -9355,10 +8976,10 @@ _SolanaStakingClient.EPOCHS_PER_YEAR_TTL_MS = 10 * 60 * 1e3;
9355
8976
  _SolanaStakingClient.FEE_CACHE_TTL_MS = 6e4;
9356
8977
  let SolanaStakingClient = _SolanaStakingClient;
9357
8978
 
9358
- var _format$q = "hh-sol-artifact-1";
9359
- var contractName$q = "Accounting";
9360
- var sourceName$q = "contracts/liqEth/accounting.sol";
9361
- var abi$q = [
8979
+ var _format$p = "hh-sol-artifact-1";
8980
+ var contractName$p = "Accounting";
8981
+ var sourceName$p = "contracts/liqEth/accounting.sol";
8982
+ var abi$p = [
9362
8983
  {
9363
8984
  inputs: [
9364
8985
  {
@@ -9920,20 +9541,20 @@ var linkReferences$p = {
9920
9541
  var deployedLinkReferences$p = {
9921
9542
  };
9922
9543
  var AccountingArtifact = {
9923
- _format: _format$q,
9924
- contractName: contractName$q,
9925
- sourceName: sourceName$q,
9926
- abi: abi$q,
9544
+ _format: _format$p,
9545
+ contractName: contractName$p,
9546
+ sourceName: sourceName$p,
9547
+ abi: abi$p,
9927
9548
  bytecode: bytecode$p,
9928
9549
  deployedBytecode: deployedBytecode$p,
9929
9550
  linkReferences: linkReferences$p,
9930
9551
  deployedLinkReferences: deployedLinkReferences$p
9931
9552
  };
9932
9553
 
9933
- var _format$p = "hh-sol-artifact-1";
9934
- var contractName$p = "DepositManager";
9935
- var sourceName$p = "contracts/liqEth/DepositManager.sol";
9936
- var abi$p = [
9554
+ var _format$o = "hh-sol-artifact-1";
9555
+ var contractName$o = "DepositManager";
9556
+ var sourceName$o = "contracts/liqEth/DepositManager.sol";
9557
+ var abi$o = [
9937
9558
  {
9938
9559
  inputs: [
9939
9560
  {
@@ -10968,20 +10589,20 @@ var linkReferences$o = {
10968
10589
  var deployedLinkReferences$o = {
10969
10590
  };
10970
10591
  var DepositManagerArtifact = {
10971
- _format: _format$p,
10972
- contractName: contractName$p,
10973
- sourceName: sourceName$p,
10974
- abi: abi$p,
10592
+ _format: _format$o,
10593
+ contractName: contractName$o,
10594
+ sourceName: sourceName$o,
10595
+ abi: abi$o,
10975
10596
  bytecode: bytecode$o,
10976
10597
  deployedBytecode: deployedBytecode$o,
10977
10598
  linkReferences: linkReferences$o,
10978
10599
  deployedLinkReferences: deployedLinkReferences$o
10979
10600
  };
10980
10601
 
10981
- var _format$o = "hh-sol-artifact-1";
10982
- var contractName$o = "LiqEthToken";
10983
- var sourceName$o = "contracts/liqEth/liqEth.sol";
10984
- var abi$o = [
10602
+ var _format$n = "hh-sol-artifact-1";
10603
+ var contractName$n = "LiqEthToken";
10604
+ var sourceName$n = "contracts/liqEth/liqEth.sol";
10605
+ var abi$n = [
10985
10606
  {
10986
10607
  inputs: [
10987
10608
  {
@@ -12252,20 +11873,20 @@ var linkReferences$n = {
12252
11873
  var deployedLinkReferences$n = {
12253
11874
  };
12254
11875
  var LiqEthArtifact = {
12255
- _format: _format$o,
12256
- contractName: contractName$o,
12257
- sourceName: sourceName$o,
12258
- abi: abi$o,
11876
+ _format: _format$n,
11877
+ contractName: contractName$n,
11878
+ sourceName: sourceName$n,
11879
+ abi: abi$n,
12259
11880
  bytecode: bytecode$n,
12260
11881
  deployedBytecode: deployedBytecode$n,
12261
11882
  linkReferences: linkReferences$n,
12262
11883
  deployedLinkReferences: deployedLinkReferences$n
12263
11884
  };
12264
11885
 
12265
- var _format$n = "hh-sol-artifact-1";
12266
- var contractName$n = "StakingModule";
12267
- var sourceName$n = "contracts/liqEth/stakingModule.sol";
12268
- var abi$n = [
11886
+ var _format$m = "hh-sol-artifact-1";
11887
+ var contractName$m = "StakingModule";
11888
+ var sourceName$m = "contracts/liqEth/stakingModule.sol";
11889
+ var abi$m = [
12269
11890
  {
12270
11891
  inputs: [
12271
11892
  {
@@ -14092,20 +13713,20 @@ var deployedLinkReferences$m = {
14092
13713
  }
14093
13714
  };
14094
13715
  var StakingModuleArtifact = {
14095
- _format: _format$n,
14096
- contractName: contractName$n,
14097
- sourceName: sourceName$n,
14098
- abi: abi$n,
13716
+ _format: _format$m,
13717
+ contractName: contractName$m,
13718
+ sourceName: sourceName$m,
13719
+ abi: abi$m,
14099
13720
  bytecode: bytecode$m,
14100
13721
  deployedBytecode: deployedBytecode$m,
14101
13722
  linkReferences: linkReferences$m,
14102
13723
  deployedLinkReferences: deployedLinkReferences$m
14103
13724
  };
14104
13725
 
14105
- var _format$m = "hh-sol-artifact-1";
14106
- var contractName$m = "WithdrawalQueue";
14107
- var sourceName$m = "contracts/liqEth/withdrawalQueue.sol";
14108
- var abi$m = [
13726
+ var _format$l = "hh-sol-artifact-1";
13727
+ var contractName$l = "WithdrawalQueue";
13728
+ var sourceName$l = "contracts/liqEth/withdrawalQueue.sol";
13729
+ var abi$l = [
14109
13730
  {
14110
13731
  inputs: [
14111
13732
  {
@@ -15103,20 +14724,20 @@ var linkReferences$l = {
15103
14724
  var deployedLinkReferences$l = {
15104
14725
  };
15105
14726
  var WithdrawalQueueArtifact = {
15106
- _format: _format$m,
15107
- contractName: contractName$m,
15108
- sourceName: sourceName$m,
15109
- abi: abi$m,
14727
+ _format: _format$l,
14728
+ contractName: contractName$l,
14729
+ sourceName: sourceName$l,
14730
+ abi: abi$l,
15110
14731
  bytecode: bytecode$l,
15111
14732
  deployedBytecode: deployedBytecode$l,
15112
14733
  linkReferences: linkReferences$l,
15113
14734
  deployedLinkReferences: deployedLinkReferences$l
15114
14735
  };
15115
14736
 
15116
- var _format$l = "hh-sol-artifact-1";
15117
- var contractName$l = "WithdrawalVault";
15118
- var sourceName$l = "contracts/liqEth/withdrawalVault.sol";
15119
- var abi$l = [
14737
+ var _format$k = "hh-sol-artifact-1";
14738
+ var contractName$k = "WithdrawalVault";
14739
+ var sourceName$k = "contracts/liqEth/withdrawalVault.sol";
14740
+ var abi$k = [
15120
14741
  {
15121
14742
  inputs: [
15122
14743
  {
@@ -15578,20 +15199,20 @@ var linkReferences$k = {
15578
15199
  var deployedLinkReferences$k = {
15579
15200
  };
15580
15201
  var WithdrawalVaultArtifact = {
15581
- _format: _format$l,
15582
- contractName: contractName$l,
15583
- sourceName: sourceName$l,
15584
- abi: abi$l,
15202
+ _format: _format$k,
15203
+ contractName: contractName$k,
15204
+ sourceName: sourceName$k,
15205
+ abi: abi$k,
15585
15206
  bytecode: bytecode$k,
15586
15207
  deployedBytecode: deployedBytecode$k,
15587
15208
  linkReferences: linkReferences$k,
15588
15209
  deployedLinkReferences: deployedLinkReferences$k
15589
15210
  };
15590
15211
 
15591
- var _format$k = "hh-sol-artifact-1";
15592
- var contractName$k = "BeaconState";
15593
- var sourceName$k = "contracts/liqEth/BeaconState.sol";
15594
- var abi$k = [
15212
+ var _format$j = "hh-sol-artifact-1";
15213
+ var contractName$j = "BeaconState";
15214
+ var sourceName$j = "contracts/liqEth/BeaconState.sol";
15215
+ var abi$j = [
15595
15216
  {
15596
15217
  inputs: [
15597
15218
  {
@@ -16414,20 +16035,20 @@ var linkReferences$j = {
16414
16035
  var deployedLinkReferences$j = {
16415
16036
  };
16416
16037
  var BeaconStateArtifact = {
16417
- _format: _format$k,
16418
- contractName: contractName$k,
16419
- sourceName: sourceName$k,
16420
- abi: abi$k,
16038
+ _format: _format$j,
16039
+ contractName: contractName$j,
16040
+ sourceName: sourceName$j,
16041
+ abi: abi$j,
16421
16042
  bytecode: bytecode$j,
16422
16043
  deployedBytecode: deployedBytecode$j,
16423
16044
  linkReferences: linkReferences$j,
16424
16045
  deployedLinkReferences: deployedLinkReferences$j
16425
16046
  };
16426
16047
 
16427
- var _format$j = "hh-sol-artifact-1";
16428
- var contractName$j = "YieldOracle";
16429
- var sourceName$j = "contracts/liqEth/Yield.sol";
16430
- var abi$j = [
16048
+ var _format$i = "hh-sol-artifact-1";
16049
+ var contractName$i = "YieldOracle";
16050
+ var sourceName$i = "contracts/liqEth/Yield.sol";
16051
+ var abi$i = [
16431
16052
  {
16432
16053
  inputs: [
16433
16054
  {
@@ -17844,20 +17465,20 @@ var deployedLinkReferences$i = {
17844
17465
  }
17845
17466
  };
17846
17467
  var YieldOracleArtifact = {
17847
- _format: _format$j,
17848
- contractName: contractName$j,
17849
- sourceName: sourceName$j,
17850
- abi: abi$j,
17468
+ _format: _format$i,
17469
+ contractName: contractName$i,
17470
+ sourceName: sourceName$i,
17471
+ abi: abi$i,
17851
17472
  bytecode: bytecode$i,
17852
17473
  deployedBytecode: deployedBytecode$i,
17853
17474
  linkReferences: linkReferences$i,
17854
17475
  deployedLinkReferences: deployedLinkReferences$i
17855
17476
  };
17856
17477
 
17857
- var _format$i = "hh-sol-artifact-1";
17858
- var contractName$i = "Depositor";
17859
- var sourceName$i = "contracts/outpost/Depositor.sol";
17860
- var abi$i = [
17478
+ var _format$h = "hh-sol-artifact-1";
17479
+ var contractName$h = "Depositor";
17480
+ var sourceName$h = "contracts/outpost/Depositor.sol";
17481
+ var abi$h = [
17861
17482
  {
17862
17483
  inputs: [
17863
17484
  {
@@ -19538,20 +19159,20 @@ var deployedLinkReferences$h = {
19538
19159
  }
19539
19160
  };
19540
19161
  var DepositorArtifact = {
19541
- _format: _format$i,
19542
- contractName: contractName$i,
19543
- sourceName: sourceName$i,
19544
- abi: abi$i,
19162
+ _format: _format$h,
19163
+ contractName: contractName$h,
19164
+ sourceName: sourceName$h,
19165
+ abi: abi$h,
19545
19166
  bytecode: bytecode$h,
19546
19167
  deployedBytecode: deployedBytecode$h,
19547
19168
  linkReferences: linkReferences$h,
19548
19169
  deployedLinkReferences: deployedLinkReferences$h
19549
19170
  };
19550
19171
 
19551
- var _format$h = "hh-sol-artifact-1";
19552
- var contractName$h = "ReceiptNFT";
19553
- var sourceName$h = "contracts/outpost/ReceiptNFT.sol";
19554
- var abi$h = [
19172
+ var _format$g = "hh-sol-artifact-1";
19173
+ var contractName$g = "ReceiptNFT";
19174
+ var sourceName$g = "contracts/outpost/ReceiptNFT.sol";
19175
+ var abi$g = [
19555
19176
  {
19556
19177
  inputs: [
19557
19178
  {
@@ -21588,20 +21209,20 @@ var linkReferences$g = {
21588
21209
  var deployedLinkReferences$g = {
21589
21210
  };
21590
21211
  var ReceiptNFTArtifact = {
21591
- _format: _format$h,
21592
- contractName: contractName$h,
21593
- sourceName: sourceName$h,
21594
- abi: abi$h,
21212
+ _format: _format$g,
21213
+ contractName: contractName$g,
21214
+ sourceName: sourceName$g,
21215
+ abi: abi$g,
21595
21216
  bytecode: bytecode$g,
21596
21217
  deployedBytecode: deployedBytecode$g,
21597
21218
  linkReferences: linkReferences$g,
21598
21219
  deployedLinkReferences: deployedLinkReferences$g
21599
21220
  };
21600
21221
 
21601
- var _format$g = "hh-sol-artifact-1";
21602
- var contractName$g = "OutpostManager";
21603
- var sourceName$g = "contracts/outpost/OutpostManager.sol";
21604
- var abi$g = [
21222
+ var _format$f = "hh-sol-artifact-1";
21223
+ var contractName$f = "OutpostManager";
21224
+ var sourceName$f = "contracts/outpost/OutpostManager.sol";
21225
+ var abi$f = [
21605
21226
  {
21606
21227
  inputs: [
21607
21228
  {
@@ -22363,20 +21984,20 @@ var linkReferences$f = {
22363
21984
  var deployedLinkReferences$f = {
22364
21985
  };
22365
21986
  var OutpostManagerArtifact = {
22366
- _format: _format$g,
22367
- contractName: contractName$g,
22368
- sourceName: sourceName$g,
22369
- abi: abi$g,
21987
+ _format: _format$f,
21988
+ contractName: contractName$f,
21989
+ sourceName: sourceName$f,
21990
+ abi: abi$f,
22370
21991
  bytecode: bytecode$f,
22371
21992
  deployedBytecode: deployedBytecode$f,
22372
21993
  linkReferences: linkReferences$f,
22373
21994
  deployedLinkReferences: deployedLinkReferences$f
22374
21995
  };
22375
21996
 
22376
- var _format$f = "hh-sol-artifact-1";
22377
- var contractName$f = "BAR";
22378
- var sourceName$f = "contracts/outpost/BAR.sol";
22379
- var abi$f = [
21997
+ var _format$e = "hh-sol-artifact-1";
21998
+ var contractName$e = "BAR";
21999
+ var sourceName$e = "contracts/outpost/BAR.sol";
22000
+ var abi$e = [
22380
22001
  {
22381
22002
  inputs: [
22382
22003
  {
@@ -24255,20 +23876,20 @@ var deployedLinkReferences$e = {
24255
23876
  }
24256
23877
  };
24257
23878
  var BARArtifact = {
24258
- _format: _format$f,
24259
- contractName: contractName$f,
24260
- sourceName: sourceName$f,
24261
- abi: abi$f,
23879
+ _format: _format$e,
23880
+ contractName: contractName$e,
23881
+ sourceName: sourceName$e,
23882
+ abi: abi$e,
24262
23883
  bytecode: bytecode$e,
24263
23884
  deployedBytecode: deployedBytecode$e,
24264
23885
  linkReferences: linkReferences$e,
24265
23886
  deployedLinkReferences: deployedLinkReferences$e
24266
23887
  };
24267
23888
 
24268
- var _format$e = "hh-sol-artifact-1";
24269
- var contractName$e = "OPP";
24270
- var sourceName$e = "contracts/outpost/OPP.sol";
24271
- var abi$e = [
23889
+ var _format$d = "hh-sol-artifact-1";
23890
+ var contractName$d = "OPP";
23891
+ var sourceName$d = "contracts/outpost/OPP.sol";
23892
+ var abi$d = [
24272
23893
  {
24273
23894
  inputs: [
24274
23895
  {
@@ -25244,20 +24865,20 @@ var deployedLinkReferences$d = {
25244
24865
  }
25245
24866
  };
25246
24867
  var OPPArtifact = {
25247
- _format: _format$e,
25248
- contractName: contractName$e,
25249
- sourceName: sourceName$e,
25250
- abi: abi$e,
24868
+ _format: _format$d,
24869
+ contractName: contractName$d,
24870
+ sourceName: sourceName$d,
24871
+ abi: abi$d,
25251
24872
  bytecode: bytecode$d,
25252
24873
  deployedBytecode: deployedBytecode$d,
25253
24874
  linkReferences: linkReferences$d,
25254
24875
  deployedLinkReferences: deployedLinkReferences$d
25255
24876
  };
25256
24877
 
25257
- var _format$d = "hh-sol-artifact-1";
25258
- var contractName$d = "OPPCommon";
25259
- var sourceName$d = "contracts/outpost/OPPCommon.sol";
25260
- var abi$d = [
24878
+ var _format$c = "hh-sol-artifact-1";
24879
+ var contractName$c = "OPPCommon";
24880
+ var sourceName$c = "contracts/outpost/OPPCommon.sol";
24881
+ var abi$c = [
25261
24882
  {
25262
24883
  inputs: [
25263
24884
  {
@@ -25452,20 +25073,20 @@ var deployedLinkReferences$c = {
25452
25073
  }
25453
25074
  };
25454
25075
  var OPPCommonArtifact = {
25455
- _format: _format$d,
25456
- contractName: contractName$d,
25457
- sourceName: sourceName$d,
25458
- abi: abi$d,
25076
+ _format: _format$c,
25077
+ contractName: contractName$c,
25078
+ sourceName: sourceName$c,
25079
+ abi: abi$c,
25459
25080
  bytecode: bytecode$c,
25460
25081
  deployedBytecode: deployedBytecode$c,
25461
25082
  linkReferences: linkReferences$c,
25462
25083
  deployedLinkReferences: deployedLinkReferences$c
25463
25084
  };
25464
25085
 
25465
- var _format$c = "hh-sol-artifact-1";
25466
- var contractName$c = "OPPInbound";
25467
- var sourceName$c = "contracts/outpost/OPPInbound.sol";
25468
- var abi$c = [
25086
+ var _format$b = "hh-sol-artifact-1";
25087
+ var contractName$b = "OPPInbound";
25088
+ var sourceName$b = "contracts/outpost/OPPInbound.sol";
25089
+ var abi$b = [
25469
25090
  {
25470
25091
  inputs: [
25471
25092
  {
@@ -26498,20 +26119,20 @@ var deployedLinkReferences$b = {
26498
26119
  }
26499
26120
  };
26500
26121
  var OPPInboundArtifact = {
26501
- _format: _format$c,
26502
- contractName: contractName$c,
26503
- sourceName: sourceName$c,
26504
- abi: abi$c,
26122
+ _format: _format$b,
26123
+ contractName: contractName$b,
26124
+ sourceName: sourceName$b,
26125
+ abi: abi$b,
26505
26126
  bytecode: bytecode$b,
26506
26127
  deployedBytecode: deployedBytecode$b,
26507
26128
  linkReferences: linkReferences$b,
26508
26129
  deployedLinkReferences: deployedLinkReferences$b
26509
26130
  };
26510
26131
 
26511
- var _format$b = "hh-sol-artifact-1";
26512
- var contractName$b = "Pretoken";
26513
- var sourceName$b = "contracts/outpost/Pretoken.sol";
26514
- var abi$b = [
26132
+ var _format$a = "hh-sol-artifact-1";
26133
+ var contractName$a = "Pretoken";
26134
+ var sourceName$a = "contracts/outpost/Pretoken.sol";
26135
+ var abi$a = [
26515
26136
  {
26516
26137
  inputs: [
26517
26138
  {
@@ -28192,200 +27813,16 @@ var deployedLinkReferences$a = {
28192
27813
  }
28193
27814
  };
28194
27815
  var PretokenArtifact = {
28195
- _format: _format$b,
28196
- contractName: contractName$b,
28197
- sourceName: sourceName$b,
28198
- abi: abi$b,
27816
+ _format: _format$a,
27817
+ contractName: contractName$a,
27818
+ sourceName: sourceName$a,
27819
+ abi: abi$a,
28199
27820
  bytecode: bytecode$a,
28200
27821
  deployedBytecode: deployedBytecode$a,
28201
27822
  linkReferences: linkReferences$a,
28202
27823
  deployedLinkReferences: deployedLinkReferences$a
28203
27824
  };
28204
27825
 
28205
- var _format$a = "hh-sol-artifact-1";
28206
- var contractName$a = "Aggregator";
28207
- var sourceName$a = "contracts/outpost/Aggregator.sol";
28208
- var abi$a = [
28209
- {
28210
- inputs: [
28211
- {
28212
- internalType: "address",
28213
- name: "_authority",
28214
- type: "address"
28215
- },
28216
- {
28217
- internalType: "int256",
28218
- name: "initialPrice",
28219
- type: "int256"
28220
- },
28221
- {
28222
- internalType: "uint8",
28223
- name: "__decimals",
28224
- type: "uint8"
28225
- }
28226
- ],
28227
- name: "initialize",
28228
- outputs: [
28229
- ],
28230
- stateMutability: "nonpayable",
28231
- type: "function"
28232
- },
28233
- {
28234
- inputs: [
28235
- ],
28236
- name: "decimals",
28237
- outputs: [
28238
- {
28239
- internalType: "uint8",
28240
- name: "",
28241
- type: "uint8"
28242
- }
28243
- ],
28244
- stateMutability: "view",
28245
- type: "function"
28246
- },
28247
- {
28248
- inputs: [
28249
- ],
28250
- name: "description",
28251
- outputs: [
28252
- {
28253
- internalType: "string",
28254
- name: "",
28255
- type: "string"
28256
- }
28257
- ],
28258
- stateMutability: "pure",
28259
- type: "function"
28260
- },
28261
- {
28262
- inputs: [
28263
- ],
28264
- name: "version",
28265
- outputs: [
28266
- {
28267
- internalType: "uint256",
28268
- name: "",
28269
- type: "uint256"
28270
- }
28271
- ],
28272
- stateMutability: "pure",
28273
- type: "function"
28274
- },
28275
- {
28276
- inputs: [
28277
- {
28278
- internalType: "uint80",
28279
- name: "",
28280
- type: "uint80"
28281
- }
28282
- ],
28283
- name: "getRoundData",
28284
- outputs: [
28285
- {
28286
- internalType: "uint80",
28287
- name: "roundId",
28288
- type: "uint80"
28289
- },
28290
- {
28291
- internalType: "int256",
28292
- name: "answer",
28293
- type: "int256"
28294
- },
28295
- {
28296
- internalType: "uint256",
28297
- name: "startedAt",
28298
- type: "uint256"
28299
- },
28300
- {
28301
- internalType: "uint256",
28302
- name: "updatedAt",
28303
- type: "uint256"
28304
- },
28305
- {
28306
- internalType: "uint80",
28307
- name: "answeredInRound",
28308
- type: "uint80"
28309
- }
28310
- ],
28311
- stateMutability: "view",
28312
- type: "function"
28313
- },
28314
- {
28315
- inputs: [
28316
- ],
28317
- name: "latestRoundData",
28318
- outputs: [
28319
- {
28320
- internalType: "uint80",
28321
- name: "roundId",
28322
- type: "uint80"
28323
- },
28324
- {
28325
- internalType: "int256",
28326
- name: "answer",
28327
- type: "int256"
28328
- },
28329
- {
28330
- internalType: "uint256",
28331
- name: "startedAt",
28332
- type: "uint256"
28333
- },
28334
- {
28335
- internalType: "uint256",
28336
- name: "updatedAt",
28337
- type: "uint256"
28338
- },
28339
- {
28340
- internalType: "uint80",
28341
- name: "answeredInRound",
28342
- type: "uint80"
28343
- }
28344
- ],
28345
- stateMutability: "view",
28346
- type: "function"
28347
- },
28348
- {
28349
- inputs: [
28350
- {
28351
- internalType: "int256",
28352
- name: "newPrice",
28353
- type: "int256"
28354
- }
28355
- ],
28356
- name: "updateAnswer",
28357
- outputs: [
28358
- ],
28359
- stateMutability: "nonpayable",
28360
- type: "function"
28361
- },
28362
- {
28363
- inputs: [
28364
- {
28365
- internalType: "int256",
28366
- name: "newPrice",
28367
- type: "int256"
28368
- },
28369
- {
28370
- internalType: "uint256",
28371
- name: "oldTimestamp",
28372
- type: "uint256"
28373
- }
28374
- ],
28375
- name: "updateStale",
28376
- outputs: [
28377
- ],
28378
- stateMutability: "nonpayable",
28379
- type: "function"
28380
- }
28381
- ];
28382
- var AggregatorArtifact = {
28383
- _format: _format$a,
28384
- contractName: contractName$a,
28385
- sourceName: sourceName$a,
28386
- abi: abi$a
28387
- };
28388
-
28389
27826
  var _format$9 = "hh-sol-artifact-1";
28390
27827
  var contractName$9 = "EthUsdPriceConsumer";
28391
27828
  var sourceName$9 = "contracts/outpost/EthUsdPriceConsumer.sol";
@@ -34800,31 +34237,30 @@ const ERC20Abi = ERC20Artifact.abi;
34800
34237
  const ERC721Abi = ERC721Artifact.abi;
34801
34238
  const ERC1155Abi = ERC1155Artifact.abi;
34802
34239
  const ADDRESSES = {
34803
- LiqEthAuthority: "0x3Eb66Bb91F7a022FbABc1619Cb6acce7025Bc41F",
34804
- BeaconState: "0x08F879c6D0964E0A17bF688Af23168f654DF372e",
34805
- WithdrawalQueue: "0x74aDeD940369baDDb0F36426F23B08499e45Fe18",
34806
- LiqEthToken: "0x8C974517D038e2e3b8a1da7b1A026bC8132A4b2e",
34807
- Accounting: "0x766CE996B8132b927988c5b2ECAE8108fB1a9307",
34808
- DepositManager: "0xEd391dB5DB11B5eDBE08e69A51D16e84293C09a3",
34809
- WithdrawalVault: "0xbaBc0D5997283ab9886696A0dEaB8A8093436b48",
34810
- StakingModule: "0x4998fBb6Ca5Ee3Db6c339e2962A34791Af643fEa",
34811
- YieldOracle: "0x61Fe311C57dd9a38Fb7B0c5A8ec521452dB25378",
34812
- OutpostManagerAuthority: "0x3B8705Ba1195AF632b3bd9E46F19348BC828FA3D",
34813
- iodata: "0x4aCABbC74a1cA9B0058d9ADAa0E00Af0f4f73212",
34814
- Base58: "0x1241F36ff30065deD52d51f0d6524EF971259A12",
34815
- sysio_merkle: "0x58ca9b5515266Fd6bF94D5F1268C505b2eC9679c",
34816
- ReceiptNFT: "0x03d6bD46cA9F54B8F8bbA21CfAfe717b36cB8593",
34817
- EthUsdPriceConsumer: "0xdC2DD993A13b3DD6D255B52285625694bd967c9A",
34818
- Pool: "0xd4742757AA61B1Fd3Fcd87980D7D460B12Cd9275",
34819
- OutpostManager: "0x38ec2B56cBCeCaFFe28b535517de1a102C3D74E3",
34820
- sysio_write: "0x0Ec4C1BaB772958aa3Db27459643bfbE7d92E305",
34821
- Pretoken: "0x8c97a51A71640fa411DEfab8feC3401eFfd1a2E4",
34822
- BAR: "0xbAFac13ffd3Aa9aEabaaeb6e4C2cF3dFf3479DC0",
34823
- OPPCommon: "0x12283a6d4E6cE4A0e8AdB319Fc161c7F4f91EA8F",
34824
- OPP: "0x87CE3Fe2CDca39C04aa2c14bbF1E1d9DB6358C4A",
34825
- Depositor: "0x5351B30EA4b75bD9be9Fc0048e88F675f7b3Ac2b",
34826
- OPPInbound: "0x0B1f7FB1c7f01A9cf490a1387E1E100F2bEA6C6d",
34827
- MockAggregator: "0xFCfc3ddd4CBd9Ad3b3af3A374B8bdA1b66eE6FFF"
34240
+ LiqEthAuthority: "0xB8fb7dBA2de501c94EAB723fa48679f698a39Aa4",
34241
+ BeaconState: "0x29719E8e76C52F5fD4888DF401579859c305f2DF",
34242
+ WithdrawalQueue: "0xce388339bFDAed9cAF536ea7b4F42123b4D755d4",
34243
+ LiqEthToken: "0x2C0e75e930Fc72ceD0725854C5E7A55566333F3f",
34244
+ Accounting: "0xE31C44d04c7B055afAC9301F55840f030eaF04BC",
34245
+ DepositManager: "0x21b339ED55A0f037f91B88044C808CcfCCBbF9A8",
34246
+ WithdrawalVault: "0x028743bE7E727aA331A1e952575cb00623B95fE2",
34247
+ StakingModule: "0xDe9754Fb58CcD4D74e94DA5682192E4e6eC334b0",
34248
+ YieldOracle: "0x7B7B8894e75b44B6cA7Dc8bE6dED5059621907b2",
34249
+ OutpostManagerAuthority: "0xeaE32b94c0F858b3600861aAE4Caeee6B6341751",
34250
+ iodata: "0x485Ed153c45189d623Bb37816eD3016A56552273",
34251
+ Base58: "0x8bB3856EC1114B1cE45a78620CF174D90a1Fd4e7",
34252
+ sysio_merkle: "0x5180a926D71c6d94c5c939Fe7Fed14cD7dcAa541",
34253
+ ReceiptNFT: "0x651De616A20b17De1095f9A0694A0e0E68025b78",
34254
+ EthUsdPriceConsumer: "0x2d866f8DB6F6c94997b0027Ba24bc64a03627ddc",
34255
+ Pool: "0xDA268Adcb90c422C2102A5f713182A42A8b9EA0D",
34256
+ OutpostManager: "0x9f279804Cb8539c53709AA37a4C1b30A52A85175",
34257
+ sysio_write: "0x3F8c880efd2c8C3aA1f0CE40b886cc6913eEC1d3",
34258
+ Pretoken: "0xCabF19Fdb7cD063738dd63a418702Ee3642FFc68",
34259
+ BAR: "0x2D8f4D4435509d7b8F93C3Ba93D45447C892f7ED",
34260
+ OPPCommon: "0x1716EEC9f1E0c1aF7BbbA8Fed10652138914f766",
34261
+ OPP: "0x5e1135cF8987268a3e7F68551558Ae92c454429f",
34262
+ Depositor: "0xf4b4ccfD684feB46504D77232FBde23b23d4F774",
34263
+ OPPInbound: "0x088484d45fF93AFabC63810FB0b335792E2B24f3"
34828
34264
  };
34829
34265
  const CONTRACTS = {
34830
34266
  LiqEthAuthority: {
@@ -34883,10 +34319,6 @@ const CONTRACTS = {
34883
34319
  address: ADDRESSES.ReceiptNFT,
34884
34320
  abi: ReceiptNFTArtifact.abi
34885
34321
  },
34886
- MockAggregator: {
34887
- address: ADDRESSES.MockAggregator,
34888
- abi: AggregatorArtifact.abi
34889
- },
34890
34322
  Pool: {
34891
34323
  address: ADDRESSES.Pool,
34892
34324
  abi: PoolArtifact.abi
@@ -35870,10 +35302,6 @@ class EthereumStakingClient {
35870
35302
  async buy(amount) {
35871
35303
  this.ensureUser();
35872
35304
  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
35305
  let result = await this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
35878
35306
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
35879
35307
  }
@@ -35987,7 +35415,7 @@ class EthereumStakingClient {
35987
35415
  }
35988
35416
  async getTrancheSnapshot(options) {
35989
35417
  const {
35990
- chainID = EvmChainID.Hoodi,
35418
+ chainID = EvmChainID.Ethereum,
35991
35419
  windowBefore,
35992
35420
  windowAfter
35993
35421
  } = options ?? {};
@@ -36008,10 +35436,8 @@ class EthereumStakingClient {
36008
35436
  ]);
36009
35437
  const totalTrancheSupply = BigInt(totalSupplyBn.toString()) / BigInt(1e10);
36010
35438
  const currentTrancheSupply = BigInt(trancheSupplyBn.toString()) / BigInt(1e10);
36011
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
36012
35439
  let ethPriceUsdBn = await this.contract.EthUsdPriceConsumer.getPrice18Decimals();
36013
35440
  let ethPriceUsd = BigInt(ethPriceUsdBn.toString()) / BigInt(1e10);
36014
- let nativePriceTimestamp = Number(updatedAt);
36015
35441
  const initialTrancheSupply = BigInt(INITIAL_TRANCHE_SUPPLY) * BigInt(1e8);
36016
35442
  return buildEthereumTrancheSnapshot({
36017
35443
  chainID,
@@ -36027,7 +35453,6 @@ class EthereumStakingClient {
36027
35453
  minPriceUsd,
36028
35454
  maxPriceUsd,
36029
35455
  ethPriceUsd,
36030
- nativePriceTimestamp,
36031
35456
  ladderWindowBefore: windowBefore,
36032
35457
  ladderWindowAfter: windowAfter
36033
35458
  });
@@ -36060,34 +35485,6 @@ class EthereumStakingClient {
36060
35485
  }
36061
35486
  return bufferWei;
36062
35487
  }
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
35488
  }
36092
35489
 
36093
35490
  class Staker {
@@ -36097,12 +35494,10 @@ class Staker {
36097
35494
  if (!Array.isArray(config)) config = [config];
36098
35495
  config.forEach((cfg) => {
36099
35496
  switch (cfg.network.chainId) {
36100
- case SolChainID.Devnet:
36101
- case SolChainID.WireTestnet:
35497
+ case SolChainID.Mainnet:
36102
35498
  this.clients.set(cfg.network.chainId, new SolanaStakingClient(cfg));
36103
35499
  break;
36104
35500
  case EvmChainID.Ethereum:
36105
- case EvmChainID.Hoodi:
36106
35501
  this.clients.set(cfg.network.chainId, new EthereumStakingClient(cfg));
36107
35502
  break;
36108
35503
  default:
@@ -36142,7 +35537,6 @@ const CONTRACT_NAMES = [
36142
35537
  "Base58",
36143
35538
  "sysio_merkle",
36144
35539
  "ReceiptNFT",
36145
- "MockAggregator",
36146
35540
  "Pool",
36147
35541
  "OutpostManager",
36148
35542
  "sysio_write",