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