@helium/spl-utils 0.10.0-alpha.1 → 0.10.0-alpha.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.
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.fetchBackwardsCompatibleIdl = void 0;
15
+ exports.useBackwardsCompatibleIdl = exports.fetchBackwardsCompatibleIdl = void 0;
16
16
  const anchor_1 = require("@coral-xyz/anchor");
17
17
  const circuit_breaker_json_1 = __importDefault(require("./idl/circuit_breaker.json"));
18
18
  const data_credits_json_1 = __importDefault(require("./idl/data_credits.json"));
@@ -28,18 +28,25 @@ const price_oracle_json_1 = __importDefault(require("./idl/price_oracle.json"));
28
28
  const rewards_oracle_json_1 = __importDefault(require("./idl/rewards_oracle.json"));
29
29
  const treasury_management_json_1 = __importDefault(require("./idl/treasury_management.json"));
30
30
  const voter_stake_registry_json_1 = __importDefault(require("./idl/voter_stake_registry.json"));
31
+ const proposal_json_1 = __importDefault(require("./idl/proposal.json"));
32
+ const state_controller_json_1 = __importDefault(require("./idl/state_controller.json"));
33
+ const nft_proxy_json_1 = __importDefault(require("./idl/nft_proxy.json"));
34
+ const organization_json_1 = __importDefault(require("./idl/organization.json"));
31
35
  function fetchBackwardsCompatibleIdl(programId, provider) {
32
36
  return __awaiter(this, void 0, void 0, function* () {
33
37
  const idl = yield anchor_1.Program.fetchIdl(programId, provider);
34
- // This is an Anchor 0.30+ IDL. Return the old IDLs
35
- // @ts-ignore
36
- if (!idl || !(idl === null || idl === void 0 ? void 0 : idl.address)) {
37
- return IDLS_BY_PROGRAM[programId.toBase58()] || idl;
38
- }
39
- return idl;
38
+ return useBackwardsCompatibleIdl(programId, idl);
40
39
  });
41
40
  }
42
41
  exports.fetchBackwardsCompatibleIdl = fetchBackwardsCompatibleIdl;
