@ckb-ccc/core 0.0.10-alpha.4 → 0.0.10-alpha.6

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 (135) hide show
  1. package/dist/address/address.advanced.js +4 -2
  2. package/dist/ckb/transaction.d.ts.map +1 -1
  3. package/dist/ckb/transaction.js +1 -2
  4. package/dist/signer/ckb/signerCkbPrivateKey.d.ts +1 -0
  5. package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  6. package/dist/signer/ckb/signerCkbPrivateKey.js +7 -7
  7. package/dist/signer/signer/index.d.ts +0 -9
  8. package/dist/signer/signer/index.d.ts.map +1 -1
  9. package/dist/signer/signer/index.js +6 -13
  10. package/dist.commonjs/address/address.advanced.d.ts +24 -29
  11. package/dist.commonjs/address/address.advanced.js +91 -115
  12. package/dist.commonjs/address/advanced.d.ts +1 -1
  13. package/dist.commonjs/address/advanced.js +14 -30
  14. package/dist.commonjs/address/index.d.ts +44 -51
  15. package/dist.commonjs/address/index.js +65 -84
  16. package/dist.commonjs/advanced.d.ts +1 -1
  17. package/dist.commonjs/advanced.js +22 -47
  18. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  19. package/dist.commonjs/advancedBarrel.js +14 -30
  20. package/dist.commonjs/barrel.d.ts +1 -1
  21. package/dist.commonjs/barrel.js +14 -30
  22. package/dist.commonjs/bytes/advanced.d.ts +2 -11
  23. package/dist.commonjs/bytes/index.d.ts +3 -9
  24. package/dist.commonjs/bytes/index.js +26 -28
  25. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  26. package/dist.commonjs/ckb/advanced.js +22 -47
  27. package/dist.commonjs/ckb/index.d.ts +1 -1
  28. package/dist.commonjs/ckb/index.js +14 -30
  29. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +260 -420
  30. package/dist.commonjs/ckb/molecule.advanced/generated.js +1332 -1536
  31. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  32. package/dist.commonjs/ckb/molecule.advanced/index.js +18 -34
  33. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  34. package/dist.commonjs/ckb/script.advanced.js +9 -12
  35. package/dist.commonjs/ckb/script.d.ts +117 -121
  36. package/dist.commonjs/ckb/script.js +176 -220
  37. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  38. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  39. package/dist.commonjs/ckb/transaction.d.ts +722 -806
  40. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  41. package/dist.commonjs/ckb/transaction.js +1190 -1424
  42. package/dist.commonjs/client/advanced.d.ts +1 -1
  43. package/dist.commonjs/client/advanced.js +14 -30
  44. package/dist.commonjs/client/client.advanced.d.ts +6 -23
  45. package/dist.commonjs/client/client.advanced.js +61 -89
  46. package/dist.commonjs/client/client.d.ts +54 -114
  47. package/dist.commonjs/client/client.js +182 -215
  48. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +4 -8
  49. package/dist.commonjs/client/clientPublicMainnet.advanced.js +189 -215
  50. package/dist.commonjs/client/clientPublicMainnet.d.ts +6 -8
  51. package/dist.commonjs/client/clientPublicMainnet.js +15 -17
  52. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +3 -6
  53. package/dist.commonjs/client/clientPublicTestnet.advanced.js +199 -227
  54. package/dist.commonjs/client/clientPublicTestnet.d.ts +6 -8
  55. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  56. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  57. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  58. package/dist.commonjs/client/clientTypes.d.ts +26 -51
  59. package/dist.commonjs/client/clientTypes.js +22 -56
  60. package/dist.commonjs/client/index.d.ts +1 -1
  61. package/dist.commonjs/client/index.js +14 -30
  62. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  63. package/dist.commonjs/client/jsonRpc/advanced.js +14 -30
  64. package/dist.commonjs/client/jsonRpc/index.d.ts +75 -94
  65. package/dist.commonjs/client/jsonRpc/index.js +108 -135
  66. package/dist.commonjs/client/jsonRpc/transformers.d.ts +36 -76
  67. package/dist.commonjs/client/jsonRpc/transformers.js +152 -174
  68. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  69. package/dist.commonjs/fixedPoint/index.d.ts +3 -9
  70. package/dist.commonjs/fixedPoint/index.js +20 -26
  71. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  72. package/dist.commonjs/fixedPoint/index.test.js +36 -42
  73. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  74. package/dist.commonjs/hasher/index.d.ts +37 -40
  75. package/dist.commonjs/hasher/index.js +48 -58
  76. package/dist.commonjs/hex/index.d.ts +1 -1
  77. package/dist.commonjs/hex/index.js +1 -1
  78. package/dist.commonjs/index.d.ts +1 -1
  79. package/dist.commonjs/index.js +22 -47
  80. package/dist.commonjs/num/index.d.ts +1 -1
  81. package/dist.commonjs/num/index.js +27 -39
  82. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  83. package/dist.commonjs/signer/btc/index.js +14 -30
  84. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  85. package/dist.commonjs/signer/btc/signerBtc.js +66 -89
  86. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  87. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  88. package/dist.commonjs/signer/btc/verify.d.ts +2 -6
  89. package/dist.commonjs/signer/btc/verify.js +3 -10
  90. package/dist.commonjs/signer/ckb/index.d.ts +1 -1
  91. package/dist.commonjs/signer/ckb/index.js +14 -30
  92. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +6 -5
  93. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  94. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +28 -42
  95. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +11 -11
  96. package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +35 -45
  97. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  98. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  99. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +3 -9
  100. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +5 -13
  101. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +2 -6
  102. package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -11
  103. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  104. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  105. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  106. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  107. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  108. package/dist.commonjs/signer/dummy/index.js +14 -30
  109. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  110. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  111. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  112. package/dist.commonjs/signer/evm/index.js +14 -30
  113. package/dist.commonjs/signer/evm/signerEvm.d.ts +38 -42
  114. package/dist.commonjs/signer/evm/signerEvm.js +70 -105
  115. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  116. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  117. package/dist.commonjs/signer/evm/verify.d.ts +2 -6
  118. package/dist.commonjs/signer/evm/verify.js +2 -7
  119. package/dist.commonjs/signer/index.d.ts +1 -1
  120. package/dist.commonjs/signer/index.js +14 -30
  121. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  122. package/dist.commonjs/signer/nostr/index.js +14 -30
  123. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  124. package/dist.commonjs/signer/nostr/signerNostr.js +71 -100
  125. package/dist.commonjs/signer/nostr/verify.d.ts +3 -9
  126. package/dist.commonjs/signer/nostr/verify.js +39 -50
  127. package/dist.commonjs/signer/signer/index.d.ts +153 -171
  128. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  129. package/dist.commonjs/signer/signer/index.js +191 -234
  130. package/dist.commonjs/utils/index.d.ts +9 -42
  131. package/dist.commonjs/utils/index.js +12 -18
  132. package/package.json +3 -3
  133. package/src/address/address.advanced.ts +4 -4
  134. package/src/signer/ckb/signerCkbPrivateKey.ts +8 -8
  135. package/src/signer/signer/index.ts +6 -14
