@ckb-ccc/core 0.0.9-alpha.1 → 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 (190) 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/clientPublicMainnet.d.ts.map +1 -1
  9. package/dist/client/clientPublicMainnet.js +1 -1
  10. package/dist/client/clientPublicTestnet.advanced.js +3 -3
  11. package/dist/client/clientPublicTestnet.d.ts.map +1 -1
  12. package/dist/client/clientPublicTestnet.js +1 -1
  13. package/dist/client/clientTypes.advanced.d.ts +8 -8
  14. package/dist/client/clientTypes.advanced.d.ts.map +1 -1
  15. package/dist/client/clientTypes.d.ts +2 -2
  16. package/dist/client/clientTypes.d.ts.map +1 -1
  17. package/dist/client/clientTypes.js +2 -2
  18. package/dist/signer/ckb/index.d.ts +3 -0
  19. package/dist/signer/ckb/index.d.ts.map +1 -1
  20. package/dist/signer/ckb/index.js +3 -0
  21. package/dist/signer/ckb/signerCkbPrivateKey.d.ts +12 -0
  22. package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -0
  23. package/dist/signer/ckb/signerCkbPrivateKey.js +38 -0
  24. package/dist/signer/ckb/signerCkbPublicKey.d.ts +18 -0
  25. package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +1 -0
  26. package/dist/signer/ckb/signerCkbPublicKey.js +44 -0
  27. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +5 -0
  28. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -0
  29. package/dist/signer/ckb/verifyCkbSecp256k1.js +14 -0
  30. package/dist/signer/evm/signerEvm.d.ts +2 -1
  31. package/dist/signer/evm/signerEvm.d.ts.map +1 -1
  32. package/dist/signer/evm/signerEvmAddressReadonly.d.ts +2 -2
  33. package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  34. package/dist/signer/signer/index.d.ts +8 -6
  35. package/dist/signer/signer/index.d.ts.map +1 -1
  36. package/dist/signer/signer/index.js +9 -5
  37. package/dist/utils/index.d.ts +18 -9
  38. package/dist/utils/index.d.ts.map +1 -1
  39. package/dist/utils/index.js +2 -2
  40. package/dist.commonjs/address/address.advanced.d.ts +29 -24
  41. package/dist.commonjs/address/address.advanced.js +115 -89
  42. package/dist.commonjs/address/advanced.d.ts +1 -1
  43. package/dist.commonjs/address/advanced.js +30 -14
  44. package/dist.commonjs/address/index.d.ts +51 -44
  45. package/dist.commonjs/address/index.js +84 -65
  46. package/dist.commonjs/advanced.d.ts +1 -1
  47. package/dist.commonjs/advanced.js +47 -22
  48. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  49. package/dist.commonjs/advancedBarrel.js +30 -14
  50. package/dist.commonjs/barrel.d.ts +1 -1
  51. package/dist.commonjs/barrel.js +30 -14
  52. package/dist.commonjs/bytes/advanced.d.ts +11 -2
  53. package/dist.commonjs/bytes/index.d.ts +9 -3
  54. package/dist.commonjs/bytes/index.js +28 -26
  55. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  56. package/dist.commonjs/ckb/advanced.js +47 -22
  57. package/dist.commonjs/ckb/index.d.ts +1 -1
  58. package/dist.commonjs/ckb/index.js +30 -14
  59. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +420 -260
  60. package/dist.commonjs/ckb/molecule.advanced/generated.js +1536 -1332
  61. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  62. package/dist.commonjs/ckb/molecule.advanced/index.js +34 -18
  63. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  64. package/dist.commonjs/ckb/script.advanced.js +12 -9
  65. package/dist.commonjs/ckb/script.d.ts +121 -117
  66. package/dist.commonjs/ckb/script.js +220 -176
  67. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  68. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  69. package/dist.commonjs/ckb/transaction.d.ts +806 -718
  70. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  71. package/dist.commonjs/ckb/transaction.js +1425 -1158
  72. package/dist.commonjs/client/advanced.d.ts +1 -1
  73. package/dist.commonjs/client/advanced.js +30 -14
  74. package/dist.commonjs/client/client.advanced.d.ts +23 -6
  75. package/dist.commonjs/client/client.advanced.js +89 -61
  76. package/dist.commonjs/client/client.d.ts +114 -54
  77. package/dist.commonjs/client/client.d.ts.map +1 -1
  78. package/dist.commonjs/client/client.js +215 -182
  79. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +8 -4
  80. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  81. package/dist.commonjs/client/clientPublicMainnet.advanced.js +215 -161
  82. package/dist.commonjs/client/clientPublicMainnet.d.ts +8 -6
  83. package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
  84. package/dist.commonjs/client/clientPublicMainnet.js +17 -15
  85. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +6 -3
  86. package/dist.commonjs/client/clientPublicTestnet.advanced.js +227 -199
  87. package/dist.commonjs/client/clientPublicTestnet.d.ts +8 -6
  88. package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
  89. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  90. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  91. package/dist.commonjs/client/clientTypes.advanced.d.ts.map +1 -1
  92. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  93. package/dist.commonjs/client/clientTypes.d.ts +52 -27
  94. package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
  95. package/dist.commonjs/client/clientTypes.js +56 -22
  96. package/dist.commonjs/client/index.d.ts +1 -1
  97. package/dist.commonjs/client/index.js +30 -14
  98. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  99. package/dist.commonjs/client/jsonRpc/advanced.js +30 -14
  100. package/dist.commonjs/client/jsonRpc/index.d.ts +94 -75
  101. package/dist.commonjs/client/jsonRpc/index.js +135 -108
  102. package/dist.commonjs/client/jsonRpc/transformers.d.ts +76 -36
  103. package/dist.commonjs/client/jsonRpc/transformers.js +174 -152
  104. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  105. package/dist.commonjs/fixedPoint/index.d.ts +9 -3
  106. package/dist.commonjs/fixedPoint/index.js +26 -20
  107. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  108. package/dist.commonjs/fixedPoint/index.test.js +42 -36
  109. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  110. package/dist.commonjs/hasher/index.d.ts +40 -37
  111. package/dist.commonjs/hasher/index.js +58 -48
  112. package/dist.commonjs/hex/index.d.ts +1 -1
  113. package/dist.commonjs/hex/index.js +1 -1
  114. package/dist.commonjs/index.d.ts +1 -1
  115. package/dist.commonjs/index.js +47 -22
  116. package/dist.commonjs/num/index.d.ts +1 -1
  117. package/dist.commonjs/num/index.js +39 -27
  118. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  119. package/dist.commonjs/signer/btc/index.js +30 -14
  120. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  121. package/dist.commonjs/signer/btc/signerBtc.js +89 -66
  122. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  123. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  124. package/dist.commonjs/signer/btc/verify.d.ts +6 -2
  125. package/dist.commonjs/signer/btc/verify.js +10 -3
  126. package/dist.commonjs/signer/ckb/index.d.ts +4 -1
  127. package/dist.commonjs/signer/ckb/index.d.ts.map +1 -1
  128. package/dist.commonjs/signer/ckb/index.js +33 -14
  129. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +12 -0
  130. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -0
  131. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +56 -0
  132. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +18 -0
  133. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +1 -0
  134. package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +58 -0
  135. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  136. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  137. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +11 -0
  138. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -0
  139. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +27 -0
  140. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +6 -2
  141. package/dist.commonjs/signer/ckb/verifyJoyId.js +11 -8
  142. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  143. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  144. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  145. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  146. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  147. package/dist.commonjs/signer/dummy/index.js +30 -14
  148. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  149. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  150. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  151. package/dist.commonjs/signer/evm/index.js +30 -14
  152. package/dist.commonjs/signer/evm/signerEvm.d.ts +43 -38
  153. package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
  154. package/dist.commonjs/signer/evm/signerEvm.js +105 -70
  155. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +38 -38
  156. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  157. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  158. package/dist.commonjs/signer/evm/verify.d.ts +6 -2
  159. package/dist.commonjs/signer/evm/verify.js +7 -2
  160. package/dist.commonjs/signer/index.d.ts +1 -1
  161. package/dist.commonjs/signer/index.js +30 -14
  162. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  163. package/dist.commonjs/signer/nostr/index.js +30 -14
  164. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  165. package/dist.commonjs/signer/nostr/signerNostr.js +100 -71
  166. package/dist.commonjs/signer/nostr/verify.d.ts +9 -3
  167. package/dist.commonjs/signer/nostr/verify.js +50 -39
  168. package/dist.commonjs/signer/signer/index.d.ts +171 -160
  169. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  170. package/dist.commonjs/signer/signer/index.js +235 -195
  171. package/dist.commonjs/utils/index.d.ts +56 -14
  172. package/dist.commonjs/utils/index.d.ts.map +1 -1
  173. package/dist.commonjs/utils/index.js +19 -13
  174. package/package.json +2 -2
  175. package/src/ckb/transaction.ts +87 -33
  176. package/src/client/client.ts +1 -1
  177. package/src/client/clientPublicMainnet.advanced.ts +34 -2
  178. package/src/client/clientPublicMainnet.ts +1 -1
  179. package/src/client/clientPublicTestnet.advanced.ts +3 -3
  180. package/src/client/clientPublicTestnet.ts +1 -1
  181. package/src/client/clientTypes.advanced.ts +8 -8
  182. package/src/client/clientTypes.ts +4 -4
  183. package/src/signer/ckb/index.ts +3 -0
  184. package/src/signer/ckb/signerCkbPrivateKey.ts +58 -0
  185. package/src/signer/ckb/signerCkbPublicKey.ts +63 -0
  186. package/src/signer/ckb/verifyCkbSecp256k1.ts +27 -0
  187. package/src/signer/evm/signerEvm.ts +2 -2
  188. package/src/signer/evm/signerEvmAddressReadonly.ts +1 -1
  189. package/src/signer/signer/index.ts +17 -9
  190. package/src/utils/index.ts +24 -12
