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