@cfxjs/sirius-next-common 0.5.0 → 0.6.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/{chunk-ODPPKXIV.js → chunk-2PHHS2RO.js} +2 -2
- package/dist/{chunk-IVE75CAC.js → chunk-33FSTL4O.js} +5 -5
- package/dist/{chunk-HTRUONHE.js → chunk-3NZH5WQ5.js} +2 -2
- package/dist/{chunk-QBF7EJFY.js → chunk-5X4PEJBK.js} +7 -7
- package/dist/{chunk-TTMMIWXR.js → chunk-6B2K5TEW.js} +3 -3
- package/dist/{chunk-LUHISU5F.js → chunk-6CSKHPNW.js} +2 -2
- package/dist/{chunk-CPSXYQJ7.js → chunk-6R34R4GT.js} +6 -3
- package/dist/{chunk-CPSXYQJ7.js.map → chunk-6R34R4GT.js.map} +1 -1
- package/dist/{chunk-4MVQ3JTN.js → chunk-7XTWMLAL.js} +2 -2
- package/dist/{chunk-M7G2HHUU.js → chunk-A66ETOJQ.js} +12 -10
- package/dist/{chunk-M7G2HHUU.js.map → chunk-A66ETOJQ.js.map} +1 -1
- package/dist/chunk-ATKGS22K.js +22 -0
- package/dist/chunk-ATKGS22K.js.map +1 -0
- package/dist/{chunk-4MEAKY73.js → chunk-BE7ARWED.js} +2 -2
- package/dist/{chunk-TAEXZ5LI.js → chunk-BVUDZX7G.js} +2 -2
- package/dist/{chunk-EGXD2GDI.js → chunk-DG5UBEHF.js} +2 -2
- package/dist/{chunk-S2C6VOUJ.js → chunk-DH2BQ7HL.js} +54 -53
- package/dist/chunk-DH2BQ7HL.js.map +1 -0
- package/dist/{chunk-7FIPVSHQ.js → chunk-DYXED7QQ.js} +2 -2
- package/dist/{chunk-WYM7FWXA.js → chunk-ESZKQ6TN.js} +2 -2
- package/dist/{chunk-NBMABBMG.js → chunk-EXHT4Z5W.js} +5 -5
- package/dist/{chunk-XGSBVC7P.js → chunk-FDTENXEV.js} +2 -2
- package/dist/{chunk-OAUFBUYV.js → chunk-G5X35MKG.js} +5 -5
- package/dist/{chunk-XIQH26WA.js → chunk-IGKHPUYH.js} +2 -2
- package/dist/{chunk-B74PZXOZ.js → chunk-IZPVE2KL.js} +6 -6
- package/dist/{chunk-QCA4QRD4.js → chunk-KEXEB4J3.js} +5 -3
- package/dist/chunk-KEXEB4J3.js.map +1 -0
- package/dist/{chunk-LMY5VYFP.js → chunk-KJGWBTHN.js} +2 -2
- package/dist/{chunk-2WY3J56A.js → chunk-KTHEE74W.js} +2 -2
- package/dist/{chunk-CTCBKNSN.js → chunk-LG4QDJAZ.js} +3 -3
- package/dist/{chunk-3XNQKM2D.js → chunk-LOWSXRES.js} +2 -2
- package/dist/{chunk-H26P76N6.js → chunk-MD7Z3RQW.js} +7 -7
- package/dist/{chunk-UBHTXZWS.js → chunk-OJKUPTS6.js} +2 -2
- package/dist/{chunk-2RVLHSYV.js → chunk-P56G5URI.js} +4 -4
- package/dist/{chunk-LZF26HB6.js → chunk-R6M4UPAP.js} +2 -2
- package/dist/chunk-RJGR6YQY.js +9 -0
- package/dist/chunk-RJGR6YQY.js.map +1 -0
- package/dist/{chunk-RK632STC.js → chunk-SW7XEZSP.js} +4 -4
- package/dist/{chunk-YLBHOAH5.js → chunk-SWXU6RIW.js} +3 -3
- package/dist/{chunk-OGZSZDXL.js → chunk-TLB3MT66.js} +4 -4
- package/dist/{chunk-XJPWKT2J.js → chunk-URGXFUYM.js} +3 -3
- package/dist/{chunk-36EB4LRH.js → chunk-V63T5THG.js} +4 -4
- package/dist/{chunk-D5HJCIRL.js → chunk-VHVK63XA.js} +2 -2
- package/dist/{chunk-2T3VTZXW.js → chunk-VTQN4OFN.js} +3 -3
- package/dist/{chunk-2BLHJLZO.js → chunk-VYC4H34V.js} +6 -6
- package/dist/{chunk-B7IDVT2B.js → chunk-WOL4GXHM.js} +4 -4
- package/dist/{chunk-TIWELXT7.js → chunk-WZNI2XMX.js} +7 -7
- package/dist/chunk-X6IIYPI2.js +5801 -0
- package/dist/chunk-X6IIYPI2.js.map +1 -0
- package/dist/{chunk-OUQEXLFQ.js → chunk-XD4ERIC5.js} +3 -3
- package/dist/{chunk-QL4NKKTA.js → chunk-XF3VAJAR.js} +2 -2
- package/dist/components/AAFailedReason/index.js +6 -5
- package/dist/components/AAFailedReason/index.js.map +1 -1
- package/dist/components/AceEditor/index.js +6 -4
- package/dist/components/AddressContainer/CoreAddressContainer.js +12 -10
- package/dist/components/AddressContainer/EVMAddressContainer.js +11 -9
- package/dist/components/AddressContainer/addressSwitcher.js +9 -7
- package/dist/components/AddressContainer/addressView.js +8 -6
- package/dist/components/AddressContainer/label.js +5 -3
- package/dist/components/AddressContainer/label.js.map +1 -1
- package/dist/components/AddressContainer/utils.js +4 -3
- package/dist/components/Age/index.js +6 -4
- package/dist/components/Age/index.js.map +1 -1
- package/dist/components/AutoComplete/index.js +4 -3
- package/dist/components/AutoComplete/index.js.map +1 -1
- package/dist/components/Charts/HighchartsReact.d.ts +7 -0
- package/dist/components/Charts/HighchartsReact.js +8 -0
- package/dist/components/Charts/HighchartsReact.js.map +1 -0
- package/dist/components/Charts/PreviewChartTemplate.js +6 -3
- package/dist/components/Charts/PreviewChartTemplate.js.map +1 -1
- package/dist/components/Charts/StockChartTemplate.js +9 -6
- package/dist/components/Charts/StockChartTemplate.js.map +1 -1
- package/dist/components/Charts/config.d.ts +2 -2
- package/dist/components/ContractAbi/IntValueFormatter.js +6 -5
- package/dist/components/ContractAbi/ParamTitle.js +7 -5
- package/dist/components/ContractAbi/index.js +13 -11
- package/dist/components/ContractAbi/utils.js +4 -3
- package/dist/components/CopyButton/index.js +5 -3
- package/dist/components/CopyButton/index.js.map +1 -1
- package/dist/components/DecimalsSelect/index.js +5 -4
- package/dist/components/DownloadCSV/index.js +6 -4
- package/dist/components/DownloadCSV/index.js.map +1 -1
- package/dist/components/Dropdown/index.js +9 -5
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/GasPriceDropdown/index.js +3 -2
- package/dist/components/GasPriceDropdown/index.js.map +1 -1
- package/dist/components/IncreasePercent/index.js +3 -2
- package/dist/components/IncreasePercent/index.js.map +1 -1
- package/dist/components/InfoIconWithTooltip/index.js +6 -4
- package/dist/components/InputData/AddressLabel.js +10 -8
- package/dist/components/InputData/ContractDetail.js +6 -5
- package/dist/components/InputData/JsonDecode.js +7 -5
- package/dist/components/InputData/OptimizationDecode.js +14 -12
- package/dist/components/InputData/Original.js +4 -3
- package/dist/components/InputData/UTF8.js +4 -3
- package/dist/components/InputData/index.js +20 -18
- package/dist/components/Modal/index.js +4 -3
- package/dist/components/NetworkIcon/index.js +3 -2
- package/dist/components/NetworkIcon/index.js.map +1 -1
- package/dist/components/OutputData/ErrorDecode.js +19 -17
- package/dist/components/OutputData/index.js +22 -20
- package/dist/components/PhishingAddressContainer/index.js +6 -4
- package/dist/components/PhishingAddressContainer/index.js.map +1 -1
- package/dist/components/Popover/index.js +4 -3
- package/dist/components/Price/index.js +5 -3
- package/dist/components/Price/index.js.map +1 -1
- package/dist/components/ProxyContractAddress/index.js +8 -6
- package/dist/components/ProxyContractAddress/index.js.map +1 -1
- package/dist/components/Radio/index.js +3 -2
- package/dist/components/Radio/index.js.map +1 -1
- package/dist/components/SearchInput/index.js +6 -4
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/Select/index.js +5 -4
- package/dist/components/Select/select.js +4 -3
- package/dist/components/SmartAccountAddress/index.js +8 -6
- package/dist/components/SmartAccountAddress/index.js.map +1 -1
- package/dist/components/Text/index.js +6 -4
- package/dist/components/Tooltip/index.js +5 -3
- package/dist/components/TransactionAction/coreTransactionAction.js +12 -10
- package/dist/components/TransactionAction/coreTransactionAction.js.map +1 -1
- package/dist/components/TransactionAction/evmTransactionAction.js +11 -9
- package/dist/components/TransactionAction/evmTransactionAction.js.map +1 -1
- package/dist/components/TransactionTrace/TraceDetail.js +30 -28
- package/dist/components/TransactionTrace/TreeTraceTable.js +31 -29
- package/dist/components/TransactionTrace/index.js +31 -29
- package/dist/utils/address.js +3 -2
- package/dist/utils/contractManagerTool.js +3 -2
- package/dist/utils/contractManagerTool.js.map +1 -1
- package/dist/utils/hooks/useAbiItemById.js +3 -2
- package/dist/utils/hooks/useAddressLabel.js +4 -3
- package/dist/utils/hooks/useAddressNameMap.js +3 -2
- package/dist/utils/hooks/useAutoSetHolderFilterParams.js +8 -6
- package/dist/utils/hooks/useAutoSetHolderFilterParams.js.map +1 -1
- package/dist/utils/hooks/useClickAway.d.ts +5 -0
- package/dist/utils/hooks/useClickAway.js +8 -0
- package/dist/utils/hooks/useClickAway.js.map +1 -0
- package/dist/utils/hooks/useContractDetail.js +3 -2
- package/dist/utils/hooks/useContractsStatistics.js +2 -1
- package/dist/utils/hooks/useContractsStatistics.js.map +1 -1
- package/dist/utils/hooks/useDecodeFunctionData.js +6 -5
- package/dist/utils/hooks/useDecodeFunctionError.js +6 -5
- package/dist/utils/hooks/useENS.js +4 -3
- package/dist/utils/hooks/useEnhanceDataWithNameMap.js +3 -2
- package/dist/utils/hooks/useEnhanceDataWithNameMap.js.map +1 -1
- package/dist/utils/hooks/useMethodAbi.js +3 -2
- package/dist/utils/hooks/useSearchParams.js +2 -1
- package/dist/utils/hooks/useSimulateTrace.js +5 -4
- package/dist/utils/hooks/useSimulateTrace.js.map +1 -1
- package/dist/utils/hooks/useTableData.js +7 -5
- package/dist/utils/hooks/useTableData.js.map +1 -1
- package/dist/utils/hooks/useTxTrace.js +5 -4
- package/dist/utils/index.js +3 -2
- package/dist/utils/request.js +2 -1
- package/package.json +11 -4
- package/dist/chunk-QCA4QRD4.js.map +0 -1
- package/dist/chunk-S2C6VOUJ.js.map +0 -1
- /package/dist/{chunk-ODPPKXIV.js.map → chunk-2PHHS2RO.js.map} +0 -0
- /package/dist/{chunk-IVE75CAC.js.map → chunk-33FSTL4O.js.map} +0 -0
- /package/dist/{chunk-HTRUONHE.js.map → chunk-3NZH5WQ5.js.map} +0 -0
- /package/dist/{chunk-QBF7EJFY.js.map → chunk-5X4PEJBK.js.map} +0 -0
- /package/dist/{chunk-TTMMIWXR.js.map → chunk-6B2K5TEW.js.map} +0 -0
- /package/dist/{chunk-LUHISU5F.js.map → chunk-6CSKHPNW.js.map} +0 -0
- /package/dist/{chunk-4MVQ3JTN.js.map → chunk-7XTWMLAL.js.map} +0 -0
- /package/dist/{chunk-4MEAKY73.js.map → chunk-BE7ARWED.js.map} +0 -0
- /package/dist/{chunk-TAEXZ5LI.js.map → chunk-BVUDZX7G.js.map} +0 -0
- /package/dist/{chunk-EGXD2GDI.js.map → chunk-DG5UBEHF.js.map} +0 -0
- /package/dist/{chunk-7FIPVSHQ.js.map → chunk-DYXED7QQ.js.map} +0 -0
- /package/dist/{chunk-WYM7FWXA.js.map → chunk-ESZKQ6TN.js.map} +0 -0
- /package/dist/{chunk-NBMABBMG.js.map → chunk-EXHT4Z5W.js.map} +0 -0
- /package/dist/{chunk-XGSBVC7P.js.map → chunk-FDTENXEV.js.map} +0 -0
- /package/dist/{chunk-OAUFBUYV.js.map → chunk-G5X35MKG.js.map} +0 -0
- /package/dist/{chunk-XIQH26WA.js.map → chunk-IGKHPUYH.js.map} +0 -0
- /package/dist/{chunk-B74PZXOZ.js.map → chunk-IZPVE2KL.js.map} +0 -0
- /package/dist/{chunk-LMY5VYFP.js.map → chunk-KJGWBTHN.js.map} +0 -0
- /package/dist/{chunk-2WY3J56A.js.map → chunk-KTHEE74W.js.map} +0 -0
- /package/dist/{chunk-CTCBKNSN.js.map → chunk-LG4QDJAZ.js.map} +0 -0
- /package/dist/{chunk-3XNQKM2D.js.map → chunk-LOWSXRES.js.map} +0 -0
- /package/dist/{chunk-H26P76N6.js.map → chunk-MD7Z3RQW.js.map} +0 -0
- /package/dist/{chunk-UBHTXZWS.js.map → chunk-OJKUPTS6.js.map} +0 -0
- /package/dist/{chunk-2RVLHSYV.js.map → chunk-P56G5URI.js.map} +0 -0
- /package/dist/{chunk-LZF26HB6.js.map → chunk-R6M4UPAP.js.map} +0 -0
- /package/dist/{chunk-RK632STC.js.map → chunk-SW7XEZSP.js.map} +0 -0
- /package/dist/{chunk-YLBHOAH5.js.map → chunk-SWXU6RIW.js.map} +0 -0
- /package/dist/{chunk-OGZSZDXL.js.map → chunk-TLB3MT66.js.map} +0 -0
- /package/dist/{chunk-XJPWKT2J.js.map → chunk-URGXFUYM.js.map} +0 -0
- /package/dist/{chunk-36EB4LRH.js.map → chunk-V63T5THG.js.map} +0 -0
- /package/dist/{chunk-D5HJCIRL.js.map → chunk-VHVK63XA.js.map} +0 -0
- /package/dist/{chunk-2T3VTZXW.js.map → chunk-VTQN4OFN.js.map} +0 -0
- /package/dist/{chunk-2BLHJLZO.js.map → chunk-VYC4H34V.js.map} +0 -0
- /package/dist/{chunk-B7IDVT2B.js.map → chunk-WOL4GXHM.js.map} +0 -0
- /package/dist/{chunk-TIWELXT7.js.map → chunk-WZNI2XMX.js.map} +0 -0
- /package/dist/{chunk-OUQEXLFQ.js.map → chunk-XD4ERIC5.js.map} +0 -0
- /package/dist/{chunk-QL4NKKTA.js.map → chunk-XF3VAJAR.js.map} +0 -0
|
@@ -1,62 +1,64 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TreeTraceTable
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-3NZH5WQ5.js";
|
|
4
4
|
import {
|
|
5
5
|
TraceDetail
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-33FSTL4O.js";
|
|
7
|
+
import "../../chunk-TLB3MT66.js";
|
|
8
|
+
import "../../chunk-DYXED7QQ.js";
|
|
9
9
|
import "../../chunk-UM5J477V.js";
|
|
10
10
|
import "../../chunk-4WLXG7ZY.js";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-URGXFUYM.js";
|
|
12
|
+
import "../../chunk-BVUDZX7G.js";
|
|
13
13
|
import "../../chunk-NWVSTRCG.js";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-5X4PEJBK.js";
|
|
15
|
+
import "../../chunk-MD7Z3RQW.js";
|
|
16
|
+
import "../../chunk-WZNI2XMX.js";
|
|
17
|
+
import "../../chunk-IZPVE2KL.js";
|
|
18
|
+
import "../../chunk-FDTENXEV.js";
|
|
19
|
+
import "../../chunk-7XTWMLAL.js";
|
|
19
20
|
import "../../chunk-GPHUCEN2.js";
|
|
20
|
-
import "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
22
|
-
import "../../chunk-
|
|
23
|
-
import "../../chunk-
|
|
24
|
-
import "../../chunk-UBHTXZWS.js";
|
|
25
|
-
import "../../chunk-RK632STC.js";
|
|
26
|
-
import "../../chunk-QL4NKKTA.js";
|
|
21
|
+
import "../../chunk-P56G5URI.js";
|
|
22
|
+
import "../../chunk-OJKUPTS6.js";
|
|
23
|
+
import "../../chunk-SW7XEZSP.js";
|
|
24
|
+
import "../../chunk-XF3VAJAR.js";
|
|
27
25
|
import "../../chunk-GZMSESHY.js";
|
|
26
|
+
import "../../chunk-JVCFVNGV.js";
|
|
27
|
+
import "../../chunk-SWXU6RIW.js";
|
|
28
28
|
import "../../chunk-XI5WO2NW.js";
|
|
29
29
|
import "../../chunk-XCLT7DP4.js";
|
|
30
30
|
import "../../chunk-O6NJ56NA.js";
|
|
31
31
|
import "../../chunk-XCKMXAL2.js";
|
|
32
32
|
import "../../chunk-TPUZ46LY.js";
|
|
33
33
|
import "../../chunk-X35GBAUQ.js";
|
|
34
|
-
import "../../chunk-
|
|
34
|
+
import "../../chunk-WOL4GXHM.js";
|
|
35
35
|
import "../../chunk-SBFEY7I7.js";
|
|
36
36
|
import "../../chunk-6A3FV7ST.js";
|
|
37
|
-
import "../../chunk-
|
|
38
|
-
import "../../chunk-
|
|
37
|
+
import "../../chunk-KTHEE74W.js";
|
|
38
|
+
import "../../chunk-IGKHPUYH.js";
|
|
39
39
|
import "../../chunk-2ZR25NMU.js";
|
|
40
40
|
import "../../chunk-CGDNDBBP.js";
|
|
41
41
|
import "../../chunk-S6O6Q2GQ.js";
|
|
42
42
|
import "../../chunk-LBAEFEJU.js";
|
|
43
43
|
import "../../chunk-5TGK2EA2.js";
|
|
44
44
|
import "../../chunk-ADNS57X5.js";
|
|
45
|
-
import "../../chunk-
|
|
46
|
-
import "../../chunk-
|
|
47
|
-
import "../../chunk-
|
|
45
|
+
import "../../chunk-6CSKHPNW.js";
|
|
46
|
+
import "../../chunk-VTQN4OFN.js";
|
|
47
|
+
import "../../chunk-ESZKQ6TN.js";
|
|
48
48
|
import "../../chunk-PRKOG6DK.js";
|
|
49
|
-
import "../../chunk-
|
|
50
|
-
import "../../chunk-
|
|
49
|
+
import "../../chunk-2PHHS2RO.js";
|
|
50
|
+
import "../../chunk-6B2K5TEW.js";
|
|
51
51
|
import "../../chunk-TOKKKTFG.js";
|
|
52
|
-
import "../../chunk-
|
|
52
|
+
import "../../chunk-KEXEB4J3.js";
|
|
53
|
+
import "../../chunk-ATKGS22K.js";
|
|
53
54
|
import "../../chunk-BMO4IZHV.js";
|
|
54
55
|
import "../../chunk-LRCAKRPK.js";
|
|
55
|
-
import "../../chunk-
|
|
56
|
+
import "../../chunk-DG5UBEHF.js";
|
|
56
57
|
import "../../chunk-HHJWVVJC.js";
|
|
57
|
-
import "../../chunk-
|
|
58
|
+
import "../../chunk-A66ETOJQ.js";
|
|
58
59
|
import "../../chunk-ON5OBLMV.js";
|
|
59
60
|
import "../../chunk-YEINMVAR.js";
|
|
61
|
+
import "../../chunk-X6IIYPI2.js";
|
|
60
62
|
import "../../chunk-L4AFJGXJ.js";
|
|
61
63
|
import "../../chunk-WQG2LZMB.js";
|
|
62
64
|
export {
|
package/dist/utils/address.js
CHANGED
|
@@ -23,11 +23,12 @@ import {
|
|
|
23
23
|
isSimplyZeroAddress,
|
|
24
24
|
isSpecialAddress,
|
|
25
25
|
isZeroAddress
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-2PHHS2RO.js";
|
|
27
27
|
import "../chunk-HHJWVVJC.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-A66ETOJQ.js";
|
|
29
29
|
import "../chunk-ON5OBLMV.js";
|
|
30
30
|
import "../chunk-YEINMVAR.js";
|
|
31
|
+
import "../chunk-X6IIYPI2.js";
|
|
31
32
|
import "../chunk-L4AFJGXJ.js";
|
|
32
33
|
import "../chunk-WQG2LZMB.js";
|
|
33
34
|
export {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseString
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DG5UBEHF.js";
|
|
4
4
|
import "../chunk-HHJWVVJC.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-A66ETOJQ.js";
|
|
6
6
|
import "../chunk-ON5OBLMV.js";
|
|
7
7
|
import "../chunk-YEINMVAR.js";
|
|
8
|
+
import "../chunk-X6IIYPI2.js";
|
|
8
9
|
import "../chunk-L4AFJGXJ.js";
|
|
9
10
|
import "../chunk-WQG2LZMB.js";
|
|
10
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/contractManagerTool.ts"],"sourcesContent":["import SDK from 'js-conflux-sdk';\nimport { gzip } from 'pako';\nimport { parseString } from './index';\n\ntype AnyFunction = (...args: any[]) => any;\n\n// fix js-conflux-sdk types\nconst SDKFormat: (\n schema: Record<string, unknown> | Record<string, unknown>[],\n options?: {\n pick?: boolean;\n strict?: boolean;\n },\n) => AnyFunction = SDK.format;\nconst SDKContract: new (\n {\n abi,\n address,\n bytecode,\n decodeByteToHex,\n }: {\n abi: any[];\n address?: string;\n bytecode?: string;\n decodeByteToHex?: boolean;\n },\n conflux?: any,\n) => SDK.Contract = SDK.Contract;\n\nconst zipContractAndToken = SDKFormat(\n {\n address: SDK.format.hexAddress, // cip-37\n name: SDK.format.bytes.$before(parseString).$or(undefined),\n website: SDK.format.bytes.$before(parseString).$or(undefined),\n abi: SDK.format.bytes\n .$before(parseString)\n .$parse(JSON.stringify, Array.isArray)\n .$after(gzip)\n .$or(undefined),\n sourceCode: SDK.format.bytes\n .$before(parseString)\n .$after(gzip)\n .$or(undefined),\n optimizeRuns: SDK.format.uInt.$after(String).$or(undefined),\n icon: SDK.format.bytes.$before(parseString).$after(gzip).$or(undefined),\n tokenIcon: SDK.format.bytes\n .$before(parseString)\n .$after(gzip)\n .$or(undefined),\n tokenWebsite: SDK.format.bytes.$before(parseString).$or(undefined),\n ipfsGateway: SDK.format.bytes.$before(parseString).$or(undefined),\n },\n { pick: true, strict: true },\n);\n\nconst formatAnnounceArray = SDKFormat([\n {\n key: SDK.format.bytes.$before(parseString),\n value: SDK.format.bytes.$before(parseString),\n },\n]);\n\nconst announcement = new SDKContract({\n abi: [\n {\n type: 'function',\n name: 'announce',\n inputs: [\n {\n type: 'tuple[]',\n components: [\n { name: 'key', type: 'bytes' },\n { name: 'value', type: 'bytes' },\n ],\n },\n ],\n outputs: [{ name: 'count', type: 'uint256' }],\n },\n ],\n});\n\nfunction chunk(array: { key: string; value: string }[], maxSize = 150 * 1000) {\n const groupArray: { key: string; value: string }[][] = [];\n\n let group: { key: string; value: string }[] = [];\n let groupSize = 0;\n array.forEach(({ key, value }) => {\n const size = key.length + value.length;\n if (size > maxSize) {\n throw new Error(\n `key \"${key}\" and data size ${size} > maximum bytes ${maxSize}`,\n );\n }\n\n if (groupSize + size > maxSize) {\n groupArray.push(group);\n group = [];\n groupSize = 0;\n }\n\n group.push({ key, value });\n groupSize += size;\n });\n groupArray.push(group);\n\n return groupArray;\n}\n/**\n * Format, zip, split and encode contract&token register information as Announcement transaction data\n *\n * @param options {object}\n * @param options.address {string} - contract address hex\n * @param [options.name] {string} - contract name\n * @param [options.website] {string}\n * @param [options.abi] {object} - contract abi json or array object (will be gzip)\n * @param [options.sourceCode] {string} - contract source code (will be gzip)\n * @param [options.optimizeRuns] {number} - contract code compile optimize runs times\n * @param [options.icon] {Buffer} - contract icon bytes (will be gzip)\n * @param [options.tokenIcon] {Buffer} - token icon bytes (will be gzip)\n * @param [options.tokenWebsite] {string}\n * @param [options.ipfsGateway] {string}\n * @return {string[]} encoded transaction data, spilt by max transaction size\n *\n * @example\n * > packContractAndToken({\n address: '0x01234567890123456789012345678901A3456789',\n name: 'MiniERC20',\n abi: [\n {\n type: 'function',\n name: 'decimals',\n inputs: [],\n outputs: [{ type: 'uint8' }],\n },\n ],\n optimizeRuns: 10,\n icon: Buffer.from([1, 2, 3, 4, 5]),\n tokenIcon: Buffer.from([1, 2, 3, 4, 5]),\n })\n [\n '0xcf7bb3090000...'\n ]\n */\nexport function packContractAndToken(options: {\n address: string;\n name?: string;\n website?: string;\n abi?: object;\n sourceCode?: string;\n optimizeRuns?: number;\n icon?: string;\n tokenIcon?: string;\n tokenWebsite?: string;\n ipfsGateway?: string;\n}): string[] {\n const { address, tokenIcon, tokenWebsite, ipfsGateway, ...object } =\n zipContractAndToken(options);\n const array = [{ key: `contract/list/${address}`, value: address }];\n Object.entries(object).forEach(([field, value]) => {\n array.push({ key: `contract/${address}/${field}`, value });\n });\n // push token info\n array.push({ key: `token/list/${address}`, value: address });\n array.push({ key: `token/${address}/icon`, value: tokenIcon });\n array.push({ key: `token/${address}/website`, value: tokenWebsite });\n array.push({ key: `token/${address}/ipfsGateway`, value: ipfsGateway });\n\n const announceArray = formatAnnounceArray(array);\n return chunk(announceArray).map(\n group => (announcement as any).announce(group).data,\n );\n}\n\nconst zipContractABI = SDKFormat(\n {\n abi: SDK.format.bytes\n .$before(parseString)\n .$parse(JSON.stringify, Array.isArray),\n },\n { pick: true, strict: true },\n);\n\n/**\n * Format, zip, split and encode contract abi as Announcement transaction data\n *\n * @param options {object}\n * @param options.abi {string[]} - contract abi array object\n * @return {string[]} encoded transaction data, spilt by max transaction size\n *\n * @example\n * > packContractAbi({\n abi: [\"function transfer(address, uint256)\", \"event Transfer(address indexed from, address indexed to, address value)\"],\n })\n [\n '0xcf7bb3090000...'\n ]\n */\nexport function packContractABI(options: { abi?: string[] }): string[] {\n const { abi } = zipContractABI(options);\n const array = [{ key: `contract/abi`, value: abi }];\n const announceArray = formatAnnounceArray(array);\n return chunk(announceArray).map(\n group => (announcement as any).announce(group).data,\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/contractManagerTool.ts"],"sourcesContent":["import SDK from 'js-conflux-sdk';\nimport { gzip } from 'pako';\nimport { parseString } from './index';\n\ntype AnyFunction = (...args: any[]) => any;\n\n// fix js-conflux-sdk types\nconst SDKFormat: (\n schema: Record<string, unknown> | Record<string, unknown>[],\n options?: {\n pick?: boolean;\n strict?: boolean;\n },\n) => AnyFunction = SDK.format;\nconst SDKContract: new (\n {\n abi,\n address,\n bytecode,\n decodeByteToHex,\n }: {\n abi: any[];\n address?: string;\n bytecode?: string;\n decodeByteToHex?: boolean;\n },\n conflux?: any,\n) => SDK.Contract = SDK.Contract;\n\nconst zipContractAndToken = SDKFormat(\n {\n address: SDK.format.hexAddress, // cip-37\n name: SDK.format.bytes.$before(parseString).$or(undefined),\n website: SDK.format.bytes.$before(parseString).$or(undefined),\n abi: SDK.format.bytes\n .$before(parseString)\n .$parse(JSON.stringify, Array.isArray)\n .$after(gzip)\n .$or(undefined),\n sourceCode: SDK.format.bytes\n .$before(parseString)\n .$after(gzip)\n .$or(undefined),\n optimizeRuns: SDK.format.uInt.$after(String).$or(undefined),\n icon: SDK.format.bytes.$before(parseString).$after(gzip).$or(undefined),\n tokenIcon: SDK.format.bytes\n .$before(parseString)\n .$after(gzip)\n .$or(undefined),\n tokenWebsite: SDK.format.bytes.$before(parseString).$or(undefined),\n ipfsGateway: SDK.format.bytes.$before(parseString).$or(undefined),\n },\n { pick: true, strict: true },\n);\n\nconst formatAnnounceArray = SDKFormat([\n {\n key: SDK.format.bytes.$before(parseString),\n value: SDK.format.bytes.$before(parseString),\n },\n]);\n\nconst announcement = new SDKContract({\n abi: [\n {\n type: 'function',\n name: 'announce',\n inputs: [\n {\n type: 'tuple[]',\n components: [\n { name: 'key', type: 'bytes' },\n { name: 'value', type: 'bytes' },\n ],\n },\n ],\n outputs: [{ name: 'count', type: 'uint256' }],\n },\n ],\n});\n\nfunction chunk(array: { key: string; value: string }[], maxSize = 150 * 1000) {\n const groupArray: { key: string; value: string }[][] = [];\n\n let group: { key: string; value: string }[] = [];\n let groupSize = 0;\n array.forEach(({ key, value }) => {\n const size = key.length + value.length;\n if (size > maxSize) {\n throw new Error(\n `key \"${key}\" and data size ${size} > maximum bytes ${maxSize}`,\n );\n }\n\n if (groupSize + size > maxSize) {\n groupArray.push(group);\n group = [];\n groupSize = 0;\n }\n\n group.push({ key, value });\n groupSize += size;\n });\n groupArray.push(group);\n\n return groupArray;\n}\n/**\n * Format, zip, split and encode contract&token register information as Announcement transaction data\n *\n * @param options {object}\n * @param options.address {string} - contract address hex\n * @param [options.name] {string} - contract name\n * @param [options.website] {string}\n * @param [options.abi] {object} - contract abi json or array object (will be gzip)\n * @param [options.sourceCode] {string} - contract source code (will be gzip)\n * @param [options.optimizeRuns] {number} - contract code compile optimize runs times\n * @param [options.icon] {Buffer} - contract icon bytes (will be gzip)\n * @param [options.tokenIcon] {Buffer} - token icon bytes (will be gzip)\n * @param [options.tokenWebsite] {string}\n * @param [options.ipfsGateway] {string}\n * @return {string[]} encoded transaction data, spilt by max transaction size\n *\n * @example\n * > packContractAndToken({\n address: '0x01234567890123456789012345678901A3456789',\n name: 'MiniERC20',\n abi: [\n {\n type: 'function',\n name: 'decimals',\n inputs: [],\n outputs: [{ type: 'uint8' }],\n },\n ],\n optimizeRuns: 10,\n icon: Buffer.from([1, 2, 3, 4, 5]),\n tokenIcon: Buffer.from([1, 2, 3, 4, 5]),\n })\n [\n '0xcf7bb3090000...'\n ]\n */\nexport function packContractAndToken(options: {\n address: string;\n name?: string;\n website?: string;\n abi?: object;\n sourceCode?: string;\n optimizeRuns?: number;\n icon?: string;\n tokenIcon?: string;\n tokenWebsite?: string;\n ipfsGateway?: string;\n}): string[] {\n const { address, tokenIcon, tokenWebsite, ipfsGateway, ...object } =\n zipContractAndToken(options);\n const array = [{ key: `contract/list/${address}`, value: address }];\n Object.entries(object).forEach(([field, value]) => {\n array.push({ key: `contract/${address}/${field}`, value });\n });\n // push token info\n array.push({ key: `token/list/${address}`, value: address });\n array.push({ key: `token/${address}/icon`, value: tokenIcon });\n array.push({ key: `token/${address}/website`, value: tokenWebsite });\n array.push({ key: `token/${address}/ipfsGateway`, value: ipfsGateway });\n\n const announceArray = formatAnnounceArray(array);\n return chunk(announceArray).map(\n group => (announcement as any).announce(group).data,\n );\n}\n\nconst zipContractABI = SDKFormat(\n {\n abi: SDK.format.bytes\n .$before(parseString)\n .$parse(JSON.stringify, Array.isArray),\n },\n { pick: true, strict: true },\n);\n\n/**\n * Format, zip, split and encode contract abi as Announcement transaction data\n *\n * @param options {object}\n * @param options.abi {string[]} - contract abi array object\n * @return {string[]} encoded transaction data, spilt by max transaction size\n *\n * @example\n * > packContractAbi({\n abi: [\"function transfer(address, uint256)\", \"event Transfer(address indexed from, address indexed to, address value)\"],\n })\n [\n '0xcf7bb3090000...'\n ]\n */\nexport function packContractABI(options: { abi?: string[] }): string[] {\n const { abi } = zipContractABI(options);\n const array = [{ key: `contract/abi`, value: abi }];\n const announceArray = formatAnnounceArray(array);\n return chunk(announceArray).map(\n group => (announcement as any).announce(group).data,\n );\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO,SAAS;AAChB,SAAS,YAAY;AAMrB,IAAM,YAMa,IAAI;AACvB,IAAM,cAac,IAAI;AAExB,IAAM,sBAAsB;AAAA,EAC1B;AAAA,IACE,SAAS,IAAI,OAAO;AAAA;AAAA,IACpB,MAAM,IAAI,OAAO,MAAM,QAAQ,WAAW,EAAE,IAAI,MAAS;AAAA,IACzD,SAAS,IAAI,OAAO,MAAM,QAA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O,MACb,QAAQ,WAAW,EACnB,OAAO,KAAK,WAAW,MAAM,OAAO;AAAA,EACzC;AAAA,EACA,EAAE,MAAM,MAAM,QAAQ,KAAK;AAC7B;AAiBO,SAAS,gBAAgB,SAAuC;AACrE,QAAM,EAAE,IAAI,IAAI,eAAe,OAAO;AACtC,QAAM,QAAQ,CAAC,EAAE,KAAK,gBAAgB,OAAO,IAAI,CAAC;AAClD,QAAM,gBAAgB,oBAAoB,KAAK;AAC/C,SAAO,MAAM,aAAa,EAAE;AAAA,IAC1B,WAAU,aAAqB,SAAS,KAAK,EAAE;AAAA,EACjD;AACF;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAbiItemById
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-IGKHPUYH.js";
|
|
4
|
+
import "../../chunk-A66ETOJQ.js";
|
|
5
5
|
import "../../chunk-ON5OBLMV.js";
|
|
6
6
|
import "../../chunk-YEINMVAR.js";
|
|
7
|
+
import "../../chunk-X6IIYPI2.js";
|
|
7
8
|
import "../../chunk-L4AFJGXJ.js";
|
|
8
9
|
import "../../chunk-WQG2LZMB.js";
|
|
9
10
|
export {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAddressLabel
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-OJKUPTS6.js";
|
|
4
|
+
import "../../chunk-2PHHS2RO.js";
|
|
5
5
|
import "../../chunk-HHJWVVJC.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-A66ETOJQ.js";
|
|
7
7
|
import "../../chunk-ON5OBLMV.js";
|
|
8
8
|
import "../../chunk-YEINMVAR.js";
|
|
9
|
+
import "../../chunk-X6IIYPI2.js";
|
|
9
10
|
import "../../chunk-L4AFJGXJ.js";
|
|
10
11
|
import "../../chunk-WQG2LZMB.js";
|
|
11
12
|
export {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
transformNameMapKeysToLowerCase,
|
|
3
3
|
useAddressNameMap
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-XF3VAJAR.js";
|
|
5
|
+
import "../../chunk-A66ETOJQ.js";
|
|
6
6
|
import "../../chunk-ON5OBLMV.js";
|
|
7
7
|
import "../../chunk-YEINMVAR.js";
|
|
8
|
+
import "../../chunk-X6IIYPI2.js";
|
|
8
9
|
import "../../chunk-L4AFJGXJ.js";
|
|
9
10
|
import "../../chunk-WQG2LZMB.js";
|
|
10
11
|
export {
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useSearchParams
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-6R34R4GT.js";
|
|
4
4
|
import {
|
|
5
5
|
isAddressEqual
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-2PHHS2RO.js";
|
|
7
7
|
import "../../chunk-HHJWVVJC.js";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-A66ETOJQ.js";
|
|
9
9
|
import "../../chunk-ON5OBLMV.js";
|
|
10
10
|
import "../../chunk-YEINMVAR.js";
|
|
11
|
+
import {
|
|
12
|
+
query_string_default
|
|
13
|
+
} from "../../chunk-X6IIYPI2.js";
|
|
11
14
|
import "../../chunk-L4AFJGXJ.js";
|
|
12
15
|
import "../../chunk-WQG2LZMB.js";
|
|
13
16
|
|
|
14
17
|
// src/utils/hooks/useAutoSetHolderFilterParams.ts
|
|
15
18
|
import { useEffect, useState } from "react";
|
|
16
19
|
import { useLocation, useHistory } from "react-router-dom";
|
|
17
|
-
import qs from "query-string";
|
|
18
20
|
var useAutoSetHolderFilterParams = (keys) => {
|
|
19
21
|
const [inHolderFilter, setInHolderFilter] = useState(false);
|
|
20
22
|
const history = useHistory();
|
|
@@ -36,7 +38,7 @@ var useAutoSetHolderFilterParams = (keys) => {
|
|
|
36
38
|
);
|
|
37
39
|
setInHolderFilter(true);
|
|
38
40
|
history.replace(
|
|
39
|
-
|
|
41
|
+
query_string_default.stringifyUrl({
|
|
40
42
|
url: pathname,
|
|
41
43
|
query: {
|
|
42
44
|
...query,
|
|
@@ -56,7 +58,7 @@ var useAutoSetHolderFilterParams = (keys) => {
|
|
|
56
58
|
})) {
|
|
57
59
|
setInHolderFilter(false);
|
|
58
60
|
history.replace(
|
|
59
|
-
|
|
61
|
+
query_string_default.stringifyUrl({
|
|
60
62
|
url: pathname,
|
|
61
63
|
query: {
|
|
62
64
|
...query
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/hooks/useAutoSetHolderFilterParams.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useLocation, useHistory } from 'react-router-dom';\nimport qs from 'query-string';\nimport { useSearchParams } from './useSearchParams';\nimport { isAddressEqual } from '../address';\n\nexport const useAutoSetHolderFilterParams = (keys: string[]) => {\n const [inHolderFilter, setInHolderFilter] = useState(false);\n const history = useHistory();\n const { pathname } = useLocation();\n const { a: holder, ...query } = useSearchParams() as Record<string, string>;\n // enter holder filter\n useEffect(() => {\n if (\n holder &&\n keys.every(key => {\n const value = query[key];\n return (\n !value ||\n isAddressEqual(value, holder, {\n isAddress: () => true,\n })\n );\n })\n ) {\n const newParams = keys.reduce(\n (prev, curr) => {\n prev[curr] = holder;\n return prev;\n },\n {} as Record<string, string>,\n );\n setInHolderFilter(true);\n history.replace(\n qs.stringifyUrl({\n url: pathname,\n query: {\n ...query,\n a: holder,\n ...newParams,\n },\n }),\n );\n }\n }, [holder]);\n\n // exit holder filter if holder is not equal to query[key]\n useEffect(() => {\n if (\n holder &&\n inHolderFilter &&\n keys.some(key => {\n const value = query[key];\n return (\n !value ||\n !isAddressEqual(value, holder, {\n isAddress: () => true,\n })\n );\n })\n ) {\n setInHolderFilter(false);\n history.replace(\n qs.stringifyUrl({\n url: pathname,\n query: {\n ...query,\n },\n }),\n );\n }\n }, [holder, history, pathname, query, inHolderFilter]);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useAutoSetHolderFilterParams.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useLocation, useHistory } from 'react-router-dom';\nimport qs from 'query-string';\nimport { useSearchParams } from './useSearchParams';\nimport { isAddressEqual } from '../address';\n\nexport const useAutoSetHolderFilterParams = (keys: string[]) => {\n const [inHolderFilter, setInHolderFilter] = useState(false);\n const history = useHistory();\n const { pathname } = useLocation();\n const { a: holder, ...query } = useSearchParams() as Record<string, string>;\n // enter holder filter\n useEffect(() => {\n if (\n holder &&\n keys.every(key => {\n const value = query[key];\n return (\n !value ||\n isAddressEqual(value, holder, {\n isAddress: () => true,\n })\n );\n })\n ) {\n const newParams = keys.reduce(\n (prev, curr) => {\n prev[curr] = holder;\n return prev;\n },\n {} as Record<string, string>,\n );\n setInHolderFilter(true);\n history.replace(\n qs.stringifyUrl({\n url: pathname,\n query: {\n ...query,\n a: holder,\n ...newParams,\n },\n }),\n );\n }\n }, [holder]);\n\n // exit holder filter if holder is not equal to query[key]\n useEffect(() => {\n if (\n holder &&\n inHolderFilter &&\n keys.some(key => {\n const value = query[key];\n return (\n !value ||\n !isAddressEqual(value, holder, {\n isAddress: () => true,\n })\n );\n })\n ) {\n setInHolderFilter(false);\n history.replace(\n qs.stringifyUrl({\n url: pathname,\n query: {\n ...query,\n },\n }),\n );\n }\n }, [holder, history, pathname, query, inHolderFilter]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,aAAa,kBAAkB;AAKjC,IAAM,+BAA+B,CAAC,SAAmB;AAC9D,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAC1D,QAAM,UAAU,WAAW;AAC3B,QAAM,EAAE,SAAS,IAAI,YAAY;AACjC,QAAM,EAAE,GAAG,QAAQ,GAAG,MAAM,IAAI,gBAAgB;AAEhD,YAAU,MAAM;AACd,QACE,UACA,KAAK,MAAM,SAAO;AAChB,YAAM,QAAQ,MAAM,GAAG;AACvB,aACE,CAAC,SACD,eAAe,OAAO,QAAQ;AAAA,QAC5B,WAAW,MAAM;AAAA,MACnB,CAAC;AAAA,IAEL,CAAC,GACD;AACA,YAAM,YAAY,KAAK;AAAA,QACrB,CAAC,MAAM,SAAS;AACd,eAAK,IAAI,IAAI;AACb,iBAAO;AAAA,QACT;AAAA,QACA,CAAC;AAAA,MACH;AACA,wBAAkB,IAAI;AACtB,cAAQ;AAAA,QACN,qBAAG,aAAa;AAAA,UACd,KAAK;AAAA,UACL,OAAO;AAAA,YACL,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAG;AAAA,UACL;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAGX,YAAU,MAAM;AACd,QACE,UACA,kBACA,KAAK,KAAK,SAAO;AACf,YAAM,QAAQ,MAAM,GAAG;AACvB,aACE,CAAC,SACD,CAAC,eAAe,OAAO,QAAQ;AAAA,QAC7B,WAAW,MAAM;AAAA,MACnB,CAAC;AAAA,IAEL,CAAC,GACD;AACA,wBAAkB,KAAK;AACvB,cAAQ;AAAA,QACN,qBAAG,aAAa;AAAA,UACd,KAAK;AAAA,UACL,OAAO;AAAA,YACL,GAAG;AAAA,UACL;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,SAAS,UAAU,OAAO,cAAc,CAAC;AACvD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useContractDetail
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-KTHEE74W.js";
|
|
4
|
+
import "../../chunk-A66ETOJQ.js";
|
|
5
5
|
import "../../chunk-ON5OBLMV.js";
|
|
6
6
|
import "../../chunk-YEINMVAR.js";
|
|
7
|
+
import "../../chunk-X6IIYPI2.js";
|
|
7
8
|
import "../../chunk-L4AFJGXJ.js";
|
|
8
9
|
import "../../chunk-WQG2LZMB.js";
|
|
9
10
|
export {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
reqContractsStatistics,
|
|
3
3
|
reqVerifiedContractsStatistics
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-A66ETOJQ.js";
|
|
5
5
|
import "../../chunk-ON5OBLMV.js";
|
|
6
6
|
import "../../chunk-YEINMVAR.js";
|
|
7
|
+
import "../../chunk-X6IIYPI2.js";
|
|
7
8
|
import "../../chunk-L4AFJGXJ.js";
|
|
8
9
|
import "../../chunk-WQG2LZMB.js";
|
|
9
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/hooks/useContractsStatistics.ts"],"sourcesContent":["import useSWR from 'swr';\nimport {\n reqContractsStatistics,\n reqVerifiedContractsStatistics,\n} from '../request';\nimport { useMemo } from 'react';\n\nexport const useContractsStatistics = () => {\n const { data: contractsStatistics, isLoading: contractsStatisticsLoading } =\n useSWR('contracts-statistics', () =>\n reqContractsStatistics({ limit: '2' }),\n );\n const {\n data: verifiedContractsStatistics,\n isLoading: verifiedContractsStatisticsLoading,\n } = useSWR('verified-contracts-statistics', () =>\n reqVerifiedContractsStatistics({ limit: '2' }),\n );\n return useMemo(() => {\n const [todayContracts, yesterdayContracts] =\n contractsStatistics?.list ?? [];\n const [todayVerifiedContracts, yesterdayVerifiedContracts] =\n verifiedContractsStatistics?.list ?? [];\n return [\n {\n totalContractsDeployed: todayContracts?.total,\n newContractsDeployed: yesterdayContracts?.count,\n totalContractsVerified: todayVerifiedContracts?.total,\n newContractsVerified: yesterdayVerifiedContracts?.count,\n },\n contractsStatisticsLoading || verifiedContractsStatisticsLoading,\n ] as const;\n }, [\n contractsStatistics,\n contractsStatisticsLoading,\n verifiedContractsStatistics,\n verifiedContractsStatisticsLoading,\n ]);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useContractsStatistics.ts"],"sourcesContent":["import useSWR from 'swr';\nimport {\n reqContractsStatistics,\n reqVerifiedContractsStatistics,\n} from '../request';\nimport { useMemo } from 'react';\n\nexport const useContractsStatistics = () => {\n const { data: contractsStatistics, isLoading: contractsStatisticsLoading } =\n useSWR('contracts-statistics', () =>\n reqContractsStatistics({ limit: '2' }),\n );\n const {\n data: verifiedContractsStatistics,\n isLoading: verifiedContractsStatisticsLoading,\n } = useSWR('verified-contracts-statistics', () =>\n reqVerifiedContractsStatistics({ limit: '2' }),\n );\n return useMemo(() => {\n const [todayContracts, yesterdayContracts] =\n contractsStatistics?.list ?? [];\n const [todayVerifiedContracts, yesterdayVerifiedContracts] =\n verifiedContractsStatistics?.list ?? [];\n return [\n {\n totalContractsDeployed: todayContracts?.total,\n newContractsDeployed: yesterdayContracts?.count,\n totalContractsVerified: todayVerifiedContracts?.total,\n newContractsVerified: yesterdayVerifiedContracts?.count,\n },\n contractsStatisticsLoading || verifiedContractsStatisticsLoading,\n ] as const;\n }, [\n contractsStatistics,\n contractsStatisticsLoading,\n verifiedContractsStatistics,\n verifiedContractsStatisticsLoading,\n ]);\n};\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,YAAY;AAKnB,SAAS,eAAe;AAEjB,IAAM,yBAAyB,MAAM;AAC1C,QAAM,EAAE,MAAM,qBAAqB,WAAW,2BAA2B,IACvE;AAAA,IAAO;AAAA,IAAwB,MAC7B,uBAAuB,EAAE,OAAO,IAAI,CAAC;AAAA,EACvC;AACF,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,WAAW;AAAA,EACb,IAAI;AAAA,IAAO;AAAA,IAAiC,MAC1C,+BAA+B,EAAE,OAAO,IAAI,CAAC;AAAA,EAC/C;AACA,SAAO,QAAQ,MAAM;AACnB,UAAM,CAAC,gBAAgB,kBAAkB,IACvC,qBAAqB,QAAQ,CAAC;AAChC,UAAM,CAAC,wBAAwB,0BAA0B,IACvD,6BAA6B,QAAQ,CAAC;AACxC,WAAO;AAAA,MACL;AAAA,QACE,wBAAwB,gBAAgB;AAAA,QACxC,sBAAsB,oBAAoB;AAAA,QAC1C,wBAAwB,wBAAwB;AAAA,QAChD,sBAAsB,4BAA4B;AAAA,MACpD;AAAA,MACA,8BAA8B;AAAA,IAChC;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionData
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-TLB3MT66.js";
|
|
4
|
+
import "../../chunk-DYXED7QQ.js";
|
|
5
5
|
import "../../chunk-SBFEY7I7.js";
|
|
6
6
|
import "../../chunk-6A3FV7ST.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-KTHEE74W.js";
|
|
8
8
|
import "../../chunk-2ZR25NMU.js";
|
|
9
9
|
import "../../chunk-CGDNDBBP.js";
|
|
10
10
|
import "../../chunk-S6O6Q2GQ.js";
|
|
11
11
|
import "../../chunk-LBAEFEJU.js";
|
|
12
12
|
import "../../chunk-5TGK2EA2.js";
|
|
13
13
|
import "../../chunk-ADNS57X5.js";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-DG5UBEHF.js";
|
|
15
15
|
import "../../chunk-HHJWVVJC.js";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-A66ETOJQ.js";
|
|
17
17
|
import "../../chunk-ON5OBLMV.js";
|
|
18
18
|
import "../../chunk-YEINMVAR.js";
|
|
19
|
+
import "../../chunk-X6IIYPI2.js";
|
|
19
20
|
import "../../chunk-L4AFJGXJ.js";
|
|
20
21
|
import "../../chunk-WQG2LZMB.js";
|
|
21
22
|
export {
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionError
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-WOL4GXHM.js";
|
|
4
4
|
import "../../chunk-SBFEY7I7.js";
|
|
5
5
|
import "../../chunk-6A3FV7ST.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-KTHEE74W.js";
|
|
7
|
+
import "../../chunk-IGKHPUYH.js";
|
|
8
8
|
import "../../chunk-2ZR25NMU.js";
|
|
9
9
|
import "../../chunk-CGDNDBBP.js";
|
|
10
10
|
import "../../chunk-S6O6Q2GQ.js";
|
|
11
11
|
import "../../chunk-LBAEFEJU.js";
|
|
12
12
|
import "../../chunk-5TGK2EA2.js";
|
|
13
13
|
import "../../chunk-ADNS57X5.js";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-DG5UBEHF.js";
|
|
15
15
|
import "../../chunk-HHJWVVJC.js";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-A66ETOJQ.js";
|
|
17
17
|
import "../../chunk-ON5OBLMV.js";
|
|
18
18
|
import "../../chunk-YEINMVAR.js";
|
|
19
|
+
import "../../chunk-X6IIYPI2.js";
|
|
19
20
|
import "../../chunk-L4AFJGXJ.js";
|
|
20
21
|
import "../../chunk-WQG2LZMB.js";
|
|
21
22
|
export {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useENS
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-VTQN4OFN.js";
|
|
4
|
+
import "../../chunk-2PHHS2RO.js";
|
|
5
5
|
import "../../chunk-HHJWVVJC.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-A66ETOJQ.js";
|
|
7
7
|
import "../../chunk-ON5OBLMV.js";
|
|
8
8
|
import "../../chunk-YEINMVAR.js";
|
|
9
|
+
import "../../chunk-X6IIYPI2.js";
|
|
9
10
|
import "../../chunk-L4AFJGXJ.js";
|
|
10
11
|
import "../../chunk-WQG2LZMB.js";
|
|
11
12
|
export {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
transformNameMapKeysToLowerCase,
|
|
3
3
|
useAddressNameMap
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-XF3VAJAR.js";
|
|
5
|
+
import "../../chunk-A66ETOJQ.js";
|
|
6
6
|
import "../../chunk-ON5OBLMV.js";
|
|
7
7
|
import "../../chunk-YEINMVAR.js";
|
|
8
|
+
import "../../chunk-X6IIYPI2.js";
|
|
8
9
|
import "../../chunk-L4AFJGXJ.js";
|
|
9
10
|
import "../../chunk-WQG2LZMB.js";
|
|
10
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/hooks/useEnhanceDataWithNameMap.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport {\n transformNameMapKeysToLowerCase,\n useAddressNameMap,\n} from './useAddressNameMap';\nimport { AddressNameMap } from '../request.types';\n\nexport const enhanceDataWithNameMap = (\n list?: Record<string, unknown>[],\n nameMap?: Record<string, AddressNameMap>,\n) => {\n if (!nameMap || !list) return list;\n const normalizedNameMap = transformNameMapKeysToLowerCase(nameMap);\n\n return (\n list.map(item => {\n const newItem = {\n ...item,\n nameMap: normalizedNameMap,\n };\n return newItem;\n }) || []\n );\n};\n\nexport const formatListResponseWithNameMap = <\n T extends Record<string, unknown>,\n>(\n res: T,\n) => {\n return {\n ...res,\n list: enhanceDataWithNameMap(\n res.list as Record<string, unknown>[],\n res.nameMap as Record<string, AddressNameMap>,\n ),\n };\n};\n\nexport const useEnhanceDataWithNameMap = (\n list?: Record<string, unknown>[],\n {\n addressKeys,\n nameMap,\n }: {\n addressKeys?: string[];\n nameMap?: Record<string, AddressNameMap>;\n } = {},\n) => {\n const keys = useMemo(() => addressKeys?.join(',') || '', [addressKeys]);\n const addresses = useMemo(() => {\n const set = new Set<string>();\n list?.forEach(item => {\n addressKeys?.forEach(key => {\n const address = item[key];\n if (address && typeof address === 'string') {\n set.add(address);\n }\n });\n });\n return Array.from(set);\n }, [list, keys]);\n const { data: fetchedNameMap, isLoading } = useAddressNameMap(\n addresses,\n !nameMap,\n );\n const finalNameMap = nameMap || fetchedNameMap;\n return useMemo(() => {\n return {\n data: enhanceDataWithNameMap(list, finalNameMap),\n isLoading,\n };\n }, [list, finalNameMap, isLoading]);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useEnhanceDataWithNameMap.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport {\n transformNameMapKeysToLowerCase,\n useAddressNameMap,\n} from './useAddressNameMap';\nimport { AddressNameMap } from '../request.types';\n\nexport const enhanceDataWithNameMap = (\n list?: Record<string, unknown>[],\n nameMap?: Record<string, AddressNameMap>,\n) => {\n if (!nameMap || !list) return list;\n const normalizedNameMap = transformNameMapKeysToLowerCase(nameMap);\n\n return (\n list.map(item => {\n const newItem = {\n ...item,\n nameMap: normalizedNameMap,\n };\n return newItem;\n }) || []\n );\n};\n\nexport const formatListResponseWithNameMap = <\n T extends Record<string, unknown>,\n>(\n res: T,\n) => {\n return {\n ...res,\n list: enhanceDataWithNameMap(\n res.list as Record<string, unknown>[],\n res.nameMap as Record<string, AddressNameMap>,\n ),\n };\n};\n\nexport const useEnhanceDataWithNameMap = (\n list?: Record<string, unknown>[],\n {\n addressKeys,\n nameMap,\n }: {\n addressKeys?: string[];\n nameMap?: Record<string, AddressNameMap>;\n } = {},\n) => {\n const keys = useMemo(() => addressKeys?.join(',') || '', [addressKeys]);\n const addresses = useMemo(() => {\n const set = new Set<string>();\n list?.forEach(item => {\n addressKeys?.forEach(key => {\n const address = item[key];\n if (address && typeof address === 'string') {\n set.add(address);\n }\n });\n });\n return Array.from(set);\n }, [list, keys]);\n const { data: fetchedNameMap, isLoading } = useAddressNameMap(\n addresses,\n !nameMap,\n );\n const finalNameMap = nameMap || fetchedNameMap;\n return useMemo(() => {\n return {\n data: enhanceDataWithNameMap(list, finalNameMap),\n isLoading,\n };\n }, [list, finalNameMap, isLoading]);\n};\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,eAAe;AAOjB,IAAM,yBAAyB,CACpC,MACA,YACG;AACH,MAAI,CAAC,WAAW,CAAC;AAAM,WAAO;AAC9B,QAAM,oBAAoB,gCAAgC,OAAO;AAEjE,SACE,KAAK,IAAI,UAAQ;AACf,UAAM,UAAU;AAAA,MACd,GAAG;AAAA,MACH,SAAS;AAAA,IACX;AACA,WAAO;AAAA,EACT,CAAC,KAAK,CAAC;AAEX;AAEO,IAAM,gCAAgC,CAG3C,QACG;AACH,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,CACvC,MACA;AAAA,EACE;AAAA,EACA;AACF,IAGI,CAAC,MACF;AACH,QAAM,OAAO,QAAQ,MAAM,aAAa,KAAK,GAAG,KAAK,IAAI,CAAC,WAAW,CAAC;AACtE,QAAM,YAAY,QAAQ,MAAM;AAC9B,UAAM,MAAM,oBAAI,IAAY;AAC5B,UAAM,QAAQ,UAAQ;AACpB,mBAAa,QAAQ,SAAO;AAC1B,cAAM,UAAU,KAAK,GAAG;AACxB,YAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,cAAI,IAAI,OAAO;AAAA,QACjB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AACD,WAAO,MAAM,KAAK,GAAG;AAAA,EACvB,GAAG,CAAC,MAAM,IAAI,CAAC;AACf,QAAM,EAAE,MAAM,gBAAgB,UAAU,IAAI;AAAA,IAC1C;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,eAAe,WAAW;AAChC,SAAO,QAAQ,MAAM;AACnB,WAAO;AAAA,MACL,MAAM,uBAAuB,MAAM,YAAY;AAAA,MAC/C;AAAA,IACF;AAAA,EACF,GAAG,CAAC,MAAM,cAAc,SAAS,CAAC;AACpC;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useMethodAbi
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-DYXED7QQ.js";
|
|
4
|
+
import "../../chunk-A66ETOJQ.js";
|
|
5
5
|
import "../../chunk-ON5OBLMV.js";
|
|
6
6
|
import "../../chunk-YEINMVAR.js";
|
|
7
|
+
import "../../chunk-X6IIYPI2.js";
|
|
7
8
|
import "../../chunk-L4AFJGXJ.js";
|
|
8
9
|
import "../../chunk-WQG2LZMB.js";
|
|
9
10
|
export {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isCreateCall,
|
|
3
3
|
isDelegateCall,
|
|
4
4
|
isStaticCall
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-V63T5THG.js";
|
|
6
6
|
import {
|
|
7
7
|
estimateGas
|
|
8
8
|
} from "../../chunk-SBFEY7I7.js";
|
|
@@ -17,17 +17,18 @@ import "../../chunk-5TGK2EA2.js";
|
|
|
17
17
|
import "../../chunk-ADNS57X5.js";
|
|
18
18
|
import {
|
|
19
19
|
formatAddress
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-2PHHS2RO.js";
|
|
21
21
|
import {
|
|
22
22
|
formatABI,
|
|
23
23
|
generateRandomId
|
|
24
|
-
} from "../../chunk-
|
|
24
|
+
} from "../../chunk-DG5UBEHF.js";
|
|
25
25
|
import "../../chunk-HHJWVVJC.js";
|
|
26
26
|
import {
|
|
27
27
|
fetchWithPrefix
|
|
28
|
-
} from "../../chunk-
|
|
28
|
+
} from "../../chunk-A66ETOJQ.js";
|
|
29
29
|
import "../../chunk-ON5OBLMV.js";
|
|
30
30
|
import "../../chunk-YEINMVAR.js";
|
|
31
|
+
import "../../chunk-X6IIYPI2.js";
|
|
31
32
|
import "../../chunk-L4AFJGXJ.js";
|
|
32
33
|
import "../../chunk-WQG2LZMB.js";
|
|
33
34
|
|
|
@@ -1 +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 } from '../sdk';\nimport { formatAddress } from '../address';\nimport BigNumber from 'bignumber.js';\nimport { Hex, Space } from '../types';\nimport {\n normalizeTransactionLists,\n type TransactionLists,\n} from '../transactionLists';\n\nexport interface SimulateLog {\n address: string;\n topics: string[];\n data: string;\n transactionLogIndex?: number;\n}\n\ntype BlockTag = 'latest' | 'safe' | 'finalized' | 'earliest' | 'pending' | Hex;\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 extends TransactionLists {\n from: Hex;\n to?: Hex;\n value?: string;\n data?: Hex;\n gas?: string;\n gasPrice?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: 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: BlockTag = 'latest',\n params: SimulateTraceConfig = {\n tracer: 'callTracer',\n tracerConfig: {\n onlyTopCall: false,\n },\n },\n) => {\n const url = `/traceCallView`;\n\n const { space, ...rawTx } = tx;\n if (space !== 'evm') {\n throw new Error('Simulate trace only supports EVM Space');\n }\n const simulateTx = { ...rawTx, ...normalizeTransactionLists(rawTx) };\n\n if (!simulateTx.maxFeePerGas && !simulateTx.gasPrice) {\n let feeCap = 22_000_000_000n; // 22 Gdrip\n if (simulateTx.maxPriorityFeePerGas !== undefined) {\n const priorityFee = BigInt(simulateTx.maxPriorityFeePerGas);\n if (priorityFee > feeCap) {\n feeCap = priorityFee;\n }\n }\n simulateTx.maxFeePerGas = `0x${feeCap.toString(16)}`;\n }\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 accessList: simulateTx.accessList,\n authorizationList: simulateTx.authorizationList,\n gasPrice: simulateTx.gasPrice,\n maxFeePerGas: simulateTx.maxFeePerGas,\n maxPriorityFeePerGas: simulateTx.maxPriorityFeePerGas,\n tag,\n });\n simulateTx.gas = `0x${gasLimit.toString(16)}`;\n } catch (error) {\n console.log('estimate gas failed:', error);\n }\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 tx,\n tag = 'latest',\n params = {\n tracer: 'callTracer',\n tracerConfig: {\n onlyTopCall: false,\n withLog: true,\n },\n },\n disabled = false,\n}: {\n tx?: SimulateTraceTxParams;\n tag?: BlockTag;\n params?: SimulateTraceConfig;\n disabled?: boolean;\n}) => {\n let key = null;\n if (!disabled && tx) {\n key = JSON.stringify([tx, tag, params]);\n }\n\n return useSWRImmutable(\n key,\n () =>\n tx &&\n querySimulateTrace(tx, tag, params).then(resp => {\n if (resp?.traceCall) {\n return formatSimulateTraceData(resp, tx.space);\n }\n }),\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,qBAAqB;AAa5B,OAAO,eAAe;AAwEtB,IAAM,0BAA0B,CAC9B,MACA,UACG;AACH,QAAM,cAAc,UAAU,SAAS,WAAW;AAClD,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,YAAY,KAAK,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ACF,CAAC;AACH;AAEO,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,MACZ,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,WAAW;AACb,MAKM;AACJ,MAAI,MAAM;AACV,MAAI,CAAC,YAAY,IAAI;AACnB,UAAM,KAAK,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC;AAAA,EACxC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,MACE,MACA,mBAAmB,IAAI,KAAK,MAAM,EAAE,KAAK,UAAQ;AAC/C,UAAI,MAAM,WAAW;AACnB,eAAO,wBAAwB,MAAM,GAAG,KAAK;AAAA,MAC/C;AAAA,IACF,CAAC;AAAA,EACL;AACF;","names":["list"]}
|
|
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 } from '../sdk';\nimport { formatAddress } from '../address';\nimport BigNumber from 'bignumber.js';\nimport { Hex, Space } from '../types';\nimport {\n normalizeTransactionLists,\n type TransactionLists,\n} from '../transactionLists';\n\nexport interface SimulateLog {\n address: string;\n topics: string[];\n data: string;\n transactionLogIndex?: number;\n}\n\ntype BlockTag = 'latest' | 'safe' | 'finalized' | 'earliest' | 'pending' | Hex;\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 extends TransactionLists {\n from: Hex;\n to?: Hex;\n value?: string;\n data?: Hex;\n gas?: string;\n gasPrice?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: 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: BlockTag = 'latest',\n params: SimulateTraceConfig = {\n tracer: 'callTracer',\n tracerConfig: {\n onlyTopCall: false,\n },\n },\n) => {\n const url = `/traceCallView`;\n\n const { space, ...rawTx } = tx;\n if (space !== 'evm') {\n throw new Error('Simulate trace only supports EVM Space');\n }\n const simulateTx = { ...rawTx, ...normalizeTransactionLists(rawTx) };\n\n if (!simulateTx.maxFeePerGas && !simulateTx.gasPrice) {\n let feeCap = 22_000_000_000n; // 22 Gdrip\n if (simulateTx.maxPriorityFeePerGas !== undefined) {\n const priorityFee = BigInt(simulateTx.maxPriorityFeePerGas);\n if (priorityFee > feeCap) {\n feeCap = priorityFee;\n }\n }\n simulateTx.maxFeePerGas = `0x${feeCap.toString(16)}`;\n }\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 accessList: simulateTx.accessList,\n authorizationList: simulateTx.authorizationList,\n gasPrice: simulateTx.gasPrice,\n maxFeePerGas: simulateTx.maxFeePerGas,\n maxPriorityFeePerGas: simulateTx.maxPriorityFeePerGas,\n tag,\n });\n simulateTx.gas = `0x${gasLimit.toString(16)}`;\n } catch (error) {\n console.log('estimate gas failed:', error);\n }\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 tx,\n tag = 'latest',\n params = {\n tracer: 'callTracer',\n tracerConfig: {\n onlyTopCall: false,\n withLog: true,\n },\n },\n disabled = false,\n}: {\n tx?: SimulateTraceTxParams;\n tag?: BlockTag;\n params?: SimulateTraceConfig;\n disabled?: boolean;\n}) => {\n let key = null;\n if (!disabled && tx) {\n key = JSON.stringify([tx, tag, params]);\n }\n\n return useSWRImmutable(\n key,\n () =>\n tx &&\n querySimulateTrace(tx, tag, params).then(resp => {\n if (resp?.traceCall) {\n return formatSimulateTraceData(resp, tx.space);\n }\n }),\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,qBAAqB;AAa5B,OAAO,eAAe;AAwEtB,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,QAAQ,EAAE;AACpC,QAAI,SAAS;AACb,QAAI,MAA2C;AAC/C,UAAM,YACJ,aAAa,eAAe,MACxB,UAAU,QAAQ,IAAI,eAAe,EAAE,IACvC;AACN,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,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,wBAAwB,KAAK;AAAA,IAC3C;AAAA,EACF;AAEA,QAAM,OAAO,KAAK,UAAU;AAAA,IAC1B,IAAI,iBAAiB;AAAA,IACrB,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ,CAAC,YAAY,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,CAAC;AAAA,EAC/B;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,MACZ,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,WAAW;AACb,MAKM;AACJ,MAAI,MAAM;AACV,MAAI,CAAC,YAAY,IAAI;AACnB,UAAM,KAAK,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC;AAAA,EACxC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,MACE,MACA,mBAAmB,IAAI,KAAK,MAAM,EAAE,KAAK,UAAQ;AAC/C,UAAI,MAAM,WAAW;AACnB,eAAO,wBAAwB,MAAM,GAAG,KAAK;AAAA,MAC/C;AAAA,IACF,CAAC;AAAA,EACL;AACF;","names":["list"]}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useSearchParams
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-6R34R4GT.js";
|
|
4
4
|
import {
|
|
5
5
|
fetchWithPrefix
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-A66ETOJQ.js";
|
|
7
7
|
import "../../chunk-ON5OBLMV.js";
|
|
8
8
|
import "../../chunk-YEINMVAR.js";
|
|
9
|
+
import {
|
|
10
|
+
query_string_default
|
|
11
|
+
} from "../../chunk-X6IIYPI2.js";
|
|
9
12
|
import "../../chunk-L4AFJGXJ.js";
|
|
10
13
|
import "../../chunk-WQG2LZMB.js";
|
|
11
14
|
|
|
12
15
|
// src/utils/hooks/useTableData.ts
|
|
13
16
|
import { useCallback, useMemo } from "react";
|
|
14
17
|
import { useHistory } from "react-router-dom";
|
|
15
|
-
import qs from "query-string";
|
|
16
18
|
import useSWR from "swr";
|
|
17
19
|
var toPositiveInt = (value, fallback, { allowZero = false } = {}) => {
|
|
18
20
|
const raw = Array.isArray(value) ? value[0] : value;
|
|
@@ -41,7 +43,7 @@ var useTableData = ({
|
|
|
41
43
|
const current = Math.floor(skip / limit) + 1;
|
|
42
44
|
const requestUrl = useMemo(() => {
|
|
43
45
|
const { skip: _s, limit: _l, ...restSearch } = search;
|
|
44
|
-
return
|
|
46
|
+
return query_string_default.stringifyUrl({
|
|
45
47
|
url,
|
|
46
48
|
query: {
|
|
47
49
|
...query || {},
|
|
@@ -64,7 +66,7 @@ var useTableData = ({
|
|
|
64
66
|
const nextPageSize = next.pageSize ?? pageSize;
|
|
65
67
|
const nextCurrent = next.current ?? current;
|
|
66
68
|
const nextSkip = Math.max(0, (nextCurrent - 1) * nextPageSize);
|
|
67
|
-
const nextSearch =
|
|
69
|
+
const nextSearch = query_string_default.stringify({
|
|
68
70
|
...search,
|
|
69
71
|
skip: String(nextSkip),
|
|
70
72
|
limit: String(nextPageSize)
|