@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.
Files changed (307) hide show
  1. package/dist/chunk-24MUZRQJ.js +108 -0
  2. package/dist/chunk-24MUZRQJ.js.map +1 -0
  3. package/dist/chunk-24Z2NTKQ.js +43 -0
  4. package/dist/chunk-24Z2NTKQ.js.map +1 -0
  5. package/dist/chunk-26ABIFHL.js +127 -0
  6. package/dist/chunk-26ABIFHL.js.map +1 -0
  7. package/dist/chunk-27S75HVO.js +108 -0
  8. package/dist/chunk-27S75HVO.js.map +1 -0
  9. package/dist/chunk-2ATI4GSO.js +130 -0
  10. package/dist/chunk-2ATI4GSO.js.map +1 -0
  11. package/dist/chunk-2RR4CX3F.js +141 -0
  12. package/dist/chunk-2RR4CX3F.js.map +1 -0
  13. package/dist/chunk-2S6T3LVP.js +212 -0
  14. package/dist/chunk-2S6T3LVP.js.map +1 -0
  15. package/dist/chunk-3357K7AW.js +108 -0
  16. package/dist/chunk-3357K7AW.js.map +1 -0
  17. package/dist/chunk-3BLNV3M6.js +49 -0
  18. package/dist/chunk-3BLNV3M6.js.map +1 -0
  19. package/dist/chunk-3DOLNPRU.js +27 -0
  20. package/dist/chunk-3DOLNPRU.js.map +1 -0
  21. package/dist/chunk-3MYGXIHH.js +108 -0
  22. package/dist/chunk-3MYGXIHH.js.map +1 -0
  23. package/dist/chunk-3PCM3OLN.js +141 -0
  24. package/dist/chunk-3PCM3OLN.js.map +1 -0
  25. package/dist/chunk-3TBXOB3R.js +141 -0
  26. package/dist/chunk-3TBXOB3R.js.map +1 -0
  27. package/dist/chunk-3XY72AXV.js +49 -0
  28. package/dist/chunk-3XY72AXV.js.map +1 -0
  29. package/dist/chunk-3YBIEQO6.js +212 -0
  30. package/dist/chunk-3YBIEQO6.js.map +1 -0
  31. package/dist/chunk-4A4J7WSV.js +86 -0
  32. package/dist/chunk-4A4J7WSV.js.map +1 -0
  33. package/dist/chunk-4ESGRQGT.js +108 -0
  34. package/dist/chunk-4ESGRQGT.js.map +1 -0
  35. package/dist/chunk-5BIMFEMU.js +1478 -0
  36. package/dist/chunk-5BIMFEMU.js.map +1 -0
  37. package/dist/chunk-5SRYL5WC.js +212 -0
  38. package/dist/chunk-5SRYL5WC.js.map +1 -0
  39. package/dist/chunk-62YQFYHZ.js +3629 -0
  40. package/dist/chunk-62YQFYHZ.js.map +1 -0
  41. package/dist/chunk-6HKZB5HS.js +49 -0
  42. package/dist/chunk-6HKZB5HS.js.map +1 -0
  43. package/dist/chunk-6NC6XI6T.js +108 -0
  44. package/dist/chunk-6NC6XI6T.js.map +1 -0
  45. package/dist/chunk-6VGNSL3V.js +108 -0
  46. package/dist/chunk-6VGNSL3V.js.map +1 -0
  47. package/dist/chunk-74Z6QJ2V.js +108 -0
  48. package/dist/chunk-74Z6QJ2V.js.map +1 -0
  49. package/dist/chunk-77BWMAR2.js +105 -0
  50. package/dist/chunk-77BWMAR2.js.map +1 -0
  51. package/dist/chunk-7EX3S2AT.js +2324 -0
  52. package/dist/chunk-7EX3S2AT.js.map +1 -0
  53. package/dist/chunk-7LU43J6Y.js +2199 -0
  54. package/dist/chunk-7LU43J6Y.js.map +1 -0
  55. package/dist/chunk-7ONFLU6G.js +127 -0
  56. package/dist/chunk-7ONFLU6G.js.map +1 -0
  57. package/dist/chunk-7S7HFNGN.js +49 -0
  58. package/dist/chunk-7S7HFNGN.js.map +1 -0
  59. package/dist/chunk-7T3QFG4C.js +108 -0
  60. package/dist/chunk-7T3QFG4C.js.map +1 -0
  61. package/dist/chunk-ACI4CZ3N.js +141 -0
  62. package/dist/chunk-ACI4CZ3N.js.map +1 -0
  63. package/dist/chunk-AF3NCC5P.js +127 -0
  64. package/dist/chunk-AF3NCC5P.js.map +1 -0
  65. package/dist/chunk-AFTE3PC6.js +141 -0
  66. package/dist/chunk-AFTE3PC6.js.map +1 -0
  67. package/dist/chunk-ARSX76AK.js +49 -0
  68. package/dist/chunk-ARSX76AK.js.map +1 -0
  69. package/dist/chunk-AVOJOQXO.js +108 -0
  70. package/dist/chunk-AVOJOQXO.js.map +1 -0
  71. package/dist/chunk-AWLKSOKJ.js +49 -0
  72. package/dist/chunk-AWLKSOKJ.js.map +1 -0
  73. package/dist/chunk-B5CBBNRH.js +141 -0
  74. package/dist/chunk-B5CBBNRH.js.map +1 -0
  75. package/dist/chunk-BJAVQP5F.js +212 -0
  76. package/dist/chunk-BJAVQP5F.js.map +1 -0
  77. package/dist/chunk-C4DWCONF.js +212 -0
  78. package/dist/chunk-C4DWCONF.js.map +1 -0
  79. package/dist/chunk-CM2VKLWZ.js +127 -0
  80. package/dist/chunk-CM2VKLWZ.js.map +1 -0
  81. package/dist/chunk-CRPUM7SJ.js +212 -0
  82. package/dist/chunk-CRPUM7SJ.js.map +1 -0
  83. package/dist/chunk-CSBHWPRR.js +105 -0
  84. package/dist/chunk-CSBHWPRR.js.map +1 -0
  85. package/dist/chunk-CT7PENLL.js +105 -0
  86. package/dist/chunk-CT7PENLL.js.map +1 -0
  87. package/dist/chunk-DIAD272J.js +49 -0
  88. package/dist/chunk-DIAD272J.js.map +1 -0
  89. package/dist/chunk-DXONM5CJ.js +141 -0
  90. package/dist/chunk-DXONM5CJ.js.map +1 -0
  91. package/dist/chunk-E4LV6EXS.js +108 -0
  92. package/dist/chunk-E4LV6EXS.js.map +1 -0
  93. package/dist/chunk-E6E6MHRM.js +212 -0
  94. package/dist/chunk-E6E6MHRM.js.map +1 -0
  95. package/dist/chunk-E77PCJ2L.js +141 -0
  96. package/dist/chunk-E77PCJ2L.js.map +1 -0
  97. package/dist/chunk-E7F44FIR.js +105 -0
  98. package/dist/chunk-E7F44FIR.js.map +1 -0
  99. package/dist/chunk-EK2YUTFC.js +141 -0
  100. package/dist/chunk-EK2YUTFC.js.map +1 -0
  101. package/dist/chunk-EKQJYLLX.js +212 -0
  102. package/dist/chunk-EKQJYLLX.js.map +1 -0
  103. package/dist/chunk-FA77TXZD.js +127 -0
  104. package/dist/chunk-FA77TXZD.js.map +1 -0
  105. package/dist/chunk-FAFYYMFU.js +108 -0
  106. package/dist/chunk-FAFYYMFU.js.map +1 -0
  107. package/dist/chunk-FHTHKUN5.js +126 -0
  108. package/dist/chunk-FHTHKUN5.js.map +1 -0
  109. package/dist/chunk-GAWACXC2.js +127 -0
  110. package/dist/chunk-GAWACXC2.js.map +1 -0
  111. package/dist/chunk-GR3BLVJV.js +212 -0
  112. package/dist/chunk-GR3BLVJV.js.map +1 -0
  113. package/dist/chunk-GRCSAYBS.js +141 -0
  114. package/dist/chunk-GRCSAYBS.js.map +1 -0
  115. package/dist/chunk-GTRGNGUL.js +212 -0
  116. package/dist/chunk-GTRGNGUL.js.map +1 -0
  117. package/dist/chunk-H6EWZ7XZ.js +105 -0
  118. package/dist/chunk-H6EWZ7XZ.js.map +1 -0
  119. package/dist/chunk-HH3OPBBE.js +108 -0
  120. package/dist/chunk-HH3OPBBE.js.map +1 -0
  121. package/dist/chunk-HRVIZJEA.js +63 -0
  122. package/dist/chunk-HRVIZJEA.js.map +1 -0
  123. package/dist/chunk-I5GYABMO.js +141 -0
  124. package/dist/chunk-I5GYABMO.js.map +1 -0
  125. package/dist/chunk-I5J6GFME.js +141 -0
  126. package/dist/chunk-I5J6GFME.js.map +1 -0
  127. package/dist/chunk-IHFBGGHI.js +2297 -0
  128. package/dist/chunk-IHFBGGHI.js.map +1 -0
  129. package/dist/chunk-IHHNRYGC.js +108 -0
  130. package/dist/chunk-IHHNRYGC.js.map +1 -0
  131. package/dist/chunk-IPF6TU3K.js +212 -0
  132. package/dist/chunk-IPF6TU3K.js.map +1 -0
  133. package/dist/chunk-JNSJK2TR.js +2323 -0
  134. package/dist/chunk-JNSJK2TR.js.map +1 -0
  135. package/dist/chunk-JY62VTMC.js +49 -0
  136. package/dist/chunk-JY62VTMC.js.map +1 -0
  137. package/dist/chunk-KKC3SV7X.js +212 -0
  138. package/dist/chunk-KKC3SV7X.js.map +1 -0
  139. package/dist/chunk-KLKFSFIO.js +127 -0
  140. package/dist/chunk-KLKFSFIO.js.map +1 -0
  141. package/dist/chunk-KLXG7TWR.js +212 -0
  142. package/dist/chunk-KLXG7TWR.js.map +1 -0
  143. package/dist/chunk-KONLD7QH.js +108 -0
  144. package/dist/chunk-KONLD7QH.js.map +1 -0
  145. package/dist/chunk-KVZ4GBCQ.js +212 -0
  146. package/dist/chunk-KVZ4GBCQ.js.map +1 -0
  147. package/dist/chunk-LCX6G6UD.js +49 -0
  148. package/dist/chunk-LCX6G6UD.js.map +1 -0
  149. package/dist/chunk-LTJESAOY.js +49 -0
  150. package/dist/chunk-LTJESAOY.js.map +1 -0
  151. package/dist/chunk-LVOIDBQG.js +5083 -0
  152. package/dist/chunk-LVOIDBQG.js.map +1 -0
  153. package/dist/chunk-M7MZHGIW.js +141 -0
  154. package/dist/chunk-M7MZHGIW.js.map +1 -0
  155. package/dist/chunk-MFLND54Z.js +105 -0
  156. package/dist/chunk-MFLND54Z.js.map +1 -0
  157. package/dist/chunk-MU2VXMVI.js +105 -0
  158. package/dist/chunk-MU2VXMVI.js.map +1 -0
  159. package/dist/chunk-MYFQGX4G.js +130 -0
  160. package/dist/chunk-MYFQGX4G.js.map +1 -0
  161. package/dist/chunk-NIVSHXEJ.js +141 -0
  162. package/dist/chunk-NIVSHXEJ.js.map +1 -0
  163. package/dist/chunk-NJMWUDSI.js +2323 -0
  164. package/dist/chunk-NJMWUDSI.js.map +1 -0
  165. package/dist/chunk-NP4YOCMX.js +127 -0
  166. package/dist/chunk-NP4YOCMX.js.map +1 -0
  167. package/dist/chunk-NVIXO3FX.js +127 -0
  168. package/dist/chunk-NVIXO3FX.js.map +1 -0
  169. package/dist/chunk-OB5SKTJ7.js +2294 -0
  170. package/dist/chunk-OB5SKTJ7.js.map +1 -0
  171. package/dist/chunk-OWG3KRZJ.js +108 -0
  172. package/dist/chunk-OWG3KRZJ.js.map +1 -0
  173. package/dist/chunk-P3FVYMA6.js +127 -0
  174. package/dist/chunk-P3FVYMA6.js.map +1 -0
  175. package/dist/chunk-PJDWYUHP.js +3629 -0
  176. package/dist/chunk-PJDWYUHP.js.map +1 -0
  177. package/dist/chunk-PS6RUUUK.js +86 -0
  178. package/dist/chunk-PS6RUUUK.js.map +1 -0
  179. package/dist/chunk-QAFEK7IY.js +105 -0
  180. package/dist/chunk-QAFEK7IY.js.map +1 -0
  181. package/dist/chunk-QFPKRXR3.js +108 -0
  182. package/dist/chunk-QFPKRXR3.js.map +1 -0
  183. package/dist/chunk-R3N37XCV.js +212 -0
  184. package/dist/chunk-R3N37XCV.js.map +1 -0
  185. package/dist/chunk-R4E42CNE.js +2324 -0
  186. package/dist/chunk-R4E42CNE.js.map +1 -0
  187. package/dist/chunk-R4FMLRKR.js +105 -0
  188. package/dist/chunk-R4FMLRKR.js.map +1 -0
  189. package/dist/chunk-R4ISWFAU.js +2323 -0
  190. package/dist/chunk-R4ISWFAU.js.map +1 -0
  191. package/dist/chunk-R5KOPIFI.js +127 -0
  192. package/dist/chunk-R5KOPIFI.js.map +1 -0
  193. package/dist/chunk-RHM7WSYL.js +127 -0
  194. package/dist/chunk-RHM7WSYL.js.map +1 -0
  195. package/dist/chunk-RMOYI7RJ.js +212 -0
  196. package/dist/chunk-RMOYI7RJ.js.map +1 -0
  197. package/dist/chunk-RQB4FWW7.js +2296 -0
  198. package/dist/chunk-RQB4FWW7.js.map +1 -0
  199. package/dist/chunk-RRQLWLKC.js +127 -0
  200. package/dist/chunk-RRQLWLKC.js.map +1 -0
  201. package/dist/chunk-S7BWR5IZ.js +212 -0
  202. package/dist/chunk-S7BWR5IZ.js.map +1 -0
  203. package/dist/chunk-SUHRSNAI.js +63 -0
  204. package/dist/chunk-SUHRSNAI.js.map +1 -0
  205. package/dist/chunk-T5J4XBWF.js +127 -0
  206. package/dist/chunk-T5J4XBWF.js.map +1 -0
  207. package/dist/chunk-T5OKHLM7.js +86 -0
  208. package/dist/chunk-T5OKHLM7.js.map +1 -0
  209. package/dist/chunk-T6TINFBB.js +49 -0
  210. package/dist/chunk-T6TINFBB.js.map +1 -0
  211. package/dist/chunk-TK4FIUGX.js +105 -0
  212. package/dist/chunk-TK4FIUGX.js.map +1 -0
  213. package/dist/chunk-TSYM32RM.js +2218 -0
  214. package/dist/chunk-TSYM32RM.js.map +1 -0
  215. package/dist/chunk-TYLFHFBL.js +127 -0
  216. package/dist/chunk-TYLFHFBL.js.map +1 -0
  217. package/dist/chunk-TZ6FCCCJ.js +105 -0
  218. package/dist/chunk-TZ6FCCCJ.js.map +1 -0
  219. package/dist/chunk-UFO7XI55.js +212 -0
  220. package/dist/chunk-UFO7XI55.js.map +1 -0
  221. package/dist/chunk-UHGU5YPX.js +127 -0
  222. package/dist/chunk-UHGU5YPX.js.map +1 -0
  223. package/dist/chunk-UTXIA4ZA.js +105 -0
  224. package/dist/chunk-UTXIA4ZA.js.map +1 -0
  225. package/dist/chunk-UYI6WFT7.js +105 -0
  226. package/dist/chunk-UYI6WFT7.js.map +1 -0
  227. package/dist/chunk-VENIIRNN.js +49 -0
  228. package/dist/chunk-VENIIRNN.js.map +1 -0
  229. package/dist/chunk-VIX553CW.js +108 -0
  230. package/dist/chunk-VIX553CW.js.map +1 -0
  231. package/dist/chunk-VLYJFH7W.js +49 -0
  232. package/dist/chunk-VLYJFH7W.js.map +1 -0
  233. package/dist/chunk-VOXSIPTX.js +141 -0
  234. package/dist/chunk-VOXSIPTX.js.map +1 -0
  235. package/dist/chunk-VZNGE73T.js +105 -0
  236. package/dist/chunk-VZNGE73T.js.map +1 -0
  237. package/dist/chunk-W2J2VZEP.js +108 -0
  238. package/dist/chunk-W2J2VZEP.js.map +1 -0
  239. package/dist/chunk-X3QTCV4Q.js +212 -0
  240. package/dist/chunk-X3QTCV4Q.js.map +1 -0
  241. package/dist/chunk-X5ZOQIDW.js +108 -0
  242. package/dist/chunk-X5ZOQIDW.js.map +1 -0
  243. package/dist/chunk-XHG32AO6.js +141 -0
  244. package/dist/chunk-XHG32AO6.js.map +1 -0
  245. package/dist/chunk-XJSNK6B3.js +127 -0
  246. package/dist/chunk-XJSNK6B3.js.map +1 -0
  247. package/dist/chunk-XRKRGNVZ.js +141 -0
  248. package/dist/chunk-XRKRGNVZ.js.map +1 -0
  249. package/dist/chunk-XVA5MO4M.js +2324 -0
  250. package/dist/chunk-XVA5MO4M.js.map +1 -0
  251. package/dist/chunk-XXEJA3Q7.js +86 -0
  252. package/dist/chunk-XXEJA3Q7.js.map +1 -0
  253. package/dist/chunk-XZAEVXPG.js +108 -0
  254. package/dist/chunk-XZAEVXPG.js.map +1 -0
  255. package/dist/chunk-YCVZY6JX.js +141 -0
  256. package/dist/chunk-YCVZY6JX.js.map +1 -0
  257. package/dist/chunk-YQAMFHXE.js +212 -0
  258. package/dist/chunk-YQAMFHXE.js.map +1 -0
  259. package/dist/chunk-YRB4D655.js +141 -0
  260. package/dist/chunk-YRB4D655.js.map +1 -0
  261. package/dist/chunk-YVPSUVSB.js +141 -0
  262. package/dist/chunk-YVPSUVSB.js.map +1 -0
  263. package/dist/chunk-YWEJJEJY.js +105 -0
  264. package/dist/chunk-YWEJJEJY.js.map +1 -0
  265. package/dist/chunk-YXOEPMQS.js +127 -0
  266. package/dist/chunk-YXOEPMQS.js.map +1 -0
  267. package/dist/chunk-ZBNO57AP.js +141 -0
  268. package/dist/chunk-ZBNO57AP.js.map +1 -0
  269. package/dist/chunk-ZZDH4KPF.js +212 -0
  270. package/dist/chunk-ZZDH4KPF.js.map +1 -0
  271. package/dist/components/AddressContainer/CoreAddressContainer.js +6 -6
  272. package/dist/components/AddressContainer/EVMAddressContainer.js +6 -6
  273. package/dist/components/AddressContainer/addressSwitcher.js +4 -4
  274. package/dist/components/AddressContainer/addressView.js +3 -3
  275. package/dist/components/AddressContainer/label.js +2 -2
  276. package/dist/components/Age/index.js +2 -2
  277. package/dist/components/CopyButton/index.js +1 -1
  278. package/dist/components/DownloadCSV/index.js +1 -1
  279. package/dist/components/Highlight/index.js +12 -2
  280. package/dist/components/Highlight/index.js.map +1 -1
  281. package/dist/components/InfoIconWithTooltip/index.js +1 -1
  282. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.d.ts +6 -0
  283. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js +7 -0
  284. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js.map +1 -0
  285. package/dist/components/PhishingAddressContainer/index.d.ts +15 -0
  286. package/dist/components/PhishingAddressContainer/index.js +124 -0
  287. package/dist/components/PhishingAddressContainer/index.js.map +1 -0
  288. package/dist/components/PhishingAddressContainer/phishing-warning.svg.svg +3 -0
  289. package/dist/components/Price/index.js +1 -1
  290. package/dist/components/Select/index.js +1 -1
  291. package/dist/components/Select/select.js +1 -1
  292. package/dist/components/Text/index.js +2 -2
  293. package/dist/components/Tooltip/index.d.ts +1 -1
  294. package/dist/components/Tooltip/index.js +1 -1
  295. package/dist/components/Tooltip/tt.d.ts +28 -0
  296. package/dist/components/Tooltip/tt.js +8 -0
  297. package/dist/components/Tooltip/tt.js.map +1 -0
  298. package/dist/components/TransactionAction/coreTransactionAction.js +6 -6
  299. package/dist/components/TransactionAction/evmTransactionAction.js +6 -6
  300. package/dist/contants/cssVariable.d.ts +20 -0
  301. package/dist/contants/cssVariable.js +41 -0
  302. package/dist/contants/cssVariable.js.map +1 -0
  303. package/dist/uno.css +6 -4
  304. package/dist/utils/contractManagerTool.d.ts +50 -0
  305. package/dist/utils/contractManagerTool.js +92 -0
  306. package/dist/utils/contractManagerTool.js.map +1 -0
  307. package/package.json +5 -5
