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.
- package/README.md +102 -0
- package/dist/cli.js +16338 -0
- package/package.json +55 -0
- package/ui/out/404/index.html +1 -0
- package/ui/out/404.html +1 -0
- package/ui/out/_next/static/--YsNpX1nEj74gOnGiYDR/_buildManifest.js +1 -0
- package/ui/out/_next/static/--YsNpX1nEj74gOnGiYDR/_ssgManifest.js +1 -0
- package/ui/out/_next/static/-7MZn09F75tC02XxCAzYQ/_buildManifest.js +1 -0
- package/ui/out/_next/static/-7MZn09F75tC02XxCAzYQ/_ssgManifest.js +1 -0
- package/ui/out/_next/static/-Yup9TU2qbfFuEoVK7cV3/_buildManifest.js +1 -0
- package/ui/out/_next/static/-Yup9TU2qbfFuEoVK7cV3/_ssgManifest.js +1 -0
- package/ui/out/_next/static/2FNwKfitLrla-BD4Pvi7U/_buildManifest.js +1 -0
- package/ui/out/_next/static/2FNwKfitLrla-BD4Pvi7U/_ssgManifest.js +1 -0
- package/ui/out/_next/static/3dg2q5Zn_zf7tMeBD4-2x/_buildManifest.js +1 -0
- package/ui/out/_next/static/3dg2q5Zn_zf7tMeBD4-2x/_ssgManifest.js +1 -0
- package/ui/out/_next/static/EMBrL2fIteEXHVOa9QqbR/_buildManifest.js +1 -0
- package/ui/out/_next/static/EMBrL2fIteEXHVOa9QqbR/_ssgManifest.js +1 -0
- package/ui/out/_next/static/HC9l66u-S82fZ45n1NJvV/_buildManifest.js +1 -0
- package/ui/out/_next/static/HC9l66u-S82fZ45n1NJvV/_ssgManifest.js +1 -0
- package/ui/out/_next/static/JDizq7Hn5WLnElAxCtqyg/_buildManifest.js +1 -0
- package/ui/out/_next/static/JDizq7Hn5WLnElAxCtqyg/_ssgManifest.js +1 -0
- package/ui/out/_next/static/KVufTmdF91v3IsRvyub2i/_buildManifest.js +1 -0
- package/ui/out/_next/static/KVufTmdF91v3IsRvyub2i/_ssgManifest.js +1 -0
- package/ui/out/_next/static/UVWp8ZgmXIqxga6tJZU2j/_buildManifest.js +1 -0
- package/ui/out/_next/static/UVWp8ZgmXIqxga6tJZU2j/_ssgManifest.js +1 -0
- package/ui/out/_next/static/WVZ0izyd9YpKZhSNF1OSe/_buildManifest.js +1 -0
- package/ui/out/_next/static/WVZ0izyd9YpKZhSNF1OSe/_ssgManifest.js +1 -0
- package/ui/out/_next/static/_jTgcoBsv_xqKZx36-jrD/_buildManifest.js +1 -0
- package/ui/out/_next/static/_jTgcoBsv_xqKZx36-jrD/_ssgManifest.js +1 -0
- package/ui/out/_next/static/_tUKGLiPpF-Ioygkq7-R9/_buildManifest.js +1 -0
- package/ui/out/_next/static/_tUKGLiPpF-Ioygkq7-R9/_ssgManifest.js +1 -0
- package/ui/out/_next/static/chunks/205-997c9580ac2ccb04.js +1 -0
- package/ui/out/_next/static/chunks/238-baf384d341a98f9f.js +1 -0
- package/ui/out/_next/static/chunks/363-11ecfe8307834c37.js +1 -0
- package/ui/out/_next/static/chunks/363-fd3f659dc66a2545.js +1 -0
- package/ui/out/_next/static/chunks/383-30e544e3db85d4b4.js +1 -0
- package/ui/out/_next/static/chunks/396-0d45f2627ca2432c.js +1 -0
- package/ui/out/_next/static/chunks/396-de3171781a3c5f52.js +1 -0
- package/ui/out/_next/static/chunks/476-1a499832716820dd.js +1 -0
- package/ui/out/_next/static/chunks/5b8f0dd8-7fc232be3e483640.js +1 -0
- package/ui/out/_next/static/chunks/5b8f0dd8-f9bbf8f44d8e6302.js +1 -0
- package/ui/out/_next/static/chunks/606-d510a7806cc50e18.js +1 -0
- package/ui/out/_next/static/chunks/628-ae8f2280d891101c.js +1 -0
- package/ui/out/_next/static/chunks/69-a23845cfa4a23071.js +1 -0
- package/ui/out/_next/static/chunks/706-142eb06ca4e1b468.js +1 -0
- package/ui/out/_next/static/chunks/749-27e561f3f17b1ad3.js +2 -0
- package/ui/out/_next/static/chunks/749-bd8c206e8e58f8b0.js +2 -0
- package/ui/out/_next/static/chunks/781-7af4662532da98ca.js +1 -0
- package/ui/out/_next/static/chunks/815-ab30cec2ff88e700.js +1 -0
- package/ui/out/_next/static/chunks/826-c38d836f8f2bac38.js +1 -0
- package/ui/out/_next/static/chunks/903-2887fe814dfa6d5e.js +1 -0
- package/ui/out/_next/static/chunks/app/_not-found/page-1a3d8ff7bd6fafe6.js +1 -0
- package/ui/out/_next/static/chunks/app/_not-found/page-fe94df087cbbeedb.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-21a02cc8bbbce9cf.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-2bf2eeddfcc46fd2.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-4fb77d9b03c79ef0.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-840e013892222293.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-8828d6c27ee45d5e.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-a5a4d066c57c6eba.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-cd6edb16de77e73a.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-ce44f544affcbb2e.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-f26a4c8967b60c31.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-fc53feb7e5bf6a0b.js +1 -0
- package/ui/out/_next/static/chunks/app/accounts/page-fe5a9daa4d22e115.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-091eba53f5dcb62b.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-265c4f26532b42ce.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-26c527bf8b829de6.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-53e2d2d715f76290.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-56d74025e6315a3d.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-844c9f55a6ec9218.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-88416cc33eabdddb.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-9361399f80e19ab7.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-afebd14c1ae73ec9.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-b0f74db982762c7e.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-d88227b11f5ac4f6.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-e454dad9b03f36df.js +1 -0
- package/ui/out/_next/static/chunks/app/contracts/page-f269686063be5d4b.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-0bf0ed51d0d1d3e8.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-56f011c6a6b2930f.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-7422dc714ea7b763.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-88938a963d68eb45.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-a1d424de4fc1d283.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-add77f8e78dbfbf5.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-c087511efc77c1ef.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-eaaaddaebabc1e84.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-ecbbc3f527378bf4.js +1 -0
- package/ui/out/_next/static/chunks/app/layout-f8c5fec65e6ca0ff.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-14579efdb2e8f6c3.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-1e273a4949e2b650.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-2d151bdd475474f6.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-43cfe0d01f696e96.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-4ab3daab428e05f1.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-64c88d55a5788e20.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-79e2f952fc54ff89.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-8305d73847b829c9.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-ab0458f12921230c.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-ac2a555e62327efe.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-bb3068075a8088dd.js +1 -0
- package/ui/out/_next/static/chunks/app/mining/page-d4bad0ff79dd463a.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-3d5fbcf1eb37e0c5.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-4b692d29a3e609a8.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-5e33fbeb3a40de20.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-62a4488ea3bc2526.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-97cebccc451eb5c6.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-a50ebf9988b322b5.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-d7c0ceaa242f38f9.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-e152fafa7a4d7361.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-eea297c1ae180bda.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-f3c51db982b5a388.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-f51d9ab619db1c20.js +1 -0
- package/ui/out/_next/static/chunks/app/network/page-f6b4c10c7d87957f.js +1 -0
- package/ui/out/_next/static/chunks/app/page-165b6a1747a64947.js +1 -0
- package/ui/out/_next/static/chunks/app/page-348c96e8d45c2559.js +1 -0
- package/ui/out/_next/static/chunks/app/page-3632f4f09f69c905.js +1 -0
- package/ui/out/_next/static/chunks/app/page-36afbe5e1cb8094f.js +1 -0
- package/ui/out/_next/static/chunks/app/page-557bd6270c5ad579.js +1 -0
- package/ui/out/_next/static/chunks/app/page-6d79f31ac0288bac.js +1 -0
- package/ui/out/_next/static/chunks/app/page-71fcaf2853c53e30.js +1 -0
- package/ui/out/_next/static/chunks/app/page-90d8520902c1a7b0.js +1 -0
- package/ui/out/_next/static/chunks/app/page-c430d30cb894c926.js +1 -0
- package/ui/out/_next/static/chunks/app/page-ce0f985468520dbc.js +1 -0
- package/ui/out/_next/static/chunks/app/page-f0dced734181e611.js +1 -0
- package/ui/out/_next/static/chunks/app/page-f27633bfbc515249.js +1 -0
- package/ui/out/_next/static/chunks/app/page-f7be59ea4e13f436.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-11fb46a5f4a8b0be.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-26003843604c7c8c.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-7041ba96cf94b9d6.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-716e9207662cbb13.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-74cdd3297d391701.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-766c3286d7fc1fbb.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-a3e3f3f091deed13.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-fb7030a6672345f4.js +1 -0
- package/ui/out/_next/static/chunks/app/wallet/page-feeafe9afcd3702d.js +1 -0
- package/ui/out/_next/static/chunks/framework-bef83a85c94ff7de.js +1 -0
- package/ui/out/_next/static/chunks/main-764c1d152dd64cdb.js +1 -0
- package/ui/out/_next/static/chunks/main-app-565ce517a559065d.js +1 -0
- package/ui/out/_next/static/chunks/pages/_app-32ee63fa91347547.js +1 -0
- package/ui/out/_next/static/chunks/pages/_error-79ee453ce9bad74d.js +1 -0
- package/ui/out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/ui/out/_next/static/chunks/webpack-ea02740f160b546a.js +1 -0
- package/ui/out/_next/static/css/0f4a493f8c2c55db.css +3 -0
- package/ui/out/_next/static/css/4169c0d861da624d.css +3 -0
- package/ui/out/_next/static/css/42c642225833b63d.css +3 -0
- package/ui/out/_next/static/css/4ec6b37afd49be73.css +3 -0
- package/ui/out/_next/static/css/6a8f3e28ef1137c2.css +3 -0
- package/ui/out/_next/static/css/6bbaea3800a74df9.css +3 -0
- package/ui/out/_next/static/css/73f87001fc8b2a52.css +3 -0
- package/ui/out/_next/static/css/90ccf9db21744740.css +3 -0
- package/ui/out/_next/static/css/9f0d4e440a0f0806.css +3 -0
- package/ui/out/_next/static/css/b1a2c26b7bd10f8d.css +3 -0
- package/ui/out/_next/static/css/c97b9630f605a98b.css +3 -0
- package/ui/out/_next/static/css/e5751e31c7620a6e.css +3 -0
- package/ui/out/_next/static/ezlluEQnUi2an273EFR3C/_buildManifest.js +1 -0
- package/ui/out/_next/static/ezlluEQnUi2an273EFR3C/_ssgManifest.js +1 -0
- package/ui/out/_next/static/ghzWYfWuW8Y8XavA7qfLx/_buildManifest.js +1 -0
- package/ui/out/_next/static/ghzWYfWuW8Y8XavA7qfLx/_ssgManifest.js +1 -0
- package/ui/out/_next/static/hzvSbCbk7BhWq0LE5xqx1/_buildManifest.js +1 -0
- package/ui/out/_next/static/hzvSbCbk7BhWq0LE5xqx1/_ssgManifest.js +1 -0
- package/ui/out/_next/static/p4x_NRy3wdFgXa-RI9_BQ/_buildManifest.js +1 -0
- package/ui/out/_next/static/p4x_NRy3wdFgXa-RI9_BQ/_ssgManifest.js +1 -0
- package/ui/out/_next/static/uKnkegMpJr2nHM4qD8J3D/_buildManifest.js +1 -0
- package/ui/out/_next/static/uKnkegMpJr2nHM4qD8J3D/_ssgManifest.js +1 -0
- package/ui/out/_next/static/vAN91b7edxmzrsDueacJ6/_buildManifest.js +1 -0
- package/ui/out/_next/static/vAN91b7edxmzrsDueacJ6/_ssgManifest.js +1 -0
- package/ui/out/accounts/index.html +1 -0
- package/ui/out/accounts/index.txt +9 -0
- package/ui/out/contracts/index.html +1 -0
- package/ui/out/contracts/index.txt +9 -0
- package/ui/out/index.html +1 -0
- package/ui/out/index.txt +9 -0
- package/ui/out/mining/index.html +1 -0
- package/ui/out/mining/index.txt +9 -0
- package/ui/out/network/index.html +1 -0
- package/ui/out/network/index.txt +9 -0
- package/ui/out/wallet/index.html +1 -0
- package/ui/out/wallet/index.txt +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,a){Promise.resolve().then(a.bind(a,7596))},7596:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return v}});var s=a(5853),n=a(4852),r=a(8990),l=a(6632),c=a(4254),i=a(9928),o=a(3264),d=a(3035);let p=(0,d.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var x=a(6970),u=a(1494);let m=(0,d.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),h=(0,d.Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var y=a(9924),f=a(8144);function g(e){let{text:t}=e,[a,n]=(0,c.useState)(!1);return(0,s.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:a?(0,s.jsx)(i.Z,{className:"h-3 w-3 text-green-400"}):(0,s.jsx)(o.Z,{className:"h-3 w-3"})})}function v(){let e=(0,n.NL)(),[t,a]=(0,c.useState)("templates"),[i,o]=(0,c.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[d,v]=(0,c.useState)("HelloWorld"),[j,N]=(0,c.useState)(null),[b,k]=(0,c.useState)("evm"),[w,C]=(0,c.useState)(""),[S,Z]=(0,c.useState)(""),[E,D]=(0,c.useState)(""),{data:M}=(0,r.a)({queryKey:["node","status"],queryFn:f.N9.status,refetchInterval:3e3}),q=(null==M?void 0:M.server)==="running",{data:V=[]}=(0,r.a)({queryKey:["contracts","templates"],queryFn:f.Vp.templates}),{data:T=[],isLoading:L}=(0,r.a)({queryKey:["contracts","deployed"],queryFn:()=>f.Vp.deployed(),refetchInterval:5e3}),H=(0,l.D)({mutationFn:()=>f.Vp.compile(i,d),onSuccess:e=>N(e)}),I=(0,l.D)({mutationFn:()=>{if(!j)throw Error("Compile first");if(!q)throw Error("Node is not running. Start it from the Dashboard first.");let e=[];if(w.trim())try{e=JSON.parse(w)}catch(e){throw Error("Invalid JSON for constructor args")}return f.Vp.deploy({bytecode:j.bytecode,abi:j.abi,args:e,chain:b,contractName:j.contractName})},onSuccess:t=>{Z("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);Z("✗ ".concat(t))}}),P=(0,l.D)({mutationFn:f.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function _(e){D("");try{let t=await f.Vp.template(e);o(t.source),v(e),a("custom"),N(null),Z("")}catch(e){D(e instanceof Error?e.message:"Failed to load template")}}return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),M&&!q&&(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,s.jsx)(p,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),E&&(0,s.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:E}),(0,s.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,s.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>a(e),children:"deployed"===e?"Deployed".concat(T.length>0?" (".concat(T.length,")"):""):e},e))}),"templates"===t&&(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:V.map(e=>(0,s.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,s.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,s.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,s.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>_(e.name),children:"Use"})]},e.name))}),"custom"===t&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Solidity Source"}),(0,s.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:i,onChange:e=>{o(e.target.value),N(null)}})]}),(0,s.jsxs)("div",{className:"flex items-end gap-3",children:[(0,s.jsxs)("div",{className:"w-48",children:[(0,s.jsx)("label",{className:"label",children:"Contract Name"}),(0,s.jsx)("input",{className:"input",value:d,onChange:e=>v(e.target.value)})]}),(0,s.jsxs)("button",{type:"button",className:"btn-secondary",disabled:H.isPending,onClick:()=>H.mutate(),children:[(0,s.jsx)(u.Z,{className:"h-4 w-4"}),H.isPending?"Compiling…":"Compile"]})]}),H.error&&(0,s.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:H.error.message}),j&&(0,s.jsxs)("div",{className:"card space-y-3",children:[(0,s.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",j.contractName," (",j.abi.length," ABI entries)"]}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"label",children:"Constructor Args (JSON array)"}),(0,s.jsx)("input",{className:"input",value:w,onChange:e=>C(e.target.value),placeholder:'e.g. ["Hello", 42]'})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Chain"}),(0,s.jsxs)("select",{className:"input",value:b,onChange:e=>k(e.target.value),children:[(0,s.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,s.jsx)("option",{value:"core",children:"Core Space"})]})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{type:"button",className:"btn-primary",disabled:I.isPending||!q,title:q?void 0:"Start the node first",onClick:()=>I.mutate(),children:[(0,s.jsx)(m,{className:"h-4 w-4"}),I.isPending?"Deploying…":"Deploy"]})})]}),S&&(0,s.jsx)("p",{className:"break-all text-sm ".concat(S.startsWith("✓")?"text-green-400":"text-red-400"),children:S})]})]}),"deployed"===t&&(0,s.jsx)("div",{className:"space-y-3",children:L?(0,s.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===T.length?(0,s.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,s.jsx)("div",{className:"space-y-2",children:T.map(e=>(0,s.jsxs)("div",{className:"card space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,s.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,s.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,s.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,s.jsx)(g,{text:e.address})]}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,s.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,s.jsx)("span",{children:"•"}),(0,s.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,s.jsx)("span",{children:"•"}),(0,s.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 gap-1",children:[(0,s.jsx)("a",{href:"http://localhost:".concat("evm"===e.chain?"8545":"12537"),target:"_blank",rel:"noreferrer",title:"Open RPC endpoint",className:"rounded p-1 text-slate-500 hover:text-slate-300",children:(0,s.jsx)(h,{className:"h-3.5 w-3.5"})}),(0,s.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:P.isPending,onClick:()=>P.mutate(e.id),children:(0,s.jsx)(y.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 border-t border-[#2a3147] pt-2",children:[(0,s.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,s.jsx)("code",{className:"max-w-[300px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,s.jsx)(g,{text:e.txHash})]})]},e.id))})]})})]})}},8144:function(e,t,a){"use strict";a.d(t,{N9:function(){return p},SC:function(){return y},SX:function(){return x},Vp:function(){return u},fA:function(){return h},mI:function(){return m}});var s,n=a(2608);let r="".concat(null!==(s=n.env.NEXT_PUBLIC_API_URL)&&void 0!==s?s:"","/api");async function l(e,t,a){let s=await fetch("".concat(r).concat(t),{method:e,headers:a?{"Content-Type":"application/json"}:void 0,body:a?JSON.stringify(a):void 0});if(!s.ok){var n;throw Error(null!==(n=(await s.json().catch(()=>({error:s.statusText}))).error)&&void 0!==n?n:s.statusText)}return s.json()}let c=e=>l("GET",e),i=(e,t)=>l("POST",e,t),o=e=>l("DELETE",e),d=(e,t)=>l("PUT",e,t),p={status:()=>c("/node/status"),start:()=>i("/node/start"),stop:()=>i("/node/stop"),restart:()=>i("/node/restart"),restartWipe:()=>i("/node/restart-wipe")},x={list:()=>c("/accounts"),faucet:()=>c("/accounts/faucet"),fund:(e,t,a)=>i("/accounts/fund",{address:e,amount:t,chain:a})},u={templates:()=>c("/contracts/templates"),template:e=>c("/contracts/templates/".concat(e)),compile:(e,t)=>i("/contracts/compile",{source:e,contractName:t}),deploy:e=>i("/contracts/deploy",e),deployed:e=>c("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>o("/contracts/deployed/".concat(e))},m={status:()=>c("/mining/status"),mine:e=>i("/mining/mine",{blocks:e}),start:e=>i("/mining/start",{intervalMs:e}),stop:()=>i("/mining/stop")},h={config:()=>c("/network/config"),updateConfig:e=>d("/network/config",e),rpcUrls:()=>c("/network/rpc-urls")},y={status:()=>c("/keystore/status"),generate:()=>i("/keystore/generate"),setup:e=>i("/keystore/setup",e),unlock:e=>i("/keystore/unlock",{password:e}),lock:()=>i("/keystore/lock"),wallets:()=>c("/keystore/wallets"),addWallet:(e,t)=>i("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>i("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>o("/keystore/wallets/".concat(e))}},9928:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(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,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(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"}]])},6970:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},9924:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(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"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,3811))},3811:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return E}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),i=s(5227),c=s(9928),o=s(3264),d=s(1464),u=s(6970),x=s(1494),m=s(8386),p=s(9924),h=s(758),g=s(5710),f=s(4254),v=s(3916),y=s(3368),b=s(9510),j=s(8144);let N={HelloWorld:{tags:["state","string"],ctor:"none",difficulty:"beginner"},SimpleStorage:{tags:["state","ownership","events"],ctor:"initialValue (uint256)",difficulty:"beginner"},Counter:{tags:["state","ownership","events","modifier"],ctor:"none",difficulty:"beginner"},TestToken:{tags:["ERC-20","token","mint","burn"],ctor:"name, symbol, initialSupply",difficulty:"beginner"},BasicNFT:{tags:["ERC-721","NFT","token","approval"],ctor:"name, symbol",difficulty:"intermediate"},Voting:{tags:["governance","struct","delegation"],ctor:"proposalNames (string[])",difficulty:"intermediate"},Escrow:{tags:["payments","payable","state machine"],ctor:"arbiter (address), beneficiary (address)",difficulty:"intermediate"},MultiSigWallet:{tags:["multisig","governance","wallet"],ctor:"owners (address[]), required (uint256)",difficulty:"advanced"},Registry:{tags:["registry","mapping","hashing"],ctor:"none",difficulty:"intermediate"}},w={beginner:"text-green-400 bg-green-900/30 border-green-800",intermediate:"text-yellow-400 bg-yellow-900/30 border-yellow-800",advanced:"text-orange-400 bg-orange-900/30 border-orange-800"};function k(e){var t,s,n,l,r,c,o;let{fn:d,contractId:u,chain:x,accounts:m,isRead:p}=e,[h,g]=(0,f.useState)(null!==(l=null===(t=d.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[v,y]=(0,f.useState)(0),[b,N]=(0,f.useState)(null),[w,k]=(0,f.useState)(!1);async function S(){k(!0),N(null);try{var e;let t=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),s=await j.Vp.call(u,null!==(e=d.name)&&void 0!==e?e:"",t,p?void 0:v);N({ok:!0,value:s})}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{k(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[d.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=d.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",d.outputs&&d.outputs.length>0?" → ".concat(d.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(c=null===(n=d.inputs)||void 0===n?void 0:n.length)&&void 0!==c?c:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:(null!==(o=d.inputs)&&void 0!==o?o:[]).map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>g(s=>{let a=[...s];return a[t]=e.target.value,a})})]},"".concat(e.name,"-").concat(t)))}),!p&&m.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:v,onChange:e=>y(Number(e.target.value)),children:m.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," —"," ","evm"===x?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:p?"btn-secondary":"btn-primary",disabled:w,onClick:S,children:w?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(i.Z,{className:"h-3.5 w-3.5 animate-spin"}),p?"Reading…":"Sending…"]}):p?"Call":"Send"}),b&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(b.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:b.ok?JSON.stringify(b.value,null,2):b.error})]})}function S(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(k,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(k,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function C(e){let{text:t}=e,[s,n]=(0,f.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(c.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(o.Z,{className:"h-3 w-3"})})}function E(){let e=(0,n.NL)(),[t,s]=(0,f.useState)("templates"),[i,c]=(0,f.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[o,k]=(0,f.useState)("HelloWorld"),[E,T]=(0,f.useState)(null),[D,F]=(0,f.useState)("evm"),[I,L]=(0,f.useState)(0),[P,R]=(0,f.useState)([]),[q,A]=(0,f.useState)(""),[W,Z]=(0,f.useState)(""),[_,V]=(0,f.useState)(new Set),{data:M}=(0,l.a)({queryKey:["node","status"],queryFn:j.N9.status,refetchInterval:3e3}),B=(null==M?void 0:M.server)==="running",{data:z=[]}=(0,l.a)({queryKey:["accounts"],queryFn:j.SX.list,enabled:B}),{data:H=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:j.Vp.templates}),{data:O=[],isLoading:J}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>j.Vp.deployed(),refetchInterval:5e3}),U=(0,r.D)({mutationFn:()=>j.Vp.compile(i,o),onSuccess:e=>{var t,s;T(e),R((null!==(s=null===(t=e.abi.find(e=>"constructor"===e.type))||void 0===t?void 0:t.inputs)&&void 0!==s?s:[]).map(()=>"")),A("")}}),K=(0,r.D)({mutationFn:()=>{var e,t;if(!E)throw Error("Compile first");if(!B)throw Error("Node is not running. Start it from the Dashboard first.");let s=(null!==(t=null===(e=E.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[]).map((e,t)=>{var s;let a=(null!==(s=P[t])&&void 0!==s?s:"").trim();if(!a)return"";try{return JSON.parse(a)}catch(e){return a}});return j.Vp.deploy({bytecode:E.bytecode,abi:E.abi,args:s,chain:D,accountIndex:I,contractName:E.contractName})},onSuccess:t=>{A("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);A("✗ ".concat(t))}}),X=(0,r.D)({mutationFn:j.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function Q(e){Z("");try{let t=await j.Vp.template(e);c(t.source),k(e),s("custom"),T(null),A("");let a=document.getElementById("btn-use-".concat(e));if(a){let e=a.innerText;a.innerText="Loaded!",a.classList.add("text-cfx-400"),setTimeout(()=>{a.innerText=e,a.classList.remove("text-cfx-400")},1500)}}catch(e){Z(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),M&&!B&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),W&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:W}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(O.length>0?" (".concat(O.length,")"):""):e},e))}),"templates"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["Click ",(0,a.jsx)("span",{className:"text-slate-300",children:"Use"})," to load a template into the Editor. All contracts are pure Solidity — no external dependencies."]}),(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:H.map(e=>{let t=N[e.name];return(0,a.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 shrink-0 text-blue-400"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:e.name}),t&&(0,a.jsx)("span",{className:"rounded border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider ".concat(w[t.difficulty]),children:t.difficulty})]}),e.description&&(0,a.jsx)("p",{className:"mt-1.5 text-xs text-slate-400 leading-relaxed",children:e.description})]}),(0,a.jsx)(y.z,{id:"btn-use-".concat(e.name),variant:"secondary",size:"sm",className:"shrink-0 text-xs transition-all",onClick:()=>Q(e.name),children:"Use template"})]}),(null==t?void 0:t.tags)&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:t.tags.map(e=>(0,a.jsx)("span",{className:"rounded bg-[#1e2535] px-1.5 py-0.5 text-[10px] text-slate-400",children:e},e))}),(null==t?void 0:t.ctor)&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-slate-500",children:[(0,a.jsx)("span",{className:"font-mono text-slate-600",children:"constructor"}),(0,a.jsx)("span",{className:"text-slate-600",children:"\xb7"}),(0,a.jsx)("span",{className:"font-mono",children:t.ctor})]})]},e.name)})})]}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(b._,{className:"text-sm font-semibold text-slate-200",children:"Solidity Source"}),(0,a.jsx)("div",{className:"h-[500px] rounded-lg border border-slate-800 overflow-hidden shadow-sm",children:(0,a.jsx)(v.ZP,{height:"100%",defaultLanguage:"solidity",theme:"vs-dark",value:i,onChange:e=>{c(e||""),T(null)},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,tabSize:4,padding:{top:16,bottom:16},smoothScrolling:!0,cursorBlinking:"smooth",fontFamily:"'JetBrains Mono', 'Fira Code', 'Monaco', monospace"}})})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:o,onChange:e=>k(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:U.isPending,onClick:()=>U.mutate(),children:[(0,a.jsx)(x.Z,{className:"h-4 w-4"}),U.isPending?"Compiling…":"Compile"]})]}),U.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:U.error.message}),E&&(()=>{var e,t;let s=null!==(t=null===(e=E.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[],n=s.some((e,t)=>{var s;return!(null!==(s=P[t])&&void 0!==s?s:"").trim()});return(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",E.contractName," (",E.abi.length," ","ABI entries)"]}),s.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-400",children:"Constructor arguments"}),s.map((e,t)=>{var s;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:null!==(s=P[t])&&void 0!==s?s:"",onChange:e=>R(s=>{let a=[...s];return a[t]=e.target.value,a})})]},"".concat(e.name,"-").concat(t))}),n&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-xs text-yellow-400",children:[(0,a.jsx)(d.Z,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,a.jsxs)("span",{children:["Fill all constructor arguments before deploying. Missing:"," ",s.filter((e,t)=>{var s;return!(null!==(s=P[t])&&void 0!==s?s:"").trim()}).map((e,t,s)=>"".concat(e.name||"arg"," (").concat(e.type,")")).join(", ")]})]})]}):(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"No constructor arguments required."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:D,onChange:e=>F(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),B&&z.length>0&&(0,a.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,a.jsx)("label",{className:"label",children:"Deployer account"}),(0,a.jsx)("select",{className:"input",value:I,onChange:e=>L(Number(e.target.value)),children:z.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," —"," ","evm"===D?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:K.isPending||!B||s.length>0&&n,title:B?n?"Fill all constructor arguments first":void 0:"Start the node first",onClick:()=>K.mutate(),children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),K.isPending?"Deploying…":"Deploy"]})})]}),q&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(q.startsWith("✓")?"text-green-400":"text-red-400"),children:q})]})})()]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:J?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===O.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:O.map(e=>{let t=_.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(C,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(C,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:X.isPending,onClick:()=>X.mutate(e.id),children:(0,a.jsx)(p.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(C,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>V(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(S,{contract:e,accounts:z})]},e.id)})})]})})]})}},3368:function(e,t,s){"use strict";s.d(t,{z:function(){return o}});var a=s(5853),n=s(4254),l=s(1145),r=s(5460),i=s(8337);let c=(0,r.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"}}),o=n.forwardRef((e,t)=>{let{className:s,variant:n,size:r,asChild:o=!1,...d}=e,u=o?l.g7:"button";return(0,a.jsx)(u,{className:(0,i.cn)(c({variant:n,size:r,className:s})),ref:t,...d})});o.displayName="Button"},9510:function(e,t,s){"use strict";s.d(t,{_:function(){return o}});var a=s(5853),n=s(4254),l=s(5307),r=s(5460),i=s(8337);let c=(0,r.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-slate-300"),o=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.f,{ref:t,className:(0,i.cn)(c(),s),...n})});o.displayName=l.f.displayName},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return x},SC:function(){return f},SX:function(){return m},Vp:function(){return p},fA:function(){return g},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 r(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 i=e=>r("GET",e),c=(e,t)=>r("POST",e,t),o=e=>r("DELETE",e),d=(e,t)=>r("PUT",e,t),u=(e,t)=>r("PATCH",e,t),x={status:()=>i("/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:()=>i("/accounts"),faucet:()=>i("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},p={templates:()=>i("/contracts/templates"),template:e=>i("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>i("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>o("/contracts/deployed/".concat(e)),call:(e,t,s,a)=>c("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:a})},h={status:()=>i("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},g={config:()=>i("/network/config"),updateConfig:e=>d("/network/config",e),rpcUrls:()=>i("/network/rpc-urls")},f={status:()=>i("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>i("/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=>o("/keystore/wallets/".concat(e))},v={get:()=>i("/settings")}},8337:function(e,t,s){"use strict";s.d(t,{cn:function(){return l}});var a=s(4685),n=s(4004);function l(){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))}}},function(e){e.O(0,[363,69,476,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,9985))},9985:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return k}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),i=s(4254),c=s(3035);let d=(0,c.Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var o=s(9928),u=s(3264);let x=(0,c.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var p=s(6970),m=s(1494);let h=(0,c.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var y=s(9924),v=s(758),j=s(5710),g=s(8144);function f(e){var t,s,n,l,r,c;let{fn:o,contractId:u,chain:x,accounts:p,isRead:m}=e,[h,y]=(0,i.useState)(null!==(l=null===(t=o.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[v,j]=(0,i.useState)(0),[f,N]=(0,i.useState)(null),[b,k]=(0,i.useState)(!1);async function w(){k(!0),N(null);try{let e=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),t=await g.Vp.call(u,o.name,e,m?void 0:v);N({ok:!0,value:t})}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{k(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[o.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=o.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",o.outputs&&o.outputs.length>0?" → ".concat(o.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(c=null===(n=o.inputs)||void 0===n?void 0:n.length)&&void 0!==c?c:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:o.inputs.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>y(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t))}),!m&&p.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:v,onChange:e=>j(Number(e.target.value)),children:p.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===x?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:m?"btn-secondary":"btn-primary",disabled:b,onClick:w,children:b?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(d,{className:"h-3.5 w-3.5 animate-spin"}),m?"Reading…":"Sending…"]}):m?"Call":"Send"}),f&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(f.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:f.ok?JSON.stringify(f.value,null,2):f.error})]})}function N(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(f,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(f,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function b(e){let{text:t}=e,[s,n]=(0,i.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(o.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(u.Z,{className:"h-3 w-3"})})}function k(){let e=(0,n.NL)(),[t,s]=(0,i.useState)("templates"),[c,d]=(0,i.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[o,u]=(0,i.useState)("HelloWorld"),[f,k]=(0,i.useState)(null),[w,C]=(0,i.useState)("evm"),[S,Z]=(0,i.useState)(0),[M,D]=(0,i.useState)([]),[q,E]=(0,i.useState)(""),[I,V]=(0,i.useState)(""),[A,F]=(0,i.useState)(new Set),{data:L}=(0,l.a)({queryKey:["node","status"],queryFn:g.N9.status,refetchInterval:3e3}),T=(null==L?void 0:L.server)==="running",{data:P=[]}=(0,l.a)({queryKey:["accounts"],queryFn:g.SX.list,enabled:T}),{data:_=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:g.Vp.templates}),{data:H=[],isLoading:R}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>g.Vp.deployed(),refetchInterval:5e3}),W=(0,r.D)({mutationFn:()=>g.Vp.compile(c,o),onSuccess:e=>{var t,s;k(e),D((null!==(s=null===(t=e.abi.find(e=>"constructor"===e.type))||void 0===t?void 0:t.inputs)&&void 0!==s?s:[]).map(()=>"")),E("")}}),O=(0,r.D)({mutationFn:()=>{var e,t;if(!f)throw Error("Compile first");if(!T)throw Error("Node is not running. Start it from the Dashboard first.");let s=(null!==(t=null===(e=f.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[]).map((e,t)=>{var s;let a=(null!==(s=M[t])&&void 0!==s?s:"").trim();if(!a)return"";try{return JSON.parse(a)}catch(e){return a}});return g.Vp.deploy({bytecode:f.bytecode,abi:f.abi,args:s,chain:w,accountIndex:S,contractName:f.contractName})},onSuccess:t=>{E("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);E("✗ ".concat(t))}}),U=(0,r.D)({mutationFn:g.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function z(e){V("");try{let t=await g.Vp.template(e);d(t.source),u(e),s("custom"),k(null),E("")}catch(e){V(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),L&&!T&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(x,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),I&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:I}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(H.length>0?" (".concat(H.length,")"):""):e},e))}),"templates"===t&&(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:_.map(e=>(0,a.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,a.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>z(e.name),children:"Use"})]},e.name))}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:c,onChange:e=>{d(e.target.value),k(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:o,onChange:e=>u(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:W.isPending,onClick:()=>W.mutate(),children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),W.isPending?"Compiling…":"Compile"]})]}),W.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:W.error.message}),f&&(()=>{var e,t;let s=null!==(t=null===(e=f.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[],n=s.some((e,t)=>{var s;return!(null!==(s=M[t])&&void 0!==s?s:"").trim()});return(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",f.contractName," (",f.abi.length," ABI entries)"]}),s.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-400",children:"Constructor arguments"}),s.map((e,t)=>{var s;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:null!==(s=M[t])&&void 0!==s?s:"",onChange:e=>D(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t)}),n&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-xs text-yellow-400",children:[(0,a.jsx)(x,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,a.jsxs)("span",{children:["Fill all constructor arguments before deploying. Missing: ",s.filter((e,t)=>{var s;return!(null!==(s=M[t])&&void 0!==s?s:"").trim()}).map((e,t,s)=>"".concat(e.name||"arg"," (").concat(e.type,")")).join(", ")]})]})]}):(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"No constructor arguments required."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:w,onChange:e=>C(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),T&&P.length>0&&(0,a.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,a.jsx)("label",{className:"label",children:"Deployer account"}),(0,a.jsx)("select",{className:"input",value:S,onChange:e=>Z(Number(e.target.value)),children:P.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===w?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:O.isPending||!T||s.length>0&&n,title:T?n?"Fill all constructor arguments first":void 0:"Start the node first",onClick:()=>O.mutate(),children:[(0,a.jsx)(h,{className:"h-4 w-4"}),O.isPending?"Deploying…":"Deploy"]})})]}),q&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(q.startsWith("✓")?"text-green-400":"text-red-400"),children:q})]})})()]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:R?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===H.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:H.map(e=>{let t=A.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(b,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(b,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:U.isPending,onClick:()=>U.mutate(e.id),children:(0,a.jsx)(y.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(b,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>F(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(N,{contract:e,accounts:P})]},e.id)})})]})})]})}},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 p},fA:function(){return h},mI:function(){return m}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function r(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 i=e=>r("GET",e),c=(e,t)=>r("POST",e,t),d=e=>r("DELETE",e),o=(e,t)=>r("PUT",e,t),u={status:()=>i("/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:()=>i("/accounts"),faucet:()=>i("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},p={templates:()=>i("/contracts/templates"),template:e=>i("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>i("/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})},m={status:()=>i("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},h={config:()=>i("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>i("/network/rpc-urls")},y={status:()=>i("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>i("/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))}},9928:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},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"}]])},3264:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},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"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,3811))},3811:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return E}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),i=s(5227),c=s(9928),o=s(3264),d=s(1464),u=s(6970),x=s(1494),m=s(8386),p=s(9924),h=s(758),g=s(5710),f=s(4254),v=s(3916),y=s(3368),b=s(9510),j=s(8144);let N={HelloWorld:{tags:["state","string"],ctor:"none",difficulty:"beginner"},SimpleStorage:{tags:["state","ownership","events"],ctor:"initialValue (uint256)",difficulty:"beginner"},Counter:{tags:["state","ownership","events","modifier"],ctor:"none",difficulty:"beginner"},TestToken:{tags:["ERC-20","token","mint","burn"],ctor:"name, symbol, initialSupply",difficulty:"beginner"},BasicNFT:{tags:["ERC-721","NFT","token","approval"],ctor:"name, symbol",difficulty:"intermediate"},Voting:{tags:["governance","struct","delegation"],ctor:"proposalNames (string[])",difficulty:"intermediate"},Escrow:{tags:["payments","payable","state machine"],ctor:"arbiter (address), beneficiary (address)",difficulty:"intermediate"},MultiSigWallet:{tags:["multisig","governance","wallet"],ctor:"owners (address[]), required (uint256)",difficulty:"advanced"},Registry:{tags:["registry","mapping","hashing"],ctor:"none",difficulty:"intermediate"}},w={beginner:"text-green-400 bg-green-900/30 border-green-800",intermediate:"text-yellow-400 bg-yellow-900/30 border-yellow-800",advanced:"text-orange-400 bg-orange-900/30 border-orange-800"};function k(e){var t,s,n,l,r,c,o;let{fn:d,contractId:u,chain:x,accounts:m,isRead:p}=e,[h,g]=(0,f.useState)(null!==(l=null===(t=d.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[v,y]=(0,f.useState)(0),[b,N]=(0,f.useState)(null),[w,k]=(0,f.useState)(!1);async function S(){k(!0),N(null);try{var e;let t=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),s=await j.Vp.call(u,null!==(e=d.name)&&void 0!==e?e:"",t,p?void 0:v);N({ok:!0,value:s})}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{k(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[d.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=d.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",d.outputs&&d.outputs.length>0?" → ".concat(d.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(c=null===(n=d.inputs)||void 0===n?void 0:n.length)&&void 0!==c?c:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:(null!==(o=d.inputs)&&void 0!==o?o:[]).map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>g(s=>{let a=[...s];return a[t]=e.target.value,a})})]},"".concat(e.name,"-").concat(t)))}),!p&&m.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:v,onChange:e=>y(Number(e.target.value)),children:m.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," —"," ","evm"===x?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:p?"btn-secondary":"btn-primary",disabled:w,onClick:S,children:w?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(i.Z,{className:"h-3.5 w-3.5 animate-spin"}),p?"Reading…":"Sending…"]}):p?"Call":"Send"}),b&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(b.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:b.ok?JSON.stringify(b.value,null,2):b.error})]})}function S(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(k,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(k,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function C(e){let{text:t}=e,[s,n]=(0,f.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(c.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(o.Z,{className:"h-3 w-3"})})}function E(){let e=(0,n.NL)(),[t,s]=(0,f.useState)("templates"),[i,c]=(0,f.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[o,k]=(0,f.useState)("HelloWorld"),[E,T]=(0,f.useState)(null),[D,F]=(0,f.useState)("evm"),[I,P]=(0,f.useState)(0),[L,R]=(0,f.useState)([]),[q,A]=(0,f.useState)(""),[W,Z]=(0,f.useState)(""),[_,V]=(0,f.useState)(new Set),{data:M}=(0,l.a)({queryKey:["node","status"],queryFn:j.N9.status,refetchInterval:3e3}),B=(null==M?void 0:M.server)==="running",{data:O=[]}=(0,l.a)({queryKey:["accounts"],queryFn:j.SX.list,enabled:B}),{data:z=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:j.Vp.templates}),{data:H=[],isLoading:J}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>j.Vp.deployed(),refetchInterval:5e3}),U=(0,r.D)({mutationFn:()=>j.Vp.compile(i,o),onSuccess:e=>{var t,s;T(e),R((null!==(s=null===(t=e.abi.find(e=>"constructor"===e.type))||void 0===t?void 0:t.inputs)&&void 0!==s?s:[]).map(()=>"")),A("")}}),K=(0,r.D)({mutationFn:()=>{var e,t;if(!E)throw Error("Compile first");if(!B)throw Error("Node is not running. Start it from the Dashboard first.");let s=(null!==(t=null===(e=E.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[]).map((e,t)=>{var s;let a=(null!==(s=L[t])&&void 0!==s?s:"").trim();if(!a)return"";try{return JSON.parse(a)}catch(e){return a}});return j.Vp.deploy({bytecode:E.bytecode,abi:E.abi,args:s,chain:D,accountIndex:I,contractName:E.contractName})},onSuccess:t=>{A("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);A("✗ ".concat(t))}}),X=(0,r.D)({mutationFn:j.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function Q(e){Z("");try{let t=await j.Vp.template(e);c(t.source),k(e),s("custom"),T(null),A("");let a=document.getElementById("btn-use-".concat(e));if(a){let e=a.innerText;a.innerText="Loaded!",a.classList.add("text-cfx-400"),setTimeout(()=>{a.innerText=e,a.classList.remove("text-cfx-400")},1500)}}catch(e){Z(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),M&&!B&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),W&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:W}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(H.length>0?" (".concat(H.length,")"):""):e},e))}),"templates"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["Click ",(0,a.jsx)("span",{className:"text-slate-300",children:"Use"})," to load a template into the Editor. All contracts are pure Solidity — no external dependencies."]}),(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:z.map(e=>{let t=N[e.name];return(0,a.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 shrink-0 text-blue-400"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:e.name}),t&&(0,a.jsx)("span",{className:"rounded border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider ".concat(w[t.difficulty]),children:t.difficulty})]}),e.description&&(0,a.jsx)("p",{className:"mt-1.5 text-xs text-slate-400 leading-relaxed",children:e.description})]}),(0,a.jsx)(y.z,{id:"btn-use-".concat(e.name),variant:"secondary",size:"sm",className:"shrink-0 text-xs transition-all",onClick:()=>Q(e.name),children:"Use template"})]}),(null==t?void 0:t.tags)&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:t.tags.map(e=>(0,a.jsx)("span",{className:"rounded bg-[#1e2535] px-1.5 py-0.5 text-[10px] text-slate-400",children:e},e))}),(null==t?void 0:t.ctor)&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-slate-500",children:[(0,a.jsx)("span",{className:"font-mono text-slate-600",children:"constructor"}),(0,a.jsx)("span",{className:"text-slate-600",children:"\xb7"}),(0,a.jsx)("span",{className:"font-mono",children:t.ctor})]})]},e.name)})})]}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(b._,{className:"text-sm font-semibold text-slate-200",children:"Solidity Source"}),(0,a.jsx)("div",{className:"h-[500px] rounded-lg border border-slate-800 overflow-hidden shadow-sm",children:(0,a.jsx)(v.ZP,{height:"100%",defaultLanguage:"solidity",theme:"vs-dark",value:i,onChange:e=>{c(e||""),T(null)},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,tabSize:4,padding:{top:16,bottom:16},smoothScrolling:!0,cursorBlinking:"smooth",fontFamily:"'JetBrains Mono', 'Fira Code', 'Monaco', monospace"}})})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:o,onChange:e=>k(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:U.isPending,onClick:()=>U.mutate(),children:[(0,a.jsx)(x.Z,{className:"h-4 w-4"}),U.isPending?"Compiling…":"Compile"]})]}),U.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:U.error.message}),E&&(()=>{var e,t;let s=null!==(t=null===(e=E.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[],n=s.some((e,t)=>{var s;return!(null!==(s=L[t])&&void 0!==s?s:"").trim()});return(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",E.contractName," (",E.abi.length," ","ABI entries)"]}),s.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-400",children:"Constructor arguments"}),s.map((e,t)=>{var s;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:null!==(s=L[t])&&void 0!==s?s:"",onChange:e=>R(s=>{let a=[...s];return a[t]=e.target.value,a})})]},"".concat(e.name,"-").concat(t))}),n&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-xs text-yellow-400",children:[(0,a.jsx)(d.Z,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,a.jsxs)("span",{children:["Fill all constructor arguments before deploying. Missing:"," ",s.filter((e,t)=>{var s;return!(null!==(s=L[t])&&void 0!==s?s:"").trim()}).map((e,t,s)=>"".concat(e.name||"arg"," (").concat(e.type,")")).join(", ")]})]})]}):(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"No constructor arguments required."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:D,onChange:e=>F(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),B&&O.length>0&&(0,a.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,a.jsx)("label",{className:"label",children:"Deployer account"}),(0,a.jsx)("select",{className:"input",value:I,onChange:e=>P(Number(e.target.value)),children:O.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," —"," ","evm"===D?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:K.isPending||!B||s.length>0&&n,title:B?n?"Fill all constructor arguments first":void 0:"Start the node first",onClick:()=>K.mutate(),children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),K.isPending?"Deploying…":"Deploy"]})})]}),q&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(q.startsWith("✓")?"text-green-400":"text-red-400"),children:q})]})})()]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:J?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===H.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:H.map(e=>{let t=_.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(C,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(C,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:X.isPending,onClick:()=>X.mutate(e.id),children:(0,a.jsx)(p.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(C,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>V(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(S,{contract:e,accounts:O})]},e.id)})})]})})]})}},3368:function(e,t,s){"use strict";s.d(t,{z:function(){return o}});var a=s(5853),n=s(4254),l=s(1145),r=s(5460),i=s(8337);let c=(0,r.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"}}),o=n.forwardRef((e,t)=>{let{className:s,variant:n,size:r,asChild:o=!1,...d}=e,u=o?l.g7:"button";return(0,a.jsx)(u,{className:(0,i.cn)(c({variant:n,size:r,className:s})),ref:t,...d})});o.displayName="Button"},9510:function(e,t,s){"use strict";s.d(t,{_:function(){return o}});var a=s(5853),n=s(4254),l=s(5307),r=s(5460),i=s(8337);let c=(0,r.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-slate-300"),o=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.f,{ref:t,className:(0,i.cn)(c(),s),...n})});o.displayName=l.f.displayName},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return x},SC:function(){return f},SX:function(){return m},Vp:function(){return p},fA:function(){return g},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 r(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 i=e=>r("GET",e),c=(e,t)=>r("POST",e,t),o=e=>r("DELETE",e),d=(e,t)=>r("PUT",e,t),u=(e,t)=>r("PATCH",e,t),x={status:()=>i("/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:()=>i("/accounts"),faucet:()=>i("/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()}},p={templates:()=>i("/contracts/templates"),template:e=>i("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>i("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>o("/contracts/deployed/".concat(e)),call:(e,t,s,a)=>c("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:a})},h={status:()=>i("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},g={config:()=>i("/network/config"),updateConfig:e=>d("/network/config",e),rpcUrls:()=>i("/network/rpc-urls")},f={status:()=>i("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>i("/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=>o("/keystore/wallets/".concat(e))},v={get:()=>i("/settings")}},8337:function(e,t,s){"use strict";s.d(t,{cn:function(){return l}});var a=s(4685),n=s(4004);function l(){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))}}},function(e){e.O(0,[363,69,476,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,9985))},9985:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return k}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),c=s(4254),i=s(3035);let d=(0,i.Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var o=s(9928),u=s(3264);let p=(0,i.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var x=s(6970),m=s(1494);let h=(0,i.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var y=s(9924),j=s(758),v=s(5710),g=s(8144);function f(e){var t,s,n,l,r,i;let{fn:o,contractId:u,chain:p,accounts:x,isRead:m}=e,[h,y]=(0,c.useState)(null!==(l=null===(t=o.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[j,v]=(0,c.useState)(0),[f,N]=(0,c.useState)(null),[b,k]=(0,c.useState)(!1);async function w(){k(!0),N(null);try{let e=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),t=await g.Vp.call(u,o.name,e,m?void 0:j);N({ok:!0,value:t})}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{k(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[o.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=o.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",o.outputs&&o.outputs.length>0?" → ".concat(o.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(i=null===(n=o.inputs)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:o.inputs.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>y(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t))}),!m&&x.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:j,onChange:e=>v(Number(e.target.value)),children:x.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===p?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:m?"btn-secondary":"btn-primary",disabled:b,onClick:w,children:b?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(d,{className:"h-3.5 w-3.5 animate-spin"}),m?"Reading…":"Sending…"]}):m?"Call":"Send"}),f&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(f.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:f.ok?JSON.stringify(f.value,null,2):f.error})]})}function N(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(f,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(f,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function b(e){let{text:t}=e,[s,n]=(0,c.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(o.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(u.Z,{className:"h-3 w-3"})})}function k(){let e=(0,n.NL)(),[t,s]=(0,c.useState)("templates"),[i,d]=(0,c.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[o,u]=(0,c.useState)("HelloWorld"),[f,k]=(0,c.useState)(null),[w,C]=(0,c.useState)("evm"),[S,Z]=(0,c.useState)(""),[E,M]=(0,c.useState)(""),[D,q]=(0,c.useState)(""),[I,V]=(0,c.useState)(new Set),{data:L}=(0,l.a)({queryKey:["node","status"],queryFn:g.N9.status,refetchInterval:3e3}),T=(null==L?void 0:L.server)==="running",{data:A=[]}=(0,l.a)({queryKey:["accounts"],queryFn:g.SX.list,enabled:T}),{data:P=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:g.Vp.templates}),{data:F=[],isLoading:H}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>g.Vp.deployed(),refetchInterval:5e3}),_=(0,r.D)({mutationFn:()=>g.Vp.compile(i,o),onSuccess:e=>k(e)}),O=(0,r.D)({mutationFn:()=>{if(!f)throw Error("Compile first");if(!T)throw Error("Node is not running. Start it from the Dashboard first.");let e=[];if(S.trim())try{e=JSON.parse(S)}catch(e){throw Error("Invalid JSON for constructor args")}return g.Vp.deploy({bytecode:f.bytecode,abi:f.abi,args:e,chain:w,contractName:f.contractName})},onSuccess:t=>{M("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);M("✗ ".concat(t))}}),R=(0,r.D)({mutationFn:g.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function W(e){q("");try{let t=await g.Vp.template(e);d(t.source),u(e),s("custom"),k(null),M("")}catch(e){q(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),L&&!T&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(p,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),D&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:D}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(F.length>0?" (".concat(F.length,")"):""):e},e))}),"templates"===t&&(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:P.map(e=>(0,a.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,a.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>W(e.name),children:"Use"})]},e.name))}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:i,onChange:e=>{d(e.target.value),k(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:o,onChange:e=>u(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),_.isPending?"Compiling…":"Compile"]})]}),_.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:_.error.message}),f&&(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",f.contractName," (",f.abi.length," ABI entries)"]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"label",children:"Constructor Args (JSON array)"}),(0,a.jsx)("input",{className:"input",value:S,onChange:e=>Z(e.target.value),placeholder:'e.g. ["Hello", 42]'})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:w,onChange:e=>C(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:O.isPending||!T,title:T?void 0:"Start the node first",onClick:()=>O.mutate(),children:[(0,a.jsx)(h,{className:"h-4 w-4"}),O.isPending?"Deploying…":"Deploy"]})})]}),E&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(E.startsWith("✓")?"text-green-400":"text-red-400"),children:E})]})]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:H?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===F.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:F.map(e=>{let t=I.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(b,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(b,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:R.isPending,onClick:()=>R.mutate(e.id),children:(0,a.jsx)(y.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(b,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>V(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(N,{contract:e,accounts:A})]},e.id)})})]})})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return p},Vp:function(){return x},fA:function(){return h},mI:function(){return m}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function r(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 c=e=>r("GET",e),i=(e,t)=>r("POST",e,t),d=e=>r("DELETE",e),o=(e,t)=>r("PUT",e,t),u={status:()=>c("/node/status"),start:()=>i("/node/start"),stop:()=>i("/node/stop"),restart:()=>i("/node/restart"),restartWipe:()=>i("/node/restart-wipe"),wipe:()=>i("/node/wipe")},p={list:()=>c("/accounts"),faucet:()=>c("/accounts/faucet"),fund:(e,t,s)=>i("/accounts/fund",{address:e,amount:t,chain:s})},x={templates:()=>c("/contracts/templates"),template:e=>c("/contracts/templates/".concat(e)),compile:(e,t)=>i("/contracts/compile",{source:e,contractName:t}),deploy:e=>i("/contracts/deploy",e),deployed:e=>c("/contracts/deployed".concat(e?"?chain=".concat(e):"")),deleteDeployed:e=>d("/contracts/deployed/".concat(e)),call:(e,t,s,a)=>i("/contracts/".concat(e,"/call"),{functionName:t,args:s,accountIndex:a})},m={status:()=>c("/mining/status"),mine:e=>i("/mining/mine",{blocks:e}),start:e=>i("/mining/start",{intervalMs:e}),stop:()=>i("/mining/stop")},h={config:()=>c("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>c("/network/rpc-urls")},y={status:()=>c("/keystore/status"),generate:()=>i("/keystore/generate"),setup:e=>i("/keystore/setup",e),unlock:e=>i("/keystore/unlock",{password:e}),lock:()=>i("/keystore/lock"),wallets:()=>c("/keystore/wallets"),addWallet:(e,t)=>i("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>i("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))}},9928:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},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"}]])},3264:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},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"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,9985))},9985:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return C}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),i=s(3035);let c=(0,i.Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var d=s(9928),o=s(3264);let u=(0,i.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var p=s(6970),x=s(1494);let m=(0,i.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var h=s(9924),y=s(758),g=s(5710),v=s(4254),f=s(8144);let j={HelloWorld:{tags:["state","string"],ctor:"none",difficulty:"beginner"},SimpleStorage:{tags:["state","ownership","events"],ctor:"initialValue (uint256)",difficulty:"beginner"},Counter:{tags:["state","ownership","events","modifier"],ctor:"none",difficulty:"beginner"},TestToken:{tags:["ERC-20","token","mint","burn"],ctor:"name, symbol, initialSupply",difficulty:"beginner"},BasicNFT:{tags:["ERC-721","NFT","token","approval"],ctor:"name, symbol",difficulty:"intermediate"},Voting:{tags:["governance","struct","delegation"],ctor:"proposalNames (string[])",difficulty:"intermediate"},Escrow:{tags:["payments","payable","state machine"],ctor:"arbiter (address), beneficiary (address)",difficulty:"intermediate"},MultiSigWallet:{tags:["multisig","governance","wallet"],ctor:"owners (address[]), required (uint256)",difficulty:"advanced"},Registry:{tags:["registry","mapping","hashing"],ctor:"none",difficulty:"intermediate"}},b={beginner:"text-green-400 bg-green-900/30 border-green-800",intermediate:"text-yellow-400 bg-yellow-900/30 border-yellow-800",advanced:"text-orange-400 bg-orange-900/30 border-orange-800"};function N(e){var t,s,n,l,r,i,d;let{fn:o,contractId:u,chain:p,accounts:x,isRead:m}=e,[h,y]=(0,v.useState)(null!==(l=null===(t=o.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[g,j]=(0,v.useState)(0),[b,N]=(0,v.useState)(null),[w,k]=(0,v.useState)(!1);async function C(){k(!0),N(null);try{var e;let t=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),s=await f.Vp.call(u,null!==(e=o.name)&&void 0!==e?e:"",t,m?void 0:g);N({ok:!0,value:s})}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{k(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[o.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=o.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",o.outputs&&o.outputs.length>0?" → ".concat(o.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(i=null===(n=o.inputs)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:(null!==(d=o.inputs)&&void 0!==d?d:[]).map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>y(s=>{let a=[...s];return a[t]=e.target.value,a})})]},"".concat(e.name,"-").concat(t)))}),!m&&x.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:g,onChange:e=>j(Number(e.target.value)),children:x.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," —"," ","evm"===p?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:m?"btn-secondary":"btn-primary",disabled:w,onClick:C,children:w?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(c,{className:"h-3.5 w-3.5 animate-spin"}),m?"Reading…":"Sending…"]}):m?"Call":"Send"}),b&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(b.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:b.ok?JSON.stringify(b.value,null,2):b.error})]})}function w(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(N,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(N,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function k(e){let{text:t}=e,[s,n]=(0,v.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(d.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(o.Z,{className:"h-3 w-3"})})}function C(){let e=(0,n.NL)(),[t,s]=(0,v.useState)("templates"),[i,c]=(0,v.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[d,o]=(0,v.useState)("HelloWorld"),[N,C]=(0,v.useState)(null),[S,Z]=(0,v.useState)("evm"),[E,M]=(0,v.useState)(0),[q,D]=(0,v.useState)([]),[T,V]=(0,v.useState)(""),[F,I]=(0,v.useState)(""),[A,L]=(0,v.useState)(new Set),{data:P}=(0,l.a)({queryKey:["node","status"],queryFn:f.N9.status,refetchInterval:3e3}),R=(null==P?void 0:P.server)==="running",{data:H=[]}=(0,l.a)({queryKey:["accounts"],queryFn:f.SX.list,enabled:R}),{data:W=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:f.Vp.templates}),{data:_=[],isLoading:U}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>f.Vp.deployed(),refetchInterval:5e3}),O=(0,r.D)({mutationFn:()=>f.Vp.compile(i,d),onSuccess:e=>{var t,s;C(e),D((null!==(s=null===(t=e.abi.find(e=>"constructor"===e.type))||void 0===t?void 0:t.inputs)&&void 0!==s?s:[]).map(()=>"")),V("")}}),z=(0,r.D)({mutationFn:()=>{var e,t;if(!N)throw Error("Compile first");if(!R)throw Error("Node is not running. Start it from the Dashboard first.");let s=(null!==(t=null===(e=N.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[]).map((e,t)=>{var s;let a=(null!==(s=q[t])&&void 0!==s?s:"").trim();if(!a)return"";try{return JSON.parse(a)}catch(e){return a}});return f.Vp.deploy({bytecode:N.bytecode,abi:N.abi,args:s,chain:S,accountIndex:E,contractName:N.contractName})},onSuccess:t=>{V("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);V("✗ ".concat(t))}}),J=(0,r.D)({mutationFn:f.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function K(e){I("");try{let t=await f.Vp.template(e);c(t.source),o(e),s("custom"),C(null),V("")}catch(e){I(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),P&&!R&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(u,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),F&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:F}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(_.length>0?" (".concat(_.length,")"):""):e},e))}),"templates"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["Click ",(0,a.jsx)("span",{className:"text-slate-300",children:"Use"})," to load a template into the Editor. All contracts are pure Solidity — no external dependencies."]}),(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:W.map(e=>{let t=j[e.name];return(0,a.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 shrink-0 text-blue-400"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:e.name}),t&&(0,a.jsx)("span",{className:"rounded border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider ".concat(b[t.difficulty]),children:t.difficulty})]}),e.description&&(0,a.jsx)("p",{className:"mt-1.5 text-xs text-slate-400 leading-relaxed",children:e.description})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0 text-xs",onClick:()=>K(e.name),children:"Use"})]}),(null==t?void 0:t.tags)&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:t.tags.map(e=>(0,a.jsx)("span",{className:"rounded bg-[#1e2535] px-1.5 py-0.5 text-[10px] text-slate-400",children:e},e))}),(null==t?void 0:t.ctor)&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-slate-500",children:[(0,a.jsx)("span",{className:"font-mono text-slate-600",children:"constructor"}),(0,a.jsx)("span",{className:"text-slate-600",children:"\xb7"}),(0,a.jsx)("span",{className:"font-mono",children:t.ctor})]})]},e.name)})})]}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:i,onChange:e=>{c(e.target.value),C(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:d,onChange:e=>o(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:O.isPending,onClick:()=>O.mutate(),children:[(0,a.jsx)(x.Z,{className:"h-4 w-4"}),O.isPending?"Compiling…":"Compile"]})]}),O.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:O.error.message}),N&&(()=>{var e,t;let s=null!==(t=null===(e=N.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[],n=s.some((e,t)=>{var s;return!(null!==(s=q[t])&&void 0!==s?s:"").trim()});return(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",N.contractName," (",N.abi.length," ","ABI entries)"]}),s.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-400",children:"Constructor arguments"}),s.map((e,t)=>{var s;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:null!==(s=q[t])&&void 0!==s?s:"",onChange:e=>D(s=>{let a=[...s];return a[t]=e.target.value,a})})]},"".concat(e.name,"-").concat(t))}),n&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-xs text-yellow-400",children:[(0,a.jsx)(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,a.jsxs)("span",{children:["Fill all constructor arguments before deploying. Missing:"," ",s.filter((e,t)=>{var s;return!(null!==(s=q[t])&&void 0!==s?s:"").trim()}).map((e,t,s)=>"".concat(e.name||"arg"," (").concat(e.type,")")).join(", ")]})]})]}):(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"No constructor arguments required."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:S,onChange:e=>Z(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),R&&H.length>0&&(0,a.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,a.jsx)("label",{className:"label",children:"Deployer account"}),(0,a.jsx)("select",{className:"input",value:E,onChange:e=>M(Number(e.target.value)),children:H.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," —"," ","evm"===S?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:z.isPending||!R||s.length>0&&n,title:R?n?"Fill all constructor arguments first":void 0:"Start the node first",onClick:()=>z.mutate(),children:[(0,a.jsx)(m,{className:"h-4 w-4"}),z.isPending?"Deploying…":"Deploy"]})})]}),T&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(T.startsWith("✓")?"text-green-400":"text-red-400"),children:T})]})})()]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:U?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===_.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:_.map(e=>{let t=A.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(k,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(k,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:J.isPending,onClick:()=>J.mutate(e.id),children:(0,a.jsx)(h.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(k,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>L(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(w,{contract:e,accounts:H})]},e.id)})})]})})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return p},Vp:function(){return x},fA:function(){return h},mI:function(){return m},pJ:function(){return g}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function r(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 i=e=>r("GET",e),c=(e,t)=>r("POST",e,t),d=e=>r("DELETE",e),o=(e,t)=>r("PUT",e,t),u={status:()=>i("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe"),wipe:()=>c("/node/wipe")},p={list:()=>i("/accounts"),faucet:()=>i("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},x={templates:()=>i("/contracts/templates"),template:e=>i("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>i("/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})},m={status:()=>i("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},h={config:()=>i("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>i("/network/rpc-urls")},y={status:()=>i("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>i("/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))},g={get:()=>i("/settings")}},9928:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},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"}]])},3264:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},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"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,9985))},9985:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return k}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),i=s(4254),c=s(3035);let d=(0,c.Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var o=s(9928),u=s(3264);let p=(0,c.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var x=s(6970),m=s(1494);let h=(0,c.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var y=s(9924),v=s(758),j=s(5710),g=s(8144);function f(e){var t,s,n,l,r,c;let{fn:o,contractId:u,chain:p,accounts:x,isRead:m}=e,[h,y]=(0,i.useState)(null!==(l=null===(t=o.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[v,j]=(0,i.useState)(0),[f,N]=(0,i.useState)(null),[b,k]=(0,i.useState)(!1);async function w(){k(!0),N(null);try{let e=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),t=await g.Vp.call(u,o.name,e,m?void 0:v);N({ok:!0,value:t})}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{k(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[o.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=o.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",o.outputs&&o.outputs.length>0?" → ".concat(o.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(c=null===(n=o.inputs)||void 0===n?void 0:n.length)&&void 0!==c?c:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:o.inputs.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>y(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t))}),!m&&x.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:v,onChange:e=>j(Number(e.target.value)),children:x.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===p?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:m?"btn-secondary":"btn-primary",disabled:b,onClick:w,children:b?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(d,{className:"h-3.5 w-3.5 animate-spin"}),m?"Reading…":"Sending…"]}):m?"Call":"Send"}),f&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(f.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:f.ok?JSON.stringify(f.value,null,2):f.error})]})}function N(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(f,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(f,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function b(e){let{text:t}=e,[s,n]=(0,i.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(o.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(u.Z,{className:"h-3 w-3"})})}function k(){let e=(0,n.NL)(),[t,s]=(0,i.useState)("templates"),[c,d]=(0,i.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[o,u]=(0,i.useState)("HelloWorld"),[f,k]=(0,i.useState)(null),[w,C]=(0,i.useState)("evm"),[S,Z]=(0,i.useState)(0),[M,D]=(0,i.useState)([]),[q,E]=(0,i.useState)(""),[I,V]=(0,i.useState)(""),[A,F]=(0,i.useState)(new Set),{data:L}=(0,l.a)({queryKey:["node","status"],queryFn:g.N9.status,refetchInterval:3e3}),T=(null==L?void 0:L.server)==="running",{data:P=[]}=(0,l.a)({queryKey:["accounts"],queryFn:g.SX.list,enabled:T}),{data:_=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:g.Vp.templates}),{data:H=[],isLoading:R}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>g.Vp.deployed(),refetchInterval:5e3}),W=(0,r.D)({mutationFn:()=>g.Vp.compile(c,o),onSuccess:e=>{var t,s;k(e),D((null!==(s=null===(t=e.abi.find(e=>"constructor"===e.type))||void 0===t?void 0:t.inputs)&&void 0!==s?s:[]).map(()=>"")),E("")}}),O=(0,r.D)({mutationFn:()=>{var e,t;if(!f)throw Error("Compile first");if(!T)throw Error("Node is not running. Start it from the Dashboard first.");let s=(null!==(t=null===(e=f.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[]).map((e,t)=>{var s;let a=(null!==(s=M[t])&&void 0!==s?s:"").trim();if(!a)return"";try{return JSON.parse(a)}catch(e){return a}});return g.Vp.deploy({bytecode:f.bytecode,abi:f.abi,args:s,chain:w,accountIndex:S,contractName:f.contractName})},onSuccess:t=>{E("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);E("✗ ".concat(t))}}),U=(0,r.D)({mutationFn:g.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function z(e){V("");try{let t=await g.Vp.template(e);d(t.source),u(e),s("custom"),k(null),E("")}catch(e){V(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),L&&!T&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(p,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),I&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:I}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(H.length>0?" (".concat(H.length,")"):""):e},e))}),"templates"===t&&(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:_.map(e=>(0,a.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,a.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>z(e.name),children:"Use"})]},e.name))}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:c,onChange:e=>{d(e.target.value),k(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:o,onChange:e=>u(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:W.isPending,onClick:()=>W.mutate(),children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),W.isPending?"Compiling…":"Compile"]})]}),W.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:W.error.message}),f&&(()=>{var e,t;let s=null!==(t=null===(e=f.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[],n=s.some((e,t)=>{var s;return!(null!==(s=M[t])&&void 0!==s?s:"").trim()});return(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",f.contractName," (",f.abi.length," ABI entries)"]}),s.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-400",children:"Constructor arguments"}),s.map((e,t)=>{var s;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:null!==(s=M[t])&&void 0!==s?s:"",onChange:e=>D(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t)}),n&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-xs text-yellow-400",children:[(0,a.jsx)(p,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,a.jsxs)("span",{children:["Fill all constructor arguments before deploying. Missing: ",s.filter((e,t)=>{var s;return!(null!==(s=M[t])&&void 0!==s?s:"").trim()}).map((e,t,s)=>"".concat(e.name||"arg"," (").concat(e.type,")")).join(", ")]})]})]}):(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"No constructor arguments required."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:w,onChange:e=>C(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),T&&P.length>0&&(0,a.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,a.jsx)("label",{className:"label",children:"Deployer account"}),(0,a.jsx)("select",{className:"input",value:S,onChange:e=>Z(Number(e.target.value)),children:P.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===w?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:O.isPending||!T||s.length>0&&n,title:T?n?"Fill all constructor arguments first":void 0:"Start the node first",onClick:()=>O.mutate(),children:[(0,a.jsx)(h,{className:"h-4 w-4"}),O.isPending?"Deploying…":"Deploy"]})})]}),q&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(q.startsWith("✓")?"text-green-400":"text-red-400"),children:q})]})})()]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:R?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===H.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:H.map(e=>{let t=A.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(b,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(b,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:U.isPending,onClick:()=>U.mutate(e.id),children:(0,a.jsx)(y.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(b,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>F(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(N,{contract:e,accounts:P})]},e.id)})})]})})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return p},Vp:function(){return x},fA:function(){return h},mI:function(){return m},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 r(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 i=e=>r("GET",e),c=(e,t)=>r("POST",e,t),d=e=>r("DELETE",e),o=(e,t)=>r("PUT",e,t),u={status:()=>i("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe"),wipe:()=>c("/node/wipe")},p={list:()=>i("/accounts"),faucet:()=>i("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},x={templates:()=>i("/contracts/templates"),template:e=>i("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>i("/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})},m={status:()=>i("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},h={config:()=>i("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>i("/network/rpc-urls")},y={status:()=>i("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>i("/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:()=>i("/settings")}},9928:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},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"}]])},3264:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},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"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,8702))},8702:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return u}});var a=s(5853),n=s(8990),l=s(6632),r=s(4254),c=s(6970),i=s(1494);let o=(0,s(3035).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var d=s(8144);function u(){let[e,t]=(0,r.useState)("templates"),[s,u]=(0,r.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[m,p]=(0,r.useState)("HelloWorld"),[h,x]=(0,r.useState)(null),[y,f]=(0,r.useState)("evm"),[g,v]=(0,r.useState)(""),[b,j]=(0,r.useState)(""),{data:N=[]}=(0,n.a)({queryKey:["contracts","templates"],queryFn:d.Vp.templates}),k=(0,l.D)({mutationFn:()=>d.Vp.compile(s,m),onSuccess:e=>x(e)}),w=(0,l.D)({mutationFn:()=>{if(!h)throw Error("Compile first");let e=[];if(g.trim())try{e=JSON.parse(g)}catch(e){throw Error("Invalid JSON for constructor args")}return d.Vp.deploy({bytecode:h.bytecode,abi:h.abi,args:e,chain:y})},onSuccess:e=>j("✓ Deployed at ".concat(e.address," (tx: ").concat(e.txHash,")")),onError:e=>j("✗ ".concat(e.message))});async function C(e){u((await d.Vp.template(e)).source),p(e),t("custom"),x(null),j("")}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile and deploy Solidity contracts"})]}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom"].map(s=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(e===s?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>t(s),children:s},s))}),"templates"===e?(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:N.map(e=>(0,a.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,a.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>C(e.name),children:"Use"})]},e.name))}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:s,onChange:e=>{u(e.target.value),x(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:m,onChange:e=>p(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,a.jsx)(i.Z,{className:"h-4 w-4"}),k.isPending?"Compiling…":"Compile"]})]}),k.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:k.error.message}),h&&(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",h.contractName," (",h.abi.length," ABI entries)"]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"label",children:"Constructor Args (JSON array)"}),(0,a.jsx)("input",{className:"input",value:g,onChange:e=>v(e.target.value),placeholder:'e.g. ["Hello", 42]'})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:y,onChange:e=>f(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM"}),(0,a.jsx)("option",{value:"core",children:"Core"})]})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:w.isPending,onClick:()=>w.mutate(),children:[(0,a.jsx)(o,{className:"h-4 w-4"}),w.isPending?"Deploying…":"Deploy"]})})]}),b&&(0,a.jsx)("p",{className:"text-sm ".concat(b.startsWith("✓")?"text-green-400":"text-red-400"),children:b})]})]})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return m},Vp:function(){return p},fA:function(){return x},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 r(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 c=e=>r("GET",e),i=(e,t)=>r("POST",e,t),o=(e,t)=>r("PUT",e,t),d=e=>r("DELETE",e),u={status:()=>c("/node/status"),start:()=>i("/node/start"),stop:()=>i("/node/stop"),restart:()=>i("/node/restart")},m={list:()=>c("/accounts"),faucet:()=>c("/accounts/faucet"),fund:(e,t,s)=>i("/accounts/fund",{address:e,amount:t,chain:s})},p={templates:()=>c("/contracts/templates"),template:e=>c("/contracts/templates/".concat(e)),compile:(e,t)=>i("/contracts/compile",{source:e,contractName:t}),deploy:e=>i("/contracts/deploy",e)},h={status:()=>c("/mining/status"),mine:e=>i("/mining/mine",{blocks:e}),start:e=>i("/mining/start",{intervalMs:e}),stop:()=>i("/mining/stop")},x={config:()=>c("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>c("/network/rpc-urls")},y={status:()=>c("/keystore/status"),generate:()=>i("/keystore/generate"),setup:e=>i("/keystore/setup",e),unlock:e=>i("/keystore/unlock",{password:e}),lock:()=>i("/keystore/lock"),wallets:()=>c("/keystore/wallets"),addWallet:(e,t)=>i("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>i("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))}},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,2724))},2724:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(5853),n=s(8990),r=s(6632),l=s(4254),o=s(3035);let i=(0,o.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var c=s(6970),d=s(1494);let u=(0,o.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var m=s(8144);function p(){let[e,t]=(0,l.useState)("templates"),[s,o]=(0,l.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[p,h]=(0,l.useState)("HelloWorld"),[x,y]=(0,l.useState)(null),[f,g]=(0,l.useState)("evm"),[v,b]=(0,l.useState)(""),[N,j]=(0,l.useState)(""),[k,w]=(0,l.useState)(""),{data:C}=(0,n.a)({queryKey:["node","status"],queryFn:m.N9.status,refetchInterval:3e3}),S=(null==C?void 0:C.server)==="running",{data:E=[]}=(0,n.a)({queryKey:["contracts","templates"],queryFn:m.Vp.templates}),_=(0,r.D)({mutationFn:()=>m.Vp.compile(s,p),onSuccess:e=>y(e)}),P=(0,r.D)({mutationFn:()=>{if(!x)throw Error("Compile first");if(!S)throw Error("Node is not running. Start it from the Dashboard first.");let e=[];if(v.trim())try{e=JSON.parse(v)}catch(e){throw Error("Invalid JSON for constructor args")}return m.Vp.deploy({bytecode:x.bytecode,abi:x.abi,args:e,chain:f})},onSuccess:e=>j("✓ Deployed at ".concat(e.address," (tx: ").concat(e.txHash,")")),onError:e=>{let t=e instanceof Error?e.message:String(e);j("✗ ".concat(t))}});async function T(e){w("");try{let s=await m.Vp.template(e);o(s.source),h(e),t("custom"),y(null),j("")}catch(e){w(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile and deploy Solidity contracts"})]}),C&&!S&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(i,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),k&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:k}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom"].map(s=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(e===s?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>t(s),children:s},s))}),"templates"===e?(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:E.map(e=>(0,a.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,a.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>T(e.name),children:"Use"})]},e.name))}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:s,onChange:e=>{o(e.target.value),y(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:p,onChange:e=>h(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,a.jsx)(d.Z,{className:"h-4 w-4"}),_.isPending?"Compiling…":"Compile"]})]}),_.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:_.error.message}),x&&(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",x.contractName," (",x.abi.length," ABI entries)"]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"label",children:"Constructor Args (JSON array)"}),(0,a.jsx)("input",{className:"input",value:v,onChange:e=>b(e.target.value),placeholder:'e.g. ["Hello", 42]'})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:f,onChange:e=>g(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM"}),(0,a.jsx)("option",{value:"core",children:"Core"})]})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:P.isPending||!S,title:S?void 0:"Start the node first",onClick:()=>P.mutate(),children:[(0,a.jsx)(u,{className:"h-4 w-4"}),P.isPending?"Deploying…":"Deploy"]})})]}),N&&(0,a.jsx)("p",{className:"text-sm ".concat(N.startsWith("✓")?"text-green-400":"text-red-400"),children:N})]})]})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return m},Vp:function(){return p},fA:function(){return x},mI:function(){return h}});var a,n=s(2608);let r="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function l(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 o=e=>l("GET",e),i=(e,t)=>l("POST",e,t),c=(e,t)=>l("PUT",e,t),d=e=>l("DELETE",e),u={status:()=>o("/node/status"),start:()=>i("/node/start"),stop:()=>i("/node/stop"),restart:()=>i("/node/restart")},m={list:()=>o("/accounts"),faucet:()=>o("/accounts/faucet"),fund:(e,t,s)=>i("/accounts/fund",{address:e,amount:t,chain:s})},p={templates:()=>o("/contracts/templates"),template:e=>o("/contracts/templates/".concat(e)),compile:(e,t)=>i("/contracts/compile",{source:e,contractName:t}),deploy:e=>i("/contracts/deploy",e)},h={status:()=>o("/mining/status"),mine:e=>i("/mining/mine",{blocks:e}),start:e=>i("/mining/start",{intervalMs:e}),stop:()=>i("/mining/stop")},x={config:()=>o("/network/config"),updateConfig:e=>c("/network/config",e),rpcUrls:()=>o("/network/rpc-urls")},y={status:()=>o("/keystore/status"),generate:()=>i("/keystore/generate"),setup:e=>i("/keystore/setup",e),unlock:e=>i("/keystore/unlock",{password:e}),lock:()=>i("/keystore/lock"),wallets:()=>o("/keystore/wallets"),addWallet:(e,t)=>i("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>i("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>d("/keystore/wallets/".concat(e))}},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,8702))},8702:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return u}});var a=s(5853),n=s(8990),l=s(6632),r=s(4254),c=s(6970),i=s(1494);let o=(0,s(3035).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var d=s(8144);function u(){let[e,t]=(0,r.useState)("templates"),[s,u]=(0,r.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[m,p]=(0,r.useState)("HelloWorld"),[h,x]=(0,r.useState)(null),[y,f]=(0,r.useState)("evm"),[g,b]=(0,r.useState)(""),[v,j]=(0,r.useState)(""),{data:N=[]}=(0,n.a)({queryKey:["contracts","templates"],queryFn:d.Vp.templates}),k=(0,l.D)({mutationFn:()=>d.Vp.compile(s,m),onSuccess:e=>x(e)}),w=(0,l.D)({mutationFn:()=>{if(!h)throw Error("Compile first");let e=[];if(g.trim())try{e=JSON.parse(g)}catch(e){throw Error("Invalid JSON for constructor args")}return d.Vp.deploy({bytecode:h.bytecode,abi:h.abi,args:e,chain:y})},onSuccess:e=>j("✓ Deployed at ".concat(e.address," (tx: ").concat(e.txHash,")")),onError:e=>j("✗ ".concat(e.message))});async function C(e){u((await d.Vp.template(e)).source),p(e),t("custom"),x(null),j("")}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile and deploy Solidity contracts"})]}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom"].map(s=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(e===s?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>t(s),children:s},s))}),"templates"===e?(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:N.map(e=>(0,a.jsxs)("div",{className:"card flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-400"}),e.name]}),(0,a.jsxs)("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-slate-400",children:[e.source.slice(0,200),"…"]})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0",onClick:()=>C(e.name),children:"Use"})]},e.name))}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:s,onChange:e=>{u(e.target.value),x(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:m,onChange:e=>p(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,a.jsx)(i.Z,{className:"h-4 w-4"}),k.isPending?"Compiling…":"Compile"]})]}),k.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:k.error.message}),h&&(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",h.contractName," (",h.abi.length," ABI entries)"]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"label",children:"Constructor Args (JSON array)"}),(0,a.jsx)("input",{className:"input",value:g,onChange:e=>b(e.target.value),placeholder:'e.g. ["Hello", 42]'})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:y,onChange:e=>f(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM"}),(0,a.jsx)("option",{value:"core",children:"Core"})]})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:w.isPending,onClick:()=>w.mutate(),children:[(0,a.jsx)(o,{className:"h-4 w-4"}),w.isPending?"Deploying…":"Deploy"]})})]}),v&&(0,a.jsx)("p",{className:"text-sm ".concat(v.startsWith("✓")?"text-green-400":"text-red-400"),children:v})]})]})]})}},8144:function(e,t,s){"use strict";async function a(e,t,s){let a=await fetch("".concat("/api").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()}s.d(t,{N9:function(){return i},SC:function(){return p},SX:function(){return o},Vp:function(){return d},fA:function(){return m},mI:function(){return u}});let n=e=>a("GET",e),l=(e,t)=>a("POST",e,t),r=(e,t)=>a("PUT",e,t),c=e=>a("DELETE",e),i={status:()=>n("/node/status"),start:()=>l("/node/start"),stop:()=>l("/node/stop"),restart:()=>l("/node/restart")},o={list:()=>n("/accounts"),faucet:()=>n("/accounts/faucet"),fund:(e,t,s)=>l("/accounts/fund",{address:e,amount:t,chain:s})},d={templates:()=>n("/contracts/templates"),template:e=>n("/contracts/templates/".concat(e)),compile:(e,t)=>l("/contracts/compile",{source:e,contractName:t}),deploy:e=>l("/contracts/deploy",e)},u={status:()=>n("/mining/status"),mine:e=>l("/mining/mine",{blocks:e}),start:e=>l("/mining/start",{intervalMs:e}),stop:()=>l("/mining/stop")},m={config:()=>n("/network/config"),updateConfig:e=>r("/network/config",e),rpcUrls:()=>n("/network/rpc-urls")},p={status:()=>n("/keystore/status"),generate:()=>l("/keystore/generate"),setup:e=>l("/keystore/setup",e),unlock:e=>l("/keystore/unlock",{password:e}),lock:()=>l("/keystore/lock"),wallets:()=>n("/keystore/wallets"),addWallet:(e,t)=>l("/keystore/wallets",{mnemonic:e,label:t}),activateWallet:e=>l("/keystore/wallets/".concat(e,"/activate")),deleteWallet:e=>c("/keystore/wallets/".concat(e))}},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])}},function(e){e.O(0,[383,815,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[913],{1033:function(e,t,s){Promise.resolve().then(s.bind(s,9985))},9985:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return C}});var a=s(5853),n=s(4852),l=s(8990),r=s(6632),i=s(4254),c=s(3035);let d=(0,c.Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var o=s(9928),u=s(3264);let p=(0,c.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var x=s(6970),m=s(1494);let h=(0,c.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var y=s(9924),g=s(758),v=s(5710),f=s(8144);let j={HelloWorld:{tags:["state","string"],ctor:"none",difficulty:"beginner"},SimpleStorage:{tags:["state","ownership","events"],ctor:"initialValue (uint256)",difficulty:"beginner"},Counter:{tags:["state","ownership","events","modifier"],ctor:"none",difficulty:"beginner"},TestToken:{tags:["ERC-20","token","mint","burn"],ctor:"name, symbol, initialSupply",difficulty:"beginner"},BasicNFT:{tags:["ERC-721","NFT","token","approval"],ctor:"name, symbol",difficulty:"intermediate"},Voting:{tags:["governance","struct","delegation"],ctor:"proposalNames (string[])",difficulty:"intermediate"},Escrow:{tags:["payments","payable","state machine"],ctor:"arbiter (address), beneficiary (address)",difficulty:"intermediate"},MultiSigWallet:{tags:["multisig","governance","wallet"],ctor:"owners (address[]), required (uint256)",difficulty:"advanced"},Registry:{tags:["registry","mapping","hashing"],ctor:"none",difficulty:"intermediate"}},b={beginner:"text-green-400 bg-green-900/30 border-green-800",intermediate:"text-yellow-400 bg-yellow-900/30 border-yellow-800",advanced:"text-orange-400 bg-orange-900/30 border-orange-800"};function N(e){var t,s,n,l,r,c;let{fn:o,contractId:u,chain:p,accounts:x,isRead:m}=e,[h,y]=(0,i.useState)(null!==(l=null===(t=o.inputs)||void 0===t?void 0:t.map(()=>""))&&void 0!==l?l:[]),[g,v]=(0,i.useState)(0),[j,b]=(0,i.useState)(null),[N,w]=(0,i.useState)(!1);async function k(){w(!0),b(null);try{let e=h.map(e=>{if(""===e.trim())return"";try{return JSON.parse(e)}catch(t){return e}}),t=await f.Vp.call(u,o.name,e,m?void 0:g);b({ok:!0,value:t})}catch(e){b({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{w(!1)}}return(0,a.jsxs)("div",{className:"rounded border border-[#2a3147] bg-[#0d1117]/40 p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"font-mono text-sm text-white",children:[o.name,(0,a.jsxs)("span",{className:"ml-1 text-slate-500 text-xs",children:["(",null!==(r=null===(s=o.inputs)||void 0===s?void 0:s.map(e=>e.type).join(", "))&&void 0!==r?r:"",")",o.outputs&&o.outputs.length>0?" → ".concat(o.outputs.map(e=>e.type).join(", ")):""]})]}),(null!==(c=null===(n=o.inputs)||void 0===n?void 0:n.length)&&void 0!==c?c:0)>0&&(0,a.jsx)("div",{className:"space-y-1.5",children:o.inputs.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:h[t],onChange:e=>y(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t))}),!m&&x.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Caller account"}),(0,a.jsx)("select",{className:"input",value:g,onChange:e=>v(Number(e.target.value)),children:x.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===p?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("button",{type:"button",className:m?"btn-secondary":"btn-primary",disabled:N,onClick:k,children:N?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(d,{className:"h-3.5 w-3.5 animate-spin"}),m?"Reading…":"Sending…"]}):m?"Call":"Send"}),j&&(0,a.jsx)("pre",{className:"text-xs font-mono break-all whitespace-pre-wrap p-2 rounded ".concat(j.ok?"bg-[#0d1117] text-green-300":"bg-red-950/50 text-red-400"),children:j.ok?JSON.stringify(j.value,null,2):j.error})]})}function w(e){let{contract:t,accounts:s}=e,n=t.abi.filter(e=>"function"===e.type),l=n.filter(e=>"view"===e.stateMutability||"pure"===e.stateMutability),r=n.filter(e=>"view"!==e.stateMutability&&"pure"!==e.stateMutability);return(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a3147] space-y-4",children:[l.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-green-500",children:"Read"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(view / pure — no tx required)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(N,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!0},e.name))})]}),r.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-orange-400",children:"Write"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:"(state-changing — sends a tx + auto-mines)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,a.jsx)(N,{fn:e,contractId:t.id,chain:t.chain,accounts:s,isRead:!1},e.name))})]}),0===n.length&&(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No callable functions found in ABI."})]})}function k(e){let{text:t}=e,[s,n]=(0,i.useState)(!1);return(0,a.jsx)("button",{type:"button",title:"Copy",className:"ml-1 rounded p-0.5 text-slate-500 hover:text-slate-300",onClick:async()=>{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1600)},children:s?(0,a.jsx)(o.Z,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(u.Z,{className:"h-3 w-3"})})}function C(){let e=(0,n.NL)(),[t,s]=(0,i.useState)("templates"),[c,d]=(0,i.useState)('// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message = "Hello, Conflux!";\n\n function setMessage(string calldata _msg) external {\n message = _msg;\n }\n}\n'),[o,u]=(0,i.useState)("HelloWorld"),[N,C]=(0,i.useState)(null),[S,Z]=(0,i.useState)("evm"),[E,M]=(0,i.useState)(0),[q,D]=(0,i.useState)([]),[T,V]=(0,i.useState)(""),[F,I]=(0,i.useState)(""),[A,L]=(0,i.useState)(new Set),{data:P}=(0,l.a)({queryKey:["node","status"],queryFn:f.N9.status,refetchInterval:3e3}),R=(null==P?void 0:P.server)==="running",{data:H=[]}=(0,l.a)({queryKey:["accounts"],queryFn:f.SX.list,enabled:R}),{data:W=[]}=(0,l.a)({queryKey:["contracts","templates"],queryFn:f.Vp.templates}),{data:_=[],isLoading:U}=(0,l.a)({queryKey:["contracts","deployed"],queryFn:()=>f.Vp.deployed(),refetchInterval:5e3}),O=(0,r.D)({mutationFn:()=>f.Vp.compile(c,o),onSuccess:e=>{var t,s;C(e),D((null!==(s=null===(t=e.abi.find(e=>"constructor"===e.type))||void 0===t?void 0:t.inputs)&&void 0!==s?s:[]).map(()=>"")),V("")}}),z=(0,r.D)({mutationFn:()=>{var e,t;if(!N)throw Error("Compile first");if(!R)throw Error("Node is not running. Start it from the Dashboard first.");let s=(null!==(t=null===(e=N.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[]).map((e,t)=>{var s;let a=(null!==(s=q[t])&&void 0!==s?s:"").trim();if(!a)return"";try{return JSON.parse(a)}catch(e){return a}});return f.Vp.deploy({bytecode:N.bytecode,abi:N.abi,args:s,chain:S,accountIndex:E,contractName:N.contractName})},onSuccess:t=>{V("✓ Deployed at ".concat(t.address," (tx: ").concat(t.txHash,")")),e.invalidateQueries({queryKey:["contracts","deployed"]})},onError:e=>{let t=e instanceof Error?e.message:String(e);V("✗ ".concat(t))}}),J=(0,r.D)({mutationFn:f.Vp.deleteDeployed,onSuccess:()=>e.invalidateQueries({queryKey:["contracts","deployed"]})});async function K(e){I("");try{let t=await f.Vp.template(e);d(t.source),u(e),s("custom"),C(null),V("")}catch(e){I(e instanceof Error?e.message:"Failed to load template")}}return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Contracts"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Compile, deploy, and track Solidity contracts"})]}),P&&!R&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-yellow-800 bg-yellow-950/40 px-4 py-2 text-sm text-yellow-400",children:[(0,a.jsx)(p,{className:"h-4 w-4 shrink-0"}),"Node is not running — deploy will fail. Start the node from the Dashboard."]}),F&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:F}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-[#2a3147] bg-[#161b27] p-1 w-fit",children:["templates","custom","deployed"].map(e=>(0,a.jsx)("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm capitalize transition-colors ".concat(t===e?"bg-blue-600 text-white":"text-slate-400 hover:text-slate-200"),onClick:()=>s(e),children:"deployed"===e?"Deployed".concat(_.length>0?" (".concat(_.length,")"):""):e},e))}),"templates"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["Click ",(0,a.jsx)("span",{className:"text-slate-300",children:"Use"})," to load a template into the Editor. All contracts are pure Solidity — no external dependencies."]}),(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:W.map(e=>{let t=j[e.name];return(0,a.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 shrink-0 text-blue-400"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:e.name}),t&&(0,a.jsx)("span",{className:"rounded border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider ".concat(b[t.difficulty]),children:t.difficulty})]}),e.description&&(0,a.jsx)("p",{className:"mt-1.5 text-xs text-slate-400 leading-relaxed",children:e.description})]}),(0,a.jsx)("button",{type:"button",className:"btn-secondary shrink-0 text-xs",onClick:()=>K(e.name),children:"Use"})]}),(null==t?void 0:t.tags)&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:t.tags.map(e=>(0,a.jsx)("span",{className:"rounded bg-[#1e2535] px-1.5 py-0.5 text-[10px] text-slate-400",children:e},e))}),(null==t?void 0:t.ctor)&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-slate-500",children:[(0,a.jsx)("span",{className:"font-mono text-slate-600",children:"constructor"}),(0,a.jsx)("span",{className:"text-slate-600",children:"\xb7"}),(0,a.jsx)("span",{className:"font-mono",children:t.ctor})]})]},e.name)})})]}),"custom"===t&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Solidity Source"}),(0,a.jsx)("textarea",{className:"input h-56 resize-y font-mono",value:c,onChange:e=>{d(e.target.value),C(null)}})]}),(0,a.jsxs)("div",{className:"flex items-end gap-3",children:[(0,a.jsxs)("div",{className:"w-48",children:[(0,a.jsx)("label",{className:"label",children:"Contract Name"}),(0,a.jsx)("input",{className:"input",value:o,onChange:e=>u(e.target.value)})]}),(0,a.jsxs)("button",{type:"button",className:"btn-secondary",disabled:O.isPending,onClick:()=>O.mutate(),children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),O.isPending?"Compiling…":"Compile"]})]}),O.error&&(0,a.jsx)("div",{className:"rounded-md border border-red-800 bg-red-950/50 px-3 py-2 text-sm text-red-400",children:O.error.message}),N&&(()=>{var e,t;let s=null!==(t=null===(e=N.abi.find(e=>"constructor"===e.type))||void 0===e?void 0:e.inputs)&&void 0!==t?t:[],n=s.some((e,t)=>{var s;return!(null!==(s=q[t])&&void 0!==s?s:"").trim()});return(0,a.jsxs)("div",{className:"card space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-green-400",children:["✓ Compiled: ",N.contractName," (",N.abi.length," ABI entries)"]}),s.length>0?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-400",children:"Constructor arguments"}),s.map((e,t)=>{var s;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"label",children:[e.name||"arg".concat(t)," ",(0,a.jsxs)("span",{className:"text-slate-600",children:["(",e.type,")"]})]}),(0,a.jsx)("input",{className:"input",placeholder:e.type,value:null!==(s=q[t])&&void 0!==s?s:"",onChange:e=>D(s=>{let a=[...s];return a[t]=e.target.value,a})})]},t)}),n&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded border border-yellow-800 bg-yellow-950/40 px-3 py-2 text-xs text-yellow-400",children:[(0,a.jsx)(p,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,a.jsxs)("span",{children:["Fill all constructor arguments before deploying. Missing: ",s.filter((e,t)=>{var s;return!(null!==(s=q[t])&&void 0!==s?s:"").trim()}).map((e,t,s)=>"".concat(e.name||"arg"," (").concat(e.type,")")).join(", ")]})]})]}):(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"No constructor arguments required."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Chain"}),(0,a.jsxs)("select",{className:"input",value:S,onChange:e=>Z(e.target.value),children:[(0,a.jsx)("option",{value:"evm",children:"EVM (eSpace)"}),(0,a.jsx)("option",{value:"core",children:"Core Space"})]})]}),R&&H.length>0&&(0,a.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,a.jsx)("label",{className:"label",children:"Deployer account"}),(0,a.jsx)("select",{className:"input",value:E,onChange:e=>M(Number(e.target.value)),children:H.map(e=>(0,a.jsxs)("option",{value:e.index,children:["#",e.index," — ","evm"===S?e.evmAddress:e.coreAddress]},e.index))})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{type:"button",className:"btn-primary",disabled:z.isPending||!R||s.length>0&&n,title:R?n?"Fill all constructor arguments first":void 0:"Start the node first",onClick:()=>z.mutate(),children:[(0,a.jsx)(h,{className:"h-4 w-4"}),z.isPending?"Deploying…":"Deploy"]})})]}),T&&(0,a.jsx)("p",{className:"break-all text-sm ".concat(T.startsWith("✓")?"text-green-400":"text-red-400"),children:T})]})})()]}),"deployed"===t&&(0,a.jsx)("div",{className:"space-y-3",children:U?(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Loading…"}):0===_.length?(0,a.jsx)("div",{className:"card text-center text-sm text-slate-500 py-8",children:"No deployed contracts yet. Deploy one from the Editor tab."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Contracts are persisted per wallet in the node data directory. They survive node restarts (but not Wipe & Restart)."}),(0,a.jsx)("div",{className:"space-y-2",children:_.map(e=>{let t=A.has(e.id),s="evm"===e.chain?"http://localhost:8545":"http://localhost:12537";return(0,a.jsxs)("div",{className:"card space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-blue-400"}),e.name,(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ".concat("evm"===e.chain?"bg-purple-900/50 text-purple-300":"bg-cyan-900/50 text-cyan-300"),children:"evm"===e.chain?"eSpace":"Core"})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,a.jsx)("code",{className:"max-w-[300px] truncate text-xs text-blue-300",children:e.address}),(0,a.jsx)(k,{text:e.address})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-[10px] text-slate-500",children:[(0,a.jsxs)("span",{children:["Chain ID: ",e.chainId]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.deployedAt).toLocaleString()}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{children:[e.abi.length," ABI entries"]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsx)("div",{title:"Copy JSON-RPC URL: ".concat(s),children:(0,a.jsx)(k,{text:s})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600 -ml-0.5 mr-1",children:"RPC"}),(0,a.jsx)("button",{type:"button",title:"Remove from tracking",className:"rounded p-1 text-slate-500 hover:text-red-400",disabled:J.isPending,onClick:()=>J.mutate(e.id),children:(0,a.jsx)(y.Z,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-[#2a3147] pt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:"tx:"}),(0,a.jsx)("code",{className:"max-w-[240px] truncate text-[10px] text-slate-400",children:e.txHash}),(0,a.jsx)(k,{text:e.txHash})]}),(0,a.jsx)("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-slate-400 hover:text-white hover:bg-[#2a3147] transition-colors",onClick:()=>L(t=>{let s=new Set(t);return s.has(e.id)?s.delete(e.id):s.add(e.id),s}),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{className:"h-3 w-3"})," Close"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.Z,{className:"h-3 w-3"})," Interact"]})})]}),t&&(0,a.jsx)(w,{contract:e,accounts:H})]},e.id)})})]})})]})}},8144:function(e,t,s){"use strict";s.d(t,{N9:function(){return u},SC:function(){return y},SX:function(){return p},Vp:function(){return x},fA:function(){return h},mI:function(){return m},pJ:function(){return g}});var a,n=s(2608);let l="".concat(null!==(a=n.env.NEXT_PUBLIC_API_URL)&&void 0!==a?a:"","/api");async function r(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 i=e=>r("GET",e),c=(e,t)=>r("POST",e,t),d=e=>r("DELETE",e),o=(e,t)=>r("PUT",e,t),u={status:()=>i("/node/status"),start:()=>c("/node/start"),stop:()=>c("/node/stop"),restart:()=>c("/node/restart"),restartWipe:()=>c("/node/restart-wipe"),wipe:()=>c("/node/wipe")},p={list:()=>i("/accounts"),faucet:()=>i("/accounts/faucet"),fund:(e,t,s)=>c("/accounts/fund",{address:e,amount:t,chain:s})},x={templates:()=>i("/contracts/templates"),template:e=>i("/contracts/templates/".concat(e)),compile:(e,t)=>c("/contracts/compile",{source:e,contractName:t}),deploy:e=>c("/contracts/deploy",e),deployed:e=>i("/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})},m={status:()=>i("/mining/status"),mine:e=>c("/mining/mine",{blocks:e}),start:e=>c("/mining/start",{intervalMs:e}),stop:()=>c("/mining/stop")},h={config:()=>i("/network/config"),updateConfig:e=>o("/network/config",e),rpcUrls:()=>i("/network/rpc-urls")},y={status:()=>i("/keystore/status"),generate:()=>c("/keystore/generate"),setup:e=>c("/keystore/setup",e),unlock:e=>c("/keystore/unlock",{password:e}),lock:()=>c("/keystore/lock"),wallets:()=>i("/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))},g={get:()=>i("/settings")}},9928:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},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"}]])},3264:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(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"}]])},6970:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]])},1494:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(3035).Z)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},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"}]])}},function(e){e.O(0,[363,285,749,744],function(){return e(e.s=1033)}),_N_E=e.O()}]);
|