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

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 (173) hide show
  1. package/dist/ckb/transaction.d.ts +19 -15
  2. package/dist/ckb/transaction.d.ts.map +1 -1
  3. package/dist/ckb/transaction.js +44 -10
  4. package/dist/client/client.d.ts +1 -1
  5. package/dist/client/client.d.ts.map +1 -1
  6. package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  7. package/dist/client/clientPublicMainnet.advanced.js +30 -2
  8. package/dist/client/clientPublicTestnet.advanced.js +3 -3
  9. package/dist/client/clientTypes.advanced.d.ts +8 -8
  10. package/dist/client/clientTypes.advanced.d.ts.map +1 -1
  11. package/dist/client/clientTypes.d.ts +2 -2
  12. package/dist/client/clientTypes.d.ts.map +1 -1
  13. package/dist/client/clientTypes.js +2 -2
  14. package/dist/signer/ckb/index.d.ts +2 -0
  15. package/dist/signer/ckb/index.d.ts.map +1 -1
  16. package/dist/signer/ckb/index.js +2 -0
  17. package/dist/signer/ckb/signerCkbPrivateKey.d.ts +4 -13
  18. package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  19. package/dist/signer/ckb/signerCkbPrivateKey.js +10 -37
  20. package/dist/signer/ckb/signerCkbPublicKey.d.ts +18 -0
  21. package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +1 -0
  22. package/dist/signer/ckb/signerCkbPublicKey.js +44 -0
  23. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +5 -0
  24. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -0
  25. package/dist/signer/ckb/verifyCkbSecp256k1.js +14 -0
  26. package/dist/signer/signer/index.d.ts.map +1 -1
  27. package/dist/signer/signer/index.js +2 -0
  28. package/dist/utils/index.d.ts +18 -9
  29. package/dist/utils/index.d.ts.map +1 -1
  30. package/dist/utils/index.js +2 -2
  31. package/dist.commonjs/address/address.advanced.d.ts +29 -24
  32. package/dist.commonjs/address/address.advanced.js +115 -89
  33. package/dist.commonjs/address/advanced.d.ts +1 -1
  34. package/dist.commonjs/address/advanced.js +30 -14
  35. package/dist.commonjs/address/index.d.ts +51 -44
  36. package/dist.commonjs/address/index.js +84 -65
  37. package/dist.commonjs/advanced.d.ts +1 -1
  38. package/dist.commonjs/advanced.js +47 -22
  39. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  40. package/dist.commonjs/advancedBarrel.js +30 -14
  41. package/dist.commonjs/barrel.d.ts +1 -1
  42. package/dist.commonjs/barrel.js +30 -14
  43. package/dist.commonjs/bytes/advanced.d.ts +11 -2
  44. package/dist.commonjs/bytes/index.d.ts +9 -3
  45. package/dist.commonjs/bytes/index.js +28 -26
  46. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  47. package/dist.commonjs/ckb/advanced.js +47 -22
  48. package/dist.commonjs/ckb/index.d.ts +1 -1
  49. package/dist.commonjs/ckb/index.js +30 -14
  50. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +420 -260
  51. package/dist.commonjs/ckb/molecule.advanced/generated.js +1536 -1332
  52. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  53. package/dist.commonjs/ckb/molecule.advanced/index.js +34 -18
  54. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  55. package/dist.commonjs/ckb/script.advanced.js +12 -9
  56. package/dist.commonjs/ckb/script.d.ts +121 -117
  57. package/dist.commonjs/ckb/script.js +220 -176
  58. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  59. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  60. package/dist.commonjs/ckb/transaction.d.ts +806 -718
  61. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  62. package/dist.commonjs/ckb/transaction.js +1425 -1158
  63. package/dist.commonjs/client/advanced.d.ts +1 -1
  64. package/dist.commonjs/client/advanced.js +30 -14
  65. package/dist.commonjs/client/client.advanced.d.ts +23 -6
  66. package/dist.commonjs/client/client.advanced.js +89 -61
  67. package/dist.commonjs/client/client.d.ts +114 -54
  68. package/dist.commonjs/client/client.d.ts.map +1 -1
  69. package/dist.commonjs/client/client.js +215 -182
  70. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +8 -4
  71. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  72. package/dist.commonjs/client/clientPublicMainnet.advanced.js +215 -161
  73. package/dist.commonjs/client/clientPublicMainnet.d.ts +8 -6
  74. package/dist.commonjs/client/clientPublicMainnet.js +17 -15
  75. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +6 -3
  76. package/dist.commonjs/client/clientPublicTestnet.advanced.js +227 -199
  77. package/dist.commonjs/client/clientPublicTestnet.d.ts +8 -6
  78. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  79. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  80. package/dist.commonjs/client/clientTypes.advanced.d.ts.map +1 -1
  81. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  82. package/dist.commonjs/client/clientTypes.d.ts +52 -27
  83. package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
  84. package/dist.commonjs/client/clientTypes.js +56 -22
  85. package/dist.commonjs/client/index.d.ts +1 -1
  86. package/dist.commonjs/client/index.js +30 -14
  87. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  88. package/dist.commonjs/client/jsonRpc/advanced.js +30 -14
  89. package/dist.commonjs/client/jsonRpc/index.d.ts +94 -75
  90. package/dist.commonjs/client/jsonRpc/index.js +135 -108
  91. package/dist.commonjs/client/jsonRpc/transformers.d.ts +76 -36
  92. package/dist.commonjs/client/jsonRpc/transformers.js +174 -152
  93. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  94. package/dist.commonjs/fixedPoint/index.d.ts +9 -3
  95. package/dist.commonjs/fixedPoint/index.js +26 -20
  96. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  97. package/dist.commonjs/fixedPoint/index.test.js +42 -36
  98. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  99. package/dist.commonjs/hasher/index.d.ts +40 -37
  100. package/dist.commonjs/hasher/index.js +58 -48
  101. package/dist.commonjs/hex/index.d.ts +1 -1
  102. package/dist.commonjs/hex/index.js +1 -1
  103. package/dist.commonjs/index.d.ts +1 -1
  104. package/dist.commonjs/index.js +47 -22
  105. package/dist.commonjs/num/index.d.ts +1 -1
  106. package/dist.commonjs/num/index.js +39 -27
  107. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  108. package/dist.commonjs/signer/btc/index.js +30 -14
  109. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  110. package/dist.commonjs/signer/btc/signerBtc.js +89 -66
  111. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  112. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  113. package/dist.commonjs/signer/btc/verify.d.ts +6 -2
  114. package/dist.commonjs/signer/btc/verify.js +10 -3
  115. package/dist.commonjs/signer/ckb/index.d.ts +3 -1
  116. package/dist.commonjs/signer/ckb/index.d.ts.map +1 -1
  117. package/dist.commonjs/signer/ckb/index.js +32 -14
  118. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +8 -17
  119. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  120. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +45 -58
  121. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +18 -0
  122. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +1 -0
  123. package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +58 -0
  124. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  125. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  126. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +11 -0
  127. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -0
  128. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +27 -0
  129. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +6 -2
  130. package/dist.commonjs/signer/ckb/verifyJoyId.js +11 -8
  131. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  132. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  133. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  134. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  135. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  136. package/dist.commonjs/signer/dummy/index.js +30 -14
  137. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  138. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  139. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  140. package/dist.commonjs/signer/evm/index.js +30 -14
  141. package/dist.commonjs/signer/evm/signerEvm.d.ts +42 -38
  142. package/dist.commonjs/signer/evm/signerEvm.js +105 -70
  143. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  144. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  145. package/dist.commonjs/signer/evm/verify.d.ts +6 -2
  146. package/dist.commonjs/signer/evm/verify.js +7 -2
  147. package/dist.commonjs/signer/index.d.ts +1 -1
  148. package/dist.commonjs/signer/index.js +30 -14
  149. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  150. package/dist.commonjs/signer/nostr/index.js +30 -14
  151. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  152. package/dist.commonjs/signer/nostr/signerNostr.js +100 -71
  153. package/dist.commonjs/signer/nostr/verify.d.ts +9 -3
  154. package/dist.commonjs/signer/nostr/verify.js +50 -39
  155. package/dist.commonjs/signer/signer/index.d.ts +171 -162
  156. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  157. package/dist.commonjs/signer/signer/index.js +235 -197
  158. package/dist.commonjs/utils/index.d.ts +56 -14
  159. package/dist.commonjs/utils/index.d.ts.map +1 -1
  160. package/dist.commonjs/utils/index.js +19 -13
  161. package/package.json +2 -2
  162. package/src/ckb/transaction.ts +87 -33
  163. package/src/client/client.ts +1 -1
  164. package/src/client/clientPublicMainnet.advanced.ts +34 -2
  165. package/src/client/clientPublicTestnet.advanced.ts +3 -3
  166. package/src/client/clientTypes.advanced.ts +8 -8
  167. package/src/client/clientTypes.ts +4 -4
  168. package/src/signer/ckb/index.ts +2 -0
  169. package/src/signer/ckb/signerCkbPrivateKey.ts +14 -54
  170. package/src/signer/ckb/signerCkbPublicKey.ts +63 -0
  171. package/src/signer/ckb/verifyCkbSecp256k1.ts +27 -0
  172. package/src/signer/signer/index.ts +6 -0
  173. package/src/utils/index.ts +24 -12