@@ -7,49 +7,49 @@ import { Signer, SignerSignType, SignerType } from "../signer";
7
7
  * This class does not support signing operations.
8
8
  */
9
9
  export declare class SignerCkbScriptReadonly extends Signer {
10
- get type(): SignerType;
11
- get signType(): SignerSignType;
12
- private readonly script;
13
- /**
14
- * Creates an instance of SignerCkbScriptReadonly.
15
- *
16
- * @param client - The client instance used for communication.
17
- * @param script - The script associated with the signer.
18
- */
19
- constructor(client: Client, script: ScriptLike);
20
- /**
21
- * Connects to the client. This implementation does nothing as the class is read-only.
22
- *
23
- * @returns A promise that resolves when the connection is complete.
24
- */
25
- connect(): Promise<void>;
26
- /**
27
- * Check if the signer is connected.
28
- *
29
- * @returns A promise that resolves the connection status.
30
- */
31
- isConnected(): Promise<boolean>;
32
- /**
33
- * Gets the internal address for the script.
34
- *
35
- * @returns A promise that resolves to a string representing the internal address.
36
- *
37
- * @example
38
- * ```typescript
39
- * const internalAddress = await signer.getInternalAddress(); // Outputs the internal address
40
- * ```
41
- */
42
- getInternalAddress(): Promise<string>;
43
- /**
44
- * Gets an array of Address objects representing the script address.
45
- *
46
- * @returns A promise that resolves to an array of Address objects.
47
- *
48
- * @example
49
- * ```typescript
50
- * const addressObjs = await signer.getAddressObjs(); // Outputs the array of Address objects
51
- * ```
52
- */
53
- getAddressObjs(): Promise<Address[]>;
10
+ get type(): SignerType;
11
+ get signType(): SignerSignType;
12
+ private readonly script;
13
+ /**
14
+ * Creates an instance of SignerCkbScriptReadonly.
15
+ *
16
+ * @param client - The client instance used for communication.
17
+ * @param script - The script associated with the signer.
18
+ */
19
+ constructor(client: Client, script: ScriptLike);
20
+ /**
21
+ * Connects to the client. This implementation does nothing as the class is read-only.
22
+ *
23
+ * @returns A promise that resolves when the connection is complete.
24
+ */
25
+ connect(): Promise<void>;
26
+ /**
27
+ * Check if the signer is connected.
28
+ *
29
+ * @returns A promise that resolves the connection status.
30
+ */
31
+ isConnected(): Promise<boolean>;
32
+ /**
33
+ * Gets the internal address for the script.
34
+ *
35
+ * @returns A promise that resolves to a string representing the internal address.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const internalAddress = await signer.getInternalAddress(); // Outputs the internal address
40
+ * ```
41
+ */
42
+ getInternalAddress(): Promise<string>;
43
+ /**
44
+ * Gets an array of Address objects representing the script address.
45
+ *
46
+ * @returns A promise that resolves to an array of Address objects.
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const addressObjs = await signer.getAddressObjs(); // Outputs the array of Address objects
51
+ * ```
52
+ */
53
+ getAddressObjs(): Promise<Address[]>;
54
54
  }
