@ckb-ccc/core 0.0.12-alpha.1 → 0.0.13-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 (274) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +10 -7
  3. package/dist/address/index.d.ts +4 -0
  4. package/dist/address/index.d.ts.map +1 -1
  5. package/dist/address/index.js +1 -0
  6. package/dist/advancedBarrel.d.ts +1 -0
  7. package/dist/advancedBarrel.d.ts.map +1 -1
  8. package/dist/advancedBarrel.js +1 -0
  9. package/dist/bytes/advanced.d.ts +1 -0
  10. package/dist/bytes/advanced.d.ts.map +1 -1
  11. package/dist/bytes/index.d.ts +9 -0
  12. package/dist/bytes/index.d.ts.map +1 -1
  13. package/dist/bytes/index.js +3 -0
  14. package/dist/ckb/index.d.ts +1 -0
  15. package/dist/ckb/index.d.ts.map +1 -1
  16. package/dist/ckb/index.js +1 -0
  17. package/dist/ckb/script.d.ts +15 -0
  18. package/dist/ckb/script.d.ts.map +1 -1
  19. package/dist/ckb/script.js +6 -0
  20. package/dist/ckb/transaction.d.ts +65 -11
  21. package/dist/ckb/transaction.d.ts.map +1 -1
  22. package/dist/ckb/transaction.js +41 -14
  23. package/dist/ckb/transactionLumos.d.ts +29 -0
  24. package/dist/ckb/transactionLumos.d.ts.map +1 -0
  25. package/dist/ckb/transactionLumos.js +1 -0
  26. package/dist/client/client.d.ts +13 -1
  27. package/dist/client/client.d.ts.map +1 -1
  28. package/dist/client/client.js +10 -1
  29. package/dist/client/clientPublicMainnet.d.ts +3 -0
  30. package/dist/client/clientPublicMainnet.d.ts.map +1 -1
  31. package/dist/client/clientPublicMainnet.js +3 -0
  32. package/dist/client/clientPublicTestnet.d.ts +3 -0
  33. package/dist/client/clientPublicTestnet.d.ts.map +1 -1
  34. package/dist/client/clientPublicTestnet.js +3 -0
  35. package/dist/client/clientTypes.d.ts +50 -0
  36. package/dist/client/clientTypes.d.ts.map +1 -1
  37. package/dist/client/clientTypes.js +9 -0
  38. package/dist/client/jsonRpc/index.d.ts +6 -6
  39. package/dist/client/jsonRpc/index.d.ts.map +1 -1
  40. package/dist/client/jsonRpc/index.js +3 -3
  41. package/dist/client/jsonRpc/transformers.d.ts +7 -2
  42. package/dist/client/jsonRpc/transformers.d.ts.map +1 -1
  43. package/dist/client/jsonRpc/transformers.js +7 -1
  44. package/dist/fixedPoint/index.d.ts +6 -0
  45. package/dist/fixedPoint/index.d.ts.map +1 -1
  46. package/dist/fixedPoint/index.js +5 -0
  47. package/dist/hasher/hasher.d.ts +3 -0
  48. package/dist/hasher/hasher.d.ts.map +1 -1
  49. package/dist/hasher/hasherCkb.d.ts +6 -1
  50. package/dist/hasher/hasherCkb.d.ts.map +1 -1
  51. package/dist/hasher/hasherCkb.js +6 -1
  52. package/dist/hasher/hasherKeecak256.d.ts +3 -0
  53. package/dist/hasher/hasherKeecak256.d.ts.map +1 -1
  54. package/dist/hasher/hasherKeecak256.js +3 -0
  55. package/dist/hex/index.d.ts +3 -0
  56. package/dist/hex/index.d.ts.map +1 -1
  57. package/dist/hex/index.js +1 -0
  58. package/dist/keystore/index.d.ts +6 -0
  59. package/dist/keystore/index.d.ts.map +1 -1
  60. package/dist/keystore/index.js +6 -0
  61. package/dist/num/index.d.ts +11 -0
  62. package/dist/num/index.d.ts.map +1 -1
  63. package/dist/num/index.js +9 -0
  64. package/dist/package.json +1 -1
  65. package/dist/signer/btc/signerBtc.d.ts +1 -0
  66. package/dist/signer/btc/signerBtc.d.ts.map +1 -1
  67. package/dist/signer/btc/signerBtc.js +1 -0
  68. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +1 -0
  69. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
  70. package/dist/signer/btc/signerBtcPublicKeyReadonly.js +1 -0
  71. package/dist/signer/btc/verify.d.ts +3 -0
  72. package/dist/signer/btc/verify.d.ts.map +1 -1
  73. package/dist/signer/btc/verify.js +3 -0
  74. package/dist/signer/ckb/signerCkbPrivateKey.d.ts +3 -0
  75. package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  76. package/dist/signer/ckb/signerCkbPrivateKey.js +3 -0
  77. package/dist/signer/ckb/signerCkbPublicKey.d.ts +3 -0
  78. package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
  79. package/dist/signer/ckb/signerCkbPublicKey.js +3 -0
  80. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +1 -0
  81. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
  82. package/dist/signer/ckb/signerCkbScriptReadonly.js +1 -0
  83. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +6 -0
  84. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
  85. package/dist/signer/ckb/verifyCkbSecp256k1.js +6 -0
  86. package/dist/signer/ckb/verifyJoyId.d.ts +3 -0
  87. package/dist/signer/ckb/verifyJoyId.d.ts.map +1 -1
  88. package/dist/signer/ckb/verifyJoyId.js +3 -0
  89. package/dist/signer/dummy/alwaysError.d.ts +3 -0
  90. package/dist/signer/dummy/alwaysError.d.ts.map +1 -1
  91. package/dist/signer/dummy/alwaysError.js +3 -0
  92. package/dist/signer/dummy/dummy.d.ts +3 -0
  93. package/dist/signer/dummy/dummy.d.ts.map +1 -1
  94. package/dist/signer/dummy/dummy.js +3 -0
  95. package/dist/signer/dummy/openLink.d.ts +3 -0
  96. package/dist/signer/dummy/openLink.d.ts.map +1 -1
  97. package/dist/signer/dummy/openLink.js +3 -0
  98. package/dist/signer/evm/signerEvm.d.ts +1 -0
  99. package/dist/signer/evm/signerEvm.d.ts.map +1 -1
  100. package/dist/signer/evm/signerEvm.js +1 -0
  101. package/dist/signer/evm/signerEvmAddressReadonly.d.ts +1 -0
  102. package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  103. package/dist/signer/evm/signerEvmAddressReadonly.js +1 -0
  104. package/dist/signer/evm/verify.d.ts +3 -0
  105. package/dist/signer/evm/verify.d.ts.map +1 -1
  106. package/dist/signer/evm/verify.js +3 -0
  107. package/dist/signer/nostr/signerNostr.d.ts +6 -0
  108. package/dist/signer/nostr/signerNostr.d.ts.map +1 -1
  109. package/dist/signer/nostr/signerNostr.js +3 -0
  110. package/dist/signer/nostr/verify.d.ts +3 -0
  111. package/dist/signer/nostr/verify.d.ts.map +1 -1
  112. package/dist/signer/nostr/verify.js +3 -0
  113. package/dist/signer/signer/index.d.ts +26 -3
  114. package/dist/signer/signer/index.d.ts.map +1 -1
  115. package/dist/signer/signer/index.js +12 -3
  116. package/dist/utils/index.d.ts +12 -0
  117. package/dist/utils/index.d.ts.map +1 -1
  118. package/dist/utils/index.js +13 -0
  119. package/dist.commonjs/address/index.d.ts +4 -0
  120. package/dist.commonjs/address/index.d.ts.map +1 -1
  121. package/dist.commonjs/address/index.js +1 -0
  122. package/dist.commonjs/advancedBarrel.d.ts +1 -0
  123. package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
  124. package/dist.commonjs/advancedBarrel.js +1 -0
  125. package/dist.commonjs/bytes/advanced.d.ts +1 -0
  126. package/dist.commonjs/bytes/advanced.d.ts.map +1 -1
  127. package/dist.commonjs/bytes/index.d.ts +9 -0
  128. package/dist.commonjs/bytes/index.d.ts.map +1 -1
  129. package/dist.commonjs/bytes/index.js +3 -0
  130. package/dist.commonjs/ckb/index.d.ts +1 -0
  131. package/dist.commonjs/ckb/index.d.ts.map +1 -1
  132. package/dist.commonjs/ckb/index.js +1 -0
  133. package/dist.commonjs/ckb/script.d.ts +15 -0
  134. package/dist.commonjs/ckb/script.d.ts.map +1 -1
  135. package/dist.commonjs/ckb/script.js +6 -0
  136. package/dist.commonjs/ckb/transaction.d.ts +65 -11
  137. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  138. package/dist.commonjs/ckb/transaction.js +41 -14
  139. package/dist.commonjs/ckb/transactionLumos.d.ts +29 -0
  140. package/dist.commonjs/ckb/transactionLumos.d.ts.map +1 -0
  141. package/dist.commonjs/ckb/transactionLumos.js +2 -0
  142. package/dist.commonjs/client/client.d.ts +13 -1
  143. package/dist.commonjs/client/client.d.ts.map +1 -1
  144. package/dist.commonjs/client/client.js +10 -1
  145. package/dist.commonjs/client/clientPublicMainnet.d.ts +3 -0
  146. package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
  147. package/dist.commonjs/client/clientPublicMainnet.js +3 -0
  148. package/dist.commonjs/client/clientPublicTestnet.d.ts +3 -0
  149. package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
  150. package/dist.commonjs/client/clientPublicTestnet.js +3 -0
  151. package/dist.commonjs/client/clientTypes.d.ts +50 -0
  152. package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
  153. package/dist.commonjs/client/clientTypes.js +9 -0
  154. package/dist.commonjs/client/jsonRpc/index.d.ts +6 -6
  155. package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
  156. package/dist.commonjs/client/jsonRpc/index.js +3 -3
  157. package/dist.commonjs/client/jsonRpc/transformers.d.ts +7 -2
  158. package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -1
  159. package/dist.commonjs/client/jsonRpc/transformers.js +35 -29
  160. package/dist.commonjs/fixedPoint/index.d.ts +6 -0
  161. package/dist.commonjs/fixedPoint/index.d.ts.map +1 -1
  162. package/dist.commonjs/fixedPoint/index.js +5 -0
  163. package/dist.commonjs/hasher/hasher.d.ts +3 -0
  164. package/dist.commonjs/hasher/hasher.d.ts.map +1 -1
  165. package/dist.commonjs/hasher/hasherCkb.d.ts +6 -1
  166. package/dist.commonjs/hasher/hasherCkb.d.ts.map +1 -1
  167. package/dist.commonjs/hasher/hasherCkb.js +6 -1
  168. package/dist.commonjs/hasher/hasherKeecak256.d.ts +3 -0
  169. package/dist.commonjs/hasher/hasherKeecak256.d.ts.map +1 -1
  170. package/dist.commonjs/hasher/hasherKeecak256.js +3 -0
  171. package/dist.commonjs/hex/index.d.ts +3 -0
  172. package/dist.commonjs/hex/index.d.ts.map +1 -1
  173. package/dist.commonjs/hex/index.js +1 -0
  174. package/dist.commonjs/keystore/index.d.ts +6 -0
  175. package/dist.commonjs/keystore/index.d.ts.map +1 -1
  176. package/dist.commonjs/keystore/index.js +6 -0
  177. package/dist.commonjs/num/index.d.ts +11 -0
  178. package/dist.commonjs/num/index.d.ts.map +1 -1
  179. package/dist.commonjs/num/index.js +9 -0
  180. package/dist.commonjs/signer/btc/signerBtc.d.ts +1 -0
  181. package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
  182. package/dist.commonjs/signer/btc/signerBtc.js +1 -0
  183. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +1 -0
  184. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
  185. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +1 -0
  186. package/dist.commonjs/signer/btc/verify.d.ts +3 -0
  187. package/dist.commonjs/signer/btc/verify.d.ts.map +1 -1
  188. package/dist.commonjs/signer/btc/verify.js +3 -0
  189. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +3 -0
  190. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  191. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +3 -0
  192. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +3 -0
  193. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
  194. package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +3 -0
  195. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +1 -0
  196. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
  197. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +1 -0
  198. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +6 -0
  199. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
  200. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +6 -0
  201. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +3 -0
  202. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts.map +1 -1
  203. package/dist.commonjs/signer/ckb/verifyJoyId.js +3 -0
  204. package/dist.commonjs/signer/dummy/alwaysError.d.ts +3 -0
  205. package/dist.commonjs/signer/dummy/alwaysError.d.ts.map +1 -1
  206. package/dist.commonjs/signer/dummy/alwaysError.js +3 -0
  207. package/dist.commonjs/signer/dummy/dummy.d.ts +3 -0
  208. package/dist.commonjs/signer/dummy/dummy.d.ts.map +1 -1
  209. package/dist.commonjs/signer/dummy/dummy.js +3 -0
  210. package/dist.commonjs/signer/dummy/openLink.d.ts +3 -0
  211. package/dist.commonjs/signer/dummy/openLink.d.ts.map +1 -1
  212. package/dist.commonjs/signer/dummy/openLink.js +3 -0
  213. package/dist.commonjs/signer/evm/signerEvm.d.ts +1 -0
  214. package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
  215. package/dist.commonjs/signer/evm/signerEvm.js +1 -0
  216. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +1 -0
  217. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  218. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +1 -0
  219. package/dist.commonjs/signer/evm/verify.d.ts +3 -0
  220. package/dist.commonjs/signer/evm/verify.d.ts.map +1 -1
  221. package/dist.commonjs/signer/evm/verify.js +3 -0
  222. package/dist.commonjs/signer/nostr/signerNostr.d.ts +6 -0
  223. package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +1 -1
  224. package/dist.commonjs/signer/nostr/signerNostr.js +3 -0
  225. package/dist.commonjs/signer/nostr/verify.d.ts +3 -0
  226. package/dist.commonjs/signer/nostr/verify.d.ts.map +1 -1
  227. package/dist.commonjs/signer/nostr/verify.js +3 -0
  228. package/dist.commonjs/signer/signer/index.d.ts +26 -3
  229. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  230. package/dist.commonjs/signer/signer/index.js +12 -3
  231. package/dist.commonjs/utils/index.d.ts +12 -0
  232. package/dist.commonjs/utils/index.d.ts.map +1 -1
  233. package/dist.commonjs/utils/index.js +13 -0
  234. package/package.json +8 -10
  235. package/src/address/index.ts +4 -1
  236. package/src/advancedBarrel.ts +1 -0
  237. package/src/bytes/advanced.ts +1 -0
  238. package/src/bytes/index.ts +9 -0
  239. package/src/ckb/index.ts +1 -0
  240. package/src/ckb/script.ts +15 -0
  241. package/src/ckb/transaction.ts +72 -16
  242. package/src/ckb/transactionLumos.ts +26 -0
  243. package/src/client/client.ts +13 -1
  244. package/src/client/clientPublicMainnet.ts +3 -0
  245. package/src/client/clientPublicTestnet.ts +3 -0
  246. package/src/client/clientTypes.ts +50 -0
  247. package/src/client/jsonRpc/index.ts +5 -6
  248. package/src/client/jsonRpc/transformers.ts +16 -3
  249. package/src/fixedPoint/index.ts +6 -0
  250. package/src/hasher/hasher.ts +3 -0
  251. package/src/hasher/hasherCkb.ts +6 -1
  252. package/src/hasher/hasherKeecak256.ts +3 -0
  253. package/src/hex/index.ts +3 -0
  254. package/src/keystore/index.ts +6 -0
  255. package/src/num/index.ts +11 -0
  256. package/src/signer/btc/signerBtc.ts +1 -0
  257. package/src/signer/btc/signerBtcPublicKeyReadonly.ts +1 -0
  258. package/src/signer/btc/verify.ts +3 -0
  259. package/src/signer/ckb/signerCkbPrivateKey.ts +3 -0
  260. package/src/signer/ckb/signerCkbPublicKey.ts +3 -0
  261. package/src/signer/ckb/signerCkbScriptReadonly.ts +1 -0
  262. package/src/signer/ckb/verifyCkbSecp256k1.ts +6 -0
  263. package/src/signer/ckb/verifyJoyId.ts +3 -0
  264. package/src/signer/dummy/alwaysError.ts +3 -0
  265. package/src/signer/dummy/dummy.ts +3 -0
  266. package/src/signer/dummy/openLink.ts +3 -0
  267. package/src/signer/evm/signerEvm.ts +1 -0
  268. package/src/signer/evm/signerEvmAddressReadonly.ts +1 -0
  269. package/src/signer/evm/verify.ts +3 -0
  270. package/src/signer/nostr/signerNostr.ts +6 -0
  271. package/src/signer/nostr/verify.ts +3 -0
  272. package/src/signer/signer/index.ts +26 -14
  273. package/src/utils/index.ts +22 -0
  274. package/typedoc.json +6 -0
