@ckb-ccc/core 0.0.10-alpha.6 → 0.0.10-alpha.8

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 (392) hide show
  1. package/dist/address/address.advanced.d.ts +2 -2
  2. package/dist/address/address.advanced.d.ts.map +1 -1
  3. package/dist/address/address.advanced.js +3 -3
  4. package/dist/address/advanced.d.ts +1 -1
  5. package/dist/address/advanced.d.ts.map +1 -1
  6. package/dist/address/advanced.js +1 -1
  7. package/dist/address/index.d.ts +3 -3
  8. package/dist/address/index.d.ts.map +1 -1
  9. package/dist/address/index.js +3 -3
  10. package/dist/advanced.d.ts +2 -2
  11. package/dist/advanced.d.ts.map +1 -1
  12. package/dist/advanced.js +2 -2
  13. package/dist/advancedBarrel.d.ts +4 -4
  14. package/dist/advancedBarrel.d.ts.map +1 -1
  15. package/dist/advancedBarrel.js +4 -4
  16. package/dist/barrel.d.ts +11 -10
  17. package/dist/barrel.d.ts.map +1 -1
  18. package/dist/barrel.js +11 -10
  19. package/dist/bytes/index.d.ts +1 -1
  20. package/dist/bytes/index.d.ts.map +1 -1
  21. package/dist/bytes/index.js +1 -1
  22. package/dist/ckb/advanced.d.ts +3 -3
  23. package/dist/ckb/advanced.d.ts.map +1 -1
  24. package/dist/ckb/advanced.js +3 -3
  25. package/dist/ckb/index.d.ts +2 -2
  26. package/dist/ckb/index.d.ts.map +1 -1
  27. package/dist/ckb/index.js +2 -2
  28. package/dist/ckb/molecule.advanced/index.d.ts +1 -1
  29. package/dist/ckb/molecule.advanced/index.d.ts.map +1 -1
  30. package/dist/ckb/molecule.advanced/index.js +1 -1
  31. package/dist/ckb/script.advanced.d.ts +1 -1
  32. package/dist/ckb/script.advanced.d.ts.map +1 -1
  33. package/dist/ckb/script.d.ts +4 -4
  34. package/dist/ckb/script.d.ts.map +1 -1
  35. package/dist/ckb/script.js +5 -5
  36. package/dist/ckb/transaction.advanced.d.ts +1 -1
  37. package/dist/ckb/transaction.advanced.d.ts.map +1 -1
  38. package/dist/ckb/transaction.d.ts +9 -9
  39. package/dist/ckb/transaction.d.ts.map +1 -1
  40. package/dist/ckb/transaction.js +9 -9
  41. package/dist/client/advanced.d.ts +5 -5
  42. package/dist/client/advanced.d.ts.map +1 -1
  43. package/dist/client/advanced.js +5 -5
  44. package/dist/client/client.advanced.d.ts +4 -4
  45. package/dist/client/client.advanced.d.ts.map +1 -1
  46. package/dist/client/client.advanced.js +6 -6
  47. package/dist/client/client.d.ts +25 -5
  48. package/dist/client/client.d.ts.map +1 -1
  49. package/dist/client/client.js +39 -7
  50. package/dist/client/clientPublicMainnet.advanced.d.ts +2 -2
  51. package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  52. package/dist/client/clientPublicMainnet.advanced.js +1 -1
  53. package/dist/client/clientPublicMainnet.d.ts +3 -3
  54. package/dist/client/clientPublicMainnet.d.ts.map +1 -1
  55. package/dist/client/clientPublicMainnet.js +3 -3
  56. package/dist/client/clientPublicTestnet.advanced.d.ts +2 -2
  57. package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  58. package/dist/client/clientPublicTestnet.advanced.js +1 -1
  59. package/dist/client/clientPublicTestnet.d.ts +3 -3
  60. package/dist/client/clientPublicTestnet.d.ts.map +1 -1
  61. package/dist/client/clientPublicTestnet.js +3 -3
  62. package/dist/client/clientTypes.advanced.d.ts +3 -3
  63. package/dist/client/clientTypes.advanced.d.ts.map +1 -1
  64. package/dist/client/clientTypes.advanced.js +1 -1
  65. package/dist/client/clientTypes.d.ts +39 -4
  66. package/dist/client/clientTypes.d.ts.map +1 -1
  67. package/dist/client/clientTypes.js +16 -4
  68. package/dist/client/index.d.ts +5 -5
  69. package/dist/client/index.d.ts.map +1 -1
  70. package/dist/client/index.js +5 -5
  71. package/dist/client/jsonRpc/advanced.d.ts +2 -2
  72. package/dist/client/jsonRpc/advanced.d.ts.map +1 -1
  73. package/dist/client/jsonRpc/advanced.js +2 -2
  74. package/dist/client/jsonRpc/index.d.ts +24 -6
  75. package/dist/client/jsonRpc/index.d.ts.map +1 -1
  76. package/dist/client/jsonRpc/index.js +18 -4
  77. package/dist/client/jsonRpc/transformers.d.ts +8 -5
  78. package/dist/client/jsonRpc/transformers.d.ts.map +1 -1
  79. package/dist/client/jsonRpc/transformers.js +58 -13
  80. package/dist/client/jsonRpc/types.d.ts +37 -10
  81. package/dist/client/jsonRpc/types.d.ts.map +1 -1
  82. package/dist/fixedPoint/index.test.js +1 -1
  83. package/dist/hasher/index.d.ts +4 -4
  84. package/dist/hasher/index.d.ts.map +1 -1
  85. package/dist/hasher/index.js +4 -4
  86. package/dist/hex/index.d.ts +1 -1
  87. package/dist/hex/index.d.ts.map +1 -1
  88. package/dist/hex/index.js +1 -1
  89. package/dist/index.d.ts +2 -2
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +2 -2
  92. package/dist/keystore/index.d.ts +25 -0
  93. package/dist/keystore/index.d.ts.map +1 -0
  94. package/dist/keystore/index.js +100 -0
  95. package/dist/num/index.d.ts +2 -2
  96. package/dist/num/index.d.ts.map +1 -1
  97. package/dist/num/index.js +2 -2
  98. package/dist/package.json +3 -0
  99. package/dist/signer/btc/index.d.ts +3 -3
  100. package/dist/signer/btc/index.d.ts.map +1 -1
  101. package/dist/signer/btc/index.js +3 -3
  102. package/dist/signer/btc/signerBtc.d.ts +4 -4
  103. package/dist/signer/btc/signerBtc.d.ts.map +1 -1
  104. package/dist/signer/btc/signerBtc.js +7 -7
  105. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +3 -3
  106. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
  107. package/dist/signer/btc/signerBtcPublicKeyReadonly.js +2 -2
  108. package/dist/signer/btc/verify.d.ts +1 -1
  109. package/dist/signer/btc/verify.d.ts.map +1 -1
  110. package/dist/signer/btc/verify.js +2 -2
  111. package/dist/signer/ckb/index.d.ts +5 -5
  112. package/dist/signer/ckb/index.d.ts.map +1 -1
  113. package/dist/signer/ckb/index.js +5 -5
  114. package/dist/signer/ckb/signerCkbPrivateKey.d.ts +5 -5
  115. package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  116. package/dist/signer/ckb/signerCkbPrivateKey.js +6 -6
  117. package/dist/signer/ckb/signerCkbPublicKey.d.ts +5 -5
  118. package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
  119. package/dist/signer/ckb/signerCkbPublicKey.js +7 -7
  120. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +4 -4
  121. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
  122. package/dist/signer/ckb/signerCkbScriptReadonly.js +3 -3
  123. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +2 -2
  124. package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
  125. package/dist/signer/ckb/verifyCkbSecp256k1.js +4 -4
  126. package/dist/signer/ckb/verifyJoyId.d.ts +1 -1
  127. package/dist/signer/ckb/verifyJoyId.d.ts.map +1 -1
  128. package/dist/signer/ckb/verifyJoyId.js +1 -1
  129. package/dist/signer/dummy/alwaysError.d.ts +3 -3
  130. package/dist/signer/dummy/alwaysError.d.ts.map +1 -1
  131. package/dist/signer/dummy/alwaysError.js +1 -1
  132. package/dist/signer/dummy/dummy.d.ts +3 -3
  133. package/dist/signer/dummy/dummy.d.ts.map +1 -1
  134. package/dist/signer/dummy/dummy.js +1 -1
  135. package/dist/signer/dummy/index.d.ts +3 -3
  136. package/dist/signer/dummy/index.d.ts.map +1 -1
  137. package/dist/signer/dummy/index.js +3 -3
  138. package/dist/signer/dummy/openLink.d.ts +3 -3
  139. package/dist/signer/dummy/openLink.d.ts.map +1 -1
  140. package/dist/signer/dummy/openLink.js +1 -1
  141. package/dist/signer/evm/index.d.ts +3 -3
  142. package/dist/signer/evm/index.d.ts.map +1 -1
  143. package/dist/signer/evm/index.js +3 -3
  144. package/dist/signer/evm/signerEvm.d.ts +5 -5
  145. package/dist/signer/evm/signerEvm.d.ts.map +1 -1
  146. package/dist/signer/evm/signerEvm.js +8 -8
  147. package/dist/signer/evm/signerEvmAddressReadonly.d.ts +3 -3
  148. package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  149. package/dist/signer/evm/signerEvmAddressReadonly.js +2 -2
  150. package/dist/signer/evm/verify.d.ts +1 -1
  151. package/dist/signer/evm/verify.d.ts.map +1 -1
  152. package/dist/signer/evm/verify.js +1 -1
  153. package/dist/signer/index.d.ts +6 -6
  154. package/dist/signer/index.d.ts.map +1 -1
  155. package/dist/signer/index.js +6 -6
  156. package/dist/signer/nostr/index.d.ts +1 -1
  157. package/dist/signer/nostr/index.d.ts.map +1 -1
  158. package/dist/signer/nostr/index.js +1 -1
  159. package/dist/signer/nostr/signerNostr.d.ts +5 -5
  160. package/dist/signer/nostr/signerNostr.d.ts.map +1 -1
  161. package/dist/signer/nostr/signerNostr.js +8 -8
  162. package/dist/signer/nostr/verify.d.ts +2 -2
  163. package/dist/signer/nostr/verify.d.ts.map +1 -1
  164. package/dist/signer/nostr/verify.js +2 -2
  165. package/dist/signer/signer/index.d.ts +6 -6
  166. package/dist/signer/signer/index.d.ts.map +1 -1
  167. package/dist/signer/signer/index.js +5 -5
  168. package/dist.commonjs/address/address.advanced.d.ts +2 -2
  169. package/dist.commonjs/address/address.advanced.d.ts.map +1 -1
  170. package/dist.commonjs/address/address.advanced.js +13 -13
  171. package/dist.commonjs/address/advanced.d.ts +1 -1
  172. package/dist.commonjs/address/advanced.d.ts.map +1 -1
  173. package/dist.commonjs/address/advanced.js +1 -1
  174. package/dist.commonjs/address/index.d.ts +3 -3
  175. package/dist.commonjs/address/index.d.ts.map +1 -1
  176. package/dist.commonjs/address/index.js +9 -9
  177. package/dist.commonjs/advanced.d.ts +2 -2
  178. package/dist.commonjs/advanced.d.ts.map +1 -1
  179. package/dist.commonjs/advanced.js +2 -2
  180. package/dist.commonjs/advancedBarrel.d.ts +4 -4
  181. package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
  182. package/dist.commonjs/advancedBarrel.js +4 -4
  183. package/dist.commonjs/barrel.d.ts +11 -10
  184. package/dist.commonjs/barrel.d.ts.map +1 -1
  185. package/dist.commonjs/barrel.js +11 -10
  186. package/dist.commonjs/bytes/index.d.ts +1 -1
  187. package/dist.commonjs/bytes/index.d.ts.map +1 -1
  188. package/dist.commonjs/bytes/index.js +4 -4
  189. package/dist.commonjs/ckb/advanced.d.ts +3 -3
  190. package/dist.commonjs/ckb/advanced.d.ts.map +1 -1
  191. package/dist.commonjs/ckb/advanced.js +3 -3
  192. package/dist.commonjs/ckb/index.d.ts +2 -2
  193. package/dist.commonjs/ckb/index.d.ts.map +1 -1
  194. package/dist.commonjs/ckb/index.js +2 -2
  195. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +1 -1
  196. package/dist.commonjs/ckb/molecule.advanced/index.d.ts.map +1 -1
  197. package/dist.commonjs/ckb/molecule.advanced/index.js +1 -1
  198. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  199. package/dist.commonjs/ckb/script.advanced.d.ts.map +1 -1
  200. package/dist.commonjs/ckb/script.d.ts +4 -4
  201. package/dist.commonjs/ckb/script.d.ts.map +1 -1
  202. package/dist.commonjs/ckb/script.js +19 -19
  203. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  204. package/dist.commonjs/ckb/transaction.advanced.d.ts.map +1 -1
  205. package/dist.commonjs/ckb/transaction.d.ts +9 -9
  206. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  207. package/dist.commonjs/ckb/transaction.js +89 -89
  208. package/dist.commonjs/client/advanced.d.ts +5 -5
  209. package/dist.commonjs/client/advanced.d.ts.map +1 -1
  210. package/dist.commonjs/client/advanced.js +5 -5
  211. package/dist.commonjs/client/client.advanced.d.ts +4 -4
  212. package/dist.commonjs/client/client.advanced.d.ts.map +1 -1
  213. package/dist.commonjs/client/client.advanced.js +16 -16
  214. package/dist.commonjs/client/client.d.ts +25 -5
  215. package/dist.commonjs/client/client.d.ts.map +1 -1
  216. package/dist.commonjs/client/client.js +51 -19
  217. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +2 -2
  218. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  219. package/dist.commonjs/client/clientPublicMainnet.advanced.js +13 -13
  220. package/dist.commonjs/client/clientPublicMainnet.d.ts +3 -3
  221. package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
  222. package/dist.commonjs/client/clientPublicMainnet.js +6 -6
  223. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +2 -2
  224. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  225. package/dist.commonjs/client/clientPublicTestnet.advanced.js +13 -13
  226. package/dist.commonjs/client/clientPublicTestnet.d.ts +3 -3
  227. package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
  228. package/dist.commonjs/client/clientPublicTestnet.js +6 -6
  229. package/dist.commonjs/client/clientTypes.advanced.d.ts +3 -3
  230. package/dist.commonjs/client/clientTypes.advanced.d.ts.map +1 -1
  231. package/dist.commonjs/client/clientTypes.advanced.js +2 -2
  232. package/dist.commonjs/client/clientTypes.d.ts +39 -4
  233. package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
  234. package/dist.commonjs/client/clientTypes.js +20 -7
  235. package/dist.commonjs/client/index.d.ts +5 -5
  236. package/dist.commonjs/client/index.d.ts.map +1 -1
  237. package/dist.commonjs/client/index.js +5 -5
  238. package/dist.commonjs/client/jsonRpc/advanced.d.ts +2 -2
  239. package/dist.commonjs/client/jsonRpc/advanced.d.ts.map +1 -1
  240. package/dist.commonjs/client/jsonRpc/advanced.js +2 -2
  241. package/dist.commonjs/client/jsonRpc/index.d.ts +24 -6
  242. package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
  243. package/dist.commonjs/client/jsonRpc/index.js +25 -11
  244. package/dist.commonjs/client/jsonRpc/transformers.d.ts +8 -5
  245. package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -1
  246. package/dist.commonjs/client/jsonRpc/transformers.js +79 -34
  247. package/dist.commonjs/client/jsonRpc/types.d.ts +37 -10
  248. package/dist.commonjs/client/jsonRpc/types.d.ts.map +1 -1
  249. package/dist.commonjs/fixedPoint/index.test.js +4 -4
  250. package/dist.commonjs/hasher/index.d.ts +4 -4
  251. package/dist.commonjs/hasher/index.d.ts.map +1 -1
  252. package/dist.commonjs/hasher/index.js +8 -8
  253. package/dist.commonjs/hex/index.d.ts +1 -1
  254. package/dist.commonjs/hex/index.d.ts.map +1 -1
  255. package/dist.commonjs/hex/index.js +2 -2
  256. package/dist.commonjs/index.d.ts +2 -2
  257. package/dist.commonjs/index.d.ts.map +1 -1
  258. package/dist.commonjs/index.js +2 -2
  259. package/dist.commonjs/keystore/index.d.ts +25 -0
  260. package/dist.commonjs/keystore/index.d.ts.map +1 -0
  261. package/dist.commonjs/keystore/index.js +105 -0
  262. package/dist.commonjs/num/index.d.ts +2 -2
  263. package/dist.commonjs/num/index.d.ts.map +1 -1
  264. package/dist.commonjs/num/index.js +7 -7
  265. package/dist.commonjs/package.json +3 -0
  266. package/dist.commonjs/signer/btc/index.d.ts +3 -3
  267. package/dist.commonjs/signer/btc/index.d.ts.map +1 -1
  268. package/dist.commonjs/signer/btc/index.js +3 -3
  269. package/dist.commonjs/signer/btc/signerBtc.d.ts +4 -4
  270. package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
  271. package/dist.commonjs/signer/btc/signerBtc.js +19 -19
  272. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +3 -3
  273. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
  274. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +4 -4
  275. package/dist.commonjs/signer/btc/verify.d.ts +1 -1
  276. package/dist.commonjs/signer/btc/verify.d.ts.map +1 -1
  277. package/dist.commonjs/signer/btc/verify.js +5 -5
  278. package/dist.commonjs/signer/ckb/index.d.ts +5 -5
  279. package/dist.commonjs/signer/ckb/index.d.ts.map +1 -1
  280. package/dist.commonjs/signer/ckb/index.js +5 -5
  281. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +5 -5
  282. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
  283. package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +15 -15
  284. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +5 -5
  285. package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
  286. package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +15 -15
  287. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +4 -4
  288. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
  289. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +8 -8
  290. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +2 -2
  291. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
  292. package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +9 -9
  293. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +1 -1
  294. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts.map +1 -1
  295. package/dist.commonjs/signer/ckb/verifyJoyId.js +2 -2
  296. package/dist.commonjs/signer/dummy/alwaysError.d.ts +3 -3
  297. package/dist.commonjs/signer/dummy/alwaysError.d.ts.map +1 -1
  298. package/dist.commonjs/signer/dummy/alwaysError.js +2 -2
  299. package/dist.commonjs/signer/dummy/dummy.d.ts +3 -3
  300. package/dist.commonjs/signer/dummy/dummy.d.ts.map +1 -1
  301. package/dist.commonjs/signer/dummy/dummy.js +3 -3
  302. package/dist.commonjs/signer/dummy/index.d.ts +3 -3
  303. package/dist.commonjs/signer/dummy/index.d.ts.map +1 -1
  304. package/dist.commonjs/signer/dummy/index.js +3 -3
  305. package/dist.commonjs/signer/dummy/openLink.d.ts +3 -3
  306. package/dist.commonjs/signer/dummy/openLink.d.ts.map +1 -1
  307. package/dist.commonjs/signer/dummy/openLink.js +2 -2
  308. package/dist.commonjs/signer/evm/index.d.ts +3 -3
  309. package/dist.commonjs/signer/evm/index.d.ts.map +1 -1
  310. package/dist.commonjs/signer/evm/index.js +3 -3
  311. package/dist.commonjs/signer/evm/signerEvm.d.ts +5 -5
  312. package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
  313. package/dist.commonjs/signer/evm/signerEvm.js +21 -21
  314. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +3 -3
  315. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  316. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +4 -4
  317. package/dist.commonjs/signer/evm/verify.d.ts +1 -1
  318. package/dist.commonjs/signer/evm/verify.d.ts.map +1 -1
  319. package/dist.commonjs/signer/evm/verify.js +2 -2
  320. package/dist.commonjs/signer/index.d.ts +6 -6
  321. package/dist.commonjs/signer/index.d.ts.map +1 -1
  322. package/dist.commonjs/signer/index.js +6 -6
  323. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  324. package/dist.commonjs/signer/nostr/index.d.ts.map +1 -1
  325. package/dist.commonjs/signer/nostr/index.js +1 -1
  326. package/dist.commonjs/signer/nostr/signerNostr.d.ts +5 -5
  327. package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +1 -1
  328. package/dist.commonjs/signer/nostr/signerNostr.js +20 -20
  329. package/dist.commonjs/signer/nostr/verify.d.ts +2 -2
  330. package/dist.commonjs/signer/nostr/verify.d.ts.map +1 -1
  331. package/dist.commonjs/signer/nostr/verify.js +5 -5
  332. package/dist.commonjs/signer/signer/index.d.ts +6 -6
  333. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  334. package/dist.commonjs/signer/signer/index.js +10 -10
  335. package/package.json +7 -5
  336. package/src/address/address.advanced.ts +4 -4
  337. package/src/address/advanced.ts +1 -1
  338. package/src/address/index.ts +5 -5
  339. package/src/advanced.ts +2 -2
  340. package/src/advancedBarrel.ts +4 -4
  341. package/src/barrel.ts +11 -10
  342. package/src/bytes/index.ts +2 -2
  343. package/src/ckb/advanced.ts +3 -3
  344. package/src/ckb/index.ts +2 -2
  345. package/src/ckb/molecule.advanced/index.ts +1 -1
  346. package/src/ckb/script.advanced.ts +1 -1
  347. package/src/ckb/script.ts +6 -6
  348. package/src/ckb/transaction.advanced.ts +1 -1
  349. package/src/ckb/transaction.ts +16 -12
  350. package/src/client/advanced.ts +5 -5
  351. package/src/client/client.advanced.ts +6 -6
  352. package/src/client/client.ts +177 -8
  353. package/src/client/clientPublicMainnet.advanced.ts +2 -2
  354. package/src/client/clientPublicMainnet.ts +4 -4
  355. package/src/client/clientPublicTestnet.advanced.ts +2 -2
  356. package/src/client/clientPublicTestnet.ts +4 -4
  357. package/src/client/clientTypes.advanced.ts +3 -3
  358. package/src/client/clientTypes.ts +59 -5
  359. package/src/client/index.ts +5 -5
  360. package/src/client/jsonRpc/advanced.ts +2 -2
  361. package/src/client/jsonRpc/index.ts +26 -6
  362. package/src/client/jsonRpc/transformers.ts +94 -27
  363. package/src/client/jsonRpc/types.ts +41 -10
  364. package/src/fixedPoint/index.test.ts +1 -1
  365. package/src/hasher/index.ts +5 -5
  366. package/src/hex/index.ts +1 -1
  367. package/src/index.ts +2 -2
  368. package/src/keystore/index.ts +138 -0
  369. package/src/num/index.ts +2 -2
  370. package/src/signer/btc/index.ts +3 -3
  371. package/src/signer/btc/signerBtc.ts +7 -7
  372. package/src/signer/btc/signerBtcPublicKeyReadonly.ts +3 -3
  373. package/src/signer/btc/verify.ts +2 -2
  374. package/src/signer/ckb/index.ts +5 -5
  375. package/src/signer/ckb/signerCkbPrivateKey.ts +7 -7
  376. package/src/signer/ckb/signerCkbPublicKey.ts +7 -7
  377. package/src/signer/ckb/signerCkbScriptReadonly.ts +4 -4
  378. package/src/signer/ckb/verifyCkbSecp256k1.ts +4 -4
  379. package/src/signer/ckb/verifyJoyId.ts +2 -2
  380. package/src/signer/dummy/alwaysError.ts +3 -3
  381. package/src/signer/dummy/dummy.ts +3 -3
  382. package/src/signer/dummy/index.ts +3 -3
  383. package/src/signer/dummy/openLink.ts +3 -3
  384. package/src/signer/evm/index.ts +3 -3
  385. package/src/signer/evm/signerEvm.ts +13 -8
  386. package/src/signer/evm/signerEvmAddressReadonly.ts +3 -3
  387. package/src/signer/evm/verify.ts +1 -1
  388. package/src/signer/index.ts +6 -6
  389. package/src/signer/nostr/index.ts +1 -1
  390. package/src/signer/nostr/signerNostr.ts +8 -8
  391. package/src/signer/nostr/verify.ts +3 -3
  392. package/src/signer/signer/index.ts +11 -11