@@ -2,50 +2,44 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _1 = require(".");
4
4
  describe("fixedPointToString", () => {
5
- const cases = [
6
- [0n, "0"],
7
- [1n, "0.00000001"],
8
- [100000000n, "1"],
9
- [1000000000n, "10"],
10
- [1010100000n, "10.101"],
11
- [11n, "1.1", 1],
12
- [0n, "0", 1],
13
- [1n, "1", 0],
14
- [0n, "0", 0],
15
- ];
16
- cases.forEach(([i, o, decimals]) =>
17
- test(`${i} with ${decimals ?? "default"} decimals = "${o}"`, () => {
18
- expect((0, _1.fixedPointToString)(i, decimals)).toBe(o);
19
- }),
20
- );
5
+ const cases = [
6
+ [0n, "0"],
7
+ [1n, "0.00000001"],
8
+ [100000000n, "1"],
9
+ [1000000000n, "10"],
10
+ [1010100000n, "10.101"],
11
+ [11n, "1.1", 1],
12
+ [0n, "0", 1],
13
+ [1n, "1", 0],
14
+ [0n, "0", 0],
15
+ ];
16
+ cases.forEach(([i, o, decimals]) => test(`${i} with ${decimals ?? "default"} decimals = "${o}"`, () => {
17
+ expect((0, _1.fixedPointToString)(i, decimals)).toBe(o);
18
+ }));
21
19
  });
