@hodlmarkets/sdk 0.1.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 (68) hide show
  1. package/README.md +121 -0
  2. package/dist/accounts.cjs +1893 -0
  3. package/dist/accounts.cjs.map +1 -0
  4. package/dist/accounts.d.cts +9 -0
  5. package/dist/accounts.d.ts +9 -0
  6. package/dist/accounts.js +1885 -0
  7. package/dist/accounts.js.map +1 -0
  8. package/dist/client.cjs +2161 -0
  9. package/dist/client.cjs.map +1 -0
  10. package/dist/client.d.cts +44 -0
  11. package/dist/client.d.ts +44 -0
  12. package/dist/client.js +2155 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/constants.cjs +68 -0
  15. package/dist/constants.cjs.map +1 -0
  16. package/dist/constants.d.cts +62 -0
  17. package/dist/constants.d.ts +62 -0
  18. package/dist/constants.js +50 -0
  19. package/dist/constants.js.map +1 -0
  20. package/dist/errors.cjs +43 -0
  21. package/dist/errors.cjs.map +1 -0
  22. package/dist/errors.d.cts +8 -0
  23. package/dist/errors.d.ts +8 -0
  24. package/dist/errors.js +39 -0
  25. package/dist/errors.js.map +1 -0
  26. package/dist/events.cjs +1923 -0
  27. package/dist/events.cjs.map +1 -0
  28. package/dist/events.d.cts +20 -0
  29. package/dist/events.d.ts +20 -0
  30. package/dist/events.js +1913 -0
  31. package/dist/events.js.map +1 -0
  32. package/dist/index.cjs +2357 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +12 -0
  35. package/dist/index.d.ts +12 -0
  36. package/dist/index.js +2302 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/instructions.cjs +2022 -0
  39. package/dist/instructions.cjs.map +1 -0
  40. package/dist/instructions.d.cts +38 -0
  41. package/dist/instructions.d.ts +38 -0
  42. package/dist/instructions.js +2012 -0
  43. package/dist/instructions.js.map +1 -0
  44. package/dist/math.cjs +98 -0
  45. package/dist/math.cjs.map +1 -0
  46. package/dist/math.d.cts +58 -0
  47. package/dist/math.d.ts +58 -0
  48. package/dist/math.js +85 -0
  49. package/dist/math.js.map +1 -0
  50. package/dist/pda.cjs +52 -0
  51. package/dist/pda.cjs.map +1 -0
  52. package/dist/pda.d.cts +10 -0
  53. package/dist/pda.d.ts +10 -0
  54. package/dist/pda.js +41 -0
  55. package/dist/pda.js.map +1 -0
  56. package/dist/transaction.cjs +37 -0
  57. package/dist/transaction.cjs.map +1 -0
  58. package/dist/transaction.d.cts +11 -0
  59. package/dist/transaction.d.ts +11 -0
  60. package/dist/transaction.js +34 -0
  61. package/dist/transaction.js.map +1 -0
  62. package/dist/types.cjs +4 -0
  63. package/dist/types.cjs.map +1 -0
  64. package/dist/types.d.cts +153 -0
  65. package/dist/types.d.ts +153 -0
  66. package/dist/types.js +3 -0
  67. package/dist/types.js.map +1 -0
  68. package/package.json +96 -0