@@ -9,20 +9,23 @@ import {
9
9
  ScriptLike,
10
10
  Transaction,
11
11
  TransactionLike,
12
- } from "../ckb";
13
- import { Zero } from "../fixedPoint";
14
- import { Hex, HexLike, hexFrom } from "../hex";
15
- import { Num, NumLike, numFrom } from "../num";
16
- import { apply, reduceAsync } from "../utils";
17
- import { filterCell } from "./client.advanced";
12
+ } from "../ckb/index.js";
13
+ import { Zero } from "../fixedPoint/index.js";
14
+ import { Hex, HexLike, hexFrom } from "../hex/index.js";
15
+ import { Num, NumLike, numFrom } from "../num/index.js";
16
+ import { apply, reduceAsync } from "../utils/index.js";
17
+ import { filterCell } from "./client.advanced.js";
18
+ import { ClientCollectableSearchKeyLike } from "./clientTypes.advanced.js";
18
19
  import {
19
20
  ClientFindCellsResponse,
21
+ ClientFindTransactionsGroupedResponse,
22
+ ClientFindTransactionsResponse,
20
23
  ClientIndexerSearchKey,
21
24
  ClientIndexerSearchKeyLike,
25
+ ClientIndexerSearchKeyTransactionLike,
22
26
  ClientTransactionResponse,
23
27
  OutputsValidator,
24
- } from "./clientTypes";
25
- import { ClientCollectableSearchKeyLike } from "./clientTypes.advanced";
28
+ } from "./clientTypes.js";
26
29
 
