@zcomb/programs-sdk 1.7.0 → 1.8.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 (44) hide show
  1. package/dist/futarchy/client.d.ts +113 -1
  2. package/dist/futarchy/client.js +13 -3
  3. package/dist/futarchy/instructions.d.ts +109 -1
  4. package/dist/futarchy/instructions.js +17 -3
  5. package/dist/generated/idls/futarchy.json +112 -0
  6. package/dist/generated/types/futarchy.d.ts +112 -0
  7. package/dist/generated/types/futarchy.js +1 -1
  8. package/package.json +1 -2
  9. package/src/amm/client.ts +0 -485
  10. package/src/amm/constants.ts +0 -31
  11. package/src/amm/index.ts +0 -5
  12. package/src/amm/instructions.ts +0 -139
  13. package/src/amm/types.ts +0 -62
  14. package/src/amm/utils.ts +0 -263
  15. package/src/futarchy/client.ts +0 -1100
  16. package/src/futarchy/constants.ts +0 -28
  17. package/src/futarchy/index.ts +0 -5
  18. package/src/futarchy/instructions.ts +0 -235
  19. package/src/futarchy/types.ts +0 -54
  20. package/src/futarchy/utils.ts +0 -108
  21. package/src/generated/idls/amm.json +0 -1252
  22. package/src/generated/idls/futarchy.json +0 -1763
  23. package/src/generated/idls/index.ts +0 -4
  24. package/src/generated/idls/svault.json +0 -2228
  25. package/src/generated/idls/vault.json +0 -1501
  26. package/src/generated/types/amm.ts +0 -1258
  27. package/src/generated/types/futarchy.ts +0 -1769
  28. package/src/generated/types/index.ts +0 -4
  29. package/src/generated/types/svault.ts +0 -2234
  30. package/src/generated/types/vault.ts +0 -1507
  31. package/src/index.ts +0 -163
  32. package/src/svault/client.ts +0 -401
  33. package/src/svault/constants.ts +0 -23
  34. package/src/svault/index.ts +0 -5
  35. package/src/svault/instructions.ts +0 -258
  36. package/src/svault/types.ts +0 -45
  37. package/src/svault/utils.ts +0 -145
  38. package/src/utils.ts +0 -41
  39. package/src/vault/client.ts +0 -333
  40. package/src/vault/constants.ts +0 -23
  41. package/src/vault/index.ts +0 -5
  42. package/src/vault/instructions.ts +0 -170
  43. package/src/vault/types.ts +0 -54
  44. package/src/vault/utils.ts +0 -70
