@cfxjs/sirius-next-common 0.2.10 → 0.2.12

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 (329) hide show
  1. package/dist/_esm-TZ4WSCGM.js +4035 -0
  2. package/dist/_esm-TZ4WSCGM.js.map +1 -0
  3. package/dist/abis/CommonError.d.ts +10 -0
  4. package/dist/abis/CommonError.js +8 -0
  5. package/dist/abis/CommonError.js.map +1 -0
  6. package/dist/abis/CommonPanic.d.ts +10 -0
  7. package/dist/abis/CommonPanic.js +8 -0
  8. package/dist/abis/CommonPanic.js.map +1 -0
  9. package/dist/ccip-DBSI27GO.js +15 -0
  10. package/dist/ccip-DBSI27GO.js.map +1 -0
  11. package/dist/chunk-3HO74CMH.js +186 -0
  12. package/dist/chunk-3HO74CMH.js.map +1 -0
  13. package/dist/chunk-3PXUIH3S.js +17 -0
  14. package/dist/chunk-3PXUIH3S.js.map +1 -0
  15. package/dist/chunk-4B6ASBYQ.js +408 -0
  16. package/dist/chunk-4B6ASBYQ.js.map +1 -0
  17. package/dist/chunk-4J3SQGIV.js +82 -0
  18. package/dist/chunk-4J3SQGIV.js.map +1 -0
  19. package/dist/{chunk-LXTR4VAD.js → chunk-5EDEEGZK.js} +42 -19
  20. package/dist/chunk-5EDEEGZK.js.map +1 -0
  21. package/dist/chunk-5TGK2EA2.js +18 -0
  22. package/dist/chunk-5TGK2EA2.js.map +1 -0
  23. package/dist/chunk-5Y7I6VYA.js +145 -0
  24. package/dist/chunk-5Y7I6VYA.js.map +1 -0
  25. package/dist/chunk-6H5A42YS.js +23 -0
  26. package/dist/chunk-6H5A42YS.js.map +1 -0
  27. package/dist/chunk-6HJCR6PQ.js +79 -0
  28. package/dist/chunk-6HJCR6PQ.js.map +1 -0
  29. package/dist/chunk-6SXAFSBF.js +1032 -0
  30. package/dist/chunk-6SXAFSBF.js.map +1 -0
  31. package/dist/chunk-ADNS57X5.js +18 -0
  32. package/dist/chunk-ADNS57X5.js.map +1 -0
  33. package/dist/{chunk-ABDGDYRT.js → chunk-ADULNBMD.js} +5 -5
  34. package/dist/{chunk-IIIPX34H.js → chunk-BUSBM33B.js} +4 -4
  35. package/dist/chunk-CKVDFS45.js +56 -0
  36. package/dist/chunk-CKVDFS45.js.map +1 -0
  37. package/dist/{chunk-WI3G3OD5.js → chunk-CNF26YY7.js} +3 -3
  38. package/dist/{chunk-DFQG46WD.js → chunk-CPPQCJEV.js} +3 -3
  39. package/dist/chunk-CPR4QZT6.js +21 -0
  40. package/dist/chunk-CPR4QZT6.js.map +1 -0
  41. package/dist/{chunk-NUKYY7GO.js → chunk-DF3PVTB5.js} +2 -2
  42. package/dist/chunk-E3ZD2GGG.js +17 -0
  43. package/dist/chunk-E3ZD2GGG.js.map +1 -0
  44. package/dist/chunk-EERNUGUK.js +198 -0
  45. package/dist/chunk-EERNUGUK.js.map +1 -0
  46. package/dist/{chunk-S5QP6EUQ.js → chunk-EMPFZFBS.js} +6 -19
  47. package/dist/chunk-EMPFZFBS.js.map +1 -0
  48. package/dist/chunk-FYLAXC3R.js +82 -0
  49. package/dist/chunk-FYLAXC3R.js.map +1 -0
  50. package/dist/{chunk-IWNT4XVY.js → chunk-GKZK26DZ.js} +3 -3
  51. package/dist/{chunk-IQJOXINX.js → chunk-GSWIFV2B.js} +2 -2
  52. package/dist/chunk-JFFTHCNE.js +344 -0
  53. package/dist/chunk-JFFTHCNE.js.map +1 -0
  54. package/dist/chunk-JIRLY7OG.js +4357 -0
  55. package/dist/chunk-JIRLY7OG.js.map +1 -0
  56. package/dist/chunk-K6FHTS3F.js +115 -0
  57. package/dist/chunk-K6FHTS3F.js.map +1 -0
  58. package/dist/chunk-L62OTV7F.js +71 -0
  59. package/dist/chunk-L62OTV7F.js.map +1 -0
  60. package/dist/{chunk-2R6NJR5T.js → chunk-LVFMTP5H.js} +2 -2
  61. package/dist/chunk-NWVSTRCG.js +20 -0
  62. package/dist/chunk-NWVSTRCG.js.map +1 -0
  63. package/dist/chunk-NXCZ5PMI.js +64 -0
  64. package/dist/chunk-NXCZ5PMI.js.map +1 -0
  65. package/dist/{chunk-HHA2RXLW.js → chunk-NZY53U2H.js} +9 -13
  66. package/dist/chunk-NZY53U2H.js.map +1 -0
  67. package/dist/{chunk-U3F7QHXB.js → chunk-OCQIWTDC.js} +2 -2
  68. package/dist/{chunk-EQWAYCW3.js → chunk-ODJ4QBD5.js} +6 -6
  69. package/dist/chunk-OYESIV3F.js +47 -0
  70. package/dist/chunk-OYESIV3F.js.map +1 -0
  71. package/dist/{chunk-IWGPVXSI.js → chunk-P4EE3QGM.js} +3 -3
  72. package/dist/{chunk-BRST23XX.js → chunk-Q2DX6IDH.js} +2 -2
  73. package/dist/chunk-QMLPHJCA.js +78 -0
  74. package/dist/chunk-QMLPHJCA.js.map +1 -0
  75. package/dist/chunk-SFCNLOQ5.js +37 -0
  76. package/dist/chunk-SFCNLOQ5.js.map +1 -0
  77. package/dist/chunk-SUCQASD3.js +84 -0
  78. package/dist/chunk-SUCQASD3.js.map +1 -0
  79. package/dist/chunk-U6ZN2ABK.js +184 -0
  80. package/dist/chunk-U6ZN2ABK.js.map +1 -0
  81. package/dist/chunk-UM5J477V.js +69 -0
  82. package/dist/chunk-UM5J477V.js.map +1 -0
  83. package/dist/{chunk-7RH7LJYB.js → chunk-WIB76E7O.js} +6 -2
  84. package/dist/{chunk-7RH7LJYB.js.map → chunk-WIB76E7O.js.map} +1 -1
  85. package/dist/chunk-WQG2LZMB.js +50 -0
  86. package/dist/chunk-WQG2LZMB.js.map +1 -0
  87. package/dist/chunk-XZ7IV2FF.js +5947 -0
  88. package/dist/chunk-XZ7IV2FF.js.map +1 -0
  89. package/dist/chunk-Y7OVL5US.js +46 -0
  90. package/dist/chunk-Y7OVL5US.js.map +1 -0
  91. package/dist/chunk-YBQQ72FQ.js +10 -0
  92. package/dist/chunk-YBQQ72FQ.js.map +1 -0
  93. package/dist/{chunk-YEUH2K6Z.js → chunk-YEINMVAR.js} +8 -2
  94. package/dist/chunk-YEINMVAR.js.map +1 -0
  95. package/dist/chunk-YIZCD4WG.js +107 -0
  96. package/dist/chunk-YIZCD4WG.js.map +1 -0
  97. package/dist/components/AceEditor/index.js +9 -143
  98. package/dist/components/AceEditor/index.js.map +1 -1
  99. package/dist/components/AddressContainer/CoreAddressContainer.js +14 -12
  100. package/dist/components/AddressContainer/EVMAddressContainer.js +13 -11
  101. package/dist/components/AddressContainer/addressSwitcher.js +11 -9
  102. package/dist/components/AddressContainer/addressView.js +9 -8
  103. package/dist/components/AddressContainer/label.js +7 -6
  104. package/dist/components/AddressContainer/utils.d.ts +9 -0
  105. package/dist/components/AddressContainer/utils.js +30 -0
  106. package/dist/components/AddressContainer/utils.js.map +1 -0
  107. package/dist/components/Age/index.js +7 -6
  108. package/dist/components/Age/index.js.map +1 -1
  109. package/dist/components/AutoComplete/index.js +6 -5
  110. package/dist/components/AutoComplete/index.js.map +1 -1
  111. package/dist/components/Button/ActionButton/index.js +1 -0
  112. package/dist/components/Button/BaseButton/index.js +1 -0
  113. package/dist/components/Button/IconButton/index.js +1 -0
  114. package/dist/components/Button/index.js +1 -0
  115. package/dist/components/Card/index.js +1 -0
  116. package/dist/components/Charts/BreadcrumbNav.js +1 -0
  117. package/dist/components/Charts/ChartOptions.js +1 -0
  118. package/dist/components/Charts/PreviewChartTemplate.js +3 -2
  119. package/dist/components/Charts/PreviewChartTemplate.js.map +1 -1
  120. package/dist/components/Charts/PreviewTitle.js +1 -0
  121. package/dist/components/Charts/StockChartTemplate.js +10 -9
  122. package/dist/components/Charts/StockChartTemplate.js.map +1 -1
  123. package/dist/components/Charts/StockTitle.js +1 -0
  124. package/dist/components/Charts/config.js +1 -0
  125. package/dist/components/Charts/constants.js +1 -0
  126. package/dist/components/Charts/useHighCharts.js +1 -0
  127. package/dist/components/CookieTip/CookieIcon.js +1 -0
  128. package/dist/components/CookieTip/index.js +2 -1
  129. package/dist/components/CookieTip/index.js.map +1 -1
  130. package/dist/components/CopyButton/index.js +6 -5
  131. package/dist/components/CopyButton/index.js.map +1 -1
  132. package/dist/components/DecimalsSelect/index.js +6 -5
  133. package/dist/components/DecimalsSelect/index.js.map +1 -1
  134. package/dist/components/DeleteIcon/index.js +2 -0
  135. package/dist/components/DeleteIcon/index.js.map +1 -1
  136. package/dist/components/Description/index.js +1 -0
  137. package/dist/components/Divider/index.js +1 -0
  138. package/dist/components/DownloadCSV/index.js +7 -6
  139. package/dist/components/DownloadCSV/index.js.map +1 -1
  140. package/dist/components/Dropdown/index.js +1 -0
  141. package/dist/components/Dropdown/index.js.map +1 -1
  142. package/dist/components/Empty/index.js +4 -40
  143. package/dist/components/Empty/index.js.map +1 -1
  144. package/dist/components/FileUpload/index.js +2 -0
  145. package/dist/components/FileUpload/index.js.map +1 -1
  146. package/dist/components/Footer/index.js +1 -0
  147. package/dist/components/Footer/index.js.map +1 -1
  148. package/dist/components/GasPriceDropdown/index.js +5 -4
  149. package/dist/components/GasPriceDropdown/index.js.map +1 -1
  150. package/dist/components/Highlight/index.js +1 -0
  151. package/dist/components/Highlight/index.js.map +1 -1
  152. package/dist/components/Icons/index.d.ts +8 -1
  153. package/dist/components/Icons/index.js +20 -64
  154. package/dist/components/Icons/index.js.map +1 -1
  155. package/dist/components/ImageSkeleton/index.js +2 -0
  156. package/dist/components/ImageSkeleton/index.js.map +1 -1
  157. package/dist/components/IncreasePercent/Icons.js +1 -0
  158. package/dist/components/IncreasePercent/index.js +5 -4
  159. package/dist/components/IncreasePercent/index.js.map +1 -1
  160. package/dist/components/InfoIconWithTooltip/InfoIcon.js +1 -0
  161. package/dist/components/InfoIconWithTooltip/index.js +7 -6
  162. package/dist/components/InputData/AddressLabel.d.ts +8 -0
  163. package/dist/components/InputData/AddressLabel.js +23 -0
  164. package/dist/components/InputData/AddressLabel.js.map +1 -0
  165. package/dist/components/InputData/ContractDetail.d.ts +22 -0
  166. package/dist/components/InputData/ContractDetail.js +19 -0
  167. package/dist/components/InputData/ContractDetail.js.map +1 -0
  168. package/dist/components/InputData/FunctionName.d.ts +10 -0
  169. package/dist/components/InputData/FunctionName.js +10 -0
  170. package/dist/components/InputData/FunctionName.js.map +1 -0
  171. package/dist/components/InputData/GeneralDecode.d.ts +9 -0
  172. package/dist/components/InputData/GeneralDecode.js +8 -0
  173. package/dist/components/InputData/GeneralDecode.js.map +1 -0
  174. package/dist/components/InputData/JsonDecode.d.ts +18 -0
  175. package/dist/components/InputData/JsonDecode.js +19 -0
  176. package/dist/components/InputData/JsonDecode.js.map +1 -0
  177. package/dist/components/InputData/OptimizationDecode.d.ts +23 -0
  178. package/dist/components/InputData/OptimizationDecode.js +32 -0
  179. package/dist/components/InputData/OptimizationDecode.js.map +1 -0
  180. package/dist/components/InputData/Original.d.ts +8 -0
  181. package/dist/components/InputData/Original.js +8 -0
  182. package/dist/components/InputData/Original.js.map +1 -0
  183. package/dist/components/InputData/UTF8.d.ts +8 -0
  184. package/dist/components/InputData/UTF8.js +14 -0
  185. package/dist/components/InputData/UTF8.js.map +1 -0
  186. package/dist/components/InputData/index.d.ts +15 -0
  187. package/dist/components/InputData/index.js +36 -0
  188. package/dist/components/InputData/index.js.map +1 -0
  189. package/dist/components/InputData/utils.d.ts +5 -0
  190. package/dist/components/InputData/utils.js +8 -0
  191. package/dist/components/InputData/utils.js.map +1 -0
  192. package/dist/components/Link/index.js +1 -0
  193. package/dist/components/List/index.js +1 -0
  194. package/dist/components/List/index.js.map +1 -1
  195. package/dist/components/Loading/index.js +1 -0
  196. package/dist/components/Loading/index.js.map +1 -1
  197. package/dist/components/Loading/loading.js +1 -0
  198. package/dist/components/Modal/index.js +6 -5
  199. package/dist/components/NetworkIcon/index.js +5 -4
  200. package/dist/components/NetworkIcon/index.js.map +1 -1
  201. package/dist/components/OutputData/ErrorDecode.d.ts +14 -0
  202. package/dist/components/OutputData/ErrorDecode.js +39 -0
  203. package/dist/components/OutputData/ErrorDecode.js.map +1 -0
  204. package/dist/components/OutputData/index.d.ts +21 -0
  205. package/dist/components/OutputData/index.js +42 -0
  206. package/dist/components/OutputData/index.js.map +1 -0
  207. package/dist/components/PageHeader/index.js +2 -0
  208. package/dist/components/PageHeader/index.js.map +1 -1
  209. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js +1 -0
  210. package/dist/components/PhishingAddressContainer/index.js +7 -6
  211. package/dist/components/PhishingAddressContainer/index.js.map +1 -1
  212. package/dist/components/Popover/index.js +6 -5
  213. package/dist/components/Price/index.js +6 -5
  214. package/dist/components/Price/index.js.map +1 -1
  215. package/dist/components/ProxyContractAddress/index.d.ts +24 -0
  216. package/dist/components/ProxyContractAddress/index.js +120 -0
  217. package/dist/components/ProxyContractAddress/index.js.map +1 -0
  218. package/dist/components/Radio/index.js +5 -4
  219. package/dist/components/Radio/index.js.map +1 -1
  220. package/dist/components/Remark/index.js +1 -0
  221. package/dist/components/Remark/index.js.map +1 -1
  222. package/dist/components/SearchIcon/index.js +2 -0
  223. package/dist/components/SearchIcon/index.js.map +1 -1
  224. package/dist/components/SearchInput/index.js +7 -6
  225. package/dist/components/SearchInput/index.js.map +1 -1
  226. package/dist/components/Select/index.d.ts +5 -4
  227. package/dist/components/Select/index.js +10 -105
  228. package/dist/components/Select/index.js.map +1 -1
  229. package/dist/components/Select/select.js +7 -5
  230. package/dist/components/Skeleton/index.js +1 -0
  231. package/dist/components/SkeletonContainer/index.js +1 -0
  232. package/dist/components/Spin/index.js +1 -0
  233. package/dist/components/Switch/index.d.ts +10 -0
  234. package/dist/components/Switch/index.js +81 -0
  235. package/dist/components/Switch/index.js.map +1 -0
  236. package/dist/components/Table/index.d.ts +9 -0
  237. package/dist/components/Table/index.js +12 -0
  238. package/dist/components/Table/index.js.map +1 -0
  239. package/dist/components/Text/index.js +7 -6
  240. package/dist/components/TextLogo/index.js +2 -0
  241. package/dist/components/TextLogo/index.js.map +1 -1
  242. package/dist/components/Tooltip/index.js +6 -5
  243. package/dist/components/TransactionAction/constants.js +1 -0
  244. package/dist/components/TransactionAction/coreTransactionAction.js +15 -13
  245. package/dist/components/TransactionAction/coreTransactionAction.js.map +1 -1
  246. package/dist/components/TransactionAction/evmTransactionAction.js +14 -12
  247. package/dist/components/TransactionAction/evmTransactionAction.js.map +1 -1
  248. package/dist/components/TransactionTrace/TraceDetail.d.ts +20 -0
  249. package/dist/components/TransactionTrace/TraceDetail.js +54 -0
  250. package/dist/components/TransactionTrace/TraceDetail.js.map +1 -0
  251. package/dist/components/TransactionTrace/TreeTraceTable.d.ts +20 -0
  252. package/dist/components/TransactionTrace/TreeTraceTable.js +57 -0
  253. package/dist/components/TransactionTrace/TreeTraceTable.js.map +1 -0
  254. package/dist/components/TransactionTrace/index.d.ts +9 -0
  255. package/dist/components/TransactionTrace/index.js +60 -0
  256. package/dist/components/TransactionTrace/index.js.map +1 -0
  257. package/dist/secp256k1-WGKMGTUQ.js +2255 -0
  258. package/dist/secp256k1-WGKMGTUQ.js.map +1 -0
  259. package/dist/store/index.js +1 -0
  260. package/dist/uno.css +103 -5
  261. package/dist/utils/address.js +5 -4
  262. package/dist/utils/cache.js +2 -1
  263. package/dist/utils/constants.d.ts +3 -1
  264. package/dist/utils/constants.js +6 -1
  265. package/dist/utils/contractManagerTool.js +5 -4
  266. package/dist/utils/contractManagerTool.js.map +1 -1
  267. package/dist/utils/cookie.js +1 -0
  268. package/dist/utils/ga.js +1 -0
  269. package/dist/utils/hooks/useAddressLabel.d.ts +3 -0
  270. package/dist/utils/hooks/useAddressLabel.js +14 -0
  271. package/dist/utils/hooks/useAddressLabel.js.map +1 -0
  272. package/dist/utils/hooks/useAge.js +2 -1
  273. package/dist/utils/hooks/useAge.js.map +1 -1
  274. package/dist/utils/hooks/useAutoSetHolderFilterParams.js +5 -4
  275. package/dist/utils/hooks/useAutoSetHolderFilterParams.js.map +1 -1
  276. package/dist/utils/hooks/useChartQueryParams.js +2 -0
  277. package/dist/utils/hooks/useChartQueryParams.js.map +1 -1
  278. package/dist/utils/hooks/useContractDetail.d.ts +6 -0
  279. package/dist/utils/hooks/useContractDetail.js +12 -0
  280. package/dist/utils/hooks/useContractDetail.js.map +1 -0
  281. package/dist/utils/hooks/useDecodeFunctionData.d.ts +29 -0
  282. package/dist/utils/hooks/useDecodeFunctionData.js +19 -0
  283. package/dist/utils/hooks/useDecodeFunctionData.js.map +1 -0
  284. package/dist/utils/hooks/useDecodeFunctionError.d.ts +17 -0
  285. package/dist/utils/hooks/useDecodeFunctionError.js +19 -0
  286. package/dist/utils/hooks/useDecodeFunctionError.js.map +1 -0
  287. package/dist/utils/hooks/useDecodedDataType.d.ts +18 -0
  288. package/dist/utils/hooks/useDecodedDataType.js +8 -0
  289. package/dist/utils/hooks/useDecodedDataType.js.map +1 -0
  290. package/dist/utils/hooks/useENS.js +6 -5
  291. package/dist/utils/hooks/useGetTxnStatus.js +2 -0
  292. package/dist/utils/hooks/useGetTxnStatus.js.map +1 -1
  293. package/dist/utils/hooks/useMethodAbi.d.ts +8 -0
  294. package/dist/utils/hooks/useMethodAbi.js +12 -0
  295. package/dist/utils/hooks/useMethodAbi.js.map +1 -0
  296. package/dist/utils/hooks/useMultiAceSearch.js +2 -0
  297. package/dist/utils/hooks/useMultiAceSearch.js.map +1 -1
  298. package/dist/utils/hooks/useSearchParams.js +1 -0
  299. package/dist/utils/hooks/useTxTrace.d.ts +124 -0
  300. package/dist/utils/hooks/useTxTrace.js +170 -0
  301. package/dist/utils/hooks/useTxTrace.js.map +1 -0
  302. package/dist/utils/index.js +5 -4
  303. package/dist/utils/media.js +1 -0
  304. package/dist/utils/pubsub.js +1 -0
  305. package/dist/utils/request.d.ts +5 -2
  306. package/dist/utils/request.js +5 -2
  307. package/dist/utils/request.types.d.ts +18 -3
  308. package/dist/utils/rpcRequest.js +1 -0
  309. package/dist/utils/rpcRequest.js.map +1 -1
  310. package/dist/utils/sdk.d.ts +35 -0
  311. package/dist/utils/sdk.js +19 -0
  312. package/dist/utils/sdk.js.map +1 -0
  313. package/package.json +5 -2
  314. package/dist/chunk-HHA2RXLW.js.map +0 -1
  315. package/dist/chunk-LXTR4VAD.js.map +0 -1
  316. package/dist/chunk-S5QP6EUQ.js.map +0 -1
  317. package/dist/chunk-YEUH2K6Z.js.map +0 -1
  318. /package/dist/{chunk-ABDGDYRT.js.map → chunk-ADULNBMD.js.map} +0 -0
  319. /package/dist/{chunk-IIIPX34H.js.map → chunk-BUSBM33B.js.map} +0 -0
  320. /package/dist/{chunk-WI3G3OD5.js.map → chunk-CNF26YY7.js.map} +0 -0
  321. /package/dist/{chunk-DFQG46WD.js.map → chunk-CPPQCJEV.js.map} +0 -0
  322. /package/dist/{chunk-NUKYY7GO.js.map → chunk-DF3PVTB5.js.map} +0 -0
  323. /package/dist/{chunk-IWNT4XVY.js.map → chunk-GKZK26DZ.js.map} +0 -0
  324. /package/dist/{chunk-IQJOXINX.js.map → chunk-GSWIFV2B.js.map} +0 -0
  325. /package/dist/{chunk-2R6NJR5T.js.map → chunk-LVFMTP5H.js.map} +0 -0
  326. /package/dist/{chunk-U3F7QHXB.js.map → chunk-OCQIWTDC.js.map} +0 -0
  327. /package/dist/{chunk-EQWAYCW3.js.map → chunk-ODJ4QBD5.js.map} +0 -0
  328. /package/dist/{chunk-IWGPVXSI.js.map → chunk-P4EE3QGM.js.map} +0 -0
  329. /package/dist/{chunk-BRST23XX.js.map → chunk-Q2DX6IDH.js.map} +0 -0
