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

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 (123) hide show
  1. package/dist/ckb/transaction.d.ts.map +1 -1
  2. package/dist/ckb/transaction.js +1 -2
  3. package/dist.commonjs/address/address.advanced.d.ts +24 -29
  4. package/dist.commonjs/address/address.advanced.js +89 -115
  5. package/dist.commonjs/address/advanced.d.ts +1 -1
  6. package/dist.commonjs/address/advanced.js +14 -30
  7. package/dist.commonjs/address/index.d.ts +44 -51
  8. package/dist.commonjs/address/index.js +65 -84
  9. package/dist.commonjs/advanced.d.ts +1 -1
  10. package/dist.commonjs/advanced.js +22 -47
  11. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  12. package/dist.commonjs/advancedBarrel.js +14 -30
  13. package/dist.commonjs/barrel.d.ts +1 -1
  14. package/dist.commonjs/barrel.js +14 -30
  15. package/dist.commonjs/bytes/advanced.d.ts +2 -11
  16. package/dist.commonjs/bytes/index.d.ts +3 -9
  17. package/dist.commonjs/bytes/index.js +26 -28
  18. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  19. package/dist.commonjs/ckb/advanced.js +22 -47
  20. package/dist.commonjs/ckb/index.d.ts +1 -1
  21. package/dist.commonjs/ckb/index.js +14 -30
  22. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +260 -420
  23. package/dist.commonjs/ckb/molecule.advanced/generated.js +1332 -1536
  24. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  25. package/dist.commonjs/ckb/molecule.advanced/index.js +18 -34
  26. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  27. package/dist.commonjs/ckb/script.advanced.js +9 -12
  28. package/dist.commonjs/ckb/script.d.ts +117 -121
  29. package/dist.commonjs/ckb/script.js +176 -220
  30. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  31. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  32. package/dist.commonjs/ckb/transaction.d.ts +722 -806
  33. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  34. package/dist.commonjs/ckb/transaction.js +1190 -1424
  35. package/dist.commonjs/client/advanced.d.ts +1 -1
  36. package/dist.commonjs/client/advanced.js +14 -30
  37. package/dist.commonjs/client/client.advanced.d.ts +6 -23
  38. package/dist.commonjs/client/client.advanced.js +61 -89
  39. package/dist.commonjs/client/client.d.ts +54 -114
  40. package/dist.commonjs/client/client.js +182 -215
  41. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +4 -8
  42. package/dist.commonjs/client/clientPublicMainnet.advanced.js +189 -215
  43. package/dist.commonjs/client/clientPublicMainnet.d.ts +6 -8
  44. package/dist.commonjs/client/clientPublicMainnet.js +15 -17
  45. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +3 -6
  46. package/dist.commonjs/client/clientPublicTestnet.advanced.js +199 -227
  47. package/dist.commonjs/client/clientPublicTestnet.d.ts +6 -8
  48. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  49. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  50. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  51. package/dist.commonjs/client/clientTypes.d.ts +26 -51
  52. package/dist.commonjs/client/clientTypes.js +22 -56
  53. package/dist.commonjs/client/index.d.ts +1 -1
  54. package/dist.commonjs/client/index.js +14 -30
  55. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  56. package/dist.commonjs/client/jsonRpc/advanced.js +14 -30
  57. package/dist.commonjs/client/jsonRpc/index.d.ts +75 -94
  58. package/dist.commonjs/client/jsonRpc/index.js +108 -135
  59. package/dist.commonjs/client/jsonRpc/transformers.d.ts +36 -76
  60. package/dist.commonjs/client/jsonRpc/transformers.js +152 -174
  61. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  62. package/dist.commonjs/fixedPoint/index.d.ts +3 -9
  63. package/dist.commonjs/fixedPoint/index.js +20 -26
  64. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  65. package/dist.commonjs/fixedPoint/index.test.js +36 -42
  66. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  67. package/dist.commonjs/hasher/index.d.ts +37 -40
  68. package/dist.commonjs/hasher/index.js +48 -58
  69. package/dist.commonjs/hex/index.d.ts +1 -1
  70. package/dist.commonjs/hex/index.js +1 -1
  71. package/dist.commonjs/index.d.ts +1 -1
  72. package/dist.commonjs/index.js +22 -47
  73. package/dist.commonjs/num/index.d.ts +1 -1
  74. package/dist.commonjs/num/index.js +27 -39
  75. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  76. package/dist.commonjs/signer/btc/index.js +14 -30
  77. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  78. package/dist.commonjs/signer/btc/signerBtc.js +66 -89
  79. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  80. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  81. package/dist.commonjs/signer/btc/verify.d.ts +2 -6
  82. package/dist.commonjs/signer/btc/verify.js +3 -10
  83. package/dist.commonjs/signer/ckb/index.d.ts +1 -1
  84. package/dist.commonjs/signer/ckb/index.js +14 -30
  85. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +5 -5
  86. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +27 -41
  87. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +11 -11
  88. package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +35 -45
  89. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  90. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  91. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +3 -9
  92. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +5 -13
  93. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +2 -6
  94. package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -11
  95. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  96. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  97. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  98. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  99. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  100. package/dist.commonjs/signer/dummy/index.js +14 -30
  101. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  102. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  103. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  104. package/dist.commonjs/signer/evm/index.js +14 -30
  105. package/dist.commonjs/signer/evm/signerEvm.d.ts +38 -42
  106. package/dist.commonjs/signer/evm/signerEvm.js +70 -105
  107. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  108. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  109. package/dist.commonjs/signer/evm/verify.d.ts +2 -6
  110. package/dist.commonjs/signer/evm/verify.js +2 -7
  111. package/dist.commonjs/signer/index.d.ts +1 -1
  112. package/dist.commonjs/signer/index.js +14 -30
  113. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  114. package/dist.commonjs/signer/nostr/index.js +14 -30
  115. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  116. package/dist.commonjs/signer/nostr/signerNostr.js +71 -100
  117. package/dist.commonjs/signer/nostr/verify.d.ts +3 -9
  118. package/dist.commonjs/signer/nostr/verify.js +39 -50
  119. package/dist.commonjs/signer/signer/index.d.ts +162 -171
  120. package/dist.commonjs/signer/signer/index.js +198 -234
  121. package/dist.commonjs/utils/index.d.ts +9 -42
  122. package/dist.commonjs/utils/index.js +12 -18
  123. package/package.json +3 -3
