@leofcoin/chain 1.4.82 → 1.4.84

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.
Files changed (30) hide show
  1. package/exports/browser/chain.js +72 -52
  2. package/exports/browser/client-c8558012-c8558012.js +10727 -0
  3. package/exports/browser/{index-6311966e-b5f647d8.js → index-ed6cbdf7-eb75dc7a.js} +2 -2
  4. package/exports/browser/{index-c3f4012c.js → index-f4429da1.js} +200 -210
  5. package/exports/browser/{messages-54aa3cad-5309745b.js → messages-35d069e1-9413ac70.js} +2 -2
  6. package/exports/browser/{node-browser-3cbee72b.js → node-browser-504c804a.js} +509 -600
  7. package/exports/browser/node-browser.js +2 -2
  8. package/exports/browser/workers/block-worker.js +200 -210
  9. package/exports/browser/workers/machine-worker.js +219 -212
  10. package/exports/chain.js +49 -35
  11. package/exports/types/config/main.d.ts +5 -0
  12. package/exports/{typings → types}/config/protocol.d.ts +1 -1
  13. package/exports/{typings → types}/contract.d.ts +1 -1
  14. package/exports/{typings → types}/fee/config.d.ts +1 -1
  15. package/exports/{typings → types}/machine.d.ts +8 -7
  16. package/exports/{typings → types}/node-browser.d.ts +1 -1
  17. package/exports/{typings → types}/node.d.ts +3 -3
  18. package/exports/workers/block-worker.js +6035 -0
  19. package/exports/workers/machine-worker.js +6298 -0
  20. package/package.json +18 -10
  21. package/exports/browser/client-6072af1a-6072af1a.js +0 -41092
  22. package/exports/typings/config/main.d.ts +0 -5
  23. /package/exports/{typings → types}/config/config.d.ts +0 -0
  24. /package/exports/{typings → types}/jobs/jobber.d.ts +0 -0
  25. /package/exports/{typings → types}/machine-state.d.ts +0 -0
  26. /package/exports/{typings → types}/protocol.d.ts +0 -0
  27. /package/exports/{typings → types}/sync-controller.d.ts +0 -0
  28. /package/exports/{typings → types}/transaction.d.ts +0 -0
  29. /package/exports/{typings → types}/typer.d.ts +0 -0
  30. /package/exports/{typings → types}/types.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-3cbee72b.js';
2
- import './index-c3f4012c.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-504c804a.js';
2
+ import './index-f4429da1.js';
3
3
 
