@ckb-ccc/core 0.0.8-alpha.3 → 0.0.9-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/ckb/script.js +2 -2
  2. package/dist/ckb/transaction.js +2 -2
  3. package/dist/client/client.d.ts +1 -0
  4. package/dist/client/client.d.ts.map +1 -1
  5. package/dist/client/client.js +1 -0
  6. package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  7. package/dist/client/clientPublicMainnet.advanced.js +35 -1
  8. package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  9. package/dist/client/clientPublicTestnet.advanced.js +20 -0
  10. package/dist/hasher/index.d.ts +17 -2
  11. package/dist/hasher/index.d.ts.map +1 -1
  12. package/dist/hasher/index.js +19 -2
  13. package/dist/signer/nostr/signerNostr.js +2 -2
  14. package/dist/signer/signer/index.d.ts +12 -0
  15. package/dist/signer/signer/index.d.ts.map +1 -1
  16. package/dist/signer/signer/index.js +18 -0
  17. package/dist.commonjs/address/address.advanced.d.ts +24 -29
  18. package/dist.commonjs/address/address.advanced.js +89 -115
  19. package/dist.commonjs/address/advanced.d.ts +1 -1
  20. package/dist.commonjs/address/advanced.js +14 -30
  21. package/dist.commonjs/address/index.d.ts +44 -51
  22. package/dist.commonjs/address/index.js +65 -84
  23. package/dist.commonjs/advanced.d.ts +1 -1
  24. package/dist.commonjs/advanced.js +22 -47
  25. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  26. package/dist.commonjs/advancedBarrel.js +14 -30
  27. package/dist.commonjs/barrel.d.ts +1 -1
  28. package/dist.commonjs/barrel.js +14 -30
  29. package/dist.commonjs/bytes/advanced.d.ts +2 -11
  30. package/dist.commonjs/bytes/index.d.ts +3 -9
  31. package/dist.commonjs/bytes/index.js +26 -28
  32. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  33. package/dist.commonjs/ckb/advanced.js +22 -47
  34. package/dist.commonjs/ckb/index.d.ts +1 -1
  35. package/dist.commonjs/ckb/index.js +14 -30
  36. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +260 -420
  37. package/dist.commonjs/ckb/molecule.advanced/generated.js +1332 -1536
  38. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  39. package/dist.commonjs/ckb/molecule.advanced/index.js +18 -34
  40. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  41. package/dist.commonjs/ckb/script.advanced.js +9 -12
  42. package/dist.commonjs/ckb/script.d.ts +117 -121
  43. package/dist.commonjs/ckb/script.js +176 -220
  44. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  45. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  46. package/dist.commonjs/ckb/transaction.d.ts +717 -792
  47. package/dist.commonjs/ckb/transaction.js +1155 -1383
  48. package/dist.commonjs/client/advanced.d.ts +1 -1
  49. package/dist.commonjs/client/advanced.js +14 -30
  50. package/dist.commonjs/client/client.advanced.d.ts +6 -23
  51. package/dist.commonjs/client/client.advanced.js +61 -89
  52. package/dist.commonjs/client/client.d.ts +54 -113
  53. package/dist.commonjs/client/client.d.ts.map +1 -1
  54. package/dist.commonjs/client/client.js +182 -214
  55. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +4 -8
  56. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  57. package/dist.commonjs/client/clientPublicMainnet.advanced.js +161 -144
  58. package/dist.commonjs/client/clientPublicMainnet.d.ts +6 -8
  59. package/dist.commonjs/client/clientPublicMainnet.js +15 -17
  60. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +3 -6
  61. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  62. package/dist.commonjs/client/clientPublicTestnet.advanced.js +199 -204
  63. package/dist.commonjs/client/clientPublicTestnet.d.ts +6 -8
  64. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  65. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  66. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  67. package/dist.commonjs/client/clientTypes.d.ts +26 -51
  68. package/dist.commonjs/client/clientTypes.js +22 -56
  69. package/dist.commonjs/client/index.d.ts +1 -1
  70. package/dist.commonjs/client/index.js +14 -30
  71. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  72. package/dist.commonjs/client/jsonRpc/advanced.js +14 -30
  73. package/dist.commonjs/client/jsonRpc/index.d.ts +75 -94
  74. package/dist.commonjs/client/jsonRpc/index.js +108 -135
  75. package/dist.commonjs/client/jsonRpc/transformers.d.ts +36 -76
  76. package/dist.commonjs/client/jsonRpc/transformers.js +152 -174
  77. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  78. package/dist.commonjs/fixedPoint/index.d.ts +3 -9
  79. package/dist.commonjs/fixedPoint/index.js +20 -26
  80. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  81. package/dist.commonjs/fixedPoint/index.test.js +36 -42
  82. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  83. package/dist.commonjs/hasher/index.d.ts +53 -38
  84. package/dist.commonjs/hasher/index.d.ts.map +1 -1
  85. package/dist.commonjs/hasher/index.js +69 -58
  86. package/dist.commonjs/hex/index.d.ts +1 -1
  87. package/dist.commonjs/hex/index.js +1 -1
  88. package/dist.commonjs/index.d.ts +1 -1
  89. package/dist.commonjs/index.js +22 -47
  90. package/dist.commonjs/num/index.d.ts +1 -1
  91. package/dist.commonjs/num/index.js +27 -39
  92. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  93. package/dist.commonjs/signer/btc/index.js +14 -30
  94. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  95. package/dist.commonjs/signer/btc/signerBtc.js +66 -89
  96. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  97. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  98. package/dist.commonjs/signer/btc/verify.d.ts +2 -6
  99. package/dist.commonjs/signer/btc/verify.js +3 -10
  100. package/dist.commonjs/signer/ckb/index.d.ts +1 -1
  101. package/dist.commonjs/signer/ckb/index.js +14 -30
  102. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  103. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  104. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +2 -6
  105. package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -11
  106. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  107. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  108. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  109. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  110. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  111. package/dist.commonjs/signer/dummy/index.js +14 -30
  112. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  113. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  114. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  115. package/dist.commonjs/signer/evm/index.js +14 -30
  116. package/dist.commonjs/signer/evm/signerEvm.d.ts +38 -42
  117. package/dist.commonjs/signer/evm/signerEvm.js +70 -105
  118. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  119. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  120. package/dist.commonjs/signer/evm/verify.d.ts +2 -6
  121. package/dist.commonjs/signer/evm/verify.js +2 -7
  122. package/dist.commonjs/signer/index.d.ts +1 -1
  123. package/dist.commonjs/signer/index.js +14 -30
  124. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  125. package/dist.commonjs/signer/nostr/index.js +14 -30
  126. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  127. package/dist.commonjs/signer/nostr/signerNostr.js +71 -100
  128. package/dist.commonjs/signer/nostr/verify.d.ts +3 -9
  129. package/dist.commonjs/signer/nostr/verify.js +39 -50
  130. package/dist.commonjs/signer/signer/index.d.ts +162 -156
  131. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  132. package/dist.commonjs/signer/signer/index.js +199 -208
  133. package/dist.commonjs/utils/index.d.ts +8 -38
  134. package/dist.commonjs/utils/index.js +12 -18
  135. package/package.json +3 -3
  136. package/src/ckb/script.ts +2 -2
  137. package/src/ckb/transaction.ts +2 -2
  138. package/src/client/client.ts +1 -0
  139. package/src/client/clientPublicMainnet.advanced.ts +40 -1
  140. package/src/client/clientPublicTestnet.advanced.ts +23 -0
  141. package/src/hasher/index.ts +27 -2
  142. package/src/signer/nostr/signerNostr.ts +2 -2
  143. package/src/signer/signer/index.ts +45 -0
