@wireio/stake 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/lib/stake.browser.js +1224 -71
  2. package/lib/stake.browser.js.map +1 -1
  3. package/lib/stake.d.ts +1150 -163
  4. package/lib/stake.js +1234 -71
  5. package/lib/stake.js.map +1 -1
  6. package/lib/stake.m.js +1224 -71
  7. package/lib/stake.m.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/assets/solana/devnet/idl/liqsol_core.json +472 -27
  10. package/src/assets/solana/devnet/idl/liqsol_token.json +34 -0
  11. package/src/assets/solana/devnet/idl/transfer_hook.json +34 -0
  12. package/src/assets/solana/devnet/types/liqsol_core.ts +472 -27
  13. package/src/assets/solana/devnet/types/liqsol_token.ts +34 -0
  14. package/src/assets/solana/devnet/types/transfer_hook.ts +34 -0
  15. package/src/assets/solana/mainnet/idl/liqsol_core.json +472 -27
  16. package/src/assets/solana/mainnet/idl/liqsol_token.json +34 -0
  17. package/src/assets/solana/mainnet/idl/transfer_hook.json +34 -0
  18. package/src/assets/solana/mainnet/types/liqsol_core.ts +472 -27
  19. package/src/assets/solana/mainnet/types/liqsol_token.ts +34 -0
  20. package/src/assets/solana/mainnet/types/transfer_hook.ts +34 -0
  21. package/src/networks/ethereum/ethereum.ts +9 -9
  22. package/src/networks/solana/clients/distribution.client.ts +114 -2
  23. package/src/networks/solana/clients/outpost.client.ts +2 -0
  24. package/src/networks/solana/clients/token.client.ts +2 -0
  25. package/src/networks/solana/constants.ts +3 -0
  26. package/src/networks/solana/program.ts +7 -0
  27. package/src/networks/solana/solana.ts +26 -1
  28. package/src/networks/solana/types.ts +3 -3
  29. package/src/networks/solana/utils.ts +7 -1
  30. package/src/types.ts +10 -1
package/lib/stake.js CHANGED
@@ -88,6 +88,51 @@ var instructions$7 = [
88
88
  args: [
89
89
  ]
90
90
  },
91
+ {
92
+ name: "admin_force_unbond_role",
93
+ discriminator: [
94
+ 80,
95
+ 107,
96
+ 27,
97
+ 49,
98
+ 126,
99
+ 25,
100
+ 31,
101
+ 238
102
+ ],
103
+ accounts: [
104
+ {
105
+ name: "admin",
106
+ signer: true
107
+ },
108
+ {
109
+ name: "global_config"
110
+ },
111
+ {
112
+ name: "global_state"
113
+ },
114
+ {
115
+ name: "user",
116
+ docs: [
117
+ "The user whose role bond is being force-unbonded"
118
+ ]
119
+ },
120
+ {
121
+ name: "outpost_account",
122
+ writable: true
123
+ }
124
+ ],
125
+ args: [
126
+ {
127
+ name: "role",
128
+ type: {
129
+ defined: {
130
+ name: "Role"
131
+ }
132
+ }
133
+ }
134
+ ]
135
+ },
91
136
  {
92
137
  name: "aggregate_stake_metrics",
93
138
  docs: [
@@ -862,6 +907,72 @@ var instructions$7 = [
862
907
  }
863
908
  ]
864
909
  },
910
+ {
911
+ name: "deposit_to_reserve",
912
+ discriminator: [
913
+ 8,
914
+ 79,
915
+ 123,
916
+ 129,
917
+ 146,
918
+ 140,
919
+ 178,
920
+ 128
921
+ ],
922
+ accounts: [
923
+ {
924
+ name: "admin",
925
+ signer: true
926
+ },
927
+ {
928
+ name: "global_config"
929
+ },
930
+ {
931
+ name: "depositor",
932
+ writable: true,
933
+ signer: true
934
+ },
935
+ {
936
+ name: "reserve_pool",
937
+ writable: true
938
+ },
939
+ {
940
+ name: "vault"
941
+ },
942
+ {
943
+ name: "ephemeral_stake",
944
+ writable: true
945
+ },
946
+ {
947
+ name: "controller_state"
948
+ },
949
+ {
950
+ name: "stake_program"
951
+ },
952
+ {
953
+ name: "system_program"
954
+ },
955
+ {
956
+ name: "clock"
957
+ },
958
+ {
959
+ name: "stake_history"
960
+ },
961
+ {
962
+ name: "rent"
963
+ }
964
+ ],
965
+ args: [
966
+ {
967
+ name: "amount",
968
+ type: "u64"
969
+ },
970
+ {
971
+ name: "seed",
972
+ type: "u32"
973
+ }
974
+ ]
975
+ },
865
976
  {
866
977
  name: "desynd",
867
978
  discriminator: [
@@ -938,6 +1049,10 @@ var instructions$7 = [
938
1049
  ],
939
1050
  writable: true
940
1051
  },
1052
+ {
1053
+ name: "pretoken_purchase_history",
1054
+ writable: true
1055
+ },
941
1056
  {
942
1057
  name: "token_program"
943
1058
  },
@@ -980,6 +1095,44 @@ var instructions$7 = [
980
1095
  ],
981
1096
  returns: "u16"
982
1097
  },