22
20
  describe("fixedPointFrom string", () => {
23
- const cases = [
24
- ["0", 0n],
25
- ["0.00000001", 1n],
26
- ["1", 100000000n],
27
- ["10", 1000000000n],
28
- ["10.101", 1010100000n],
29
- ["1.1", 11n, 1],
30
- ["0", 0n, 1],
31
- ["1", 1n, 0],
32
- ["0", 0n, 0],
33
- ];
34
- cases.forEach(([i, o, decimals]) =>
35
- test(`"${i}" = ${o} with ${decimals ?? "default"} decimals `, () => {
36
- expect((0, _1.fixedPointFrom)(i, decimals)).toBe(o);
37
- }),
38
- );
21
+ const cases = [
22
+ ["0", 0n],
23
+ ["0.00000001", 1n],
24
+ ["1", 100000000n],
25
+ ["10", 1000000000n],
26
+ ["10.101", 1010100000n],
27
+ ["1.1", 11n, 1],
28
+ ["0", 0n, 1],
29
+ ["1", 1n, 0],
30
+ ["0", 0n, 0],
31
+ ];
32
+ cases.forEach(([i, o, decimals]) => test(`"${i}" = ${o} with ${decimals ?? "default"} decimals `, () => {
33
+ expect((0, _1.fixedPointFrom)(i, decimals)).toBe(o);
34
+ }));
39
35
  });
40
36
  describe("fixedPointFrom number", () => {
41
- const cases = [
42
- [0.00000001, 1n],
43
- [10.101, 1010100000n],
44
- [1.1, 11n, 1],
45
- ];
46
- cases.forEach(([i, o, decimals]) =>
47
- test(`${i} = ${o} with ${decimals ?? "default"} decimals `, () => {
48
- expect((0, _1.fixedPointFrom)(i, decimals)).toBe(o);
49
- }),
50
- );
37
+ const cases = [
38
+ [0.00000001, 1n],
39
+ [10.101, 1010100000n],
40
+ [1.1, 11n, 1],
41
+ ];
42
+ cases.forEach(([i, o, decimals]) => test(`${i} = ${o} with ${decimals ?? "default"} decimals `, () => {
43
+ expect((0, _1.fixedPointFrom)(i, decimals)).toBe(o);
44
+ }));
51
45
  });
@@ -1,2 +1,2 @@
1
1
  export declare const CKB_BLAKE2B_PERSONAL = "ckb-default-hash";
2
- //# sourceMappingURL=advanced.d.ts.map
2
+ //# sourceMappingURL=advanced.d.ts.map
@@ -3,41 +3,41 @@ import { CellInputLike } from "../ckb";
3
3
  import { Hex } from "../hex";
4
4
  import { NumLike } from "../num";
