@ckb-ccc/core 0.0.7-alpha.2 → 0.0.8-alpha.3

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 (115) hide show
  1. package/README.md +6 -4
  2. package/dist.commonjs/address/address.advanced.d.ts +29 -24
  3. package/dist.commonjs/address/address.advanced.js +115 -89
  4. package/dist.commonjs/address/advanced.d.ts +1 -1
  5. package/dist.commonjs/address/advanced.js +30 -14
  6. package/dist.commonjs/address/index.d.ts +51 -44
  7. package/dist.commonjs/address/index.js +84 -65
  8. package/dist.commonjs/advanced.d.ts +1 -1
  9. package/dist.commonjs/advanced.js +47 -22
  10. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  11. package/dist.commonjs/advancedBarrel.js +30 -14
  12. package/dist.commonjs/barrel.d.ts +1 -1
  13. package/dist.commonjs/barrel.js +30 -14
  14. package/dist.commonjs/bytes/advanced.d.ts +11 -2
  15. package/dist.commonjs/bytes/index.d.ts +9 -3
  16. package/dist.commonjs/bytes/index.js +28 -26
  17. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  18. package/dist.commonjs/ckb/advanced.js +47 -22
  19. package/dist.commonjs/ckb/index.d.ts +1 -1
  20. package/dist.commonjs/ckb/index.js +30 -14
  21. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +420 -260
  22. package/dist.commonjs/ckb/molecule.advanced/generated.js +1536 -1332
  23. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  24. package/dist.commonjs/ckb/molecule.advanced/index.js +34 -18
  25. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  26. package/dist.commonjs/ckb/script.advanced.js +12 -9
  27. package/dist.commonjs/ckb/script.d.ts +121 -117
  28. package/dist.commonjs/ckb/script.js +220 -176
  29. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  30. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  31. package/dist.commonjs/ckb/transaction.d.ts +792 -717
  32. package/dist.commonjs/ckb/transaction.js +1383 -1155
  33. package/dist.commonjs/client/advanced.d.ts +1 -1
  34. package/dist.commonjs/client/advanced.js +30 -14
  35. package/dist.commonjs/client/client.advanced.d.ts +23 -6
  36. package/dist.commonjs/client/client.advanced.js +89 -61
  37. package/dist.commonjs/client/client.d.ts +113 -53
  38. package/dist.commonjs/client/client.js +214 -181
  39. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +8 -4
  40. package/dist.commonjs/client/clientPublicMainnet.advanced.js +144 -127
  41. package/dist.commonjs/client/clientPublicMainnet.d.ts +8 -6
  42. package/dist.commonjs/client/clientPublicMainnet.js +17 -15
  43. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +6 -3
  44. package/dist.commonjs/client/clientPublicTestnet.advanced.js +204 -179
  45. package/dist.commonjs/client/clientPublicTestnet.d.ts +8 -6
  46. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  47. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  48. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  49. package/dist.commonjs/client/clientTypes.d.ts +51 -26
  50. package/dist.commonjs/client/clientTypes.js +56 -22
  51. package/dist.commonjs/client/index.d.ts +1 -1
  52. package/dist.commonjs/client/index.js +30 -14
  53. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  54. package/dist.commonjs/client/jsonRpc/advanced.js +30 -14
  55. package/dist.commonjs/client/jsonRpc/index.d.ts +94 -75
  56. package/dist.commonjs/client/jsonRpc/index.js +135 -108
  57. package/dist.commonjs/client/jsonRpc/transformers.d.ts +76 -36
  58. package/dist.commonjs/client/jsonRpc/transformers.js +174 -152
  59. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  60. package/dist.commonjs/fixedPoint/index.d.ts +9 -3
  61. package/dist.commonjs/fixedPoint/index.js +26 -20
  62. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  63. package/dist.commonjs/fixedPoint/index.test.js +42 -36
  64. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  65. package/dist.commonjs/hasher/index.d.ts +36 -36
  66. package/dist.commonjs/hasher/index.js +54 -47
  67. package/dist.commonjs/hex/index.d.ts +1 -1
  68. package/dist.commonjs/hex/index.js +1 -1
  69. package/dist.commonjs/index.d.ts +1 -1
  70. package/dist.commonjs/index.js +47 -22
  71. package/dist.commonjs/num/index.d.ts +1 -1
  72. package/dist.commonjs/num/index.js +39 -27
  73. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  74. package/dist.commonjs/signer/btc/index.js +30 -14
  75. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  76. package/dist.commonjs/signer/btc/signerBtc.js +89 -66
  77. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  78. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  79. package/dist.commonjs/signer/btc/verify.d.ts +6 -2
  80. package/dist.commonjs/signer/btc/verify.js +10 -3
  81. package/dist.commonjs/signer/ckb/index.d.ts +1 -1
  82. package/dist.commonjs/signer/ckb/index.js +30 -14
  83. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  84. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  85. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +6 -2
  86. package/dist.commonjs/signer/ckb/verifyJoyId.js +11 -8
  87. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  88. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  89. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  90. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  91. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  92. package/dist.commonjs/signer/dummy/index.js +30 -14
  93. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  94. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  95. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  96. package/dist.commonjs/signer/evm/index.js +30 -14
  97. package/dist.commonjs/signer/evm/signerEvm.d.ts +42 -38
  98. package/dist.commonjs/signer/evm/signerEvm.js +105 -70
  99. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  100. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  101. package/dist.commonjs/signer/evm/verify.d.ts +6 -2
  102. package/dist.commonjs/signer/evm/verify.js +7 -2
  103. package/dist.commonjs/signer/index.d.ts +1 -1
  104. package/dist.commonjs/signer/index.js +30 -14
  105. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  106. package/dist.commonjs/signer/nostr/index.js +30 -14
  107. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  108. package/dist.commonjs/signer/nostr/signerNostr.js +100 -71
  109. package/dist.commonjs/signer/nostr/verify.d.ts +9 -3
  110. package/dist.commonjs/signer/nostr/verify.js +50 -39
  111. package/dist.commonjs/signer/signer/index.d.ts +156 -150
  112. package/dist.commonjs/signer/signer/index.js +208 -181
  113. package/dist.commonjs/utils/index.d.ts +38 -8
  114. package/dist.commonjs/utils/index.js +18 -12
  115. package/package.json +2 -2
