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