5
5
  export declare class Hasher {
6
- private readonly hasher;
7
- /**
8
- * Creates an instance of Hasher.
9
- *
10
- * @param outLength - The output length of the hash in bytes. Default is 32.
11
- * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
12
- */
13
- constructor(outLength?: number, personal?: string);
14
- /**
15
- * Updates the hash with the given data.
16
- *
17
- * @param data - The data to update the hash with.
18
- * @returns The current Hasher instance for chaining.
19
- *
20
- * @example
21
- * ```typescript
22
- * const hasher = new Hasher();
23
- * hasher.update("some data").update("more data");
24
- * const hash = hasher.digest();
25
- * ```
26
- */
27
- update(data: BytesLike): Hasher;
28
- /**
29
- * Finalizes the hash and returns the digest as a hexadecimal string.
30
- *
31
- * @returns The hexadecimal string representation of the hash.
32
- *
33
- * @example
34
- * ```typescript
35
- * const hasher = new Hasher();
36
- * hasher.update("some data");
37
- * const hash = hasher.digest(); // Outputs something like "0x..."
38
- * ```
39
- */
40
- digest(): Hex;
6
+ private readonly hasher;
7
+ /**
8
+ * Creates an instance of Hasher.
9
+ *
10
+ * @param outLength - The output length of the hash in bytes. Default is 32.
11
+ * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
12
+ */
13
+ constructor(outLength?: number, personal?: string);
14
+ /**
15
+ * Updates the hash with the given data.
16
+ *
17
+ * @param data - The data to update the hash with.
18
+ * @returns The current Hasher instance for chaining.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const hasher = new Hasher();
23
+ * hasher.update("some data").update("more data");
24
+ * const hash = hasher.digest();
25
+ * ```
26
+ */
27
+ update(data: BytesLike): Hasher;
28
+ /**
29
+ * Finalizes the hash and returns the digest as a hexadecimal string.
30
+ *
31
+ * @returns The hexadecimal string representation of the hash.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const hasher = new Hasher();
36
+ * hasher.update("some data");
37
+ * const hash = hasher.digest(); // Outputs something like "0x..."
38
+ * ```
39
+ */
40
+ digest(): Hex;
41
41
  }
42
42
  /**
43
43
  * Computes the CKB hash of the given data using the Blake2b algorithm.
@@ -63,8 +63,5 @@ export declare function hashCkb(...data: BytesLike[]): Hex;
63
63
  * const hash = hashTypeId(cellInput, outputIndex); // Outputs something like "0x..."
64
64
  * ```
65
65
  */
66
- export declare function hashTypeId(
67
- cellInputLike: CellInputLike,
68
- outputIndex: NumLike,
69
- ): Hex;
70
- //# sourceMappingURL=index.d.ts.map
66
+ export declare function hashTypeId(cellInputLike: CellInputLike, outputIndex: NumLike): Hex;
67
+ //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  exports.hashTypeId = exports.hashCkb = exports.Hasher = void 0;
9
7
  const blake2b_1 = __importDefault(require("blake2b"));
@@ -12,52 +10,47 @@ const ckb_1 = require("../ckb");
12
10
  const num_1 = require("../num");
13
11
  const advanced_1 = require("./advanced");