@@ -5,200 +5,191 @@ import { Client } from "../../client";
5
5
  import { Hex } from "../../hex";
6
6
  import { Num } from "../../num";
7
7
  export declare enum SignerSignType {
8
- Unknown = "Unknown",
9
- BtcEcdsa = "BtcEcdsa",
10
- EvmPersonal = "EvmPersonal",
11
- JoyId = "JoyId",
12
- NostrEvent = "NostrEvent",
13
- CkbSecp256k1 = "CkbSecp256k1",
8
+ Unknown = "Unknown",
9
+ BtcEcdsa = "BtcEcdsa",
10
+ EvmPersonal = "EvmPersonal",
11
+ JoyId = "JoyId",
12
+ NostrEvent = "NostrEvent",
13
+ CkbSecp256k1 = "CkbSecp256k1"
14
14
  }
15
15
  /**
16
16
  * An enumeration of signer display types in wallet.
17
17
  */
18
18
  export declare enum SignerType {
19
- EVM = "EVM",
20
- BTC = "BTC",
21
- CKB = "CKB",
22
- Nostr = "Nostr",
19
+ EVM = "EVM",
20
+ BTC = "BTC",
21
+ CKB = "CKB",
22
+ Nostr = "Nostr"
23
23
  }
24
24
  export type NetworkPreference = {
25
- addressPrefix: string;
26
- signerType: SignerType;
27
- network: string;
25
+ addressPrefix: string;
26
+ signerType: SignerType;
27
+ network: string;
28
28
  };
29
29
  export declare class Signature {
30
- signature: string;
31
- identity: string;
32
- signType: SignerSignType;
33
- constructor(signature: string, identity: string, signType: SignerSignType);
30
+ signature: string;
31
+ identity: string;
32
+ signType: SignerSignType;
33
+ constructor(signature: string, identity: string, signType: SignerSignType);
34
34
  }
