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