package/dist/events.js ADDED
@@ -0,0 +1,1913 @@
1
+ import { BorshCoder, EventParser } from '@coral-xyz/anchor';
2
+
3
+ // src/events.ts
4
+
5
+ // src/idl/hodl.json
6
+ var hodl_default = {
7
+ address: "hodLrUfwyK3Z7Td5hdZhyojyznG1rqbHVex11y5s4yG",
8
+ metadata: {
9
+ name: "hodl",
10
+ version: "0.1.0",
11
+ spec: "0.1.0"
12
+ },
13
+ instructions: [
14
+ {
15
+ name: "buy",
16
+ docs: [
17
+ "Buy tokens from the vAMM",
18
+ "",
19
+ "Tokens are split into tradable (immediate) and vaulted (accrue linearly).",
20
+ "Allocation is based on token-amount range bands: 40/60 at 0-50M, +5% per 50M band, 100/0 at 600M+.",
21
+ "After vest_duration passes, all buys are 100% tradable."
22
+ ],
23
+ discriminator: [
24
+ 102,
25
+ 6,
26
+ 61,
27
+ 18,
28
+ 1,
29
+ 218,
30
+ 235,
31
+ 234
32
+ ],
33
+ accounts: [
34
+ {
35
+ name: "buyer",
36
+ writable: true,
37
+ signer: true
38
+ },
39
+ {
40
+ name: "pool_state",
41
+ writable: true,
42
+ pda: {
43
+ seeds: [
44
+ {
45
+ kind: "const",
46
+ value: [
47
+ 112,
48
+ 111,
49
+ 111,
50
+ 108
51
+ ]
52
+ },
53
+ {
54
+ kind: "account",
55
+ path: "mint"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ name: "token_vault",
62
+ writable: true
63
+ },
64
+ {
65
+ name: "vault_authority",
66
+ pda: {
67
+ seeds: [
68
+ {
69
+ kind: "const",
70
+ value: [
71
+ 118,
72
+ 97,
73
+ 117,
74
+ 108,
75
+ 116,
76
+ 95,
77
+ 97,
78
+ 117,
79
+ 116,
80
+ 104,
81
+ 111,
82
+ 114,
83
+ 105,
84
+ 116,
85
+ 121
86
+ ]
87
+ },
88
+ {
89
+ kind: "account",
90
+ path: "pool_state"
91
+ }
92
+ ]
93
+ }
94
+ },
95
+ {
96
+ name: "buyer_token_account",
97
+ writable: true,
98
+ pda: {
99
+ seeds: [
100
+ {
101
+ kind: "account",
102
+ path: "buyer"
103
+ },
104
+ {
105
+ kind: "const",
106
+ value: [
107
+ 6,
108
+ 221,
109
+ 246,
110
+ 225,
111
+ 215,
112
+ 101,
113
+ 161,
114
+ 147,
115
+ 217,
116
+ 203,
117
+ 225,
118
+ 70,
119
+ 206,
120
+ 235,
121
+ 121,
122
+ 172,
123
+ 28,
124
+ 180,
125
+ 133,
126
+ 237,
127
+ 95,
128
+ 91,
129
+ 55,
130
+ 145,
131
+ 58,
132
+ 140,
133
+ 245,
134
+ 133,
135
+ 126,
136
+ 255,
137
+ 0,
138
+ 169
139
+ ]
140
+ },
141
+ {
142
+ kind: "account",
143
+ path: "mint"
144
+ }
145
+ ],
146
+ program: {
147
+ kind: "const",
148
+ value: [
149
+ 140,
150
+ 151,
151
+ 37,
152
+ 143,
153
+ 78,
154
+ 36,
155
+ 137,
156
+ 241,
157
+ 187,
158
+ 61,
159
+ 16,
160
+ 41,
161
+ 20,
162
+ 142,
163
+ 13,
164
+ 131,
165
+ 11,
166
+ 90,
167
+ 19,
168
+ 153,
169
+ 218,
170
+ 255,
171
+ 16,
172
+ 132,
173
+ 4,
174
+ 142,
175
+ 123,
176
+ 216,
177
+ 219,
178
+ 233,
179
+ 248,
180
+ 89
181
+ ]
182
+ }
183
+ }
184
+ },
185
+ {
186
+ name: "pool_sol_account",
187
+ writable: true,
188
+ pda: {
189
+ seeds: [
190
+ {
191
+ kind: "const",
192
+ value: [
193
+ 115,
194
+ 111,
195
+ 108,
196
+ 95,
197
+ 118,
198
+ 97,
199
+ 117,
200
+ 108,
201
+ 116
202
+ ]
203
+ },
204
+ {
205
+ kind: "account",
206
+ path: "pool_state"
207
+ }
208
+ ]
209
+ }
210
+ },
211
+ {
212
+ name: "mint"
213
+ },
214
+ {
215
+ name: "token_program",
216
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
217
+ },
218
+ {
219
+ name: "associated_token_program",
220
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
221
+ },
222
+ {
223
+ name: "system_program",
224
+ address: "11111111111111111111111111111111"
225
+ },
226
+ {
227
+ name: "position",
228
+ writable: true,
229
+ pda: {
230
+ seeds: [
231
+ {
232
+ kind: "const",
233
+ value: [
234
+ 112,
235
+ 111,
236
+ 115,
237
+ 105,
238
+ 116,
239
+ 105,
240
+ 111,
241
+ 110
242
+ ]
243
+ },
244
+ {
245
+ kind: "account",
246
+ path: "pool_state"
247
+ },
248
+ {
249
+ kind: "account",
250
+ path: "buyer"
251
+ }
252
+ ]
253
+ }
254
+ },
255
+ {
256
+ name: "event_authority",
257
+ pda: {
258
+ seeds: [
259
+ {
260
+ kind: "const",
261
+ value: [
262
+ 95,
263
+ 95,
264
+ 101,
265
+ 118,
266
+ 101,
267
+ 110,
268
+ 116,
269
+ 95,
270
+ 97,
271
+ 117,
272
+ 116,
273
+ 104,
274
+ 111,
275
+ 114,
276
+ 105,
277
+ 116,
278
+ 121
279
+ ]
280
+ }
281
+ ]
282
+ }
283
+ },
284
+ {
285
+ name: "program"
286
+ }
287
+ ],
288
+ args: [
289
+ {
290
+ name: "sol_amount",
291
+ type: "u64"
292
+ },
293
+ {
294
+ name: "min_tokens_out",
295
+ type: "u64"
296
+ }
297
+ ]
298
+ },
299
+ {
300
+ name: "claim_accrued",
301
+ docs: [
302
+ "Claim accrued tokens",
303
+ "Transfers tokens that have accrued from vaulted to tradable from vault to wallet"
304
+ ],
305
+ discriminator: [
306
+ 209,
307
+ 92,
308
+ 30,
309
+ 216,
310
+ 89,
311
+ 249,
312
+ 122,
313
+ 243
314
+ ],
315
+ accounts: [
316
+ {
317
+ name: "owner",
318
+ signer: true
319
+ },
320
+ {
321
+ name: "pool_state",
322
+ writable: true,
323
+ pda: {
324
+ seeds: [
325
+ {
326
+ kind: "const",
327
+ value: [
328
+ 112,
329
+ 111,
330
+ 111,
331
+ 108
332
+ ]
333
+ },
334
+ {
335
+ kind: "account",
336
+ path: "pool_state.mint",
337
+ account: "PoolState"
338
+ }
339
+ ]
340
+ }
341
+ },
342
+ {
343
+ name: "position",
344
+ writable: true,
345
+ pda: {
346
+ seeds: [
347
+ {
348
+ kind: "const",
349
+ value: [
350
+ 112,
351
+ 111,
352
+ 115,
353
+ 105,
354
+ 116,
355
+ 105,
356
+ 111,
357
+ 110
358
+ ]
359
+ },
360
+ {
361
+ kind: "account",
362
+ path: "pool_state"
363
+ },
364
+ {
365
+ kind: "account",
366
+ path: "owner"
367
+ }
368
+ ]
369
+ }
370
+ },
371
+ {
372
+ name: "token_vault",
373
+ writable: true
374
+ },
375
+ {
376
+ name: "vault_authority",
377
+ pda: {
378
+ seeds: [
379
+ {
380
+ kind: "const",
381
+ value: [
382
+ 118,
383
+ 97,
384
+ 117,
385
+ 108,
386
+ 116,
387
+ 95,
388
+ 97,
389
+ 117,
390
+ 116,
391
+ 104,
392
+ 111,
393
+ 114,
394
+ 105,
395
+ 116,
396
+ 121
397
+ ]
398
+ },
399
+ {
400
+ kind: "account",
401
+ path: "pool_state"
402
+ }
403
+ ]
404
+ }
405
+ },
406
+ {
407
+ name: "user_token_account",
408
+ writable: true
409
+ },
410
+ {
411
+ name: "token_program",
412
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
413
+ },
414
+ {
415
+ name: "event_authority",
416
+ pda: {
417
+ seeds: [
418
+ {
419
+ kind: "const",
420
+ value: [
421
+ 95,
422
+ 95,
423
+ 101,
424
+ 118,
425
+ 101,
426
+ 110,
427
+ 116,
428
+ 95,
429
+ 97,
430
+ 117,
431
+ 116,
432
+ 104,
433
+ 111,
434
+ 114,
435
+ 105,
436
+ 116,
437
+ 121
438
+ ]
439
+ }
440
+ ]
441
+ }
442
+ },
443
+ {
444
+ name: "program"
445
+ }
446
+ ],
447
+ args: []
448
+ },
449
+ {
450
+ name: "close_position",
451
+ docs: [
452
+ "Close an empty position account and reclaim rent"
453
+ ],
454
+ discriminator: [
455
+ 123,
456
+ 134,
457
+ 81,
458
+ 0,
459
+ 49,
460
+ 68,
461
+ 98,
462
+ 98
463
+ ],
464
+ accounts: [
465
+ {
466
+ name: "owner",
467
+ writable: true,
468
+ signer: true
469
+ },
470
+ {
471
+ name: "pool_state",
472
+ writable: true
473
+ },
474
+ {
475
+ name: "position",
476
+ writable: true,
477
+ pda: {
478
+ seeds: [
479
+ {
480
+ kind: "const",
481
+ value: [
482
+ 112,
483
+ 111,
484
+ 115,
485
+ 105,
486
+ 116,
487
+ 105,
488
+ 111,
489
+ 110
490
+ ]
491
+ },
492
+ {
493
+ kind: "account",
494
+ path: "pool_state"
495
+ },
496
+ {
497
+ kind: "account",
498
+ path: "owner"
499
+ }
500
+ ]
501
+ }
502
+ },
503
+ {
504
+ name: "user_token_account",
505
+ writable: true
506
+ },
507
+ {
508
+ name: "mint"
509
+ },
510
+ {
511
+ name: "token_program",
512
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
513
+ },
514
+ {
515
+ name: "system_program",
516
+ address: "11111111111111111111111111111111"
517
+ },
518
+ {
519
+ name: "event_authority",
520
+ pda: {
521
+ seeds: [
522
+ {
523
+ kind: "const",
524
+ value: [
525
+ 95,
526
+ 95,
527
+ 101,
528
+ 118,
529
+ 101,
530
+ 110,
531
+ 116,
532
+ 95,
533
+ 97,
534
+ 117,
535
+ 116,
536
+ 104,
537
+ 111,
538
+ 114,
539
+ 105,
540
+ 116,
541
+ 121
542
+ ]
543
+ }
544
+ ]
545
+ }
546
+ },
547
+ {
548
+ name: "program"
549
+ }
550
+ ],
551
+ args: []
552
+ },
553
+ {
554
+ name: "create_token",
555
+ docs: [
556
+ "Create a new token and initialize vAMM pool"
557
+ ],
558
+ discriminator: [
559
+ 84,
560
+ 52,
561
+ 204,
562
+ 228,
563
+ 24,
564
+ 140,
565
+ 234,
566
+ 75
567
+ ],
568
+ accounts: [
569
+ {
570
+ name: "creator",
571
+ writable: true,
572
+ signer: true
573
+ },
574
+ {
575
+ name: "protocol_authority"
576
+ },
577
+ {
578
+ name: "mint",
579
+ writable: true,
580
+ signer: true
581
+ },
582
+ {
583
+ name: "pool_state",
584
+ writable: true,
585
+ pda: {
586
+ seeds: [
587
+ {
588
+ kind: "const",
589
+ value: [
590
+ 112,
591
+ 111,
592
+ 111,
593
+ 108
594
+ ]
595
+ },
596
+ {
597
+ kind: "account",
598
+ path: "mint"
599
+ }
600
+ ]
601
+ }
602
+ },
603
+ {
604
+ name: "token_vault",
605
+ writable: true
606
+ },
607
+ {
608
+ name: "vault_authority",
609
+ pda: {
610
+ seeds: [
611
+ {
612
+ kind: "const",
613
+ value: [
614
+ 118,
615
+ 97,
616
+ 117,
617
+ 108,
618
+ 116,
619
+ 95,
620
+ 97,
621
+ 117,
622
+ 116,
623
+ 104,
624
+ 111,
625
+ 114,
626
+ 105,
627
+ 116,
628
+ 121
629
+ ]
630
+ },
631
+ {
632
+ kind: "account",
633
+ path: "pool_state"
634
+ }
635
+ ]
636
+ }
637
+ },
638
+ {
639
+ name: "metadata",
640
+ writable: true
641
+ },
642
+ {
643
+ name: "pool_sol_account",
644
+ writable: true
645
+ },
646
+ {
647
+ name: "protocol_fee_wallet",
648
+ writable: true,
649
+ pda: {
650
+ seeds: [
651
+ {
652
+ kind: "const",
653
+ value: [
654
+ 112,
655
+ 114,
656
+ 111,
657
+ 116,
658
+ 111,
659
+ 99,
660
+ 111,
661
+ 108,
662
+ 95,
663
+ 102,
664
+ 101,
665
+ 101,
666
+ 115
667
+ ]
668
+ }
669
+ ]
670
+ }
671
+ },
672
+ {
673
+ name: "token_program",
674
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
675
+ },
676
+ {
677
+ name: "associated_token_program",
678
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
679
+ },
680
+ {
681
+ name: "system_program",
682
+ address: "11111111111111111111111111111111"
683
+ },
684
+ {
685
+ name: "rent",
686
+ address: "SysvarRent111111111111111111111111111111111"
687
+ },
688
+ {
689
+ name: "metadata_program"
690
+ },
691
+ {
692
+ name: "sysvar_instructions"
693
+ },
694
+ {
695
+ name: "event_authority",
696
+ pda: {
697
+ seeds: [
698
+ {
699
+ kind: "const",
700
+ value: [
701
+ 95,
702
+ 95,
703
+ 101,
704
+ 118,
705
+ 101,
706
+ 110,
707
+ 116,
708
+ 95,
709
+ 97,
710
+ 117,
711
+ 116,
712
+ 104,
713
+ 111,
714
+ 114,
715
+ 105,
716
+ 116,
717
+ 121
718
+ ]
719
+ }
720
+ ]
721
+ }
722
+ },
723
+ {
724
+ name: "program"
725
+ }
726
+ ],
727
+ args: [
728
+ {
729
+ name: "name",
730
+ type: "string"
731
+ },
732
+ {
733
+ name: "symbol",
734
+ type: "string"
735
+ },
736
+ {
737
+ name: "uri",
738
+ type: "string"
739
+ },
740
+ {
741
+ name: "pool_description",
742
+ type: "string"
743
+ },
744
+ {
745
+ name: "vest_duration",
746
+ type: "i64"
747
+ }
748
+ ]
749
+ },
750
+ {
751
+ name: "emergency_withdraw_sol",
752
+ docs: [
753
+ "Emergency withdraw SOL from a pool's sol_vault"
754
+ ],
755
+ discriminator: [
756
+ 219,
757
+ 156,
758
+ 123,
759
+ 176,
760
+ 91,
761
+ 105,
762
+ 30,
763
+ 160
764
+ ],
765
+ accounts: [
766
+ {
767
+ name: "authority",
768
+ writable: true,
769
+ signer: true
770
+ },
771
+ {
772
+ name: "pool_state"
773
+ },
774
+ {
775
+ name: "sol_vault",
776
+ writable: true,
777
+ pda: {
778
+ seeds: [
779
+ {
780
+ kind: "const",
781
+ value: [
782
+ 115,
783
+ 111,
784
+ 108,
785
+ 95,
786
+ 118,
787
+ 97,
788
+ 117,
789
+ 108,
790
+ 116
791
+ ]
792
+ },
793
+ {
794
+ kind: "account",
795
+ path: "pool_state"
796
+ }
797
+ ]
798
+ }
799
+ },
800
+ {
801
+ name: "system_program",
802
+ address: "11111111111111111111111111111111"
803
+ }
804
+ ],
805
+ args: [
806
+ {
807
+ name: "amount",
808
+ type: "u64"
809
+ }
810
+ ]
811
+ },
812
+ {
813
+ name: "sell",
814
+ docs: [
815
+ "Sell tokens back to the vAMM",
816
+ "If sell_percentage is provided, it overrides token_amount"
817
+ ],
818
+ discriminator: [
819
+ 51,
820
+ 230,
821
+ 133,
822
+ 164,
823
+ 1,
824
+ 127,
825
+ 131,
826
+ 173
827
+ ],
828
+ accounts: [
829
+ {
830
+ name: "seller",
831
+ writable: true,
832
+ signer: true
833
+ },
834
+ {
835
+ name: "pool_state",
836
+ writable: true,
837
+ pda: {
838
+ seeds: [
839
+ {
840
+ kind: "const",
841
+ value: [
842
+ 112,
843
+ 111,
844
+ 111,
845
+ 108
846
+ ]
847
+ },
848
+ {
849
+ kind: "account",
850
+ path: "mint"
851
+ }
852
+ ]
853
+ }
854
+ },
855
+ {
856
+ name: "position",
857
+ writable: true,
858
+ pda: {
859
+ seeds: [
860
+ {
861
+ kind: "const",
862
+ value: [
863
+ 112,
864
+ 111,
865
+ 115,
866
+ 105,
867
+ 116,
868
+ 105,
869
+ 111,
870
+ 110
871
+ ]
872
+ },
873
+ {
874
+ kind: "account",
875
+ path: "pool_state"
876
+ },
877
+ {
878
+ kind: "account",
879
+ path: "seller"
880
+ }
881
+ ]
882
+ }
883
+ },
884
+ {
885
+ name: "token_vault",
886
+ writable: true
887
+ },
888
+ {
889
+ name: "vault_authority",
890
+ pda: {
891
+ seeds: [
892
+ {
893
+ kind: "const",
894
+ value: [
895
+ 118,
896
+ 97,
897
+ 117,
898
+ 108,
899
+ 116,
900
+ 95,
901
+ 97,
902
+ 117,
903
+ 116,
904
+ 104,
905
+ 111,
906
+ 114,
907
+ 105,
908
+ 116,
909
+ 121
910
+ ]
911
+ },
912
+ {
913
+ kind: "account",
914
+ path: "pool_state"
915
+ }
916
+ ]
917
+ }
918
+ },
919
+ {
920
+ name: "seller_token_account",
921
+ writable: true
922
+ },
923
+ {
924
+ name: "pool_sol_account",
925
+ writable: true,
926
+ pda: {
927
+ seeds: [
928
+ {
929
+ kind: "const",
930
+ value: [
931
+ 115,
932
+ 111,
933
+ 108,
934
+ 95,
935
+ 118,
936
+ 97,
937
+ 117,
938
+ 108,
939
+ 116
940
+ ]
941
+ },
942
+ {
943
+ kind: "account",
944
+ path: "pool_state"
945
+ }
946
+ ]
947
+ }
948
+ },
949
+ {
950
+ name: "mint"
951
+ },
952
+ {
953
+ name: "token_program",
954
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
955
+ },
956
+ {
957
+ name: "system_program",
958
+ address: "11111111111111111111111111111111"
959
+ },
960
+ {
961
+ name: "event_authority",
962
+ pda: {
963
+ seeds: [
964
+ {
965
+ kind: "const",
966
+ value: [
967
+ 95,
968
+ 95,
969
+ 101,
970
+ 118,
971
+ 101,
972
+ 110,
973
+ 116,
974
+ 95,
975
+ 97,
976
+ 117,
977
+ 116,
978
+ 104,
979
+ 111,
980
+ 114,
981
+ 105,
982
+ 116,
983
+ 121
984
+ ]
985
+ }
986
+ ]
987
+ }
988
+ },
989
+ {
990
+ name: "program"
991
+ }
992
+ ],
993
+ args: [
994
+ {
995
+ name: "token_amount",
996
+ type: "u64"
997
+ },
998
+ {
999
+ name: "min_sol_out",
1000
+ type: "u64"
1001
+ },
1002
+ {
1003
+ name: "sell_percentage",
1004
+ type: {
1005
+ option: "u8"
1006
+ }
1007
+ }
1008
+ ]
1009
+ },
1010
+ {
1011
+ name: "withdraw_protocol_fees",
1012
+ docs: [
1013
+ "Withdraw accumulated protocol fees"
1014
+ ],
1015
+ discriminator: [
1016
+ 11,
1017
+ 68,
1018
+ 165,
1019
+ 98,
1020
+ 18,
1021
+ 208,
1022
+ 134,
1023
+ 73
1024
+ ],
1025
+ accounts: [
1026
+ {
1027
+ name: "authority",
1028
+ writable: true,
1029
+ signer: true
1030
+ },
1031
+ {
1032
+ name: "protocol_fee_wallet",
1033
+ writable: true,
1034
+ pda: {
1035
+ seeds: [
1036
+ {
1037
+ kind: "const",
1038
+ value: [
1039
+ 112,
1040
+ 114,
1041
+ 111,
1042
+ 116,
1043
+ 111,
1044
+ 99,
1045
+ 111,
1046
+ 108,
1047
+ 95,
1048
+ 102,
1049
+ 101,
1050
+ 101,
1051
+ 115
1052
+ ]
1053
+ }
1054
+ ]
1055
+ }
1056
+ },
1057
+ {
1058
+ name: "system_program",
1059
+ address: "11111111111111111111111111111111"
1060
+ }
1061
+ ],
1062
+ args: [
1063
+ {
1064
+ name: "amount",
1065
+ type: "u64"
1066
+ }
1067
+ ]
1068
+ }
1069
+ ],
1070
+ accounts: [
1071
+ {
1072
+ name: "PoolState",
1073
+ discriminator: [
1074
+ 247,
1075
+ 237,
1076
+ 227,
1077
+ 245,
1078
+ 215,
1079
+ 195,
1080
+ 222,
1081
+ 70
1082
+ ]
1083
+ },
1084
+ {
1085
+ name: "Position",
1086
+ discriminator: [
1087
+ 170,
1088
+ 188,
1089
+ 143,
1090
+ 228,
1091
+ 122,
1092
+ 64,
1093
+ 247,
1094
+ 208
1095
+ ]
1096
+ }
1097
+ ],
1098
+ events: [
1099
+ {
1100
+ name: "AccrualClaimed",
1101
+ discriminator: [
1102
+ 86,
1103
+ 99,
1104
+ 51,
1105
+ 211,
1106
+ 226,
1107
+ 48,
1108
+ 235,
1109
+ 238
1110
+ ]
1111
+ },
1112
+ {
1113
+ name: "PositionClosed",
1114
+ discriminator: [
1115
+ 157,
1116
+ 163,
1117
+ 227,
1118
+ 228,
1119
+ 13,
1120
+ 97,
1121
+ 138,
1122
+ 121
1123
+ ]
1124
+ },
1125
+ {
1126
+ name: "TokenCreated",
1127
+ discriminator: [
1128
+ 236,
1129
+ 19,
1130
+ 41,
1131
+ 255,
1132
+ 130,
1133
+ 78,
1134
+ 147,
1135
+ 172
1136
+ ]
1137
+ },
1138
+ {
1139
+ name: "TokenPurchased",
1140
+ discriminator: [
1141
+ 3,
1142
+ 73,
1143
+ 186,
1144
+ 50,
1145
+ 15,
1146
+ 181,
1147
+ 213,
1148
+ 37
1149
+ ]
1150
+ },
1151
+ {
1152
+ name: "TokenSold",
1153
+ discriminator: [
1154
+ 88,
1155
+ 61,
1156
+ 1,
1157
+ 247,
1158
+ 185,
1159
+ 6,
1160
+ 252,
1161
+ 86
1162
+ ]
1163
+ }
1164
+ ],
1165
+ errors: [
1166
+ {
1167
+ code: 7005,
1168
+ name: "InsufficientTokens",
1169
+ msg: "Insufficient token reserves in vault"
1170
+ },
1171
+ {
1172
+ code: 7100,
1173
+ name: "ArithmeticOverflow",
1174
+ msg: "Arithmetic overflow"
1175
+ },
1176
+ {
1177
+ code: 7102,
1178
+ name: "DivisionError",
1179
+ msg: "Division by zero or invalid division"
1180
+ },
1181
+ {
1182
+ code: 7104,
1183
+ name: "TokenOverflow",
1184
+ msg: "Token calculation overflow"
1185
+ },
1186
+ {
1187
+ code: 7105,
1188
+ name: "TokenUnderflow",
1189
+ msg: "Token calculation underflow"
1190
+ },
1191
+ {
1192
+ code: 7200,
1193
+ name: "SlippageExceeded",
1194
+ msg: "Slippage exceeded: output below minimum threshold"
1195
+ },
1196
+ {
1197
+ code: 7312,
1198
+ name: "AccrualCalculationOverflow",
1199
+ msg: "Accrual calculation overflow"
1200
+ },
1201
+ {
1202
+ code: 7315,
1203
+ name: "PositionNotEmpty",
1204
+ msg: "Position is not empty, must sell all tokens first"
1205
+ },
1206
+ {
1207
+ code: 7319,
1208
+ name: "InvalidProtocolAuthority",
1209
+ msg: "Invalid protocol authority - must match PROTOCOL_AUTHORITY constant"
1210
+ },
1211
+ {
1212
+ code: 7321,
1213
+ name: "MustHaveUnlockedPortion",
1214
+ msg: "Position must have tokens to perform this operation"
1215
+ },
1216
+ {
1217
+ code: 7500,
1218
+ name: "PositionNotOwnedBySigner",
1219
+ msg: "Position not owned by signer"
1220
+ },
1221
+ {
1222
+ code: 7505,
1223
+ name: "InvalidSolVaultPDA",
1224
+ msg: "SOL vault PDA derivation mismatch"
1225
+ },
1226
+ {
1227
+ code: 7601,
1228
+ name: "InvalidVestingType",
1229
+ msg: "Invalid vesting type"
1230
+ },
1231
+ {
1232
+ code: 7604,
1233
+ name: "InvalidPercentage",
1234
+ msg: "Invalid percentage value (must be 0-100)"
1235
+ },
1236
+ {
1237
+ code: 7901,
1238
+ name: "NotAuthorized",
1239
+ msg: "Not authorized"
1240
+ },
1241
+ {
1242
+ code: 8014,
1243
+ name: "InsufficientLiquidity",
1244
+ msg: "Insufficient liquidity"
1245
+ },
1246
+ {
1247
+ code: 8018,
1248
+ name: "VammNotActive",
1249
+ msg: "vAMM is not active"
1250
+ },
1251
+ {
1252
+ code: 8020,
1253
+ name: "InvalidAmount",
1254
+ msg: "Invalid amount"
1255
+ }
1256
+ ],
1257
+ types: [
1258
+ {
1259
+ name: "AccrualClaimed",
1260
+ docs: [
1261
+ "Event emitted when accrued tokens are claimed"
1262
+ ],
1263
+ type: {
1264
+ kind: "struct",
1265
+ fields: [
1266
+ {
1267
+ name: "owner",
1268
+ type: "pubkey"
1269
+ },
1270
+ {
1271
+ name: "pool",
1272
+ type: "pubkey"
1273
+ },
1274
+ {
1275
+ name: "position",
1276
+ type: "pubkey"
1277
+ },
1278
+ {
1279
+ name: "tokens_claimed",
1280
+ type: "u64"
1281
+ },
1282
+ {
1283
+ name: "new_tradable_tokens",
1284
+ type: "u64"
1285
+ },
1286
+ {
1287
+ name: "remaining_vaulted_tokens",
1288
+ type: "u64"
1289
+ },
1290
+ {
1291
+ name: "tokens_transferred",
1292
+ type: "u64"
1293
+ },
1294
+ {
1295
+ name: "initial_vaulted",
1296
+ type: "u64"
1297
+ },
1298
+ {
1299
+ name: "timestamp",
1300
+ type: "i64"
1301
+ }
1302
+ ]
1303
+ }
1304
+ },
1305
+ {
1306
+ name: "PoolMetadata",
1307
+ type: {
1308
+ kind: "struct",
1309
+ fields: [
1310
+ {
1311
+ name: "name",
1312
+ docs: [
1313
+ "Optional pool name"
1314
+ ],
1315
+ type: "string"
1316
+ },
1317
+ {
1318
+ name: "description",
1319
+ docs: [
1320
+ "Optional pool description"
1321
+ ],
1322
+ type: "string"
1323
+ },
1324
+ {
1325
+ name: "version",
1326
+ docs: [
1327
+ "Pool version"
1328
+ ],
1329
+ type: "u8"
1330
+ }
1331
+ ]
1332
+ }
1333
+ },
1334
+ {
1335
+ name: "PoolState",
1336
+ docs: [
1337
+ "Pool state account - main state for a vAMM pool"
1338
+ ],
1339
+ type: {
1340
+ kind: "struct",
1341
+ fields: [
1342
+ {
1343
+ name: "authority",
1344
+ docs: [
1345
+ "Pool authority (creator)"
1346
+ ],
1347
+ type: "pubkey"
1348
+ },
1349
+ {
1350
+ name: "mint",
1351
+ docs: [
1352
+ "Token mint for this pool"
1353
+ ],
1354
+ type: "pubkey"
1355
+ },
1356
+ {
1357
+ name: "token_vault",
1358
+ docs: [
1359
+ "Token vault (holds unsold tokens)"
1360
+ ],
1361
+ type: "pubkey"
1362
+ },
1363
+ {
1364
+ name: "vault_authority",
1365
+ docs: [
1366
+ "Vault authority (PDA)"
1367
+ ],
1368
+ type: "pubkey"
1369
+ },
1370
+ {
1371
+ name: "sol_vault",
1372
+ docs: [
1373
+ "Pool SOL vault (holds raised SOL)"
1374
+ ],
1375
+ type: "pubkey"
1376
+ },
1377
+ {
1378
+ name: "total_positions",
1379
+ docs: [
1380
+ "Total number of positions in this pool"
1381
+ ],
1382
+ type: "u64"
1383
+ },
1384
+ {
1385
+ name: "creation_timestamp",
1386
+ docs: [
1387
+ "Pool creation timestamp (Unix timestamp)"
1388
+ ],
1389
+ type: "i64"
1390
+ },
1391
+ {
1392
+ name: "last_update_timestamp",
1393
+ docs: [
1394
+ "Last update timestamp (Unix timestamp)"
1395
+ ],
1396
+ type: "i64"
1397
+ },
1398
+ {
1399
+ name: "metadata",
1400
+ docs: [
1401
+ "Pool metadata"
1402
+ ],
1403
+ type: {
1404
+ defined: {
1405
+ name: "PoolMetadata"
1406
+ }
1407
+ }
1408
+ },
1409
+ {
1410
+ name: "vest_duration",
1411
+ docs: [
1412
+ "=== ACCRUAL SYSTEM FIELDS ===",
1413
+ "Dev-set unlock duration in seconds (applies to all traders)"
1414
+ ],
1415
+ type: "i64"
1416
+ },
1417
+ {
1418
+ name: "next_position_number",
1419
+ docs: [
1420
+ "Next position number to assign (sequential counter for display/identity)"
1421
+ ],
1422
+ type: "u64"
1423
+ },
1424
+ {
1425
+ name: "vamm_active",
1426
+ docs: [
1427
+ "=== VAMM STATE ===",
1428
+ "vAMM is active for trading"
1429
+ ],
1430
+ type: "bool"
1431
+ },
1432
+ {
1433
+ name: "vamm_real_sol",
1434
+ docs: [
1435
+ "Real SOL in the vAMM"
1436
+ ],
1437
+ type: "u64"
1438
+ },
1439
+ {
1440
+ name: "vamm_tokens",
1441
+ docs: [
1442
+ "Real tokens in the vAMM"
1443
+ ],
1444
+ type: "u64"
1445
+ },
1446
+ {
1447
+ name: "vamm_k",
1448
+ docs: [
1449
+ "The invariant k (set at creation, never changes)",
1450
+ "k = (vamm_real_sol + VIRTUAL_SOL) * vamm_tokens"
1451
+ ],
1452
+ type: "u128"
1453
+ },
1454
+ {
1455
+ name: "tokens_sold",
1456
+ docs: [
1457
+ "Cumulative tokens bought from vAMM (increases on buy, decreases on sell)"
1458
+ ],
1459
+ type: "u64"
1460
+ },
1461
+ {
1462
+ name: "tokens_reserved_for_claims",
1463
+ docs: [
1464
+ "Vault tokens reserved for position claims (not available for vAMM liquidity)",
1465
+ "Incremented on buy (vaulted portion), decremented on claim_accrued"
1466
+ ],
1467
+ type: "u64"
1468
+ },
1469
+ {
1470
+ name: "bump_vault_auth",
1471
+ docs: [
1472
+ "Bump seeds for PDAs"
1473
+ ],
1474
+ type: "u8"
1475
+ },
1476
+ {
1477
+ name: "bump_pool",
1478
+ type: "u8"
1479
+ }
1480
+ ]
1481
+ }
1482
+ },
1483
+ {
1484
+ name: "Position",
1485
+ docs: [
1486
+ "Position in a vAMM pool",
1487
+ "Tokens split into tradable (immediate) and vaulted (accrue linearly over vest_duration)"
1488
+ ],
1489
+ type: {
1490
+ kind: "struct",
1491
+ fields: [
1492
+ {
1493
+ name: "owner",
1494
+ docs: [
1495
+ "Owner's public key"
1496
+ ],
1497
+ type: {
1498
+ array: [
1499
+ "u8",
1500
+ 32
1501
+ ]
1502
+ }
1503
+ },
1504
+ {
1505
+ name: "pool",
1506
+ docs: [
1507
+ "Pool this position belongs to"
1508
+ ],
1509
+ type: {
1510
+ array: [
1511
+ "u8",
1512
+ 32
1513
+ ]
1514
+ }
1515
+ },
1516
+ {
1517
+ name: "tradable_tokens",
1518
+ docs: [
1519
+ "Tradable tokens (can be sold immediately)"
1520
+ ],
1521
+ type: "u64"
1522
+ },
1523
+ {
1524
+ name: "vaulted_tokens",
1525
+ docs: [
1526
+ "Vaulted tokens (accruing linearly to tradable)"
1527
+ ],
1528
+ type: "u64"
1529
+ },
1530
+ {
1531
+ name: "sol_spent",
1532
+ docs: [
1533
+ "SOL spent on this position"
1534
+ ],
1535
+ type: "u64"
1536
+ },
1537
+ {
1538
+ name: "tokens_transferred",
1539
+ docs: [
1540
+ "Cumulative tokens transferred to wallet (for claim_accrued tracking)"
1541
+ ],
1542
+ type: "u64"
1543
+ },
1544
+ {
1545
+ name: "entry_timestamp",
1546
+ docs: [
1547
+ "Entry timestamp (for accrual calculation)"
1548
+ ],
1549
+ type: "i64"
1550
+ },
1551
+ {
1552
+ name: "initial_vaulted",
1553
+ docs: [
1554
+ "Cumulative initial vaulted tokens from all buys (for accrual calculation)",
1555
+ "This tracks the total vaulted amount at buy time, used to calculate accrual progress"
1556
+ ],
1557
+ type: "u64"
1558
+ },
1559
+ {
1560
+ name: "position_number",
1561
+ docs: [
1562
+ "Position number in the pool (sequential counter for display/identity)"
1563
+ ],
1564
+ type: "u64"
1565
+ },
1566
+ {
1567
+ name: "last_update_timestamp",
1568
+ docs: [
1569
+ "Last update timestamp"
1570
+ ],
1571
+ type: "i64"
1572
+ }
1573
+ ]
1574
+ }
1575
+ },
1576
+ {
1577
+ name: "PositionClosed",
1578
+ docs: [
1579
+ "Event emitted when a position account is closed"
1580
+ ],
1581
+ type: {
1582
+ kind: "struct",
1583
+ fields: [
1584
+ {
1585
+ name: "owner",
1586
+ type: "pubkey"
1587
+ },
1588
+ {
1589
+ name: "pool",
1590
+ type: "pubkey"
1591
+ },
1592
+ {
1593
+ name: "position",
1594
+ type: "pubkey"
1595
+ },
1596
+ {
1597
+ name: "rent_reclaimed",
1598
+ type: "u64"
1599
+ },
1600
+ {
1601
+ name: "timestamp",
1602
+ type: "i64"
1603
+ }
1604
+ ]
1605
+ }
1606
+ },
1607
+ {
1608
+ name: "TokenCreated",
1609
+ docs: [
1610
+ "Event emitted when a new token and vAMM pool is created"
1611
+ ],
1612
+ type: {
1613
+ kind: "struct",
1614
+ fields: [
1615
+ {
1616
+ name: "mint",
1617
+ type: "pubkey"
1618
+ },
1619
+ {
1620
+ name: "pool",
1621
+ type: "pubkey"
1622
+ },
1623
+ {
1624
+ name: "creator",
1625
+ type: "pubkey"
1626
+ },
1627
+ {
1628
+ name: "name",
1629
+ type: "string"
1630
+ },
1631
+ {
1632
+ name: "symbol",
1633
+ type: "string"
1634
+ },
1635
+ {
1636
+ name: "total_supply",
1637
+ type: "u64"
1638
+ },
1639
+ {
1640
+ name: "initial_k",
1641
+ type: "u128"
1642
+ },
1643
+ {
1644
+ name: "vamm_tokens",
1645
+ type: "u64"
1646
+ },
1647
+ {
1648
+ name: "vest_duration",
1649
+ type: "i64"
1650
+ },
1651
+ {
1652
+ name: "creation_timestamp",
1653
+ type: "i64"
1654
+ }
1655
+ ]
1656
+ }
1657
+ },
1658
+ {
1659
+ name: "TokenPurchased",
1660
+ docs: [
1661
+ "Event emitted when tokens are bought"
1662
+ ],
1663
+ type: {
1664
+ kind: "struct",
1665
+ fields: [
1666
+ {
1667
+ name: "buyer",
1668
+ type: "pubkey"
1669
+ },
1670
+ {
1671
+ name: "pool",
1672
+ type: "pubkey"
1673
+ },
1674
+ {
1675
+ name: "mint",
1676
+ type: "pubkey"
1677
+ },
1678
+ {
1679
+ name: "sol_amount",
1680
+ type: "u64"
1681
+ },
1682
+ {
1683
+ name: "tokens_received",
1684
+ type: "u64"
1685
+ },
1686
+ {
1687
+ name: "vamm_real_sol",
1688
+ type: "u64"
1689
+ },
1690
+ {
1691
+ name: "vamm_tokens",
1692
+ type: "u64"
1693
+ },
1694
+ {
1695
+ name: "tokens_sold",
1696
+ type: "u64"
1697
+ },
1698
+ {
1699
+ name: "position",
1700
+ type: "pubkey"
1701
+ },
1702
+ {
1703
+ name: "position_number",
1704
+ type: "u64"
1705
+ },
1706
+ {
1707
+ name: "vest_duration",
1708
+ type: "i64"
1709
+ },
1710
+ {
1711
+ name: "unlock_time_seconds",
1712
+ type: "i64"
1713
+ },
1714
+ {
1715
+ name: "tradable_tokens",
1716
+ docs: [
1717
+ "Position state after buy"
1718
+ ],
1719
+ type: "u64"
1720
+ },
1721
+ {
1722
+ name: "vaulted_tokens",
1723
+ type: "u64"
1724
+ },
1725
+ {
1726
+ name: "sol_spent",
1727
+ type: "u64"
1728
+ },
1729
+ {
1730
+ name: "tokens_transferred",
1731
+ type: "u64"
1732
+ },
1733
+ {
1734
+ name: "initial_vaulted",
1735
+ type: "u64"
1736
+ },
1737
+ {
1738
+ name: "timestamp",
1739
+ type: "i64"
1740
+ }
1741
+ ]
1742
+ }
1743
+ },
1744
+ {
1745
+ name: "TokenSold",
1746
+ docs: [
1747
+ "Event emitted when tokens are sold"
1748
+ ],
1749
+ type: {
1750
+ kind: "struct",
1751
+ fields: [
1752
+ {
1753
+ name: "seller",
1754
+ type: "pubkey"
1755
+ },
1756
+ {
1757
+ name: "pool",
1758
+ type: "pubkey"
1759
+ },
1760
+ {
1761
+ name: "mint",
1762
+ type: "pubkey"
1763
+ },
1764
+ {
1765
+ name: "token_amount",
1766
+ type: "u64"
1767
+ },
1768
+ {
1769
+ name: "sol_received",
1770
+ type: "u64"
1771
+ },
1772
+ {
1773
+ name: "vamm_real_sol",
1774
+ type: "u64"
1775
+ },
1776
+ {
1777
+ name: "vamm_tokens",
1778
+ type: "u64"
1779
+ },
1780
+ {
1781
+ name: "tokens_sold",
1782
+ type: "u64"
1783
+ },
1784
+ {
1785
+ name: "position",
1786
+ type: "pubkey"
1787
+ },
1788
+ {
1789
+ name: "position_number",
1790
+ type: "u64"
1791
+ },
1792
+ {
1793
+ name: "vest_duration",
1794
+ type: "i64"
1795
+ },
1796
+ {
1797
+ name: "unlock_time_seconds",
1798
+ type: "i64"
1799
+ },
1800
+ {
1801
+ name: "tradable_tokens",
1802
+ docs: [
1803
+ "Position state after sell"
1804
+ ],
1805
+ type: "u64"
1806
+ },
1807
+ {
1808
+ name: "vaulted_tokens",
1809
+ type: "u64"
1810
+ },
1811
+ {
1812
+ name: "sol_spent",
1813
+ type: "u64"
1814
+ },
1815
+ {
1816
+ name: "tokens_transferred",
1817
+ type: "u64"
1818
+ },
1819
+ {
1820
+ name: "initial_vaulted",
1821
+ type: "u64"
1822
+ },
1823
+ {
1824
+ name: "timestamp",
1825
+ type: "i64"
1826
+ }
1827
+ ]
1828
+ }
1829
+ }
1830
+ ]
1831
+ };
1832
+
1833
+ // src/events.ts
1834
+ function parseTransactionEvents(input, config) {
1835
+ if (!input) return [];
1836
+ const logs = Array.isArray(input) ? input : input.meta?.logMessages ?? [];
1837
+ if (logs.length === 0) return [];
1838
+ const coder = new BorshCoder(hodl_default);
1839
+ const parser = new EventParser(config.programId, coder);
1840
+ const events = [];
1841
+ try {
1842
+ for (const event of parser.parseLogs(logs)) {
1843
+ events.push({ name: event.name, data: event.data });
1844
+ }
1845
+ } catch {
1846
+ }
1847
+ return events;
1848
+ }
1849
+ async function fetchAndParseTransaction(connection, signature, config) {
1850
+ const tx = await connection.getTransaction(signature, {
1851
+ commitment: "confirmed",
1852
+ maxSupportedTransactionVersion: 0
1853
+ });
1854
+ return parseTransactionEvents(tx, config);
1855
+ }
1856
+ function subscribeToEvents(connection, config, onEvent, opts = {}) {
1857
+ const commitment = opts.commitment ?? "confirmed";
1858
+ const coder = new BorshCoder(hodl_default);
1859
+ const parser = new EventParser(config.programId, coder);
1860
+ return connection.onLogs(
1861
+ config.programId,
1862
+ ({ logs, err, signature }, context) => {
1863
+ if (err) {
1864
+ opts.onError?.(new Error(`Log subscription error: ${JSON.stringify(err)}`));
1865
+ return;
1866
+ }
1867
+ try {
1868
+ for (const event of parser.parseLogs(logs)) {
1869
+ onEvent(
1870
+ { name: event.name, data: event.data },
1871
+ context.slot,
1872
+ signature
1873
+ );
1874
+ }
1875
+ } catch (e) {
1876
+ opts.onError?.(e instanceof Error ? e : new Error(String(e)));
1877
+ }
1878
+ },
1879
+ commitment
1880
+ );
1881
+ }
1882
+ function unsubscribeFromEvents(connection, subscriptionId) {
1883
+ return connection.removeOnLogsListener(subscriptionId);
1884
+ }
1885
+ function subscribeToTokenPurchased(connection, config, onEvent, opts) {
1886
+ return subscribeToEvents(connection, config, (event, slot, sig) => {
1887
+ if (event.name === "tokenPurchased") onEvent(event.data, slot, sig);
1888
+ }, opts);
1889
+ }
1890
+ function subscribeToTokenSold(connection, config, onEvent, opts) {
1891
+ return subscribeToEvents(connection, config, (event, slot, sig) => {
1892
+ if (event.name === "tokenSold") onEvent(event.data, slot, sig);
1893
+ }, opts);
1894
+ }
1895
+ function subscribeToTokenCreated(connection, config, onEvent, opts) {
1896
+ return subscribeToEvents(connection, config, (event, slot, sig) => {
1897
+ if (event.name === "tokenCreated") onEvent(event.data, slot, sig);
1898
+ }, opts);
1899
+ }
1900
+ function subscribeToAccrualClaimed(connection, config, onEvent, opts) {
1901
+ return subscribeToEvents(connection, config, (event, slot, sig) => {
1902
+ if (event.name === "accrualClaimed") onEvent(event.data, slot, sig);
1903
+ }, opts);
1904
+ }
1905
+ function subscribeToPositionClosed(connection, config, onEvent, opts) {
1906
+ return subscribeToEvents(connection, config, (event, slot, sig) => {
1907
+ if (event.name === "positionClosed") onEvent(event.data, slot, sig);
1908
+ }, opts);
1909
+ }
1910
+
1911
+ export { fetchAndParseTransaction, parseTransactionEvents, subscribeToAccrualClaimed, subscribeToEvents, subscribeToPositionClosed, subscribeToTokenCreated, subscribeToTokenPurchased, subscribeToTokenSold, unsubscribeFromEvents };
1912
+ //# sourceMappingURL=events.js.map
1913
+ //# sourceMappingURL=events.js.map