14
12
  class Hasher {
15
- /**
16
- * Creates an instance of Hasher.
17
- *
18
- * @param outLength - The output length of the hash in bytes. Default is 32.
19
- * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
20
- */
21
- constructor(outLength = 32, personal = advanced_1.CKB_BLAKE2B_PERSONAL) {
22
- this.hasher = (0, blake2b_1.default)(
23
- outLength,
24
- undefined,
25
- undefined,
26
- (0, bytes_1.bytesFrom)(personal, "utf8"),
27
- );
28
- }
29
- /**
30
- * Updates the hash with the given data.
31
- *
32
- * @param data - The data to update the hash with.
33
- * @returns The current Hasher instance for chaining.
34
- *
35
- * @example
36
- * ```typescript
37
- * const hasher = new Hasher();
38
- * hasher.update("some data").update("more data");
39
- * const hash = hasher.digest();
40
- * ```
41
- */
42
- update(data) {
43
- this.hasher.update((0, bytes_1.bytesFrom)(data));
44
- return this;
45
- }
46
- /**
47
- * Finalizes the hash and returns the digest as a hexadecimal string.
48
- *
49
- * @returns The hexadecimal string representation of the hash.
50
- *
51
- * @example
52
- * ```typescript
53
- * const hasher = new Hasher();
54
- * hasher.update("some data");
55
- * const hash = hasher.digest(); // Outputs something like "0x..."
56
- * ```
57
- */
58
- digest() {
59
- return `0x${this.hasher.digest("hex")}`;
60
- }
13
+ /**
14
+ * Creates an instance of Hasher.
15
+ *
16
+ * @param outLength - The output length of the hash in bytes. Default is 32.
17
+ * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
18
+ */
19
+ constructor(outLength = 32, personal = advanced_1.CKB_BLAKE2B_PERSONAL) {
20
+ this.hasher = (0, blake2b_1.default)(outLength, undefined, undefined, (0, bytes_1.bytesFrom)(personal, "utf8"));
21
+ }
22
+ /**
23
+ * Updates the hash with the given data.
24
+ *
25
+ * @param data - The data to update the hash with.
26
+ * @returns The current Hasher instance for chaining.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const hasher = new Hasher();
31
+ * hasher.update("some data").update("more data");
32
+ * const hash = hasher.digest();
33
+ * ```
34
+ */
35
+ update(data) {
36
+ this.hasher.update((0, bytes_1.bytesFrom)(data));
37
+ return this;
38
+ }
39
+ /**
40
+ * Finalizes the hash and returns the digest as a hexadecimal string.
41
+ *
42
+ * @returns The hexadecimal string representation of the hash.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const hasher = new Hasher();
47
+ * hasher.update("some data");
48
+ * const hash = hasher.digest(); // Outputs something like "0x..."
49
+ * ```
50
+ */
51
+ digest() {
52
+ return `0x${this.hasher.digest("hex")}`;
53
+ }
61
54
  }
62
55
  exports.Hasher = Hasher;
63
56
  /**
@@ -72,9 +65,9 @@ exports.Hasher = Hasher;
72
65
  * ```
73
66
  */
74
67
  function hashCkb(...data) {
75
- const hasher = new Hasher();
76
- data.forEach((d) => hasher.update(d));
77
- return hasher.digest();
68
+ const hasher = new Hasher();
69
+ data.forEach((d) => hasher.update(d));
70
+ return hasher.digest();
78
71
  }
79
72
  exports.hashCkb = hashCkb;
80
73
  /**
@@ -90,9 +83,6 @@ exports.hashCkb = hashCkb;
90
83
  * ```
91
84
  */
92
85
  function hashTypeId(cellInputLike, outputIndex) {
93
- return hashCkb(
94
- ckb_1.CellInput.from(cellInputLike).toBytes(),
95
- (0, num_1.numLeToBytes)(outputIndex, 8),
96
- );
86
+ return hashCkb(ckb_1.CellInput.from(cellInputLike).toBytes(), (0, num_1.numLeToBytes)(outputIndex, 8));
97
87
  }
98
88
  exports.hashTypeId = hashTypeId;
@@ -21,4 +21,4 @@ export type HexLike = BytesLike;
21
21
  * ```
22
22
  */
23
23
  export declare function hexFrom(hex: HexLike): Hex;
24
- //# sourceMappingURL=index.d.ts.map
24
+ //# sourceMappingURL=index.d.ts.map
@@ -15,6 +15,6 @@ const bytes_1 = require("../bytes");
15
15
  * ```
16
16
  */
17
17
  function hexFrom(hex) {
18
- return `0x${(0, bytes_1.bytesTo)((0, bytes_1.bytesFrom)(hex), "hex")}`;
18
+ return `0x${(0, bytes_1.bytesTo)((0, bytes_1.bytesFrom)(hex), "hex")}`;
19
19
  }
20
20
  exports.hexFrom = hexFrom;
@@ -1,3 +1,3 @@
1
1
  export * from "./barrel";