55
- //# sourceMappingURL=signerCkbScriptReadonly.d.ts.map
55
+ //# sourceMappingURL=signerCkbScriptReadonly.d.ts.map
@@ -9,61 +9,61 @@ const signer_1 = require("../signer");
9
9
  * This class does not support signing operations.
10
10
  */
11
11
  class SignerCkbScriptReadonly extends signer_1.Signer {
12
- get type() {
13
- return signer_1.SignerType.CKB;
14
- }
15
- get signType() {
16
- return signer_1.SignerSignType.Unknown;
17
- }
18
- /**
19
- * Creates an instance of SignerCkbScriptReadonly.
20
- *
21
- * @param client - The client instance used for communication.
22
- * @param script - The script associated with the signer.
23
- */
24
- constructor(client, script) {
25
- super(client);
26
- this.script = ckb_1.Script.from(script);
27
- }
28
- /**
29
- * Connects to the client. This implementation does nothing as the class is read-only.
30
- *
31
- * @returns A promise that resolves when the connection is complete.
32
- */
33
- async connect() { }
34
- /**
35
- * Check if the signer is connected.
36
- *
37
- * @returns A promise that resolves the connection status.
38
- */
39
- async isConnected() {
40
- return true;
41
- }
42
- /**
43
- * Gets the internal address for the script.
44
- *
45
- * @returns A promise that resolves to a string representing the internal address.
46
- *
47
- * @example
48
- * ```typescript
49
- * const internalAddress = await signer.getInternalAddress(); // Outputs the internal address
50
- * ```
51
- */
52
- async getInternalAddress() {
53
- return this.getRecommendedAddress();
54
- }
55
- /**
56
- * Gets an array of Address objects representing the script address.
57
- *
58
- * @returns A promise that resolves to an array of Address objects.
59
- *
60
- * @example
61
- * ```typescript
62
- * const addressObjs = await signer.getAddressObjs(); // Outputs the array of Address objects
63
- * ```
64
- */
65
- async getAddressObjs() {
66
- return [address_1.Address.fromScript(this.script, this.client)];
67
- }
12
+ get type() {
13
+ return signer_1.SignerType.CKB;
14
+ }
15
+ get signType() {
16
+ return signer_1.SignerSignType.Unknown;
17
+ }
18
+ /**
19
+ * Creates an instance of SignerCkbScriptReadonly.
20
+ *
21
+ * @param client - The client instance used for communication.
22
+ * @param script - The script associated with the signer.
23
+ */
24
+ constructor(client, script) {
25
+ super(client);
26
+ this.script = ckb_1.Script.from(script);
27
+ }
28
+ /**
29
+ * Connects to the client. This implementation does nothing as the class is read-only.
30
+ *
31
+ * @returns A promise that resolves when the connection is complete.
32
+ */
33
+ async connect() {}
34
+ /**
35
+ * Check if the signer is connected.
36
+ *
37
+ * @returns A promise that resolves the connection status.
38
+ */
39
+ async isConnected() {
40
+ return true;
41
+ }
42
+ /**
43
+ * Gets the internal address for the script.
44
+ *
45
+ * @returns A promise that resolves to a string representing the internal address.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const internalAddress = await signer.getInternalAddress(); // Outputs the internal address
50
+ * ```
51
+ */
52
+ async getInternalAddress() {
53
+ return this.getRecommendedAddress();
54
+ }
55
+ /**
56
+ * Gets an array of Address objects representing the script address.
57
+ *
58
+ * @returns A promise that resolves to an array of Address objects.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const addressObjs = await signer.getAddressObjs(); // Outputs the array of Address objects
63
+ * ```
64
+ */
65
+ async getAddressObjs() {
66
+ return [address_1.Address.fromScript(this.script, this.client)];
67
+ }
68
68
  }
