-
Notifications
You must be signed in to change notification settings - Fork 0
/
6294.async.js
1 lines (1 loc) · 13.3 KB
/
6294.async.js
1
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6294],{3089:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(87462),s=n(62435),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"},c=n(84089),o=function(e,t){return s.createElement(c.Z,(0,r.Z)({},e,{ref:t,icon:a}))};var i=s.forwardRef(o)},98165:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(87462),s=n(62435),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z"}}]},name:"sync",theme:"outlined"},c=n(84089),o=function(e,t){return s.createElement(c.Z,(0,r.Z)({},e,{ref:t,icon:a}))};var i=s.forwardRef(o)},36294:function(e,t,n){n.r(t),n.d(t,{default:function(){return z}});var r=n(15009),s=n.n(r),a=n(99289),c=n.n(a),o=n(5574),i=n.n(o),l=n(74563),u=n(9004),d=n(19601),f=n(64119),p=n(98165),x=n(3089),h=n(11774),v=n(92340),m=n(59530),g=n(45360),b=n(66309),j=n(83062),w=n(7134),k=n(15867),N=n(71230),S=n(15746),_=n(55054),y=n(9669),Z=n.n(y),F=n(27484),M=n.n(F),D=n(62435),O=n(86074),C=0,I=0,z=function(){var e=g.ZP.useMessage(),t=i()(e,2),n=t[0],r=t[1],a=(0,D.useState)(!1),o=i()(a,2),y=o[0],F=o[1],z=(0,m.useDispatch)(),A=(0,m.useSelector)((function(e){return e.global.session})),P=(0,m.useSelector)((function(e){return e.global.account})),R=(0,m.useSelector)((function(e){return e.global.contractKit})),V=(0,m.useSelector)((function(e){return e.vote.nodeDataSource})),E=(0,D.useState)(""),T=i()(E,2),W=T[0],B=T[1],q=(0,m.useSelector)((function(e){return e.dash.nodeInfo})),L=(0,m.useSelector)((function(e){return e.vote.responseTime})),H=(0,D.useRef)(),G=(0,m.useIntl)(),J=G.formatMessage({id:"node.intlVotes"}),K=G.formatMessage({id:"node.intlStatus"}),Q=G.formatMessage({id:"node.intlP2PStatus"}),Y=G.formatMessage({id:"node.intlRPCStatus"}),$=G.formatMessage({id:"node.intlLocation"}),U=G.formatMessage({id:"node.intlWebsite"}),X=G.formatMessage({id:"node.intlTotalReward"}),ee=G.formatMessage({id:"node.intlAction"}),te=G.formatMessage({id:"node.intlNodes"}),ne=G.formatMessage({id:"node.intlProducers"}),re=G.formatMessage({id:"node.intlRewardPool"}),se=G.formatMessage({id:"node.intlMinVotes"}),ae=G.formatMessage({id:"producer.intlVote"}),ce=G.formatMessage({id:"node.intlVoteSuccess"}),oe=G.formatMessage({id:"node.intlVoteFail"}),ie=G.formatMessage({id:"common.intlPleaseConnectWallet"}),le=G.formatMessage({id:"common.intlPleaseConnectNetwork"}),ue=G.formatMessage({id:"node.intlResponseTime"}),de=(0,D.useCallback)(function(){var e=c()(s()().mark((function e(t){var n,r,a,c,o,l,u,p,x;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},r=/http:/,a=/api\.dfsland\..*|www\.dfsland\..*|api\.dfsnetwork\..*|api\.goldenpig\.mom.*|api\.dapaopro\.xyz.*/,!t.length){e.next=31;break}c=0;case 5:if(!(c<t.length)){e.next=30;break}if("offline"!==t[c].rpcstatus){e.next=11;break}return n[t[c].owner]="NA",e.abrupt("continue",27);case 11:if(!r.test(t[c].rpcurl)){e.next=16;break}return n[t[c].owner]="http",e.abrupt("continue",27);case 16:if(!a.test(t[c].rpcurl)){e.next=19;break}return n[t[c].owner]="cors",e.abrupt("continue",27);case 19:return o=M()().valueOf(),e.next=22,(0,f.zI)(Z().get("".concat(t[c].rpcurl,"/v1/chain/get_info"),{timeout:1e4}));case 22:l=e.sent,u=i()(l,1),p=u[0],x=M()().valueOf(),n[t[c].owner]=p?"9999":String(x-o);case 27:c++,e.next=5;break;case 30:z(d.N.setResponseTime(n));case 31:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[]),fe=(0,D.useCallback)(function(){var e=c()(s()().mark((function e(t){var r,a,c,o,i,l,p;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Z().get("https://api.dfs.land/dfschain/producers");case 3:return r=e.sent.data,e.next=6,t.client.v1.chain.get_currency_stats("eosio.token","DFS");case 6:return a=e.sent,e.next=9,t.client.v1.chain.get_currency_balance("eosio.token","dfsbpsvoters","DFS");case 9:return c=e.sent,e.next=12,t.client.v1.chain.get_producer_schedule();case 12:o=e.sent,i=o.active.producers,l=r.reduce((function(e,t){var n=0;return t.current_status&&(n=t.current_status),e+n}),0),p={totalNodes:r.length,totalProducers:i.length,totalNodesOnline:l,rewardMinVotes:a.DFS.supply.value/1e4,bpRewardPoolBal:c[0].value},z(u.N.setNodeInfo(p)),r.forEach((function(e,t){r[t].last_check||(r[t].current_status=0,r[t].p2pstatus="offline",r[t].rpcstatus="offline",r[t].total_reward="0.00000000 DFS");var n=r[t].logo;n&&!n.startsWith("http")&&n.startsWith("Qm")?r[t].logo="https://imagedelivery.net/hc5yVyoIvwlbf8YqJjqHMw/".concat(n,"/public"):void 0!==n&&/^(https|http|ftp):\/\/[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,}(:[0-9]{1,5})?(\/[\S]*)?$/.test(n)||(r[t].logo="https://dfs.land/assets/icons/48x48.png"),r[t].key=t,r[t].rank=t+1,1===r[t].current_status&&Number(e.total_votes)/1e8>=p.rewardMinVotes?r[t].is_reward=1:r[t].is_reward=0})),z(d.N.setNodeDataSource(r)),F(!1),de(r),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(0),F(!1),(0,f.Tv)(e.t0,n,"handleGetNodeInfo");case 27:case"end":return e.stop()}}),e,null,[[0,23]])})));return function(t){return e.apply(this,arguments)}}(),[de,n]),pe=(0,D.useCallback)(function(){var e=c()(s()().mark((function e(t){var n,r,a,c;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=8;break}return e.next=3,(0,f.zI)(t.client.v1.chain.get_info());case 3:n=e.sent,r=i()(n,2),a=r[0],(c=r[1])?B(c.head_block_producer.toString()):(B(""),console.log(a));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[]),xe=(0,D.useCallback)((function(e){switch(e.nick){case"DFSNode.Online - 广州":return e.key+1+". DFSOnline-广州";case"DFSNode.Online - 杭州":return e.key+1+". DFSOnline-杭州";case"DFSNode.Online - 香港":return e.key+1+". DFSOnline-香港";case"DFSNode.Online - 张家口":return e.key+1+". DFSOnline-张家口";case"DFSNode.Online - 呼和浩特":return e.key+1+". DFSOnline-呼和浩特";case"DFS-美国弗吉尼亚-Node":return e.key+1+". DFS-美国弗吉尼亚";case"DFS-北京节点(持续在线)":return e.key+1+". DFS-北京节点";case"DFS-广州(持续在线)":return e.key+1+". DFS-广州";default:return e.key+1+". "+e.nick}}),[]),he=(0,D.useCallback)((function(e,t){var n=e.current_status,r=e.is_reward,s=e.is_active,a=Number(e.total_votes)/1e8,c=s?(0,O.jsx)(b.Z,{color:"blue",children:"Active"}):(0,O.jsx)(b.Z,{children:"Deactive"});return t<30?1===r?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b.Z,{icon:(0,O.jsx)(p.Z,{spin:!0}),color:"blue",children:"Online+30%"}),c]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b.Z,{className:"font-semibold",icon:(0,O.jsx)(x.Z,{}),color:"red",children:"Offline+30%"}),c]}):a>=q.rewardMinVotes?1===n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b.Z,{icon:(0,O.jsx)(p.Z,{spin:!0}),color:"blue",children:"Online"}),c]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b.Z,{className:"font-semibold",icon:(0,O.jsx)(x.Z,{}),color:"red",children:"Offline"}),c]}):1===n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b.Z,{icon:(0,O.jsx)(p.Z,{}),color:"blue",children:"Online"}),c]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(b.Z,{className:"font-semibold",icon:(0,O.jsx)(x.Z,{}),color:"red",children:"Offline"}),c]})}),[q]),ve=(0,D.useCallback)(function(){var e=c()(s()().mark((function e(t){var r,a,c,o,l;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(A&&A.broadcast){e.next=5;break}return n.error("".concat(ie)),e.abrupt("return");case 5:if(P){e.next=8;break}return n.error("".concat(le)),e.abrupt("return");case 8:return r={action:{account:"dfsbpsvoters",name:"vote",authorization:[A.permissionLevel],data:{voter:A.actor,producer:t.owner}}},e.next=11,(0,f.zI)(A.transact(r));case 11:a=e.sent,c=i()(a,2),o=c[0],l=c[1],o?n.error(o):l&&l.response?n.success("".concat(ce)):n.error("".concat(oe));case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[A,P]);(0,D.useEffect)((function(){A?(V.length?F(!1):F(!0),fe(A),pe(A)):F(!0)}),[A,fe,pe]),(0,D.useEffect)((function(){return A&&(C=setInterval((function(){pe(A)}),6e3)),function(){clearInterval(C)}}),[A,pe]),(0,D.useEffect)((function(){return A&&(I=setInterval((function(){fe(A)}),12e4)),function(){clearInterval(I)}}),[A,R,fe]);var me=(0,D.useMemo)((function(){return[{title:(0,O.jsx)("span",{className:"text-blue-500",children:W||"Node"}),dataIndex:"owner",key:"owner",fixed:!0,render:function(e,t){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(j.Z,{title:t.intro,placement:"topLeft",children:(0,O.jsx)("span",{className:"hover:cursor-pointer font-semibold",children:xe(t)})}),(0,O.jsxs)("div",{className:"flex items-center",children:[(0,O.jsx)(w.C,{className:"mr-2",size:"default",shape:"square",src:t.logo}),(0,O.jsx)("div",{className:"",children:t.owner})]})]})}},{title:"".concat(J," / ").concat(K),dataIndex:"current_status",key:"current_status",sorter:function(e,t){return Number(e.total_votes)-Number(t.total_votes)},filters:[{text:"Online",value:"online"},{text:"Offline",value:"offline"},{text:"Active",value:"active"},{text:"Deactive",value:"deactive"}],onFilter:function(e,t){return"online"===e?1===t.current_status:"offline"===e?0===t.current_status:"active"===e?1===t.is_active:"deactive"!==e||0===t.is_active},render:function(e,t,n){return(0,O.jsxs)("div",{children:[(0,O.jsx)("div",{onClick:function(){return H.current.handleOpen(t)},children:(0,O.jsx)("a",{children:(Number(t.total_votes)/1e8).toFixed(0)})}),he(t,n)]})}},{title:"".concat(Y," / ").concat(Q),dataIndex:"rpcstatus",key:"rpcstatus",render:function(e,t){return(0,O.jsxs)("div",{children:["online"===t.rpcstatus?(0,O.jsx)("div",{children:t.rpcurl}):(0,O.jsx)("div",{className:"text-red-600 font-semibold",children:t.rpcurl}),"online"===t.p2pstatus?(0,O.jsx)("div",{children:t.p2purl}):(0,O.jsx)("div",{className:"text-red-600 font-semibold",children:t.p2purl})]})}},{title:"".concat($," / ").concat(U),dataIndex:"url",key:"url",render:function(e,t){return(0,O.jsxs)("div",{children:[(0,O.jsx)("div",{children:t.location}),(0,O.jsx)("div",{style:{maxWidth:"200px"},children:(0,O.jsx)("a",{href:t.url,target:"blank",children:t.url})})]})}},{title:"".concat(X),dataIndex:"total_reward",key:"total_reward",sorter:function(e,t){return Number(t.total_reward.split(" ")[0])-Number(e.total_reward.split(" ")[0])},render:function(e,t){return(0,O.jsx)("div",{children:Number(t.total_reward.split(" ")[0]).toFixed(2)+" "+t.total_reward.split(" ")[1]})}},{title:"".concat(ue),dataIndex:"owner",key:"owner",sorter:function(e,t){return L[e.owner].localeCompare(L[t.owner])},render:function(e,t){var n=(0,O.jsx)("div",{}),r=Object.keys(L).length;return r&&(n="NA"===L[t.owner]?(0,O.jsx)("div",{className:"text-red-600 font-semibold",children:"NA"}):"http"===L[t.owner]?(0,O.jsx)("div",{className:"text-red-600 font-semibold line-through",children:"http"}):"cors"===L[t.owner]?(0,O.jsx)("div",{className:"text-red-600 font-semibold line-through",children:"cors"}):(0,O.jsx)("div",{children:L[t.owner]+"ms"})),(0,O.jsx)("span",{children:r?n:(0,O.jsx)(p.Z,{spin:!0,style:{color:"#0958d9"}})})}},{title:"".concat(ee),dataIndex:"key",key:"key",align:"center",render:function(e,t){return(0,O.jsx)(k.ZP,{onClick:function(){return ve(t)},children:ae})}}]}),[W,L]);return(0,O.jsxs)(h._z,{className:"node",ghost:!0,children:[(0,O.jsx)(v.Z,{scroll:{x:!0},size:"small",columns:me,dataSource:V,defaultData:[],loading:{spinning:y,size:"large"},rowClassName:function(e){return e.owner===W?"bg-blue-200":""},search:!1,options:!1,pagination:{pageSize:100},tableAlertRender:!1,tableAlertOptionRender:!1,headerTitle:(0,O.jsxs)(N.Z,{gutter:10,className:"w-full",children:[(0,O.jsx)(S.Z,{lg:{span:"6"},md:{span:"6"},sm:{span:"6"},xs:{span:"6"},children:(0,O.jsx)(_.Z,{title:(0,O.jsx)("div",{className:"text-center",children:te}),valueStyle:{textAlign:"center"},value:"".concat(q.totalNodesOnline,"/").concat(q.totalNodes)})}),(0,O.jsx)(S.Z,{lg:{span:"6"},md:{span:"6"},sm:{span:"6"},xs:{span:"6"},children:(0,O.jsx)(_.Z,{title:(0,O.jsx)("div",{className:"text-center",children:ne}),valueStyle:{textAlign:"center"},value:q.totalProducers})}),(0,O.jsx)(S.Z,{lg:{span:"6"},md:{span:"6"},sm:{span:"6"},xs:{span:"6"},children:(0,O.jsx)(_.Z,{title:(0,O.jsx)("div",{className:"text-center",children:se}),valueStyle:{textAlign:"center"},value:q.rewardMinVotes.toFixed(0)})}),(0,O.jsx)(S.Z,{lg:{span:"6"},md:{span:"6"},sm:{span:"6"},xs:{span:"6"},children:(0,O.jsx)(_.Z,{title:(0,O.jsx)("div",{className:"text-center",children:re}),valueStyle:{textAlign:"center"},value:q.bpRewardPoolBal.toFixed(2)})})]})}),(0,O.jsx)(l._h,{ref:H}),r]})}}}]);