27
30
  export enum KnownScript {
28
31
  Secp256k1Blake160 = "Secp256k1Blake160",
@@ -271,6 +274,172 @@ export abstract class Client {
271
274
  );
272
275
  }
273
276
 
277
+ abstract findTransactionsPaged(
278
+ key: Omit<ClientIndexerSearchKeyTransactionLike, "groupByTransaction"> & {
279
+ groupByTransaction: true;
280
+ },
281
+ order?: "asc" | "desc",
282
+ limit?: NumLike,
283
+ after?: string,
284
+ ): Promise<ClientFindTransactionsGroupedResponse>;
285
+ abstract findTransactionsPaged(
286
+ key: Omit<ClientIndexerSearchKeyTransactionLike, "groupByTransaction"> & {
287
+ groupByTransaction?: false | null;
288
+ },
289
+ order?: "asc" | "desc",
290
+ limit?: NumLike,
291
+ after?: string,
292
+ ): Promise<ClientFindTransactionsResponse>;
293
+ abstract findTransactionsPaged(
294
+ key: ClientIndexerSearchKeyTransactionLike,
295
+ order?: "asc" | "desc",
296
+ limit?: NumLike,
297
+ after?: string,
298
+ ): Promise<
299
+ ClientFindTransactionsResponse | ClientFindTransactionsGroupedResponse
300
+ >;
301
+
302
+ findTransactions(
303
+ key: Omit<ClientIndexerSearchKeyTransactionLike, "groupByTransaction"> & {
304
+ groupByTransaction: true;
305
+ },
306
+ order?: "asc" | "desc",
307
+ limit?: number,
308
+ ): AsyncGenerator<ClientFindTransactionsGroupedResponse["transactions"][0]>;
309
+ findTransactions(
310
+ key: Omit<ClientIndexerSearchKeyTransactionLike, "groupByTransaction"> & {
311
+ groupByTransaction?: false | null;
312
+ },
313
+ order?: "asc" | "desc",
314
+ limit?: number,
315
+ ): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0]>;
316
+ findTransactions(
317
+ key: ClientIndexerSearchKeyTransactionLike,
318
+ order?: "asc" | "desc",
319
+ limit?: number,
320
+ ): AsyncGenerator<
321
+ | ClientFindTransactionsResponse["transactions"][0]
322
+ | ClientFindTransactionsGroupedResponse["transactions"][0]
323
+ >;
324
+ async *findTransactions(
325
+ key: ClientIndexerSearchKeyTransactionLike,
326
+ order?: "asc" | "desc",
327
+ limit = 10,
328
+ ): AsyncGenerator<
329
+ | ClientFindTransactionsResponse["transactions"][0]
330
+ | ClientFindTransactionsGroupedResponse["transactions"][0]
331
+ > {
332
+ let last: string | undefined = undefined;
333
+
334
+ while (true) {
335
+ const {
336
+ transactions,
337
+ lastCursor,
338
+ }:
339
+ | ClientFindTransactionsResponse
340
+ | ClientFindTransactionsGroupedResponse =
341
+ await this.findTransactionsPaged(key, order, limit, last);
342
+ for (const tx of transactions) {
343
+ yield tx;
344
+ }
345
+ if (transactions.length === 0 || transactions.length < limit) {
346
+ return;
347
+ }
348
+ last = lastCursor;
349
+ }
350
+ }
351
+
352
+ findTransactionsByLockAndType(
353
+ lock: ScriptLike,
354
+ type: ScriptLike,
355
+ groupByTransaction: true,
356
+ order?: "asc" | "desc",
357
+ limit?: number,
358
+ ): AsyncGenerator<ClientFindTransactionsGroupedResponse["transactions"][0]>;
359
+ findTransactionsByLockAndType(
360
+ lock: ScriptLike,
361
+ type: ScriptLike,
362
+ groupByTransaction?: false | null,
363
+ order?: "asc" | "desc",
364
+ limit?: number,
365
+ ): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0]>;
366
+ findTransactionsByLockAndType(
367
+ lock: ScriptLike,
368
+ type: ScriptLike,
369
+ groupByTransaction?: boolean | null,
370
+ order?: "asc" | "desc",
371
+ limit?: number,
372
+ ): AsyncGenerator<
373
+ | ClientFindTransactionsResponse["transactions"][0]
374
+ | ClientFindTransactionsGroupedResponse["transactions"][0]
375
+ >;
376
+ findTransactionsByLockAndType(
377
+ lock: ScriptLike,
378
+ type: ScriptLike,
379
+ groupByTransaction?: boolean | null,
380
+ order?: "asc" | "desc",
381
+ limit = 10,
382
+ ): AsyncGenerator<
383
+ | ClientFindTransactionsResponse["transactions"][0]
384
+ | ClientFindTransactionsGroupedResponse["transactions"][0]
385
+ > {
386
+ return this.findTransactions(
387
+ {
388
+ script: lock,
389
+ scriptType: "lock",
390
+ scriptSearchMode: "exact",
391
+ filter: {
392
+ script: type,
393
+ },
394
+ groupByTransaction,
395
+ },
396
+ order,
397
+ limit,
398
+ );
399
+ }
400
+
401
+ findTransactionsByType(
402
+ type: ScriptLike,
403
+ groupByTransaction: true,
404
+ order?: "asc" | "desc",
405
+ limit?: number,
406
+ ): AsyncGenerator<ClientFindTransactionsGroupedResponse["transactions"][0]>;
407
+ findTransactionsByType(
408
+ type: ScriptLike,
409
+ groupByTransaction?: false | null,
410
+ order?: "asc" | "desc",
411
+ limit?: number,
412
+ ): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0]>;
413
+ findTransactionsByType(
414
+ type: ScriptLike,
415
+ groupByTransaction?: boolean | null,
416
+ order?: "asc" | "desc",
417
+ limit?: number,
418
+ ): AsyncGenerator<
419
+ | ClientFindTransactionsResponse["transactions"][0]
420
+ | ClientFindTransactionsGroupedResponse["transactions"][0]
421
+ >;
422
+ findTransactionsByType(
423
+ type: ScriptLike,
424
+ groupByTransaction?: boolean | null,
425
+ order?: "asc" | "desc",
426
+ limit = 10,
427
+ ): AsyncGenerator<
428
+ | ClientFindTransactionsResponse["transactions"][0]
429
+ | ClientFindTransactionsGroupedResponse["transactions"][0]
430
+ > {
431
+ return this.findTransactions(
432
+ {
433
+ script: type,
434
+ scriptType: "type",
435
+ scriptSearchMode: "exact",
436
+ groupByTransaction,
437
+ },
438
+ order,
439
+ limit,
440
+ );
441
+ }
442
+
274
443
  abstract getCellsCapacity(key: ClientIndexerSearchKeyLike): Promise<Num>;
