@lightprotocol/compressed-token 0.2.0 → 0.3.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/dist/cjs/browser/index.cjs +950 -473
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +950 -473
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +956 -477
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +1128 -562
- package/package.json +27 -17
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var stateless_js = require('@lightprotocol/stateless.js');
|
|
4
|
-
var anchor = require('@coral-xyz/anchor');
|
|
5
4
|
var web3_js = require('@solana/web3.js');
|
|
5
|
+
var anchor = require('@coral-xyz/anchor');
|
|
6
6
|
|
|
7
7
|
const IDL = {
|
|
8
|
-
version: '0.
|
|
8
|
+
version: '0.4.0',
|
|
9
9
|
name: 'light_compressed_token',
|
|
10
|
-
constants: [
|
|
11
|
-
{
|
|
12
|
-
name: 'PROGRAM_ID',
|
|
13
|
-
type: 'string',
|
|
14
|
-
value: '"9sixVEthz2kMSKfeApZXHwuboT6DZuT6crAYJTciUCqE"',
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
10
|
instructions: [
|
|
18
11
|
{
|
|
19
12
|
name: 'createMint',
|
|
@@ -29,11 +22,6 @@ const IDL = {
|
|
|
29
22
|
isMut: true,
|
|
30
23
|
isSigner: true,
|
|
31
24
|
},
|
|
32
|
-
{
|
|
33
|
-
name: 'authority',
|
|
34
|
-
isMut: true,
|
|
35
|
-
isSigner: true,
|
|
36
|
-
},
|
|
37
25
|
{
|
|
38
26
|
name: 'tokenPoolPda',
|
|
39
27
|
isMut: true,
|
|
@@ -49,11 +37,6 @@ const IDL = {
|
|
|
49
37
|
isMut: true,
|
|
50
38
|
isSigner: false,
|
|
51
39
|
},
|
|
52
|
-
{
|
|
53
|
-
name: 'mintAuthorityPda',
|
|
54
|
-
isMut: true,
|
|
55
|
-
isSigner: false,
|
|
56
|
-
},
|
|
57
40
|
{
|
|
58
41
|
name: 'tokenProgram',
|
|
59
42
|
isMut: false,
|
|
@@ -69,6 +52,12 @@ const IDL = {
|
|
|
69
52
|
},
|
|
70
53
|
{
|
|
71
54
|
name: 'mintTo',
|
|
55
|
+
docs: [
|
|
56
|
+
'Mints tokens from an spl token mint to a list of compressed accounts.',
|
|
57
|
+
'Minted tokens are transferred to a pool account owned by the compressed',
|
|
58
|
+
'token program. The instruction creates one compressed output account for',
|
|
59
|
+
'every amount and pubkey input pair one output compressed account.',
|
|
60
|
+
],
|
|
72
61
|
accounts: [
|
|
73
62
|
{
|
|
74
63
|
name: 'feePayer',
|
|
@@ -77,12 +66,12 @@ const IDL = {
|
|
|
77
66
|
},
|
|
78
67
|
{
|
|
79
68
|
name: 'authority',
|
|
80
|
-
isMut:
|
|
69
|
+
isMut: false,
|
|
81
70
|
isSigner: true,
|
|
82
71
|
},
|
|
83
72
|
{
|
|
84
|
-
name: '
|
|
85
|
-
isMut:
|
|
73
|
+
name: 'cpiAuthorityPda',
|
|
74
|
+
isMut: false,
|
|
86
75
|
isSigner: false,
|
|
87
76
|
},
|
|
88
77
|
{
|
|
@@ -107,7 +96,7 @@ const IDL = {
|
|
|
107
96
|
},
|
|
108
97
|
{
|
|
109
98
|
name: 'registeredProgramPda',
|
|
110
|
-
isMut:
|
|
99
|
+
isMut: false,
|
|
111
100
|
isSigner: false,
|
|
112
101
|
},
|
|
113
102
|
{
|
|
@@ -117,7 +106,7 @@ const IDL = {
|
|
|
117
106
|
},
|
|
118
107
|
{
|
|
119
108
|
name: 'accountCompressionAuthority',
|
|
120
|
-
isMut:
|
|
109
|
+
isMut: false,
|
|
121
110
|
isSigner: false,
|
|
122
111
|
},
|
|
123
112
|
{
|
|
@@ -154,10 +143,6 @@ const IDL = {
|
|
|
154
143
|
vec: 'u64',
|
|
155
144
|
},
|
|
156
145
|
},
|
|
157
|
-
{
|
|
158
|
-
name: 'bump',
|
|
159
|
-
type: 'u8',
|
|
160
|
-
},
|
|
161
146
|
],
|
|
162
147
|
},
|
|
163
148
|
{
|
|
@@ -215,7 +200,7 @@ const IDL = {
|
|
|
215
200
|
isOptional: true,
|
|
216
201
|
},
|
|
217
202
|
{
|
|
218
|
-
name: '
|
|
203
|
+
name: 'compressOrDecompressTokenAccount',
|
|
219
204
|
isMut: true,
|
|
220
205
|
isSigner: false,
|
|
221
206
|
isOptional: true,
|
|
@@ -239,10 +224,567 @@ const IDL = {
|
|
|
239
224
|
},
|
|
240
225
|
],
|
|
241
226
|
},
|
|
242
|
-
],
|
|
243
|
-
types: [
|
|
244
227
|
{
|
|
245
|
-
name: '
|
|
228
|
+
name: 'approve',
|
|
229
|
+
accounts: [
|
|
230
|
+
{
|
|
231
|
+
name: 'feePayer',
|
|
232
|
+
isMut: true,
|
|
233
|
+
isSigner: true,
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'authority',
|
|
237
|
+
isMut: false,
|
|
238
|
+
isSigner: true,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: 'cpiAuthorityPda',
|
|
242
|
+
isMut: false,
|
|
243
|
+
isSigner: false,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'lightSystemProgram',
|
|
247
|
+
isMut: false,
|
|
248
|
+
isSigner: false,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'registeredProgramPda',
|
|
252
|
+
isMut: false,
|
|
253
|
+
isSigner: false,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'noopProgram',
|
|
257
|
+
isMut: false,
|
|
258
|
+
isSigner: false,
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'accountCompressionAuthority',
|
|
262
|
+
isMut: false,
|
|
263
|
+
isSigner: false,
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: 'accountCompressionProgram',
|
|
267
|
+
isMut: false,
|
|
268
|
+
isSigner: false,
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: 'selfProgram',
|
|
272
|
+
isMut: false,
|
|
273
|
+
isSigner: false,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'systemProgram',
|
|
277
|
+
isMut: false,
|
|
278
|
+
isSigner: false,
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
args: [
|
|
282
|
+
{
|
|
283
|
+
name: 'inputs',
|
|
284
|
+
type: 'bytes',
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'revoke',
|
|
290
|
+
accounts: [
|
|
291
|
+
{
|
|
292
|
+
name: 'feePayer',
|
|
293
|
+
isMut: true,
|
|
294
|
+
isSigner: true,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: 'authority',
|
|
298
|
+
isMut: false,
|
|
299
|
+
isSigner: true,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: 'cpiAuthorityPda',
|
|
303
|
+
isMut: false,
|
|
304
|
+
isSigner: false,
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'lightSystemProgram',
|
|
308
|
+
isMut: false,
|
|
309
|
+
isSigner: false,
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: 'registeredProgramPda',
|
|
313
|
+
isMut: false,
|
|
314
|
+
isSigner: false,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: 'noopProgram',
|
|
318
|
+
isMut: false,
|
|
319
|
+
isSigner: false,
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'accountCompressionAuthority',
|
|
323
|
+
isMut: false,
|
|
324
|
+
isSigner: false,
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'accountCompressionProgram',
|
|
328
|
+
isMut: false,
|
|
329
|
+
isSigner: false,
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'selfProgram',
|
|
333
|
+
isMut: false,
|
|
334
|
+
isSigner: false,
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: 'systemProgram',
|
|
338
|
+
isMut: false,
|
|
339
|
+
isSigner: false,
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
args: [
|
|
343
|
+
{
|
|
344
|
+
name: 'inputs',
|
|
345
|
+
type: 'bytes',
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: 'freeze',
|
|
351
|
+
accounts: [
|
|
352
|
+
{
|
|
353
|
+
name: 'feePayer',
|
|
354
|
+
isMut: true,
|
|
355
|
+
isSigner: true,
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
name: 'authority',
|
|
359
|
+
isMut: false,
|
|
360
|
+
isSigner: true,
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: 'cpiAuthorityPda',
|
|
364
|
+
isMut: false,
|
|
365
|
+
isSigner: false,
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: 'lightSystemProgram',
|
|
369
|
+
isMut: false,
|
|
370
|
+
isSigner: false,
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: 'registeredProgramPda',
|
|
374
|
+
isMut: false,
|
|
375
|
+
isSigner: false,
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: 'noopProgram',
|
|
379
|
+
isMut: false,
|
|
380
|
+
isSigner: false,
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: 'accountCompressionAuthority',
|
|
384
|
+
isMut: false,
|
|
385
|
+
isSigner: false,
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: 'accountCompressionProgram',
|
|
389
|
+
isMut: false,
|
|
390
|
+
isSigner: false,
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
name: 'selfProgram',
|
|
394
|
+
isMut: false,
|
|
395
|
+
isSigner: false,
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: 'systemProgram',
|
|
399
|
+
isMut: false,
|
|
400
|
+
isSigner: false,
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: 'mint',
|
|
404
|
+
isMut: false,
|
|
405
|
+
isSigner: false,
|
|
406
|
+
},
|
|
407
|
+
],
|
|
408
|
+
args: [
|
|
409
|
+
{
|
|
410
|
+
name: 'inputs',
|
|
411
|
+
type: 'bytes',
|
|
412
|
+
},
|
|
413
|
+
],
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: 'thaw',
|
|
417
|
+
accounts: [
|
|
418
|
+
{
|
|
419
|
+
name: 'feePayer',
|
|
420
|
+
isMut: true,
|
|
421
|
+
isSigner: true,
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: 'authority',
|
|
425
|
+
isMut: false,
|
|
426
|
+
isSigner: true,
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
name: 'cpiAuthorityPda',
|
|
430
|
+
isMut: false,
|
|
431
|
+
isSigner: false,
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: 'lightSystemProgram',
|
|
435
|
+
isMut: false,
|
|
436
|
+
isSigner: false,
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: 'registeredProgramPda',
|
|
440
|
+
isMut: false,
|
|
441
|
+
isSigner: false,
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: 'noopProgram',
|
|
445
|
+
isMut: false,
|
|
446
|
+
isSigner: false,
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: 'accountCompressionAuthority',
|
|
450
|
+
isMut: false,
|
|
451
|
+
isSigner: false,
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
name: 'accountCompressionProgram',
|
|
455
|
+
isMut: false,
|
|
456
|
+
isSigner: false,
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: 'selfProgram',
|
|
460
|
+
isMut: false,
|
|
461
|
+
isSigner: false,
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: 'systemProgram',
|
|
465
|
+
isMut: false,
|
|
466
|
+
isSigner: false,
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: 'mint',
|
|
470
|
+
isMut: false,
|
|
471
|
+
isSigner: false,
|
|
472
|
+
},
|
|
473
|
+
],
|
|
474
|
+
args: [
|
|
475
|
+
{
|
|
476
|
+
name: 'inputs',
|
|
477
|
+
type: 'bytes',
|
|
478
|
+
},
|
|
479
|
+
],
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: 'burn',
|
|
483
|
+
accounts: [
|
|
484
|
+
{
|
|
485
|
+
name: 'feePayer',
|
|
486
|
+
isMut: true,
|
|
487
|
+
isSigner: true,
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
name: 'authority',
|
|
491
|
+
isMut: false,
|
|
492
|
+
isSigner: true,
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: 'cpiAuthorityPda',
|
|
496
|
+
isMut: false,
|
|
497
|
+
isSigner: false,
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: 'lightSystemProgram',
|
|
501
|
+
isMut: false,
|
|
502
|
+
isSigner: false,
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: 'registeredProgramPda',
|
|
506
|
+
isMut: false,
|
|
507
|
+
isSigner: false,
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: 'noopProgram',
|
|
511
|
+
isMut: false,
|
|
512
|
+
isSigner: false,
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: 'accountCompressionAuthority',
|
|
516
|
+
isMut: false,
|
|
517
|
+
isSigner: false,
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: 'accountCompressionProgram',
|
|
521
|
+
isMut: false,
|
|
522
|
+
isSigner: false,
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: 'selfProgram',
|
|
526
|
+
isMut: false,
|
|
527
|
+
isSigner: false,
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: 'systemProgram',
|
|
531
|
+
isMut: false,
|
|
532
|
+
isSigner: false,
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
args: [
|
|
536
|
+
{
|
|
537
|
+
name: 'inputs',
|
|
538
|
+
type: 'bytes',
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: 'stubIdlBuild',
|
|
544
|
+
docs: [
|
|
545
|
+
'This function is a stub to allow Anchor to include the input types in',
|
|
546
|
+
'the IDL. It should not be included in production builds nor be called in',
|
|
547
|
+
'practice.',
|
|
548
|
+
],
|
|
549
|
+
accounts: [
|
|
550
|
+
{
|
|
551
|
+
name: 'feePayer',
|
|
552
|
+
isMut: true,
|
|
553
|
+
isSigner: true,
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: 'authority',
|
|
557
|
+
isMut: false,
|
|
558
|
+
isSigner: true,
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: 'cpiAuthorityPda',
|
|
562
|
+
isMut: false,
|
|
563
|
+
isSigner: false,
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: 'lightSystemProgram',
|
|
567
|
+
isMut: false,
|
|
568
|
+
isSigner: false,
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: 'registeredProgramPda',
|
|
572
|
+
isMut: false,
|
|
573
|
+
isSigner: false,
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'noopProgram',
|
|
577
|
+
isMut: false,
|
|
578
|
+
isSigner: false,
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: 'accountCompressionAuthority',
|
|
582
|
+
isMut: false,
|
|
583
|
+
isSigner: false,
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: 'accountCompressionProgram',
|
|
587
|
+
isMut: false,
|
|
588
|
+
isSigner: false,
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
name: 'selfProgram',
|
|
592
|
+
isMut: false,
|
|
593
|
+
isSigner: false,
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: 'tokenPoolPda',
|
|
597
|
+
isMut: true,
|
|
598
|
+
isSigner: false,
|
|
599
|
+
isOptional: true,
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
name: 'compressOrDecompressTokenAccount',
|
|
603
|
+
isMut: true,
|
|
604
|
+
isSigner: false,
|
|
605
|
+
isOptional: true,
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
name: 'tokenProgram',
|
|
609
|
+
isMut: false,
|
|
610
|
+
isSigner: false,
|
|
611
|
+
isOptional: true,
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
name: 'systemProgram',
|
|
615
|
+
isMut: false,
|
|
616
|
+
isSigner: false,
|
|
617
|
+
},
|
|
618
|
+
],
|
|
619
|
+
args: [
|
|
620
|
+
{
|
|
621
|
+
name: 'inputs1',
|
|
622
|
+
type: {
|
|
623
|
+
defined: 'CompressedTokenInstructionDataTransfer',
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
name: 'inputs2',
|
|
628
|
+
type: {
|
|
629
|
+
defined: 'TokenData',
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
],
|
|
633
|
+
},
|
|
634
|
+
],
|
|
635
|
+
accounts: [
|
|
636
|
+
{
|
|
637
|
+
name: 'RegisteredProgram',
|
|
638
|
+
type: {
|
|
639
|
+
kind: 'struct',
|
|
640
|
+
fields: [
|
|
641
|
+
{
|
|
642
|
+
name: 'registeredProgramId',
|
|
643
|
+
type: 'publicKey',
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: 'groupAuthorityPda',
|
|
647
|
+
type: 'publicKey',
|
|
648
|
+
},
|
|
649
|
+
],
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
],
|
|
653
|
+
types: [
|
|
654
|
+
{
|
|
655
|
+
name: 'AccessMetadata',
|
|
656
|
+
type: {
|
|
657
|
+
kind: 'struct',
|
|
658
|
+
fields: [
|
|
659
|
+
{
|
|
660
|
+
name: 'owner',
|
|
661
|
+
docs: ['Owner of the Merkle tree.'],
|
|
662
|
+
type: 'publicKey',
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
name: 'programOwner',
|
|
666
|
+
docs: [
|
|
667
|
+
'Delegate of the Merkle tree. This will be used for program owned Merkle trees.',
|
|
668
|
+
],
|
|
669
|
+
type: 'publicKey',
|
|
670
|
+
},
|
|
671
|
+
],
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: 'AccountState',
|
|
676
|
+
type: {
|
|
677
|
+
kind: 'enum',
|
|
678
|
+
variants: [
|
|
679
|
+
{
|
|
680
|
+
name: 'Initialized',
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
name: 'Frozen',
|
|
684
|
+
},
|
|
685
|
+
],
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
name: 'CompressedAccount',
|
|
690
|
+
type: {
|
|
691
|
+
kind: 'struct',
|
|
692
|
+
fields: [
|
|
693
|
+
{
|
|
694
|
+
name: 'owner',
|
|
695
|
+
type: 'publicKey',
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: 'lamports',
|
|
699
|
+
type: 'u64',
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
name: 'address',
|
|
703
|
+
type: {
|
|
704
|
+
option: {
|
|
705
|
+
array: ['u8', 32],
|
|
706
|
+
},
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: 'data',
|
|
711
|
+
type: {
|
|
712
|
+
option: {
|
|
713
|
+
defined: 'CompressedAccountData',
|
|
714
|
+
},
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
],
|
|
718
|
+
},
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
name: 'CompressedAccountData',
|
|
722
|
+
type: {
|
|
723
|
+
kind: 'struct',
|
|
724
|
+
fields: [
|
|
725
|
+
{
|
|
726
|
+
name: 'discriminator',
|
|
727
|
+
type: {
|
|
728
|
+
array: ['u8', 8],
|
|
729
|
+
},
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
name: 'data',
|
|
733
|
+
type: 'bytes',
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
name: 'dataHash',
|
|
737
|
+
type: {
|
|
738
|
+
array: ['u8', 32],
|
|
739
|
+
},
|
|
740
|
+
},
|
|
741
|
+
],
|
|
742
|
+
},
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: 'CompressedCpiContext',
|
|
746
|
+
type: {
|
|
747
|
+
kind: 'struct',
|
|
748
|
+
fields: [
|
|
749
|
+
{
|
|
750
|
+
name: 'setContext',
|
|
751
|
+
type: 'bool',
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: 'cpiContextAccountIndex',
|
|
755
|
+
type: 'u8',
|
|
756
|
+
},
|
|
757
|
+
],
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
name: 'CompressedProof',
|
|
762
|
+
type: {
|
|
763
|
+
kind: 'struct',
|
|
764
|
+
fields: [
|
|
765
|
+
{
|
|
766
|
+
name: 'a',
|
|
767
|
+
type: {
|
|
768
|
+
array: ['u8', 32],
|
|
769
|
+
},
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
name: 'b',
|
|
773
|
+
type: {
|
|
774
|
+
array: ['u8', 64],
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
name: 'c',
|
|
779
|
+
type: {
|
|
780
|
+
array: ['u8', 32],
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
],
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
name: 'CompressedTokenInstructionDataTransfer',
|
|
246
788
|
type: {
|
|
247
789
|
kind: 'struct',
|
|
248
790
|
fields: [
|
|
@@ -255,16 +797,27 @@ const IDL = {
|
|
|
255
797
|
},
|
|
256
798
|
},
|
|
257
799
|
{
|
|
258
|
-
name: '
|
|
800
|
+
name: 'mint',
|
|
801
|
+
type: 'publicKey',
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: 'delegatedTransfer',
|
|
805
|
+
docs: [
|
|
806
|
+
'If the signer is a delegate, the delegate index is index 0 of remaining accounts.',
|
|
807
|
+
'owner = Some(owner) is the owner of the token account.',
|
|
808
|
+
'Is set if the signer is delegate',
|
|
809
|
+
],
|
|
259
810
|
type: {
|
|
260
|
-
|
|
811
|
+
option: {
|
|
812
|
+
defined: 'DelegatedTransfer',
|
|
813
|
+
},
|
|
261
814
|
},
|
|
262
815
|
},
|
|
263
816
|
{
|
|
264
|
-
name: '
|
|
817
|
+
name: 'inputTokenDataWithContext',
|
|
265
818
|
type: {
|
|
266
819
|
vec: {
|
|
267
|
-
defined: '
|
|
820
|
+
defined: 'InputTokenDataWithContext',
|
|
268
821
|
},
|
|
269
822
|
},
|
|
270
823
|
},
|
|
@@ -272,119 +825,134 @@ const IDL = {
|
|
|
272
825
|
name: 'outputCompressedAccounts',
|
|
273
826
|
type: {
|
|
274
827
|
vec: {
|
|
275
|
-
defined: '
|
|
828
|
+
defined: 'PackedTokenTransferOutputData',
|
|
276
829
|
},
|
|
277
830
|
},
|
|
278
831
|
},
|
|
279
832
|
{
|
|
280
|
-
name: '
|
|
281
|
-
|
|
282
|
-
'The indices of the accounts in the output state merkle tree.',
|
|
283
|
-
],
|
|
284
|
-
type: 'bytes',
|
|
833
|
+
name: 'isCompress',
|
|
834
|
+
type: 'bool',
|
|
285
835
|
},
|
|
286
836
|
{
|
|
287
|
-
name: '
|
|
837
|
+
name: 'compressOrDecompressAmount',
|
|
288
838
|
type: {
|
|
289
839
|
option: 'u64',
|
|
290
840
|
},
|
|
291
841
|
},
|
|
292
842
|
{
|
|
293
|
-
name: '
|
|
843
|
+
name: 'cpiContext',
|
|
294
844
|
type: {
|
|
295
|
-
|
|
296
|
-
defined: '
|
|
845
|
+
option: {
|
|
846
|
+
defined: 'CompressedCpiContext',
|
|
297
847
|
},
|
|
298
848
|
},
|
|
299
849
|
},
|
|
300
|
-
{
|
|
301
|
-
name: 'compressionLamports',
|
|
302
|
-
type: {
|
|
303
|
-
option: 'u64',
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
name: 'isCompress',
|
|
308
|
-
type: 'bool',
|
|
309
|
-
},
|
|
310
850
|
],
|
|
311
851
|
},
|
|
312
852
|
},
|
|
313
853
|
{
|
|
314
|
-
name: '
|
|
854
|
+
name: 'DelegatedTransfer',
|
|
315
855
|
type: {
|
|
316
856
|
kind: 'struct',
|
|
317
857
|
fields: [
|
|
318
858
|
{
|
|
319
|
-
name: '
|
|
320
|
-
type:
|
|
321
|
-
array: ['u8', 32],
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
name: 'addressQueueAccountIndex',
|
|
326
|
-
type: 'u8',
|
|
859
|
+
name: 'owner',
|
|
860
|
+
type: 'publicKey',
|
|
327
861
|
},
|
|
328
862
|
{
|
|
329
|
-
name: '
|
|
863
|
+
name: 'delegateChangeAccountIndex',
|
|
330
864
|
type: 'u8',
|
|
331
865
|
},
|
|
332
|
-
{
|
|
333
|
-
name: 'addressMerkleTreeRootIndex',
|
|
334
|
-
type: 'u16',
|
|
335
|
-
},
|
|
336
866
|
],
|
|
337
867
|
},
|
|
338
868
|
},
|
|
339
869
|
{
|
|
340
|
-
name: '
|
|
870
|
+
name: 'InputTokenDataWithContext',
|
|
341
871
|
type: {
|
|
342
872
|
kind: 'struct',
|
|
343
873
|
fields: [
|
|
344
874
|
{
|
|
345
|
-
name: '
|
|
875
|
+
name: 'amount',
|
|
876
|
+
type: 'u64',
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
name: 'delegateIndex',
|
|
346
880
|
type: {
|
|
347
|
-
|
|
881
|
+
option: 'u8',
|
|
348
882
|
},
|
|
349
883
|
},
|
|
350
884
|
{
|
|
351
|
-
name: '
|
|
352
|
-
type:
|
|
885
|
+
name: 'isNative',
|
|
886
|
+
type: {
|
|
887
|
+
option: 'u64',
|
|
888
|
+
},
|
|
353
889
|
},
|
|
354
890
|
{
|
|
355
|
-
name: '
|
|
356
|
-
type:
|
|
891
|
+
name: 'merkleContext',
|
|
892
|
+
type: {
|
|
893
|
+
defined: 'PackedMerkleContext',
|
|
894
|
+
},
|
|
357
895
|
},
|
|
358
896
|
{
|
|
359
|
-
name: '
|
|
897
|
+
name: 'rootIndex',
|
|
360
898
|
type: 'u16',
|
|
361
899
|
},
|
|
362
900
|
],
|
|
363
901
|
},
|
|
364
902
|
},
|
|
365
903
|
{
|
|
366
|
-
name: '
|
|
904
|
+
name: 'InstructionDataInvoke',
|
|
367
905
|
type: {
|
|
368
906
|
kind: 'struct',
|
|
369
907
|
fields: [
|
|
370
908
|
{
|
|
371
|
-
name: '
|
|
909
|
+
name: 'proof',
|
|
372
910
|
type: {
|
|
373
|
-
|
|
911
|
+
option: {
|
|
912
|
+
defined: 'CompressedProof',
|
|
913
|
+
},
|
|
374
914
|
},
|
|
375
915
|
},
|
|
376
916
|
{
|
|
377
|
-
name: '
|
|
917
|
+
name: 'inputCompressedAccountsWithMerkleContext',
|
|
378
918
|
type: {
|
|
379
|
-
|
|
919
|
+
vec: {
|
|
920
|
+
defined: 'PackedCompressedAccountWithMerkleContext',
|
|
921
|
+
},
|
|
380
922
|
},
|
|
381
923
|
},
|
|
382
924
|
{
|
|
383
|
-
name: '
|
|
925
|
+
name: 'outputCompressedAccounts',
|
|
384
926
|
type: {
|
|
385
|
-
|
|
927
|
+
vec: {
|
|
928
|
+
defined: 'OutputCompressedAccountWithPackedContext',
|
|
929
|
+
},
|
|
930
|
+
},
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
name: 'relayFee',
|
|
934
|
+
type: {
|
|
935
|
+
option: 'u64',
|
|
936
|
+
},
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
name: 'newAddressParams',
|
|
940
|
+
type: {
|
|
941
|
+
vec: {
|
|
942
|
+
defined: 'NewAddressParamsPacked',
|
|
943
|
+
},
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
name: 'compressOrDecompressLamports',
|
|
948
|
+
type: {
|
|
949
|
+
option: 'u64',
|
|
386
950
|
},
|
|
387
951
|
},
|
|
952
|
+
{
|
|
953
|
+
name: 'isCompress',
|
|
954
|
+
type: 'bool',
|
|
955
|
+
},
|
|
388
956
|
],
|
|
389
957
|
},
|
|
390
958
|
},
|
|
@@ -409,12 +977,6 @@ const IDL = {
|
|
|
409
977
|
},
|
|
410
978
|
},
|
|
411
979
|
},
|
|
412
|
-
{
|
|
413
|
-
name: 'inputRootIndices',
|
|
414
|
-
type: {
|
|
415
|
-
vec: 'u16',
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
980
|
{
|
|
419
981
|
name: 'inputCompressedAccountsWithMerkleContext',
|
|
420
982
|
type: {
|
|
@@ -427,17 +989,10 @@ const IDL = {
|
|
|
427
989
|
name: 'outputCompressedAccounts',
|
|
428
990
|
type: {
|
|
429
991
|
vec: {
|
|
430
|
-
defined: '
|
|
992
|
+
defined: 'OutputCompressedAccountWithPackedContext',
|
|
431
993
|
},
|
|
432
994
|
},
|
|
433
995
|
},
|
|
434
|
-
{
|
|
435
|
-
name: 'outputStateMerkleTreeAccountIndices',
|
|
436
|
-
docs: [
|
|
437
|
-
'The indices of the accounts in the output state merkle tree.',
|
|
438
|
-
],
|
|
439
|
-
type: 'bytes',
|
|
440
|
-
},
|
|
441
996
|
{
|
|
442
997
|
name: 'relayFee',
|
|
443
998
|
type: {
|
|
@@ -445,7 +1000,7 @@ const IDL = {
|
|
|
445
1000
|
},
|
|
446
1001
|
},
|
|
447
1002
|
{
|
|
448
|
-
name: '
|
|
1003
|
+
name: 'compressOrDecompressLamports',
|
|
449
1004
|
type: {
|
|
450
1005
|
option: 'u64',
|
|
451
1006
|
},
|
|
@@ -472,349 +1027,285 @@ const IDL = {
|
|
|
472
1027
|
},
|
|
473
1028
|
},
|
|
474
1029
|
{
|
|
475
|
-
name: '
|
|
476
|
-
type: {
|
|
477
|
-
kind: 'struct',
|
|
478
|
-
fields: [
|
|
479
|
-
{
|
|
480
|
-
name: 'compressedAccount',
|
|
481
|
-
type: {
|
|
482
|
-
defined: 'CompressedAccount',
|
|
483
|
-
},
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
name: 'merkleContext',
|
|
487
|
-
type: {
|
|
488
|
-
defined: 'PackedMerkleContext',
|
|
489
|
-
},
|
|
490
|
-
},
|
|
491
|
-
],
|
|
492
|
-
},
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
name: 'CompressedAccountWithMerkleContext',
|
|
1030
|
+
name: 'MerkleTreeMetadata',
|
|
496
1031
|
type: {
|
|
497
1032
|
kind: 'struct',
|
|
498
1033
|
fields: [
|
|
499
1034
|
{
|
|
500
|
-
name: '
|
|
1035
|
+
name: 'accessMetadata',
|
|
501
1036
|
type: {
|
|
502
|
-
defined: '
|
|
1037
|
+
defined: 'AccessMetadata',
|
|
503
1038
|
},
|
|
504
1039
|
},
|
|
505
1040
|
{
|
|
506
|
-
name: '
|
|
1041
|
+
name: 'rolloverMetadata',
|
|
507
1042
|
type: {
|
|
508
|
-
defined: '
|
|
1043
|
+
defined: 'RolloverMetadata',
|
|
509
1044
|
},
|
|
510
1045
|
},
|
|
511
|
-
],
|
|
512
|
-
},
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
name: 'MerkleContext',
|
|
516
|
-
type: {
|
|
517
|
-
kind: 'struct',
|
|
518
|
-
fields: [
|
|
519
1046
|
{
|
|
520
|
-
name: '
|
|
1047
|
+
name: 'associatedQueue',
|
|
521
1048
|
type: 'publicKey',
|
|
522
1049
|
},
|
|
523
1050
|
{
|
|
524
|
-
name: '
|
|
1051
|
+
name: 'nextMerkleTree',
|
|
525
1052
|
type: 'publicKey',
|
|
526
1053
|
},
|
|
527
|
-
{
|
|
528
|
-
name: 'leafIndex',
|
|
529
|
-
type: 'u32',
|
|
530
|
-
},
|
|
531
|
-
],
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
name: 'PackedMerkleContext',
|
|
536
|
-
type: {
|
|
537
|
-
kind: 'struct',
|
|
538
|
-
fields: [
|
|
539
|
-
{
|
|
540
|
-
name: 'merkleTreePubkeyIndex',
|
|
541
|
-
type: 'u8',
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
name: 'nullifierQueuePubkeyIndex',
|
|
545
|
-
type: 'u8',
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
name: 'leafIndex',
|
|
549
|
-
type: 'u32',
|
|
550
|
-
},
|
|
551
1054
|
],
|
|
552
1055
|
},
|
|
553
1056
|
},
|
|
554
1057
|
{
|
|
555
|
-
name: '
|
|
1058
|
+
name: 'MerkleTreeSequenceNumber',
|
|
556
1059
|
type: {
|
|
557
1060
|
kind: 'struct',
|
|
558
1061
|
fields: [
|
|
559
1062
|
{
|
|
560
|
-
name: '
|
|
1063
|
+
name: 'pubkey',
|
|
561
1064
|
type: 'publicKey',
|
|
562
1065
|
},
|
|
563
1066
|
{
|
|
564
|
-
name: '
|
|
1067
|
+
name: 'seq',
|
|
565
1068
|
type: 'u64',
|
|
566
1069
|
},
|
|
567
|
-
{
|
|
568
|
-
name: 'address',
|
|
569
|
-
type: {
|
|
570
|
-
option: {
|
|
571
|
-
array: ['u8', 32],
|
|
572
|
-
},
|
|
573
|
-
},
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
name: 'data',
|
|
577
|
-
type: {
|
|
578
|
-
option: {
|
|
579
|
-
defined: 'CompressedAccountData',
|
|
580
|
-
},
|
|
581
|
-
},
|
|
582
|
-
},
|
|
583
1070
|
],
|
|
584
1071
|
},
|
|
585
1072
|
},
|
|
586
1073
|
{
|
|
587
|
-
name: '
|
|
1074
|
+
name: 'NewAddressParamsPacked',
|
|
588
1075
|
type: {
|
|
589
1076
|
kind: 'struct',
|
|
590
1077
|
fields: [
|
|
591
1078
|
{
|
|
592
|
-
name: '
|
|
1079
|
+
name: 'seed',
|
|
593
1080
|
type: {
|
|
594
|
-
array: ['u8',
|
|
1081
|
+
array: ['u8', 32],
|
|
595
1082
|
},
|
|
596
1083
|
},
|
|
597
1084
|
{
|
|
598
|
-
name: '
|
|
599
|
-
type: '
|
|
1085
|
+
name: 'addressQueueAccountIndex',
|
|
1086
|
+
type: 'u8',
|
|
600
1087
|
},
|
|
601
1088
|
{
|
|
602
|
-
name: '
|
|
603
|
-
type:
|
|
604
|
-
|
|
605
|
-
|
|
1089
|
+
name: 'addressMerkleTreeAccountIndex',
|
|
1090
|
+
type: 'u8',
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
name: 'addressMerkleTreeRootIndex',
|
|
1094
|
+
type: 'u16',
|
|
606
1095
|
},
|
|
607
1096
|
],
|
|
608
1097
|
},
|
|
609
1098
|
},
|
|
610
1099
|
{
|
|
611
|
-
name: '
|
|
1100
|
+
name: 'OutputCompressedAccountWithPackedContext',
|
|
612
1101
|
type: {
|
|
613
1102
|
kind: 'struct',
|
|
614
1103
|
fields: [
|
|
615
1104
|
{
|
|
616
|
-
name: '
|
|
617
|
-
type: {
|
|
618
|
-
vec: {
|
|
619
|
-
array: ['u8', 32],
|
|
620
|
-
},
|
|
621
|
-
},
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
name: 'outputCompressedAccountHashes',
|
|
625
|
-
type: {
|
|
626
|
-
vec: {
|
|
627
|
-
array: ['u8', 32],
|
|
628
|
-
},
|
|
629
|
-
},
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
name: 'outputCompressedAccounts',
|
|
633
|
-
type: {
|
|
634
|
-
vec: {
|
|
635
|
-
defined: 'CompressedAccount',
|
|
636
|
-
},
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
name: 'outputStateMerkleTreeAccountIndices',
|
|
641
|
-
type: 'bytes',
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
name: 'outputLeafIndices',
|
|
645
|
-
type: {
|
|
646
|
-
vec: 'u32',
|
|
647
|
-
},
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
name: 'relayFee',
|
|
1105
|
+
name: 'compressedAccount',
|
|
651
1106
|
type: {
|
|
652
|
-
|
|
1107
|
+
defined: 'CompressedAccount',
|
|
653
1108
|
},
|
|
654
1109
|
},
|
|
655
1110
|
{
|
|
656
|
-
name: '
|
|
657
|
-
type: '
|
|
1111
|
+
name: 'merkleTreeIndex',
|
|
1112
|
+
type: 'u8',
|
|
658
1113
|
},
|
|
1114
|
+
],
|
|
1115
|
+
},
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
name: 'PackedCompressedAccountWithMerkleContext',
|
|
1119
|
+
type: {
|
|
1120
|
+
kind: 'struct',
|
|
1121
|
+
fields: [
|
|
659
1122
|
{
|
|
660
|
-
name: '
|
|
1123
|
+
name: 'compressedAccount',
|
|
661
1124
|
type: {
|
|
662
|
-
|
|
1125
|
+
defined: 'CompressedAccount',
|
|
663
1126
|
},
|
|
664
1127
|
},
|
|
665
1128
|
{
|
|
666
|
-
name: '
|
|
1129
|
+
name: 'merkleContext',
|
|
667
1130
|
type: {
|
|
668
|
-
|
|
1131
|
+
defined: 'PackedMerkleContext',
|
|
669
1132
|
},
|
|
670
1133
|
},
|
|
671
1134
|
{
|
|
672
|
-
name: '
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
1135
|
+
name: 'rootIndex',
|
|
1136
|
+
docs: [
|
|
1137
|
+
'Index of root used in inclusion validity proof.',
|
|
1138
|
+
],
|
|
1139
|
+
type: 'u16',
|
|
676
1140
|
},
|
|
677
1141
|
],
|
|
678
1142
|
},
|
|
679
1143
|
},
|
|
680
1144
|
{
|
|
681
|
-
name: '
|
|
1145
|
+
name: 'PackedMerkleContext',
|
|
682
1146
|
type: {
|
|
683
1147
|
kind: 'struct',
|
|
684
1148
|
fields: [
|
|
685
1149
|
{
|
|
686
|
-
name: '
|
|
687
|
-
type: '
|
|
1150
|
+
name: 'merkleTreePubkeyIndex',
|
|
1151
|
+
type: 'u8',
|
|
688
1152
|
},
|
|
689
1153
|
{
|
|
690
|
-
name: '
|
|
1154
|
+
name: 'nullifierQueuePubkeyIndex',
|
|
691
1155
|
type: 'u8',
|
|
692
1156
|
},
|
|
1157
|
+
{
|
|
1158
|
+
name: 'leafIndex',
|
|
1159
|
+
type: 'u32',
|
|
1160
|
+
},
|
|
693
1161
|
],
|
|
694
1162
|
},
|
|
695
1163
|
},
|
|
696
1164
|
{
|
|
697
|
-
name: '
|
|
1165
|
+
name: 'PackedTokenTransferOutputData',
|
|
698
1166
|
type: {
|
|
699
1167
|
kind: 'struct',
|
|
700
1168
|
fields: [
|
|
701
1169
|
{
|
|
702
|
-
name: '
|
|
703
|
-
type: '
|
|
704
|
-
},
|
|
705
|
-
{
|
|
706
|
-
name: 'delegateIndex',
|
|
707
|
-
type: {
|
|
708
|
-
option: 'u8',
|
|
709
|
-
},
|
|
1170
|
+
name: 'owner',
|
|
1171
|
+
type: 'publicKey',
|
|
710
1172
|
},
|
|
711
1173
|
{
|
|
712
|
-
name: '
|
|
713
|
-
type:
|
|
714
|
-
option: 'u64',
|
|
715
|
-
},
|
|
1174
|
+
name: 'amount',
|
|
1175
|
+
type: 'u64',
|
|
716
1176
|
},
|
|
717
1177
|
{
|
|
718
|
-
name: '
|
|
1178
|
+
name: 'lamports',
|
|
719
1179
|
type: {
|
|
720
1180
|
option: 'u64',
|
|
721
1181
|
},
|
|
722
1182
|
},
|
|
723
1183
|
{
|
|
724
|
-
name: '
|
|
725
|
-
type:
|
|
726
|
-
defined: 'PackedMerkleContext',
|
|
727
|
-
},
|
|
1184
|
+
name: 'merkleTreeIndex',
|
|
1185
|
+
type: 'u8',
|
|
728
1186
|
},
|
|
729
1187
|
],
|
|
730
1188
|
},
|
|
731
1189
|
},
|
|
732
1190
|
{
|
|
733
|
-
name: '
|
|
1191
|
+
name: 'PublicTransactionEvent',
|
|
734
1192
|
type: {
|
|
735
1193
|
kind: 'struct',
|
|
736
1194
|
fields: [
|
|
737
1195
|
{
|
|
738
|
-
name: '
|
|
1196
|
+
name: 'inputCompressedAccountHashes',
|
|
739
1197
|
type: {
|
|
740
|
-
|
|
741
|
-
|
|
1198
|
+
vec: {
|
|
1199
|
+
array: ['u8', 32],
|
|
742
1200
|
},
|
|
743
1201
|
},
|
|
744
1202
|
},
|
|
745
1203
|
{
|
|
746
|
-
name: '
|
|
1204
|
+
name: 'outputCompressedAccountHashes',
|
|
747
1205
|
type: {
|
|
748
|
-
vec:
|
|
1206
|
+
vec: {
|
|
1207
|
+
array: ['u8', 32],
|
|
1208
|
+
},
|
|
749
1209
|
},
|
|
750
1210
|
},
|
|
751
1211
|
{
|
|
752
|
-
name: '
|
|
753
|
-
type: 'publicKey',
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
name: 'signerIsDelegate',
|
|
757
|
-
type: 'bool',
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
name: 'inputTokenDataWithContext',
|
|
1212
|
+
name: 'outputCompressedAccounts',
|
|
761
1213
|
type: {
|
|
762
1214
|
vec: {
|
|
763
|
-
defined: '
|
|
1215
|
+
defined: 'OutputCompressedAccountWithPackedContext',
|
|
764
1216
|
},
|
|
765
1217
|
},
|
|
766
1218
|
},
|
|
767
1219
|
{
|
|
768
|
-
name: '
|
|
1220
|
+
name: 'outputLeafIndices',
|
|
1221
|
+
type: {
|
|
1222
|
+
vec: 'u32',
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
name: 'sequenceNumbers',
|
|
769
1227
|
type: {
|
|
770
1228
|
vec: {
|
|
771
|
-
defined: '
|
|
1229
|
+
defined: 'MerkleTreeSequenceNumber',
|
|
772
1230
|
},
|
|
773
1231
|
},
|
|
774
1232
|
},
|
|
775
1233
|
{
|
|
776
|
-
name: '
|
|
777
|
-
type:
|
|
1234
|
+
name: 'relayFee',
|
|
1235
|
+
type: {
|
|
1236
|
+
option: 'u64',
|
|
1237
|
+
},
|
|
778
1238
|
},
|
|
779
1239
|
{
|
|
780
1240
|
name: 'isCompress',
|
|
781
1241
|
type: 'bool',
|
|
782
1242
|
},
|
|
783
1243
|
{
|
|
784
|
-
name: '
|
|
1244
|
+
name: 'compressOrDecompressLamports',
|
|
785
1245
|
type: {
|
|
786
1246
|
option: 'u64',
|
|
787
1247
|
},
|
|
788
1248
|
},
|
|
789
1249
|
{
|
|
790
|
-
name: '
|
|
1250
|
+
name: 'pubkeyArray',
|
|
791
1251
|
type: {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
1252
|
+
vec: 'publicKey',
|
|
1253
|
+
},
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
name: 'message',
|
|
1257
|
+
type: {
|
|
1258
|
+
option: 'bytes',
|
|
795
1259
|
},
|
|
796
1260
|
},
|
|
797
1261
|
],
|
|
798
1262
|
},
|
|
799
1263
|
},
|
|
800
1264
|
{
|
|
801
|
-
name: '
|
|
1265
|
+
name: 'RolloverMetadata',
|
|
802
1266
|
type: {
|
|
803
1267
|
kind: 'struct',
|
|
804
1268
|
fields: [
|
|
805
1269
|
{
|
|
806
|
-
name: '
|
|
807
|
-
|
|
1270
|
+
name: 'index',
|
|
1271
|
+
docs: ['Unique index.'],
|
|
1272
|
+
type: 'u64',
|
|
808
1273
|
},
|
|
809
1274
|
{
|
|
810
|
-
name: '
|
|
1275
|
+
name: 'rolloverFee',
|
|
1276
|
+
docs: [
|
|
1277
|
+
'This fee is used for rent for the next account.',
|
|
1278
|
+
'It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over',
|
|
1279
|
+
],
|
|
811
1280
|
type: 'u64',
|
|
812
1281
|
},
|
|
813
1282
|
{
|
|
814
|
-
name: '
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1283
|
+
name: 'rolloverThreshold',
|
|
1284
|
+
docs: [
|
|
1285
|
+
'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).',
|
|
1286
|
+
],
|
|
1287
|
+
type: 'u64',
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
name: 'networkFee',
|
|
1291
|
+
docs: ['Tip for maintaining the account.'],
|
|
1292
|
+
type: 'u64',
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
name: 'rolledoverSlot',
|
|
1296
|
+
docs: [
|
|
1297
|
+
'The slot when the account was rolled over, a rolled over account should not be written to.',
|
|
1298
|
+
],
|
|
1299
|
+
type: 'u64',
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
name: 'closeThreshold',
|
|
1303
|
+
docs: [
|
|
1304
|
+
'If current slot is greater than rolledover_slot + close_threshold and',
|
|
1305
|
+
"the account is empty it can be closed. No 'close' functionality has been",
|
|
1306
|
+
'implemented yet.',
|
|
1307
|
+
],
|
|
1308
|
+
type: 'u64',
|
|
818
1309
|
},
|
|
819
1310
|
],
|
|
820
1311
|
},
|
|
@@ -868,78 +1359,6 @@ const IDL = {
|
|
|
868
1359
|
option: 'u64',
|
|
869
1360
|
},
|
|
870
1361
|
},
|
|
871
|
-
{
|
|
872
|
-
name: 'delegatedAmount',
|
|
873
|
-
docs: ['The amount delegated'],
|
|
874
|
-
type: 'u64',
|
|
875
|
-
},
|
|
876
|
-
],
|
|
877
|
-
},
|
|
878
|
-
},
|
|
879
|
-
{
|
|
880
|
-
name: 'AccountState',
|
|
881
|
-
type: {
|
|
882
|
-
kind: 'enum',
|
|
883
|
-
variants: [
|
|
884
|
-
{
|
|
885
|
-
name: 'Initialized',
|
|
886
|
-
},
|
|
887
|
-
{
|
|
888
|
-
name: 'Frozen',
|
|
889
|
-
},
|
|
890
|
-
],
|
|
891
|
-
},
|
|
892
|
-
},
|
|
893
|
-
{
|
|
894
|
-
name: 'ErrorCode',
|
|
895
|
-
type: {
|
|
896
|
-
kind: 'enum',
|
|
897
|
-
variants: [
|
|
898
|
-
{
|
|
899
|
-
name: 'PublicKeyAmountMissmatch',
|
|
900
|
-
},
|
|
901
|
-
{
|
|
902
|
-
name: 'MissingNewAuthorityPda',
|
|
903
|
-
},
|
|
904
|
-
{
|
|
905
|
-
name: 'SignerCheckFailed',
|
|
906
|
-
},
|
|
907
|
-
{
|
|
908
|
-
name: 'MintCheckFailed',
|
|
909
|
-
},
|
|
910
|
-
{
|
|
911
|
-
name: 'ComputeInputSumFailed',
|
|
912
|
-
},
|
|
913
|
-
{
|
|
914
|
-
name: 'ComputeOutputSumFailed',
|
|
915
|
-
},
|
|
916
|
-
{
|
|
917
|
-
name: 'ComputeCompressSumFailed',
|
|
918
|
-
},
|
|
919
|
-
{
|
|
920
|
-
name: 'ComputeDecompressSumFailed',
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
name: 'SumCheckFailed',
|
|
924
|
-
},
|
|
925
|
-
{
|
|
926
|
-
name: 'DecompressRecipientUndefinedForDecompress',
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
name: 'CompressedPdaUndefinedForDecompress',
|
|
930
|
-
},
|
|
931
|
-
{
|
|
932
|
-
name: 'DeCompressAmountUndefinedForDecompress',
|
|
933
|
-
},
|
|
934
|
-
{
|
|
935
|
-
name: 'CompressedPdaUndefinedForCompress',
|
|
936
|
-
},
|
|
937
|
-
{
|
|
938
|
-
name: 'DeCompressAmountUndefinedForCompress',
|
|
939
|
-
},
|
|
940
|
-
{
|
|
941
|
-
name: 'DelegateUndefined',
|
|
942
|
-
},
|
|
943
1362
|
],
|
|
944
1363
|
},
|
|
945
1364
|
},
|
|
@@ -947,13 +1366,108 @@ const IDL = {
|
|
|
947
1366
|
errors: [
|
|
948
1367
|
{
|
|
949
1368
|
code: 6000,
|
|
950
|
-
name: '
|
|
951
|
-
msg: '
|
|
1369
|
+
name: 'PublicKeyAmountMissmatch',
|
|
1370
|
+
msg: 'public keys and amounts must be of same length',
|
|
952
1371
|
},
|
|
953
1372
|
{
|
|
954
1373
|
code: 6001,
|
|
955
|
-
name: '
|
|
956
|
-
msg: '
|
|
1374
|
+
name: 'SignerCheckFailed',
|
|
1375
|
+
msg: 'SignerCheckFailed',
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
code: 6002,
|
|
1379
|
+
name: 'ComputeInputSumFailed',
|
|
1380
|
+
msg: 'ComputeInputSumFailed',
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
code: 6003,
|
|
1384
|
+
name: 'ComputeOutputSumFailed',
|
|
1385
|
+
msg: 'ComputeOutputSumFailed',
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
code: 6004,
|
|
1389
|
+
name: 'ComputeCompressSumFailed',
|
|
1390
|
+
msg: 'ComputeCompressSumFailed',
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
code: 6005,
|
|
1394
|
+
name: 'ComputeDecompressSumFailed',
|
|
1395
|
+
msg: 'ComputeDecompressSumFailed',
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
code: 6006,
|
|
1399
|
+
name: 'SumCheckFailed',
|
|
1400
|
+
msg: 'SumCheckFailed',
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
code: 6007,
|
|
1404
|
+
name: 'DecompressRecipientUndefinedForDecompress',
|
|
1405
|
+
msg: 'DecompressRecipientUndefinedForDecompress',
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
code: 6008,
|
|
1409
|
+
name: 'CompressedPdaUndefinedForDecompress',
|
|
1410
|
+
msg: 'CompressedPdaUndefinedForDecompress',
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
code: 6009,
|
|
1414
|
+
name: 'DeCompressAmountUndefinedForDecompress',
|
|
1415
|
+
msg: 'DeCompressAmountUndefinedForDecompress',
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
code: 6010,
|
|
1419
|
+
name: 'CompressedPdaUndefinedForCompress',
|
|
1420
|
+
msg: 'CompressedPdaUndefinedForCompress',
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
code: 6011,
|
|
1424
|
+
name: 'DeCompressAmountUndefinedForCompress',
|
|
1425
|
+
msg: 'DeCompressAmountUndefinedForCompress',
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
code: 6012,
|
|
1429
|
+
name: 'DelegateUndefined',
|
|
1430
|
+
msg: 'DelegateUndefined while delegated amount is defined',
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
code: 6013,
|
|
1434
|
+
name: 'DelegateSignerCheckFailed',
|
|
1435
|
+
msg: 'DelegateSignerCheckFailed',
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
code: 6014,
|
|
1439
|
+
name: 'SplTokenSupplyMismatch',
|
|
1440
|
+
msg: 'SplTokenSupplyMismatch',
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
code: 6015,
|
|
1444
|
+
name: 'HeapMemoryCheckFailed',
|
|
1445
|
+
msg: 'HeapMemoryCheckFailed',
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
code: 6016,
|
|
1449
|
+
name: 'InstructionNotCallable',
|
|
1450
|
+
msg: 'The instruction is not callable',
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
code: 6017,
|
|
1454
|
+
name: 'ArithmeticUnderflow',
|
|
1455
|
+
msg: 'ArithmeticUnderflow',
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
code: 6018,
|
|
1459
|
+
name: 'InvalidDelegate',
|
|
1460
|
+
msg: 'InvalidDelegate',
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
code: 6019,
|
|
1464
|
+
name: 'HashToFieldError',
|
|
1465
|
+
msg: 'HashToFieldError',
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
code: 6020,
|
|
1469
|
+
name: 'InvalidMint',
|
|
1470
|
+
msg: 'InvalidMint',
|
|
957
1471
|
},
|
|
958
1472
|
],
|
|
959
1473
|
};
|
|
@@ -963,7 +1477,7 @@ const IDL = {
|
|
|
963
1477
|
* Packs Compressed Token Accounts.
|
|
964
1478
|
*/
|
|
965
1479
|
function packCompressedTokenAccounts(params) {
|
|
966
|
-
const { inputCompressedTokenAccounts,
|
|
1480
|
+
const { inputCompressedTokenAccounts, outputStateTrees, remainingAccounts = [], rootIndices, tokenTransferOutputs, } = params;
|
|
967
1481
|
const _remainingAccounts = remainingAccounts.slice();
|
|
968
1482
|
let delegateIndex = null;
|
|
969
1483
|
if (inputCompressedTokenAccounts.length > 0 &&
|
|
@@ -974,29 +1488,35 @@ function packCompressedTokenAccounts(params) {
|
|
|
974
1488
|
/// Currently just packs 'delegate' to pubkeyArray
|
|
975
1489
|
const packedInputTokenData = [];
|
|
976
1490
|
/// pack inputs
|
|
977
|
-
inputCompressedTokenAccounts.forEach((account) => {
|
|
1491
|
+
inputCompressedTokenAccounts.forEach((account, index) => {
|
|
978
1492
|
const merkleTreePubkeyIndex = stateless_js.getIndexOrAdd(_remainingAccounts, account.compressedAccount.merkleTree);
|
|
979
1493
|
const nullifierQueuePubkeyIndex = stateless_js.getIndexOrAdd(_remainingAccounts, account.compressedAccount.nullifierQueue);
|
|
980
1494
|
packedInputTokenData.push({
|
|
981
1495
|
amount: account.parsed.amount,
|
|
982
1496
|
delegateIndex,
|
|
983
|
-
delegatedAmount: account.parsed.delegatedAmount.eq(stateless_js.bn(0))
|
|
984
|
-
? null
|
|
985
|
-
: account.parsed.delegatedAmount,
|
|
986
1497
|
isNative: account.parsed.isNative,
|
|
987
1498
|
merkleContext: {
|
|
988
1499
|
merkleTreePubkeyIndex,
|
|
989
1500
|
nullifierQueuePubkeyIndex,
|
|
990
1501
|
leafIndex: account.compressedAccount.leafIndex,
|
|
991
1502
|
},
|
|
1503
|
+
rootIndex: rootIndices[index],
|
|
992
1504
|
});
|
|
993
1505
|
});
|
|
994
1506
|
/// pack output state trees
|
|
995
|
-
const paddedOutputStateMerkleTrees = stateless_js.padOutputStateMerkleTrees(outputStateTrees,
|
|
996
|
-
const
|
|
997
|
-
paddedOutputStateMerkleTrees.forEach(account => {
|
|
998
|
-
|
|
999
|
-
|
|
1507
|
+
const paddedOutputStateMerkleTrees = stateless_js.padOutputStateMerkleTrees(outputStateTrees, tokenTransferOutputs.length, inputCompressedTokenAccounts.map(acc => acc.compressedAccount));
|
|
1508
|
+
const packedOutputTokenData = [];
|
|
1509
|
+
paddedOutputStateMerkleTrees.forEach((account, index) => {
|
|
1510
|
+
var _a;
|
|
1511
|
+
const merkleTreeIndex = stateless_js.getIndexOrAdd(_remainingAccounts, account);
|
|
1512
|
+
packedOutputTokenData.push({
|
|
1513
|
+
owner: tokenTransferOutputs[index].owner,
|
|
1514
|
+
amount: tokenTransferOutputs[index].amount,
|
|
1515
|
+
lamports: ((_a = tokenTransferOutputs[index].lamports) === null || _a === void 0 ? void 0 : _a.eq(stateless_js.bn(0)))
|
|
1516
|
+
? null
|
|
1517
|
+
: tokenTransferOutputs[index].lamports,
|
|
1518
|
+
merkleTreeIndex,
|
|
1519
|
+
});
|
|
1000
1520
|
});
|
|
1001
1521
|
// to meta
|
|
1002
1522
|
const remainingAccountMetas = _remainingAccounts.map((account) => ({
|
|
@@ -1006,14 +1526,13 @@ function packCompressedTokenAccounts(params) {
|
|
|
1006
1526
|
}));
|
|
1007
1527
|
return {
|
|
1008
1528
|
inputTokenDataWithContext: packedInputTokenData,
|
|
1009
|
-
outputStateMerkleTreeIndices,
|
|
1010
1529
|
remainingAccountMetas,
|
|
1530
|
+
packedOutputTokenData,
|
|
1011
1531
|
};
|
|
1012
1532
|
}
|
|
1013
1533
|
|
|
1014
1534
|
const POOL_SEED = Buffer.from('pool');
|
|
1015
1535
|
const CPI_AUTHORITY_SEED = Buffer.from('cpi_authority');
|
|
1016
|
-
const MINT_AUTHORITY_SEED = anchor.utils.bytes.utf8.encode('mint_authority_pda');
|
|
1017
1536
|
const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
|
|
1018
1537
|
|
|
1019
1538
|
/** Address of the SPL Token program */
|
|
@@ -5873,7 +6392,6 @@ function createMintToInstruction(mint, destination, authority, amount, multiSign
|
|
|
5873
6392
|
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
5874
6393
|
}
|
|
5875
6394
|
|
|
5876
|
-
var _a;
|
|
5877
6395
|
/**
|
|
5878
6396
|
* Sum up the token amounts of the compressed token accounts
|
|
5879
6397
|
*/
|
|
@@ -6020,59 +6538,32 @@ class CompressedTokenProgram {
|
|
|
6020
6538
|
programId: TOKEN_PROGRAM_ID,
|
|
6021
6539
|
space: MINT_SIZE,
|
|
6022
6540
|
});
|
|
6023
|
-
const
|
|
6024
|
-
const
|
|
6025
|
-
/// Fund the mint authority PDA. The authority is system-owned in order
|
|
6026
|
-
/// to natively mint compressed tokens.
|
|
6027
|
-
const fundAuthorityPdaInstruction = web3_js.SystemProgram.transfer({
|
|
6028
|
-
fromPubkey: feePayer,
|
|
6029
|
-
toPubkey: mintAuthorityPda,
|
|
6030
|
-
lamports: rentExemptBalance,
|
|
6031
|
-
});
|
|
6032
|
-
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
6033
|
-
/// Create omnibus compressed mint account
|
|
6034
|
-
const ix = await this.program.methods
|
|
6035
|
-
.createMint()
|
|
6036
|
-
.accounts({
|
|
6037
|
-
mint,
|
|
6541
|
+
const initializeMintInstruction = createInitializeMint2Instruction(mint, params.decimals, authority, params.freezeAuthority, TOKEN_PROGRAM_ID);
|
|
6542
|
+
const ix = await this.registerMint({
|
|
6038
6543
|
feePayer,
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
mintAuthorityPda,
|
|
6043
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
6044
|
-
cpiAuthorityPda: this.deriveCpiAuthorityPda,
|
|
6045
|
-
})
|
|
6046
|
-
.instruction();
|
|
6047
|
-
return [
|
|
6048
|
-
createMintAccountInstruction,
|
|
6049
|
-
initializeMintInstruction,
|
|
6050
|
-
fundAuthorityPdaInstruction,
|
|
6051
|
-
ix,
|
|
6052
|
-
];
|
|
6544
|
+
mint,
|
|
6545
|
+
});
|
|
6546
|
+
return [createMintAccountInstruction, initializeMintInstruction, ix];
|
|
6053
6547
|
}
|
|
6054
6548
|
/**
|
|
6055
6549
|
* Enable compression for an existing SPL mint, creating an omnibus account.
|
|
6056
6550
|
* For new mints, use `CompressedTokenProgram.createMint`.
|
|
6057
6551
|
*/
|
|
6058
6552
|
static async registerMint(params) {
|
|
6059
|
-
const { mint,
|
|
6060
|
-
const [mintAuthorityPda] = this.deriveMintAuthorityPda(authority, mint);
|
|
6553
|
+
const { mint, feePayer } = params;
|
|
6061
6554
|
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
6062
6555
|
const ix = await this.program.methods
|
|
6063
6556
|
.createMint()
|
|
6064
6557
|
.accounts({
|
|
6065
6558
|
mint,
|
|
6066
6559
|
feePayer,
|
|
6067
|
-
authority,
|
|
6068
6560
|
tokenPoolPda,
|
|
6069
6561
|
systemProgram: web3_js.SystemProgram.programId,
|
|
6070
|
-
mintAuthorityPda,
|
|
6071
6562
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
6072
6563
|
cpiAuthorityPda: this.deriveCpiAuthorityPda,
|
|
6073
6564
|
})
|
|
6074
6565
|
.instruction();
|
|
6075
|
-
return
|
|
6566
|
+
return ix;
|
|
6076
6567
|
}
|
|
6077
6568
|
/**
|
|
6078
6569
|
* Construct mintTo instruction for compressed tokens
|
|
@@ -6081,15 +6572,14 @@ class CompressedTokenProgram {
|
|
|
6081
6572
|
const systemKeys = stateless_js.defaultStaticAccountsStruct();
|
|
6082
6573
|
const { mint, feePayer, authority, merkleTree, toPubkey, amount } = params;
|
|
6083
6574
|
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
6084
|
-
const [mintAuthorityPda, bump] = this.deriveMintAuthorityPda(authority, mint);
|
|
6085
6575
|
const amounts = stateless_js.toArray(amount).map(amount => stateless_js.bn(amount));
|
|
6086
6576
|
const toPubkeys = stateless_js.toArray(toPubkey);
|
|
6087
6577
|
const instruction = await this.program.methods
|
|
6088
|
-
.mintTo(toPubkeys, amounts
|
|
6578
|
+
.mintTo(toPubkeys, amounts)
|
|
6089
6579
|
.accounts({
|
|
6090
6580
|
feePayer,
|
|
6091
6581
|
authority,
|
|
6092
|
-
|
|
6582
|
+
cpiAuthorityPda: this.deriveCpiAuthorityPda,
|
|
6093
6583
|
mint,
|
|
6094
6584
|
tokenPoolPda,
|
|
6095
6585
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
@@ -6098,7 +6588,7 @@ class CompressedTokenProgram {
|
|
|
6098
6588
|
noopProgram: systemKeys.noopProgram,
|
|
6099
6589
|
accountCompressionAuthority: systemKeys.accountCompressionAuthority,
|
|
6100
6590
|
accountCompressionProgram: systemKeys.accountCompressionProgram,
|
|
6101
|
-
merkleTree,
|
|
6591
|
+
merkleTree: merkleTree !== null && merkleTree !== void 0 ? merkleTree : stateless_js.defaultTestStateTreeAccounts().merkleTree,
|
|
6102
6592
|
selfProgram: this.programId,
|
|
6103
6593
|
})
|
|
6104
6594
|
.instruction();
|
|
@@ -6111,43 +6601,40 @@ class CompressedTokenProgram {
|
|
|
6111
6601
|
static async approveAndMintTo(params) {
|
|
6112
6602
|
const { mint, feePayer, authorityTokenAccount, authority, merkleTree, toPubkey, } = params;
|
|
6113
6603
|
const amount = BigInt(params.amount.toString());
|
|
6114
|
-
/// 1. Mint to
|
|
6604
|
+
/// 1. Mint to existing ATA of mintAuthority.
|
|
6115
6605
|
const splMintToInstruction = createMintToInstruction(mint, authorityTokenAccount, authority, amount);
|
|
6116
|
-
/// 2.
|
|
6117
|
-
const approveInstruction =
|
|
6118
|
-
/// 3. Compress from mint authority ATA to recipient compressed account
|
|
6119
|
-
const ixs = await this.compress({
|
|
6606
|
+
/// 2. Compress from mint authority ATA to recipient compressed account
|
|
6607
|
+
const [approveInstruction, compressInstruction] = await this.compress({
|
|
6120
6608
|
payer: feePayer,
|
|
6121
6609
|
owner: authority,
|
|
6122
6610
|
source: authorityTokenAccount,
|
|
6123
6611
|
toAddress: toPubkey,
|
|
6124
6612
|
mint,
|
|
6125
|
-
amount:
|
|
6613
|
+
amount: params.amount,
|
|
6126
6614
|
outputStateTree: merkleTree,
|
|
6127
6615
|
});
|
|
6128
|
-
return [splMintToInstruction, approveInstruction,
|
|
6616
|
+
return [splMintToInstruction, approveInstruction, compressInstruction];
|
|
6129
6617
|
}
|
|
6130
6618
|
/**
|
|
6131
6619
|
* Construct transfer instruction for compressed tokens
|
|
6132
6620
|
*/
|
|
6133
6621
|
static async transfer(params) {
|
|
6134
6622
|
const { payer, inputCompressedTokenAccounts, recentInputStateRootIndices, recentValidityProof, amount, outputStateTrees, toAddress, } = params;
|
|
6135
|
-
const
|
|
6136
|
-
const { inputTokenDataWithContext,
|
|
6623
|
+
const tokenTransferOutputs = createTransferOutputState(inputCompressedTokenAccounts, toAddress, amount);
|
|
6624
|
+
const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
|
|
6137
6625
|
inputCompressedTokenAccounts,
|
|
6138
|
-
outputCompressedAccountsLength: outputCompressedAccounts.length,
|
|
6139
6626
|
outputStateTrees,
|
|
6627
|
+
rootIndices: recentInputStateRootIndices,
|
|
6628
|
+
tokenTransferOutputs,
|
|
6140
6629
|
});
|
|
6141
6630
|
const { mint, currentOwner } = parseTokenData(inputCompressedTokenAccounts);
|
|
6142
6631
|
const data = {
|
|
6143
6632
|
proof: recentValidityProof,
|
|
6144
|
-
rootIndices: recentInputStateRootIndices,
|
|
6145
6633
|
mint,
|
|
6146
|
-
|
|
6634
|
+
delegatedTransfer: null, // TODO: implement
|
|
6147
6635
|
inputTokenDataWithContext,
|
|
6148
|
-
outputCompressedAccounts,
|
|
6149
|
-
|
|
6150
|
-
compressionAmount: null,
|
|
6636
|
+
outputCompressedAccounts: packedOutputTokenData,
|
|
6637
|
+
compressOrDecompressAmount: null,
|
|
6151
6638
|
isCompress: false,
|
|
6152
6639
|
cpiContext: null,
|
|
6153
6640
|
};
|
|
@@ -6166,7 +6653,7 @@ class CompressedTokenProgram {
|
|
|
6166
6653
|
accountCompressionProgram: accountCompressionProgram,
|
|
6167
6654
|
selfProgram: this.programId,
|
|
6168
6655
|
tokenPoolPda: null,
|
|
6169
|
-
|
|
6656
|
+
compressOrDecompressTokenAccount: null,
|
|
6170
6657
|
tokenProgram: null,
|
|
6171
6658
|
})
|
|
6172
6659
|
.remainingAccounts(remainingAccountMetas)
|
|
@@ -6180,27 +6667,26 @@ class CompressedTokenProgram {
|
|
|
6180
6667
|
static async compress(params) {
|
|
6181
6668
|
const { payer, owner, source, toAddress, mint, outputStateTree } = params;
|
|
6182
6669
|
const amount = stateless_js.bn(params.amount);
|
|
6183
|
-
const
|
|
6670
|
+
const tokenTransferOutputs = [
|
|
6184
6671
|
{
|
|
6185
6672
|
owner: toAddress,
|
|
6186
6673
|
amount,
|
|
6187
6674
|
lamports: stateless_js.bn(0),
|
|
6188
6675
|
},
|
|
6189
6676
|
];
|
|
6190
|
-
const { inputTokenDataWithContext,
|
|
6677
|
+
const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
|
|
6191
6678
|
inputCompressedTokenAccounts: [],
|
|
6192
|
-
|
|
6193
|
-
|
|
6679
|
+
outputStateTrees: outputStateTree,
|
|
6680
|
+
rootIndices: [],
|
|
6681
|
+
tokenTransferOutputs,
|
|
6194
6682
|
});
|
|
6195
6683
|
const data = {
|
|
6196
6684
|
proof: null,
|
|
6197
|
-
rootIndices: [],
|
|
6198
6685
|
mint,
|
|
6199
|
-
|
|
6686
|
+
delegatedTransfer: null, // TODO: implement
|
|
6200
6687
|
inputTokenDataWithContext,
|
|
6201
|
-
outputCompressedAccounts,
|
|
6202
|
-
|
|
6203
|
-
compressionAmount: amount,
|
|
6688
|
+
outputCompressedAccounts: packedOutputTokenData,
|
|
6689
|
+
compressOrDecompressAmount: amount,
|
|
6204
6690
|
isCompress: true,
|
|
6205
6691
|
cpiContext: null,
|
|
6206
6692
|
};
|
|
@@ -6220,7 +6706,7 @@ class CompressedTokenProgram {
|
|
|
6220
6706
|
accountCompressionProgram: accountCompressionProgram,
|
|
6221
6707
|
selfProgram: this.programId,
|
|
6222
6708
|
tokenPoolPda: this.deriveTokenPoolPda(mint),
|
|
6223
|
-
|
|
6709
|
+
compressOrDecompressTokenAccount: source, // token
|
|
6224
6710
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
6225
6711
|
})
|
|
6226
6712
|
.remainingAccounts(remainingAccountMetas)
|
|
@@ -6235,21 +6721,20 @@ class CompressedTokenProgram {
|
|
|
6235
6721
|
const amount = stateless_js.bn(params.amount);
|
|
6236
6722
|
const tokenTransferOutputs = createDecompressOutputState(inputCompressedTokenAccounts, amount);
|
|
6237
6723
|
/// Pack
|
|
6238
|
-
const { inputTokenDataWithContext,
|
|
6724
|
+
const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
|
|
6239
6725
|
inputCompressedTokenAccounts,
|
|
6240
|
-
|
|
6241
|
-
|
|
6726
|
+
outputStateTrees: outputStateTree,
|
|
6727
|
+
rootIndices: recentInputStateRootIndices,
|
|
6728
|
+
tokenTransferOutputs: tokenTransferOutputs,
|
|
6242
6729
|
});
|
|
6243
6730
|
const { mint, currentOwner } = parseTokenData(inputCompressedTokenAccounts);
|
|
6244
6731
|
const data = {
|
|
6245
6732
|
proof: recentValidityProof,
|
|
6246
|
-
rootIndices: recentInputStateRootIndices,
|
|
6247
6733
|
mint,
|
|
6248
|
-
|
|
6734
|
+
delegatedTransfer: null, // TODO: implement
|
|
6249
6735
|
inputTokenDataWithContext,
|
|
6250
|
-
outputCompressedAccounts:
|
|
6251
|
-
|
|
6252
|
-
compressionAmount: amount,
|
|
6736
|
+
outputCompressedAccounts: packedOutputTokenData,
|
|
6737
|
+
compressOrDecompressAmount: amount,
|
|
6253
6738
|
isCompress: false,
|
|
6254
6739
|
cpiContext: null,
|
|
6255
6740
|
};
|
|
@@ -6268,7 +6753,7 @@ class CompressedTokenProgram {
|
|
|
6268
6753
|
accountCompressionProgram: accountCompressionProgram,
|
|
6269
6754
|
selfProgram: this.programId,
|
|
6270
6755
|
tokenPoolPda: this.deriveTokenPoolPda(mint),
|
|
6271
|
-
|
|
6756
|
+
compressOrDecompressTokenAccount: toAddress,
|
|
6272
6757
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
6273
6758
|
})
|
|
6274
6759
|
.remainingAccounts(remainingAccountMetas)
|
|
@@ -6276,16 +6761,11 @@ class CompressedTokenProgram {
|
|
|
6276
6761
|
return instruction;
|
|
6277
6762
|
}
|
|
6278
6763
|
}
|
|
6279
|
-
_a = CompressedTokenProgram;
|
|
6280
6764
|
/**
|
|
6281
6765
|
* Public key that identifies the CompressedPda program
|
|
6282
6766
|
*/
|
|
6283
|
-
CompressedTokenProgram.programId = new web3_js.PublicKey('
|
|
6767
|
+
CompressedTokenProgram.programId = new web3_js.PublicKey('HXVfQ44ATEi9WBKLSCCwM54KokdkzqXci9xCQ7ST9SYN');
|
|
6284
6768
|
CompressedTokenProgram._program = null;
|
|
6285
|
-
/** @internal */
|
|
6286
|
-
CompressedTokenProgram.deriveMintAuthorityPda = (authority, mint) => {
|
|
6287
|
-
return web3_js.PublicKey.findProgramAddressSync([MINT_AUTHORITY_SEED, authority.toBuffer(), mint.toBuffer()], _a.programId);
|
|
6288
|
-
};
|
|
6289
6769
|
|
|
6290
6770
|
/**
|
|
6291
6771
|
* Mint compressed tokens to a solana address from an external mint authority
|
|
@@ -6302,7 +6782,7 @@ CompressedTokenProgram.deriveMintAuthorityPda = (authority, mint) => {
|
|
|
6302
6782
|
*
|
|
6303
6783
|
* @return Signature of the confirmed transaction
|
|
6304
6784
|
*/
|
|
6305
|
-
async function approveAndMintTo(rpc, payer, mint, destination, authority, amount, merkleTree
|
|
6785
|
+
async function approveAndMintTo(rpc, payer, mint, destination, authority, amount, merkleTree, confirmOptions) {
|
|
6306
6786
|
const authorityTokenAccount = await getOrCreateAssociatedTokenAccount(rpc, payer, mint, authority.publicKey);
|
|
6307
6787
|
const ixs = await CompressedTokenProgram.approveAndMintTo({
|
|
6308
6788
|
feePayer: payer.publicKey,
|
|
@@ -6341,7 +6821,7 @@ async function approveAndMintTo(rpc, payer, mint, destination, authority, amount
|
|
|
6341
6821
|
*
|
|
6342
6822
|
* @return Signature of the confirmed transaction
|
|
6343
6823
|
*/
|
|
6344
|
-
async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree
|
|
6824
|
+
async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree, confirmOptions) {
|
|
6345
6825
|
amount = stateless_js.bn(amount);
|
|
6346
6826
|
const [approveIx, compressIx] = await CompressedTokenProgram.compress({
|
|
6347
6827
|
payer: payer.publicKey,
|
|
@@ -6375,7 +6855,8 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
|
|
|
6375
6855
|
* @param owner Owner of the compressed tokens
|
|
6376
6856
|
* @param toAddress Destination address of the recipient
|
|
6377
6857
|
* @param merkleTree State tree account that the compressed tokens should be
|
|
6378
|
-
* inserted into. Defaults to the default state tree
|
|
6858
|
+
* inserted into. Defaults to the default state tree
|
|
6859
|
+
* account.
|
|
6379
6860
|
* @param confirmOptions Options for confirming the transaction
|
|
6380
6861
|
*
|
|
6381
6862
|
*
|
|
@@ -6383,7 +6864,7 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
|
|
|
6383
6864
|
*/
|
|
6384
6865
|
async function transfer(rpc, payer, mint, amount, owner, toAddress,
|
|
6385
6866
|
/// TODO: allow multiple
|
|
6386
|
-
merkleTree
|
|
6867
|
+
merkleTree, confirmOptions) {
|
|
6387
6868
|
amount = stateless_js.bn(amount);
|
|
6388
6869
|
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(owner.publicKey, {
|
|
6389
6870
|
mint,
|
|
@@ -6454,7 +6935,7 @@ function selectMinCompressedTokenAccountsForTransfer(accounts, transferAmount) {
|
|
|
6454
6935
|
*/
|
|
6455
6936
|
async function decompress(rpc, payer, mint, amount, owner, toAddress,
|
|
6456
6937
|
/// TODO: allow multiple
|
|
6457
|
-
merkleTree
|
|
6938
|
+
merkleTree, confirmOptions) {
|
|
6458
6939
|
amount = stateless_js.bn(amount);
|
|
6459
6940
|
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(owner.publicKey, {
|
|
6460
6941
|
mint,
|
|
@@ -6483,7 +6964,7 @@ merkleTree = stateless_js.defaultTestStateTreeAccounts().merkleTree, confirmOpti
|
|
|
6483
6964
|
*
|
|
6484
6965
|
* @param rpc RPC to use
|
|
6485
6966
|
* @param payer Payer of the transaction and initialization fees
|
|
6486
|
-
* @param mintAuthority Account or multisig that will control minting
|
|
6967
|
+
* @param mintAuthority Account or multisig that will control minting
|
|
6487
6968
|
* @param decimals Location of the decimal place
|
|
6488
6969
|
* @param keypair Optional keypair, defaulting to a new random one
|
|
6489
6970
|
* @param confirmOptions Options for confirming the transaction
|
|
@@ -6496,12 +6977,12 @@ async function createMint(rpc, payer, mintAuthority, decimals, keypair = web3_js
|
|
|
6496
6977
|
feePayer: payer.publicKey,
|
|
6497
6978
|
mint: keypair.publicKey,
|
|
6498
6979
|
decimals,
|
|
6499
|
-
authority: mintAuthority
|
|
6980
|
+
authority: mintAuthority,
|
|
6500
6981
|
freezeAuthority: null, // TODO: add feature
|
|
6501
6982
|
rentExemptBalance,
|
|
6502
6983
|
});
|
|
6503
6984
|
const { blockhash } = await rpc.getLatestBlockhash();
|
|
6504
|
-
const additionalSigners = stateless_js.dedupeSigner(payer, [
|
|
6985
|
+
const additionalSigners = stateless_js.dedupeSigner(payer, [keypair]);
|
|
6505
6986
|
const tx = stateless_js.buildAndSignTx(ixs, payer, blockhash, additionalSigners);
|
|
6506
6987
|
const txId = await stateless_js.sendAndConfirmTx(rpc, tx, confirmOptions);
|
|
6507
6988
|
return { mint: keypair.publicKey, transactionSignature: txId };
|
|
@@ -6522,8 +7003,7 @@ async function createMint(rpc, payer, mintAuthority, decimals, keypair = web3_js
|
|
|
6522
7003
|
*
|
|
6523
7004
|
* @return Signature of the confirmed transaction
|
|
6524
7005
|
*/
|
|
6525
|
-
async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTree
|
|
6526
|
-
confirmOptions) {
|
|
7006
|
+
async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTree, confirmOptions) {
|
|
6527
7007
|
const additionalSigners = stateless_js.dedupeSigner(payer, [authority]);
|
|
6528
7008
|
const ix = await CompressedTokenProgram.mintTo({
|
|
6529
7009
|
feePayer: payer.publicKey,
|
|
@@ -6550,15 +7030,13 @@ confirmOptions) {
|
|
|
6550
7030
|
*
|
|
6551
7031
|
* @return transaction signature
|
|
6552
7032
|
*/
|
|
6553
|
-
async function registerMint(rpc, payer,
|
|
6554
|
-
const
|
|
7033
|
+
async function registerMint(rpc, payer, mintAddress, confirmOptions) {
|
|
7034
|
+
const ix = await CompressedTokenProgram.registerMint({
|
|
6555
7035
|
feePayer: payer.publicKey,
|
|
6556
7036
|
mint: mintAddress,
|
|
6557
|
-
authority: mintAuthority.publicKey,
|
|
6558
7037
|
});
|
|
6559
7038
|
const { blockhash } = await rpc.getLatestBlockhash();
|
|
6560
|
-
const
|
|
6561
|
-
const tx = stateless_js.buildAndSignTx(ixs, payer, blockhash, additionalSigners);
|
|
7039
|
+
const tx = stateless_js.buildAndSignTx([ix], payer, blockhash);
|
|
6562
7040
|
const txId = await stateless_js.sendAndConfirmTx(rpc, tx, confirmOptions);
|
|
6563
7041
|
return txId;
|
|
6564
7042
|
}
|
|
@@ -6566,7 +7044,6 @@ async function registerMint(rpc, payer, mintAuthority, mintAddress, confirmOptio
|
|
|
6566
7044
|
exports.CPI_AUTHORITY_SEED = CPI_AUTHORITY_SEED;
|
|
6567
7045
|
exports.CompressedTokenProgram = CompressedTokenProgram;
|
|
6568
7046
|
exports.IDL = IDL;
|
|
6569
|
-
exports.MINT_AUTHORITY_SEED = MINT_AUTHORITY_SEED;
|
|
6570
7047
|
exports.POOL_SEED = POOL_SEED;
|
|
6571
7048
|
exports.SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE;
|
|
6572
7049
|
exports.approveAndMintTo = approveAndMintTo;
|