@helium/currency-utils 0.9.23 → 0.10.0-alpha.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.
@@ -1,290 +1,280 @@
1
1
  export type PythSolanaReceiver = {
2
- version: "0.1.0";
3
- name: "pyth_solana_receiver";
2
+ address: "rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ";
3
+ metadata: {
4
+ name: "pyth_solana_receiver";
5
+ version: "0.1.0";
6
+ spec: "0.1.0";
7
+ };
4
8
  instructions: [
5
9
  {
6
10
  name: "initialize";
11
+ discriminator: [175, 175, 109, 31, 13, 152, 155, 237];
7
12
  accounts: [
8
13
  {
9
14
  name: "payer";
10
- isMut: true;
11
- isSigner: true;
15
+ writable: true;
16
+ signer: true;
12
17
  },
13
18
  {
14
19
  name: "config";
15
- isMut: true;
16
- isSigner: false;
20
+ writable: true;
17
21
  },
18
22
  {
19
- name: "systemProgram";
20
- isMut: false;
21
- isSigner: false;
23
+ name: "system_program";
22
24
  }
23
25
  ];
24
26
  args: [
25
27
  {
26
- name: "initialConfig";
28
+ name: "initial_config";
27
29
  type: {
28
- defined: "Config";
30
+ defined: {
31
+ name: "Config";
32
+ };
29
33
  };
30
34
  }
31
35
  ];
32
36
  },
33
37
  {
34
- name: "requestGovernanceAuthorityTransfer";
38
+ name: "request_governance_authority_transfer";
39
+ discriminator: [92, 18, 67, 156, 27, 151, 183, 224];
35
40
  accounts: [
36
41
  {
37
42
  name: "payer";
38
- isMut: false;
39
- isSigner: true;
43
+ signer: true;
40
44
  },
41
45
  {
42
46
  name: "config";
43
- isMut: true;
44
- isSigner: false;
47
+ writable: true;
45
48
  }
46
49
  ];
47
50
  args: [
48
51
  {
49
- name: "targetGovernanceAuthority";
50
- type: "publicKey";
52
+ name: "target_governance_authority";
53
+ type: "pubkey";
51
54
  }
52
55
  ];
53
56
  },
54
57
  {
55
- name: "acceptGovernanceAuthorityTransfer";
58
+ name: "accept_governance_authority_transfer";
59
+ discriminator: [254, 39, 222, 79, 64, 217, 205, 127];
56
60
  accounts: [
57
61
  {
58
62
  name: "payer";
59
- isMut: false;
60
- isSigner: true;
63
+ signer: true;
61
64
  },
62
65
  {
63
66
  name: "config";
64
- isMut: true;
65
- isSigner: false;
67
+ writable: true;
66
68
  }
67
69
  ];
68
70
  args: [];
69
71
  },
70
72
  {
71
- name: "setDataSources";
73
+ name: "set_data_sources";
74
+ discriminator: [107, 73, 15, 119, 195, 116, 91, 210];
72
75
  accounts: [
73
76
  {
74
77
  name: "payer";
75
- isMut: false;
76
- isSigner: true;
78
+ signer: true;
77
79
  },
78
80
  {
79
81
  name: "config";
80
- isMut: true;
81
- isSigner: false;
82
+ writable: true;
82
83
  }
83
84
  ];
84
85
  args: [
85
86
  {
86
- name: "validDataSources";
87
+ name: "valid_data_sources";
87
88
  type: {
88
89
  vec: {
89
- defined: "DataSource";
90
+ defined: {
91
+ name: "DataSource";
92
+ };
90
93
  };
91
94
  };
92
95
  }
93
96
  ];
94
97
  },
95
98
  {
96
- name: "setFee";
99
+ name: "set_fee";
100
+ discriminator: [18, 154, 24, 18, 237, 214, 19, 80];
97
101
  accounts: [
98
102
  {
99
103
  name: "payer";
100
- isMut: false;
101
- isSigner: true;
104
+ signer: true;
102
105
  },
103
106
  {
104
107
  name: "config";
105
- isMut: true;
106
- isSigner: false;
108
+ writable: true;
107
109
  }
108
110
  ];
109
111
  args: [
110
112
  {
111
- name: "singleUpdateFeeInLamports";
113
+ name: "single_update_fee_in_lamports";
112
114
  type: "u64";
113
115
  }
114
116
  ];
115
117
  },
116
118
  {
117
- name: "setWormholeAddress";
119
+ name: "set_wormhole_address";
120
+ discriminator: [154, 174, 252, 157, 91, 215, 179, 156];
118
121
  accounts: [
119
122
  {
120
123
  name: "payer";
121
- isMut: false;
122
- isSigner: true;
124
+ signer: true;
123
125
  },
124
126
  {
125
127
  name: "config";
126
- isMut: true;
127
- isSigner: false;
128
+ writable: true;
128
129
  }
129
130
  ];
130
131
  args: [
131
132
  {
132
133
  name: "wormhole";
133
- type: "publicKey";
134
+ type: "pubkey";
134
135
  }
135
136
  ];
136
137
  },
137
138
  {
138
- name: "setMinimumSignatures";
139
+ name: "set_minimum_signatures";
140
+ discriminator: [5, 210, 206, 124, 43, 68, 104, 149];
139
141
  accounts: [
140
142
  {
141
143
  name: "payer";
142
- isMut: false;
143
- isSigner: true;
144
+ signer: true;
144
145
  },
145
146
  {
146
147
  name: "config";
147
- isMut: true;
148
- isSigner: false;
148
+ writable: true;
149
149
  }
150
150
  ];
151
151
  args: [
152
152
  {
153
- name: "minimumSignatures";
153
+ name: "minimum_signatures";
154
154
  type: "u8";
155
155
  }
156
156
  ];
157
157
  },
158
158
  {
159
- name: "postUpdateAtomic";
159
+ name: "post_update_atomic";
160
160
  docs: [
161
161
  "Post a price update using a VAA and a MerklePriceUpdate.",
162
162
  "This function allows you to post a price update in a single transaction.",
163
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
164
  "Typically, you can fit 5 guardian signatures in a transaction that uses this."
165
165
  ];
166
+ discriminator: [49, 172, 84, 192, 175, 180, 52, 234];
166
167
  accounts: [
167
168
  {
168
169
  name: "payer";
169
- isMut: true;
170
- isSigner: true;
170
+ writable: true;
171
+ signer: true;
171
172
  },
172
173
  {
173
- name: "guardianSet";
174
- isMut: false;
175
- isSigner: false;
174
+ name: "guardian_set";
176
175
  docs: [
177
176
  "Instead we do the same steps in deserialize_guardian_set_checked."
178
177
  ];
179
178
  },
180
179
  {
181
180
  name: "config";
182
- isMut: false;
183
- isSigner: false;
184
181
  },
185
182
  {
186
183
  name: "treasury";
187
- isMut: true;
188
- isSigner: false;
184
+ writable: true;
189
185
  },
190
186
  {
191
- name: "priceUpdateAccount";
192
- isMut: true;
193
- isSigner: true;
187
+ name: "price_update_account";
194
188
  docs: [
195
189
  "The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.",
196
190
  "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"
197
191
  ];
192
+ writable: true;
193
+ signer: true;
198
194
  },
199
195
  {
200
- name: "systemProgram";
201
- isMut: false;
202
- isSigner: false;
196
+ name: "system_program";
203
197
  },
204
198
  {
205
- name: "writeAuthority";
206
- isMut: false;
207
- isSigner: true;
199
+ name: "write_authority";
200
+ signer: true;
208
201
  }
209
202
  ];
210
203
  args: [
211
204
  {
212
205
  name: "params";
213
206
  type: {
214
- defined: "PostUpdateAtomicParams";
207
+ defined: {
208
+ name: "PostUpdateAtomicParams";
209
+ };
215
210
  };
216
211
  }
217
212
  ];
218
213
  },
219
214
  {
220
- name: "postUpdate";
215
+ name: "post_update";
221
216
  docs: [
222
217
  "Post a price update using an encoded_vaa account and a MerklePriceUpdate calldata.",
223
218
  "This should be called after the client has already verified the Vaa via the Wormhole contract.",
224
219
  "Check out target_chains/solana/cli/src/main.rs for an example of how to do this."
225
220
  ];
221
+ discriminator: [133, 95, 207, 175, 11, 79, 118, 44];
226
222
  accounts: [
227
223
  {
228
224
  name: "payer";
229
- isMut: true;
230
- isSigner: true;
225
+ writable: true;
226
+ signer: true;
231
227
  },
232
228
  {
233
- name: "encodedVaa";
234
- isMut: false;
235
- isSigner: false;
229
+ name: "encoded_vaa";
236
230
  },
237
231
  {
238
232
  name: "config";
239
- isMut: false;
240
- isSigner: false;
241
233
  },
242
234
  {
243
235
  name: "treasury";
244
- isMut: true;
245
- isSigner: false;
236
+ writable: true;
246
237
  },
247
238
  {
248
- name: "priceUpdateAccount";
249
- isMut: true;
250
- isSigner: true;
239
+ name: "price_update_account";
251
240
  docs: [
252
241
  "The contraint is such that either the price_update_account is uninitialized or the payer is the write_authority.",
253
242
  "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"
254
243
  ];
244
+ writable: true;
245
+ signer: true;
255
246
  },
256
247
  {
257
- name: "systemProgram";
258
- isMut: false;
259
- isSigner: false;
248
+ name: "system_program";
260
249
  },
261
250
  {
262
- name: "writeAuthority";
263
- isMut: false;
264
- isSigner: true;
251
+ name: "write_authority";
252
+ signer: true;
265
253
  }
266
254
  ];
267
255
  args: [
268
256
  {
269
257
  name: "params";
270
258
  type: {
271
- defined: "PostUpdateParams";
259
+ defined: {
260
+ name: "PostUpdateParams";
261
+ };
272
262
  };
273
263
  }
274
264
  ];
275
265
  },
276
266
  {
277
- name: "reclaimRent";
267
+ name: "reclaim_rent";
268
+ discriminator: [218, 200, 19, 197, 227, 89, 192, 22];
278
269
  accounts: [
279
270
  {
280
271
  name: "payer";
281
- isMut: true;
282
- isSigner: true;
272
+ writable: true;
273
+ signer: true;
283
274
  },
284
275
  {
285
- name: "priceUpdateAccount";
286
- isMut: true;
287
- isSigner: false;
276
+ name: "price_update_account";
277
+ writable: true;
288
278
  }
289
279
  ];
290
280
  args: [];
@@ -293,69 +283,123 @@ export type PythSolanaReceiver = {
293
283
  accounts: [
294
284
  {
295
285
  name: "Config";
296
- type: {
297
- kind: "struct";
298
- fields: [
299
- {
300
- name: "governanceAuthority";
301
- type: "publicKey";
302
- },
303
- {
304
- name: "targetGovernanceAuthority";
305
- type: {
306
- option: "publicKey";
307
- };
308
- },
309
- {
310
- name: "wormhole";
311
- type: "publicKey";
312
- },
313
- {
314
- name: "validDataSources";
315
- type: {
316
- vec: {
317
- defined: "DataSource";
318
- };
319
- };
320
- },
321
- {
322
- name: "singleUpdateFeeInLamports";
323
- type: "u64";
324
- },
325
- {
326
- name: "minimumSignatures";
327
- type: "u8";
328
- }
329
- ];
330
- };
286
+ discriminator: [155, 12, 170, 224, 30, 250, 204, 130];
331
287
  },
332
288
  {
333
289
  name: "priceUpdateV2";
334
- type: {
335
- kind: "struct";
336
- fields: [
337
- {
338
- name: "writeAuthority";
339
- type: "publicKey";
340
- },
341
- {
342
- name: "verificationLevel";
343
- type: {
344
- defined: "VerificationLevel";
345
- };
346
- },
347
- {
348
- name: "priceMessage";
349
- type: {
350
- defined: "PriceFeedMessage";
351
- };
352
- },
353
- {
354
- name: "postedSlot";
355
- type: "u64";
356
- }
357
- ];
358
- };
290
+ discriminator: [70, 9, 59, 15, 151, 95, 3, 234];
291
+ }
292
+ ];
293
+ errors: [
294
+ {
295
+ code: 6000;
296
+ name: "InvalidWormholeMessage";
297
+ msg: "Received an invalid wormhole message";
298
+ },
299
+ {
300
+ code: 6001;
301
+ name: "DeserializeMessageFailed";
302
+ msg: "An error occurred when deserializing the message";
303
+ },
304
+ {
305
+ code: 6002;
306
+ name: "InvalidPriceUpdate";
307
+ msg: "Received an invalid price update";
308
+ },
309
+ {
310
+ code: 6003;
311
+ name: "UnsupportedMessageType";
312
+ msg: "This type of message is not supported currently";
313
+ },
314
+ {
315
+ code: 6004;
316
+ name: "InvalidDataSource";
317
+ msg: "The tuple emitter chain, emitter doesn't match one of the valid data sources.";
318
+ },
319
+ {
320
+ code: 6005;
321
+ name: "InsufficientFunds";
322
+ msg: "Funds are insufficient to pay the receiving fee";
323
+ },
324
+ {
325
+ code: 6006;
326
+ name: "WrongWriteAuthority";
327
+ msg: "This signer can't write to price update account";
328
+ },
329
+ {
330
+ code: 6007;
331
+ name: "WrongVaaOwner";
332
+ msg: "The posted VAA account has the wrong owner.";
333
+ },
334
+ {
335
+ code: 6008;
336
+ name: "DeserializeVaaFailed";
337
+ msg: "An error occurred when deserializing the VAA.";
338
+ },
339
+ {
340
+ code: 6009;
341
+ name: "InsufficientGuardianSignatures";
342
+ msg: "The number of guardian signatures is below the minimum";
343
+ },
344
+ {
345
+ code: 6010;
346
+ name: "InvalidVaaVersion";
347
+ msg: "Invalid VAA version";
348
+ },
349
+ {
350
+ code: 6011;
351
+ name: "GuardianSetMismatch";
352
+ msg: "Guardian set version in the VAA doesn't match the guardian set passed";
353
+ },
354
+ {
355
+ code: 6012;
356
+ name: "InvalidGuardianOrder";
357
+ msg: "Guardian signature indices must be increasing";
358
+ },
359
+ {
360
+ code: 6013;
361
+ name: "InvalidGuardianIndex";
362
+ msg: "Guardian index exceeds the number of guardians in the set";
363
+ },
364
+ {
365
+ code: 6014;
366
+ name: "InvalidSignature";
367
+ msg: "A VAA signature is invalid";
368
+ },
369
+ {
370
+ code: 6015;
371
+ name: "InvalidGuardianKeyRecovery";
372
+ msg: "The recovered guardian public key doesn't match the guardian set";
373
+ },
374
+ {
375
+ code: 6016;
376
+ name: "WrongGuardianSetOwner";
377
+ msg: "The guardian set account is owned by the wrong program";
378
+ },
379
+ {
380
+ code: 6017;
381
+ name: "InvalidGuardianSetPda";
382
+ msg: "The Guardian Set account doesn't match the PDA derivation";
383
+ },
384
+ {
385
+ code: 6018;
386
+ name: "GuardianSetExpired";
387
+ msg: "The Guardian Set is expired";
388
+ },
389
+ {
390
+ code: 6019;
391
+ name: "GovernanceAuthorityMismatch";
392
+ msg: "The signer is not authorized to perform this governance action";
393
+ },
394
+ {
395
+ code: 6020;
396
+ name: "TargetGovernanceAuthorityMismatch";
397
+ msg: "The signer is not authorized to accept the governance authority";
398
+ },
399
+ {
400
+ code: 6021;
401
+ name: "NonexistentGovernanceAuthorityTransferRequest";
402
+ msg: "The governance authority needs to request a transfer first";
359
403
  }
360
404
  ];
361
405
  types: [
@@ -365,7 +409,7 @@ export type PythSolanaReceiver = {
365
409
  kind: "struct";
366
410
  fields: [
367
411
  {
368
- name: "feedId";
412
+ name: "feed_id";
369
413
  type: {
370
414
  array: ["u8", 32];
371
415
  };
@@ -383,19 +427,19 @@ export type PythSolanaReceiver = {
383
427
  type: "i32";
384
428
  },
385
429
  {
386
- name: "publishTime";
430
+ name: "publish_time";
387
431
  type: "i64";
388
432
  },
389
433
  {
390
- name: "prevPublishTime";
434
+ name: "prev_publish_time";
391
435
  type: "i64";
392
436
  },
393
437
  {
394
- name: "emaPrice";
438
+ name: "ema_price";
395
439
  type: "i64";
396
440
  },
397
441
  {
398
- name: "emaConf";
442
+ name: "ema_conf";
399
443
  type: "u64";
400
444
  }
401
445
  ];
@@ -432,7 +476,7 @@ export type PythSolanaReceiver = {
432
476
  },
433
477
  {
434
478
  name: "emitter";
435
- type: "publicKey";
479
+ type: "pubkey";
436
480
  }
437
481
  ];
438
482
  };
@@ -447,13 +491,15 @@ export type PythSolanaReceiver = {
447
491
  type: "bytes";
448
492
  },
449
493
  {
450
- name: "merklePriceUpdate";
494
+ name: "merkle_price_update";
451
495
  type: {
452
- defined: "MerklePriceUpdate";
496
+ defined: {
497
+ name: "MerklePriceUpdate";
498
+ };
453
499
  };
454
500
  },
455
501
  {
456
- name: "treasuryId";
502
+ name: "treasury_id";
457
503
  type: "u8";
458
504
  }
459
505
  ];
@@ -465,13 +511,15 @@ export type PythSolanaReceiver = {
465
511
  kind: "struct";
466
512
  fields: [
467
513
  {
468
- name: "merklePriceUpdate";
514
+ name: "merkle_price_update";
469
515
  type: {
470
- defined: "MerklePriceUpdate";
516
+ defined: {
517
+ name: "MerklePriceUpdate";
518
+ };
471
519
  };
472
520
  },
473
521
  {
474
- name: "treasuryId";
522
+ name: "treasury_id";
475
523
  type: "u8";
476
524
  }
477
525
  ];
@@ -489,7 +537,7 @@ export type PythSolanaReceiver = {
489
537
  name: "Partial";
490
538
  fields: [
491
539
  {
492
- name: "numSignatures";
540
+ name: "num_signatures";
493
541
  type: "u8";
494
542
  }
495
543
  ];
@@ -499,118 +547,78 @@ export type PythSolanaReceiver = {
499
547
  }
500
548
  ];
501
549
  };
502
- }
503
- ];
504
- errors: [
505
- {
506
- code: 6000;
507
- name: "InvalidWormholeMessage";
508
- msg: "Received an invalid wormhole message";
509
- },
510
- {
511
- code: 6001;
512
- name: "DeserializeMessageFailed";
513
- msg: "An error occurred when deserializing the message";
514
- },
515
- {
516
- code: 6002;
517
- name: "InvalidPriceUpdate";
518
- msg: "Received an invalid price update";
519
- },
520
- {
521
- code: 6003;
522
- name: "UnsupportedMessageType";
523
- msg: "This type of message is not supported currently";
524
- },
525
- {
526
- code: 6004;
527
- name: "InvalidDataSource";
528
- msg: "The tuple emitter chain, emitter doesn't match one of the valid data sources.";
529
- },
530
- {
531
- code: 6005;
532
- name: "InsufficientFunds";
533
- msg: "Funds are insufficient to pay the receiving fee";
534
- },
535
- {
536
- code: 6006;
537
- name: "WrongWriteAuthority";
538
- msg: "This signer can't write to price update account";
539
- },
540
- {
541
- code: 6007;
542
- name: "WrongVaaOwner";
543
- msg: "The posted VAA account has the wrong owner.";
544
- },
545
- {
546
- code: 6008;
547
- name: "DeserializeVaaFailed";
548
- msg: "An error occurred when deserializing the VAA.";
549
- },
550
- {
551
- code: 6009;
552
- name: "InsufficientGuardianSignatures";
553
- msg: "The number of guardian signatures is below the minimum";
554
- },
555
- {
556
- code: 6010;
557
- name: "InvalidVaaVersion";
558
- msg: "Invalid VAA version";
559
- },
560
- {
561
- code: 6011;
562
- name: "GuardianSetMismatch";
563
- msg: "Guardian set version in the VAA doesn't match the guardian set passed";
564
- },
565
- {
566
- code: 6012;
567
- name: "InvalidGuardianOrder";
568
- msg: "Guardian signature indices must be increasing";
569
- },
570
- {
571
- code: 6013;
572
- name: "InvalidGuardianIndex";
573
- msg: "Guardian index exceeds the number of guardians in the set";
574
- },
575
- {
576
- code: 6014;
577
- name: "InvalidSignature";
578
- msg: "A VAA signature is invalid";
579
550
  },
580
551
  {
581
- code: 6015;
582
- name: "InvalidGuardianKeyRecovery";
583
- msg: "The recovered guardian public key doesn't match the guardian set";
584
- },
585
- {
586
- code: 6016;
587
- name: "WrongGuardianSetOwner";
588
- msg: "The guardian set account is owned by the wrong program";
589
- },
590
- {
591
- code: 6017;
592
- name: "InvalidGuardianSetPda";
593
- msg: "The Guardian Set account doesn't match the PDA derivation";
594
- },
595
- {
596
- code: 6018;
597
- name: "GuardianSetExpired";
598
- msg: "The Guardian Set is expired";
599
- },
600
- {
601
- code: 6019;
602
- name: "GovernanceAuthorityMismatch";
603
- msg: "The signer is not authorized to perform this governance action";
604
- },
605
- {
606
- code: 6020;
607
- name: "TargetGovernanceAuthorityMismatch";
608
- msg: "The signer is not authorized to accept the governance authority";
552
+ name: "Config";
553
+ type: {
554
+ kind: "struct";
555
+ fields: [
556
+ {
557
+ name: "governance_authority";
558
+ type: "pubkey";
559
+ },
560
+ {
561
+ name: "target_governance_authority";
562
+ type: {
563
+ option: "pubkey";
564
+ };
565
+ },
566
+ {
567
+ name: "wormhole";
568
+ type: "pubkey";
569
+ },
570
+ {
571
+ name: "valid_data_sources";
572
+ type: {
573
+ vec: {
574
+ defined: {
575
+ name: "DataSource";
576
+ };
577
+ };
578
+ };
579
+ },
580
+ {
581
+ name: "single_update_fee_in_lamports";
582
+ type: "u64";
583
+ },
584
+ {
585
+ name: "minimum_signatures";
586
+ type: "u8";
587
+ }
588
+ ];
589
+ };
609
590
  },
610
591
  {
611
- code: 6021;
612
- name: "NonexistentGovernanceAuthorityTransferRequest";
613
- msg: "The governance authority needs to request a transfer first";
592
+ name: "priceUpdateV2";
593
+ type: {
594
+ kind: "struct";
595
+ fields: [
596
+ {
597
+ name: "write_authority";
598
+ type: "pubkey";
599
+ },
600
+ {
601
+ name: "verification_level";
602
+ type: {
603
+ defined: {
604
+ name: "VerificationLevel";
605
+ };
606
+ };
607
+ },
608
+ {
609
+ name: "price_message";
610
+ type: {
611
+ defined: {
612
+ name: "PriceFeedMessage";
613
+ };
614
+ };
615
+ },
616
+ {
617
+ name: "posted_slot";
618
+ type: "u64";
619
+ }
620
+ ];
621
+ };
614
622
  }
615
623
  ];
616
624
  };