@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.
@@ -5,7 +5,7 @@ var web3_js = require('@solana/web3.js');
5
5
  var anchor = require('@coral-xyz/anchor');
6
6
 
7
7
  const IDL = {
8
- version: '0.5.0',
8
+ version: '1.0.0',
9
9
  name: 'light_compressed_token',
10
10
  instructions: [
11
11
  {
@@ -1153,12 +1153,6 @@ const IDL = {
1153
1153
  name: 'isCompress',
1154
1154
  type: 'bool',
1155
1155
  },
1156
- {
1157
- name: 'signerSeeds',
1158
- type: {
1159
- vec: 'bytes',
1160
- },
1161
- },
1162
1156
  {
1163
1157
  name: 'cpiContext',
1164
1158
  type: {
@@ -1561,23 +1555,128 @@ const IDL = {
1561
1555
  errors: [
1562
1556
  {
1563
1557
  code: 6000,
1564
- name: 'SignerCheckFailed',
1565
- msg: 'Signer check failed',
1558
+ name: 'PublicKeyAmountMissmatch',
1559
+ msg: 'public keys and amounts must be of same length',
1566
1560
  },
1567
1561
  {
1568
1562
  code: 6001,
1569
- name: 'CreateTransferInstructionFailed',
1570
- msg: 'Create transfer instruction failed',
1563
+ name: 'ComputeInputSumFailed',
1564
+ msg: 'ComputeInputSumFailed',
1571
1565
  },
1572
1566
  {
1573
1567
  code: 6002,
1574
- name: 'AccountNotFound',
1575
- msg: 'Account not found',
1568
+ name: 'ComputeOutputSumFailed',
1569
+ msg: 'ComputeOutputSumFailed',
1576
1570
  },
1577
1571
  {
1578
1572
  code: 6003,
1579
- name: 'SerializationError',
1580
- msg: 'Serialization error',
1573
+ name: 'ComputeCompressSumFailed',
1574
+ msg: 'ComputeCompressSumFailed',
1575
+ },
1576
+ {
1577
+ code: 6004,
1578
+ name: 'ComputeDecompressSumFailed',
1579
+ msg: 'ComputeDecompressSumFailed',
1580
+ },
1581
+ {
1582
+ code: 6005,
1583
+ name: 'SumCheckFailed',
1584
+ msg: 'SumCheckFailed',
1585
+ },
1586
+ {
1587
+ code: 6006,
1588
+ name: 'DecompressRecipientUndefinedForDecompress',
1589
+ msg: 'DecompressRecipientUndefinedForDecompress',
1590
+ },
1591
+ {
1592
+ code: 6007,
1593
+ name: 'CompressedPdaUndefinedForDecompress',
1594
+ msg: 'CompressedPdaUndefinedForDecompress',
1595
+ },
1596
+ {
1597
+ code: 6008,
1598
+ name: 'DeCompressAmountUndefinedForDecompress',
1599
+ msg: 'DeCompressAmountUndefinedForDecompress',
1600
+ },
1601
+ {
1602
+ code: 6009,
1603
+ name: 'CompressedPdaUndefinedForCompress',
1604
+ msg: 'CompressedPdaUndefinedForCompress',
1605
+ },
1606
+ {
1607
+ code: 6010,
1608
+ name: 'DeCompressAmountUndefinedForCompress',
1609
+ msg: 'DeCompressAmountUndefinedForCompress',
1610
+ },
1611
+ {
1612
+ code: 6011,
1613
+ name: 'DelegateSignerCheckFailed',
1614
+ msg: 'DelegateSignerCheckFailed',
1615
+ },
1616
+ {
1617
+ code: 6012,
1618
+ name: 'MintTooLarge',
1619
+ msg: 'Minted amount greater than u64::MAX',
1620
+ },
1621
+ {
1622
+ code: 6013,
1623
+ name: 'SplTokenSupplyMismatch',
1624
+ msg: 'SplTokenSupplyMismatch',
1625
+ },
1626
+ {
1627
+ code: 6014,
1628
+ name: 'HeapMemoryCheckFailed',
1629
+ msg: 'HeapMemoryCheckFailed',
1630
+ },
1631
+ {
1632
+ code: 6015,
1633
+ name: 'InstructionNotCallable',
1634
+ msg: 'The instruction is not callable',
1635
+ },
1636
+ {
1637
+ code: 6016,
1638
+ name: 'ArithmeticUnderflow',
1639
+ msg: 'ArithmeticUnderflow',
1640
+ },
1641
+ {
1642
+ code: 6017,
1643
+ name: 'HashToFieldError',
1644
+ msg: 'HashToFieldError',
1645
+ },
1646
+ {
1647
+ code: 6018,
1648
+ name: 'InvalidAuthorityMint',
1649
+ msg: 'Expected the authority to be also a mint authority',
1650
+ },
1651
+ {
1652
+ code: 6019,
1653
+ name: 'InvalidFreezeAuthority',
1654
+ msg: 'Provided authority is not the freeze authority',
1655
+ },
1656
+ {
1657
+ code: 6020,
1658
+ name: 'InvalidDelegateIndex',
1659
+ },
1660
+ {
1661
+ code: 6021,
1662
+ name: 'TokenPoolPdaUndefined',
1663
+ },
1664
+ {
1665
+ code: 6022,
1666
+ name: 'IsTokenPoolPda',
1667
+ msg: 'Compress or decompress recipient is the same account as the token pool pda.',
1668
+ },
1669
+ {
1670
+ code: 6023,
1671
+ name: 'InvalidTokenPoolPda',
1672
+ },
1673
+ {
1674
+ code: 6024,
1675
+ name: 'NoInputTokenAccountsProvided',
1676
+ },
1677
+ {
1678
+ code: 6025,
1679
+ name: 'NoInputsProvided',
1581
1680
  },
1582
1681
  ],
1583
1682
  };
@@ -3710,7 +3809,7 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_buffer);
3710
3809
  * THE SOFTWARE.
3711
3810
  */
3712
3811
  Object.defineProperty(Layout$1, "__esModule", { value: true });
3713
- 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;
3812
+ 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;
3714
3813
  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;
3715
3814
  const buffer_1 = require$$0;
3716
3815
  /* Check if a value is a Uint8Array.
@@ -3857,7 +3956,7 @@ class Layout {
3857
3956
  return undefined;
3858
3957
  }
3859
3958
  }
3860
- Layout$1.Layout = Layout;
3959
+ var Layout_2 = Layout$1.Layout = Layout;
3861
3960
  /* Provide text that carries a name (such as for a function that will
3862
3961
  * be throwing an error) annotated with the property of a given layout
3863
3962
  * (such as one for which the value was unacceptable).
@@ -6183,6 +6282,8 @@ var TokenInstruction;
6183
6282
  // ConfidentialTransferFeeExtension = 37,
6184
6283
  // WithdrawalExcessLamports = 38,
6185
6284
  TokenInstruction[TokenInstruction["MetadataPointerExtension"] = 39] = "MetadataPointerExtension";
6285
+ TokenInstruction[TokenInstruction["GroupPointerExtension"] = 40] = "GroupPointerExtension";
6286
+ TokenInstruction[TokenInstruction["GroupMemberPointerExtension"] = 41] = "GroupMemberPointerExtension";
6186
6287
  })(TokenInstruction || (TokenInstruction = {}));
6187
6288
 
6188
6289
  /** @internal */
@@ -6339,6 +6440,38 @@ function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false,
6339
6440
  return address;
6340
6441
  }
6341
6442
 
6443
+ class COptionPublicKeyLayout extends Layout_2 {
6444
+ constructor(property) {
6445
+ super(-1, property);
6446
+ this.publicKeyLayout = publicKey();
6447
+ }
6448
+ decode(buffer, offset = 0) {
6449
+ const option = buffer[offset];
6450
+ if (option === 0) {
6451
+ return null;
6452
+ }
6453
+ return this.publicKeyLayout.decode(buffer, offset + 1);
6454
+ }
6455
+ encode(src, buffer, offset = 0) {
6456
+ if (src === null) {
6457
+ buffer[offset] = 0;
6458
+ return 1;
6459
+ }
6460
+ else {
6461
+ buffer[offset] = 1;
6462
+ this.publicKeyLayout.encode(src, buffer, offset + 1);
6463
+ return 33;
6464
+ }
6465
+ }
6466
+ getSpan(buffer, offset = 0) {
6467
+ if (buffer) {
6468
+ const option = buffer[offset];
6469
+ return option === 0 ? 1 : 1 + this.publicKeyLayout.span;
6470
+ }
6471
+ return 1 + this.publicKeyLayout.span;
6472
+ }
6473
+ }
6474
+
6342
6475
  /**
6343
6476
  * Construct a CreateAssociatedTokenAccount instruction
6344
6477
  *
@@ -6375,8 +6508,7 @@ const initializeMint2InstructionData = struct([
6375
6508
  u8('instruction'),
6376
6509
  u8('decimals'),
6377
6510
  publicKey('mintAuthority'),
6378
- u8('freezeAuthorityOption'),
6379
- publicKey('freezeAuthority'),
6511
+ new COptionPublicKeyLayout('freezeAuthority'),
6380
6512
  ]);
6381
6513
  /**
6382
6514
  * Construct an InitializeMint2 instruction
@@ -6396,8 +6528,7 @@ function createInitializeMint2Instruction(mint, decimals, mintAuthority, freezeA
6396
6528
  instruction: TokenInstruction.InitializeMint2,
6397
6529
  decimals,
6398
6530
  mintAuthority,
6399
- freezeAuthorityOption: freezeAuthority ? 1 : 0,
6400
- freezeAuthority: freezeAuthority || new web3_js.PublicKey(0),
6531
+ freezeAuthority,
6401
6532
  }, data);
6402
6533
  return new web3_js.TransactionInstruction({ keys, programId, data });
6403
6534
  }