@cfxjs/sirius-next-common 0.2.9 → 0.2.11
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.
- package/dist/_esm-TZ4WSCGM.js +4035 -0
- package/dist/_esm-TZ4WSCGM.js.map +1 -0
- package/dist/abis/CommonError.d.ts +10 -0
- package/dist/abis/CommonError.js +8 -0
- package/dist/abis/CommonError.js.map +1 -0
- package/dist/abis/CommonPanic.d.ts +10 -0
- package/dist/abis/CommonPanic.js +8 -0
- package/dist/abis/CommonPanic.js.map +1 -0
- package/dist/ccip-DBSI27GO.js +15 -0
- package/dist/ccip-DBSI27GO.js.map +1 -0
- package/dist/chunk-3PXUIH3S.js +17 -0
- package/dist/chunk-3PXUIH3S.js.map +1 -0
- package/dist/chunk-4B6ASBYQ.js +408 -0
- package/dist/chunk-4B6ASBYQ.js.map +1 -0
- package/dist/{chunk-Z6EYKGBH.js → chunk-5EDEEGZK.js} +42 -66
- package/dist/chunk-5EDEEGZK.js.map +1 -0
- package/dist/chunk-5TGK2EA2.js +18 -0
- package/dist/chunk-5TGK2EA2.js.map +1 -0
- package/dist/chunk-5Y7I6VYA.js +145 -0
- package/dist/chunk-5Y7I6VYA.js.map +1 -0
- package/dist/chunk-6H5A42YS.js +23 -0
- package/dist/chunk-6H5A42YS.js.map +1 -0
- package/dist/chunk-6SXAFSBF.js +1032 -0
- package/dist/chunk-6SXAFSBF.js.map +1 -0
- package/dist/chunk-735VMABS.js +82 -0
- package/dist/chunk-735VMABS.js.map +1 -0
- package/dist/chunk-7CBOXGGA.js +78 -0
- package/dist/chunk-7CBOXGGA.js.map +1 -0
- package/dist/chunk-ADNS57X5.js +18 -0
- package/dist/chunk-ADNS57X5.js.map +1 -0
- package/dist/{chunk-CY4XPEK5.js → chunk-ADULNBMD.js} +5 -5
- package/dist/chunk-AKMGJWIM.js +79 -0
- package/dist/chunk-AKMGJWIM.js.map +1 -0
- package/dist/{chunk-EYT54RGS.js → chunk-BUSBM33B.js} +4 -4
- package/dist/chunk-CKVDFS45.js +56 -0
- package/dist/chunk-CKVDFS45.js.map +1 -0
- package/dist/{chunk-KKR2JERD.js → chunk-CNF26YY7.js} +3 -3
- package/dist/{chunk-H7V2CGOB.js → chunk-CPPQCJEV.js} +3 -3
- package/dist/chunk-CPR4QZT6.js +21 -0
- package/dist/chunk-CPR4QZT6.js.map +1 -0
- package/dist/chunk-CPSXYQJ7.js +13 -0
- package/dist/chunk-CPSXYQJ7.js.map +1 -0
- package/dist/{chunk-JXKHN73X.js → chunk-DF3PVTB5.js} +2 -2
- package/dist/chunk-E3ZD2GGG.js +17 -0
- package/dist/chunk-E3ZD2GGG.js.map +1 -0
- package/dist/chunk-EERNUGUK.js +198 -0
- package/dist/chunk-EERNUGUK.js.map +1 -0
- package/dist/{chunk-BVED57CI.js → chunk-EMPFZFBS.js} +6 -19
- package/dist/chunk-EMPFZFBS.js.map +1 -0
- package/dist/chunk-FYLAXC3R.js +82 -0
- package/dist/chunk-FYLAXC3R.js.map +1 -0
- package/dist/{chunk-52R454XN.js → chunk-GKZK26DZ.js} +3 -3
- package/dist/{chunk-OQCPL2OI.js → chunk-GSWIFV2B.js} +2 -2
- package/dist/chunk-JFFTHCNE.js +344 -0
- package/dist/chunk-JFFTHCNE.js.map +1 -0
- package/dist/chunk-JIRLY7OG.js +4357 -0
- package/dist/chunk-JIRLY7OG.js.map +1 -0
- package/dist/chunk-K6FHTS3F.js +115 -0
- package/dist/chunk-K6FHTS3F.js.map +1 -0
- package/dist/chunk-L62OTV7F.js +71 -0
- package/dist/chunk-L62OTV7F.js.map +1 -0
- package/dist/{chunk-WOX3LUVT.js → chunk-LVFMTP5H.js} +2 -2
- package/dist/chunk-NWVSTRCG.js +20 -0
- package/dist/chunk-NWVSTRCG.js.map +1 -0
- package/dist/chunk-NXCZ5PMI.js +64 -0
- package/dist/chunk-NXCZ5PMI.js.map +1 -0
- package/dist/{chunk-XZQWPTKA.js → chunk-NZY53U2H.js} +9 -13
- package/dist/chunk-NZY53U2H.js.map +1 -0
- package/dist/{chunk-FXGL77DI.js → chunk-OCQIWTDC.js} +2 -2
- package/dist/{chunk-3CHXTO52.js → chunk-ODJ4QBD5.js} +6 -6
- package/dist/chunk-OYESIV3F.js +47 -0
- package/dist/chunk-OYESIV3F.js.map +1 -0
- package/dist/{chunk-W7ZK4OQA.js → chunk-P4EE3QGM.js} +3 -3
- package/dist/{chunk-CKOT4CK7.js → chunk-Q2DX6IDH.js} +2 -2
- package/dist/chunk-SFCNLOQ5.js +37 -0
- package/dist/chunk-SFCNLOQ5.js.map +1 -0
- package/dist/chunk-SUCQASD3.js +84 -0
- package/dist/chunk-SUCQASD3.js.map +1 -0
- package/dist/chunk-U6ZN2ABK.js +184 -0
- package/dist/chunk-U6ZN2ABK.js.map +1 -0
- package/dist/chunk-UM5J477V.js +69 -0
- package/dist/chunk-UM5J477V.js.map +1 -0
- package/dist/{chunk-7RH7LJYB.js → chunk-WIB76E7O.js} +6 -2
- package/dist/{chunk-7RH7LJYB.js.map → chunk-WIB76E7O.js.map} +1 -1
- package/dist/chunk-WQG2LZMB.js +50 -0
- package/dist/chunk-WQG2LZMB.js.map +1 -0
- package/dist/chunk-XZ7IV2FF.js +5947 -0
- package/dist/chunk-XZ7IV2FF.js.map +1 -0
- package/dist/chunk-Y7OVL5US.js +46 -0
- package/dist/chunk-Y7OVL5US.js.map +1 -0
- package/dist/chunk-YBQQ72FQ.js +10 -0
- package/dist/chunk-YBQQ72FQ.js.map +1 -0
- package/dist/chunk-YDA7DDMQ.js +186 -0
- package/dist/chunk-YDA7DDMQ.js.map +1 -0
- package/dist/{chunk-YEUH2K6Z.js → chunk-YEINMVAR.js} +8 -2
- package/dist/chunk-YEINMVAR.js.map +1 -0
- package/dist/chunk-YIZCD4WG.js +107 -0
- package/dist/chunk-YIZCD4WG.js.map +1 -0
- package/dist/components/AceEditor/index.js +9 -143
- package/dist/components/AceEditor/index.js.map +1 -1
- package/dist/components/AddressContainer/CoreAddressContainer.js +14 -12
- package/dist/components/AddressContainer/EVMAddressContainer.js +13 -11
- package/dist/components/AddressContainer/addressSwitcher.js +11 -9
- package/dist/components/AddressContainer/addressView.js +9 -8
- package/dist/components/AddressContainer/label.js +7 -6
- package/dist/components/AddressContainer/utils.d.ts +9 -0
- package/dist/components/AddressContainer/utils.js +30 -0
- package/dist/components/AddressContainer/utils.js.map +1 -0
- package/dist/components/Age/index.js +7 -6
- package/dist/components/Age/index.js.map +1 -1
- package/dist/components/AutoComplete/index.js +6 -5
- package/dist/components/AutoComplete/index.js.map +1 -1
- package/dist/components/Button/ActionButton/index.js +1 -0
- package/dist/components/Button/BaseButton/index.js +1 -0
- package/dist/components/Button/IconButton/index.js +1 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Charts/BreadcrumbNav.js +1 -0
- package/dist/components/Charts/ChartOptions.js +1 -0
- package/dist/components/Charts/PreviewChartTemplate.js +3 -2
- package/dist/components/Charts/PreviewChartTemplate.js.map +1 -1
- package/dist/components/Charts/PreviewTitle.js +1 -0
- package/dist/components/Charts/StockChartTemplate.js +10 -9
- package/dist/components/Charts/StockChartTemplate.js.map +1 -1
- package/dist/components/Charts/StockTitle.js +1 -0
- package/dist/components/Charts/config.js +1 -0
- package/dist/components/Charts/constants.js +1 -0
- package/dist/components/Charts/useHighCharts.js +1 -0
- package/dist/components/CookieTip/CookieIcon.js +1 -0
- package/dist/components/CookieTip/index.js +2 -1
- package/dist/components/CookieTip/index.js.map +1 -1
- package/dist/components/CopyButton/index.js +6 -5
- package/dist/components/CopyButton/index.js.map +1 -1
- package/dist/components/DecimalsSelect/index.js +6 -5
- package/dist/components/DecimalsSelect/index.js.map +1 -1
- package/dist/components/DeleteIcon/index.js +2 -0
- package/dist/components/DeleteIcon/index.js.map +1 -1
- package/dist/components/Description/index.js +1 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/DownloadCSV/index.js +7 -6
- package/dist/components/DownloadCSV/index.js.map +1 -1
- package/dist/components/Dropdown/index.js +1 -0
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Empty/index.js +4 -40
- package/dist/components/Empty/index.js.map +1 -1
- package/dist/components/FileUpload/index.js +2 -0
- package/dist/components/FileUpload/index.js.map +1 -1
- package/dist/components/Footer/index.js +1 -0
- package/dist/components/Footer/index.js.map +1 -1
- package/dist/components/GasPriceDropdown/index.js +5 -4
- package/dist/components/GasPriceDropdown/index.js.map +1 -1
- package/dist/components/Highlight/index.js +1 -0
- package/dist/components/Highlight/index.js.map +1 -1
- package/dist/components/Icons/index.d.ts +8 -1
- package/dist/components/Icons/index.js +20 -64
- package/dist/components/Icons/index.js.map +1 -1
- package/dist/components/ImageSkeleton/index.js +2 -0
- package/dist/components/ImageSkeleton/index.js.map +1 -1
- package/dist/components/IncreasePercent/Icons.js +1 -0
- package/dist/components/IncreasePercent/index.js +5 -4
- package/dist/components/IncreasePercent/index.js.map +1 -1
- package/dist/components/InfoIconWithTooltip/InfoIcon.js +1 -0
- package/dist/components/InfoIconWithTooltip/index.js +7 -6
- package/dist/components/InputData/AddressLabel.d.ts +8 -0
- package/dist/components/InputData/AddressLabel.js +23 -0
- package/dist/components/InputData/AddressLabel.js.map +1 -0
- package/dist/components/InputData/ContractDetail.d.ts +22 -0
- package/dist/components/InputData/ContractDetail.js +19 -0
- package/dist/components/InputData/ContractDetail.js.map +1 -0
- package/dist/components/InputData/FunctionName.d.ts +10 -0
- package/dist/components/InputData/FunctionName.js +10 -0
- package/dist/components/InputData/FunctionName.js.map +1 -0
- package/dist/components/InputData/GeneralDecode.d.ts +9 -0
- package/dist/components/InputData/GeneralDecode.js +8 -0
- package/dist/components/InputData/GeneralDecode.js.map +1 -0
- package/dist/components/InputData/JsonDecode.d.ts +18 -0
- package/dist/components/InputData/JsonDecode.js +19 -0
- package/dist/components/InputData/JsonDecode.js.map +1 -0
- package/dist/components/InputData/OptimizationDecode.d.ts +23 -0
- package/dist/components/InputData/OptimizationDecode.js +32 -0
- package/dist/components/InputData/OptimizationDecode.js.map +1 -0
- package/dist/components/InputData/Original.d.ts +8 -0
- package/dist/components/InputData/Original.js +8 -0
- package/dist/components/InputData/Original.js.map +1 -0
- package/dist/components/InputData/UTF8.d.ts +8 -0
- package/dist/components/InputData/UTF8.js +14 -0
- package/dist/components/InputData/UTF8.js.map +1 -0
- package/dist/components/InputData/index.d.ts +15 -0
- package/dist/components/InputData/index.js +36 -0
- package/dist/components/InputData/index.js.map +1 -0
- package/dist/components/InputData/utils.d.ts +5 -0
- package/dist/components/InputData/utils.js +8 -0
- package/dist/components/InputData/utils.js.map +1 -0
- package/dist/components/Link/index.js +1 -0
- package/dist/components/List/index.js +1 -0
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Loading/index.js +1 -0
- package/dist/components/Loading/index.js.map +1 -1
- package/dist/components/Loading/loading.js +1 -0
- package/dist/components/Modal/index.js +6 -5
- package/dist/components/NetworkIcon/index.js +5 -4
- package/dist/components/NetworkIcon/index.js.map +1 -1
- package/dist/components/OutputData/ErrorDecode.d.ts +14 -0
- package/dist/components/OutputData/ErrorDecode.js +39 -0
- package/dist/components/OutputData/ErrorDecode.js.map +1 -0
- package/dist/components/OutputData/index.d.ts +21 -0
- package/dist/components/OutputData/index.js +42 -0
- package/dist/components/OutputData/index.js.map +1 -0
- package/dist/components/PageHeader/index.js +2 -0
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js +1 -0
- package/dist/components/PhishingAddressContainer/index.js +7 -6
- package/dist/components/PhishingAddressContainer/index.js.map +1 -1
- package/dist/components/Popover/index.js +6 -5
- package/dist/components/Price/index.js +6 -5
- package/dist/components/Price/index.js.map +1 -1
- package/dist/components/ProxyContractAddress/index.d.ts +24 -0
- package/dist/components/ProxyContractAddress/index.js +120 -0
- package/dist/components/ProxyContractAddress/index.js.map +1 -0
- package/dist/components/Radio/index.js +5 -4
- package/dist/components/Radio/index.js.map +1 -1
- package/dist/components/Remark/index.js +1 -0
- package/dist/components/Remark/index.js.map +1 -1
- package/dist/components/SearchIcon/index.js +2 -0
- package/dist/components/SearchIcon/index.js.map +1 -1
- package/dist/components/SearchInput/index.js +7 -6
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/Select/index.d.ts +5 -4
- package/dist/components/Select/index.js +10 -105
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/select.js +7 -5
- package/dist/components/Skeleton/index.js +1 -0
- package/dist/components/SkeletonContainer/index.js +1 -0
- package/dist/components/Spin/index.js +1 -0
- package/dist/components/Switch/index.d.ts +10 -0
- package/dist/components/Switch/index.js +81 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Table/index.d.ts +9 -0
- package/dist/components/Table/index.js +12 -0
- package/dist/components/Table/index.js.map +1 -0
- package/dist/components/Text/index.js +7 -6
- package/dist/components/TextLogo/index.js +2 -0
- package/dist/components/TextLogo/index.js.map +1 -1
- package/dist/components/Tooltip/index.js +6 -5
- package/dist/components/TransactionAction/constants.js +1 -0
- package/dist/components/TransactionAction/coreTransactionAction.js +15 -13
- package/dist/components/TransactionAction/coreTransactionAction.js.map +1 -1
- package/dist/components/TransactionAction/evmTransactionAction.js +14 -12
- package/dist/components/TransactionAction/evmTransactionAction.js.map +1 -1
- package/dist/components/TransactionTrace/TraceDetail.d.ts +20 -0
- package/dist/components/TransactionTrace/TraceDetail.js +54 -0
- package/dist/components/TransactionTrace/TraceDetail.js.map +1 -0
- package/dist/components/TransactionTrace/TreeTraceTable.d.ts +20 -0
- package/dist/components/TransactionTrace/TreeTraceTable.js +57 -0
- package/dist/components/TransactionTrace/TreeTraceTable.js.map +1 -0
- package/dist/components/TransactionTrace/index.d.ts +9 -0
- package/dist/components/TransactionTrace/index.js +60 -0
- package/dist/components/TransactionTrace/index.js.map +1 -0
- package/dist/secp256k1-WGKMGTUQ.js +2255 -0
- package/dist/secp256k1-WGKMGTUQ.js.map +1 -0
- package/dist/store/index.js +1 -0
- package/dist/uno.css +103 -5
- package/dist/utils/address.js +5 -4
- package/dist/utils/cache.js +2 -1
- package/dist/utils/constants.d.ts +3 -1
- package/dist/utils/constants.js +6 -1
- package/dist/utils/contractManagerTool.js +5 -4
- package/dist/utils/contractManagerTool.js.map +1 -1
- package/dist/utils/cookie.js +1 -0
- package/dist/utils/ga.js +1 -0
- package/dist/utils/hooks/useAddressLabel.d.ts +3 -0
- package/dist/utils/hooks/useAddressLabel.js +14 -0
- package/dist/utils/hooks/useAddressLabel.js.map +1 -0
- package/dist/utils/hooks/useAge.js +2 -1
- package/dist/utils/hooks/useAge.js.map +1 -1
- package/dist/utils/hooks/useAutoSetHolderFilterParams.d.ts +3 -0
- package/dist/utils/hooks/useAutoSetHolderFilterParams.js +72 -0
- package/dist/utils/hooks/useAutoSetHolderFilterParams.js.map +1 -0
- package/dist/utils/hooks/useChartQueryParams.js +2 -0
- package/dist/utils/hooks/useChartQueryParams.js.map +1 -1
- package/dist/utils/hooks/useContractDetail.d.ts +6 -0
- package/dist/utils/hooks/useContractDetail.js +12 -0
- package/dist/utils/hooks/useContractDetail.js.map +1 -0
- package/dist/utils/hooks/useDecodeFunctionData.d.ts +29 -0
- package/dist/utils/hooks/useDecodeFunctionData.js +19 -0
- package/dist/utils/hooks/useDecodeFunctionData.js.map +1 -0
- package/dist/utils/hooks/useDecodeFunctionError.d.ts +17 -0
- package/dist/utils/hooks/useDecodeFunctionError.js +19 -0
- package/dist/utils/hooks/useDecodeFunctionError.js.map +1 -0
- package/dist/utils/hooks/useDecodedDataType.d.ts +18 -0
- package/dist/utils/hooks/useDecodedDataType.js +8 -0
- package/dist/utils/hooks/useDecodedDataType.js.map +1 -0
- package/dist/utils/hooks/useENS.js +6 -5
- package/dist/utils/hooks/useGetTxnStatus.js +2 -0
- package/dist/utils/hooks/useGetTxnStatus.js.map +1 -1
- package/dist/utils/hooks/useMethodAbi.d.ts +8 -0
- package/dist/utils/hooks/useMethodAbi.js +12 -0
- package/dist/utils/hooks/useMethodAbi.js.map +1 -0
- package/dist/utils/hooks/useMultiAceSearch.js +2 -0
- package/dist/utils/hooks/useMultiAceSearch.js.map +1 -1
- package/dist/utils/hooks/useSearchParams.d.ts +5 -0
- package/dist/utils/hooks/useSearchParams.js +8 -0
- package/dist/utils/hooks/useSearchParams.js.map +1 -0
- package/dist/utils/hooks/useTxTrace.d.ts +124 -0
- package/dist/utils/hooks/useTxTrace.js +170 -0
- package/dist/utils/hooks/useTxTrace.js.map +1 -0
- package/dist/utils/index.js +5 -4
- package/dist/utils/media.js +1 -0
- package/dist/utils/pubsub.js +1 -0
- package/dist/utils/request.d.ts +5 -7
- package/dist/utils/request.js +7 -6
- package/dist/utils/request.types.d.ts +18 -3
- package/dist/utils/rpcRequest.js +1 -0
- package/dist/utils/rpcRequest.js.map +1 -1
- package/dist/utils/sdk.d.ts +35 -0
- package/dist/utils/sdk.js +19 -0
- package/dist/utils/sdk.js.map +1 -0
- package/package.json +8 -5
- package/dist/chunk-BVED57CI.js.map +0 -1
- package/dist/chunk-XZQWPTKA.js.map +0 -1
- package/dist/chunk-YEUH2K6Z.js.map +0 -1
- package/dist/chunk-Z6EYKGBH.js.map +0 -1
- /package/dist/{chunk-CY4XPEK5.js.map → chunk-ADULNBMD.js.map} +0 -0
- /package/dist/{chunk-EYT54RGS.js.map → chunk-BUSBM33B.js.map} +0 -0
- /package/dist/{chunk-KKR2JERD.js.map → chunk-CNF26YY7.js.map} +0 -0
- /package/dist/{chunk-H7V2CGOB.js.map → chunk-CPPQCJEV.js.map} +0 -0
- /package/dist/{chunk-JXKHN73X.js.map → chunk-DF3PVTB5.js.map} +0 -0
- /package/dist/{chunk-52R454XN.js.map → chunk-GKZK26DZ.js.map} +0 -0
- /package/dist/{chunk-OQCPL2OI.js.map → chunk-GSWIFV2B.js.map} +0 -0
- /package/dist/{chunk-WOX3LUVT.js.map → chunk-LVFMTP5H.js.map} +0 -0
- /package/dist/{chunk-FXGL77DI.js.map → chunk-OCQIWTDC.js.map} +0 -0
- /package/dist/{chunk-3CHXTO52.js.map → chunk-ODJ4QBD5.js.map} +0 -0
- /package/dist/{chunk-W7ZK4OQA.js.map → chunk-P4EE3QGM.js.map} +0 -0
- /package/dist/{chunk-CKOT4CK7.js.map → chunk-Q2DX6IDH.js.map} +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatAddress
|
|
3
|
+
} from "../../chunk-CNF26YY7.js";
|
|
4
|
+
import {
|
|
5
|
+
formatABI
|
|
6
|
+
} from "../../chunk-CPPQCJEV.js";
|
|
7
|
+
import "../../chunk-WIB76E7O.js";
|
|
8
|
+
import {
|
|
9
|
+
fetchWithPrefix
|
|
10
|
+
} from "../../chunk-5EDEEGZK.js";
|
|
11
|
+
import {
|
|
12
|
+
publishRequestError
|
|
13
|
+
} from "../../chunk-J2I22Q2M.js";
|
|
14
|
+
import "../../chunk-YEINMVAR.js";
|
|
15
|
+
import "../../chunk-DQGLZCIG.js";
|
|
16
|
+
import "../../chunk-WQG2LZMB.js";
|
|
17
|
+
|
|
18
|
+
// src/utils/hooks/useTxTrace.ts
|
|
19
|
+
import useSWRImmutable from "swr/immutable";
|
|
20
|
+
var formatTraceData = (data, space) => {
|
|
21
|
+
const addressType = space === "core" ? "base32" : "hex";
|
|
22
|
+
const contractInfo = data.contractMap || {};
|
|
23
|
+
const tokenInfo = data.tokenMap || {};
|
|
24
|
+
const proxyMap = data.proxyMap || {};
|
|
25
|
+
const nameTagMap = data.nameTagMap || {};
|
|
26
|
+
const ensMap = data.ensMap || {};
|
|
27
|
+
const methodMap = data.methodMap || {};
|
|
28
|
+
let total = 0;
|
|
29
|
+
const formatList = (t, parent) => {
|
|
30
|
+
total += t.length;
|
|
31
|
+
return t.map((item, index) => formatItem(item, index, parent, t));
|
|
32
|
+
};
|
|
33
|
+
const formatItem = (t, index, parent, list2) => {
|
|
34
|
+
const methodId = t.action.input?.slice(0, 10);
|
|
35
|
+
const from = formatAddress(t.action.from, addressType);
|
|
36
|
+
const to = formatAddress(t.action.to, addressType);
|
|
37
|
+
let method = methodId;
|
|
38
|
+
let abi = void 0;
|
|
39
|
+
const methodABI = methodId && to ? methodMap[methodId]?.[to] : void 0;
|
|
40
|
+
if (methodABI) {
|
|
41
|
+
try {
|
|
42
|
+
const result = formatABI(`["${methodABI}"]`, {
|
|
43
|
+
json: true,
|
|
44
|
+
allowEmpty: true
|
|
45
|
+
});
|
|
46
|
+
abi = JSON.parse(result);
|
|
47
|
+
const jsonABI = abi[0];
|
|
48
|
+
method = jsonABI?.name || methodId;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.log("parse method abi error: ", methodABI, error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const isContractCreated = !!t.action.createType;
|
|
54
|
+
const item = {
|
|
55
|
+
index: `${parent?.index ? `${parent.index}_` : ""}${index}`,
|
|
56
|
+
type: `${t.action.callType || t.type}`,
|
|
57
|
+
from,
|
|
58
|
+
to,
|
|
59
|
+
input: t.action.input,
|
|
60
|
+
value: t.action.value,
|
|
61
|
+
result: t.result,
|
|
62
|
+
gas: t.action.gas,
|
|
63
|
+
method,
|
|
64
|
+
abi,
|
|
65
|
+
contractCreated: isContractCreated ? t.result?.addr : void 0,
|
|
66
|
+
fromContractInfo: contractInfo[from] || {},
|
|
67
|
+
toContractInfo: contractInfo[to ?? ""] || {},
|
|
68
|
+
fromTokenInfo: tokenInfo[from] || {},
|
|
69
|
+
toTokenInfo: tokenInfo[to ?? ""] || {},
|
|
70
|
+
fromNameTagInfo: nameTagMap[from],
|
|
71
|
+
toNameTagInfo: nameTagMap[to ?? ""],
|
|
72
|
+
fromENSInfo: ensMap[from],
|
|
73
|
+
toENSInfo: ensMap[to ?? ""],
|
|
74
|
+
isCallImpl: t.isCallImpl,
|
|
75
|
+
fromPocket: t.action.fromPocket,
|
|
76
|
+
toPocket: t.action.toPocket
|
|
77
|
+
};
|
|
78
|
+
if (t.action.fromSpace === "evm") {
|
|
79
|
+
item.fromESpaceInfo = {
|
|
80
|
+
address: formatAddress(from, "hex")
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (t.action.toSpace === "evm") {
|
|
84
|
+
item.toESpaceInfo = {
|
|
85
|
+
address: formatAddress(to, "hex")
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (parent && parent.to && proxyMap[parent.to] && from === parent.to && to) {
|
|
89
|
+
if (index === 0 && proxyMap[parent.to] === "Proxy" && t.action.callType === "delegatecall") {
|
|
90
|
+
parent.proxy = {
|
|
91
|
+
type: "Proxy",
|
|
92
|
+
implAddress: to
|
|
93
|
+
};
|
|
94
|
+
item.isCallImpl = true;
|
|
95
|
+
}
|
|
96
|
+
const second = list2[1];
|
|
97
|
+
if (index === 0 && proxyMap[parent.to] === "BeaconProxy" && t.action.callType === "staticcall" && second && second.action.to && second.action.from === parent.to && second.action.callType === "delegatecall") {
|
|
98
|
+
parent.proxy = {
|
|
99
|
+
type: "BeaconProxy",
|
|
100
|
+
beaconAddress: to,
|
|
101
|
+
implAddress: second.action.to
|
|
102
|
+
};
|
|
103
|
+
item.isCallBeacon = true;
|
|
104
|
+
second.isCallImpl = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (t.calls) {
|
|
108
|
+
item.calls = formatList(t.calls, item);
|
|
109
|
+
}
|
|
110
|
+
return item;
|
|
111
|
+
};
|
|
112
|
+
const list = formatList(data.traceTree);
|
|
113
|
+
return {
|
|
114
|
+
total,
|
|
115
|
+
list
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
var treeTraceToList = (data, showProxyCall = false) => {
|
|
119
|
+
const result = [];
|
|
120
|
+
const handler = (list) => {
|
|
121
|
+
list.forEach((item) => {
|
|
122
|
+
if (showProxyCall || !item.isCallBeacon && !item.isCallImpl) {
|
|
123
|
+
result.push(item);
|
|
124
|
+
}
|
|
125
|
+
if (item.calls) {
|
|
126
|
+
handler(item.calls);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
handler(data);
|
|
131
|
+
return result;
|
|
132
|
+
};
|
|
133
|
+
var hideProxyCallInTreeTrace = (data) => {
|
|
134
|
+
const handler = (list) => {
|
|
135
|
+
const result = [];
|
|
136
|
+
list.forEach((item) => {
|
|
137
|
+
const newTrace = { ...item };
|
|
138
|
+
if (!newTrace.isCallBeacon && !newTrace.isCallImpl) {
|
|
139
|
+
result.push(newTrace);
|
|
140
|
+
if (newTrace.calls) {
|
|
141
|
+
newTrace.calls = handler(newTrace.calls);
|
|
142
|
+
}
|
|
143
|
+
} else if (newTrace.calls) {
|
|
144
|
+
result.push(...handler(newTrace.calls));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return result;
|
|
148
|
+
};
|
|
149
|
+
return handler(data);
|
|
150
|
+
};
|
|
151
|
+
var useTxTrace = (hash, space) => {
|
|
152
|
+
const url = `/transferTree/${hash}`;
|
|
153
|
+
return useSWRImmutable(
|
|
154
|
+
[url, space],
|
|
155
|
+
() => fetchWithPrefix(url).then((resp) => {
|
|
156
|
+
if (resp?.traceTree) {
|
|
157
|
+
const { list, total } = formatTraceData(resp, space);
|
|
158
|
+
return { list, total };
|
|
159
|
+
}
|
|
160
|
+
}).catch((e) => {
|
|
161
|
+
publishRequestError({ code: 60002, message: e.message }, "code");
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
export {
|
|
166
|
+
hideProxyCallInTreeTrace,
|
|
167
|
+
treeTraceToList,
|
|
168
|
+
useTxTrace
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=useTxTrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useTxTrace.ts"],"sourcesContent":["import useSWRImmutable from 'swr/immutable';\nimport { fetchWithPrefix } from 'src/utils/request';\nimport { publishRequestError } from '../pubsub';\nimport type { AbiFunctionWithoutGas } from 'src/utils/sdk';\nimport { formatABI } from '..';\nimport { formatAddress } from '../address';\nimport { Pocket } from '../request.types';\n\nexport interface TraceAction {\n createType: string;\n callType: string;\n from: string;\n to?: string;\n input?: `0x${string}`;\n value: string;\n gas?: string;\n space: string;\n\n // ↓↓↓↓↓↓↓↓ only for core space ↓↓↓↓↓↓↓↓\n fromPocket?: Pocket;\n toPocket?: Pocket;\n fromSpace?: 'evm' | 'none' | 'native';\n toSpace?: 'evm' | 'none' | 'native';\n}\nexport interface TraceResult {\n addr?: string;\n gasLeft: string;\n outcome: 'success' | 'fail' | 'reverted';\n returnData: `0x${string}`;\n}\n\ninterface ContractInfo {\n address: string;\n isVirtual: boolean;\n verify: {\n result: number;\n };\n}\ninterface TokenInfo {\n address: string;\n decimals: number;\n symbol: string;\n name: string;\n tokenType: string;\n}\n\ninterface NameTagInfo {\n nameTag: string;\n website?: string;\n desc?: string;\n labels?: string[];\n caution?: number;\n}\n\nexport interface OriginTreeTrace {\n calls: OriginTreeTrace[];\n action: TraceAction;\n result?: TraceResult;\n blockHash: string;\n epochHash: string;\n epochNumber: number;\n transactionHash: string;\n transactionPosition: number;\n type: string;\n valid: boolean;\n // added by frontend\n isCallImpl?: boolean;\n}\n\nexport type ProxyType = 'BeaconProxy' | 'Proxy';\n\nexport interface OriginTraceData {\n addressArray: string[];\n contractMap: Record<string, ContractInfo>;\n tokenMap: Record<string, TokenInfo>;\n proxyMap: Record<string, ProxyType>;\n methodMap: Record<string, Record<string, string>>;\n ensMap: Record<\n string,\n {\n name?: string;\n }\n >;\n nameTagMap: Record<string, NameTagInfo>;\n traceTree: OriginTreeTrace[];\n}\n\nexport interface ListTraceForUI {\n index: string;\n type: string;\n from: string;\n to?: string;\n value: string;\n input?: `0x${string}`;\n result?: TraceResult;\n gas?: string;\n isProxyCall?: boolean;\n method?: string;\n contractCreated?: string;\n abi?: AbiFunctionWithoutGas[];\n fromContractInfo: ContractInfo | {};\n toContractInfo: ContractInfo | {};\n fromTokenInfo: TokenInfo | {};\n toTokenInfo: TokenInfo | {};\n fromNameTagInfo?: NameTagInfo;\n toNameTagInfo?: NameTagInfo;\n fromENSInfo?: {\n name?: string;\n };\n toENSInfo?: {\n name?: string;\n };\n proxy?: {\n type: ProxyType;\n beaconAddress?: string;\n implAddress: string;\n };\n isCallBeacon?: boolean;\n isCallImpl?: boolean;\n // only for core space ↓↓↓↓↓↓↓↓\n toESpaceInfo?: {\n address?: string;\n };\n fromESpaceInfo?: {\n address?: string;\n };\n fromPocket?: Pocket;\n toPocket?: Pocket;\n}\n\nexport interface TreeTraceForUI extends ListTraceForUI {\n calls?: TreeTraceForUI[];\n}\n\nconst formatTraceData = (data: OriginTraceData, space: 'evm' | 'core') => {\n const addressType = space === 'core' ? 'base32' : 'hex';\n const contractInfo = data.contractMap || {};\n const tokenInfo = data.tokenMap || {};\n const proxyMap = data.proxyMap || {};\n const nameTagMap = data.nameTagMap || {};\n const ensMap = data.ensMap || {};\n const methodMap = data.methodMap || {};\n\n let total = 0;\n\n const formatList = (\n t: OriginTreeTrace[],\n parent?: TreeTraceForUI,\n ): TreeTraceForUI[] => {\n total += t.length;\n return t.map((item, index) => formatItem(item, index, parent, t));\n };\n const formatItem = (\n t: OriginTreeTrace,\n index: number,\n parent: TreeTraceForUI | undefined,\n list: OriginTreeTrace[],\n ): TreeTraceForUI => {\n const methodId = t.action.input?.slice(0, 10);\n const from = formatAddress(t.action.from, addressType);\n const to = formatAddress(t.action.to, addressType);\n let method = methodId;\n let abi: AbiFunctionWithoutGas[] | undefined = undefined;\n const methodABI = methodId && to ? methodMap[methodId]?.[to] : undefined;\n if (methodABI) {\n try {\n const result = formatABI(`[\"${methodABI}\"]`, {\n json: true,\n allowEmpty: true,\n });\n abi = JSON.parse(result) as AbiFunctionWithoutGas[];\n const jsonABI = abi[0];\n method = jsonABI?.name || methodId;\n } catch (error) {\n console.log('parse method abi error: ', methodABI, error);\n }\n }\n\n const isContractCreated = !!t.action.createType;\n\n const item: TreeTraceForUI = {\n index: `${parent?.index ? `${parent.index}_` : ''}${index}`,\n type: `${t.action.callType || t.type}`,\n from: from,\n to: to,\n input: t.action.input,\n value: t.action.value,\n result: t.result,\n gas: t.action.gas,\n method,\n abi,\n contractCreated: isContractCreated ? t.result?.addr : undefined,\n fromContractInfo: contractInfo[from] || {},\n toContractInfo: contractInfo[to ?? ''] || {},\n fromTokenInfo: tokenInfo[from] || {},\n toTokenInfo: tokenInfo[to ?? ''] || {},\n fromNameTagInfo: nameTagMap[from],\n toNameTagInfo: nameTagMap[to ?? ''],\n fromENSInfo: ensMap[from],\n toENSInfo: ensMap[to ?? ''],\n isCallImpl: t.isCallImpl,\n fromPocket: t.action.fromPocket,\n toPocket: t.action.toPocket,\n };\n if (t.action.fromSpace === 'evm') {\n item.fromESpaceInfo = {\n address: formatAddress(from, 'hex'),\n };\n }\n if (t.action.toSpace === 'evm') {\n item.toESpaceInfo = {\n address: formatAddress(to, 'hex'),\n };\n }\n if (\n parent &&\n parent.to &&\n proxyMap[parent.to] &&\n from === parent.to &&\n to\n ) {\n // proxy call\n if (\n index === 0 &&\n proxyMap[parent.to] === 'Proxy' &&\n t.action.callType === 'delegatecall'\n ) {\n parent.proxy = {\n type: 'Proxy',\n implAddress: to,\n };\n item.isCallImpl = true;\n }\n // beacon proxy call\n const second = list[1];\n if (\n index === 0 &&\n proxyMap[parent.to] === 'BeaconProxy' &&\n t.action.callType === 'staticcall' &&\n second &&\n second.action.to &&\n second.action.from === parent.to &&\n second.action.callType === 'delegatecall'\n ) {\n parent.proxy = {\n type: 'BeaconProxy',\n beaconAddress: to,\n implAddress: second.action.to,\n };\n item.isCallBeacon = true;\n second.isCallImpl = true;\n }\n }\n if (t.calls) {\n item.calls = formatList(t.calls, item);\n }\n return item;\n };\n const list = formatList(data.traceTree);\n return {\n total,\n list,\n };\n};\n\nexport const treeTraceToList = (\n data: TreeTraceForUI[],\n showProxyCall = false,\n) => {\n const result: ListTraceForUI[] = [];\n const handler = (list: TreeTraceForUI[]) => {\n list.forEach(item => {\n if (showProxyCall || (!item.isCallBeacon && !item.isCallImpl)) {\n result.push(item);\n }\n if (item.calls) {\n handler(item.calls);\n }\n });\n };\n handler(data);\n return result;\n};\n\nexport const hideProxyCallInTreeTrace = (data: TreeTraceForUI[]) => {\n const handler = (list: TreeTraceForUI[]) => {\n const result: TreeTraceForUI[] = [];\n list.forEach(item => {\n const newTrace = { ...item };\n if (!newTrace.isCallBeacon && !newTrace.isCallImpl) {\n result.push(newTrace);\n if (newTrace.calls) {\n newTrace.calls = handler(newTrace.calls);\n }\n } else if (newTrace.calls) {\n result.push(...handler(newTrace.calls));\n }\n });\n return result;\n };\n return handler(data);\n};\n\nexport const useTxTrace = (hash: string, space: 'evm' | 'core') => {\n const url = `/transferTree/${hash}`;\n\n return useSWRImmutable([url, space], () =>\n fetchWithPrefix(url)\n .then((resp: any) => {\n if (resp?.traceTree) {\n const { list, total } = formatTraceData(resp, space);\n return { list, total };\n }\n })\n .catch(e => {\n publishRequestError({ code: 60002, message: e.message }, 'code');\n }),\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,qBAAqB;AAsI5B,IAAM,kBAAkB,CAAC,MAAuB,UAA0B;AACxE,QAAM,cAAc,UAAU,SAAS,WAAW;AAClD,QAAM,eAAe,KAAK,eAAe,CAAC;AAC1C,QAAM,YAAY,KAAK,YAAY,CAAC;AACpC,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,aAAa,KAAK,cAAc,CAAC;AACvC,QAAM,SAAS,KAAK,UAAU,CAAC;AAC/B,QAAM,YAAY,KAAK,aAAa,CAAC;AAErC,MAAI,QAAQ;AAEZ,QAAM,aAAa,CACjB,GACA,WACqB;AACrB,aAAS,EAAE;AACX,WAAO,EAAE,IAAI,CAAC,MAAM,UAAU,WAAW,MAAM,OAAO,QAAQ,CAAC,CAAC;AAAA,EAClE;AACA,QAAM,aAAa,CACjB,GACA,OACA,QACAA,UACmB;AACnB,UAAM,WAAW,EAAE,OAAO,OAAO,MAAM,GAAG,EAAE;AAC5C,UAAM,OAAO,cAAc,EAAE,OAAO,MAAM,WAAW;AACrD,UAAM,KAAK,cAAc,EAAE,OAAO,IAAI,WAAW;AACjD,QAAI,SAAS;AACb,QAAI,MAA2C;AAC/C,UAAM,YAAY,YAAY,KAAK,UAAU,QAAQ,IAAI,EAAE,IAAI;AAC/D,QAAI,WAAW;AACb,UAAI;AACF,cAAM,SAAS,UAAU,KAAK,eAAe;AAAA,UAC3C,MAAM;AAAA,UACN,YAAY;AAAA,QACd,CAAC;AACD,cAAM,KAAK,MAAM,MAAM;AACvB,cAAM,UAAU,IAAI,CAAC;AACrB,iBAAS,SAAS,QAAQ;AAAA,MAC5B,SAAS,OAAP;AACA,gBAAQ,IAAI,4BAA4B,WAAW,KAAK;AAAA,MAC1D;AAAA,IACF;AAEA,UAAM,oBAAoB,CAAC,CAAC,EAAE,OAAO;AAErC,UAAM,OAAuB;AAAA,MAC3B,OAAO,GAAG,QAAQ,QAAQ,GAAG,OAAO,WAAW,KAAK;AAAA,MACpD,MAAM,GAAG,EAAE,OAAO,YAAY,EAAE;AAAA,MAChC;AAAA,MACA;AAAA,MACA,OAAO,EAAE,OAAO;AAAA,MAChB,OAAO,EAAE,OAAO;AAAA,MAChB,QAAQ,EAAE;AAAA,MACV,KAAK,EAAE,OAAO;AAAA,MACd;AAAA,MACA;AAAA,MACA,iBAAiB,oBAAoB,EAAE,QAAQ,OAAO;AAAA,MACtD,kBAAkB,aAAa,IAAI,KAAK,CAAC;AAAA,MACzC,gBAAgB,aAAa,MAAM,EAAE,KAAK,CAAC;AAAA,MAC3C,eAAe,UAAU,IAAI,KAAK,CAAC;AAAA,MACnC,aAAa,UAAU,MAAM,EAAE,KAAK,CAAC;AAAA,MACrC,iBAAiB,WAAW,IAAI;AAAA,MAChC,eAAe,WAAW,MAAM,EAAE;AAAA,MAClC,aAAa,OAAO,IAAI;AAAA,MACxB,WAAW,OAAO,MAAM,EAAE;AAAA,MAC1B,YAAY,EAAE;AAAA,MACd,YAAY,EAAE,OAAO;AAAA,MACrB,UAAU,EAAE,OAAO;AAAA,IACrB;AACA,QAAI,EAAE,OAAO,cAAc,OAAO;AAChC,WAAK,iBAAiB;AAAA,QACpB,SAAS,cAAc,MAAM,KAAK;AAAA,MACpC;AAAA,IACF;AACA,QAAI,EAAE,OAAO,YAAY,OAAO;AAC9B,WAAK,eAAe;AAAA,QAClB,SAAS,cAAc,IAAI,KAAK;AAAA,MAClC;AAAA,IACF;AACA,QACE,UACA,OAAO,MACP,SAAS,OAAO,EAAE,KAClB,SAAS,OAAO,MAChB,IACA;AAEA,UACE,UAAU,KACV,SAAS,OAAO,EAAE,MAAM,WACxB,EAAE,OAAO,aAAa,gBACtB;AACA,eAAO,QAAQ;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AACA,aAAK,aAAa;AAAA,MACpB;AAEA,YAAM,SAASA,MAAK,CAAC;AACrB,UACE,UAAU,KACV,SAAS,OAAO,EAAE,MAAM,iBACxB,EAAE,OAAO,aAAa,gBACtB,UACA,OAAO,OAAO,MACd,OAAO,OAAO,SAAS,OAAO,MAC9B,OAAO,OAAO,aAAa,gBAC3B;AACA,eAAO,QAAQ;AAAA,UACb,MAAM;AAAA,UACN,eAAe;AAAA,UACf,aAAa,OAAO,OAAO;AAAA,QAC7B;AACA,aAAK,eAAe;AACpB,eAAO,aAAa;AAAA,MACtB;AAAA,IACF;AACA,QAAI,EAAE,OAAO;AACX,WAAK,QAAQ,WAAW,EAAE,OAAO,IAAI;AAAA,IACvC;AACA,WAAO;AAAA,EACT;AACA,QAAM,OAAO,WAAW,KAAK,SAAS;AACtC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,kBAAkB,CAC7B,MACA,gBAAgB,UACb;AACH,QAAM,SAA2B,CAAC;AAClC,QAAM,UAAU,CAAC,SAA2B;AAC1C,SAAK,QAAQ,UAAQ;AACnB,UAAI,iBAAkB,CAAC,KAAK,gBAAgB,CAAC,KAAK,YAAa;AAC7D,eAAO,KAAK,IAAI;AAAA,MAClB;AACA,UAAI,KAAK,OAAO;AACd,gBAAQ,KAAK,KAAK;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,EACH;AACA,UAAQ,IAAI;AACZ,SAAO;AACT;AAEO,IAAM,2BAA2B,CAAC,SAA2B;AAClE,QAAM,UAAU,CAAC,SAA2B;AAC1C,UAAM,SAA2B,CAAC;AAClC,SAAK,QAAQ,UAAQ;AACnB,YAAM,WAAW,EAAE,GAAG,KAAK;AAC3B,UAAI,CAAC,SAAS,gBAAgB,CAAC,SAAS,YAAY;AAClD,eAAO,KAAK,QAAQ;AACpB,YAAI,SAAS,OAAO;AAClB,mBAAS,QAAQ,QAAQ,SAAS,KAAK;AAAA,QACzC;AAAA,MACF,WAAW,SAAS,OAAO;AACzB,eAAO,KAAK,GAAG,QAAQ,SAAS,KAAK,CAAC;AAAA,MACxC;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,IAAI;AACrB;AAEO,IAAM,aAAa,CAAC,MAAc,UAA0B;AACjE,QAAM,MAAM,iBAAiB;AAE7B,SAAO;AAAA,IAAgB,CAAC,KAAK,KAAK;AAAA,IAAG,MACnC,gBAAgB,GAAG,EAChB,KAAK,CAAC,SAAc;AACnB,UAAI,MAAM,WAAW;AACnB,cAAM,EAAE,MAAM,MAAM,IAAI,gBAAgB,MAAM,KAAK;AACnD,eAAO,EAAE,MAAM,MAAM;AAAA,MACvB;AAAA,IACF,CAAC,EACA,MAAM,OAAK;AACV,0BAAoB,EAAE,MAAM,OAAO,SAAS,EAAE,QAAQ,GAAG,MAAM;AAAA,IACjE,CAAC;AAAA,EACL;AACF;","names":["list"]}
|
package/dist/utils/index.js
CHANGED
|
@@ -52,12 +52,13 @@ import {
|
|
|
52
52
|
transferToLowerCase,
|
|
53
53
|
validURL,
|
|
54
54
|
viewJson
|
|
55
|
-
} from "../chunk-
|
|
56
|
-
import "../chunk-
|
|
57
|
-
import "../chunk-
|
|
55
|
+
} from "../chunk-CPPQCJEV.js";
|
|
56
|
+
import "../chunk-WIB76E7O.js";
|
|
57
|
+
import "../chunk-5EDEEGZK.js";
|
|
58
58
|
import "../chunk-J2I22Q2M.js";
|
|
59
|
-
import "../chunk-
|
|
59
|
+
import "../chunk-YEINMVAR.js";
|
|
60
60
|
import "../chunk-DQGLZCIG.js";
|
|
61
|
+
import "../chunk-WQG2LZMB.js";
|
|
61
62
|
export {
|
|
62
63
|
HIDE_IN_DOT_NET,
|
|
63
64
|
addIPFSGateway,
|
package/dist/utils/media.js
CHANGED
package/dist/utils/pubsub.js
CHANGED
package/dist/utils/request.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseContractInfo, DetectAccountTypeResponse } from './request.types.js';
|
|
1
|
+
import { BaseContractInfo, DetectAccountTypeResponse, MethodAbiItemResponse } from './request.types.js';
|
|
2
2
|
|
|
3
3
|
interface FetchOptions extends RequestInit {
|
|
4
4
|
timeout?: number;
|
|
@@ -8,11 +8,6 @@ declare const appendApiPrefix: (url: string) => string;
|
|
|
8
8
|
declare const fetchWithPrefix: <T>(url: string, opts?: FetchOptions) => Promise<T>;
|
|
9
9
|
declare const fetchWithOpenApi: <T>(url: string, opts?: FetchOptions) => Promise<T>;
|
|
10
10
|
declare const simpleGetFetcher: <T>(...args: any[]) => Promise<T>;
|
|
11
|
-
declare const useSWRWithGetFetcher: (key: string | string[] | null, swrOpts?: {}) => {
|
|
12
|
-
data: any;
|
|
13
|
-
error: any;
|
|
14
|
-
mutate: any;
|
|
15
|
-
};
|
|
16
11
|
type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD';
|
|
17
12
|
interface QueryParams {
|
|
18
13
|
[key: string]: string | undefined;
|
|
@@ -32,5 +27,8 @@ declare const reqNametag: (address: string[]) => Promise<any>;
|
|
|
32
27
|
declare const reqContractAndToken: (address: string[]) => Promise<any>;
|
|
33
28
|
declare const getContractDetail: <T extends string>(contractAddress?: string, fields?: T[]) => Promise<BaseContractInfo & Record<T, unknown>>;
|
|
34
29
|
declare const detectAccountType: (address: string) => Promise<DetectAccountTypeResponse>;
|
|
30
|
+
declare const reqAbiByMethodId: (methodId: string) => Promise<{
|
|
31
|
+
list: MethodAbiItemResponse[];
|
|
32
|
+
}>;
|
|
35
33
|
|
|
36
|
-
export { appendApiPrefix, detectAccountType, fetch, fetchWithOpenApi, fetchWithPrefix, getContractDetail, reqContractAndToken, reqNametag, sendRequestChart, sendRequestENSInfo, sendRequestGasPrice, simpleGetFetcher
|
|
34
|
+
export { appendApiPrefix, detectAccountType, fetch, fetchWithOpenApi, fetchWithPrefix, getContractDetail, reqAbiByMethodId, reqContractAndToken, reqNametag, sendRequestChart, sendRequestENSInfo, sendRequestGasPrice, simpleGetFetcher };
|
package/dist/utils/request.js
CHANGED
|
@@ -5,17 +5,18 @@ import {
|
|
|
5
5
|
fetchWithOpenApi,
|
|
6
6
|
fetchWithPrefix,
|
|
7
7
|
getContractDetail,
|
|
8
|
+
reqAbiByMethodId,
|
|
8
9
|
reqContractAndToken,
|
|
9
10
|
reqNametag,
|
|
10
11
|
sendRequestChart,
|
|
11
12
|
sendRequestENSInfo,
|
|
12
13
|
sendRequestGasPrice,
|
|
13
|
-
simpleGetFetcher
|
|
14
|
-
|
|
15
|
-
} from "../chunk-Z6EYKGBH.js";
|
|
14
|
+
simpleGetFetcher
|
|
15
|
+
} from "../chunk-5EDEEGZK.js";
|
|
16
16
|
import "../chunk-J2I22Q2M.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-YEINMVAR.js";
|
|
18
18
|
import "../chunk-DQGLZCIG.js";
|
|
19
|
+
import "../chunk-WQG2LZMB.js";
|
|
19
20
|
export {
|
|
20
21
|
appendApiPrefix,
|
|
21
22
|
detectAccountType,
|
|
@@ -23,12 +24,12 @@ export {
|
|
|
23
24
|
fetchWithOpenApi,
|
|
24
25
|
fetchWithPrefix,
|
|
25
26
|
getContractDetail,
|
|
27
|
+
reqAbiByMethodId,
|
|
26
28
|
reqContractAndToken,
|
|
27
29
|
reqNametag,
|
|
28
30
|
sendRequestChart,
|
|
29
31
|
sendRequestENSInfo,
|
|
30
32
|
sendRequestGasPrice,
|
|
31
|
-
simpleGetFetcher
|
|
32
|
-
useSWRWithGetFetcher
|
|
33
|
+
simpleGetFetcher
|
|
33
34
|
};
|
|
34
35
|
//# sourceMappingURL=request.js.map
|
|
@@ -34,8 +34,18 @@ interface BaseContractInfo {
|
|
|
34
34
|
exactMatch?: boolean;
|
|
35
35
|
};
|
|
36
36
|
proxy?: Record<string, unknown>;
|
|
37
|
-
beacon?:
|
|
38
|
-
|
|
37
|
+
beacon?: {
|
|
38
|
+
address?: string;
|
|
39
|
+
verify?: {
|
|
40
|
+
exactMatch?: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
implementation?: {
|
|
44
|
+
address?: string;
|
|
45
|
+
verify?: {
|
|
46
|
+
exactMatch?: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
39
49
|
destroy?: {
|
|
40
50
|
status?: number;
|
|
41
51
|
message?: string;
|
|
@@ -51,5 +61,10 @@ interface DetectAccountTypeResponse {
|
|
|
51
61
|
delegatedTo: `0x${string}` | '' | null;
|
|
52
62
|
extraMessage: string;
|
|
53
63
|
}
|
|
64
|
+
interface MethodAbiItemResponse {
|
|
65
|
+
fullName: string;
|
|
66
|
+
formatWithArg?: string;
|
|
67
|
+
}
|
|
68
|
+
type Pocket = 'balance' | 'staking_balance' | 'storage_collateral' | 'sponsor_balance_for_gas' | 'sponsor_balance_for_collateral' | 'mint_or_burn' | 'gas_payment';
|
|
54
69
|
|
|
55
|
-
export { BaseContractInfo, DetectAccountTypeResponse };
|
|
70
|
+
export { BaseContractInfo, DetectAccountTypeResponse, MethodAbiItemResponse, Pocket };
|
package/dist/utils/rpcRequest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/rpcRequest.ts"],"sourcesContent":["import { publishRequestError } from './pubsub';\n\nconst request = async <T>(method: string, ...args: any[]): Promise<T> => {\n const CFX = (window as any).CFX;\n\n try {\n const [namespace, m] = method.split('_');\n // 断言 CFX[namespace][m] 为一个函数,并调用它\n if (namespace && m && typeof CFX[namespace][m] === 'function') {\n return await CFX[namespace][m](...args);\n } else {\n throw new Error(\n `Method ${m} is not a function in namespace ${namespace}`,\n );\n }\n } catch (e: unknown) {\n if (e instanceof Error) {\n publishRequestError(e, 'rpc');\n } else {\n console.error('Unexpected error', e);\n }\n throw e;\n }\n};\n\nexport const getAccount = async (...args: unknown[]) => {\n try {\n return request('cfx_getAccount', ...args);\n } catch (e) {\n throw e;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/rpcRequest.ts"],"sourcesContent":["import { publishRequestError } from './pubsub';\n\nconst request = async <T>(method: string, ...args: any[]): Promise<T> => {\n const CFX = (window as any).CFX;\n\n try {\n const [namespace, m] = method.split('_');\n // 断言 CFX[namespace][m] 为一个函数,并调用它\n if (namespace && m && typeof CFX[namespace][m] === 'function') {\n return await CFX[namespace][m](...args);\n } else {\n throw new Error(\n `Method ${m} is not a function in namespace ${namespace}`,\n );\n }\n } catch (e: unknown) {\n if (e instanceof Error) {\n publishRequestError(e, 'rpc');\n } else {\n console.error('Unexpected error', e);\n }\n throw e;\n }\n};\n\nexport const getAccount = async (...args: unknown[]) => {\n try {\n return request('cfx_getAccount', ...args);\n } catch (e) {\n throw e;\n }\n};\n"],"mappings":";;;;;;;AAEA,IAAM,UAAU,OAAU,WAAmB,SAA4B;AACvE,QAAM,MAAO,OAAe;AAE5B,MAAI;AACF,UAAM,CAAC,WAAW,CAAC,IAAI,OAAO,MAAM,GAAG;AAEvC,QAAI,aAAa,KAAK,OAAO,IAAI,SAAS,EAAE,CAAC,MAAM,YAAY;AAC7D,aAAO,MAAM,IAAI,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI;AAAA,IACxC,OAAO;AACL,YAAM,IAAI;AAAA,QACR,UAAU,oCAAoC;AAAA,MAChD;AAAA,IACF;AAAA,EACF,SAAS,GAAP;AACA,QAAI,aAAa,OAAO;AACtB,0BAAoB,GAAG,KAAK;AAAA,IAC9B,OAAO;AACL,cAAQ,MAAM,oBAAoB,CAAC;AAAA,IACrC;AACA,UAAM;AAAA,EACR;AACF;AAEO,IAAM,aAAa,UAAU,SAAoB;AACtD,MAAI;AACF,WAAO,QAAQ,kBAAkB,GAAG,IAAI;AAAA,EAC1C,SAAS,GAAP;AACA,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Abi, AbiItem } from 'viem';
|
|
2
|
+
export { AbiItem, AbiParameter, AbiStateMutability, getAbiItem } from 'viem';
|
|
3
|
+
|
|
4
|
+
declare const decodeFunctionData: ({ data, abi, space, }: {
|
|
5
|
+
data: `0x${string}`;
|
|
6
|
+
abi: Abi;
|
|
7
|
+
space: 'evm' | 'core';
|
|
8
|
+
}) => {
|
|
9
|
+
args: readonly unknown[] | undefined;
|
|
10
|
+
functionName: string;
|
|
11
|
+
};
|
|
12
|
+
declare const decodeFunctionResult: ({ data, abi, functionName, space, }: {
|
|
13
|
+
data: `0x${string}`;
|
|
14
|
+
functionName: string;
|
|
15
|
+
abi: Abi;
|
|
16
|
+
space: 'evm' | 'core';
|
|
17
|
+
}) => unknown;
|
|
18
|
+
declare const decodeErrorResult: ({ data, abi, space, }: {
|
|
19
|
+
data: `0x${string}`;
|
|
20
|
+
abi: Abi;
|
|
21
|
+
space: 'evm' | 'core';
|
|
22
|
+
}) => {
|
|
23
|
+
abiItem: AbiItem;
|
|
24
|
+
args: readonly unknown[] | undefined;
|
|
25
|
+
errorName: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AbiError = AbiItem & {
|
|
29
|
+
type: 'error';
|
|
30
|
+
};
|
|
31
|
+
type AbiFunctionWithoutGas = Omit<AbiItem & {
|
|
32
|
+
type: 'function';
|
|
33
|
+
}, 'gas'>;
|
|
34
|
+
|
|
35
|
+
export { AbiError, AbiFunctionWithoutGas, decodeErrorResult, decodeFunctionData, decodeFunctionResult };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decodeErrorResult,
|
|
3
|
+
decodeFunctionData,
|
|
4
|
+
decodeFunctionResult
|
|
5
|
+
} from "../chunk-6SXAFSBF.js";
|
|
6
|
+
import {
|
|
7
|
+
getAbiItem
|
|
8
|
+
} from "../chunk-JIRLY7OG.js";
|
|
9
|
+
import "../chunk-4B6ASBYQ.js";
|
|
10
|
+
import "../chunk-WIB76E7O.js";
|
|
11
|
+
import "../chunk-DQGLZCIG.js";
|
|
12
|
+
import "../chunk-WQG2LZMB.js";
|
|
13
|
+
export {
|
|
14
|
+
decodeErrorResult,
|
|
15
|
+
decodeFunctionData,
|
|
16
|
+
decodeFunctionResult,
|
|
17
|
+
getAbiItem
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfxjs/sirius-next-common",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**"
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@cfx-kit/ui-components": "^0.0.18",
|
|
20
20
|
"@radix-ui/react-radio-group": "^1.2.3",
|
|
21
21
|
"@radix-ui/react-select": "^2.0.0",
|
|
22
|
+
"@rc-component/table": "1.9.1",
|
|
22
23
|
"@testing-library/react": "^15.0.5",
|
|
23
24
|
"@types/i18next": "^13.0.0",
|
|
24
25
|
"@types/lodash": "^4.17.0",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"ace-builds": "1.4.12",
|
|
30
31
|
"bignumber.js": "^9.1.2",
|
|
31
32
|
"clsx": "^2.1.0",
|
|
33
|
+
"cive": "^0.8.1",
|
|
32
34
|
"copyfiles": "^2.4.1",
|
|
33
35
|
"dayjs": "^1.11.10",
|
|
34
36
|
"ethers": "5.7.0",
|
|
@@ -48,9 +50,10 @@
|
|
|
48
50
|
"react-merge-refs": "3.0.2",
|
|
49
51
|
"react-router-dom": "^5.1.2",
|
|
50
52
|
"react-use": "^17.5.0",
|
|
51
|
-
"swr": "
|
|
53
|
+
"swr": "2.2.5",
|
|
52
54
|
"tailwind-merge": "^2.3.0",
|
|
53
55
|
"unocss-preset-animations": "^1.0.2",
|
|
56
|
+
"viem": "^2.40.3",
|
|
54
57
|
"vite": "^5.1.6",
|
|
55
58
|
"zustand": "^4.5.2"
|
|
56
59
|
},
|
|
@@ -75,9 +78,9 @@
|
|
|
75
78
|
"typescript": "^5.4.2",
|
|
76
79
|
"unocss": "0.58.6",
|
|
77
80
|
"vitest": "3.2.3",
|
|
78
|
-
"@cfxjs/sirius-next-
|
|
79
|
-
"@cfxjs/sirius-next-
|
|
80
|
-
"@cfxjs/sirius-next-
|
|
81
|
+
"@cfxjs/sirius-next-eslint-config": "0.0.0",
|
|
82
|
+
"@cfxjs/sirius-next-i18n": "0.2.9",
|
|
83
|
+
"@cfxjs/sirius-next-typescript-config": "0.0.0"
|
|
81
84
|
},
|
|
82
85
|
"publishConfig": {
|
|
83
86
|
"access": "public"
|