69
69
  exports.SignerCkbScriptReadonly = SignerCkbScriptReadonly;
@@ -0,0 +1,11 @@
1
+ import { BytesLike } from "../../bytes";
2
+ import { Hex } from "../../hex";
3
+ export declare function messageHashCkbSecp256k1(
4
+ message: string | BytesLike,
5
+ ): Hex;
6
+ export declare function verifyMessageCkbSecp256k1(
7
+ message: string | BytesLike,
8
+ signature: string,
9
+ publicKey: string,
10
+ ): boolean;
11
+ //# sourceMappingURL=verifyCkbSecp256k1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyCkbSecp256k1.d.ts","sourceRoot":"","sources":["../../../src/signer/ckb/verifyCkbSecp256k1.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,GAAG,EAAW,MAAM,WAAW,CAAC;AAGzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,CAIxE;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAUT"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyMessageCkbSecp256k1 = exports.messageHashCkbSecp256k1 = void 0;
4
+ const secp256k1_1 = require("@noble/curves/secp256k1");
5
+ const bytes_1 = require("../../bytes");
6
+ const hasher_1 = require("../../hasher");
7
+ const hex_1 = require("../../hex");
8
+ const num_1 = require("../../num");
9
+ function messageHashCkbSecp256k1(message) {
10
+ const msg =
11
+ typeof message === "string" ? message : (0, hex_1.hexFrom)(message);
12
+ const buffer = (0, bytes_1.bytesFrom)(`Nervos Message:${msg}`, "utf8");
13
+ return (0, hasher_1.hashCkb)(buffer);
14
+ }
15
+ exports.messageHashCkbSecp256k1 = messageHashCkbSecp256k1;
16
+ function verifyMessageCkbSecp256k1(message, signature, publicKey) {
17
+ const signatureBytes = (0, bytes_1.bytesFrom)(signature);
18
+ return secp256k1_1.secp256k1.verify(
19
+ new secp256k1_1.secp256k1.Signature(
20
+ (0, num_1.numFrom)(signatureBytes.slice(0, 32)),
21
+ (0, num_1.numFrom)(signatureBytes.slice(32, 64)),
22
+ ).addRecoveryBit(Number((0, num_1.numFrom)(signatureBytes.slice(64, 65)))),
23
+ (0, bytes_1.bytesFrom)(messageHashCkbSecp256k1(message)),
24
+ (0, bytes_1.bytesFrom)(publicKey),
25
+ );
26
+ }
27
+ exports.verifyMessageCkbSecp256k1 = verifyMessageCkbSecp256k1;
@@ -1,3 +1,7 @@
1
1
  import { BytesLike } from "../../bytes";