@@ -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
@@ -1,41 +1,41 @@
1
1
  import { BytesLike } from "../bytes";
2
2
  import { Hex } from "../hex";
3
3
  export declare class Hasher {
4
- private readonly hasher;
5
- /**
6
- * Creates an instance of Hasher.
7
- *
8
- * @param outLength - The output length of the hash in bytes. Default is 32.
9
- * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
10
- */
11
- constructor(outLength?: number, personal?: string);
12
- /**
13
- * Updates the hash with the given data.
14
- *
15
- * @param data - The data to update the hash with.
16
- * @returns The current Hasher instance for chaining.
17
- *
18
- * @example
19
- * ```typescript
20
- * const hasher = new Hasher();
21
- * hasher.update("some data").update("more data");
22
- * const hash = hasher.digest();
23
- * ```
24
- */
25
- update(data: BytesLike): Hasher;
26
- /**
27
- * Finalizes the hash and returns the digest as a hexadecimal string.
28
- *
29
- * @returns The hexadecimal string representation of the hash.
30
- *
31
- * @example
32
- * ```typescript
33
- * const hasher = new Hasher();
34
- * hasher.update("some data");
35
- * const hash = hasher.digest(); // Outputs something like "0x..."
36
- * ```
37
- */
38
- digest(): Hex;
4
+ private readonly hasher;
5
+ /**
6
+ * Creates an instance of Hasher.
7
+ *
8
+ * @param outLength - The output length of the hash in bytes. Default is 32.
9
+ * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
10
+ */
11
+ constructor(outLength?: number, personal?: string);
12
+ /**
13
+ * Updates the hash with the given data.
14
+ *
15
+ * @param data - The data to update the hash with.
16
+ * @returns The current Hasher instance for chaining.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const hasher = new Hasher();
21
+ * hasher.update("some data").update("more data");
22
+ * const hash = hasher.digest();
23
+ * ```
24
+ */
25
+ update(data: BytesLike): Hasher;
26
+ /**
27
+ * Finalizes the hash and returns the digest as a hexadecimal string.
28
+ *
29
+ * @returns The hexadecimal string representation of the hash.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const hasher = new Hasher();
34
+ * hasher.update("some data");
35
+ * const hash = hasher.digest(); // Outputs something like "0x..."
36
+ * ```
37
+ */
38
+ digest(): Hex;
39
39
  }