275
444
 
276
445
  async getBalanceSingle(lock: ScriptLike): Promise<Num> {
@@ -1,5 +1,5 @@
1
- import { Script } from "../ckb";
2
- import { CellDepInfoLike, KnownScript } from "./client";
1
+ import { Script } from "../ckb/index.js";
2
+ import { CellDepInfoLike, KnownScript } from "./client.js";
3
3
 
4
4
  export const MAINNET_SCRIPTS: Record<
5
5
  KnownScript,
@@ -1,7 +1,7 @@
1
- import { Script } from "../ckb";
2
- import { CellDepInfo, KnownScript } from "./client";
3
- import { MAINNET_SCRIPTS } from "./clientPublicMainnet.advanced";
4
- import { ClientJsonRpc } from "./jsonRpc";
1
+ import { Script } from "../ckb/index.js";
2
+ import { CellDepInfo, KnownScript } from "./client.js";
3
+ import { MAINNET_SCRIPTS } from "./clientPublicMainnet.advanced.js";
4
+ import { ClientJsonRpc } from "./jsonRpc/index.js";
5
5
 
6
6
  export class ClientPublicMainnet extends ClientJsonRpc {
7
7
  constructor(url = "https://mainnet.ckb.dev/", timeout?: number) {
@@ -1,5 +1,5 @@
1
- import { Script } from "../ckb";
2
- import { CellDepInfoLike, KnownScript } from "./client";
1
+ import { Script } from "../ckb/index.js";
2
+ import { CellDepInfoLike, KnownScript } from "./client.js";
3
3
 
4
4
  export const TESTNET_SCRIPTS: Record<
5
5
  KnownScript,
@@ -1,7 +1,7 @@
1
- import { Script } from "../ckb";
2
- import { CellDepInfo, KnownScript } from "./client";
3
- import { TESTNET_SCRIPTS } from "./clientPublicTestnet.advanced";
4
- import { ClientJsonRpc } from "./jsonRpc";
1
+ import { Script } from "../ckb/index.js";
2
+ import { CellDepInfo, KnownScript } from "./client.js";
3
+ import { TESTNET_SCRIPTS } from "./clientPublicTestnet.advanced.js";
4
+ import { ClientJsonRpc } from "./jsonRpc/index.js";
5
5
 
6
6
  export class ClientPublicTestnet extends ClientJsonRpc {
7
7
  constructor(url = "https://testnet.ckb.dev/", timeout?: number) {
@@ -1,6 +1,6 @@
1
- import { ScriptLike } from "../ckb";
2
- import { HexLike } from "../hex";
3
- import { Num, numFrom, NumLike } from "../num";
1
+ import { ScriptLike } from "../ckb/index.js";
2
+ import { HexLike } from "../hex/index.js";
3
+ import { Num, numFrom, NumLike } from "../num/index.js";
4
4
 
5
5
  export function clientSearchKeyRangeFrom([a, b]: [NumLike, NumLike]): [
6
6
  Num,
@@ -1,12 +1,12 @@
1
- import { Cell, Script, Transaction } from "../ckb";
2
- import { Hex, hexFrom } from "../hex";
3
- import { Num, NumLike } from "../num";
4
- import { apply } from "../utils";
1
+ import { Cell, Script, Transaction } from "../ckb/index.js";
2
+ import { Hex, hexFrom } from "../hex/index.js";
3
+ import { Num, NumLike } from "../num/index.js";
4
+ import { apply } from "../utils/index.js";
5
5
  import {
6
6
  ClientCollectableSearchKeyFilterLike,
7
7
  ClientCollectableSearchKeyLike,
8
8
  clientSearchKeyRangeFrom,
9
- } from "./clientTypes.advanced";
9
+ } from "./clientTypes.advanced.js";
10
10
 
11
11
  export type OutputsValidator = "passthrough" | "well_known_scripts_only";
12
12
 
@@ -79,3 +79,57 @@ export type ClientFindCellsResponse = {
79
79
  lastCursor: string;
80
80
  cells: Cell[];
81
81
  };
82
+
83
+ export type ClientIndexerSearchKeyTransactionLike = Omit<
84
+ ClientCollectableSearchKeyLike,
85
+ "withData"
86
+ > & {
87
+ filter?: ClientIndexerSearchKeyFilterLike | null;
88
+ groupByTransaction?: boolean | null;
89
+ };
90
+
91
+ export class ClientIndexerSearchKeyTransaction {
92
+ constructor(
93
+ public script: Script,
94
+ public scriptType: "lock" | "type",
95
+ public scriptSearchMode: "prefix" | "exact" | "partial",
96
+ public filter: ClientIndexerSearchKeyFilter | undefined,
97
+ public groupByTransaction: boolean | undefined,
98
+ ) {}
99
+
100
+ static from(
101
+ keyLike: ClientIndexerSearchKeyTransactionLike,
102
+ ): ClientIndexerSearchKeyTransaction {
103
+ return new ClientIndexerSearchKeyTransaction(
104
+ Script.from(keyLike.script),
105
+ keyLike.scriptType,
106
+ keyLike.scriptSearchMode,
107
+ apply(ClientIndexerSearchKeyFilter.from, keyLike.filter),
108
+ keyLike.groupByTransaction ?? undefined,
109
+ );
110
+ }
111
+ }
112
+
113
+ export type ClientFindTransactionsResponse = {
114
+ lastCursor: string;
115
+ transactions: {
116
+ txHash: Hex;
117
+ blockNumber: Num;
118
+ txIndex: Num;
119
+ isInput: boolean;
120
+ cellIndex: Num;
121
+ }[];
122
+ };
123
+
124
+ export type ClientFindTransactionsGroupedResponse = {
125
+ lastCursor: string;
126
+ transactions: {
127
+ txHash: Hex;
128
+ blockNumber: Num;
129
+ txIndex: Num;
130
+ cells: {
131
+ isInput: boolean;
132
+ cellIndex: Num;
133
+ }[];
134
+ }[];
135
+ };
@@ -1,5 +1,5 @@
1
- export * from "./client";
2
- export * from "./clientPublicMainnet";
3
- export * from "./clientPublicTestnet";
4
- export * from "./clientTypes";
5
- export * from "./jsonRpc";
1
+ export * from "./client.js";
2
+ export * from "./clientPublicMainnet.js";
3
+ export * from "./clientPublicTestnet.js";
4
+ export * from "./clientTypes.js";
5
+ export * from "./jsonRpc/index.js";
@@ -1,2 +1,2 @@
1
- export * from "./transformers";
2
- export * from "./types";
1
+ export * from "./transformers.js";
2
+ export * from "./types.js";
@@ -1,15 +1,15 @@
1
1
  import fetch from "cross-fetch";
2
- import { TransactionLike } from "../../ckb";
3
- import { Hex, HexLike, hexFrom } from "../../hex";
4
- import { Num, NumLike, numFrom, numToHex } from "../../num";
5
- import { Client } from "../client";
2
+ import { TransactionLike } from "../../ckb/index.js";
3
+ import { Hex, HexLike, hexFrom } from "../../hex/index.js";
4
+ import { Num, NumLike, numFrom, numToHex } from "../../num/index.js";
5
+ import { Client } from "../client.js";
6
6
  import {
7
7
  ClientFindCellsResponse,
8
8
  ClientIndexerSearchKeyLike,
9
9
  ClientTransactionResponse,
10
10
  OutputsValidator,
11
- } from "../clientTypes";
12
- import { JsonRpcPayload, JsonRpcTransformers } from "./advanced";
11
+ } from "../clientTypes.js";
12
+ import { JsonRpcPayload, JsonRpcTransformers } from "./advanced.js";
13
13
 
14
14
  /**
15
15
  * Applies a transformation function to a value if the transformer is provided.
@@ -120,6 +120,26 @@ export abstract class ClientJsonRpc extends Client {
120
120
  after?: string,
121
121
  ) => Promise<ClientFindCellsResponse>;
122
122
 
123
+ /**
124
+ * find transactions from node.
125
+ *
126
+ * @param key - The search key of transactions.
127
+ * @param order - The order of transactions.
128
+ * @param limit - The max return size of transactions.
129
+ * @param after - Pagination parameter.
130
+ * @returns The found transactions.
131
+ */
132
+
133
+ findTransactionsPaged = this.buildSender(
134
+ "get_transactions",
135
+ [
136
+ JsonRpcTransformers.indexerSearchKeyTransactionFrom,
137
+ (order) => order ?? "asc",
138
+ (limit) => numToHex(limit ?? 10),
139
+ ],
140
+ JsonRpcTransformers.findTransactionsResponseTo,
141
+ ) as Client["findTransactionsPaged"];
142
+
123
143
  /**
124
144
  * get cells capacity from node.
125
145
  *
@@ -18,28 +18,37 @@ import {
18
18
  TransactionLike,
19
19
  depTypeFrom,
20
20
  hashTypeFrom,
21
- } from "../../ckb";
22
- import { Hex } from "../../hex";
23
- import { NumLike, numToHex } from "../../num";
24
- import { apply } from "../../utils";
21
+ } from "../../ckb/index.js";
22
+ import { Hex } from "../../hex/index.js";
23
+ import { NumLike, numFrom, numToHex } from "../../num/index.js";
24
+ import { apply } from "../../utils/index.js";
25
25
  import {
26
26
  ClientFindCellsResponse,
27
+ ClientFindTransactionsGroupedResponse,
28
+ ClientFindTransactionsResponse,
27
29
  ClientIndexerSearchKey,
30
+ ClientIndexerSearchKeyFilter,
28
31
  ClientIndexerSearchKeyLike,
32
+ ClientIndexerSearchKeyTransaction,
33
+ ClientIndexerSearchKeyTransactionLike,
29
34
  ClientTransactionResponse,
30
35
  TransactionStatus,
31
- } from "../clientTypes";
36
+ } from "../clientTypes.js";
32
37
  import {
33
38
  JsonRpcCellDep,
34
39
  JsonRpcCellInput,
35
40
  JsonRpcCellOutput,
36
41
  JsonRpcDepType,
37
42
  JsonRpcHashType,
43
+ JsonRpcIndexerFindTransactionsGroupedResponse,
44
+ JsonRpcIndexerFindTransactionsResponse,
38
45
  JsonRpcIndexerSearchKey,
46
+ JsonRpcIndexerSearchKeyFilter,
47
+ JsonRpcIndexerSearchKeyTransaction,
39
48
  JsonRpcOutPoint,
40
49
  JsonRpcScript,
41
50
  JsonRpcTransaction,
42
- } from "./types";
51
+ } from "./types.js";
43
52
 
44
53
  export class JsonRpcTransformers {
45
54
  static hashTypeFrom(hashType: HashTypeLike): JsonRpcHashType {
@@ -175,6 +184,28 @@ export class JsonRpcTransformers {
175
184
  static rangeFrom([a, b]: [NumLike, NumLike]): [Hex, Hex] {
176
185
  return [numToHex(a), numToHex(b)];
177
186
  }
187
+ static indexerSearchKeyFilterFrom(
188
+ filter: ClientIndexerSearchKeyFilter,
189
+ ): JsonRpcIndexerSearchKeyFilter {
190
+ return {
191
+ script: apply(JsonRpcTransformers.scriptFrom, filter.script),
192
+ script_len_range: apply(
193
+ JsonRpcTransformers.rangeFrom,
194
+ filter.scriptLenRange,
195
+ ),
196
+ output_data: filter.outputData,
197
+ output_data_filter_mode: filter.outputDataSearchMode,
198
+ output_data_len_range: apply(
199
+ JsonRpcTransformers.rangeFrom,
200
+ filter.outputDataLenRange,
201
+ ),
202
+ output_capacity_range: apply(
203
+ JsonRpcTransformers.rangeFrom,
204
+ filter.outputCapacityRange,
205
+ ),
206
+ block_range: apply(JsonRpcTransformers.rangeFrom, filter.blockRange),
207
+ };
208
+ }
178
209
  static indexerSearchKeyFrom(
179
210
  keyLike: ClientIndexerSearchKeyLike,
180
211
  ): JsonRpcIndexerSearchKey {
@@ -183,27 +214,7 @@ export class JsonRpcTransformers {
183
214
  script: JsonRpcTransformers.scriptFrom(key.script),
184
215
  script_type: key.scriptType,
185
216
  script_search_mode: key.scriptSearchMode,
186
- filter: apply(
187
- (filter: NonNullable<ClientIndexerSearchKey["filter"]>) => ({
188
- script: apply(JsonRpcTransformers.scriptFrom, filter.script),
189
- script_len_range: apply(
190
- JsonRpcTransformers.rangeFrom,
191
- filter.scriptLenRange,
192
- ),
193
- output_data: filter.outputData,
194
- output_data_filter_mode: filter.outputDataSearchMode,
195
- output_data_len_range: apply(
196
- JsonRpcTransformers.rangeFrom,
197
- filter.outputDataLenRange,
198
- ),
199
- output_capacity_range: apply(
200
- JsonRpcTransformers.rangeFrom,
201
- filter.outputCapacityRange,
202
- ),
203
- block_range: apply(JsonRpcTransformers.rangeFrom, filter.blockRange),
204
- }),
205
- key.filter,
206
- ),
217
+ filter: apply(JsonRpcTransformers.indexerSearchKeyFilterFrom, key.filter),
207
218
  with_data: key.withData,
208
219
  };
209
220
  }
@@ -229,4 +240,60 @@ export class JsonRpcTransformers {
229
240
  ),
230
241
  };
231
242
  }
243
+ static indexerSearchKeyTransactionFrom(
244
+ keyLike: ClientIndexerSearchKeyTransactionLike,
245
+ ): JsonRpcIndexerSearchKeyTransaction {
246
+ const key = ClientIndexerSearchKeyTransaction.from(keyLike);
247
+ return {
248
+ script: JsonRpcTransformers.scriptFrom(key.script),
249
+ script_type: key.scriptType,
250
+ script_search_mode: key.scriptSearchMode,
251
+ filter: apply(JsonRpcTransformers.indexerSearchKeyFilterFrom, key.filter),
252
+ group_by_transaction: key.groupByTransaction,
253
+ };
254
+ }
255
+ static findTransactionsResponseTo({
256
+ last_cursor,
257
+ objects,
258
+ }:
259
+ | JsonRpcIndexerFindTransactionsResponse
260
+ | JsonRpcIndexerFindTransactionsGroupedResponse):
261
+ | ClientFindTransactionsResponse
262
+ | ClientFindTransactionsGroupedResponse {
263
+ if (objects.length === 0) {
264
+ return {
265
+ lastCursor: last_cursor,
266
+ transactions: [],
267
+ };
268
+ }
269
+ if ("io_index" in objects[0]) {
270
+ return {
271
+ lastCursor: last_cursor,
272
+ transactions: (
273
+ objects as JsonRpcIndexerFindTransactionsResponse["objects"]
274
+ ).map((tx) => ({
275
+ txHash: tx.tx_hash,
276
+ blockNumber: numFrom(tx.block_number),
277
+ txIndex: numFrom(tx.tx_index),
278
+ cellIndex: numFrom(tx.io_index),
279
+ isInput: tx.io_type === "input",
280
+ })),
281
+ };
282
+ }
283
+
284
+ return {
285
+ lastCursor: last_cursor,
286
+ transactions: (
287
+ objects as JsonRpcIndexerFindTransactionsGroupedResponse["objects"]
288
+ ).map((tx) => ({
289
+ txHash: tx.tx_hash,
290
+ blockNumber: numFrom(tx.block_number),
291
+ txIndex: numFrom(tx.tx_index),
292
+ cells: tx.cells.map(([type, i]) => ({
293
+ isInput: type === "input",
294
+ cellIndex: numFrom(i),
295
+ })),
296
+ })),
297
+ };
298
+ }
232
299
  }
@@ -1,4 +1,4 @@
1
- import { Hex } from "../../hex";
1
+ import { Hex } from "../../hex/index.js";
2
2
 
3
3
  export type JsonRpcPayload = {
4
4
  id: number;
@@ -47,18 +47,49 @@ export type JsonRpcTransaction = {
47
47
  witnesses: Hex[];
48
48
  };
49
49
 
50
+ export type JsonRpcIndexerSearchKeyFilter = {
51
+ script?: JsonRpcScript;
52
+ script_len_range?: [Hex, Hex];
53
+ output_data?: Hex;
54
+ output_data_filter_mode?: "prefix" | "exact" | "partial";
55
+ output_data_len_range?: [Hex, Hex];
56
+ output_capacity_range?: [Hex, Hex];
57
+ block_range?: [Hex, Hex];
58
+ };
59
+
50
60
  export type JsonRpcIndexerSearchKey = {
51
61
  script: JsonRpcScript;
52
62
  script_type: "lock" | "type";
53
63
  script_search_mode?: "prefix" | "exact" | "partial";
54
- filter?: {
55
- script?: JsonRpcScript;
56
- script_len_range?: [Hex, Hex];
57
- output_data?: Hex;
58
- output_data_filter_mode?: "prefix" | "exact" | "partial";
59
- output_data_len_range?: [Hex, Hex];
60
- output_capacity_range?: [Hex, Hex];
61
- block_range?: [Hex, Hex];
62
- };
64
+ filter?: JsonRpcIndexerSearchKeyFilter;
63
65
  with_data?: boolean;
64
66
  };
67
+
68
+ export type JsonRpcIndexerSearchKeyTransaction = {
69
+ script: JsonRpcScript;
70
+ script_type: "lock" | "type";
71
+ script_search_mode?: "prefix" | "exact" | "partial";
72
+ filter?: JsonRpcIndexerSearchKeyFilter;
73
+ group_by_transaction?: boolean;
74
+ };
75
+
76
+ export type JsonRpcIndexerFindTransactionsResponse = {
77
+ last_cursor: string;
78
+ objects: {
79
+ tx_hash: Hex;
80
+ block_number: Hex;
81
+ tx_index: Hex;
82
+ io_type: "input" | "output";
83
+ io_index: Hex;
84
+ }[];
85
+ };
86
+
87
+ export type JsonRpcIndexerFindTransactionsGroupedResponse = {
88
+ last_cursor: string;
89
+ objects: {
90
+ tx_hash: Hex;
91
+ block_number: Hex;
92
+ tx_index: Hex;
93
+ cells: ["input" | "output", Hex][];
94
+ }[];
95
+ };
@@ -1,4 +1,4 @@
1
- import { fixedPointFrom, fixedPointToString } from ".";
1
+ import { fixedPointFrom, fixedPointToString } from "./index.js";
2
2
 
3
3
  describe("fixedPointToString", () => {
4
4
  const cases: [bigint, string, number?][] = [
@@ -1,9 +1,9 @@
1
1
  import blake2b, { Blake2b } from "blake2b";
2
- import { BytesLike, bytesFrom } from "../bytes";
3
- import { CellInput, CellInputLike } from "../ckb";
4
- import { Hex } from "../hex";
5
- import { NumLike, numLeToBytes } from "../num";
6
- import { CKB_BLAKE2B_PERSONAL } from "./advanced";
2
+ import { BytesLike, bytesFrom } from "../bytes/index.js";
3
+ import { CellInput, CellInputLike } from "../ckb/index.js";
4
+ import { Hex } from "../hex/index.js";
5
+ import { NumLike, numLeToBytes } from "../num/index.js";
6
+ import { CKB_BLAKE2B_PERSONAL } from "./advanced.js";
7
7
 
8
8
  export class Hasher {
9
9
  private readonly hasher: Blake2b;
package/src/hex/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { bytesFrom, BytesLike, bytesTo } from "../bytes";
1
+ import { bytesFrom, BytesLike, bytesTo } from "../bytes/index.js";
2
2
 
3
3
  /**
4
4
  * Represents a hexadecimal string prefixed with "0x".
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./barrel";
2
- export * as ccc from "./barrel";
1
+ export * from "./barrel.js";
2
+ export * as ccc from "./barrel.js";