42
+ function useBackwardsCompatibleIdl(programId, idl) {
43
+ // This is an Anchor 0.30+ IDL. Return the old IDLs
44
+ if (!idl || !(idl === null || idl === void 0 ? void 0 : idl.address)) {
45
+ return IDLS_BY_PROGRAM[programId.toBase58()] || idl;
46
+ }
47
+ return idl;
48
+ }
49
+ exports.useBackwardsCompatibleIdl = useBackwardsCompatibleIdl;
43
50
  const IDLS_BY_PROGRAM = {
44
51
  "1azyuavdMyvsivtNxPoz6SucD18eDHeXzFCUPq5XU7w": lazy_distributor_json_1.default,
45
52
  hdaoVTCqhfHHo75XdAMxBKdUqvq1i5bF23sisBqVgGR: helium_sub_daos_json_1.default,
@@ -55,5 +62,9 @@ const IDLS_BY_PROGRAM = {
55
62
  memMa1HG4odAFmUbGWfPwS1WWfK95k99F2YTkGvyxZr: mobile_entity_manager_json_1.default,
56
63
  hexbnKYoA2GercNNhHUCCfrTRWrHjT6ujKPXTa5NPqJ: hexboosting_json_1.default,
57
64
  noEmmgLmQdk6DLiPV8CSwQv3qQDyGEhz9m5A4zhtByv: no_emit_json_1.default,
65
+ propFYxqmVcufMhk5esNMrexq2ogHbbC2kP9PU1qxKs: proposal_json_1.default,
66
+ stcfiqW3fwD9QCd8Bqr1NBLrs7dftZHBQe7RiMMA4aM: state_controller_json_1.default,
67
+ nprx42sXf5rpVnwBWEdRg1d8tuCWsTuVLys1pRWwE6p: nft_proxy_json_1.default,
68
+ orgdXvHVLkWgBYerptASkAwkZAE563CJUu717dMNx5f: organization_json_1.default,
58
69
  };
59
70
  //# sourceMappingURL=fetchBackwardsCompatibleIdl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchBackwardsCompatibleIdl.js","sourceRoot":"","sources":["../../src/fetchBackwardsCompatibleIdl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,8CAA4C;AAC5C,sFAA2D;AAC3D,gFAAqD;AACrD,oEAA0C;AAC1C,kGAAsE;AACtE,sFAA0D;AAC1D,8EAAoD;AACpD,wFAA6D;AAC7D,0F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Rg1d8tuCWsTuVLys1pRWwE6p",
3
+ "metadata": {
4
+ "name": "nft_proxy",
5
+ "version": "0.0.2",
6
+ "spec": "0.1.0",
7
+ "description": "Created with Anchor"
8
+ },
9
+ "instructions": [
10
+ {
11
+ "name": "assign_proxy_v0",
12
+ "discriminator": [
13
+ 107,
14
+ 214,
15
+ 197,
16
+ 124,
17
+ 248,
18
+ 222,
19
+ 169,
20
+ 25
21
+ ],
22
+ "accounts": [
23
+ {
24
+ "name": "payer",
25
+ "writable": true,
26
+ "signer": true
27
+ },
28
+ {
29
+ "name": "asset"
30
+ },
31
+ {
32
+ "name": "approver",
33
+ "signer": true
34
+ },
35
+ {
36
+ "name": "voter",
37
+ "docs": [
38
+ "or in the case of a primary proxy (first in the line), Pubkey::default"
39
+ ]
40
+ },
41
+ {
42
+ "name": "token_account",
43
+ "optional": true
44
+ },
45
+ {
46
+ "name": "proxy_config"
47
+ },
48
+ {
49
+ "name": "current_proxy_assignment",
50
+ "writable": true,
51
+ "pda": {
52
+ "seeds": [
53
+ {
54
+ "kind": "const",
55
+ "value": [
56
+ 112,
57
+ 114,
58
+ 111,
59
+ 120,
60
+ 121,
61
+ 95,
62
+ 97,
63
+ 115,
64
+ 115,
65
+ 105,
66
+ 103,
67
+ 110,
68
+ 109,
69
+ 101,
70
+ 110,
71
+ 116
72
+ ]
73
+ },
74
+ {
75
+ "kind": "account",
76
+ "path": "proxy_config"
77
+ },
78
+ {
79
+ "kind": "account",
80
+ "path": "asset"
81
+ },
82
+ {
83
+ "kind": "account",
84
+ "path": "voter"
85
+ }
86
+ ]
87
+ }
88
+ },
89
+ {
90
+ "name": "recipient"
91
+ },
92
+ {
93
+ "name": "next_proxy_assignment",
94
+ "writable": true,
95
+ "pda": {
96
+ "seeds": [
97
+ {
98
+ "kind": "const",
99
+ "value": [
100
+ 112,
101
+ 114,
102
+ 111,
103
+ 120,
104
+ 121,
105
+ 95,
106
+ 97,
107
+ 115,
108
+ 115,
109
+ 105,
110
+ 103,
111
+ 110,
112
+ 109,
113
+ 101,
114
+ 110,
115
+ 116
116
+ ]
117
+ },
118
+ {
119
+ "kind": "account",
120
+ "path": "proxy_config"
121
+ },
122
+ {
123
+ "kind": "account",
124
+ "path": "asset"
125
+ },
126
+ {
127
+ "kind": "account",
128
+ "path": "recipient"
129
+ }
130
+ ]
131
+ }
132
+ },
133
+ {
134
+ "name": "system_program",
135
+ "address": "11111111111111111111111111111111"
136
+ }
137
+ ],
138
+ "args": [
139
+ {
140
+ "name": "args",
141
+ "type": {
142
+ "defined": {
143
+ "name": "AssignProxyArgsV0"
144
+ }
145
+ }
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "name": "close_expired_proxy_v0",
151
+ "discriminator": [
152
+ 21,
153
+ 151,
154
+ 28,
155
+ 156,
156
+ 29,
157
+ 184,
158
+ 97,
159
+ 58
160
+ ],
161
+ "accounts": [
162
+ {
163
+ "name": "rent_refund",
164
+ "writable": true,
165
+ "relations": [
166
+ "proxy_assignment"
167
+ ]
168
+ },
169
+ {
170
+ "name": "proxy_assignment",
171
+ "writable": true
172
+ },
173
+ {
174
+ "name": "system_program",
175
+ "address": "11111111111111111111111111111111"
176
+ }
177
+ ],
178
+ "args": []
179
+ },
180
+ {
181
+ "name": "initialize_proxy_config_v0",
182
+ "discriminator": [
183
+ 8,
184
+ 242,
185
+ 247,
186
+ 214,
187
+ 208,
188
+ 16,
189
+ 189,
190
+ 129
191
+ ],
192
+ "accounts": [
193
+ {
194
+ "name": "payer",
195
+ "writable": true,
196
+ "signer": true
197
+ },
198
+ {
199
+ "name": "authority"
200
+ },
201
+ {
202
+ "name": "proxy_config",
203
+ "writable": true,
204
+ "pda": {
205
+ "seeds": [
206
+ {
207
+ "kind": "const",
208
+ "value": [
209
+ 112,
210
+ 114,
211
+ 111,
212
+ 120,
213
+ 121,
214
+ 95,
215
+ 99,
216
+ 111,
217
+ 110,
218
+ 102,
219
+ 105,
220
+ 103
221
+ ]
222
+ },
223
+ {
224
+ "kind": "arg",
225
+ "path": "args.name"
226
+ }
227
+ ]
228
+ }
229
+ },
230
+ {
231
+ "name": "system_program",
232
+ "address": "11111111111111111111111111111111"
233
+ }
234
+ ],
235
+ "args": [
236
+ {
237
+ "name": "args",
238
+ "type": {
239
+ "defined": {
240
+ "name": "InitializeProxyConfigArgsV0"
241
+ }
242
+ }
243
+ }
244
+ ]
245
+ },
246
+ {
247
+ "name": "unassign_expired_proxy_v0",
248
+ "discriminator": [
249
+ 165,
250
+ 221,
251
+ 241,
252
+ 128,
253
+ 213,
254
+ 85,
255
+ 107,
256
+ 20
257
+ ],
258
+ "accounts": [
259
+ {
260
+ "name": "rent_refund",
261
+ "writable": true,
262
+ "relations": [
263
+ "proxy_assignment"
264
+ ]
265
+ },
266
+ {
267
+ "name": "prev_proxy_assignment",
268
+ "writable": true
269
+ },
270
+ {
271
+ "name": "proxy_assignment",
272
+ "writable": true
273
+ },
274
+ {
275
+ "name": "system_program",
276
+ "address": "11111111111111111111111111111111"
277
+ }
278
+ ],
279
+ "args": []
280
+ },
281
+ {
282
+ "name": "unassign_proxy_v0",
283
+ "discriminator": [
284
+ 23,
285
+ 104,
286
+ 235,
287
+ 220,
288
+ 139,
289
+ 184,
290
+ 41,
291
+ 221
292
+ ],
293
+ "accounts": [
294
+ {
295
+ "name": "rent_refund",
296
+ "writable": true,
297
+ "relations": [
298
+ "proxy_assignment"
299
+ ]
300
+ },
301
+ {
302
+ "name": "asset",
303
+ "relations": [
304
+ "current_proxy_assignment"
305
+ ]
306
+ },
307
+ {
308
+ "name": "approver",
309
+ "signer": true
310
+ },
311
+ {
312
+ "name": "voter",
313
+ "docs": [
314
+ "or in the case of a primary proxy (first in the line), Pubkey::default"
315
+ ],
316
+ "relations": [
317
+ "current_proxy_assignment"
318
+ ]
319
+ },
320
+ {
321
+ "name": "token_account",
322
+ "optional": true
323
+ },
324
+ {
325
+ "name": "current_proxy_assignment"
326
+ },
327
+ {
328
+ "name": "prev_proxy_assignment",
329
+ "writable": true
330
+ },
331
+ {
332
+ "name": "proxy_assignment",
333
+ "writable": true
334
+ },
335
+ {
336
+ "name": "proxy_config",
337
+ "relations": [
338
+ "current_proxy_assignment",
339
+ "prev_proxy_assignment",
340
+ "proxy_assignment"
341
+ ]
342
+ },
343
+ {
344
+ "name": "system_program",
345
+ "address": "11111111111111111111111111111111"
346
+ }
347
+ ],
348
+ "args": []
349
+ },
350
+ {
351
+ "name": "update_proxy_config_v0",
352
+ "discriminator": [
353
+ 165,
354
+ 218,
355
+ 143,
356
+ 105,
357
+ 41,
358
+ 163,
359
+ 178,
360
+ 225
361
+ ],
362
+ "accounts": [
363
+ {
364
+ "name": "payer",
365
+ "writable": true,
366
+ "signer": true
367
+ },
368
+ {
369
+ "name": "authority",
370
+ "signer": true,
371
+ "relations": [
372
+ "proxy_config"
373
+ ]
374
+ },
375
+ {
376
+ "name": "proxy_config",
377
+ "writable": true
378
+ },
379
+ {
380
+ "name": "system_program",
381
+ "address": "11111111111111111111111111111111"
382
+ }
383
+ ],
384
+ "args": [
385
+ {
386
+ "name": "args",
387
+ "type": {
388
+ "defined": {
389
+ "name": "UpdateProxyConfigArgsV0"
390
+ }
391
+ }
392
+ }
393
+ ]
394
+ }
395
+ ],
396
+ "accounts": [
397
+ {
398
+ "name": "ProxyAssignmentV0",
399
+ "discriminator": [
400
+ 196,
401
+ 152,
402
+ 78,
403
+ 155,
404
+ 132,
405
+ 136,
406
+ 147,
407
+ 55
408
+ ]
409
+ },
410
+ {
411
+ "name": "ProxyConfigV0",
412
+ "discriminator": [
413
+ 187,
414
+ 22,
415
+ 143,
416
+ 173,
417
+ 201,
418
+ 68,
419
+ 34,
420
+ 64
421
+ ]
422
+ }
423
+ ],
424
+ "errors": [
425
+ {
426
+ "code": 6000,
427
+ "name": "ExpirationExceedsMax",
428
+ "msg": "The specified expiration time exceeds the maximum allowed for this proxy configuration"
429
+ },
430
+ {
431
+ "code": 6001,
432
+ "name": "ExpirationExceedsSeasonMax",
433
+ "msg": "The specified expiration time exceeds the maximum allowed for this season"
434
+ },
435
+ {
436
+ "code": 6002,
437
+ "name": "ExpirationPast",
438
+ "msg": "The specified expiration time has already passed"
439
+ },
440
+ {
441
+ "code": 6003,
442
+ "name": "ExpirationExceedsPreceedingProxy",
443
+ "msg": "The specified expiration time exceeds the expiration of the existing delegatio"
444
+ },
445
+ {
446
+ "code": 6004,
447
+ "name": "SeasonsNotSorted",
448
+ "msg": "The seasons are not sorted"
449
+ },
450
+ {
451
+ "code": 6005,
452
+ "name": "InvalidDataIncrease",
453
+ "msg": "The data size increase is not valid"
454
+ },
455
+ {
456
+ "code": 6006,
457
+ "name": "ExpirationTimeInvalid",
458
+ "msg": "The expiration time is invalid"
459
+ },
460
+ {
461
+ "code": 6007,
462
+ "name": "ExpirationNotPast",
463
+ "msg": "The specified expiration time has not passed"
464
+ }
465
+ ],
466
+ "types": [
467
+ {
468
+ "name": "AssignProxyArgsV0",
469
+ "type": {
470
+ "kind": "struct",
471
+ "fields": [
472
+ {
473
+ "name": "expiration_time",
474
+ "type": "i64"
475
+ }
476
+ ]
477
+ }
478
+ },
479
+ {
480
+ "name": "InitializeProxyConfigArgsV0",
481
+ "type": {
482
+ "kind": "struct",
483
+ "fields": [
484
+ {
485
+ "name": "name",
486
+ "type": "string"
487
+ },
488
+ {
489
+ "name": "max_proxy_time",
490
+ "type": "i64"
491
+ },
492
+ {
493
+ "name": "seasons",
494
+ "type": {
495
+ "vec": {
496
+ "defined": {
497
+ "name": "SeasonV0"
498
+ }
499
+ }
500
+ }
501
+ }
502
+ ]
503
+ }
504
+ },
505
+ {
506
+ "name": "ProxyAssignmentV0",
507
+ "type": {
508
+ "kind": "struct",
509
+ "fields": [
510
+ {
511
+ "name": "voter",
512
+ "type": "pubkey"
513
+ },
514
+ {
515
+ "name": "proxy_config",
516
+ "type": "pubkey"
517
+ },
518
+ {
519
+ "name": "asset",
520
+ "type": "pubkey"
521
+ },
522
+ {
523
+ "name": "index",
524
+ "type": "u16"
525
+ },
526
+ {
527
+ "name": "next_voter",
528
+ "type": "pubkey"
529
+ },
530
+ {
531
+ "name": "rent_refund",
532
+ "type": "pubkey"
533
+ },
534
+ {
535
+ "name": "expiration_time",
536
+ "type": "i64"
537
+ },
538
+ {
539
+ "name": "bump_seed",
540
+ "type": "u8"
541
+ }
542
+ ]
543
+ }
544
+ },
545
+ {
546
+ "name": "ProxyConfigV0",
547
+ "type": {
548
+ "kind": "struct",
549
+ "fields": [
550
+ {
551
+ "name": "authority",
552
+ "type": "pubkey"
553
+ },
554
+ {
555
+ "name": "name",
556
+ "type": "string"
557
+ },
558
+ {
559
+ "name": "max_proxy_time",
560
+ "type": "i64"
561
+ },
562
+ {
563
+ "name": "seasons",
564
+ "type": {
565
+ "vec": {
566
+ "defined": {
567
+ "name": "SeasonV0"
568
+ }
569
+ }
570
+ }
571
+ }
572
+ ]
573
+ }
574
+ },
575
+ {
576
+ "name": "SeasonV0",
577
+ "type": {
578
+ "kind": "struct",
579
+ "fields": [
580
+ {
581
+ "name": "start",
582
+ "type": "i64"
583
+ },
584
+ {
585
+ "name": "end",
586
+ "type": "i64"
587
+ }
588
+ ]
589
+ }
590
+ },
591
+ {
592
+ "name": "UpdateProxyConfigArgsV0",
593
+ "type": {
594
+ "kind": "struct",
595
+ "fields": [
596
+ {
597
+ "name": "max_proxy_time",
598
+ "type": {
599
+ "option": "i64"
600
+ }
601
+ },
602
+ {
603
+ "name": "seasons",
604
+ "type": {
605
+ "option": {
606
+ "vec": {
607
+ "defined": {
608
+ "name": "SeasonV0"
609
+ }
610
+ }
611
+ }
612
+ }
613
+ }
614
+ ]
615
+ }
616
+ }
617
+ ]
618
+ }