@@ -2,44 +2,50 @@
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]) => test(`${i} with ${decimals ?? "default"} decimals = "${o}"`, () => {
17
- expect((0, _1.fixedPointToString)(i, decimals)).toBe(o);
18
- }));
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
+ );
19
21
  });
20
22
  describe("fixedPointFrom string", () => {
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
- }));
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
+ );
35
39
  });
36
40
  describe("fixedPointFrom number", () => {
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
- }));
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
+ );
45
51
  });
@@ -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,5 +63,8 @@ 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(cellInputLike: CellInputLike, outputIndex: NumLike): Hex;
67
- //# sourceMappingURL=index.d.ts.map
66
+ export declare function hashTypeId(
67
+ cellInputLike: CellInputLike,
68
+ outputIndex: NumLike,
69
+ ): Hex;
70
+ //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
5
7
  Object.defineProperty(exports, "__esModule", { value: true });
6
8
  exports.hashTypeId = exports.hashCkb = exports.Hasher = void 0;
7
9
  const blake2b_1 = __importDefault(require("blake2b"));
@@ -10,47 +12,52 @@ const ckb_1 = require("../ckb");
10
12
  const num_1 = require("../num");
11
13
  const advanced_1 = require("./advanced");
12
14
  class Hasher {
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
- }
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
+ }
54
61
  }
