@wireio/stake 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/stake.js CHANGED
@@ -6,7 +6,7 @@ var anchor = require('@coral-xyz/anchor');
6
6
  var splToken = require('@solana/spl-token');
7
7
  var ethers = require('ethers');
8
8
 
9
- var address$3 = "2qSsCXBYUSwF7zrzTT9jFpRpCmWoDpEyHr9exfCMq56P";
9
+ var address$3 = "5nBtmutQLrRKBUxNfHJPDjiW5u8id6QM9Hhjg1D1g1XH";
10
10
  var metadata$3 = {
11
11
  name: "liqsol_core",
12
12
  version: "0.1.0",
@@ -20,7 +20,8 @@ var instructions$3 = [
20
20
  "Accumulate unstake requests to be processed in next allocation cycle",
21
21
  "Multiple requests can be accumulated before calculating allocations",
22
22
  "Returns the target epoch when this unstake request will be processed",
23
- "We should not be able to"
23
+ "We should not be able to call this without development feature enabled",
24
+ ""
24
25
  ],
25
26
  discriminator: [
26
27
  24,
@@ -57,6 +58,12 @@ var instructions$3 = [
57
58
  "Maintenance ledger - to determine target processing epoch"
58
59
  ]
59
60
  },
61
+ {
62
+ name: "global_config",
63
+ docs: [
64
+ "Global config for min_unstake_request setting"
65
+ ]
66
+ },
60
67
  {
61
68
  name: "clock"
62
69
  }
@@ -108,6 +115,12 @@ var instructions$3 = [
108
115
  name: "processing_state",
109
116
  writable: true
110
117
  },
118
+ {
119
+ name: "global_config",
120
+ docs: [
121
+ "Global config for threshold parameters"
122
+ ]
123
+ },
111
124
  {
112
125
  name: "authority",
113
126
  signer: true
@@ -184,44 +197,6 @@ var instructions$3 = [
184
197
  }
185
198
  ]
186
199
  },
187
- {
188
- name: "advance_serviceability",
189
- docs: [
190
- "Advance the max servicable receipt ID"
191
- ],
192
- discriminator: [
193
- 139,
194
- 89,
195
- 79,
196
- 2,
197
- 90,
198
- 211,
199
- 173,
200
- 240
201
- ],
202
- accounts: [
203
- {
204
- name: "authority",
205
- docs: [
206
- "Authority that can update serviceable epoch"
207
- ],
208
- signer: true
209
- },
210
- {
211
- name: "global",
212
- writable: true
213
- },
214
- {
215
- name: "runtime_program"
216
- }
217
- ],
218
- args: [
219
- {
220
- name: "resolved_epoch",
221
- type: "u64"
222
- }
223
- ]
224
- },
225
200
  {
226
201
  name: "aggregate_stake_metrics",
227
202
  docs: [
@@ -383,6 +358,12 @@ var instructions$3 = [
383
358
  "Maintenance ledger - to track last unstake allocation epoch"
384
359
  ],
385
360
  writable: true
361
+ },
362
+ {
363
+ name: "global_config",
364
+ docs: [
365
+ "Global config for late epoch slot gate"
366
+ ]
386
367
  }
387
368
  ],
388
369
  args: [
@@ -447,6 +428,12 @@ var instructions$3 = [
447
428
  docs: [
448
429
  "Global withdraw operator state - to read total_encumbered_funds"
449
430
  ]
431
+ },
432
+ {
433
+ name: "global_config",
434
+ docs: [
435
+ "Global config for rebalancing thresholds"
436
+ ]
450
437
  }
451
438
  ],
452
439
  args: [
@@ -571,6 +558,12 @@ var instructions$3 = [
571
558
  {
572
559
  name: "stake_history"
573
560
  },
561
+ {
562
+ name: "global_config",
563
+ docs: [
564
+ "Global config for claim_withdrawals_enabled check"
565
+ ]
566
+ },
574
567
  {
575
568
  name: "token_program"
576
569
  },
@@ -623,6 +616,12 @@ var instructions$3 = [
623
616
  "Stake controller state - used to verify authority"
624
617
  ]
625
618
  },
619
+ {
620
+ name: "global_config",
621
+ docs: [
622
+ "Global config for cooldown_epochs"
623
+ ]
624
+ },
626
625
  {
627
626
  name: "clock"
628
627
  },
@@ -962,6 +961,12 @@ var instructions$3 = [
962
961
  name: "controller_state",
963
962
  writable: true
964
963
  },
964
+ {
965
+ name: "global_config",
966
+ docs: [
967
+ "Global config for deposit settings"
968
+ ]
969
+ },
965
970
  {
966
971
  name: "payout_state",
967
972
  writable: true
@@ -1098,47 +1103,6 @@ var instructions$3 = [
1098
1103
  }
1099
1104
  ]
1100
1105
  },