@@ -0,0 +1,1032 @@
1
+ import {
2
+ AbiDecodingDataSizeTooSmallError,
3
+ AbiDecodingZeroDataError,
4
+ AbiFunctionNotFoundError,
5
+ AbiFunctionOutputsNotFoundError,
6
+ AbiFunctionSignatureNotFoundError,
7
+ BaseError,
8
+ InvalidAbiDecodingTypeError,
9
+ InvalidDefinitionTypeError,
10
+ bytesToBigInt,
11
+ bytesToBool,
12
+ bytesToHex,
13
+ bytesToNumber,
14
+ bytesToString,
15
+ checksumAddress,
16
+ decodeErrorResult,
17
+ decodeFunctionData,
18
+ decodeFunctionResult,
19
+ formatAbiItem,
20
+ hexToBytes,
21
+ isHex,
22
+ padHex,
23
+ size,
24
+ slice,
25
+ sliceBytes,
26
+ stringToBytes,
27
+ toEventSelector,
28
+ toFunctionSelector,
29
+ toHex,
30
+ trim
31
+ } from "./chunk-JIRLY7OG.js";
32
+ import {
33
+ NETWORK_ID
34
+ } from "./chunk-WIB76E7O.js";
35
+ import {
36
+ __publicField
37
+ } from "./chunk-WQG2LZMB.js";
38
+
39
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/lru.js
40
+ var LruMap = class extends Map {
41
+ constructor(size2) {
42
+ super();
43
+ __publicField(this, "maxSize");
44
+ this.maxSize = size2;
45
+ }
46
+ get(key) {
47
+ const value = super.get(key);
48
+ if (super.has(key) && value !== void 0) {
49
+ this.delete(key);
50
+ super.set(key, value);
51
+ }
52
+ return value;
53
+ }
54
+ set(key, value) {
55
+ super.set(key, value);
56
+ if (this.maxSize && this.size > this.maxSize) {
57
+ const firstKey = this.keys().next().value;
58
+ if (firstKey)
59
+ this.delete(firstKey);
60
+ }
61
+ return this;
62
+ }
63
+ };
64
+
65
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/errors/address.js
66
+ var InvalidNetworkIdError = class extends BaseError {
67
+ constructor({ networkId, message }) {
68
+ super(`Invalid network id: ${networkId}. ${message || ""}`);
69
+ __publicField(this, "name", "InvalidNetworkIdError");
70
+ }
71
+ };
72
+ var ConvertBitExcessPaddingError = class extends BaseError {
73
+ constructor() {
74
+ super("Excess padding");
75
+ __publicField(this, "name", "ConvertBitExcessPaddingError");
76
+ }
77
+ };
78
+ var ConvertBitNonZeroPaddingError = class extends BaseError {
79
+ constructor() {
80
+ super("Non-zero padding");
81
+ __publicField(this, "name", "ConvertBitNonZeroPaddingError");
82
+ }
83
+ };
84
+ var MixedCaseAddressError = class extends BaseError {
85
+ constructor({ address }) {
86
+ super(`Mixed case address ${address}`);
87
+ __publicField(this, "name", "MixedCaseAddressError");
88
+ }
89
+ };
90
+ var InvalidAddressVersionError = class extends BaseError {
91
+ constructor({ address }) {
92
+ super(`Invalid address version ${address}`);
93
+ __publicField(this, "name", "InvalidAddressVersionError");
94
+ }
95
+ };
96
+ var AddressTypeNotMatchError = class extends BaseError {
97
+ constructor({ address }) {
98
+ super(`Address type not match ${address}`);
99
+ __publicField(this, "name", "AddressTypeNotMatchError");
100
+ }
101
+ };
102
+
103
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/convertBit.js
104
+ function convertBit(buffer, inBits, outBits, isPad = false) {
105
+ const mask = (1 << outBits) - 1;
106
+ const array = [];
107
+ let bits = 0;
108
+ let value = 0;
109
+ for (const byte of buffer) {
110
+ bits += inBits;
111
+ value = value << inBits | byte;
112
+ while (bits >= outBits) {
113
+ bits -= outBits;
114
+ array.push(value >>> bits & mask);
115
+ }
116
+ }
117
+ value = value << outBits - bits & mask;
118
+ if (bits && isPad) {
119
+ array.push(value);
120
+ } else if (value && !isPad) {
121
+ throw new ConvertBitExcessPaddingError();
122
+ } else if (bits >= inBits && !isPad) {
123
+ throw new ConvertBitNonZeroPaddingError();
124
+ }
125
+ return array;
126
+ }
127
+
128
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/getAddressType.js
129
+ function getAddressTypeByHexAddress(hexAddressUit8Array) {
130
+ switch (hexAddressUit8Array[0] & 240) {
131
+ case 16:
132
+ return "user";
133
+ case 128:
134
+ return "contract";
135
+ case 0:
136
+ for (const x of hexAddressUit8Array) {
137
+ if (x !== 0)
138
+ return "builtin";
139
+ }
140
+ return "null";
141
+ default:
142
+ return "unknown";
143
+ }
144
+ }
145
+
146
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/constants/networkId.js
147
+ var mainNetworkId = 1029;
148
+ var testNetworkId = 1;
149
+
150
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/constants/networkName.js
151
+ var mainNetworkName = "cfx";
152
+ var testNetworkName = "cfxtest";
153
+ var otherNetworkName = "net";
154
+
155
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/isValidNetworkId.js
156
+ var NET_ID_LIMIT = 4294967295;
157
+ function isValidNetworkId(networkId) {
158
+ if (typeof networkId === "string") {
159
+ return /^([1-9]\d*)$/.test(networkId) && Number(networkId) <= NET_ID_LIMIT;
160
+ }
161
+ return networkId > 0 && networkId < NET_ID_LIMIT;
162
+ }
163
+
164
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/getNetworkIdByNetworkIdPrefix.js
165
+ function getNetworkIdByNetworkIdPrefix(networkName) {
166
+ const lowerCaseNetworkName = networkName.toLowerCase();
167
+ if (lowerCaseNetworkName === mainNetworkName) {
168
+ return mainNetworkId;
169
+ }
170
+ if (lowerCaseNetworkName === testNetworkName) {
171
+ return testNetworkId;
172
+ }
173
+ const netPrefix = lowerCaseNetworkName.slice(0, 3);
174
+ const strNetId = lowerCaseNetworkName.slice(3);
175
+ if (!isValidNetworkId(strNetId)) {
176
+ throw new InvalidNetworkIdError({ networkId: strNetId });
177
+ }
178
+ if (netPrefix !== otherNetworkName) {
179
+ throw new InvalidNetworkIdError({
180
+ networkId: strNetId,
181
+ message: "netId prefix should be passed by 'cfx', 'cfxtest' or 'net[n]'"
182
+ });
183
+ }
184
+ const netId = Number(strNetId);
185
+ if (netId === mainNetworkId || netId === testNetworkId) {
186
+ throw new InvalidNetworkIdError({
187
+ networkId: strNetId,
188
+ message: "net1 or net1029 are invalid"
189
+ });
190
+ }
191
+ return netId;
192
+ }
193
+
194
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/getNetworkIdPrefixByNetworkId.js
195
+ function getNetworkPrefixByNetworkId(networkId) {
196
+ if (!isValidNetworkId(networkId)) {
197
+ throw new InvalidNetworkIdError({ networkId });
198
+ }
199
+ if (networkId === mainNetworkId) {
200
+ return "cfx";
201
+ }
202
+ if (networkId === testNetworkId) {
203
+ return "cfxtest";
204
+ }
205
+ return `net${networkId}`;
206
+ }
207
+
208
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/polyMod.js
209
+ var BIGINT_0 = 0n;
210
+ var BIGINT_1 = 1n;
211
+ var BIGINT_5 = 5n;
212
+ var BIGINT_35 = 35n;
213
+ var BIGINT_0B00001 = 1n;
214
+ var BIGINT_0B00010 = 2n;
215
+ var BIGINT_0B00100 = 4n;
216
+ var BIGINT_0B01000 = 8n;
217
+ var BIGINT_0B10000 = 16n;
218
+ var BIGINT_0X07FFFFFFFF = 34359738367n;
219
+ var BIGINT_0X98F2BC8E61 = 656907472481n;
220
+ var BIGINT_0X79B76D99E2 = 522768456162n;
221
+ var BIGINT_0XF33E5FB3C4 = 1044723512260n;
222
+ var BIGINT_0XAE2EABE2A8 = 748107326120n;
223
+ var BIGINT_0X1E4F43E470 = 130178868336n;
224
+ function polyMod(buffer) {
225
+ let checksumBigInt = BIGINT_1;
226
+ for (const byte of buffer) {
227
+ const high = checksumBigInt >> BIGINT_35;
228
+ checksumBigInt = (checksumBigInt & BIGINT_0X07FFFFFFFF) << BIGINT_5;
229
+ checksumBigInt = byte ? checksumBigInt ^ BigInt(byte) : checksumBigInt;
230
+ if ((high & BIGINT_0B00001) !== BIGINT_0) {
231
+ checksumBigInt = checksumBigInt ^ BIGINT_0X98F2BC8E61;
232
+ }
233
+ if ((high & BIGINT_0B00010) !== BIGINT_0) {
234
+ checksumBigInt = checksumBigInt ^ BIGINT_0X79B76D99E2;
235
+ }
236
+ if ((high & BIGINT_0B00100) !== BIGINT_0) {
237
+ checksumBigInt = checksumBigInt ^ BIGINT_0XF33E5FB3C4;
238
+ }
239
+ if ((high & BIGINT_0B01000) !== BIGINT_0) {
240
+ checksumBigInt = checksumBigInt ^ BIGINT_0XAE2EABE2A8;
241
+ }
242
+ if ((high & BIGINT_0B10000) !== BIGINT_0) {
243
+ checksumBigInt = checksumBigInt ^ BIGINT_0X1E4F43E470;
244
+ }
245
+ }
246
+ return checksumBigInt ^ BIGINT_1;
247
+ }
248
+
249
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/hexAddressToBase32.js
250
+ var VERSION_BYTE = 0;
251
+ var ALPHABET = "ABCDEFGHJKMNPRSTUVWXYZ0123456789";
252
+ function hexAddressToBase32({ hexAddress, networkId, verbose }) {
253
+ const hexBuffer = hexToBytes(hexAddress);
254
+ const addressType = getAddressTypeByHexAddress(hexBuffer);
255
+ const netName = getNetworkPrefixByNetworkId(networkId).toUpperCase();
256
+ const netName5Bits = stringToBytes(netName).map((_byte) => _byte & 31);
257
+ const payload5Bits = convertBit(new Uint8Array([VERSION_BYTE, ...hexBuffer]), 8, 5, true);
258
+ const checksumBigInt = polyMod(new Uint8Array([
259
+ ...netName5Bits,
260
+ 0,
261
+ ...payload5Bits,
262
+ 0,
263
+ 0,
264
+ 0,
265
+ 0,
266
+ 0,
267
+ 0,
268
+ 0,
269
+ 0
270
+ ]));
271
+ let checksumHex = toHex(checksumBigInt);
272
+ if (checksumHex.length < 12) {
273
+ checksumHex = padHex(checksumHex, { dir: "left", size: 5 });
274
+ }
275
+ const checksumBytes = hexToBytes(checksumHex);
276
+ const checksum5Bits = convertBit(checksumBytes, 8, 5, true);
277
+ const payload = payload5Bits.map((_byte2) => ALPHABET[_byte2]).join("");
278
+ const checksum = checksum5Bits.map((_byte3) => ALPHABET[_byte3]).join("");
279
+ return verbose ? `${netName}:TYPE.${addressType.toUpperCase()}:${payload}${checksum}` : `${netName}:${payload}${checksum}`.toLowerCase();
280
+ }
281
+
282
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/decodeBase32Address.js
283
+ var ALPHABET_MAP = {
284
+ "0": 22,
285
+ "1": 23,
286
+ "2": 24,
287
+ "3": 25,
288
+ "4": 26,
289
+ "5": 27,
290
+ "6": 28,
291
+ "7": 29,
292
+ "8": 30,
293
+ "9": 31,
294
+ A: 0,
295
+ B: 1,
296
+ C: 2,
297
+ D: 3,
298
+ E: 4,
299
+ F: 5,
300
+ G: 6,
301
+ H: 7,
302
+ J: 8,
303
+ K: 9,
304
+ M: 10,
305
+ N: 11,
306
+ P: 12,
307
+ R: 13,
308
+ S: 14,
309
+ T: 15,
310
+ U: 16,
311
+ V: 17,
312
+ W: 18,
313
+ X: 19,
314
+ Y: 20,
315
+ Z: 21
316
+ };
317
+ function decodeBase32Address({ address, strict = true }) {
318
+ if (address !== address.toLowerCase() && address !== address.toUpperCase()) {
319
+ throw new MixedCaseAddressError({ address });
320
+ }
321
+ const [, netName, shouldHaveType, payload, checksum] = address.toUpperCase().match(/^([^:]+):(.+:)?(.{34})(.{8})$/) || ["", "", "", "", ""];
322
+ const netName5Bits = stringToBytes(netName).map((_byte) => _byte & 31);
323
+ const payload5Bits = Array.from(payload, (char) => ALPHABET_MAP[char]);
324
+ const checksum5Bits = Array.from(checksum, (char) => ALPHABET_MAP[char]);
325
+ const [version, ...addressBytes] = convertBit(new Uint8Array([...payload5Bits]), 5, 8);
326
+ if (version !== VERSION_BYTE) {
327
+ throw new InvalidAddressVersionError({ address });
328
+ }
329
+ const byteAddress = new Uint8Array([...addressBytes]);
330
+ const networkId = getNetworkIdByNetworkIdPrefix(netName);
331
+ const type = getAddressTypeByHexAddress(byteAddress);
332
+ if (shouldHaveType && `type.${type}:` !== shouldHaveType.toLowerCase()) {
333
+ throw new AddressTypeNotMatchError({ address });
334
+ }
335
+ if (strict) {
336
+ const valid = polyMod(new Uint8Array([...netName5Bits, 0, ...payload5Bits, ...checksum5Bits]));
337
+ if (valid) {
338
+ throw new InvalidAddressVersionError({ address });
339
+ }
340
+ }
341
+ return {
342
+ address: bytesToHex(byteAddress),
343
+ type,
344
+ networkId
345
+ };
346
+ }
347
+
348
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/base32AddressToHex.js
349
+ function base32AddressToHex({ address, strict = true }) {
350
+ if (address !== address.toLowerCase() && address !== address.toUpperCase()) {
351
+ throw new MixedCaseAddressError({ address });
352
+ }
353
+ const addressInfo = decodeBase32Address({ address, strict });
354
+ return addressInfo.address;
355
+ }
356
+
357
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/address/isAddress.js
358
+ var isAddressCache = /* @__PURE__ */ new LruMap(8192);
359
+ function isAddress(address) {
360
+ if (isAddressCache.has(address))
361
+ return isAddressCache.get(address);
362
+ const result = (() => {
363
+ if (address.toLowerCase() !== address && address.toUpperCase() !== address)
364
+ return false;
365
+ try {
366
+ const addr = base32AddressToHex({ address });
367
+ return !!addr;
368
+ } catch (_error) {
369
+ return false;
370
+ }
371
+ })();
372
+ isAddressCache.set(address, result);
373
+ return result;
374
+ }
375
+
376
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/abi/encodeAbiParameters.js
377
+ function getArrayComponents(type) {
378
+ const matches = type.match(/^(.*)\[(\d+)?\]$/);
379
+ return matches ? (
380
+ // Return `null` if the array is dynamic.
381
+ [matches[2] ? Number(matches[2]) : null, matches[1]]
382
+ ) : void 0;
383
+ }
384
+
385
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/errors/cursor.js
386
+ var NegativeOffsetError = class extends BaseError {
387
+ constructor({ offset }) {
388
+ super(`Offset \`${offset}\` cannot be negative.`);
389
+ __publicField(this, "name", "NegativeOffsetError");
390
+ }
391
+ };
392
+ var PositionOutOfBoundsError = class extends BaseError {
393
+ constructor({ length, position }) {
394
+ super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`);
395
+ __publicField(this, "name", "PositionOutOfBoundsError");
396
+ }
397
+ };
398
+ var RecursiveReadLimitExceededError = class extends BaseError {
399
+ constructor({ count, limit }) {
400
+ super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`);
401
+ __publicField(this, "name", "RecursiveReadLimitExceededError");
402
+ }
403
+ };
404
+
405
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/cursor.js
406
+ var staticCursor = {
407
+ bytes: new Uint8Array(),
408
+ dataView: new DataView(new ArrayBuffer(0)),
409
+ position: 0,
410
+ positionReadCount: /* @__PURE__ */ new Map(),
411
+ recursiveReadCount: 0,
412
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
413
+ assertReadLimit() {
414
+ if (this.recursiveReadCount >= this.recursiveReadLimit)
415
+ throw new RecursiveReadLimitExceededError({
416
+ count: this.recursiveReadCount + 1,
417
+ limit: this.recursiveReadLimit
418
+ });
419
+ },
420
+ assertPosition(position) {
421
+ if (position < 0 || position > this.bytes.length - 1)
422
+ throw new PositionOutOfBoundsError({
423
+ length: this.bytes.length,
424
+ position
425
+ });
426
+ },
427
+ decrementPosition(offset) {
428
+ if (offset < 0)
429
+ throw new NegativeOffsetError({ offset });
430
+ const position = this.position - offset;
431
+ this.assertPosition(position);
432
+ this.position = position;
433
+ },
434
+ getReadCount(position) {
435
+ return this.positionReadCount.get(position || this.position) || 0;
436
+ },
437
+ incrementPosition(offset) {
438
+ if (offset < 0)
439
+ throw new NegativeOffsetError({ offset });
440
+ const position = this.position + offset;
441
+ this.assertPosition(position);
442
+ this.position = position;
443
+ },
444
+ inspectByte(position_) {
445
+ const position = position_ ?? this.position;
446
+ this.assertPosition(position);
447
+ return this.bytes[position];
448
+ },
449
+ inspectBytes(length, position_) {
450
+ const position = position_ ?? this.position;
451
+ this.assertPosition(position + length - 1);
452
+ return this.bytes.subarray(position, position + length);
453
+ },
454
+ inspectUint8(position_) {
455
+ const position = position_ ?? this.position;
456
+ this.assertPosition(position);
457
+ return this.bytes[position];
458
+ },
459
+ inspectUint16(position_) {
460
+ const position = position_ ?? this.position;
461
+ this.assertPosition(position + 1);
462
+ return this.dataView.getUint16(position);
463
+ },
464
+ inspectUint24(position_) {
465
+ const position = position_ ?? this.position;
466
+ this.assertPosition(position + 2);
467
+ return (this.dataView.getUint16(position) << 8) + this.dataView.getUint8(position + 2);
468
+ },
469
+ inspectUint32(position_) {
470
+ const position = position_ ?? this.position;
471
+ this.assertPosition(position + 3);
472
+ return this.dataView.getUint32(position);
473
+ },
474
+ pushByte(byte) {
475
+ this.assertPosition(this.position);
476
+ this.bytes[this.position] = byte;
477
+ this.position++;
478
+ },
479
+ pushBytes(bytes) {
480
+ this.assertPosition(this.position + bytes.length - 1);
481
+ this.bytes.set(bytes, this.position);
482
+ this.position += bytes.length;
483
+ },
484
+ pushUint8(value) {
485
+ this.assertPosition(this.position);
486
+ this.bytes[this.position] = value;
487
+ this.position++;
488
+ },
489
+ pushUint16(value) {
490
+ this.assertPosition(this.position + 1);
491
+ this.dataView.setUint16(this.position, value);
492
+ this.position += 2;
493
+ },
494
+ pushUint24(value) {
495
+ this.assertPosition(this.position + 2);
496
+ this.dataView.setUint16(this.position, value >> 8);
497
+ this.dataView.setUint8(this.position + 2, value & ~4294967040);
498
+ this.position += 3;
499
+ },
500
+ pushUint32(value) {
501
+ this.assertPosition(this.position + 3);
502
+ this.dataView.setUint32(this.position, value);
503
+ this.position += 4;
504
+ },
505
+ readByte() {
506
+ this.assertReadLimit();
507
+ this._touch();
508
+ const value = this.inspectByte();
509
+ this.position++;
510
+ return value;
511
+ },
512
+ readBytes(length, size2) {
513
+ this.assertReadLimit();
514
+ this._touch();
515
+ const value = this.inspectBytes(length);
516
+ this.position += size2 ?? length;
517
+ return value;
518
+ },
519
+ readUint8() {
520
+ this.assertReadLimit();
521
+ this._touch();
522
+ const value = this.inspectUint8();
523
+ this.position += 1;
524
+ return value;
525
+ },
526
+ readUint16() {
527
+ this.assertReadLimit();
528
+ this._touch();
529
+ const value = this.inspectUint16();
530
+ this.position += 2;
531
+ return value;
532
+ },
533
+ readUint24() {
534
+ this.assertReadLimit();
535
+ this._touch();
536
+ const value = this.inspectUint24();
537
+ this.position += 3;
538
+ return value;
539
+ },
540
+ readUint32() {
541
+ this.assertReadLimit();
542
+ this._touch();
543
+ const value = this.inspectUint32();
544
+ this.position += 4;
545
+ return value;
546
+ },
547
+ get remaining() {
548
+ return this.bytes.length - this.position;
549
+ },
550
+ setPosition(position) {
551
+ const oldPosition = this.position;
552
+ this.assertPosition(position);
553
+ this.position = position;
554
+ return () => this.position = oldPosition;
555
+ },
556
+ _touch() {
557
+ if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
558
+ return;
559
+ const count = this.getReadCount();
560
+ this.positionReadCount.set(this.position, count + 1);
561
+ if (count > 0)
562
+ this.recursiveReadCount++;
563
+ }
564
+ };
565
+ function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
566
+ const cursor = Object.create(staticCursor);
567
+ cursor.bytes = bytes;
568
+ cursor.dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
569
+ cursor.positionReadCount = /* @__PURE__ */ new Map();
570
+ cursor.recursiveReadLimit = recursiveReadLimit;
571
+ return cursor;
572
+ }
573
+
574
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/abi/decodeAbiParameters.js
575
+ function decodeAbiParameters(params, data, networkId) {
576
+ const bytes = typeof data === "string" ? hexToBytes(data) : data;
577
+ const cursor = createCursor(bytes);
578
+ if (size(bytes) === 0 && params.length > 0)
579
+ throw new AbiDecodingZeroDataError();
580
+ if (size(data) && size(data) < 32)
581
+ throw new AbiDecodingDataSizeTooSmallError({
582
+ data: typeof data === "string" ? data : bytesToHex(data),
583
+ params,
584
+ size: size(data)
585
+ });
586
+ let consumed = 0;
587
+ const values = [];
588
+ for (let i = 0; i < params.length; ++i) {
589
+ const param = params[i];
590
+ cursor.setPosition(consumed);
591
+ const [data2, consumed_] = decodeParameter(cursor, param, {
592
+ networkId,
593
+ staticPosition: 0
594
+ });
595
+ consumed += consumed_;
596
+ values.push(data2);
597
+ }
598
+ return values;
599
+ }
600
+ function decodeParameter(cursor, param, { staticPosition, networkId }) {
601
+ const arrayComponents = getArrayComponents(param.type);
602
+ if (arrayComponents) {
603
+ const [length, type] = arrayComponents;
604
+ return decodeArray(cursor, { ...param, type }, { length, staticPosition, networkId });
605
+ }
606
+ if (param.type === "tuple")
607
+ return decodeTuple(cursor, param, {
608
+ staticPosition,
609
+ networkId
610
+ });
611
+ if (param.type === "address")
612
+ return decodeAddress(cursor, networkId);
613
+ if (param.type === "bool")
614
+ return decodeBool(cursor);
615
+ if (param.type.startsWith("bytes"))
616
+ return decodeBytes(cursor, param, { staticPosition });
617
+ if (param.type.startsWith("uint") || param.type.startsWith("int"))
618
+ return decodeNumber(cursor, param);
619
+ if (param.type === "string")
620
+ return decodeString(cursor, { staticPosition });
621
+ throw new InvalidAbiDecodingTypeError(param.type, {
622
+ docsPath: "/docs/contract/decodeAbiParameters"
623
+ });
624
+ }
625
+ var sizeOfLength = 32;
626
+ var sizeOfOffset = 32;
627
+ function decodeAddress(cursor, networkId) {
628
+ const value = cursor.readBytes(32);
629
+ const hexAddress = checksumAddress(bytesToHex(sliceBytes(value, -20)));
630
+ const base32Address = hexAddressToBase32({ hexAddress, networkId });
631
+ return [base32Address, 32];
632
+ }
633
+ function decodeArray(cursor, param, { length, staticPosition, networkId }) {
634
+ if (!length) {
635
+ const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
636
+ const start = staticPosition + offset;
637
+ const startOfData = start + sizeOfLength;
638
+ cursor.setPosition(start);
639
+ const length2 = bytesToNumber(cursor.readBytes(sizeOfLength));
640
+ const dynamicChild = hasDynamicChild(param);
641
+ let consumed2 = 0;
642
+ const value2 = [];
643
+ for (let i = 0; i < length2; ++i) {
644
+ cursor.setPosition(startOfData + (dynamicChild ? i * 32 : consumed2));
645
+ const [data, consumed_] = decodeParameter(cursor, param, {
646
+ staticPosition: startOfData,
647
+ networkId
648
+ });
649
+ consumed2 += consumed_;
650
+ value2.push(data);
651
+ }
652
+ cursor.setPosition(staticPosition + 32);
653
+ return [value2, 32];
654
+ }
655
+ if (hasDynamicChild(param)) {
656
+ const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
657
+ const start = staticPosition + offset;
658
+ const value2 = [];
659
+ for (let i = 0; i < length; ++i) {
660
+ cursor.setPosition(start + i * 32);
661
+ const [data] = decodeParameter(cursor, param, {
662
+ staticPosition: start,
663
+ networkId
664
+ });
665
+ value2.push(data);
666
+ }
667
+ cursor.setPosition(staticPosition + 32);
668
+ return [value2, 32];
669
+ }
670
+ let consumed = 0;
671
+ const value = [];
672
+ for (let i = 0; i < length; ++i) {
673
+ const [data, consumed_] = decodeParameter(cursor, param, {
674
+ staticPosition: staticPosition + consumed,
675
+ networkId
676
+ });
677
+ consumed += consumed_;
678
+ value.push(data);
679
+ }
680
+ return [value, consumed];
681
+ }
682
+ function decodeBool(cursor) {
683
+ return [bytesToBool(cursor.readBytes(32), { size: 32 }), 32];
684
+ }
685
+ function decodeBytes(cursor, param, { staticPosition }) {
686
+ const [_, size2] = param.type.split("bytes");
687
+ if (!size2) {
688
+ const offset = bytesToNumber(cursor.readBytes(32));
689
+ cursor.setPosition(staticPosition + offset);
690
+ const length = bytesToNumber(cursor.readBytes(32));
691
+ if (length === 0) {
692
+ cursor.setPosition(staticPosition + 32);
693
+ return ["0x", 32];
694
+ }
695
+ const data = cursor.readBytes(length);
696
+ cursor.setPosition(staticPosition + 32);
697
+ return [bytesToHex(data), 32];
698
+ }
699
+ const value = bytesToHex(cursor.readBytes(Number.parseInt(size2), 32));
700
+ return [value, 32];
701
+ }
702
+ function decodeNumber(cursor, param) {
703
+ const signed = param.type.startsWith("int");
704
+ const size2 = Number.parseInt(param.type.split("int")[1] || "256");
705
+ const value = cursor.readBytes(32);
706
+ return [
707
+ size2 > 48 ? bytesToBigInt(value, { signed }) : bytesToNumber(value, { signed }),
708
+ 32
709
+ ];
710
+ }
711
+ function decodeTuple(cursor, param, { staticPosition, networkId }) {
712
+ const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name }) => !name);
713
+ const value = hasUnnamedChild ? [] : {};
714
+ let consumed = 0;
715
+ if (hasDynamicChild(param)) {
716
+ const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
717
+ const start = staticPosition + offset;
718
+ for (let i = 0; i < param.components.length; ++i) {
719
+ const component = param.components[i];
720
+ cursor.setPosition(start + consumed);
721
+ const [data, consumed_] = decodeParameter(cursor, component, {
722
+ staticPosition: start,
723
+ networkId
724
+ });
725
+ consumed += consumed_;
726
+ value[hasUnnamedChild ? i : component?.name] = data;
727
+ }
728
+ cursor.setPosition(staticPosition + 32);
729
+ return [value, 32];
730
+ }
731
+ for (let i = 0; i < param.components.length; ++i) {
732
+ const component = param.components[i];
733
+ const [data, consumed_] = decodeParameter(cursor, component, {
734
+ staticPosition,
735
+ networkId
736
+ });
737
+ value[hasUnnamedChild ? i : component?.name] = data;
738
+ consumed += consumed_;
739
+ }
740
+ return [value, consumed];
741
+ }
742
+ function decodeString(cursor, { staticPosition }) {
743
+ const offset = bytesToNumber(cursor.readBytes(32));
744
+ const start = staticPosition + offset;
745
+ cursor.setPosition(start);
746
+ const length = bytesToNumber(cursor.readBytes(32));
747
+ if (length === 0) {
748
+ cursor.setPosition(staticPosition + 32);
749
+ return ["", 32];
750
+ }
751
+ const data = cursor.readBytes(length, 32);
752
+ const value = bytesToString(trim(data));
753
+ cursor.setPosition(staticPosition + 32);
754
+ return [value, 32];
755
+ }
756
+ function hasDynamicChild(param) {
757
+ const { type } = param;
758
+ if (type === "string")
759
+ return true;
760
+ if (type === "bytes")
761
+ return true;
762
+ if (type.endsWith("[]"))
763
+ return true;
764
+ if (type === "tuple")
765
+ return param.components?.some(hasDynamicChild);
766
+ const arrayComponents = getArrayComponents(param.type);
767
+ if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
768
+ return true;
769
+ return false;
770
+ }
771
+
772
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/abi/formatAbiItem.js
773
+ function formatAbiItem2(abiItem, { includeName = false } = {}) {
774
+ if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
775
+ throw new InvalidDefinitionTypeError(abiItem.type);
776
+ return `${abiItem.name}(${formatAbiParams2(abiItem.inputs, { includeName })})`;
777
+ }
778
+ function formatAbiParams2(params, { includeName = false } = {}) {
779
+ if (!params)
780
+ return "";
781
+ return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
782
+ }
783
+ function formatAbiParam(param, { includeName }) {
784
+ if (param.type.startsWith("tuple")) {
785
+ return `(${formatAbiParams2(param.components, { includeName })})${param.type.slice("tuple".length)}`;
786
+ }
787
+ return param.type + (includeName && param.name ? ` ${param.name}` : "");
788
+ }
789
+
790
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/abi/decodeFunctionData.js
791
+ function decodeFunctionData2(parameters) {
792
+ const { abi, data, networkId } = parameters;
793
+ const signature = slice(data, 0, 4);
794
+ const description = abi.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem(x)));
795
+ if (!description)
796
+ throw new AbiFunctionSignatureNotFoundError(signature, {
797
+ docsPath: "/docs/contract/decodeFunctionData"
798
+ });
799
+ return {
800
+ functionName: description.name,
801
+ args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbiParameters(description.inputs, slice(data, 4), networkId) : void 0
802
+ };
803
+ }
804
+
805
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/types/abi.js
806
+ var AbiItemAmbiguityError = class extends BaseError {
807
+ constructor(x, y) {
808
+ super("Found ambiguous types in overloaded ABI items.", {
809
+ metaMessages: [
810
+ `\`${x.type}\` in \`${formatAbiItem(x.abiItem)}\`, and`,
811
+ `\`${y.type}\` in \`${formatAbiItem(y.abiItem)}\``,
812
+ "",
813
+ "These types encode differently and cannot be distinguished at runtime.",
814
+ "Remove one of the ambiguous items in the ABI."
815
+ ]
816
+ });
817
+ __publicField(this, "name", "AbiItemAmbiguityError");
818
+ }
819
+ };
820
+
821
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/abi/getAbiItem.js
822
+ function getAbiItem2(parameters) {
823
+ const { abi, args = [], name } = parameters;
824
+ const isSelector = isHex(name, { strict: false });
825
+ const abiItems = abi.filter((abiItem) => {
826
+ if (isSelector) {
827
+ if (abiItem.type === "function")
828
+ return toFunctionSelector(abiItem) === name;
829
+ if (abiItem.type === "event")
830
+ return toEventSelector(abiItem) === name;
831
+ return false;
832
+ }
833
+ return "name" in abiItem && abiItem.name === name;
834
+ });
835
+ if (abiItems.length === 0)
836
+ return void 0;
837
+ if (abiItems.length === 1)
838
+ return abiItems[0];
839
+ let matchedAbiItem = void 0;
840
+ for (const abiItem of abiItems) {
841
+ if (!("inputs" in abiItem))
842
+ continue;
843
+ if (!args || args.length === 0) {
844
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
845
+ return abiItem;
846
+ continue;
847
+ }
848
+ if (!abiItem.inputs)
849
+ continue;
850
+ if (abiItem.inputs.length === 0)
851
+ continue;
852
+ if (abiItem.inputs.length !== args.length)
853
+ continue;
854
+ const matched = args.every((arg, index) => {
855
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
856
+ if (!abiParameter)
857
+ return false;
858
+ return isArgOfType(arg, abiParameter);
859
+ });
860
+ if (matched) {
861
+ if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
862
+ const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
863
+ if (ambiguousTypes)
864
+ throw new AbiItemAmbiguityError({
865
+ abiItem,
866
+ type: ambiguousTypes[0]
867
+ }, {
868
+ abiItem: matchedAbiItem,
869
+ type: ambiguousTypes[1]
870
+ });
871
+ }
872
+ matchedAbiItem = abiItem;
873
+ }
874
+ }
875
+ if (matchedAbiItem)
876
+ return matchedAbiItem;
877
+ return abiItems[0];
878
+ }
879
+ function isArgOfType(arg, abiParameter) {
880
+ const argType = typeof arg;
881
+ const abiParameterType = abiParameter.type;
882
+ switch (abiParameterType) {
883
+ case "address":
884
+ return isAddress(arg);
885
+ case "bool":
886
+ return argType === "boolean";
887
+ case "function":
888
+ return argType === "string";
889
+ case "string":
890
+ return argType === "string";
891
+ default: {
892
+ if (abiParameterType === "tuple" && "components" in abiParameter)
893
+ return Object.values(abiParameter.components).every((component, index) => {
894
+ return isArgOfType(Object.values(arg)[index], component);
895
+ });
896
+ if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(abiParameterType))
897
+ return argType === "number" || argType === "bigint";
898
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
899
+ return argType === "string" || arg instanceof Uint8Array;
900
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
901
+ return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
902
+ ...abiParameter,
903
+ // Pop off `[]` or `[M]` from end of type
904
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
905
+ }));
906
+ }
907
+ return false;
908
+ }
909
+ }
910
+ }
911
+ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
912
+ for (const parameterIndex in sourceParameters) {
913
+ const sourceParameter = sourceParameters[parameterIndex];
914
+ const targetParameter = targetParameters[parameterIndex];
915
+ if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter)
916
+ return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);
917
+ const types = [sourceParameter.type, targetParameter.type];
918
+ const ambiguous = (() => {
919
+ if (types.includes("address") && types.includes("bytes20"))
920
+ return true;
921
+ if (types.includes("address") && types.includes("string"))
922
+ return isAddress(args[parameterIndex]);
923
+ if (types.includes("address") && types.includes("bytes"))
924
+ return isAddress(args[parameterIndex]);
925
+ return false;
926
+ })();
927
+ if (ambiguous)
928
+ return types;
929
+ }
930
+ return;
931
+ }
932
+
933
+ // ../../node_modules/.pnpm/cive@0.8.1_bufferutil@4.0.8_typescript@5.4.3_utf-8-validate@5.0.10/node_modules/cive/_esm/utils/abi/decodeFunctionResult.js
934
+ var docsPath = "/docs/contract/decodeFunctionResult";
935
+ function decodeFunctionResult2(parameters) {
936
+ const { abi, args, functionName, data, networkId } = parameters;
937
+ let abiItem = abi[0];
938
+ if (functionName) {
939
+ const item = getAbiItem2({ abi, args, name: functionName });
940
+ if (!item)
941
+ throw new AbiFunctionNotFoundError(functionName, { docsPath });
942
+ abiItem = item;
943
+ }
944
+ if (abiItem.type !== "function")
945
+ throw new AbiFunctionNotFoundError(void 0, { docsPath });
946
+ if (!abiItem.outputs)
947
+ throw new AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath });
948
+ const values = decodeAbiParameters(abiItem.outputs, data, networkId);
949
+ if (values && values.length > 1)
950
+ return values;
951
+ if (values && values.length === 1)
952
+ return values[0];
953
+ return void 0;
954
+ }
955
+
956
+ // src/utils/sdk.ts
957
+ var decodeFunctionData3 = ({
958
+ data,
959
+ abi,
960
+ space
961
+ }) => {
962
+ if (space === "core") {
963
+ return decodeFunctionData2({
964
+ data,
965
+ abi,
966
+ networkId: NETWORK_ID
967
+ });
968
+ } else {
969
+ return decodeFunctionData({
970
+ data,
971
+ abi
972
+ });
973
+ }
974
+ };
975
+ var decodeFunctionResult3 = ({
976
+ data,
977
+ abi,
978
+ functionName,
979
+ space
980
+ }) => {
981
+ if (space === "core") {
982
+ return decodeFunctionResult2({
983
+ data,
984
+ functionName,
985
+ abi,
986
+ networkId: NETWORK_ID
987
+ });
988
+ } else {
989
+ return decodeFunctionResult({
990
+ data,
991
+ functionName,
992
+ abi
993
+ });
994
+ }
995
+ };
996
+ var decodeErrorResult2 = ({
997
+ data,
998
+ abi,
999
+ space
1000
+ }) => {
1001
+ if (space === "core") {
1002
+ if (data.length < 10 || !data.startsWith("0x"))
1003
+ throw new Error("Invalid data");
1004
+ const signature = data.slice(0, 10);
1005
+ const abiItem = abi.find(
1006
+ (x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem2(x))
1007
+ );
1008
+ if (!abiItem)
1009
+ throw new Error(`not found abi item for error signature: ${signature}`);
1010
+ return {
1011
+ abiItem,
1012
+ args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbiParameters(
1013
+ abiItem.inputs,
1014
+ `0x${data.slice(10)}`,
1015
+ NETWORK_ID
1016
+ ) : void 0,
1017
+ errorName: abiItem.name
1018
+ };
1019
+ } else {
1020
+ return decodeErrorResult({
1021
+ data,
1022
+ abi
1023
+ });
1024
+ }
1025
+ };
1026
+
1027
+ export {
1028
+ decodeFunctionData3 as decodeFunctionData,
1029
+ decodeFunctionResult3 as decodeFunctionResult,
1030
+ decodeErrorResult2 as decodeErrorResult
1031
+ };
1032
+ //# sourceMappingURL=chunk-6SXAFSBF.js.map