2
2
  export * as ccc from "./barrel";
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -1,55 +1,30 @@
1
1
  "use strict";
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (
9
- !desc ||
10
- ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11
- ) {
12
- desc = {
13
- enumerable: true,
14
- get: function () {
15
- return m[k];
16
- },
17
- };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }
21
- : function (o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- });
25
- var __setModuleDefault =
26
- (this && this.__setModuleDefault) ||
27
- (Object.create
28
- ? function (o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }
31
- : function (o, v) {
32
- o["default"] = v;
33
- });
34
- var __exportStar =
35
- (this && this.__exportStar) ||
36
- function (m, exports) {
37
- for (var p in m)
38
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
39
- __createBinding(exports, m, p);
40
- };
41
- var __importStar =
42
- (this && this.__importStar) ||
43
- function (mod) {
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
44
22
  if (mod && mod.__esModule) return mod;
45
23
  var result = {};
46
- if (mod != null)
47
- for (var k in mod)
48
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
49
- __createBinding(result, mod, k);
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
50
25
  __setModuleDefault(result, mod);
51
26
  return result;
52
- };
27
+ };
53
28
  Object.defineProperty(exports, "__esModule", { value: true });
54
29
  exports.ccc = void 0;
55
30
  __exportStar(require("./barrel"), exports);
@@ -121,4 +121,4 @@ export declare function numLeFromBytes(val: BytesLike): Num;
121
121
  * ```
122
122
  */
123
123
  export declare function numBeFromBytes(val: BytesLike): Num;
124
- //# sourceMappingURL=index.d.ts.map
124
+ //# sourceMappingURL=index.d.ts.map
@@ -1,15 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.numBeFromBytes =
4
- exports.numLeFromBytes =
5
- exports.numFromBytes =
6
- exports.numBeToBytes =
7
- exports.numLeToBytes =
8
- exports.numToBytes =
9
- exports.numToHex =
10
- exports.numFrom =
11
- exports.numMax =
12
- void 0;
3
+ exports.numBeFromBytes = exports.numLeFromBytes = exports.numFromBytes = exports.numBeToBytes = exports.numLeToBytes = exports.numToBytes = exports.numToHex = exports.numFrom = exports.numMax = void 0;
13
4
  const bytes_1 = require("../bytes");
14
5
  const hex_1 = require("../hex");
15
6
  /**
@@ -24,14 +15,14 @@ const hex_1 = require("../hex");
24
15
  * ```
25
16
  */
26
17
  function numMax(a, ...numbers) {
27
- let max = numFrom(a);
28
- numbers.forEach((nLike) => {
29
- const n = numFrom(nLike);
30
- if (n > max) {
31
- max = n;
32
- }
33
- });
34
- return max;
18
+ let max = numFrom(a);
19
+ numbers.forEach((nLike) => {
20
+ const n = numFrom(nLike);
21
+ if (n > max) {
22
+ max = n;
23
+ }
24
+ });
25
+ return max;
35
26
  }
36
27
  exports.numMax = numMax;
37
28
  /**
@@ -47,13 +38,13 @@ exports.numMax = numMax;
47
38
  * ```
48
39
  */
49
40
  function numFrom(val) {
50
- if (typeof val === "bigint") {
51
- return val;
52
- }
53
- if (typeof val === "string" || typeof val === "number") {
54
- return BigInt(val);
55
- }
56
- return BigInt((0, hex_1.hexFrom)(val));
41
+ if (typeof val === "bigint") {
42
+ return val;
43
+ }
44
+ if (typeof val === "string" || typeof val === "number") {
45
+ return BigInt(val);
46
+ }
47
+ return BigInt((0, hex_1.hexFrom)(val));
57
48
  }
58
49
  exports.numFrom = numFrom;
59
50
  /**
@@ -68,7 +59,7 @@ exports.numFrom = numFrom;
68
59
  * ```
69
60
  */
70
61
  function numToHex(val) {
71
- return `0x${numFrom(val).toString(16)}`;
62
+ return `0x${numFrom(val).toString(16)}`;
72
63
  }
73
64
  exports.numToHex = numToHex;