@@ -8,23 +8,43 @@ import {
8
8
  clientSearchKeyRangeFrom,
9
9
  } from "./clientTypes.advanced.js";
10
10
 
11
+ /**
12
+ * @public
13
+ */
11
14
  export type OutputsValidator = "passthrough" | "well_known_scripts_only";
12
15
 
16
+ /**
17
+ * @public
18
+ */
13
19
  export type TransactionStatus =
14
20
  | "pending"
15
21
  | "proposed"
16
22
  | "committed"
17
23
  | "unknown"
18
24
  | "rejected";
25
+ /**
26
+ * @public
27
+ */
19
28
  export type ClientTransactionResponse = {
20
29
  transaction: Transaction;
21
30
  status: TransactionStatus;
31
+ cycles?: Num;
32
+ blockHash?: Hex;
33
+ blockNumber?: Num;
34
+ txIndex?: Num;
35
+ reason?: string;
22
36
  };
23
37
 
38
+ /**
39
+ * @public
40
+ */
24
41
  export type ClientIndexerSearchKeyFilterLike =
25
42
  ClientCollectableSearchKeyFilterLike & {
26
43
  blockRange?: [NumLike, NumLike] | null;
27
44
  };
45
+ /**
46
+ * @public
47
+ */
28
48
  export class ClientIndexerSearchKeyFilter {
29
49
  constructor(
30
50
  public script: Script | undefined,
@@ -51,10 +71,16 @@ export class ClientIndexerSearchKeyFilter {
51
71
  }
52
72
  }
53
73
 
74
+ /**
75
+ * @public
76
+ */
54
77
  export type ClientIndexerSearchKeyLike = ClientCollectableSearchKeyLike & {
55
78
  filter?: ClientIndexerSearchKeyFilterLike | null;
56
79
  };
57
80
 
81
+ /**
82
+ * @public
83
+ */
58
84
  export class ClientIndexerSearchKey {
59
85
  constructor(
60
86
  public script: Script,
@@ -75,11 +101,17 @@ export class ClientIndexerSearchKey {
75
101
  }
76
102
  }
77
103
 
104
+ /**
105
+ * @public
106
+ */
78
107
  export type ClientFindCellsResponse = {
79
108
  lastCursor: string;
80
109
  cells: Cell[];
81
110
  };
82
111
 
112
+ /**
113
+ * @public
114
+ */
83
115
  export type ClientIndexerSearchKeyTransactionLike = Omit<
84
116
  ClientCollectableSearchKeyLike,
85
117
  "withData"
@@ -88,6 +120,9 @@ export type ClientIndexerSearchKeyTransactionLike = Omit<
88
120
  groupByTransaction?: boolean | null;
89
121
  };
90
122
 
123
+ /**
124
+ * @public
125
+ */
91
126
  export class ClientIndexerSearchKeyTransaction {
92
127
  constructor(
93
128
  public script: Script,
@@ -110,6 +145,9 @@ export class ClientIndexerSearchKeyTransaction {
110
145
  }
111
146
  }
112
147
 
148
+ /**
149
+ * @public
150
+ */
113
151
  export type ClientFindTransactionsResponse = {
114
152
  lastCursor: string;
115
153
  transactions: {
@@ -121,6 +159,9 @@ export type ClientFindTransactionsResponse = {
121
159
  }[];
122
160
  };
123
161
 
162
+ /**
163
+ * @public
164
+ */
124
165
  export type ClientFindTransactionsGroupedResponse = {
125
166
  lastCursor: string;
126
167
  transactions: {
@@ -134,6 +175,9 @@ export type ClientFindTransactionsGroupedResponse = {
134
175
  }[];
135
176
  };
136
177
 
178
+ /**
179
+ * @public
180
+ */
137
181
  export type ClientBlockHeader = {
138
182
  compactTarget: Num;
139
183
  dao: Hex;
@@ -149,11 +193,17 @@ export type ClientBlockHeader = {
149
193
  version: Num;
150
194
  };
151
195
 
196
+ /**
197
+ * @public
198
+ */
152
199
  export type ClientBlockUncle = {
153
200
  header: ClientBlockHeader;
154
201
  proposals: Hex[];
155
202
  };
156
203
 
204
+ /**
205
+ * @public
206
+ */
157
207
  export type ClientBlock = {
158
208
  header: ClientBlockHeader;
159
209
  proposals: Hex[];
@@ -5,7 +5,6 @@ import { Hex, HexLike, hexFrom } from "../../hex/index.js";
5
5
  import { Num, NumLike, numFrom, numToHex } from "../../num/index.js";
6
6
  import { Client } from "../client.js";
7
7
  import {
8
- ClientBlock,
9
8
  ClientFindCellsResponse,
10
9
  ClientIndexerSearchKeyLike,
11
10
  ClientTransactionResponse,
@@ -46,7 +45,7 @@ export abstract class ClientJsonRpc extends Client {
46
45
  /**
47
46
  * Creates an instance of ClientJsonRpc.
48
47
  *
49
- * @param url - The URL of the JSON-RPC server.
48
+ * @param url_ - The URL of the JSON-RPC server.
50
49
  * @param timeout - The timeout for requests in milliseconds, default is 30000.
51
50
  */
52
51
 
@@ -84,26 +83,26 @@ export abstract class ClientJsonRpc extends Client {
84
83
  *
85
84
  * @param blockNumber - The block number.
86
85
  * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
87
- * @param with_cycles - whether the return cycles of block transactions. (Optional, default false.)
86
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
88
87
  * @returns Block
89
88
  */
90
89
  getBlockByNumber = this.buildSender(
91
90
  "get_block_by_number",
92
91
  [(v: NumLike) => numToHex(numFrom(v))],
93
92
  (b) => apply(JsonRpcTransformers.blockTo, b),
94
- ) as () => Promise<ClientBlock | undefined>;
93
+ ) as Client["getBlockByNumber"];
95
94
 
96
95
  /**
97
96
  * Get block by block hash
98
97
  *
99
98
  * @param blockHash - The block hash.
100
99
  * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
101
- * @param with_cycles - whether the return cycles of block transactions. (Optional, default false.)
100
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
102
101
  * @returns Block
103
102
  */
104
103
  getBlockByHash = this.buildSender("get_block", [hexFrom], (b) =>
105
104
  apply(JsonRpcTransformers.blockTo, b),
106
- ) as () => Promise<ClientBlock | undefined>;
105
+ ) as Client["getBlockByHash"];
107
106
 
108
107
  /**
109
108
  * Send a transaction to node.
@@ -19,7 +19,7 @@ import {
19
19
  depTypeFrom,
20
20
  hashTypeFrom,
21
21
  } from "../../ckb/index.js";
22
- import { Hex } from "../../hex/index.js";
22
+ import { Hex, HexLike, hexFrom } from "../../hex/index.js";
23
23
  import { NumLike, numFrom, numToHex } from "../../num/index.js";
24
24
  import { apply } from "../../utils/index.js";
25
25
  import {
@@ -172,10 +172,18 @@ export class JsonRpcTransformers {
172
172
  });
173
173
  }
174
174
  static transactionResponseTo({
175
- tx_status: { status },
175
+ cycles,
176
+ tx_status: { status, block_number, block_hash, tx_index, reason },
176
177
  transaction,
177
178
  }: {
178
- tx_status: { status: TransactionStatus };
179
+ cycles?: NumLike;
180
+ tx_status: {
181
+ status: TransactionStatus;
182
+ block_hash?: HexLike;
183
+ tx_index?: NumLike;
184
+ block_number?: NumLike;
185
+ reason?: string;
186
+ };
179
187
  transaction: JsonRpcTransaction | null;
180
188
  }): ClientTransactionResponse | undefined {
181
189
  if (transaction == null) {
@@ -185,6 +193,11 @@ export class JsonRpcTransformers {
185
193
  return {
186
194
  transaction: JsonRpcTransformers.transactionTo(transaction),
187
195
  status,
196
+ cycles: apply(numFrom, cycles),
197
+ blockHash: apply(hexFrom, block_hash),
198
+ blockNumber: apply(numFrom, block_number),
199
+ txIndex: apply(numFrom, tx_index),
200
+ reason,
188
201
  };
189
202
  }
190
203
  static blockHeaderTo(header: JsonRpcBlockHeader): ClientBlockHeader {
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Represents a fixed point value as a bigint.
3
+ * @public
3
4
  */
4
5
 
5
6
  export type FixedPoint = bigint;
@@ -7,12 +8,14 @@ export type FixedPoint = bigint;
7
8
  /**
8
9
  * Represents a value that can be converted to a fixed point value.
9
10
  * It can be a bigint, string, or number.
11
+ * @public
10
12
  */
11
13
 
12
14
  export type FixedPointLike = bigint | string | number;
13
15
 
14
16
  /**
15
17
  * Converts a FixedPointLike value to its string representation with fixed-point decimals.
18
+ * @public
16
19
  *
17
20
  * @param val - The value to convert, which can be a bigint, string, or number.
18
21
  * @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
@@ -43,6 +46,7 @@ export function fixedPointToString(val: FixedPointLike, decimals = 8): string {
43
46
 
44
47
  /**
45
48
  * Converts a FixedPointLike value to a FixedPoint (bigint) with fixed-point decimals.
49
+ * @public
46
50
  *
47
51
  * @param val - The value to convert, which can be a bigint, string, or number.
48
52
  * @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
@@ -74,6 +78,7 @@ export function fixedPointFrom(val: FixedPointLike, decimals = 8): FixedPoint {
74
78
 
75
79
  /**
76
80
  * Represents the fixed point value of zero as a bigint.
81
+ * @public
77
82
  */
78
83
 
79
84
  export const Zero: FixedPoint = 0n;
@@ -81,6 +86,7 @@ export const Zero: FixedPoint = 0n;
81
86
  /**
82
87
  * Represents the fixed point value of one as a FixedPoint (bigint).
83
88
  * Equivalent to 1 in fixed-point representation with default decimals (8).
89
+ * @public
84
90
  */
85
91
 
86
92
  export const One: FixedPoint = fixedPointFrom("1");
@@ -1,6 +1,9 @@
1
1
  import { BytesLike } from "../bytes/index.js";
2
2
  import { Hex } from "../hex/index.js";
3
3
 
4
+ /**
5
+ * @public
6
+ */
4
7
  export interface Hasher {
5
8
  /**
6
9
  * Updates the hash with the given data.
@@ -6,6 +6,9 @@ import { NumLike, numLeToBytes } from "../num/index.js";
6
6
  import { CKB_BLAKE2B_PERSONAL } from "./advanced.js";
7
7
  import { Hasher } from "./hasher.js";
8
8
 
9
+ /**
10
+ * @public
11
+ */
9
12
  export class HasherCkb implements Hasher {
10
13
  private readonly hasher: ReturnType<(typeof blake2b)["create"]>;
11
14
 
@@ -62,6 +65,7 @@ export class HasherCkb implements Hasher {
62
65
 
63
66
  /**
64
67
  * Computes the CKB hash of the given data using the Blake2b algorithm.
68
+ * @public
65
69
  *
66
70
  * @param data - The data to hash.
67
71
  * @returns The hexadecimal string representation of the hash.
@@ -80,8 +84,9 @@ export function hashCkb(...data: BytesLike[]): Hex {
80
84
 
81
85
  /**
82
86
  * Computes the Type ID hash of the given data.
87
+ * @public
83
88
  *
84
- * @param cellInput - The first cell input of the transaction.
89
+ * @param cellInputLike - The first cell input of the transaction.
85
90
  * @param outputIndex - The output index of the Type ID cell.
86
91
  * @returns The hexadecimal string representation of the hash.
87
92
  *
@@ -3,6 +3,9 @@ import { BytesLike, bytesFrom } from "../bytes/index.js";
3
3
  import { Hex, hexFrom } from "../hex/index.js";
4
4
  import { Hasher } from "./hasher.js";
5
5
 
6
+ /**
7
+ * @public
8
+ */
6
9
  export class HasherKeecak256 implements Hasher {
7
10
  private readonly hasher: ReturnType<(typeof keccak_256)["create"]>;
8
11
 
package/src/hex/index.ts CHANGED
@@ -2,16 +2,19 @@ import { bytesFrom, BytesLike, bytesTo } from "../bytes/index.js";
2
2
 
3
3
  /**
4
4
  * Represents a hexadecimal string prefixed with "0x".
5
+ * @public
5
6
  */
6
7
  export type Hex = `0x${string}`;
7
8
  /**
8
9
  * Represents a value that can be converted to a hexadecimal string.
9
10
  * It extends the BytesLike type.
11
+ * @public
10
12
  */
11
13
  export type HexLike = BytesLike;
12
14
 
13
15
  /**
14
16
  * Converts a HexLike value to a Hex string.
17
+ * @public
15
18
  *
16
19
  * @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
17
20
  * @returns A Hex string representing the value.
@@ -18,6 +18,9 @@ function mac(derivedKey: Bytes, cipherText: Bytes) {
18
18
  ).slice(2);
19
19
  }
20
20
 
21
+ /**
22
+ * @public
23
+ */
21
24
  export async function keystoreEncrypt(
22
25
  privateKeyLike: BytesLike,
23
26
  chainCodeLike: BytesLike,
@@ -79,6 +82,9 @@ export async function keystoreEncrypt(
79
82
  };
80
83
  }
81
84
 
85
+ /**
86
+ * @public
87
+ */
82
88
  export async function keystoreDecrypt(
83
89
  keystore: unknown,
84
90
  password: string,
package/src/num/index.ts CHANGED
@@ -3,17 +3,20 @@ import { Hex, HexLike, hexFrom } from "../hex/index.js";
3
3
 
4
4
  /**
5
5
  * Represents a numeric value as a bigint.
6
+ * @public
6
7
  */
7
8
  export type Num = bigint;
8
9
 
9
10
  /**
10
11
  * Represents a value that can be converted to a numeric value.
11
12
  * It can be a string, number, bigint, or HexLike.
13
+ * @public
12
14
  */
13
15
  export type NumLike = string | number | bigint | HexLike;
14
16
 
15
17
  /**
16
18
  * Get the max among all numbers.
19
+ * @public
17
20
  *
18
21
  * @param numbers - numbers.
19
22
  * @returns The max numbers among them.
@@ -36,6 +39,7 @@ export function numMax(a: NumLike, ...numbers: NumLike[]): Num {
36
39
 
37
40
  /**
38
41
  * Converts a NumLike value to a Num (bigint).
42
+ * @public
39
43
  *
40
44
  * @param val - The value to convert, which can be a string, number, bigint, or HexLike.
41
45
  * @returns A Num (bigint) representing the value.
@@ -60,6 +64,7 @@ export function numFrom(val: NumLike): Num {
60
64
 
61
65
  /**
62
66
  * Converts a NumLike value to a hexadecimal string.
67
+ * @public
63
68
  *
64
69
  * @param val - The value to convert, which can be a string, number, bigint, or HexLike.
65
70
  * @returns A Hex string representing the numeric value.
@@ -75,6 +80,7 @@ export function numToHex(val: NumLike): Hex {
75
80
 
76
81
  /**
77
82
  * Converts a NumLike value to a byte array in little-endian order.
83
+ * @public
78
84
  *
79
85
  * @param val - The value to convert, which can be a string, number, bigint, or HexLike.
80
86
  * @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
@@ -92,6 +98,7 @@ export function numToBytes(val: NumLike, bytes?: number): Bytes {
92
98
 
93
99
  /**
94
100
  * Converts a NumLike value to a byte array in little-endian order.
101
+ * @public
95
102
  *
96
103
  * @param val - The value to convert, which can be a string, number, bigint, or HexLike.
97
104
  * @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
@@ -108,6 +115,7 @@ export function numLeToBytes(val: NumLike, bytes?: number): Bytes {
108
115
 
109
116
  /**
110
117
  * Converts a NumLike value to a byte array in big-endian order.
118
+ * @public
111
119
  *
112
120
  * @param val - The value to convert, which can be a string, number, bigint, or HexLike.
113
121
  * @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
@@ -132,6 +140,7 @@ export function numBeToBytes(val: NumLike, bytes?: number): Bytes {
132
140
 
133
141
  /**
134
142
  * Converts a byte array to a Num (bigint) assuming little-endian order.
143
+ * @public
135
144
  *
136
145
  * @param val - The byte array to convert.
137
146
  * @returns A Num (bigint) representing the numeric value.
@@ -147,6 +156,7 @@ export function numFromBytes(val: BytesLike): Num {
147
156
 
148
157
  /**
149
158
  * Converts a byte array to a Num (bigint) assuming little-endian order.
159
+ * @public
150
160
  *
151
161
  * @param val - The byte array to convert.
152
162
  * @returns A Num (bigint) representing the numeric value.
@@ -162,6 +172,7 @@ export function numLeFromBytes(val: BytesLike): Num {
162
172
 
163
173
  /**
164
174
  * Converts a byte array to a Num (bigint) assuming big-endian order.
175
+ * @public
165
176
  *
166
177
  * @param val - The byte array to convert.
167
178
  * @returns A Num (bigint) representing the numeric value.
@@ -12,6 +12,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
12
12
  * An abstract class extending the Signer class for Bitcoin-like signing operations.
13
13
  * This class provides methods to get Bitcoin account, public key, and internal address,
14
14
  * as well as signing transactions.
15
+ * @public
15
16
  */
16
17
  export abstract class SignerBtc extends Signer {
17
18
  get type(): SignerType {
@@ -5,6 +5,7 @@ import { SignerBtc } from "./signerBtc.js";
5
5
  /**
6
6
  * A class extending SignerBtc that provides read-only access to a Bitcoin public key and account.
7
7
  * This class does not support signing operations.
8
+ * @public
8
9
  */
9
10
  export class SignerBtcPublicKeyReadonly extends SignerBtc {
10
11
  private readonly publicKey: Hex;
@@ -3,6 +3,9 @@ import { magicHash } from "bitcoinjs-message";
3
3
  import { BytesLike, bytesFrom } from "../../bytes/index.js";
4
4
  import { hexFrom } from "../../hex/index.js";
5
5
 
6
+ /**
7
+ * @public
8
+ */
6
9
  export function verifyMessageBtcEcdsa(
7
10
  message: string | BytesLike,
8
11
  signature: string,
@@ -7,6 +7,9 @@ import { numBeToBytes } from "../../num/index.js";
7
7
  import { SignerCkbPublicKey } from "./signerCkbPublicKey.js";
8
8
  import { messageHashCkbSecp256k1 } from "./verifyCkbSecp256k1.js";
9
9
 
10
+ /**
11
+ * @public
12
+ */
10
13
  export class SignerCkbPrivateKey extends SignerCkbPublicKey {
11
14
  public readonly privateKey: Hex;
12
15
 
@@ -6,6 +6,9 @@ import { hashCkb } from "../../hasher/index.js";
6
6
  import { Hex, HexLike, hexFrom } from "../../hex/index.js";
7
7
  import { Signer, SignerSignType, SignerType } from "../signer/index.js";
8
8
 
9
+ /**
10
+ * @public
11
+ */
9
12
  export class SignerCkbPublicKey extends Signer {
10
13
  get type(): SignerType {
11
14
  return SignerType.CKB;
@@ -6,6 +6,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
6
6
  /**
7
7
  * A class extending Signer that provides read-only access to a CKB script.
8
8
  * This class does not support signing operations.
9
+ * @public
9
10
  */
10
11
  export class SignerCkbScriptReadonly extends Signer {
11
12
  get type(): SignerType {
@@ -4,12 +4,18 @@ import { hashCkb } from "../../hasher/index.js";
4
4
  import { Hex, hexFrom } from "../../hex/index.js";
5
5
  import { numFrom } from "../../num/index.js";
6
6
 
7
+ /**
8
+ * @public
9
+ */
7
10
  export function messageHashCkbSecp256k1(message: string | BytesLike): Hex {
8
11
  const msg = typeof message === "string" ? message : hexFrom(message);
9
12
  const buffer = bytesFrom(`Nervos Message:${msg}`, "utf8");
10
13
  return hashCkb(buffer);
11
14
  }
12
15
 
16
+ /**
17
+ * @public
18
+ */
13
19
  export function verifyMessageCkbSecp256k1(
14
20
  message: string | BytesLike,
15
21
  signature: string,
@@ -2,6 +2,9 @@ import { verifySignature } from "@joyid/ckb";
2
2
  import { BytesLike } from "../../bytes/index.js";
3
3
  import { hexFrom } from "../../hex/index.js";
4
4
 
5
+ /**
6
+ * @public
7
+ */
5
8
  export function verifyMessageJoyId(
6
9
  message: string | BytesLike,
7
10
  signature: string,
@@ -2,6 +2,9 @@ import { Client } from "../../client/index.js";
2
2
  import { SignerType } from "../signer/index.js";
3
3
  import { SignerDummy } from "./dummy.js";
4
4
 
5
+ /**
6
+ * @public
7
+ */
5
8
  export class SignerAlwaysError extends SignerDummy {
6
9
  constructor(
7
10
  client: Client,
@@ -2,6 +2,9 @@ import { Address } from "../../address/index.js";
2
2
  import { Client } from "../../client/index.js";
3
3
  import { Signer, SignerSignType, SignerType } from "../signer/index.js";
4
4
 
5
+ /**
6
+ * @public
7
+ */
5
8
  export abstract class SignerDummy extends Signer {
6
9
  get signType(): SignerSignType {
7
10
  return SignerSignType.Unknown;
@@ -2,6 +2,9 @@ import { Client } from "../../client/index.js";
2
2
  import { SignerType } from "../signer/index.js";
3
3
  import { SignerDummy } from "./dummy.js";
4
4
 
5
+ /**
6
+ * @public
7
+ */
5
8
  export class SignerOpenLink extends SignerDummy {
6
9
  constructor(
7
10
  client: Client,
@@ -16,6 +16,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
16
16
  /**
17
17
  * An abstract class extending Signer for Ethereum Virtual Machine (EVM) based signing operations.
18
18
  * This class provides methods to get EVM account, internal address, and signing transactions.
19
+ * @public
19
20
  */
20
21
  export abstract class SignerEvm extends Signer {
21
22
  get type(): SignerType {
@@ -5,6 +5,7 @@ import { SignerEvm } from "./signerEvm.js";
5
5
  /**
6
6
  * A class extending SignerEvm that provides read-only access to an EVM address.
7
7
  * This class does not support signing operations.
8
+ * @public
8
9
  */
9
10
  export class SignerEvmAddressReadonly extends SignerEvm {
10
11
  private readonly address: Hex;
@@ -1,6 +1,9 @@
1
1
  import { verifyMessage } from "ethers";
2
2
  import { BytesLike, bytesFrom } from "../../bytes/index.js";
3
3
 
4
+ /**
5
+ * @public
6
+ */
4
7
  export function verifyMessageEvmPersonal(
5
8
  message: string | BytesLike,
6
9
  signature: string,
@@ -8,6 +8,9 @@ import { Hex, hexFrom } from "../../hex/index.js";
8
8
  import { Signer, SignerSignType, SignerType } from "../signer/index.js";
9
9
  import { buildNostrEventFromMessage } from "./verify.js";
10
10
 
11
+ /**
12
+ * @public
13
+ */
11
14
  export interface NostrEvent {
12
15
  id?: string;
13
16
  pubkey?: string;
@@ -18,6 +21,9 @@ export interface NostrEvent {
18
21
  content: string;
19
22
  }
20
23
 
24
+ /**
25
+ * @public
26
+ */
21
27
  export abstract class SignerNostr extends Signer {
22
28
  static CKB_SIG_HASH_ALL_TAG = "ckb_sighash_all";
23
29
  static CKB_UNLOCK_EVENT_KIND = 23334;
@@ -5,6 +5,9 @@ import { BytesLike, bytesFrom } from "../../bytes/index.js";
5
5
  import { hexFrom } from "../../hex/index.js";
6
6
  import { NostrEvent } from "./signerNostr.js";
7
7
 
8
+ /**
9
+ * @public
10
+ */
8
11
  export function buildNostrEventFromMessage(
9
12
  message: string | BytesLike,
10
13
  ): NostrEvent {