@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.
@@ -6,7 +6,7 @@ var anchor = require('@coral-xyz/anchor');
6
6
  var require$$0 = require('buffer');
7
7
 
8
8
  const IDL = {
9
- version: '0.5.0',
9
+ version: '1.0.0',
10
10
  name: 'light_compressed_token',
11
11
  instructions: [
12
12
  {
@@ -1154,12 +1154,6 @@ const IDL = {
1154
1154
  name: 'isCompress',
1155
1155
  type: 'bool',
1156
1156
  },
1157
- {
1158
- name: 'signerSeeds',
1159
- type: {
1160
- vec: 'bytes',
1161
- },
1162
- },
1163
1157
  {
1164
1158
  name: 'cpiContext',
1165
1159
  type: {
@@ -1562,23 +1556,128 @@ const IDL = {
1562
1556
  errors: [
1563
1557
  {
1564
1558
  code: 6000,
1565
- name: 'SignerCheckFailed',
1566
- msg: 'Signer check failed',
1559
+ name: 'PublicKeyAmountMissmatch',
1560
+ msg: 'public keys and amounts must be of same length',
1567
1561
  },
1568
1562
  {
1569
1563
  code: 6001,
1570
- name: 'CreateTransferInstructionFailed',
1571
- msg: 'Create transfer instruction failed',
1564
+ name: 'ComputeInputSumFailed',
1565
+ msg: 'ComputeInputSumFailed',
1572
1566
  },
1573
1567
  {
1574
1568
  code: 6002,
1575
- name: 'AccountNotFound',
1576
- msg: 'Account not found',
1569
+ name: 'ComputeOutputSumFailed',
1570
+ msg: 'ComputeOutputSumFailed',
1577
1571
  },
1578
1572
  {
1579
1573
  code: 6003,
1580
- name: 'SerializationError',
1581
- msg: 'Serialization error',
1574
+ name: 'ComputeCompressSumFailed',
1575
+ msg: 'ComputeCompressSumFailed',
1576
+ },
1577
+ {
1578
+ code: 6004,
1579
+ name: 'ComputeDecompressSumFailed',
1580
+ msg: 'ComputeDecompressSumFailed',
1581
+ },
1582
+ {
1583
+ code: 6005,
1584
+ name: 'SumCheckFailed',
1585
+ msg: 'SumCheckFailed',
1586
+ },
1587
+ {
1588
+ code: 6006,
1589
+ name: 'DecompressRecipientUndefinedForDecompress',
1590
+ msg: 'DecompressRecipientUndefinedForDecompress',
1591
+ },
1592
+ {
1593
+ code: 6007,
1594
+ name: 'CompressedPdaUndefinedForDecompress',
1595
+ msg: 'CompressedPdaUndefinedForDecompress',
1596
+ },
1597
+ {
1598
+ code: 6008,
1599
+ name: 'DeCompressAmountUndefinedForDecompress',
1600
+ msg: 'DeCompressAmountUndefinedForDecompress',
1601
+ },
1602
+ {
1603
+ code: 6009,
1604
+ name: 'CompressedPdaUndefinedForCompress',
1605
+ msg: 'CompressedPdaUndefinedForCompress',
1606
+ },
1607
+ {
1608
+ code: 6010,
1609
+ name: 'DeCompressAmountUndefinedForCompress',
1610
+ msg: 'DeCompressAmountUndefinedForCompress',
1611
+ },
1612
+ {
1613
+ code: 6011,
1614
+ name: 'DelegateSignerCheckFailed',
1615
+ msg: 'DelegateSignerCheckFailed',
1616
+ },
1617
+ {
1618
+ code: 6012,
1619
+ name: 'MintTooLarge',
1620
+ msg: 'Minted amount greater than u64::MAX',
1621
+ },
1622
+ {
1623
+ code: 6013,
1624
+ name: 'SplTokenSupplyMismatch',
1625
+ msg: 'SplTokenSupplyMismatch',
1626
+ },
1627
+ {
1628
+ code: 6014,
1629
+ name: 'HeapMemoryCheckFailed',
1630
+ msg: 'HeapMemoryCheckFailed',
1631
+ },
1632
+ {
1633
+ code: 6015,
1634
+ name: 'InstructionNotCallable',
1635
+ msg: 'The instruction is not callable',
1636
+ },
1637
+ {
1638
+ code: 6016,
1639
+ name: 'ArithmeticUnderflow',
1640
+ msg: 'ArithmeticUnderflow',
1641
+ },
1642
+ {
1643
+ code: 6017,
1644
+ name: 'HashToFieldError',
1645
+ msg: 'HashToFieldError',
1646
+ },
1647
+ {
1648
+ code: 6018,
1649
+ name: 'InvalidAuthorityMint',
1650
+ msg: 'Expected the authority to be also a mint authority',
1651
+ },
1652
+ {
1653
+ code: 6019,
1654
+ name: 'InvalidFreezeAuthority',
1655
+ msg: 'Provided authority is not the freeze authority',
1656
+ },
1657
+ {
1658
+ code: 6020,
1659
+ name: 'InvalidDelegateIndex',
1660
+ },
1661
+ {
1662
+ code: 6021,
1663
+ name: 'TokenPoolPdaUndefined',
1664
+ },
1665
+ {
1666
+ code: 6022,
1667
+ name: 'IsTokenPoolPda',
1668
+ msg: 'Compress or decompress recipient is the same account as the token pool pda.',
1669
+ },
1670
+ {
1671
+ code: 6023,
1672
+ name: 'InvalidTokenPoolPda',
1673
+ },
1674
+ {
1675
+ code: 6024,
1676
+ name: 'NoInputTokenAccountsProvided',
1677
+ },
1678
+ {
1679
+ code: 6025,
1680
+ name: 'NoInputsProvided',
1582
1681
  },
1583
1682
  ],
1584
1683
  };
@@ -1687,7 +1786,7 @@ var Layout$1 = {};
1687
1786
  * THE SOFTWARE.
1688
1787
  */
1689
1788
  Object.defineProperty(Layout$1, "__esModule", { value: true });
1690
- 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;
1789
+ 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;
1691
1790
  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;
1692
1791
  const buffer_1 = require$$0;
1693
1792
  /* Check if a value is a Uint8Array.
@@ -1834,7 +1933,7 @@ class Layout {
1834
1933
  return undefined;
1835
1934
  }
1836
1935
  }
1837
- Layout$1.Layout = Layout;
1936
+ var Layout_2 = Layout$1.Layout = Layout;
1838
1937
  /* Provide text that carries a name (such as for a function that will
1839
1938
  * be throwing an error) annotated with the property of a given layout
1840
1939
  * (such as one for which the value was unacceptable).
@@ -4160,6 +4259,8 @@ var TokenInstruction;
4160
4259
  // ConfidentialTransferFeeExtension = 37,
4161
4260
  // WithdrawalExcessLamports = 38,
4162
4261
  TokenInstruction[TokenInstruction["MetadataPointerExtension"] = 39] = "MetadataPointerExtension";
4262
+ TokenInstruction[TokenInstruction["GroupPointerExtension"] = 40] = "GroupPointerExtension";
4263
+ TokenInstruction[TokenInstruction["GroupMemberPointerExtension"] = 41] = "GroupMemberPointerExtension";
4163
4264
  })(TokenInstruction || (TokenInstruction = {}));
4164
4265
 
4165
4266
  /** @internal */
@@ -4316,6 +4417,38 @@ function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false,
4316
4417
  return address;
4317
4418
  }
4318
4419
 
4420
+ class COptionPublicKeyLayout extends Layout_2 {
4421
+ constructor(property) {
4422
+ super(-1, property);
4423
+ this.publicKeyLayout = publicKey();
4424
+ }
4425
+ decode(buffer, offset = 0) {
4426
+ const option = buffer[offset];
4427
+ if (option === 0) {
4428
+ return null;
4429
+ }
4430
+ return this.publicKeyLayout.decode(buffer, offset + 1);
4431
+ }
4432
+ encode(src, buffer, offset = 0) {
4433
+ if (src === null) {
4434
+ buffer[offset] = 0;
4435
+ return 1;
4436
+ }
4437
+ else {
4438
+ buffer[offset] = 1;
4439
+ this.publicKeyLayout.encode(src, buffer, offset + 1);
4440
+ return 33;
4441
+ }
4442
+ }
4443
+ getSpan(buffer, offset = 0) {
4444
+ if (buffer) {
4445
+ const option = buffer[offset];
4446
+ return option === 0 ? 1 : 1 + this.publicKeyLayout.span;
4447
+ }
4448
+ return 1 + this.publicKeyLayout.span;
4449
+ }
4450
+ }
4451
+
4319
4452
  /**
4320
4453
  * Construct a CreateAssociatedTokenAccount instruction
4321
4454
  *
@@ -4352,8 +4485,7 @@ const initializeMint2InstructionData = struct([
4352
4485
  u8('instruction'),
4353
4486
  u8('decimals'),
4354
4487
  publicKey('mintAuthority'),
4355
- u8('freezeAuthorityOption'),
4356
- publicKey('freezeAuthority'),
4488
+ new COptionPublicKeyLayout('freezeAuthority'),
4357
4489
  ]);
4358
4490
  /**
4359
4491
  * Construct an InitializeMint2 instruction
@@ -4373,8 +4505,7 @@ function createInitializeMint2Instruction(mint, decimals, mintAuthority, freezeA
4373
4505
  instruction: TokenInstruction.InitializeMint2,
4374
4506
  decimals,
4375
4507
  mintAuthority,
4376
- freezeAuthorityOption: freezeAuthority ? 1 : 0,
4377
- freezeAuthority: freezeAuthority || new web3_js.PublicKey(0),
4508
+ freezeAuthority,
4378
4509
  }, data);
4379
4510
  return new web3_js.TransactionInstruction({ keys, programId, data });
4380
4511
  }