55
62
  exports.Hasher = Hasher;
56
63
  /**
@@ -65,9 +72,9 @@ exports.Hasher = Hasher;
65
72
  * ```
66
73
  */
67
74
  function hashCkb(...data) {
68
- const hasher = new Hasher();
69
- data.forEach((d) => hasher.update(d));
70
- return hasher.digest();
75
+ const hasher = new Hasher();
76
+ data.forEach((d) => hasher.update(d));
77
+ return hasher.digest();
71
78
  }
72
79
  exports.hashCkb = hashCkb;
73
80
  /**
@@ -83,6 +90,9 @@ exports.hashCkb = hashCkb;
83
90
  * ```
84
91
  */
85
92
  function hashTypeId(cellInputLike, outputIndex) {
86
- return hashCkb(ckb_1.CellInput.from(cellInputLike).toBytes(), (0, num_1.numLeToBytes)(outputIndex, 8));
93
+ return hashCkb(
94
+ ckb_1.CellInput.from(cellInputLike).toBytes(),
95
+ (0, num_1.numLeToBytes)(outputIndex, 8),
96
+ );
87
97
  }
88
98
  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,30 +1,55 @@
1
1
  "use strict";
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) {
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) {
22
44
  if (mod && mod.__esModule) return mod;
23
45
  var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
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);
25
50
  __setModuleDefault(result, mod);
