@wireio/stake 0.7.3 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/stake.js CHANGED
@@ -4,8 +4,28 @@ var core = require('@wireio/core');
4
4
  var web3_js = require('@solana/web3.js');
5
5
  var anchor = require('@coral-xyz/anchor');
6
6
  var splToken = require('@solana/spl-token');
7
+ var multisig = require('@sqds/multisig');
7
8
  var ethers = require('ethers');
8
9
 
10
+ function _interopNamespaceDefault(e) {
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var multisig__namespace = /*#__PURE__*/_interopNamespaceDefault(multisig);
28
+
9
29
  var address$3 = "5nBtmutQLrRKBUxNfHJPDjiW5u8id6QM9Hhjg1D1g1XH";
10
30
  var metadata$3 = {
11
31
  name: "liqsol_core",
@@ -14,68 +34,6 @@ var metadata$3 = {
14
34
  description: "Created with Anchor"
15
35
  };
16
36
  var instructions$3 = [
17
- {
18
- name: "accumulate_unstake_request",
19
- docs: [
20
- "Accumulate unstake requests to be processed in next allocation cycle",
21
- "Multiple requests can be accumulated before calculating allocations",
22
- "Returns the target epoch when this unstake request will be processed",
23
- "We should not be able to call this without development feature enabled",
24
- ""
25
- ],
26
- discriminator: [
27
- 24,
28
- 73,
29
- 69,
30
- 139,
31
- 36,
32
- 209,
33
- 105,
34
- 252
35
- ],
36
- accounts: [
37
- {
38
- name: "admin",
39
- writable: true,
40
- signer: true
41
- },
42
- {
43
- name: "stake_allocation_state",
44
- docs: [
45
- "Stake allocation state - to accumulate pending unstake requests"
46
- ],
47
- writable: true
48
- },
49
- {
50
- name: "stake_metrics",
51
- docs: [
52
- "Stake metrics - to validate total unstake amount is available"
53
- ]
54
- },
55
- {
56
- name: "maintenance_ledger",
57
- docs: [
58
- "Maintenance ledger - to determine target processing epoch"
59
- ]
60
- },
61
- {
62
- name: "global_config",
63
- docs: [
64
- "Global config for min_unstake_request setting"
65
- ]
66
- },
67
- {
68
- name: "clock"
69
- }
70
- ],
71
- args: [
72
- {
73
- name: "amount",
74
- type: "u64"
75
- }
76
- ],
77
- returns: "u64"
78
- },
79
37
  {
80
38
  name: "add_top_performers_batch",
81
39
  docs: [
@@ -129,74 +87,6 @@ var instructions$3 = [
129
87
  args: [
130
88
  ]
131
89
  },
132
- {
133
- name: "add_validator_v2",
134
- docs: [
135
- "Add a new validator bbypassing the looking at leaderboard and getting validators form there"
136
- ],
137
- discriminator: [
138
- 217,
139
- 158,
140
- 30,
141
- 19,
142
- 123,
143
- 99,
144
- 110,
145
- 30
146
- ],
147
- accounts: [
148
- {
149
- name: "authority",
150
- writable: true,
151
- signer: true
152
- },
153
- {
154
- name: "active_list",
155
- docs: [
156
- "Active list - will add the validator here"
157
- ],
158
- writable: true
159
- },
160
- {
161
- name: "validator_info",
162
- docs: [
163
- "Create the validator info account"
164
- ],
165
- writable: true
166
- },
167
- {
168
- name: "validator_transient",
169
- docs: [
170
- "Create the validator transient account"
171
- ],
172
- writable: true
173
- },
174
- {
175
- name: "stake_allocation_state",
176
- docs: [
177
- "Stake allocation state - to update total_active_vpp when adding validator"
178
- ],
179
- writable: true
180
- },
181
- {
182
- name: "system_program"
183
- }
184
- ],
185
- args: [
186
- {
187
- name: "vote_account",
188
- type: "pubkey"
189
- },
190
- {
191
- name: "name",
192
- type: "string"
193
- },
194
- {
195
- name: "performance_score",
196
- type: "u8"
197
- }
198
- ]
199
- },
200
90
  {
201
91
  name: "aggregate_stake_metrics",
202
92
  docs: [
@@ -236,43 +126,6 @@ var instructions$3 = [
236
126
  args: [
237
127
  ]
238
128
  },
239
- {
240
- name: "blacklist_validator",
241
- docs: [
242
- "Blacklist a validator (user-facing, maintenance will handle graveyard movement)",
243
- "UnderPerforming is set automatically when score is updated",
244
- "Another serious emergency stop function"
245
- ],
246
- discriminator: [
247
- 125,
248
- 42,
249
- 36,
250
- 229,
251
- 27,
252
- 38,
253
- 226,
254
- 62
255
- ],
256
- accounts: [
257
- {
258
- name: "validator_info",
259
- writable: true
260
- },
261
- {
262
- name: "stake_allocation_state",
263
- docs: [
264
- "Stake allocation state - to update total_active_vpp when VPP changes"
265
- ],
266
- writable: true
267
- }
268
- ],
269
- args: [
270
- {
271
- name: "vote_account",
272
- type: "pubkey"
273
- }
274
- ]
275
- },
276
129
  {
277
130
  name: "bond_role",
278
131
  discriminator: [
@@ -2862,147 +2715,6 @@ var instructions$3 = [
2862
2715
  }
2863
2716
  ]
2864
2717
  },
2865
- {
2866
- name: "reset_distribution_state",
2867
- discriminator: [
2868
- 159,
2869
- 183,
2870
- 162,
2871
- 74,
2872
- 228,
2873
- 135,
2874
- 157,
2875
- 79
2876
- ],
2877
- accounts: [
2878
- {
2879
- name: "admin",
2880
- signer: true
2881
- },
2882
- {
2883
- name: "distribution_state",
2884
- writable: true
2885
- }
2886
- ],
2887
- args: [
2888
- ]
2889
- },
2890
- {
2891
- name: "reset_global_state",
2892
- discriminator: [
2893
- 252,
2894
- 41,
2895
- 117,
2896
- 110,
2897
- 248,
2898
- 165,
2899
- 48,
2900
- 88
2901
- ],
2902
- accounts: [
2903
- {
2904
- name: "admin",
2905
- signer: true
2906
- },
2907
- {
2908
- name: "global_config"
2909
- },
2910
- {
2911
- name: "global_state",
2912
- writable: true
2913
- },
2914
- {
2915
- name: "pool_authority"
2916
- },
2917
- {
2918
- name: "liqsol_mint"
2919
- },
2920
- {
2921
- name: "liqsol_pool_ata",
2922
- writable: true
2923
- },
2924
- {
2925
- name: "token_program"
2926
- },
2927
- {
2928
- name: "associated_token_program"
2929
- }
2930
- ],
2931
- args: [
2932
- ]
2933
- },
2934
- {
2935
- name: "reset_price_history",
2936
- discriminator: [
2937
- 213,
2938
- 231,
2939
- 155,
2940
- 139,
2941
- 248,
2942
- 60,
2943
- 67,
2944
- 199
2945
- ],
2946
- accounts: [
2947
- {
2948
- name: "admin",
2949
- writable: true,
2950
- signer: true
2951
- },
2952
- {
2953
- name: "global_config"
2954
- },
2955
- {
2956
- name: "tranche_state",
2957
- writable: true
2958
- },
2959
- {
2960
- name: "price_history",
2961
- writable: true
2962
- },
2963
- {
2964
- name: "system_program"
2965
- }
2966
- ],
2967
- args: [
2968
- ]
2969
- },
2970
- {
2971
- name: "reset_tranche_state",
2972
- discriminator: [
2973
- 106,
2974
- 102,
2975
- 143,
2976
- 40,
2977
- 152,
2978
- 173,
2979
- 165,
2980
- 168
2981
- ],
2982
- accounts: [
2983
- {
2984
- name: "admin",
2985
- writable: true,
2986
- signer: true
2987
- },
2988
- {
2989
- name: "global_config"
2990
- },
2991
- {
2992
- name: "tranche_state",
2993
- writable: true
2994
- },
2995
- {
2996
- name: "price_history",
2997
- writable: true
2998
- },
2999
- {
3000
- name: "system_program"
3001
- }
3002
- ],
3003
- args: [
3004
- ]
3005
- },
3006
2718
  {
3007
2719
  name: "set_admin",
3008
2720
  discriminator: [
@@ -3025,8 +2737,7 @@ var instructions$3 = [
3025
2737
  signer: true
3026
2738
  },
3027
2739
  {
3028
- name: "new_authority",
3029
- signer: true
2740
+ name: "new_authority"
3030
2741
  }
3031
2742
  ],
3032
2743
  args: [
@@ -3054,52 +2765,12 @@ var instructions$3 = [
3054
2765
  signer: true
3055
2766
  },
3056
2767
  {
3057
- name: "new_authority",
3058
- signer: true
2768
+ name: "new_authority"
3059
2769
  }
3060
2770
  ],
3061
2771
  args: [
3062
2772
  ]
3063
2773
  },
3064
- {
3065
- name: "set_last_state_change_epoch",
3066
- docs: [
3067
- "Admin function to directly set last_state_change_epoch (useful for testing cooldowns)"
3068
- ],
3069
- discriminator: [
3070
- 94,
3071
- 57,
3072
- 139,
3073
- 195,
3074
- 123,
3075
- 224,
3076
- 227,
3077
- 106
3078
- ],
3079
- accounts: [
3080
- {
3081
- name: "validator_info",
3082
- writable: true
3083
- },
3084
- {
3085
- name: "stake_allocation_state",
3086
- docs: [
3087
- "Stake allocation state - to update total_active_vpp when VPP changes"
3088
- ],
3089
- writable: true
3090
- }
3091
- ],
3092
- args: [
3093
- {
3094
- name: "vote_account",
3095
- type: "pubkey"
3096
- },
3097
- {
3098
- name: "epoch",
3099
- type: "u16"
3100
- }
3101
- ]
3102
- },
3103
2774
  {
3104
2775
  name: "set_paused",
3105
2776
  discriminator: [
@@ -3589,35 +3260,6 @@ var instructions$3 = [
3589
3260
  }
3590
3261
  ]
3591
3262
  },
3592
- {
3593
- name: "test_clear_active_list",
3594
- discriminator: [
3595
- 17,
3596
- 195,
3597
- 59,
3598
- 174,
3599
- 184,
3600
- 137,
3601
- 149,
3602
- 144
3603
- ],
3604
- accounts: [
3605
- {
3606
- name: "active_list",
3607
- writable: true
3608
- },
3609
- {
3610
- name: "processing_state",
3611
- writable: true
3612
- },
3613
- {
3614
- name: "authority",
3615
- signer: true
3616
- }
3617
- ],
3618
- args: [
3619
- ]
3620
- },
3621
3263
  {
3622
3264
  name: "update_config_bool",
3623
3265
  discriminator: [
@@ -4295,8 +3937,118 @@ var events = [
4295
3937
  var errors$3 = [
4296
3938
  {
4297
3939
  code: 6000,
4298
- name: "AccountBorrowFailed",
4299
- msg: "Util Acc borrow Failed"
3940
+ name: "DestinationAccountDoesNotExist",
3941
+ msg: "Destination stake account does not exist"
3942
+ },
3943
+ {
3944
+ code: 6001,
3945
+ name: "SourceAccountDoesNotExist",
3946
+ msg: "Source stake account does not exist"
3947
+ },
3948
+ {
3949
+ code: 6002,
3950
+ name: "InvalidDestinationOwner",
3951
+ msg: "Destination account not owned by stake program"
3952
+ },
3953
+ {
3954
+ code: 6003,
3955
+ name: "InvalidSourceOwner",
3956
+ msg: "Source account not owned by stake program"
3957
+ },
3958
+ {
3959
+ code: 6004,
3960
+ name: "ClockBorrowFailed",
3961
+ msg: "Failed to borrow clock data"
3962
+ },
3963
+ {
3964
+ code: 6005,
3965
+ name: "ClockDeserializeFailed",
3966
+ msg: "Failed to deserialize clock"
3967
+ },
3968
+ {
3969
+ code: 6006,
3970
+ name: "DestinationAnalysisFailed",
3971
+ msg: "Failed to analyze destination stake account"
3972
+ },
3973
+ {
3974
+ code: 6007,
3975
+ name: "SourceAnalysisFailed",
3976
+ msg: "Failed to analyze source stake account"
3977
+ },
3978
+ {
3979
+ code: 6008,
3980
+ name: "DestinationStillActivating",
3981
+ msg: "Destination stake is still activating"
3982
+ },
3983
+ {
3984
+ code: 6009,
3985
+ name: "DestinationDeactivating",
3986
+ msg: "Destination stake is deactivating"
3987
+ },
3988
+ {
3989
+ code: 6010,
3990
+ name: "SourceStillActivating",
3991
+ msg: "Source stake is still activating"
3992
+ },
3993
+ {
3994
+ code: 6011,
3995
+ name: "SourceDeactivating",
3996
+ msg: "Source stake is deactivating"
3997
+ },
3998
+ {
3999
+ code: 6012,
4000
+ name: "DestinationBorrowFailed",
4001
+ msg: "Failed to borrow destination account data"
4002
+ },
4003
+ {
4004
+ code: 6013,
4005
+ name: "DestinationParseFailed",
4006
+ msg: "Failed to parse destination stake state"
4007
+ },
4008
+ {
4009
+ code: 6014,
4010
+ name: "SourceBorrowFailed",
4011
+ msg: "Failed to borrow source account data"
4012
+ },
4013
+ {
4014
+ code: 6015,
4015
+ name: "SourceParseFailed",
4016
+ msg: "Failed to parse source stake state"
4017
+ },
4018
+ {
4019
+ code: 6016,
4020
+ name: "DifferentValidators",
4021
+ msg: "Stakes are delegated to different validators"
4022
+ },
4023
+ {
4024
+ code: 6017,
4025
+ name: "DifferentStakers",
4026
+ msg: "Stakes have different staker authorities"
4027
+ },
4028
+ {
4029
+ code: 6018,
4030
+ name: "DifferentWithdrawers",
4031
+ msg: "Stakes have different withdrawer authorities"
4032
+ },
4033
+ {
4034
+ code: 6019,
4035
+ name: "AuthoritiesNotFound",
4036
+ msg: "Could not extract authorities from accounts"
4037
+ },
4038
+ {
4039
+ code: 6020,
4040
+ name: "MergeInstructionFailed",
4041
+ msg: "Merge instruction failed"
4042
+ },
4043
+ {
4044
+ code: 6021,
4045
+ name: "EpochRewardsActive",
4046
+ msg: "Epoch rewards distribution is active - stake operations blocked"
4047
+ },
4048
+ {
4049
+ code: 6022,
4050
+ name: "DifferentCreditsObserved",
4051
+ msg: "Stakes have different credits_observed - cannot merge until both earn same rewards"
4300
4052
  }
4301
4053
  ];
4302
4054
  var types$5 = [
@@ -6749,153 +6501,6 @@ var instructions$1 = [
6749
6501
  args: [
6750
6502
  ]
6751
6503
  },
6752
- {
6753
- name: "test_clear_leaderboard",
6754
- discriminator: [
6755
- 118,
6756
- 207,
6757
- 26,
6758
- 205,
6759
- 180,
6760
- 7,
6761
- 75,
6762
- 244
6763
- ],
6764
- accounts: [
6765
- {
6766
- name: "leaderboard_state",
6767
- writable: true
6768
- },
6769
- {
6770
- name: "authority",
6771
- signer: true
6772
- }
6773
- ],
6774
- args: [
6775
- ]
6776
- },
6777
- {
6778
- name: "test_force_register_validator",
6779
- discriminator: [
6780
- 136,
6781
- 156,
6782
- 132,
6783
- 32,
6784
- 96,
6785
- 240,
6786
- 7,
6787
- 115
6788
- ],
6789
- accounts: [
6790
- {
6791
- name: "registrant",
6792
- writable: true,
6793
- signer: true
6794
- },
6795
- {
6796
- name: "vote_account"
6797
- },
6798
- {
6799
- name: "validator_record",
6800
- writable: true
6801
- },
6802
- {
6803
- name: "leaderboard_state",
6804
- writable: true
6805
- },
6806
- {
6807
- name: "system_program"
6808
- },
6809
- {
6810
- name: "clock"
6811
- }
6812
- ],
6813
- args: [
6814
- {
6815
- name: "vpp",
6816
- type: "u8"
6817
- }
6818
- ]
6819
- },
6820
- {
6821
- name: "test_force_update_vpp",
6822
- discriminator: [
6823
- 67,
6824
- 51,
6825
- 28,
6826
- 174,
6827
- 200,
6828
- 214,
6829
- 203,
6830
- 162
6831
- ],
6832
- accounts: [
6833
- {
6834
- name: "registrant",
6835
- writable: true,
6836
- signer: true
6837
- },
6838
- {
6839
- name: "vote_account"
6840
- },
6841
- {
6842
- name: "validator_record",
6843
- writable: true
6844
- },
6845
- {
6846
- name: "leaderboard_state",
6847
- writable: true
6848
- }
6849
- ],
6850
- args: [
6851
- {
6852
- name: "vpp",
6853
- type: "u8"
6854
- }
6855
- ]
6856
- },
6857
- {
6858
- name: "test_seed_random_validators",
6859
- discriminator: [
6860
- 48,
6861
- 155,
6862
- 181,
6863
- 112,
6864
- 163,
6865
- 242,
6866
- 43,
6867
- 146
6868
- ],
6869
- accounts: [
6870
- {
6871
- name: "registrant",
6872
- writable: true,
6873
- signer: true
6874
- },
6875
- {
6876
- name: "leaderboard_state",
6877
- writable: true
6878
- }
6879
- ],
6880
- args: [
6881
- {
6882
- name: "count",
6883
- type: "u16"
6884
- },
6885
- {
6886
- name: "seed",
6887
- type: "u64"
6888
- },
6889
- {
6890
- name: "min_vpp",
6891
- type: "u8"
6892
- },
6893
- {
6894
- name: "max_vpp",
6895
- type: "u8"
6896
- }
6897
- ]
6898
- },
6899
6504
  {
6900
6505
  name: "update_commission",
6901
6506
  discriminator: [
@@ -7829,7 +7434,7 @@ const deriveEphemeralStakeAddress = (user, seed) => __async$f(null, null, functi
7829
7434
  return web3_js.PublicKey.createWithSeed(user, seedStr, web3_js.StakeProgram.programId);
7830
7435
  });
7831
7436
  const CHAINLINK_FEED = new web3_js.PublicKey(
7832
- "99B2bTijsU6f1GCT73HmdR7HCFFjGMBcPZY6jZ96ynrR"
7437
+ "CH31Xns5z3M1cTAbKW34jcxPPciazARpijcHj9rxtemt"
7833
7438
  );
7834
7439
  const CHAINLINK_PROGRAM = new web3_js.PublicKey(
7835
7440
  "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny"
@@ -7917,6 +7522,9 @@ class DepositClient {
7917
7522
  const svc = new SolanaProgramService(provider);
7918
7523
  this.program = svc.getProgram("liqsolCore");
7919
7524
  }
7525
+ get connection() {
7526
+ return this.provider.connection;
7527
+ }
7920
7528
  get wallet() {
7921
7529
  return this.provider.wallet;
7922
7530
  }
@@ -7945,7 +7553,7 @@ class DepositClient {
7945
7553
  const userAta = splToken.getAssociatedTokenAddressSync(
7946
7554
  liqsolMint,
7947
7555
  user,
7948
- false,
7556
+ true,
7949
7557
  splToken.TOKEN_2022_PROGRAM_ID
7950
7558
  );
7951
7559
  const distributionState = deriveDistributionStatePda();
@@ -7958,7 +7566,7 @@ class DepositClient {
7958
7566
  );
7959
7567
  const seed = Math.floor(Math.random() * __pow(2, 32));
7960
7568
  const ephemeralStake = yield deriveEphemeralStakeAddress(user, seed);
7961
- const ix = yield this.program.methods.deposit(new anchor.BN(amount.toString()), seed).accounts({
7569
+ return yield this.program.methods.deposit(new anchor.BN(amount.toString()), seed).accounts({
7962
7570
  user,
7963
7571
  depositAuthority,
7964
7572
  systemProgram: web3_js.SystemProgram.programId,
@@ -7985,7 +7593,64 @@ class DepositClient {
7985
7593
  rent: web3_js.SYSVAR_RENT_PUBKEY,
7986
7594
  globalConfig
7987
7595
  }).instruction();
7988
- return new web3_js.Transaction().add(ix);
7596
+ });
7597
+ }
7598
+ buildSquadsDepositProposalTx(params) {
7599
+ return __async$e(this, null, function* () {
7600
+ var _a, _b, _c, _d;
7601
+ const { connection, multisigPda, amountLamports, wallet } = params;
7602
+ const vaultIndex = (_a = params.vaultIndex) != null ? _a : 0;
7603
+ if (!(wallet == null ? void 0 : wallet.publicKey)) throw new Error("wallet.publicKey missing");
7604
+ if (!amountLamports || amountLamports <= BigInt(0)) throw new Error("amountLamports must be > 0");
7605
+ const [vaultPda] = multisig__namespace.getVaultPda({ multisigPda, index: vaultIndex });
7606
+ const depositBuilt = yield this.buildDepositIxForUser(amountLamports, vaultPda);
7607
+ const ms = yield multisig__namespace.accounts.Multisig.fromAccountAddress(connection, multisigPda);
7608
+ const current = BigInt((_d = (_c = (_b = ms.transactionIndex) == null ? void 0 : _b.toString) == null ? void 0 : _c.call(_b)) != null ? _d : 0);
7609
+ const transactionIndex = current + BigInt(1);
7610
+ const { blockhash } = yield connection.getLatestBlockhash("confirmed");
7611
+ const message = new web3_js.TransactionMessage({
7612
+ payerKey: vaultPda,
7613
+ recentBlockhash: blockhash,
7614
+ instructions: [depositBuilt.ix]
7615
+ });
7616
+ const createVaultTxIx = yield multisig__namespace.instructions.vaultTransactionCreate({
7617
+ multisigPda,
7618
+ transactionIndex,
7619
+ creator: wallet.publicKey,
7620
+ vaultIndex,
7621
+ ephemeralSigners: 0,
7622
+ transactionMessage: message
7623
+ });
7624
+ console.log("createVaultTxIx", createVaultTxIx);
7625
+ const tx = new web3_js.Transaction().add(createVaultTxIx);
7626
+ return { tx, transactionIndex, vaultPda };
7627
+ });
7628
+ }
7629
+ buildSquadsDepositProposalTx2(params) {
7630
+ return __async$e(this, null, function* () {
7631
+ var _a, _b, _c, _d;
7632
+ const { connection, multisigPda, amountLamports, wallet } = params;
7633
+ const vaultIndex = (_a = params.vaultIndex) != null ? _a : 0;
7634
+ if (!(wallet == null ? void 0 : wallet.publicKey)) throw new Error("wallet.publicKey missing");
7635
+ if (!amountLamports || amountLamports <= BigInt(0)) throw new Error("amountLamports must be > 0");
7636
+ const [vaultPda] = multisig__namespace.getVaultPda({ multisigPda, index: vaultIndex });
7637
+ const depositBuilt = yield this.buildDepositIxForUser(amountLamports, vaultPda);
7638
+ const ms = yield multisig__namespace.accounts.Multisig.fromAccountAddress(connection, multisigPda);
7639
+ const current = BigInt((_d = (_c = (_b = ms.transactionIndex) == null ? void 0 : _b.toString) == null ? void 0 : _c.call(_b)) != null ? _d : 0);
7640
+ const transactionIndex = current + BigInt(1);
7641
+ const { blockhash } = yield connection.getLatestBlockhash("confirmed");
7642
+ new web3_js.TransactionMessage({
7643
+ payerKey: vaultPda,
7644
+ recentBlockhash: blockhash,
7645
+ instructions: [depositBuilt.ix]
7646
+ });
7647
+ const createProposalIx = yield multisig__namespace.instructions.proposalCreate({
7648
+ multisigPda,
7649
+ transactionIndex,
7650
+ creator: wallet.publicKey
7651
+ });
7652
+ const tx = new web3_js.Transaction().add(createProposalIx);
7653
+ return { tx, transactionIndex, vaultPda };
7989
7654
  });
7990
7655
  }
7991
7656
  buildWithdrawTx(_0) {
@@ -8004,7 +7669,7 @@ class DepositClient {
8004
7669
  const userAta = splToken.getAssociatedTokenAddressSync(
8005
7670
  liqsolMint,
8006
7671
  user,
8007
- false,
7672
+ true,
8008
7673
  splToken.TOKEN_2022_PROGRAM_ID
8009
7674
  );
8010
7675
  const userRecord = deriveUserRecordPda(userAta);
@@ -8037,7 +7702,7 @@ class DepositClient {
8037
7702
  const nftAta = splToken.getAssociatedTokenAddressSync(
8038
7703
  nftMint,
8039
7704
  owner,
8040
- false,
7705
+ true,
8041
7706
  splToken.TOKEN_2022_PROGRAM_ID
8042
7707
  );
8043
7708
  const bucketAuthority = deriveBucketAuthorityPda();
@@ -8076,6 +7741,70 @@ class DepositClient {
8076
7741
  return new web3_js.Transaction().add(ix);
8077
7742
  });
8078
7743
  }
7744
+ buildDepositIxForUser(amount, user) {
7745
+ return __async$e(this, null, function* () {
7746
+ if (!user) {
7747
+ throw new Error("buildDepositIxForUser: user is required");
7748
+ }
7749
+ if (!amount || amount <= BigInt(0)) {
7750
+ throw new Error("buildDepositIxForUser: amount must be > 0");
7751
+ }
7752
+ const depositAuthority = deriveDepositAuthorityPda();
7753
+ const liqsolMint = deriveLiqsolMintPda();
7754
+ const liqsolMintAuthority = deriveLiqsolMintAuthorityPda();
7755
+ const reservePool = deriveReservePoolPda();
7756
+ const vault = deriveVaultPda();
7757
+ const controllerState = deriveStakeControllerStatePda();
7758
+ const payoutState = derivePayoutStatePda();
7759
+ const bucketAuthority = deriveBucketAuthorityPda();
7760
+ const payRateHistory = derivePayRateHistoryPda();
7761
+ const globalConfig = deriveGlobalConfigPda();
7762
+ const userAta = splToken.getAssociatedTokenAddressSync(
7763
+ liqsolMint,
7764
+ user,
7765
+ true,
7766
+ splToken.TOKEN_2022_PROGRAM_ID
7767
+ );
7768
+ const distributionState = deriveDistributionStatePda();
7769
+ const userRecord = deriveUserRecordPda(userAta);
7770
+ const bucketTokenAccount = splToken.getAssociatedTokenAddressSync(
7771
+ liqsolMint,
7772
+ bucketAuthority,
7773
+ true,
7774
+ splToken.TOKEN_2022_PROGRAM_ID
7775
+ );
7776
+ const seed = Math.floor(Math.random() * __pow(2, 32));
7777
+ const ephemeralStake = yield deriveEphemeralStakeAddress(user, seed);
7778
+ const ix = yield this.program.methods.deposit(new anchor.BN(amount.toString()), seed).accounts({
7779
+ user,
7780
+ depositAuthority,
7781
+ systemProgram: web3_js.SystemProgram.programId,
7782
+ tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
7783
+ associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
7784
+ liqsolProgram: PROGRAM_IDS.LIQSOL_TOKEN,
7785
+ stakeProgram: web3_js.StakeProgram.programId,
7786
+ liqsolMint,
7787
+ userAta,
7788
+ liqsolMintAuthority,
7789
+ reservePool,
7790
+ vault,
7791
+ ephemeralStake,
7792
+ controllerState,
7793
+ payoutState,
7794
+ bucketAuthority,
7795
+ bucketTokenAccount,
7796
+ userRecord,
7797
+ distributionState,
7798
+ payRateHistory,
7799
+ instructionsSysvar: web3_js.SYSVAR_INSTRUCTIONS_PUBKEY,
7800
+ clock: web3_js.SYSVAR_CLOCK_PUBKEY,
7801
+ stakeHistory: web3_js.SYSVAR_STAKE_HISTORY_PUBKEY,
7802
+ rent: web3_js.SYSVAR_RENT_PUBKEY,
7803
+ globalConfig
7804
+ }).instruction();
7805
+ return { ix, seed, userAta, ephemeralStake };
7806
+ });
7807
+ }
8079
7808
  }
8080
7809
 
8081
7810
  var __async$d = (__this, __arguments, generator) => {
@@ -8649,7 +8378,7 @@ class DistributionClient {
8649
8378
  const ata = splToken.getAssociatedTokenAddressSync(
8650
8379
  liqsolMint,
8651
8380
  ownerOrAta,
8652
- false,
8381
+ true,
8653
8382
  splToken.TOKEN_2022_PROGRAM_ID
8654
8383
  );
8655
8384
  const pdaFromWallet = deriveUserRecordPda(ata);
@@ -8992,7 +8721,7 @@ class OutpostClient {
8992
8721
  };
8993
8722
  }
8994
8723
  static tokensToShares(amount, currentIndex) {
8995
- const numerator = amount.mul(INDEX_SCALE$1);
8724
+ const numerator = amount.mul(new anchor.BN(INDEX_SCALE$1));
8996
8725
  const shares = numerator.div(currentIndex);
8997
8726
  const remainder = numerator.mod(currentIndex);
8998
8727
  return remainder.eqn(0) ? shares : shares.addn(1);
@@ -9256,19 +8985,120 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9256
8985
  get network() {
9257
8986
  return this.config.network;
9258
8987
  }
8988
+ get feePayer() {
8989
+ if (this.signer) return this.signer;
8990
+ if (this.anchor.wallet.publicKey) return this.anchor.wallet.publicKey;
8991
+ throw new Error("No signing authority available");
8992
+ }
8993
+ get squadsX() {
8994
+ var _a;
8995
+ const config = (_a = this.config.extras) == null ? void 0 : _a.squadsX;
8996
+ return config != null ? config : null;
8997
+ }
8998
+ createVaultLiqsolAtaOneShot(params) {
8999
+ return __async$8(this, null, function* () {
9000
+ const { connection, payer, vaultPda } = params;
9001
+ const liqsolMint = deriveLiqsolMintPda();
9002
+ const vaultAta = splToken.getAssociatedTokenAddressSync(
9003
+ liqsolMint,
9004
+ vaultPda,
9005
+ true,
9006
+ splToken.TOKEN_2022_PROGRAM_ID,
9007
+ splToken.ASSOCIATED_TOKEN_PROGRAM_ID
9008
+ );
9009
+ const info = yield connection.getAccountInfo(vaultAta, "confirmed");
9010
+ console.log("info?", info);
9011
+ if (info) return null;
9012
+ const ix = splToken.createAssociatedTokenAccountInstruction(
9013
+ payer,
9014
+ vaultAta,
9015
+ vaultPda,
9016
+ liqsolMint,
9017
+ splToken.TOKEN_2022_PROGRAM_ID,
9018
+ splToken.ASSOCIATED_TOKEN_PROGRAM_ID
9019
+ );
9020
+ const tx = new web3_js.Transaction().add(ix);
9021
+ return { tx, vaultAta };
9022
+ });
9023
+ }
9024
+ prepSquadsIxs(ix) {
9025
+ return __async$8(this, null, function* () {
9026
+ var _a, _b, _c, _d;
9027
+ if (!this.squadsX) throw new Error("Attempting to wrap Squads instruction without SquadsX config");
9028
+ const multisigPda = this.squadsMultisigPDA;
9029
+ const vaultPda = this.squadsVaultPDA;
9030
+ const vaultIndex = (_b = (_a = this.squadsX) == null ? void 0 : _a.vaultIndex) != null ? _b : 0;
9031
+ const creator = this.solPubKey;
9032
+ const ms = yield multisig__namespace.accounts.Multisig.fromAccountAddress(this.connection, multisigPda);
9033
+ const current = BigInt((_d = (_c = ms.transactionIndex) == null ? void 0 : _c.toString()) != null ? _d : 0);
9034
+ const transactionIndex = current + BigInt(1);
9035
+ const { blockhash } = yield this.connection.getLatestBlockhash("confirmed");
9036
+ const transactionMessage = new web3_js.TransactionMessage({
9037
+ payerKey: vaultPda,
9038
+ recentBlockhash: blockhash,
9039
+ instructions: [ix]
9040
+ });
9041
+ const createVaultTxIx = yield multisig__namespace.instructions.vaultTransactionCreate({
9042
+ multisigPda,
9043
+ transactionIndex,
9044
+ creator,
9045
+ vaultIndex,
9046
+ transactionMessage,
9047
+ ephemeralSigners: 0
9048
+ });
9049
+ const createProposalIx = yield multisig__namespace.instructions.proposalCreate({
9050
+ multisigPda,
9051
+ transactionIndex,
9052
+ creator
9053
+ });
9054
+ return [createVaultTxIx, createProposalIx];
9055
+ });
9056
+ }
9259
9057
  deposit(amountLamports) {
9260
9058
  return __async$8(this, null, function* () {
9261
9059
  this.ensureUser();
9262
9060
  if (amountLamports <= BigInt(0)) {
9263
9061
  throw new Error("Deposit amount must be greater than zero.");
9264
9062
  }
9265
- const tx = yield this.depositClient.buildDepositTx(amountLamports);
9266
- const { tx: prepared, blockhash, lastValidBlockHeight } = yield this.prepareTx(tx);
9267
- const signed = yield this.signTransaction(prepared);
9268
- return yield this.sendAndConfirmHttp(signed, {
9269
- blockhash,
9270
- lastValidBlockHeight
9271
- });
9063
+ try {
9064
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9065
+ if (!!this.squadsX) {
9066
+ const createVaultTx = yield this.createVaultLiqsolAtaOneShot({
9067
+ connection: this.connection,
9068
+ payer: this.solPubKey,
9069
+ vaultPda: this.squadsVaultPDA
9070
+ });
9071
+ if (createVaultTx !== null) {
9072
+ console.log("need to create vault ata first...");
9073
+ const tx0 = new web3_js.Transaction().add(createVaultTx.tx);
9074
+ const prepared0 = yield this.prepareTx(tx0);
9075
+ const signed0 = yield this.signTransaction(prepared0.tx);
9076
+ const sent0 = yield this.sendAndConfirmHttp(signed0, prepared0);
9077
+ console.log("create Vault ATA", sent0);
9078
+ }
9079
+ const ix = yield this.depositClient.buildDepositTx(amountLamports, this.squadsVaultPDA);
9080
+ const squadIxs = yield this.prepSquadsIxs(ix);
9081
+ const tx1 = new web3_js.Transaction().add(cuIx, squadIxs[0]);
9082
+ const prepared1 = yield this.prepareTx(tx1);
9083
+ const signed1 = yield this.signTransaction(prepared1.tx);
9084
+ const sent1 = yield this.sendAndConfirmHttp(signed1, prepared1);
9085
+ console.log("SENT 1", sent1);
9086
+ const tx2 = new web3_js.Transaction().add(cuIx, squadIxs[1]);
9087
+ const prepared2 = yield this.prepareTx(tx2);
9088
+ const signed2 = yield this.signTransaction(prepared2.tx);
9089
+ const sent2 = yield this.sendAndConfirmHttp(signed2, prepared2);
9090
+ console.log("SENT 2", sent2);
9091
+ return sent2;
9092
+ } else {
9093
+ const ix = yield this.depositClient.buildDepositTx(amountLamports);
9094
+ const tx = new web3_js.Transaction().add(ix);
9095
+ const prepared = yield this.prepareTx(tx);
9096
+ const signed = yield this.signTransaction(prepared.tx);
9097
+ return this.sendAndConfirmHttp(signed, prepared);
9098
+ }
9099
+ } catch (err) {
9100
+ throw new Error(`Failed to deposit Solana: ${err}`);
9101
+ }
9272
9102
  });
9273
9103
  }
9274
9104
  withdraw(amountLamports) {
@@ -9277,13 +9107,16 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9277
9107
  if (amountLamports <= BigInt(0)) {
9278
9108
  throw new Error("Withdraw amount must be greater than zero.");
9279
9109
  }
9280
- const tx = yield this.depositClient.buildWithdrawTx(amountLamports);
9281
- const { tx: prepared, blockhash, lastValidBlockHeight } = yield this.prepareTx(tx);
9282
- const signed = yield this.signTransaction(prepared);
9283
- return yield this.sendAndConfirmHttp(signed, {
9284
- blockhash,
9285
- lastValidBlockHeight
9286
- });
9110
+ try {
9111
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9112
+ const ix = yield this.depositClient.buildWithdrawTx(amountLamports);
9113
+ const tx = new web3_js.Transaction().add(cuIx, ix);
9114
+ const prepared = yield this.prepareTx(tx);
9115
+ const signed = yield this.signTransaction(prepared.tx);
9116
+ return this.sendAndConfirmHttp(signed, prepared);
9117
+ } catch (err) {
9118
+ throw new Error(`Failed to withdraw Solana: ${err}`);
9119
+ }
9287
9120
  });
9288
9121
  }
9289
9122
  stake(amountLamports) {
@@ -9292,13 +9125,17 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9292
9125
  if (!amountLamports || amountLamports <= BigInt(0)) {
9293
9126
  throw new Error("Stake amount must be greater than zero.");
9294
9127
  }
9295
- const user = this.solPubKey;
9296
- const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9297
- const ix = yield this.outpostClient.buildStakeIx(amountLamports, user);
9298
- const tx = new web3_js.Transaction().add(cuIx, ix);
9299
- const prepared = yield this.prepareTx(tx);
9300
- const signed = yield this.signTransaction(prepared.tx);
9301
- return this.sendAndConfirmHttp(signed, prepared);
9128
+ try {
9129
+ const user = this.solPubKey;
9130
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9131
+ const ix = yield this.outpostClient.buildStakeIx(amountLamports, user);
9132
+ const tx = new web3_js.Transaction().add(cuIx, ix);
9133
+ const prepared = yield this.prepareTx(tx);
9134
+ const signed = yield this.signTransaction(prepared.tx);
9135
+ return this.sendAndConfirmHttp(signed, prepared);
9136
+ } catch (err) {
9137
+ throw new Error(`Failed to stake Solana: ${err}`);
9138
+ }
9302
9139
  });
9303
9140
  }
9304
9141
  unstake(amountLamports) {
@@ -9307,13 +9144,17 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9307
9144
  if (!amountLamports || amountLamports <= BigInt(0)) {
9308
9145
  throw new Error("Unstake amount must be greater than zero.");
9309
9146
  }
9310
- const user = this.solPubKey;
9311
- const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9312
- const ix = yield this.outpostClient.buildUnstakeIx(amountLamports, user);
9313
- const tx = new web3_js.Transaction().add(cuIx, ix);
9314
- const prepared = yield this.prepareTx(tx);
9315
- const signed = yield this.signTransaction(prepared.tx);
9316
- return this.sendAndConfirmHttp(signed, prepared);
9147
+ try {
9148
+ const user = this.solPubKey;
9149
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9150
+ const ix = yield this.outpostClient.buildUnstakeIx(amountLamports, user);
9151
+ const tx = new web3_js.Transaction().add(cuIx, ix);
9152
+ const prepared = yield this.prepareTx(tx);
9153
+ const signed = yield this.signTransaction(prepared.tx);
9154
+ return this.sendAndConfirmHttp(signed, prepared);
9155
+ } catch (err) {
9156
+ throw new Error(`Failed to unstake Solana: ${err}`);
9157
+ }
9317
9158
  });
9318
9159
  }
9319
9160
  buy(amountLamports) {
@@ -9322,102 +9163,108 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9322
9163
  if (!amountLamports || amountLamports <= BigInt(0)) {
9323
9164
  throw new Error("liqSOL pretoken purchase requires a positive amount.");
9324
9165
  }
9325
- const user = this.solPubKey;
9326
- const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9327
- const ix = yield this.tokenClient.buildPurchaseIx(amountLamports, user);
9328
- const tx = new web3_js.Transaction().add(cuIx, ix);
9329
- const { tx: prepared, blockhash, lastValidBlockHeight } = yield this.prepareTx(tx);
9330
- const signed = yield this.signTransaction(prepared);
9331
- return yield this.sendAndConfirmHttp(signed, {
9332
- blockhash,
9333
- lastValidBlockHeight
9334
- });
9166
+ try {
9167
+ const user = this.solPubKey;
9168
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
9169
+ const ix = yield this.tokenClient.buildPurchaseIx(amountLamports, user);
9170
+ const tx = new web3_js.Transaction().add(cuIx, ix);
9171
+ const prepared = yield this.prepareTx(tx);
9172
+ const signed = yield this.signTransaction(prepared.tx);
9173
+ return this.sendAndConfirmHttp(signed, prepared);
9174
+ } catch (err) {
9175
+ throw new Error(`Failed to buy liqSOL pretokens: ${err}`);
9176
+ }
9335
9177
  });
9336
9178
  }
9337
9179
  getPortfolio() {
9338
9180
  return __async$8(this, null, function* () {
9339
9181
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
9340
9182
  if (!this.pubKey) throw new Error("User pubKey is undefined");
9341
- const user = this.solPubKey;
9342
- const reservePoolPDA = deriveReservePoolPda();
9343
- const vaultPDA = deriveVaultPda();
9344
- const liqsolMint = deriveLiqsolMintPda();
9345
- const userLiqsolAta = splToken.getAssociatedTokenAddressSync(
9346
- liqsolMint,
9347
- user,
9348
- false,
9349
- splToken.TOKEN_2022_PROGRAM_ID,
9350
- splToken.ASSOCIATED_TOKEN_PROGRAM_ID
9351
- );
9352
- const [nativeLamports, actualBalResp, snapshot] = yield Promise.all([
9353
- this.connection.getBalance(user, "confirmed"),
9354
- this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
9355
- this.outpostClient.fetchWireState(user).catch(() => null)
9356
- ]);
9357
- const LIQSOL_DECIMALS = 9;
9358
- const actualAmountStr = (_b = (_a = actualBalResp == null ? void 0 : actualBalResp.value) == null ? void 0 : _a.amount) != null ? _b : "0";
9359
- const globalState = (_c = snapshot == null ? void 0 : snapshot.globalState) != null ? _c : null;
9360
- const outpostAccount = (_d = snapshot == null ? void 0 : snapshot.outpostAccount) != null ? _d : null;
9361
- const trancheState = (_e = snapshot == null ? void 0 : snapshot.trancheState) != null ? _e : null;
9362
- const userPretokenRecord = (_f = snapshot == null ? void 0 : snapshot.userPretokenRecord) != null ? _f : null;
9363
- const stakedLiqsolStr = (_i = (_h = (_g = outpostAccount == null ? void 0 : outpostAccount.stakedLiqsol) == null ? void 0 : _g.toString) == null ? void 0 : _h.call(_g)) != null ? _i : "0";
9364
- const wirePretokensStr = (_l = (_k = (_j = userPretokenRecord == null ? void 0 : userPretokenRecord.totalPretokensPurchased) == null ? void 0 : _j.toString) == null ? void 0 : _k.call(_j)) != null ? _l : "0";
9365
- const currentIndexStr = (_o = (_n = (_m = globalState == null ? void 0 : globalState.currentIndex) == null ? void 0 : _m.toString) == null ? void 0 : _n.call(_m)) != null ? _o : "0";
9366
- const totalSharesStr = (_r = (_q = (_p = globalState == null ? void 0 : globalState.totalShares) == null ? void 0 : _p.toString) == null ? void 0 : _q.call(_p)) != null ? _r : "0";
9367
- const userSharesStr = (_u = (_t = (_s = outpostAccount == null ? void 0 : outpostAccount.stakedShares) == null ? void 0 : _s.toString) == null ? void 0 : _t.call(_s)) != null ? _u : "0";
9368
- const stakedLiqsol = BigInt(stakedLiqsolStr);
9369
- const currentIndex = BigInt(currentIndexStr);
9370
- const totalShares = BigInt(totalSharesStr);
9371
- const userShares = BigInt(userSharesStr);
9372
- let estimatedClaim = BigInt(0);
9373
- let estimatedYield = BigInt(0);
9374
- if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
9375
- estimatedClaim = userShares * currentIndex / INDEX_SCALE$1;
9376
- if (estimatedClaim > stakedLiqsol) {
9377
- estimatedYield = estimatedClaim - stakedLiqsol;
9183
+ try {
9184
+ const user = !!this.squadsX ? this.squadsVaultPDA : this.solPubKey;
9185
+ console.log("get portfolio for user", user.toBase58());
9186
+ const reservePoolPDA = deriveReservePoolPda();
9187
+ const vaultPDA = deriveVaultPda();
9188
+ const liqsolMint = deriveLiqsolMintPda();
9189
+ const userLiqsolAta = splToken.getAssociatedTokenAddressSync(
9190
+ liqsolMint,
9191
+ user,
9192
+ true,
9193
+ splToken.TOKEN_2022_PROGRAM_ID,
9194
+ splToken.ASSOCIATED_TOKEN_PROGRAM_ID
9195
+ );
9196
+ const [nativeLamports, actualBalResp, snapshot] = yield Promise.all([
9197
+ this.connection.getBalance(user, "confirmed"),
9198
+ this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
9199
+ this.outpostClient.fetchWireState(user).catch(() => null)
9200
+ ]);
9201
+ const LIQSOL_DECIMALS = 9;
9202
+ const actualAmountStr = (_b = (_a = actualBalResp == null ? void 0 : actualBalResp.value) == null ? void 0 : _a.amount) != null ? _b : "0";
9203
+ const globalState = (_c = snapshot == null ? void 0 : snapshot.globalState) != null ? _c : null;
9204
+ const outpostAccount = (_d = snapshot == null ? void 0 : snapshot.outpostAccount) != null ? _d : null;
9205
+ const trancheState = (_e = snapshot == null ? void 0 : snapshot.trancheState) != null ? _e : null;
9206
+ const userPretokenRecord = (_f = snapshot == null ? void 0 : snapshot.userPretokenRecord) != null ? _f : null;
9207
+ const stakedLiqsolStr = (_i = (_h = (_g = outpostAccount == null ? void 0 : outpostAccount.stakedLiqsol) == null ? void 0 : _g.toString) == null ? void 0 : _h.call(_g)) != null ? _i : "0";
9208
+ const wirePretokensStr = (_l = (_k = (_j = userPretokenRecord == null ? void 0 : userPretokenRecord.totalPretokensPurchased) == null ? void 0 : _j.toString) == null ? void 0 : _k.call(_j)) != null ? _l : "0";
9209
+ const currentIndexStr = (_o = (_n = (_m = globalState == null ? void 0 : globalState.currentIndex) == null ? void 0 : _m.toString) == null ? void 0 : _n.call(_m)) != null ? _o : "0";
9210
+ const totalSharesStr = (_r = (_q = (_p = globalState == null ? void 0 : globalState.totalShares) == null ? void 0 : _p.toString) == null ? void 0 : _q.call(_p)) != null ? _r : "0";
9211
+ const userSharesStr = (_u = (_t = (_s = outpostAccount == null ? void 0 : outpostAccount.stakedShares) == null ? void 0 : _s.toString) == null ? void 0 : _t.call(_s)) != null ? _u : "0";
9212
+ const stakedLiqsol = BigInt(stakedLiqsolStr);
9213
+ const currentIndex = BigInt(currentIndexStr);
9214
+ const totalShares = BigInt(totalSharesStr);
9215
+ const userShares = BigInt(userSharesStr);
9216
+ let estimatedClaim = BigInt(0);
9217
+ let estimatedYield = BigInt(0);
9218
+ if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
9219
+ estimatedClaim = userShares * currentIndex / INDEX_SCALE$1;
9220
+ if (estimatedClaim > stakedLiqsol) {
9221
+ estimatedYield = estimatedClaim - stakedLiqsol;
9222
+ }
9378
9223
  }
9224
+ return {
9225
+ native: {
9226
+ amount: BigInt(nativeLamports),
9227
+ symbol: "SOL",
9228
+ decimals: 9
9229
+ },
9230
+ liq: {
9231
+ amount: BigInt(actualAmountStr),
9232
+ symbol: "LiqSOL",
9233
+ decimals: LIQSOL_DECIMALS,
9234
+ ata: userLiqsolAta
9235
+ },
9236
+ staked: {
9237
+ amount: stakedLiqsol,
9238
+ symbol: "LiqSOL",
9239
+ decimals: LIQSOL_DECIMALS
9240
+ },
9241
+ wire: {
9242
+ amount: BigInt(wirePretokensStr),
9243
+ symbol: "$WIRE",
9244
+ decimals: 8
9245
+ },
9246
+ yield: {
9247
+ currentIndex,
9248
+ indexScale: INDEX_SCALE$1,
9249
+ totalShares,
9250
+ userShares,
9251
+ estimatedClaim,
9252
+ estimatedYield
9253
+ },
9254
+ extras: {
9255
+ userLiqsolAta: userLiqsolAta.toBase58(),
9256
+ reservePoolPDA: reservePoolPDA.toBase58(),
9257
+ vaultPDA: vaultPDA.toBase58(),
9258
+ globalIndex: (_v = globalState == null ? void 0 : globalState.currentIndex) == null ? void 0 : _v.toString(),
9259
+ totalShares: (_w = globalState == null ? void 0 : globalState.totalShares) == null ? void 0 : _w.toString(),
9260
+ currentTrancheNumber: (_x = trancheState == null ? void 0 : trancheState.currentTrancheNumber) == null ? void 0 : _x.toString(),
9261
+ currentTranchePriceUsd: (_y = trancheState == null ? void 0 : trancheState.currentTranchePriceUsd) == null ? void 0 : _y.toString()
9262
+ },
9263
+ chainID: this.network.chainId
9264
+ };
9265
+ } catch (err) {
9266
+ throw new Error(`Failed to get Solana portfolio: ${err}`);
9379
9267
  }
9380
- return {
9381
- native: {
9382
- amount: BigInt(nativeLamports),
9383
- symbol: "SOL",
9384
- decimals: 9
9385
- },
9386
- liq: {
9387
- amount: BigInt(actualAmountStr),
9388
- symbol: "LiqSOL",
9389
- decimals: LIQSOL_DECIMALS,
9390
- ata: userLiqsolAta
9391
- },
9392
- staked: {
9393
- amount: stakedLiqsol,
9394
- symbol: "LiqSOL",
9395
- decimals: LIQSOL_DECIMALS
9396
- },
9397
- wire: {
9398
- amount: BigInt(wirePretokensStr),
9399
- symbol: "$WIRE",
9400
- decimals: 8
9401
- },
9402
- yield: {
9403
- currentIndex,
9404
- indexScale: INDEX_SCALE$1,
9405
- totalShares,
9406
- userShares,
9407
- estimatedClaim,
9408
- estimatedYield
9409
- },
9410
- extras: {
9411
- userLiqsolAta: userLiqsolAta.toBase58(),
9412
- reservePoolPDA: reservePoolPDA.toBase58(),
9413
- vaultPDA: vaultPDA.toBase58(),
9414
- globalIndex: (_v = globalState == null ? void 0 : globalState.currentIndex) == null ? void 0 : _v.toString(),
9415
- totalShares: (_w = globalState == null ? void 0 : globalState.totalShares) == null ? void 0 : _w.toString(),
9416
- currentTrancheNumber: (_x = trancheState == null ? void 0 : trancheState.currentTrancheNumber) == null ? void 0 : _x.toString(),
9417
- currentTranchePriceUsd: (_y = trancheState == null ? void 0 : trancheState.currentTranchePriceUsd) == null ? void 0 : _y.toString()
9418
- },
9419
- chainID: this.network.chainId
9420
- };
9421
9268
  });
9422
9269
  }
9423
9270
  getUserRecord() {
@@ -9426,46 +9273,70 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9426
9273
  return this.distributionClient.getUserRecord(this.solPubKey);
9427
9274
  });
9428
9275
  }
9276
+ get squadsMultisigPDA() {
9277
+ if (!this.squadsX) return null;
9278
+ return new web3_js.PublicKey(this.squadsX.multisigPDA);
9279
+ }
9280
+ get squadsVaultPDA() {
9281
+ var _a;
9282
+ if (!this.squadsX || !this.squadsMultisigPDA) return null;
9283
+ const multisigPda = this.squadsMultisigPDA;
9284
+ const index = (_a = this.squadsX.vaultIndex) != null ? _a : 0;
9285
+ const pda = multisig__namespace.getVaultPda({ multisigPda, index });
9286
+ return pda[0];
9287
+ }
9429
9288
  getTrancheSnapshot(options) {
9430
9289
  return __async$8(this, null, function* () {
9431
- const {
9432
- chainID = core.SolChainID.WireTestnet,
9433
- windowBefore,
9434
- windowAfter
9435
- } = options != null ? options : {};
9436
- const [globalState, trancheState] = yield Promise.all([
9437
- this.tokenClient.fetchGlobalState(),
9438
- this.tokenClient.fetchTrancheState()
9439
- ]);
9440
- const { price: solPriceUsd, timestamp } = yield this.tokenClient.getSolPriceUsdSafe();
9441
- return buildSolanaTrancheSnapshot({
9442
- chainID,
9443
- globalState,
9444
- trancheState,
9445
- solPriceUsd,
9446
- nativePriceTimestamp: timestamp,
9447
- ladderWindowBefore: windowBefore,
9448
- ladderWindowAfter: windowAfter
9449
- });
9290
+ try {
9291
+ const {
9292
+ chainID = core.SolChainID.WireTestnet,
9293
+ windowBefore,
9294
+ windowAfter
9295
+ } = options != null ? options : {};
9296
+ const [globalState, trancheState] = yield Promise.all([
9297
+ this.tokenClient.fetchGlobalState(),
9298
+ this.tokenClient.fetchTrancheState()
9299
+ ]);
9300
+ const { price: solPriceUsd, timestamp } = yield this.tokenClient.getSolPriceUsdSafe();
9301
+ return buildSolanaTrancheSnapshot({
9302
+ chainID,
9303
+ globalState,
9304
+ trancheState,
9305
+ solPriceUsd,
9306
+ nativePriceTimestamp: timestamp,
9307
+ ladderWindowBefore: windowBefore,
9308
+ ladderWindowAfter: windowAfter
9309
+ });
9310
+ } catch (err) {
9311
+ throw new Error(`Failed to build Solana tranche snapshot: ${err}`);
9312
+ }
9450
9313
  });
9451
9314
  }
9452
9315
  getSystemAPY() {
9453
9316
  return __async$8(this, null, function* () {
9454
- const ratePerEpoch = yield this.getEpochRateDecimalFromProgram();
9455
- const epochsPerYear = yield this.getEpochsPerYearFromCluster();
9456
- const apyDecimal = Math.pow(1 + ratePerEpoch, epochsPerYear) - 1;
9457
- const apyPercent = apyDecimal * 100;
9458
- return apyPercent;
9317
+ try {
9318
+ const ratePerEpoch = yield this.getEpochRateDecimalFromProgram();
9319
+ const epochsPerYear = yield this.getEpochsPerYearFromCluster();
9320
+ const apyDecimal = Math.pow(1 + ratePerEpoch, epochsPerYear) - 1;
9321
+ const apyPercent = apyDecimal * 100;
9322
+ return apyPercent;
9323
+ } catch (err) {
9324
+ throw new Error(`Failed to compute Solana system APY: ${err}`);
9325
+ }
9459
9326
  });
9460
9327
  }
9461
9328
  getEpochRateDecimalFromProgram() {
9462
9329
  return __async$8(this, null, function* () {
9463
- const liqSolCoreProgram = this.program.getProgram("liqsolCore");
9464
- const stakeMetricsPda = deriveStakeMetricsPda();
9465
- const stakeMetrics = yield liqSolCoreProgram.account.stakeMetrics.fetch(stakeMetricsPda);
9466
- const raw = BigInt(stakeMetrics.solSystemPayRate.toString());
9467
- const rateDecimal = Number(raw) / Number(PAY_RATE_SCALE_FACTOR);
9468
- return rateDecimal;
9330
+ try {
9331
+ const liqSolCoreProgram = this.program.getProgram("liqsolCore");
9332
+ const stakeMetricsPda = deriveStakeMetricsPda();
9333
+ const stakeMetrics = yield liqSolCoreProgram.account.stakeMetrics.fetch(stakeMetricsPda);
9334
+ const raw = BigInt(stakeMetrics.solSystemPayRate.toString());
9335
+ const rateDecimal = Number(raw) / Number(PAY_RATE_SCALE_FACTOR);
9336
+ return rateDecimal;
9337
+ } catch (err) {
9338
+ throw new Error(`Failed to read stakeMetrics from program: ${err}`);
9339
+ }
9469
9340
  });
9470
9341
  }
9471
9342
  getEpochsPerYearFromCluster() {
@@ -9533,8 +9404,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9533
9404
  return __async$8(this, null, function* () {
9534
9405
  var _a, _b, _c, _d;
9535
9406
  this.ensureUser();
9536
- const payer = this.solPubKey;
9537
- const balanceLamports = (_a = options == null ? void 0 : options.balanceOverrideLamports) != null ? _a : BigInt(yield this.connection.getBalance(payer, commitment));
9407
+ const balanceLamports = (_a = options == null ? void 0 : options.balanceOverrideLamports) != null ? _a : BigInt(yield this.connection.getBalance(this.feePayer, commitment));
9538
9408
  if (balanceLamports <= BigInt(0)) {
9539
9409
  return BigInt(0);
9540
9410
  }
@@ -9593,7 +9463,7 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9593
9463
  if (this.cachedTxFee && now - this.cachedTxFee.fetchedAt < _SolanaStakingClient.FEE_CACHE_TTL_MS) {
9594
9464
  return this.cachedTxFee.value;
9595
9465
  }
9596
- const payer = this.solPubKey;
9466
+ const payer = this.feePayer;
9597
9467
  const dummyIx = web3_js.SystemProgram.transfer({
9598
9468
  fromPubkey: payer,
9599
9469
  toPubkey: payer,
@@ -9656,18 +9526,18 @@ const _SolanaStakingClient = class _SolanaStakingClient {
9656
9526
  return __async$8(this, null, function* () {
9657
9527
  const { blockhash, lastValidBlockHeight } = yield this.connection.getLatestBlockhash("confirmed");
9658
9528
  tx.recentBlockhash = blockhash;
9659
- tx.feePayer = this.solPubKey;
9529
+ tx.feePayer = this.feePayer;
9660
9530
  return { tx, blockhash, lastValidBlockHeight };
9661
9531
  });
9662
9532
  }
9663
9533
  ensureUser() {
9664
- if (!this.pubKey || !this.anchor.wallet.publicKey) {
9665
- throw new Error("User Authorization required: pubKey is undefined");
9666
- }
9667
- if (this.solPubKey.toBase58() !== this.anchor.wallet.publicKey.toBase58()) {
9668
- throw new Error(
9669
- "Write access requires connected wallet to match pubKey"
9670
- );
9534
+ var _a;
9535
+ if (!this.pubKey) throw new Error("User pubKey is undefined");
9536
+ const wallet = (_a = this.anchor) == null ? void 0 : _a.wallet;
9537
+ const pk = wallet == null ? void 0 : wallet.publicKey;
9538
+ if (!pk) throw new Error("Wallet not connected");
9539
+ if (typeof wallet.signTransaction !== "function") {
9540
+ throw new Error("Wallet does not support signTransaction");
9671
9541
  }
9672
9542
  }
9673
9543
  };
@@ -35223,10 +35093,6 @@ const CONTRACTS = {
35223
35093
  address: ADDRESSES.ReceiptNFT,
35224
35094
  abi: ReceiptNFTArtifact.abi
35225
35095
  },
35226
- MockAggregator: {
35227
- address: ADDRESSES.MockAggregator,
35228
- abi: AggregatorArtifact.abi
35229
- },
35230
35096
  Pool: {
35231
35097
  address: ADDRESSES.Pool,
35232
35098
  abi: PoolArtifact.abi
@@ -35266,6 +35132,10 @@ const CONTRACTS = {
35266
35132
  Depositor: {
35267
35133
  address: ADDRESSES.Depositor,
35268
35134
  abi: DepositorArtifact.abi
35135
+ },
35136
+ MockAggregator: {
35137
+ address: ADDRESSES.MockAggregator,
35138
+ abi: AggregatorArtifact.abi
35269
35139
  }
35270
35140
  };
35271
35141
  class EthereumContractService {
@@ -35965,18 +35835,22 @@ class OPPClient {
35965
35835
  }
35966
35836
  getMessages(address) {
35967
35837
  return __async$2(this, null, function* () {
35968
- const oppMessageFilter = this.contract.OPP.filters.OPPMessage();
35969
- const events = yield this.contract.OPP.queryFilter(oppMessageFilter, 0, "latest");
35970
- const allAssertions = [];
35971
- for (const event of events) {
35972
- const assertions = yield this.extractAssertionsFromEvent(event);
35973
- allAssertions.push(...assertions);
35838
+ try {
35839
+ const oppMessageFilter = this.contract.OPP.filters.OPPMessage();
35840
+ const events = yield this.contract.OPP.queryFilter(oppMessageFilter, 0, "latest");
35841
+ const allAssertions = [];
35842
+ for (const event of events) {
35843
+ const assertions = yield this.extractAssertionsFromEvent(event);
35844
+ allAssertions.push(...assertions);
35845
+ }
35846
+ const normalized = address ? address.toLowerCase() : null;
35847
+ const filtered = allAssertions.filter(
35848
+ (a) => a.from && a.from.toLowerCase() === normalized || a.to && a.to.toLowerCase() === normalized
35849
+ );
35850
+ return filtered.reverse();
35851
+ } catch (error) {
35852
+ return [];
35974
35853
  }
35975
- const normalized = address ? address.toLowerCase() : null;
35976
- const filtered = allAssertions.filter(
35977
- (a) => a.from && a.from.toLowerCase() === normalized || a.to && a.to.toLowerCase() === normalized
35978
- );
35979
- return filtered.reverse();
35980
35854
  });
35981
35855
  }
35982
35856
  extractAssertionsFromEvent(event) {
@@ -36239,7 +36113,12 @@ class ReceiptClient {
36239
36113
  }
36240
36114
  stakeReceipts(address) {
36241
36115
  return __async$1(this, null, function* () {
36242
- return this.fetchPreLaunchReceipts(address, ReceiptNFTKind.STAKE);
36116
+ try {
36117
+ const receipts = yield this.fetchPreLaunchReceipts(address, ReceiptNFTKind.STAKE);
36118
+ return receipts;
36119
+ } catch (err) {
36120
+ return [];
36121
+ }
36243
36122
  });
36244
36123
  }
36245
36124
  pretokenReceipts(address) {
@@ -36408,10 +36287,6 @@ class EthereumStakingClient {
36408
36287
  return __async(this, null, function* () {
36409
36288
  this.ensureUser();
36410
36289
  const buyer = yield this.signer.getAddress();
36411
- const network = yield this.provider.getNetwork();
36412
- const chainId = network.chainId;
36413
- const allowedTestChains = new Set([560048]);
36414
- if (allowedTestChains.has(chainId)) yield this.updateMockAggregatorPrice();
36415
36290
  let result = yield this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
36416
36291
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
36417
36292
  });
@@ -36419,72 +36294,77 @@ class EthereumStakingClient {
36419
36294
  getPortfolio() {
36420
36295
  return __async(this, null, function* () {
36421
36296
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
36422
- if (!this.signer) return Promise.resolve(null);
36423
- const walletAddress = yield this.signer.getAddress();
36424
- const nativeBalance = yield this.provider.getBalance(walletAddress);
36425
- const nativeDecimals = (_c = (_b = (_a = this.network) == null ? void 0 : _a.nativeCurrency) == null ? void 0 : _b.decimals) != null ? _c : 18;
36426
- const nativeSymbol = (_f = (_e = (_d = this.network) == null ? void 0 : _d.nativeCurrency) == null ? void 0 : _e.symbol) != null ? _f : "ETH";
36427
- const liqBalance = yield this.contract.LiqEthToken.balanceOf(walletAddress);
36428
- const liqSymbol = "Liq" + ((_i = (_h = (_g = this.network) == null ? void 0 : _g.nativeCurrency) == null ? void 0 : _h.symbol) != null ? _i : "ETH");
36429
- let stakeReceipts = yield this.receiptClient.stakeReceipts(walletAddress);
36430
- let stakeBalanceBN = ethers.BigNumber.from(0);
36431
- for (let r of stakeReceipts) {
36432
- stakeBalanceBN = stakeBalanceBN.add(ethers.BigNumber.from(r.receipt.principal.amount));
36433
- }
36434
- let stakeSharesBN = ethers.BigNumber.from(0);
36435
- for (let r of stakeReceipts) {
36436
- stakeSharesBN = stakeSharesBN.add(ethers.BigNumber.from(r.receipt.shares.amount));
36437
- }
36438
- const wireBalance = yield this.contract.Pretoken.balanceOf(walletAddress);
36439
- let currentIndex = BigInt(0);
36440
- let totalShares = BigInt(0);
36441
- let userShares = BigInt(0);
36442
- const indexScale = BigInt(1e27);
36443
36297
  try {
36444
- const [indexBn, totalSharesBn] = yield Promise.all([
36445
- this.contract.Depositor.index().catch(() => ethers.BigNumber.from(0)),
36446
- this.contract.Depositor.totalShares().catch(() => ethers.BigNumber.from(0))
36447
- ]);
36448
- const userSharesBn = stakeSharesBN;
36449
- currentIndex = BigInt(indexBn.toString());
36450
- totalShares = BigInt(totalSharesBn.toString());
36451
- userShares = BigInt(userSharesBn.toString());
36452
- } catch (e) {
36298
+ if (!this.signer) return Promise.resolve(null);
36299
+ const walletAddress = yield this.signer.getAddress();
36300
+ const nativeBalance = yield this.provider.getBalance(walletAddress);
36301
+ const nativeDecimals = (_c = (_b = (_a = this.network) == null ? void 0 : _a.nativeCurrency) == null ? void 0 : _b.decimals) != null ? _c : 18;
36302
+ const nativeSymbol = (_f = (_e = (_d = this.network) == null ? void 0 : _d.nativeCurrency) == null ? void 0 : _e.symbol) != null ? _f : "ETH";
36303
+ const liqBalance = yield this.contract.LiqEthToken.balanceOf(walletAddress);
36304
+ const liqSymbol = "Liq" + ((_i = (_h = (_g = this.network) == null ? void 0 : _g.nativeCurrency) == null ? void 0 : _h.symbol) != null ? _i : "ETH");
36305
+ let stakeReceipts = yield this.receiptClient.stakeReceipts(walletAddress);
36306
+ let stakeBalanceBN = ethers.BigNumber.from(0);
36307
+ for (let r of stakeReceipts) {
36308
+ stakeBalanceBN = stakeBalanceBN.add(ethers.BigNumber.from(r.receipt.principal.amount));
36309
+ }
36310
+ let stakeSharesBN = ethers.BigNumber.from(0);
36311
+ for (let r of stakeReceipts) {
36312
+ stakeSharesBN = stakeSharesBN.add(ethers.BigNumber.from(r.receipt.shares.amount));
36313
+ }
36314
+ const wireBalance = yield this.contract.Pretoken.balanceOf(walletAddress);
36315
+ let currentIndex = BigInt(0);
36316
+ let totalShares = BigInt(0);
36317
+ let userShares = BigInt(0);
36318
+ const indexScale = BigInt(1e27);
36319
+ try {
36320
+ const [indexBn, totalSharesBn] = yield Promise.all([
36321
+ this.contract.Depositor.index().catch(() => ethers.BigNumber.from(0)),
36322
+ this.contract.Depositor.totalShares().catch(() => ethers.BigNumber.from(0))
36323
+ ]);
36324
+ const userSharesBn = stakeSharesBN;
36325
+ currentIndex = BigInt(indexBn.toString());
36326
+ totalShares = BigInt(totalSharesBn.toString());
36327
+ userShares = BigInt(userSharesBn.toString());
36328
+ } catch (error) {
36329
+ console.log("Error fetching staking index/shares:", error);
36330
+ }
36331
+ let estimatedClaim = BigInt(0);
36332
+ let estimatedYield = BigInt(0);
36333
+ const portfolio = {
36334
+ native: {
36335
+ amount: nativeBalance.toBigInt(),
36336
+ decimals: nativeDecimals,
36337
+ symbol: nativeSymbol
36338
+ },
36339
+ liq: {
36340
+ amount: liqBalance.toBigInt(),
36341
+ decimals: nativeDecimals,
36342
+ symbol: liqSymbol
36343
+ },
36344
+ staked: {
36345
+ amount: stakeBalanceBN.toBigInt(),
36346
+ decimals: nativeDecimals,
36347
+ symbol: liqSymbol
36348
+ },
36349
+ wire: {
36350
+ amount: wireBalance.toBigInt(),
36351
+ decimals: 18,
36352
+ symbol: "$WIRE"
36353
+ },
36354
+ yield: {
36355
+ currentIndex,
36356
+ indexScale,
36357
+ totalShares,
36358
+ userShares,
36359
+ estimatedClaim,
36360
+ estimatedYield
36361
+ },
36362
+ chainID: this.network.chainId
36363
+ };
36364
+ return portfolio;
36365
+ } catch (error) {
36366
+ throw error;
36453
36367
  }
36454
- let estimatedClaim = BigInt(0);
36455
- let estimatedYield = BigInt(0);
36456
- const portfolio = {
36457
- native: {
36458
- amount: nativeBalance.toBigInt(),
36459
- decimals: nativeDecimals,
36460
- symbol: nativeSymbol
36461
- },
36462
- liq: {
36463
- amount: liqBalance.toBigInt(),
36464
- decimals: nativeDecimals,
36465
- symbol: liqSymbol
36466
- },
36467
- staked: {
36468
- amount: stakeBalanceBN.toBigInt(),
36469
- decimals: nativeDecimals,
36470
- symbol: liqSymbol
36471
- },
36472
- wire: {
36473
- amount: wireBalance.toBigInt(),
36474
- decimals: 18,
36475
- symbol: "$WIRE"
36476
- },
36477
- yield: {
36478
- currentIndex,
36479
- indexScale,
36480
- totalShares,
36481
- userShares,
36482
- estimatedClaim,
36483
- estimatedYield
36484
- },
36485
- chainID: this.network.chainId
36486
- };
36487
- return portfolio;
36488
36368
  });
36489
36369
  }
36490
36370
  fetchPrelaunchReceipts(address) {
@@ -36542,7 +36422,7 @@ class EthereumStakingClient {
36542
36422
  getTrancheSnapshot(options) {
36543
36423
  return __async(this, null, function* () {
36544
36424
  const {
36545
- chainID = core.EvmChainID.Hoodi,
36425
+ chainID = core.EvmChainID.Ethereum,
36546
36426
  windowBefore,
36547
36427
  windowAfter
36548
36428
  } = options != null ? options : {};
@@ -36563,10 +36443,8 @@ class EthereumStakingClient {
36563
36443
  ]);
36564
36444
  const totalTrancheSupply = BigInt(totalSupplyBn.toString()) / BigInt(1e10);
36565
36445
  const currentTrancheSupply = BigInt(trancheSupplyBn.toString()) / BigInt(1e10);
36566
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = yield this.contract.MockAggregator.latestRoundData();
36567
36446
  let ethPriceUsdBn = yield this.contract.EthUsdPriceConsumer.getPrice18Decimals();
36568
36447
  let ethPriceUsd = BigInt(ethPriceUsdBn.toString()) / BigInt(1e10);
36569
- let nativePriceTimestamp = Number(updatedAt);
36570
36448
  const initialTrancheSupply = BigInt(INITIAL_TRANCHE_SUPPLY) * BigInt(1e8);
36571
36449
  return buildEthereumTrancheSnapshot({
36572
36450
  chainID,
@@ -36582,7 +36460,6 @@ class EthereumStakingClient {
36582
36460
  minPriceUsd,
36583
36461
  maxPriceUsd,
36584
36462
  ethPriceUsd,
36585
- nativePriceTimestamp,
36586
36463
  ladderWindowBefore: windowBefore,
36587
36464
  ladderWindowAfter: windowAfter
36588
36465
  });
@@ -36619,36 +36496,6 @@ class EthereumStakingClient {
36619
36496
  return bufferWei;
36620
36497
  });
36621
36498
  }
36622
- updateMockAggregatorPrice() {
36623
- return __async(this, null, function* () {
36624
- const aggregator = this.contract.MockAggregator;
36625
- const [roundId, answer, startedAt, updatedAt, answeredInRound] = yield aggregator.latestRoundData();
36626
- const now = (yield this.provider.getBlock("latest")).timestamp;
36627
- const ageSec = Number(now) - Number(updatedAt);
36628
- const ONE_HOUR = 1 * 3600;
36629
- if (ageSec > ONE_HOUR) {
36630
- const network = yield this.provider.getNetwork();
36631
- const chainId = network.chainId;
36632
- const allowedTestChains = new Set([560048]);
36633
- if (!allowedTestChains.has(chainId)) {
36634
- console.warn(`MockAggregator is stale (${ageSec}s) but chainId ${chainId} is not a test/local network \u2014 skipping update.`);
36635
- return;
36636
- }
36637
- const res = yield fetch("https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd");
36638
- const data = yield res.json();
36639
- const ethUsd = data.ethereum.usd;
36640
- const currentEthPrice = ethers.ethers.utils.parseUnits(ethUsd.toString(), 8);
36641
- try {
36642
- const tx = yield aggregator.updateAnswer(currentEthPrice);
36643
- const txreceipt = yield tx.wait(1);
36644
- } catch (err) {
36645
- console.error("MockAggregator updateAnswer failed", (err == null ? void 0 : err.message) || err);
36646
- }
36647
- } else {
36648
- console.log(`MockAggregator updated ${ageSec}s ago \u2014 no update needed`);
36649
- }
36650
- });
36651
- }
36652
36499
  }
36653
36500
 
36654
36501
  class Staker {
@@ -36659,10 +36506,8 @@ class Staker {
36659
36506
  config.forEach((cfg) => {
36660
36507
  switch (cfg.network.chainId) {
36661
36508
  case core.SolChainID.Devnet:
36662
- case core.SolChainID.WireTestnet:
36663
36509
  this.clients.set(cfg.network.chainId, new SolanaStakingClient(cfg));
36664
36510
  break;
36665
- case core.EvmChainID.Ethereum:
36666
36511
  case core.EvmChainID.Hoodi:
36667
36512
  this.clients.set(cfg.network.chainId, new EthereumStakingClient(cfg));
36668
36513
  break;
@@ -36703,7 +36548,6 @@ const CONTRACT_NAMES = [
36703
36548
  "Base58",
36704
36549
  "sysio_merkle",
36705
36550
  "ReceiptNFT",
36706
- "MockAggregator",
36707
36551
  "Pool",
36708
36552
  "OutpostManager",
36709
36553
  "sysio_write",
@@ -36713,7 +36557,8 @@ const CONTRACT_NAMES = [
36713
36557
  "OPP",
36714
36558
  "Pretoken",
36715
36559
  "OPPInbound",
36716
- "Depositor"
36560
+ "Depositor",
36561
+ "MockAggregator"
36717
36562
  ];
36718
36563
 
36719
36564
  var types$1 = /*#__PURE__*/Object.freeze({