@exponent-labs/pyth-idl 0.0.10

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.
@@ -0,0 +1,1561 @@
1
+ export type PythSolanaReceiver = {
2
+ version: "0.2.0"
3
+ name: "pyth_solana_receiver"
4
+ instructions: [
5
+ {
6
+ name: "initialize"
7
+ accounts: [
8
+ {
9
+ name: "payer"
10
+ isMut: true
11
+ isSigner: true
12
+ },
13
+ {
14
+ name: "config"
15
+ isMut: true
16
+ isSigner: false
17
+ },
18
+ {
19
+ name: "systemProgram"
20
+ isMut: false
21
+ isSigner: false
22
+ },
23
+ ]
24
+ args: [
25
+ {
26
+ name: "initialConfig"
27
+ type: {
28
+ defined: "Config"
29
+ }
30
+ },
31
+ ]
32
+ },
33
+ {
34
+ name: "requestGovernanceAuthorityTransfer"
35
+ accounts: [
36
+ {
37
+ name: "payer"
38
+ isMut: false
39
+ isSigner: true
40
+ },
41
+ {
42
+ name: "config"
43
+ isMut: true
44
+ isSigner: false
45
+ },
46
+ ]
47
+ args: [
48
+ {
49
+ name: "targetGovernanceAuthority"
50
+ type: "publicKey"
51
+ },
52
+ ]
53
+ },
54
+ {
55
+ name: "acceptGovernanceAuthorityTransfer"
56
+ accounts: [
57
+ {
58
+ name: "payer"
59
+ isMut: false
60
+ isSigner: true
61
+ },
62
+ {
63
+ name: "config"
64
+ isMut: true
65
+ isSigner: false
66
+ },
67
+ ]
68
+ args: []
69
+ },
70
+ {
71
+ name: "setDataSources"
72
+ accounts: [
73
+ {
74
+ name: "payer"
75
+ isMut: false
76
+ isSigner: true
77
+ },
78
+ {
79
+ name: "config"
80
+ isMut: true
81
+ isSigner: false
82
+ },
83
+ ]
84
+ args: [
85
+ {
86
+ name: "validDataSources"
87
+ type: {
88
+ vec: {
89
+ defined: "DataSource"
90
+ }
91
+ }
92
+ },
93
+ ]
94
+ },
95
+ {
96
+ name: "setFee"
97
+ accounts: [
98
+ {
99
+ name: "payer"
100
+ isMut: false
101
+ isSigner: true
102
+ },
103
+ {
104
+ name: "config"
105
+ isMut: true
106
+ isSigner: false
107
+ },
108
+ ]
109
+ args: [
110
+ {
111
+ name: "singleUpdateFeeInLamports"
112
+ type: "u64"
113
+ },
114
+ ]
115
+ },
116
+ {
117
+ name: "setWormholeAddress"
118
+ accounts: [
119
+ {
120
+ name: "payer"
121
+ isMut: false
122
+ isSigner: true
123
+ },
124
+ {
125
+ name: "config"
126
+ isMut: true
127
+ isSigner: false
128
+ },
129
+ ]
130
+ args: [
131
+ {
132
+ name: "wormhole"
133
+ type: "publicKey"
134
+ },
135
+ ]
136
+ },
137
+ {
138
+ name: "setMinimumSignatures"
139
+ accounts: [
140
+ {
141
+ name: "payer"
142
+ isMut: false
143
+ isSigner: true
144
+ },
145
+ {
146
+ name: "config"
147
+ isMut: true
148
+ isSigner: false
149
+ },
150
+ ]
151
+ args: [
152
+ {
153
+ name: "minimumSignatures"
154
+ type: "u8"
155
+ },
156
+ ]
157
+ },
158
+ {
159
+ name: "postUpdateAtomic"
160
+ docs: [
161
+ "Post a price update using a VAA and a MerklePriceUpdate.",
162
+ "This function allows you to post a price update in a single transaction.",
163
+ "Compared to post_update, it is less secure since you won't be able to verify all guardian signatures if you use this function because of transaction size limitations.",
164
+ "Typically, you can fit 5 guardian signatures in a transaction that uses this.",
165
+ ]
166
+ accounts: [
167
+ {
168
+ name: "payer"
169
+ isMut: true
170
+ isSigner: true
171
+ },
172
+ {
173
+ name: "guardianSet"
174
+ isMut: false
175
+ isSigner: false
176
+ docs: ["Instead we do the same steps in deserialize_guardian_set_checked."]
177
+ },
178
+ {
179
+ name: "config"
180
+ isMut: false
181
+ isSigner: false
182
+ },
183
+ {
184
+ name: "treasury"
185
+ isMut: true
186
+ isSigner: false
187
+ },
188
+ {
189
+ name: "priceUpdateAccount"
190
+ isMut: true
191
+ isSigner: true
192
+ docs: [
193
+ "The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.",
194
+ "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
195
+ ]
196
+ },
197
+ {
198
+ name: "systemProgram"
199
+ isMut: false
200
+ isSigner: false
201
+ },
202
+ {
203
+ name: "writeAuthority"
204
+ isMut: false
205
+ isSigner: true
206
+ },
207
+ ]
208
+ args: [
209
+ {
210
+ name: "params"
211
+ type: {
212
+ defined: "PostUpdateAtomicParams"
213
+ }
214
+ },
215
+ ]
216
+ },
217
+ {
218
+ name: "postUpdate"
219
+ docs: [
220
+ "Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.",
221
+ "This should be called after the client has already verified the Vaa via the Wormhole contract.",
222
+ "Check out target_chains/solana/cli/src/main.rs for an example of how to do this.",
223
+ ]
224
+ accounts: [
225
+ {
226
+ name: "payer"
227
+ isMut: true
228
+ isSigner: true
229
+ },
230
+ {
231
+ name: "encodedVaa"
232
+ isMut: false
233
+ isSigner: false
234
+ },
235
+ {
236
+ name: "config"
237
+ isMut: false
238
+ isSigner: false
239
+ },
240
+ {
241
+ name: "treasury"
242
+ isMut: true
243
+ isSigner: false
244
+ },
245
+ {
246
+ name: "priceUpdateAccount"
247
+ isMut: true
248
+ isSigner: true
249
+ docs: [
250
+ "The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.",
251
+ "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
252
+ ]
253
+ },
254
+ {
255
+ name: "systemProgram"
256
+ isMut: false
257
+ isSigner: false
258
+ },
259
+ {
260
+ name: "writeAuthority"
261
+ isMut: false
262
+ isSigner: true
263
+ },
264
+ ]
265
+ args: [
266
+ {
267
+ name: "params"
268
+ type: {
269
+ defined: "PostUpdateParams"
270
+ }
271
+ },
272
+ ]
273
+ },
274
+ {
275
+ name: "postTwapUpdate"
276
+ docs: [
277
+ "Post a TWAP (time weighted average price) update for a given time window.",
278
+ "This should be called after the client has already verified the VAAs via the Wormhole contract.",
279
+ "Check out target_chains/solana/cli/src/main.rs for an example of how to do this.",
280
+ ]
281
+ accounts: [
282
+ {
283
+ name: "payer"
284
+ isMut: true
285
+ isSigner: true
286
+ },
287
+ {
288
+ name: "startEncodedVaa"
289
+ isMut: false
290
+ isSigner: false
291
+ },
292
+ {
293
+ name: "endEncodedVaa"
294
+ isMut: false
295
+ isSigner: false
296
+ },
297
+ {
298
+ name: "config"
299
+ isMut: false
300
+ isSigner: false
301
+ },
302
+ {
303
+ name: "treasury"
304
+ isMut: true
305
+ isSigner: false
306
+ },
307
+ {
308
+ name: "twapUpdateAccount"
309
+ isMut: true
310
+ isSigner: true
311
+ docs: [
312
+ "The contraint is such that either the twap_update_account is uninitialized or the write_authority is the write_authority.",
313
+ "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that twap_update_account.write_authority == Pubkey::default() once the account is initialized",
314
+ ]
315
+ },
316
+ {
317
+ name: "systemProgram"
318
+ isMut: false
319
+ isSigner: false
320
+ },
321
+ {
322
+ name: "writeAuthority"
323
+ isMut: false
324
+ isSigner: true
325
+ },
326
+ ]
327
+ args: [
328
+ {
329
+ name: "params"
330
+ type: {
331
+ defined: "PostTwapUpdateParams"
332
+ }
333
+ },
334
+ ]
335
+ },
336
+ {
337
+ name: "reclaimRent"
338
+ accounts: [
339
+ {
340
+ name: "payer"
341
+ isMut: true
342
+ isSigner: true
343
+ },
344
+ {
345
+ name: "priceUpdateAccount"
346
+ isMut: true
347
+ isSigner: false
348
+ },
349
+ ]
350
+ args: []
351
+ },
352
+ {
353
+ name: "reclaimTwapRent"
354
+ accounts: [
355
+ {
356
+ name: "payer"
357
+ isMut: true
358
+ isSigner: true
359
+ },
360
+ {
361
+ name: "twapUpdateAccount"
362
+ isMut: true
363
+ isSigner: false
364
+ },
365
+ ]
366
+ args: []
367
+ },
368
+ ]
369
+ accounts: [
370
+ {
371
+ name: "Config"
372
+ type: {
373
+ kind: "struct"
374
+ fields: [
375
+ {
376
+ name: "governanceAuthority"
377
+ type: "publicKey"
378
+ },
379
+ {
380
+ name: "targetGovernanceAuthority"
381
+ type: {
382
+ option: "publicKey"
383
+ }
384
+ },
385
+ {
386
+ name: "wormhole"
387
+ type: "publicKey"
388
+ },
389
+ {
390
+ name: "validDataSources"
391
+ type: {
392
+ vec: {
393
+ defined: "DataSource"
394
+ }
395
+ }
396
+ },
397
+ {
398
+ name: "singleUpdateFeeInLamports"
399
+ type: "u64"
400
+ },
401
+ {
402
+ name: "minimumSignatures"
403
+ type: "u8"
404
+ },
405
+ ]
406
+ }
407
+ },
408
+ {
409
+ name: "priceUpdateV2"
410
+ type: {
411
+ kind: "struct"
412
+ fields: [
413
+ {
414
+ name: "writeAuthority"
415
+ type: "publicKey"
416
+ },
417
+ {
418
+ name: "verificationLevel"
419
+ type: {
420
+ defined: "VerificationLevel"
421
+ }
422
+ },
423
+ {
424
+ name: "priceMessage"
425
+ type: {
426
+ defined: "PriceFeedMessage"
427
+ }
428
+ },
429
+ {
430
+ name: "postedSlot"
431
+ type: "u64"
432
+ },
433
+ ]
434
+ }
435
+ },
436
+ {
437
+ name: "twapUpdate"
438
+ type: {
439
+ kind: "struct"
440
+ fields: [
441
+ {
442
+ name: "writeAuthority"
443
+ type: "publicKey"
444
+ },
445
+ {
446
+ name: "twap"
447
+ type: {
448
+ defined: "TwapPrice"
449
+ }
450
+ },
451
+ ]
452
+ }
453
+ },
454
+ ]
455
+ types: [
456
+ {
457
+ name: "PriceFeedMessage"
458
+ type: {
459
+ kind: "struct"
460
+ fields: [
461
+ {
462
+ name: "feedId"
463
+ type: {
464
+ array: ["u8", 32]
465
+ }
466
+ },
467
+ {
468
+ name: "price"
469
+ type: "i64"
470
+ },
471
+ {
472
+ name: "conf"
473
+ type: "u64"
474
+ },
475
+ {
476
+ name: "exponent"
477
+ type: "i32"
478
+ },
479
+ {
480
+ name: "publishTime"
481
+ type: "i64"
482
+ },
483
+ {
484
+ name: "prevPublishTime"
485
+ type: "i64"
486
+ },
487
+ {
488
+ name: "emaPrice"
489
+ type: "i64"
490
+ },
491
+ {
492
+ name: "emaConf"
493
+ type: "u64"
494
+ },
495
+ ]
496
+ }
497
+ },
498
+ {
499
+ name: "TwapPrice"
500
+ docs: [
501
+ "The time weighted average price & conf for a feed over the window [start_time, end_time].",
502
+ "This type is used to persist the calculated TWAP in TwapUpdate accounts on Solana.",
503
+ ]
504
+ type: {
505
+ kind: "struct"
506
+ fields: [
507
+ {
508
+ name: "feedId"
509
+ type: {
510
+ array: ["u8", 32]
511
+ }
512
+ },
513
+ {
514
+ name: "startTime"
515
+ type: "i64"
516
+ },
517
+ {
518
+ name: "endTime"
519
+ type: "i64"
520
+ },
521
+ {
522
+ name: "price"
523
+ type: "i64"
524
+ },
525
+ {
526
+ name: "conf"
527
+ type: "u64"
528
+ },
529
+ {
530
+ name: "exponent"
531
+ type: "i32"
532
+ },
533
+ {
534
+ name: "downSlotsRatio"
535
+ docs: [
536
+ "Ratio out of 1_000_000, where a value of 1_000_000 represents",
537
+ "all slots were missed and 0 represents no slots were missed.",
538
+ ]
539
+ type: "u32"
540
+ },
541
+ ]
542
+ }
543
+ },
544
+ {
545
+ name: "MerklePriceUpdate"
546
+ type: {
547
+ kind: "struct"
548
+ fields: [
549
+ {
550
+ name: "message"
551
+ type: "bytes"
552
+ },
553
+ {
554
+ name: "proof"
555
+ type: {
556
+ vec: {
557
+ array: ["u8", 20]
558
+ }
559
+ }
560
+ },
561
+ ]
562
+ }
563
+ },
564
+ {
565
+ name: "DataSource"
566
+ type: {
567
+ kind: "struct"
568
+ fields: [
569
+ {
570
+ name: "chain"
571
+ type: "u16"
572
+ },
573
+ {
574
+ name: "emitter"
575
+ type: "publicKey"
576
+ },
577
+ ]
578
+ }
579
+ },
580
+ {
581
+ name: "PostUpdateAtomicParams"
582
+ type: {
583
+ kind: "struct"
584
+ fields: [
585
+ {
586
+ name: "vaa"
587
+ type: "bytes"
588
+ },
589
+ {
590
+ name: "merklePriceUpdate"
591
+ type: {
592
+ defined: "MerklePriceUpdate"
593
+ }
594
+ },
595
+ {
596
+ name: "treasuryId"
597
+ type: "u8"
598
+ },
599
+ ]
600
+ }
601
+ },
602
+ {
603
+ name: "PostUpdateParams"
604
+ type: {
605
+ kind: "struct"
606
+ fields: [
607
+ {
608
+ name: "merklePriceUpdate"
609
+ type: {
610
+ defined: "MerklePriceUpdate"
611
+ }
612
+ },
613
+ {
614
+ name: "treasuryId"
615
+ type: "u8"
616
+ },
617
+ ]
618
+ }
619
+ },
620
+ {
621
+ name: "PostTwapUpdateParams"
622
+ type: {
623
+ kind: "struct"
624
+ fields: [
625
+ {
626
+ name: "startMerklePriceUpdate"
627
+ type: {
628
+ defined: "MerklePriceUpdate"
629
+ }
630
+ },
631
+ {
632
+ name: "endMerklePriceUpdate"
633
+ type: {
634
+ defined: "MerklePriceUpdate"
635
+ }
636
+ },
637
+ {
638
+ name: "treasuryId"
639
+ type: "u8"
640
+ },
641
+ ]
642
+ }
643
+ },
644
+ {
645
+ name: "VerificationLevel"
646
+ docs: [
647
+ "* This enum represents how many guardian signatures were checked for a Pythnet price update\n * If full, guardian quorum has been attained\n * If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked",
648
+ ]
649
+ type: {
650
+ kind: "enum"
651
+ variants: [
652
+ {
653
+ name: "Partial"
654
+ fields: [
655
+ {
656
+ name: "numSignatures"
657
+ type: "u8"
658
+ },
659
+ ]
660
+ },
661
+ {
662
+ name: "Full"
663
+ },
664
+ ]
665
+ }
666
+ },
667
+ ]
668
+ errors: [
669
+ {
670
+ code: 6000
671
+ name: "InvalidWormholeMessage"
672
+ msg: "Received an invalid wormhole message"
673
+ },
674
+ {
675
+ code: 6001
676
+ name: "DeserializeMessageFailed"
677
+ msg: "An error occurred when deserializing the message"
678
+ },
679
+ {
680
+ code: 6002
681
+ name: "InvalidPriceUpdate"
682
+ msg: "Received an invalid price update"
683
+ },
684
+ {
685
+ code: 6003
686
+ name: "UnsupportedMessageType"
687
+ msg: "This type of message is not supported currently"
688
+ },
689
+ {
690
+ code: 6004
691
+ name: "InvalidDataSource"
692
+ msg: "The tuple emitter chain, emitter doesn't match one of the valid data sources."
693
+ },
694
+ {
695
+ code: 6005
696
+ name: "InsufficientFunds"
697
+ msg: "Funds are insufficient to pay the receiving fee"
698
+ },
699
+ {
700
+ code: 6006
701
+ name: "WrongWriteAuthority"
702
+ msg: "This signer can't write to price update account"
703
+ },
704
+ {
705
+ code: 6007
706
+ name: "WrongVaaOwner"
707
+ msg: "The posted VAA account has the wrong owner."
708
+ },
709
+ {
710
+ code: 6008
711
+ name: "DeserializeVaaFailed"
712
+ msg: "An error occurred when deserializing the VAA."
713
+ },
714
+ {
715
+ code: 6009
716
+ name: "InsufficientGuardianSignatures"
717
+ msg: "The number of guardian signatures is below the minimum"
718
+ },
719
+ {
720
+ code: 6010
721
+ name: "InvalidVaaVersion"
722
+ msg: "Invalid VAA version"
723
+ },
724
+ {
725
+ code: 6011
726
+ name: "GuardianSetMismatch"
727
+ msg: "Guardian set version in the VAA doesn't match the guardian set passed"
728
+ },
729
+ {
730
+ code: 6012
731
+ name: "InvalidGuardianOrder"
732
+ msg: "Guardian signature indices must be increasing"
733
+ },
734
+ {
735
+ code: 6013
736
+ name: "InvalidGuardianIndex"
737
+ msg: "Guardian index exceeds the number of guardians in the set"
738
+ },
739
+ {
740
+ code: 6014
741
+ name: "InvalidSignature"
742
+ msg: "A VAA signature is invalid"
743
+ },
744
+ {
745
+ code: 6015
746
+ name: "InvalidGuardianKeyRecovery"
747
+ msg: "The recovered guardian public key doesn't match the guardian set"
748
+ },
749
+ {
750
+ code: 6016
751
+ name: "WrongGuardianSetOwner"
752
+ msg: "The guardian set account is owned by the wrong program"
753
+ },
754
+ {
755
+ code: 6017
756
+ name: "InvalidGuardianSetPda"
757
+ msg: "The Guardian Set account doesn't match the PDA derivation"
758
+ },
759
+ {
760
+ code: 6018
761
+ name: "GuardianSetExpired"
762
+ msg: "The Guardian Set is expired"
763
+ },
764
+ {
765
+ code: 6019
766
+ name: "GovernanceAuthorityMismatch"
767
+ msg: "The signer is not authorized to perform this governance action"
768
+ },
769
+ {
770
+ code: 6020
771
+ name: "TargetGovernanceAuthorityMismatch"
772
+ msg: "The signer is not authorized to accept the governance authority"
773
+ },
774
+ {
775
+ code: 6021
776
+ name: "NonexistentGovernanceAuthorityTransferRequest"
777
+ msg: "The governance authority needs to request a transfer first"
778
+ },
779
+ ]
780
+ }
781
+
782
+ export const IDL: PythSolanaReceiver = {
783
+ version: "0.2.0",
784
+ name: "pyth_solana_receiver",
785
+ instructions: [
786
+ {
787
+ name: "initialize",
788
+ accounts: [
789
+ {
790
+ name: "payer",
791
+ isMut: true,
792
+ isSigner: true,
793
+ },
794
+ {
795
+ name: "config",
796
+ isMut: true,
797
+ isSigner: false,
798
+ },
799
+ {
800
+ name: "systemProgram",
801
+ isMut: false,
802
+ isSigner: false,
803
+ },
804
+ ],
805
+ args: [
806
+ {
807
+ name: "initialConfig",
808
+ type: {
809
+ defined: "Config",
810
+ },
811
+ },
812
+ ],
813
+ },
814
+ {
815
+ name: "requestGovernanceAuthorityTransfer",
816
+ accounts: [
817
+ {
818
+ name: "payer",
819
+ isMut: false,
820
+ isSigner: true,
821
+ },
822
+ {
823
+ name: "config",
824
+ isMut: true,
825
+ isSigner: false,
826
+ },
827
+ ],
828
+ args: [
829
+ {
830
+ name: "targetGovernanceAuthority",
831
+ type: "publicKey",
832
+ },
833
+ ],
834
+ },
835
+ {
836
+ name: "acceptGovernanceAuthorityTransfer",
837
+ accounts: [
838
+ {
839
+ name: "payer",
840
+ isMut: false,
841
+ isSigner: true,
842
+ },
843
+ {
844
+ name: "config",
845
+ isMut: true,
846
+ isSigner: false,
847
+ },
848
+ ],
849
+ args: [],
850
+ },
851
+ {
852
+ name: "setDataSources",
853
+ accounts: [
854
+ {
855
+ name: "payer",
856
+ isMut: false,
857
+ isSigner: true,
858
+ },
859
+ {
860
+ name: "config",
861
+ isMut: true,
862
+ isSigner: false,
863
+ },
864
+ ],
865
+ args: [
866
+ {
867
+ name: "validDataSources",
868
+ type: {
869
+ vec: {
870
+ defined: "DataSource",
871
+ },
872
+ },
873
+ },
874
+ ],
875
+ },
876
+ {
877
+ name: "setFee",
878
+ accounts: [
879
+ {
880
+ name: "payer",
881
+ isMut: false,
882
+ isSigner: true,
883
+ },
884
+ {
885
+ name: "config",
886
+ isMut: true,
887
+ isSigner: false,
888
+ },
889
+ ],
890
+ args: [
891
+ {
892
+ name: "singleUpdateFeeInLamports",
893
+ type: "u64",
894
+ },
895
+ ],
896
+ },
897
+ {
898
+ name: "setWormholeAddress",
899
+ accounts: [
900
+ {
901
+ name: "payer",
902
+ isMut: false,
903
+ isSigner: true,
904
+ },
905
+ {
906
+ name: "config",
907
+ isMut: true,
908
+ isSigner: false,
909
+ },
910
+ ],
911
+ args: [
912
+ {
913
+ name: "wormhole",
914
+ type: "publicKey",
915
+ },
916
+ ],
917
+ },
918
+ {
919
+ name: "setMinimumSignatures",
920
+ accounts: [
921
+ {
922
+ name: "payer",
923
+ isMut: false,
924
+ isSigner: true,
925
+ },
926
+ {
927
+ name: "config",
928
+ isMut: true,
929
+ isSigner: false,
930
+ },
931
+ ],
932
+ args: [
933
+ {
934
+ name: "minimumSignatures",
935
+ type: "u8",
936
+ },
937
+ ],
938
+ },
939
+ {
940
+ name: "postUpdateAtomic",
941
+ docs: [
942
+ "Post a price update using a VAA and a MerklePriceUpdate.",
943
+ "This function allows you to post a price update in a single transaction.",
944
+ "Compared to post_update, it is less secure since you won't be able to verify all guardian signatures if you use this function because of transaction size limitations.",
945
+ "Typically, you can fit 5 guardian signatures in a transaction that uses this.",
946
+ ],
947
+ accounts: [
948
+ {
949
+ name: "payer",
950
+ isMut: true,
951
+ isSigner: true,
952
+ },
953
+ {
954
+ name: "guardianSet",
955
+ isMut: false,
956
+ isSigner: false,
957
+ docs: ["Instead we do the same steps in deserialize_guardian_set_checked."],
958
+ },
959
+ {
960
+ name: "config",
961
+ isMut: false,
962
+ isSigner: false,
963
+ },
964
+ {
965
+ name: "treasury",
966
+ isMut: true,
967
+ isSigner: false,
968
+ },
969
+ {
970
+ name: "priceUpdateAccount",
971
+ isMut: true,
972
+ isSigner: true,
973
+ docs: [
974
+ "The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.",
975
+ "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
976
+ ],
977
+ },
978
+ {
979
+ name: "systemProgram",
980
+ isMut: false,
981
+ isSigner: false,
982
+ },
983
+ {
984
+ name: "writeAuthority",
985
+ isMut: false,
986
+ isSigner: true,
987
+ },
988
+ ],
989
+ args: [
990
+ {
991
+ name: "params",
992
+ type: {
993
+ defined: "PostUpdateAtomicParams",
994
+ },
995
+ },
996
+ ],
997
+ },
998
+ {
999
+ name: "postUpdate",
1000
+ docs: [
1001
+ "Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.",
1002
+ "This should be called after the client has already verified the Vaa via the Wormhole contract.",
1003
+ "Check out target_chains/solana/cli/src/main.rs for an example of how to do this.",
1004
+ ],
1005
+ accounts: [
1006
+ {
1007
+ name: "payer",
1008
+ isMut: true,
1009
+ isSigner: true,
1010
+ },
1011
+ {
1012
+ name: "encodedVaa",
1013
+ isMut: false,
1014
+ isSigner: false,
1015
+ },
1016
+ {
1017
+ name: "config",
1018
+ isMut: false,
1019
+ isSigner: false,
1020
+ },
1021
+ {
1022
+ name: "treasury",
1023
+ isMut: true,
1024
+ isSigner: false,
1025
+ },
1026
+ {
1027
+ name: "priceUpdateAccount",
1028
+ isMut: true,
1029
+ isSigner: true,
1030
+ docs: [
1031
+ "The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.",
1032
+ "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized",
1033
+ ],
1034
+ },
1035
+ {
1036
+ name: "systemProgram",
1037
+ isMut: false,
1038
+ isSigner: false,
1039
+ },
1040
+ {
1041
+ name: "writeAuthority",
1042
+ isMut: false,
1043
+ isSigner: true,
1044
+ },
1045
+ ],
1046
+ args: [
1047
+ {
1048
+ name: "params",
1049
+ type: {
1050
+ defined: "PostUpdateParams",
1051
+ },
1052
+ },
1053
+ ],
1054
+ },
1055
+ {
1056
+ name: "postTwapUpdate",
1057
+ docs: [
1058
+ "Post a TWAP (time weighted average price) update for a given time window.",
1059
+ "This should be called after the client has already verified the VAAs via the Wormhole contract.",
1060
+ "Check out target_chains/solana/cli/src/main.rs for an example of how to do this.",
1061
+ ],
1062
+ accounts: [
1063
+ {
1064
+ name: "payer",
1065
+ isMut: true,
1066
+ isSigner: true,
1067
+ },
1068
+ {
1069
+ name: "startEncodedVaa",
1070
+ isMut: false,
1071
+ isSigner: false,
1072
+ },
1073
+ {
1074
+ name: "endEncodedVaa",
1075
+ isMut: false,
1076
+ isSigner: false,
1077
+ },
1078
+ {
1079
+ name: "config",
1080
+ isMut: false,
1081
+ isSigner: false,
1082
+ },
1083
+ {
1084
+ name: "treasury",
1085
+ isMut: true,
1086
+ isSigner: false,
1087
+ },
1088
+ {
1089
+ name: "twapUpdateAccount",
1090
+ isMut: true,
1091
+ isSigner: true,
1092
+ docs: [
1093
+ "The contraint is such that either the twap_update_account is uninitialized or the write_authority is the write_authority.",
1094
+ "Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that twap_update_account.write_authority == Pubkey::default() once the account is initialized",
1095
+ ],
1096
+ },
1097
+ {
1098
+ name: "systemProgram",
1099
+ isMut: false,
1100
+ isSigner: false,
1101
+ },
1102
+ {
1103
+ name: "writeAuthority",
1104
+ isMut: false,
1105
+ isSigner: true,
1106
+ },
1107
+ ],
1108
+ args: [
1109
+ {
1110
+ name: "params",
1111
+ type: {
1112
+ defined: "PostTwapUpdateParams",
1113
+ },
1114
+ },
1115
+ ],
1116
+ },
1117
+ {
1118
+ name: "reclaimRent",
1119
+ accounts: [
1120
+ {
1121
+ name: "payer",
1122
+ isMut: true,
1123
+ isSigner: true,
1124
+ },
1125
+ {
1126
+ name: "priceUpdateAccount",
1127
+ isMut: true,
1128
+ isSigner: false,
1129
+ },
1130
+ ],
1131
+ args: [],
1132
+ },
1133
+ {
1134
+ name: "reclaimTwapRent",
1135
+ accounts: [
1136
+ {
1137
+ name: "payer",
1138
+ isMut: true,
1139
+ isSigner: true,
1140
+ },
1141
+ {
1142
+ name: "twapUpdateAccount",
1143
+ isMut: true,
1144
+ isSigner: false,
1145
+ },
1146
+ ],
1147
+ args: [],
1148
+ },
1149
+ ],
1150
+ accounts: [
1151
+ {
1152
+ name: "Config",
1153
+ type: {
1154
+ kind: "struct",
1155
+ fields: [
1156
+ {
1157
+ name: "governanceAuthority",
1158
+ type: "publicKey",
1159
+ },
1160
+ {
1161
+ name: "targetGovernanceAuthority",
1162
+ type: {
1163
+ option: "publicKey",
1164
+ },
1165
+ },
1166
+ {
1167
+ name: "wormhole",
1168
+ type: "publicKey",
1169
+ },
1170
+ {
1171
+ name: "validDataSources",
1172
+ type: {
1173
+ vec: {
1174
+ defined: "DataSource",
1175
+ },
1176
+ },
1177
+ },
1178
+ {
1179
+ name: "singleUpdateFeeInLamports",
1180
+ type: "u64",
1181
+ },
1182
+ {
1183
+ name: "minimumSignatures",
1184
+ type: "u8",
1185
+ },
1186
+ ],
1187
+ },
1188
+ },
1189
+ {
1190
+ name: "priceUpdateV2",
1191
+ type: {
1192
+ kind: "struct",
1193
+ fields: [
1194
+ {
1195
+ name: "writeAuthority",
1196
+ type: "publicKey",
1197
+ },
1198
+ {
1199
+ name: "verificationLevel",
1200
+ type: {
1201
+ defined: "VerificationLevel",
1202
+ },
1203
+ },
1204
+ {
1205
+ name: "priceMessage",
1206
+ type: {
1207
+ defined: "PriceFeedMessage",
1208
+ },
1209
+ },
1210
+ {
1211
+ name: "postedSlot",
1212
+ type: "u64",
1213
+ },
1214
+ ],
1215
+ },
1216
+ },
1217
+ {
1218
+ name: "twapUpdate",
1219
+ type: {
1220
+ kind: "struct",
1221
+ fields: [
1222
+ {
1223
+ name: "writeAuthority",
1224
+ type: "publicKey",
1225
+ },
1226
+ {
1227
+ name: "twap",
1228
+ type: {
1229
+ defined: "TwapPrice",
1230
+ },
1231
+ },
1232
+ ],
1233
+ },
1234
+ },
1235
+ ],
1236
+ types: [
1237
+ {
1238
+ name: "PriceFeedMessage",
1239
+ type: {
1240
+ kind: "struct",
1241
+ fields: [
1242
+ {
1243
+ name: "feedId",
1244
+ type: {
1245
+ array: ["u8", 32],
1246
+ },
1247
+ },
1248
+ {
1249
+ name: "price",
1250
+ type: "i64",
1251
+ },
1252
+ {
1253
+ name: "conf",
1254
+ type: "u64",
1255
+ },
1256
+ {
1257
+ name: "exponent",
1258
+ type: "i32",
1259
+ },
1260
+ {
1261
+ name: "publishTime",
1262
+ type: "i64",
1263
+ },
1264
+ {
1265
+ name: "prevPublishTime",
1266
+ type: "i64",
1267
+ },
1268
+ {
1269
+ name: "emaPrice",
1270
+ type: "i64",
1271
+ },
1272
+ {
1273
+ name: "emaConf",
1274
+ type: "u64",
1275
+ },
1276
+ ],
1277
+ },
1278
+ },
1279
+ {
1280
+ name: "TwapPrice",
1281
+ docs: [
1282
+ "The time weighted average price & conf for a feed over the window [start_time, end_time].",
1283
+ "This type is used to persist the calculated TWAP in TwapUpdate accounts on Solana.",
1284
+ ],
1285
+ type: {
1286
+ kind: "struct",
1287
+ fields: [
1288
+ {
1289
+ name: "feedId",
1290
+ type: {
1291
+ array: ["u8", 32],
1292
+ },
1293
+ },
1294
+ {
1295
+ name: "startTime",
1296
+ type: "i64",
1297
+ },
1298
+ {
1299
+ name: "endTime",
1300
+ type: "i64",
1301
+ },
1302
+ {
1303
+ name: "price",
1304
+ type: "i64",
1305
+ },
1306
+ {
1307
+ name: "conf",
1308
+ type: "u64",
1309
+ },
1310
+ {
1311
+ name: "exponent",
1312
+ type: "i32",
1313
+ },
1314
+ {
1315
+ name: "downSlotsRatio",
1316
+ docs: [
1317
+ "Ratio out of 1_000_000, where a value of 1_000_000 represents",
1318
+ "all slots were missed and 0 represents no slots were missed.",
1319
+ ],
1320
+ type: "u32",
1321
+ },
1322
+ ],
1323
+ },
1324
+ },
1325
+ {
1326
+ name: "MerklePriceUpdate",
1327
+ type: {
1328
+ kind: "struct",
1329
+ fields: [
1330
+ {
1331
+ name: "message",
1332
+ type: "bytes",
1333
+ },
1334
+ {
1335
+ name: "proof",
1336
+ type: {
1337
+ vec: {
1338
+ array: ["u8", 20],
1339
+ },
1340
+ },
1341
+ },
1342
+ ],
1343
+ },
1344
+ },
1345
+ {
1346
+ name: "DataSource",
1347
+ type: {
1348
+ kind: "struct",
1349
+ fields: [
1350
+ {
1351
+ name: "chain",
1352
+ type: "u16",
1353
+ },
1354
+ {
1355
+ name: "emitter",
1356
+ type: "publicKey",
1357
+ },
1358
+ ],
1359
+ },
1360
+ },
1361
+ {
1362
+ name: "PostUpdateAtomicParams",
1363
+ type: {
1364
+ kind: "struct",
1365
+ fields: [
1366
+ {
1367
+ name: "vaa",
1368
+ type: "bytes",
1369
+ },
1370
+ {
1371
+ name: "merklePriceUpdate",
1372
+ type: {
1373
+ defined: "MerklePriceUpdate",
1374
+ },
1375
+ },
1376
+ {
1377
+ name: "treasuryId",
1378
+ type: "u8",
1379
+ },
1380
+ ],
1381
+ },
1382
+ },
1383
+ {
1384
+ name: "PostUpdateParams",
1385
+ type: {
1386
+ kind: "struct",
1387
+ fields: [
1388
+ {
1389
+ name: "merklePriceUpdate",
1390
+ type: {
1391
+ defined: "MerklePriceUpdate",
1392
+ },
1393
+ },
1394
+ {
1395
+ name: "treasuryId",
1396
+ type: "u8",
1397
+ },
1398
+ ],
1399
+ },
1400
+ },
1401
+ {
1402
+ name: "PostTwapUpdateParams",
1403
+ type: {
1404
+ kind: "struct",
1405
+ fields: [
1406
+ {
1407
+ name: "startMerklePriceUpdate",
1408
+ type: {
1409
+ defined: "MerklePriceUpdate",
1410
+ },
1411
+ },
1412
+ {
1413
+ name: "endMerklePriceUpdate",
1414
+ type: {
1415
+ defined: "MerklePriceUpdate",
1416
+ },
1417
+ },
1418
+ {
1419
+ name: "treasuryId",
1420
+ type: "u8",
1421
+ },
1422
+ ],
1423
+ },
1424
+ },
1425
+ {
1426
+ name: "VerificationLevel",
1427
+ docs: [
1428
+ "* This enum represents how many guardian signatures were checked for a Pythnet price update\n * If full, guardian quorum has been attained\n * If partial, at least config.minimum signatures have been verified, but in the case config.minimum_signatures changes in the future we also include the number of signatures that were checked",
1429
+ ],
1430
+ type: {
1431
+ kind: "enum",
1432
+ variants: [
1433
+ {
1434
+ name: "Partial",
1435
+ fields: [
1436
+ {
1437
+ name: "numSignatures",
1438
+ type: "u8",
1439
+ },
1440
+ ],
1441
+ },
1442
+ {
1443
+ name: "Full",
1444
+ },
1445
+ ],
1446
+ },
1447
+ },
1448
+ ],
1449
+ errors: [
1450
+ {
1451
+ code: 6000,
1452
+ name: "InvalidWormholeMessage",
1453
+ msg: "Received an invalid wormhole message",
1454
+ },
1455
+ {
1456
+ code: 6001,
1457
+ name: "DeserializeMessageFailed",
1458
+ msg: "An error occurred when deserializing the message",
1459
+ },
1460
+ {
1461
+ code: 6002,
1462
+ name: "InvalidPriceUpdate",
1463
+ msg: "Received an invalid price update",
1464
+ },
1465
+ {
1466
+ code: 6003,
1467
+ name: "UnsupportedMessageType",
1468
+ msg: "This type of message is not supported currently",
1469
+ },
1470
+ {
1471
+ code: 6004,
1472
+ name: "InvalidDataSource",
1473
+ msg: "The tuple emitter chain, emitter doesn't match one of the valid data sources.",
1474
+ },
1475
+ {
1476
+ code: 6005,
1477
+ name: "InsufficientFunds",
1478
+ msg: "Funds are insufficient to pay the receiving fee",
1479
+ },
1480
+ {
1481
+ code: 6006,
1482
+ name: "WrongWriteAuthority",
1483
+ msg: "This signer can't write to price update account",
1484
+ },
1485
+ {
1486
+ code: 6007,
1487
+ name: "WrongVaaOwner",
1488
+ msg: "The posted VAA account has the wrong owner.",
1489
+ },
1490
+ {
1491
+ code: 6008,
1492
+ name: "DeserializeVaaFailed",
1493
+ msg: "An error occurred when deserializing the VAA.",
1494
+ },
1495
+ {
1496
+ code: 6009,
1497
+ name: "InsufficientGuardianSignatures",
1498
+ msg: "The number of guardian signatures is below the minimum",
1499
+ },
1500
+ {
1501
+ code: 6010,
1502
+ name: "InvalidVaaVersion",
1503
+ msg: "Invalid VAA version",
1504
+ },
1505
+ {
1506
+ code: 6011,
1507
+ name: "GuardianSetMismatch",
1508
+ msg: "Guardian set version in the VAA doesn't match the guardian set passed",
1509
+ },
1510
+ {
1511
+ code: 6012,
1512
+ name: "InvalidGuardianOrder",
1513
+ msg: "Guardian signature indices must be increasing",
1514
+ },
1515
+ {
1516
+ code: 6013,
1517
+ name: "InvalidGuardianIndex",
1518
+ msg: "Guardian index exceeds the number of guardians in the set",
1519
+ },
1520
+ {
1521
+ code: 6014,
1522
+ name: "InvalidSignature",
1523
+ msg: "A VAA signature is invalid",
1524
+ },
1525
+ {
1526
+ code: 6015,
1527
+ name: "InvalidGuardianKeyRecovery",
1528
+ msg: "The recovered guardian public key doesn't match the guardian set",
1529
+ },
1530
+ {
1531
+ code: 6016,
1532
+ name: "WrongGuardianSetOwner",
1533
+ msg: "The guardian set account is owned by the wrong program",
1534
+ },
1535
+ {
1536
+ code: 6017,
1537
+ name: "InvalidGuardianSetPda",
1538
+ msg: "The Guardian Set account doesn't match the PDA derivation",
1539
+ },
1540
+ {
1541
+ code: 6018,
1542
+ name: "GuardianSetExpired",
1543
+ msg: "The Guardian Set is expired",
1544
+ },
1545
+ {
1546
+ code: 6019,
1547
+ name: "GovernanceAuthorityMismatch",
1548
+ msg: "The signer is not authorized to perform this governance action",
1549
+ },
1550
+ {
1551
+ code: 6020,
1552
+ name: "TargetGovernanceAuthorityMismatch",
1553
+ msg: "The signer is not authorized to accept the governance authority",
1554
+ },
1555
+ {
1556
+ code: 6021,
1557
+ name: "NonexistentGovernanceAuthorityTransferRequest",
1558
+ msg: "The governance authority needs to request a transfer first",
1559
+ },
1560
+ ],
1561
+ }