@cfxjs/sirius-next-common 0.1.26 → 0.1.28
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-24MUZRQJ.js +108 -0
- package/dist/chunk-24MUZRQJ.js.map +1 -0
- package/dist/chunk-24Z2NTKQ.js +43 -0
- package/dist/chunk-24Z2NTKQ.js.map +1 -0
- package/dist/chunk-26ABIFHL.js +127 -0
- package/dist/chunk-26ABIFHL.js.map +1 -0
- package/dist/chunk-27S75HVO.js +108 -0
- package/dist/chunk-27S75HVO.js.map +1 -0
- package/dist/chunk-2ATI4GSO.js +130 -0
- package/dist/chunk-2ATI4GSO.js.map +1 -0
- package/dist/chunk-2RR4CX3F.js +141 -0
- package/dist/chunk-2RR4CX3F.js.map +1 -0
- package/dist/chunk-2S6T3LVP.js +212 -0
- package/dist/chunk-2S6T3LVP.js.map +1 -0
- package/dist/chunk-3357K7AW.js +108 -0
- package/dist/chunk-3357K7AW.js.map +1 -0
- package/dist/chunk-3BLNV3M6.js +49 -0
- package/dist/chunk-3BLNV3M6.js.map +1 -0
- package/dist/chunk-3DOLNPRU.js +27 -0
- package/dist/chunk-3DOLNPRU.js.map +1 -0
- package/dist/chunk-3MYGXIHH.js +108 -0
- package/dist/chunk-3MYGXIHH.js.map +1 -0
- package/dist/chunk-3PCM3OLN.js +141 -0
- package/dist/chunk-3PCM3OLN.js.map +1 -0
- package/dist/chunk-3TBXOB3R.js +141 -0
- package/dist/chunk-3TBXOB3R.js.map +1 -0
- package/dist/chunk-3XY72AXV.js +49 -0
- package/dist/chunk-3XY72AXV.js.map +1 -0
- package/dist/chunk-3YBIEQO6.js +212 -0
- package/dist/chunk-3YBIEQO6.js.map +1 -0
- package/dist/chunk-4A4J7WSV.js +86 -0
- package/dist/chunk-4A4J7WSV.js.map +1 -0
- package/dist/chunk-4ESGRQGT.js +108 -0
- package/dist/chunk-4ESGRQGT.js.map +1 -0
- package/dist/chunk-5BIMFEMU.js +1478 -0
- package/dist/chunk-5BIMFEMU.js.map +1 -0
- package/dist/chunk-5SRYL5WC.js +212 -0
- package/dist/chunk-5SRYL5WC.js.map +1 -0
- package/dist/chunk-62YQFYHZ.js +3629 -0
- package/dist/chunk-62YQFYHZ.js.map +1 -0
- package/dist/chunk-6HKZB5HS.js +49 -0
- package/dist/chunk-6HKZB5HS.js.map +1 -0
- package/dist/chunk-6NC6XI6T.js +108 -0
- package/dist/chunk-6NC6XI6T.js.map +1 -0
- package/dist/chunk-6VGNSL3V.js +108 -0
- package/dist/chunk-6VGNSL3V.js.map +1 -0
- package/dist/chunk-74Z6QJ2V.js +108 -0
- package/dist/chunk-74Z6QJ2V.js.map +1 -0
- package/dist/chunk-77BWMAR2.js +105 -0
- package/dist/chunk-77BWMAR2.js.map +1 -0
- package/dist/chunk-7EX3S2AT.js +2324 -0
- package/dist/chunk-7EX3S2AT.js.map +1 -0
- package/dist/chunk-7LU43J6Y.js +2199 -0
- package/dist/chunk-7LU43J6Y.js.map +1 -0
- package/dist/chunk-7ONFLU6G.js +127 -0
- package/dist/chunk-7ONFLU6G.js.map +1 -0
- package/dist/chunk-7S7HFNGN.js +49 -0
- package/dist/chunk-7S7HFNGN.js.map +1 -0
- package/dist/chunk-7T3QFG4C.js +108 -0
- package/dist/chunk-7T3QFG4C.js.map +1 -0
- package/dist/chunk-ACI4CZ3N.js +141 -0
- package/dist/chunk-ACI4CZ3N.js.map +1 -0
- package/dist/chunk-AF3NCC5P.js +127 -0
- package/dist/chunk-AF3NCC5P.js.map +1 -0
- package/dist/chunk-AFTE3PC6.js +141 -0
- package/dist/chunk-AFTE3PC6.js.map +1 -0
- package/dist/chunk-ARSX76AK.js +49 -0
- package/dist/chunk-ARSX76AK.js.map +1 -0
- package/dist/chunk-AVOJOQXO.js +108 -0
- package/dist/chunk-AVOJOQXO.js.map +1 -0
- package/dist/chunk-AWLKSOKJ.js +49 -0
- package/dist/chunk-AWLKSOKJ.js.map +1 -0
- package/dist/chunk-B5CBBNRH.js +141 -0
- package/dist/chunk-B5CBBNRH.js.map +1 -0
- package/dist/chunk-BJAVQP5F.js +212 -0
- package/dist/chunk-BJAVQP5F.js.map +1 -0
- package/dist/chunk-C4DWCONF.js +212 -0
- package/dist/chunk-C4DWCONF.js.map +1 -0
- package/dist/chunk-CM2VKLWZ.js +127 -0
- package/dist/chunk-CM2VKLWZ.js.map +1 -0
- package/dist/chunk-CRPUM7SJ.js +212 -0
- package/dist/chunk-CRPUM7SJ.js.map +1 -0
- package/dist/chunk-CSBHWPRR.js +105 -0
- package/dist/chunk-CSBHWPRR.js.map +1 -0
- package/dist/chunk-CT7PENLL.js +105 -0
- package/dist/chunk-CT7PENLL.js.map +1 -0
- package/dist/chunk-DIAD272J.js +49 -0
- package/dist/chunk-DIAD272J.js.map +1 -0
- package/dist/chunk-DXONM5CJ.js +141 -0
- package/dist/chunk-DXONM5CJ.js.map +1 -0
- package/dist/chunk-E4LV6EXS.js +108 -0
- package/dist/chunk-E4LV6EXS.js.map +1 -0
- package/dist/chunk-E6E6MHRM.js +212 -0
- package/dist/chunk-E6E6MHRM.js.map +1 -0
- package/dist/chunk-E77PCJ2L.js +141 -0
- package/dist/chunk-E77PCJ2L.js.map +1 -0
- package/dist/chunk-E7F44FIR.js +105 -0
- package/dist/chunk-E7F44FIR.js.map +1 -0
- package/dist/chunk-EK2YUTFC.js +141 -0
- package/dist/chunk-EK2YUTFC.js.map +1 -0
- package/dist/chunk-EKQJYLLX.js +212 -0
- package/dist/chunk-EKQJYLLX.js.map +1 -0
- package/dist/chunk-FA77TXZD.js +127 -0
- package/dist/chunk-FA77TXZD.js.map +1 -0
- package/dist/chunk-FAFYYMFU.js +108 -0
- package/dist/chunk-FAFYYMFU.js.map +1 -0
- package/dist/chunk-FHTHKUN5.js +126 -0
- package/dist/chunk-FHTHKUN5.js.map +1 -0
- package/dist/chunk-GAWACXC2.js +127 -0
- package/dist/chunk-GAWACXC2.js.map +1 -0
- package/dist/chunk-GR3BLVJV.js +212 -0
- package/dist/chunk-GR3BLVJV.js.map +1 -0
- package/dist/chunk-GRCSAYBS.js +141 -0
- package/dist/chunk-GRCSAYBS.js.map +1 -0
- package/dist/chunk-GTRGNGUL.js +212 -0
- package/dist/chunk-GTRGNGUL.js.map +1 -0
- package/dist/chunk-H6EWZ7XZ.js +105 -0
- package/dist/chunk-H6EWZ7XZ.js.map +1 -0
- package/dist/chunk-HH3OPBBE.js +108 -0
- package/dist/chunk-HH3OPBBE.js.map +1 -0
- package/dist/chunk-HRVIZJEA.js +63 -0
- package/dist/chunk-HRVIZJEA.js.map +1 -0
- package/dist/chunk-I5GYABMO.js +141 -0
- package/dist/chunk-I5GYABMO.js.map +1 -0
- package/dist/chunk-I5J6GFME.js +141 -0
- package/dist/chunk-I5J6GFME.js.map +1 -0
- package/dist/chunk-IHFBGGHI.js +2297 -0
- package/dist/chunk-IHFBGGHI.js.map +1 -0
- package/dist/chunk-IHHNRYGC.js +108 -0
- package/dist/chunk-IHHNRYGC.js.map +1 -0
- package/dist/chunk-IPF6TU3K.js +212 -0
- package/dist/chunk-IPF6TU3K.js.map +1 -0
- package/dist/chunk-JNSJK2TR.js +2323 -0
- package/dist/chunk-JNSJK2TR.js.map +1 -0
- package/dist/chunk-JY62VTMC.js +49 -0
- package/dist/chunk-JY62VTMC.js.map +1 -0
- package/dist/chunk-KKC3SV7X.js +212 -0
- package/dist/chunk-KKC3SV7X.js.map +1 -0
- package/dist/chunk-KLKFSFIO.js +127 -0
- package/dist/chunk-KLKFSFIO.js.map +1 -0
- package/dist/chunk-KLXG7TWR.js +212 -0
- package/dist/chunk-KLXG7TWR.js.map +1 -0
- package/dist/chunk-KONLD7QH.js +108 -0
- package/dist/chunk-KONLD7QH.js.map +1 -0
- package/dist/chunk-KVZ4GBCQ.js +212 -0
- package/dist/chunk-KVZ4GBCQ.js.map +1 -0
- package/dist/chunk-LCX6G6UD.js +49 -0
- package/dist/chunk-LCX6G6UD.js.map +1 -0
- package/dist/chunk-LTJESAOY.js +49 -0
- package/dist/chunk-LTJESAOY.js.map +1 -0
- package/dist/chunk-LVOIDBQG.js +5083 -0
- package/dist/chunk-LVOIDBQG.js.map +1 -0
- package/dist/chunk-M7MZHGIW.js +141 -0
- package/dist/chunk-M7MZHGIW.js.map +1 -0
- package/dist/chunk-MFLND54Z.js +105 -0
- package/dist/chunk-MFLND54Z.js.map +1 -0
- package/dist/chunk-MU2VXMVI.js +105 -0
- package/dist/chunk-MU2VXMVI.js.map +1 -0
- package/dist/chunk-MYFQGX4G.js +130 -0
- package/dist/chunk-MYFQGX4G.js.map +1 -0
- package/dist/chunk-NIVSHXEJ.js +141 -0
- package/dist/chunk-NIVSHXEJ.js.map +1 -0
- package/dist/chunk-NJMWUDSI.js +2323 -0
- package/dist/chunk-NJMWUDSI.js.map +1 -0
- package/dist/chunk-NP4YOCMX.js +127 -0
- package/dist/chunk-NP4YOCMX.js.map +1 -0
- package/dist/chunk-NVIXO3FX.js +127 -0
- package/dist/chunk-NVIXO3FX.js.map +1 -0
- package/dist/chunk-OB5SKTJ7.js +2294 -0
- package/dist/chunk-OB5SKTJ7.js.map +1 -0
- package/dist/chunk-OWG3KRZJ.js +108 -0
- package/dist/chunk-OWG3KRZJ.js.map +1 -0
- package/dist/chunk-P3FVYMA6.js +127 -0
- package/dist/chunk-P3FVYMA6.js.map +1 -0
- package/dist/chunk-PJDWYUHP.js +3629 -0
- package/dist/chunk-PJDWYUHP.js.map +1 -0
- package/dist/chunk-PS6RUUUK.js +86 -0
- package/dist/chunk-PS6RUUUK.js.map +1 -0
- package/dist/chunk-QAFEK7IY.js +105 -0
- package/dist/chunk-QAFEK7IY.js.map +1 -0
- package/dist/chunk-QFPKRXR3.js +108 -0
- package/dist/chunk-QFPKRXR3.js.map +1 -0
- package/dist/chunk-R3N37XCV.js +212 -0
- package/dist/chunk-R3N37XCV.js.map +1 -0
- package/dist/chunk-R4E42CNE.js +2324 -0
- package/dist/chunk-R4E42CNE.js.map +1 -0
- package/dist/chunk-R4FMLRKR.js +105 -0
- package/dist/chunk-R4FMLRKR.js.map +1 -0
- package/dist/chunk-R4ISWFAU.js +2323 -0
- package/dist/chunk-R4ISWFAU.js.map +1 -0
- package/dist/chunk-R5KOPIFI.js +127 -0
- package/dist/chunk-R5KOPIFI.js.map +1 -0
- package/dist/chunk-RHM7WSYL.js +127 -0
- package/dist/chunk-RHM7WSYL.js.map +1 -0
- package/dist/chunk-RMOYI7RJ.js +212 -0
- package/dist/chunk-RMOYI7RJ.js.map +1 -0
- package/dist/chunk-RQB4FWW7.js +2296 -0
- package/dist/chunk-RQB4FWW7.js.map +1 -0
- package/dist/chunk-RRQLWLKC.js +127 -0
- package/dist/chunk-RRQLWLKC.js.map +1 -0
- package/dist/chunk-S7BWR5IZ.js +212 -0
- package/dist/chunk-S7BWR5IZ.js.map +1 -0
- package/dist/chunk-SUHRSNAI.js +63 -0
- package/dist/chunk-SUHRSNAI.js.map +1 -0
- package/dist/chunk-T5J4XBWF.js +127 -0
- package/dist/chunk-T5J4XBWF.js.map +1 -0
- package/dist/chunk-T5OKHLM7.js +86 -0
- package/dist/chunk-T5OKHLM7.js.map +1 -0
- package/dist/chunk-T6TINFBB.js +49 -0
- package/dist/chunk-T6TINFBB.js.map +1 -0
- package/dist/chunk-TK4FIUGX.js +105 -0
- package/dist/chunk-TK4FIUGX.js.map +1 -0
- package/dist/chunk-TSYM32RM.js +2218 -0
- package/dist/chunk-TSYM32RM.js.map +1 -0
- package/dist/chunk-TYLFHFBL.js +127 -0
- package/dist/chunk-TYLFHFBL.js.map +1 -0
- package/dist/chunk-TZ6FCCCJ.js +105 -0
- package/dist/chunk-TZ6FCCCJ.js.map +1 -0
- package/dist/chunk-UFO7XI55.js +212 -0
- package/dist/chunk-UFO7XI55.js.map +1 -0
- package/dist/chunk-UHGU5YPX.js +127 -0
- package/dist/chunk-UHGU5YPX.js.map +1 -0
- package/dist/chunk-UTXIA4ZA.js +105 -0
- package/dist/chunk-UTXIA4ZA.js.map +1 -0
- package/dist/chunk-UYI6WFT7.js +105 -0
- package/dist/chunk-UYI6WFT7.js.map +1 -0
- package/dist/chunk-VENIIRNN.js +49 -0
- package/dist/chunk-VENIIRNN.js.map +1 -0
- package/dist/chunk-VIX553CW.js +108 -0
- package/dist/chunk-VIX553CW.js.map +1 -0
- package/dist/chunk-VLYJFH7W.js +49 -0
- package/dist/chunk-VLYJFH7W.js.map +1 -0
- package/dist/chunk-VOXSIPTX.js +141 -0
- package/dist/chunk-VOXSIPTX.js.map +1 -0
- package/dist/chunk-VZNGE73T.js +105 -0
- package/dist/chunk-VZNGE73T.js.map +1 -0
- package/dist/chunk-W2J2VZEP.js +108 -0
- package/dist/chunk-W2J2VZEP.js.map +1 -0
- package/dist/chunk-X3QTCV4Q.js +212 -0
- package/dist/chunk-X3QTCV4Q.js.map +1 -0
- package/dist/chunk-X5ZOQIDW.js +108 -0
- package/dist/chunk-X5ZOQIDW.js.map +1 -0
- package/dist/chunk-XHG32AO6.js +141 -0
- package/dist/chunk-XHG32AO6.js.map +1 -0
- package/dist/chunk-XJSNK6B3.js +127 -0
- package/dist/chunk-XJSNK6B3.js.map +1 -0
- package/dist/chunk-XRKRGNVZ.js +141 -0
- package/dist/chunk-XRKRGNVZ.js.map +1 -0
- package/dist/chunk-XVA5MO4M.js +2324 -0
- package/dist/chunk-XVA5MO4M.js.map +1 -0
- package/dist/chunk-XXEJA3Q7.js +86 -0
- package/dist/chunk-XXEJA3Q7.js.map +1 -0
- package/dist/chunk-XZAEVXPG.js +108 -0
- package/dist/chunk-XZAEVXPG.js.map +1 -0
- package/dist/chunk-YCVZY6JX.js +141 -0
- package/dist/chunk-YCVZY6JX.js.map +1 -0
- package/dist/chunk-YQAMFHXE.js +212 -0
- package/dist/chunk-YQAMFHXE.js.map +1 -0
- package/dist/chunk-YRB4D655.js +141 -0
- package/dist/chunk-YRB4D655.js.map +1 -0
- package/dist/chunk-YVPSUVSB.js +141 -0
- package/dist/chunk-YVPSUVSB.js.map +1 -0
- package/dist/chunk-YWEJJEJY.js +105 -0
- package/dist/chunk-YWEJJEJY.js.map +1 -0
- package/dist/chunk-YXOEPMQS.js +127 -0
- package/dist/chunk-YXOEPMQS.js.map +1 -0
- package/dist/chunk-ZBNO57AP.js +141 -0
- package/dist/chunk-ZBNO57AP.js.map +1 -0
- package/dist/chunk-ZZDH4KPF.js +212 -0
- package/dist/chunk-ZZDH4KPF.js.map +1 -0
- package/dist/components/AddressContainer/CoreAddressContainer.js +6 -6
- package/dist/components/AddressContainer/EVMAddressContainer.js +6 -6
- package/dist/components/AddressContainer/addressSwitcher.js +4 -4
- package/dist/components/AddressContainer/addressView.js +3 -3
- package/dist/components/AddressContainer/label.js +2 -2
- package/dist/components/Age/index.js +2 -2
- package/dist/components/CopyButton/index.js +1 -1
- package/dist/components/DownloadCSV/index.js +1 -1
- package/dist/components/Highlight/index.js +12 -2
- package/dist/components/Highlight/index.js.map +1 -1
- package/dist/components/InfoIconWithTooltip/index.js +1 -1
- package/dist/components/PhishingAddressContainer/PhishingWarningIcon.d.ts +6 -0
- package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js +7 -0
- package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js.map +1 -0
- package/dist/components/PhishingAddressContainer/index.d.ts +15 -0
- package/dist/components/PhishingAddressContainer/index.js +124 -0
- package/dist/components/PhishingAddressContainer/index.js.map +1 -0
- package/dist/components/PhishingAddressContainer/phishing-warning.svg.svg +3 -0
- package/dist/components/Price/index.js +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Select/select.js +1 -1
- package/dist/components/Text/index.js +2 -2
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/Tooltip/tt.d.ts +28 -0
- package/dist/components/Tooltip/tt.js +8 -0
- package/dist/components/Tooltip/tt.js.map +1 -0
- package/dist/components/TransactionAction/coreTransactionAction.js +6 -6
- package/dist/components/TransactionAction/evmTransactionAction.js +6 -6
- package/dist/contants/cssVariable.d.ts +20 -0
- package/dist/contants/cssVariable.js +41 -0
- package/dist/contants/cssVariable.js.map +1 -0
- package/dist/uno.css +6 -4
- package/dist/utils/contractManagerTool.d.ts +50 -0
- package/dist/utils/contractManagerTool.js +92 -0
- package/dist/utils/contractManagerTool.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContractAddress,
|
|
3
|
+
ContractCreatedAddress,
|
|
4
|
+
InvalidAddress,
|
|
5
|
+
MyAddress
|
|
6
|
+
} from "./chunk-GTRGNGUL.js";
|
|
7
|
+
import {
|
|
8
|
+
RenderAddress
|
|
9
|
+
} from "./chunk-CM2VKLWZ.js";
|
|
10
|
+
import {
|
|
11
|
+
convertCheckSum,
|
|
12
|
+
formatAddress,
|
|
13
|
+
isEvmAddress,
|
|
14
|
+
isZeroAddress
|
|
15
|
+
} from "./chunk-RTFAJGPO.js";
|
|
16
|
+
import {
|
|
17
|
+
getLabelInfo
|
|
18
|
+
} from "./chunk-3XY72AXV.js";
|
|
19
|
+
import {
|
|
20
|
+
getTranslations,
|
|
21
|
+
useGlobalData
|
|
22
|
+
} from "./chunk-DQGLZCIG.js";
|
|
23
|
+
|
|
24
|
+
// src/components/AddressContainer/EVMAddressContainer.tsx
|
|
25
|
+
import { memo } from "react";
|
|
26
|
+
import { withTranslation } from "react-i18next";
|
|
27
|
+
import _ from "lodash";
|
|
28
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
29
|
+
var parseProps = (props, globalData) => {
|
|
30
|
+
const { alias, t, showAddressLabel, showNametag, nametagInfo } = props;
|
|
31
|
+
const value = props.value || "";
|
|
32
|
+
const cfxAddress = formatAddress(value, "hex");
|
|
33
|
+
const translations = getTranslations();
|
|
34
|
+
let aliasLabel = alias;
|
|
35
|
+
if (!alias && isZeroAddress(cfxAddress)) {
|
|
36
|
+
aliasLabel = t(translations.general.zeroAddress);
|
|
37
|
+
}
|
|
38
|
+
let officalNametag = null;
|
|
39
|
+
let addressLabel = null;
|
|
40
|
+
if (cfxAddress && showAddressLabel) {
|
|
41
|
+
const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
|
|
42
|
+
const gAddressLabel = addressLabels?.[convertCheckSum(cfxAddress)] || addressLabels?.[cfxAddress.toLowerCase()];
|
|
43
|
+
if (gAddressLabel) {
|
|
44
|
+
const { label } = getLabelInfo(gAddressLabel, "tag");
|
|
45
|
+
addressLabel = label;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (cfxAddress && showNametag) {
|
|
49
|
+
const nametags = nametagInfo?.[convertCheckSum(cfxAddress)] || nametagInfo?.[cfxAddress.toLowerCase()];
|
|
50
|
+
if (nametags) {
|
|
51
|
+
const nametag = nametags?.nametag ?? "";
|
|
52
|
+
const { label } = getLabelInfo(nametag, "nametag");
|
|
53
|
+
officalNametag = label;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
alias: aliasLabel,
|
|
58
|
+
nametag: officalNametag,
|
|
59
|
+
addressLabel,
|
|
60
|
+
cfxAddress
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var EVMAddressContainer = withTranslation()(
|
|
64
|
+
memo((props) => {
|
|
65
|
+
const { globalData } = useGlobalData();
|
|
66
|
+
if (!props.value && !props.contractCreated) {
|
|
67
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "--" });
|
|
68
|
+
}
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
isFull: false,
|
|
71
|
+
isFullNameTag: false,
|
|
72
|
+
link: true,
|
|
73
|
+
isMe: false,
|
|
74
|
+
showIcon: true,
|
|
75
|
+
verify: false,
|
|
76
|
+
showAddressLabel: true,
|
|
77
|
+
showENSLabel: true,
|
|
78
|
+
showNametag: true
|
|
79
|
+
};
|
|
80
|
+
const mergeDefaultProps = _.assign({}, defaultProps, props);
|
|
81
|
+
const mergeParseProps = _.merge(
|
|
82
|
+
{},
|
|
83
|
+
mergeDefaultProps,
|
|
84
|
+
parseProps(mergeDefaultProps, globalData)
|
|
85
|
+
);
|
|
86
|
+
if (!mergeParseProps.value && mergeParseProps.contractCreated) {
|
|
87
|
+
return ContractCreatedAddress({
|
|
88
|
+
...mergeParseProps,
|
|
89
|
+
outputType: "hex"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (!isEvmAddress(mergeParseProps.value)) {
|
|
93
|
+
return InvalidAddress(mergeParseProps);
|
|
94
|
+
}
|
|
95
|
+
if (mergeParseProps.isContract) {
|
|
96
|
+
return ContractAddress(mergeParseProps);
|
|
97
|
+
}
|
|
98
|
+
if (mergeParseProps.isMe) {
|
|
99
|
+
return MyAddress(mergeParseProps);
|
|
100
|
+
}
|
|
101
|
+
return RenderAddress(mergeParseProps);
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
EVMAddressContainer
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=chunk-24MUZRQJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/EVMAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isEvmAddress,\n isZeroAddress,\n convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { getLabelInfo } from './label';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { EVMAddressContainerProps } from './types';\n\nconst parseProps = (\n props: EVMAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const { alias, t, showAddressLabel, showNametag, nametagInfo } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'hex');\n\n const translations = getTranslations();\n\n let aliasLabel = alias;\n if (!alias && isZeroAddress(cfxAddress)) {\n aliasLabel = t(translations.general.zeroAddress);\n }\n\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n const gAddressLabel =\n addressLabels?.[convertCheckSum(cfxAddress)] ||\n addressLabels?.[cfxAddress.toLowerCase()];\n\n if (gAddressLabel) {\n const { label } = getLabelInfo(gAddressLabel, 'tag');\n addressLabel = label;\n }\n }\n\n if (cfxAddress && showNametag) {\n const nametags =\n nametagInfo?.[convertCheckSum(cfxAddress)] ||\n nametagInfo?.[cfxAddress.toLowerCase()];\n\n if (nametags) {\n const nametag = nametags?.nametag ?? '';\n const { label } = getLabelInfo(nametag, 'nametag');\n officalNametag = label;\n }\n }\n\n return {\n alias: aliasLabel,\n nametag: officalNametag,\n addressLabel,\n cfxAddress,\n };\n};\n\nexport const EVMAddressContainer = withTranslation()(\n memo((props: EVMAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'hex',\n });\n }\n\n if (!isEvmAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isContract) {\n return ContractAddress(mergeParseProps);\n }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1C,aAAO,gCAAE,gBAAE;AAAA,IACb;AAEA,UAAM,eAAe;AAAA,MACnB,QAAQ;AAAA,MACR,eAAe;AAAA,MACf,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,aAAa;AAAA,IACf;AAEA,UAAM,oBAAoB,EAAE,OAAO,CAAC,GAAG,cAAc,KAAK;AAE1D,UAAM,kBAAkB,EAAE;AAAA,MACxB,CAAC;AAAA,MACD;AAAA,MACA,WAAW,mBAAmB,UAAU;AAAA,IAC1C;AAEA,QAAI,CAAC,gBAAgB,SAAS,gBAAgB,iBAAiB;AAC7D,aAAO,uBAAuB;AAAA,QAC5B,GAAG;AAAA,QACH,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,QAAI,CAAC,aAAa,gBAAgB,KAAK,GAAG;AACxC,aAAO,eAAe,eAAe;AAAA,IACvC;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO,gBAAgB,eAAe;AAAA,IACxC;AAEA,QAAI,gBAAgB,MAAM;AACxB,aAAO,UAAU,eAAe;AAAA,IAClC;AAEA,WAAO,cAAc,eAAe;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/contants/cssVariable.ts
|
|
2
|
+
var sansSerifFont = `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
3
|
+
'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
|
4
|
+
'Segoe UI Symbol', 'Noto Color Emoji'`;
|
|
5
|
+
var monospaceFont = `'Roboto Mono', 'Lucida Console', Consolas, 'Liberation Mono', Menlo, Courier, monospace`;
|
|
6
|
+
var blue0 = "#7789D3";
|
|
7
|
+
var blue1 = "#26244B";
|
|
8
|
+
var blue2 = "#4665f0";
|
|
9
|
+
var blue3 = "#F5F7FF";
|
|
10
|
+
var blue4 = "#7789D3";
|
|
11
|
+
var gray0 = "#F1F3F9";
|
|
12
|
+
var gray1 = "#FDFDFE";
|
|
13
|
+
var gray2 = "#8A8C95";
|
|
14
|
+
var gray3 = "#EBECED";
|
|
15
|
+
var gray4 = "#74798C";
|
|
16
|
+
var green0 = "#AFE9D2";
|
|
17
|
+
var green1 = "#05343F";
|
|
18
|
+
var green2 = "#17B38A";
|
|
19
|
+
var green3 = "#F0F4F3";
|
|
20
|
+
var orange0 = "#F8963E";
|
|
21
|
+
var black0 = "#0F1327";
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
sansSerifFont,
|
|
25
|
+
monospaceFont,
|
|
26
|
+
blue0,
|
|
27
|
+
blue1,
|
|
28
|
+
blue2,
|
|
29
|
+
blue3,
|
|
30
|
+
blue4,
|
|
31
|
+
gray0,
|
|
32
|
+
gray1,
|
|
33
|
+
gray2,
|
|
34
|
+
gray3,
|
|
35
|
+
gray4,
|
|
36
|
+
green0,
|
|
37
|
+
green1,
|
|
38
|
+
green2,
|
|
39
|
+
green3,
|
|
40
|
+
orange0,
|
|
41
|
+
black0
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=chunk-24Z2NTKQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contants/cssVariable.ts"],"sourcesContent":["export const sansSerifFont = `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,\n 'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',\n 'Segoe UI Symbol', 'Noto Color Emoji'`;\n\nexport const monospaceFont = `'Roboto Mono', 'Lucida Console', Consolas, 'Liberation Mono', Menlo, Courier, monospace`;\n\nexport const blue0 = '#7789D3';\nexport const blue1 = '#26244B';\nexport const blue2 = '#4665f0';\nexport const blue3 = '#F5F7FF';\nexport const blue4 = '#7789D3';\nexport const gray0 = '#F1F3F9';\nexport const gray1 = '#FDFDFE';\nexport const gray2 = '#8A8C95';\nexport const gray3 = '#EBECED';\nexport const gray4 = '#74798C';\nexport const green0 = '#AFE9D2';\nexport const green1 = '#05343F';\nexport const green2 = '#17B38A';\nexport const green3 = '#F0F4F3';\nexport const orange0 = '#F8963E';\nexport const black0 = '#0F1327';\n"],"mappings":";AAAO,IAAM,gBAAgB;AAAA;AAAA;AAItB,IAAM,gBAAgB;AAEtB,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,SAAS;AACf,IAAM,SAAS;AACf,IAAM,SAAS;AACf,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,SAAS;","names":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
convertCheckSum
|
|
3
|
+
} from "./chunk-RTFAJGPO.js";
|
|
4
|
+
import {
|
|
5
|
+
Text
|
|
6
|
+
} from "./chunk-MFLND54Z.js";
|
|
7
|
+
import {
|
|
8
|
+
getTranslations
|
|
9
|
+
} from "./chunk-DQGLZCIG.js";
|
|
10
|
+
|
|
11
|
+
// src/components/AddressContainer/addressView.tsx
|
|
12
|
+
import { Translation } from "react-i18next";
|
|
13
|
+
import { shortenAddress } from "@cfx-kit/dapp-utils/dist/address";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var defaultPCMaxWidth = 138;
|
|
16
|
+
var renderTooltipContent = (tooltipContent) => {
|
|
17
|
+
return Object.entries(tooltipContent).map(([key, { label, value, hideLabel }]) => {
|
|
18
|
+
if (value) {
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
20
|
+
!hideLabel && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Translation, { children: (t) => t(label) }) }),
|
|
21
|
+
value
|
|
22
|
+
] }, key);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}).filter(Boolean);
|
|
26
|
+
};
|
|
27
|
+
var convertLink = ({
|
|
28
|
+
link,
|
|
29
|
+
type,
|
|
30
|
+
hrefAddress,
|
|
31
|
+
cfxAddress
|
|
32
|
+
}) => {
|
|
33
|
+
if (typeof link === "string") {
|
|
34
|
+
return link;
|
|
35
|
+
}
|
|
36
|
+
const address = hrefAddress || cfxAddress;
|
|
37
|
+
if (address && typeof address === "string") {
|
|
38
|
+
const pathname = window.location.pathname.toLowerCase();
|
|
39
|
+
const addressLower = address.toLowerCase();
|
|
40
|
+
if (pathname.includes("/address/" + addressLower)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (type === "pow") {
|
|
44
|
+
return `/address/${address}`;
|
|
45
|
+
}
|
|
46
|
+
if (type === "pos") {
|
|
47
|
+
return `/pos/accounts/${address}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
var RenderAddress = ({
|
|
53
|
+
cfxAddress,
|
|
54
|
+
alias,
|
|
55
|
+
hoverValue,
|
|
56
|
+
hrefAddress,
|
|
57
|
+
content,
|
|
58
|
+
link = "",
|
|
59
|
+
isFull = false,
|
|
60
|
+
isFullNameTag = false,
|
|
61
|
+
style = {},
|
|
62
|
+
maxWidth,
|
|
63
|
+
prefix = null,
|
|
64
|
+
suffix = null,
|
|
65
|
+
type = "pow",
|
|
66
|
+
addressLabel = "",
|
|
67
|
+
ENSLabel = "",
|
|
68
|
+
nametag = "",
|
|
69
|
+
hideAliasPrefixInHover = false
|
|
70
|
+
}) => {
|
|
71
|
+
const translations = getTranslations();
|
|
72
|
+
const name = content || ENSLabel || nametag || addressLabel || alias;
|
|
73
|
+
const defaultStyle = {
|
|
74
|
+
maxWidth: `${name && isFullNameTag || isFull ? "auto" : (maxWidth || defaultPCMaxWidth) + "px"}`
|
|
75
|
+
};
|
|
76
|
+
const href = convertLink({ link, type, hrefAddress, cfxAddress });
|
|
77
|
+
const Wrapper = href ? "a" : "div";
|
|
78
|
+
const tooltipContent = {
|
|
79
|
+
ENSLabel: {
|
|
80
|
+
label: translations?.ens?.tip,
|
|
81
|
+
value: ENSLabel
|
|
82
|
+
},
|
|
83
|
+
nametag: {
|
|
84
|
+
label: translations?.nametag?.tip,
|
|
85
|
+
value: nametag
|
|
86
|
+
},
|
|
87
|
+
addressLabel: {
|
|
88
|
+
label: translations?.profile.address.myNameTag,
|
|
89
|
+
value: addressLabel
|
|
90
|
+
},
|
|
91
|
+
alias: {
|
|
92
|
+
label: translations?.profile.address.publicNameTag,
|
|
93
|
+
value: alias,
|
|
94
|
+
hideLabel: hideAliasPrefixInHover
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const checksumAddress = convertCheckSum(cfxAddress);
|
|
98
|
+
const cfxAddressLabel = typeof cfxAddress === "string" && !isFull ? shortenAddress(checksumAddress) : checksumAddress;
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex", children: [
|
|
100
|
+
prefix,
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
Text,
|
|
103
|
+
{
|
|
104
|
+
tag: "span",
|
|
105
|
+
hoverValue: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
+
renderTooltipContent(tooltipContent),
|
|
107
|
+
/* @__PURE__ */ jsx("div", { children: hoverValue || checksumAddress })
|
|
108
|
+
] }),
|
|
109
|
+
children: /* @__PURE__ */ jsx(
|
|
110
|
+
Wrapper,
|
|
111
|
+
{
|
|
112
|
+
className: "block relative align-bottom cursor-default truncate",
|
|
113
|
+
style: { ...defaultStyle, ...style },
|
|
114
|
+
...href ? { href: String(href) } : {},
|
|
115
|
+
children: name || cfxAddressLabel
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
suffix
|
|
121
|
+
] });
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
RenderAddress
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=chunk-26ABIFHL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\n\nconst defaultPCMaxWidth = 138;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n alias,\n hoverValue,\n hrefAddress,\n content,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n const name = content || ENSLabel || nametag || addressLabel || alias;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'auto' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: alias,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof cfxAddress === 'string' && !isFull\n ? shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\">\n {prefix}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;AAUrB,SAgHA,UA7GM,KAHN;AARV,IAAM,oBAAoB;AAG1B,IAAM,uBAAuB,CAAC,mBAAmC;AAC/D,SAAO,OAAO,QAAQ,cAAc,EACjC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,OAAO,UAAU,CAAC,MAAM;AAC3C,QAAI,OAAO;AACT,aACE,qBAAC,SACE;AAAA,SAAC,aACA,oBAAC,UACC,8BAAC,eAAa,iBAAK,EAAE,KAAK,GAAE,GAC9B;AAAA,QAED;AAAA,WANO,GAOV;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;AAGA,IAAM,cAAc,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA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AA,IACT;AAAA,IACA,OAAO;AAAA,MACL,OAAO,cAAc,QAAQ,QAAQ;AAAA,MACrC,OAAO;AAAA,MACP,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,kBAAkB,gBAAgB,UAAU;AAElD,QAAM,kBACJ,OAAO,eAAe,YAAY,CAAC,SAC/B,eAAe,eAAgB,IAC/B;AAEN,SACE,qBAAC,SAAI,WAAU,eACZ;AAAA;AAAA,IACD;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACJ,YACE,iCACG;AAAA,+BAAqB,cAAc;AAAA,UACpC,oBAAC,SAAK,wBAAc,iBAAgB;AAAA,WACtC;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,YAClC,GAAI,OAAO,EAAE,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC;AAAA,YAErC,kBAAQ;AAAA;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContractAddress,
|
|
3
|
+
ContractCreatedAddress,
|
|
4
|
+
InvalidAddress,
|
|
5
|
+
MyAddress
|
|
6
|
+
} from "./chunk-X3QTCV4Q.js";
|
|
7
|
+
import {
|
|
8
|
+
RenderAddress
|
|
9
|
+
} from "./chunk-FHTHKUN5.js";
|
|
10
|
+
import {
|
|
11
|
+
convertCheckSum,
|
|
12
|
+
formatAddress,
|
|
13
|
+
isEvmAddress,
|
|
14
|
+
isZeroAddress
|
|
15
|
+
} from "./chunk-RTFAJGPO.js";
|
|
16
|
+
import {
|
|
17
|
+
getLabelInfo
|
|
18
|
+
} from "./chunk-CRLSK4N6.js";
|
|
19
|
+
import {
|
|
20
|
+
getTranslations,
|
|
21
|
+
useGlobalData
|
|
22
|
+
} from "./chunk-DQGLZCIG.js";
|
|
23
|
+
|
|
24
|
+
// src/components/AddressContainer/EVMAddressContainer.tsx
|
|
25
|
+
import { memo } from "react";
|
|
26
|
+
import { withTranslation } from "react-i18next";
|
|
27
|
+
import _ from "lodash";
|
|
28
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
29
|
+
var parseProps = (props, globalData) => {
|
|
30
|
+
const { alias, t, showAddressLabel, showNametag, nametagInfo } = props;
|
|
31
|
+
const value = props.value || "";
|
|
32
|
+
const cfxAddress = formatAddress(value, "hex");
|
|
33
|
+
const translations = getTranslations();
|
|
34
|
+
let aliasLabel = alias;
|
|
35
|
+
if (!alias && isZeroAddress(cfxAddress)) {
|
|
36
|
+
aliasLabel = t(translations.general.zeroAddress);
|
|
37
|
+
}
|
|
38
|
+
let officalNametag = null;
|
|
39
|
+
let addressLabel = null;
|
|
40
|
+
if (cfxAddress && showAddressLabel) {
|
|
41
|
+
const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
|
|
42
|
+
const gAddressLabel = addressLabels?.[convertCheckSum(cfxAddress)] || addressLabels?.[cfxAddress.toLowerCase()];
|
|
43
|
+
if (gAddressLabel) {
|
|
44
|
+
const { label } = getLabelInfo(gAddressLabel, "tag");
|
|
45
|
+
addressLabel = label;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (cfxAddress && showNametag) {
|
|
49
|
+
const nametags = nametagInfo?.[convertCheckSum(cfxAddress)] || nametagInfo?.[cfxAddress.toLowerCase()];
|
|
50
|
+
if (nametags) {
|
|
51
|
+
const nametag = nametags?.nametag ?? "";
|
|
52
|
+
const { label } = getLabelInfo(nametag, "nametag");
|
|
53
|
+
officalNametag = label;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
alias: aliasLabel,
|
|
58
|
+
nametag: officalNametag,
|
|
59
|
+
addressLabel,
|
|
60
|
+
cfxAddress
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var EVMAddressContainer = withTranslation()(
|
|
64
|
+
memo((props) => {
|
|
65
|
+
const { globalData } = useGlobalData();
|
|
66
|
+
if (!props.value && !props.contractCreated) {
|
|
67
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "--" });
|
|
68
|
+
}
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
isFull: false,
|
|
71
|
+
isFullNameTag: false,
|
|
72
|
+
link: true,
|
|
73
|
+
isMe: false,
|
|
74
|
+
showIcon: true,
|
|
75
|
+
verify: false,
|
|
76
|
+
showAddressLabel: true,
|
|
77
|
+
showENSLabel: true,
|
|
78
|
+
showNametag: true
|
|
79
|
+
};
|
|
80
|
+
const mergeDefaultProps = _.assign({}, defaultProps, props);
|
|
81
|
+
const mergeParseProps = _.merge(
|
|
82
|
+
{},
|
|
83
|
+
mergeDefaultProps,
|
|
84
|
+
parseProps(mergeDefaultProps, globalData)
|
|
85
|
+
);
|
|
86
|
+
if (!mergeParseProps.value && mergeParseProps.contractCreated) {
|
|
87
|
+
return ContractCreatedAddress({
|
|
88
|
+
...mergeParseProps,
|
|
89
|
+
outputType: "hex"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (!isEvmAddress(mergeParseProps.value)) {
|
|
93
|
+
return InvalidAddress(mergeParseProps);
|
|
94
|
+
}
|
|
95
|
+
if (mergeParseProps.isContract) {
|
|
96
|
+
return ContractAddress(mergeParseProps);
|
|
97
|
+
}
|
|
98
|
+
if (mergeParseProps.isMe) {
|
|
99
|
+
return MyAddress(mergeParseProps);
|
|
100
|
+
}
|
|
101
|
+
return RenderAddress(mergeParseProps);
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
EVMAddressContainer
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=chunk-27S75HVO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/EVMAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isEvmAddress,\n isZeroAddress,\n convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { getLabelInfo } from './label';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { EVMAddressContainerProps } from './types';\n\nconst parseProps = (\n props: EVMAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const { alias, t, showAddressLabel, showNametag, nametagInfo } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'hex');\n\n const translations = getTranslations();\n\n let aliasLabel = alias;\n if (!alias && isZeroAddress(cfxAddress)) {\n aliasLabel = t(translations.general.zeroAddress);\n }\n\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n const gAddressLabel =\n addressLabels?.[convertCheckSum(cfxAddress)] ||\n addressLabels?.[cfxAddress.toLowerCase()];\n\n if (gAddressLabel) {\n const { label } = getLabelInfo(gAddressLabel, 'tag');\n addressLabel = label;\n }\n }\n\n if (cfxAddress && showNametag) {\n const nametags =\n nametagInfo?.[convertCheckSum(cfxAddress)] ||\n nametagInfo?.[cfxAddress.toLowerCase()];\n\n if (nametags) {\n const nametag = nametags?.nametag ?? '';\n const { label } = getLabelInfo(nametag, 'nametag');\n officalNametag = label;\n }\n }\n\n return {\n alias: aliasLabel,\n nametag: officalNametag,\n addressLabel,\n cfxAddress,\n };\n};\n\nexport const EVMAddressContainer = withTranslation()(\n memo((props: EVMAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'hex',\n });\n }\n\n if (!isEvmAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isContract) {\n return ContractAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isMe) {\n return MyAddress(mergeParseProps);\n }\n\n return RenderAddress(mergeParseProps);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,SAA0B,uBAAuB;AACjD,OAAO,OAAO;AAgFD;AA3Db,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM,EAAE,OAAO,GAAG,kBAAkB,aAAa,YAAY,IAAI;AACjE,QAAM,QAAgB,MAAM,SAAS;AACrC,QAAM,aAAa,cAAc,OAAO,KAAK;AAE7C,QAAM,eAAe,gBAAgB;AAErC,MAAI,aAAa;AACjB,MAAI,CAAC,SAAS,cAAc,UAAU,GAAG;AACvC,iBAAa,EAAE,aAAa,QAAQ,WAAW;AAAA,EACjD;AAGA,MAAI,iBAAkC;AAEtC,MAAI,eAAgC;AAEpC,MAAI,cAAc,kBAAkB;AAElC,UAAM,gBAAgB,6DAA+C;AACrE,UAAM,gBACJ,gBAAgB,gBAAgB,UAAU,CAAC,KAC3C,gBAAgB,WAAW,YAAY,CAAC;AAE1C,QAAI,eAAe;AACjB,YAAM,EAAE,MAAM,IAAI,aAAa,eAAe,KAAK;AACnD,qBAAe;AAAA,IACjB;AAAA,EACF;AAEA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ACH;","names":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
monospaceFont
|
|
3
|
+
} from "./chunk-24Z2NTKQ.js";
|
|
4
|
+
import {
|
|
5
|
+
convertCheckSum
|
|
6
|
+
} from "./chunk-RTFAJGPO.js";
|
|
7
|
+
import {
|
|
8
|
+
Text
|
|
9
|
+
} from "./chunk-K3RTTXFH.js";
|
|
10
|
+
import {
|
|
11
|
+
getTranslations
|
|
12
|
+
} from "./chunk-DQGLZCIG.js";
|
|
13
|
+
|
|
14
|
+
// src/components/AddressContainer/addressView.tsx
|
|
15
|
+
import { Translation } from "react-i18next";
|
|
16
|
+
import { shortenAddress } from "@cfx-kit/dapp-utils/dist/address";
|
|
17
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var defaultPCMaxWidth = 152;
|
|
19
|
+
var renderTooltipContent = (tooltipContent) => {
|
|
20
|
+
return Object.entries(tooltipContent).map(([key, { label, value, hideLabel }]) => {
|
|
21
|
+
if (value) {
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
23
|
+
!hideLabel && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Translation, { children: (t) => t(label) }) }),
|
|
24
|
+
value
|
|
25
|
+
] }, key);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}).filter(Boolean);
|
|
29
|
+
};
|
|
30
|
+
var convertLink = ({
|
|
31
|
+
link,
|
|
32
|
+
type,
|
|
33
|
+
hrefAddress,
|
|
34
|
+
cfxAddress
|
|
35
|
+
}) => {
|
|
36
|
+
if (typeof link === "string") {
|
|
37
|
+
return link;
|
|
38
|
+
}
|
|
39
|
+
const address = hrefAddress || cfxAddress;
|
|
40
|
+
if (address && typeof address === "string") {
|
|
41
|
+
const pathname = window.location.pathname.toLowerCase();
|
|
42
|
+
const addressLower = address.toLowerCase();
|
|
43
|
+
if (pathname.includes("/address/" + addressLower)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (type === "pow") {
|
|
47
|
+
return `/address/${address}`;
|
|
48
|
+
}
|
|
49
|
+
if (type === "pos") {
|
|
50
|
+
return `/pos/accounts/${address}`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
};
|
|
55
|
+
var RenderAddress = ({
|
|
56
|
+
cfxAddress,
|
|
57
|
+
alias,
|
|
58
|
+
hoverValue,
|
|
59
|
+
hrefAddress,
|
|
60
|
+
content,
|
|
61
|
+
link = "",
|
|
62
|
+
isFull = false,
|
|
63
|
+
isFullNameTag = false,
|
|
64
|
+
style = {},
|
|
65
|
+
maxWidth,
|
|
66
|
+
prefix = null,
|
|
67
|
+
suffix = null,
|
|
68
|
+
type = "pow",
|
|
69
|
+
addressLabel = "",
|
|
70
|
+
ENSLabel = "",
|
|
71
|
+
nametag = "",
|
|
72
|
+
hideAliasPrefixInHover = false
|
|
73
|
+
}) => {
|
|
74
|
+
const translations = getTranslations();
|
|
75
|
+
const name = content || ENSLabel || nametag || addressLabel || alias;
|
|
76
|
+
const defaultStyle = {
|
|
77
|
+
maxWidth: `${name && isFullNameTag || isFull ? "auto" : (maxWidth || defaultPCMaxWidth) + "px"}`
|
|
78
|
+
};
|
|
79
|
+
const href = convertLink({ link, type, hrefAddress, cfxAddress });
|
|
80
|
+
const Wrapper = href ? "a" : "div";
|
|
81
|
+
const tooltipContent = {
|
|
82
|
+
ENSLabel: {
|
|
83
|
+
label: translations?.ens?.tip,
|
|
84
|
+
value: ENSLabel
|
|
85
|
+
},
|
|
86
|
+
nametag: {
|
|
87
|
+
label: translations?.nametag?.tip,
|
|
88
|
+
value: nametag
|
|
89
|
+
},
|
|
90
|
+
addressLabel: {
|
|
91
|
+
label: translations?.profile.address.myNameTag,
|
|
92
|
+
value: addressLabel
|
|
93
|
+
},
|
|
94
|
+
alias: {
|
|
95
|
+
label: translations?.profile.address.publicNameTag,
|
|
96
|
+
value: alias,
|
|
97
|
+
hideLabel: hideAliasPrefixInHover
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const checksumAddress = convertCheckSum(cfxAddress);
|
|
101
|
+
const cfxAddressLabel = typeof cfxAddress === "string" && !isFull ? shortenAddress(checksumAddress) : checksumAddress;
|
|
102
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex", style: { fontFamily: monospaceFont }, children: [
|
|
103
|
+
prefix,
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
Text,
|
|
106
|
+
{
|
|
107
|
+
tag: "span",
|
|
108
|
+
hoverValue: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
109
|
+
renderTooltipContent(tooltipContent),
|
|
110
|
+
/* @__PURE__ */ jsx("div", { children: hoverValue || checksumAddress })
|
|
111
|
+
] }),
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
Wrapper,
|
|
114
|
+
{
|
|
115
|
+
className: "block relative align-bottom cursor-default truncate",
|
|
116
|
+
style: { ...defaultStyle, ...style },
|
|
117
|
+
...href ? { href: String(href) } : {},
|
|
118
|
+
children: name || cfxAddressLabel
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
suffix
|
|
124
|
+
] });
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
RenderAddress
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=chunk-2ATI4GSO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\nimport { monospaceFont } from '../../contants/cssVariable';\n\nconst defaultPCMaxWidth = 152;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n alias,\n hoverValue,\n hrefAddress,\n content,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n const name = content || ENSLabel || nametag || addressLabel || alias;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'auto' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: alias,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof cfxAddress === 'string' && !isFull\n ? shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\" style={{ fontFamily: monospaceFont }}>\n {prefix}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;AAWrB,SAgHA,UA7GM,KAHN;AARV,IAAM,oBAAoB;AAG1B,IAAM,uBAAuB,CAAC,mBAAmC;AAC/D,SAAO,OAAO,QAAQ,cAAc,EACjC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,OAAO,UAAU,CAAC,MAAM;AAC3C,QAAI,OAAO;AACT,aACE,qBAAC,SACE;AAAA,SAAC,aACA,oBAAC,UACC,8BAAC,eAAa,iBAAK,EAAE,KAAK,GAAE,GAC9B;AAAA,QAED;AAAA,WANO,GAOV;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;AAGA,IAAM,cAAc,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0B;AACxB,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,eAAe;AAE/B,MAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,UAAM,WAAW,OAAO,SAAS,SAAS,YAAY;AACtD,UAAM,eAAe,QAAQ,YAAY;AACzC,QAAI,SAAS,SAAS,cAAc,YAAY,GAAG;AACjD,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,OAAO;AAClB,aAAO,YAAY;AAAA,IACrB;AAEA,QAAI,SAAS,OAAO;AAClB,aAAO,iBAAiB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