@@ -1,33 +1,17 @@
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("./address.advanced"), exports);
@@ -2,60 +2,53 @@ import { Script, ScriptLike } from "../ckb";
2
2
  import { Client, KnownScript } from "../client";
3
3
  import { HexLike } from "../hex";
4
4
  export type AddressLike = {
5
- script: ScriptLike;
6
- prefix: string;
5
+ script: ScriptLike;
6
+ prefix: string;
7
7
  };
8
8
  /**
9
9
  * Represents a ckb address with associated script and prefix.
10
10
  */
11
11
  export declare class Address {
12
- script: Script;
13
- prefix: string;
14
- /**
15
- * Creates an instance of Address.
16
- *
17
- * @param script - The script associated with the address.
18
- * @param prefix - The address prefix.
19
- */
20
- constructor(script: Script, prefix: string);
21
- /**
22
- * Creates an Address instance from an AddressLike object.
23
- *
24
- * @param address - An AddressLike object or an instance of Address.
25
- * @returns An Address instance.
26
- */
27
- static from(address: AddressLike): Address;
28
- /**
29
- * Creates an Address instance from an address string.
30
- *
31
- * @param address - The address string to parse.
32
- * @param clients - A Client instance or a record of Client instances keyed by prefix.
33
- * @returns A promise that resolves to an Address instance.
34
- *
35
- * @throws Will throw an error if the address prefix is unknown or mismatched.
36
- */
37
- static fromString(
38
- address: string,
39
- clients: Client | Record<string, Client>,
40
- ): Promise<Address>;
41
- /**
42
- * Creates an Address instance from a script and client.
43
- *
44
- * @param script - The script-like object.
45
- * @param client - The client instance used to fetch the address prefix.
46
- * @returns A promise that resolves to an Address instance.
47
- */
48
- static fromScript(script: ScriptLike, client: Client): Address;
49
- static fromKnownScript(
50
- client: Client,
51
- script: KnownScript,
52
- args: HexLike,
53
- ): Promise<Address>;
54
- /**
55
- * Converts the Address instance to a string.
56
- *
57
- * @returns The address as a string.
58
- */
59
- toString(): string;
12
+ script: Script;
13
+ prefix: string;
14
+ /**
15
+ * Creates an instance of Address.
16
+ *
17
+ * @param script - The script associated with the address.
18
+ * @param prefix - The address prefix.
19
+ */
20
+ constructor(script: Script, prefix: string);
21
+ /**
22
+ * Creates an Address instance from an AddressLike object.
23
+ *
24
+ * @param address - An AddressLike object or an instance of Address.
25
+ * @returns An Address instance.
26
+ */
27
+ static from(address: AddressLike): Address;
28
+ /**
29
+ * Creates an Address instance from an address string.
30
+ *
31
+ * @param address - The address string to parse.
32
+ * @param clients - A Client instance or a record of Client instances keyed by prefix.
33
+ * @returns A promise that resolves to an Address instance.
34
+ *
35
+ * @throws Will throw an error if the address prefix is unknown or mismatched.
36
+ */
37
+ static fromString(address: string, clients: Client | Record<string, Client>): Promise<Address>;
38
+ /**
39
+ * Creates an Address instance from a script and client.
40
+ *
41
+ * @param script - The script-like object.
42
+ * @param client - The client instance used to fetch the address prefix.
43
+ * @returns A promise that resolves to an Address instance.
44
+ */
45
+ static fromScript(script: ScriptLike, client: Client): Address;
46
+ static fromKnownScript(client: Client, script: KnownScript, args: HexLike): Promise<Address>;
47
+ /**
48
+ * Converts the Address instance to a string.
49
+ *
50
+ * @returns The address as a string.
51
+ */
52
+ toString(): string;
60
53
  }
