@lightprotocol/compressed-token 0.11.0 → 0.12.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 +152 -21
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +152 -21
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +152 -21
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +114 -15
- package/package.json +21 -20
package/dist/es/browser/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { PublicKey, SystemProgram, TransactionInstruction, Transaction, sendAndC
|
|
|
3
3
|
import { AnchorProvider, setProvider, Program, BN } from '@coral-xyz/anchor';
|
|
4
4
|
|
|
5
5
|
const IDL = {
|
|
6
|
-
version: '0.
|
|
6
|
+
version: '1.0.0',
|
|
7
7
|
name: 'light_compressed_token',
|
|
8
8
|
instructions: [
|
|
9
9
|
{
|
|
@@ -1151,12 +1151,6 @@ const IDL = {
|
|
|
1151
1151
|
name: 'isCompress',
|
|
1152
1152
|
type: 'bool',
|
|
1153
1153
|
},
|
|
1154
|
-
{
|
|
1155
|
-
name: 'signerSeeds',
|
|
1156
|
-
type: {
|
|
1157
|
-
vec: 'bytes',
|
|
1158
|
-
},
|
|
1159
|
-
},
|
|
1160
1154
|
{
|
|
1161
1155
|
name: 'cpiContext',
|
|
1162
1156
|
type: {
|
|
@@ -1559,23 +1553,128 @@ const IDL = {
|
|
|
1559
1553
|
errors: [
|
|
1560
1554
|
{
|
|
1561
1555
|
code: 6000,
|
|
1562
|
-
name: '
|
|
1563
|
-
msg: '
|
|
1556
|
+
name: 'PublicKeyAmountMissmatch',
|
|
1557
|
+
msg: 'public keys and amounts must be of same length',
|
|
1564
1558
|
},
|
|
1565
1559
|
{
|
|
1566
1560
|
code: 6001,
|
|
1567
|
-
name: '
|
|
1568
|
-
msg: '
|
|
1561
|
+
name: 'ComputeInputSumFailed',
|
|
1562
|
+
msg: 'ComputeInputSumFailed',
|
|
1569
1563
|
},
|
|
1570
1564
|
{
|
|
1571
1565
|
code: 6002,
|
|
1572
|
-
name: '
|
|
1573
|
-
msg: '
|
|
1566
|
+
name: 'ComputeOutputSumFailed',
|
|
1567
|
+
msg: 'ComputeOutputSumFailed',
|
|
1574
1568
|
},
|
|
1575
1569
|
{
|
|
1576
1570
|
code: 6003,
|
|
1577
|
-
name: '
|
|
1578
|
-
msg: '
|
|
1571
|
+
name: 'ComputeCompressSumFailed',
|
|
1572
|
+
msg: 'ComputeCompressSumFailed',
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
code: 6004,
|
|
1576
|
+
name: 'ComputeDecompressSumFailed',
|
|
1577
|
+
msg: 'ComputeDecompressSumFailed',
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
code: 6005,
|
|
1581
|
+
name: 'SumCheckFailed',
|
|
1582
|
+
msg: 'SumCheckFailed',
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
code: 6006,
|
|
1586
|
+
name: 'DecompressRecipientUndefinedForDecompress',
|
|
1587
|
+
msg: 'DecompressRecipientUndefinedForDecompress',
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
code: 6007,
|
|
1591
|
+
name: 'CompressedPdaUndefinedForDecompress',
|
|
1592
|
+
msg: 'CompressedPdaUndefinedForDecompress',
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
code: 6008,
|
|
1596
|
+
name: 'DeCompressAmountUndefinedForDecompress',
|
|
1597
|
+
msg: 'DeCompressAmountUndefinedForDecompress',
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
code: 6009,
|
|
1601
|
+
name: 'CompressedPdaUndefinedForCompress',
|
|
1602
|
+
msg: 'CompressedPdaUndefinedForCompress',
|
|
1603
|
+
},
|
|
1604
|
+
{
|
|
1605
|
+
code: 6010,
|
|
1606
|
+
name: 'DeCompressAmountUndefinedForCompress',
|
|
1607
|
+
msg: 'DeCompressAmountUndefinedForCompress',
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
code: 6011,
|
|
1611
|
+
name: 'DelegateSignerCheckFailed',
|
|
1612
|
+
msg: 'DelegateSignerCheckFailed',
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
code: 6012,
|
|
1616
|
+
name: 'MintTooLarge',
|
|
1617
|
+
msg: 'Minted amount greater than u64::MAX',
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
code: 6013,
|
|
1621
|
+
name: 'SplTokenSupplyMismatch',
|
|
1622
|
+
msg: 'SplTokenSupplyMismatch',
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
code: 6014,
|
|
1626
|
+
name: 'HeapMemoryCheckFailed',
|
|
1627
|
+
msg: 'HeapMemoryCheckFailed',
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
code: 6015,
|
|
1631
|
+
name: 'InstructionNotCallable',
|
|
1632
|
+
msg: 'The instruction is not callable',
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
code: 6016,
|
|
1636
|
+
name: 'ArithmeticUnderflow',
|
|
1637
|
+
msg: 'ArithmeticUnderflow',
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
code: 6017,
|
|
1641
|
+
name: 'HashToFieldError',
|
|
1642
|
+
msg: 'HashToFieldError',
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
code: 6018,
|
|
1646
|
+
name: 'InvalidAuthorityMint',
|
|
1647
|
+
msg: 'Expected the authority to be also a mint authority',
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
code: 6019,
|
|
1651
|
+
name: 'InvalidFreezeAuthority',
|
|
1652
|
+
msg: 'Provided authority is not the freeze authority',
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
code: 6020,
|
|
1656
|
+
name: 'InvalidDelegateIndex',
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
code: 6021,
|
|
1660
|
+
name: 'TokenPoolPdaUndefined',
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
code: 6022,
|
|
1664
|
+
name: 'IsTokenPoolPda',
|
|
1665
|
+
msg: 'Compress or decompress recipient is the same account as the token pool pda.',
|
|
1666
|
+
},
|
|
1667
|
+
{
|
|
1668
|
+
code: 6023,
|
|
1669
|
+
name: 'InvalidTokenPoolPda',
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
code: 6024,
|
|
1673
|
+
name: 'NoInputTokenAccountsProvided',
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
code: 6025,
|
|
1677
|
+
name: 'NoInputsProvided',
|
|
1579
1678
|
},
|
|
1580
1679
|
],
|
|
1581
1680
|
};
|
|
@@ -3707,7 +3806,7 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_buffer);
|
|
|
3707
3806
|
* THE SOFTWARE.
|
|
3708
3807
|
*/
|
|
3709
3808
|
Object.defineProperty(Layout$1, "__esModule", { value: true });
|
|
3710
|
-
Layout$1.s16 = Layout$1.s8 = Layout$1.nu64be = Layout$1.u48be = Layout$1.u40be = Layout$1.u32be = Layout$1.u24be = Layout$1.u16be = Layout$1.nu64 = Layout$1.u48 = Layout$1.u40 = u32 = Layout$1.u32 = Layout$1.u24 = Layout$1.u16 = u8 = Layout$1.u8 = Layout$1.offset = Layout$1.greedy = Layout$1.Constant = Layout$1.UTF8 = Layout$1.CString = Layout$1.Blob = Layout$1.Boolean = Layout$1.BitField = Layout$1.BitStructure = Layout$1.VariantLayout = Layout$1.Union = Layout$1.UnionLayoutDiscriminator = Layout$1.UnionDiscriminator = Layout$1.Structure = Layout$1.Sequence = Layout$1.DoubleBE = Layout$1.Double = Layout$1.FloatBE = Layout$1.Float = Layout$1.NearInt64BE = Layout$1.NearInt64 = Layout$1.NearUInt64BE = Layout$1.NearUInt64 = Layout$1.IntBE = Layout$1.Int = Layout$1.UIntBE = Layout$1.UInt = Layout$1.OffsetLayout = Layout$1.GreedyCount = Layout$1.ExternalLayout = Layout$1.bindConstructorLayout = Layout$1.nameWithProperty = Layout$1.Layout = Layout$1.uint8ArrayToBuffer = Layout$1.checkUint8Array = void 0;
|
|
3809
|
+
Layout$1.s16 = Layout$1.s8 = Layout$1.nu64be = Layout$1.u48be = Layout$1.u40be = Layout$1.u32be = Layout$1.u24be = Layout$1.u16be = Layout$1.nu64 = Layout$1.u48 = Layout$1.u40 = u32 = Layout$1.u32 = Layout$1.u24 = Layout$1.u16 = u8 = Layout$1.u8 = Layout$1.offset = Layout$1.greedy = Layout$1.Constant = Layout$1.UTF8 = Layout$1.CString = Layout$1.Blob = Layout$1.Boolean = Layout$1.BitField = Layout$1.BitStructure = Layout$1.VariantLayout = Layout$1.Union = Layout$1.UnionLayoutDiscriminator = Layout$1.UnionDiscriminator = Layout$1.Structure = Layout$1.Sequence = Layout$1.DoubleBE = Layout$1.Double = Layout$1.FloatBE = Layout$1.Float = Layout$1.NearInt64BE = Layout$1.NearInt64 = Layout$1.NearUInt64BE = Layout$1.NearUInt64 = Layout$1.IntBE = Layout$1.Int = Layout$1.UIntBE = Layout$1.UInt = Layout$1.OffsetLayout = Layout$1.GreedyCount = Layout$1.ExternalLayout = Layout$1.bindConstructorLayout = Layout$1.nameWithProperty = Layout_2 = Layout$1.Layout = Layout$1.uint8ArrayToBuffer = Layout$1.checkUint8Array = void 0;
|
|
3711
3810
|
Layout$1.constant = Layout$1.utf8 = Layout$1.cstr = blob = Layout$1.blob = Layout$1.unionLayoutDiscriminator = Layout$1.union = Layout$1.seq = Layout$1.bits = struct = Layout$1.struct = Layout$1.f64be = Layout$1.f64 = Layout$1.f32be = Layout$1.f32 = Layout$1.ns64be = Layout$1.s48be = Layout$1.s40be = Layout$1.s32be = Layout$1.s24be = Layout$1.s16be = Layout$1.ns64 = Layout$1.s48 = Layout$1.s40 = Layout$1.s32 = Layout$1.s24 = void 0;
|
|
3712
3811
|
const buffer_1 = require$$0;
|
|
3713
3812
|
/* Check if a value is a Uint8Array.
|
|
@@ -3854,7 +3953,7 @@ class Layout {
|
|
|
3854
3953
|
return undefined;
|
|
3855
3954
|
}
|
|
3856
3955
|
}
|
|
3857
|
-
Layout$1.Layout = Layout;
|
|
3956
|
+
var Layout_2 = Layout$1.Layout = Layout;
|
|
3858
3957
|
/* Provide text that carries a name (such as for a function that will
|
|
3859
3958
|
* be throwing an error) annotated with the property of a given layout
|
|
3860
3959
|
* (such as one for which the value was unacceptable).
|
|
@@ -6180,6 +6279,8 @@ var TokenInstruction;
|
|
|
6180
6279
|
// ConfidentialTransferFeeExtension = 37,
|
|
6181
6280
|
// WithdrawalExcessLamports = 38,
|
|
6182
6281
|
TokenInstruction[TokenInstruction["MetadataPointerExtension"] = 39] = "MetadataPointerExtension";
|
|
6282
|
+
TokenInstruction[TokenInstruction["GroupPointerExtension"] = 40] = "GroupPointerExtension";
|
|
6283
|
+
TokenInstruction[TokenInstruction["GroupMemberPointerExtension"] = 41] = "GroupMemberPointerExtension";
|
|
6183
6284
|
})(TokenInstruction || (TokenInstruction = {}));
|
|
6184
6285
|
|
|
6185
6286
|
/** @internal */
|
|
@@ -6336,6 +6437,38 @@ function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false,
|
|
|
6336
6437
|
return address;
|
|
6337
6438
|
}
|
|
6338
6439
|
|
|
6440
|
+
class COptionPublicKeyLayout extends Layout_2 {
|
|
6441
|
+
constructor(property) {
|
|
6442
|
+
super(-1, property);
|
|
6443
|
+
this.publicKeyLayout = publicKey();
|
|
6444
|
+
}
|
|
6445
|
+
decode(buffer, offset = 0) {
|
|
6446
|
+
const option = buffer[offset];
|
|
6447
|
+
if (option === 0) {
|
|
6448
|
+
return null;
|
|
6449
|
+
}
|
|
6450
|
+
return this.publicKeyLayout.decode(buffer, offset + 1);
|
|
6451
|
+
}
|
|
6452
|
+
encode(src, buffer, offset = 0) {
|
|
6453
|
+
if (src === null) {
|
|
6454
|
+
buffer[offset] = 0;
|
|
6455
|
+
return 1;
|
|
6456
|
+
}
|
|
6457
|
+
else {
|
|
6458
|
+
buffer[offset] = 1;
|
|
6459
|
+
this.publicKeyLayout.encode(src, buffer, offset + 1);
|
|
6460
|
+
return 33;
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
getSpan(buffer, offset = 0) {
|
|
6464
|
+
if (buffer) {
|
|
6465
|
+
const option = buffer[offset];
|
|
6466
|
+
return option === 0 ? 1 : 1 + this.publicKeyLayout.span;
|
|
6467
|
+
}
|
|
6468
|
+
return 1 + this.publicKeyLayout.span;
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
|
|
6339
6472
|
/**
|
|
6340
6473
|
* Construct a CreateAssociatedTokenAccount instruction
|
|
6341
6474
|
*
|
|
@@ -6372,8 +6505,7 @@ const initializeMint2InstructionData = struct([
|
|
|
6372
6505
|
u8('instruction'),
|
|
6373
6506
|
u8('decimals'),
|
|
6374
6507
|
publicKey('mintAuthority'),
|
|
6375
|
-
|
|
6376
|
-
publicKey('freezeAuthority'),
|
|
6508
|
+
new COptionPublicKeyLayout('freezeAuthority'),
|
|
6377
6509
|
]);
|
|
6378
6510
|
/**
|
|
6379
6511
|
* Construct an InitializeMint2 instruction
|
|
@@ -6393,8 +6525,7 @@ function createInitializeMint2Instruction(mint, decimals, mintAuthority, freezeA
|
|
|
6393
6525
|
instruction: TokenInstruction.InitializeMint2,
|
|
6394
6526
|
decimals,
|
|
6395
6527
|
mintAuthority,
|
|
6396
|
-
|
|
6397
|
-
freezeAuthority: freezeAuthority || new PublicKey(0),
|
|
6528
|
+
freezeAuthority,
|
|
6398
6529
|
}, data);
|
|
6399
6530
|
return new TransactionInstruction({ keys, programId, data });
|
|
6400
6531
|
}
|