@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
package/dist/cjs/node/index.cjs
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
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
|
var require$$0 = require('buffer');
|
|
7
7
|
|
|
8
8
|
const IDL = {
|
|
9
|
-
version: '0.
|
|
9
|
+
version: '0.4.0',
|
|
10
10
|
name: 'light_compressed_token',
|
|
11
|
-
constants: [
|
|
12
|
-
{
|
|
13
|
-
name: 'PROGRAM_ID',
|
|
14
|
-
type: 'string',
|
|
15
|
-
value: '"9sixVEthz2kMSKfeApZXHwuboT6DZuT6crAYJTciUCqE"',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
11
|
instructions: [
|
|
19
12
|
{
|
|
20
13
|
name: 'createMint',
|
|
@@ -30,11 +23,6 @@ const IDL = {
|
|
|
30
23
|
isMut: true,
|
|
31
24
|
isSigner: true,
|
|
32
25
|
},
|
|
33
|
-
{
|
|
34
|
-
name: 'authority',
|
|
35
|
-
isMut: true,
|
|
36
|
-
isSigner: true,
|
|
37
|
-
},
|
|
38
26
|
{
|
|
39
27
|
name: 'tokenPoolPda',
|
|
40
28
|
isMut: true,
|
|
@@ -50,11 +38,6 @@ const IDL = {
|
|
|
50
38
|
isMut: true,
|
|
51
39
|
isSigner: false,
|
|
52
40
|
},
|
|
53
|
-
{
|
|
54
|
-
name: 'mintAuthorityPda',
|
|
55
|
-
isMut: true,
|
|
56
|
-
isSigner: false,
|
|
57
|
-
},
|
|
58
41
|
{
|
|
59
42
|
name: 'tokenProgram',
|
|
60
43
|
isMut: false,
|
|
@@ -70,6 +53,12 @@ const IDL = {
|
|
|
70
53
|
},
|
|
71
54
|
{
|
|
72
55
|
name: 'mintTo',
|
|
56
|
+
docs: [
|
|
57
|
+
'Mints tokens from an spl token mint to a list of compressed accounts.',
|
|
58
|
+
'Minted tokens are transferred to a pool account owned by the compressed',
|
|
59
|
+
'token program. The instruction creates one compressed output account for',
|
|
60
|
+
'every amount and pubkey input pair one output compressed account.',
|
|
61
|
+
],
|
|
73
62
|
accounts: [
|
|
74
63
|
{
|
|
75
64
|
name: 'feePayer',
|
|
@@ -78,12 +67,12 @@ const IDL = {
|
|
|
78
67
|
},
|
|
79
68
|
{
|
|
80
69
|
name: 'authority',
|
|
81
|
-
isMut:
|
|
70
|
+
isMut: false,
|
|
82
71
|
isSigner: true,
|
|
83
72
|
},
|
|
84
73
|
{
|
|
85
|
-
name: '
|
|
86
|
-
isMut:
|
|
74
|
+
name: 'cpiAuthorityPda',
|
|
75
|
+
isMut: false,
|
|
87
76
|
isSigner: false,
|
|
88
77
|
},
|
|
89
78
|
{
|
|
@@ -108,7 +97,7 @@ const IDL = {
|
|
|
108
97
|
},
|
|
109
98
|
{
|
|
110
99
|
name: 'registeredProgramPda',
|
|
111
|
-
isMut:
|
|
100
|
+
isMut: false,
|
|
112
101
|
isSigner: false,
|
|
113
102
|
},
|
|
114
103
|
{
|
|
@@ -118,7 +107,7 @@ const IDL = {
|
|
|
118
107
|
},
|
|
119
108
|
{
|
|
120
109
|
name: 'accountCompressionAuthority',
|
|
121
|
-
isMut:
|
|
110
|
+
isMut: false,
|
|
122
111
|
isSigner: false,
|
|
123
112
|
},
|
|
124
113
|
{
|
|
@@ -155,10 +144,6 @@ const IDL = {
|
|
|
155
144
|
vec: 'u64',
|
|
156
145
|
},
|
|
157
146
|
},
|
|
158
|
-
{
|
|
159
|
-
name: 'bump',
|
|
160
|
-
type: 'u8',
|
|
161
|
-
},
|
|
162
147
|
],
|
|
163
148
|
},
|
|
164
149
|
{
|
|
@@ -216,7 +201,7 @@ const IDL = {
|
|
|
216
201
|
isOptional: true,
|
|
217
202
|
},
|
|
218
203
|
{
|
|
219
|
-
name: '
|
|
204
|
+
name: 'compressOrDecompressTokenAccount',
|
|
220
205
|
isMut: true,
|
|
221
206
|
isSigner: false,
|
|
222
207
|
isOptional: true,
|
|
@@ -240,10 +225,567 @@ const IDL = {
|
|
|
240
225
|
},
|
|
241
226
|
],
|
|
242
227
|
},
|
|
243
|
-
],
|
|
244
|
-
types: [
|
|
245
228
|
{
|
|
246
|
-
name: '
|
|
229
|
+
name: 'approve',
|
|
230
|
+
accounts: [
|
|
231
|
+
{
|
|
232
|
+
name: 'feePayer',
|
|
233
|
+
isMut: true,
|
|
234
|
+
isSigner: true,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'authority',
|
|
238
|
+
isMut: false,
|
|
239
|
+
isSigner: true,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'cpiAuthorityPda',
|
|
243
|
+
isMut: false,
|
|
244
|
+
isSigner: false,
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'lightSystemProgram',
|
|
248
|
+
isMut: false,
|
|
249
|
+
isSigner: false,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'registeredProgramPda',
|
|
253
|
+
isMut: false,
|
|
254
|
+
isSigner: false,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: 'noopProgram',
|
|
258
|
+
isMut: false,
|
|
259
|
+
isSigner: false,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'accountCompressionAuthority',
|
|
263
|
+
isMut: false,
|
|
264
|
+
isSigner: false,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: 'accountCompressionProgram',
|
|
268
|
+
isMut: false,
|
|
269
|
+
isSigner: false,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'selfProgram',
|
|
273
|
+
isMut: false,
|
|
274
|
+
isSigner: false,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'systemProgram',
|
|
278
|
+
isMut: false,
|
|
279
|
+
isSigner: false,
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
args: [
|
|
283
|
+
{
|
|
284
|
+
name: 'inputs',
|
|
285
|
+
type: 'bytes',
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: 'revoke',
|
|
291
|
+
accounts: [
|
|
292
|
+
{
|
|
293
|
+
name: 'feePayer',
|
|
294
|
+
isMut: true,
|
|
295
|
+
isSigner: true,
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: 'authority',
|
|
299
|
+
isMut: false,
|
|
300
|
+
isSigner: true,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: 'cpiAuthorityPda',
|
|
304
|
+
isMut: false,
|
|
305
|
+
isSigner: false,
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: 'lightSystemProgram',
|
|
309
|
+
isMut: false,
|
|
310
|
+
isSigner: false,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'registeredProgramPda',
|
|
314
|
+
isMut: false,
|
|
315
|
+
isSigner: false,
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'noopProgram',
|
|
319
|
+
isMut: false,
|
|
320
|
+
isSigner: false,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: 'accountCompressionAuthority',
|
|
324
|
+
isMut: false,
|
|
325
|
+
isSigner: false,
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'accountCompressionProgram',
|
|
329
|
+
isMut: false,
|
|
330
|
+
isSigner: false,
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: 'selfProgram',
|
|
334
|
+
isMut: false,
|
|
335
|
+
isSigner: false,
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: 'systemProgram',
|
|
339
|
+
isMut: false,
|
|
340
|
+
isSigner: false,
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
args: [
|
|
344
|
+
{
|
|
345
|
+
name: 'inputs',
|
|
346
|
+
type: 'bytes',
|
|
347
|
+
},
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: 'freeze',
|
|
352
|
+
accounts: [
|
|
353
|
+
{
|
|
354
|
+
name: 'feePayer',
|
|
355
|
+
isMut: true,
|
|
356
|
+
isSigner: true,
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: 'authority',
|
|
360
|
+
isMut: false,
|
|
361
|
+
isSigner: true,
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'cpiAuthorityPda',
|
|
365
|
+
isMut: false,
|
|
366
|
+
isSigner: false,
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: 'lightSystemProgram',
|
|
370
|
+
isMut: false,
|
|
371
|
+
isSigner: false,
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: 'registeredProgramPda',
|
|
375
|
+
isMut: false,
|
|
376
|
+
isSigner: false,
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: 'noopProgram',
|
|
380
|
+
isMut: false,
|
|
381
|
+
isSigner: false,
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: 'accountCompressionAuthority',
|
|
385
|
+
isMut: false,
|
|
386
|
+
isSigner: false,
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: 'accountCompressionProgram',
|
|
390
|
+
isMut: false,
|
|
391
|
+
isSigner: false,
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'selfProgram',
|
|
395
|
+
isMut: false,
|
|
396
|
+
isSigner: false,
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: 'systemProgram',
|
|
400
|
+
isMut: false,
|
|
401
|
+
isSigner: false,
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
name: 'mint',
|
|
405
|
+
isMut: false,
|
|
406
|
+
isSigner: false,
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
args: [
|
|
410
|
+
{
|
|
411
|
+
name: 'inputs',
|
|
412
|
+
type: 'bytes',
|
|
413
|
+
},
|
|
414
|
+
],
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: 'thaw',
|
|
418
|
+
accounts: [
|
|
419
|
+
{
|
|
420
|
+
name: 'feePayer',
|
|
421
|
+
isMut: true,
|
|
422
|
+
isSigner: true,
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: 'authority',
|
|
426
|
+
isMut: false,
|
|
427
|
+
isSigner: true,
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: 'cpiAuthorityPda',
|
|
431
|
+
isMut: false,
|
|
432
|
+
isSigner: false,
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: 'lightSystemProgram',
|
|
436
|
+
isMut: false,
|
|
437
|
+
isSigner: false,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: 'registeredProgramPda',
|
|
441
|
+
isMut: false,
|
|
442
|
+
isSigner: false,
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
name: 'noopProgram',
|
|
446
|
+
isMut: false,
|
|
447
|
+
isSigner: false,
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
name: 'accountCompressionAuthority',
|
|
451
|
+
isMut: false,
|
|
452
|
+
isSigner: false,
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: 'accountCompressionProgram',
|
|
456
|
+
isMut: false,
|
|
457
|
+
isSigner: false,
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: 'selfProgram',
|
|
461
|
+
isMut: false,
|
|
462
|
+
isSigner: false,
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: 'systemProgram',
|
|
466
|
+
isMut: false,
|
|
467
|
+
isSigner: false,
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: 'mint',
|
|
471
|
+
isMut: false,
|
|
472
|
+
isSigner: false,
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
args: [
|
|
476
|
+
{
|
|
477
|
+
name: 'inputs',
|
|
478
|
+
type: 'bytes',
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
name: 'burn',
|
|
484
|
+
accounts: [
|
|
485
|
+
{
|
|
486
|
+
name: 'feePayer',
|
|
487
|
+
isMut: true,
|
|
488
|
+
isSigner: true,
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: 'authority',
|
|
492
|
+
isMut: false,
|
|
493
|
+
isSigner: true,
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
name: 'cpiAuthorityPda',
|
|
497
|
+
isMut: false,
|
|
498
|
+
isSigner: false,
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
name: 'lightSystemProgram',
|
|
502
|
+
isMut: false,
|
|
503
|
+
isSigner: false,
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'registeredProgramPda',
|
|
507
|
+
isMut: false,
|
|
508
|
+
isSigner: false,
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: 'noopProgram',
|
|
512
|
+
isMut: false,
|
|
513
|
+
isSigner: false,
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: 'accountCompressionAuthority',
|
|
517
|
+
isMut: false,
|
|
518
|
+
isSigner: false,
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: 'accountCompressionProgram',
|
|
522
|
+
isMut: false,
|
|
523
|
+
isSigner: false,
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: 'selfProgram',
|
|
527
|
+
isMut: false,
|
|
528
|
+
isSigner: false,
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: 'systemProgram',
|
|
532
|
+
isMut: false,
|
|
533
|
+
isSigner: false,
|
|
534
|
+
},
|
|
535
|
+
],
|
|
536
|
+
args: [
|
|
537
|
+
{
|
|
538
|
+
name: 'inputs',
|
|
539
|
+
type: 'bytes',
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: 'stubIdlBuild',
|
|
545
|
+
docs: [
|
|
546
|
+
'This function is a stub to allow Anchor to include the input types in',
|
|
547
|
+
'the IDL. It should not be included in production builds nor be called in',
|
|
548
|
+
'practice.',
|
|
549
|
+
],
|
|
550
|
+
accounts: [
|
|
551
|
+
{
|
|
552
|
+
name: 'feePayer',
|
|
553
|
+
isMut: true,
|
|
554
|
+
isSigner: true,
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: 'authority',
|
|
558
|
+
isMut: false,
|
|
559
|
+
isSigner: true,
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
name: 'cpiAuthorityPda',
|
|
563
|
+
isMut: false,
|
|
564
|
+
isSigner: false,
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: 'lightSystemProgram',
|
|
568
|
+
isMut: false,
|
|
569
|
+
isSigner: false,
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: 'registeredProgramPda',
|
|
573
|
+
isMut: false,
|
|
574
|
+
isSigner: false,
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: 'noopProgram',
|
|
578
|
+
isMut: false,
|
|
579
|
+
isSigner: false,
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: 'accountCompressionAuthority',
|
|
583
|
+
isMut: false,
|
|
584
|
+
isSigner: false,
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: 'accountCompressionProgram',
|
|
588
|
+
isMut: false,
|
|
589
|
+
isSigner: false,
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
name: 'selfProgram',
|
|
593
|
+
isMut: false,
|
|
594
|
+
isSigner: false,
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
name: 'tokenPoolPda',
|
|
598
|
+
isMut: true,
|
|
599
|
+
isSigner: false,
|
|
600
|
+
isOptional: true,
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
name: 'compressOrDecompressTokenAccount',
|
|
604
|
+
isMut: true,
|
|
605
|
+
isSigner: false,
|
|
606
|
+
isOptional: true,
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: 'tokenProgram',
|
|
610
|
+
isMut: false,
|
|
611
|
+
isSigner: false,
|
|
612
|
+
isOptional: true,
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'systemProgram',
|
|
616
|
+
isMut: false,
|
|
617
|
+
isSigner: false,
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
args: [
|
|
621
|
+
{
|
|
622
|
+
name: 'inputs1',
|
|
623
|
+
type: {
|
|
624
|
+
defined: 'CompressedTokenInstructionDataTransfer',
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: 'inputs2',
|
|
629
|
+
type: {
|
|
630
|
+
defined: 'TokenData',
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
],
|
|
634
|
+
},
|
|
635
|
+
],
|
|
636
|
+
accounts: [
|
|
637
|
+
{
|
|
638
|
+
name: 'RegisteredProgram',
|
|
639
|
+
type: {
|
|
640
|
+
kind: 'struct',
|
|
641
|
+
fields: [
|
|
642
|
+
{
|
|
643
|
+
name: 'registeredProgramId',
|
|
644
|
+
type: 'publicKey',
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: 'groupAuthorityPda',
|
|
648
|
+
type: 'publicKey',
|
|
649
|
+
},
|
|
650
|
+
],
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
],
|
|
654
|
+
types: [
|
|
655
|
+
{
|
|
656
|
+
name: 'AccessMetadata',
|
|
657
|
+
type: {
|
|
658
|
+
kind: 'struct',
|
|
659
|
+
fields: [
|
|
660
|
+
{
|
|
661
|
+
name: 'owner',
|
|
662
|
+
docs: ['Owner of the Merkle tree.'],
|
|
663
|
+
type: 'publicKey',
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: 'programOwner',
|
|
667
|
+
docs: [
|
|
668
|
+
'Delegate of the Merkle tree. This will be used for program owned Merkle trees.',
|
|
669
|
+
],
|
|
670
|
+
type: 'publicKey',
|
|
671
|
+
},
|
|
672
|
+
],
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
name: 'AccountState',
|
|
677
|
+
type: {
|
|
678
|
+
kind: 'enum',
|
|
679
|
+
variants: [
|
|
680
|
+
{
|
|
681
|
+
name: 'Initialized',
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'Frozen',
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
name: 'CompressedAccount',
|
|
691
|
+
type: {
|
|
692
|
+
kind: 'struct',
|
|
693
|
+
fields: [
|
|
694
|
+
{
|
|
695
|
+
name: 'owner',
|
|
696
|
+
type: 'publicKey',
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
name: 'lamports',
|
|
700
|
+
type: 'u64',
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: 'address',
|
|
704
|
+
type: {
|
|
705
|
+
option: {
|
|
706
|
+
array: ['u8', 32],
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
name: 'data',
|
|
712
|
+
type: {
|
|
713
|
+
option: {
|
|
714
|
+
defined: 'CompressedAccountData',
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
],
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: 'CompressedAccountData',
|
|
723
|
+
type: {
|
|
724
|
+
kind: 'struct',
|
|
725
|
+
fields: [
|
|
726
|
+
{
|
|
727
|
+
name: 'discriminator',
|
|
728
|
+
type: {
|
|
729
|
+
array: ['u8', 8],
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: 'data',
|
|
734
|
+
type: 'bytes',
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
name: 'dataHash',
|
|
738
|
+
type: {
|
|
739
|
+
array: ['u8', 32],
|
|
740
|
+
},
|
|
741
|
+
},
|
|
742
|
+
],
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
name: 'CompressedCpiContext',
|
|
747
|
+
type: {
|
|
748
|
+
kind: 'struct',
|
|
749
|
+
fields: [
|
|
750
|
+
{
|
|
751
|
+
name: 'setContext',
|
|
752
|
+
type: 'bool',
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
name: 'cpiContextAccountIndex',
|
|
756
|
+
type: 'u8',
|
|
757
|
+
},
|
|
758
|
+
],
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
name: 'CompressedProof',
|
|
763
|
+
type: {
|
|
764
|
+
kind: 'struct',
|
|
765
|
+
fields: [
|
|
766
|
+
{
|
|
767
|
+
name: 'a',
|
|
768
|
+
type: {
|
|
769
|
+
array: ['u8', 32],
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
name: 'b',
|
|
774
|
+
type: {
|
|
775
|
+
array: ['u8', 64],
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: 'c',
|
|
780
|
+
type: {
|
|
781
|
+
array: ['u8', 32],
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
],
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
name: 'CompressedTokenInstructionDataTransfer',
|
|
247
789
|
type: {
|
|
248
790
|
kind: 'struct',
|
|
249
791
|
fields: [
|
|
@@ -256,16 +798,27 @@ const IDL = {
|
|
|
256
798
|
},
|
|
257
799
|
},
|
|
258
800
|
{
|
|
259
|
-
name: '
|
|
801
|
+
name: 'mint',
|
|
802
|
+
type: 'publicKey',
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
name: 'delegatedTransfer',
|
|
806
|
+
docs: [
|
|
807
|
+
'If the signer is a delegate, the delegate index is index 0 of remaining accounts.',
|
|
808
|
+
'owner = Some(owner) is the owner of the token account.',
|
|
809
|
+
'Is set if the signer is delegate',
|
|
810
|
+
],
|
|
260
811
|
type: {
|
|
261
|
-
|
|
812
|
+
option: {
|
|
813
|
+
defined: 'DelegatedTransfer',
|
|
814
|
+
},
|
|
262
815
|
},
|
|
263
816
|
},
|
|
264
817
|
{
|
|
265
|
-
name: '
|
|
818
|
+
name: 'inputTokenDataWithContext',
|
|
266
819
|
type: {
|
|
267
820
|
vec: {
|
|
268
|
-
defined: '
|
|
821
|
+
defined: 'InputTokenDataWithContext',
|
|
269
822
|
},
|
|
270
823
|
},
|
|
271
824
|
},
|
|
@@ -273,119 +826,134 @@ const IDL = {
|
|
|
273
826
|
name: 'outputCompressedAccounts',
|
|
274
827
|
type: {
|
|
275
828
|
vec: {
|
|
276
|
-
defined: '
|
|
829
|
+
defined: 'PackedTokenTransferOutputData',
|
|
277
830
|
},
|
|
278
831
|
},
|
|
279
832
|
},
|
|
280
833
|
{
|
|
281
|
-
name: '
|
|
282
|
-
|
|
283
|
-
'The indices of the accounts in the output state merkle tree.',
|
|
284
|
-
],
|
|
285
|
-
type: 'bytes',
|
|
834
|
+
name: 'isCompress',
|
|
835
|
+
type: 'bool',
|
|
286
836
|
},
|
|
287
837
|
{
|
|
288
|
-
name: '
|
|
838
|
+
name: 'compressOrDecompressAmount',
|
|
289
839
|
type: {
|
|
290
840
|
option: 'u64',
|
|
291
841
|
},
|
|
292
842
|
},
|
|
293
843
|
{
|
|
294
|
-
name: '
|
|
844
|
+
name: 'cpiContext',
|
|
295
845
|
type: {
|
|
296
|
-
|
|
297
|
-
defined: '
|
|
846
|
+
option: {
|
|
847
|
+
defined: 'CompressedCpiContext',
|
|
298
848
|
},
|
|
299
849
|
},
|
|
300
850
|
},
|
|
301
|
-
{
|
|
302
|
-
name: 'compressionLamports',
|
|
303
|
-
type: {
|
|
304
|
-
option: 'u64',
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
name: 'isCompress',
|
|
309
|
-
type: 'bool',
|
|
310
|
-
},
|
|
311
851
|
],
|
|
312
852
|
},
|
|
313
853
|
},
|
|
314
854
|
{
|
|
315
|
-
name: '
|
|
855
|
+
name: 'DelegatedTransfer',
|
|
316
856
|
type: {
|
|
317
857
|
kind: 'struct',
|
|
318
858
|
fields: [
|
|
319
859
|
{
|
|
320
|
-
name: '
|
|
321
|
-
type:
|
|
322
|
-
array: ['u8', 32],
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: 'addressQueueAccountIndex',
|
|
327
|
-
type: 'u8',
|
|
860
|
+
name: 'owner',
|
|
861
|
+
type: 'publicKey',
|
|
328
862
|
},
|
|
329
863
|
{
|
|
330
|
-
name: '
|
|
864
|
+
name: 'delegateChangeAccountIndex',
|
|
331
865
|
type: 'u8',
|
|
332
866
|
},
|
|
333
|
-
{
|
|
334
|
-
name: 'addressMerkleTreeRootIndex',
|
|
335
|
-
type: 'u16',
|
|
336
|
-
},
|
|
337
867
|
],
|
|
338
868
|
},
|
|
339
869
|
},
|
|
340
870
|
{
|
|
341
|
-
name: '
|
|
871
|
+
name: 'InputTokenDataWithContext',
|
|
342
872
|
type: {
|
|
343
873
|
kind: 'struct',
|
|
344
874
|
fields: [
|
|
345
875
|
{
|
|
346
|
-
name: '
|
|
876
|
+
name: 'amount',
|
|
877
|
+
type: 'u64',
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: 'delegateIndex',
|
|
347
881
|
type: {
|
|
348
|
-
|
|
882
|
+
option: 'u8',
|
|
349
883
|
},
|
|
350
884
|
},
|
|
351
885
|
{
|
|
352
|
-
name: '
|
|
353
|
-
type:
|
|
886
|
+
name: 'isNative',
|
|
887
|
+
type: {
|
|
888
|
+
option: 'u64',
|
|
889
|
+
},
|
|
354
890
|
},
|
|
355
891
|
{
|
|
356
|
-
name: '
|
|
357
|
-
type:
|
|
892
|
+
name: 'merkleContext',
|
|
893
|
+
type: {
|
|
894
|
+
defined: 'PackedMerkleContext',
|
|
895
|
+
},
|
|
358
896
|
},
|
|
359
897
|
{
|
|
360
|
-
name: '
|
|
898
|
+
name: 'rootIndex',
|
|
361
899
|
type: 'u16',
|
|
362
900
|
},
|
|
363
901
|
],
|
|
364
902
|
},
|
|
365
903
|
},
|
|
366
904
|
{
|
|
367
|
-
name: '
|
|
905
|
+
name: 'InstructionDataInvoke',
|
|
368
906
|
type: {
|
|
369
907
|
kind: 'struct',
|
|
370
908
|
fields: [
|
|
371
909
|
{
|
|
372
|
-
name: '
|
|
910
|
+
name: 'proof',
|
|
373
911
|
type: {
|
|
374
|
-
|
|
912
|
+
option: {
|
|
913
|
+
defined: 'CompressedProof',
|
|
914
|
+
},
|
|
375
915
|
},
|
|
376
916
|
},
|
|
377
917
|
{
|
|
378
|
-
name: '
|
|
918
|
+
name: 'inputCompressedAccountsWithMerkleContext',
|
|
379
919
|
type: {
|
|
380
|
-
|
|
920
|
+
vec: {
|
|
921
|
+
defined: 'PackedCompressedAccountWithMerkleContext',
|
|
922
|
+
},
|
|
381
923
|
},
|
|
382
924
|
},
|
|
383
925
|
{
|
|
384
|
-
name: '
|
|
926
|
+
name: 'outputCompressedAccounts',
|
|
385
927
|
type: {
|
|
386
|
-
|
|
928
|
+
vec: {
|
|
929
|
+
defined: 'OutputCompressedAccountWithPackedContext',
|
|
930
|
+
},
|
|
931
|
+
},
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
name: 'relayFee',
|
|
935
|
+
type: {
|
|
936
|
+
option: 'u64',
|
|
937
|
+
},
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: 'newAddressParams',
|
|
941
|
+
type: {
|
|
942
|
+
vec: {
|
|
943
|
+
defined: 'NewAddressParamsPacked',
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
name: 'compressOrDecompressLamports',
|
|
949
|
+
type: {
|
|
950
|
+
option: 'u64',
|
|
387
951
|
},
|
|
388
952
|
},
|
|
953
|
+
{
|
|
954
|
+
name: 'isCompress',
|
|
955
|
+
type: 'bool',
|
|
956
|
+
},
|
|
389
957
|
],
|
|
390
958
|
},
|
|
391
959
|
},
|
|
@@ -410,12 +978,6 @@ const IDL = {
|
|
|
410
978
|
},
|
|
411
979
|
},
|
|
412
980
|
},
|
|
413
|
-
{
|
|
414
|
-
name: 'inputRootIndices',
|
|
415
|
-
type: {
|
|
416
|
-
vec: 'u16',
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
981
|
{
|
|
420
982
|
name: 'inputCompressedAccountsWithMerkleContext',
|
|
421
983
|
type: {
|
|
@@ -428,17 +990,10 @@ const IDL = {
|
|
|
428
990
|
name: 'outputCompressedAccounts',
|
|
429
991
|
type: {
|
|
430
992
|
vec: {
|
|
431
|
-
defined: '
|
|
993
|
+
defined: 'OutputCompressedAccountWithPackedContext',
|
|
432
994
|
},
|
|
433
995
|
},
|
|
434
996
|
},
|
|
435
|
-
{
|
|
436
|
-
name: 'outputStateMerkleTreeAccountIndices',
|
|
437
|
-
docs: [
|
|
438
|
-
'The indices of the accounts in the output state merkle tree.',
|
|
439
|
-
],
|
|
440
|
-
type: 'bytes',
|
|
441
|
-
},
|
|
442
997
|
{
|
|
443
998
|
name: 'relayFee',
|
|
444
999
|
type: {
|
|
@@ -446,7 +1001,7 @@ const IDL = {
|
|
|
446
1001
|
},
|
|
447
1002
|
},
|
|
448
1003
|
{
|
|
449
|
-
name: '
|
|
1004
|
+
name: 'compressOrDecompressLamports',
|
|
450
1005
|
type: {
|
|
451
1006
|
option: 'u64',
|
|
452
1007
|
},
|
|
@@ -473,349 +1028,285 @@ const IDL = {
|
|
|
473
1028
|
},
|
|
474
1029
|
},
|
|
475
1030
|
{
|
|
476
|
-
name: '
|
|
477
|
-
type: {
|
|
478
|
-
kind: 'struct',
|
|
479
|
-
fields: [
|
|
480
|
-
{
|
|
481
|
-
name: 'compressedAccount',
|
|
482
|
-
type: {
|
|
483
|
-
defined: 'CompressedAccount',
|
|
484
|
-
},
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
name: 'merkleContext',
|
|
488
|
-
type: {
|
|
489
|
-
defined: 'PackedMerkleContext',
|
|
490
|
-
},
|
|
491
|
-
},
|
|
492
|
-
],
|
|
493
|
-
},
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
name: 'CompressedAccountWithMerkleContext',
|
|
1031
|
+
name: 'MerkleTreeMetadata',
|
|
497
1032
|
type: {
|
|
498
1033
|
kind: 'struct',
|
|
499
1034
|
fields: [
|
|
500
1035
|
{
|
|
501
|
-
name: '
|
|
1036
|
+
name: 'accessMetadata',
|
|
502
1037
|
type: {
|
|
503
|
-
defined: '
|
|
1038
|
+
defined: 'AccessMetadata',
|
|
504
1039
|
},
|
|
505
1040
|
},
|
|
506
1041
|
{
|
|
507
|
-
name: '
|
|
1042
|
+
name: 'rolloverMetadata',
|
|
508
1043
|
type: {
|
|
509
|
-
defined: '
|
|
1044
|
+
defined: 'RolloverMetadata',
|
|
510
1045
|
},
|
|
511
1046
|
},
|
|
512
|
-
],
|
|
513
|
-
},
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
name: 'MerkleContext',
|
|
517
|
-
type: {
|
|
518
|
-
kind: 'struct',
|
|
519
|
-
fields: [
|
|
520
1047
|
{
|
|
521
|
-
name: '
|
|
1048
|
+
name: 'associatedQueue',
|
|
522
1049
|
type: 'publicKey',
|
|
523
1050
|
},
|
|
524
1051
|
{
|
|
525
|
-
name: '
|
|
1052
|
+
name: 'nextMerkleTree',
|
|
526
1053
|
type: 'publicKey',
|
|
527
1054
|
},
|
|
528
|
-
{
|
|
529
|
-
name: 'leafIndex',
|
|
530
|
-
type: 'u32',
|
|
531
|
-
},
|
|
532
|
-
],
|
|
533
|
-
},
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
name: 'PackedMerkleContext',
|
|
537
|
-
type: {
|
|
538
|
-
kind: 'struct',
|
|
539
|
-
fields: [
|
|
540
|
-
{
|
|
541
|
-
name: 'merkleTreePubkeyIndex',
|
|
542
|
-
type: 'u8',
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
name: 'nullifierQueuePubkeyIndex',
|
|
546
|
-
type: 'u8',
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
name: 'leafIndex',
|
|
550
|
-
type: 'u32',
|
|
551
|
-
},
|
|
552
1055
|
],
|
|
553
1056
|
},
|
|
554
1057
|
},
|
|
555
1058
|
{
|
|
556
|
-
name: '
|
|
1059
|
+
name: 'MerkleTreeSequenceNumber',
|
|
557
1060
|
type: {
|
|
558
1061
|
kind: 'struct',
|
|
559
1062
|
fields: [
|
|
560
1063
|
{
|
|
561
|
-
name: '
|
|
1064
|
+
name: 'pubkey',
|
|
562
1065
|
type: 'publicKey',
|
|
563
1066
|
},
|
|
564
1067
|
{
|
|
565
|
-
name: '
|
|
1068
|
+
name: 'seq',
|
|
566
1069
|
type: 'u64',
|
|
567
1070
|
},
|
|
568
|
-
{
|
|
569
|
-
name: 'address',
|
|
570
|
-
type: {
|
|
571
|
-
option: {
|
|
572
|
-
array: ['u8', 32],
|
|
573
|
-
},
|
|
574
|
-
},
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
name: 'data',
|
|
578
|
-
type: {
|
|
579
|
-
option: {
|
|
580
|
-
defined: 'CompressedAccountData',
|
|
581
|
-
},
|
|
582
|
-
},
|
|
583
|
-
},
|
|
584
1071
|
],
|
|
585
1072
|
},
|
|
586
1073
|
},
|
|
587
1074
|
{
|
|
588
|
-
name: '
|
|
1075
|
+
name: 'NewAddressParamsPacked',
|
|
589
1076
|
type: {
|
|
590
1077
|
kind: 'struct',
|
|
591
1078
|
fields: [
|
|
592
1079
|
{
|
|
593
|
-
name: '
|
|
1080
|
+
name: 'seed',
|
|
594
1081
|
type: {
|
|
595
|
-
array: ['u8',
|
|
1082
|
+
array: ['u8', 32],
|
|
596
1083
|
},
|
|
597
1084
|
},
|
|
598
1085
|
{
|
|
599
|
-
name: '
|
|
600
|
-
type: '
|
|
1086
|
+
name: 'addressQueueAccountIndex',
|
|
1087
|
+
type: 'u8',
|
|
601
1088
|
},
|
|
602
1089
|
{
|
|
603
|
-
name: '
|
|
604
|
-
type:
|
|
605
|
-
|
|
606
|
-
|
|
1090
|
+
name: 'addressMerkleTreeAccountIndex',
|
|
1091
|
+
type: 'u8',
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
name: 'addressMerkleTreeRootIndex',
|
|
1095
|
+
type: 'u16',
|
|
607
1096
|
},
|
|
608
1097
|
],
|
|
609
1098
|
},
|
|
610
1099
|
},
|
|
611
1100
|
{
|
|
612
|
-
name: '
|
|
1101
|
+
name: 'OutputCompressedAccountWithPackedContext',
|
|
613
1102
|
type: {
|
|
614
1103
|
kind: 'struct',
|
|
615
1104
|
fields: [
|
|
616
1105
|
{
|
|
617
|
-
name: '
|
|
618
|
-
type: {
|
|
619
|
-
vec: {
|
|
620
|
-
array: ['u8', 32],
|
|
621
|
-
},
|
|
622
|
-
},
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
name: 'outputCompressedAccountHashes',
|
|
626
|
-
type: {
|
|
627
|
-
vec: {
|
|
628
|
-
array: ['u8', 32],
|
|
629
|
-
},
|
|
630
|
-
},
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
name: 'outputCompressedAccounts',
|
|
634
|
-
type: {
|
|
635
|
-
vec: {
|
|
636
|
-
defined: 'CompressedAccount',
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
name: 'outputStateMerkleTreeAccountIndices',
|
|
642
|
-
type: 'bytes',
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
name: 'outputLeafIndices',
|
|
646
|
-
type: {
|
|
647
|
-
vec: 'u32',
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
name: 'relayFee',
|
|
1106
|
+
name: 'compressedAccount',
|
|
652
1107
|
type: {
|
|
653
|
-
|
|
1108
|
+
defined: 'CompressedAccount',
|
|
654
1109
|
},
|
|
655
1110
|
},
|
|
656
1111
|
{
|
|
657
|
-
name: '
|
|
658
|
-
type: '
|
|
1112
|
+
name: 'merkleTreeIndex',
|
|
1113
|
+
type: 'u8',
|
|
659
1114
|
},
|
|
1115
|
+
],
|
|
1116
|
+
},
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
name: 'PackedCompressedAccountWithMerkleContext',
|
|
1120
|
+
type: {
|
|
1121
|
+
kind: 'struct',
|
|
1122
|
+
fields: [
|
|
660
1123
|
{
|
|
661
|
-
name: '
|
|
1124
|
+
name: 'compressedAccount',
|
|
662
1125
|
type: {
|
|
663
|
-
|
|
1126
|
+
defined: 'CompressedAccount',
|
|
664
1127
|
},
|
|
665
1128
|
},
|
|
666
1129
|
{
|
|
667
|
-
name: '
|
|
1130
|
+
name: 'merkleContext',
|
|
668
1131
|
type: {
|
|
669
|
-
|
|
1132
|
+
defined: 'PackedMerkleContext',
|
|
670
1133
|
},
|
|
671
1134
|
},
|
|
672
1135
|
{
|
|
673
|
-
name: '
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
1136
|
+
name: 'rootIndex',
|
|
1137
|
+
docs: [
|
|
1138
|
+
'Index of root used in inclusion validity proof.',
|
|
1139
|
+
],
|
|
1140
|
+
type: 'u16',
|
|
677
1141
|
},
|
|
678
1142
|
],
|
|
679
1143
|
},
|
|
680
1144
|
},
|
|
681
1145
|
{
|
|
682
|
-
name: '
|
|
1146
|
+
name: 'PackedMerkleContext',
|
|
683
1147
|
type: {
|
|
684
1148
|
kind: 'struct',
|
|
685
1149
|
fields: [
|
|
686
1150
|
{
|
|
687
|
-
name: '
|
|
688
|
-
type: '
|
|
1151
|
+
name: 'merkleTreePubkeyIndex',
|
|
1152
|
+
type: 'u8',
|
|
689
1153
|
},
|
|
690
1154
|
{
|
|
691
|
-
name: '
|
|
1155
|
+
name: 'nullifierQueuePubkeyIndex',
|
|
692
1156
|
type: 'u8',
|
|
693
1157
|
},
|
|
1158
|
+
{
|
|
1159
|
+
name: 'leafIndex',
|
|
1160
|
+
type: 'u32',
|
|
1161
|
+
},
|
|
694
1162
|
],
|
|
695
1163
|
},
|
|
696
1164
|
},
|
|
697
1165
|
{
|
|
698
|
-
name: '
|
|
1166
|
+
name: 'PackedTokenTransferOutputData',
|
|
699
1167
|
type: {
|
|
700
1168
|
kind: 'struct',
|
|
701
1169
|
fields: [
|
|
702
1170
|
{
|
|
703
|
-
name: '
|
|
704
|
-
type: '
|
|
705
|
-
},
|
|
706
|
-
{
|
|
707
|
-
name: 'delegateIndex',
|
|
708
|
-
type: {
|
|
709
|
-
option: 'u8',
|
|
710
|
-
},
|
|
1171
|
+
name: 'owner',
|
|
1172
|
+
type: 'publicKey',
|
|
711
1173
|
},
|
|
712
1174
|
{
|
|
713
|
-
name: '
|
|
714
|
-
type:
|
|
715
|
-
option: 'u64',
|
|
716
|
-
},
|
|
1175
|
+
name: 'amount',
|
|
1176
|
+
type: 'u64',
|
|
717
1177
|
},
|
|
718
1178
|
{
|
|
719
|
-
name: '
|
|
1179
|
+
name: 'lamports',
|
|
720
1180
|
type: {
|
|
721
1181
|
option: 'u64',
|
|
722
1182
|
},
|
|
723
1183
|
},
|
|
724
1184
|
{
|
|
725
|
-
name: '
|
|
726
|
-
type:
|
|
727
|
-
defined: 'PackedMerkleContext',
|
|
728
|
-
},
|
|
1185
|
+
name: 'merkleTreeIndex',
|
|
1186
|
+
type: 'u8',
|
|
729
1187
|
},
|
|
730
1188
|
],
|
|
731
1189
|
},
|
|
732
1190
|
},
|
|
733
1191
|
{
|
|
734
|
-
name: '
|
|
1192
|
+
name: 'PublicTransactionEvent',
|
|
735
1193
|
type: {
|
|
736
1194
|
kind: 'struct',
|
|
737
1195
|
fields: [
|
|
738
1196
|
{
|
|
739
|
-
name: '
|
|
1197
|
+
name: 'inputCompressedAccountHashes',
|
|
740
1198
|
type: {
|
|
741
|
-
|
|
742
|
-
|
|
1199
|
+
vec: {
|
|
1200
|
+
array: ['u8', 32],
|
|
743
1201
|
},
|
|
744
1202
|
},
|
|
745
1203
|
},
|
|
746
1204
|
{
|
|
747
|
-
name: '
|
|
1205
|
+
name: 'outputCompressedAccountHashes',
|
|
748
1206
|
type: {
|
|
749
|
-
vec:
|
|
1207
|
+
vec: {
|
|
1208
|
+
array: ['u8', 32],
|
|
1209
|
+
},
|
|
750
1210
|
},
|
|
751
1211
|
},
|
|
752
1212
|
{
|
|
753
|
-
name: '
|
|
754
|
-
type: 'publicKey',
|
|
755
|
-
},
|
|
756
|
-
{
|
|
757
|
-
name: 'signerIsDelegate',
|
|
758
|
-
type: 'bool',
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
name: 'inputTokenDataWithContext',
|
|
1213
|
+
name: 'outputCompressedAccounts',
|
|
762
1214
|
type: {
|
|
763
1215
|
vec: {
|
|
764
|
-
defined: '
|
|
1216
|
+
defined: 'OutputCompressedAccountWithPackedContext',
|
|
765
1217
|
},
|
|
766
1218
|
},
|
|
767
1219
|
},
|
|
768
1220
|
{
|
|
769
|
-
name: '
|
|
1221
|
+
name: 'outputLeafIndices',
|
|
1222
|
+
type: {
|
|
1223
|
+
vec: 'u32',
|
|
1224
|
+
},
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
name: 'sequenceNumbers',
|
|
770
1228
|
type: {
|
|
771
1229
|
vec: {
|
|
772
|
-
defined: '
|
|
1230
|
+
defined: 'MerkleTreeSequenceNumber',
|
|
773
1231
|
},
|
|
774
1232
|
},
|
|
775
1233
|
},
|
|
776
1234
|
{
|
|
777
|
-
name: '
|
|
778
|
-
type:
|
|
1235
|
+
name: 'relayFee',
|
|
1236
|
+
type: {
|
|
1237
|
+
option: 'u64',
|
|
1238
|
+
},
|
|
779
1239
|
},
|
|
780
1240
|
{
|
|
781
1241
|
name: 'isCompress',
|
|
782
1242
|
type: 'bool',
|
|
783
1243
|
},
|
|
784
1244
|
{
|
|
785
|
-
name: '
|
|
1245
|
+
name: 'compressOrDecompressLamports',
|
|
786
1246
|
type: {
|
|
787
1247
|
option: 'u64',
|
|
788
1248
|
},
|
|
789
1249
|
},
|
|
790
1250
|
{
|
|
791
|
-
name: '
|
|
1251
|
+
name: 'pubkeyArray',
|
|
792
1252
|
type: {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
1253
|
+
vec: 'publicKey',
|
|
1254
|
+
},
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
name: 'message',
|
|
1258
|
+
type: {
|
|
1259
|
+
option: 'bytes',
|
|
796
1260
|
},
|
|
797
1261
|
},
|
|
798
1262
|
],
|
|
799
1263
|
},
|
|
800
1264
|
},
|
|
801
1265
|
{
|
|
802
|
-
name: '
|
|
1266
|
+
name: 'RolloverMetadata',
|
|
803
1267
|
type: {
|
|
804
1268
|
kind: 'struct',
|
|
805
1269
|
fields: [
|
|
806
1270
|
{
|
|
807
|
-
name: '
|
|
808
|
-
|
|
1271
|
+
name: 'index',
|
|
1272
|
+
docs: ['Unique index.'],
|
|
1273
|
+
type: 'u64',
|
|
809
1274
|
},
|
|
810
1275
|
{
|
|
811
|
-
name: '
|
|
1276
|
+
name: 'rolloverFee',
|
|
1277
|
+
docs: [
|
|
1278
|
+
'This fee is used for rent for the next account.',
|
|
1279
|
+
'It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over',
|
|
1280
|
+
],
|
|
812
1281
|
type: 'u64',
|
|
813
1282
|
},
|
|
814
1283
|
{
|
|
815
|
-
name: '
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
1284
|
+
name: 'rolloverThreshold',
|
|
1285
|
+
docs: [
|
|
1286
|
+
'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).',
|
|
1287
|
+
],
|
|
1288
|
+
type: 'u64',
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
name: 'networkFee',
|
|
1292
|
+
docs: ['Tip for maintaining the account.'],
|
|
1293
|
+
type: 'u64',
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
name: 'rolledoverSlot',
|
|
1297
|
+
docs: [
|
|
1298
|
+
'The slot when the account was rolled over, a rolled over account should not be written to.',
|
|
1299
|
+
],
|
|
1300
|
+
type: 'u64',
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
name: 'closeThreshold',
|
|
1304
|
+
docs: [
|
|
1305
|
+
'If current slot is greater than rolledover_slot + close_threshold and',
|
|
1306
|
+
"the account is empty it can be closed. No 'close' functionality has been",
|
|
1307
|
+
'implemented yet.',
|
|
1308
|
+
],
|
|
1309
|
+
type: 'u64',
|
|
819
1310
|
},
|
|
820
1311
|
],
|
|
821
1312
|
},
|
|
@@ -869,78 +1360,6 @@ const IDL = {
|
|
|
869
1360
|
option: 'u64',
|
|
870
1361
|
},
|
|
871
1362
|
},
|
|
872
|
-
{
|
|
873
|
-
name: 'delegatedAmount',
|
|
874
|
-
docs: ['The amount delegated'],
|
|
875
|
-
type: 'u64',
|
|
876
|
-
},
|
|
877
|
-
],
|
|
878
|
-
},
|
|
879
|
-
},
|
|
880
|
-
{
|
|
881
|
-
name: 'AccountState',
|
|
882
|
-
type: {
|
|
883
|
-
kind: 'enum',
|
|
884
|
-
variants: [
|
|
885
|
-
{
|
|
886
|
-
name: 'Initialized',
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
name: 'Frozen',
|
|
890
|
-
},
|
|
891
|
-
],
|
|
892
|
-
},
|
|
893
|
-
},
|
|
894
|
-
{
|
|
895
|
-
name: 'ErrorCode',
|
|
896
|
-
type: {
|
|
897
|
-
kind: 'enum',
|
|
898
|
-
variants: [
|
|
899
|
-
{
|
|
900
|
-
name: 'PublicKeyAmountMissmatch',
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
name: 'MissingNewAuthorityPda',
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
name: 'SignerCheckFailed',
|
|
907
|
-
},
|
|
908
|
-
{
|
|
909
|
-
name: 'MintCheckFailed',
|
|
910
|
-
},
|
|
911
|
-
{
|
|
912
|
-
name: 'ComputeInputSumFailed',
|
|
913
|
-
},
|
|
914
|
-
{
|
|
915
|
-
name: 'ComputeOutputSumFailed',
|
|
916
|
-
},
|
|
917
|
-
{
|
|
918
|
-
name: 'ComputeCompressSumFailed',
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
name: 'ComputeDecompressSumFailed',
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
name: 'SumCheckFailed',
|
|
925
|
-
},
|
|
926
|
-
{
|
|
927
|
-
name: 'DecompressRecipientUndefinedForDecompress',
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
name: 'CompressedPdaUndefinedForDecompress',
|
|
931
|
-
},
|
|
932
|
-
{
|
|
933
|
-
name: 'DeCompressAmountUndefinedForDecompress',
|
|
934
|
-
},
|
|
935
|
-
{
|
|
936
|
-
name: 'CompressedPdaUndefinedForCompress',
|
|
937
|
-
},
|
|
938
|
-
{
|
|
939
|
-
name: 'DeCompressAmountUndefinedForCompress',
|
|
940
|
-
},
|
|
941
|
-
{
|
|
942
|
-
name: 'DelegateUndefined',
|
|
943
|
-
},
|
|
944
1363
|
],
|
|
945
1364
|
},
|
|
946
1365
|
},
|
|
@@ -948,13 +1367,108 @@ const IDL = {
|
|
|
948
1367
|
errors: [
|
|
949
1368
|
{
|
|
950
1369
|
code: 6000,
|
|
951
|
-
name: '
|
|
952
|
-
msg: '
|
|
1370
|
+
name: 'PublicKeyAmountMissmatch',
|
|
1371
|
+
msg: 'public keys and amounts must be of same length',
|
|
953
1372
|
},
|
|
954
1373
|
{
|
|
955
1374
|
code: 6001,
|
|
956
|
-
name: '
|
|
957
|
-
msg: '
|
|
1375
|
+
name: 'SignerCheckFailed',
|
|
1376
|
+
msg: 'SignerCheckFailed',
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
code: 6002,
|
|
1380
|
+
name: 'ComputeInputSumFailed',
|
|
1381
|
+
msg: 'ComputeInputSumFailed',
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
code: 6003,
|
|
1385
|
+
name: 'ComputeOutputSumFailed',
|
|
1386
|
+
msg: 'ComputeOutputSumFailed',
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
code: 6004,
|
|
1390
|
+
name: 'ComputeCompressSumFailed',
|
|
1391
|
+
msg: 'ComputeCompressSumFailed',
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
code: 6005,
|
|
1395
|
+
name: 'ComputeDecompressSumFailed',
|
|
1396
|
+
msg: 'ComputeDecompressSumFailed',
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
code: 6006,
|
|
1400
|
+
name: 'SumCheckFailed',
|
|
1401
|
+
msg: 'SumCheckFailed',
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
code: 6007,
|
|
1405
|
+
name: 'DecompressRecipientUndefinedForDecompress',
|
|
1406
|
+
msg: 'DecompressRecipientUndefinedForDecompress',
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
code: 6008,
|
|
1410
|
+
name: 'CompressedPdaUndefinedForDecompress',
|
|
1411
|
+
msg: 'CompressedPdaUndefinedForDecompress',
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
code: 6009,
|
|
1415
|
+
name: 'DeCompressAmountUndefinedForDecompress',
|
|
1416
|
+
msg: 'DeCompressAmountUndefinedForDecompress',
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
code: 6010,
|
|
1420
|
+
name: 'CompressedPdaUndefinedForCompress',
|
|
1421
|
+
msg: 'CompressedPdaUndefinedForCompress',
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
code: 6011,
|
|
1425
|
+
name: 'DeCompressAmountUndefinedForCompress',
|
|
1426
|
+
msg: 'DeCompressAmountUndefinedForCompress',
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
code: 6012,
|
|
1430
|
+
name: 'DelegateUndefined',
|
|
1431
|
+
msg: 'DelegateUndefined while delegated amount is defined',
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
code: 6013,
|
|
1435
|
+
name: 'DelegateSignerCheckFailed',
|
|
1436
|
+
msg: 'DelegateSignerCheckFailed',
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
code: 6014,
|
|
1440
|
+
name: 'SplTokenSupplyMismatch',
|
|
1441
|
+
msg: 'SplTokenSupplyMismatch',
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
code: 6015,
|
|
1445
|
+
name: 'HeapMemoryCheckFailed',
|
|
1446
|
+
msg: 'HeapMemoryCheckFailed',
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
code: 6016,
|
|
1450
|
+
name: 'InstructionNotCallable',
|
|
1451
|
+
msg: 'The instruction is not callable',
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
code: 6017,
|
|
1455
|
+
name: 'ArithmeticUnderflow',
|
|
1456
|
+
msg: 'ArithmeticUnderflow',
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
code: 6018,
|
|
1460
|
+
name: 'InvalidDelegate',
|
|
1461
|
+
msg: 'InvalidDelegate',
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
code: 6019,
|
|
1465
|
+
name: 'HashToFieldError',
|
|
1466
|
+
msg: 'HashToFieldError',
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
code: 6020,
|
|
1470
|
+
name: 'InvalidMint',
|
|
1471
|
+
msg: 'InvalidMint',
|
|
958
1472
|
},
|
|
959
1473
|
],
|
|
960
1474
|
};
|
|
@@ -964,7 +1478,7 @@ const IDL = {
|
|
|
964
1478
|
* Packs Compressed Token Accounts.
|
|
965
1479
|
*/
|
|
966
1480
|
function packCompressedTokenAccounts(params) {
|
|
967
|
-
const { inputCompressedTokenAccounts,
|
|
1481
|
+
const { inputCompressedTokenAccounts, outputStateTrees, remainingAccounts = [], rootIndices, tokenTransferOutputs, } = params;
|
|
968
1482
|
const _remainingAccounts = remainingAccounts.slice();
|
|
969
1483
|
let delegateIndex = null;
|
|
970
1484
|
if (inputCompressedTokenAccounts.length > 0 &&
|
|
@@ -975,29 +1489,35 @@ function packCompressedTokenAccounts(params) {
|
|
|
975
1489
|
/// Currently just packs 'delegate' to pubkeyArray
|
|
976
1490
|
const packedInputTokenData = [];
|
|
977
1491
|
/// pack inputs
|
|
978
|
-
inputCompressedTokenAccounts.forEach((account) => {
|
|
1492
|
+
inputCompressedTokenAccounts.forEach((account, index) => {
|
|
979
1493
|
const merkleTreePubkeyIndex = stateless_js.getIndexOrAdd(_remainingAccounts, account.compressedAccount.merkleTree);
|
|
980
1494
|
const nullifierQueuePubkeyIndex = stateless_js.getIndexOrAdd(_remainingAccounts, account.compressedAccount.nullifierQueue);
|
|
981
1495
|
packedInputTokenData.push({
|
|
982
1496
|
amount: account.parsed.amount,
|
|
983
1497
|
delegateIndex,
|
|
984
|
-
delegatedAmount: account.parsed.delegatedAmount.eq(stateless_js.bn(0))
|
|
985
|
-
? null
|
|
986
|
-
: account.parsed.delegatedAmount,
|
|
987
1498
|
isNative: account.parsed.isNative,
|
|
988
1499
|
merkleContext: {
|
|
989
1500
|
merkleTreePubkeyIndex,
|
|
990
1501
|
nullifierQueuePubkeyIndex,
|
|
991
1502
|
leafIndex: account.compressedAccount.leafIndex,
|
|
992
1503
|
},
|
|
1504
|
+
rootIndex: rootIndices[index],
|
|
993
1505
|
});
|
|
994
1506
|
});
|
|
995
1507
|
/// pack output state trees
|
|
996
|
-
const paddedOutputStateMerkleTrees = stateless_js.padOutputStateMerkleTrees(outputStateTrees,
|
|
997
|
-
const
|
|
998
|
-
paddedOutputStateMerkleTrees.forEach(account => {
|
|
999
|
-
|
|
1000
|
-
|
|
1508
|
+
const paddedOutputStateMerkleTrees = stateless_js.padOutputStateMerkleTrees(outputStateTrees, tokenTransferOutputs.length, inputCompressedTokenAccounts.map(acc => acc.compressedAccount));
|
|
1509
|
+
const packedOutputTokenData = [];
|
|
1510
|
+
paddedOutputStateMerkleTrees.forEach((account, index) => {
|
|
1511
|
+
var _a;
|
|
1512
|
+
const merkleTreeIndex = stateless_js.getIndexOrAdd(_remainingAccounts, account);
|
|
1513
|
+
packedOutputTokenData.push({
|
|
1514
|
+
owner: tokenTransferOutputs[index].owner,
|
|
1515
|
+
amount: tokenTransferOutputs[index].amount,
|
|
1516
|
+
lamports: ((_a = tokenTransferOutputs[index].lamports) === null || _a === void 0 ? void 0 : _a.eq(stateless_js.bn(0)))
|
|
1517
|
+
? null
|
|
1518
|
+
: tokenTransferOutputs[index].lamports,
|
|
1519
|
+
merkleTreeIndex,
|
|
1520
|
+
});
|
|
1001
1521
|
});
|
|
1002
1522
|
// to meta
|
|
1003
1523
|
const remainingAccountMetas = _remainingAccounts.map((account) => ({
|
|
@@ -1007,14 +1527,13 @@ function packCompressedTokenAccounts(params) {
|
|
|
1007
1527
|
}));
|
|
1008
1528
|
return {
|
|
1009
1529
|
inputTokenDataWithContext: packedInputTokenData,
|
|
1010
|
-
outputStateMerkleTreeIndices,
|
|
1011
1530
|
remainingAccountMetas,
|
|
1531
|
+
packedOutputTokenData,
|
|
1012
1532
|
};
|
|
1013
1533
|
}
|
|
1014
1534
|
|
|
1015
1535
|
const POOL_SEED = Buffer.from('pool');
|
|
1016
1536
|
const CPI_AUTHORITY_SEED = Buffer.from('cpi_authority');
|
|
1017
|
-
const MINT_AUTHORITY_SEED = anchor.utils.bytes.utf8.encode('mint_authority_pda');
|
|
1018
1537
|
const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
|
|
1019
1538
|
|
|
1020
1539
|
/** Address of the SPL Token program */
|
|
@@ -3850,7 +4369,6 @@ function createMintToInstruction(mint, destination, authority, amount, multiSign
|
|
|
3850
4369
|
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
3851
4370
|
}
|
|
3852
4371
|
|
|
3853
|
-
var _a;
|
|
3854
4372
|
/**
|
|
3855
4373
|
* Sum up the token amounts of the compressed token accounts
|
|
3856
4374
|
*/
|
|
@@ -3997,59 +4515,32 @@ class CompressedTokenProgram {
|
|
|
3997
4515
|
programId: TOKEN_PROGRAM_ID,
|
|
3998
4516
|
space: MINT_SIZE,
|
|
3999
4517
|
});
|
|
4000
|
-
const
|
|
4001
|
-
const
|
|
4002
|
-
/// Fund the mint authority PDA. The authority is system-owned in order
|
|
4003
|
-
/// to natively mint compressed tokens.
|
|
4004
|
-
const fundAuthorityPdaInstruction = web3_js.SystemProgram.transfer({
|
|
4005
|
-
fromPubkey: feePayer,
|
|
4006
|
-
toPubkey: mintAuthorityPda,
|
|
4007
|
-
lamports: rentExemptBalance,
|
|
4008
|
-
});
|
|
4009
|
-
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
4010
|
-
/// Create omnibus compressed mint account
|
|
4011
|
-
const ix = await this.program.methods
|
|
4012
|
-
.createMint()
|
|
4013
|
-
.accounts({
|
|
4014
|
-
mint,
|
|
4518
|
+
const initializeMintInstruction = createInitializeMint2Instruction(mint, params.decimals, authority, params.freezeAuthority, TOKEN_PROGRAM_ID);
|
|
4519
|
+
const ix = await this.registerMint({
|
|
4015
4520
|
feePayer,
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
mintAuthorityPda,
|
|
4020
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
4021
|
-
cpiAuthorityPda: this.deriveCpiAuthorityPda,
|
|
4022
|
-
})
|
|
4023
|
-
.instruction();
|
|
4024
|
-
return [
|
|
4025
|
-
createMintAccountInstruction,
|
|
4026
|
-
initializeMintInstruction,
|
|
4027
|
-
fundAuthorityPdaInstruction,
|
|
4028
|
-
ix,
|
|
4029
|
-
];
|
|
4521
|
+
mint,
|
|
4522
|
+
});
|
|
4523
|
+
return [createMintAccountInstruction, initializeMintInstruction, ix];
|
|
4030
4524
|
}
|
|
4031
4525
|
/**
|
|
4032
4526
|
* Enable compression for an existing SPL mint, creating an omnibus account.
|
|
4033
4527
|
* For new mints, use `CompressedTokenProgram.createMint`.
|
|
4034
4528
|
*/
|
|
4035
4529
|
static async registerMint(params) {
|
|
4036
|
-
const { mint,
|
|
4037
|
-
const [mintAuthorityPda] = this.deriveMintAuthorityPda(authority, mint);
|
|
4530
|
+
const { mint, feePayer } = params;
|
|
4038
4531
|
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
4039
4532
|
const ix = await this.program.methods
|
|
4040
4533
|
.createMint()
|
|
4041
4534
|
.accounts({
|
|
4042
4535
|
mint,
|
|
4043
4536
|
feePayer,
|
|
4044
|
-
authority,
|
|
4045
4537
|
tokenPoolPda,
|
|
4046
4538
|
systemProgram: web3_js.SystemProgram.programId,
|
|
4047
|
-
mintAuthorityPda,
|
|
4048
4539
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
4049
4540
|
cpiAuthorityPda: this.deriveCpiAuthorityPda,
|
|
4050
4541
|
})
|
|
4051
4542
|
.instruction();
|
|
4052
|
-
return
|
|
4543
|
+
return ix;
|
|
4053
4544
|
}
|
|
4054
4545
|
/**
|
|
4055
4546
|
* Construct mintTo instruction for compressed tokens
|
|
@@ -4058,15 +4549,14 @@ class CompressedTokenProgram {
|
|
|
4058
4549
|
const systemKeys = stateless_js.defaultStaticAccountsStruct();
|
|
4059
4550
|
const { mint, feePayer, authority, merkleTree, toPubkey, amount } = params;
|
|
4060
4551
|
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
4061
|
-
const [mintAuthorityPda, bump] = this.deriveMintAuthorityPda(authority, mint);
|
|
4062
4552
|
const amounts = stateless_js.toArray(amount).map(amount => stateless_js.bn(amount));
|
|
4063
4553
|
const toPubkeys = stateless_js.toArray(toPubkey);
|
|
4064
4554
|
const instruction = await this.program.methods
|
|
4065
|
-
.mintTo(toPubkeys, amounts
|
|
4555
|
+
.mintTo(toPubkeys, amounts)
|
|
4066
4556
|
.accounts({
|
|
4067
4557
|
feePayer,
|
|
4068
4558
|
authority,
|
|
4069
|
-
|
|
4559
|
+
cpiAuthorityPda: this.deriveCpiAuthorityPda,
|
|
4070
4560
|
mint,
|
|
4071
4561
|
tokenPoolPda,
|
|
4072
4562
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
@@ -4075,7 +4565,7 @@ class CompressedTokenProgram {
|
|
|
4075
4565
|
noopProgram: systemKeys.noopProgram,
|
|
4076
4566
|
accountCompressionAuthority: systemKeys.accountCompressionAuthority,
|
|
4077
4567
|
accountCompressionProgram: systemKeys.accountCompressionProgram,
|
|
4078
|
-
merkleTree,
|
|
4568
|
+
merkleTree: merkleTree !== null && merkleTree !== void 0 ? merkleTree : stateless_js.defaultTestStateTreeAccounts().merkleTree,
|
|
4079
4569
|
selfProgram: this.programId,
|
|
4080
4570
|
})
|
|
4081
4571
|
.instruction();
|
|
@@ -4088,43 +4578,40 @@ class CompressedTokenProgram {
|
|
|
4088
4578
|
static async approveAndMintTo(params) {
|
|
4089
4579
|
const { mint, feePayer, authorityTokenAccount, authority, merkleTree, toPubkey, } = params;
|
|
4090
4580
|
const amount = BigInt(params.amount.toString());
|
|
4091
|
-
/// 1. Mint to
|
|
4581
|
+
/// 1. Mint to existing ATA of mintAuthority.
|
|
4092
4582
|
const splMintToInstruction = createMintToInstruction(mint, authorityTokenAccount, authority, amount);
|
|
4093
|
-
/// 2.
|
|
4094
|
-
const approveInstruction =
|
|
4095
|
-
/// 3. Compress from mint authority ATA to recipient compressed account
|
|
4096
|
-
const ixs = await this.compress({
|
|
4583
|
+
/// 2. Compress from mint authority ATA to recipient compressed account
|
|
4584
|
+
const [approveInstruction, compressInstruction] = await this.compress({
|
|
4097
4585
|
payer: feePayer,
|
|
4098
4586
|
owner: authority,
|
|
4099
4587
|
source: authorityTokenAccount,
|
|
4100
4588
|
toAddress: toPubkey,
|
|
4101
4589
|
mint,
|
|
4102
|
-
amount:
|
|
4590
|
+
amount: params.amount,
|
|
4103
4591
|
outputStateTree: merkleTree,
|
|
4104
4592
|
});
|
|
4105
|
-
return [splMintToInstruction, approveInstruction,
|
|
4593
|
+
return [splMintToInstruction, approveInstruction, compressInstruction];
|
|
4106
4594
|
}
|
|
4107
4595
|
/**
|
|
4108
4596
|
* Construct transfer instruction for compressed tokens
|
|
4109
4597
|
*/
|
|
4110
4598
|
static async transfer(params) {
|
|
4111
4599
|
const { payer, inputCompressedTokenAccounts, recentInputStateRootIndices, recentValidityProof, amount, outputStateTrees, toAddress, } = params;
|
|
4112
|
-
const
|
|
4113
|
-
const { inputTokenDataWithContext,
|
|
4600
|
+
const tokenTransferOutputs = createTransferOutputState(inputCompressedTokenAccounts, toAddress, amount);
|
|
4601
|
+
const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
|
|
4114
4602
|
inputCompressedTokenAccounts,
|
|
4115
|
-
outputCompressedAccountsLength: outputCompressedAccounts.length,
|
|
4116
4603
|
outputStateTrees,
|
|
4604
|
+
rootIndices: recentInputStateRootIndices,
|
|
4605
|
+
tokenTransferOutputs,
|
|
4117
4606
|
});
|
|
4118
4607
|
const { mint, currentOwner } = parseTokenData(inputCompressedTokenAccounts);
|
|
4119
4608
|
const data = {
|
|
4120
4609
|
proof: recentValidityProof,
|
|
4121
|
-
rootIndices: recentInputStateRootIndices,
|
|
4122
4610
|
mint,
|
|
4123
|
-
|
|
4611
|
+
delegatedTransfer: null, // TODO: implement
|
|
4124
4612
|
inputTokenDataWithContext,
|
|
4125
|
-
outputCompressedAccounts,
|
|
4126
|
-
|
|
4127
|
-
compressionAmount: null,
|
|
4613
|
+
outputCompressedAccounts: packedOutputTokenData,
|
|
4614
|
+
compressOrDecompressAmount: null,
|
|
4128
4615
|
isCompress: false,
|
|
4129
4616
|
cpiContext: null,
|
|
4130
4617
|
};
|
|
@@ -4143,7 +4630,7 @@ class CompressedTokenProgram {
|
|
|
4143
4630
|
accountCompressionProgram: accountCompressionProgram,
|
|
4144
4631
|
selfProgram: this.programId,
|
|
4145
4632
|
tokenPoolPda: null,
|
|
4146
|
-
|
|
4633
|
+
compressOrDecompressTokenAccount: null,
|
|
4147
4634
|
tokenProgram: null,
|
|
4148
4635
|
})
|
|
4149
4636
|
.remainingAccounts(remainingAccountMetas)
|
|
@@ -4157,27 +4644,26 @@ class CompressedTokenProgram {
|
|
|
4157
4644
|
static async compress(params) {
|
|
4158
4645
|
const { payer, owner, source, toAddress, mint, outputStateTree } = params;
|
|
4159
4646
|
const amount = stateless_js.bn(params.amount);
|
|
4160
|
-
const
|
|
4647
|
+
const tokenTransferOutputs = [
|
|
4161
4648
|
{
|
|
4162
4649
|
owner: toAddress,
|
|
4163
4650
|
amount,
|
|
4164
4651
|
lamports: stateless_js.bn(0),
|
|
4165
4652
|
},
|
|
4166
4653
|
];
|
|
4167
|
-
const { inputTokenDataWithContext,
|
|
4654
|
+
const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
|
|
4168
4655
|
inputCompressedTokenAccounts: [],
|
|
4169
|
-
|
|
4170
|
-
|
|
4656
|
+
outputStateTrees: outputStateTree,
|
|
4657
|
+
rootIndices: [],
|
|
4658
|
+
tokenTransferOutputs,
|
|
4171
4659
|
});
|
|
4172
4660
|
const data = {
|
|
4173
4661
|
proof: null,
|
|
4174
|
-
rootIndices: [],
|
|
4175
4662
|
mint,
|
|
4176
|
-
|
|
4663
|
+
delegatedTransfer: null, // TODO: implement
|
|
4177
4664
|
inputTokenDataWithContext,
|
|
4178
|
-
outputCompressedAccounts,
|
|
4179
|
-
|
|
4180
|
-
compressionAmount: amount,
|
|
4665
|
+
outputCompressedAccounts: packedOutputTokenData,
|
|
4666
|
+
compressOrDecompressAmount: amount,
|
|
4181
4667
|
isCompress: true,
|
|
4182
4668
|
cpiContext: null,
|
|
4183
4669
|
};
|
|
@@ -4197,7 +4683,7 @@ class CompressedTokenProgram {
|
|
|
4197
4683
|
accountCompressionProgram: accountCompressionProgram,
|
|
4198
4684
|
selfProgram: this.programId,
|
|
4199
4685
|
tokenPoolPda: this.deriveTokenPoolPda(mint),
|
|
4200
|
-
|
|
4686
|
+
compressOrDecompressTokenAccount: source, // token
|
|
4201
4687
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
4202
4688
|
})
|
|
4203
4689
|
.remainingAccounts(remainingAccountMetas)
|
|
@@ -4212,21 +4698,20 @@ class CompressedTokenProgram {
|
|
|
4212
4698
|
const amount = stateless_js.bn(params.amount);
|
|
4213
4699
|
const tokenTransferOutputs = createDecompressOutputState(inputCompressedTokenAccounts, amount);
|
|
4214
4700
|
/// Pack
|
|
4215
|
-
const { inputTokenDataWithContext,
|
|
4701
|
+
const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
|
|
4216
4702
|
inputCompressedTokenAccounts,
|
|
4217
|
-
|
|
4218
|
-
|
|
4703
|
+
outputStateTrees: outputStateTree,
|
|
4704
|
+
rootIndices: recentInputStateRootIndices,
|
|
4705
|
+
tokenTransferOutputs: tokenTransferOutputs,
|
|
4219
4706
|
});
|
|
4220
4707
|
const { mint, currentOwner } = parseTokenData(inputCompressedTokenAccounts);
|
|
4221
4708
|
const data = {
|
|
4222
4709
|
proof: recentValidityProof,
|
|
4223
|
-
rootIndices: recentInputStateRootIndices,
|
|
4224
4710
|
mint,
|
|
4225
|
-
|
|
4711
|
+
delegatedTransfer: null, // TODO: implement
|
|
4226
4712
|
inputTokenDataWithContext,
|
|
4227
|
-
outputCompressedAccounts:
|
|
4228
|
-
|
|
4229
|
-
compressionAmount: amount,
|
|
4713
|
+
outputCompressedAccounts: packedOutputTokenData,
|
|
4714
|
+
compressOrDecompressAmount: amount,
|
|
4230
4715
|
isCompress: false,
|
|
4231
4716
|
cpiContext: null,
|
|
4232
4717
|
};
|
|
@@ -4245,7 +4730,7 @@ class CompressedTokenProgram {
|
|
|
4245
4730
|
accountCompressionProgram: accountCompressionProgram,
|
|
4246
4731
|
selfProgram: this.programId,
|
|
4247
4732
|
tokenPoolPda: this.deriveTokenPoolPda(mint),
|
|
4248
|
-
|
|
4733
|
+
compressOrDecompressTokenAccount: toAddress,
|
|
4249
4734
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
4250
4735
|
})
|
|
4251
4736
|
.remainingAccounts(remainingAccountMetas)
|
|
@@ -4253,16 +4738,11 @@ class CompressedTokenProgram {
|
|
|
4253
4738
|
return instruction;
|
|
4254
4739
|
}
|
|
4255
4740
|
}
|
|
4256
|
-
_a = CompressedTokenProgram;
|
|
4257
4741
|
/**
|
|
4258
4742
|
* Public key that identifies the CompressedPda program
|
|
4259
4743
|
*/
|
|
4260
|
-
CompressedTokenProgram.programId = new web3_js.PublicKey('
|
|
4744
|
+
CompressedTokenProgram.programId = new web3_js.PublicKey('HXVfQ44ATEi9WBKLSCCwM54KokdkzqXci9xCQ7ST9SYN');
|
|
4261
4745
|
CompressedTokenProgram._program = null;
|
|
4262
|
-
/** @internal */
|
|
4263
|
-
CompressedTokenProgram.deriveMintAuthorityPda = (authority, mint) => {
|
|
4264
|
-
return web3_js.PublicKey.findProgramAddressSync([MINT_AUTHORITY_SEED, authority.toBuffer(), mint.toBuffer()], _a.programId);
|
|
4265
|
-
};
|
|
4266
4746
|
|
|
4267
4747
|
/**
|
|
4268
4748
|
* Mint compressed tokens to a solana address from an external mint authority
|
|
@@ -4279,7 +4759,7 @@ CompressedTokenProgram.deriveMintAuthorityPda = (authority, mint) => {
|
|
|
4279
4759
|
*
|
|
4280
4760
|
* @return Signature of the confirmed transaction
|
|
4281
4761
|
*/
|
|
4282
|
-
async function approveAndMintTo(rpc, payer, mint, destination, authority, amount, merkleTree
|
|
4762
|
+
async function approveAndMintTo(rpc, payer, mint, destination, authority, amount, merkleTree, confirmOptions) {
|
|
4283
4763
|
const authorityTokenAccount = await getOrCreateAssociatedTokenAccount(rpc, payer, mint, authority.publicKey);
|
|
4284
4764
|
const ixs = await CompressedTokenProgram.approveAndMintTo({
|
|
4285
4765
|
feePayer: payer.publicKey,
|
|
@@ -4318,7 +4798,7 @@ async function approveAndMintTo(rpc, payer, mint, destination, authority, amount
|
|
|
4318
4798
|
*
|
|
4319
4799
|
* @return Signature of the confirmed transaction
|
|
4320
4800
|
*/
|
|
4321
|
-
async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree
|
|
4801
|
+
async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree, confirmOptions) {
|
|
4322
4802
|
amount = stateless_js.bn(amount);
|
|
4323
4803
|
const [approveIx, compressIx] = await CompressedTokenProgram.compress({
|
|
4324
4804
|
payer: payer.publicKey,
|
|
@@ -4352,7 +4832,8 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
|
|
|
4352
4832
|
* @param owner Owner of the compressed tokens
|
|
4353
4833
|
* @param toAddress Destination address of the recipient
|
|
4354
4834
|
* @param merkleTree State tree account that the compressed tokens should be
|
|
4355
|
-
* inserted into. Defaults to the default state tree
|
|
4835
|
+
* inserted into. Defaults to the default state tree
|
|
4836
|
+
* account.
|
|
4356
4837
|
* @param confirmOptions Options for confirming the transaction
|
|
4357
4838
|
*
|
|
4358
4839
|
*
|
|
@@ -4360,7 +4841,7 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
|
|
|
4360
4841
|
*/
|
|
4361
4842
|
async function transfer(rpc, payer, mint, amount, owner, toAddress,
|
|
4362
4843
|
/// TODO: allow multiple
|
|
4363
|
-
merkleTree
|
|
4844
|
+
merkleTree, confirmOptions) {
|
|
4364
4845
|
amount = stateless_js.bn(amount);
|
|
4365
4846
|
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(owner.publicKey, {
|
|
4366
4847
|
mint,
|
|
@@ -4431,7 +4912,7 @@ function selectMinCompressedTokenAccountsForTransfer(accounts, transferAmount) {
|
|
|
4431
4912
|
*/
|
|
4432
4913
|
async function decompress(rpc, payer, mint, amount, owner, toAddress,
|
|
4433
4914
|
/// TODO: allow multiple
|
|
4434
|
-
merkleTree
|
|
4915
|
+
merkleTree, confirmOptions) {
|
|
4435
4916
|
amount = stateless_js.bn(amount);
|
|
4436
4917
|
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(owner.publicKey, {
|
|
4437
4918
|
mint,
|
|
@@ -4460,7 +4941,7 @@ merkleTree = stateless_js.defaultTestStateTreeAccounts().merkleTree, confirmOpti
|
|
|
4460
4941
|
*
|
|
4461
4942
|
* @param rpc RPC to use
|
|
4462
4943
|
* @param payer Payer of the transaction and initialization fees
|
|
4463
|
-
* @param mintAuthority Account or multisig that will control minting
|
|
4944
|
+
* @param mintAuthority Account or multisig that will control minting
|
|
4464
4945
|
* @param decimals Location of the decimal place
|
|
4465
4946
|
* @param keypair Optional keypair, defaulting to a new random one
|
|
4466
4947
|
* @param confirmOptions Options for confirming the transaction
|
|
@@ -4473,12 +4954,12 @@ async function createMint(rpc, payer, mintAuthority, decimals, keypair = web3_js
|
|
|
4473
4954
|
feePayer: payer.publicKey,
|
|
4474
4955
|
mint: keypair.publicKey,
|
|
4475
4956
|
decimals,
|
|
4476
|
-
authority: mintAuthority
|
|
4957
|
+
authority: mintAuthority,
|
|
4477
4958
|
freezeAuthority: null, // TODO: add feature
|
|
4478
4959
|
rentExemptBalance,
|
|
4479
4960
|
});
|
|
4480
4961
|
const { blockhash } = await rpc.getLatestBlockhash();
|
|
4481
|
-
const additionalSigners = stateless_js.dedupeSigner(payer, [
|
|
4962
|
+
const additionalSigners = stateless_js.dedupeSigner(payer, [keypair]);
|
|
4482
4963
|
const tx = stateless_js.buildAndSignTx(ixs, payer, blockhash, additionalSigners);
|
|
4483
4964
|
const txId = await stateless_js.sendAndConfirmTx(rpc, tx, confirmOptions);
|
|
4484
4965
|
return { mint: keypair.publicKey, transactionSignature: txId };
|
|
@@ -4499,8 +4980,7 @@ async function createMint(rpc, payer, mintAuthority, decimals, keypair = web3_js
|
|
|
4499
4980
|
*
|
|
4500
4981
|
* @return Signature of the confirmed transaction
|
|
4501
4982
|
*/
|
|
4502
|
-
async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTree
|
|
4503
|
-
confirmOptions) {
|
|
4983
|
+
async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTree, confirmOptions) {
|
|
4504
4984
|
const additionalSigners = stateless_js.dedupeSigner(payer, [authority]);
|
|
4505
4985
|
const ix = await CompressedTokenProgram.mintTo({
|
|
4506
4986
|
feePayer: payer.publicKey,
|
|
@@ -4527,15 +5007,13 @@ confirmOptions) {
|
|
|
4527
5007
|
*
|
|
4528
5008
|
* @return transaction signature
|
|
4529
5009
|
*/
|
|
4530
|
-
async function registerMint(rpc, payer,
|
|
4531
|
-
const
|
|
5010
|
+
async function registerMint(rpc, payer, mintAddress, confirmOptions) {
|
|
5011
|
+
const ix = await CompressedTokenProgram.registerMint({
|
|
4532
5012
|
feePayer: payer.publicKey,
|
|
4533
5013
|
mint: mintAddress,
|
|
4534
|
-
authority: mintAuthority.publicKey,
|
|
4535
5014
|
});
|
|
4536
5015
|
const { blockhash } = await rpc.getLatestBlockhash();
|
|
4537
|
-
const
|
|
4538
|
-
const tx = stateless_js.buildAndSignTx(ixs, payer, blockhash, additionalSigners);
|
|
5016
|
+
const tx = stateless_js.buildAndSignTx([ix], payer, blockhash);
|
|
4539
5017
|
const txId = await stateless_js.sendAndConfirmTx(rpc, tx, confirmOptions);
|
|
4540
5018
|
return txId;
|
|
4541
5019
|
}
|
|
@@ -4543,7 +5021,6 @@ async function registerMint(rpc, payer, mintAuthority, mintAddress, confirmOptio
|
|
|
4543
5021
|
exports.CPI_AUTHORITY_SEED = CPI_AUTHORITY_SEED;
|
|
4544
5022
|
exports.CompressedTokenProgram = CompressedTokenProgram;
|
|
4545
5023
|
exports.IDL = IDL;
|
|
4546
|
-
exports.MINT_AUTHORITY_SEED = MINT_AUTHORITY_SEED;
|
|
4547
5024
|
exports.POOL_SEED = POOL_SEED;
|
|
4548
5025
|
exports.SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE;
|
|
4549
5026
|
exports.approveAndMintTo = approveAndMintTo;
|