conflux-devkit 0.1.0

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 (176) hide show
  1. package/README.md +102 -0
  2. package/dist/cli.js +16338 -0
  3. package/package.json +55 -0
  4. package/ui/out/404/index.html +1 -0
  5. package/ui/out/404.html +1 -0
  6. package/ui/out/_next/static/--YsNpX1nEj74gOnGiYDR/_buildManifest.js +1 -0
  7. package/ui/out/_next/static/--YsNpX1nEj74gOnGiYDR/_ssgManifest.js +1 -0
  8. package/ui/out/_next/static/-7MZn09F75tC02XxCAzYQ/_buildManifest.js +1 -0
  9. package/ui/out/_next/static/-7MZn09F75tC02XxCAzYQ/_ssgManifest.js +1 -0
  10. package/ui/out/_next/static/-Yup9TU2qbfFuEoVK7cV3/_buildManifest.js +1 -0
  11. package/ui/out/_next/static/-Yup9TU2qbfFuEoVK7cV3/_ssgManifest.js +1 -0
  12. package/ui/out/_next/static/2FNwKfitLrla-BD4Pvi7U/_buildManifest.js +1 -0
  13. package/ui/out/_next/static/2FNwKfitLrla-BD4Pvi7U/_ssgManifest.js +1 -0
  14. package/ui/out/_next/static/3dg2q5Zn_zf7tMeBD4-2x/_buildManifest.js +1 -0
  15. package/ui/out/_next/static/3dg2q5Zn_zf7tMeBD4-2x/_ssgManifest.js +1 -0
  16. package/ui/out/_next/static/EMBrL2fIteEXHVOa9QqbR/_buildManifest.js +1 -0
  17. package/ui/out/_next/static/EMBrL2fIteEXHVOa9QqbR/_ssgManifest.js +1 -0
  18. package/ui/out/_next/static/HC9l66u-S82fZ45n1NJvV/_buildManifest.js +1 -0
  19. package/ui/out/_next/static/HC9l66u-S82fZ45n1NJvV/_ssgManifest.js +1 -0
  20. package/ui/out/_next/static/JDizq7Hn5WLnElAxCtqyg/_buildManifest.js +1 -0
  21. package/ui/out/_next/static/JDizq7Hn5WLnElAxCtqyg/_ssgManifest.js +1 -0
  22. package/ui/out/_next/static/KVufTmdF91v3IsRvyub2i/_buildManifest.js +1 -0
  23. package/ui/out/_next/static/KVufTmdF91v3IsRvyub2i/_ssgManifest.js +1 -0
  24. package/ui/out/_next/static/UVWp8ZgmXIqxga6tJZU2j/_buildManifest.js +1 -0
  25. package/ui/out/_next/static/UVWp8ZgmXIqxga6tJZU2j/_ssgManifest.js +1 -0
  26. package/ui/out/_next/static/WVZ0izyd9YpKZhSNF1OSe/_buildManifest.js +1 -0
  27. package/ui/out/_next/static/WVZ0izyd9YpKZhSNF1OSe/_ssgManifest.js +1 -0
  28. package/ui/out/_next/static/_jTgcoBsv_xqKZx36-jrD/_buildManifest.js +1 -0
  29. package/ui/out/_next/static/_jTgcoBsv_xqKZx36-jrD/_ssgManifest.js +1 -0
  30. package/ui/out/_next/static/_tUKGLiPpF-Ioygkq7-R9/_buildManifest.js +1 -0
  31. package/ui/out/_next/static/_tUKGLiPpF-Ioygkq7-R9/_ssgManifest.js +1 -0
  32. package/ui/out/_next/static/chunks/205-997c9580ac2ccb04.js +1 -0
  33. package/ui/out/_next/static/chunks/238-baf384d341a98f9f.js +1 -0
  34. package/ui/out/_next/static/chunks/363-11ecfe8307834c37.js +1 -0
  35. package/ui/out/_next/static/chunks/363-fd3f659dc66a2545.js +1 -0
  36. package/ui/out/_next/static/chunks/383-30e544e3db85d4b4.js +1 -0
  37. package/ui/out/_next/static/chunks/396-0d45f2627ca2432c.js +1 -0
  38. package/ui/out/_next/static/chunks/396-de3171781a3c5f52.js +1 -0
  39. package/ui/out/_next/static/chunks/476-1a499832716820dd.js +1 -0
  40. package/ui/out/_next/static/chunks/5b8f0dd8-7fc232be3e483640.js +1 -0
  41. package/ui/out/_next/static/chunks/5b8f0dd8-f9bbf8f44d8e6302.js +1 -0
  42. package/ui/out/_next/static/chunks/606-d510a7806cc50e18.js +1 -0
  43. package/ui/out/_next/static/chunks/628-ae8f2280d891101c.js +1 -0
  44. package/ui/out/_next/static/chunks/69-a23845cfa4a23071.js +1 -0
  45. package/ui/out/_next/static/chunks/706-142eb06ca4e1b468.js +1 -0
  46. package/ui/out/_next/static/chunks/749-27e561f3f17b1ad3.js +2 -0
  47. package/ui/out/_next/static/chunks/749-bd8c206e8e58f8b0.js +2 -0
  48. package/ui/out/_next/static/chunks/781-7af4662532da98ca.js +1 -0
  49. package/ui/out/_next/static/chunks/815-ab30cec2ff88e700.js +1 -0
  50. package/ui/out/_next/static/chunks/826-c38d836f8f2bac38.js +1 -0
  51. package/ui/out/_next/static/chunks/903-2887fe814dfa6d5e.js +1 -0
  52. package/ui/out/_next/static/chunks/app/_not-found/page-1a3d8ff7bd6fafe6.js +1 -0
  53. package/ui/out/_next/static/chunks/app/_not-found/page-fe94df087cbbeedb.js +1 -0
  54. package/ui/out/_next/static/chunks/app/accounts/page-21a02cc8bbbce9cf.js +1 -0
  55. package/ui/out/_next/static/chunks/app/accounts/page-2bf2eeddfcc46fd2.js +1 -0
  56. package/ui/out/_next/static/chunks/app/accounts/page-4fb77d9b03c79ef0.js +1 -0
  57. package/ui/out/_next/static/chunks/app/accounts/page-840e013892222293.js +1 -0
  58. package/ui/out/_next/static/chunks/app/accounts/page-8828d6c27ee45d5e.js +1 -0
  59. package/ui/out/_next/static/chunks/app/accounts/page-a5a4d066c57c6eba.js +1 -0
  60. package/ui/out/_next/static/chunks/app/accounts/page-cd6edb16de77e73a.js +1 -0
  61. package/ui/out/_next/static/chunks/app/accounts/page-ce44f544affcbb2e.js +1 -0
  62. package/ui/out/_next/static/chunks/app/accounts/page-f26a4c8967b60c31.js +1 -0
  63. package/ui/out/_next/static/chunks/app/accounts/page-fc53feb7e5bf6a0b.js +1 -0
  64. package/ui/out/_next/static/chunks/app/accounts/page-fe5a9daa4d22e115.js +1 -0
  65. package/ui/out/_next/static/chunks/app/contracts/page-091eba53f5dcb62b.js +1 -0
  66. package/ui/out/_next/static/chunks/app/contracts/page-265c4f26532b42ce.js +1 -0
  67. package/ui/out/_next/static/chunks/app/contracts/page-26c527bf8b829de6.js +1 -0
  68. package/ui/out/_next/static/chunks/app/contracts/page-53e2d2d715f76290.js +1 -0
  69. package/ui/out/_next/static/chunks/app/contracts/page-56d74025e6315a3d.js +1 -0
  70. package/ui/out/_next/static/chunks/app/contracts/page-844c9f55a6ec9218.js +1 -0
  71. package/ui/out/_next/static/chunks/app/contracts/page-88416cc33eabdddb.js +1 -0
  72. package/ui/out/_next/static/chunks/app/contracts/page-9361399f80e19ab7.js +1 -0
  73. package/ui/out/_next/static/chunks/app/contracts/page-afebd14c1ae73ec9.js +1 -0
  74. package/ui/out/_next/static/chunks/app/contracts/page-b0f74db982762c7e.js +1 -0
  75. package/ui/out/_next/static/chunks/app/contracts/page-d88227b11f5ac4f6.js +1 -0
  76. package/ui/out/_next/static/chunks/app/contracts/page-e454dad9b03f36df.js +1 -0
  77. package/ui/out/_next/static/chunks/app/contracts/page-f269686063be5d4b.js +1 -0
  78. package/ui/out/_next/static/chunks/app/layout-0bf0ed51d0d1d3e8.js +1 -0
  79. package/ui/out/_next/static/chunks/app/layout-56f011c6a6b2930f.js +1 -0
  80. package/ui/out/_next/static/chunks/app/layout-7422dc714ea7b763.js +1 -0
  81. package/ui/out/_next/static/chunks/app/layout-88938a963d68eb45.js +1 -0
  82. package/ui/out/_next/static/chunks/app/layout-a1d424de4fc1d283.js +1 -0
  83. package/ui/out/_next/static/chunks/app/layout-add77f8e78dbfbf5.js +1 -0
  84. package/ui/out/_next/static/chunks/app/layout-c087511efc77c1ef.js +1 -0
  85. package/ui/out/_next/static/chunks/app/layout-eaaaddaebabc1e84.js +1 -0
  86. package/ui/out/_next/static/chunks/app/layout-ecbbc3f527378bf4.js +1 -0
  87. package/ui/out/_next/static/chunks/app/layout-f8c5fec65e6ca0ff.js +1 -0
  88. package/ui/out/_next/static/chunks/app/mining/page-14579efdb2e8f6c3.js +1 -0
  89. package/ui/out/_next/static/chunks/app/mining/page-1e273a4949e2b650.js +1 -0
  90. package/ui/out/_next/static/chunks/app/mining/page-2d151bdd475474f6.js +1 -0
  91. package/ui/out/_next/static/chunks/app/mining/page-43cfe0d01f696e96.js +1 -0
  92. package/ui/out/_next/static/chunks/app/mining/page-4ab3daab428e05f1.js +1 -0
  93. package/ui/out/_next/static/chunks/app/mining/page-64c88d55a5788e20.js +1 -0
  94. package/ui/out/_next/static/chunks/app/mining/page-79e2f952fc54ff89.js +1 -0
  95. package/ui/out/_next/static/chunks/app/mining/page-8305d73847b829c9.js +1 -0
  96. package/ui/out/_next/static/chunks/app/mining/page-ab0458f12921230c.js +1 -0
  97. package/ui/out/_next/static/chunks/app/mining/page-ac2a555e62327efe.js +1 -0
  98. package/ui/out/_next/static/chunks/app/mining/page-bb3068075a8088dd.js +1 -0
  99. package/ui/out/_next/static/chunks/app/mining/page-d4bad0ff79dd463a.js +1 -0
  100. package/ui/out/_next/static/chunks/app/network/page-3d5fbcf1eb37e0c5.js +1 -0
  101. package/ui/out/_next/static/chunks/app/network/page-4b692d29a3e609a8.js +1 -0
  102. package/ui/out/_next/static/chunks/app/network/page-5e33fbeb3a40de20.js +1 -0
  103. package/ui/out/_next/static/chunks/app/network/page-62a4488ea3bc2526.js +1 -0
  104. package/ui/out/_next/static/chunks/app/network/page-97cebccc451eb5c6.js +1 -0
  105. package/ui/out/_next/static/chunks/app/network/page-a50ebf9988b322b5.js +1 -0
  106. package/ui/out/_next/static/chunks/app/network/page-d7c0ceaa242f38f9.js +1 -0
  107. package/ui/out/_next/static/chunks/app/network/page-e152fafa7a4d7361.js +1 -0
  108. package/ui/out/_next/static/chunks/app/network/page-eea297c1ae180bda.js +1 -0
  109. package/ui/out/_next/static/chunks/app/network/page-f3c51db982b5a388.js +1 -0
  110. package/ui/out/_next/static/chunks/app/network/page-f51d9ab619db1c20.js +1 -0
  111. package/ui/out/_next/static/chunks/app/network/page-f6b4c10c7d87957f.js +1 -0
  112. package/ui/out/_next/static/chunks/app/page-165b6a1747a64947.js +1 -0
  113. package/ui/out/_next/static/chunks/app/page-348c96e8d45c2559.js +1 -0
  114. package/ui/out/_next/static/chunks/app/page-3632f4f09f69c905.js +1 -0
  115. package/ui/out/_next/static/chunks/app/page-36afbe5e1cb8094f.js +1 -0
  116. package/ui/out/_next/static/chunks/app/page-557bd6270c5ad579.js +1 -0
  117. package/ui/out/_next/static/chunks/app/page-6d79f31ac0288bac.js +1 -0
  118. package/ui/out/_next/static/chunks/app/page-71fcaf2853c53e30.js +1 -0
  119. package/ui/out/_next/static/chunks/app/page-90d8520902c1a7b0.js +1 -0
  120. package/ui/out/_next/static/chunks/app/page-c430d30cb894c926.js +1 -0
  121. package/ui/out/_next/static/chunks/app/page-ce0f985468520dbc.js +1 -0
  122. package/ui/out/_next/static/chunks/app/page-f0dced734181e611.js +1 -0
  123. package/ui/out/_next/static/chunks/app/page-f27633bfbc515249.js +1 -0
  124. package/ui/out/_next/static/chunks/app/page-f7be59ea4e13f436.js +1 -0
  125. package/ui/out/_next/static/chunks/app/wallet/page-11fb46a5f4a8b0be.js +1 -0
  126. package/ui/out/_next/static/chunks/app/wallet/page-26003843604c7c8c.js +1 -0
  127. package/ui/out/_next/static/chunks/app/wallet/page-7041ba96cf94b9d6.js +1 -0
  128. package/ui/out/_next/static/chunks/app/wallet/page-716e9207662cbb13.js +1 -0
  129. package/ui/out/_next/static/chunks/app/wallet/page-74cdd3297d391701.js +1 -0
  130. package/ui/out/_next/static/chunks/app/wallet/page-766c3286d7fc1fbb.js +1 -0
  131. package/ui/out/_next/static/chunks/app/wallet/page-a3e3f3f091deed13.js +1 -0
  132. package/ui/out/_next/static/chunks/app/wallet/page-fb7030a6672345f4.js +1 -0
  133. package/ui/out/_next/static/chunks/app/wallet/page-feeafe9afcd3702d.js +1 -0
  134. package/ui/out/_next/static/chunks/framework-bef83a85c94ff7de.js +1 -0
  135. package/ui/out/_next/static/chunks/main-764c1d152dd64cdb.js +1 -0
  136. package/ui/out/_next/static/chunks/main-app-565ce517a559065d.js +1 -0
  137. package/ui/out/_next/static/chunks/pages/_app-32ee63fa91347547.js +1 -0
  138. package/ui/out/_next/static/chunks/pages/_error-79ee453ce9bad74d.js +1 -0
  139. package/ui/out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  140. package/ui/out/_next/static/chunks/webpack-ea02740f160b546a.js +1 -0
  141. package/ui/out/_next/static/css/0f4a493f8c2c55db.css +3 -0
  142. package/ui/out/_next/static/css/4169c0d861da624d.css +3 -0
  143. package/ui/out/_next/static/css/42c642225833b63d.css +3 -0
  144. package/ui/out/_next/static/css/4ec6b37afd49be73.css +3 -0
  145. package/ui/out/_next/static/css/6a8f3e28ef1137c2.css +3 -0
  146. package/ui/out/_next/static/css/6bbaea3800a74df9.css +3 -0
  147. package/ui/out/_next/static/css/73f87001fc8b2a52.css +3 -0
  148. package/ui/out/_next/static/css/90ccf9db21744740.css +3 -0
  149. package/ui/out/_next/static/css/9f0d4e440a0f0806.css +3 -0
  150. package/ui/out/_next/static/css/b1a2c26b7bd10f8d.css +3 -0
  151. package/ui/out/_next/static/css/c97b9630f605a98b.css +3 -0
  152. package/ui/out/_next/static/css/e5751e31c7620a6e.css +3 -0
  153. package/ui/out/_next/static/ezlluEQnUi2an273EFR3C/_buildManifest.js +1 -0
  154. package/ui/out/_next/static/ezlluEQnUi2an273EFR3C/_ssgManifest.js +1 -0
  155. package/ui/out/_next/static/ghzWYfWuW8Y8XavA7qfLx/_buildManifest.js +1 -0
  156. package/ui/out/_next/static/ghzWYfWuW8Y8XavA7qfLx/_ssgManifest.js +1 -0
  157. package/ui/out/_next/static/hzvSbCbk7BhWq0LE5xqx1/_buildManifest.js +1 -0
  158. package/ui/out/_next/static/hzvSbCbk7BhWq0LE5xqx1/_ssgManifest.js +1 -0
  159. package/ui/out/_next/static/p4x_NRy3wdFgXa-RI9_BQ/_buildManifest.js +1 -0
  160. package/ui/out/_next/static/p4x_NRy3wdFgXa-RI9_BQ/_ssgManifest.js +1 -0
  161. package/ui/out/_next/static/uKnkegMpJr2nHM4qD8J3D/_buildManifest.js +1 -0
  162. package/ui/out/_next/static/uKnkegMpJr2nHM4qD8J3D/_ssgManifest.js +1 -0
  163. package/ui/out/_next/static/vAN91b7edxmzrsDueacJ6/_buildManifest.js +1 -0
  164. package/ui/out/_next/static/vAN91b7edxmzrsDueacJ6/_ssgManifest.js +1 -0
  165. package/ui/out/accounts/index.html +1 -0
  166. package/ui/out/accounts/index.txt +9 -0
  167. package/ui/out/contracts/index.html +1 -0
  168. package/ui/out/contracts/index.txt +9 -0
  169. package/ui/out/index.html +1 -0
  170. package/ui/out/index.txt +9 -0
  171. package/ui/out/mining/index.html +1 -0
  172. package/ui/out/mining/index.txt +9 -0
  173. package/ui/out/network/index.html +1 -0
  174. package/ui/out/network/index.txt +9 -0
  175. package/ui/out/wallet/index.html +1 -0
  176. package/ui/out/wallet/index.txt +9 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,8172))},8172:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var n=s(5853),a=s(4852),l=s(6632),i=s(8990),r=s(4254),c=s(9928),d=s(3264),o=s(5175),u=s(9924);let x=(0,s(3035).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var m=s(2846),h=s(758),p=s(5710),v=s(8701),y=s(3737),j=s(6444),N=s(7201),g=s(3948),f=s(6804),b=s(8144),w=s(3634);function k(e){let{text:t,small:s}=e,[a,l]=(0,r.useState)(!1);return(0,n.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),1600)},children:a?(0,n.jsx)(c.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,n.jsx)(d.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function C(e){let{onClose:t}=e,s=(0,a.NL)(),[i,c]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[u,x]=(0,r.useState)("evm"),[m,h]=(0,r.useState)(""),p=(0,l.D)({mutationFn:()=>b.SX.fund(i,d||void 0,u),onSuccess:e=>{h("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>h("✗ ".concat(e.message))});return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:(0,n.jsxs)("div",{className:"card w-full max-w-md space-y-4",children:[(0,n.jsx)("h2",{className:"font-medium text-white",children:"Fund Address"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Address"}),(0,n.jsx)("input",{className:"input",value:i,onChange:e=>c(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("label",{className:"label",children:"Amount (optional)"}),(0,n.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value),placeholder:"1000"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Chain"}),(0,n.jsxs)("select",{className:"input",value:u,onChange:e=>x(e.target.value),children:[(0,n.jsx)("option",{value:"evm",children:"EVM"}),(0,n.jsx)("option",{value:"core",children:"Core"})]})]})]}),m&&(0,n.jsx)("p",{className:"text-sm text-slate-300",children:m}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)("button",{type:"button",className:"btn-secondary",onClick:t,children:"Close"}),(0,n.jsx)("button",{type:"button",className:"btn-primary",disabled:!i||p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Sending…":"Fund"})]})]})})}function S(){var e,t,s,c,d,S,P,Z,I,q,E,M,R;let F=(0,a.NL)(),[W,K]=(0,r.useState)(null),[A,D]=(0,r.useState)(null),[T,Q]=(0,r.useState)(""),[V,_]=(0,r.useState)(!1),[L,U]=(0,r.useState)(!1),[z,X]=(0,r.useState)(!1),[B,O]=(0,r.useState)("1"),[H,G]=(0,r.useState)("1000"),[J,Y]=(0,r.useState)(""),[$,ee]=(0,r.useState)(!1),{data:et}=(0,i.a)({queryKey:["node","status"],queryFn:b.N9.status}),{data:es=[]}=(0,i.a)({queryKey:["keystore","wallets"],queryFn:b.SC.wallets,refetchInterval:5e3}),{data:en}=(0,i.a)({queryKey:["network","config"],queryFn:b.fA.config}),ea=(null===(e=null!=W?W:et)||void 0===e?void 0:e.server)==="running",{data:el=[],isLoading:ei}=(0,i.a)({queryKey:["accounts"],queryFn:b.SX.list,enabled:ea,refetchInterval:!!ea&&8e3}),{data:er}=(0,i.a)({queryKey:["accounts","faucet"],queryFn:b.SX.faucet,enabled:ea}),{data:ec}=(0,i.a)({queryKey:["mining","status"],queryFn:b.mI.status,enabled:ea,refetchInterval:!!ea&&3e3});(0,r.useEffect)(()=>{let e=(0,w.h)(),t=e=>{K(e),F.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[F]),(0,r.useEffect)(()=>{en&&!A&&D({coreRpcPort:String(en.coreRpcPort),evmRpcPort:String(en.evmRpcPort),wsPort:String(en.wsPort),evmWsPort:String(en.evmWsPort),chainId:String(en.chainId),evmChainId:String(en.evmChainId)})},[en,A]),(0,r.useEffect)(()=>{(null==ec?void 0:ec.isRunning)&&void 0!==ec.interval&&G(String(ec.interval))},[null==ec?void 0:ec.isRunning,null==ec?void 0:ec.interval]);let ed=(0,l.D)({mutationFn:b.N9.start,onSuccess:()=>F.invalidateQueries({queryKey:["node"]})}),eo=(0,l.D)({mutationFn:b.N9.stop,onSuccess:()=>F.invalidateQueries({queryKey:["node"]})}),eu=(0,l.D)({mutationFn:b.N9.restart,onSuccess:()=>F.invalidateQueries({queryKey:["node"]})}),ex=(0,l.D)({mutationFn:b.N9.restartWipe,onSuccess:()=>{F.invalidateQueries({queryKey:["node"]}),F.invalidateQueries({queryKey:["accounts"]}),F.invalidateQueries({queryKey:["mining"]})}}),em=(0,l.D)({mutationFn:b.N9.wipe,onSuccess:()=>{F.invalidateQueries({queryKey:["node"]}),F.invalidateQueries({queryKey:["accounts"]}),F.invalidateQueries({queryKey:["contracts","deployed"]}),F.invalidateQueries({queryKey:["mining"]})}}),eh=(0,l.D)({mutationFn:b.SC.activateWallet,onSuccess:()=>F.invalidateQueries({queryKey:["keystore","wallets"]})}),ep=(0,l.D)({mutationFn:e=>b.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{Q("✓ Saved"),setTimeout(()=>Q(""),2500),F.invalidateQueries({queryKey:["network"]})},onError:e=>Q("✗ ".concat(e.message))}),ev=(0,l.D)({mutationFn:()=>b.mI.mine(Number(B)),onSuccess:e=>{Y("✓ Mined ".concat(e.mined," block(s)")),F.invalidateQueries({queryKey:["mining"]})},onError:e=>Y("✗ ".concat(e.message))}),ey=(0,l.D)({mutationFn:()=>b.mI.start(Number(H)),onSuccess:()=>F.invalidateQueries({queryKey:["mining"]})}),ej=(0,l.D)({mutationFn:b.mI.stop,onSuccess:()=>F.invalidateQueries({queryKey:["mining"]})}),eN=null!=W?W:et,eg=null!==(t=null==eN?void 0:eN.server)&&void 0!==t?t:"stopped",ef="starting"===eg||"stopping"===eg||ed.isPending||eo.isPending||eu.isPending||ex.isPending||em.isPending,eb=ea?"status-dot-green":ef?"status-dot-yellow":"status-dot-red",ew=ed.isPending?"Starting…":eo.isPending?"Stopping…":eu.isPending||ex.isPending?"Restarting…":em.isPending?"Wiping…":"starting"===eg?"Starting…":"stopping"===eg?"Stopping…":"running"===eg?"Running":"Stopped",ek=es.find(e=>e.isActive),eC=null==eN?void 0:eN.rpcUrls,eS=z?el:el.slice(0,5),eP=ev.isPending||ey.isPending||ej.isPending;async function eZ(){try{await ej.mutateAsync(),ey.mutate()}catch(e){}}return(0,n.jsxs)("div",{className:"space-y-6",children:[L&&(0,n.jsx)(C,{onClose:()=>U(!1)}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,n.jsxs)("div",{className:"card space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:eb}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-white",children:ew}),ea&&(null==eN?void 0:eN.epochNumber)!==void 0&&(0,n.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",eN.epochNumber]})]})]}),(0,n.jsx)("div",{className:"flex gap-2",children:ea?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",disabled:ef,onClick:()=>eu.mutate(),children:[(0,n.jsx)(x,{className:"h-4 w-4"})," Restart"]}),(0,n.jsxs)("button",{type:"button",className:"btn-warning",disabled:ef,title:"Wipe this wallet's data directory and restart from block 0",onClick:()=>{confirm("Wipe all chain data for this wallet and restart from block 0?")&&ex.mutate()},children:[(0,n.jsx)(u.Z,{className:"h-4 w-4"})," Wipe & Restart"]}),(0,n.jsxs)("button",{type:"button",className:"btn-danger",disabled:ef,onClick:()=>eo.mutate(),children:[(0,n.jsx)(m.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"btn-success",disabled:ef,onClick:()=>ed.mutate(),children:[(0,n.jsx)(o.Z,{className:"h-4 w-4"})," Start"]}),(0,n.jsxs)("button",{type:"button",className:"btn-warning",disabled:ef,title:"Delete all chain data for this wallet (cannot be undone)",onClick:()=>{confirm("Wipe all chain data for this wallet? This cannot be undone.")&&em.mutate()},children:[(0,n.jsx)(u.Z,{className:"h-4 w-4"})," Wipe Data"]})]})})]}),ea&&eC&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-3",children:[(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between text-xs font-medium uppercase tracking-wider text-slate-500 hover:text-slate-300 transition-colors",onClick:()=>ee(e=>!e),children:[(0,n.jsx)("span",{children:"RPC Endpoints"}),$?(0,n.jsx)(h.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(p.Z,{className:"h-3.5 w-3.5"})]}),$&&(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[[["Core RPC",eC.core],["EVM / ETH RPC",eC.evm],["Core WebSocket",null!==(s=eC.coreWs)&&void 0!==s?s:eC.ws],["EVM WebSocket",null!==(c=eC.evmWs)&&void 0!==c?c:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,n.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,n.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,n.jsx)(k,{text:s})]})]},t)}),A&&(0,n.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-slate-300",children:A.chainId}),(0,n.jsx)(k,{text:A.chainId,small:!0})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-slate-300",children:A.evmChainId}),(0,n.jsx)(k,{text:A.evmChainId,small:!0})]})]})]})]})]}),!ea&&es.length>0&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,n.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,n.jsx)(v.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===es.length?(0,n.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,n.jsx)("code",{className:"text-xs text-blue-300",children:null!==(d=null==ek?void 0:ek.label)&&void 0!==d?d:es[0].label}),(0,n.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,n.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(S=null==ek?void 0:ek.id)&&void 0!==S?S:"",onChange:e=>eh.mutate(e.target.value),disabled:eh.isPending,children:es.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!ea&&A&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,n.jsx)("div",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Network Configuration"}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,a]=e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:s}),(0,n.jsx)("input",{className:"input",type:"number",value:null!==(t=A[a])&&void 0!==t?t:"",onChange:e=>D(t=>t?{...t,[a]:e.target.value}:t)})]},a)})}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("button",{type:"button",className:"btn-primary",disabled:ep.isPending||ef,onClick:()=>A&&ep.mutate(A),children:[(0,n.jsx)(y.Z,{className:"h-4 w-4"}),ep.isPending?"Saving…":"Save Config"]}),T&&(0,n.jsx)("span",{className:"text-sm ".concat(T.startsWith("✓")?"text-green-400":"text-red-400"),children:T})]})]})]})]}),ea&&(0,n.jsxs)("div",{className:"card space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Mining"}),(0,n.jsxs)("span",{className:"text-xs text-slate-500",children:[null!==(P=null==ec?void 0:ec.blocksMined)&&void 0!==P?P:0," blocks mined"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs font-medium ".concat((null==ec?void 0:ec.isRunning)?"text-green-400":"text-slate-500"),children:(null==ec?void 0:ec.isRunning)?"Auto":"Manual"}),(0,n.jsx)("button",{type:"button",disabled:eP,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none ".concat((null==ec?void 0:ec.isRunning)?"bg-green-600":"bg-slate-600"),onClick:()=>(null==ec?void 0:ec.isRunning)?ej.mutate():ey.mutate(),title:(null==ec?void 0:ec.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,n.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat((null==ec?void 0:ec.isRunning)?"translate-x-[18px]":"translate-x-0.5")})})]})]}),(null==ec?void 0:ec.isRunning)?(0,n.jsxs)("div",{className:"flex items-end gap-3",children:[(0,n.jsxs)("div",{className:"w-36",children:[(0,n.jsx)("label",{className:"label",children:"Interval (ms)"}),(0,n.jsx)("input",{className:"input",type:"number",min:"100",value:H,onChange:e=>G(e.target.value)})]}),Number(H)!==(null!==(Z=ec.interval)&&void 0!==Z?Z:0)&&(0,n.jsx)("button",{type:"button",className:"btn-secondary",disabled:eP,onClick:eZ,children:"Update"})]}):(0,n.jsxs)("div",{className:"flex items-end gap-3",children:[(0,n.jsxs)("div",{className:"w-28",children:[(0,n.jsx)("label",{className:"label",children:"Blocks"}),(0,n.jsx)("input",{className:"input",type:"number",min:"1",max:"1000",value:B,onChange:e=>O(e.target.value)})]}),(0,n.jsxs)("button",{type:"button",className:"btn-primary",disabled:eP,onClick:()=>ev.mutate(),children:[(0,n.jsx)(j.Z,{className:"h-4 w-4"}),ev.isPending?"Mining…":"Mine"]})]}),J&&(0,n.jsx)("p",{className:"text-sm ".concat(J.startsWith("✓")?"text-green-400":"text-red-400"),children:J}),(ey.error||ej.error)&&(0,n.jsx)("p",{className:"text-sm text-red-400",children:String(null!==(I=ey.error)&&void 0!==I?I:ej.error)})]}),ea&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Accounts"}),er&&(0,n.jsx)("div",{className:"card",children:(0,n.jsxs)("div",{className:"flex items-start justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Faucet Account"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[260px] truncate text-xs text-blue-300",children:er.coreAddress}),(0,n.jsx)(k,{text:er.coreAddress,small:!0})]}),(0,n.jsxs)("div",{className:"mt-0.5 text-sm text-slate-300",children:[er.coreBalance," CFX"]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",title:"Toggle private key visibility",onClick:()=>_(e=>!e),children:[V?(0,n.jsx)(N.Z,{className:"h-4 w-4"}):(0,n.jsx)(g.Z,{className:"h-4 w-4"}),"Keys"]}),(0,n.jsxs)("button",{type:"button",className:"btn-primary",onClick:()=>U(!0),children:[(0,n.jsx)(f.Z,{className:"h-4 w-4"})," Fund"]})]})]})}),ei?(0,n.jsx)("p",{className:"text-sm text-slate-500",children:"Loading accounts…"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[#2a3147]",children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{className:"bg-[#161b27] text-xs uppercase tracking-wider text-slate-500",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"#"}),(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"Core Address"}),(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"EVM Address"}),(0,n.jsx)("th",{className:"px-3 py-2 text-right",children:"Core"}),(0,n.jsx)("th",{className:"px-3 py-2 text-right",children:"EVM"}),V&&(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"Private Key"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-[#2a3147]",children:eS.map(e=>(0,n.jsxs)("tr",{className:"bg-[#0e1117] hover:bg-[#161b27]",children:[(0,n.jsx)("td",{className:"px-3 py-2 text-slate-500",children:e.index}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[180px] truncate text-xs text-blue-300",children:e.coreAddress}),(0,n.jsx)(k,{text:e.coreAddress,small:!0})]})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[140px] truncate text-xs text-blue-300",children:e.evmAddress}),(0,n.jsx)(k,{text:e.evmAddress,small:!0})]})}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.coreBalance||"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.evmBalance||"—"}),V&&(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[120px] truncate text-xs text-slate-400",children:e.privateKey}),(0,n.jsx)(k,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),el.length>5&&(0,n.jsx)("button",{type:"button",className:"btn-secondary w-full text-center text-xs",onClick:()=>X(e=>!e),children:z?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.Z,{className:"mr-1 inline h-3.5 w-3.5"}),"Show less"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.Z,{className:"mr-1 inline h-3.5 w-3.5"}),"Show all ",el.length," accounts"]})})]})]}),(ed.error||eo.error||eu.error||ex.error||em.error)&&(0,n.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(R=null!==(M=null!==(E=null!==(q=ed.error)&&void 0!==q?q:eo.error)&&void 0!==E?E:eu.error)&&void 0!==M?M:ex.error)&&void 0!==R?R:em.error)})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return v},SX:function(){return x},Vp:function(){return m},fA:function(){return p},mI:function(){return h}});var n,a=s(2608);let l="".concat(null!==(n=a.env.NEXT_PUBLIC_API_URL)&&void 0!==n?n:"","/api");async function i(e,t,s){let n=await fetch("".concat(l).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!n.ok){var a;throw Error(null!==(a=(await n.json().catch(()=>({error:n.statusText}))).error)&&void 0!==a?a:n.statusText)}return n.json()}let r=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=e=>i("DELETE",e),o=(e,t)=>i("PUT",e,t),u={status:()=>r("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe"),wipe:()=>c("/node/wipe")},x={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},m={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>r("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>d("/contracts/deployed/".concat(e)),call:(e,t,s,n)=>c("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:n})},h={status:()=>r("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},p={config:()=>r("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},v={status:()=>r("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var n=s(7903),a=s(2608);let l=null;function i(){if(!l){var e;let t=null!==(e=a.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";l=(0,n.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return l}},5710:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},758:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},9924:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,826,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,506))},506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return P}});var a=s(5853),n=s(4852),l=s(6632),i=s(8990),r=s(4254),c=s(9928),d=s(3264),o=s(5175),u=s(3035);let x=(0,u.Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var m=s(9924),h=s(2846),p=s(8701),v=s(3737),y=s(6444),j=s(7201),N=s(3948),g=s(6804);let f=(0,u.Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),b=(0,u.Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var w=s(8144),k=s(3634);function C(e){let{text:t,small:s}=e,[n,l]=(0,r.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),1600)},children:n?(0,a.jsx)(c.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,a.jsx)(d.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function S(e){let{onClose:t}=e,s=(0,n.NL)(),[i,c]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[u,x]=(0,r.useState)("evm"),[m,h]=(0,r.useState)(""),p=(0,l.D)({mutationFn:()=>w.SX.fund(i,d||void 0,u),onSuccess:e=>{h("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>h("✗ ".concat(e.message))});return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:(0,a.jsxs)("div",{className:"card w-full max-w-md space-y-4",children:[(0,a.jsx)("h2",{className:"font-medium text-white",children:"Fund Address"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Address"}),(0,a.jsx)("input",{className:"input",value:i,onChange:e=>c(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"label",children:"Amount (optional)"}),(0,a.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value),placeholder:"1000"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:u,onChange:e=>x(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM"}),(0,a.jsx)("option",{value:"core",children:"Core"})]})]})]}),m&&(0,a.jsx)("p",{className:"text-sm text-slate-300",children:m}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-secondary",onClick:t,children:"Close"}),(0,a.jsx)("button",{type:"button",className:"btn-primary",disabled:!i||p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Sending…":"Fund"})]})]})})}function P(){var e,t,s,c,d,u,P,I,E,M,R,Z;let q=(0,n.NL)(),[F,A]=(0,r.useState)(null),[W,K]=(0,r.useState)(null),[D,T]=(0,r.useState)(""),[V,Q]=(0,r.useState)(!1),[_,L]=(0,r.useState)(!1),[U,z]=(0,r.useState)(!1),[X,B]=(0,r.useState)("1"),[O,H]=(0,r.useState)("1000"),[G,J]=(0,r.useState)(""),{data:Y}=(0,i.a)({queryKey:["node","status"],queryFn:w.N9.status}),{data:$=[]}=(0,i.a)({queryKey:["keystore","wallets"],queryFn:w.SC.wallets,refetchInterval:5e3}),{data:ee}=(0,i.a)({queryKey:["network","config"],queryFn:w.fA.config}),et=(null===(e=null!=F?F:Y)||void 0===e?void 0:e.server)==="running",{data:es=[],isLoading:ea}=(0,i.a)({queryKey:["accounts"],queryFn:w.SX.list,enabled:et,refetchInterval:!!et&&8e3}),{data:en}=(0,i.a)({queryKey:["accounts","faucet"],queryFn:w.SX.faucet,enabled:et}),{data:el}=(0,i.a)({queryKey:["mining","status"],queryFn:w.mI.status,enabled:et,refetchInterval:!!et&&3e3});(0,r.useEffect)(()=>{let e=(0,k.h)(),t=e=>{A(e),q.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[q]),(0,r.useEffect)(()=>{ee&&!W&&K({coreRpcPort:String(ee.coreRpcPort),evmRpcPort:String(ee.evmRpcPort),wsPort:String(ee.wsPort),evmWsPort:String(ee.evmWsPort),chainId:String(ee.chainId),evmChainId:String(ee.evmChainId)})},[ee,W]),(0,r.useEffect)(()=>{(null==el?void 0:el.isRunning)&&void 0!==el.interval&&H(String(el.interval))},[null==el?void 0:el.isRunning,null==el?void 0:el.interval]);let ei=(0,l.D)({mutationFn:w.N9.start,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),er=(0,l.D)({mutationFn:w.N9.stop,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),ec=(0,l.D)({mutationFn:w.N9.restart,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),ed=(0,l.D)({mutationFn:w.N9.restartWipe,onSuccess:()=>{q.invalidateQueries({queryKey:["node"]}),q.invalidateQueries({queryKey:["accounts"]}),q.invalidateQueries({queryKey:["mining"]})}}),eo=(0,l.D)({mutationFn:w.SC.activateWallet,onSuccess:()=>q.invalidateQueries({queryKey:["keystore","wallets"]})}),eu=(0,l.D)({mutationFn:e=>w.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{T("✓ Saved"),setTimeout(()=>T(""),2500),q.invalidateQueries({queryKey:["network"]})},onError:e=>T("✗ ".concat(e.message))}),ex=(0,l.D)({mutationFn:()=>w.mI.mine(Number(X)),onSuccess:e=>{J("✓ Mined ".concat(e.mined," block(s)")),q.invalidateQueries({queryKey:["mining"]})},onError:e=>J("✗ ".concat(e.message))}),em=(0,l.D)({mutationFn:()=>w.mI.start(Number(O)),onSuccess:()=>q.invalidateQueries({queryKey:["mining"]})}),eh=(0,l.D)({mutationFn:w.mI.stop,onSuccess:()=>q.invalidateQueries({queryKey:["mining"]})}),ep=null!=F?F:Y,ev=null!==(t=null==ep?void 0:ep.server)&&void 0!==t?t:"stopped",ey="starting"===ev||"stopping"===ev||ei.isPending||er.isPending||ec.isPending||ed.isPending,ej=et?"status-dot-green":ey?"status-dot-yellow":"status-dot-red",eN=ei.isPending?"Starting…":er.isPending?"Stopping…":ec.isPending||ed.isPending?"Restarting…":"starting"===ev?"Starting…":"stopping"===ev?"Stopping…":"running"===ev?"Running":"Stopped",eg=$.find(e=>e.isActive),ef=null==ep?void 0:ep.rpcUrls,eb=U?es:es.slice(0,5),ew=ex.isPending||em.isPending||eh.isPending;async function ek(){try{await eh.mutateAsync(),em.mutate()}catch(e){}}return(0,a.jsxs)("div",{className:"space-y-6",children:[_&&(0,a.jsx)(S,{onClose:()=>L(!1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,a.jsxs)("div",{className:"card space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:ej}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-medium text-white",children:eN}),et&&(null==ep?void 0:ep.epochNumber)!==void 0&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",ep.epochNumber]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:et?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:ey,onClick:()=>ec.mutate(),children:[(0,a.jsx)(x,{className:"h-4 w-4"})," Restart"]}),(0,a.jsxs)("button",{type:"button",className:"btn-warning",disabled:ey,title:"Wipe this wallet's data directory and restart from block 0",onClick:()=>{confirm("Wipe all chain data for this wallet and restart from block 0?")&&ed.mutate()},children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"})," Wipe & Restart"]}),(0,a.jsxs)("button",{type:"button",className:"btn-danger",disabled:ey,onClick:()=>er.mutate(),children:[(0,a.jsx)(h.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,a.jsxs)("button",{type:"button",className:"btn-success",disabled:ey,onClick:()=>ei.mutate(),children:[(0,a.jsx)(o.Z,{className:"h-4 w-4"})," Start"]})})]}),!et&&$.length>0&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,a.jsx)(p.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===$.length?(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-xs text-blue-300",children:null!==(s=null==eg?void 0:eg.label)&&void 0!==s?s:$[0].label}),(0,a.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,a.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(c=null==eg?void 0:eg.id)&&void 0!==c?c:"",onChange:e=>eo.mutate(e.target.value),disabled:eo.isPending,children:$.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!et&&W&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsx)("div",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Network Configuration"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,n]=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:s}),(0,a.jsx)("input",{className:"input",type:"number",value:null!==(t=W[n])&&void 0!==t?t:"",onChange:e=>K(t=>t?{...t,[n]:e.target.value}:t)})]},n)})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:eu.isPending||ey,onClick:()=>W&&eu.mutate(W),children:[(0,a.jsx)(v.Z,{className:"h-4 w-4"}),eu.isPending?"Saving…":"Save Config"]}),D&&(0,a.jsx)("span",{className:"text-sm ".concat(D.startsWith("✓")?"text-green-400":"text-red-400"),children:D})]})]})]})]}),et&&(0,a.jsxs)("div",{className:"card space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Mining"}),(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:[null!==(d=null==el?void 0:el.blocksMined)&&void 0!==d?d:0," blocks mined"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium ".concat((null==el?void 0:el.isRunning)?"text-green-400":"text-slate-500"),children:(null==el?void 0:el.isRunning)?"Auto":"Manual"}),(0,a.jsx)("button",{type:"button",disabled:ew,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none ".concat((null==el?void 0:el.isRunning)?"bg-green-600":"bg-slate-600"),onClick:()=>(null==el?void 0:el.isRunning)?eh.mutate():em.mutate(),title:(null==el?void 0:el.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,a.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat((null==el?void 0:el.isRunning)?"translate-x-[18px]":"translate-x-0.5")})})]})]}),(null==el?void 0:el.isRunning)?(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-36",children:[(0,a.jsx)("label",{className:"label",children:"Interval (ms)"}),(0,a.jsx)("input",{className:"input",type:"number",min:"100",value:O,onChange:e=>H(e.target.value)})]}),Number(O)!==(null!==(u=el.interval)&&void 0!==u?u:0)&&(0,a.jsx)("button",{type:"button",className:"btn-secondary",disabled:ew,onClick:ek,children:"Update"})]}):(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-28",children:[(0,a.jsx)("label",{className:"label",children:"Blocks"}),(0,a.jsx)("input",{className:"input",type:"number",min:"1",max:"1000",value:X,onChange:e=>B(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:ew,onClick:()=>ex.mutate(),children:[(0,a.jsx)(y.Z,{className:"h-4 w-4"}),ex.isPending?"Mining…":"Mine"]})]}),G&&(0,a.jsx)("p",{className:"text-sm ".concat(G.startsWith("✓")?"text-green-400":"text-red-400"),children:G}),(em.error||eh.error)&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:String(null!==(P=em.error)&&void 0!==P?P:eh.error)})]}),et&&ef&&(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"RPC Endpoints"}),[["Core RPC",ef.core],["EVM / ETH RPC",ef.evm],["Core WebSocket",null!==(I=ef.coreWs)&&void 0!==I?I:ef.ws],["EVM WebSocket",null!==(E=ef.evmWs)&&void 0!==E?E:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,a.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,a.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,a.jsx)(C,{text:s})]})]},t)}),W&&(0,a.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:W.chainId}),(0,a.jsx)(C,{text:W.chainId,small:!0})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:W.evmChainId}),(0,a.jsx)(C,{text:W.evmChainId,small:!0})]})]})]})]}),et&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Accounts"}),en&&(0,a.jsx)("div",{className:"card",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Faucet Account"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[260px] truncate text-xs text-blue-300",children:en.coreAddress}),(0,a.jsx)(C,{text:en.coreAddress,small:!0})]}),(0,a.jsxs)("div",{className:"mt-0.5 text-sm text-slate-300",children:[en.coreBalance," CFX"]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,a.jsxs)("button",{type:"button",className:"btn-secondary",title:"Toggle private key visibility",onClick:()=>Q(e=>!e),children:[V?(0,a.jsx)(j.Z,{className:"h-4 w-4"}):(0,a.jsx)(N.Z,{className:"h-4 w-4"}),"Keys"]}),(0,a.jsxs)("button",{type:"button",className:"btn-primary",onClick:()=>L(!0),children:[(0,a.jsx)(g.Z,{className:"h-4 w-4"})," Fund"]})]})]})}),ea?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading accounts…"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[#2a3147]",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-[#161b27] text-xs uppercase tracking-wider text-slate-500",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"#"}),(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Core Address"}),(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"EVM Address"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Core"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"EVM"}),V&&(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Private Key"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-[#2a3147]",children:eb.map(e=>(0,a.jsxs)("tr",{className:"bg-[#0e1117] hover:bg-[#161b27]",children:[(0,a.jsx)("td",{className:"px-3 py-2 text-slate-500",children:e.index}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[180px] truncate text-xs text-blue-300",children:e.coreAddress}),(0,a.jsx)(C,{text:e.coreAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[140px] truncate text-xs text-blue-300",children:e.evmAddress}),(0,a.jsx)(C,{text:e.evmAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.coreBalance||"—"}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.evmBalance||"—"}),V&&(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[120px] truncate text-xs text-slate-400",children:e.privateKey}),(0,a.jsx)(C,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),es.length>5&&(0,a.jsx)("button",{type:"button",className:"btn-secondary w-full text-center text-xs",onClick:()=>z(e=>!e),children:U?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{className:"mr-1 inline h-3.5 w-3.5"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{className:"mr-1 inline h-3.5 w-3.5"}),"Show all ",es.length," accounts"]})})]})]}),(ei.error||er.error||ec.error||ed.error)&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(Z=null!==(R=null!==(M=ei.error)&&void 0!==M?M:er.error)&&void 0!==R?R:ec.error)&&void 0!==Z?Z:ed.error)})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return v},SX:function(){return x},Vp:function(){return m},fA:function(){return p},mI:function(){return h}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function i(e,t,s){let a=await fetch("".concat(l).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!a.ok){var n;throw Error(null!==(n=(await a.json().catch(()=>({error:a.statusText}))).error)&&void 0!==n?n:a.statusText)}return a.json()}let r=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=(e,t)=>i("PUT",e,t),o=e=>i("DELETE",e),u={status:()=>r("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe")},x={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},m={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e)},h={status:()=>r("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},p={config:()=>r("/network/config"),updateConfig:e=>d("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},v={status:()=>r("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>o("/keystore/wallets/".concat(e))}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var a=s(7903),n=s(2608);let l=null;function i(){if(!l){var e;let t=null!==(e=n.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";l=(0,a.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return l}},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},9924:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,826,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,506))},506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return P}});var a=s(5853),n=s(4852),l=s(6632),i=s(8990),r=s(4254),c=s(9928),d=s(3264),o=s(5175),u=s(3035);let x=(0,u.Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var m=s(9924),h=s(2846),p=s(8701),v=s(3737),y=s(6444),j=s(7201),N=s(3948),g=s(6804);let f=(0,u.Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),b=(0,u.Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var w=s(8144),k=s(3634);function C(e){let{text:t,small:s}=e,[n,l]=(0,r.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),1600)},children:n?(0,a.jsx)(c.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,a.jsx)(d.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function S(e){let{onClose:t}=e,s=(0,n.NL)(),[i,c]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[u,x]=(0,r.useState)("evm"),[m,h]=(0,r.useState)(""),p=(0,l.D)({mutationFn:()=>w.SX.fund(i,d||void 0,u),onSuccess:e=>{h("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>h("✗ ".concat(e.message))});return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:(0,a.jsxs)("div",{className:"card w-full max-w-md space-y-4",children:[(0,a.jsx)("h2",{className:"font-medium text-white",children:"Fund Address"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Address"}),(0,a.jsx)("input",{className:"input",value:i,onChange:e=>c(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"label",children:"Amount (optional)"}),(0,a.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value),placeholder:"1000"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:u,onChange:e=>x(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM"}),(0,a.jsx)("option",{value:"core",children:"Core"})]})]})]}),m&&(0,a.jsx)("p",{className:"text-sm text-slate-300",children:m}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-secondary",onClick:t,children:"Close"}),(0,a.jsx)("button",{type:"button",className:"btn-primary",disabled:!i||p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Sending…":"Fund"})]})]})})}function P(){var e,t,s,c,d,u,P,I,E,M,R,Z;let q=(0,n.NL)(),[F,A]=(0,r.useState)(null),[W,D]=(0,r.useState)(null),[K,T]=(0,r.useState)(""),[V,Q]=(0,r.useState)(!1),[_,L]=(0,r.useState)(!1),[U,z]=(0,r.useState)(!1),[X,B]=(0,r.useState)("1"),[O,H]=(0,r.useState)("1000"),[G,J]=(0,r.useState)(""),{data:Y}=(0,i.a)({queryKey:["node","status"],queryFn:w.N9.status}),{data:$=[]}=(0,i.a)({queryKey:["keystore","wallets"],queryFn:w.SC.wallets,refetchInterval:5e3}),{data:ee}=(0,i.a)({queryKey:["network","config"],queryFn:w.fA.config}),et=(null===(e=null!=F?F:Y)||void 0===e?void 0:e.server)==="running",{data:es=[],isLoading:ea}=(0,i.a)({queryKey:["accounts"],queryFn:w.SX.list,enabled:et,refetchInterval:!!et&&8e3}),{data:en}=(0,i.a)({queryKey:["accounts","faucet"],queryFn:w.SX.faucet,enabled:et}),{data:el}=(0,i.a)({queryKey:["mining","status"],queryFn:w.mI.status,enabled:et,refetchInterval:!!et&&3e3});(0,r.useEffect)(()=>{let e=(0,k.h)(),t=e=>{A(e),q.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[q]),(0,r.useEffect)(()=>{ee&&!W&&D({coreRpcPort:String(ee.coreRpcPort),evmRpcPort:String(ee.evmRpcPort),wsPort:String(ee.wsPort),evmWsPort:String(ee.evmWsPort),chainId:String(ee.chainId),evmChainId:String(ee.evmChainId)})},[ee,W]),(0,r.useEffect)(()=>{(null==el?void 0:el.isRunning)&&void 0!==el.interval&&H(String(el.interval))},[null==el?void 0:el.isRunning,null==el?void 0:el.interval]);let ei=(0,l.D)({mutationFn:w.N9.start,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),er=(0,l.D)({mutationFn:w.N9.stop,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),ec=(0,l.D)({mutationFn:w.N9.restart,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),ed=(0,l.D)({mutationFn:w.N9.restartWipe,onSuccess:()=>{q.invalidateQueries({queryKey:["node"]}),q.invalidateQueries({queryKey:["accounts"]}),q.invalidateQueries({queryKey:["mining"]})}}),eo=(0,l.D)({mutationFn:w.SC.activateWallet,onSuccess:()=>q.invalidateQueries({queryKey:["keystore","wallets"]})}),eu=(0,l.D)({mutationFn:e=>w.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{T("✓ Saved"),setTimeout(()=>T(""),2500),q.invalidateQueries({queryKey:["network"]})},onError:e=>T("✗ ".concat(e.message))}),ex=(0,l.D)({mutationFn:()=>w.mI.mine(Number(X)),onSuccess:e=>{J("✓ Mined ".concat(e.mined," block(s)")),q.invalidateQueries({queryKey:["mining"]})},onError:e=>J("✗ ".concat(e.message))}),em=(0,l.D)({mutationFn:()=>w.mI.start(Number(O)),onSuccess:()=>q.invalidateQueries({queryKey:["mining"]})}),eh=(0,l.D)({mutationFn:w.mI.stop,onSuccess:()=>q.invalidateQueries({queryKey:["mining"]})}),ep=null!=F?F:Y,ev=null!==(t=null==ep?void 0:ep.server)&&void 0!==t?t:"stopped",ey="starting"===ev||"stopping"===ev||ei.isPending||er.isPending||ec.isPending||ed.isPending,ej=et?"status-dot-green":ey?"status-dot-yellow":"status-dot-red",eN=ei.isPending?"Starting…":er.isPending?"Stopping…":ec.isPending||ed.isPending?"Restarting…":"starting"===ev?"Starting…":"stopping"===ev?"Stopping…":"running"===ev?"Running":"Stopped",eg=$.find(e=>e.isActive),ef=null==ep?void 0:ep.rpcUrls,eb=U?es:es.slice(0,5),ew=ex.isPending||em.isPending||eh.isPending;async function ek(){try{await eh.mutateAsync(),em.mutate()}catch(e){}}return(0,a.jsxs)("div",{className:"space-y-6",children:[_&&(0,a.jsx)(S,{onClose:()=>L(!1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,a.jsxs)("div",{className:"card space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:ej}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-medium text-white",children:eN}),et&&(null==ep?void 0:ep.epochNumber)!==void 0&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",ep.epochNumber]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:et?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:ey,onClick:()=>ec.mutate(),children:[(0,a.jsx)(x,{className:"h-4 w-4"})," Restart"]}),(0,a.jsxs)("button",{type:"button",className:"btn-warning",disabled:ey,title:"Wipe this wallet's data directory and restart from block 0",onClick:()=>{confirm("Wipe all chain data for this wallet and restart from block 0?")&&ed.mutate()},children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"})," Wipe & Restart"]}),(0,a.jsxs)("button",{type:"button",className:"btn-danger",disabled:ey,onClick:()=>er.mutate(),children:[(0,a.jsx)(h.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,a.jsxs)("button",{type:"button",className:"btn-success",disabled:ey,onClick:()=>ei.mutate(),children:[(0,a.jsx)(o.Z,{className:"h-4 w-4"})," Start"]})})]}),!et&&$.length>0&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,a.jsx)(p.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===$.length?(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-xs text-blue-300",children:null!==(s=null==eg?void 0:eg.label)&&void 0!==s?s:$[0].label}),(0,a.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,a.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(c=null==eg?void 0:eg.id)&&void 0!==c?c:"",onChange:e=>eo.mutate(e.target.value),disabled:eo.isPending,children:$.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!et&&W&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsx)("div",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Network Configuration"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,n]=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:s}),(0,a.jsx)("input",{className:"input",type:"number",value:null!==(t=W[n])&&void 0!==t?t:"",onChange:e=>D(t=>t?{...t,[n]:e.target.value}:t)})]},n)})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:eu.isPending||ey,onClick:()=>W&&eu.mutate(W),children:[(0,a.jsx)(v.Z,{className:"h-4 w-4"}),eu.isPending?"Saving…":"Save Config"]}),K&&(0,a.jsx)("span",{className:"text-sm ".concat(K.startsWith("✓")?"text-green-400":"text-red-400"),children:K})]})]})]})]}),et&&(0,a.jsxs)("div",{className:"card space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Mining"}),(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:[null!==(d=null==el?void 0:el.blocksMined)&&void 0!==d?d:0," blocks mined"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium ".concat((null==el?void 0:el.isRunning)?"text-green-400":"text-slate-500"),children:(null==el?void 0:el.isRunning)?"Auto":"Manual"}),(0,a.jsx)("button",{type:"button",disabled:ew,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none ".concat((null==el?void 0:el.isRunning)?"bg-green-600":"bg-slate-600"),onClick:()=>(null==el?void 0:el.isRunning)?eh.mutate():em.mutate(),title:(null==el?void 0:el.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,a.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat((null==el?void 0:el.isRunning)?"translate-x-[18px]":"translate-x-0.5")})})]})]}),(null==el?void 0:el.isRunning)?(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-36",children:[(0,a.jsx)("label",{className:"label",children:"Interval (ms)"}),(0,a.jsx)("input",{className:"input",type:"number",min:"100",value:O,onChange:e=>H(e.target.value)})]}),Number(O)!==(null!==(u=el.interval)&&void 0!==u?u:0)&&(0,a.jsx)("button",{type:"button",className:"btn-secondary",disabled:ew,onClick:ek,children:"Update"})]}):(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-28",children:[(0,a.jsx)("label",{className:"label",children:"Blocks"}),(0,a.jsx)("input",{className:"input",type:"number",min:"1",max:"1000",value:X,onChange:e=>B(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:ew,onClick:()=>ex.mutate(),children:[(0,a.jsx)(y.Z,{className:"h-4 w-4"}),ex.isPending?"Mining…":"Mine"]})]}),G&&(0,a.jsx)("p",{className:"text-sm ".concat(G.startsWith("✓")?"text-green-400":"text-red-400"),children:G}),(em.error||eh.error)&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:String(null!==(P=em.error)&&void 0!==P?P:eh.error)})]}),et&&ef&&(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"RPC Endpoints"}),[["Core RPC",ef.core],["EVM / ETH RPC",ef.evm],["Core WebSocket",null!==(I=ef.coreWs)&&void 0!==I?I:ef.ws],["EVM WebSocket",null!==(E=ef.evmWs)&&void 0!==E?E:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,a.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,a.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,a.jsx)(C,{text:s})]})]},t)}),W&&(0,a.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:W.chainId}),(0,a.jsx)(C,{text:W.chainId,small:!0})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:W.evmChainId}),(0,a.jsx)(C,{text:W.evmChainId,small:!0})]})]})]})]}),et&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Accounts"}),en&&(0,a.jsx)("div",{className:"card",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Faucet Account"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[260px] truncate text-xs text-blue-300",children:en.coreAddress}),(0,a.jsx)(C,{text:en.coreAddress,small:!0})]}),(0,a.jsxs)("div",{className:"mt-0.5 text-sm text-slate-300",children:[en.coreBalance," CFX"]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,a.jsxs)("button",{type:"button",className:"btn-secondary",title:"Toggle private key visibility",onClick:()=>Q(e=>!e),children:[V?(0,a.jsx)(j.Z,{className:"h-4 w-4"}):(0,a.jsx)(N.Z,{className:"h-4 w-4"}),"Keys"]}),(0,a.jsxs)("button",{type:"button",className:"btn-primary",onClick:()=>L(!0),children:[(0,a.jsx)(g.Z,{className:"h-4 w-4"})," Fund"]})]})]})}),ea?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading accounts…"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[#2a3147]",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-[#161b27] text-xs uppercase tracking-wider text-slate-500",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"#"}),(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Core Address"}),(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"EVM Address"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Core"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"EVM"}),V&&(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Private Key"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-[#2a3147]",children:eb.map(e=>(0,a.jsxs)("tr",{className:"bg-[#0e1117] hover:bg-[#161b27]",children:[(0,a.jsx)("td",{className:"px-3 py-2 text-slate-500",children:e.index}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[180px] truncate text-xs text-blue-300",children:e.coreAddress}),(0,a.jsx)(C,{text:e.coreAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[140px] truncate text-xs text-blue-300",children:e.evmAddress}),(0,a.jsx)(C,{text:e.evmAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.coreBalance||"—"}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.evmBalance||"—"}),V&&(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[120px] truncate text-xs text-slate-400",children:e.privateKey}),(0,a.jsx)(C,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),es.length>5&&(0,a.jsx)("button",{type:"button",className:"btn-secondary w-full text-center text-xs",onClick:()=>z(e=>!e),children:U?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{className:"mr-1 inline h-3.5 w-3.5"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{className:"mr-1 inline h-3.5 w-3.5"}),"Show all ",es.length," accounts"]})})]})]}),(ei.error||er.error||ec.error||ed.error)&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(Z=null!==(R=null!==(M=ei.error)&&void 0!==M?M:er.error)&&void 0!==R?R:ec.error)&&void 0!==Z?Z:ed.error)})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return v},SX:function(){return x},Vp:function(){return m},fA:function(){return p},mI:function(){return h}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function i(e,t,s){let a=await fetch("".concat(l).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!a.ok){var n;throw Error(null!==(n=(await a.json().catch(()=>({error:a.statusText}))).error)&&void 0!==n?n:a.statusText)}return a.json()}let r=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=e=>i("DELETE",e),o=(e,t)=>i("PUT",e,t),u={status:()=>r("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe")},x={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},m={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>r("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>d("/contracts/deployed/".concat(e))},h={status:()=>r("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},p={config:()=>r("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},v={status:()=>r("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var a=s(7903),n=s(2608);let l=null;function i(){if(!l){var e;let t=null!==(e=n.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";l=(0,a.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return l}},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},9924:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,826,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,8375))},8375:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return I}});var a=s(5853),n=s(8990),l=s(4852),i=s(6632),r=s(4254),c=s(9928),d=s(3264),o=s(3035);let u=(0,o.Z)("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),x=(0,o.Z)("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var m=s(758),h=s(5710),p=s(5175),y=s(9924);let v=(0,o.Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var j=s(2846),b=s(8701),g=s(3737),N=s(6444),f=s(7201),w=s(3948),k=s(6804),S=s(8144),C=s(3634);function P(e){let{text:t,small:s}=e,[n,l]=(0,r.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),1600)},children:n?(0,a.jsx)(c.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,a.jsx)(d.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function Z(){let{data:e}=(0,n.a)({queryKey:["settings"],queryFn:S.pJ.get,staleTime:3e4}),[t,s]=(0,r.useState)(!1);if(!e)return null;let l=!e.isPublic||e.authEnabled;return(0,a.jsxs)("div",{className:"card border ".concat(l?"border-[#2a3147]":"border-yellow-800"),children:[(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between",onClick:()=>s(e=>!e),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e.isPublic&&!e.authEnabled?(0,a.jsx)(u,{className:"h-4 w-4 text-yellow-400"}):(0,a.jsx)(x,{className:"h-4 w-4 text-green-400"}),(0,a.jsx)("span",{className:"text-sm font-medium text-slate-300",children:"Security"}),e.isPublic&&!e.authEnabled&&(0,a.jsx)("span",{className:"rounded bg-yellow-900/50 px-1.5 py-0.5 text-[10px] text-yellow-400",children:"exposed without auth"})]}),t?(0,a.jsx)(m.Z,{className:"h-4 w-4 text-slate-500"}):(0,a.jsx)(h.Z,{className:"h-4 w-4 text-slate-500"})]}),t&&(0,a.jsxs)("div",{className:"mt-3 space-y-3 border-t border-[#2a3147] pt-3 text-xs",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["Bind address","".concat(e.host,":").concat(e.port)],["Public",e.isPublic?"Yes":"No (localhost)"],["API auth",e.authEnabled?"✓ Enabled":"✗ Disabled"],["Rate limit","".concat(e.rateLimit.maxRequests," req / min")],["CORS",Array.isArray(e.corsOrigins)?e.corsOrigins.join(", ")||"none":e.corsOrigins]].map(t=>{let[s,n]=t;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-slate-500",children:s}),(0,a.jsx)("div",{className:"mt-0.5 font-medium ".concat("API auth"===s&&!e.authEnabled&&e.isPublic?"text-yellow-400":"text-slate-200"),children:n})]},s)})}),e.isPublic&&!e.authEnabled&&(0,a.jsxs)("div",{className:"rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-yellow-400",children:[(0,a.jsx)("p",{className:"font-semibold",children:"⚠ Running on a public interface without auth"}),(0,a.jsxs)("p",{className:"mt-1 text-yellow-500",children:["Anyone who can reach this host can control the node and read private keys. Restart with ",(0,a.jsx)("code",{className:"rounded bg-yellow-900/60 px-1",children:"--api-key <secret>"})," to enable Bearer token auth."]})]}),(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0e1117] px-3 py-2 text-slate-400",children:[(0,a.jsx)("p",{className:"font-semibold text-slate-300",children:"Public-host hardening checklist"}),(0,a.jsxs)("ul",{className:"mt-1 list-inside list-disc space-y-0.5 text-slate-500",children:[(0,a.jsxs)("li",{children:["Pass ",(0,a.jsx)("code",{className:"text-slate-400",children:"--api-key <secret>"})," on startup"]}),(0,a.jsxs)("li",{children:["Restrict ",(0,a.jsx)("code",{className:"text-slate-400",children:"--cors-origin"})," to your frontend origin"]}),(0,a.jsx)("li",{children:"Put a TLS-terminating reverse proxy (nginx/caddy) in front"}),(0,a.jsxs)("li",{children:["Limit firewall ingress to port ",e.port," from known IPs"]}),(0,a.jsx)("li",{children:"Never expose a wallet that holds real funds"})]})]})]})]})}function E(e){let{onClose:t}=e,s=(0,l.NL)(),[n,c]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[u,x]=(0,r.useState)(""),m=(0,i.D)({mutationFn:()=>S.SX.fund(n,d||void 0),onSuccess:e=>{x("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>x("✗ ".concat(e.message))}),h=n.trim().toLowerCase().startsWith("0x")?"EVM (eSpace)":n.trim()?"Core Space":null;return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:(0,a.jsxs)("div",{className:"card w-full max-w-md space-y-4",children:[(0,a.jsx)("h2",{className:"font-medium text-white",children:"Fund Address"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:["Address",h&&(0,a.jsxs)("span",{className:"ml-2 text-xs text-slate-400",children:["— detected: ",h]})]}),(0,a.jsx)("input",{className:"input",value:n,onChange:e=>c(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Amount (optional)"}),(0,a.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value),placeholder:"1000"})]}),u&&(0,a.jsx)("p",{className:"text-sm text-slate-300",children:u}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-secondary",onClick:t,children:"Close"}),(0,a.jsx)("button",{type:"button",className:"btn-primary",disabled:!n||m.isPending,onClick:()=>m.mutate(),children:m.isPending?"Sending…":"Fund"})]})]})})}function I(){var e,t,s,c,d,o,u,x,I,q,R,M,A;let F=(0,l.NL)(),[W,K]=(0,r.useState)(null),[D,T]=(0,r.useState)(null),[Q,V]=(0,r.useState)(""),[L,_]=(0,r.useState)(!1),[z,O]=(0,r.useState)(!1),[B,U]=(0,r.useState)(!1),[X,H]=(0,r.useState)("1"),[J,Y]=(0,r.useState)("1000"),[G,$]=(0,r.useState)(""),[ee,et]=(0,r.useState)(!1),{data:es}=(0,n.a)({queryKey:["node","status"],queryFn:S.N9.status}),{data:ea=[]}=(0,n.a)({queryKey:["keystore","wallets"],queryFn:S.SC.wallets,refetchInterval:5e3}),{data:en}=(0,n.a)({queryKey:["network","config"],queryFn:S.fA.config}),el=(null===(e=null!=W?W:es)||void 0===e?void 0:e.server)==="running",{data:ei=[],isLoading:er}=(0,n.a)({queryKey:["accounts"],queryFn:S.SX.list,enabled:el,refetchInterval:!!el&&8e3}),{data:ec}=(0,n.a)({queryKey:["accounts","faucet"],queryFn:S.SX.faucet,enabled:el}),{data:ed}=(0,n.a)({queryKey:["mining","status"],queryFn:S.mI.status,enabled:el,refetchInterval:!!el&&3e3});(0,r.useEffect)(()=>{let e=(0,C.h)(),t=e=>{K(e),F.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[F]),(0,r.useEffect)(()=>{en&&!D&&T({coreRpcPort:String(en.coreRpcPort),evmRpcPort:String(en.evmRpcPort),wsPort:String(en.wsPort),evmWsPort:String(en.evmWsPort),chainId:String(en.chainId),evmChainId:String(en.evmChainId)})},[en,D]),(0,r.useEffect)(()=>{(null==ed?void 0:ed.isRunning)&&void 0!==ed.interval&&Y(String(ed.interval))},[null==ed?void 0:ed.isRunning,null==ed?void 0:ed.interval]);let eo=(0,i.D)({mutationFn:S.N9.start,onSuccess:()=>F.invalidateQueries({queryKey:["node"]})}),eu=(0,i.D)({mutationFn:S.N9.stop,onSuccess:()=>F.invalidateQueries({queryKey:["node"]})}),ex=(0,i.D)({mutationFn:S.N9.restart,onSuccess:()=>F.invalidateQueries({queryKey:["node"]})}),em=(0,i.D)({mutationFn:S.N9.restartWipe,onSuccess:()=>{F.invalidateQueries({queryKey:["node"]}),F.invalidateQueries({queryKey:["accounts"]}),F.invalidateQueries({queryKey:["mining"]})}}),eh=(0,i.D)({mutationFn:S.N9.wipe,onSuccess:()=>{F.invalidateQueries({queryKey:["node"]}),F.invalidateQueries({queryKey:["accounts"]}),F.invalidateQueries({queryKey:["contracts","deployed"]}),F.invalidateQueries({queryKey:["mining"]})}}),ep=(0,i.D)({mutationFn:S.SC.activateWallet,onSuccess:()=>F.invalidateQueries({queryKey:["keystore","wallets"]})}),ey=(0,i.D)({mutationFn:e=>S.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{V("✓ Saved"),setTimeout(()=>V(""),2500),F.invalidateQueries({queryKey:["network"]})},onError:e=>V("✗ ".concat(e.message))}),ev=(0,i.D)({mutationFn:()=>S.mI.mine(Number(X)),onSuccess:e=>{$("✓ Mined ".concat(e.mined," block(s)")),F.invalidateQueries({queryKey:["mining"]})},onError:e=>$("✗ ".concat(e.message))}),ej=(0,i.D)({mutationFn:()=>S.mI.start(Number(J)),onSuccess:()=>F.invalidateQueries({queryKey:["mining"]})}),eb=(0,i.D)({mutationFn:S.mI.stop,onSuccess:()=>F.invalidateQueries({queryKey:["mining"]})}),eg=null!=W?W:es,eN=null!==(t=null==eg?void 0:eg.server)&&void 0!==t?t:"stopped",ef="starting"===eN||"stopping"===eN||eo.isPending||eu.isPending||ex.isPending||em.isPending||eh.isPending,ew=el?"status-dot-green":ef?"status-dot-yellow":"status-dot-red",ek=eo.isPending?"Starting…":eu.isPending?"Stopping…":ex.isPending||em.isPending?"Restarting…":eh.isPending?"Wiping…":"starting"===eN?"Starting…":"stopping"===eN?"Stopping…":"running"===eN?"Running":"Stopped",eS=ea.find(e=>e.isActive),eC=null==eg?void 0:eg.rpcUrls,eP=B?ei:ei.slice(0,5),eZ=ev.isPending||ej.isPending||eb.isPending;async function eE(){try{await eb.mutateAsync(),ej.mutate()}catch(e){}}return(0,a.jsxs)("div",{className:"space-y-6",children:[z&&(0,a.jsx)(E,{onClose:()=>O(!1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,a.jsxs)("div",{className:"card space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:ew}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-medium text-white",children:ek}),el&&(null==eg?void 0:eg.epochNumber)!==void 0&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",eg.epochNumber]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:el?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:ef,onClick:()=>ex.mutate(),children:[(0,a.jsx)(v,{className:"h-4 w-4"})," Restart"]}),(0,a.jsxs)("button",{type:"button",className:"btn-warning",disabled:ef,title:"Wipe this wallet's data directory and restart from block 0",onClick:()=>{confirm("Wipe all chain data for this wallet and restart from block 0?")&&em.mutate()},children:[(0,a.jsx)(y.Z,{className:"h-4 w-4"})," Wipe & Restart"]}),(0,a.jsxs)("button",{type:"button",className:"btn-danger",disabled:ef,onClick:()=>eu.mutate(),children:[(0,a.jsx)(j.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",className:"btn-success",disabled:ef,onClick:()=>eo.mutate(),children:[(0,a.jsx)(p.Z,{className:"h-4 w-4"})," Start"]}),(0,a.jsxs)("button",{type:"button",className:"btn-warning",disabled:ef,title:"Delete all chain data for this wallet (cannot be undone)",onClick:()=>{confirm("Wipe all chain data for this wallet? This cannot be undone.")&&eh.mutate()},children:[(0,a.jsx)(y.Z,{className:"h-4 w-4"})," Wipe Data"]})]})})]}),el&&eC&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-3",children:[(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between text-xs font-medium uppercase tracking-wider text-slate-500 hover:text-slate-300 transition-colors",onClick:()=>et(e=>!e),children:[(0,a.jsx)("span",{children:"RPC Endpoints"}),ee?(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5"}):(0,a.jsx)(h.Z,{className:"h-3.5 w-3.5"})]}),ee&&(0,a.jsxs)("div",{className:"mt-3 space-y-2",children:[[["Core RPC",eC.core],["EVM / ETH RPC",eC.evm],["Core WebSocket",null!==(s=eC.coreWs)&&void 0!==s?s:eC.ws],["EVM WebSocket",null!==(c=eC.evmWs)&&void 0!==c?c:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,a.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,a.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,a.jsx)(P,{text:s})]})]},t)}),D&&(0,a.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:D.chainId}),(0,a.jsx)(P,{text:D.chainId,small:!0})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:D.evmChainId}),(0,a.jsx)(P,{text:D.evmChainId,small:!0})]})]})]})]})]}),!el&&ea.length>0&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,a.jsx)(b.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===ea.length?(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-xs text-blue-300",children:null!==(d=null==eS?void 0:eS.label)&&void 0!==d?d:ea[0].label}),(0,a.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,a.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(o=null==eS?void 0:eS.id)&&void 0!==o?o:"",onChange:e=>ep.mutate(e.target.value),disabled:ep.isPending,children:ea.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!el&&D&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsx)("div",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Network Configuration"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,n]=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:s}),(0,a.jsx)("input",{className:"input",type:"number",value:null!==(t=D[n])&&void 0!==t?t:"",onChange:e=>T(t=>t?{...t,[n]:e.target.value}:t)})]},n)})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:ey.isPending||ef,onClick:()=>D&&ey.mutate(D),children:[(0,a.jsx)(g.Z,{className:"h-4 w-4"}),ey.isPending?"Saving…":"Save Config"]}),Q&&(0,a.jsx)("span",{className:"text-sm ".concat(Q.startsWith("✓")?"text-green-400":"text-red-400"),children:Q})]})]})]})]}),el&&(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-slate-300 shrink-0",children:"Mining"}),(0,a.jsxs)("span",{className:"rounded bg-[#1a2235] px-2 py-0.5 text-sm font-semibold tabular-nums text-white shrink-0",children:[(null!==(u=null==ed?void 0:ed.blocksMined)&&void 0!==u?u:0).toLocaleString(),(0,a.jsx)("span",{className:"ml-1 text-xs font-normal text-slate-400",children:"blocks"})]}),(0,a.jsx)("div",{className:"flex-1"}),(null==ed?void 0:ed.isRunning)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{className:"text-xs text-slate-500 shrink-0",children:"Interval (ms)"}),(0,a.jsx)("input",{className:"input w-24 shrink-0",type:"number",min:"100",value:J,onChange:e=>Y(e.target.value)}),Number(J)!==(null!==(x=ed.interval)&&void 0!==x?x:0)&&(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",disabled:eZ,onClick:eE,children:"Apply"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{className:"text-xs text-slate-500 shrink-0",children:"Blocks"}),(0,a.jsx)("input",{className:"input w-20 shrink-0",type:"number",min:"1",max:"1000",value:X,onChange:e=>H(e.target.value)}),(0,a.jsxs)("button",{type:"button",className:"btn-primary shrink-0",disabled:eZ,onClick:()=>ev.mutate(),children:[(0,a.jsx)(N.Z,{className:"h-4 w-4"}),ev.isPending?"Mining…":"Mine"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0 border-l border-[#2a3147] pl-3",children:[(0,a.jsx)("span",{className:"text-xs font-medium ".concat((null==ed?void 0:ed.isRunning)?"text-green-400":"text-slate-500"),children:"Auto"}),(0,a.jsx)("button",{type:"button",disabled:eZ,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none ".concat((null==ed?void 0:ed.isRunning)?"bg-green-600":"bg-slate-600"),onClick:()=>(null==ed?void 0:ed.isRunning)?eb.mutate():ej.mutate(),title:(null==ed?void 0:ed.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,a.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat((null==ed?void 0:ed.isRunning)?"translate-x-[18px]":"translate-x-0.5")})})]})]}),(G||ej.error||eb.error)&&(0,a.jsx)("p",{className:"mt-2 text-xs ".concat((null==G?void 0:G.startsWith("✓"))?"text-green-400":"text-red-400"),children:G||String(null!==(I=ej.error)&&void 0!==I?I:eb.error)})]}),el&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Accounts"}),ec&&(0,a.jsx)("div",{className:"card",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Faucet Account"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[260px] truncate text-xs text-blue-300",children:ec.coreAddress}),(0,a.jsx)(P,{text:ec.coreAddress,small:!0})]}),(0,a.jsxs)("div",{className:"mt-0.5 text-sm text-slate-300",children:[ec.coreBalance," CFX"]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,a.jsxs)("button",{type:"button",className:"btn-secondary",title:"Toggle private key visibility",onClick:()=>_(e=>!e),children:[L?(0,a.jsx)(f.Z,{className:"h-4 w-4"}):(0,a.jsx)(w.Z,{className:"h-4 w-4"}),"Keys"]}),(0,a.jsxs)("button",{type:"button",className:"btn-primary",onClick:()=>O(!0),children:[(0,a.jsx)(k.Z,{className:"h-4 w-4"})," Fund"]})]})]})}),er?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading accounts…"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[#2a3147]",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-[#161b27] text-xs uppercase tracking-wider text-slate-500",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"#"}),(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Core Address"}),(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"EVM Address"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Core"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"EVM"}),L&&(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Private Key"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-[#2a3147]",children:eP.map(e=>(0,a.jsxs)("tr",{className:"bg-[#0e1117] hover:bg-[#161b27]",children:[(0,a.jsx)("td",{className:"px-3 py-2 text-slate-500",children:e.index}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[180px] truncate text-xs text-blue-300",children:e.coreAddress}),(0,a.jsx)(P,{text:e.coreAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[140px] truncate text-xs text-blue-300",children:e.evmAddress}),(0,a.jsx)(P,{text:e.evmAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.coreBalance||"—"}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.evmBalance||"—"}),L&&(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[120px] truncate text-xs text-slate-400",children:e.privateKey}),(0,a.jsx)(P,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),ei.length>5&&(0,a.jsx)("button",{type:"button",className:"btn-secondary w-full text-center text-xs",onClick:()=>U(e=>!e),children:B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{className:"mr-1 inline h-3.5 w-3.5"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.Z,{className:"mr-1 inline h-3.5 w-3.5"}),"Show all ",ei.length," accounts"]})})]})]}),(0,a.jsx)(Z,{}),(eo.error||eu.error||ex.error||em.error||eh.error)&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(A=null!==(M=null!==(R=null!==(q=eo.error)&&void 0!==q?q:eu.error)&&void 0!==R?R:ex.error)&&void 0!==M?M:em.error)&&void 0!==A?A:eh.error)})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return x},Vp:function(){return m},fA:function(){return p},mI:function(){return h},pJ:function(){return v}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function i(e,t,s){let a=await fetch("".concat(l).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!a.ok){var n;throw Error(null!==(n=(await a.json().catch(()=>({error:a.statusText}))).error)&&void 0!==n?n:a.statusText)}return a.json()}let r=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=e=>i("DELETE",e),o=(e,t)=>i("PUT",e,t),u={status:()=>r("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe"),wipe:()=>c("/node/wipe")},x={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},m={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>r("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>d("/contracts/deployed/".concat(e)),call:(e,t,s,a)=>c("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:a})},h={status:()=>r("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},p={config:()=>r("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},y={status:()=>r("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))},v={get:()=>r("/settings")}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var a=s(7903),n=s(2608);let l=null;function i(){if(!l){var e;let t=null!==(e=n.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";l=(0,a.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return l}},5710:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},758:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},9924:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,826,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,8375))},8375:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return M}});var a=s(5853),n=s(8990),r=s(4852),i=s(6632),l=s(9928),c=s(3264),d=s(3035);let o=(0,d.Z)("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),u=(0,d.Z)("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var x=s(758),m=s(5710),h=s(5175),p=s(9924);let f=(0,d.Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var v=s(2846),g=s(8701),y=s(3737),j=s(6444),b=s(7201),N=s(3948),w=s(6804),k=s(4254),C=s(8144),S=s(3634),P=s(3368),Z=s(5570),I=s(2566),R=s(9510);function q(e){return!e||e.length<14?e||"":"".concat(e.slice(0,6),"...").concat(e.slice(-4))}function A(e){let{text:t,small:s}=e,[n,r]=(0,k.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1600)},children:n?(0,a.jsx)(l.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,a.jsx)(c.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function E(){let{data:e}=(0,n.a)({queryKey:["settings"],queryFn:C.pJ.get,staleTime:3e4}),[t,s]=(0,k.useState)(!1);if(!e)return null;let r=!e.isPublic||e.authEnabled;return(0,a.jsxs)("div",{className:"card border ".concat(r?"border-[#2a3147]":"border-yellow-800"),children:[(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between",onClick:()=>s(e=>!e),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e.isPublic&&!e.authEnabled?(0,a.jsx)(o,{className:"h-4 w-4 text-yellow-400"}):(0,a.jsx)(u,{className:"h-4 w-4 text-green-400"}),(0,a.jsx)("span",{className:"text-sm font-medium text-slate-300",children:"Security"}),e.isPublic&&!e.authEnabled&&(0,a.jsx)("span",{className:"rounded bg-yellow-900/50 px-1.5 py-0.5 text-[10px] text-yellow-400",children:"exposed without auth"})]}),t?(0,a.jsx)(x.Z,{className:"h-4 w-4 text-slate-500"}):(0,a.jsx)(m.Z,{className:"h-4 w-4 text-slate-500"})]}),t&&(0,a.jsxs)("div",{className:"mt-3 space-y-3 border-t border-[#2a3147] pt-3 text-xs",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["Bind address","".concat(e.host,":").concat(e.port)],["Public",e.isPublic?"Yes":"No (localhost)"],["API auth",e.authEnabled?"✓ Enabled":"✗ Disabled"],["Rate limit","".concat(e.rateLimit.maxRequests," req / min")],["CORS",Array.isArray(e.corsOrigins)?e.corsOrigins.join(", ")||"none":e.corsOrigins]].map(t=>{let[s,n]=t;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-slate-500",children:s}),(0,a.jsx)("div",{className:"mt-0.5 font-medium ".concat("API auth"===s&&!e.authEnabled&&e.isPublic?"text-yellow-400":"text-slate-200"),children:n})]},s)})}),e.isPublic&&!e.authEnabled&&(0,a.jsxs)("div",{className:"rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-yellow-400",children:[(0,a.jsx)("p",{className:"font-semibold",children:"⚠ Running on a public interface without auth"}),(0,a.jsxs)("p",{className:"mt-1 text-yellow-500",children:["Anyone who can reach this host can control the node and read private keys. Restart with"," ",(0,a.jsx)("code",{className:"rounded bg-yellow-900/60 px-1",children:"--api-key <secret>"})," ","to enable Bearer token auth."]})]}),(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0e1117] px-3 py-2 text-slate-400",children:[(0,a.jsx)("p",{className:"font-semibold text-slate-300",children:"Public-host hardening checklist"}),(0,a.jsxs)("ul",{className:"mt-1 list-inside list-disc space-y-0.5 text-slate-500",children:[(0,a.jsxs)("li",{children:["Pass"," ",(0,a.jsx)("code",{className:"text-slate-400",children:"--api-key <secret>"})," ","on startup"]}),(0,a.jsxs)("li",{children:["Restrict ",(0,a.jsx)("code",{className:"text-slate-400",children:"--cors-origin"})," ","to your frontend origin"]}),(0,a.jsx)("li",{children:"Put a TLS-terminating reverse proxy (nginx/caddy) in front"}),(0,a.jsxs)("li",{children:["Limit firewall ingress to port ",e.port," from known IPs"]}),(0,a.jsx)("li",{children:"Never expose a wallet that holds real funds"})]})]})]})]})}function F(e){let{onClose:t}=e,s=(0,r.NL)(),[n,l]=(0,k.useState)(""),[c,d]=(0,k.useState)(""),[o,u]=(0,k.useState)(""),x=(0,i.D)({mutationFn:()=>C.SX.fund(n,c||void 0),onSuccess:e=>{u("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>u("✗ ".concat(e.message))}),m=n.trim().toLowerCase().startsWith("0x")?"EVM (eSpace)":n.trim()?"Core Space":null;return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm",children:(0,a.jsxs)(Z.Zb,{className:"w-full max-w-md shadow-2xl border-cfx-500/20",children:[(0,a.jsxs)(Z.Ol,{children:[(0,a.jsx)(Z.ll,{children:"Fund Address"}),(0,a.jsx)(Z.SZ,{children:"Send CFX from faucet to address."})]}),(0,a.jsxs)(Z.aY,{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(R._,{children:["Address",m&&(0,a.jsxs)("span",{className:"ml-2 text-xs text-cfx-400",children:["— detected: ",m]})]}),(0,a.jsx)(I.I,{value:n,onChange:e=>l(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(R._,{children:"Amount (optional)"}),(0,a.jsx)(I.I,{value:c,onChange:e=>d(e.target.value),placeholder:"1000"})]}),o&&(0,a.jsx)("p",{className:"text-sm text-cfx-300",children:o})]}),(0,a.jsxs)(Z.eW,{className:"flex justify-end gap-2 pt-2",children:[(0,a.jsx)(P.z,{variant:"outline",onClick:t,children:"Close"}),(0,a.jsx)(P.z,{disabled:!n||x.isPending,onClick:()=>x.mutate(),children:x.isPending?"Sending…":"Fund"})]})]})})}function M(){var e,t,s,l,c,d,o,u,M,W,z,D,_;let K=(0,r.NL)(),[T,Q]=(0,k.useState)(null),[L,V]=(0,k.useState)(null),[O,X]=(0,k.useState)(""),[B,U]=(0,k.useState)(!1),[H,Y]=(0,k.useState)(!1),[J,G]=(0,k.useState)(!1),[$,ee]=(0,k.useState)("1"),[et,es]=(0,k.useState)("1000"),[ea,en]=(0,k.useState)(""),[er,ei]=(0,k.useState)(!1),{data:el}=(0,n.a)({queryKey:["node","status"],queryFn:C.N9.status}),{data:ec=[]}=(0,n.a)({queryKey:["keystore","wallets"],queryFn:C.SC.wallets,refetchInterval:5e3}),{data:ed}=(0,n.a)({queryKey:["network","config"],queryFn:C.fA.config}),eo=(null===(e=null!=T?T:el)||void 0===e?void 0:e.server)==="running",{data:eu=[],isLoading:ex}=(0,n.a)({queryKey:["accounts"],queryFn:C.SX.list,enabled:eo,refetchInterval:!!eo&&8e3}),{data:em}=(0,n.a)({queryKey:["accounts","faucet"],queryFn:C.SX.faucet,enabled:eo}),{data:eh}=(0,n.a)({queryKey:["mining","status"],queryFn:C.mI.status,enabled:eo,refetchInterval:!!eo&&3e3});(0,k.useEffect)(()=>{let e=(0,S.h)(),t=e=>{Q(e),K.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[K]),(0,k.useEffect)(()=>{ed&&!L&&V({coreRpcPort:String(ed.coreRpcPort),evmRpcPort:String(ed.evmRpcPort),wsPort:String(ed.wsPort),evmWsPort:String(ed.evmWsPort),chainId:String(ed.chainId),evmChainId:String(ed.evmChainId)})},[ed,L]),(0,k.useEffect)(()=>{(null==eh?void 0:eh.isRunning)&&void 0!==eh.interval&&es(String(eh.interval))},[null==eh?void 0:eh.isRunning,null==eh?void 0:eh.interval]);let ep=(0,i.D)({mutationFn:C.N9.start,onSuccess:()=>K.invalidateQueries({queryKey:["node"]})}),ef=(0,i.D)({mutationFn:C.N9.stop,onSuccess:()=>K.invalidateQueries({queryKey:["node"]})}),ev=(0,i.D)({mutationFn:C.N9.restart,onSuccess:()=>K.invalidateQueries({queryKey:["node"]})}),eg=(0,i.D)({mutationFn:C.N9.restartWipe,onSuccess:()=>{K.invalidateQueries({queryKey:["node"]}),K.invalidateQueries({queryKey:["accounts"]}),K.invalidateQueries({queryKey:["mining"]})}}),ey=(0,i.D)({mutationFn:C.N9.wipe,onSuccess:()=>{K.invalidateQueries({queryKey:["node"]}),K.invalidateQueries({queryKey:["accounts"]}),K.invalidateQueries({queryKey:["contracts","deployed"]}),K.invalidateQueries({queryKey:["mining"]})}}),ej=(0,i.D)({mutationFn:C.SC.activateWallet,onSuccess:()=>K.invalidateQueries({queryKey:["keystore","wallets"]})}),eb=(0,i.D)({mutationFn:e=>C.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{X("✓ Saved"),setTimeout(()=>X(""),2500),K.invalidateQueries({queryKey:["network"]})},onError:e=>X("✗ ".concat(e.message))}),eN=(0,i.D)({mutationFn:()=>C.mI.mine(Number($)),onSuccess:e=>{en("✓ Mined ".concat(e.mined," block(s)")),K.invalidateQueries({queryKey:["mining"]})},onError:e=>en("✗ ".concat(e.message))}),ew=(0,i.D)({mutationFn:()=>C.mI.start(Number(et)),onSuccess:()=>K.invalidateQueries({queryKey:["mining"]})}),ek=(0,i.D)({mutationFn:C.mI.stop,onSuccess:()=>K.invalidateQueries({queryKey:["mining"]})}),eC=null!=T?T:el,eS=null!==(t=null==eC?void 0:eC.server)&&void 0!==t?t:"stopped",eP="starting"===eS||"stopping"===eS||ep.isPending||ef.isPending||ev.isPending||eg.isPending||ey.isPending,eZ=eo?"status-dot-green":eP?"status-dot-yellow":"status-dot-red",eI=ep.isPending?"Starting…":ef.isPending?"Stopping…":ev.isPending||eg.isPending?"Restarting…":ey.isPending?"Wiping…":"starting"===eS?"Starting…":"stopping"===eS?"Stopping…":"running"===eS?"Running":"Stopped",eR=ec.find(e=>e.isActive),eq=null==eC?void 0:eC.rpcUrls,eA=J?eu:eu.slice(0,5),eE=eN.isPending||ew.isPending||ek.isPending;async function eF(){try{await ek.mutateAsync(),ew.mutate()}catch(e){}}return(0,a.jsxs)("div",{className:"space-y-6",children:[H&&(0,a.jsx)(F,{onClose:()=>Y(!1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,a.jsx)(Z.Zb,{className:"border-slate-800 bg-slate-900/40",children:(0,a.jsxs)(Z.aY,{className:"p-5 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("span",{className:"relative flex h-3.5 w-3.5 ".concat("status-dot-green"===eZ?"bg-green-500 shadow-[0_0_12px_rgba(34,197,94,0.6)]":"status-dot-yellow"===eZ?"bg-yellow-500 shadow-[0_0_12px_rgba(234,179,8,0.6)]":"bg-red-500 shadow-[0_0_12px_rgba(239,68,68,0.6)]"," rounded-full")}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-base font-semibold text-white tracking-wide",children:eI}),eo&&(null==eC?void 0:eC.epochNumber)!==void 0&&(0,a.jsxs)("div",{className:"text-xs font-medium text-cfx-400 mt-0.5",children:["Epoch #",eC.epochNumber]})]})]}),(0,a.jsx)("div",{className:"flex gap-2.5",children:eo?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(P.z,{variant:"secondary",disabled:eP,onClick:()=>ev.mutate(),children:[(0,a.jsx)(f,{className:"mr-2 h-4 w-4"})," Restart"]}),(0,a.jsx)(P.z,{variant:"destructive",disabled:eP,title:"Wipe this wallet's data directory and restart from block 0",onClick:()=>{confirm("Wipe all chain data for this wallet and restart from block 0?")&&eg.mutate()},children:(0,a.jsx)(p.Z,{className:"h-4 w-4"})}),(0,a.jsxs)(P.z,{variant:"destructive",disabled:eP,onClick:()=>ef.mutate(),children:[(0,a.jsx)(v.Z,{className:"mr-2 h-4 w-4"})," Stop"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(P.z,{className:"bg-green-600 hover:bg-green-500 text-white shadow shadow-green-900/20",disabled:eP,onClick:()=>ep.mutate(),children:[(0,a.jsx)(h.Z,{className:"mr-2 h-4 w-4"})," Start Node"]}),(0,a.jsxs)(P.z,{variant:"destructive",disabled:eP,title:"Delete all chain data for this wallet (cannot be undone)",onClick:()=>{confirm("Wipe all chain data for this wallet? This cannot be undone.")&&ey.mutate()},children:[(0,a.jsx)(p.Z,{className:"mr-2 h-4 w-4"})," Wipe Data"]})]})})]}),eo&&eq&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-3",children:[(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between text-xs font-medium uppercase tracking-wider text-slate-500 hover:text-slate-300 transition-colors",onClick:()=>ei(e=>!e),children:[(0,a.jsx)("span",{children:"RPC Endpoints"}),er?(0,a.jsx)(x.Z,{className:"h-3.5 w-3.5"}):(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5"})]}),er&&(0,a.jsxs)("div",{className:"mt-3 space-y-2",children:[[["Core RPC",eq.core],["EVM / ETH RPC",eq.evm],["Core WebSocket",null!==(s=eq.coreWs)&&void 0!==s?s:eq.ws],["EVM WebSocket",null!==(l=eq.evmWs)&&void 0!==l?l:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,a.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,a.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,a.jsx)(A,{text:s})]})]},t)}),L&&(0,a.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:L.chainId}),(0,a.jsx)(A,{text:L.chainId,small:!0})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-slate-300",children:L.evmChainId}),(0,a.jsx)(A,{text:L.evmChainId,small:!0})]})]})]})]})]}),!eo&&ec.length>0&&(0,a.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,a.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,a.jsx)(g.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===ec.length?(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-xs text-blue-300",children:null!==(c=null==eR?void 0:eR.label)&&void 0!==c?c:ec[0].label}),(0,a.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,a.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(d=null==eR?void 0:eR.id)&&void 0!==d?d:"",onChange:e=>ej.mutate(e.target.value),disabled:ej.isPending,children:ec.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!eo&&L&&(0,a.jsxs)("div",{className:"border-t border-slate-800 pt-6 mt-4",children:[(0,a.jsx)("h3",{className:"mb-4 text-sm font-semibold text-slate-200",children:"Network Configuration"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,n]=e;return(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(R._,{children:s}),(0,a.jsx)(I.I,{type:"number",value:null!==(t=L[n])&&void 0!==t?t:"",onChange:e=>V(t=>t?{...t,[n]:e.target.value}:t)})]},n)})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)(P.z,{disabled:eb.isPending||eP,onClick:()=>L&&eb.mutate(L),children:[(0,a.jsx)(y.Z,{className:"mr-2 h-4 w-4"}),eb.isPending?"Saving…":"Save Config"]}),O&&(0,a.jsx)("span",{className:"text-sm font-medium ".concat(O.startsWith("✓")?"text-green-400":"text-red-400"),children:O})]})]})]})]})}),eo&&(0,a.jsx)(Z.Zb,{children:(0,a.jsxs)(Z.aY,{className:"p-4 sm:p-6",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-slate-300 shrink-0",children:"Mining"}),(0,a.jsxs)("span",{className:"rounded-md bg-slate-950 border border-slate-800 px-3 py-1 text-sm font-semibold tabular-nums text-white shrink-0 shadow-inner",children:[(null!==(o=null==eh?void 0:eh.blocksMined)&&void 0!==o?o:0).toLocaleString(),(0,a.jsx)("span",{className:"ml-1.5 text-xs font-normal text-slate-400",children:"blocks"})]}),(0,a.jsx)("div",{className:"flex-1"}),(null==eh?void 0:eh.isRunning)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R._,{className:"text-xs text-slate-500 shrink-0",children:"Interval (ms)"}),(0,a.jsx)(I.I,{className:"w-24 shrink-0 h-9",type:"number",min:"100",value:et,onChange:e=>es(e.target.value)}),Number(et)!==(null!==(u=eh.interval)&&void 0!==u?u:0)&&(0,a.jsx)(P.z,{variant:"secondary",size:"sm",className:"shrink-0",disabled:eE,onClick:eF,children:"Apply"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R._,{className:"text-xs text-slate-500 shrink-0",children:"Blocks"}),(0,a.jsx)(I.I,{className:"w-20 shrink-0 h-9",type:"number",min:"1",max:"1000",value:$,onChange:e=>ee(e.target.value)}),(0,a.jsxs)(P.z,{size:"sm",className:"shrink-0",disabled:eE,onClick:()=>eN.mutate(),children:[(0,a.jsx)(j.Z,{className:"mr-1.5 h-3.5 w-3.5"}),eN.isPending?"Mining…":"Mine"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0 border-l border-slate-800 pl-4 ml-1",children:[(0,a.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider ".concat((null==eh?void 0:eh.isRunning)?"text-cfx-400":"text-slate-500"),children:"Auto"}),(0,a.jsx)("button",{type:"button",disabled:eE,className:"relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-cfx-500 focus:ring-offset-2 focus:ring-offset-slate-950 ".concat((null==eh?void 0:eh.isRunning)?"bg-cfx-500":"bg-slate-700"),onClick:()=>(null==eh?void 0:eh.isRunning)?ek.mutate():ew.mutate(),title:(null==eh?void 0:eh.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,a.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ".concat((null==eh?void 0:eh.isRunning)?"translate-x-6":"translate-x-1")})})]})]}),(ea||ew.error||ek.error)&&(0,a.jsx)("p",{className:"mt-3 text-sm font-medium ".concat((null==ea?void 0:ea.startsWith("✓"))?"text-green-400":"text-red-400"),children:ea||String(null!==(M=ew.error)&&void 0!==M?M:ek.error)})]})}),eo&&(0,a.jsxs)(Z.Zb,{className:"border-cfx-500/10",children:[(0,a.jsxs)(Z.Ol,{children:[(0,a.jsx)(Z.ll,{className:"text-lg",children:"Accounts"}),(0,a.jsx)(Z.SZ,{children:"Development accounts derived from mnemonic."})]}),(0,a.jsxs)(Z.aY,{className:"space-y-6",children:[em&&(0,a.jsx)("div",{className:"rounded-xl border border-cfx-500/30 bg-cfx-900/10 p-5 shadow-inner",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-cfx-400",children:"Faucet Account (Node Admin)"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-sm font-medium text-slate-200",children:q(em.coreAddress)}),(0,a.jsx)(A,{text:em.coreAddress})]}),(0,a.jsxs)("div",{className:"mt-1.5 text-xl font-semibold text-white",children:[em.coreBalance," ",(0,a.jsx)("span",{className:"text-sm font-normal text-slate-400",children:"CFX"})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 gap-3",children:[(0,a.jsxs)(P.z,{variant:"outline",className:"border-cfx-500/30 text-cfx-200 hover:bg-cfx-900/30 hover:text-white",title:"Toggle private key visibility",onClick:()=>U(e=>!e),children:[B?(0,a.jsx)(b.Z,{className:"mr-2 h-4 w-4"}):(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Keys"]}),(0,a.jsxs)(P.z,{className:"bg-cfx-600 hover:bg-cfx-500 text-white shadow-lg shadow-cfx-500/20",onClick:()=>Y(!0),children:[(0,a.jsx)(w.Z,{className:"mr-2 h-4 w-4"})," Fund Address"]})]})]})}),ex?(0,a.jsx)("p",{className:"text-sm text-slate-500 py-4 text-center",children:"Loading accounts…"}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-slate-800 shadow-sm",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-slate-900 text-xs font-semibold uppercase tracking-wider text-slate-400",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3 text-left",children:"#"}),(0,a.jsx)("th",{className:"px-4 py-3 text-left",children:"Core Address"}),(0,a.jsx)("th",{className:"px-4 py-3 text-left",children:"eSpace Address"}),(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Core CFX"}),(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"eSpace CFX"}),B&&(0,a.jsx)("th",{className:"px-4 py-3 text-left",children:"Private Key"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-slate-800 bg-slate-950",children:eA.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-slate-900/50 transition-colors",children:[(0,a.jsx)("td",{className:"px-4 py-3 text-slate-500 font-medium",children:e.index}),(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-[13px] text-blue-300 font-medium whitespace-nowrap",children:q(e.coreAddress)}),(0,a.jsx)(A,{text:e.coreAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-[13px] text-blue-300 font-medium whitespace-nowrap",children:q(e.evmAddress)}),(0,a.jsx)(A,{text:e.evmAddress,small:!0})]})}),(0,a.jsx)("td",{className:"px-4 py-3 text-right text-[13px] font-medium text-slate-200",children:e.coreBalance||"—"}),(0,a.jsx)("td",{className:"px-4 py-3 text-right text-[13px] font-medium text-slate-200",children:e.evmBalance||"—"}),B&&(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-[13px] text-slate-400 whitespace-nowrap",children:q(e.privateKey)}),(0,a.jsx)(A,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),eu.length>5&&(0,a.jsx)(P.z,{variant:"secondary",className:"w-full",onClick:()=>G(e=>!e),children:J?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.Z,{className:"mr-2 h-4 w-4 focus:outline-none"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{className:"mr-2 h-4 w-4 focus:outline-none"}),"Show all ",eu.length," accounts"]})})]})]})]}),(0,a.jsx)(E,{}),(ep.error||ef.error||ev.error||eg.error||ey.error)&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(_=null!==(D=null!==(z=null!==(W=ep.error)&&void 0!==W?W:ef.error)&&void 0!==z?z:ev.error)&&void 0!==D?D:eg.error)&&void 0!==_?_:ey.error)})]})}},3368:function(e,t,s){"use strict";s.d(t,{z:function(){return d}});var a=s(5853),n=s(4254),r=s(1145),i=s(5460),l=s(8337);let c=(0,i.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-cfx-500 text-white hover:bg-cfx-600",destructive:"bg-red-500 text-destructive-foreground hover:bg-red-500/90",outline:"border border-slate-700 bg-transparent hover:bg-slate-800 text-white",secondary:"bg-slate-800 text-slate-100 hover:bg-slate-700",ghost:"hover:bg-slate-800 hover:text-slate-100",link:"text-cfx-500 underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=n.forwardRef((e,t)=>{let{className:s,variant:n,size:i,asChild:d=!1,...o}=e,u=d?r.g7:"button";return(0,a.jsx)(u,{className:(0,l.cn)(c({variant:n,size:i,className:s})),ref:t,...o})});d.displayName="Button"},5570:function(e,t,s){"use strict";s.d(t,{Ol:function(){return l},SZ:function(){return d},Zb:function(){return i},aY:function(){return o},eW:function(){return u},ll:function(){return c}});var a=s(5853),n=s(4254),r=s(8337);let i=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("rounded-xl border border-slate-800 bg-slate-900/50 text-slate-100 shadow",s),...n})});i.displayName="Card";let l=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",s),...n})});l.displayName="CardHeader";let c=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("h3",{ref:t,className:(0,r.cn)("font-semibold leading-none tracking-tight",s),...n})});c.displayName="CardTitle";let d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("p",{ref:t,className:(0,r.cn)("text-sm text-slate-400",s),...n})});d.displayName="CardDescription";let o=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("p-6 pt-0",s),...n})});o.displayName="CardContent";let u=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("flex items-center p-6 pt-0",s),...n})});u.displayName="CardFooter"},2566:function(e,t,s){"use strict";s.d(t,{I:function(){return i}});var a=s(5853),n=s(4254),r=s(8337);let i=n.forwardRef((e,t)=>{let{className:s,type:n,...i}=e;return(0,a.jsx)("input",{type:n,className:(0,r.cn)("flex h-10 w-full rounded-md border border-slate-700 bg-slate-950 px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cfx-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...i})});i.displayName="Input"},9510:function(e,t,s){"use strict";s.d(t,{_:function(){return d}});var a=s(5853),n=s(4254),r=s(5307),i=s(5460),l=s(8337);let c=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-slate-300"),d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(r.f,{ref:t,className:(0,l.cn)(c(),s),...n})});d.displayName=r.f.displayName},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return x},SC:function(){return v},SX:function(){return m},Vp:function(){return h},fA:function(){return f},mI:function(){return p},pJ:function(){return g}});var a,n=s(2608);let r="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function i(e,t,s){let a=await fetch("".concat(r).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!a.ok){var n;throw Error(null!==(n=(await a.json().catch(()=>({error:a.statusText}))).error)&&void 0!==n?n:a.statusText)}return a.json()}let l=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=e=>i("DELETE",e),o=(e,t)=>i("PUT",e,t),u=(e,t)=>i("PATCH",e,t),x={status:()=>l("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe"),wipe:()=>c("/node/wipe")},m={list:()=>l("/accounts"),faucet:()=>l("/accounts/faucet"),fund:async(e,t,s)=>{let a=await fetch("/api/accounts/fund",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({address:e,amount:t,chain:s})});return await a.json()}},h={templates:()=>l("/contracts/templates"),template:e=>l("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>l("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>d("/contracts/deployed/".concat(e)),call:(e,t,s,a)=>c("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:a})},p={status:()=>l("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},f={config:()=>l("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>l("/network/rpc-urls")},v={status:()=>l("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>l("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),renameWallet:(e,t)=>u("/keystore/wallets/".concat(e),{label:t}),deleteWallet:e=>d("/keystore/wallets/".concat(e))},g={get:()=>l("/settings")}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var a=s(7903),n=s(2608);let r=null;function i(){if(!r){var e;let t=null!==(e=n.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";r=(0,a.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return r}},8337:function(e,t,s){"use strict";s.d(t,{cn:function(){return r}});var a=s(4685),n=s(4004);function r(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,n.m6)((0,a.W)(t))}},5710:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},758:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},9924:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,69,781,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,8172))},8172:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return f}});var n=s(5853),r=s(4852),a=s(8990),o=s(6632),c=s(4254),i=s(9928),l=s(3264),u=s(5175);let d=(0,s(3035).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var x=s(2846),m=s(8144),p=s(3634);function h(e){let{text:t}=e,[s,r]=(0,c.useState)(!1),a=async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1800)};return(0,n.jsx)("button",{type:"button",onClick:a,className:"btn-secondary ml-2 px-1.5 py-1",title:"Copy",children:s?(0,n.jsx)(i.Z,{className:"h-3.5 w-3.5 text-green-400"}):(0,n.jsx)(l.Z,{className:"h-3.5 w-3.5"})})}function f(){var e,t,s;let i=(0,r.NL)(),[l,f]=(0,c.useState)(null),{data:y}=(0,a.a)({queryKey:["node","status"],queryFn:m.N9.status});(0,c.useEffect)(()=>{let e=(0,p.h)(),t=e=>{f(e),i.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[i]);let v=null!=l?l:y,N=(0,o.D)({mutationFn:m.N9.start,onSuccess:()=>i.invalidateQueries({queryKey:["node"]})}),k=(0,o.D)({mutationFn:m.N9.stop,onSuccess:()=>i.invalidateQueries({queryKey:["node"]})}),j=(0,o.D)({mutationFn:m.N9.restart,onSuccess:()=>i.invalidateQueries({queryKey:["node"]})}),b=(null==v?void 0:v.server)==="running",w=(null==v?void 0:v.server)==="starting"||(null==v?void 0:v.server)==="stopping"||N.isPending||k.isPending||j.isPending,g=b?"status-dot-green":w?"status-dot-yellow":"status-dot-red",C=null==v?void 0:v.rpcUrls;return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,n.jsxs)("div",{className:"card flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:g}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium capitalize text-white",children:null!==(e=null==v?void 0:v.server)&&void 0!==e?e:"unknown"}),b&&(null==v?void 0:v.epochNumber)!==void 0&&(0,n.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",v.epochNumber]})]})]}),(0,n.jsx)("div",{className:"flex gap-2",children:b?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",disabled:w,onClick:()=>j.mutate(),children:[(0,n.jsx)(d,{className:"h-4 w-4"})," Restart"]}),(0,n.jsxs)("button",{type:"button",className:"btn-danger",disabled:w,onClick:()=>k.mutate(),children:[(0,n.jsx)(x.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,n.jsxs)("button",{type:"button",className:"btn-success",disabled:w,onClick:()=>N.mutate(),children:[(0,n.jsx)(u.Z,{className:"h-4 w-4"})," Start"]})})]}),C&&(0,n.jsxs)("div",{className:"card space-y-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"RPC Endpoints"}),[["Core RPC",C.core],["EVM / ETH RPC",C.evm],["WebSocket",C.ws]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,n.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,n.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,n.jsx)(h,{text:s})]})]},t)})]}),(N.error||k.error||j.error)&&(0,n.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(s=null!==(t=N.error)&&void 0!==t?t:k.error)&&void 0!==s?s:j.error)})]})}},8144:function(e,t,s){"use strict";async function n(e,t,s){let n=await fetch("".concat("/api").concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!n.ok){var r;throw Error(null!==(r=(await n.json().catch(()=>({error:n.statusText}))).error)&&void 0!==r?r:n.statusText)}return n.json()}s.d(t,{N9:function(){return i},SC:function(){return m},SX:function(){return l},Vp:function(){return u},fA:function(){return x},mI:function(){return d}});let r=e=>n("GET",e),a=(e,t)=>n("POST",e,t),o=(e,t)=>n("PUT",e,t),c=e=>n("DELETE",e),i={status:()=>r("/node/status"),start:()=>a("/node/start"),stop:()=>a("/node/stop"),restart:()=>a("/node/restart")},l={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>a("/accounts/fund",{address:e,amount:t,chain:s})},u={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>a("/contracts/compile",{source:e,contractName:t}),deploy:e=>a("/contracts/deploy",e)},d={status:()=>r("/mining/status"),mine:e=>a("/mining/mine",{blocks:e}),start:e=>a("/mining/start",{intervalMs:e}),stop:()=>a("/mining/stop")},x={config:()=>r("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},m={status:()=>r("/keystore/status"),generate:()=>a("/keystore/generate"),setup:e=>a("/keystore/setup",e),unlock:e=>a("/keystore/unlock",{password:e}),lock:()=>a("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>a("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>a("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>c("/keystore/wallets/".concat(e))}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return a}});var n=s(7903);let r=null;function a(){return r||(r=(0,n.io)({path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})),r}},9928:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]])},3264:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])}},function(e){e.O(0,[383,815,903,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,506))},506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var n=s(5853),a=s(4852),l=s(6632),i=s(8990),r=s(4254),c=s(9928),d=s(3264),o=s(5175),u=s(3035);let x=(0,u.Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var m=s(2846),h=s(8701),p=s(3737),v=s(7201),j=s(3948),N=s(6804);let g=(0,u.Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),y=(0,u.Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var f=s(6444),b=s(8144),w=s(3634);function k(e){let{text:t,small:s}=e,[a,l]=(0,r.useState)(!1);return(0,n.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),1600)},children:a?(0,n.jsx)(c.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,n.jsx)(d.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function C(e){let{onClose:t}=e,s=(0,a.NL)(),[i,c]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[u,x]=(0,r.useState)("evm"),[m,h]=(0,r.useState)(""),p=(0,l.D)({mutationFn:()=>b.SX.fund(i,d||void 0,u),onSuccess:e=>{h("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>h("✗ ".concat(e.message))});return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:(0,n.jsxs)("div",{className:"card w-full max-w-md space-y-4",children:[(0,n.jsx)("h2",{className:"font-medium text-white",children:"Fund Address"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Address"}),(0,n.jsx)("input",{className:"input",value:i,onChange:e=>c(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("label",{className:"label",children:"Amount (optional)"}),(0,n.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value),placeholder:"1000"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Chain"}),(0,n.jsxs)("select",{className:"input",value:u,onChange:e=>x(e.target.value),children:[(0,n.jsx)("option",{value:"evm",children:"EVM"}),(0,n.jsx)("option",{value:"core",children:"Core"})]})]})]}),m&&(0,n.jsx)("p",{className:"text-sm text-slate-300",children:m}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)("button",{type:"button",className:"btn-secondary",onClick:t,children:"Close"}),(0,n.jsx)("button",{type:"button",className:"btn-primary",disabled:!i||p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Sending…":"Fund"})]})]})})}function S(){var e,t,s,c,d,u,S,P,I,E,R;let M=(0,a.NL)(),[Z,q]=(0,r.useState)(null),[A,F]=(0,r.useState)(null),[D,K]=(0,r.useState)(""),[W,T]=(0,r.useState)(!1),[V,_]=(0,r.useState)(!1),[L,Q]=(0,r.useState)(!1),[U,z]=(0,r.useState)("1"),[X,B]=(0,r.useState)("1000"),[O,H]=(0,r.useState)(""),{data:G}=(0,i.a)({queryKey:["node","status"],queryFn:b.N9.status}),{data:J=[]}=(0,i.a)({queryKey:["keystore","wallets"],queryFn:b.SC.wallets,refetchInterval:5e3}),{data:Y}=(0,i.a)({queryKey:["network","config"],queryFn:b.fA.config}),$=(null===(e=null!=Z?Z:G)||void 0===e?void 0:e.server)==="running",{data:ee=[],isLoading:et}=(0,i.a)({queryKey:["accounts"],queryFn:b.SX.list,enabled:$,refetchInterval:!!$&&8e3}),{data:es}=(0,i.a)({queryKey:["accounts","faucet"],queryFn:b.SX.faucet,enabled:$}),{data:en}=(0,i.a)({queryKey:["mining","status"],queryFn:b.mI.status,enabled:$,refetchInterval:!!$&&3e3});(0,r.useEffect)(()=>{let e=(0,w.h)(),t=e=>{q(e),M.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[M]),(0,r.useEffect)(()=>{Y&&!A&&F({coreRpcPort:String(Y.coreRpcPort),evmRpcPort:String(Y.evmRpcPort),wsPort:String(Y.wsPort),evmWsPort:String(Y.evmWsPort),chainId:String(Y.chainId),evmChainId:String(Y.evmChainId)})},[Y,A]),(0,r.useEffect)(()=>{(null==en?void 0:en.isRunning)&&void 0!==en.interval&&B(String(en.interval))},[null==en?void 0:en.isRunning,null==en?void 0:en.interval]);let ea=(0,l.D)({mutationFn:b.N9.start,onSuccess:()=>M.invalidateQueries({queryKey:["node"]})}),el=(0,l.D)({mutationFn:b.N9.stop,onSuccess:()=>M.invalidateQueries({queryKey:["node"]})}),ei=(0,l.D)({mutationFn:b.N9.restart,onSuccess:()=>M.invalidateQueries({queryKey:["node"]})}),er=(0,l.D)({mutationFn:b.SC.activateWallet,onSuccess:()=>M.invalidateQueries({queryKey:["keystore","wallets"]})}),ec=(0,l.D)({mutationFn:e=>b.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{K("✓ Saved"),setTimeout(()=>K(""),2500),M.invalidateQueries({queryKey:["network"]})},onError:e=>K("✗ ".concat(e.message))}),ed=(0,l.D)({mutationFn:()=>b.mI.mine(Number(U)),onSuccess:e=>{H("✓ Mined ".concat(e.mined," block(s)")),M.invalidateQueries({queryKey:["mining"]})},onError:e=>H("✗ ".concat(e.message))}),eo=(0,l.D)({mutationFn:()=>b.mI.start(Number(X)),onSuccess:()=>M.invalidateQueries({queryKey:["mining"]})}),eu=(0,l.D)({mutationFn:b.mI.stop,onSuccess:()=>M.invalidateQueries({queryKey:["mining"]})}),ex=null!=Z?Z:G,em=null!==(t=null==ex?void 0:ex.server)&&void 0!==t?t:"stopped",eh="starting"===em||"stopping"===em||ea.isPending||el.isPending||ei.isPending,ep=$?"status-dot-green":eh?"status-dot-yellow":"status-dot-red",ev=ea.isPending?"Starting…":el.isPending?"Stopping…":ei.isPending?"Restarting…":"starting"===em?"Starting…":"stopping"===em?"Stopping…":"running"===em?"Running":"Stopped",ej=J.find(e=>e.isActive),eN=null==ex?void 0:ex.rpcUrls,eg=L?ee:ee.slice(0,5),ey=ed.isPending||eo.isPending||eu.isPending;async function ef(){try{await eu.mutateAsync(),eo.mutate()}catch(e){}}return(0,n.jsxs)("div",{className:"space-y-6",children:[V&&(0,n.jsx)(C,{onClose:()=>_(!1)}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,n.jsxs)("div",{className:"card space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:ep}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-white",children:ev}),$&&(null==ex?void 0:ex.epochNumber)!==void 0&&(0,n.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",ex.epochNumber]})]})]}),(0,n.jsx)("div",{className:"flex gap-2",children:$?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",disabled:eh,onClick:()=>ei.mutate(),children:[(0,n.jsx)(x,{className:"h-4 w-4"})," Restart"]}),(0,n.jsxs)("button",{type:"button",className:"btn-danger",disabled:eh,onClick:()=>el.mutate(),children:[(0,n.jsx)(m.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,n.jsxs)("button",{type:"button",className:"btn-success",disabled:eh,onClick:()=>ea.mutate(),children:[(0,n.jsx)(o.Z,{className:"h-4 w-4"})," Start"]})})]}),!$&&J.length>0&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,n.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,n.jsx)(h.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===J.length?(0,n.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,n.jsx)("code",{className:"text-xs text-blue-300",children:null!==(s=null==ej?void 0:ej.label)&&void 0!==s?s:J[0].label}),(0,n.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,n.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(c=null==ej?void 0:ej.id)&&void 0!==c?c:"",onChange:e=>er.mutate(e.target.value),disabled:er.isPending,children:J.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!$&&A&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,n.jsx)("div",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Network Configuration"}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,a]=e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:s}),(0,n.jsx)("input",{className:"input",type:"number",value:null!==(t=A[a])&&void 0!==t?t:"",onChange:e=>F(t=>t?{...t,[a]:e.target.value}:t)})]},a)})}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("button",{type:"button",className:"btn-primary",disabled:ec.isPending,onClick:()=>A&&ec.mutate(A),children:[(0,n.jsx)(p.Z,{className:"h-4 w-4"}),ec.isPending?"Saving…":"Save Config"]}),D&&(0,n.jsx)("span",{className:"text-sm ".concat(D.startsWith("✓")?"text-green-400":"text-red-400"),children:D})]})]})]})]}),$&&eN&&(0,n.jsxs)("div",{className:"card space-y-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"RPC Endpoints"}),[["Core RPC",eN.core],["EVM / ETH RPC",eN.evm],["Core WebSocket",null!==(d=eN.coreWs)&&void 0!==d?d:eN.ws],["EVM WebSocket",null!==(u=eN.evmWs)&&void 0!==u?u:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,n.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,n.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,n.jsx)(k,{text:s})]})]},t)}),A&&(0,n.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-slate-300",children:A.chainId}),(0,n.jsx)(k,{text:A.chainId,small:!0})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-slate-300",children:A.evmChainId}),(0,n.jsx)(k,{text:A.evmChainId,small:!0})]})]})]})]}),$&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Accounts"}),es&&(0,n.jsx)("div",{className:"card",children:(0,n.jsxs)("div",{className:"flex items-start justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Faucet Account"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[260px] truncate text-xs text-blue-300",children:es.coreAddress}),(0,n.jsx)(k,{text:es.coreAddress,small:!0})]}),(0,n.jsxs)("div",{className:"mt-0.5 text-sm text-slate-300",children:[es.coreBalance," CFX"]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",title:"Toggle private key visibility",onClick:()=>T(e=>!e),children:[W?(0,n.jsx)(v.Z,{className:"h-4 w-4"}):(0,n.jsx)(j.Z,{className:"h-4 w-4"}),"Keys"]}),(0,n.jsxs)("button",{type:"button",className:"btn-primary",onClick:()=>_(!0),children:[(0,n.jsx)(N.Z,{className:"h-4 w-4"})," Fund"]})]})]})}),et?(0,n.jsx)("p",{className:"text-sm text-slate-500",children:"Loading accounts…"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[#2a3147]",children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{className:"bg-[#161b27] text-xs uppercase tracking-wider text-slate-500",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"#"}),(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"Core Address"}),(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"EVM Address"}),(0,n.jsx)("th",{className:"px-3 py-2 text-right",children:"Core"}),(0,n.jsx)("th",{className:"px-3 py-2 text-right",children:"EVM"}),W&&(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"Private Key"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-[#2a3147]",children:eg.map(e=>(0,n.jsxs)("tr",{className:"bg-[#0e1117] hover:bg-[#161b27]",children:[(0,n.jsx)("td",{className:"px-3 py-2 text-slate-500",children:e.index}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[180px] truncate text-xs text-blue-300",children:e.coreAddress}),(0,n.jsx)(k,{text:e.coreAddress,small:!0})]})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[140px] truncate text-xs text-blue-300",children:e.evmAddress}),(0,n.jsx)(k,{text:e.evmAddress,small:!0})]})}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.coreBalance||"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.evmBalance||"—"}),W&&(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[120px] truncate text-xs text-slate-400",children:e.privateKey}),(0,n.jsx)(k,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),ee.length>5&&(0,n.jsx)("button",{type:"button",className:"btn-secondary w-full text-center text-xs",onClick:()=>Q(e=>!e),children:L?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g,{className:"mr-1 inline h-3.5 w-3.5"}),"Show less"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y,{className:"mr-1 inline h-3.5 w-3.5"}),"Show all ",ee.length," accounts"]})})]})]}),$&&(0,n.jsxs)("div",{className:"card space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Mining"}),(0,n.jsxs)("span",{className:"text-xs text-slate-500",children:[null!==(S=null==en?void 0:en.blocksMined)&&void 0!==S?S:0," blocks mined"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs font-medium ".concat((null==en?void 0:en.isRunning)?"text-green-400":"text-slate-500"),children:(null==en?void 0:en.isRunning)?"Auto":"Manual"}),(0,n.jsx)("button",{type:"button",disabled:ey,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none ".concat((null==en?void 0:en.isRunning)?"bg-green-600":"bg-slate-600"),onClick:()=>(null==en?void 0:en.isRunning)?eu.mutate():eo.mutate(),title:(null==en?void 0:en.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,n.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat((null==en?void 0:en.isRunning)?"translate-x-[18px]":"translate-x-0.5")})})]})]}),(null==en?void 0:en.isRunning)?(0,n.jsxs)("div",{className:"flex items-end gap-3",children:[(0,n.jsxs)("div",{className:"w-36",children:[(0,n.jsx)("label",{className:"label",children:"Interval (ms)"}),(0,n.jsx)("input",{className:"input",type:"number",min:"100",value:X,onChange:e=>B(e.target.value)})]}),Number(X)!==(null!==(P=en.interval)&&void 0!==P?P:0)&&(0,n.jsx)("button",{type:"button",className:"btn-secondary",disabled:ey,onClick:ef,children:"Update"})]}):(0,n.jsxs)("div",{className:"flex items-end gap-3",children:[(0,n.jsxs)("div",{className:"w-28",children:[(0,n.jsx)("label",{className:"label",children:"Blocks"}),(0,n.jsx)("input",{className:"input",type:"number",min:"1",max:"1000",value:U,onChange:e=>z(e.target.value)})]}),(0,n.jsxs)("button",{type:"button",className:"btn-primary",disabled:ey,onClick:()=>ed.mutate(),children:[(0,n.jsx)(f.Z,{className:"h-4 w-4"}),ed.isPending?"Mining…":"Mine"]})]}),O&&(0,n.jsx)("p",{className:"text-sm ".concat(O.startsWith("✓")?"text-green-400":"text-red-400"),children:O}),(eo.error||eu.error)&&(0,n.jsx)("p",{className:"text-sm text-red-400",children:String(null!==(I=eo.error)&&void 0!==I?I:eu.error)})]}),(ea.error||el.error||ei.error)&&(0,n.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(R=null!==(E=ea.error)&&void 0!==E?E:el.error)&&void 0!==R?R:ei.error)})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return v},SX:function(){return x},Vp:function(){return m},fA:function(){return p},mI:function(){return h}});var n,a=s(2608);let l="".concat(null!==(n=a.env.NEXT_PUBLIC_API_URL)&&void 0!==n?n:"","/api");async function i(e,t,s){let n=await fetch("".concat(l).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!n.ok){var a;throw Error(null!==(a=(await n.json().catch(()=>({error:n.statusText}))).error)&&void 0!==a?a:n.statusText)}return n.json()}let r=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=(e,t)=>i("PUT",e,t),o=e=>i("DELETE",e),u={status:()=>r("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart")},x={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},m={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e)},h={status:()=>r("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},p={config:()=>r("/network/config"),updateConfig:e=>d("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},v={status:()=>r("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>o("/keystore/wallets/".concat(e))}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var n=s(7903),a=s(2608);let l=null;function i(){if(!l){var e;let t=null!==(e=a.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";l=(0,n.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return l}},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,826,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{1134:function(e,t,s){Promise.resolve().then(s.bind(s,8172))},8172:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var n=s(5853),a=s(4852),l=s(6632),i=s(8990),r=s(4254),c=s(9928),d=s(3264),o=s(5175);let u=(0,s(3035).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var x=s(9924),m=s(2846),h=s(8701),p=s(3737),v=s(6444),y=s(7201),j=s(3948),N=s(6804),g=s(758),f=s(5710),b=s(8144),w=s(3634);function k(e){let{text:t,small:s}=e,[a,l]=(0,r.useState)(!1);return(0,n.jsx)("button",{type:"button",title:"Copy",className:"rounded text-slate-500 hover:text-slate-300 ".concat(s?"p-0.5":"ml-1.5 px-1.5 py-1 btn-secondary"),onClick:async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),1600)},children:a?(0,n.jsx)(c.Z,{className:s?"h-3 w-3 text-green-400":"h-3.5 w-3.5 text-green-400"}):(0,n.jsx)(d.Z,{className:s?"h-3 w-3":"h-3.5 w-3.5"})})}function C(e){let{onClose:t}=e,s=(0,a.NL)(),[i,c]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[u,x]=(0,r.useState)("evm"),[m,h]=(0,r.useState)(""),p=(0,l.D)({mutationFn:()=>b.SX.fund(i,d||void 0,u),onSuccess:e=>{h("✓ tx: ".concat(e.txHash)),s.invalidateQueries({queryKey:["accounts"]})},onError:e=>h("✗ ".concat(e.message))});return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",children:(0,n.jsxs)("div",{className:"card w-full max-w-md space-y-4",children:[(0,n.jsx)("h2",{className:"font-medium text-white",children:"Fund Address"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Address"}),(0,n.jsx)("input",{className:"input",value:i,onChange:e=>c(e.target.value),placeholder:"0x… or cfx:…"})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("label",{className:"label",children:"Amount (optional)"}),(0,n.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value),placeholder:"1000"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Chain"}),(0,n.jsxs)("select",{className:"input",value:u,onChange:e=>x(e.target.value),children:[(0,n.jsx)("option",{value:"evm",children:"EVM"}),(0,n.jsx)("option",{value:"core",children:"Core"})]})]})]}),m&&(0,n.jsx)("p",{className:"text-sm text-slate-300",children:m}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)("button",{type:"button",className:"btn-secondary",onClick:t,children:"Close"}),(0,n.jsx)("button",{type:"button",className:"btn-primary",disabled:!i||p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Sending…":"Fund"})]})]})})}function S(){var e,t,s,c,d,S,P,I,Z,E,M,R;let q=(0,a.NL)(),[F,A]=(0,r.useState)(null),[W,D]=(0,r.useState)(null),[K,T]=(0,r.useState)(""),[V,Q]=(0,r.useState)(!1),[_,L]=(0,r.useState)(!1),[U,z]=(0,r.useState)(!1),[X,B]=(0,r.useState)("1"),[O,H]=(0,r.useState)("1000"),[G,J]=(0,r.useState)(""),{data:Y}=(0,i.a)({queryKey:["node","status"],queryFn:b.N9.status}),{data:$=[]}=(0,i.a)({queryKey:["keystore","wallets"],queryFn:b.SC.wallets,refetchInterval:5e3}),{data:ee}=(0,i.a)({queryKey:["network","config"],queryFn:b.fA.config}),et=(null===(e=null!=F?F:Y)||void 0===e?void 0:e.server)==="running",{data:es=[],isLoading:en}=(0,i.a)({queryKey:["accounts"],queryFn:b.SX.list,enabled:et,refetchInterval:!!et&&8e3}),{data:ea}=(0,i.a)({queryKey:["accounts","faucet"],queryFn:b.SX.faucet,enabled:et}),{data:el}=(0,i.a)({queryKey:["mining","status"],queryFn:b.mI.status,enabled:et,refetchInterval:!!et&&3e3});(0,r.useEffect)(()=>{let e=(0,w.h)(),t=e=>{A(e),q.setQueryData(["node","status"],e)};return e.on("node:status",t),()=>{e.off("node:status",t)}},[q]),(0,r.useEffect)(()=>{ee&&!W&&D({coreRpcPort:String(ee.coreRpcPort),evmRpcPort:String(ee.evmRpcPort),wsPort:String(ee.wsPort),evmWsPort:String(ee.evmWsPort),chainId:String(ee.chainId),evmChainId:String(ee.evmChainId)})},[ee,W]),(0,r.useEffect)(()=>{(null==el?void 0:el.isRunning)&&void 0!==el.interval&&H(String(el.interval))},[null==el?void 0:el.isRunning,null==el?void 0:el.interval]);let ei=(0,l.D)({mutationFn:b.N9.start,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),er=(0,l.D)({mutationFn:b.N9.stop,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),ec=(0,l.D)({mutationFn:b.N9.restart,onSuccess:()=>q.invalidateQueries({queryKey:["node"]})}),ed=(0,l.D)({mutationFn:b.N9.restartWipe,onSuccess:()=>{q.invalidateQueries({queryKey:["node"]}),q.invalidateQueries({queryKey:["accounts"]}),q.invalidateQueries({queryKey:["mining"]})}}),eo=(0,l.D)({mutationFn:b.SC.activateWallet,onSuccess:()=>q.invalidateQueries({queryKey:["keystore","wallets"]})}),eu=(0,l.D)({mutationFn:e=>b.fA.updateConfig({coreRpcPort:Number(e.coreRpcPort),evmRpcPort:Number(e.evmRpcPort),wsPort:Number(e.wsPort),evmWsPort:Number(e.evmWsPort),chainId:Number(e.chainId),evmChainId:Number(e.evmChainId)}),onSuccess:()=>{T("✓ Saved"),setTimeout(()=>T(""),2500),q.invalidateQueries({queryKey:["network"]})},onError:e=>T("✗ ".concat(e.message))}),ex=(0,l.D)({mutationFn:()=>b.mI.mine(Number(X)),onSuccess:e=>{J("✓ Mined ".concat(e.mined," block(s)")),q.invalidateQueries({queryKey:["mining"]})},onError:e=>J("✗ ".concat(e.message))}),em=(0,l.D)({mutationFn:()=>b.mI.start(Number(O)),onSuccess:()=>q.invalidateQueries({queryKey:["mining"]})}),eh=(0,l.D)({mutationFn:b.mI.stop,onSuccess:()=>q.invalidateQueries({queryKey:["mining"]})}),ep=null!=F?F:Y,ev=null!==(t=null==ep?void 0:ep.server)&&void 0!==t?t:"stopped",ey="starting"===ev||"stopping"===ev||ei.isPending||er.isPending||ec.isPending||ed.isPending,ej=et?"status-dot-green":ey?"status-dot-yellow":"status-dot-red",eN=ei.isPending?"Starting…":er.isPending?"Stopping…":ec.isPending||ed.isPending?"Restarting…":"starting"===ev?"Starting…":"stopping"===ev?"Stopping…":"running"===ev?"Running":"Stopped",eg=$.find(e=>e.isActive),ef=null==ep?void 0:ep.rpcUrls,eb=U?es:es.slice(0,5),ew=ex.isPending||em.isPending||eh.isPending;async function ek(){try{await eh.mutateAsync(),em.mutate()}catch(e){}}return(0,n.jsxs)("div",{className:"space-y-6",children:[_&&(0,n.jsx)(C,{onClose:()=>L(!1)}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Local Conflux development node"})]}),(0,n.jsxs)("div",{className:"card space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:ej}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-white",children:eN}),et&&(null==ep?void 0:ep.epochNumber)!==void 0&&(0,n.jsxs)("div",{className:"text-xs text-slate-400",children:["Epoch #",ep.epochNumber]})]})]}),(0,n.jsx)("div",{className:"flex gap-2",children:et?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",disabled:ey,onClick:()=>ec.mutate(),children:[(0,n.jsx)(u,{className:"h-4 w-4"})," Restart"]}),(0,n.jsxs)("button",{type:"button",className:"btn-warning",disabled:ey,title:"Wipe this wallet's data directory and restart from block 0",onClick:()=>{confirm("Wipe all chain data for this wallet and restart from block 0?")&&ed.mutate()},children:[(0,n.jsx)(x.Z,{className:"h-4 w-4"})," Wipe & Restart"]}),(0,n.jsxs)("button",{type:"button",className:"btn-danger",disabled:ey,onClick:()=>er.mutate(),children:[(0,n.jsx)(m.Z,{className:"h-4 w-4"})," Stop"]})]}):(0,n.jsxs)("button",{type:"button",className:"btn-success",disabled:ey,onClick:()=>ei.mutate(),children:[(0,n.jsx)(o.Z,{className:"h-4 w-4"})," Start"]})})]}),!et&&$.length>0&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,n.jsxs)("label",{className:"label flex items-center gap-1.5",children:[(0,n.jsx)(h.Z,{className:"h-3.5 w-3.5"})," Wallet"]}),1===$.length?(0,n.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,n.jsx)("code",{className:"text-xs text-blue-300",children:null!==(s=null==eg?void 0:eg.label)&&void 0!==s?s:$[0].label}),(0,n.jsx)("span",{className:"rounded bg-blue-600/20 px-1.5 py-0.5 text-[10px] text-blue-400",children:"active"})]}):(0,n.jsx)("select",{className:"input mt-1 w-full max-w-xs",value:null!==(c=null==eg?void 0:eg.id)&&void 0!==c?c:"",onChange:e=>eo.mutate(e.target.value),disabled:eo.isPending,children:$.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.label,e.isActive?" (active)":""]},e.id))})]}),!et&&W&&(0,n.jsxs)("div",{className:"border-t border-[#2a3147] pt-4",children:[(0,n.jsx)("div",{className:"mb-3 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Network Configuration"}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[["Core RPC Port","coreRpcPort"],["EVM RPC Port","evmRpcPort"],["Core WS Port","wsPort"],["EVM WS Port","evmWsPort"],["Core Chain ID","chainId"],["EVM Chain ID","evmChainId"]].map(e=>{var t;let[s,a]=e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:s}),(0,n.jsx)("input",{className:"input",type:"number",value:null!==(t=W[a])&&void 0!==t?t:"",onChange:e=>D(t=>t?{...t,[a]:e.target.value}:t)})]},a)})}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("button",{type:"button",className:"btn-primary",disabled:eu.isPending||ey,onClick:()=>W&&eu.mutate(W),children:[(0,n.jsx)(p.Z,{className:"h-4 w-4"}),eu.isPending?"Saving…":"Save Config"]}),K&&(0,n.jsx)("span",{className:"text-sm ".concat(K.startsWith("✓")?"text-green-400":"text-red-400"),children:K})]})]})]})]}),et&&(0,n.jsxs)("div",{className:"card space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Mining"}),(0,n.jsxs)("span",{className:"text-xs text-slate-500",children:[null!==(d=null==el?void 0:el.blocksMined)&&void 0!==d?d:0," blocks mined"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs font-medium ".concat((null==el?void 0:el.isRunning)?"text-green-400":"text-slate-500"),children:(null==el?void 0:el.isRunning)?"Auto":"Manual"}),(0,n.jsx)("button",{type:"button",disabled:ew,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none ".concat((null==el?void 0:el.isRunning)?"bg-green-600":"bg-slate-600"),onClick:()=>(null==el?void 0:el.isRunning)?eh.mutate():em.mutate(),title:(null==el?void 0:el.isRunning)?"Stop auto-mining":"Start auto-mining",children:(0,n.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ".concat((null==el?void 0:el.isRunning)?"translate-x-[18px]":"translate-x-0.5")})})]})]}),(null==el?void 0:el.isRunning)?(0,n.jsxs)("div",{className:"flex items-end gap-3",children:[(0,n.jsxs)("div",{className:"w-36",children:[(0,n.jsx)("label",{className:"label",children:"Interval (ms)"}),(0,n.jsx)("input",{className:"input",type:"number",min:"100",value:O,onChange:e=>H(e.target.value)})]}),Number(O)!==(null!==(S=el.interval)&&void 0!==S?S:0)&&(0,n.jsx)("button",{type:"button",className:"btn-secondary",disabled:ew,onClick:ek,children:"Update"})]}):(0,n.jsxs)("div",{className:"flex items-end gap-3",children:[(0,n.jsxs)("div",{className:"w-28",children:[(0,n.jsx)("label",{className:"label",children:"Blocks"}),(0,n.jsx)("input",{className:"input",type:"number",min:"1",max:"1000",value:X,onChange:e=>B(e.target.value)})]}),(0,n.jsxs)("button",{type:"button",className:"btn-primary",disabled:ew,onClick:()=>ex.mutate(),children:[(0,n.jsx)(v.Z,{className:"h-4 w-4"}),ex.isPending?"Mining…":"Mine"]})]}),G&&(0,n.jsx)("p",{className:"text-sm ".concat(G.startsWith("✓")?"text-green-400":"text-red-400"),children:G}),(em.error||eh.error)&&(0,n.jsx)("p",{className:"text-sm text-red-400",children:String(null!==(P=em.error)&&void 0!==P?P:eh.error)})]}),et&&ef&&(0,n.jsxs)("div",{className:"card space-y-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"RPC Endpoints"}),[["Core RPC",ef.core],["EVM / ETH RPC",ef.evm],["Core WebSocket",null!==(I=ef.coreWs)&&void 0!==I?I:ef.ws],["EVM WebSocket",null!==(Z=ef.evmWs)&&void 0!==Z?Z:""]].filter(e=>{let[,t]=e;return t}).map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"w-32 text-xs text-slate-500",children:t}),(0,n.jsxs)("div",{className:"flex flex-1 items-center overflow-hidden",children:[(0,n.jsx)("code",{className:"flex-1 truncate rounded bg-[#0e1117] px-2 py-1 text-xs text-blue-300",children:s}),(0,n.jsx)(k,{text:s})]})]},t)}),W&&(0,n.jsxs)("div",{className:"flex gap-8 border-t border-[#2a3147] pt-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[10px] text-slate-500",children:"Core Chain ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-slate-300",children:W.chainId}),(0,n.jsx)(k,{text:W.chainId,small:!0})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[10px] text-slate-500",children:"EVM Chain ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-slate-300",children:W.evmChainId}),(0,n.jsx)(k,{text:W.evmChainId,small:!0})]})]})]})]}),et&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("h2",{className:"text-sm font-medium text-slate-300",children:"Accounts"}),ea&&(0,n.jsx)("div",{className:"card",children:(0,n.jsxs)("div",{className:"flex items-start justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-slate-500",children:"Faucet Account"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[260px] truncate text-xs text-blue-300",children:ea.coreAddress}),(0,n.jsx)(k,{text:ea.coreAddress,small:!0})]}),(0,n.jsxs)("div",{className:"mt-0.5 text-sm text-slate-300",children:[ea.coreBalance," CFX"]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,n.jsxs)("button",{type:"button",className:"btn-secondary",title:"Toggle private key visibility",onClick:()=>Q(e=>!e),children:[V?(0,n.jsx)(y.Z,{className:"h-4 w-4"}):(0,n.jsx)(j.Z,{className:"h-4 w-4"}),"Keys"]}),(0,n.jsxs)("button",{type:"button",className:"btn-primary",onClick:()=>L(!0),children:[(0,n.jsx)(N.Z,{className:"h-4 w-4"})," Fund"]})]})]})}),en?(0,n.jsx)("p",{className:"text-sm text-slate-500",children:"Loading accounts…"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[#2a3147]",children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{className:"bg-[#161b27] text-xs uppercase tracking-wider text-slate-500",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"#"}),(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"Core Address"}),(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"EVM Address"}),(0,n.jsx)("th",{className:"px-3 py-2 text-right",children:"Core"}),(0,n.jsx)("th",{className:"px-3 py-2 text-right",children:"EVM"}),V&&(0,n.jsx)("th",{className:"px-3 py-2 text-left",children:"Private Key"})]})}),(0,n.jsx)("tbody",{className:"divide-y divide-[#2a3147]",children:eb.map(e=>(0,n.jsxs)("tr",{className:"bg-[#0e1117] hover:bg-[#161b27]",children:[(0,n.jsx)("td",{className:"px-3 py-2 text-slate-500",children:e.index}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[180px] truncate text-xs text-blue-300",children:e.coreAddress}),(0,n.jsx)(k,{text:e.coreAddress,small:!0})]})}),(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[140px] truncate text-xs text-blue-300",children:e.evmAddress}),(0,n.jsx)(k,{text:e.evmAddress,small:!0})]})}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.coreBalance||"—"}),(0,n.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-300",children:e.evmBalance||"—"}),V&&(0,n.jsx)("td",{className:"px-3 py-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("code",{className:"max-w-[120px] truncate text-xs text-slate-400",children:e.privateKey}),(0,n.jsx)(k,{text:e.privateKey,small:!0})]})})]},e.index))})]})}),es.length>5&&(0,n.jsx)("button",{type:"button",className:"btn-secondary w-full text-center text-xs",onClick:()=>z(e=>!e),children:U?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g.Z,{className:"mr-1 inline h-3.5 w-3.5"}),"Show less"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.Z,{className:"mr-1 inline h-3.5 w-3.5"}),"Show all ",es.length," accounts"]})})]})]}),(ei.error||er.error||ec.error||ed.error)&&(0,n.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-4 py-2 text-sm text-red-400",children:String(null!==(R=null!==(M=null!==(E=ei.error)&&void 0!==E?E:er.error)&&void 0!==M?M:ec.error)&&void 0!==R?R:ed.error)})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return v},SX:function(){return x},Vp:function(){return m},fA:function(){return p},mI:function(){return h}});var n,a=s(2608);let l="".concat(null!==(n=a.env.NEXT_PUBLIC_API_URL)&&void 0!==n?n:"","/api");async function i(e,t,s){let n=await fetch("".concat(l).concat(t),{method:e,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!n.ok){var a;throw Error(null!==(a=(await n.json().catch(()=>({error:n.statusText}))).error)&&void 0!==a?a:n.statusText)}return n.json()}let r=e=>i("GET",e),c=(e,t)=>i("POST",e,t),d=e=>i("DELETE",e),o=(e,t)=>i("PUT",e,t),u={status:()=>r("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe")},x={list:()=>r("/accounts"),faucet:()=>r("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},m={templates:()=>r("/contracts/templates"),template:e=>r("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>r("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>d("/contracts/deployed/".concat(e)),call:(e,t,s,n)=>c("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:n})},h={status:()=>r("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},p={config:()=>r("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>r("/network/rpc-urls")},v={status:()=>r("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>r("/keystore/wallets"),addWallet:(e,t)=>c("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>c("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))}},3634:function(e,t,s){"use strict";s.d(t,{h:function(){return i}});var n=s(7903),a=s(2608);let l=null;function i(){if(!l){var e;let t=null!==(e=a.env.NEXT_PUBLIC_WS_URL)&&void 0!==e?e:"";l=(0,n.io)(t||void 0,{path:"/socket.io",reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:Number.POSITIVE_INFINITY})}return l}},5710:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},758:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},6804:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]])},7201:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},3948:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5175:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3737:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},2846:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},9924:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},6444:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(3035).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},function(e){e.O(0,[363,826,285,749,744],function(){return e(e.s=1134)}),_N_E=e.O()}]);