2
- export declare function verifyMessageJoyId(message: string | BytesLike, signature: string, identity: string): Promise<boolean>;
3
- //# sourceMappingURL=verifyJoyId.d.ts.map
2
+ export declare function verifyMessageJoyId(
3
+ message: string | BytesLike,
4
+ signature: string,
5
+ identity: string,
6
+ ): Promise<boolean>;
7
+ //# sourceMappingURL=verifyJoyId.d.ts.map
@@ -4,13 +4,16 @@ exports.verifyMessageJoyId = void 0;
4
4
  const ckb_1 = require("@joyid/ckb");
5
5
  const hex_1 = require("../../hex");
6
6
  function verifyMessageJoyId(message, signature, identity) {
7
- const challenge = typeof message === "string" ? message : (0, hex_1.hexFrom)(message).slice(2);
8
- const { publicKey, keyType } = JSON.parse(identity);
9
- return (0, ckb_1.verifySignature)({
10
- challenge,
11
- pubkey: publicKey,
12
- keyType,
13
- ...JSON.parse(signature),
14
- });
7
+ const challenge =
8
+ typeof message === "string"
9
+ ? message
10
+ : (0, hex_1.hexFrom)(message).slice(2);
11
+ const { publicKey, keyType } = JSON.parse(identity);
12
+ return (0, ckb_1.verifySignature)({
13
+ challenge,
14
+ pubkey: publicKey,
15
+ keyType,
16
+ ...JSON.parse(signature),
17
+ });
15
18
  }