4
4
  /**
5
5
  * @params {String} network
@@ -4581,216 +4581,206 @@ var index$2 = {
4581
4581
  isBase64
4582
4582
  };
4583
4583
 
4584
- const isTypedArrayCompatible = (possibleUint8Array) => {
4585
- if (typeof possibleUint8Array === 'string') {
4586
- possibleUint8Array = possibleUint8Array.split(',').map(number => Number(number));
4587
- for (const number of possibleUint8Array) {
4588
- if (isNaN(number))
4589
- return false;
4590
- }
4591
- }
4592
- for (const number of possibleUint8Array) {
4593
- if (isNaN(number))
4594
- return false;
4595
- }
4596
- return true;
4597
- };
4598
- /**
4599
- * Returns a String as Uint8Array
4600
- * @param string string to encode to Uint8Array
4601
- * @returns Uint8Array
4602
- */
4603
- const fromString$1 = (string) => new TextEncoder().encode(string);
4604
- /**
4605
- * Returns a Uint8Array as String
4606
- * @param uint8Array Uint8Array to encode to String
4607
- * @returns String
4608
- */
4609
- const toString$1 = (uint8Array) => new TextDecoder().decode(uint8Array);
4610
- /**
4611
- * Returns a String as Uint8Array
4612
- * @param string string to encode to Uint8Array
4613
- * @returns Uint8Array
4614
- */
4615
- const fromUintArrayString = (string) => Uint8Array.from(string.split(',').map(string => Number(string)));
4616
- /**
4617
- * Returns a Uint8Array as String
4618
- * @param uint8Array Uint8Array to encode to String
4619
- * @returns String
4620
- */
4621
- const toUintArrayString = (uint8Array) => uint8Array.toString();
4622
- /**
4623
- * hexString -> uint8Array
4624
- * @param string hex encoded string
4625
- * @returns UintArray
4626
- */
4627
- const fromHex = (string) => Uint8Array.from(string.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
4628
- /**
4629
- * uint8Array -> hexString
4630
- * @param bytes number[]
4631
- * @returns hexString
4632
- */
4633
- const toHex = (bytes) => bytes.reduce((string, byte) => string + byte.toString(16).padStart(2, '0'), '');
4634
- /**
4635
- * number[] -> Uint8Array
4636
- * @param array number[]
4637
- * @returns Uint8Array
4638
- */
4639
- const fromArrayLike = (array) => Uint8Array.from(array);
4640
- /**
4641
- * Uint8Array -> number[]
4642
- * @param uint8Array Uint8Array
4643
- * @returns Uint8Array
4644
- */
4645
- const toArrayLike = (uint8Array) => [...uint8Array.values()];
4646
- const toBase64 = (uint8Array) => index$2.encode(uint8Array);
4647
- const fromBase64 = (string) => index$2.decode(string);
4648
- const toBase58 = (uint8Array) => base58$1.encode(uint8Array);
4649
- const fromBase58 = (string) => base58$1.decode(string);
4650
- const toBase32 = (uint8Array) => index$7.encode(uint8Array);
4651
- const fromBase32 = (string) => index$7.decode(string);
4652
- const toBase16 = (uint8Array) => index$3.encode(uint8Array);
4653
- const fromBase16 = (string) => index$3.decode(string);
4654
- let FormatInterface$2 = class FormatInterface {
4655
- encoded;
4656
- constructor(input) {
4657
- if (input) {
4658
- if (index$3.isBase16(input))
4659
- this.encoded = this.fromBase16(input);
4660
- else if (index$7.isBase32(input))
4661
- this.encoded = this.fromBase32(input);
4662
- else if (base58$1.isBase58(input))
4663
- this.encoded = this.fromBase58(input);
4664
- else if (index$2.isBase64(input))
4665
- this.encoded = this.fromBase64(input);
4666
- else if (typeof input === 'string') {
4667
- let isCompatible = isTypedArrayCompatible(input);
4668
- if (isCompatible)
4669
- this.encoded = fromUintArrayString(input);
4670
- else
4671
- this.encoded = this.fromString(input); // normal string
4672
- }
4673
- else if (typeof input === 'object')
4674
- this.encoded = this.fromObject(input);
4675
- else if (input instanceof Uint8Array)
4676
- this.encoded = input;
4677
- else if (Array.isArray(input) && isTypedArrayCompatible(input))
4678
- this.encoded = this.fromArrayLike(input);
4679
- }
4680
- }
4681
- /**
4682
- * Returns a String as Uint8Array
4683
- * @param string string to encode to Uint8Array
4684
- * @returns Uint8Array
4685
- */
4686
- fromString(string) {
4687
- return new TextEncoder().encode(string);
4688
- }
4689
- /**
4690
- * Returns a Uint8Array as String
4691
- * @param uint8Array Uint8Array to encode to String
4692
- * @returns String
4693
- */
4694
- toString(uint8Array) {
4695
- return new TextDecoder().decode(uint8Array);
4696
- }
4697
- /**
4698
- * Returns a String as Uint8Array
4699
- * @param string string to encode to Uint8Array
4700
- * @returns Uint8Array
4701
- */
4702
- fromUintArrayString(string) {
4703
- return Uint8Array.from(string.split(',').map(string => Number(string)));
4704
- }
4705
- /**
4706
- * Returns a Uint8Array as String
4707
- * @param uint8Array Uint8Array to encode to String
4708
- * @returns String
4709
- */
4710
- toUintArrayString(uint8Array) {
4711
- return uint8Array.toString();
4712
- }
4713
- /**
4714
- * hexString -> uint8Array
4715
- * @param string hex encoded string
4716
- * @returns UintArray
4717
- */
4718
- fromHex(string) {
4719
- return Uint8Array.from(string.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
4720
- }
4721
- /**
4722
- * uint8Array -> hexString
4723
- * @param bytes number[]
4724
- * @returns hexString
4725
- */
4726
- toHex(bytes) {
4727
- return bytes.reduce((string, byte) => string + byte.toString(16).padStart(2, '0'), '');
4728
- }
4729
- /**
4730
- * number[] -> Uint8Array
4731
- * @param array number[]
4732
- * @returns Uint8Array
4733
- */
4734
- fromArrayLike(array) {
4735
- return Uint8Array.from(array);
4736
- }
4737
- /**
4738
- * Uint8Array -> number[]
4739
- * @param uint8Array Uint8Array
4740
- * @returns Uint8Array
4741
- */
4742
- toArrayLike(uint8Array) {
4743
- return [...uint8Array.values()];
4744
- }
4745
- fromObject(object) {
4746
- return new TextEncoder().encode(JSON.stringify(object));
4747
- }
4748
- toObject(uint8Array) {
4749
- return JSON.parse(new TextDecoder().decode(uint8Array));
4750
- }
4751
- toBase64(uint8Array) {
4752
- return index$2.encode(uint8Array);
4753
- }
4754
- fromBase64(string) {
4755
- return index$2.decode(string);
4756
- }
4757
- toBase58(uint8Array) {
4758
- return base58$1.encode(uint8Array);
4759
- }
4760
- fromBase58(string) {
4761
- return base58$1.decode(string);
4762
- }
4763
- toBase32(uint8Array) {
4764
- return index$7.encode(uint8Array);
4765
- }
4766
- fromBase32(string) {
4767
- return index$7.decode(string);
4768
- }
4769
- toBase16(uint8Array) {
4770
- return index$3.encode(uint8Array);
4771
- }
4772
- fromBase16(string) {
4773
- return index$3.decode(string);
4774
- }
4775
- };
4776
- var index$1 = {
4777
- fromString: fromString$1,
4778
- toString: toString$1,
4779
- fromHex,
4780
- toHex,
4781
- fromArrayLike,
4782
- toArrayLike,
4783
- fromUintArrayString,
4784
- toUintArrayString,
4785
- toBase64,
4786
- fromBase64,
4787
- toBase58,
4788
- fromBase58,
4789
- toBase32,
4790
- fromBase32,
4791
- toBase16,
4792
- fromBase16,
4793
- FormatInterface: FormatInterface$2
4584
+ /**
4585
+ * Returns a hex string as Binary string
4586
+ * @param string string to encode to binary
4587
+ * @returns binaryString
4588
+ */
4589
+ const hexToBinary = (hex) => (parseInt(hex, 16).toString(2)).padStart(8, '0');
4590
+ const isTypedArrayCompatible = (possibleUint8Array) => {
4591
+ if (typeof possibleUint8Array === 'string') {
4592
+ possibleUint8Array = possibleUint8Array.split(',').map(number => Number(number));
4593
+ for (const number of possibleUint8Array) {
4594
+ if (isNaN(number))
4595
+ return false;
4596
+ }
4597
+ }
4598
+ for (const number of possibleUint8Array) {
4599
+ if (isNaN(number))
4600
+ return false;
4601
+ }
4602
+ return true;
4603
+ };
4604
+ /**
4605
+ * Returns a String as Uint8Array
4606
+ * @param string string to encode to Uint8Array
4607
+ * @returns Uint8Array
4608
+ */
4609
+ const fromString$1 = (string) => new TextEncoder().encode(string);
4610
+ /**
4611
+ * Returns a Uint8Array as String
4612
+ * @param uint8Array Uint8Array to encode to String
4613
+ * @returns String
4614
+ */
4615
+ const toString$1 = (uint8Array) => new TextDecoder().decode(uint8Array);
4616
+ /**
4617
+ * Returns a String as Uint8Array
4618
+ * @param string string to encode to Uint8Array
4619
+ * @returns Uint8Array
4620
+ */
4621
+ const fromUintArrayString = (string) => Uint8Array.from(string.split(',').map(string => Number(string)));
4622
+ /**
4623
+ * Returns a Uint8Array as String
4624
+ * @param uint8Array Uint8Array to encode to String
4625
+ * @returns String
4626
+ */
4627
+ const toUintArrayString = (uint8Array) => uint8Array.toString();
4628
+ /**
4629
+ * hexString -> uint8Array
4630
+ * @param string hex encoded string
4631
+ * @returns UintArray
4632
+ */
4633
+ const fromHex = (string) => Uint8Array.from(string.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
4634
+ /**
4635
+ * uint8Array -> hexString
4636
+ * @param bytes number[]
4637
+ * @returns hexString
4638
+ */
4639
+ const toHex = (bytes) => bytes.reduce((string, byte) => string + byte.toString(16).padStart(2, '0'), '');
4640
+ /**
4641
+ * number[] -> Uint8Array
4642
+ * @param array number[]
4643
+ * @returns Uint8Array
4644
+ */
4645
+ const fromArrayLike = (array) => Uint8Array.from(array);
4646
+ /**
4647
+ * Uint8Array -> number[]
4648
+ * @param uint8Array Uint8Array
4649
+ * @returns Uint8Array
4650
+ */
4651
+ const toArrayLike = (uint8Array) => [...uint8Array.values()];
4652
+ /**
4653
+ * object -> Uint8Array
4654
+ * @param object any
4655
+ * @returns Uint8Array
4656
+ */
4657
+ const fromObject = (object) => new TextEncoder().encode(JSON.stringify(object));
4658
+ /**
4659
+ * Uint8Array -> Object
4660
+ * @param uint8Array Uint8Array
4661
+ * @returns Object
4662
+ */
4663
+ const toObject = (uint8Array) => JSON.parse(new TextDecoder().decode(uint8Array));
4664
+ const fromBinary = (string) => fromHex(parseInt(string, 2).toString(16).toUpperCase());
4665
+ const toBinary = (uint8Array) => hexToBinary(toHex(uint8Array));
4666
+ const toBase64 = (uint8Array) => index$2.encode(uint8Array);
4667
+ const fromBase64 = (string) => index$2.decode(string);
4668
+ const toBase58 = (uint8Array) => base58$1.encode(uint8Array);
4669
+ const fromBase58 = (string) => base58$1.decode(string);
4670
+ const toBase32 = (uint8Array) => index$7.encode(uint8Array);
4671
+ const fromBase32 = (string) => index$7.decode(string);
4672
+ const toBase16 = (uint8Array) => index$3.encode(uint8Array);
4673
+ const fromBase16 = (string) => index$3.decode(string);
4674
+ let FormatInterface$2 = class FormatInterface {
4675
+ encoded;
4676
+ decoded;
4677
+ constructor(input) {
4678
+ if (input) {
4679
+ if (index$3.isBase16(input))
4680
+ this.encoded = this.fromBase16(input);
4681
+ else if (index$7.isBase32(input))
4682
+ this.encoded = this.fromBase32(input);
4683
+ else if (base58$1.isBase58(input))
4684
+ this.encoded = this.fromBase58(input);
4685
+ else if (index$2.isBase64(input))
4686
+ this.encoded = this.fromBase64(input);
4687
+ else if (typeof input === 'string') {
4688
+ let isCompatible = isTypedArrayCompatible(input);
4689
+ if (isCompatible)
4690
+ this.encoded = fromUintArrayString(input);
4691
+ else
4692
+ this.encoded = this.fromString(input); // normal string
4693
+ }
4694
+ else if (typeof input === 'object')
4695
+ this.encoded = this.fromObject(input);
4696
+ else if (input instanceof Uint8Array)
4697
+ this.encoded = input;
4698
+ else if (Array.isArray(input) && isTypedArrayCompatible(input))
4699
+ this.encoded = this.fromArrayLike(input);
4700
+ }
4701
+ }
4702
+ /**
4703
+ * Returns a String as Uint8Array
4704
+ * @param string string to encode to Uint8Array
4705
+ * @returns Uint8Array
4706
+ */
4707
+ fromString = (string) => this.encoded = fromString$1(string);
4708
+ /**
4709
+ * Returns a Uint8Array as String
4710
+ * @param uint8Array Uint8Array to encode to String
4711
+ * @returns String
4712
+ */
4713
+ toString = (uint8Array) => this.decoded = toString$1(uint8Array);
4714
+ /**
4715
+ * Returns a String as Uint8Array
4716
+ * @param string string to encode to Uint8Array
4717
+ * @returns Uint8Array
4718
+ */
4719
+ fromUintArrayString = (string) => this.encoded = fromUintArrayString(string);
4720
+ /**
4721
+ * Returns a Uint8Array as String
4722
+ * @param uint8Array Uint8Array to encode to String
4723
+ * @returns String
4724
+ */
4725
+ toUintArrayString = (uint8Array) => this.decoded = uint8Array.toString();
4726
+ /**
4727
+ * hexString -> uint8Array
4728
+ * @param string hex encoded string
4729
+ * @returns UintArray
4730
+ */
4731
+ fromHex = (string) => this.encoded = fromHex(string);
4732
+ /**
4733
+ * uint8Array -> hexString
4734
+ * @param bytes ArrayLike
4735
+ * @returns hexString
4736
+ */
4737
+ toHex = (arrayLike) => this.decoded = toHex(arrayLike);
4738
+ /**
4739
+ * number[] -> Uint8Array
4740
+ * @param array number[]
4741
+ * @returns Uint8Array
4742
+ */
4743
+ fromArrayLike = (array) => this.encoded = Uint8Array.from(array);
4744
+ /**
4745
+ * Uint8Array -> number[]
4746
+ * @param uint8Array Uint8Array
4747
+ * @returns Uint8Array
4748
+ */
4749
+ toArrayLike = (uint8Array) => this.decoded = [...uint8Array.values()];
4750
+ fromObject = (object) => this.encoded = fromObject(object);
4751
+ toBinary = (uint8Array) => this.decoded = hexToBinary(toHex(uint8Array));
4752
+ fromBinary = (binary) => this.encoded = fromBinary(binary);
4753
+ toObject = (uint8Array) => this.decoded = toObject(uint8Array);
4754
+ toBase64 = (uint8Array) => this.decoded = index$2.encode(uint8Array);
4755
+ fromBase64 = (string) => this.encoded = index$2.decode(string);
4756
+ toBase58 = (uint8Array) => this.decoded = base58$1.encode(uint8Array);
4757
+ fromBase58 = (string) => this.encoded = base58$1.decode(string);
4758
+ toBase32 = (uint8Array) => this.decoded = index$7.encode(uint8Array);
4759
+ fromBase32 = (string) => this.encoded = index$7.decode(string);
4760
+ toBase16 = (uint8Array) => this.decoded = index$3.encode(uint8Array);
4761
+ fromBase16 = (string) => this.decoded = index$3.decode(string);
4762
+ };
4763
+ var index$1 = {
4764
+ fromString: fromString$1,
4765
+ toString: toString$1,
4766
+ fromHex,
4767
+ toHex,
4768
+ fromArrayLike,
4769
+ toArrayLike,
4770
+ fromUintArrayString,
4771
+ toUintArrayString,
4772
+ toObject,
4773
+ toBinary,
4774
+ fromBinary,
4775
+ toBase64,
4776
+ fromBase64,
4777
+ toBase58,
4778
+ fromBase58,
4779
+ toBase32,
4780
+ fromBase32,
4781
+ toBase16,
4782
+ fromBase16,
4783
+ FormatInterface: FormatInterface$2
4794
4784
  };
4795
4785
 
4796
4786
  const { fromString, toString } = index$1;
@@ -1,5 +1,5 @@
1
- import { F as FormatInterface } from './node-browser-3cbee72b.js';
2
- import './index-c3f4012c.js';
1
+ import { F as FormatInterface } from './node-browser-504c804a.js';
2
+ import './index-f4429da1.js';
3
3
 
4
4
  var proto$b = {
5
5
  data: new Uint8Array(),