61
- //# sourceMappingURL=index.d.ts.map
54
+ //# sourceMappingURL=index.d.ts.map
@@ -9,92 +9,73 @@ const address_advanced_1 = require("./address.advanced");
9
9
  * Represents a ckb address with associated script and prefix.
10
10
  */
11
11
  class Address {
12
- /**
13
- * Creates an instance of Address.
14
- *
15
- * @param script - The script associated with the address.
16
- * @param prefix - The address prefix.
17
- */
18
- constructor(script, prefix) {
19
- this.script = script;
20
- this.prefix = prefix;
21
- }
22
- /**
23
- * Creates an Address instance from an AddressLike object.
24
- *
25
- * @param address - An AddressLike object or an instance of Address.
26
- * @returns An Address instance.
27
- */
28
- static from(address) {
29
- if (address instanceof Address) {
30
- return address;
12
+ /**
13
+ * Creates an instance of Address.
14
+ *
15
+ * @param script - The script associated with the address.
16
+ * @param prefix - The address prefix.
17
+ */
18
+ constructor(script, prefix) {
19
+ this.script = script;
20
+ this.prefix = prefix;
31
21
  }
32
- return new Address(ckb_1.Script.from(address.script), address.prefix);
33
- }
34
- /**
35
- * Creates an Address instance from an address string.
36
- *
37
- * @param address - The address string to parse.
38
- * @param clients - A Client instance or a record of Client instances keyed by prefix.
39
- * @returns A promise that resolves to an Address instance.
40
- *
41
- * @throws Will throw an error if the address prefix is unknown or mismatched.
42
- */
43
- static async fromString(address, clients) {
44
- const { prefix, format, payload } = (0,
45
- address_advanced_1.addressPayloadFromString)(address);
46
- const client = clients[prefix] ?? clients;
47
- if (!client) {
48
- throw new Error(`Unknown address prefix ${prefix}`);
22
+ /**
23
+ * Creates an Address instance from an AddressLike object.
24
+ *
25
+ * @param address - An AddressLike object or an instance of Address.
26
+ * @returns An Address instance.
27
+ */
28
+ static from(address) {
29
+ if (address instanceof Address) {
30
+ return address;
31
+ }
32
+ return new Address(ckb_1.Script.from(address.script), address.prefix);
49
33
  }
50
- const expectedPrefix = client.addressPrefix;
51
- if (expectedPrefix !== prefix) {
52
- throw new Error(
53
- `Unknown address prefix ${prefix}, expected ${expectedPrefix}`,
54
- );
34
+ /**
35
+ * Creates an Address instance from an address string.
36
+ *
37
+ * @param address - The address string to parse.
38
+ * @param clients - A Client instance or a record of Client instances keyed by prefix.
39
+ * @returns A promise that resolves to an Address instance.
40
+ *
41
+ * @throws Will throw an error if the address prefix is unknown or mismatched.
42
+ */
43
+ static async fromString(address, clients) {
44
+ const { prefix, format, payload } = (0, address_advanced_1.addressPayloadFromString)(address);
45
+ const client = clients[prefix] ?? clients;
46
+ if (!client) {
47
+ throw new Error(`Unknown address prefix ${prefix}`);
48
+ }
49
+ const expectedPrefix = client.addressPrefix;
50
+ if (expectedPrefix !== prefix) {
51
+ throw new Error(`Unknown address prefix ${prefix}, expected ${expectedPrefix}`);
52
+ }
53
+ return Address.from(await (0, address_advanced_1.addressFromPayload)(prefix, format, payload, client));
54
+ }
55
+ /**
56
+ * Creates an Address instance from a script and client.
57
+ *
58
+ * @param script - The script-like object.
59
+ * @param client - The client instance used to fetch the address prefix.
60
+ * @returns A promise that resolves to an Address instance.
61
+ */
62
+ static fromScript(script, client) {
63
+ return Address.from({ script, prefix: client.addressPrefix });
64
+ }
65
+ static async fromKnownScript(client, script, args) {
66
+ return Address.from({
67
+ script: await ckb_1.Script.fromKnownScript(client, script, args),
68
+ prefix: client.addressPrefix,
69
+ });
70
+ }
71
+ /**
72
+ * Converts the Address instance to a string.
73
+ *
74
+ * @returns The address as a string.
75
+ */
76
+ toString() {
77
+ const data = (0, bytes_1.bytesConcat)([address_advanced_1.AddressFormat.Full], (0, bytes_1.bytesFrom)(this.script.codeHash), (0, ckb_1.hashTypeToBytes)(this.script.hashType), (0, bytes_1.bytesFrom)(this.script.args));
78
+ return bech32_1.bech32m.encode(this.prefix, bech32_1.bech32m.toWords(data), address_advanced_1.ADDRESS_BECH32_LIMIT);
55
79
  }
56
- return Address.from(
57
- await (0, address_advanced_1.addressFromPayload)(
58
- prefix,
59
- format,
60
- payload,
61
- client,
62
- ),
63
- );
64
- }
65
- /**
66
- * Creates an Address instance from a script and client.
67
- *
68
- * @param script - The script-like object.
69
- * @param client - The client instance used to fetch the address prefix.
70
- * @returns A promise that resolves to an Address instance.
71
- */
72
- static fromScript(script, client) {
73
- return Address.from({ script, prefix: client.addressPrefix });
74
- }
75
- static async fromKnownScript(client, script, args) {
76
- return Address.from({
77
- script: await ckb_1.Script.fromKnownScript(client, script, args),
78
- prefix: client.addressPrefix,
79
- });
80
- }
81
- /**
82
- * Converts the Address instance to a string.
83
- *
84
- * @returns The address as a string.
85
- */
86
- toString() {
87
- const data = (0, bytes_1.bytesConcat)(
88
- [address_advanced_1.AddressFormat.Full],
89
- (0, bytes_1.bytesFrom)(this.script.codeHash),
90
- (0, ckb_1.hashTypeToBytes)(this.script.hashType),
91
- (0, bytes_1.bytesFrom)(this.script.args),
92
- );
93
- return bech32_1.bech32m.encode(
94
- this.prefix,
95
- bech32_1.bech32m.toWords(data),
96
- address_advanced_1.ADDRESS_BECH32_LIMIT,
97
- );
98
- }
99
80
  }
100
81
  exports.Address = Address;
@@ -1,3 +1,3 @@
1
1
  export * from "./advancedBarrel";
2
2
  export * as cccA from "./advancedBarrel";
3
- //# sourceMappingURL=advanced.d.ts.map
3
+ //# sourceMappingURL=advanced.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.cccA = void 0;
55
30
  __exportStar(require("./advancedBarrel"), exports);
@@ -2,4 +2,4 @@ export * from "./address/advanced";
2
2
  export * from "./ckb/advanced";
3
3
  export * from "./client/advanced";
4
4
  export * from "./hasher/advanced";
5
- //# sourceMappingURL=advancedBarrel.d.ts.map
5
+ //# sourceMappingURL=advancedBarrel.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("./address/advanced"), exports);
34
18
  __exportStar(require("./ckb/advanced"), exports);
@@ -8,4 +8,4 @@ export * from "./hex";
8
8
  export * from "./num";
9
9
  export * from "./signer";
10
10
  export * from "./utils";
11
- //# sourceMappingURL=barrel.d.ts.map
11
+ //# sourceMappingURL=barrel.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("./address"), exports);
34
18
  __exportStar(require("./bytes"), exports);
@@ -1,14 +1,5 @@
1
1
  /**
2
2
  * Represents the possible encoding formats for converting bytes.
3
3
  */
4
- export type BytesFromEncoding =
5
- | "utf8"
6
- | "utf16le"
7
- | "latin1"
8
- | "base64"
9
- | "base64url"
10
- | "hex"
11
- | "ascii"
12
- | "binary"
13
- | "ucs2";
14
- //# sourceMappingURL=advanced.d.ts.map
4
+ export type BytesFromEncoding = "utf8" | "utf16le" | "latin1" | "base64" | "base64url" | "hex" | "ascii" | "binary" | "ucs2";
5
+ //# sourceMappingURL=advanced.d.ts.map
@@ -35,10 +35,7 @@ export declare function bytesConcat(...args: BytesLike[]): Bytes;
35
35
  * console.log(base64String); // Outputs "aGVsbG8="
36
36
  * ```
37
37
  */
38
- export declare function bytesTo(
39
- val: BytesLike,
40
- encoding: BytesFromEncoding,
41
- ): string;
38
+ export declare function bytesTo(val: BytesLike, encoding: BytesFromEncoding): string;
42
39
  /**
43
40
  * Converts various types of byte-like values to a Uint8Array.
44
41
  *
@@ -63,8 +60,5 @@ export declare function bytesTo(
63
60
  * console.log(bytes4); // Outputs Uint8Array [1, 2, 255]
64
61
  * ```
65
62
  */
66
- export declare function bytesFrom(
67
- bytes: BytesLike,
68
- encoding?: BytesFromEncoding,
69
- ): Bytes;
70
- //# sourceMappingURL=index.d.ts.map
63
+ export declare function bytesFrom(bytes: BytesLike, encoding?: BytesFromEncoding): Bytes;
64
+ //# sourceMappingURL=index.d.ts.map
@@ -20,12 +20,10 @@ const buffer_1 = require("buffer/");
20
20
  * ```
21
21
  */
22
22
  function bytesConcat(...args) {
23
- return new Uint8Array(
24
- args.reduce((acc, v) => {
25
- acc.push(...bytesFrom(v));
26
- return acc;
27
- }, []),
28
- );
23
+ return new Uint8Array(args.reduce((acc, v) => {
24
+ acc.push(...bytesFrom(v));
25
+ return acc;
26
+ }, []));
29
27
  }
30
28
  exports.bytesConcat = bytesConcat;
31
29
  /**
@@ -45,7 +43,7 @@ exports.bytesConcat = bytesConcat;
45
43
  * ```
46
44
  */
47
45
  function bytesTo(val, encoding) {
48
- return buffer_1.Buffer.from(bytesFrom(val)).toString(encoding);
46
+ return buffer_1.Buffer.from(bytesFrom(val)).toString(encoding);
49
47
  }
50
48
  exports.bytesTo = bytesTo;
51
49
  /**
@@ -73,27 +71,27 @@ exports.bytesTo = bytesTo;
73
71
  * ```
74
72
  */
75
73
  function bytesFrom(bytes, encoding) {
76
- if (bytes instanceof Uint8Array) {
77
- return bytes;
78
- }
79
- if (bytes instanceof ArrayBuffer) {
80
- return new Uint8Array(bytes);
81
- }
82
- if (Array.isArray(bytes)) {
83
- if (bytes.some((v) => v < 0 || 0xff < v)) {
84
- throw new Error(`Invalid bytes ${JSON.stringify(bytes)}`);
74
+ if (bytes instanceof Uint8Array) {
75
+ return bytes;
85
76
  }
86
- return new Uint8Array(bytes);
87
- }
88
- if (encoding !== undefined) {
89
- return buffer_1.Buffer.from(bytes, encoding);
90
- }
91
- const str = bytes.startsWith("0x") ? bytes.slice(2) : bytes;
92
- const paddedStr = str.length % 2 === 0 ? str : `0${str}`;
93
- const data = buffer_1.Buffer.from(paddedStr, "hex");
94
- if (data.length * 2 !== paddedStr.length) {
95
- throw new Error(`Invalid bytes ${bytes}`);
96
- }
97
- return data;
77
+ if (bytes instanceof ArrayBuffer) {
78
+ return new Uint8Array(bytes);
79
+ }
80
+ if (Array.isArray(bytes)) {
81
+ if (bytes.some((v) => v < 0 || 0xff < v)) {
82
+ throw new Error(`Invalid bytes ${JSON.stringify(bytes)}`);
83
+ }
84
+ return new Uint8Array(bytes);
85
+ }
86
+ if (encoding !== undefined) {
87
+ return buffer_1.Buffer.from(bytes, encoding);
88
+ }
89
+ const str = bytes.startsWith("0x") ? bytes.slice(2) : bytes;
90
+ const paddedStr = str.length % 2 === 0 ? str : `0${str}`;
91
+ const data = buffer_1.Buffer.from(paddedStr, "hex");
92
+ if (data.length * 2 !== paddedStr.length) {
93
+ throw new Error(`Invalid bytes ${bytes}`);
94
+ }
95
+ return data;
98
96
  }
99
97
  exports.bytesFrom = bytesFrom;
@@ -1,4 +1,4 @@
1
1
  export * as moleculeCodecCkb from "./molecule.advanced";
2
2
  export * from "./script.advanced";
3
3
  export * from "./transaction.advanced";
4
- //# sourceMappingURL=advanced.d.ts.map
4
+ //# sourceMappingURL=advanced.d.ts.map