16
19
  exports.verifyMessageJoyId = verifyMessageJoyId;
@@ -2,8 +2,8 @@ import { Client } from "../../client";
2
2
  import { SignerType } from "../signer";
3
3
  import { SignerDummy } from "./dummy";
4
4
  export declare class SignerAlwaysError extends SignerDummy {
5
- private readonly message;
6
- constructor(client: Client, type: SignerType, message: string);
7
- connect(): Promise<void>;
5
+ private readonly message;
6
+ constructor(client: Client, type: SignerType, message: string);
7
+ connect(): Promise<void>;
8
8
  }
9
- //# sourceMappingURL=alwaysError.d.ts.map
9
+ //# sourceMappingURL=alwaysError.d.ts.map
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SignerAlwaysError = void 0;
4
4
  const dummy_1 = require("./dummy");
5
5
  class SignerAlwaysError extends dummy_1.SignerDummy {
6
- constructor(client, type, message) {
7
- super(client, type);
8
- this.message = message;
9
- }
10
- async connect() {
11
- throw new Error(this.message);
12
- }
6
+ constructor(client, type, message) {
7
+ super(client, type);
8
+ this.message = message;
9
+ }
10
+ async connect() {
11
+ throw new Error(this.message);
12
+ }
13
13
  }
14
14
  exports.SignerAlwaysError = SignerAlwaysError;
@@ -2,11 +2,11 @@ import { Address } from "../../address";
2
2
  import { Client } from "../../client";
3
3
  import { Signer, SignerSignType, SignerType } from "../signer";
4
4
  export declare abstract class SignerDummy extends Signer {
5
- readonly type: SignerType;
6
- get signType(): SignerSignType;
7
- constructor(client: Client, type: SignerType);
8
- isConnected(): Promise<boolean>;
9
- getInternalAddress(): Promise<string>;
10
- getAddressObjs(): Promise<Address[]>;
5
+ readonly type: SignerType;
6
+ get signType(): SignerSignType;
7
+ constructor(client: Client, type: SignerType);
8
+ isConnected(): Promise<boolean>;
9
+ getInternalAddress(): Promise<string>;
10
+ getAddressObjs(): Promise<Address[]>;
11
11
  }
12
- //# sourceMappingURL=dummy.d.ts.map
12
+ //# sourceMappingURL=dummy.d.ts.map
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SignerDummy = void 0;
4
4
  const signer_1 = require("../signer");
5
5
  class SignerDummy extends signer_1.Signer {
6
- get signType() {
7
- return signer_1.SignerSignType.Unknown;
8
- }
9
- constructor(client, type) {
10
- super(client);
11
- this.type = type;
12
- }
13
- async isConnected() {
14
- return false;
15
- }
16
- async getInternalAddress() {
17
- throw new Error("Can't get address from SignerDummy");
18
- }
19
- async getAddressObjs() {
20
- throw new Error("Can't get addresses from SignerDummy");
21
- }
6
+ get signType() {
7
+ return signer_1.SignerSignType.Unknown;
8
+ }
9
+ constructor(client, type) {
10
+ super(client);
11
+ this.type = type;
12
+ }
13
+ async isConnected() {
14
+ return false;
15
+ }
16
+ async getInternalAddress() {
17
+ throw new Error("Can't get address from SignerDummy");
18
+ }
19
+ async getAddressObjs() {
20
+ throw new Error("Can't get addresses from SignerDummy");
21
+ }
22
22
  }