@@ -1,1252 +0,0 @@
1
- {
2
- "address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx",
3
- "metadata": {
4
- "name": "amm",
5
- "version": "0.1.0",
6
- "spec": "0.1.0",
7
- "description": "Created with Anchor"
8
- },
9
- "instructions": [
10
- {
11
- "name": "add_liquidity",
12
- "discriminator": [
13
- 181,
14
- 157,
15
- 89,
16
- 67,
17
- 143,
18
- 182,
19
- 52,
20
- 72
21
- ],
22
- "accounts": [
23
- {
24
- "name": "depositor",
25
- "signer": true
26
- },
27
- {
28
- "name": "pool",
29
- "pda": {
30
- "seeds": [
31
- {
32
- "kind": "const",
33
- "value": [
34
- 112,
35
- 111,
36
- 111,
37
- 108
38
- ]
39
- },
40
- {
41
- "kind": "account",
42
- "path": "pool.admin",
43
- "account": "PoolAccount"
44
- },
45
- {
46
- "kind": "account",
47
- "path": "pool.mint_a",
48
- "account": "PoolAccount"
49
- },
50
- {
51
- "kind": "account",
52
- "path": "pool.mint_b",
53
- "account": "PoolAccount"
54
- }
55
- ]
56
- }
57
- },
58
- {
59
- "name": "reserve_a",
60
- "writable": true,
61
- "pda": {
62
- "seeds": [
63
- {
64
- "kind": "const",
65
- "value": [
66
- 114,
67
- 101,
68
- 115,
69
- 101,
70
- 114,
71
- 118,
72
- 101
73
- ]
74
- },
75
- {
76
- "kind": "account",
77
- "path": "pool"
78
- },
79
- {
80
- "kind": "account",
81
- "path": "pool.mint_a",
82
- "account": "PoolAccount"
83
- }
84
- ]
85
- }
86
- },
87
- {
88
- "name": "reserve_b",
89
- "writable": true,
90
- "pda": {
91
- "seeds": [
92
- {
93
- "kind": "const",
94
- "value": [
95
- 114,
96
- 101,
97
- 115,
98
- 101,
99
- 114,
100
- 118,
101
- 101
102
- ]
103
- },
104
- {
105
- "kind": "account",
106
- "path": "pool"
107
- },
108
- {
109
- "kind": "account",
110
- "path": "pool.mint_b",
111
- "account": "PoolAccount"
112
- }
113
- ]
114
- }
115
- },
116
- {
117
- "name": "depositor_token_acc_a",
118
- "writable": true
119
- },
120
- {
121
- "name": "depositor_token_acc_b",
122
- "writable": true
123
- },
124
- {
125
- "name": "token_program",
126
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
127
- }
128
- ],
129
- "args": [
130
- {
131
- "name": "amount_a",
132
- "type": "u64"
133
- },
134
- {
135
- "name": "amount_b",
136
- "type": "u64"
137
- }
138
- ]
139
- },
140
- {
141
- "name": "cease_trading",
142
- "discriminator": [
143
- 187,
144
- 140,
145
- 73,
146
- 84,
147
- 119,
148
- 249,
149
- 38,
150
- 212
151
- ],
152
- "accounts": [
153
- {
154
- "name": "admin",
155
- "signer": true
156
- },
157
- {
158
- "name": "pool",
159
- "writable": true,
160
- "pda": {
161
- "seeds": [
162
- {
163
- "kind": "const",
164
- "value": [
165
- 112,
166
- 111,
167
- 111,
168
- 108
169
- ]
170
- },
171
- {
172
- "kind": "account",
173
- "path": "pool.admin",
174
- "account": "PoolAccount"
175
- },
176
- {
177
- "kind": "account",
178
- "path": "pool.mint_a",
179
- "account": "PoolAccount"
180
- },
181
- {
182
- "kind": "account",
183
- "path": "pool.mint_b",
184
- "account": "PoolAccount"
185
- }
186
- ]
187
- }
188
- }
189
- ],
190
- "args": []
191
- },
192
- {
193
- "name": "crank_twap",
194
- "discriminator": [
195
- 43,
196
- 127,
197
- 177,
198
- 237,
199
- 243,
200
- 153,
201
- 31,
202
- 162
203
- ],
204
- "accounts": [
205
- {
206
- "name": "pool",
207
- "writable": true,
208
- "pda": {
209
- "seeds": [
210
- {
211
- "kind": "const",
212
- "value": [
213
- 112,
214
- 111,
215
- 111,
216
- 108
217
- ]
218
- },
219
- {
220
- "kind": "account",
221
- "path": "pool.admin",
222
- "account": "PoolAccount"
223
- },
224
- {
225
- "kind": "account",
226
- "path": "pool.mint_a",
227
- "account": "PoolAccount"
228
- },
229
- {
230
- "kind": "account",
231
- "path": "pool.mint_b",
232
- "account": "PoolAccount"
233
- }
234
- ]
235
- }
236
- },
237
- {
238
- "name": "reserve_a",
239
- "pda": {
240
- "seeds": [
241
- {
242
- "kind": "const",
243
- "value": [
244
- 114,
245
- 101,
246
- 115,
247
- 101,
248
- 114,
249
- 118,
250
- 101
251
- ]
252
- },
253
- {
254
- "kind": "account",
255
- "path": "pool"
256
- },
257
- {
258
- "kind": "account",
259
- "path": "pool.mint_a",
260
- "account": "PoolAccount"
261
- }
262
- ]
263
- }
264
- },
265
- {
266
- "name": "reserve_b",
267
- "pda": {
268
- "seeds": [
269
- {
270
- "kind": "const",
271
- "value": [
272
- 114,
273
- 101,
274
- 115,
275
- 101,
276
- 114,
277
- 118,
278
- 101
279
- ]
280
- },
281
- {
282
- "kind": "account",
283
- "path": "pool"
284
- },
285
- {
286
- "kind": "account",
287
- "path": "pool.mint_b",
288
- "account": "PoolAccount"
289
- }
290
- ]
291
- }
292
- }
293
- ],
294
- "args": [],
295
- "returns": "u128"
296
- },
297
- {
298
- "name": "create_pool",
299
- "discriminator": [
300
- 233,
301
- 146,
302
- 209,
303
- 142,
304
- 207,
305
- 104,
306
- 64,
307
- 188
308
- ],
309
- "accounts": [
310
- {
311
- "name": "payer",
312
- "writable": true,
313
- "signer": true
314
- },
315
- {
316
- "name": "admin",
317
- "signer": true
318
- },
319
- {
320
- "name": "mint_a"
321
- },
322
- {
323
- "name": "mint_b"
324
- },
325
- {
326
- "name": "pool",
327
- "writable": true,
328
- "pda": {
329
- "seeds": [
330
- {
331
- "kind": "const",
332
- "value": [
333
- 112,
334
- 111,
335
- 111,
336
- 108
337
- ]
338
- },
339
- {
340
- "kind": "account",
341
- "path": "admin"
342
- },
343
- {
344
- "kind": "account",
345
- "path": "mint_a"
346
- },
347
- {
348
- "kind": "account",
349
- "path": "mint_b"
350
- }
351
- ]
352
- }
353
- },
354
- {
355
- "name": "reserve_a",
356
- "writable": true,
357
- "pda": {
358
- "seeds": [
359
- {
360
- "kind": "const",
361
- "value": [
362
- 114,
363
- 101,
364
- 115,
365
- 101,
366
- 114,
367
- 118,
368
- 101
369
- ]
370
- },
371
- {
372
- "kind": "account",
373
- "path": "pool"
374
- },
375
- {
376
- "kind": "account",
377
- "path": "mint_a"
378
- }
379
- ]
380
- }
381
- },
382
- {
383
- "name": "reserve_b",
384
- "writable": true,
385
- "pda": {
386
- "seeds": [
387
- {
388
- "kind": "const",
389
- "value": [
390
- 114,
391
- 101,
392
- 115,
393
- 101,
394
- 114,
395
- 118,
396
- 101
397
- ]
398
- },
399
- {
400
- "kind": "account",
401
- "path": "pool"
402
- },
403
- {
404
- "kind": "account",
405
- "path": "mint_b"
406
- }
407
- ]
408
- }
409
- },
410
- {
411
- "name": "fee_authority",
412
- "address": "FEEnkcCNE2623LYCPtLf63LFzXpCFigBLTu4qZovRGZC"
413
- },
414
- {
415
- "name": "fee_vault",
416
- "writable": true,
417
- "pda": {
418
- "seeds": [
419
- {
420
- "kind": "const",
421
- "value": [
422
- 102,
423
- 101,
424
- 101,
425
- 95,
426
- 118,
427
- 97,
428
- 117,
429
- 108,
430
- 116
431
- ]
432
- },
433
- {
434
- "kind": "account",
435
- "path": "pool"
436
- }
437
- ]
438
- }
439
- },
440
- {
441
- "name": "token_program",
442
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
443
- },
444
- {
445
- "name": "system_program",
446
- "address": "11111111111111111111111111111111"
447
- }
448
- ],
449
- "args": [
450
- {
451
- "name": "fee",
452
- "type": "u16"
453
- },
454
- {
455
- "name": "starting_observation",
456
- "type": "u128"
457
- },
458
- {
459
- "name": "max_observation_delta",
460
- "type": "u128"
461
- },
462
- {
463
- "name": "warmup_duration",
464
- "type": "u32"
465
- },
466
- {
467
- "name": "liquidity_provider",
468
- "type": {
469
- "option": "pubkey"
470
- }
471
- }
472
- ]
473
- },
474
- {
475
- "name": "remove_liquidity",
476
- "discriminator": [
477
- 80,
478
- 85,
479
- 209,
480
- 72,
481
- 24,
482
- 206,
483
- 177,
484
- 108
485
- ],
486
- "accounts": [
487
- {
488
- "name": "depositor",
489
- "signer": true
490
- },
491
- {
492
- "name": "pool",
493
- "pda": {
494
- "seeds": [
495
- {
496
- "kind": "const",
497
- "value": [
498
- 112,
499
- 111,
500
- 111,
501
- 108
502
- ]
503
- },
504
- {
505
- "kind": "account",
506
- "path": "pool.admin",
507
- "account": "PoolAccount"
508
- },
509
- {
510
- "kind": "account",
511
- "path": "pool.mint_a",
512
- "account": "PoolAccount"
513
- },
514
- {
515
- "kind": "account",
516
- "path": "pool.mint_b",
517
- "account": "PoolAccount"
518
- }
519
- ]
520
- }
521
- },
522
- {
523
- "name": "reserve_a",
524
- "writable": true,
525
- "pda": {
526
- "seeds": [
527
- {
528
- "kind": "const",
529
- "value": [
530
- 114,
531
- 101,
532
- 115,
533
- 101,
534
- 114,
535
- 118,
536
- 101
537
- ]
538
- },
539
- {
540
- "kind": "account",
541
- "path": "pool"
542
- },
543
- {
544
- "kind": "account",
545
- "path": "pool.mint_a",
546
- "account": "PoolAccount"
547
- }
548
- ]
549
- }
550
- },
551
- {
552
- "name": "reserve_b",
553
- "writable": true,
554
- "pda": {
555
- "seeds": [
556
- {
557
- "kind": "const",
558
- "value": [
559
- 114,
560
- 101,
561
- 115,
562
- 101,
563
- 114,
564
- 118,
565
- 101
566
- ]
567
- },
568
- {
569
- "kind": "account",
570
- "path": "pool"
571
- },
572
- {
573
- "kind": "account",
574
- "path": "pool.mint_b",
575
- "account": "PoolAccount"
576
- }
577
- ]
578
- }
579
- },
580
- {
581
- "name": "depositor_token_acc_a",
582
- "writable": true
583
- },
584
- {
585
- "name": "depositor_token_acc_b",
586
- "writable": true
587
- },
588
- {
589
- "name": "token_program",
590
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
591
- }
592
- ],
593
- "args": [
594
- {
595
- "name": "amount_a",
596
- "type": "u64"
597
- },
598
- {
599
- "name": "amount_b",
600
- "type": "u64"
601
- }
602
- ]
603
- },
604
- {
605
- "name": "swap",
606
- "discriminator": [
607
- 248,
608
- 198,
609
- 158,
610
- 145,
611
- 225,
612
- 117,
613
- 135,
614
- 200
615
- ],
616
- "accounts": [
617
- {
618
- "name": "trader",
619
- "signer": true
620
- },
621
- {
622
- "name": "pool",
623
- "writable": true,
624
- "pda": {
625
- "seeds": [
626
- {
627
- "kind": "const",
628
- "value": [
629
- 112,
630
- 111,
631
- 111,
632
- 108
633
- ]
634
- },
635
- {
636
- "kind": "account",
637
- "path": "pool.admin",
638
- "account": "PoolAccount"
639
- },
640
- {
641
- "kind": "account",
642
- "path": "pool.mint_a",
643
- "account": "PoolAccount"
644
- },
645
- {
646
- "kind": "account",
647
- "path": "pool.mint_b",
648
- "account": "PoolAccount"
649
- }
650
- ]
651
- }
652
- },
653
- {
654
- "name": "reserve_a",
655
- "writable": true,
656
- "pda": {
657
- "seeds": [
658
- {
659
- "kind": "const",
660
- "value": [
661
- 114,
662
- 101,
663
- 115,
664
- 101,
665
- 114,
666
- 118,
667
- 101
668
- ]
669
- },
670
- {
671
- "kind": "account",
672
- "path": "pool"
673
- },
674
- {
675
- "kind": "account",
676
- "path": "pool.mint_a",
677
- "account": "PoolAccount"
678
- }
679
- ]
680
- }
681
- },
682
- {
683
- "name": "reserve_b",
684
- "writable": true,
685
- "pda": {
686
- "seeds": [
687
- {
688
- "kind": "const",
689
- "value": [
690
- 114,
691
- 101,
692
- 115,
693
- 101,
694
- 114,
695
- 118,
696
- 101
697
- ]
698
- },
699
- {
700
- "kind": "account",
701
- "path": "pool"
702
- },
703
- {
704
- "kind": "account",
705
- "path": "pool.mint_b",
706
- "account": "PoolAccount"
707
- }
708
- ]
709
- }
710
- },
711
- {
712
- "name": "fee_vault",
713
- "docs": [
714
- "Fee vault with hardcoded fee authority wallet"
715
- ],
716
- "writable": true,
717
- "pda": {
718
- "seeds": [
719
- {
720
- "kind": "const",
721
- "value": [
722
- 102,
723
- 101,
724
- 101,
725
- 95,
726
- 118,
727
- 97,
728
- 117,
729
- 108,
730
- 116
731
- ]
732
- },
733
- {
734
- "kind": "account",
735
- "path": "pool"
736
- }
737
- ]
738
- }
739
- },
740
- {
741
- "name": "trader_account_a",
742
- "writable": true
743
- },
744
- {
745
- "name": "trader_account_b",
746
- "writable": true
747
- },
748
- {
749
- "name": "token_program",
750
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
751
- }
752
- ],
753
- "args": [
754
- {
755
- "name": "swap_a_to_b",
756
- "type": "bool"
757
- },
758
- {
759
- "name": "input_amount",
760
- "type": "u64"
761
- },
762
- {
763
- "name": "min_output_amount",
764
- "type": "u64"
765
- }
766
- ]
767
- }
768
- ],
769
- "accounts": [
770
- {
771
- "name": "PoolAccount",
772
- "discriminator": [
773
- 116,
774
- 210,
775
- 187,
776
- 119,
777
- 196,
778
- 196,
779
- 52,
780
- 137
781
- ]
782
- }
783
- ],
784
- "events": [
785
- {
786
- "name": "CondSwap",
787
- "discriminator": [
788
- 99,
789
- 23,
790
- 169,
791
- 57,
792
- 70,
793
- 218,
794
- 240,
795
- 69
796
- ]
797
- },
798
- {
799
- "name": "LiquidityAdded",
800
- "discriminator": [
801
- 154,
802
- 26,
803
- 221,
804
- 108,
805
- 238,
806
- 64,
807
- 217,
808
- 161
809
- ]
810
- },
811
- {
812
- "name": "LiquidityRemoved",
813
- "discriminator": [
814
- 225,
815
- 105,
816
- 216,
817
- 39,
818
- 124,
819
- 116,
820
- 169,
821
- 189
822
- ]
823
- },
824
- {
825
- "name": "PoolCreated",
826
- "discriminator": [
827
- 202,
828
- 44,
829
- 41,
830
- 88,
831
- 104,
832
- 220,
833
- 157,
834
- 82
835
- ]
836
- },
837
- {
838
- "name": "TWAPUpdate",
839
- "discriminator": [
840
- 48,
841
- 209,
842
- 39,
843
- 135,
844
- 187,
845
- 76,
846
- 144,
847
- 38
848
- ]
849
- }
850
- ],
851
- "errors": [
852
- {
853
- "code": 6000,
854
- "name": "InvalidAdmin",
855
- "msg": "Invalid admin"
856
- },
857
- {
858
- "code": 6001,
859
- "name": "InvalidDepositor",
860
- "msg": "Invalid depositor"
861
- },
862
- {
863
- "code": 6002,
864
- "name": "InvalidState",
865
- "msg": "Invalid state"
866
- },
867
- {
868
- "code": 6003,
869
- "name": "InvalidAmount",
870
- "msg": "Invalid amount"
871
- },
872
- {
873
- "code": 6004,
874
- "name": "SlippageExceeded",
875
- "msg": "Slippage exceeded"
876
- },
877
- {
878
- "code": 6005,
879
- "name": "InvariantViolated",
880
- "msg": "Invariant violated"
881
- },
882
- {
883
- "code": 6006,
884
- "name": "EmptyPool",
885
- "msg": "Pool is empty"
886
- },
887
- {
888
- "code": 6007,
889
- "name": "MathOverflow",
890
- "msg": "Math overflow"
891
- },
892
- {
893
- "code": 6008,
894
- "name": "MathUnderflow",
895
- "msg": "Math underflow"
896
- },
897
- {
898
- "code": 6009,
899
- "name": "OutputTooSmall",
900
- "msg": "Output too small"
901
- },
902
- {
903
- "code": 6010,
904
- "name": "InsufficientReserve",
905
- "msg": "Insufficient reserve balance"
906
- },
907
- {
908
- "code": 6011,
909
- "name": "InvalidFee",
910
- "msg": "Fee exceeds maximum"
911
- }
912
- ],
913
- "types": [
914
- {
915
- "name": "CondSwap",
916
- "type": {
917
- "kind": "struct",
918
- "fields": [
919
- {
920
- "name": "pool",
921
- "type": "pubkey"
922
- },
923
- {
924
- "name": "trader",
925
- "type": "pubkey"
926
- },
927
- {
928
- "name": "swap_a_to_b",
929
- "type": "bool"
930
- },
931
- {
932
- "name": "input_amount",
933
- "type": "u64"
934
- },
935
- {
936
- "name": "output_amount",
937
- "type": "u64"
938
- },
939
- {
940
- "name": "fee_amount",
941
- "type": "u64"
942
- }
943
- ]
944
- }
945
- },
946
- {
947
- "name": "LiquidityAdded",
948
- "type": {
949
- "kind": "struct",
950
- "fields": [
951
- {
952
- "name": "pool",
953
- "type": "pubkey"
954
- },
955
- {
956
- "name": "amount_a",
957
- "type": "u64"
958
- },
959
- {
960
- "name": "amount_b",
961
- "type": "u64"
962
- }
963
- ]
964
- }
965
- },
966
- {
967
- "name": "LiquidityRemoved",
968
- "type": {
969
- "kind": "struct",
970
- "fields": [
971
- {
972
- "name": "pool",
973
- "type": "pubkey"
974
- },
975
- {
976
- "name": "amount_a",
977
- "type": "u64"
978
- },
979
- {
980
- "name": "amount_b",
981
- "type": "u64"
982
- }
983
- ]
984
- }
985
- },
986
- {
987
- "name": "PoolAccount",
988
- "type": {
989
- "kind": "struct",
990
- "fields": [
991
- {
992
- "name": "version",
993
- "type": "u8"
994
- },
995
- {
996
- "name": "bumps",
997
- "type": {
998
- "defined": {
999
- "name": "PoolBumps"
1000
- }
1001
- }
1002
- },
1003
- {
1004
- "name": "state",
1005
- "type": {
1006
- "defined": {
1007
- "name": "PoolState"
1008
- }
1009
- }
1010
- },
1011
- {
1012
- "name": "mint_a",
1013
- "type": "pubkey"
1014
- },
1015
- {
1016
- "name": "mint_b",
1017
- "type": "pubkey"
1018
- },
1019
- {
1020
- "name": "fee",
1021
- "type": "u16"
1022
- },
1023
- {
1024
- "name": "admin",
1025
- "type": "pubkey"
1026
- },
1027
- {
1028
- "name": "liquidity_provider",
1029
- "type": "pubkey"
1030
- },
1031
- {
1032
- "name": "oracle",
1033
- "type": {
1034
- "defined": {
1035
- "name": "TwapOracle"
1036
- }
1037
- }
1038
- }
1039
- ]
1040
- }
1041
- },
1042
- {
1043
- "name": "PoolBumps",
1044
- "type": {
1045
- "kind": "struct",
1046
- "fields": [
1047
- {
1048
- "name": "pool",
1049
- "type": "u8"
1050
- },
1051
- {
1052
- "name": "reserve_a",
1053
- "type": "u8"
1054
- },
1055
- {
1056
- "name": "reserve_b",
1057
- "type": "u8"
1058
- },
1059
- {
1060
- "name": "fee_vault",
1061
- "type": "u8"
1062
- }
1063
- ]
1064
- }
1065
- },
1066
- {
1067
- "name": "PoolCreated",
1068
- "type": {
1069
- "kind": "struct",
1070
- "fields": [
1071
- {
1072
- "name": "version",
1073
- "type": "u8"
1074
- },
1075
- {
1076
- "name": "pool",
1077
- "type": "pubkey"
1078
- },
1079
- {
1080
- "name": "mint_a",
1081
- "type": "pubkey"
1082
- },
1083
- {
1084
- "name": "mint_b",
1085
- "type": "pubkey"
1086
- },
1087
- {
1088
- "name": "fee",
1089
- "type": "u16"
1090
- },
1091
- {
1092
- "name": "admin",
1093
- "type": "pubkey"
1094
- }
1095
- ]
1096
- }
1097
- },
1098
- {
1099
- "name": "PoolState",
1100
- "type": {
1101
- "kind": "enum",
1102
- "variants": [
1103
- {
1104
- "name": "Trading"
1105
- },
1106
- {
1107
- "name": "Finalized"
1108
- }
1109
- ]
1110
- }
1111
- },
1112
- {
1113
- "name": "TWAPUpdate",
1114
- "type": {
1115
- "kind": "struct",
1116
- "fields": [
1117
- {
1118
- "name": "unix_time",
1119
- "type": "i64"
1120
- },
1121
- {
1122
- "name": "price",
1123
- "type": "u128"
1124
- },
1125
- {
1126
- "name": "observation",
1127
- "type": "u128"
1128
- },
1129
- {
1130
- "name": "cumulative_observations",
1131
- "type": "u128"
1132
- },
1133
- {
1134
- "name": "twap",
1135
- "type": "u128"
1136
- }
1137
- ]
1138
- }
1139
- },
1140
- {
1141
- "name": "TwapOracle",
1142
- "docs": [
1143
- "TWAP oracle that tracks time-weighted average prices with manipulation resistance.",
1144
- "",
1145
- "Observations are rate-limited to prevent flash loan and single-block attacks.",
1146
- "The cumulative_observations field accumulates (observation * time_elapsed) which",
1147
- "can be divided by total time to get the TWAP."
1148
- ],
1149
- "type": {
1150
- "kind": "struct",
1151
- "fields": [
1152
- {
1153
- "name": "cumulative_observations",
1154
- "docs": [
1155
- "Running sum of (observation * seconds_elapsed) used for TWAP calculation.",
1156
- "On overflow, wraps back to 0 - clients should handle this edge case."
1157
- ],
1158
- "type": "u128"
1159
- },
1160
- {
1161
- "name": "last_update_unix_time",
1162
- "docs": [
1163
- "Unix timestamp of the most recent price recording"
1164
- ],
1165
- "type": "i64"
1166
- },
1167
- {
1168
- "name": "created_at_unix_time",
1169
- "docs": [
1170
- "Unix timestamp when this oracle was initialized"
1171
- ],
1172
- "type": "i64"
1173
- },
1174
- {
1175
- "name": "last_price",
1176
- "docs": [
1177
- "Most recent raw price from pool reserves (reserves_a / reserves_b * PRICE_SCALE)"
1178
- ],
1179
- "type": "u128"
1180
- },
1181
- {
1182
- "name": "last_observation",
1183
- "docs": [
1184
- "Rate-limited observation that moves toward price bounded by max_observation_delta"
1185
- ],
1186
- "type": "u128"
1187
- },
1188
- {
1189
- "name": "max_observation_delta",
1190
- "docs": [
1191
- "Maximum amount observation can change per crank (manipulation resistance)"
1192
- ],
1193
- "type": "u128"
1194
- },
1195
- {
1196
- "name": "starting_observation",
1197
- "docs": [
1198
- "Initial value for last_observation when oracle is created"
1199
- ],
1200
- "type": "u128"
1201
- },
1202
- {
1203
- "name": "warmup_duration",
1204
- "docs": [
1205
- "Seconds after creation before TWAP accumulation begins"
1206
- ],
1207
- "type": "u32"
1208
- },
1209
- {
1210
- "name": "min_recording_interval",
1211
- "docs": [
1212
- "Minimum time in-between TWAP recordings"
1213
- ],
1214
- "type": "i64"
1215
- }
1216
- ]
1217
- }
1218
- }
1219
- ],
1220
- "constants": [
1221
- {
1222
- "name": "AMM_VERSION",
1223
- "type": "u8",
1224
- "value": "1"
1225
- },
1226
- {
1227
- "name": "FEE_AUTHORITY",
1228
- "type": "pubkey",
1229
- "value": "FEEnkcCNE2623LYCPtLf63LFzXpCFigBLTu4qZovRGZC"
1230
- },
1231
- {
1232
- "name": "FEE_VAULT_SEED",
1233
- "type": "bytes",
1234
- "value": "[102, 101, 101, 95, 118, 97, 117, 108, 116]"
1235
- },
1236
- {
1237
- "name": "MAX_FEE",
1238
- "type": "u16",
1239
- "value": "5000"
1240
- },
1241
- {
1242
- "name": "POOL_SEED",
1243
- "type": "bytes",
1244
- "value": "[112, 111, 111, 108]"
1245
- },
1246
- {
1247
- "name": "RESERVE_SEED",
1248
- "type": "bytes",
1249
- "value": "[114, 101, 115, 101, 114, 118, 101]"
1250
- }
1251
- ]
1252
- }