26
51
  return result;
27
- };
52
+ };
28
53
  Object.defineProperty(exports, "__esModule", { value: true });
29
54
  exports.ccc = void 0;
30
55
  __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,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.numBeFromBytes = exports.numLeFromBytes = exports.numFromBytes = exports.numBeToBytes = exports.numLeToBytes = exports.numToBytes = exports.numToHex = exports.numFrom = exports.numMax = void 0;
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;
4
13
  const bytes_1 = require("../bytes");
5
14
  const hex_1 = require("../hex");
6
15
  /**
@@ -15,14 +24,14 @@ const hex_1 = require("../hex");
15
24
  * ```
16
25
  */
17
26
  function numMax(a, ...numbers) {
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;
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;
26
35
  }
27
36
  exports.numMax = numMax;
28
37
  /**
@@ -38,13 +47,13 @@ exports.numMax = numMax;
38
47
  * ```
39
48
  */
40
49
  function numFrom(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));
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));
48
57
  }
49
58
  exports.numFrom = numFrom;
50
59
  /**
@@ -59,7 +68,7 @@ exports.numFrom = numFrom;
59
68
  * ```
60
69
  */
61
70
  function numToHex(val) {
62
- return `0x${numFrom(val).toString(16)}`;
71
+ return `0x${numFrom(val).toString(16)}`;
63
72
  }
64
73
  exports.numToHex = numToHex;
65
74
  /**
@@ -75,7 +84,7 @@ exports.numToHex = numToHex;
75
84
  * ```
76
85
  */
77
86
  function numToBytes(val, bytes) {
78
- return numLeToBytes(val, bytes);
87
+ return numLeToBytes(val, bytes);
79
88
  }
80
89
  exports.numToBytes = numToBytes;
81
90
  /**
@@ -91,7 +100,7 @@ exports.numToBytes = numToBytes;
91
100
  * ```
92
101
  */
93
102
  function numLeToBytes(val, bytes) {
94
- return numBeToBytes(val, bytes).reverse();
103
+ return numBeToBytes(val, bytes).reverse();
95
104
  }
96
105
  exports.numLeToBytes = numLeToBytes;
97
106
  /**
@@ -107,11 +116,14 @@ exports.numLeToBytes = numLeToBytes;
107
116
  * ```
108
117
  */
109
118
  function numBeToBytes(val, bytes) {
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);
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
+ );
115
127
  }
116
128
  exports.numBeToBytes = numBeToBytes;
117
129
  /**
@@ -126,7 +138,7 @@ exports.numBeToBytes = numBeToBytes;
126
138
  * ```
127
139
  */
128
140
  function numFromBytes(val) {
129
- return numLeFromBytes(val);
141
+ return numLeFromBytes(val);
130
142
  }
131
143
  exports.numFromBytes = numFromBytes;
132
144
  /**
@@ -141,7 +153,7 @@ exports.numFromBytes = numFromBytes;
141
153
  * ```
142
154
  */
143
155
  function numLeFromBytes(val) {
144
- return numBeFromBytes((0, bytes_1.bytesFrom)(val).reverse());
156
+ return numBeFromBytes((0, bytes_1.bytesFrom)(val).reverse());
145
157
  }
146
158
  exports.numLeFromBytes = numLeFromBytes;
147
159
  /**
@@ -156,6 +168,6 @@ exports.numLeFromBytes = numLeFromBytes;
156
168
  * ```
157
169
  */
158
170
  function numBeFromBytes(val) {
159
- return numFrom((0, bytes_1.bytesFrom)(val));
171
+ return numFrom((0, bytes_1.bytesFrom)(val));
160
172
  }
161
173
  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,18 +1,34 @@
1
1
  "use strict";
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
- };
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
+ };
16
32
  Object.defineProperty(exports, "__esModule", { value: true });
17
33
  __exportStar(require("./signerBtc"), exports);
18
34
  __exportStar(require("./signerBtcPublicKeyReadonly"), exports);