35
35
  /**
36
36
  * An abstract class representing a generic signer.
37
37
  * This class provides methods to connect, get addresses, and sign transactions.
38
38
  */
39
39
  export declare abstract class Signer {
40
- protected client_: Client;
41
- constructor(client_: Client);
42
- abstract get type(): SignerType;
43
- abstract get signType(): SignerSignType;
44
- get client(): Client;
45
- matchNetworkPreference(
46
- preferences: NetworkPreference[],
47
- currentNetwork: string,
48
- ): NetworkPreference | undefined;
49
- static verifyMessage(
50
- message: string | BytesLike,
51
- signature: Signature,
52
- ): Promise<boolean>;
53
- /**
54
- * Connects to the signer.
55
- *
56
- * @returns A promise that resolves when the connection is complete.
57
- */
58
- abstract connect(): Promise<void>;
59
- /**
60
- * Register a listener to be called when this signer is replaced.
61
- *
62
- * @returns A function for unregister
63
- */
64
- onReplaced(_: () => void): () => void;
65
- /**
66
- * Disconnects to the signer.
67
- *
68
- * @returns A promise that resolves when the signer is disconnected.
69
- */
70
- disconnect(): Promise<void>;
71
- /**
72
- * Check if the signer is connected.
73
- *
74
- * @returns A promise that resolves the connection status.
75
- */
76
- abstract isConnected(): Promise<boolean>;
77
- /**
78
- * Gets the internal address associated with the signer.
79
- *
80
- * @returns A promise that resolves to a string representing the internal address.
81
- */
82
- abstract getInternalAddress(): Promise<string>;
83
- /**
84
- * Gets the identity for verifying signature, usually it's address
85
- *
86
- * @returns A promise that resolves to a string representing the identity
87
- */
88
- getIdentity(): Promise<string>;
89
- /**
90
- * Gets an array of Address objects associated with the signer.
91
- *
92
- * @returns A promise that resolves to an array of Address objects.
93
- */
94
- abstract getAddressObjs(): Promise<Address[]>;
95
- /**
96
- * Gets the recommended Address object for the signer.
97
- *
98
- * @param _preference - Optional preference parameter.
99
- * @returns A promise that resolves to the recommended Address object.
100
- */
101
- getRecommendedAddressObj(_preference?: unknown): Promise<Address>;
102
- /**
103
- * Gets the recommended address for the signer as a string.
104
- *
105
- * @param preference - Optional preference parameter.
106
- * @returns A promise that resolves to the recommended address as a string.
107
- */
108
- getRecommendedAddress(preference?: unknown): Promise<string>;
109
- /**
110
- * Gets an array of addresses associated with the signer as strings.
111
- *
112
- * @returns A promise that resolves to an array of addresses as strings.
113
- */
114
- getAddresses(): Promise<string[]>;
115
- /**
116
- * Gets balance of all addresses
117
- *
118
- * @returns A promise that resolves to the balance
119
- */
120
- getBalance(): Promise<Num>;
121
- /**
122
- * Signs a message.
123
- *
124
- * @param _ - The message to sign, as a string or BytesLike object.
125
- * @returns A promise that resolves to the signature info.
126
- * @throws Will throw an error if not implemented.
127
- */
128
- signMessage(message: string | BytesLike): Promise<Signature>;
129
- /**
130
- * Signs a message and returns signature only. This method is not implemented and should be overridden by subclasses.
131
- *
132
- * @param _ - The message to sign, as a string or BytesLike object.
133
- * @returns A promise that resolves to the signature as a string.
134
- * @throws Will throw an error if not implemented.
135
- */
136
- signMessageRaw(_: string | BytesLike): Promise<string>;
137
- /**
138
- * Verify a signature.
139
- *
140
- * @param _ - The original message.
141
- * @param _ - The signature to verify.
142
- * @returns A promise that resolves to the verification result.
143
- * @throws Will throw an error if not implemented.
144
- */
145
- verifyMessage(
146
- message: string | BytesLike,
147
- signature: string | Signature,
148
- ): Promise<boolean>;
149
- /**
150
- * Verify a string signature. This method is not implemented and should be overridden by subclasses.
151
- *
152
- * @param _0 - The original message.
153
- * @param _1 - The signature to verify.
154
- * @returns A promise that resolves to the verification result.
155
- * @throws Will throw an error if not implemented.
156
- */
157
- verifyMessageRaw(_0: string | BytesLike, _1: string): Promise<boolean>;
158
- /**
159
- * Sends a transaction after signing it.
160
- *
161
- * @param tx - The transaction to send, represented as a TransactionLike object.
162
- * @returns A promise that resolves to the transaction hash as a Hex string.
163
- */
164
- sendTransaction(tx: TransactionLike): Promise<Hex>;
165
- /**
166
- * Signs a transaction.
167
- *
168
- * @param tx - The transaction to sign, represented as a TransactionLike object.
169
- * @returns A promise that resolves to the signed Transaction object.
170
- */
171
- signTransaction(tx: TransactionLike): Promise<Transaction>;
172
- /**
173
- * prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
174
- *
175
- * @param _ - The transaction to prepare, represented as a TransactionLike object.
176
- * @returns A promise that resolves to the prepared Transaction object.
177
- * @throws Will throw an error if not implemented.
178
- */
179
- prepareTransaction(_: TransactionLike): Promise<Transaction>;
180
- /**
181
- * Signs a transaction without preparing information for it. This method is not implemented and should be overridden by subclasses.
182
- *
183
- * @param _ - The transaction to sign, represented as a TransactionLike object.
184
- * @returns A promise that resolves to the signed Transaction object.
185
- * @throws Will throw an error if not implemented.
186
- */
187
- signOnlyTransaction(_: TransactionLike): Promise<Transaction>;
40
+ protected client_: Client;
41
+ constructor(client_: Client);
42
+ abstract get type(): SignerType;
43
+ abstract get signType(): SignerSignType;
44
+ get client(): Client;
45
+ matchNetworkPreference(preferences: NetworkPreference[], currentNetwork: string): NetworkPreference | undefined;
46
+ static verifyMessage(message: string | BytesLike, signature: Signature): Promise<boolean>;
47
+ /**
48
+ * Connects to the signer.
49
+ *
50
+ * @returns A promise that resolves when the connection is complete.
51
+ */
52
+ abstract connect(): Promise<void>;
53
+ /**
54
+ * Register a listener to be called when this signer is replaced.
55
+ *
56
+ * @returns A function for unregister
57
+ */
58
+ onReplaced(_: () => void): () => void;
59
+ /**
60
+ * Disconnects to the signer.
61
+ *
62
+ * @returns A promise that resolves when the signer is disconnected.
63
+ */
64
+ disconnect(): Promise<void>;
65
+ /**
66
+ * Check if the signer is connected.
67
+ *
68
+ * @returns A promise that resolves the connection status.
69
+ */
70
+ abstract isConnected(): Promise<boolean>;
71
+ /**
72
+ * Gets the internal address associated with the signer.
73
+ *
74
+ * @returns A promise that resolves to a string representing the internal address.
75
+ */
76
+ abstract getInternalAddress(): Promise<string>;
77
+ /**
78
+ * Gets the identity for verifying signature, usually it's address
79
+ *
80
+ * @returns A promise that resolves to a string representing the identity
81
+ */
82
+ getIdentity(): Promise<string>;
83
+ /**
84
+ * Gets an array of Address objects associated with the signer.
85
+ *
86
+ * @returns A promise that resolves to an array of Address objects.
87
+ */
88
+ abstract getAddressObjs(): Promise<Address[]>;
89
+ /**
90
+ * Gets the recommended Address object for the signer.
91
+ *
92
+ * @param _preference - Optional preference parameter.
93
+ * @returns A promise that resolves to the recommended Address object.
94
+ */
95
+ getRecommendedAddressObj(_preference?: unknown): Promise<Address>;
96
+ /**
97
+ * Gets the recommended address for the signer as a string.
98
+ *
99
+ * @param preference - Optional preference parameter.
100
+ * @returns A promise that resolves to the recommended address as a string.
101
+ */
102
+ getRecommendedAddress(preference?: unknown): Promise<string>;
103
+ /**
104
+ * Gets an array of addresses associated with the signer as strings.
105
+ *
106
+ * @returns A promise that resolves to an array of addresses as strings.
107
+ */
108
+ getAddresses(): Promise<string[]>;
109
+ /**
110
+ * Gets balance of all addresses
111
+ *
112
+ * @returns A promise that resolves to the balance
113
+ */
114
+ getBalance(): Promise<Num>;
115
+ /**
116
+ * Signs a message.
117
+ *
118
+ * @param _ - The message to sign, as a string or BytesLike object.
119
+ * @returns A promise that resolves to the signature info.
120
+ * @throws Will throw an error if not implemented.
121
+ */
122
+ signMessage(message: string | BytesLike): Promise<Signature>;
123
+ /**
124
+ * Signs a message and returns signature only. This method is not implemented and should be overridden by subclasses.
125
+ *
126
+ * @param _ - The message to sign, as a string or BytesLike object.
127
+ * @returns A promise that resolves to the signature as a string.
128
+ * @throws Will throw an error if not implemented.
129
+ */
130
+ signMessageRaw(_: string | BytesLike): Promise<string>;
131
+ /**
132
+ * Verify a signature.
133
+ *
134
+ * @param _ - The original message.
135
+ * @param _ - The signature to verify.
136
+ * @returns A promise that resolves to the verification result.
137
+ * @throws Will throw an error if not implemented.
138
+ */
139
+ verifyMessage(message: string | BytesLike, signature: string | Signature): Promise<boolean>;
140
+ /**
141
+ * Verify a string signature. This method is not implemented and should be overridden by subclasses.
142
+ *
143
+ * @param _0 - The original message.
144
+ * @param _1 - The signature to verify.
145
+ * @returns A promise that resolves to the verification result.
146
+ * @throws Will throw an error if not implemented.
147
+ */
148
+ verifyMessageRaw(_0: string | BytesLike, _1: string): Promise<boolean>;
149
+ /**
150
+ * Sends a transaction after signing it.
151
+ *
152
+ * @param tx - The transaction to send, represented as a TransactionLike object.
153
+ * @returns A promise that resolves to the transaction hash as a Hex string.
154
+ */
155
+ sendTransaction(tx: TransactionLike): Promise<Hex>;
156
+ /**
157
+ * Signs a transaction.
158
+ *
159
+ * @param tx - The transaction to sign, represented as a TransactionLike object.
160
+ * @returns A promise that resolves to the signed Transaction object.
161
+ */
162
+ signTransaction(tx: TransactionLike): Promise<Transaction>;
163
+ /**
164
+ * prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
165
+ *
166
+ * @param _ - The transaction to prepare, represented as a TransactionLike object.
167
+ * @returns A promise that resolves to the prepared Transaction object.
168
+ * @throws Will throw an error if not implemented.
169
+ */
170
+ prepareTransaction(_: TransactionLike): Promise<Transaction>;
171
+ /**
172
+ * Signs a transaction without preparing information for it. This method is not implemented and should be overridden by subclasses.
173
+ *
174
+ * @param _ - The transaction to sign, represented as a TransactionLike object.
175
+ * @returns A promise that resolves to the signed Transaction object.
176
+ * @throws Will throw an error if not implemented.
177
+ */
178
+ signOnlyTransaction(_: TransactionLike): Promise<Transaction>;
188
179
  }
189
180
  /**
190
181
  * A class representing information about a signer, including its type and the signer instance.
191
182
  */
192
183
  export declare class SignerInfo {
193
- name: string;
194
- signer: Signer;
195
- constructor(name: string, signer: Signer);
184
+ name: string;
185
+ signer: Signer;
186
+ constructor(name: string, signer: Signer);
196
187
  }
197
188
  /**
198
189
  * Represents a wallet with a name, icon, and an array of signer information.
199
190
  */
200
191
  export type Wallet = {
201
- name: string;
202
- icon: string;
192
+ name: string;
193
+ icon: string;
203
194
  };
204
- //# sourceMappingURL=index.d.ts.map
195
+ //# sourceMappingURL=index.d.ts.map