1098
+ {
1099
+ name: "has_role",
1100
+ discriminator: [
1101
+ 218,
1102
+ 136,
1103
+ 44,
1104
+ 87,
1105
+ 142,
1106
+ 247,
1107
+ 141,
1108
+ 195
1109
+ ],
1110
+ accounts: [
1111
+ {
1112
+ name: "user",
1113
+ docs: [
1114
+ "User whose role status is being checked."
1115
+ ]
1116
+ },
1117
+ {
1118
+ name: "outpost_account"
1119
+ },
1120
+ {
1121
+ name: "global_state"
1122
+ }
1123
+ ],
1124
+ args: [
1125
+ {
1126
+ name: "role",
1127
+ type: {
1128
+ defined: {
1129
+ name: "Role"
1130
+ }
1131
+ }
1132
+ }
1133
+ ],
1134
+ returns: "bool"
1135
+ },
983
1136
  {
984
1137
  name: "init_bucket",
985
1138
  docs: [
@@ -1331,6 +1484,52 @@ var instructions$7 = [
1331
1484
  args: [
1332
1485
  ]
1333
1486
  },
1487
+ {
1488
+ name: "initialize_pretoken_purchase_history",
1489
+ docs: [
1490
+ "Admin-only: initialize PretokenPurchaseHistory PDA for a pool"
1491
+ ],
1492
+ discriminator: [
1493
+ 140,
1494
+ 166,
1495
+ 196,
1496
+ 128,
1497
+ 189,
1498
+ 240,
1499
+ 159,
1500
+ 1
1501
+ ],
1502
+ accounts: [
1503
+ {
1504
+ name: "admin",
1505
+ writable: true,
1506
+ signer: true
1507
+ },
1508
+ {
1509
+ name: "global_config"
1510
+ },
1511
+ {
1512
+ name: "pretoken_purchase_history",
1513
+ writable: true
1514
+ },
1515
+ {
1516
+ name: "pool_authority"
1517
+ },
1518
+ {
1519
+ name: "global_state",
1520
+ writable: true
1521
+ },
1522
+ {
1523
+ name: "pool_pretoken_record",
1524
+ writable: true
1525
+ },
1526
+ {
1527
+ name: "system_program"
1528
+ }
1529
+ ],
1530
+ args: [
1531
+ ]
1532
+ },
1334
1533
  {
1335
1534
  name: "initialize_processing_state",
1336
1535
  docs: [
@@ -2212,6 +2411,10 @@ var instructions$7 = [
2212
2411
  },
2213
2412
  {
2214
2413
  name: "system_program"
2414
+ },
2415
+ {
2416
+ name: "pretoken_purchase_history",
2417
+ writable: true
2215
2418
  }
2216
2419
  ],
2217
2420
  args: [
@@ -2306,6 +2509,10 @@ var instructions$7 = [
2306
2509
  },
2307
2510
  {
2308
2511
  name: "chainlink_program"
2512
+ },
2513
+ {
2514
+ name: "pretoken_purchase_history",
2515
+ writable: true
2309
2516
  }
2310
2517
  ],
2311
2518
  args: [
@@ -2401,7 +2608,7 @@ var instructions$7 = [
2401
2608
  name: "refresh_stake_metrics_post_sync",
2402
2609
  docs: [
2403
2610
  "V2: Refresh stake metrics after removal selection + PDA setup",
2404
- "Requires ActiveInfosSynced + ValidatorPdaSetup as prerequisites",
2611
+ "Requires ValidatorAdditionSelection + ValidatorPdaSetup as prerequisites",
2405
2612
  "Tracks completion in last_post_sync_stake_metrics_refresh_epoch"
2406
2613
  ],
2407
2614
  discriminator: [
@@ -2445,24 +2652,51 @@ var instructions$7 = [
2445
2652
  ]
2446
2653
  },
2447
2654
  {
2448
- name: "register_user",
2655
+ name: "refund",
2449
2656
  discriminator: [
2450
2657
  2,
2451
- 241,
2452
- 150,
2453
- 223,
2454
- 99,
2455
- 214,
2456
- 116,
2457
- 97
2658
+ 96,
2659
+ 183,
2660
+ 251,
2661
+ 63,
2662
+ 208,
2663
+ 46,
2664
+ 46
2458
2665
  ],
2459
2666
  accounts: [
2667
+ {
2668
+ name: "associated_token_program"
2669
+ },
2460
2670
  {
2461
2671
  name: "user",
2672
+ writable: true,
2673
+ signer: true
2674
+ },
2675
+ {
2676
+ name: "global_state",
2462
2677
  writable: true
2463
2678
  },
2464
2679
  {
2465
- name: "user_ata",
2680
+ name: "outpost_account",
2681
+ writable: true
2682
+ },
2683
+ {
2684
+ name: "distribution_state",
2685
+ writable: true
2686
+ },
2687
+ {
2688
+ name: "pool_authority"
2689
+ },
2690
+ {
2691
+ name: "liqsol_pool_ata",
2692
+ writable: true
2693
+ },
2694
+ {
2695
+ name: "refund_liqsol_ata",
2696
+ writable: true
2697
+ },
2698
+ {
2699
+ name: "liqsol_pool_user_record",
2466
2700
  writable: true
2467
2701
  },
2468
2702
  {
@@ -2470,13 +2704,118 @@ var instructions$7 = [
2470
2704
  writable: true
2471
2705
  },
2472
2706
  {
2473
- name: "payer",
2474
- docs: [
2475
- "Payer for the user record PDA creation (always the user)"
2476
- ],
2707
+ name: "extra_account_meta_list"
2708
+ },
2709
+ {
2710
+ name: "liqsol_core_program"
2711
+ },
2712
+ {
2713
+ name: "transfer_hook_program"
2714
+ },
2715
+ {
2716
+ name: "liqsol_mint"
2717
+ },
2718
+ {
2719
+ name: "token_program"
2720
+ },
2721
+ {
2722
+ name: "bucket_authority"
2723
+ },
2724
+ {
2725
+ name: "bucket_token_account",
2726
+ writable: true
2727
+ },
2728
+ {
2729
+ name: "bucket_user_record",
2730
+ writable: true
2731
+ },
2732
+ {
2733
+ name: "system_program"
2734
+ }
2735
+ ],
2736
+ args: [
2737
+ ]
2738
+ },
2739
+ {
2740
+ name: "register_system_pda",
2741
+ discriminator: [
2742
+ 110,
2743
+ 93,
2744
+ 36,
2745
+ 156,
2746
+ 179,
2747
+ 69,
2748
+ 54,
2749
+ 210
2750
+ ],
2751
+ accounts: [
2752
+ {
2753
+ name: "admin",
2477
2754
  writable: true,
2478
2755
  signer: true
2479
2756
  },
2757
+ {
2758
+ name: "global_config"
2759
+ },
2760
+ {
2761
+ name: "pda_owner",
2762
+ docs: [
2763
+ "The PDA whose user record we're creating — must be system-owned (no program data)."
2764
+ ]
2765
+ },
2766
+ {
2767
+ name: "pda_ata"
2768
+ },
2769
+ {
2770
+ name: "user_record",
2771
+ writable: true
2772
+ },
2773
+ {
2774
+ name: "distribution_state",
2775
+ writable: true
2776
+ },
2777
+ {
2778
+ name: "bucket_authority"
2779
+ },
2780
+ {
2781
+ name: "bucket_token_account",
2782
+ docs: [
2783
+ "The bucket's associated token account holding liqSOL (for index sync)"
2784
+ ],
2785
+ writable: true
2786
+ },
2787
+ {
2788
+ name: "system_program"
2789
+ }
2790
+ ],
2791
+ args: [
2792
+ ]
2793
+ },
2794
+ {
2795
+ name: "register_user",
2796
+ discriminator: [
2797
+ 2,
2798
+ 241,
2799
+ 150,
2800
+ 223,
2801
+ 99,
2802
+ 214,
2803
+ 116,
2804
+ 97
2805
+ ],
2806
+ accounts: [
2807
+ {
2808
+ name: "payer",
2809
+ writable: true,
2810
+ signer: true
2811
+ },
2812
+ {
2813
+ name: "user_ata"
2814
+ },
2815
+ {
2816
+ name: "user_record",
2817
+ writable: true
2818
+ },
2480
2819
  {
2481
2820
  name: "distribution_state",
2482
2821
  writable: true
@@ -2642,7 +2981,8 @@ var instructions$7 = [
2642
2981
  name: "bucket_token_account",
2643
2982
  docs: [
2644
2983
  "The bucket's token account holding liqSOL (for sync_index balance)"
2645
- ]
2984
+ ],
2985
+ writable: true
2646
2986
  },
2647
2987
  {
2648
2988
  name: "reserve_pool",
@@ -2991,7 +3331,8 @@ var instructions$7 = [
2991
3331
  name: "global_config"
2992
3332
  },
2993
3333
  {
2994
- name: "global_state"
3334
+ name: "global_state",
3335
+ writable: true
2995
3336
  },
2996
3337
  {
2997
3338
  name: "user",
@@ -3084,7 +3425,7 @@ var instructions$7 = [
3084
3425
  name: "sync_main_stake_accounts",
3085
3426
  docs: [
3086
3427
  "V2: Sync main stake accounts using PDA architecture (batched)",
3087
- "Processes up to 10 validators per transaction via remaining_accounts",
3428
+ "Processes validators in batches via remaining_accounts (batch size is enforced client-side)",
3088
3429
  "Note: Only syncs primary delegated stakes, not transient stakes"
3089
3430
  ],
3090
3431
  discriminator: [
@@ -3252,6 +3593,10 @@ var instructions$7 = [
3252
3593
  ],
3253
3594
  writable: true
3254
3595
  },
3596
+ {
3597
+ name: "pretoken_purchase_history",
3598
+ writable: true
3599
+ },
3255
3600
  {
3256
3601
  name: "token_program"
3257
3602
  },
@@ -3654,6 +3999,19 @@ var accounts$5 = [
3654
3999
  150
3655
4000
  ]
3656
4001
  },
4002
+ {
4003
+ name: "PretokenPurchaseHistory",
4004
+ discriminator: [
4005
+ 33,
4006
+ 71,
4007
+ 113,
4008
+ 206,
4009
+ 33,
4010
+ 180,
4011
+ 236,
4012
+ 131
4013
+ ]
4014
+ },
3657
4015
  {
3658
4016
  name: "PriceHistory",
3659
4017
  discriminator: [
@@ -4166,12 +4524,24 @@ var types$9 = [
4166
4524
  ],
4167
4525
  type: "u16"
4168
4526
  },
4527
+ {
4528
+ name: "aggregate_mode_tag",
4529
+ docs: [
4530
+ "Tracks which aggregation mode currently owns the shared temp fields.",
4531
+ "0 = idle,",
4532
+ "1 = Normal,",
4533
+ "2 = PostSync,",
4534
+ "3 = PostLateEpoch.",
4535
+ "Prevents cross-mode state contamination when modes share the same vars."
4536
+ ],
4537
+ type: "u8"
4538
+ },
4169
4539
  {
4170
4540
  name: "_reserved",
4171
4541
  type: {
4172
4542
  array: [
4173
4543
  "u8",
4174
- 32
4544
+ 31
4175
4545
  ]
4176
4546
  }
4177
4547
  }
@@ -4404,7 +4774,9 @@ var types$9 = [
4404
4774
  {
4405
4775
  name: "authority",
4406
4776
  docs: [
4407
- "Authority that can update serviceable_epoch"
4777
+ "DEPRECATED: Originally intended as authority for serviceable_epoch updates,",
4778
+ "but serviceable_epoch is updated by merge_deactivated_stakes gated via GlobalConfig.cranky.",
4779
+ "Retained to preserve account layout."
4408
4780
  ],
4409
4781
  type: "pubkey"
4410
4782
  },
@@ -4720,9 +5092,10 @@ var types$9 = [
4720
5092
  type: "u64"
4721
5093
  },
4722
5094
  {
4723
- name: "last_pool_liqsol_balance",
5095
+ name: "expected_pool_balance",
4724
5096
  docs: [
4725
- "Last observed liqSOL pool balance (for yield calculation)"
5097
+ "Expected liqSOL pool balance (tracked by protocol operations, not read from on-chain balance).",
5098
+ "Any discrepancy vs actual on-chain balance is treated as unsolicited donations, not yield."
4726
5099
  ],
4727
5100
  type: "u64"
4728
5101
  },
@@ -4935,6 +5308,9 @@ var types$9 = [
4935
5308
  },
4936
5309
  {
4937
5310
  name: "last_active_infos_synced_epoch",
5311
+ docs: [
5312
+ "DEPRECATED: ActiveInfosSynced removed in WIN-134. Retained to preserve account layout."
5313
+ ],
4938
5314
  type: "u16"
4939
5315
  },
4940
5316
  {
@@ -4949,6 +5325,9 @@ var types$9 = [
4949
5325
  },
4950
5326
  {
4951
5327
  name: "last_distribution_slot",
5328
+ docs: [
5329
+ "DEPRECATED: Distribution slot tracking removed in PR113. Retained to preserve account layout."
5330
+ ],
4952
5331
  type: {
4953
5332
  option: "u64"
4954
5333
  }
@@ -5113,6 +5492,24 @@ var types$9 = [
5113
5492
  {
5114
5493
  name: "bump",
5115
5494
  type: "u8"
5495
+ },
5496
+ {
5497
+ name: "accumulated_pretoken_yield",
5498
+ type: {
5499
+ option: "u64"
5500
+ }
5501
+ },
5502
+ {
5503
+ name: "last_epoch_synd_liqsol",
5504
+ type: {
5505
+ option: "u64"
5506
+ }
5507
+ },
5508
+ {
5509
+ name: "last_synd_epoch",
5510
+ type: {
5511
+ option: "u64"
5512
+ }
5116
5513
  }
5117
5514
  ]
5118
5515
  }
@@ -5207,6 +5604,57 @@ var types$9 = [
5207
5604
  ]
5208
5605
  }
5209
5606
  },
5607
+ {
5608
+ name: "PretokenPurchaseHistory",
5609
+ serialization: "bytemuck",
5610
+ repr: {
5611
+ kind: "c"
5612
+ },
5613
+ type: {
5614
+ kind: "struct",
5615
+ fields: [
5616
+ {
5617
+ name: "starting_epoch",
5618
+ type: "u64"
5619
+ },
5620
+ {
5621
+ name: "latest_epoch",
5622
+ type: "u64"
5623
+ },
5624
+ {
5625
+ name: "purchased_per_epoch",
5626
+ type: {
5627
+ array: [
5628
+ "u64",
5629
+ 100
5630
+ ]
5631
+ }
5632
+ },
5633
+ {
5634
+ name: "synd_per_epoch",
5635
+ type: {
5636
+ array: [
5637
+ "u64",
5638
+ 100
5639
+ ]
5640
+ }
5641
+ },
5642
+ {
5643
+ name: "bump",
5644
+ type: "u8"
5645
+ },
5646
+ {
5647
+ name: "_padding",
5648
+ type: {
5649
+ array: [
5650
+ "u8",
5651
+ 7
5652
+ ]
5653
+ }
5654
+ }
5655
+ ]
5656
+ }
5657
+ },
5210
5658
  {
5211
5659
  name: "PretokenPurchased",
5212
5660
  type: {
@@ -5467,56 +5915,56 @@ var types$9 = [
5467
5915
  {
5468
5916
  name: "addition_in_progress",
5469
5917
  docs: [
5470
- "Whether validator addition selection is currently in progress (batched processing)"
5918
+ "DEPRECATED see BatchOrchestrator. Always false."
5471
5919
  ],
5472
5920
  type: "bool"
5473
5921
  },
5474
5922
  {
5475
5923
  name: "addition_next_rank",
5476
5924
  docs: [
5477
- "Next rank to process in leaderboard sorted_indices"
5925
+ "DEPRECATED see BatchOrchestrator.addition_next_rank. Always 0."
5478
5926
  ],
5479
5927
  type: "u16"
5480
5928
  },
5481
5929
  {
5482
5930
  name: "addition_target_rank",
5483
5931
  docs: [
5484
- "Target rank to process up to (inclusive)"
5932
+ "DEPRECATED see BatchOrchestrator.addition_target_rank. Always 0."
5485
5933
  ],
5486
5934
  type: "u16"
5487
5935
  },
5488
5936
  {
5489
5937
  name: "validators_added_this_selection",
5490
5938
  docs: [
5491
- "Number of validators added in the current selection cycle"
5939
+ "DEPRECATED see BatchOrchestrator. Always 0."
5492
5940
  ],
5493
5941
  type: "u16"
5494
5942
  },
5495
5943
  {
5496
5944
  name: "removal_in_progress",
5497
5945
  docs: [
5498
- "Whether validator removal selection is currently in progress (batched processing)"
5946
+ "DEPRECATED see BatchOrchestrator. Always false."
5499
5947
  ],
5500
5948
  type: "bool"
5501
5949
  },
5502
5950
  {
5503
5951
  name: "removal_next_index",
5504
5952
  docs: [
5505
- "Next index in active list to check for removal"
5953
+ "DEPRECATED see BatchOrchestrator.removal_next_index. Always 0."
5506
5954
  ],
5507
5955
  type: "u16"
5508
5956
  },
5509
5957
  {
5510
5958
  name: "removal_active_list_snapshot",
5511
5959
  docs: [
5512
- "Snapshot of active list count at start of removal (frozen)"
5960
+ "DEPRECATED see BatchOrchestrator. Always 0."
5513
5961
  ],
5514
5962
  type: "u16"
5515
5963
  },
5516
5964
  {
5517
5965
  name: "validators_removed_this_selection",
5518
5966
  docs: [
5519
- "Number of validators removed in the current selection cycle"
5967
+ "DEPRECATED see BatchOrchestrator. Always 0."
5520
5968
  ],
5521
5969
  type: "u16"
5522
5970
  }
@@ -6372,6 +6820,41 @@ var instructions$6 = [
6372
6820
  }
6373
6821
  }
6374
6822
  ]
6823
+ },
6824
+ {
6825
+ name: "update_liqsol_metadata_permissionless",
6826
+ discriminator: [
6827
+ 21,
6828
+ 255,
6829
+ 26,
6830
+ 184,
6831
+ 136,
6832
+ 110,
6833
+ 214,
6834
+ 33
6835
+ ],
6836
+ accounts: [
6837
+ {
6838
+ name: "payer",
6839
+ writable: true,
6840
+ signer: true
6841
+ },
6842
+ {
6843
+ name: "mint_authority"
6844
+ },
6845
+ {
6846
+ name: "mint",
6847
+ writable: true
6848
+ },
6849
+ {
6850
+ name: "token_program"
6851
+ },
6852
+ {
6853
+ name: "system_program"
6854
+ }
6855
+ ],
6856
+ args: [
6857
+ ]
6375
6858
  }
6376
6859
  ];
6377
6860
  var errors$6 = [
@@ -7129,6 +7612,41 @@ var instructions$4 = [
7129
7612
  type: "u64"
7130
7613
  }
7131
7614
  ]
7615
+ },
7616
+ {
7617
+ name: "update_extra_account_meta_list",
7618
+ discriminator: [
7619
+ 44,
7620
+ 125,
7621
+ 141,
7622
+ 226,
7623
+ 97,
7624
+ 179,
7625
+ 166,
7626
+ 96
7627
+ ],
7628
+ accounts: [
7629
+ {
7630
+ name: "payer",
7631
+ writable: true,
7632
+ signer: true
7633
+ },
7634
+ {
7635
+ name: "extra_account_meta_list",
7636
+ writable: true
7637
+ },
7638
+ {
7639
+ name: "mint"
7640
+ },
7641
+ {
7642
+ name: "system_program"
7643
+ },
7644
+ {
7645
+ name: "liqsol_core"
7646
+ }
7647
+ ],
7648
+ args: [
7649
+ ]
7132
7650
  }
7133
7651
  ];
7134
7652
  var accounts$3 = [
@@ -7299,6 +7817,51 @@ var instructions$3 = [
7299
7817
  args: [
7300
7818
  ]
7301
7819
  },
7820
+ {
7821
+ name: "admin_force_unbond_role",
7822
+ discriminator: [
7823
+ 80,
7824
+ 107,
7825
+ 27,
7826
+ 49,
7827
+ 126,
7828
+ 25,
7829
+ 31,
7830
+ 238
7831
+ ],
7832
+ accounts: [
7833
+ {
7834
+ name: "admin",
7835
+ signer: true
7836
+ },
7837
+ {
7838
+ name: "global_config"
7839
+ },
7840
+ {
7841
+ name: "global_state"
7842
+ },
7843
+ {
7844
+ name: "user",
7845
+ docs: [
7846
+ "The user whose role bond is being force-unbonded"
7847
+ ]
7848
+ },
7849
+ {
7850
+ name: "outpost_account",
7851
+ writable: true
7852
+ }
7853
+ ],
7854
+ args: [
7855
+ {
7856
+ name: "role",
7857
+ type: {
7858
+ defined: {
7859
+ name: "Role"
7860
+ }
7861
+ }
7862
+ }
7863
+ ]
7864
+ },
7302
7865
  {
7303
7866
  name: "aggregate_stake_metrics",
7304
7867
  docs: [
@@ -8073,6 +8636,72 @@ var instructions$3 = [
8073
8636
  }
8074
8637
  ]
8075
8638
  },
8639
+ {
8640
+ name: "deposit_to_reserve",
8641
+ discriminator: [
8642
+ 8,
8643
+ 79,
8644
+ 123,
8645
+ 129,
8646
+ 146,
8647
+ 140,
8648
+ 178,
8649
+ 128
8650
+ ],
8651
+ accounts: [
8652
+ {
8653
+ name: "admin",
8654
+ signer: true
8655
+ },
8656
+ {
8657
+ name: "global_config"
8658
+ },
8659
+ {
8660
+ name: "depositor",
8661
+ writable: true,
8662
+ signer: true
8663
+ },
8664
+ {
8665
+ name: "reserve_pool",
8666
+ writable: true
8667
+ },
8668
+ {
8669
+ name: "vault"
8670
+ },
8671
+ {
8672
+ name: "ephemeral_stake",
8673
+ writable: true
8674
+ },
8675
+ {
8676
+ name: "controller_state"
8677
+ },
8678
+ {
8679
+ name: "stake_program"
8680
+ },
8681
+ {
8682
+ name: "system_program"
8683
+ },
8684
+ {
8685
+ name: "clock"
8686
+ },
8687
+ {
8688
+ name: "stake_history"
8689
+ },
8690
+ {
8691
+ name: "rent"
8692
+ }
8693
+ ],
8694
+ args: [
8695
+ {
8696
+ name: "amount",
8697
+ type: "u64"
8698
+ },
8699
+ {
8700
+ name: "seed",
8701
+ type: "u32"
8702
+ }
8703
+ ]
8704
+ },
8076
8705
  {
8077
8706
  name: "desynd",
8078
8707
  discriminator: [
@@ -8149,6 +8778,10 @@ var instructions$3 = [
8149
8778
  ],
8150
8779
  writable: true
8151
8780
  },
8781
+ {
8782
+ name: "pretoken_purchase_history",
8783
+ writable: true
8784
+ },
8152
8785
  {
8153
8786
  name: "token_program"
8154
8787
  },
@@ -8191,6 +8824,44 @@ var instructions$3 = [
8191
8824
  ],
8192
8825
  returns: "u16"
8193
8826
  },
8827
+ {
8828
+ name: "has_role",
8829
+ discriminator: [
8830
+ 218,
8831
+ 136,
8832
+ 44,
8833
+ 87,
8834
+ 142,
8835
+ 247,
8836
+ 141,
8837
+ 195
8838
+ ],
8839
+ accounts: [
8840
+ {
8841
+ name: "user",
8842
+ docs: [
8843
+ "User whose role status is being checked."
8844
+ ]
8845
+ },
8846
+ {
8847
+ name: "outpost_account"
8848
+ },
8849
+ {
8850
+ name: "global_state"
8851
+ }
8852
+ ],
8853
+ args: [
8854
+ {
8855
+ name: "role",
8856
+ type: {
8857
+ defined: {
8858
+ name: "Role"
8859
+ }
8860
+ }
8861
+ }
8862
+ ],
8863
+ returns: "bool"
8864
+ },
8194
8865
  {
8195
8866
  name: "init_bucket",
8196
8867
  docs: [
@@ -8542,6 +9213,52 @@ var instructions$3 = [
8542
9213
  args: [
8543
9214
  ]
8544
9215
  },
9216
+ {
9217
+ name: "initialize_pretoken_purchase_history",
9218
+ docs: [
9219
+ "Admin-only: initialize PretokenPurchaseHistory PDA for a pool"
9220
+ ],
9221
+ discriminator: [
9222
+ 140,
9223
+ 166,
9224
+ 196,
9225
+ 128,
9226
+ 189,
9227
+ 240,
9228
+ 159,
9229
+ 1
9230
+ ],
9231
+ accounts: [
9232
+ {
9233
+ name: "admin",
9234
+ writable: true,
9235
+ signer: true
9236
+ },
9237
+ {
9238
+ name: "global_config"
9239
+ },
9240
+ {
9241
+ name: "pretoken_purchase_history",
9242
+ writable: true
9243
+ },
9244
+ {
9245
+ name: "pool_authority"
9246
+ },
9247
+ {
9248
+ name: "global_state",
9249
+ writable: true
9250
+ },
9251
+ {
9252
+ name: "pool_pretoken_record",
9253
+ writable: true
9254
+ },
9255
+ {
9256
+ name: "system_program"
9257
+ }
9258
+ ],
9259
+ args: [
9260
+ ]
9261
+ },
8545
9262
  {
8546
9263
  name: "initialize_processing_state",
8547
9264
  docs: [
@@ -9423,6 +10140,10 @@ var instructions$3 = [
9423
10140
  },
9424
10141
  {
9425
10142
  name: "system_program"
10143
+ },
10144
+ {
10145
+ name: "pretoken_purchase_history",
10146
+ writable: true
9426
10147
  }
9427
10148
  ],
9428
10149
  args: [
@@ -9517,6 +10238,10 @@ var instructions$3 = [
9517
10238
  },
9518
10239
  {
9519
10240
  name: "chainlink_program"
10241
+ },
10242
+ {
10243
+ name: "pretoken_purchase_history",
10244
+ writable: true
9520
10245
  }
9521
10246
  ],
9522
10247
  args: [
@@ -9612,7 +10337,7 @@ var instructions$3 = [
9612
10337
  name: "refresh_stake_metrics_post_sync",
9613
10338
  docs: [
9614
10339
  "V2: Refresh stake metrics after removal selection + PDA setup",
9615
- "Requires ActiveInfosSynced + ValidatorPdaSetup as prerequisites",
10340
+ "Requires ValidatorAdditionSelection + ValidatorPdaSetup as prerequisites",
9616
10341
  "Tracks completion in last_post_sync_stake_metrics_refresh_epoch"
9617
10342
  ],
9618
10343
  discriminator: [
@@ -9656,24 +10381,51 @@ var instructions$3 = [
9656
10381
  ]
9657
10382
  },
9658
10383
  {
9659
- name: "register_user",
10384
+ name: "refund",
9660
10385
  discriminator: [
9661
10386
  2,
9662
- 241,
9663
- 150,
9664
- 223,
9665
- 99,
9666
- 214,
9667
- 116,
9668
- 97
10387
+ 96,
10388
+ 183,
10389
+ 251,
10390
+ 63,
10391
+ 208,
10392
+ 46,
10393
+ 46
9669
10394
  ],
9670
10395
  accounts: [
10396
+ {
10397
+ name: "associated_token_program"
10398
+ },
9671
10399
  {
9672
10400
  name: "user",
10401
+ writable: true,
10402
+ signer: true
10403
+ },
10404
+ {
10405
+ name: "global_state",
9673
10406
  writable: true
9674
10407
  },
9675
10408
  {
9676
- name: "user_ata",
10409
+ name: "outpost_account",
10410
+ writable: true
10411
+ },
10412
+ {
10413
+ name: "distribution_state",
10414
+ writable: true
10415
+ },
10416
+ {
10417
+ name: "pool_authority"
10418
+ },
10419
+ {
10420
+ name: "liqsol_pool_ata",
10421
+ writable: true
10422
+ },
10423
+ {
10424
+ name: "refund_liqsol_ata",
10425
+ writable: true
10426
+ },
10427
+ {
10428
+ name: "liqsol_pool_user_record",
9677
10429
  writable: true
9678
10430
  },
9679
10431
  {
@@ -9681,13 +10433,118 @@ var instructions$3 = [
9681
10433
  writable: true
9682
10434
  },
9683
10435
  {
9684
- name: "payer",
10436
+ name: "extra_account_meta_list"
10437
+ },
10438
+ {
10439
+ name: "liqsol_core_program"
10440
+ },
10441
+ {
10442
+ name: "transfer_hook_program"
10443
+ },
10444
+ {
10445
+ name: "liqsol_mint"
10446
+ },
10447
+ {
10448
+ name: "token_program"
10449
+ },
10450
+ {
10451
+ name: "bucket_authority"
10452
+ },
10453
+ {
10454
+ name: "bucket_token_account",
10455
+ writable: true
10456
+ },
10457
+ {
10458
+ name: "bucket_user_record",
10459
+ writable: true
10460
+ },
10461
+ {
10462
+ name: "system_program"
10463
+ }
10464
+ ],
10465
+ args: [
10466
+ ]
10467
+ },
10468
+ {
10469
+ name: "register_system_pda",
10470
+ discriminator: [
10471
+ 110,
10472
+ 93,
10473
+ 36,
10474
+ 156,
10475
+ 179,
10476
+ 69,
10477
+ 54,
10478
+ 210
10479
+ ],
10480
+ accounts: [
10481
+ {
10482
+ name: "admin",
10483
+ writable: true,
10484
+ signer: true
10485
+ },
10486
+ {
10487
+ name: "global_config"
10488
+ },
10489
+ {
10490
+ name: "pda_owner",
10491
+ docs: [
10492
+ "The PDA whose user record we're creating — must be system-owned (no program data)."
10493
+ ]
10494
+ },
10495
+ {
10496
+ name: "pda_ata"
10497
+ },
10498
+ {
10499
+ name: "user_record",
10500
+ writable: true
10501
+ },
10502
+ {
10503
+ name: "distribution_state",
10504
+ writable: true
10505
+ },
10506
+ {
10507
+ name: "bucket_authority"
10508
+ },
10509
+ {
10510
+ name: "bucket_token_account",
9685
10511
  docs: [
9686
- "Payer for the user record PDA creation (always the user)"
10512
+ "The bucket's associated token account holding liqSOL (for index sync)"
9687
10513
  ],
10514
+ writable: true
10515
+ },
10516
+ {
10517
+ name: "system_program"
10518
+ }
10519
+ ],
10520
+ args: [
10521
+ ]
10522
+ },
10523
+ {
10524
+ name: "register_user",
10525
+ discriminator: [
10526
+ 2,
10527
+ 241,
10528
+ 150,
10529
+ 223,
10530
+ 99,
10531
+ 214,
10532
+ 116,
10533
+ 97
10534
+ ],
10535
+ accounts: [
10536
+ {
10537
+ name: "payer",
9688
10538
  writable: true,
9689
10539
  signer: true
9690
10540
  },
10541
+ {
10542
+ name: "user_ata"
10543
+ },
10544
+ {
10545
+ name: "user_record",
10546
+ writable: true
10547
+ },
9691
10548
  {
9692
10549
  name: "distribution_state",
9693
10550
  writable: true
@@ -9853,7 +10710,8 @@ var instructions$3 = [
9853
10710
  name: "bucket_token_account",
9854
10711
  docs: [
9855
10712
  "The bucket's token account holding liqSOL (for sync_index balance)"
9856
- ]
10713
+ ],
10714
+ writable: true
9857
10715
  },
9858
10716
  {
9859
10717
  name: "reserve_pool",
@@ -10202,7 +11060,8 @@ var instructions$3 = [
10202
11060
  name: "global_config"
10203
11061
  },
10204
11062
  {
10205
- name: "global_state"
11063
+ name: "global_state",
11064
+ writable: true
10206
11065
  },
10207
11066
  {
10208
11067
  name: "user",
@@ -10295,7 +11154,7 @@ var instructions$3 = [
10295
11154
  name: "sync_main_stake_accounts",
10296
11155
  docs: [
10297
11156
  "V2: Sync main stake accounts using PDA architecture (batched)",
10298
- "Processes up to 10 validators per transaction via remaining_accounts",
11157
+ "Processes validators in batches via remaining_accounts (batch size is enforced client-side)",
10299
11158
  "Note: Only syncs primary delegated stakes, not transient stakes"
10300
11159
  ],
10301
11160
  discriminator: [
@@ -10463,6 +11322,10 @@ var instructions$3 = [
10463
11322
  ],
10464
11323
  writable: true
10465
11324
  },
11325
+ {
11326
+ name: "pretoken_purchase_history",
11327
+ writable: true
11328
+ },
10466
11329
  {
10467
11330
  name: "token_program"
10468
11331
  },
@@ -10865,6 +11728,19 @@ var accounts$2 = [
10865
11728
  150
10866
11729
  ]
10867
11730
  },
11731
+ {
11732
+ name: "PretokenPurchaseHistory",
11733
+ discriminator: [
11734
+ 33,
11735
+ 71,
11736
+ 113,
11737
+ 206,
11738
+ 33,
11739
+ 180,
11740
+ 236,
11741
+ 131
11742
+ ]
11743
+ },
10868
11744
  {
10869
11745
  name: "PriceHistory",
10870
11746
  discriminator: [
@@ -11377,12 +12253,24 @@ var types$5 = [
11377
12253
  ],
11378
12254
  type: "u16"
11379
12255
  },
12256
+ {
12257
+ name: "aggregate_mode_tag",
12258
+ docs: [
12259
+ "Tracks which aggregation mode currently owns the shared temp fields.",
12260
+ "0 = idle,",
12261
+ "1 = Normal,",
12262
+ "2 = PostSync,",
12263
+ "3 = PostLateEpoch.",
12264
+ "Prevents cross-mode state contamination when modes share the same vars."
12265
+ ],
12266
+ type: "u8"
12267
+ },
11380
12268
  {
11381
12269
  name: "_reserved",
11382
12270
  type: {
11383
12271
  array: [
11384
12272
  "u8",
11385
- 32
12273
+ 31
11386
12274
  ]
11387
12275
  }
11388
12276
  }
@@ -11615,7 +12503,9 @@ var types$5 = [
11615
12503
  {
11616
12504
  name: "authority",
11617
12505
  docs: [
11618
- "Authority that can update serviceable_epoch"
12506
+ "DEPRECATED: Originally intended as authority for serviceable_epoch updates,",
12507
+ "but serviceable_epoch is updated by merge_deactivated_stakes gated via GlobalConfig.cranky.",
12508
+ "Retained to preserve account layout."
11619
12509
  ],
11620
12510
  type: "pubkey"
11621
12511
  },
@@ -11931,9 +12821,10 @@ var types$5 = [
11931
12821
  type: "u64"
11932
12822
  },
11933
12823
  {
11934
- name: "last_pool_liqsol_balance",
12824
+ name: "expected_pool_balance",
11935
12825
  docs: [
11936
- "Last observed liqSOL pool balance (for yield calculation)"
12826
+ "Expected liqSOL pool balance (tracked by protocol operations, not read from on-chain balance).",
12827
+ "Any discrepancy vs actual on-chain balance is treated as unsolicited donations, not yield."
11937
12828
  ],
11938
12829
  type: "u64"
11939
12830
  },
@@ -12146,6 +13037,9 @@ var types$5 = [
12146
13037
  },
12147
13038
  {
12148
13039
  name: "last_active_infos_synced_epoch",
13040
+ docs: [
13041
+ "DEPRECATED: ActiveInfosSynced removed in WIN-134. Retained to preserve account layout."
13042
+ ],
12149
13043
  type: "u16"
12150
13044
  },
12151
13045
  {
@@ -12160,6 +13054,9 @@ var types$5 = [
12160
13054
  },
12161
13055
  {
12162
13056
  name: "last_distribution_slot",
13057
+ docs: [
13058
+ "DEPRECATED: Distribution slot tracking removed in PR113. Retained to preserve account layout."
13059
+ ],
12163
13060
  type: {
12164
13061
  option: "u64"
12165
13062
  }
@@ -12324,6 +13221,24 @@ var types$5 = [
12324
13221
  {
12325
13222
  name: "bump",
12326
13223
  type: "u8"
13224
+ },
13225
+ {
13226
+ name: "accumulated_pretoken_yield",
13227
+ type: {
13228
+ option: "u64"
13229
+ }
13230
+ },
13231
+ {
13232
+ name: "last_epoch_synd_liqsol",
13233
+ type: {
13234
+ option: "u64"
13235
+ }
13236
+ },
13237
+ {
13238
+ name: "last_synd_epoch",
13239
+ type: {
13240
+ option: "u64"
13241
+ }
12327
13242
  }
12328
13243
  ]
12329
13244
  }
@@ -12418,6 +13333,57 @@ var types$5 = [
12418
13333
  ]
12419
13334
  }
12420
13335
  },
13336
+ {
13337
+ name: "PretokenPurchaseHistory",
13338
+ serialization: "bytemuck",
13339
+ repr: {
13340
+ kind: "c"
13341
+ },
13342
+ type: {
13343
+ kind: "struct",
13344
+ fields: [
13345
+ {
13346
+ name: "starting_epoch",
13347
+ type: "u64"
13348
+ },
13349
+ {
13350
+ name: "latest_epoch",
13351
+ type: "u64"
13352
+ },
13353
+ {
13354
+ name: "purchased_per_epoch",
13355
+ type: {
13356
+ array: [
13357
+ "u64",
13358
+ 100
13359
+ ]
13360
+ }
13361
+ },
13362
+ {
13363
+ name: "synd_per_epoch",
13364
+ type: {
13365
+ array: [
13366
+ "u64",
13367
+ 100
13368
+ ]
13369
+ }
13370
+ },
13371
+ {
13372
+ name: "bump",
13373
+ type: "u8"
13374
+ },
13375
+ {
13376
+ name: "_padding",
13377
+ type: {
13378
+ array: [
13379
+ "u8",
13380
+ 7
13381
+ ]
13382
+ }
13383
+ }
13384
+ ]
13385
+ }
13386
+ },
12421
13387
  {
12422
13388
  name: "PretokenPurchased",
12423
13389
  type: {
@@ -12678,56 +13644,56 @@ var types$5 = [
12678
13644
  {
12679
13645
  name: "addition_in_progress",
12680
13646
  docs: [
12681
- "Whether validator addition selection is currently in progress (batched processing)"
13647
+ "DEPRECATED see BatchOrchestrator. Always false."
12682
13648
  ],
12683
13649
  type: "bool"
12684
13650
  },
12685
13651
  {
12686
13652
  name: "addition_next_rank",
12687
13653
  docs: [
12688
- "Next rank to process in leaderboard sorted_indices"
13654
+ "DEPRECATED see BatchOrchestrator.addition_next_rank. Always 0."
12689
13655
  ],
12690
13656
  type: "u16"
12691
13657
  },
12692
13658
  {
12693
13659
  name: "addition_target_rank",
12694
13660
  docs: [
12695
- "Target rank to process up to (inclusive)"
13661
+ "DEPRECATED see BatchOrchestrator.addition_target_rank. Always 0."
12696
13662
  ],
12697
13663
  type: "u16"
12698
13664
  },
12699
13665
  {
12700
13666
  name: "validators_added_this_selection",
12701
13667
  docs: [
12702
- "Number of validators added in the current selection cycle"
13668
+ "DEPRECATED see BatchOrchestrator. Always 0."
12703
13669
  ],
12704
13670
  type: "u16"
12705
13671
  },
12706
13672
  {
12707
13673
  name: "removal_in_progress",
12708
13674
  docs: [
12709
- "Whether validator removal selection is currently in progress (batched processing)"
13675
+ "DEPRECATED see BatchOrchestrator. Always false."
12710
13676
  ],
12711
13677
  type: "bool"
12712
13678
  },
12713
13679
  {
12714
13680
  name: "removal_next_index",
12715
13681
  docs: [
12716
- "Next index in active list to check for removal"
13682
+ "DEPRECATED see BatchOrchestrator.removal_next_index. Always 0."
12717
13683
  ],
12718
13684
  type: "u16"
12719
13685
  },
12720
13686
  {
12721
13687
  name: "removal_active_list_snapshot",
12722
13688
  docs: [
12723
- "Snapshot of active list count at start of removal (frozen)"
13689
+ "DEPRECATED see BatchOrchestrator. Always 0."
12724
13690
  ],
12725
13691
  type: "u16"
12726
13692
  },
12727
13693
  {
12728
13694
  name: "validators_removed_this_selection",
12729
13695
  docs: [
12730
- "Number of validators removed in the current selection cycle"
13696
+ "DEPRECATED see BatchOrchestrator. Always 0."
12731
13697
  ],
12732
13698
  type: "u16"
12733
13699
  }
@@ -13583,6 +14549,41 @@ var instructions$2 = [
13583
14549
  }
13584
14550
  }
13585
14551
  ]
14552
+ },
14553
+ {
14554
+ name: "update_liqsol_metadata_permissionless",
14555
+ discriminator: [
14556
+ 21,
14557
+ 255,
14558
+ 26,
14559
+ 184,
14560
+ 136,
14561
+ 110,
14562
+ 214,
14563
+ 33
14564
+ ],
14565
+ accounts: [
14566
+ {
14567
+ name: "payer",
14568
+ writable: true,
14569
+ signer: true
14570
+ },
14571
+ {
14572
+ name: "mint_authority"
14573
+ },
14574
+ {
14575
+ name: "mint",
14576
+ writable: true
14577
+ },
14578
+ {
14579
+ name: "token_program"
14580
+ },
14581
+ {
14582
+ name: "system_program"
14583
+ }
14584
+ ],
14585
+ args: [
14586
+ ]
13586
14587
  }
13587
14588
  ];
13588
14589
  var errors$2 = [
@@ -14340,6 +15341,41 @@ var instructions = [
14340
15341
  type: "u64"
14341
15342
  }
14342
15343
  ]
15344
+ },
15345
+ {
15346
+ name: "update_extra_account_meta_list",
15347
+ discriminator: [
15348
+ 44,
15349
+ 125,
15350
+ 141,
15351
+ 226,
15352
+ 97,
15353
+ 179,
15354
+ 166,
15355
+ 96
15356
+ ],
15357
+ accounts: [
15358
+ {
15359
+ name: "payer",
15360
+ writable: true,
15361
+ signer: true
15362
+ },
15363
+ {
15364
+ name: "extra_account_meta_list",
15365
+ writable: true
15366
+ },
15367
+ {
15368
+ name: "mint"
15369
+ },
15370
+ {
15371
+ name: "system_program"
15372
+ },
15373
+ {
15374
+ name: "liqsol_core"
15375
+ }
15376
+ ],
15377
+ args: [
15378
+ ]
14343
15379
  }
14344
15380
  ];
14345
15381
  var accounts = [
@@ -14525,7 +15561,8 @@ const PDA_SEEDS = {
14525
15561
  WITHDRAW_MINT_AUTHORITY: "mint_authority",
14526
15562
  MINT_METADATA: "mint_metadata",
14527
15563
  LIQ_RECEIPT_DATA: "liq_receipt_data",
14528
- WITHDRAW_MINT: "mint"
15564
+ WITHDRAW_MINT: "mint",
15565
+ PRETOKEN_PURCHASE_HISTORY: "pretoken_purchase_history"
14529
15566
  };
14530
15567
  const deriveEphemeralStakeAddress = (user, seed) => __async$h(null, null, function* () {
14531
15568
  const seedStr = `ephemeral_${seed}`;
@@ -14731,6 +15768,7 @@ function buildOutpostAccounts(connection, user, pgs) {
14731
15768
  const liqsolPoolUserRecord = pgs.deriveUserRecordPda(liqsolPoolAta);
14732
15769
  const userUserRecord = pgs.deriveUserRecordPda(userAta);
14733
15770
  const extraAccountMetaList = pgs.deriveExtraAccountMetaListPda(liqsolMint);
15771
+ const pretokenPurchaseHistory = pgs.derivePretokenPurchaseHistoryPda();
14734
15772
  let chainLinkFeed = CHAINLINK_FEED;
14735
15773
  let chainLinkProgram = CHAINLINK_PROGRAM;
14736
15774
  try {
@@ -14760,7 +15798,8 @@ function buildOutpostAccounts(connection, user, pgs) {
14760
15798
  trancheState,
14761
15799
  chainLinkFeed,
14762
15800
  chainLinkProgram,
14763
- extraAccountMetaList
15801
+ extraAccountMetaList,
15802
+ pretokenPurchaseHistory
14764
15803
  };
14765
15804
  });
14766
15805
  }
@@ -15168,6 +16207,7 @@ var __async$e = (__this, __arguments, generator) => {
15168
16207
  step((generator = generator.apply(__this, __arguments)).next());
15169
16208
  });
15170
16209
  };
16210
+ const INDEX_SCALE_BN = new anchor.BN("1000000000000");
15171
16211
  class DistributionClient {
15172
16212
  constructor(provider, pgs) {
15173
16213
  this.provider = provider;
@@ -15177,6 +16217,16 @@ class DistributionClient {
15177
16217
  get connection() {
15178
16218
  return this.provider.connection;
15179
16219
  }
16220
+ getTokenBalance(ata) {
16221
+ return __async$e(this, null, function* () {
16222
+ try {
16223
+ const bal = yield this.connection.getTokenAccountBalance(ata);
16224
+ return new anchor.BN(bal.value.amount);
16225
+ } catch (e) {
16226
+ return new anchor.BN(0);
16227
+ }
16228
+ });
16229
+ }
15180
16230
  getDistributionState() {
15181
16231
  return __async$e(this, null, function* () {
15182
16232
  const pda = this.pgs.deriveDistributionStatePda();
@@ -15256,6 +16306,85 @@ class DistributionClient {
15256
16306
  return { shares: userShares, totalShares, ratio };
15257
16307
  });
15258
16308
  }
16309
+ getClaimableLiqsol(user) {
16310
+ return __async$e(this, null, function* () {
16311
+ const liqsolMint = this.pgs.deriveLiqsolMintPda();
16312
+ const bucketAuthority = this.pgs.deriveBucketAuthorityPda();
16313
+ const userAta = splToken.getAssociatedTokenAddressSync(
16314
+ liqsolMint,
16315
+ user,
16316
+ true,
16317
+ splToken.TOKEN_2022_PROGRAM_ID
16318
+ );
16319
+ const bucketTokenAccount = splToken.getAssociatedTokenAddressSync(
16320
+ liqsolMint,
16321
+ bucketAuthority,
16322
+ true,
16323
+ splToken.TOKEN_2022_PROGRAM_ID
16324
+ );
16325
+ const [distributionState, userRecord, actualBalance, bucketBalance] = yield Promise.all([
16326
+ this.getDistributionState(),
16327
+ this.getUserRecord(user),
16328
+ this.getTokenBalance(userAta),
16329
+ this.getTokenBalance(bucketTokenAccount)
16330
+ ]);
16331
+ if (!distributionState || !userRecord) {
16332
+ return new anchor.BN(0);
16333
+ }
16334
+ let syncedIndex = new anchor.BN(distributionState.currentIndex.toString());
16335
+ const totalShares = new anchor.BN(distributionState.totalShares.toString());
16336
+ const lastBucketBalance = new anchor.BN(distributionState.lastBucketBalance.toString());
16337
+ if (totalShares.gt(new anchor.BN(0)) && bucketBalance.gt(lastBucketBalance)) {
16338
+ const delta = bucketBalance.sub(lastBucketBalance);
16339
+ const indexDelta = delta.mul(INDEX_SCALE_BN).div(totalShares);
16340
+ if (indexDelta.gt(new anchor.BN(0))) {
16341
+ syncedIndex = syncedIndex.add(indexDelta);
16342
+ }
16343
+ }
16344
+ const shares = new anchor.BN(userRecord.shares.toString());
16345
+ const entitled = shares.mul(syncedIndex).div(INDEX_SCALE_BN);
16346
+ if (entitled.lte(actualBalance)) {
16347
+ return new anchor.BN(0);
16348
+ }
16349
+ return entitled.sub(actualBalance);
16350
+ });
16351
+ }
16352
+ buildClaimRewardsIx(user) {
16353
+ return __async$e(this, null, function* () {
16354
+ const liqsolMint = this.pgs.deriveLiqsolMintPda();
16355
+ const distributionState = this.pgs.deriveDistributionStatePda();
16356
+ const bucketAuthority = this.pgs.deriveBucketAuthorityPda();
16357
+ const userAta = splToken.getAssociatedTokenAddressSync(
16358
+ liqsolMint,
16359
+ user,
16360
+ true,
16361
+ splToken.TOKEN_2022_PROGRAM_ID
16362
+ );
16363
+ const bucketTokenAccount = splToken.getAssociatedTokenAddressSync(
16364
+ liqsolMint,
16365
+ bucketAuthority,
16366
+ true,
16367
+ splToken.TOKEN_2022_PROGRAM_ID
16368
+ );
16369
+ const userRecord = this.pgs.deriveUserRecordPda(userAta);
16370
+ const bucketUserRecord = this.pgs.deriveUserRecordPda(bucketTokenAccount);
16371
+ const extraAccountMetaList = this.pgs.deriveExtraAccountMetaListPda(liqsolMint);
16372
+ return this.program.methods.claimRewards().accounts({
16373
+ user,
16374
+ userAta,
16375
+ userRecord,
16376
+ bucketUserRecord,
16377
+ distributionState,
16378
+ extraAccountMetaList,
16379
+ liqsolCoreProgram: this.pgs.PROGRAM_IDS.LIQSOL_CORE,
16380
+ transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
16381
+ liqsolMint,
16382
+ bucketAuthority,
16383
+ bucketTokenAccount,
16384
+ tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
16385
+ }).instruction();
16386
+ });
16387
+ }
15259
16388
  getAverageScaledPayRate(windowSize = 5) {
15260
16389
  return __async$e(this, null, function* () {
15261
16390
  var _a, _b, _c, _d, _e;
@@ -15509,7 +16638,8 @@ class OutpostClient {
15509
16638
  outpostAccount: a.outpostAccount,
15510
16639
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
15511
16640
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
15512
- systemProgram: web3_js.SystemProgram.programId
16641
+ systemProgram: web3_js.SystemProgram.programId,
16642
+ pretokenPurchaseHistory: a.pretokenPurchaseHistory
15513
16643
  }).instruction();
15514
16644
  });
15515
16645
  }
@@ -15539,7 +16669,8 @@ class OutpostClient {
15539
16669
  outpostAccount: a.outpostAccount,
15540
16670
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
15541
16671
  systemProgram: web3_js.SystemProgram.programId,
15542
- associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID
16672
+ associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
16673
+ pretokenPurchaseHistory: a.pretokenPurchaseHistory
15543
16674
  }).instruction();
15544
16675
  });
15545
16676
  }
@@ -15671,7 +16802,8 @@ class TokenClient {
15671
16802
  chainlinkProgram: (_b = a.chainLinkProgram) != null ? _b : CHAINLINK_PROGRAM,
15672
16803
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
15673
16804
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
15674
- systemProgram: web3_js.SystemProgram.programId
16805
+ systemProgram: web3_js.SystemProgram.programId,
16806
+ pretokenPurchaseHistory: a.pretokenPurchaseHistory
15675
16807
  }).instruction();
15676
16808
  });
15677
16809
  }
@@ -15916,6 +17048,12 @@ class SolanaProgramService {
15916
17048
  this.ids.LIQSOL_CORE
15917
17049
  )[0];
15918
17050
  }
17051
+ derivePretokenPurchaseHistoryPda() {
17052
+ return web3_js.PublicKey.findProgramAddressSync(
17053
+ [Buffer.from(PDA_SEEDS.PRETOKEN_PURCHASE_HISTORY)],
17054
+ this.ids.LIQSOL_CORE
17055
+ )[0];
17056
+ }
15919
17057
  deriveWithdrawNftMintPda(receiptId) {
15920
17058
  const receiptIdBytes = Buffer.alloc(8);
15921
17059
  const asBigInt = typeof receiptId === "bigint" ? receiptId : BigInt(receiptId.toString());
@@ -16188,6 +17326,20 @@ const _SolanaStakingClient = class _SolanaStakingClient {
16188
17326
  }
16189
17327
  });
16190
17328
  }
17329
+ claimLiqsolRewards() {
17330
+ return __async$9(this, null, function* () {
17331
+ var _a;
17332
+ this.ensureUser();
17333
+ const owner = (_a = this.squadsVaultPDA) != null ? _a : this.anchor.wallet.publicKey;
17334
+ try {
17335
+ const ix = yield this.distributionClient.buildClaimRewardsIx(owner);
17336
+ return !!this.squadsX ? yield this.sendSquadsIxs(ix) : yield this.buildAndSendIx(ix);
17337
+ } catch (err) {
17338
+ console.log(`Failed to claim liqSOL rewards on Solana: ${err}`);
17339
+ throw err;
17340
+ }
17341
+ });
17342
+ }
16191
17343
  stake(amountLamports) {
16192
17344
  return __async$9(this, null, function* () {
16193
17345
  this.ensureUser();
@@ -16245,10 +17397,11 @@ const _SolanaStakingClient = class _SolanaStakingClient {
16245
17397
  splToken.TOKEN_2022_PROGRAM_ID,
16246
17398
  splToken.ASSOCIATED_TOKEN_PROGRAM_ID
16247
17399
  );
16248
- const [nativeLamports, actualBalResp, snapshot] = yield Promise.all([
17400
+ const [nativeLamports, actualBalResp, snapshot, claimableLamports] = yield Promise.all([
16249
17401
  this.connection.getBalance(user, "confirmed"),
16250
17402
  this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
16251
- this.outpostClient.fetchWireState(user).catch(() => null)
17403
+ this.outpostClient.fetchWireState(user).catch(() => null),
17404
+ this.distributionClient.getClaimableLiqsol(user).catch(() => new anchor.BN(0))
16252
17405
  ]);
16253
17406
  const LIQSOL_DECIMALS = 9;
16254
17407
  const actualAmountStr = (_b = (_a = actualBalResp == null ? void 0 : actualBalResp.value) == null ? void 0 : _a.amount) != null ? _b : "0";
@@ -16285,6 +17438,12 @@ const _SolanaStakingClient = class _SolanaStakingClient {
16285
17438
  decimals: LIQSOL_DECIMALS,
16286
17439
  ata: userLiqsolAta
16287
17440
  },
17441
+ claimable: {
17442
+ amount: BigInt(claimableLamports.toString()),
17443
+ symbol: "LiqSOL",
17444
+ decimals: LIQSOL_DECIMALS,
17445
+ ata: userLiqsolAta
17446
+ },
16288
17447
  staked: {
16289
17448
  amount: stakedLiqsol,
16290
17449
  symbol: "LiqSOL",
@@ -42132,6 +43291,10 @@ class EthereumStakingClient {
42132
43291
  get network() {
42133
43292
  return this.config.network;
42134
43293
  }
43294
+ get address() {
43295
+ var _a;
43296
+ return (_a = this.signer) == null ? void 0 : _a.getAddress();
43297
+ }
42135
43298
  deposit(amount) {
42136
43299
  return __async(this, null, function* () {
42137
43300
  this.ensureUser();
@@ -42143,7 +43306,7 @@ class EthereumStakingClient {
42143
43306
  withdraw(amount) {
42144
43307
  return __async(this, null, function* () {
42145
43308
  this.ensureUser();
42146
- const address = yield this.signer.getAddress();
43309
+ const address = yield this.address;
42147
43310
  const amountWei = ethers.BigNumber.from(amount);
42148
43311
  const result = yield this.convertClient.performWithdraw(address, amountWei);
42149
43312
  return result.txHash;
@@ -42152,7 +43315,7 @@ class EthereumStakingClient {
42152
43315
  getPendingWithdraws() {
42153
43316
  return __async(this, null, function* () {
42154
43317
  this.ensureUser();
42155
- const address = yield this.signer.getAddress();
43318
+ const address = yield this.address;
42156
43319
  return yield this.receiptClient.fetchWithdrawReceipts(address);
42157
43320
  });
42158
43321
  }
@@ -42167,7 +43330,7 @@ class EthereumStakingClient {
42167
43330
  stake(amount) {
42168
43331
  return __async(this, null, function* () {
42169
43332
  this.ensureUser();
42170
- const walletAddress = yield this.signer.getAddress();
43333
+ const walletAddress = yield this.address;
42171
43334
  const amountWei = ethers.BigNumber.from(amount);
42172
43335
  const result = yield this.stakeClient.performStake(amountWei, walletAddress);
42173
43336
  return result.txHash;
@@ -42189,7 +43352,7 @@ class EthereumStakingClient {
42189
43352
  buy(amount) {
42190
43353
  return __async(this, null, function* () {
42191
43354
  this.ensureUser();
42192
- const buyer = yield this.signer.getAddress();
43355
+ const buyer = yield this.address;
42193
43356
  let result = yield this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
42194
43357
  return result && result.txHash ? result.txHash : "Error - no resulting txHash";
42195
43358
  });
@@ -42206,7 +43369,7 @@ class EthereumStakingClient {
42206
43369
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
42207
43370
  try {
42208
43371
  if (!this.signer) return Promise.resolve(null);
42209
- const walletAddress = yield this.signer.getAddress();
43372
+ const walletAddress = yield this.address;
42210
43373
  const nativeBalance = yield this.provider.getBalance(walletAddress);
42211
43374
  const nativeDecimals = (_c = (_b = (_a = this.network) == null ? void 0 : _a.nativeCurrency) == null ? void 0 : _b.decimals) != null ? _c : 18;
42212
43375
  const nativeSymbol = (_f = (_e = (_d = this.network) == null ? void 0 : _d.nativeCurrency) == null ? void 0 : _e.symbol) != null ? _f : "ETH";
@@ -42286,14 +43449,14 @@ class EthereumStakingClient {
42286
43449
  fetchPrelaunchReceipts(address) {
42287
43450
  return __async(this, null, function* () {
42288
43451
  this.ensureUser();
42289
- if (address === void 0) address = yield this.signer.getAddress();
43452
+ if (address === void 0) address = yield this.address;
42290
43453
  return yield this.receiptClient.stakeReceipts(address);
42291
43454
  });
42292
43455
  }
42293
43456
  getOPPMessages(address) {
42294
43457
  return __async(this, null, function* () {
42295
43458
  this.ensureUser();
42296
- if (!address) address = yield this.signer.getAddress();
43459
+ if (!address) address = yield this.address;
42297
43460
  return yield this.oppClient.getMessages(address);
42298
43461
  });
42299
43462
  }
@@ -42381,7 +43544,7 @@ class EthereumStakingClient {
42381
43544
  return __async(this, null, function* () {
42382
43545
  var _a, _b, _c, _d, _e;
42383
43546
  this.ensureUser();
42384
- const walletAddress = yield this.signer.getAddress();
43547
+ const walletAddress = yield this.address;
42385
43548
  const baseGas = yield this.provider.estimateGas({
42386
43549
  from: walletAddress,
42387
43550
  to: walletAddress,