40
40
  /**
41
41
  * Computes the CKB hash of the given data using the Blake2b algorithm.
@@ -49,4 +49,4 @@ export declare class Hasher {
49
49
  * ```
50
50
  */
51
51
  export declare function ckbHash(...data: BytesLike[]): Hex;
52
- //# sourceMappingURL=index.d.ts.map
52
+ //# sourceMappingURL=index.d.ts.map
@@ -1,54 +1,61 @@
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.ckbHash = exports.Hasher = void 0;
7
9
  const blake2b_1 = __importDefault(require("blake2b"));
8
10
  const bytes_1 = require("../bytes");
9
11
  const advanced_1 = require("./advanced");
10
12
  class Hasher {
11
- /**
12
- * Creates an instance of Hasher.
13
- *
14
- * @param outLength - The output length of the hash in bytes. Default is 32.
15
- * @param personal - The personal string for the Blake2b algorithm. Default is CKB_BLAKE2B_PERSONAL.
16
- */
17
- constructor(outLength = 32, personal = advanced_1.CKB_BLAKE2B_PERSONAL) {
18
- this.hasher = (0, blake2b_1.default)(outLength, undefined, undefined, (0, bytes_1.bytesFrom)(personal, "utf8"));
19
- }
20
- /**
21
- * Updates the hash with the given data.
22
- *
23
- * @param data - The data to update the hash with.
24
- * @returns The current Hasher instance for chaining.
25
- *
26
- * @example
27
- * ```typescript
28
- * const hasher = new Hasher();
29
- * hasher.update("some data").update("more data");
30
- * const hash = hasher.digest();
31
- * ```
32
- */
33
- update(data) {
34
- this.hasher.update((0, bytes_1.bytesFrom)(data));
35
- return this;
36
- }
37
- /**
38
- * Finalizes the hash and returns the digest as a hexadecimal string.
39
- *
40
- * @returns The hexadecimal string representation of the hash.
41
- *
42
- * @example
43
- * ```typescript
44
- * const hasher = new Hasher();
45
- * hasher.update("some data");
46
- * const hash = hasher.digest(); // Outputs something like "0x..."
47
- * ```
48
- */
49
- digest() {
50
- return `0x${this.hasher.digest("hex")}`;
51
- }
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)(
21
+ outLength,
22
+ undefined,
23
+ undefined,
24
+ (0, bytes_1.bytesFrom)(personal, "utf8"),
25
+ );
26
+ }
27
+ /**
28
+ * Updates the hash with the given data.
29
+ *
30
+ * @param data - The data to update the hash with.
31
+ * @returns The current Hasher instance for chaining.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const hasher = new Hasher();
36
+ * hasher.update("some data").update("more data");
37
+ * const hash = hasher.digest();
38
+ * ```
39
+ */
40
+ update(data) {
41
+ this.hasher.update((0, bytes_1.bytesFrom)(data));
42
+ return this;
43
+ }
44
+ /**
45
+ * Finalizes the hash and returns the digest as a hexadecimal string.
46
+ *
47
+ * @returns The hexadecimal string representation of the hash.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const hasher = new Hasher();
52
+ * hasher.update("some data");
53
+ * const hash = hasher.digest(); // Outputs something like "0x..."
54
+ * ```
55
+ */
56
+ digest() {
57
+ return `0x${this.hasher.digest("hex")}`;
58
+ }
52
59
  }
53
60
  exports.Hasher = Hasher;
54
61
  /**
@@ -63,8 +70,8 @@ exports.Hasher = Hasher;
63
70
  * ```
64
71
  */
65
72
  function ckbHash(...data) {
66
- const hasher = new Hasher();
67
- data.forEach((d) => hasher.update(d));
68
- return hasher.digest();
73
+ const hasher = new Hasher();
74
+ data.forEach((d) => hasher.update(d));
75
+ return hasher.digest();
69
76
  }
70
77
  exports.ckbHash = ckbHash;
@@ -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);