1101
- {
1102
- name: "force_validator_unstake",
1103
- docs: [
1104
- "A function you can call to directly influence the amount to unstake from a particular validator",
1105
- "Tbh this is a bypass of the system and should not be called unless you know what you are doing"
1106
- ],
1107
- discriminator: [
1108
- 7,
1109
- 208,
1110
- 146,
1111
- 241,
1112
- 10,
1113
- 219,
1114
- 109,
1115
- 30
1116
- ],
1117
- accounts: [
1118
- {
1119
- name: "admin",
1120
- writable: true,
1121
- signer: true
1122
- },
1123
- {
1124
- name: "validator_info",
1125
- docs: [
1126
- "Validator info account to update"
1127
- ],
1128
- writable: true
1129
- }
1130
- ],
1131
- args: [
1132
- {
1133
- name: "vote_account",
1134
- type: "pubkey"
1135
- },
1136
- {
1137
- name: "amount",
1138
- type: "u64"
1139
- }
1140
- ]
1141
- },
1142
1106
  {
1143
1107
  name: "get_min_max_resolved_epoch_deactivations",
1144
1108
  docs: [
@@ -1384,6 +1348,38 @@ var instructions$3 = [
1384
1348
  args: [
1385
1349
  ]
1386
1350
  },
1351
+ {
1352
+ name: "initialize_global_config",
1353
+ discriminator: [
1354
+ 113,
1355
+ 216,
1356
+ 122,
1357
+ 131,
1358
+ 225,
1359
+ 209,
1360
+ 22,
1361
+ 55
1362
+ ],
1363
+ accounts: [
1364
+ {
1365
+ name: "global_config",
1366
+ writable: true
1367
+ },
1368
+ {
1369
+ name: "controller_state"
1370
+ },
1371
+ {
1372
+ name: "payer",
1373
+ writable: true,
1374
+ signer: true
1375
+ },
1376
+ {
1377
+ name: "system_program"
1378
+ }
1379
+ ],
1380
+ args: [
1381
+ ]
1382
+ },
1387
1383
  {
1388
1384
  name: "initialize_graveyard_list",
1389
1385
  docs: [
@@ -1914,6 +1910,10 @@ var instructions$3 = [
1914
1910
  ],
1915
1911
  writable: true
1916
1912
  },
1913
+ {
1914
+ name: "withdraw_global",
1915
+ writable: true
1916
+ },
1917
1917
  {
1918
1918
  name: "stake_program"
1919
1919
  },
@@ -1978,6 +1978,12 @@ var instructions$3 = [
1978
1978
  name: "processing_state",
1979
1979
  writable: true
1980
1980
  },
1981
+ {
1982
+ name: "global_config",
1983
+ docs: [
1984
+ "Global config for late epoch slot gate"
1985
+ ]
1986
+ },
1981
1987
  {
1982
1988
  name: "clock"
1983
1989
  },
@@ -2052,6 +2058,12 @@ var instructions$3 = [
2052
2058
  },
2053
2059
  {
2054
2060
  name: "instructions"
2061
+ },
2062
+ {
2063
+ name: "global_config",
2064
+ docs: [
2065
+ "Global config for process_pay_cycle_enabled check"
2066
+ ]
2055
2067
  }
2056
2068
  ],
2057
2069
  args: [
@@ -2124,6 +2136,12 @@ var instructions$3 = [
2124
2136
  },
2125
2137
  {
2126
2138
  name: "rent"
2139
+ },
2140
+ {
2141
+ name: "global_config",
2142
+ docs: [
2143
+ "Global config for process_stake_orders_enabled check"
2144
+ ]
2127
2145
  }
2128
2146
  ],
2129
2147
  args: [
@@ -2233,6 +2251,12 @@ var instructions$3 = [
2233
2251
  },
2234
2252
  {
2235
2253
  name: "stake_program"
2254
+ },
2255
+ {
2256
+ name: "global_config",
2257
+ docs: [
2258
+ "Global config for process_unstake_orders_enabled check"
2259
+ ]
2236
2260
  }
2237
2261
  ],
2238
2262
  args: [
@@ -2510,6 +2534,12 @@ var instructions$3 = [
2510
2534
  },
2511
2535
  {
2512
2536
  name: "active_list"
2537
+ },
2538
+ {
2539
+ name: "global_config",
2540
+ docs: [
2541
+ "Global config for late epoch slot gate"
2542
+ ]
2513
2543
  }
2514
2544
  ],
2515
2545
  args: [
@@ -2551,6 +2581,12 @@ var instructions$3 = [
2551
2581
  },
2552
2582
  {
2553
2583
  name: "active_list"
2584
+ },
2585
+ {
2586
+ name: "global_config",
2587
+ docs: [
2588
+ "Global config for late epoch slot gate"
2589
+ ]
2554
2590
  }
2555
2591
  ],
2556
2592
  args: [
@@ -2645,6 +2681,12 @@ var instructions$3 = [
2645
2681
  {
2646
2682
  name: "allocation_state"
2647
2683
  },
2684
+ {
2685
+ name: "global_config",
2686
+ docs: [
2687
+ "Global config for late epoch slot gate"
2688
+ ]
2689
+ },
2648
2690
  {
2649
2691
  name: "authority",
2650
2692
  signer: true
@@ -2776,6 +2818,12 @@ var instructions$3 = [
2776
2818
  "Maintenance ledger - for accumulate_unstake_request"
2777
2819
  ]
2778
2820
  },
2821
+ {
2822
+ name: "global_config",
2823
+ docs: [
2824
+ "Global config for min_unstake_request setting"
2825
+ ]
2826
+ },
2779
2827
  {
2780
2828
  name: "clock"
2781
2829
  },
@@ -3157,6 +3205,12 @@ var instructions$3 = [
3157
3205
  name: "allocation_state",
3158
3206
  writable: true
3159
3207
  },
3208
+ {
3209
+ name: "global_config",
3210
+ docs: [
3211
+ "Global config for late epoch slot gate"
3212
+ ]
3213
+ },
3160
3214
  {
3161
3215
  name: "system_program",
3162
3216
  docs: [
@@ -3225,6 +3279,12 @@ var instructions$3 = [
3225
3279
  name: "maintenance_ledger",
3226
3280
  writable: true
3227
3281
  },
3282
+ {
3283
+ name: "global_config",
3284
+ docs: [
3285
+ "Global config for late epoch slot gate"
3286
+ ]
3287
+ },
3228
3288
  {
3229
3289
  name: "authority",
3230
3290
  signer: true
@@ -3234,37 +3294,32 @@ var instructions$3 = [
3234
3294
  ]
3235
3295
  },
3236
3296
  {
3237
- name: "sync_distribution_index",
3297
+ name: "sync_leaderboard_scores_batch",
3238
3298
  discriminator: [
3239
- 82,
3240
- 159,
3241
- 232,
3242
- 125,
3243
- 12,
3244
- 29,
3245
- 9,
3246
- 226
3299
+ 52,
3300
+ 11,
3301
+ 210,
3302
+ 173,
3303
+ 90,
3304
+ 5,
3305
+ 48,
3306
+ 50
3247
3307
  ],
3248
3308
  accounts: [
3249
3309
  {
3250
- name: "authority",
3251
- docs: [
3252
- "Admin or crank that triggers the index sync"
3253
- ],
3254
- signer: true
3310
+ name: "leaderboard_state"
3255
3311
  },
3256
3312
  {
3257
- name: "distribution_state",
3313
+ name: "processing_state",
3258
3314
  writable: true
3259
3315
  },
3260
3316
  {
3261
- name: "bucket_authority",
3262
- docs: [
3263
- "The bucket's associated token account holding liqSOL"
3264
- ]
3317
+ name: "maintenance_ledger",
3318
+ writable: true
3265
3319
  },
3266
3320
  {
3267
- name: "bucket_token_account"
3321
+ name: "authority",
3322
+ signer: true
3268
3323
  }
3269
3324
  ],
3270
3325
  args: [
@@ -3352,6 +3407,12 @@ var instructions$3 = [
3352
3407
  name: "maintenance_ledger",
3353
3408
  writable: true
3354
3409
  },
3410
+ {
3411
+ name: "global_config",
3412
+ docs: [
3413
+ "Global config for min_vpp_entry and min_vpp_exit"
3414
+ ]
3415
+ },
3355
3416
  {
3356
3417
  name: "authority",
3357
3418
  signer: true
@@ -3483,63 +3544,235 @@ var instructions$3 = [
3483
3544
  ]
3484
3545
  },
3485
3546
  {
3486
- name: "update_growth_parameters",
3547
+ name: "update_config_bool",
3487
3548
  discriminator: [
3488
- 172,
3489
- 187,
3490
- 237,
3491
- 233,
3492
- 250,
3493
- 160,
3494
- 115,
3495
- 239
3549
+ 79,
3550
+ 36,
3551
+ 65,
3552
+ 239,
3553
+ 188,
3554
+ 35,
3555
+ 13,
3556
+ 160
3496
3557
  ],
3497
3558
  accounts: [
3498
3559
  {
3499
- name: "admin",
3500
- writable: true,
3501
- signer: true
3502
- },
3503
- {
3504
- name: "tranche_state",
3560
+ name: "global_config",
3505
3561
  writable: true
3506
3562
  },
3507
3563
  {
3508
- name: "price_history",
3509
- writable: true
3564
+ name: "controller_state"
3510
3565
  },
3511
3566
  {
3512
- name: "system_program"
3567
+ name: "authority",
3568
+ docs: [
3569
+ "Authority must match StakeControllerState.authority"
3570
+ ],
3571
+ signer: true
3513
3572
  }
3514
3573
  ],
3515
3574
  args: [
3516
3575
  {
3517
- name: "supply_growth_bps",
3518
- type: "u16"
3576
+ name: "key",
3577
+ type: {
3578
+ defined: {
3579
+ name: "ConfigKeyBool"
3580
+ }
3581
+ }
3519
3582
  },
3520
3583
  {
3521
- name: "price_growth_bps",
3522
- type: "u16"
3584
+ name: "value",
3585
+ type: "bool"
3523
3586
  }
3524
3587
  ]
3525
3588
  },
3526
3589
  {
3527
- name: "update_price_bounds",
3590
+ name: "update_config_u16",
3528
3591
  discriminator: [
3529
- 241,
3530
- 116,
3531
- 141,
3532
- 65,
3533
- 61,
3534
- 95,
3535
- 232,
3536
- 28
3592
+ 149,
3593
+ 9,
3594
+ 244,
3595
+ 25,
3596
+ 46,
3597
+ 136,
3598
+ 59,
3599
+ 173
3537
3600
  ],
3538
3601
  accounts: [
3539
3602
  {
3540
- name: "admin",
3541
- writable: true,
3542
- signer: true
3603
+ name: "global_config",
3604
+ writable: true
3605
+ },
3606
+ {
3607
+ name: "controller_state"
3608
+ },
3609
+ {
3610
+ name: "authority",
3611
+ docs: [
3612
+ "Authority must match StakeControllerState.authority"
3613
+ ],
3614
+ signer: true
3615
+ }
3616
+ ],
3617
+ args: [
3618
+ {
3619
+ name: "key",
3620
+ type: {
3621
+ defined: {
3622
+ name: "ConfigKeyU16"
3623
+ }
3624
+ }
3625
+ },
3626
+ {
3627
+ name: "value",
3628
+ type: "u16"
3629
+ }
3630
+ ]
3631
+ },
3632
+ {
3633
+ name: "update_config_u64",
3634
+ discriminator: [
3635
+ 120,
3636
+ 43,
3637
+ 124,
3638
+ 106,
3639
+ 97,
3640
+ 80,
3641
+ 208,
3642
+ 123
3643
+ ],
3644
+ accounts: [
3645
+ {
3646
+ name: "global_config",
3647
+ writable: true
3648
+ },
3649
+ {
3650
+ name: "controller_state"
3651
+ },
3652
+ {
3653
+ name: "authority",
3654
+ docs: [
3655
+ "Authority must match StakeControllerState.authority"
3656
+ ],
3657
+ signer: true
3658
+ }
3659
+ ],
3660
+ args: [
3661
+ {
3662
+ name: "key",
3663
+ type: {
3664
+ defined: {
3665
+ name: "ConfigKeyU64"
3666
+ }
3667
+ }
3668
+ },
3669
+ {
3670
+ name: "value",
3671
+ type: "u64"
3672
+ }
3673
+ ]
3674
+ },
3675
+ {
3676
+ name: "update_config_u8",
3677
+ discriminator: [
3678
+ 17,
3679
+ 160,
3680
+ 31,
3681
+ 134,
3682
+ 222,
3683
+ 250,
3684
+ 229,
3685
+ 253
3686
+ ],
3687
+ accounts: [
3688
+ {
3689
+ name: "global_config",
3690
+ writable: true
3691
+ },
3692
+ {
3693
+ name: "controller_state"
3694
+ },
3695
+ {
3696
+ name: "authority",
3697
+ docs: [
3698
+ "Authority must match StakeControllerState.authority"
3699
+ ],
3700
+ signer: true
3701
+ }
3702
+ ],
3703
+ args: [
3704
+ {
3705
+ name: "key",
3706
+ type: {
3707
+ defined: {
3708
+ name: "ConfigKeyU8"
3709
+ }
3710
+ }
3711
+ },
3712
+ {
3713
+ name: "value",
3714
+ type: "u8"
3715
+ }
3716
+ ]
3717
+ },
3718
+ {
3719
+ name: "update_growth_parameters",
3720
+ discriminator: [
3721
+ 172,
3722
+ 187,
3723
+ 237,
3724
+ 233,
3725
+ 250,
3726
+ 160,
3727
+ 115,
3728
+ 239
3729
+ ],
3730
+ accounts: [
3731
+ {
3732
+ name: "admin",
3733
+ writable: true,
3734
+ signer: true
3735
+ },
3736
+ {
3737
+ name: "tranche_state",
3738
+ writable: true
3739
+ },
3740
+ {
3741
+ name: "price_history",
3742
+ writable: true
3743
+ },
3744
+ {
3745
+ name: "system_program"
3746
+ }
3747
+ ],
3748
+ args: [
3749
+ {
3750
+ name: "supply_growth_bps",
3751
+ type: "u16"
3752
+ },
3753
+ {
3754
+ name: "price_growth_bps",
3755
+ type: "u16"
3756
+ }
3757
+ ]
3758
+ },
3759
+ {
3760
+ name: "update_price_bounds",
3761
+ discriminator: [
3762
+ 241,
3763
+ 116,
3764
+ 141,
3765
+ 65,
3766
+ 61,
3767
+ 95,
3768
+ 232,
3769
+ 28
3770
+ ],
3771
+ accounts: [
3772
+ {
3773
+ name: "admin",
3774
+ writable: true,
3775
+ signer: true
3543
3776
  },
3544
3777
  {
3545
3778
  name: "tranche_state",
@@ -3556,11 +3789,11 @@ var instructions$3 = [
3556
3789
  args: [
3557
3790
  {
3558
3791
  name: "min_price_usd",
3559
- type: "i128"
3792
+ type: "u64"
3560
3793
  },
3561
3794
  {
3562
3795
  name: "max_price_usd",
3563
- type: "i128"
3796
+ type: "u64"
3564
3797
  },
3565
3798
  {
3566
3799
  name: "max_staleness_seconds",
@@ -3609,6 +3842,19 @@ var accounts$2 = [
3609
3842
  127
3610
3843
  ]
3611
3844
  },
3845
+ {
3846
+ name: "GlobalConfig",
3847
+ discriminator: [
3848
+ 149,
3849
+ 8,
3850
+ 156,
3851
+ 202,
3852
+ 160,
3853
+ 252,
3854
+ 176,
3855
+ 217
3856
+ ]
3857
+ },
3612
3858
  {
3613
3859
  name: "GlobalState",
3614
3860
  discriminator: [
@@ -4170,6 +4416,13 @@ var types$5 = [
4170
4416
  ],
4171
4417
  type: "u16"
4172
4418
  },
4419
+ {
4420
+ name: "leaderboard_scores_next_index",
4421
+ docs: [
4422
+ "Next leaderboard registry index to process for score sync"
4423
+ ],
4424
+ type: "u16"
4425
+ },
4173
4426
  {
4174
4427
  name: "removal_next_index",
4175
4428
  docs: [
@@ -4217,6 +4470,130 @@ var types$5 = [
4217
4470
  ]
4218
4471
  }
4219
4472
  },
4473
+ {
4474
+ name: "ConfigKeyBool",
4475
+ docs: [
4476
+ "Keys for bool config values (feature flags) - stored as bits in a u16",
4477
+ "Bit positions: 0=Deposits, 1=Withdrawals, 2=ClaimWithdrawals, 3=ProcessStake,",
4478
+ "4=ProcessUnstake, 5=ProcessPayCycle, 6=Rebalancing, 7-15=Reserved"
4479
+ ],
4480
+ type: {
4481
+ kind: "enum",
4482
+ variants: [
4483
+ {
4484
+ name: "DepositsEnabled"
4485
+ },
4486
+ {
4487
+ name: "WithdrawalsEnabled"
4488
+ },
4489
+ {
4490
+ name: "ClaimWithdrawalsEnabled"
4491
+ },
4492
+ {
4493
+ name: "ProcessStakeOrdersEnabled"
4494
+ },
4495
+ {
4496
+ name: "ProcessUnstakeOrdersEnabled"
4497
+ },
4498
+ {
4499
+ name: "ProcessPayCycleEnabled"
4500
+ },
4501
+ {
4502
+ name: "RebalancingEnabled"
4503
+ }
4504
+ ]
4505
+ }
4506
+ },
4507
+ {
4508
+ name: "ConfigKeyU16",
4509
+ docs: [
4510
+ "Keys for u16 config values (small counts, thresholds, ranks)"
4511
+ ],
4512
+ type: {
4513
+ kind: "enum",
4514
+ variants: [
4515
+ {
4516
+ name: "CooldownEpochs"
4517
+ },
4518
+ {
4519
+ name: "DepositFeeEpochsMultiplier"
4520
+ },
4521
+ {
4522
+ name: "MinVppEntry"
4523
+ },
4524
+ {
4525
+ name: "MinVppExit"
4526
+ },
4527
+ {
4528
+ name: "TinyNetworkThreshold"
4529
+ },
4530
+ {
4531
+ name: "SmallNetworkThreshold"
4532
+ },
4533
+ {
4534
+ name: "MediumNetworkThreshold"
4535
+ },
4536
+ {
4537
+ name: "LargeNetworkEntryRank"
4538
+ },
4539
+ {
4540
+ name: "LargeNetworkExitRank"
4541
+ }
4542
+ ]
4543
+ }
4544
+ },
4545
+ {
4546
+ name: "ConfigKeyU64",
4547
+ docs: [
4548
+ "Keys for u64 config values (large amounts, rates)"
4549
+ ],
4550
+ type: {
4551
+ kind: "enum",
4552
+ variants: [
4553
+ {
4554
+ name: "MinUserDeposit"
4555
+ },
4556
+ {
4557
+ name: "MinUnstakeRequest"
4558
+ },
4559
+ {
4560
+ name: "MinRebalanceStakeDelta"
4561
+ },
4562
+ {
4563
+ name: "MinRebalanceUnstakeDelta"
4564
+ },
4565
+ {
4566
+ name: "TransientThreshold"
4567
+ },
4568
+ {
4569
+ name: "MinLateEpochSlotGate"
4570
+ }
4571
+ ]
4572
+ }
4573
+ },
4574
+ {
4575
+ name: "ConfigKeyU8",
4576
+ docs: [
4577
+ "Keys for u8 config values (percentages 0-100)"
4578
+ ],
4579
+ type: {
4580
+ kind: "enum",
4581
+ variants: [
4582
+ {
4583
+ name: "SmallNetworkEntryPercent"
4584
+ },
4585
+ {
4586
+ name: "SmallNetworkExitPercent"
4587
+ },
4588
+ {
4589
+ name: "MediumNetworkEntryPercent"
4590
+ },
4591
+ {
4592
+ name: "MediumNetworkExitPercent"
4593
+ }
4594
+ ]
4595
+ }
4596
+ },
4220
4597
  {
4221
4598
  name: "DistributionState",
4222
4599
  type: {
@@ -4227,130 +4604,337 @@ var types$5 = [
4227
4604
  type: "pubkey"
4228
4605
  },
4229
4606
  {
4230
- name: "current_index",
4607
+ name: "current_index",
4608
+ type: "u64"
4609
+ },
4610
+ {
4611
+ name: "total_shares",
4612
+ docs: [
4613
+ "Sum of all user shares across the system"
4614
+ ],
4615
+ type: "u64"
4616
+ },
4617
+ {
4618
+ name: "last_bucket_balance",
4619
+ docs: [
4620
+ "Last observed bucket balance used for incremental index updates"
4621
+ ],
4622
+ type: "u64"
4623
+ },
4624
+ {
4625
+ name: "bump",
4626
+ type: "u8"
4627
+ },
4628
+ {
4629
+ name: "bucket_bump",
4630
+ docs: [
4631
+ "Cached bucket authority bump to avoid repeated find_program_address calls"
4632
+ ],
4633
+ type: "u8"
4634
+ },
4635
+ {
4636
+ name: "pool_bump",
4637
+ docs: [
4638
+ "Cached pool authority bump to avoid repeated find_program_address calls"
4639
+ ],
4640
+ type: "u8"
4641
+ },
4642
+ {
4643
+ name: "bucket_authority",
4644
+ docs: [
4645
+ "Cached bucket authority pubkey for transfer-hook optimization"
4646
+ ],
4647
+ type: "pubkey"
4648
+ },
4649
+ {
4650
+ name: "pool_authority",
4651
+ docs: [
4652
+ "Cached pool authority pubkey for transfer-hook optimization"
4653
+ ],
4654
+ type: "pubkey"
4655
+ }
4656
+ ]
4657
+ }
4658
+ },
4659
+ {
4660
+ name: "EpochResolved",
4661
+ type: {
4662
+ kind: "struct",
4663
+ fields: [
4664
+ {
4665
+ name: "validator",
4666
+ type: "pubkey"
4667
+ },
4668
+ {
4669
+ name: "epoch",
4670
+ type: "u64"
4671
+ },
4672
+ {
4673
+ name: "total_stake_amount",
4674
+ type: "u64"
4675
+ },
4676
+ {
4677
+ name: "max_index",
4678
+ type: "u32"
4679
+ }
4680
+ ]
4681
+ }
4682
+ },
4683
+ {
4684
+ name: "Global",
4685
+ docs: [
4686
+ "Global operator state. Epoch-based model: receipts are serviceable",
4687
+ "when `epoch <= serviceable_epoch` as reported by an external runtime."
4688
+ ],
4689
+ type: {
4690
+ kind: "struct",
4691
+ fields: [
4692
+ {
4693
+ name: "bump",
4694
+ type: "u8"
4695
+ },
4696
+ {
4697
+ name: "authority",
4698
+ docs: [
4699
+ "Authority that can update serviceable_epoch"
4700
+ ],
4701
+ type: "pubkey"
4702
+ },
4703
+ {
4704
+ name: "liqsol_mint",
4705
+ docs: [
4706
+ "Token-2022 liqSOL mint burned on withdraw."
4707
+ ],
4708
+ type: "pubkey"
4709
+ },
4710
+ {
4711
+ name: "serviceable_epoch",
4712
+ docs: [
4713
+ "Highest epoch that is currently claimable."
4714
+ ],
4715
+ type: "u64"
4716
+ },
4717
+ {
4718
+ name: "total_encumbered_funds",
4719
+ docs: [
4720
+ "Total SOL encumbered for pending withdrawal requests.",
4721
+ "This amount is reserved from the reserve pool and will be paid out when receipts are claimed."
4722
+ ],
4723
+ type: "u64"
4724
+ },
4725
+ {
4726
+ name: "next_receipt_id",
4727
+ docs: [
4728
+ "Monotonic counter for generating unique receipt IDs"
4729
+ ],
4730
+ type: "u64"
4731
+ }
4732
+ ]
4733
+ }
4734
+ },
4735
+ {
4736
+ name: "GlobalConfig",
4737
+ docs: [
4738
+ "Zero-copy global config PDA",
4739
+ "Authority is taken from StakeControllerState, not stored here"
4740
+ ],
4741
+ serialization: "bytemuckunsafe",
4742
+ repr: {
4743
+ kind: "c"
4744
+ },
4745
+ type: {
4746
+ kind: "struct",
4747
+ fields: [
4748
+ {
4749
+ name: "bump",
4750
+ type: "u8"
4751
+ },
4752
+ {
4753
+ name: "_padding",
4754
+ type: {
4755
+ array: [
4756
+ "u8",
4757
+ 7
4758
+ ]
4759
+ }
4760
+ },
4761
+ {
4762
+ name: "min_user_deposit",
4763
+ docs: [
4764
+ "Minimum SOL amount a user can deposit"
4765
+ ],
4766
+ type: "u64"
4767
+ },
4768
+ {
4769
+ name: "min_unstake_request",
4770
+ docs: [
4771
+ "Minimum SOL amount for an unstake/withdrawal request"
4772
+ ],
4773
+ type: "u64"
4774
+ },
4775
+ {
4776
+ name: "min_rebalance_stake_delta",
4777
+ docs: [
4778
+ "Minimum stake delta to trigger a stake rebalance order"
4779
+ ],
4780
+ type: "u64"
4781
+ },
4782
+ {
4783
+ name: "min_rebalance_unstake_delta",
4784
+ docs: [
4785
+ "Minimum unstake delta to trigger an unstake rebalance order"
4786
+ ],
4231
4787
  type: "u64"
4232
4788
  },
4233
4789
  {
4234
- name: "total_shares",
4790
+ name: "transient_threshold",
4235
4791
  docs: [
4236
- "Sum of all user shares across the system"
4792
+ "Minimum transient stake to include in effective stake calculations"
4237
4793
  ],
4238
4794
  type: "u64"
4239
4795
  },
4240
4796
  {
4241
- name: "last_bucket_balance",
4797
+ name: "min_late_epoch_slot_gate",
4242
4798
  docs: [
4243
- "Last observed bucket balance used for incremental index updates"
4799
+ "Minimum slots that must have elapsed in the epoch before late epoch operations can execute"
4244
4800
  ],
4245
4801
  type: "u64"
4246
4802
  },
4247
4803
  {
4248
- name: "bump",
4249
- type: "u8"
4804
+ name: "_reserved_u64",
4805
+ type: {
4806
+ array: [
4807
+ "u64",
4808
+ 2
4809
+ ]
4810
+ }
4250
4811
  },
4251
4812
  {
4252
- name: "bucket_bump",
4813
+ name: "cooldown_epochs",
4253
4814
  docs: [
4254
- "Cached bucket authority bump to avoid repeated find_program_address calls"
4815
+ "Epochs a validator must wait in the graveyard before it is booted. This begins after the last recorded state change"
4255
4816
  ],
4256
- type: "u8"
4817
+ type: "u16"
4257
4818
  },
4258
4819
  {
4259
- name: "pool_bump",
4820
+ name: "deposit_fee_multiplier",
4260
4821
  docs: [
4261
- "Cached pool authority bump to avoid repeated find_program_address calls"
4822
+ "Multiplier for deposit fee calculation, this would be average \"pay rate x number of epochs we expect the stake to warm up\""
4262
4823
  ],
4263
- type: "u8"
4824
+ type: "u16"
4264
4825
  },
4265
4826
  {
4266
- name: "bucket_authority",
4827
+ name: "min_vpp_entry",
4267
4828
  docs: [
4268
- "Cached bucket authority pubkey for transfer-hook optimization"
4829
+ "Minimum VPP score required to enter the active validator set, this is a fall back for when the val set is really small"
4269
4830
  ],
4270
- type: "pubkey"
4831
+ type: "u16"
4271
4832
  },
4272
4833
  {
4273
- name: "pool_authority",
4834
+ name: "min_vpp_exit",
4274
4835
  docs: [
4275
- "Cached pool authority pubkey for transfer-hook optimization"
4836
+ "VPP score threshold below which a validator is removed from active set, again a fall back"
4276
4837
  ],
4277
- type: "pubkey"
4278
- }
4279
- ]
4280
- }
4281
- },
4282
- {
4283
- name: "EpochResolved",
4284
- type: {
4285
- kind: "struct",
4286
- fields: [
4838
+ type: "u16"
4839
+ },
4287
4840
  {
4288
- name: "validator",
4289
- type: "pubkey"
4841
+ name: "tiny_network_threshold",
4842
+ docs: [
4843
+ "Max validators for \"tiny\" network band (uses fixed VPP thresholds) as above"
4844
+ ],
4845
+ type: "u16"
4290
4846
  },
4291
4847
  {
4292
- name: "epoch",
4293
- type: "u64"
4848
+ name: "small_network_threshold",
4849
+ docs: [
4850
+ "Max validators for \"small\" network band (uses percentile-based selection)"
4851
+ ],
4852
+ type: "u16"
4294
4853
  },
4295
4854
  {
4296
- name: "total_stake_amount",
4297
- type: "u64"
4855
+ name: "medium_network_threshold",
4856
+ docs: [
4857
+ "Max validators for \"medium\" network band (uses percentile-based selection)"
4858
+ ],
4859
+ type: "u16"
4298
4860
  },
4299
4861
  {
4300
- name: "max_index",
4301
- type: "u32"
4302
- }
4303
- ]
4304
- }
4305
- },
4306
- {
4307
- name: "Global",
4308
- docs: [
4309
- "Global operator state. Epoch-based model: receipts are serviceable",
4310
- "when `epoch <= serviceable_epoch` as reported by an external runtime."
4311
- ],
4312
- type: {
4313
- kind: "struct",
4314
- fields: [
4862
+ name: "large_network_entry_rank",
4863
+ docs: [
4864
+ "Fixed rank threshold to enter active set in large networks (0-indexed)"
4865
+ ],
4866
+ type: "u16"
4867
+ },
4315
4868
  {
4316
- name: "bump",
4317
- type: "u8"
4869
+ name: "large_network_exit_rank",
4870
+ docs: [
4871
+ "Fixed rank threshold to exit active set in large networks (0-indexed)"
4872
+ ],
4873
+ type: "u16"
4318
4874
  },
4319
4875
  {
4320
- name: "authority",
4876
+ name: "_reserved_u16",
4877
+ type: {
4878
+ array: [
4879
+ "u16",
4880
+ 3
4881
+ ]
4882
+ }
4883
+ },
4884
+ {
4885
+ name: "small_network_entry_percent",
4321
4886
  docs: [
4322
- "Authority that can update serviceable_epoch"
4887
+ "Percentile rank required to enter active set in small networks"
4323
4888
  ],
4324
- type: "pubkey"
4889
+ type: "u8"
4325
4890
  },
4326
4891
  {
4327
- name: "liqsol_mint",
4892
+ name: "small_network_exit_percent",
4328
4893
  docs: [
4329
- "Token-2022 liqSOL mint burned on withdraw."
4894
+ "Percentile rank below which validators exit in small networks"
4330
4895
  ],
4331
- type: "pubkey"
4896
+ type: "u8"
4332
4897
  },
4333
4898
  {
4334
- name: "serviceable_epoch",
4899
+ name: "medium_network_entry_percent",
4335
4900
  docs: [
4336
- "Highest epoch that is currently claimable."
4901
+ "Percentile rank required to enter active set in medium networks"
4337
4902
  ],
4338
- type: "u64"
4903
+ type: "u8"
4339
4904
  },
4340
4905
  {
4341
- name: "total_encumbered_funds",
4906
+ name: "medium_network_exit_percent",
4342
4907
  docs: [
4343
- "Total SOL encumbered for pending withdrawal requests.",
4344
- "This amount is reserved from the reserve pool and will be paid out when receipts are claimed."
4908
+ "Percentile rank below which validators exit in medium networks"
4345
4909
  ],
4346
- type: "u64"
4910
+ type: "u8"
4347
4911
  },
4348
4912
  {
4349
- name: "next_receipt_id",
4913
+ name: "_reserved_u8",
4914
+ type: {
4915
+ array: [
4916
+ "u8",
4917
+ 2
4918
+ ]
4919
+ }
4920
+ },
4921
+ {
4922
+ name: "feature_flags",
4350
4923
  docs: [
4351
- "Monotonic counter for generating unique receipt IDs"
4924
+ "Bit 0: DepositsEnabled, Bit 1: WithdrawalsEnabled, Bit 2: ClaimWithdrawalsEnabled,",
4925
+ "Bit 3: ProcessStakeOrdersEnabled, Bit 4: ProcessUnstakeOrdersEnabled,",
4926
+ "Bit 5: ProcessPayCycleEnabled, Bit 6: RebalancingEnabled, Bits 7-15: Reserved"
4352
4927
  ],
4353
- type: "u64"
4928
+ type: "u16"
4929
+ },
4930
+ {
4931
+ name: "_reserved_flags",
4932
+ type: {
4933
+ array: [
4934
+ "u16",
4935
+ 1
4936
+ ]
4937
+ }
4354
4938
  }
4355
4939
  ]
4356
4940
  }
@@ -4621,6 +5205,10 @@ var types$5 = [
4621
5205
  name: "last_validator_score_sync_epoch",
4622
5206
  type: "u16"
4623
5207
  },
5208
+ {
5209
+ name: "last_leaderboard_scores_sync_epoch",
5210
+ type: "u16"
5211
+ },
4624
5212
  {
4625
5213
  name: "last_active_infos_synced_epoch",
4626
5214
  type: "u16"
@@ -4910,7 +5498,7 @@ var types$5 = [
4910
5498
  },
4911
5499
  {
4912
5500
  name: "pretokens_purchased",
4913
- type: "i128"
5501
+ type: "u64"
4914
5502
  }
4915
5503
  ]
4916
5504
  }
@@ -4938,7 +5526,7 @@ var types$5 = [
4938
5526
  ],
4939
5527
  type: {
4940
5528
  array: [
4941
- "i128",
5529
+ "u64",
4942
5530
  10
4943
5531
  ]
4944
5532
  }
@@ -5114,6 +5702,30 @@ var types$5 = [
5114
5702
  ],
5115
5703
  type: "u64"
5116
5704
  },
5705
+ {
5706
+ name: "is_small_distribution_mode",
5707
+ docs: [
5708
+ "Whether we're in small distribution mode (not enough for VPP-based distribution)",
5709
+ "In this mode, we distribute evenly to first N validators instead of using VPP ratios"
5710
+ ],
5711
+ type: "bool"
5712
+ },
5713
+ {
5714
+ name: "validators_to_fund_this_rebalance",
5715
+ docs: [
5716
+ "Number of validators to fund in small distribution mode",
5717
+ "Calculated as floor(total_to_distribute / MIN_STAKE_DELEGATION)"
5718
+ ],
5719
+ type: "u16"
5720
+ },
5721
+ {
5722
+ name: "amount_per_validator_this_rebalance",
5723
+ docs: [
5724
+ "Amount each validator gets in small distribution mode",
5725
+ "Calculated as total_to_distribute / validators_to_fund"
5726
+ ],
5727
+ type: "u64"
5728
+ },
5117
5729
  {
5118
5730
  name: "selection_entry_threshold_vpp",
5119
5731
  docs: [
@@ -5290,8 +5902,7 @@ var types$5 = [
5290
5902
  {
5291
5903
  name: "TrancheState",
5292
5904
  docs: [
5293
- "All i128 values use 8-decimal precision (SCALE = 1e8 = 100,000,000)",
5294
- "This matches Chainlink SOL/USD's native format, avoiding conversion overhead",
5905
+ "All u64 values use 8-decimal precision (SCALE = 1e8 = 100,000,000)",
5295
5906
  "Example: $193.32 is stored as 19332000000"
5296
5907
  ],
5297
5908
  type: {
@@ -5310,19 +5921,19 @@ var types$5 = [
5310
5921
  },
5311
5922
  {
5312
5923
  name: "current_tranche_supply",
5313
- type: "i128"
5924
+ type: "u64"
5314
5925
  },
5315
5926
  {
5316
5927
  name: "current_tranche_price_usd",
5317
- type: "i128"
5928
+ type: "u64"
5318
5929
  },
5319
5930
  {
5320
5931
  name: "total_pretokens_sold",
5321
- type: "i128"
5932
+ type: "u64"
5322
5933
  },
5323
5934
  {
5324
5935
  name: "initial_tranche_supply",
5325
- type: "i128"
5936
+ type: "u64"
5326
5937
  },
5327
5938
  {
5328
5939
  name: "supply_growth_bps",
@@ -5343,14 +5954,14 @@ var types$5 = [
5343
5954
  docs: [
5344
5955
  "Minimum valid SOL/USD price for validation (8-dec)"
5345
5956
  ],
5346
- type: "i128"
5957
+ type: "u64"
5347
5958
  },
5348
5959
  {
5349
5960
  name: "max_price_usd",
5350
5961
  docs: [
5351
5962
  "Maximum valid SOL/USD price for validation (8-dec)"
5352
5963
  ],
5353
- type: "i128"
5964
+ type: "u64"
5354
5965
  },
5355
5966
  {
5356
5967
  name: "max_staleness_seconds",
@@ -5395,7 +6006,7 @@ var types$5 = [
5395
6006
  },
5396
6007
  {
5397
6008
  name: "total_pretokens_purchased",
5398
- type: "i128"
6009
+ type: "u64"
5399
6010
  },
5400
6011
  {
5401
6012
  name: "last_tranche_number",
@@ -5403,7 +6014,7 @@ var types$5 = [
5403
6014
  },
5404
6015
  {
5405
6016
  name: "last_tranche_price_usd",
5406
- type: "i128"
6017
+ type: "u64"
5407
6018
  },
5408
6019
  {
5409
6020
  name: "bump",
@@ -5931,7 +6542,7 @@ var liqsolCoreIDL = {
5931
6542
  types: types$5
5932
6543
  };
5933
6544
 
5934
- var address$2 = "6hiJ8PrSyYLr7H9MA9VYh9fvGoHxZ2TXdDAMzjeUVSXZ";
6545
+ var address$2 = "5MRFSLCkXPEzfR6gkcZCVttq9g83mMUHyTZ85Z3TSpvU";
5935
6546
  var metadata$2 = {
5936
6547
  name: "liqsol_token",
5937
6548
  version: "0.1.0",
@@ -6120,7 +6731,7 @@ var liqsolTokenJson = {
6120
6731
  types: types$4
6121
6732
  };
6122
6733
 
6123
- var address$1 = "H6CWj2PgxCE9Z5dPi9nMrR2VxT1C4DQcqR1QjmLeon47";
6734
+ var address$1 = "5v7mWL1735qp2Th9B5WNf7spGynR5ZaxwyCYoQw13DP2";
6124
6735
  var metadata$1 = {
6125
6736
  name: "validator_leaderboard",
6126
6737
  version: "0.1.0",
@@ -6242,6 +6853,9 @@ var instructions$1 = [
6242
6853
  },
6243
6854
  {
6244
6855
  name: "system_program"
6856
+ },
6857
+ {
6858
+ name: "clock"
6245
6859
  }
6246
6860
  ],
6247
6861
  args: [
@@ -6849,7 +7463,7 @@ var validatorLeaderboardJson = {
6849
7463
  types: types$3
6850
7464
  };
6851
7465
 
6852
- var address = "EtqCLddkPNGjkgiH9rVUmK3M5X2FKFprQvgscBJ8g6hX";
7466
+ var address = "HbBpH9opFW9gcYVanHLweKuHhWQ8P3Kcc1mbpAx1vojz";
6853
7467
  var metadata = {
6854
7468
  name: "transfer_hook",
6855
7469
  version: "0.1.0",
@@ -6974,6 +7588,11 @@ var errors = [
6974
7588
  {
6975
7589
  code: 6002,
6976
7590
  name: "TlvAccountResolutionError"
7591
+ },
7592
+ {
7593
+ code: 6003,
7594
+ name: "CannotTransferToBucket",
7595
+ msg: "Cannot transfer liqSOL directly to bucket - only protocol minting is allowed"
6977
7596
  }
6978
7597
  ];
6979
7598
  var types$2 = [
@@ -7082,6 +7701,7 @@ const {
7082
7701
  TRANSFER_HOOK
7083
7702
  } = PROGRAM_IDS;
7084
7703
  const PDA_SEEDS = {
7704
+ GLOBAL_CONFIG: "global_config",
7085
7705
  DEPOSIT_AUTHORITY: "deposit_authority",
7086
7706
  VAULT: "vault",
7087
7707
  RESERVE_POOL: "reserve_pool",
@@ -7115,6 +7735,10 @@ const PDA_SEEDS = {
7115
7735
  LIQ_RECEIPT_DATA: "liq_receipt_data",
7116
7736
  WITHDRAW_MINT: "mint"
7117
7737
  };
7738
+ const deriveGlobalConfigPda = () => web3_js.PublicKey.findProgramAddressSync(
7739
+ [Buffer.from(PDA_SEEDS.GLOBAL_CONFIG)],
7740
+ LIQSOL_CORE
7741
+ )[0];
7118
7742
  const deriveLiqsolMintPda = () => web3_js.PublicKey.findProgramAddressSync(
7119
7743
  [Buffer.from(PDA_SEEDS.LIQSOL_MINT)],
7120
7744
  LIQSOL_TOKEN
@@ -7365,6 +7989,7 @@ class DepositClient {
7365
7989
  const payoutState = derivePayoutStatePda();
7366
7990
  const bucketAuthority = deriveBucketAuthorityPda();
7367
7991
  const payRateHistory = derivePayRateHistoryPda();
7992
+ const globalConfig = deriveGlobalConfigPda();
7368
7993
  const userAta = splToken.getAssociatedTokenAddressSync(
7369
7994
  liqsolMint,
7370
7995
  user,
@@ -7405,7 +8030,8 @@ class DepositClient {
7405
8030
  instructionsSysvar: web3_js.SYSVAR_INSTRUCTIONS_PUBKEY,
7406
8031
  clock: web3_js.SYSVAR_CLOCK_PUBKEY,
7407
8032
  stakeHistory: web3_js.SYSVAR_STAKE_HISTORY_PUBKEY,
7408
- rent: web3_js.SYSVAR_RENT_PUBKEY
8033
+ rent: web3_js.SYSVAR_RENT_PUBKEY,
8034
+ globalConfig
7409
8035
  }).instruction();
7410
8036
  return new web3_js.Transaction().add(ix);
7411
8037
  });
@@ -7436,6 +8062,7 @@ class DepositClient {
7436
8062
  const stakeAllocationState = deriveStakeAllocationStatePda();
7437
8063
  const stakeMetrics = deriveStakeMetricsPda();
7438
8064
  const maintenanceLedger = deriveMaintenanceLedgerPda();
8065
+ const globalConfig = deriveGlobalConfigPda();
7439
8066
  const globalState = yield this.program.account.global.fetch(global);
7440
8067
  const receiptId = globalState.nextReceiptId.toBigInt();
7441
8068
  const mintAuthority = deriveWithdrawMintAuthorityPda();
@@ -7479,7 +8106,8 @@ class DepositClient {
7479
8106
  tokenInterface: splToken.TOKEN_2022_PROGRAM_ID,
7480
8107
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
7481
8108
  systemProgram: web3_js.SystemProgram.programId,
7482
- rent: web3_js.SYSVAR_RENT_PUBKEY
8109
+ rent: web3_js.SYSVAR_RENT_PUBKEY,
8110
+ globalConfig
7483
8111
  }).instruction();
7484
8112
  return new web3_js.Transaction().add(ix);
7485
8113
  });
@@ -8565,7 +9193,7 @@ class SolanaStakingClient {
8565
9193
  }
8566
9194
  deposit(amountLamports) {
8567
9195
  return __async$8(this, null, function* () {
8568
- this.ensureWriteAccess();
9196
+ this.ensureUser();
8569
9197
  if (amountLamports <= BigInt(0)) {
8570
9198
  throw new Error("Deposit amount must be greater than zero.");
8571
9199
  }
@@ -8580,7 +9208,7 @@ class SolanaStakingClient {
8580
9208
  }
8581
9209
  withdraw(amountLamports) {
8582
9210
  return __async$8(this, null, function* () {
8583
- this.ensureWriteAccess();
9211
+ this.ensureUser();
8584
9212
  if (amountLamports <= BigInt(0)) {
8585
9213
  throw new Error("Withdraw amount must be greater than zero.");
8586
9214
  }
@@ -8595,13 +9223,14 @@ class SolanaStakingClient {
8595
9223
  }
8596
9224
  stake(amountLamports) {
8597
9225
  return __async$8(this, null, function* () {
8598
- this.ensureWriteAccess();
9226
+ this.ensureUser();
8599
9227
  if (!amountLamports || amountLamports <= BigInt(0)) {
8600
9228
  throw new Error("Stake amount must be greater than zero.");
8601
9229
  }
8602
9230
  const user = this.solPubKey;
9231
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8603
9232
  const ix = yield this.outpostClient.buildStakeIx(amountLamports, user);
8604
- const tx = new web3_js.Transaction().add(ix);
9233
+ const tx = new web3_js.Transaction().add(cuIx, ix);
8605
9234
  const prepared = yield this.prepareTx(tx);
8606
9235
  const signed = yield this.signTransaction(prepared.tx);
8607
9236
  return this.sendAndConfirmHttp(signed, prepared);
@@ -8609,13 +9238,14 @@ class SolanaStakingClient {
8609
9238
  }
8610
9239
  unstake(amountLamports) {
8611
9240
  return __async$8(this, null, function* () {
8612
- this.ensureWriteAccess();
9241
+ this.ensureUser();
8613
9242
  if (!amountLamports || amountLamports <= BigInt(0)) {
8614
9243
  throw new Error("Unstake amount must be greater than zero.");
8615
9244
  }
8616
9245
  const user = this.solPubKey;
9246
+ const cuIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 });
8617
9247
  const ix = yield this.outpostClient.buildUnstakeIx(amountLamports, user);
8618
- const tx = new web3_js.Transaction().add(ix);
9248
+ const tx = new web3_js.Transaction().add(cuIx, ix);
8619
9249
  const prepared = yield this.prepareTx(tx);
8620
9250
  const signed = yield this.signTransaction(prepared.tx);
8621
9251
  return this.sendAndConfirmHttp(signed, prepared);
@@ -8623,7 +9253,7 @@ class SolanaStakingClient {
8623
9253
  }
8624
9254
  buy(amountLamports) {
8625
9255
  return __async$8(this, null, function* () {
8626
- this.ensureWriteAccess();
9256
+ this.ensureUser();
8627
9257
  if (!amountLamports || amountLamports <= BigInt(0)) {
8628
9258
  throw new Error("liqSOL pretoken purchase requires a positive amount.");
8629
9259
  }
@@ -8674,12 +9304,12 @@ class SolanaStakingClient {
8674
9304
  const currentIndex = BigInt(currentIndexStr);
8675
9305
  const totalShares = BigInt(totalSharesStr);
8676
9306
  const userShares = BigInt(userSharesStr);
8677
- let estimatedClaimLiqsol = BigInt(0);
8678
- let estimatedYieldLiqsol = BigInt(0);
9307
+ let estimatedClaim = BigInt(0);
9308
+ let estimatedYield = BigInt(0);
8679
9309
  if (userShares > BigInt(0) && currentIndex > BigInt(0)) {
8680
- estimatedClaimLiqsol = userShares * currentIndex / INDEX_SCALE$1;
8681
- if (estimatedClaimLiqsol > stakedLiqsol) {
8682
- estimatedYieldLiqsol = estimatedClaimLiqsol - stakedLiqsol;
9310
+ estimatedClaim = userShares * currentIndex / INDEX_SCALE$1;
9311
+ if (estimatedClaim > stakedLiqsol) {
9312
+ estimatedYield = estimatedClaim - stakedLiqsol;
8683
9313
  }
8684
9314
  }
8685
9315
  return {
@@ -8709,8 +9339,8 @@ class SolanaStakingClient {
8709
9339
  indexScale: INDEX_SCALE$1,
8710
9340
  totalShares,
8711
9341
  userShares,
8712
- estimatedClaimLiqsol,
8713
- estimatedYieldLiqsol
9342
+ estimatedClaim,
9343
+ estimatedYield
8714
9344
  },
8715
9345
  extras: {
8716
9346
  userLiqsolAta: userLiqsolAta.toBase58(),
@@ -8725,6 +9355,18 @@ class SolanaStakingClient {
8725
9355
  };
8726
9356
  });
8727
9357
  }
9358
+ getUserRecord() {
9359
+ return __async$8(this, null, function* () {
9360
+ if (!this.pubKey) throw new Error("User pubKey is undefined");
9361
+ return this.distributionClient.getUserRecord(this.solPubKey);
9362
+ });
9363
+ }
9364
+ getSystemAPY() {
9365
+ return Promise.resolve(0);
9366
+ }
9367
+ getDepositFee(amount) {
9368
+ return Promise.resolve(amount * BigInt(1) / BigInt(100));
9369
+ }
8728
9370
  getTrancheSnapshot(options) {
8729
9371
  return __async$8(this, null, function* () {
8730
9372
  const {
@@ -8748,15 +9390,9 @@ class SolanaStakingClient {
8748
9390
  });
8749
9391
  });
8750
9392
  }
8751
- getUserRecord() {
8752
- return __async$8(this, null, function* () {
8753
- if (!this.pubKey) throw new Error("User pubKey is undefined");
8754
- return this.distributionClient.getUserRecord(this.solPubKey);
8755
- });
8756
- }
8757
9393
  sendAndConfirmHttp(signed, ctx) {
8758
9394
  return __async$8(this, null, function* () {
8759
- this.ensureWriteAccess();
9395
+ this.ensureUser();
8760
9396
  const signature = yield this.connection.sendRawTransaction(
8761
9397
  signed.serialize(),
8762
9398
  {
@@ -8783,13 +9419,13 @@ class SolanaStakingClient {
8783
9419
  }
8784
9420
  signTransaction(tx) {
8785
9421
  return __async$8(this, null, function* () {
8786
- this.ensureWriteAccess();
9422
+ this.ensureUser();
8787
9423
  return this.anchor.wallet.signTransaction(tx);
8788
9424
  });
8789
9425
  }
8790
9426
  sendTransaction(signed) {
8791
9427
  return __async$8(this, null, function* () {
8792
- this.ensureWriteAccess();
9428
+ this.ensureUser();
8793
9429
  return this.anchor.sendAndConfirm(signed);
8794
9430
  });
8795
9431
  }
@@ -8801,7 +9437,7 @@ class SolanaStakingClient {
8801
9437
  return { tx, blockhash, lastValidBlockHeight };
8802
9438
  });
8803
9439
  }
8804
- ensureWriteAccess() {
9440
+ ensureUser() {
8805
9441
  if (!this.pubKey || !this.anchor.wallet.publicKey) {
8806
9442
  throw new Error("User Authorization required: pubKey is undefined");
8807
9443
  }
@@ -29640,8 +30276,12 @@ class EthereumStakingClient {
29640
30276
  constructor(config) {
29641
30277
  this.config = config;
29642
30278
  try {
29643
- this.provider = config.provider;
29644
- this.signer = this.provider.getSigner();
30279
+ if (config.provider) {
30280
+ this.provider = config.provider;
30281
+ this.signer = this.provider.getSigner();
30282
+ } else {
30283
+ this.provider = new ethers.ethers.providers.JsonRpcProvider(config.network.rpcUrls[0]);
30284
+ }
29645
30285
  this.pubKey = config.pubKey;
29646
30286
  this.contractService = new EthereumContractService({
29647
30287
  provider: this.provider,
@@ -29664,6 +30304,7 @@ class EthereumStakingClient {
29664
30304
  }
29665
30305
  deposit(amount) {
29666
30306
  return __async(this, null, function* () {
30307
+ this.ensureUser();
29667
30308
  const amountWei = ethers.BigNumber.isBigNumber(amount) ? amount : ethers.BigNumber.from(amount);
29668
30309
  const result = yield this.convertClient.performDeposit(amountWei);
29669
30310
  return result.txHash;
@@ -29671,6 +30312,7 @@ class EthereumStakingClient {
29671
30312
  }
29672
30313
  withdraw(amount) {
29673
30314
  return __async(this, null, function* () {
30315
+ this.ensureUser();
29674
30316
  const address = yield this.signer.getAddress();
29675
30317
  const amountWei = ethers.BigNumber.from(amount);
29676
30318
  const result = yield this.convertClient.performWithdraw(address, amountWei);
@@ -29679,6 +30321,7 @@ class EthereumStakingClient {
29679
30321
  }
29680
30322
  stake(amount) {
29681
30323
  return __async(this, null, function* () {
30324
+ this.ensureUser();
29682
30325
  const walletAddress = yield this.signer.getAddress();
29683
30326
  const amountWei = ethers.BigNumber.from(amount);
29684
30327
  const result = yield this.stakeClient.performStake(amountWei, walletAddress);
@@ -29692,6 +30335,7 @@ class EthereumStakingClient {
29692
30335
  }
29693
30336
  unstakePrelaunch(tokenId, recipient) {
29694
30337
  return __async(this, null, function* () {
30338
+ this.ensureUser();
29695
30339
  const tokenIdBigNum = ethers.BigNumber.from(tokenId);
29696
30340
  const result = yield this.stakeClient.performWithdrawStake(tokenIdBigNum, recipient);
29697
30341
  return result.txHash;
@@ -29699,44 +30343,17 @@ class EthereumStakingClient {
29699
30343
  }
29700
30344
  buy(amount) {
29701
30345
  return __async(this, null, function* () {
30346
+ this.ensureUser();
29702
30347
  const buyer = yield this.signer.getAddress();
29703
30348
  yield this.updateMockAggregatorPrice();
29704
30349
  let result = yield this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
29705
30350
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
29706
30351
  });
29707
30352
  }
29708
- getOPPMessages(address) {
29709
- return __async(this, null, function* () {
29710
- if (!address) address = yield this.signer.getAddress();
29711
- return yield this.oppClient.getMessages(address);
29712
- });
29713
- }
29714
- getOPPStatus() {
29715
- return __async(this, null, function* () {
29716
- return yield this.oppClient.getStatus();
29717
- });
29718
- }
29719
- fetchPrelaunchReceipts(address) {
29720
- return __async(this, null, function* () {
29721
- if (address === void 0) address = yield this.signer.getAddress();
29722
- return yield this.receiptClient.stakeReceipts(address);
29723
- });
29724
- }
29725
- getEthStats() {
29726
- return __async(this, null, function* () {
29727
- let withdrawDelay = yield this.contract.DepositManager.withdrawDelay();
29728
- let minDeposit = yield this.contract.DepositManager.minDeposit();
29729
- let rewardCooldown = yield this.contract.DepositManager.rewardCooldown();
29730
- return {
29731
- withdrawDelay,
29732
- minDeposit,
29733
- rewardCooldown
29734
- };
29735
- });
29736
- }
29737
30353
  getPortfolio() {
29738
30354
  return __async(this, null, function* () {
29739
30355
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
30356
+ this.ensureUser();
29740
30357
  const walletAddress = yield this.signer.getAddress();
29741
30358
  const nativeBalance = yield this.provider.getBalance(walletAddress);
29742
30359
  const nativeDecimals = (_c = (_b = (_a = this.network) == null ? void 0 : _a.nativeCurrency) == null ? void 0 : _b.decimals) != null ? _c : 18;
@@ -29748,7 +30365,28 @@ class EthereumStakingClient {
29748
30365
  for (let r of stakeReceipts) {
29749
30366
  stakeBalanceBN = stakeBalanceBN.add(ethers.BigNumber.from(r.receipt.principal.amount));
29750
30367
  }
30368
+ let stakeSharesBN = ethers.BigNumber.from(0);
30369
+ for (let r of stakeReceipts) {
30370
+ stakeSharesBN = stakeSharesBN.add(ethers.BigNumber.from(r.receipt.shares.amount));
30371
+ }
29751
30372
  const wireBalance = yield this.contract.Pretoken.balanceOf(walletAddress);
30373
+ let currentIndex = BigInt(0);
30374
+ let totalShares = BigInt(0);
30375
+ let userShares = BigInt(0);
30376
+ const indexScale = BigInt(1e27);
30377
+ try {
30378
+ const [indexBn, totalSharesBn] = yield Promise.all([
30379
+ this.contract.Depositor.index().catch(() => ethers.BigNumber.from(0)),
30380
+ this.contract.Depositor.totalShares().catch(() => ethers.BigNumber.from(0))
30381
+ ]);
30382
+ const userSharesBn = stakeSharesBN;
30383
+ currentIndex = BigInt(indexBn.toString());
30384
+ totalShares = BigInt(totalSharesBn.toString());
30385
+ userShares = BigInt(userSharesBn.toString());
30386
+ } catch (e) {
30387
+ }
30388
+ let estimatedClaim = BigInt(0);
30389
+ let estimatedYield = BigInt(0);
29752
30390
  const portfolio = {
29753
30391
  native: {
29754
30392
  amount: nativeBalance.toBigInt(),
@@ -29770,11 +30408,69 @@ class EthereumStakingClient {
29770
30408
  decimals: 18,
29771
30409
  symbol: "$WIRE"
29772
30410
  },
30411
+ yield: {
30412
+ currentIndex,
30413
+ indexScale,
30414
+ totalShares,
30415
+ userShares,
30416
+ estimatedClaim,
30417
+ estimatedYield
30418
+ },
29773
30419
  chainID: this.network.chainId
29774
30420
  };
29775
30421
  return portfolio;
29776
30422
  });
29777
30423
  }
30424
+ fetchPrelaunchReceipts(address) {
30425
+ return __async(this, null, function* () {
30426
+ this.ensureUser();
30427
+ if (address === void 0) address = yield this.signer.getAddress();
30428
+ return yield this.receiptClient.stakeReceipts(address);
30429
+ });
30430
+ }
30431
+ getOPPMessages(address) {
30432
+ return __async(this, null, function* () {
30433
+ this.ensureUser();
30434
+ if (!address) address = yield this.signer.getAddress();
30435
+ return yield this.oppClient.getMessages(address);
30436
+ });
30437
+ }
30438
+ ensureUser() {
30439
+ if (!this.signer) {
30440
+ throw new Error(
30441
+ "EthereumStakingClient: write operation requires a wallet-connected Web3 provider"
30442
+ );
30443
+ }
30444
+ }
30445
+ getSystemAPY() {
30446
+ return __async(this, null, function* () {
30447
+ const annualBpsBn = yield this.contract.DepositManager.dailyRateBPS();
30448
+ return annualBpsBn.toNumber() / 1e4;
30449
+ });
30450
+ }
30451
+ getDepositFee(amountWei) {
30452
+ return __async(this, null, function* () {
30453
+ const feeBn = yield this.contract.DepositManager.procFee(amountWei);
30454
+ return BigInt(feeBn.toString());
30455
+ });
30456
+ }
30457
+ getOPPStatus() {
30458
+ return __async(this, null, function* () {
30459
+ return yield this.oppClient.getStatus();
30460
+ });
30461
+ }
30462
+ getEthStats() {
30463
+ return __async(this, null, function* () {
30464
+ let withdrawDelay = yield this.contract.DepositManager.withdrawDelay();
30465
+ let minDeposit = yield this.contract.DepositManager.minDeposit();
30466
+ let rewardCooldown = yield this.contract.DepositManager.rewardCooldown();
30467
+ return {
30468
+ withdrawDelay,
30469
+ minDeposit,
30470
+ rewardCooldown
30471
+ };
30472
+ });
30473
+ }
29778
30474
  getTrancheSnapshot(options) {
29779
30475
  return __async(this, null, function* () {
29780
30476
  const {
@@ -29963,6 +30659,7 @@ exports.deriveDepositAuthorityPda = deriveDepositAuthorityPda;
29963
30659
  exports.deriveDistributionStatePda = deriveDistributionStatePda;
29964
30660
  exports.deriveEphemeralStakeAddress = deriveEphemeralStakeAddress;
29965
30661
  exports.deriveExtraAccountMetaListPda = deriveExtraAccountMetaListPda;
30662
+ exports.deriveGlobalConfigPda = deriveGlobalConfigPda;
29966
30663
  exports.deriveLeaderboardStatePda = deriveLeaderboardStatePda;
29967
30664
  exports.deriveLiqReceiptDataPda = deriveLiqReceiptDataPda;
29968
30665
  exports.deriveLiqsolMintAuthorityPda = deriveLiqsolMintAuthorityPda;