23
23
  exports.SignerDummy = SignerDummy;
@@ -1,4 +1,4 @@
1
1
  export * from "./alwaysError";
2
2
  export * from "./dummy";
3
3
  export * from "./openLink";
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("./alwaysError"), exports);
18
34
  __exportStar(require("./dummy"), exports);
@@ -2,8 +2,8 @@ import { Client } from "../../client";
2
2
  import { SignerType } from "../signer";
3
3
  import { SignerDummy } from "./dummy";
4
4
  export declare class SignerOpenLink extends SignerDummy {
5
- private readonly link;
6
- constructor(client: Client, type: SignerType, link: string);
7
- connect(): Promise<void>;
5
+ private readonly link;
6
+ constructor(client: Client, type: SignerType, link: string);
7
+ connect(): Promise<void>;
8
8
  }
9
- //# sourceMappingURL=openLink.d.ts.map
9
+ //# sourceMappingURL=openLink.d.ts.map
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SignerOpenLink = void 0;
4
4
  const dummy_1 = require("./dummy");
5
5
  class SignerOpenLink extends dummy_1.SignerDummy {
6
- constructor(client, type, link) {
7
- super(client, type);
8
- this.link = link;
9
- }
10
- async connect() {
11
- window.open(this.link, "_blank")?.focus();
12
- }
6
+ constructor(client, type, link) {
7
+ super(client, type);
8
+ this.link = link;
9
+ }
10
+ async connect() {
11
+ window.open(this.link, "_blank")?.focus();
12
+ }
13
13
  }
14
14
  exports.SignerOpenLink = SignerOpenLink;
@@ -1,4 +1,4 @@
1
1
  export * from "./signerEvm";
2
2
  export * from "./signerEvmAddressReadonly";
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("./signerEvm"), exports);
18
34
  __exportStar(require("./signerEvmAddressReadonly"), exports);
@@ -1,48 +1,53 @@
1
1
  import { Address } from "../../address";
2
2
  import { BytesLike } from "../../bytes";
3
3
  import { Script, Transaction, TransactionLike } from "../../ckb";
4
+ import { Hex } from "../../hex";
4
5
  import { Signer, SignerSignType, SignerType } from "../signer";
5
6
  /**
6
7
  * An abstract class extending Signer for Ethereum Virtual Machine (EVM) based signing operations.
7
8
  * This class provides methods to get EVM account, internal address, and signing transactions.
8
9
  */
