@cfxjs/sirius-next-common 0.2.29 → 0.3.1
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/{ccip-DBSI27GO.js → ccip-4OIZJRM7.js} +3 -3
- package/dist/chunk-267JWZ3X.js +20 -0
- package/dist/chunk-267JWZ3X.js.map +1 -0
- package/dist/{chunk-WIB76E7O.js → chunk-2MY3T2VH.js} +2 -2
- package/dist/{chunk-CTHYDPXG.js → chunk-3CY7SRAN.js} +7 -7
- package/dist/{chunk-RP23W2AA.js → chunk-4QR5LKPG.js} +3 -3
- package/dist/{chunk-XZ7IV2FF.js → chunk-4WLXG7ZY.js} +2 -2
- package/dist/{chunk-YOI54A6M.js → chunk-5DFWDFAH.js} +2 -2
- package/dist/{chunk-XMBEB34D.js → chunk-5PYC44RX.js} +2 -2
- package/dist/{chunk-5H6N5Q5P.js → chunk-63ULYLAC.js} +3 -3
- package/dist/chunk-6JLI3Y4J.js +159 -0
- package/dist/chunk-6JLI3Y4J.js.map +1 -0
- package/dist/chunk-6JXQS4XH.js +14 -0
- package/dist/chunk-6JXQS4XH.js.map +1 -0
- package/dist/{chunk-RFN3GPMD.js → chunk-7BAN6GKP.js} +4 -4
- package/dist/chunk-7HK6APFZ.js +28 -0
- package/dist/chunk-7HK6APFZ.js.map +1 -0
- package/dist/{chunk-HBJOTRGP.js → chunk-7NVZPYT3.js} +2 -2
- package/dist/chunk-A3VDKIWS.js +60 -0
- package/dist/chunk-A3VDKIWS.js.map +1 -0
- package/dist/{chunk-H5ZIEB6Y.js → chunk-A4QSFRUF.js} +51 -25
- package/dist/chunk-A4QSFRUF.js.map +1 -0
- package/dist/{chunk-3LFAB7KP.js → chunk-A64ILFRR.js} +5 -5
- package/dist/{chunk-J3GK2LUK.js → chunk-A7LX3FWL.js} +8 -8
- package/dist/{chunk-CQ7PIGKY.js → chunk-AJB2BZ6T.js} +2 -2
- package/dist/{secp256k1-WGKMGTUQ.js → chunk-CGDNDBBP.js} +8 -7
- package/dist/{secp256k1-WGKMGTUQ.js.map → chunk-CGDNDBBP.js.map} +1 -1
- package/dist/{chunk-337L4DV3.js → chunk-CMM72NR3.js} +3 -3
- package/dist/{chunk-Z2UXDMUA.js → chunk-CWTDFCRF.js} +3 -3
- package/dist/{chunk-G6N3L7XQ.js → chunk-D6INJ4N5.js} +7 -5
- package/dist/chunk-D6INJ4N5.js.map +1 -0
- package/dist/{chunk-473ZUYVX.js → chunk-EN25IHGP.js} +3 -3
- package/dist/{chunk-5FNTPYWO.js → chunk-EZVQ6JRV.js} +3 -3
- package/dist/{chunk-S7FVSBBH.js → chunk-FGUCFE4W.js} +2 -2
- package/dist/chunk-FLFDRCTI.js +21490 -0
- package/dist/chunk-FLFDRCTI.js.map +1 -0
- package/dist/{chunk-OSFR346H.js → chunk-FOQ3VNZS.js} +15 -11
- package/dist/chunk-FOQ3VNZS.js.map +1 -0
- package/dist/{chunk-Z7YF2BJY.js → chunk-G56ZGF4A.js} +2 -2
- package/dist/chunk-GNOB77UA.js +14 -0
- package/dist/chunk-GNOB77UA.js.map +1 -0
- package/dist/{chunk-5ZPPSS5X.js → chunk-IKPPUNBU.js} +2 -2
- package/dist/{chunk-VIXYY5CK.js → chunk-IXMDBWQH.js} +2 -2
- package/dist/{chunk-G7UHBRGA.js → chunk-J6WXTCBD.js} +5 -5
- package/dist/chunk-J6WXTCBD.js.map +1 -0
- package/dist/chunk-JLEQ7K57.js +23 -0
- package/dist/chunk-JLEQ7K57.js.map +1 -0
- package/dist/{chunk-DQGLZCIG.js → chunk-L4AFJGXJ.js} +1 -1
- package/dist/{chunk-DQGLZCIG.js.map → chunk-L4AFJGXJ.js.map} +1 -1
- package/dist/{chunk-4B6ASBYQ.js → chunk-LBAEFEJU.js} +10 -1
- package/dist/{chunk-4B6ASBYQ.js.map → chunk-LBAEFEJU.js.map} +1 -1
- package/dist/{chunk-I5YTFVQB.js → chunk-NDGJLSZN.js} +2 -2
- package/dist/chunk-NSSKV676.js +50 -0
- package/dist/chunk-NSSKV676.js.map +1 -0
- package/dist/{chunk-MOVBVQ73.js → chunk-NZ32DWUZ.js} +6 -6
- package/dist/{chunk-IKP2BVXN.js → chunk-OVWRJMGS.js} +9 -9
- package/dist/chunk-PCTL7FBZ.js +10 -0
- package/dist/chunk-PCTL7FBZ.js.map +1 -0
- package/dist/{chunk-JIRLY7OG.js → chunk-S6O6Q2GQ.js} +1735 -174
- package/dist/chunk-S6O6Q2GQ.js.map +1 -0
- package/dist/{chunk-MKBKASBZ.js → chunk-SCTG3SCG.js} +3 -3
- package/dist/{chunk-RM25O3LE.js → chunk-SEIHZVZU.js} +2 -2
- package/dist/{chunk-X4VWQ2HL.js → chunk-SFULLYYL.js} +5 -5
- package/dist/{chunk-W2CLMFMA.js → chunk-T5IOTGTQ.js} +4 -4
- package/dist/{chunk-IW36ZVPL.js → chunk-UARYZ4C2.js} +2 -2
- package/dist/chunk-VRA7CSHI.js +132 -0
- package/dist/chunk-VRA7CSHI.js.map +1 -0
- package/dist/{chunk-5L5VDFFK.js → chunk-VSVZWF66.js} +6 -6
- package/dist/chunk-VYI4IZMQ.js +9448 -0
- package/dist/chunk-VYI4IZMQ.js.map +1 -0
- package/dist/{chunk-EMY3TQJY.js → chunk-WJPIKXWT.js} +2 -2
- package/dist/{chunk-YZP2WZRW.js → chunk-WZ6MS4XP.js} +9 -9
- package/dist/{chunk-Y7OVL5US.js → chunk-XCLT7DP4.js} +2 -2
- package/dist/{chunk-H2HTJNMZ.js → chunk-XN2TDIIK.js} +2 -2
- package/dist/{chunk-IUFQJFZW.js → chunk-XQ246UQW.js} +11 -10
- package/dist/chunk-XQ246UQW.js.map +1 -0
- package/dist/chunk-Y362QJNT.js +65 -0
- package/dist/chunk-Y362QJNT.js.map +1 -0
- package/dist/chunk-YEJRYVZ3.js +167 -0
- package/dist/chunk-YEJRYVZ3.js.map +1 -0
- package/dist/{chunk-J2I22Q2M.js → chunk-ZZLGINAC.js} +2 -2
- package/dist/components/AAFailedReason/index.js +13 -11
- package/dist/components/AAFailedReason/index.js.map +1 -1
- package/dist/components/AceEditor/index.js +7 -7
- package/dist/components/AddressContainer/CoreAddressContainer.js +13 -13
- package/dist/components/AddressContainer/EVMAddressContainer.js +12 -12
- package/dist/components/AddressContainer/addressSwitcher.js +10 -10
- package/dist/components/AddressContainer/addressView.js +9 -9
- package/dist/components/AddressContainer/label.js +6 -6
- package/dist/components/AddressContainer/utils.js +6 -6
- package/dist/components/Age/index.js +7 -7
- package/dist/components/AutoComplete/index.js +6 -6
- package/dist/components/Charts/ChartOptions.js +2 -2
- package/dist/components/Charts/PreviewChartTemplate.js +4 -4
- package/dist/components/Charts/PreviewTitle.js +2 -2
- package/dist/components/Charts/StockChartTemplate.js +4 -4
- package/dist/components/Collapse/index.d.ts +31 -0
- package/dist/components/Collapse/index.js +105 -0
- package/dist/components/Collapse/index.js.map +1 -0
- package/dist/components/ContractAbi/Error.d.ts +8 -0
- package/dist/components/ContractAbi/Error.js +8 -0
- package/dist/components/ContractAbi/Error.js.map +1 -0
- package/dist/components/ContractAbi/FuncBody.d.ts +9 -0
- package/dist/components/ContractAbi/FuncBody.js +8 -0
- package/dist/components/ContractAbi/FuncBody.js.map +1 -0
- package/dist/components/ContractAbi/FuncResponse.d.ts +13 -0
- package/dist/components/ContractAbi/FuncResponse.js +8 -0
- package/dist/components/ContractAbi/FuncResponse.js.map +1 -0
- package/dist/components/ContractAbi/IntValueFormatter.d.ts +9 -0
- package/dist/components/ContractAbi/IntValueFormatter.js +18 -0
- package/dist/components/ContractAbi/IntValueFormatter.js.map +1 -0
- package/dist/components/ContractAbi/OutputParams.d.ts +11 -0
- package/dist/components/ContractAbi/OutputParams.js +8 -0
- package/dist/components/ContractAbi/OutputParams.js.map +1 -0
- package/dist/components/ContractAbi/ParamTitle.d.ts +13 -0
- package/dist/components/ContractAbi/ParamTitle.js +20 -0
- package/dist/components/ContractAbi/ParamTitle.js.map +1 -0
- package/dist/components/ContractAbi/constants.d.ts +9 -0
- package/dist/components/ContractAbi/constants.js +10 -0
- package/dist/components/ContractAbi/constants.js.map +1 -0
- package/dist/components/ContractAbi/index.d.ts +10 -0
- package/dist/components/ContractAbi/index.js +52 -0
- package/dist/components/ContractAbi/index.js.map +1 -0
- package/dist/components/ContractAbi/utils.d.ts +9 -0
- package/dist/components/ContractAbi/utils.js +14 -0
- package/dist/components/ContractAbi/utils.js.map +1 -0
- package/dist/components/CookieTip/index.js +2 -2
- package/dist/components/CopyButton/index.d.ts +5 -2
- package/dist/components/CopyButton/index.js +50 -33
- package/dist/components/CopyButton/index.js.map +1 -1
- package/dist/components/DecimalsSelect/index.js +8 -131
- package/dist/components/DecimalsSelect/index.js.map +1 -1
- package/dist/components/DownloadCSV/index.js +7 -7
- package/dist/components/Empty/index.js +2 -2
- package/dist/components/GasPriceDropdown/index.js +5 -5
- package/dist/components/Highlight/index.d.ts +1 -1
- package/dist/components/Highlight/index.js +2 -2
- package/dist/components/Highlight/index.js.map +1 -1
- package/dist/components/IncreasePercent/index.js +5 -5
- package/dist/components/InfoIconWithTooltip/index.js +7 -7
- package/dist/components/InputData/AddressLabel.js +11 -11
- package/dist/components/InputData/ContractDetail.js +8 -8
- package/dist/components/InputData/FunctionName.d.ts +2 -0
- package/dist/components/InputData/JsonDecode.d.ts +2 -0
- package/dist/components/InputData/JsonDecode.js +8 -8
- package/dist/components/InputData/OptimizationDecode.d.ts +4 -1
- package/dist/components/InputData/OptimizationDecode.js +15 -15
- package/dist/components/InputData/Original.d.ts +2 -1
- package/dist/components/InputData/Original.js +7 -1
- package/dist/components/InputData/UTF8.js +6 -6
- package/dist/components/InputData/index.d.ts +2 -0
- package/dist/components/InputData/index.js +20 -20
- package/dist/components/List/index.js +3 -3
- package/dist/components/Modal/index.js +6 -6
- package/dist/components/NetworkIcon/index.js +5 -5
- package/dist/components/OutputData/ErrorDecode.d.ts +10 -6
- package/dist/components/OutputData/ErrorDecode.js +26 -24
- package/dist/components/OutputData/index.d.ts +2 -0
- package/dist/components/OutputData/index.js +28 -26
- package/dist/components/PhishingAddressContainer/index.js +7 -7
- package/dist/components/Popover/index.js +6 -6
- package/dist/components/Price/index.js +6 -6
- package/dist/components/ProxyContractAddress/index.d.ts +2 -0
- package/dist/components/ProxyContractAddress/index.js +9 -9
- package/dist/components/Radio/index.js +5 -5
- package/dist/components/Remark/index.js +1 -1
- package/dist/components/SearchInput/index.js +7 -7
- package/dist/components/Select/index.js +7 -7
- package/dist/components/Select/select.js +6 -6
- package/dist/components/SmartAccountAddress/index.js +9 -9
- package/dist/components/Table/index.js +3 -3
- package/dist/components/Text/index.js +7 -7
- package/dist/components/Tooltip/index.js +6 -6
- package/dist/components/TransactionAction/coreTransactionAction.js +13 -13
- package/dist/components/TransactionAction/evmTransactionAction.js +12 -12
- package/dist/components/TransactionTrace/TraceDetail.d.ts +2 -0
- package/dist/components/TransactionTrace/TraceDetail.js +36 -34
- package/dist/components/TransactionTrace/TreeTraceTable.d.ts +2 -0
- package/dist/components/TransactionTrace/TreeTraceTable.js +39 -37
- package/dist/components/TransactionTrace/index.d.ts +2 -0
- package/dist/components/TransactionTrace/index.js +39 -37
- package/dist/secp256k1-2GKRGI5Q.js +17 -0
- package/dist/secp256k1-2GKRGI5Q.js.map +1 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/two-arrow-VZ3CKZHM.png +0 -0
- package/dist/uno.css +40 -4
- package/dist/utils/address.js +5 -5
- package/dist/utils/cive-plugins.d.ts +22 -0
- package/dist/utils/cive-plugins.js +17 -0
- package/dist/utils/cive-plugins.js.map +1 -0
- package/dist/utils/constants.js +2 -2
- package/dist/utils/contractManagerTool.js +5 -5
- package/dist/utils/hooks/useAbiItemById.js +4 -4
- package/dist/utils/hooks/useAddressLabel.js +6 -6
- package/dist/utils/hooks/useAddressNameMap.js +4 -4
- package/dist/utils/hooks/useAge.js +2 -2
- package/dist/utils/hooks/useAutoSetHolderFilterParams.js +5 -5
- package/dist/utils/hooks/useContractDetail.js +4 -4
- package/dist/utils/hooks/useDecodeFunctionData.d.ts +3 -1
- package/dist/utils/hooks/useDecodeFunctionData.js +15 -11
- package/dist/utils/hooks/useDecodeFunctionError.d.ts +9 -7
- package/dist/utils/hooks/useDecodeFunctionError.js +13 -11
- package/dist/utils/hooks/useDecodedDataType.d.ts +2 -0
- package/dist/utils/hooks/useENS.js +6 -6
- package/dist/utils/hooks/useEnhanceDataWithNameMap.js +4 -4
- package/dist/utils/hooks/useMethodAbi.js +4 -4
- package/dist/utils/hooks/useSimulateTrace.d.ts +71 -0
- package/dist/utils/hooks/useSimulateTrace.js +185 -0
- package/dist/utils/hooks/useSimulateTrace.js.map +1 -0
- package/dist/utils/hooks/useTableData.js +3 -3
- package/dist/utils/hooks/useTxTrace.d.ts +10 -3
- package/dist/utils/hooks/useTxTrace.js +16 -146
- package/dist/utils/hooks/useTxTrace.js.map +1 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +7 -5
- package/dist/utils/pubsub.js +2 -2
- package/dist/utils/request.js +3 -3
- package/dist/utils/rpcRequest.js +2 -2
- package/dist/utils/sdk.d.ts +34 -9
- package/dist/utils/sdk.js +17 -7
- package/package.json +5 -2
- package/dist/chunk-5AM5HM3B.js +0 -10
- package/dist/chunk-5AM5HM3B.js.map +0 -1
- package/dist/chunk-6SXAFSBF.js +0 -1032
- package/dist/chunk-6SXAFSBF.js.map +0 -1
- package/dist/chunk-G6N3L7XQ.js.map +0 -1
- package/dist/chunk-G7UHBRGA.js.map +0 -1
- package/dist/chunk-H5ZIEB6Y.js.map +0 -1
- package/dist/chunk-IUFQJFZW.js.map +0 -1
- package/dist/chunk-JIRLY7OG.js.map +0 -1
- package/dist/chunk-OSFR346H.js.map +0 -1
- package/dist/chunk-SK75VWEO.js +0 -157
- package/dist/chunk-SK75VWEO.js.map +0 -1
- /package/dist/{ccip-DBSI27GO.js.map → ccip-4OIZJRM7.js.map} +0 -0
- /package/dist/{chunk-WIB76E7O.js.map → chunk-2MY3T2VH.js.map} +0 -0
- /package/dist/{chunk-CTHYDPXG.js.map → chunk-3CY7SRAN.js.map} +0 -0
- /package/dist/{chunk-RP23W2AA.js.map → chunk-4QR5LKPG.js.map} +0 -0
- /package/dist/{chunk-XZ7IV2FF.js.map → chunk-4WLXG7ZY.js.map} +0 -0
- /package/dist/{chunk-YOI54A6M.js.map → chunk-5DFWDFAH.js.map} +0 -0
- /package/dist/{chunk-XMBEB34D.js.map → chunk-5PYC44RX.js.map} +0 -0
- /package/dist/{chunk-5H6N5Q5P.js.map → chunk-63ULYLAC.js.map} +0 -0
- /package/dist/{chunk-RFN3GPMD.js.map → chunk-7BAN6GKP.js.map} +0 -0
- /package/dist/{chunk-HBJOTRGP.js.map → chunk-7NVZPYT3.js.map} +0 -0
- /package/dist/{chunk-3LFAB7KP.js.map → chunk-A64ILFRR.js.map} +0 -0
- /package/dist/{chunk-J3GK2LUK.js.map → chunk-A7LX3FWL.js.map} +0 -0
- /package/dist/{chunk-CQ7PIGKY.js.map → chunk-AJB2BZ6T.js.map} +0 -0
- /package/dist/{chunk-337L4DV3.js.map → chunk-CMM72NR3.js.map} +0 -0
- /package/dist/{chunk-Z2UXDMUA.js.map → chunk-CWTDFCRF.js.map} +0 -0
- /package/dist/{chunk-473ZUYVX.js.map → chunk-EN25IHGP.js.map} +0 -0
- /package/dist/{chunk-5FNTPYWO.js.map → chunk-EZVQ6JRV.js.map} +0 -0
- /package/dist/{chunk-S7FVSBBH.js.map → chunk-FGUCFE4W.js.map} +0 -0
- /package/dist/{chunk-Z7YF2BJY.js.map → chunk-G56ZGF4A.js.map} +0 -0
- /package/dist/{chunk-5ZPPSS5X.js.map → chunk-IKPPUNBU.js.map} +0 -0
- /package/dist/{chunk-VIXYY5CK.js.map → chunk-IXMDBWQH.js.map} +0 -0
- /package/dist/{chunk-I5YTFVQB.js.map → chunk-NDGJLSZN.js.map} +0 -0
- /package/dist/{chunk-MOVBVQ73.js.map → chunk-NZ32DWUZ.js.map} +0 -0
- /package/dist/{chunk-IKP2BVXN.js.map → chunk-OVWRJMGS.js.map} +0 -0
- /package/dist/{chunk-MKBKASBZ.js.map → chunk-SCTG3SCG.js.map} +0 -0
- /package/dist/{chunk-RM25O3LE.js.map → chunk-SEIHZVZU.js.map} +0 -0
- /package/dist/{chunk-X4VWQ2HL.js.map → chunk-SFULLYYL.js.map} +0 -0
- /package/dist/{chunk-W2CLMFMA.js.map → chunk-T5IOTGTQ.js.map} +0 -0
- /package/dist/{chunk-IW36ZVPL.js.map → chunk-UARYZ4C2.js.map} +0 -0
- /package/dist/{chunk-5L5VDFFK.js.map → chunk-VSVZWF66.js.map} +0 -0
- /package/dist/{chunk-EMY3TQJY.js.map → chunk-WJPIKXWT.js.map} +0 -0
- /package/dist/{chunk-YZP2WZRW.js.map → chunk-WZ6MS4XP.js.map} +0 -0
- /package/dist/{chunk-Y7OVL5US.js.map → chunk-XCLT7DP4.js.map} +0 -0
- /package/dist/{chunk-H2HTJNMZ.js.map → chunk-XN2TDIIK.js.map} +0 -0
- /package/dist/{chunk-J2I22Q2M.js.map → chunk-ZZLGINAC.js.map} +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import { ProxyType, TreeTraceForUI } from './useTxTrace.js';
|
|
3
|
+
import { AddressNameMap } from '../request.types.js';
|
|
4
|
+
import { Space } from '../sdk.js';
|
|
5
|
+
import 'viem';
|
|
6
|
+
import 'cive/accounts';
|
|
7
|
+
import 'cive';
|
|
8
|
+
|
|
9
|
+
interface SimulateLog {
|
|
10
|
+
address: string;
|
|
11
|
+
topics: string[];
|
|
12
|
+
data: string;
|
|
13
|
+
transactionLogIndex?: number;
|
|
14
|
+
}
|
|
15
|
+
interface SimulateTraceCall {
|
|
16
|
+
from: string;
|
|
17
|
+
to: string;
|
|
18
|
+
gas: string;
|
|
19
|
+
gasUsed: string;
|
|
20
|
+
input: `0x${string}`;
|
|
21
|
+
output?: `0x${string}`;
|
|
22
|
+
value: string;
|
|
23
|
+
type: string;
|
|
24
|
+
error?: string;
|
|
25
|
+
calls?: SimulateTraceCall[];
|
|
26
|
+
isCallImpl?: boolean;
|
|
27
|
+
logs?: SimulateLog[];
|
|
28
|
+
}
|
|
29
|
+
interface SimulateTraceResponse {
|
|
30
|
+
traceCall: SimulateTraceCall;
|
|
31
|
+
addressArray: string[];
|
|
32
|
+
authMap?: Record<string, string>;
|
|
33
|
+
proxyMap?: Record<string, ProxyType>;
|
|
34
|
+
methodMap?: Record<string, Record<string, string>>;
|
|
35
|
+
nameMap?: Record<string, AddressNameMap>;
|
|
36
|
+
}
|
|
37
|
+
interface SimulateTraceTxParams {
|
|
38
|
+
from?: string;
|
|
39
|
+
to?: string;
|
|
40
|
+
value?: string;
|
|
41
|
+
data?: string;
|
|
42
|
+
gas?: string;
|
|
43
|
+
gasPrice?: string;
|
|
44
|
+
maxFeePerGas?: string;
|
|
45
|
+
space: Exclude<Space, 'core'>;
|
|
46
|
+
}
|
|
47
|
+
interface SimulateTraceConfig {
|
|
48
|
+
tracer: 'callTracer';
|
|
49
|
+
tracerConfig?: {
|
|
50
|
+
disableStorage?: boolean;
|
|
51
|
+
disableStack?: boolean;
|
|
52
|
+
enableMemory?: boolean;
|
|
53
|
+
enableReturnData?: boolean;
|
|
54
|
+
onlyTopCall?: boolean;
|
|
55
|
+
withLog?: boolean;
|
|
56
|
+
timeout?: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
declare const querySimulateTrace: (tx: SimulateTraceTxParams, tag?: string, params?: SimulateTraceConfig) => Promise<SimulateTraceResponse>;
|
|
60
|
+
declare const useSimulateTrace: (simulateTx: SimulateTraceTxParams, tag?: string, params?: SimulateTraceConfig) => swr.SWRResponse<{
|
|
61
|
+
total: number;
|
|
62
|
+
list: TreeTraceForUI[];
|
|
63
|
+
logs: {
|
|
64
|
+
transactionLogIndex: number;
|
|
65
|
+
address: string;
|
|
66
|
+
topics: string[];
|
|
67
|
+
data: string;
|
|
68
|
+
}[];
|
|
69
|
+
} | undefined, any, any>;
|
|
70
|
+
|
|
71
|
+
export { SimulateLog, SimulateTraceConfig, SimulateTraceResponse, SimulateTraceTxParams, querySimulateTrace, useSimulateTrace };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isCreateCall,
|
|
3
|
+
isDelegateCall,
|
|
4
|
+
isStaticCall
|
|
5
|
+
} from "../../chunk-6JLI3Y4J.js";
|
|
6
|
+
import {
|
|
7
|
+
estimateGas
|
|
8
|
+
} from "../../chunk-FLFDRCTI.js";
|
|
9
|
+
import "../../chunk-VYI4IZMQ.js";
|
|
10
|
+
import "../../chunk-CGDNDBBP.js";
|
|
11
|
+
import "../../chunk-S6O6Q2GQ.js";
|
|
12
|
+
import "../../chunk-LBAEFEJU.js";
|
|
13
|
+
import "../../chunk-5TGK2EA2.js";
|
|
14
|
+
import "../../chunk-ADNS57X5.js";
|
|
15
|
+
import {
|
|
16
|
+
formatAddress
|
|
17
|
+
} from "../../chunk-4QR5LKPG.js";
|
|
18
|
+
import {
|
|
19
|
+
formatABI,
|
|
20
|
+
generateRandomId
|
|
21
|
+
} from "../../chunk-D6INJ4N5.js";
|
|
22
|
+
import "../../chunk-2MY3T2VH.js";
|
|
23
|
+
import {
|
|
24
|
+
fetchWithPrefix
|
|
25
|
+
} from "../../chunk-EN25IHGP.js";
|
|
26
|
+
import "../../chunk-ZZLGINAC.js";
|
|
27
|
+
import "../../chunk-YEINMVAR.js";
|
|
28
|
+
import "../../chunk-L4AFJGXJ.js";
|
|
29
|
+
import "../../chunk-WQG2LZMB.js";
|
|
30
|
+
|
|
31
|
+
// src/utils/hooks/useSimulateTrace.ts
|
|
32
|
+
import useSWRImmutable from "swr/immutable";
|
|
33
|
+
import BigNumber from "bignumber.js";
|
|
34
|
+
var formatSimulateTraceData = (data, space) => {
|
|
35
|
+
const addressType = space === "core" ? "base32" : "hex";
|
|
36
|
+
const proxyMap = data.proxyMap || {};
|
|
37
|
+
const methodMap = data.methodMap || {};
|
|
38
|
+
const nameMap = data.nameMap || {};
|
|
39
|
+
const authMap = data.authMap || {};
|
|
40
|
+
let total = 0;
|
|
41
|
+
const logs = [];
|
|
42
|
+
const formatList = (t, parent) => {
|
|
43
|
+
total += t.length;
|
|
44
|
+
return t.map((item, index) => formatItem(item, index, parent, t));
|
|
45
|
+
};
|
|
46
|
+
const formatItem = (t, index, parent, list2) => {
|
|
47
|
+
if (t.logs) {
|
|
48
|
+
logs.push(...t.logs);
|
|
49
|
+
}
|
|
50
|
+
const type = t.type?.toLowerCase();
|
|
51
|
+
const isContractCreated = isCreateCall(type);
|
|
52
|
+
const methodId = t.input?.slice(0, 10);
|
|
53
|
+
const from = formatAddress(t.from, addressType);
|
|
54
|
+
const to = !isContractCreated ? formatAddress(t.to, addressType) : void 0;
|
|
55
|
+
const delegatedTo = to && authMap[to];
|
|
56
|
+
let method = methodId;
|
|
57
|
+
let abi = void 0;
|
|
58
|
+
const methodABI = methodId && (delegatedTo || to) ? methodMap[methodId]?.[delegatedTo || to] : void 0;
|
|
59
|
+
if (methodABI) {
|
|
60
|
+
try {
|
|
61
|
+
const result = formatABI(`["${methodABI}"]`, {
|
|
62
|
+
json: true,
|
|
63
|
+
allowEmpty: true
|
|
64
|
+
});
|
|
65
|
+
abi = JSON.parse(result);
|
|
66
|
+
const jsonABI = abi[0];
|
|
67
|
+
method = jsonABI?.name || methodId;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.log("parse method abi error: ", methodABI, error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const item = {
|
|
73
|
+
index: `${parent?.index ? `${parent.index}_` : ""}${index}`,
|
|
74
|
+
type,
|
|
75
|
+
from,
|
|
76
|
+
to,
|
|
77
|
+
input: t.input,
|
|
78
|
+
value: t.value,
|
|
79
|
+
gas: t.gas ? new BigNumber(t.gas).toString() : void 0,
|
|
80
|
+
gasUsed: t.gasUsed ? new BigNumber(t.gasUsed).toString() : void 0,
|
|
81
|
+
output: t.output,
|
|
82
|
+
outcome: !t.error ? "success" : t.error === "Reverted" ? "reverted" : "fail",
|
|
83
|
+
method,
|
|
84
|
+
abi,
|
|
85
|
+
contractCreated: isContractCreated ? t.to : void 0,
|
|
86
|
+
nameMap,
|
|
87
|
+
delegatedTo,
|
|
88
|
+
isCallImpl: t.isCallImpl
|
|
89
|
+
};
|
|
90
|
+
if (parent && parent.to && proxyMap[parent.to] && from === parent.to && to) {
|
|
91
|
+
if (index === 0 && proxyMap[parent.to] === "Proxy" && isDelegateCall(type)) {
|
|
92
|
+
parent.proxy = {
|
|
93
|
+
type: "Proxy",
|
|
94
|
+
implAddress: to
|
|
95
|
+
};
|
|
96
|
+
item.isCallImpl = true;
|
|
97
|
+
}
|
|
98
|
+
const second = list2[1];
|
|
99
|
+
if (index === 0 && proxyMap[parent.to] === "BeaconProxy" && isStaticCall(type) && second && second.to && second.from === parent.to && isDelegateCall(second.type)) {
|
|
100
|
+
parent.proxy = {
|
|
101
|
+
type: "BeaconProxy",
|
|
102
|
+
beaconAddress: to,
|
|
103
|
+
implAddress: second.to
|
|
104
|
+
};
|
|
105
|
+
item.isCallBeacon = true;
|
|
106
|
+
second.isCallImpl = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (t.calls) {
|
|
110
|
+
item.calls = formatList(t.calls, item);
|
|
111
|
+
}
|
|
112
|
+
return item;
|
|
113
|
+
};
|
|
114
|
+
const list = formatList([data.traceCall]);
|
|
115
|
+
return {
|
|
116
|
+
total,
|
|
117
|
+
list,
|
|
118
|
+
// TODO: use real log index, and sort
|
|
119
|
+
logs: logs.map((item, index) => ({ ...item, transactionLogIndex: index }))
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
var querySimulateTrace = async (tx, tag = "latest", params = {
|
|
123
|
+
tracer: "callTracer",
|
|
124
|
+
tracerConfig: {
|
|
125
|
+
onlyTopCall: false
|
|
126
|
+
}
|
|
127
|
+
}) => {
|
|
128
|
+
const url = `/traceCallView`;
|
|
129
|
+
const { space, ...simulateTx } = tx;
|
|
130
|
+
if (!simulateTx.gas) {
|
|
131
|
+
try {
|
|
132
|
+
const gasLimit = await estimateGas({
|
|
133
|
+
account: simulateTx.from,
|
|
134
|
+
to: simulateTx.to,
|
|
135
|
+
value: simulateTx.value,
|
|
136
|
+
data: simulateTx.data,
|
|
137
|
+
space
|
|
138
|
+
});
|
|
139
|
+
simulateTx.gas = `0x${gasLimit.toString(16)}`;
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.log("estimate gas failed:", error);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (!simulateTx.maxFeePerGas && !simulateTx.gasPrice) {
|
|
145
|
+
simulateTx.maxFeePerGas = "0x51f4d5c00";
|
|
146
|
+
}
|
|
147
|
+
const data = JSON.stringify({
|
|
148
|
+
id: generateRandomId(),
|
|
149
|
+
jsonrpc: "2.0",
|
|
150
|
+
method: "debug_traceCall",
|
|
151
|
+
params: [simulateTx, tag, params]
|
|
152
|
+
});
|
|
153
|
+
return fetchWithPrefix(url, {
|
|
154
|
+
method: "POST",
|
|
155
|
+
body: data,
|
|
156
|
+
headers: {
|
|
157
|
+
"Content-Type": "application/json"
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
var useSimulateTrace = (simulateTx, tag = "latest", params = {
|
|
162
|
+
tracer: "callTracer",
|
|
163
|
+
tracerConfig: {
|
|
164
|
+
onlyTopCall: false,
|
|
165
|
+
withLog: true
|
|
166
|
+
}
|
|
167
|
+
}) => {
|
|
168
|
+
let key = null;
|
|
169
|
+
if (simulateTx.from) {
|
|
170
|
+
key = JSON.stringify([simulateTx, tag, params]);
|
|
171
|
+
}
|
|
172
|
+
return useSWRImmutable(
|
|
173
|
+
key,
|
|
174
|
+
() => querySimulateTrace(simulateTx, tag, params).then((resp) => {
|
|
175
|
+
if (resp?.traceCall) {
|
|
176
|
+
return formatSimulateTraceData(resp, simulateTx.space);
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
export {
|
|
182
|
+
querySimulateTrace,
|
|
183
|
+
useSimulateTrace
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=useSimulateTrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useSimulateTrace.ts"],"sourcesContent":["import useSWRImmutable from 'swr/immutable';\nimport { fetchWithPrefix } from '../request';\nimport { formatABI, generateRandomId } from '..';\nimport {\n isCreateCall,\n isDelegateCall,\n isStaticCall,\n ProxyType,\n TreeTraceForUI,\n} from './useTxTrace';\nimport { AddressNameMap } from '../request.types';\nimport { AbiFunctionWithoutGas, estimateGas, Space } from '../sdk';\nimport { formatAddress } from '../address';\nimport BigNumber from 'bignumber.js';\n\nexport interface SimulateLog {\n address: string;\n topics: string[];\n data: string;\n transactionLogIndex?: number;\n}\n\ninterface SimulateTraceCall {\n from: string;\n to: string;\n gas: string;\n gasUsed: string;\n input: `0x${string}`;\n output?: `0x${string}`;\n value: string;\n type: string;\n error?: string;\n calls?: SimulateTraceCall[];\n isCallImpl?: boolean;\n logs?: SimulateLog[];\n}\n\nexport interface SimulateTraceResponse {\n traceCall: SimulateTraceCall;\n addressArray: string[];\n authMap?: Record<string, string>;\n proxyMap?: Record<string, ProxyType>;\n methodMap?: Record<string, Record<string, string>>;\n nameMap?: Record<string, AddressNameMap>;\n}\n\nexport interface SimulateTraceTxParams {\n from?: string;\n to?: string;\n value?: string;\n data?: string;\n gas?: string;\n gasPrice?: string;\n maxFeePerGas?: string;\n // simulate trace not support core space now\n space: Exclude<Space, 'core'>;\n}\n\nexport interface SimulateTraceConfig {\n // other tracer has different response, not support now\n // | '4byteTracer'\n // | 'prestateTracer'\n // | 'flatCallTracer'\n // | 'muxTracer'\n // | 'erc7562Tracer';\n tracer: 'callTracer';\n tracerConfig?: {\n disableStorage?: boolean;\n disableStack?: boolean;\n enableMemory?: boolean;\n enableReturnData?: boolean;\n onlyTopCall?: boolean;\n withLog?: boolean;\n timeout?: number;\n };\n}\n\nconst formatSimulateTraceData = (\n data: SimulateTraceResponse,\n space: 'evm' | 'core',\n) => {\n const addressType = space === 'core' ? 'base32' : 'hex';\n const proxyMap = data.proxyMap || {};\n const methodMap = data.methodMap || {};\n const nameMap = data.nameMap || {};\n const authMap = data.authMap || {};\n\n let total = 0;\n const logs: SimulateLog[] = [];\n\n const formatList = (\n t: SimulateTraceCall[],\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: SimulateTraceCall,\n index: number,\n parent: TreeTraceForUI | undefined,\n list: SimulateTraceCall[],\n ): TreeTraceForUI => {\n if (t.logs) {\n logs.push(...t.logs);\n }\n const type = t.type?.toLowerCase();\n const isContractCreated = isCreateCall(type);\n const methodId = t.input?.slice(0, 10);\n const from = formatAddress(t.from, addressType);\n const to = !isContractCreated\n ? formatAddress(t.to, addressType)\n : undefined;\n const delegatedTo = to && authMap[to];\n let method = methodId;\n let abi: AbiFunctionWithoutGas[] | undefined = undefined;\n const methodABI =\n methodId && (delegatedTo || to)\n ? methodMap[methodId]?.[delegatedTo || to]\n : 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 item: TreeTraceForUI = {\n index: `${parent?.index ? `${parent.index}_` : ''}${index}`,\n type: type,\n from: from,\n to: to,\n input: t.input,\n value: t.value,\n gas: t.gas ? new BigNumber(t.gas).toString() : undefined,\n gasUsed: t.gasUsed ? new BigNumber(t.gasUsed).toString() : undefined,\n output: t.output,\n outcome: !t.error\n ? 'success'\n : t.error === 'Reverted'\n ? 'reverted'\n : 'fail',\n method,\n abi,\n contractCreated: isContractCreated ? t.to : undefined,\n nameMap,\n delegatedTo,\n isCallImpl: t.isCallImpl,\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 isDelegateCall(type)\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 isStaticCall(type) &&\n second &&\n second.to &&\n second.from === parent.to &&\n isDelegateCall(second.type)\n ) {\n parent.proxy = {\n type: 'BeaconProxy',\n beaconAddress: to,\n implAddress: second.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.traceCall]);\n return {\n total,\n list,\n // TODO: use real log index, and sort\n logs: logs.map((item, index) => ({ ...item, transactionLogIndex: index })),\n };\n};\nexport const querySimulateTrace = async (\n tx: SimulateTraceTxParams,\n tag = 'latest',\n params: SimulateTraceConfig = {\n tracer: 'callTracer',\n tracerConfig: {\n onlyTopCall: false,\n },\n },\n) => {\n const url = `/traceCallView`;\n\n const { space, ...simulateTx } = tx;\n\n if (!simulateTx.gas) {\n try {\n const gasLimit = await estimateGas({\n account: simulateTx.from,\n to: simulateTx.to,\n value: simulateTx.value,\n data: simulateTx.data as `0x${string}`,\n space,\n });\n simulateTx.gas = `0x${gasLimit.toString(16)}`;\n } catch (error) {\n console.log('estimate gas failed:', error);\n }\n }\n if (!simulateTx.maxFeePerGas && !simulateTx.gasPrice) {\n simulateTx.maxFeePerGas = '0x51f4d5c00'; // 22 Gdrip\n }\n\n const data = JSON.stringify({\n id: generateRandomId(),\n jsonrpc: '2.0',\n method: 'debug_traceCall',\n params: [simulateTx, tag, params],\n });\n return fetchWithPrefix<SimulateTraceResponse>(url, {\n method: 'POST',\n body: data,\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n};\n\nexport const useSimulateTrace = (\n simulateTx: SimulateTraceTxParams,\n tag = 'latest',\n params: SimulateTraceConfig = {\n tracer: 'callTracer',\n tracerConfig: {\n onlyTopCall: false,\n withLog: true,\n },\n },\n) => {\n let key = null;\n if (simulateTx.from) {\n key = JSON.stringify([simulateTx, tag, params]);\n }\n\n return useSWRImmutable(key, () =>\n querySimulateTrace(simulateTx, tag, params).then(resp => {\n if (resp?.traceCall) {\n return formatSimulateTraceData(resp, simulateTx.space);\n }\n }),\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,qBAAqB;AAa5B,OAAO,eAAe;AAgEtB,IAAM,0BAA0B,CAC9B,MACA,UACG;AACH,QAAM,cAAc,UAAU,SAAS,WAAW;AAClD,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,YAAY,KAAK,aAAa,CAAC;AACrC,QAAM,UAAU,KAAK,WAAW,CAAC;AACjC,QAAM,UAAU,KAAK,WAAW,CAAC;AAEjC,MAAI,QAAQ;AACZ,QAAM,OAAsB,CAAC;AAE7B,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,QAAI,EAAE,MAAM;AACV,WAAK,KAAK,GAAG,EAAE,IAAI;AAAA,IACrB;AACA,UAAM,OAAO,EAAE,MAAM,YAAY;AACjC,UAAM,oBAAoB,aAAa,IAAI;AAC3C,UAAM,WAAW,EAAE,OAAO,MAAM,GAAG,EAAE;AACrC,UAAM,OAAO,cAAc,EAAE,MAAM,WAAW;AAC9C,UAAM,KAAK,CAAC,oBACR,cAAc,EAAE,IAAI,WAAW,IAC/B;AACJ,UAAM,cAAc,MAAM,QA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AY,KAAK,MAAM;AAAA,EAClC,CAAC;AACD,SAAO,gBAAuC,KAAK;AAAA,IACjD,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,MACP,gBAAgB;AAAA,IAClB;AAAA,EACF,CAAC;AACH;AAEO,IAAM,mBAAmB,CAC9B,YACA,MAAM,UACN,SAA8B;AAAA,EAC5B,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF,MACG;AACH,MAAI,MAAM;AACV,MAAI,WAAW,MAAM;AACnB,UAAM,KAAK,UAAU,CAAC,YAAY,KAAK,MAAM,CAAC;AAAA,EAChD;AAEA,SAAO;AAAA,IAAgB;AAAA,IAAK,MAC1B,mBAAmB,YAAY,KAAK,MAAM,EAAE,KAAK,UAAQ;AACvD,UAAI,MAAM,WAAW;AACnB,eAAO,wBAAwB,MAAM,WAAW,KAAK;AAAA,MACvD;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["list"]}
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "../../chunk-CPSXYQJ7.js";
|
|
4
4
|
import {
|
|
5
5
|
fetchWithPrefix
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-EN25IHGP.js";
|
|
7
|
+
import "../../chunk-ZZLGINAC.js";
|
|
8
8
|
import "../../chunk-YEINMVAR.js";
|
|
9
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-L4AFJGXJ.js";
|
|
10
10
|
import "../../chunk-WQG2LZMB.js";
|
|
11
11
|
|
|
12
12
|
// src/utils/hooks/useTableData.ts
|
|
@@ -2,7 +2,12 @@ import * as swr from 'swr';
|
|
|
2
2
|
import { AbiFunctionWithoutGas } from '../sdk.js';
|
|
3
3
|
import { Pocket, AddressNameMap } from '../request.types.js';
|
|
4
4
|
import 'viem';
|
|
5
|
+
import 'cive/accounts';
|
|
6
|
+
import 'cive';
|
|
5
7
|
|
|
8
|
+
declare const isDelegateCall: (callType?: string) => boolean | "" | undefined;
|
|
9
|
+
declare const isStaticCall: (callType?: string) => boolean | "" | undefined;
|
|
10
|
+
declare const isCreateCall: (callType?: string) => boolean | "" | undefined;
|
|
6
11
|
interface TraceAction {
|
|
7
12
|
createType: string;
|
|
8
13
|
callType: string;
|
|
@@ -52,7 +57,9 @@ interface ListTraceForUI {
|
|
|
52
57
|
to?: string;
|
|
53
58
|
value: string;
|
|
54
59
|
input?: `0x${string}`;
|
|
55
|
-
|
|
60
|
+
gasUsed?: string;
|
|
61
|
+
outcome?: 'success' | 'fail' | 'reverted';
|
|
62
|
+
output?: `0x${string}`;
|
|
56
63
|
gas?: string;
|
|
57
64
|
isProxyCall?: boolean;
|
|
58
65
|
method?: string;
|
|
@@ -77,9 +84,9 @@ declare const treeTraceToList: (data: TreeTraceForUI[], showProxyCall?: boolean)
|
|
|
77
84
|
declare const hideProxyCallInTreeTrace: (data: TreeTraceForUI[]) => TreeTraceForUI[];
|
|
78
85
|
declare const useTxTrace: (hash: string, space: 'evm' | 'core', { isAATx, }?: {
|
|
79
86
|
isAATx?: boolean | undefined;
|
|
80
|
-
}) => swr.SWRResponse<
|
|
87
|
+
}) => swr.SWRResponse<{
|
|
81
88
|
list: TreeTraceForUI[];
|
|
82
89
|
total: number;
|
|
83
90
|
} | undefined, any, any>;
|
|
84
91
|
|
|
85
|
-
export { ListTraceForUI, OriginTraceData, OriginTreeTrace, ProxyType, TraceAction, TraceResult, TreeTraceForUI, hideProxyCallInTreeTrace, treeTraceToList, useTxTrace };
|
|
92
|
+
export { ListTraceForUI, OriginTraceData, OriginTreeTrace, ProxyType, TraceAction, TraceResult, TreeTraceForUI, hideProxyCallInTreeTrace, isCreateCall, isDelegateCall, isStaticCall, treeTraceToList, useTxTrace };
|
|
@@ -1,154 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
hideProxyCallInTreeTrace,
|
|
3
|
+
isCreateCall,
|
|
4
|
+
isDelegateCall,
|
|
5
|
+
isStaticCall,
|
|
6
|
+
treeTraceToList,
|
|
7
|
+
useTxTrace
|
|
8
|
+
} from "../../chunk-6JLI3Y4J.js";
|
|
9
|
+
import "../../chunk-4QR5LKPG.js";
|
|
10
|
+
import "../../chunk-D6INJ4N5.js";
|
|
11
|
+
import "../../chunk-2MY3T2VH.js";
|
|
12
|
+
import "../../chunk-EN25IHGP.js";
|
|
13
|
+
import "../../chunk-ZZLGINAC.js";
|
|
14
14
|
import "../../chunk-YEINMVAR.js";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-L4AFJGXJ.js";
|
|
16
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 proxyMap = data.proxyMap || {};
|
|
23
|
-
const methodMap = data.methodMap || {};
|
|
24
|
-
const nameMap = data.nameMap || {};
|
|
25
|
-
const authMap = data.authMap || {};
|
|
26
|
-
let total = 0;
|
|
27
|
-
const formatList = (t, parent) => {
|
|
28
|
-
total += t.length;
|
|
29
|
-
return t.map((item, index) => formatItem(item, index, parent, t));
|
|
30
|
-
};
|
|
31
|
-
const formatItem = (t, index, parent, list2) => {
|
|
32
|
-
const methodId = t.action.input?.slice(0, 10);
|
|
33
|
-
const from = formatAddress(t.action.from, addressType);
|
|
34
|
-
const to = formatAddress(t.action.to, addressType);
|
|
35
|
-
const delegatedTo = to && authMap[to];
|
|
36
|
-
let method = methodId;
|
|
37
|
-
let abi = void 0;
|
|
38
|
-
const methodABI = methodId && (delegatedTo || to) ? methodMap[methodId]?.[delegatedTo || to] : void 0;
|
|
39
|
-
if (methodABI) {
|
|
40
|
-
try {
|
|
41
|
-
const result = formatABI(`["${methodABI}"]`, {
|
|
42
|
-
json: true,
|
|
43
|
-
allowEmpty: true
|
|
44
|
-
});
|
|
45
|
-
abi = JSON.parse(result);
|
|
46
|
-
const jsonABI = abi[0];
|
|
47
|
-
method = jsonABI?.name || methodId;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.log("parse method abi error: ", methodABI, error);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const isContractCreated = !!t.action.createType;
|
|
53
|
-
const item = {
|
|
54
|
-
index: `${parent?.index ? `${parent.index}_` : ""}${index}`,
|
|
55
|
-
type: `${t.action.callType || t.type}`,
|
|
56
|
-
from,
|
|
57
|
-
to,
|
|
58
|
-
input: t.action.input,
|
|
59
|
-
value: t.action.value,
|
|
60
|
-
result: t.result,
|
|
61
|
-
gas: t.action.gas,
|
|
62
|
-
method,
|
|
63
|
-
abi,
|
|
64
|
-
contractCreated: isContractCreated ? t.result?.addr : void 0,
|
|
65
|
-
nameMap,
|
|
66
|
-
delegatedTo,
|
|
67
|
-
isCallImpl: t.isCallImpl,
|
|
68
|
-
fromPocket: t.action.fromPocket,
|
|
69
|
-
toPocket: t.action.toPocket
|
|
70
|
-
};
|
|
71
|
-
if (parent && parent.to && proxyMap[parent.to] && from === parent.to && to) {
|
|
72
|
-
if (index === 0 && proxyMap[parent.to] === "Proxy" && t.action.callType === "delegatecall") {
|
|
73
|
-
parent.proxy = {
|
|
74
|
-
type: "Proxy",
|
|
75
|
-
implAddress: to
|
|
76
|
-
};
|
|
77
|
-
item.isCallImpl = true;
|
|
78
|
-
}
|
|
79
|
-
const second = list2[1];
|
|
80
|
-
if (index === 0 && proxyMap[parent.to] === "BeaconProxy" && t.action.callType === "staticcall" && second && second.action.to && second.action.from === parent.to && second.action.callType === "delegatecall") {
|
|
81
|
-
parent.proxy = {
|
|
82
|
-
type: "BeaconProxy",
|
|
83
|
-
beaconAddress: to,
|
|
84
|
-
implAddress: second.action.to
|
|
85
|
-
};
|
|
86
|
-
item.isCallBeacon = true;
|
|
87
|
-
second.isCallImpl = true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (t.calls) {
|
|
91
|
-
item.calls = formatList(t.calls, item);
|
|
92
|
-
}
|
|
93
|
-
return item;
|
|
94
|
-
};
|
|
95
|
-
const list = formatList(data.traceTree);
|
|
96
|
-
return {
|
|
97
|
-
total,
|
|
98
|
-
list
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
var treeTraceToList = (data, showProxyCall = false) => {
|
|
102
|
-
const result = [];
|
|
103
|
-
const handler = (list) => {
|
|
104
|
-
list.forEach((item) => {
|
|
105
|
-
if (showProxyCall || !item.isCallBeacon && !item.isCallImpl) {
|
|
106
|
-
result.push(item);
|
|
107
|
-
}
|
|
108
|
-
if (item.calls) {
|
|
109
|
-
handler(item.calls);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
handler(data);
|
|
114
|
-
return result;
|
|
115
|
-
};
|
|
116
|
-
var hideProxyCallInTreeTrace = (data) => {
|
|
117
|
-
const handler = (list) => {
|
|
118
|
-
const result = [];
|
|
119
|
-
list.forEach((item) => {
|
|
120
|
-
const newTrace = { ...item };
|
|
121
|
-
if (!newTrace.isCallBeacon && !newTrace.isCallImpl) {
|
|
122
|
-
result.push(newTrace);
|
|
123
|
-
if (newTrace.calls) {
|
|
124
|
-
newTrace.calls = handler(newTrace.calls);
|
|
125
|
-
}
|
|
126
|
-
} else if (newTrace.calls) {
|
|
127
|
-
result.push(...handler(newTrace.calls));
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
return result;
|
|
131
|
-
};
|
|
132
|
-
return handler(data);
|
|
133
|
-
};
|
|
134
|
-
var useTxTrace = (hash, space, {
|
|
135
|
-
isAATx = false
|
|
136
|
-
} = {}) => {
|
|
137
|
-
const url = `/transferTree/${hash}${isAATx ? "?txType=aa" : ""}`;
|
|
138
|
-
return useSWRImmutable(
|
|
139
|
-
[url, space],
|
|
140
|
-
() => fetchWithPrefix(url).then((resp) => {
|
|
141
|
-
if (resp?.traceTree) {
|
|
142
|
-
const { list, total } = formatTraceData(resp, space);
|
|
143
|
-
return { list, total };
|
|
144
|
-
}
|
|
145
|
-
}).catch((e) => {
|
|
146
|
-
publishRequestError({ code: 60002, message: e.message }, "code");
|
|
147
|
-
})
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
17
|
export {
|
|
151
18
|
hideProxyCallInTreeTrace,
|
|
19
|
+
isCreateCall,
|
|
20
|
+
isDelegateCall,
|
|
21
|
+
isStaticCall,
|
|
152
22
|
treeTraceToList,
|
|
153
23
|
useTxTrace
|
|
154
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/hooks/useTxTrace.ts"],"sourcesContent":["import useSWRImmutable from 'swr/immutable';\nimport { fetchWithPrefix } from '../request';\nimport { publishRequestError } from '../pubsub';\nimport type { AbiFunctionWithoutGas } from '../sdk';\nimport { formatABI } from '..';\nimport { formatAddress } from '../address';\nimport { AddressNameMap, 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\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 authMap?: Record<string, string>;\n proxyMap?: Record<string, ProxyType>;\n methodMap?: Record<string, Record<string, string>>;\n nameMap?: Record<string, AddressNameMap>;\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 nameMap: Record<string, AddressNameMap>;\n proxy?: {\n type: ProxyType;\n beaconAddress?: string;\n implAddress: string;\n };\n isCallBeacon?: boolean;\n isCallImpl?: boolean;\n // only for evm space ↓↓↓↓↓↓↓↓\n delegatedTo?: string;\n // only for core space ↓↓↓↓↓↓↓↓\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 proxyMap = data.proxyMap || {};\n const methodMap = data.methodMap || {};\n const nameMap = data.nameMap || {};\n const authMap = data.authMap || {};\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 const delegatedTo = to && authMap[to];\n let method = methodId;\n let abi: AbiFunctionWithoutGas[] | undefined = undefined;\n const methodABI =\n methodId && (delegatedTo || to)\n ? methodMap[methodId]?.[delegatedTo || to]\n : 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 nameMap,\n delegatedTo,\n isCallImpl: t.isCallImpl,\n fromPocket: t.action.fromPocket,\n toPocket: t.action.toPocket,\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 = (\n hash: string,\n space: 'evm' | 'core',\n {\n isAATx = false,\n }: {\n isAATx?: boolean;\n } = {},\n) => {\n const url = `/transferTree/${hash}${isAATx ? '?txType=aa' : ''}`;\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;AAyF5B,IAAM,kBAAkB,CAAC,MAAuB,UAA0B;AACxE,QAAM,cAAc,UAAU,SAAS,WAAW;AAClD,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,YAAY,KAAK,aAAa,CAAC;AACrC,QAAM,UAAU,KAAK,WAAW,CAAC;AACjC,QAAM,UAAU,KAAK,WAAW,CAAC;AAEjC,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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AA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,IAAI;AACrB;AAEO,IAAM,aAAa,CACxB,MACA,OACA;AAAA,EACE,SAAS;AACX,IAEI,CAAC,MACF;AACH,QAAM,MAAM,iBAAiB,OAAO,SAAS,eAAe;AAE5D,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"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { GlobalDataType, NetworksType, NetworkSpace } from '../store/types.js';
|
|
1
2
|
import BigNumber from 'bignumber.js';
|
|
2
3
|
import dayjs from 'dayjs';
|
|
3
4
|
import { ClassValue } from 'clsx';
|
|
4
5
|
import { utils } from 'ethers';
|
|
5
|
-
import { GlobalDataType, NetworksType, NetworkSpace } from '../store/types.js';
|
|
6
6
|
import '@cfxjs/sirius-next-i18n/types';
|
|
7
7
|
import './constants.js';
|
|
8
8
|
|
|
@@ -151,5 +151,6 @@ declare function decodeAANonce(nonceInput: string | BigNumber): {
|
|
|
151
151
|
nonce: string;
|
|
152
152
|
keyHex: string;
|
|
153
153
|
};
|
|
154
|
+
declare const generateRandomId: () => string;
|
|
154
155
|
|
|
155
|
-
export { HIDE_IN_DOT_NET, addIPFSGateway, byteToKb, checkBytes, checkCfxType, checkInt, checkUint, cn, constprocessResultArray, convertBigNumbersToStrings, convertObjBigNumbersToStrings, coreCorrespondsToEspace, decodeAANonce, formatABI, formatBalance, formatLargeNumber, formatNumber, formatPrice, formatString, formatTimeStamp, fromCfxToDrip, fromDripToCfx, fromDripToGdrip, fromGdripToDrip, getDuration, getEllipsStr, getIncreasePercent, getInitialDate, getNetwork, getNetworkIcon, getPercent, getTimeByBlockInterval, gotoNetwork, hex2utf8, isBlockHash, isEvenLength, isHash, isHex, isLikeBigNumber, isObject, isSafeNumberOrNumericStringInput, isTxHash, isZeroOrPositiveInteger, mergeDeep, parseString, replaceAll, roundToFixedPrecision, selectText, sleep, toThousands, transferRisk, transferToLowerCase, validURL, viewJson };
|
|
156
|
+
export { HIDE_IN_DOT_NET, addIPFSGateway, byteToKb, checkBytes, checkCfxType, checkInt, checkUint, cn, constprocessResultArray, convertBigNumbersToStrings, convertObjBigNumbersToStrings, coreCorrespondsToEspace, decodeAANonce, formatABI, formatBalance, formatLargeNumber, formatNumber, formatPrice, formatString, formatTimeStamp, fromCfxToDrip, fromDripToCfx, fromDripToGdrip, fromGdripToDrip, generateRandomId, getDuration, getEllipsStr, getIncreasePercent, getInitialDate, getNetwork, getNetworkIcon, getPercent, getTimeByBlockInterval, gotoNetwork, hex2utf8, isBlockHash, isEvenLength, isHash, isHex, isLikeBigNumber, isObject, isSafeNumberOrNumericStringInput, isTxHash, isZeroOrPositiveInteger, mergeDeep, parseString, replaceAll, roundToFixedPrecision, selectText, sleep, toThousands, transferRisk, transferToLowerCase, validURL, viewJson };
|
package/dist/utils/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
fromDripToCfx,
|
|
24
24
|
fromDripToGdrip,
|
|
25
25
|
fromGdripToDrip,
|
|
26
|
+
generateRandomId,
|
|
26
27
|
getDuration,
|
|
27
28
|
getEllipsStr,
|
|
28
29
|
getIncreasePercent,
|
|
@@ -53,12 +54,12 @@ import {
|
|
|
53
54
|
transferToLowerCase,
|
|
54
55
|
validURL,
|
|
55
56
|
viewJson
|
|
56
|
-
} from "../chunk-
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-
|
|
59
|
-
import "../chunk-
|
|
57
|
+
} from "../chunk-D6INJ4N5.js";
|
|
58
|
+
import "../chunk-2MY3T2VH.js";
|
|
59
|
+
import "../chunk-EN25IHGP.js";
|
|
60
|
+
import "../chunk-ZZLGINAC.js";
|
|
60
61
|
import "../chunk-YEINMVAR.js";
|
|
61
|
-
import "../chunk-
|
|
62
|
+
import "../chunk-L4AFJGXJ.js";
|
|
62
63
|
import "../chunk-WQG2LZMB.js";
|
|
63
64
|
export {
|
|
64
65
|
HIDE_IN_DOT_NET,
|
|
@@ -85,6 +86,7 @@ export {
|
|
|
85
86
|
fromDripToCfx,
|
|
86
87
|
fromDripToGdrip,
|
|
87
88
|
fromGdripToDrip,
|
|
89
|
+
generateRandomId,
|
|
88
90
|
getDuration,
|
|
89
91
|
getEllipsStr,
|
|
90
92
|
getIncreasePercent,
|
package/dist/utils/pubsub.js
CHANGED
package/dist/utils/request.js
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
sendRequestENSInfo,
|
|
15
15
|
sendRequestGasPrice,
|
|
16
16
|
simpleGetFetcher
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
} from "../chunk-EN25IHGP.js";
|
|
18
|
+
import "../chunk-ZZLGINAC.js";
|
|
19
19
|
import "../chunk-YEINMVAR.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-L4AFJGXJ.js";
|
|
21
21
|
import "../chunk-WQG2LZMB.js";
|
|
22
22
|
export {
|
|
23
23
|
appendApiPrefix,
|
package/dist/utils/rpcRequest.js
CHANGED