@@ -0,0 +1,141 @@
1
+ import {
2
+ useENS
3
+ } from "./chunk-5CJCDS5F.js";
4
+ import {
5
+ ContractAddress,
6
+ ContractCreatedAddress,
7
+ CoreHexAddress,
8
+ InvalidAddress,
9
+ MyAddress,
10
+ PosAddress
11
+ } from "./chunk-UFO7XI55.js";
12
+ import {
13
+ RenderAddress
14
+ } from "./chunk-YXOEPMQS.js";
15
+ import {
16
+ formatAddress,
17
+ isCoreAddress,
18
+ isCoreContractAddress,
19
+ isZeroAddress
20
+ } from "./chunk-RTFAJGPO.js";
21
+ import {
22
+ getLabelInfo
23
+ } from "./chunk-CRLSK4N6.js";
24
+ import {
25
+ getTranslations,
26
+ useGlobalData
27
+ } from "./chunk-DQGLZCIG.js";
28
+
29
+ // src/components/AddressContainer/CoreAddressContainer.tsx
30
+ import { memo } from "react";
31
+ import { withTranslation } from "react-i18next";
32
+ import _ from "lodash";
33
+ import { Fragment, jsx } from "react/jsx-runtime";
34
+ var parseProps = (props, globalData) => {
35
+ const {
36
+ alias,
37
+ ensInfo,
38
+ t,
39
+ showAddressLabel,
40
+ showNametag,
41
+ nametagInfo,
42
+ showENSLabel
43
+ } = props;
44
+ const value = props.value || "";
45
+ const cfxAddress = formatAddress(value, "base32");
46
+ let ENSMap = ensInfo || {};
47
+ const translations = getTranslations();
48
+ let aliasLabel = alias;
49
+ if (!alias && isZeroAddress(cfxAddress)) {
50
+ aliasLabel = t(translations.general.zeroAddress);
51
+ }
52
+ let prefixIcon = null;
53
+ let officalNametag = null;
54
+ let addressLabel = null;
55
+ let ENSLabel = null;
56
+ const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;
57
+ if (cfxAddress && showAddressLabel) {
58
+ const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
59
+ const gAddressLabel = addressLabels?.[cfxAddress];
60
+ if (gAddressLabel) {
61
+ const { label } = getLabelInfo(gAddressLabel, "tag");
62
+ addressLabel = label;
63
+ }
64
+ }
65
+ if (cfxAddress && showNametag) {
66
+ const nametags = nametagInfo?.[cfxAddress];
67
+ if (nametags) {
68
+ const nametag = nametags?.nametag ?? "";
69
+ const { label } = getLabelInfo(nametag, "nametag");
70
+ officalNametag = label;
71
+ }
72
+ }
73
+ if (showENSLabel && gENSLabel) {
74
+ const { label, icon } = getLabelInfo(gENSLabel, "ens");
75
+ ENSLabel = label;
76
+ prefixIcon = icon;
77
+ }
78
+ return {
79
+ alias: aliasLabel,
80
+ prefix: prefixIcon,
81
+ nametag: officalNametag,
82
+ addressLabel,
83
+ ENSLabel,
84
+ cfxAddress
85
+ };
86
+ };
87
+ var CoreAddressContainer = withTranslation()(
88
+ memo((props) => {
89
+ const { globalData } = useGlobalData();
90
+ const unnecessaryEns = props.ensInfo || props.showENSLabel === false;
91
+ const { ens } = useENS(unnecessaryEns ? null : props.value);
92
+ if (!props.value && !props.contractCreated) {
93
+ return /* @__PURE__ */ jsx(Fragment, { children: "--" });
94
+ }
95
+ const defaultProps = {
96
+ isFull: false,
97
+ isFullNameTag: false,
98
+ link: true,
99
+ isMe: false,
100
+ showIcon: true,
101
+ verify: false,
102
+ showAddressLabel: true,
103
+ showENSLabel: true,
104
+ showNametag: true,
105
+ ensInfo: ens
106
+ };
107
+ const mergeDefaultProps = _.assign({}, defaultProps, props);
108
+ const mergeParseProps = _.merge(
109
+ {},
110
+ mergeDefaultProps,
111
+ parseProps(mergeDefaultProps, globalData)
112
+ );
113
+ if (mergeParseProps.isPosAddress) {
114
+ return PosAddress(mergeParseProps);
115
+ }
116
+ if (!mergeParseProps.value && mergeParseProps.contractCreated) {
117
+ return ContractCreatedAddress({
118
+ ...mergeParseProps,
119
+ outputType: "base32"
120
+ });
121
+ }
122
+ if (mergeParseProps.isEspaceAddress) {
123
+ return CoreHexAddress(mergeParseProps);
124
+ }
125
+ if (!isCoreAddress(mergeParseProps.value)) {
126
+ return InvalidAddress(mergeParseProps);
127
+ }
128
+ if (isCoreContractAddress(mergeParseProps.cfxAddress)) {
129
+ return ContractAddress(mergeParseProps);
130
+ }
131
+ if (mergeParseProps.isMe) {
132
+ return MyAddress(mergeParseProps);
133
+ }
134
+ return RenderAddress(mergeParseProps);
135
+ })
136
+ );
137
+
138
+ export {
139
+ CoreAddressContainer
140
+ };
141
+ //# sourceMappingURL=chunk-M7MZHGIW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/AddressContainer/CoreAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isCoreAddress,\n isCoreContractAddress,\n isZeroAddress,\n convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { getLabelInfo } from './label';\nimport { useENS } from '../../utils/hooks/useENS';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n CoreHexAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n PosAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { CoreAddressContainerProps } from './types';\n\nconst parseProps = (\n props: CoreAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const {\n alias,\n ensInfo,\n t,\n showAddressLabel,\n showNametag,\n nametagInfo,\n showENSLabel,\n } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'base32');\n\n let ENSMap = ensInfo || {};\n\n const translations = getTranslations();\n\n let aliasLabel = alias;\n if (!alias && isZeroAddress(cfxAddress)) {\n aliasLabel = t(translations.general.zeroAddress);\n }\n\n let prefixIcon: React.ReactNode = null;\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n // ens name tag\n let ENSLabel: React.ReactNode = null;\n // global ens name tag\n const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n const gAddressLabel = addressLabels?.[cfxAddress];\n\n if (gAddressLabel) {\n const { label } = getLabelInfo(gAddressLabel, 'tag');\n addressLabel = label;\n }\n }\n\n if (cfxAddress && showNametag) {\n const nametags = nametagInfo?.[cfxAddress];\n\n if (nametags) {\n const nametag = nametags?.nametag ?? '';\n const { label } = getLabelInfo(nametag, 'nametag');\n officalNametag = label;\n }\n }\n\n if (showENSLabel && gENSLabel) {\n const { label, icon } = getLabelInfo(gENSLabel, 'ens');\n ENSLabel = label;\n prefixIcon = icon;\n }\n\n return {\n alias: aliasLabel,\n prefix: prefixIcon,\n nametag: officalNametag,\n addressLabel,\n ENSLabel,\n cfxAddress,\n };\n};\n\nexport const CoreAddressContainer = withTranslation()(\n memo((props: CoreAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If the interface returns Ens content, there is no need to obtain it separately, or disable the display of Ens content (in most cases on the list page).\n const unnecessaryEns = props.ensInfo || props.showENSLabel === false;\n const { ens } = useENS(unnecessaryEns ? null : props.value);\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 ensInfo: ens,\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.isPosAddress) {\n return PosAddress(mergeParseProps);\n }\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'base32',\n });\n }\n\n if (mergeParseProps.isEspaceAddress) {\n return CoreHexAddress(mergeParseProps);\n }\n\n if (!isCoreAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (isCoreContractAddress(mergeParseProps.cfxAddress)) {\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;AA2GD;AAlFb,IAAM,aAAa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";
10
+
11
+ // src/components/Text/index.tsx
12
+ import React from "react";
13
+ import clsx from "clsx";
14
+ import { jsx } from "react/jsx-runtime";
15
+ var getTypeColor = (type) => {
16
+ const colors = {
17
+ default: "inherit",
18
+ primary: "#7cd77b",
19
+ secondary: "#666",
20
+ success: "#7cd77b",
21
+ warning: "#ffc438",
22
+ error: "#e15c56"
23
+ };
24
+ return colors[type] || colors.default;
25
+ };
26
+ var Text = React.memo(
27
+ ({
28
+ className,
29
+ children,
30
+ maxWidth: _maxWidth,
31
+ mobileMaxWidth = _maxWidth,
32
+ maxCount: _maxCount,
33
+ mobileMaxCount = _maxCount,
34
+ hoverValue,
35
+ hoverValueMaxCount: outerHoverValueMaxCount,
36
+ tag = "p",
37
+ type = "default",
38
+ hideTooltip = false,
39
+ ...props
40
+ }) => {
41
+ const Component = tag;
42
+ const bp = useBreakpoint();
43
+ let child = children;
44
+ const maxCount = bp === "s" ? mobileMaxCount : _maxCount;
45
+ const maxWidth = bp === "s" ? mobileMaxWidth : _maxWidth;
46
+ if (maxWidth === void 0 && maxCount && typeof children === "string" && children.length > maxCount) {
47
+ child = String.prototype.substr.call(children, 0, maxCount) + "...";
48
+ }
49
+ let textContent = hoverValue || children;
50
+ if (bp === "s" && typeof textContent === "string") {
51
+ const hoverValueMaxCount = outerHoverValueMaxCount || 34;
52
+ let textContentCopy = textContent;
53
+ let newTextContent = [];
54
+ let count = 0;
55
+ while (textContentCopy.length > hoverValueMaxCount) {
56
+ newTextContent.push(
57
+ /* @__PURE__ */ jsx("span", { children: textContentCopy.substr(0, hoverValueMaxCount) }, count)
58
+ );
59
+ newTextContent.push(/* @__PURE__ */ jsx("br", {}, `br${count}`));
60
+ textContentCopy = textContentCopy.substr(hoverValueMaxCount);
61
+ if (count > 3) {
62
+ textContentCopy = textContentCopy.substr(0, hoverValueMaxCount - 3) + "...";
63
+ }
64
+ }
65
+ newTextContent.push(/* @__PURE__ */ jsx("span", { children: textContentCopy }, ++count));
66
+ textContent = newTextContent;
67
+ }
68
+ const tooltipText = !hideTooltip && React.createElement(
69
+ "div",
70
+ {
71
+ onClick: (e) => {
72
+ e.preventDefault();
73
+ e.stopPropagation();
74
+ selectText(e.currentTarget);
75
+ }
76
+ },
77
+ textContent
78
+ );
79
+ const p = { title: tooltipText };
80
+ return React.createElement(Tooltip, p, [
81
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
82
+ Component,
83
+ {
84
+ className: clsx(
85
+ "sirius-text truncate vertical-bottom",
86
+ "all-[a]:truncate all-[a]:vertical-bottom all-[a]:cursor-pointer all-[a:hover]:text-#0626ae",
87
+ className
88
+ ),
89
+ style: {
90
+ maxWidth,
91
+ display: maxWidth === void 0 ? "inherit" : "inline-block",
92
+ color: getTypeColor(type)
93
+ },
94
+ ...props,
95
+ children: child
96
+ }
97
+ ) }, "text")
98
+ ]);
99
+ }
100
+ );
101
+
102
+ export {
103
+ Text
104
+ };
105
+ //# sourceMappingURL=chunk-MFLND54Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Text/index.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\nimport { Tooltip } from '../Tooltip';\nimport { selectText } from '../../utils';\nimport { useBreakpoint } from '../../utils/media';\n\ntype NormalTypes =\n | 'default'\n | 'secondary'\n | 'success'\n | 'warning'\n | 'error'\n | 'primary';\n\ntype TextProps = {\n children?: React.ReactNode;\n maxWidth?: string;\n mobileMaxWidth?: string;\n maxCount?: number;\n mobileMaxCount?: number;\n hoverValue?: React.ReactNode;\n hoverValueMaxCount?: number;\n tag?: 'p' | 'span';\n type?: NormalTypes;\n hideTooltip?: boolean;\n};\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof TextProps>;\n\nconst getTypeColor = (type: NormalTypes) => {\n const colors: { [key in NormalTypes]: string } = {\n default: 'inherit',\n primary: '#7cd77b',\n secondary: '#666',\n success: '#7cd77b',\n warning: '#ffc438',\n error: '#e15c56',\n };\n\n return colors[type] || colors.default;\n};\n\n// note:\n// 1. maxWidth priority is higher than maxCount\n// 2. maxCount only apply to string\n// 3. if hoverValue is provided, use hoverValue as Tooltip text, otherwise use children\n// if text of prop tooltip is provided, use as Tooltip text\nexport const Text = React.memo(\n ({\n className,\n children,\n maxWidth: _maxWidth,\n mobileMaxWidth = _maxWidth,\n maxCount: _maxCount,\n mobileMaxCount = _maxCount,\n hoverValue,\n hoverValueMaxCount: outerHoverValueMaxCount,\n tag = 'p',\n type = 'default',\n hideTooltip = false,\n ...props\n }: NativeAttrs & TextProps) => {\n const Component = tag;\n const bp = useBreakpoint();\n let child: React.ReactNode = children;\n const maxCount = bp === 's' ? mobileMaxCount : _maxCount;\n const maxWidth = bp === 's' ? mobileMaxWidth : _maxWidth;\n if (\n maxWidth === undefined &&\n maxCount &&\n typeof children === 'string' &&\n children.length > maxCount\n ) {\n child = String.prototype.substr.call(children, 0, maxCount) + '...';\n }\n\n let textContent = hoverValue || children;\n // 控制移动端字符串类型 tooltip 的长度\n // 这里有个问题,就是截断的位置可能是一个完整的单词,暂时没有办法处理,如果为了避免这种情况,需要由外面传入前对内容进行处理,比如设置固定宽度小于 24rem\n // @todo 后续可以试下读取文本长度,动态设置容器宽度值的方式,可以避免截断位置的问题\n if (bp === 's' && typeof textContent === 'string') {\n const hoverValueMaxCount = outerHoverValueMaxCount || 34; // default text count is 36\n let textContentCopy: string = textContent;\n let newTextContent: Array<React.ReactNode> = [];\n let count = 0;\n while (textContentCopy.length > hoverValueMaxCount) {\n newTextContent.push(\n <span key={count}>\n {textContentCopy.substr(0, hoverValueMaxCount)}\n </span>,\n );\n newTextContent.push(<br key={`br${count}`} />);\n textContentCopy = textContentCopy.substr(hoverValueMaxCount);\n // 防止文本过长的情况\n if (count > 3) {\n textContentCopy =\n textContentCopy.substr(0, hoverValueMaxCount - 3) + '...';\n }\n }\n newTextContent.push(<span key={++count}>{textContentCopy}</span>);\n textContent = newTextContent;\n }\n const tooltipText =\n !hideTooltip &&\n React.createElement(\n 'div',\n {\n onClick: e => {\n e.preventDefault();\n e.stopPropagation();\n selectText(e.currentTarget);\n },\n },\n textContent,\n );\n\n const p = { title: tooltipText };\n return React.createElement(Tooltip, p, [\n <span key=\"text\">\n <Component\n className={clsx(\n 'sirius-text truncate vertical-bottom',\n 'all-[a]:truncate all-[a]:vertical-bottom all-[a]:cursor-pointer all-[a:hover]:text-#0626ae',\n className,\n )}\n style={{\n maxWidth,\n display: maxWidth === undefined ? 'inherit' : 'inline-block',\n color: getTypeColor(type),\n }}\n {...props}\n >\n {child}\n </Component>\n </span>,\n ]);\n },\n);\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,UAAU;AAqFP;AA1DV,IAAM,eAAe,CAAC,SAAsB;AAC1C,QAAM,SAA2C;AAAA,IAC/C,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAEA,SAAO,OAAO,IAAI,KAAK,OAAO;AAChC;AAOO,IAAM,OAAO,MAAM;AAAA,EACxB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB;AAAA,IACA,oBAAoB;AAAA,IACpB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,IACd,GAAG;AAAA,EACL,MAA+B;AAC7B,UAAM,YAAY;AAClB,UAAM,KAAK,cAAc;AACzB,QAAI,QAAyB;AAC7B,UAAM,WAAW,OAAO,MAAM,iBAAiB;AAC/C,UAAM,WAAW,OAAO,MAAM,iBAAiB;AAC/C,QACE,aAAa,UACb,YACA,OAAO,aAAa,YACpB,SAAS,SAAS,UAClB;AACA,cAAQ,OAAO,UAAU,OAAO,KAAK,UAAU,GAAG,QAAQ,IAAI;AAAA,IAChE;AAEA,QAAI,cAAc,cAAc;AAIhC,QAAI,OAAO,OAAO,OAAO,gBAAgB,UAAU;AACjD,YAAM,qBAAqB,2BAA2B;AACtD,UAAI,kBAA0B;AAC9B,UAAI,iBAAyC,CAAC;AAC9C,UAAI,QAAQ;AACZ,aAAO,gBAAgB,SAAS,oBAAoB;AAClD,uBAAe;AAAA,UACb,oBAAC,UACE,0BAAgB,OAAO,GAAG,kBAAkB,KADpC,KAEX;AAAA,QACF;AACA,uBAAe,KAAK,oBAAC,UAAQ,KAAK,OAAS,CAAE;AAC7C,0BAAkB,gBAAgB,OAAO,kBAAkB;AAE3D,YAAI,QAAQ,GAAG;AACb,4BACE,gBAAgB,OAAO,GAAG,qBAAqB,CAAC,IAAI;AAAA,QACxD;AAAA,MACF;AACA,qBAAe,KAAK,oBAAC,UAAoB,6BAAV,EAAE,KAAwB,CAAO;AAChE,oBAAc;AAAA,IAChB;AACA,UAAM,cACJ,CAAC,eACD,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,QACE,SAAS,OAAK;AACZ,YAAE,eAAe;AACjB,YAAE,gBAAgB;AAClB,qBAAW,EAAE,aAAa;AAAA,QAC5B;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAEF,UAAM,IAAI,EAAE,OAAO,YAAY;AAC/B,WAAO,MAAM,cAAc,SAAS,GAAG;AAAA,MACrC,oBAAC,UACC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA,SAAS,aAAa,SAAY,YAAY;AAAA,YAC9C,OAAO,aAAa,IAAI;AAAA,UAC1B;AAAA,UACC,GAAG;AAAA,UAEH;AAAA;AAAA,MACH,KAfQ,MAgBV;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,105 @@
1
+ import {
2
+ useBreakpoint
3
+ } from "./chunk-TOKKKTFG.js";
4
+ import {
5
+ Tooltip
6
+ } from "./chunk-R4ISWFAU.js";
7
+ import {
8
+ selectText
9
+ } from "./chunk-4WJBUQY7.js";
10
+
11
+ // src/components/Text/index.tsx
12
+ import React from "react";
13
+ import clsx from "clsx";
14
+ import { jsx } from "react/jsx-runtime";
15
+ var getTypeColor = (type) => {
16
+ const colors = {
17
+ default: "inherit",
18
+ primary: "#7cd77b",
19
+ secondary: "#666",
20
+ success: "#7cd77b",
21
+ warning: "#ffc438",
22
+ error: "#e15c56"
23
+ };
24
+ return colors[type] || colors.default;
25
+ };
26
+ var Text = React.memo(
27
+ ({
28
+ className,
29
+ children,
30
+ maxWidth: _maxWidth,
31
+ mobileMaxWidth = _maxWidth,
32
+ maxCount: _maxCount,
33
+ mobileMaxCount = _maxCount,
34
+ hoverValue,
35
+ hoverValueMaxCount: outerHoverValueMaxCount,
36
+ tag = "p",
37
+ type = "default",
38
+ hideTooltip = false,
39
+ ...props
40
+ }) => {
41
+ const Component = tag;
42
+ const bp = useBreakpoint();
43
+ let child = children;
44
+ const maxCount = bp === "s" ? mobileMaxCount : _maxCount;
45
+ const maxWidth = bp === "s" ? mobileMaxWidth : _maxWidth;
46
+ if (maxWidth === void 0 && maxCount && typeof children === "string" && children.length > maxCount) {
47
+ child = String.prototype.substr.call(children, 0, maxCount) + "...";
48
+ }
49
+ let textContent = hoverValue || children;
50
+ if (bp === "s" && typeof textContent === "string") {
51
+ const hoverValueMaxCount = outerHoverValueMaxCount || 34;
52
+ let textContentCopy = textContent;
53
+ let newTextContent = [];
54
+ let count = 0;
55
+ while (textContentCopy.length > hoverValueMaxCount) {
56
+ newTextContent.push(
57
+ /* @__PURE__ */ jsx("span", { children: textContentCopy.substr(0, hoverValueMaxCount) }, count)
58
+ );
59
+ newTextContent.push(/* @__PURE__ */ jsx("br", {}, `br${count}`));
60
+ textContentCopy = textContentCopy.substr(hoverValueMaxCount);
61
+ if (count > 3) {
62
+ textContentCopy = textContentCopy.substr(0, hoverValueMaxCount - 3) + "...";
63
+ }
64
+ }
65
+ newTextContent.push(/* @__PURE__ */ jsx("span", { children: textContentCopy }, ++count));
66
+ textContent = newTextContent;
67
+ }
68
+ const tooltipText = !hideTooltip && React.createElement(
69
+ "div",
70
+ {
71
+ onClick: (e) => {
72
+ e.preventDefault();
73
+ e.stopPropagation();
74
+ selectText(e.currentTarget);
75
+ }
76
+ },
77
+ textContent
78
+ );
79
+ const p = { title: tooltipText };
80
+ return React.createElement(Tooltip, p, [
81
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
82
+ Component,
83
+ {
84
+ className: clsx(
85
+ "sirius-text truncate vertical-bottom",
86
+ "all-[a]:truncate all-[a]:vertical-bottom all-[a]:cursor-pointer all-[a:hover]:text-#0626ae",
87
+ className
88
+ ),
89
+ style: {
90
+ maxWidth,
91
+ display: maxWidth === void 0 ? "inherit" : "inline-block",
92
+ color: getTypeColor(type)
93
+ },
94
+ ...props,
95
+ children: child
96
+ }
97
+ ) }, "text")
98
+ ]);
99
+ }
100
+ );
101
+
102
+ export {
103
+ Text
104
+ };
105
+ //# sourceMappingURL=chunk-MU2VXMVI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Text/index.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\nimport { Tooltip } from '../Tooltip';\nimport { selectText } from '../../utils';\nimport { useBreakpoint } from '../../utils/media';\n\ntype NormalTypes =\n | 'default'\n | 'secondary'\n | 'success'\n | 'warning'\n | 'error'\n | 'primary';\n\ntype TextProps = {\n children?: React.ReactNode;\n maxWidth?: string;\n mobileMaxWidth?: string;\n maxCount?: number;\n mobileMaxCount?: number;\n hoverValue?: React.ReactNode;\n hoverValueMaxCount?: number;\n tag?: 'p' | 'span';\n type?: NormalTypes;\n hideTooltip?: boolean;\n};\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof TextProps>;\n\nconst getTypeColor = (type: NormalTypes) => {\n const colors: { [key in NormalTypes]: string } = {\n default: 'inherit',\n primary: '#7cd77b',\n secondary: '#666',\n success: '#7cd77b',\n warning: '#ffc438',\n error: '#e15c56',\n };\n\n return colors[type] || colors.default;\n};\n\n// note:\n// 1. maxWidth priority is higher than maxCount\n// 2. maxCount only apply to string\n// 3. if hoverValue is provided, use hoverValue as Tooltip text, otherwise use children\n// if text of prop tooltip is provided, use as Tooltip text\nexport const Text = React.memo(\n ({\n className,\n children,\n maxWidth: _maxWidth,\n mobileMaxWidth = _maxWidth,\n maxCount: _maxCount,\n mobileMaxCount = _maxCount,\n hoverValue,\n hoverValueMaxCount: outerHoverValueMaxCount,\n tag = 'p',\n type = 'default',\n hideTooltip = false,\n ...props\n }: NativeAttrs & TextProps) => {\n const Component = tag;\n const bp = useBreakpoint();\n let child: React.ReactNode = children;\n const maxCount = bp === 's' ? mobileMaxCount : _maxCount;\n const maxWidth = bp === 's' ? mobileMaxWidth : _maxWidth;\n if (\n maxWidth === undefined &&\n maxCount &&\n typeof children === 'string' &&\n children.length > maxCount\n ) {\n child = String.prototype.substr.call(children, 0, maxCount) + '...';\n }\n\n let textContent = hoverValue || children;\n // 控制移动端字符串类型 tooltip 的长度\n // 这里有个问题,就是截断的位置可能是一个完整的单词,暂时没有办法处理,如果为了避免这种情况,需要由外面传入前对内容进行处理,比如设置固定宽度小于 24rem\n // @todo 后续可以试下读取文本长度,动态设置容器宽度值的方式,可以避免截断位置的问题\n if (bp === 's' && typeof textContent === 'string') {\n const hoverValueMaxCount = outerHoverValueMaxCount || 34; // default text count is 36\n let textContentCopy: string = textContent;\n let newTextContent: Array<React.ReactNode> = [];\n let count = 0;\n while (textContentCopy.length > hoverValueMaxCount) {\n newTextContent.push(\n <span key={count}>\n {textContentCopy.substr(0, hoverValueMaxCount)}\n </span>,\n );\n newTextContent.push(<br key={`br${count}`} />);\n textContentCopy = textContentCopy.substr(hoverValueMaxCount);\n // 防止文本过长的情况\n if (count > 3) {\n textContentCopy =\n textContentCopy.substr(0, hoverValueMaxCount - 3) + '...';\n }\n }\n newTextContent.push(<span key={++count}>{textContentCopy}</span>);\n textContent = newTextContent;\n }\n const tooltipText =\n !hideTooltip &&\n React.createElement(\n 'div',\n {\n onClick: e => {\n e.preventDefault();\n e.stopPropagation();\n selectText(e.currentTarget);\n },\n },\n textContent,\n );\n\n const p = { title: tooltipText };\n return React.createElement(Tooltip, p, [\n <span key=\"text\">\n <Component\n className={clsx(\n 'sirius-text truncate vertical-bottom',\n 'all-[a]:truncate all-[a]:vertical-bottom all-[a]:cursor-pointer all-[a:hover]:text-#0626ae',\n className,\n )}\n style={{\n maxWidth,\n display: maxWidth === undefined ? 'inherit' : 'inline-block',\n color: getTypeColor(type),\n }}\n {...props}\n >\n {child}\n </Component>\n </span>,\n ]);\n },\n);\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,UAAU;AAqFP;AA1DV,IAAM,eAAe,CAAC,SAAsB;AAC1C,QAAM,SAA2C;AAAA,IAC/C,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAEA,SAAO,OAAO,IAAI,KAAK,OAAO;AAChC;AAOO,IAAM,OAAO,MAAM;AAAA,EACxB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB;AAAA,IACA,oBAAoB;AAAA,IACpB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,IACd,GAAG;AAAA,EACL,MAA+B;AAC7B,UAAM,YAAY;AAClB,UAAM,KAAK,cAAc;AACzB,QAAI,QAAyB;AAC7B,UAAM,WAAW,OAAO,MAAM,iBAAiB;AAC/C,UAAM,WAAW,OAAO,MAAM,iBAAiB;AAC/C,QACE,aAAa,UACb,YACA,OAAO,aAAa,YACpB,SAAS,SAAS,UAClB;AACA,cAAQ,OAAO,UAAU,OAAO,KAAK,UAAU,GAAG,QAAQ,IAAI;AAAA,IAChE;AAEA,QAAI,cAAc,cAAc;AAIhC,QAAI,OAAO,OAA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+ } 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 = 138;
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-MYFQGX4G.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 = 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\" 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,GA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I,WAAU,eAAc,OAAO,EAAE,YAAY,cAAc,GAC7D;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,141 @@
1
+ import {
2
+ useENS
3
+ } from "./chunk-5CJCDS5F.js";
4
+ import {
5
+ ContractAddress,
6
+ ContractCreatedAddress,
7
+ CoreHexAddress,
8
+ InvalidAddress,
9
+ MyAddress,
10
+ PosAddress
11
+ } from "./chunk-EKQJYLLX.js";
12
+ import {
13
+ RenderAddress
14
+ } from "./chunk-RRQLWLKC.js";
15
+ import {
16
+ formatAddress,
17
+ isCoreAddress,
18
+ isCoreContractAddress,
19
+ isZeroAddress
20
+ } from "./chunk-RTFAJGPO.js";
21
+ import {
22
+ getLabelInfo
23
+ } from "./chunk-ARSX76AK.js";
24
+ import {
25
+ getTranslations,
26
+ useGlobalData
27
+ } from "./chunk-DQGLZCIG.js";
28
+
29
+ // src/components/AddressContainer/CoreAddressContainer.tsx
30
+ import { memo } from "react";
31
+ import { withTranslation } from "react-i18next";
32
+ import _ from "lodash";
33
+ import { Fragment, jsx } from "react/jsx-runtime";
34
+ var parseProps = (props, globalData) => {
35
+ const {
36
+ alias,
37
+ ensInfo,
38
+ t,
39
+ showAddressLabel,
40
+ showNametag,
41
+ nametagInfo,
42
+ showENSLabel
43
+ } = props;
44
+ const value = props.value || "";
45
+ const cfxAddress = formatAddress(value, "base32");
46
+ let ENSMap = ensInfo || {};
47
+ const translations = getTranslations();
48
+ let aliasLabel = alias;
49
+ if (!alias && isZeroAddress(cfxAddress)) {
50
+ aliasLabel = t(translations.general.zeroAddress);
51
+ }
52
+ let prefixIcon = null;
53
+ let officalNametag = null;
54
+ let addressLabel = null;
55
+ let ENSLabel = null;
56
+ const gENSLabel = cfxAddress && ENSMap[cfxAddress]?.name;
57
+ if (cfxAddress && showAddressLabel) {
58
+ const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
59
+ const gAddressLabel = addressLabels?.[cfxAddress];
60
+ if (gAddressLabel) {
61
+ const { label } = getLabelInfo(gAddressLabel, "tag");
62
+ addressLabel = label;
63
+ }
64
+ }
65
+ if (cfxAddress && showNametag) {
66
+ const nametags = nametagInfo?.[cfxAddress];
67
+ if (nametags) {
68
+ const nametag = nametags?.nametag ?? "";
69
+ const { label } = getLabelInfo(nametag, "nametag");
70
+ officalNametag = label;
71
+ }
72
+ }
73
+ if (showENSLabel && gENSLabel) {
74
+ const { label, icon } = getLabelInfo(gENSLabel, "ens");
75
+ ENSLabel = label;
76
+ prefixIcon = icon;
77
+ }
78
+ return {
79
+ alias: aliasLabel,
80
+ prefix: prefixIcon,
81
+ nametag: officalNametag,
82
+ addressLabel,
83
+ ENSLabel,
84
+ cfxAddress
85
+ };
86
+ };
87
+ var CoreAddressContainer = withTranslation()(
88
+ memo((props) => {
89
+ const { globalData } = useGlobalData();
90
+ const unnecessaryEns = props.ensInfo || props.showENSLabel === false;
91
+ const { ens } = useENS(unnecessaryEns ? null : props.value);
92
+ if (!props.value && !props.contractCreated) {
93
+ return /* @__PURE__ */ jsx(Fragment, { children: "--" });
94
+ }
95
+ const defaultProps = {
96
+ isFull: false,
97
+ isFullNameTag: false,
98
+ link: true,
99
+ isMe: false,
100
+ showIcon: true,
101
+ verify: false,
102
+ showAddressLabel: true,
103
+ showENSLabel: true,
104
+ showNametag: true,
105
+ ensInfo: ens
106
+ };
107
+ const mergeDefaultProps = _.assign({}, defaultProps, props);
108
+ const mergeParseProps = _.merge(
109
+ {},
110
+ mergeDefaultProps,
111
+ parseProps(mergeDefaultProps, globalData)
112
+ );
113
+ if (mergeParseProps.isPosAddress) {
114
+ return PosAddress(mergeParseProps);
115
+ }
116
+ if (!mergeParseProps.value && mergeParseProps.contractCreated) {
117
+ return ContractCreatedAddress({
118
+ ...mergeParseProps,
119
+ outputType: "base32"
120
+ });
121
+ }
122
+ if (mergeParseProps.isEspaceAddress) {
123
+ return CoreHexAddress(mergeParseProps);
124
+ }
125
+ if (!isCoreAddress(mergeParseProps.value)) {
126
+ return InvalidAddress(mergeParseProps);
127
+ }
128
+ if (isCoreContractAddress(mergeParseProps.cfxAddress)) {
129
+ return ContractAddress(mergeParseProps);
130
+ }
131
+ if (mergeParseProps.isMe) {
132
+ return MyAddress(mergeParseProps);
133
+ }
134
+ return RenderAddress(mergeParseProps);
135
+ })
136
+ );
137
+
138
+ export {
139
+ CoreAddressContainer
140
+ };
141
+ //# sourceMappingURL=chunk-NIVSHXEJ.js.map