9
10
  export declare abstract class SignerEvm extends Signer {
10
- get type(): SignerType;
11
- get signType(): SignerSignType;
12
- /**
13
- * Gets the EVM account associated with the signer.
14
- *
15
- * @returns A promise that resolves to a string representing the EVM account.
16
- */
17
- abstract getEvmAccount(): Promise<string>;
18
- /**
19
- * Gets the internal address, which is the EVM account in this case.
20
- *
21
- * @returns A promise that resolves to a string representing the internal address.
22
- */
23
- getInternalAddress(): Promise<string>;
24
- /**
25
- * Gets an array of Address objects representing the known script addresses for the signer.
26
- *
27
- * @returns A promise that resolves to an array of Address objects.
28
- */
29
- getAddressObjs(): Promise<Address[]>;
30
- _getOmniLockEvmAddressObj(account: string): Promise<Address>;
31
- _getOmniLockOldEvmAddressObj(account: string): Promise<Address>;
32
- /**
33
- * prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
34
- *
35
- * @param txLike - The transaction to prepare, represented as a TransactionLike object.
36
- * @returns A promise that resolves to the prepared Transaction object.
37
- */
38
- prepareTransaction(txLike: TransactionLike): Promise<Transaction>;
39
- /**
40
- * Signs a transaction without modifying it.
41
- *
42
- * @param txLike - The transaction to sign, represented as a TransactionLike object.
43
- * @returns A promise that resolves to a signed Transaction object.
44
- */
45
- signOnlyTransaction(txLike: TransactionLike): Promise<Transaction>;
46
- _signOmniLockScriptForTransaction(tx: Transaction, script: Script, messageTransformer: (hash: string) => BytesLike): Promise<Transaction>;
11
+ get type(): SignerType;
12
+ get signType(): SignerSignType;
13
+ /**
14
+ * Gets the EVM account associated with the signer.
15
+ *
16
+ * @returns A promise that resolves to a string representing the EVM account.
17
+ */
18
+ abstract getEvmAccount(): Promise<Hex>;
19
+ /**
20
+ * Gets the internal address, which is the EVM account in this case.
21
+ *
22
+ * @returns A promise that resolves to a string representing the internal address.
23
+ */
24
+ getInternalAddress(): Promise<string>;
25
+ /**
26
+ * Gets an array of Address objects representing the known script addresses for the signer.
27
+ *
28
+ * @returns A promise that resolves to an array of Address objects.
29
+ */
30
+ getAddressObjs(): Promise<Address[]>;
31
+ _getOmniLockEvmAddressObj(account: string): Promise<Address>;
32
+ _getOmniLockOldEvmAddressObj(account: string): Promise<Address>;
33
+ /**
34
+ * prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
35
+ *
36
+ * @param txLike - The transaction to prepare, represented as a TransactionLike object.
37
+ * @returns A promise that resolves to the prepared Transaction object.
38
+ */
39
+ prepareTransaction(txLike: TransactionLike): Promise<Transaction>;
40
+ /**
41
+ * Signs a transaction without modifying it.
42
+ *
43
+ * @param txLike - The transaction to sign, represented as a TransactionLike object.
44
+ * @returns A promise that resolves to a signed Transaction object.
45
+ */
46
+ signOnlyTransaction(txLike: TransactionLike): Promise<Transaction>;
47
+ _signOmniLockScriptForTransaction(
48
+ tx: Transaction,
49
+ script: Script,
50
+ messageTransformer: (hash: string) => BytesLike,
51
+ ): Promise<Transaction>;
47
52
  }
48
- //# sourceMappingURL=signerEvm.d.ts.map
53
+ //# sourceMappingURL=signerEvm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signerEvm.d.ts","sourceRoot":"","sources":["../../../src/signer/evm/signerEvm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAA0B,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAe,MAAM,WAAW,CAAC;AAK9E,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/D;;;GAGG;AACH,8BAAsB,SAAU,SAAQ,MAAM;IAC5C,IAAI,IAAI,IAAI,UAAU,CAErB;IAED,IAAI,QAAQ,IAAI,cAAc,CAE7B;IAED;;;;OAIG;IACH,QAAQ,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAEzC;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAQpC,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ5D,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQrE;;;;;OAKG;IACG,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAWvE;;;;;OAKG;IACG,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBlE,iCAAiC,CACrC,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAC9C,OAAO,CAAC,WAAW,CAAC;CA6BxB"}
1
+ {"version":3,"file":"signerEvm.d.ts","sourceRoot":"","sources":["../../../src/signer/evm/signerEvm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAA0B,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAe,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,GAAG,EAAW,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/D;;;GAGG;AACH,8BAAsB,SAAU,SAAQ,MAAM;IAC5C,IAAI,IAAI,IAAI,UAAU,CAErB;IAED,IAAI,QAAQ,IAAI,cAAc,CAE7B;IAED;;;;OAIG;IACH,QAAQ,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC;IAEtC;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAQpC,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ5D,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQrE;;;;;OAKG;IACG,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAWvE;;;;;OAKG;IACG,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBlE,iCAAiC,CACrC,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAC9C,OAAO,CAAC,WAAW,CAAC;CA6BxB"}