74
65
  /**
@@ -84,7 +75,7 @@ exports.numToHex = numToHex;
84
75
  * ```
85
76
  */
86
77
  function numToBytes(val, bytes) {
87
- return numLeToBytes(val, bytes);
78
+ return numLeToBytes(val, bytes);
88
79
  }
89
80
  exports.numToBytes = numToBytes;
90
81
  /**
@@ -100,7 +91,7 @@ exports.numToBytes = numToBytes;
100
91
  * ```
101
92
  */
102
93
  function numLeToBytes(val, bytes) {
103
- return numBeToBytes(val, bytes).reverse();
94
+ return numBeToBytes(val, bytes).reverse();
104
95
  }
105
96
  exports.numLeToBytes = numLeToBytes;
106
97
  /**
@@ -116,14 +107,11 @@ exports.numLeToBytes = numLeToBytes;
116
107
  * ```
117
108
  */
118
109
  function numBeToBytes(val, bytes) {
119
- const rawBytes = (0, bytes_1.bytesFrom)(numFrom(val).toString(16));
120
- if (bytes == null) {
121
- return rawBytes;
122
- }
123
- return (0, bytes_1.bytesConcat)(
124
- Array.from(Array(bytes - rawBytes.length), () => 0),
125
- rawBytes,
126
- );
110
+ const rawBytes = (0, bytes_1.bytesFrom)(numFrom(val).toString(16));
111
+ if (bytes == null) {
112
+ return rawBytes;
113
+ }
114
+ return (0, bytes_1.bytesConcat)(Array.from(Array(bytes - rawBytes.length), () => 0), rawBytes);
127
115
  }
128
116
  exports.numBeToBytes = numBeToBytes;
129
117
  /**
@@ -138,7 +126,7 @@ exports.numBeToBytes = numBeToBytes;
138
126
  * ```
139
127
  */
140
128
  function numFromBytes(val) {
141
- return numLeFromBytes(val);
129
+ return numLeFromBytes(val);
142
130
  }
143
131
  exports.numFromBytes = numFromBytes;
144
132
  /**
@@ -153,7 +141,7 @@ exports.numFromBytes = numFromBytes;
153
141
  * ```
154
142
  */
155
143
  function numLeFromBytes(val) {
156
- return numBeFromBytes((0, bytes_1.bytesFrom)(val).reverse());
144
+ return numBeFromBytes((0, bytes_1.bytesFrom)(val).reverse());
157
145
  }
158
146
  exports.numLeFromBytes = numLeFromBytes;
159
147
  /**
@@ -168,6 +156,6 @@ exports.numLeFromBytes = numLeFromBytes;
168
156
  * ```
169
157
  */
170
158
  function numBeFromBytes(val) {
171
- return numFrom((0, bytes_1.bytesFrom)(val));
159
+ return numFrom((0, bytes_1.bytesFrom)(val));
172
160
  }
173
161
  exports.numBeFromBytes = numBeFromBytes;
@@ -1,4 +1,4 @@
1
1
  export * from "./signerBtc";
2
2
  export * from "./signerBtcPublicKeyReadonly";
3
3
  export * from "./verify";
4
- //# sourceMappingURL=index.d.ts.map
4
+ //# sourceMappingURL=index.d.ts.map
@@ -1,34 +1,18 @@
1
1
  "use strict";
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (
9
- !desc ||
10
- ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11
- ) {
12
- desc = {
13
- enumerable: true,
14
- get: function () {
15
- return m[k];
16
- },
17
- };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }
21
- : function (o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- });
25
- var __exportStar =
26
- (this && this.__exportStar) ||
27
- function (m, exports) {
28
- for (var p in m)
29
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
30
- __createBinding(exports, m, p);
31
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
32
16
  Object.defineProperty(exports, "__esModule", { value: true });
33
17
  __exportStar(require("./signerBtc"), exports);
34
18
  __exportStar(require("./signerBtcPublicKeyReadonly"), exports);