ant-dashboard
Version:
An app which helps users to setup their ant node and do actions like cash out cheques,receive earnings
1 lines • 114 kB
JavaScript
(this["webpackJsonpant-dashboard"]=this["webpackJsonpant-dashboard"]||[]).push([[0],{291:function(e,t,n){},292:function(e,t,n){},381:function(e,t,n){"use strict";n.r(t);var a=n(0),i=n.n(a),r=n(18),c=n.n(r),o=(n(291),n(62)),s=(n(292),n(448)),l=n(480),d=n(26),j=n(25),u=n(13),b=n(1),h=function(e){var t=e.component,n=e.layout,a=e.exact,i=e.path;return Object(b.jsx)(j.a,{exact:a,path:i,render:function(e){return Object(b.jsx)(n,Object(u.a)(Object(u.a)({},e),{},{children:Object(b.jsx)(t,Object(u.a)({},e))}))}})},p=n(5),x=n(50),O=n(82),g=n(83),m=n(121),f=n(120),v=function(e){Object(m.a)(n,e);var t=Object(f.a)(n);function n(e){var a;return Object(O.a)(this,n),(a=t.call(this,e)).state={error:null},a}return Object(g.a)(n,[{key:"componentDidCatch",value:function(e,t){console.error({error:e,errorInfo:t})}},{key:"render",value:function(){return this.state.error?Object(b.jsxs)("h1",{children:["Something went wrong. Error: ",this.state.error.message]}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return{error:e}}}]),n}(a.Component),y=n(188),w=n(163),A=n(482),k=n(437),C=n(253),S=n(110),N=n(152),B=n.n(N),L=n(96),I=n(37),T=n.n(I);function E(e){return I.BigNumber.isBigNumber(e)&&e.isInteger()||"bigint"===typeof e}function D(e){if(I.BigNumber.isBigNumber(e))return e;if("string"===typeof e)return new I.BigNumber(e);if("bigint"===typeof e)return new I.BigNumber(e.toString());if("number"===typeof e)return new I.BigNumber(e);throw new TypeError("Not a BigNumber or BigNumber convertible value. Type: ".concat(typeof e," value: ").concat(e))}function P(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,a=arguments.length>1?arguments[1]:void 0,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[];if(a=a||i.length,n)for(e=0;e<n;e++)r[e]=i[0|Math.random()*a];else for(r[8]=r[13]=r[18]=r[23]="-",r[14]="4",e=0;e<36;e++)r[e]||(t=0|16*Math.random(),r[e]=i[19===e?3&t|8:t]);return r.join("")}function H(){var e=[];try{JSON.parse(localStorage.node_api).forEach((function(t,n){var a=t.id,i=t.nodeName,r=t.apiHost,c=t.debugApiHost,o=t.authorizationCode;if(a){var s={id:a,nodeName:i?i.toString().trim():"node".concat(n),apiHost:r?r.toString().trim():"",debugApiHost:c?c.toString().trim():"",authorizationCode:o?o.toString().trim():""};e.push(s)}}))}catch(t){}return e}function z(){for(var e={id:"",nodeName:"",apiHost:"http://localhost:1633",debugApiHost:"http://localhost:1635",authorizationCode:""},t=H(),n=localStorage.acitve_node_api_key||"",a=0;a<t.length;a++)if(t[a].id===n){e=t[a];break}return t.length>0&&!e.id&&(e=t[0],localStorage.acitve_node_api_key=e.id),e}function R(e){var t=e.id,n=e.nodeName,a=e.apiHost,i=e.debugApiHost,r=e.authorizationCode,c=e.setActive,o=void 0===c||c,s=H(),l={id:t||"",nodeName:n.trim()?n.trim():"node".concat(s.length+1),apiHost:a.trim(),debugApiHost:i.trim(),authorizationCode:r.trim()};if(t){for(var d=0;d<s.length;d++)if(s[d].id===t){s[d]=l;break}}else l.id=P(),s.push(l);return localStorage.node_api=JSON.stringify(s),o&&(localStorage.acitve_node_api_key=l.id),l}function q(e){for(var t=H(),n=0;n<t.length;n++)if(t[n].id===e){t.splice(n,1);break}localStorage.node_api=JSON.stringify(t)}function F(e){localStorage.acitve_node_api_key=e}function U(e){try{if("string"!==typeof e)return!1;var t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(n){if(n instanceof TypeError||n.code&&"ERR_INVALID_URL"===n.code)return!1;throw n}}var W=z(),V=W.apiHost,K=W.debugApiHost,M=function(){return new L.Bee(V)},Y=function(){return new L.Bee(K)},G=function(){return new L.BeeDebug(K)},X={health:function(){return M().isConnected()}},Q={uploadFile:function(e,t){return M().uploadFile(e,t)},uploadFilePkg:function(e,t){return M().uploadFilePkg(e,t)},downloadFile:function(e){return M().downloadFile(e)}},Z={getPostageStamps:function(){return Y().getAllPostageBatch()},buyPostageStamp:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Y().createPostageBatch(e.toString(),t,n)}},J={status:{nodeHealth:function(){return G().getHealth()}},connectivity:{addresses:function(){return G().getNodeAddresses()},listPeers:function(){return G().getPeers()},topology:function(){return G().getTopology()},ping:function(e){return G().pingPeer(e)}},balance:{balances:function(){return G().getAllBalances()}},chequebook:{address:function(){return G().getChequebookAddress()},balance:function(){return G().getChequebookBalance()},getLastCheques:function(){return G().getLastCheques()},peerCashout:function(e){return G().cashoutLastCheque(e)},getPeerLastCashout:function(e){return G().getLastCashoutAction(e)},getPeerLastCheques:function(e){return G().getLastChequesForPeer(e)},withdraw:function(e){return G().withdrawTokens(e.toString())},deposit:function(e){return G().depositTokens(e.toString())}},settlements:{getSettlements:function(){return G().getAllSettlements()}}},_=n(74),$=n.n(_),ee=[18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0],te=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;Object(O.a)(this,e),this.amount=void 0,this.decimals=void 0;var a=D(t);if(!E(a)||!ee.includes(n))throw new TypeError("Not a valid token values");this.amount=a,this.decimals=n}return Object(g.a)(e,[{key:"toBigInt",get:function(){return BigInt(this.amount.toFixed(0))}},{key:"toString",get:function(){return this.amount.toFixed(0)}},{key:"toBigNumber",get:function(){return new I.BigNumber(this.amount)}},{key:"toDecimal",get:function(){return this.amount.dividedBy(new I.BigNumber(10).pow(this.decimals))}},{key:"toFixedDecimal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return this.toDecimal.toFixed(e)}}],[{key:"fromDecimal",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,a=D(t),i=a.multipliedBy(new I.BigNumber(10).pow(n));return new e(i,n)}}]),e}(),ne={refresh:function(){},exist:function(){return!1},nodeApi:z(),nodeApiList:H()},ae=Object(a.createContext)(ne);ae.Consumer;function ie(e){var t=e.children,n=Object(a.useState)(ne.nodeApi),i=Object(p.a)(n,2),r=i[0],c=i[1],o=Object(a.useState)(ne.nodeApiList),s=Object(p.a)(o,2),l=s[0],d=s[1],j=Object(a.useMemo)((function(){var e={},t={},n={};return l.forEach((function(a){var i=a.id,r=a.nodeName,c=a.apiHost,o=a.debugApiHost;r&&(e[r]=i),c&&(t[c]=i),o&&(n[o]=i)})),[e,t,n]}),[l]),u=Object(p.a)(j,3),h=u[0],x=u[1],O=u[2],g=Object(a.useCallback)((function(){c(z()),d(H())}),[c,d]),m=Object(a.useCallback)((function(e,t,n){var a=!1;return"nodeName"===e?a=Boolean(h[t])&&(!n||n!==h[t]):"apiHost"===e?a=Boolean(x[t])&&(!n||n!==x[t]):"debugApiHost"===e&&(a=Boolean(O[t])&&(!n||n!==O[t])),a}),[h,x,O]);return Object(b.jsx)(ae.Provider,{value:{nodeApi:r,nodeApiList:l,refresh:g,exist:m},children:t})}var re=function(){var e=Object(a.useState)(!1),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!0),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){s(!0),X.health().then((function(e){i(e)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{health:n,isLoadingHealth:o,error:j}},ce=function(){var e=Object(a.useState)(null),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!0),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){s(!0),J.status.nodeHealth().then((function(e){i(e)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{nodeHealth:n,isLoadingNodeHealth:o,error:j}},oe=function(){var e=Object(a.useState)(null),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!0),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){s(!0),J.connectivity.addresses().then((function(e){i(e)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{nodeAddresses:n,isLoadingNodeAddresses:o,error:j}},se=function(){var e=Object(a.useState)(null),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!0),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){s(!0),J.connectivity.topology().then((function(e){i(e)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{topology:n,isLoading:o,error:j}},le=function(){var e=Object(a.useState)(null),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!0),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){s(!0),J.chequebook.address().then((function(e){i(e)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{chequebookAddress:n,isLoadingChequebookAddress:o,error:j}},de=function(){var e=Object(a.useState)(null),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!0),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){s(!0),J.chequebook.balance().then((function(e){var t=e.totalBalance,n=e.availableBalance,a={totalBalance:new te(t),availableBalance:new te(n)};i(a)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{chequebookBalance:n,isLoadingChequebookBalance:o,error:j}},je=n(107),ue=n.n(je),be=function(){var e,t,n=function(){var e=Object(a.useState)(null),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(!1),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)(null),d=Object(p.a)(l,2),j=d[0],u=d[1];return Object(a.useEffect)((function(){$.a.get("".concat("https://api.github.com/repos/ethsana/sana","/releases/latest")).then((function(e){i(e.data)})).catch((function(e){u(e)})).finally((function(){s(!1)}))}),[]),{latestBeeRelease:n,isLoadingLatestBeeRelease:o,error:j}}(),i=n.latestBeeRelease,r=n.isLoadingLatestBeeRelease,c=ce(),o=c.nodeHealth,s=c.isLoadingNodeHealth,l=null===(e=ue.a.coerce(null===i||void 0===i?void 0:i.name))||void 0===e?void 0:e.version,d=null===(t=ue.a.coerce(null===o||void 0===o?void 0:o.version))||void 0===t?void 0:t.version,j=Boolean(l&&d&&ue.a.satisfies(l,d,{includePrerelease:!0}));return{isLoading:s||r,isOk:!0,userVersion:null===o||void 0===o?void 0:o.version,latestVersion:l,latestUrl:(null===i||void 0===i?void 0:i.html_url)||"https://github.com/ethsana/sana/releases/latest",isLatestBeeVersion:j}},he=function(){var e,t=function(){var e=Object(a.useState)(!1),t=Object(p.a)(e,2),n=t[0],i=t[1],r=Object(a.useState)(""),c=Object(p.a)(r,2),o=c[0],s=c[1],l=Object(a.useState)({work:!1,reward:"0",pending:"0",expire:"0"}),d=Object(p.a)(l,2),j=d[0],u=d[1],b=Object(a.useContext)(ae).nodeApi;return Object(a.useEffect)((function(){var e=function(){i(!0),$.a.get("".concat(b.debugApiHost,"/mine/status"),{headers:{Authorization:b.authorizationCode||""}}).then((function(e){u(null===e||void 0===e?void 0:e.data)})).catch((function(e){var t;"404"===(null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.status.toString())?s("404"):s(e.toString()),u(null)})).finally((function(){i(!1)}))};e();var t=setInterval((function(){return e()}),8e3);return function(){clearInterval(t)}}),[]),{isLoadingEarnsInfo:n,error:o,earnsInfo:j}}(),n=t.isLoadingEarnsInfo,i=t.error,r=t.earnsInfo;if(!r)return{reward:new te("0"),pending:new te("0"),totalEarns:new te("0"),isWork:!1,isLoadingEarnsInfo:n,error:i,expire:0,freeze:!1};var c=new te(r.reward),o=r.deposit?new te(r.deposit):null,s=new te(r.pending),l=new te(c.toBigNumber.plus(s.toBigNumber));return{reward:c,pending:s,deposit:o,totalEarns:l,expire:1e3*Number(r.expire),freeze:null!==(e=null===r||void 0===r?void 0:r.freeze)&&void 0!==e&&e,isWork:Boolean(r.work),isLoadingEarnsInfo:n,error:i}},pe=Object(y.a)((function(e){return Object(w.a)({root:{width:"100%",marginBottom:e.spacing(2)}})}));function xe(e){var t=pe(),n=be(),i=n.isLoading,r=n.userVersion,c=Object(a.useState)(!0),o=Object(p.a)(c,2),s=o[0],l=o[1];if(i||e.isLoadingNodeHealth)return null;var d=e.version===r;return Object(b.jsx)(C.a,{in:!d&&s,children:Object(b.jsx)("div",{className:t.root,children:Object(b.jsxs)(A.a,{severity:"warning",action:Object(b.jsx)(S.a,{"aria-label":"close",color:"inherit",size:"small",onClick:function(){l(!1)},children:Object(b.jsx)(B.a,{fontSize:"inherit"})}),children:[Object(b.jsx)(k.a,{children:"Warning"}),"Your Ant node version (",Object(b.jsx)("code",{children:r}),") does not exactly match the Ant version we tested the Ant Dashboard against (",Object(b.jsx)("code",{children:e.version}),"). Please note that some functionality may not work properly."]})})})}var Oe=n(439),ge=n(440),me=n(386),fe=n(387),ve=n(388),ye=n(441),we=n(442),Ae=n(438),ke=n(231),Ce=n.n(ke),Se=n(232),Ne=n.n(Se),Be=n(234),Le=n.n(Be),Ie=n(230),Te=n.n(Ie),Ee=n(229),De=n.n(Ee),Pe=n(233),He=n.n(Pe),ze=[{label:"Status",id:"status",path:"/",icon:Ae.a},{label:"Files",id:"files",path:"/files/",icon:De.a},{label:"Stamps",id:"stamps",path:"/stamps/",icon:Te.a},{label:"Accounting",id:"accounting",path:"/accounting/",icon:Ce.a},{label:"Peers",id:"peers",path:"/peers/",icon:Ne.a},{label:"Application",id:"application",path:"/apps/",icon:He.a},{label:"Settings",id:"settings",path:"/settings/",icon:Le.a}],Re=Object(y.a)((function(e){var t="light"===e.palette.type;return Object(w.a)({root:{display:"flex"},drawer:{width:240,flexShrink:0},drawerPaper:{width:240,backgroundColor:e.palette.background.paper,boxShadow:"none"},drawerContainer:{overflow:"auto"},activeSideBar:{},activeSideBarItem:{backgroundColor:"rgba(255, 255, 255, ".concat(t?"0.4":"0.16",")")},toolbar:e.mixins.toolbar})}));function qe(e){var t,n=Re();return Object(b.jsx)("div",{className:n.root,children:Object(b.jsxs)(Oe.a,{className:n.drawer,variant:"permanent",classes:{paper:n.drawerPaper},children:[Object(b.jsxs)("div",{className:n.drawerContainer,children:[Object(b.jsx)(ge.a,{}),Object(b.jsx)(me.a,{children:ze.map((function(t){return Object(b.jsx)(o.b,{to:t.path,style:{color:"inherit",textDecoration:"none"},children:Object(b.jsxs)(fe.a,{button:!0,selected:e.location.pathname===t.path,className:e.location.pathname===t.path?n.activeSideBarItem:"",children:[Object(b.jsx)(ve.a,{children:Object(b.jsx)(t.icon,{})}),Object(b.jsx)(ye.a,{primary:t.label,className:e.location.pathname===t.path?n.activeSideBar:""})]})},t.id)}))}),Object(b.jsx)(we.a,{})]}),Object(b.jsx)("div",{style:{position:"fixed",bottom:0,width:"inherit",padding:"10px"},children:Object(b.jsxs)(fe.a,{children:[Object(b.jsxs)("div",{style:{marginRight:"30px"},children:[Object(b.jsx)("div",{style:{backgroundColor:e.health?"#32c48d":"#c9201f",marginRight:"7px",height:"10px",width:"10px",borderRadius:"50%",display:"inline-block"}}),Object(b.jsx)("span",{children:"API"})]}),Object(b.jsxs)("div",{children:[Object(b.jsx)("div",{style:{backgroundColor:"ok"===(null===(t=e.nodeHealth)||void 0===t?void 0:t.status)?"#32c48d":"#c9201f",marginRight:"7px",height:"10px",width:"10px",borderRadius:"50%",display:"inline-block"}}),Object(b.jsx)("span",{children:"Debug API"})]})]})})]})})}var Fe=n(485),Ue=n(98),We=n(444),Ve=n(445),Ke=n(447),Me=n(168),Ye=n(443),Ge=n(446),Xe=n(155),Qe=n.n(Xe),Ze=n(156),Je=n.p+"static/media/sana-logo-light.710eb502.svg",_e=n.p+"static/media/sana-logo-dark.671b1352.svg",$e=function(){return Object(a.useContext)(ae)},et=Object(y.a)((function(e){return Object(w.a)({logo:{width:200,flexShrink:0,flexGrow:0},network:{color:"#fff",backgroundColor:"#32c48d"},margin:{margin:e.spacing(1)},withoutLabel:{marginTop:e.spacing(3)},textField:{width:"25ch"},legend:{".PrivateNotchedOutline-legend-21":{width:"200px"}}})}));function tt(){var e=et(),t=Object(a.useContext)(li).theme,n=$e(),i=n.nodeApi,r=n.nodeApiList,c=n.refresh,o=Object(a.useState)(!1),s=Object(p.a)(o,2),l=s[0],d=s[1],j=Object(a.useState)(""),u=Object(p.a)(j,2),h=u[0],x=u[1],O=function(){d(!1)},g=[{field:"nodeName",headerName:"Node Name",width:200,editable:!1},{field:"apiHost",headerName:"Api Endpoint",width:260,editable:!1},{field:"debugApiHost",headerName:"Debug Api Endpoint",width:260,editable:!1},{headerName:" ",field:"null",renderCell:function(e){var t=e.row.id;return Object(b.jsx)(b.Fragment,{children:t===i.id?Object(b.jsx)(Fe.a,{label:"CONNECTED",size:"small",icon:Object(b.jsx)(Qe.a,{})}):Object(b.jsx)(Ue.a,{size:"small",variant:"contained",color:"primary",onClick:function(){m(t)},children:"CONNECT"})})},filterable:!1,flex:1,hideSortIcons:!0,sortable:!1,editable:!1}],m=function(e){F(e),c(),window.location.reload()};return Object(b.jsxs)(ge.a,{style:{display:"flex",width:"100%",justifyContent:"space-between"},children:[Object(b.jsx)("div",{className:e.logo,children:Object(b.jsx)("img",{src:"light"===t?Je:_e,alt:"sana logo",width:"50"})}),Object(b.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[r.length>0&&Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)("span",{style:{color:"#999"},children:"Connected Node:"}),"\xa0",Object(b.jsx)(Ue.a,{onClick:function(){d(!0)},style:{textTransform:"none"},endIcon:Object(b.jsx)(Ye.a,{}),children:Object(b.jsx)("span",{style:{marginRight:"-6px"},children:i.nodeName||i.apiHost||i.debugApiHost})}),Object(b.jsxs)(We.a,{open:l,onClose:O,maxWidth:"md",fullWidth:!0,children:[Object(b.jsxs)(Ve.a,{style:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},disableTypography:!0,children:[Object(b.jsx)("h2",{children:"Change Node API"}),Object(b.jsx)(S.a,{style:{marginRight:"-15px"},onClick:O,children:Object(b.jsx)(Ge.a,{})})]}),Object(b.jsxs)(Ke.a,{children:[Object(b.jsxs)("div",{style:{display:"flex",gap:"4px"},children:[Object(b.jsx)(Me.a,{label:"Type to search",variant:"outlined",size:"small",fullWidth:!0,value:h,onChange:function(e){x(e.target.value.trim())}}),Boolean(h)&&Object(b.jsx)(Ue.a,{onClick:function(){x("")},children:"clear"})]}),Object(b.jsx)("div",{style:{height:20}}),Object(b.jsx)(Ze.a,{"aria-labelledby":"id",rows:r.filter((function(e){var t=e.nodeName,n=e.apiHost,a=e.debugApiHost;if(h){var i=h.toLowerCase();return t.toLowerCase().indexOf(i)>=0||n.toLowerCase().indexOf(i)>=0||a.toLowerCase().indexOf(i)>=0}return!0})),columns:g,headerHeight:45,rowHeight:45,pageSize:10,autoHeight:!0,disableSelectionOnClick:!0,disableColumnMenu:!0,disableColumnSelector:!0,disableDensitySelector:!0})]}),Object(b.jsx)("div",{style:{height:20}})]})]}),Object(b.jsx)(Fe.a,{style:{marginLeft:"12px"},size:"small",label:"xDai",className:e.network})]})]})}var nt=n(450),at=Object(y.a)((function(e){return Object(w.a)({root:{padding:0},main:{marginLeft:"240px",flexGrow:1,minHeight:"calc(100vh - 64px)",backgroundColor:e.palette.background.default,padding:"12px",boxSizing:"border-box"},appBar:{zIndex:e.zIndex.drawer+1,backgroundColor:e.palette.background.default,flexGrow:1},toolbar:{width:"100%",justifyContent:"space-between"},title:Object(x.a)({flexGrow:1,display:"none"},e.breakpoints.up("sm"),{display:"block"})})})),it=function(e){var t=at(),n=Object(a.useState)("light"),i=Object(p.a)(n,2),r=i[0],c=(i[1],re().health),o=ce(),s=o.nodeHealth,l=o.isLoadingNodeHealth,d=null===s||void 0===s?void 0:s.version;return Object(b.jsxs)(a.Fragment,{children:[Object(b.jsx)(nt.a,{position:"fixed",className:t.appBar,children:Object(b.jsx)(tt,{})}),Object(b.jsx)("div",{style:{height:"64px"}}),Object(b.jsx)(qe,Object(u.a)(Object(u.a)({},e),{},{themeMode:r,health:c,nodeHealth:s})),Object(b.jsx)(v,{children:Object(b.jsxs)("main",{className:t.main,children:[Object(b.jsx)(xe,{version:d,isLoadingNodeHealth:l}),e.children]})})]})},rt=n(451),ct=n(391),ot=n(97),st=n(84),lt=n(486),dt=n(457),jt=n(393),ut=n(461),bt=n(464),ht=n(456),pt=n(458),xt=n(459),Ot=n(460),gt=n(462),mt=n(463);function ft(e){var t=Object(a.useState)(!1),n=Object(p.a)(t,2),i=n[0],r=n[1],c=Object(a.useState)(!1),o=Object(p.a)(c,2),s=o[0],l=o[1],d=Object(a.useState)(""),j=Object(p.a)(d,2),h=j[0],x=j[1],O=Object(a.useContext)(ae).nodeApi;return Object(b.jsx)("div",{children:i?Object(b.jsxs)("div",{style:{display:"flex"},children:[Object(b.jsx)(Me.a,{defaultValue:e.defaultHost,label:"Enter host",variant:"outlined",size:"small",onChange:function(e){return x(e.target.value)},style:{marginRight:"15px",minWidth:"300px"}}),Object(b.jsx)(Ue.a,{onClick:function(){h&&(l(!0),"api_host"===e.hostName?R(Object(u.a)(Object(u.a)({},O),{},{apiHost:h})):"debug_api_host"===e.hostName?R(Object(u.a)(Object(u.a)({},O),{},{debugApiHost:h})):localStorage.setItem(e.hostName,h),r(!i),window.location.reload())},size:"small",variant:"outlined",children:"Connect"}),Object(b.jsx)(Ue.a,{style:{marginLeft:"7px"},onClick:function(){return r(!i)},size:"small",children:"Cancel"})]}):s?Object(b.jsx)(rt.a,{style:{textAlign:"center",padding:"0px"},children:Object(b.jsx)(ct.a,{size:20})}):Object(b.jsx)(Ue.a,{onClick:function(){return r(!i)},size:"small",variant:"outlined",children:"Change host"})})}function vt(e){var t=e.isLoading,n=e.isOk;if(t)return null;var a=Object(b.jsxs)("div",{style:{display:"flex",marginTop:"25px",marginBottom:"25px"},children:[Object(b.jsxs)("span",{style:{marginRight:"15px"},children:["Debug API (",Object(b.jsx)(st.a,{variant:"button",children:K}),")"]}),Object(b.jsx)(ft,{hostName:"debug_api_host",defaultHost:K})]});return n?a:Object(b.jsxs)("div",{children:[a,Object(b.jsx)("div",{children:Object(b.jsxs)(st.a,{component:"div",variant:"body2",gutterBottom:!0,style:{margin:"15px"},children:["We cannot connect to your nodes debug API at ",Object(b.jsx)(st.a,{variant:"button",children:K}),". Please check the following to troubleshoot your issue."]})})]})}function yt(e){var t=e.isLoading,n=e.isOk;return t?null:Object(b.jsxs)("div",{children:[Object(b.jsxs)("div",{style:{display:"flex",marginBottom:"25px"},children:[Object(b.jsxs)("span",{style:{marginRight:"15px"},children:["Node API (",Object(b.jsx)(st.a,{variant:"button",children:V}),")"]}),Object(b.jsx)(ft,{hostName:"api_host",defaultHost:V})]}),Object(b.jsx)("div",{children:!n&&Object(b.jsxs)(st.a,{component:"div",variant:"body2",gutterBottom:!0,style:{margin:"15px"},children:["We cannot connect to your nodes API at ",Object(b.jsx)(st.a,{variant:"button",children:V}),". Please check the following to troubleshoot your issue."]})})]})}function wt(e){var t=e.isLoading,n=e.isOk,a=e.userVersion,i=e.latestVersion,r=e.latestUrl;if(t)return null;var c=Object(b.jsxs)("div",{style:{display:"flex"},children:[Object(b.jsxs)("div",{style:{marginRight:"30px"},children:[Object(b.jsx)("p",{children:Object(b.jsx)("span",{children:"User Version"})}),Object(b.jsx)(st.a,{component:"h5",variant:"h5",children:Object(b.jsx)("span",{children:a||"--"})})]}),Object(b.jsxs)("div",{children:[Object(b.jsx)("p",{children:Object(b.jsx)("span",{children:"Latest Version"})}),Object(b.jsx)(st.a,{component:"h5",variant:"h5",children:Object(b.jsx)("span",{children:i})})]})]});return n?Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)("span",{children:"You are running the latest version of Ant"}),c]}):Object(b.jsxs)(b.Fragment,{children:[Object(b.jsxs)("span",{children:["Your Ant version is out of date. Please update to the"," ",Object(b.jsx)("a",{href:r,rel:"noreferrer",target:"_blank",children:"latest"})," ","before continuing. Rerun the installation script below to upgrade. Reference the docs for help with updating."," ",Object(b.jsx)("a",{href:"https://docs.ethswarm.org/docs/installation/manual#upgrading-bee",rel:"noreferrer",target:"_blank",children:"Docs"})]}),c]})}var At=n(236),kt=n.n(At),Ct=n(452);function St(e){var t=Object(a.useState)(!1),n=Object(p.a)(t,2),i=n[0],r=n[1];return Object(b.jsxs)("div",{children:[Object(b.jsx)(S.a,{color:"primary",size:"small",onClick:function(){r(!0)},children:Object(b.jsx)(Ct.a,{})}),Object(b.jsx)(We.a,{onClose:function(){r(!1)},"aria-labelledby":"simple-dialog-title",open:i,children:Object(b.jsxs)("div",{style:{padding:"30px",textAlign:"center"},children:[Object(b.jsx)(Ve.a,{id:"simple-dialog-title",children:e.label}),Object(b.jsx)(kt.a,{value:e.value,size:150,bgColor:"#ffffff",fgColor:"#000000",level:"L",includeMargin:!1,renderAs:"svg"})]})})]})}var Nt=n(237),Bt=n(453);function Lt(e){var t=e.value,n=Object(d.b)().enqueueSnackbar;return Object(b.jsx)("div",{style:{marginRight:"3px",marginLeft:"3px"},children:Object(b.jsx)(S.a,{color:"primary",size:"small",onClick:function(){return n("Copied: ".concat(t),{variant:"success"})},children:Object(b.jsx)(Nt.CopyToClipboard,{text:t,children:Object(b.jsx)(Bt.a,{style:{height:"20px"}})})})})}var It=n(238),Tt=n.n(It);function Et(e){return Object(b.jsx)(st.a,{component:"div",variant:"subtitle1",children:e.address?Object(b.jsxs)("div",{style:{display:"flex"},children:[e.hideBlockie?null:Object(b.jsx)("div",{style:{paddingTop:"5px",marginRight:"10px"},children:Object(b.jsx)(Tt.a,{style:{width:"23"}})}),Object(b.jsx)("div",{children:Object(b.jsx)("a",{style:e.truncate?{marginRight:"7px",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"}:{marginRight:"7px"},href:"https://".concat(e.network,"/").concat(e.transaction?"tx":"address","/").concat(e.address),target:"_blank",rel:"noreferrer",children:e.address})}),Object(b.jsx)(St,{value:e.address,label:"Ethereum Address"}),Object(b.jsx)(Lt,{value:e.address})]}):"-"})}function Dt(e){var t=e.isLoading,n=e.isOk,a=e.nodeAddresses;return t?null:n?Object(b.jsxs)("div",{children:[Object(b.jsx)(st.a,{variant:"subtitle1",gutterBottom:!0,children:"Node Address"}),Object(b.jsx)(Et,{address:null===a||void 0===a?void 0:a.ethereum,network:"blockscout.com/xdai/mainnet"})]}):Object(b.jsxs)("p",{children:["Your Ant node must have access to the xdai blockchain, By default, Ant expects a local node at http://localhost:8545. To use a provider instead, simply change your ",Object(b.jsx)("strong",{children:"--swap-endpoint"})," in your configuration file."]})}var Pt=n(67),Ht=n.n(Pt),zt=n(104),Rt=n(256),qt=n(455),Ft=n(454),Ut=n(257);function Wt(e){var t=e.successMessage,n=e.errorMessage,i=e.dialogMessage,r=e.min,c=e.max,o=e.label,s=e.action,l=Object(a.useState)(!1),j=Object(p.a)(l,2),u=j[0],h=j[1],x=Object(a.useState)(""),O=Object(p.a)(x,2),g=O[0],m=O[1],f=Object(a.useState)(null),v=Object(p.a)(f,2),y=v[0],w=v[1],A=Object(a.useState)(null),k=Object(p.a)(A,2),C=k[0],S=k[1],N=Object(d.b)().enqueueSnackbar,B=function(){h(!1)},L=function(){var e=Object(zt.a)(Ht.a.mark((function e(){var a;return Ht.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==y){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,s(y.toBigInt);case 5:a=e.sent,h(!1),N("".concat(t," Transaction ").concat(a),{variant:"success"}),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),N("".concat(n," Error: ").concat(e.t0.message),{variant:"error"});case 13:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}();return Object(b.jsxs)("div",{children:[Object(b.jsx)(Ue.a,{variant:"outlined",color:"primary",onClick:function(){h(!0)},children:o}),Object(b.jsxs)(We.a,{open:u,onClose:B,"aria-labelledby":"form-dialog-title",children:[Object(b.jsx)(Ve.a,{id:"form-dialog-title",children:o}),Object(b.jsxs)(Ke.a,{children:[Object(b.jsx)(Ft.a,{children:i}),Object(b.jsx)(Rt.a,{autoFocus:!0,margin:"dense",id:"name",type:"text",placeholder:"Amount",fullWidth:!0,value:g,onChange:function(e){var t=e.target.value;m(t),S(null);try{var n=te.fromDecimal(t);w(n),r&&n.toDecimal.isLessThan(r)&&S(new Error("Needs to be more than ".concat(r))),c&&n.toDecimal.isGreaterThan(c)&&S(new Error("Needs to be less than ".concat(c)))}catch(e){S(e)}}}),C&&Object(b.jsxs)(Ut.a,{error:!0,children:["Please provide valid SANA amount (max 16 decimals). Error: ",C.message]})]}),Object(b.jsxs)(qt.a,{children:[Object(b.jsx)(Ue.a,{onClick:B,color:"primary",children:"Cancel"}),Object(b.jsx)(Ue.a,{onClick:L,color:"primary",children:o})]})]})]})}function Vt(){return Object(b.jsx)(Wt,{successMessage:"Successful deposit.",errorMessage:"Error with depositing",dialogMessage:"Specify the amount of SANA you would like to withdraw from your node.",label:"Deposit",min:new I.BigNumber(0),action:J.chequebook.deposit})}var Kt=function(e){var t=e.isLoading,n=e.chequebookAddress,a=e.chequebookBalance;return t?null:Object(b.jsxs)("div",{children:[(null===n||void 0===n?void 0:n.chequebookAddress)&&(null===a||void 0===a?void 0:a.totalBalance.toBigNumber.isGreaterThan(0))&&Object(b.jsx)("p",{style:{marginBottom:"20px",display:"flex"},children:Object(b.jsx)(Vt,{})}),Object(b.jsx)("div",{style:{marginBottom:"10px"},children:!(null===n||void 0===n?void 0:n.chequebookAddress)&&Object(b.jsx)("div",{children:Object(b.jsxs)("span",{children:["Your chequebook is either not deployed or funded. Join"," ",Object(b.jsx)("a",{href:"https://discord.gg/c72mpR7Erf",rel:"noreferrer",target:"_blank",children:"our discord channel"})]})})}),Object(b.jsx)(st.a,{variant:"subtitle1",gutterBottom:!0,children:"Chequebook Address"}),Object(b.jsx)(Et,{address:null===n||void 0===n?void 0:n.chequebookAddress,network:"blockscout.com/xdai/mainnet"})]})};function Mt(e){var t=e.isLoading,n=e.isOk,a=e.topology;if(t)return null;var i=Object(b.jsxs)("div",{style:{display:"flex",marginTop:"15px"},children:[Object(b.jsxs)("div",{style:{marginRight:"30px"},children:[Object(b.jsx)(st.a,{component:"div",variant:"subtitle1",gutterBottom:!0,color:"textSecondary",children:Object(b.jsx)("span",{children:"Connected Peers"})}),Object(b.jsx)(st.a,{component:"h2",variant:"h5",children:(null===a||void 0===a?void 0:a.connected)?a.connected:"-"})]}),Object(b.jsxs)("div",{children:[Object(b.jsx)(st.a,{component:"div",variant:"subtitle1",gutterBottom:!0,color:"textSecondary",children:Object(b.jsx)("span",{children:"Discovered Nodes"})}),Object(b.jsx)(st.a,{component:"h2",variant:"h5",children:(null===a||void 0===a?void 0:a.population)?a.population:"-"})]})]});return n?Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)("span",{children:"You are connected to peers!"}),i]}):Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)("span",{children:"Your node is not connected to any peers"}),i]})}var Yt=function(){var e=Object(a.useContext)(ae).nodeApi,t=Object(a.useState)(""),n=Object(p.a)(t,2),i=n[0],r=n[1];return Object(b.jsxs)(b.Fragment,{children:[!e.authorizationCode&&Object(b.jsx)(st.a,{component:"div",variant:"body2",gutterBottom:!0,children:"If you have configured dashboard-authorization in sana.yaml(ant version >0.1.0), \n please fill in the corresponding value to secure the node, if not, it is not necessary."}),Object(b.jsxs)("div",{style:{display:"flex",marginTop:"25px",marginBottom:"25px"},children:[Object(b.jsx)(Me.a,{defaultValue:e.authorizationCode,label:"Node Dashboard-Authorization",variant:"outlined",size:"small",placeholder:"Enter the node dashboard-authorization",style:{marginRight:"15px",minWidth:"320px"},onChange:function(e){var t,n;r(null===e||void 0===e||null===(t=e.target)||void 0===t||null===(n=t.value)||void 0===n?void 0:n.trim())}}),Object(b.jsx)(Ue.a,{size:"small",variant:"outlined",onClick:function(){e.authorizationCode!==i&&(R(Object(u.a)(Object(u.a)({},e),{},{authorizationCode:i})),window.location.reload())},children:"Set"}),Object(b.jsx)("div",{style:{width:"10px"}})]})]})},Gt=Object(y.a)((function(e){return Object(w.a)({root:{padding:e.spacing(2),width:"100%"},button:{marginTop:e.spacing(1),marginRight:e.spacing(1)},actionsContainer:{margin:e.spacing(2)}})}));function Xt(e){var t,n=e.nodeVersion,i=e.ethereumConnection,r=e.debugApiConnection,c=e.apiConnection,o=e.topology,s=e.chequebook,l=Gt(),d=Object(a.useState)(-1),j=Object(p.a)(d,2),h=j[0],x=j[1],O=[{label:"Running latest Ant version",isOk:n.isOk,isLoading:n.isLoading,component:Object(b.jsx)(wt,Object(u.a)({},n))},{label:"Setting Node Authorization",isOk:n.isOk,isLoading:n.isLoading,component:Object(b.jsx)(Yt,{})},{label:"Connected to Node DebugAPI",isOk:r.isOk,isLoading:r.isLoading,component:Object(b.jsx)(vt,Object(u.a)({},r))},{label:"Connected to Ethereum Blockchain",isOk:i.isOk,isLoading:i.isLoading,component:Object(b.jsx)(Dt,Object(u.a)({},i))},{label:"Deployed and Funded Chequebook",isOk:s.isOk,isLoading:s.isLoading,component:Object(b.jsx)(Kt,Object(u.a)({ethereumAddress:null===(t=i.nodeAddresses)||void 0===t?void 0:t.ethereum},s))},{label:"Connected to Node API",isOk:c.isOk,isLoading:c.isLoading,component:Object(b.jsx)(yt,Object(u.a)({},c))},{label:"Connected to Peers",isOk:o.isOk,isLoading:o.isLoading,component:Object(b.jsx)(Mt,Object(u.a)({},o))}];Object(a.useEffect)((function(){if(!(h>=0&&h<O.length)&&O.every((function(e){return!e.isLoading})))for(var e=0;e<O.length;++e)if(!O[e].isOk)return void x(e)}),[O]);var g=function(){x((function(e){return e+1}))},m=function(){x((function(e){return e-1}))};return Object(b.jsxs)(ot.a,{className:l.root,children:[Object(b.jsxs)(st.a,{variant:"h5",gutterBottom:!0,children:["Node Setup",Object(b.jsx)("span",{style:{marginLeft:"25px"},children:Object(b.jsxs)(Ue.a,{variant:"outlined",size:"small",onClick:function(){return window.location.reload()},children:[Object(b.jsx)(ht.a,{}),Object(b.jsx)("span",{style:{marginLeft:"7px"},children:"Refresh Checks"})]})})]}),Object(b.jsx)(lt.a,{nonLinear:!0,activeStep:h,orientation:"vertical",children:O.map((function(e,t){var n=e.label,a=e.isOk,i=e.component,r=e.isLoading;return Object(b.jsxs)(dt.a,{children:[Object(b.jsx)(jt.a,{disabled:r,onClick:function(){return x(t===h?O.length:t)},StepIconComponent:function(){return r?Object(b.jsx)(pt.a,{style:{height:"25px",cursor:"pointer"}}):a?Object(b.jsx)(xt.a,{style:{color:"#32c48d",height:"25px",cursor:"pointer"}}):Object(b.jsx)(Ot.a,{style:{color:"#c9201f",height:"25px",cursor:"pointer"}})},children:Object(b.jsx)(ut.a,{disabled:r,onClick:function(){return x(t===h?O.length:t)},style:{justifyContent:"space-between"},children:Object(b.jsxs)("div",{style:{display:"flex"},children:[Object(b.jsx)("div",{style:{marginTop:"5px"},children:n}),Object(b.jsx)("div",{style:{marginLeft:"12px"},children:t===h?Object(b.jsx)(gt.a,{}):Object(b.jsx)(mt.a,{})})]})})}),Object(b.jsxs)(bt.a,{children:[Object(b.jsx)(st.a,{component:"div",children:i}),Object(b.jsx)("div",{className:l.actionsContainer,children:Object(b.jsxs)("div",{children:[Object(b.jsx)(Ue.a,{disabled:0===h,onClick:m,className:l.button,children:"Back"}),Object(b.jsx)(Ue.a,{variant:"contained",color:"primary",onClick:g,className:l.button,children:t<O.length-1?"Next":"Finish"})]})})]})]},n)}))})]})}var Qt=n(465),Zt=n(466),Jt=n(467),_t=n(468),$t=Object(y.a)((function(){return Object(w.a)({root:{display:"flex",flex:"1 1 auto",flexDirection:"column"},status:{color:"#2145a0",backgroundColor:"#e1effe"}})}));var en=function(e){var t=e.userBeeVersion,n=e.nodeAddresses,i=e.nodeTopology,r=e.isOk,c=e.isLatestBeeVersion,s=e.latestUrl,l=$t(),d=Object(a.useState)(!1),j=Object(p.a)(d,2),u=j[0],h=j[1];return Object(b.jsx)(Qt.a,{children:Object(b.jsxs)(Zt.a,{className:l.root,children:[Object(b.jsxs)(st.a,{component:"h5",variant:"h5",style:{display:"flex",justifyContent:"space-between"},children:[r&&Object(b.jsxs)("div",{children:[Object(b.jsx)(xt.a,{style:{color:"#32c48d",marginRight:"7px"}}),Object(b.jsx)("span",{children:"Your ant node is running as expected"})]}),!r&&Object(b.jsxs)("div",{children:[Object(b.jsx)(Ot.a,{style:{color:"#c9201f",marginRight:"7px"}}),Object(b.jsx)("span",{children:"Could not connect to ant node"})]})]}),r&&Object(b.jsxs)(b.Fragment,{children:[Object(b.jsxs)("div",{style:{marginBottom:"20px"},children:[Object(b.jsxs)("span",{style:{marginRight:"20px"},children:["Discovered Nodes: ",null===i||void 0===i?void 0:i.population]}),Object(b.jsxs)("span",{style:{marginRight:"20px"},children:[Object(b.jsx)("span",{children:"Connected Peers: "}),Object(b.jsx)(o.b,{to:"/peers/",children:null===i||void 0===i?void 0:i.connected})]})]}),Object(b.jsxs)("div",{children:[Object(b.jsxs)(st.a,{component:"div",variant:"subtitle2",gutterBottom:!0,children:[Object(b.jsx)("span",{children:"AGENT: "}),Object(b.jsx)("a",{href:"https://github.com/ethsana/sana",rel:"noreferrer",target:"_blank",children:"Ant"})," ",Object(b.jsx)("span",{children:t||"-"}),c?Object(b.jsx)(Fe.a,{style:{marginLeft:"7px",color:"#2145a0"},size:"small",label:"latest",className:l.status}):Object(b.jsx)(Ue.a,{size:"small",variant:"outlined",href:s,children:"update"})]}),Object(b.jsxs)(st.a,{component:"div",variant:"subtitle2",gutterBottom:!0,children:[Object(b.jsx)("span",{children:"PUBLIC KEY: "}),Object(b.jsx)("span",{children:(null===n||void 0===n?void 0:n.publicKey)?n.publicKey:"-"})]}),Object(b.jsxs)(st.a,{component:"div",variant:"subtitle2",gutterBottom:!0,children:[Object(b.jsx)("span",{children:"PSS PUBLIC KEY: "}),Object(b.jsx)("span",{children:(null===n||void 0===n?void 0:n.pssPublicKey)?n.pssPublicKey:"-"})]}),Object(b.jsxs)(st.a,{component:"div",variant:"subtitle2",gutterBottom:!0,children:[Object(b.jsx)("span",{children:"OVERLAY ADDRESS (PEER ID): "}),Object(b.jsx)("span",{children:(null===n||void 0===n?void 0:n.overlay)?n.overlay:"-"})]}),Object(b.jsxs)(st.a,{component:"div",variant:"subtitle2",gutterBottom:!0,children:[Object(b.jsx)(st.a,{component:"div",onClick:function(){return h(!u)},children:Object(b.jsxs)(Ue.a,{color:"primary",style:{padding:0,marginTop:"6px"},children:[u?Object(b.jsx)(Jt.a,{style:{fontSize:"12px"}}):Object(b.jsx)(_t.a,{style:{fontSize:"12px"}}),Object(b.jsx)("span",{children:"Underlay Addresses"})]})}),u&&Object(b.jsx)("div",{children:null===n||void 0===n?void 0:n.underlay.map((function(e){return Object(b.jsx)("li",{children:e},e)}))})]})]})]})]})})},tn=n(469),nn=Object(y.a)((function(){return Object(w.a)({root:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",paddingLeft:8,paddingRight:8},details:{display:"flex",flexDirection:"column"},content:{flex:"1 0 auto"}})}));var an=function(e){var t,n,a=nn();return Object(b.jsxs)(Qt.a,{className:a.root,children:[e.isLoadingNodeAddresses?Object(b.jsxs)("div",{style:{padding:"16px"},children:[Object(b.jsx)(tn.a,{width:300,height:30,animation:"wave"}),Object(b.jsx)(tn.a,{width:300,height:50,animation:"wave"})]}):Object(b.jsx)("div",{className:a.details,children:Object(b.jsxs)(Zt.a,{className:a.content,children:[Object(b.jsx)(st.a,{variant:"subtitle1",gutterBottom:!0,children:"Ethereum Address"}),Object(b.jsx)(Et,{address:null===(t=e.nodeAddresses)||void 0===t?void 0:t.ethereum,network:"blockscout.com/xdai/mainnet"})]})}),e.isLoadingChequebookAddress?Object(b.jsxs)("div",{style:{padding:"16px"},children:[Object(b.jsx)(tn.a,{width:300,height:30,animation:"wave"}),Object(b.jsx)(tn.a,{width:300,height:50,animation:"wave"})]}):Object(b.jsx)("div",{className:a.details,children:Object(b.jsxs)(Zt.a,{className:a.content,children:[Object(b.jsx)(st.a,{variant:"subtitle1",gutterBottom:!0,children:"Chequebook Contract Address"}),Object(b.jsx)(Et,{address:null===(n=e.chequebookAddress)||void 0===n?void 0:n.chequebookAddress,network:"blockscout.com/xdai/mainnet"})]})})]})},rn=n(471),cn=!1;function on(e){var t=e.disabled,n=i.a.useState(!1),r=Object(p.a)(n,2),c=r[0],o=r[1],s=i.a.useState(""),l=Object(p.a)(s,2),j=l[0],u=l[1],h=Object(d.b)().enqueueSnackbar,x=Object(a.useState)(!1),O=Object(p.a)(x,2),g=O[0],m=O[1],f=Object(a.useState)(!1),v=Object(p.a)(f,2),y=v[0],w=v[1],A=Object(a.useContext)(ae).nodeApi,k=Object(a.useCallback)((function(){cn||t||g||(cn=!0,m(!0),$.a.post("".concat(A.debugApiHost,"/mine/withdraw"),{},{headers:{Authorization:A.authorizationCode}}).then((function(e){var t=e.data;Boolean(null===t||void 0===t?void 0:t.code)?h("Cashout: ".concat(null===t||void 0===t?void 0:t.message),{variant:"error"}):(u(null===t||void 0===t?void 0:t.hash),w(!(null===t||void 0===t?void 0:t.hash)),o(!0))})).catch((function(e){e.response?h("Withdraw: ".concat(e.response.data.message),{variant:"error"}):h("Withdraw: ".concat(e.toString()),{variant:"error"})})).finally((function(){cn=!1,m(!1)})))}),[u,o,w,h,cn,t]);return Object(b.jsxs)("div",{children:[Object(b.jsxs)(Ue.a,{variant:"contained",disabled:t,color:"primary",style:{marginRight:"14px"},onClick:k,children:[g&&Object(b.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(66,66,66,.8)"},children:Object(b.jsx)(ct.a,{style:{width:"24px",height:"24px"}})}),"Cashout"]}),Object(b.jsxs)(We.a,{open:c,"aria-labelledby":"draggable-dialog-title",fullWidth:!0,children:[Object(b.jsx)(Ve.a,{id:"draggable-dialog-title",children:"Cashout"}),Object(b.jsxs)(Ke.a,{children:[g&&Object(b.jsx)("p",{children:"Cashout..."}),!g&&j&&Object(b.jsxs)(a.Fragment,{children:[Object(b.jsx)(Ft.a,{style:{marginTop:"20px",overflowWrap:"break-word"},children:"Copy the transaction hash or click on the link below for details"}),Object(b.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:["Hash:"," ",Object(b.jsx)("a",{style:{margin:"0 7px",fontSize:"14px"},href:"https://blockscout.com/xdai/mainnet/tx/".concat(j),target:"_blank",rel:"noreferrer",children:j.slice(0,16)+"******"+j.slice(j.length-16)}),Object(b.jsx)(Lt,{value:j})]})]}),y&&Object(b.jsx)("p",{style:{color:"red"},children:"Failed to Cashout"})]}),Object(b.jsx)(qt.a,{children:Object(b.jsx)(Ue.a,{autoFocus:!0,variant:"outlined",color:"primary",onClick:function(){o(!1)},children:"OK"})})]})]})}var sn=n(108),ln=n.n(sn),dn=n(470),jn=!1,un=function(e){var t=e.expire,n=e.callback,i=Object(a.useState)(1e3),r=Object(p.a)(i,2),c=r[0],o=r[1],s=Object(a.useState)("0d 00h:00m:00s"),l=Object(p.a)(s,2),d=l[0],j=l[1];Object(a.useEffect)((function(){O&&(o(null),n())}));var u=ln()(t),h=u.diff(ln()()),x=ln.a.duration(h),O=h<0;return Object(dn.a)((function(){var e=x.hours()>9?x.hours():"0".concat(x.hours()),t=x.minutes()>9?x.minutes():"0".concat(x.minutes()),n=x.seconds()>9?x.seconds():"0".concat(x.seconds()),a="".concat(x.days(),"d ").concat(e,"h:").concat(t,"m:").concat(n,"s");O||(x=ln.a.duration(u.diff(ln()())),j((function(){return a})))}),c,{immediate:!0}),Object(b.jsx)("span",{style:{color:"#32c48d"},children:d})};function bn(e){var t=e.disabled,n=e.expire,r=e.isExpiry,c=i.a.useState(!1),o=Object(p.a)(c,2),s=o[0],l=o[1],j=i.a.useState(""),u=Object(p.a)(j,2),h=u[0],x=u[1],O=Object(a.useState)(!1),g=Object(p.a)(O,2),m=g[0],f=g[1],v=Object(a.useState)(!1),y=Object(p.a)(v,2),w=y[0],A=y[1],k=Object(a.useContext)(ae).nodeApi,C=Object(d.b)().enqueueSnackbar,N=Object(a.useState)(r),B=Object(p.a)(N,2),L=B[0],I=B[1];Object(a.useEffect)((function(){I(r)}),[r]);var T=function(){l(!1)},E=Object(a.useCallback)((function(){jn||t||h||(jn=!0,f(!0),A(!1),$.a.post("".concat(k.debugApiHost,"/mine/cashdeposit"),{},{headers:{Authorization:k.authorizationCode}}).then((function(e){var t=e.data;x(t.hash),A(!t.hash)})).catch((function(e){e.response?C("Withdraw: ".concat(e.response.data.message),{variant:"error",autoHideDuration:2e3}):C("Withdraw: ".concat(e.toString()),{variant:"error",autoHideDuration:2e3})})).finally((function(){var e=setTimeout((function(){clearTimeout(e),jn=!1,f(!1)}),1e3)})))}),[x,l,C,f,jn,m,t,h,k,L]);return Object(b.jsxs)("div",{children:[Object(b.jsx)(Ue.a,{variant:"contained",disabled:t||Boolean(h),color:"primary",style:{marginRight:"14px"},onClick:function(){A(!1),l(!0)},children:0===n||r||L?"Unstake":Object(b.jsx)(un,{expire:n,callback:function(){I(!0)}})}),Object(b.jsxs)(We.a,{open:s,"aria-labelledby":"draggable-dialog-title",fullWidth:!0,children:[Object(b.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:"24px"},children:[Object(b.jsx)(Ve.a,{id:"draggable-dialog-title",children:0!==n||t?"Unstake":Object(b.jsx)("span",{style:{color:"yellow"},children:"Warning"})}),Object(b.jsx)(S.a,{style:{marginRight:"-15px"},onClick:T,children:Object(b.jsx)(Ge.a,{})})]}),Object(b.jsxs)(Ke.a,{children:[0===n&&!t&&!w&&!m&&!h&&Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)("p",{style:{fontSize:"16px",margin:"0"},children:"Proceed with caution! This action will prevent you from continuing to mine."}),Object(b.jsx)("p",{children:"Tip: the token will be locked for 7 days and you will need to withdraw it again after expiry to take it out."})]}),!t&&n>0&&!w&&!m&&!h&&Object(b.jsx)("p",{children:"The pledged token has been unfrozen and you can withdraw it."}),m&&Object(b.jsx)("p",{children:"Waiting for the transaction to be completed"}),!m&&h&&Object(b.jsxs)(a.Fragment,{children:[Object(b.jsx)(Ft.a,{style:{marginTop:"20px",overflowWrap:"break-word"},children:"Copy the transaction hash or click on the link below for details"}),Object(b.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:["Hash:"," ",Object(b.jsx)("a",{style:{margin:"0 7px",fontSize:"14px"},href:"https://blockscout.com/xdai/mainnet/tx/".concat(h),target:"_blank",rel:"noreferrer",children:h.slice(0,12)+"***"+h.slice(h.length-12)}),Object(b.jsx)(Lt,{value:h})]})]}),w&&Object(b.jsx)("p",{style:{color:"red"},children:"Failed to withdraw desposit"})]}),Object(b.jsxs)(qt.a,{children:[Object(b.jsx)(Ue.a,{onClick:T,variant:"outlined",children:h?"close":"cancel"}),Object(b.jsx)("div",{style:{marginRight:"8px"}}),!h&&Object(b.jsxs)(Ue.a,{onClick:E,variant:"outlined",color:"primary",disabled:Boolean(h),children:["Confirm",m&&Object(b.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:Object(b.jsx)(ct.a,{style:{width:"24px",height:"24px"}})})]})]})]})]})}var hn=!1;function pn(){var e=i.a.useState(!1),t=Object(p.a)(e,2),n=t[0],r=t[1],c=i.a.useState(""),o=Object(p.a)(c,2),s=o[0],l=o[1],j=Object(a.useState)(!1),u=Object(p.a)(j,2),h=u[0],x=u[1],O=Object(a.useState)(!1),g=Object(p.a)(O,2),m=g[0],f=g[1],v=Object(a.useContext)(ae).nodeApi,y=Object(d.b)().enqueueSnackbar,w=function(){r(!1)};return Object(b.jsxs)("div",{children:[!Boolean(s)&&Object(b.jsx)(Ue.a,{variant:"contained",color:"primary",style:{marginRight:"14px"},onClick:function(){f(!1),r(!0)},children:"Activate"}),Object(b.jsxs)(We.a,{open:n,"aria-labelledby":"draggable-dialog-title",fullWidth:!0,children:[Object(b.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:"24px"},children:[Object(b.jsx)(Ve.a,{id:"draggable-dialog-title",children:"Activation"}),Object(b.jsx)(S.a,{style:{marginRight:"-15px"},onClick:w,children:Object(b.jsx)(Ge.a,{})})]}),Object(b.jsxs)(Ke.a,{children:[!m&&!h&&!s&&Object(b.jsx)(st.a,{children:"For nodes that have withdrawn their pledged SANA token, this action will open the node to re-pledge and participate in mining, are you sure you want to activate it?"}),h&&Object(b.jsx)("p",{children:"Waiting for the transaction to be completed"}),!h&&s&&Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)(Ft.a,{style:{marginTop:"20px",overflowWrap:"break-word"},children:"Copy the transaction hash or click on the link below for details"}),Object(b.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:["Hash:"," ",Object(b.jsx)("a",{style:{margin:"0 7px",fontSize:"14px"},href:"https://blockscout.com/xdai/mainnet/tx/".concat(s),target:"_blank",rel:"noreferrer",children:s.slice(0,12)+"***"+s.slice(s.length-12)}),Object(b.jsx)(Lt,{value:s})]})]}),m&&Object(b.jsx)("p",{style:{color:"red"},children:"Failed to Activate"})]}),Object(b.jsxs)(qt.a,{children:[Object(b.jsx)(Ue.a,{onClick:w,variant:"outlined",children:Boolean(s)?"close":"cancel"}),Object(b.jsx)("div",{style:{marginRight:"8px"}}),!Boolean(s)&&Object(b.jsxs)(Ue.a,{onClick:function(){hn||s||(hn=!0,x(!0),f(!1),$.a.post("".concat(v.debugApiHost,"/mine/unfreeze"),{},{headers:{Authorization:v.authorizationCode}}).then((function(e){var t=e.data;l(t.hash),f(!t.hash)})).catch((function(e){e.response?y("Activate: ".concat(e.response.data.message),{variant:"error",autoHideDuration:2e3}):y("Activate: ".concat(e.toString()),{variant:"error",autoHideDuration:2e3})})).finally((function(){x(!1),hn=!1})))},variant:"outlined",color:"primary",children:["Confirm",h&&Object(b.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:Object(b.jsx)(ct.a,{style:{width:"24px",height:"24px"}})})]})]})]})]})}var xn=Object(y.a)((function(e){return Object(w.a)({root:{flexGrow:1},card:{padding:e.spacing(2)},span:{margin:"10px auto",color:e.palette.text.primary,fontWeight:500,fontSize:15},label:{display:"block",fontSize:16,color:e.palette.primary.main},val:{display:"block",paddingTop:"2px"}})})),On=function(e){var t=e.isWork;return Object(b.jsx)("div",{style:{backgroundColor:t?"#32c48d":"red",marginRight:"7px",height:"10px",width:"10px",borderRadius:"50%",display:"inline-block"}})};var gn=function(e){var t=e.error,n=e.isWork,i=e.expire,r=e.pending,c=e.reward,o=e.freeze,s=e.totalEarns,l=e.deposit,d=xn(),j=Number(i-(new Date).getTime())<=0,u=Object(a.useMemo)((function(){return t?0:l?l.toBigNumber.isZero()?0:l.toFixedDecimal():0===i?n?5e4:0:j?0:5e4}),[i,l,n,t,j]),h=Object(a.useMemo)((function(){return t?0:l?0===u?u:0:0===u?5e4:0}),[u,t,i,l,n,c,r]),p=Object(a.useMemo)((function(){return!!t||(l?!!l.toBigNumber.isZero()||0!==i&&!j:0===i?!n:!j)}),[i,l,n,t,j]);return Object(b.jsx)("div",{className:d.root,children:Object(b.jsxs)(rn.a,{container:!0,spacing:2,children:[Object(b.jsx)(rn.a,{item:!0,xs:3,children:Object(b.jsxs)(Qt.a,{className:d.card,children:[Object(b.jsxs)("div",{className:d.span,children:[Object(b.jsx)("span",{className:d.label,children:"Amount of SANA deposits"}),Object(b.jsx)("span",{className:d.val,children:u})]}),Object(b.jsxs)("div",{className:d.span,children:[Object(b.jsx)("span",{className:d.label,children:"Miner Node Status"}),Object(b.jsxs)("span",{className:d.val,children:[!o&&Object(b.jsx)(On,{isWork:n}),t?" The node is wrong, refresh to check":n?"working":o?"":"unwork",t&&Object(b.jsxs)(Ue.a,{variant:"outlined",size:"small",style:{marginTop:"7px"},onClick:function(){return window.location.reload()},children:[Object(b.jsx)(ht.a,{}),Object(b.jsx)("span",{children:"Refresh Checks"})]}),o&&Object(b.jsx)(pn,{})]})]})]})}),Object(b.jsx)(rn.a,{item:!0,xs:3,children:Object(b.jsxs)(Qt.a,{className:d.card,children:[Object(b.jsxs)("div",{className:d.span,children:[Object(b.jsx)("s