-
Notifications
You must be signed in to change notification settings - Fork 0
/
src__pages__Msig__Pubkey.async.js
1 lines (1 loc) · 17 KB
/
src__pages__Msig__Pubkey.async.js
1
(self.webpackChunk=self.webpackChunk||[]).push([[1519],{91604:function(e,n,r){"use strict";r.d(n,{Z:function(){return x}});var t=r(1413),a=r(87462),s=r(62435),i={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"},c=r(84089),o=function(e,n){return s.createElement(c.Z,(0,a.Z)({},e,{ref:n,icon:i}))};var u=s.forwardRef(o),l=r(28459),f=r(2058),d=r(9105),m=r(90789),p=r(86074),g=s.forwardRef((function(e,n){var r=e.fieldProps,a=e.title,i=void 0===a?"单击或拖动文件到此区域进行上传":a,c=e.icon,o=void 0===c?(0,p.jsx)(u,{}):c,m=e.description,g=void 0===m?"支持单次或批量上传":m,x=e.action,h=e.accept,v=e.onChange,b=e.value,k=e.children,S=e.max,w=e.proFieldProps,y=(0,s.useContext)(l.ZP.ConfigContext),j=(0,s.useContext)(d.A),C=(null==w?void 0:w.mode)||j.mode||"edit",N=y.getPrefixCls("upload"),M=(void 0===S||!b||(null==b?void 0:b.length)<S)&&"read"!==C&&!0!==(null==w?void 0:w.readonly);return(0,p.jsxs)(f.Z.Dragger,(0,t.Z)((0,t.Z)({ref:n,name:"files",action:x,accept:h,fileList:b},r),{},{onChange:function(e){null==v||v(e),null!=r&&r.onChange&&(null==r||r.onChange(e))},style:(0,t.Z)((0,t.Z)({},null==r?void 0:r.style),{},{display:M?void 0:"none"}),children:[(0,p.jsx)("p",{className:"".concat(N,"-drag-icon"),children:o}),(0,p.jsx)("p",{className:"".concat(N,"-text"),children:i}),(0,p.jsx)("p",{className:"".concat(N,"-hint"),children:g}),k?(0,p.jsx)("div",{className:"".concat(N,"-extra"),style:{padding:16},children:k}):null]}))})),x=(0,m.G)(g,{getValueFromEvent:function(e){return e.fileList}})},218:function(e,n,r){"use strict";r.d(n,{s:function(){return d}});var t=r(5574),a=r.n(t),s=r(37476),i=r(90672),c=r(59530),o=r(45360),u=r(62435),l=r(86074),f=u.forwardRef((function(e,n){var r=o.ZP.useMessage(),t=a()(r,2),f=t[0],d=t[1],m=(0,u.useRef)(),p=(0,u.useState)(!1),g=a()(p,2),x=g[0],h=g[1],v=(0,u.useState)(""),b=a()(v,2),k=b[0],S=b[1],w=(0,u.useState)(""),y=a()(w,2),j=y[0],C=y[1],N=(0,c.useIntl)(),M=N.formatMessage({id:"msig.intlPreviewFail"}),T=N.formatMessage({id:"msig.intlClose"}),F=(0,u.useCallback)((function(e){var n=new FileReader;n.readAsText(e.originFileObj),n.onload=function(){try{var r,t=JSON.parse(n.result);if(t)null===(r=m.current)||void 0===r||r.setFieldValue("content",JSON.stringify(t,null,2)),S(JSON.stringify(t,null,2)),C(e.name),h(!0);else f.error("".concat(M))}catch(e){f.error("".concat(M))}}}),[]);return(0,u.useImperativeHandle)(n,(function(){return{handleOpen:F}})),(0,l.jsxs)(s.Y,{formRef:m,title:(0,l.jsx)("div",{className:"mt-3",children:j}),open:x,onOpenChange:function(e){h(e)},layout:"vertical",width:"700px",modalProps:{style:{top:25}},submitter:{searchConfig:{resetText:T},render:function(e,n){return[n[0]]}},children:[(0,l.jsx)(i.Z,{name:"content",fieldProps:{autoSize:{minRows:5},allowClear:!1,autoFocus:!1,onChange:void 0,value:k,size:"large"}}),d]})})),d=(0,u.memo)(f)},56706:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return J}});var t=r(15009),a=r.n(t),s=r(97857),i=r.n(s),c=r(19632),o=r.n(c),u=r(64599),l=r.n(u),f=r(99289),d=r.n(f),m=r(5574),p=r.n(m),g=r.p+"static/msigPubkey.c1821967.png",x=r(218),h=r(64119),v=r(11774),b=r(38345),k=r(97269),S=r(90672),w=r(91604),y=r(59530),j=r(80507),C=r(45360),N=r(99021),M=r(2058),T=r(15867),F=r(27484),O=r.n(F),P=r(70178),Z=r.n(P),I=r(62435),R=(r(99646),r(86074));O().extend(Z());var J=function(){var e=C.ZP.useMessage(),n=p()(e,2),r=n[0],t=n[1],s=(0,y.useSelector)((function(e){return e.global.session})),c=(0,y.useSelector)((function(e){return e.global.account})),u=(0,I.useRef)(),f=(0,I.useRef)(),m=(0,I.useRef)(),F=(0,I.useState)(""),P=p()(F,2),Z=P[0],J=P[1],_=(0,I.useState)(""),A=p()(_,2),z=A[0],E=A[1],L=(0,I.useState)(""),V=p()(L,2),Y=V[0],H=V[1],D=(0,I.useState)(1),U=p()(D,2),W=U[0],Q=U[1],G=(0,I.useState)([]),q=p()(G,2),B=q[0],K=q[1],X=(0,y.useIntl)(),$=X.formatMessage({id:"verify.intlSignSuccess"}),ee=X.formatMessage({id:"verify.intlSignFail"}),ne=X.formatMessage({id:"common.intlCopySuccess"}),re=X.formatMessage({id:"common.intlInputException"}),te=X.formatMessage({id:"msig.intlImportFail"}),ae=X.formatMessage({id:"msig.intlImportSuccess"}),se=X.formatMessage({id:"msig.intlUploadFail"}),ie=X.formatMessage({id:"msig.intlUploadSuccess"}),ce=X.formatMessage({id:"common.intlPleaseConnectWallet"}),oe=X.formatMessage({id:"common.intlPleaseConnectNetwork"}),ue=X.formatMessage({id:"msig.intlSignedTransaction"}),le=X.formatMessage({id:"msig.intlSign"}),fe=X.formatMessage({id:"msig.intlImportTransaction"}),de=X.formatMessage({id:"msig.intlExportSignedTransaction"}),me=X.formatMessage({id:"msig.intlCopySignedTransaction"}),pe=X.formatMessage({id:"msig.intlTransactionInfo"}),ge=X.formatMessage({id:"msig.intlSendTransaction"}),xe=X.formatMessage({id:"msig.intlSend"}),he=X.formatMessage({id:"msig.intlSignAndSend"}),ve=X.formatMessage({id:"msig.intlNoNeedInput"}),be=X.formatMessage({id:"msig.intlTransactionEmpty"}),ke=X.formatMessage({id:"msig.intlTransactionDifferent"}),Se=X.formatMessage({id:"common.intlTxSuccess"}),we=X.formatMessage({id:"common.intlTxFail"}),ye=X.formatMessage({id:"contract.intlCreateTransaction"}),je=X.formatMessage({id:"msig.intlCreatTxTip1"}),Ce=X.formatMessage({id:"msig.intlCreatTxTip2"}),Ne=X.formatMessage({id:"msig.intlCreatTxTip3"}),Me=(0,I.useCallback)(function(){var e=d()(a()().mark((function e(n){var t,f,d,m,g,x,v,b,k,S,w,y,C,N,M,T,F,P,Z,I,R,_,A,z,L,V,Y,D;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s&&s.broadcast){e.next=5;break}return r.error("".concat(ce)),e.abrupt("return",!1);case 5:if(c){e.next=8;break}return r.error("".concat(oe)),e.abrupt("return",!1);case 8:t=JSON.parse(n.transactionInfo),f=j.uQ.from(t),d=j.YW.from(t),m=[],g=new Set,d.actions.forEach((function(e){g.add(e.account.toString())})),d.context_free_actions.forEach((function(e){g.add(e.account.toString())})),x=l()(g),e.prev=16,x.s();case 18:if((v=x.n()).done){e.next=34;break}return b=v.value,e.next=22,(0,h.zI)(s.client.v1.chain.get_abi(b));case 22:if(k=e.sent,S=p()(k,2),w=S[0],y=S[1],!w){e.next=31;break}return r.error(w),e.abrupt("return",!1);case 31:m.push({abi:j.dL.from(y.abi),account:j.VG.from(b)});case 32:e.next=18;break;case 34:e.next=39;break;case 36:e.prev=36,e.t0=e.catch(16),x.e(e.t0);case 39:return e.prev=39,x.f(),e.finish(39);case 42:return e.next=44,(0,h.zI)(s.transact({transaction:d},{broadcast:!1,transactPlugins:[],abis:m}));case 44:if(C=e.sent,N=p()(C,2),M=N[0],T=N[1],!M){e.next=53;break}return r.error(M),e.abrupt("return",!1);case 53:if(!T){e.next=85;break}P=T.resolved.transaction,Z=T.signatures[0],I=Array.from(new Set([].concat(o()(f.signatures.map(String)),[Z]))),R=j.uQ.from(i()(i()({},P),{},{signatures:I})),_=j.Pc.from(Z),A=_.recoverDigest(T.resolved.signingDigest).toString(),z=c.data.permissions,L=0;case 62:if(!(L<z.length)){e.next=78;break}if(z[L].perm_name.toString()!==s.permission.toString()){e.next=75;break}V=z[L].required_auth.keys,Y=0;case 66:if(!(Y<V.length)){e.next=74;break}if(V[Y].key.toString()!==A){e.next=71;break}return E(A),Q(V[Y].weight.value),e.abrupt("break",74);case 71:Y++,e.next=66;break;case 74:return e.abrupt("break",78);case 75:L++,e.next=62;break;case 78:D=O()(P.expiration.toString()).utc().format("YYYY-MM-DDTHH:mm:ss"),H(D),null===(F=u.current)||void 0===F||F.setFieldValue("signedTransaction",JSON.stringify(R,null,2)),J(JSON.stringify(R,null,2)),r.success("".concat($)),e.next=86;break;case 85:r.error("".concat(ee));case 86:return e.abrupt("return",!0);case 87:case"end":return e.stop()}}),e,null,[[16,36,39,42]])})));return function(n){return e.apply(this,arguments)}}(),[s,c]),Te=(0,I.useCallback)(d()(a()().mark((function e(){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.navigator.clipboard.writeText(Z);case 2:r.success("".concat(ne));case 3:case"end":return e.stop()}}),e)}))),[Z]),Fe=(0,I.useCallback)(function(){var e=d()(a()().mark((function e(n){var t;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(t=new FileReader).readAsText(n.fileList[0].originFileObj),t.onload=function(){try{var e,n=JSON.parse(t.result);if(n)null===(e=u.current)||void 0===e||e.setFieldValue("transactionInfo",JSON.stringify(n,null,2)),r.success("".concat(ae));else r.error("".concat(te))}catch(e){(0,h.Tv)(e,r,"handleImport")}};case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),[]),Oe=(0,I.useCallback)(function(){var e=d()(a()().mark((function e(n){var t;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("removed"!==n.file.status){e.next=3;break}return K(n.fileList),e.abrupt("return");case 3:(t=new FileReader).readAsText(n.fileList[n.fileList.length-1].originFileObj),t.onload=function(){try{JSON.parse(t.result)?(K(n.fileList),r.success("".concat(ie))):r.error("".concat(se))}catch(e){(0,h.Tv)(e,r,"handleUpload")}};case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),[]),Pe=(0,I.useCallback)((function(){var e=s.actor.toString(),n=s.permission.toString(),r="data:,".concat(Z),t=document.createElement("a");t.href=r,t.download="".concat(e,"@").concat(n,"#").concat(z,"_weight@").concat(W,"_expiration@").concat(Y,"_signed.json"),t.click()}),[Z,s,z,Y,W]),Ze=(0,I.useCallback)(d()(a()().mark((function e(){var n,t,c,o,u,f,d,m,p;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==B.length){e.next=3;break}return r.error(be),e.abrupt("return",!1);case 3:e.prev=3,n=new Set,t="",c=l()(B),e.prev=7,u=a()().mark((function e(){var s,i,c;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.value,e.next=3,new Promise((function(e){var n=new FileReader;n.readAsText(s.originFileObj),n.onload=function(){return e(n.result)}}));case 3:if(i=e.sent,(c=JSON.parse(i)).signatures.forEach((function(e){n.add(e)})),t){e.next=11;break}c.signatures=[],t=JSON.stringify(c),e.next=15;break;case 11:if(c.signatures=[],t===JSON.stringify(c)){e.next=15;break}return r.error(ke),e.abrupt("return",{v:!1});case 15:case"end":return e.stop()}}),e)})),c.s();case 10:if((o=c.n()).done){e.next=17;break}return e.delegateYield(u(),"t0",12);case 12:if(!(f=e.t0)){e.next=15;break}return e.abrupt("return",f.v);case 15:e.next=10;break;case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(7),c.e(e.t1);case 22:return e.prev=22,c.f(),e.finish(22);case 25:return d=j.YW.from(JSON.parse(t)),m=j.uQ.from(i()(i()({},d),{},{signatures:Array.from(n)})),e.next=29,s.client.v1.chain.push_transaction(m);case 29:(p=e.sent)&&p.processed&&"executed"===p.processed.receipt.status?r.success(Se):r.error(we),e.next=36;break;case 33:e.prev=33,e.t2=e.catch(3),(0,h.Tv)(e.t2,r,"handleConfirmSend");case 36:case"end":return e.stop()}}),e,null,[[3,33],[7,19,22,25]])}))),[B,r,s]),Ie=(0,I.useCallback)(d()(a()().mark((function e(){var n,t,o,u,f,d,m,g,x,v,b,k,S,w,y,C,N,M,T,F,O,P,Z,I;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==B.length){e.next=3;break}return r.error(be),e.abrupt("return",!1);case 3:if(s&&s.broadcast){e.next=8;break}return r.error("".concat(ce)),e.abrupt("return");case 8:if(c){e.next=11;break}return r.error("".concat(oe)),e.abrupt("return");case 11:e.prev=11,n=new Set,t="",o=l()(B),e.prev=15,f=a()().mark((function e(){var s,i,c;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=u.value,e.next=3,new Promise((function(e){var n=new FileReader;n.readAsText(s.originFileObj),n.onload=function(){return e(n.result)}}));case 3:if(i=e.sent,(c=JSON.parse(i)).signatures.forEach((function(e){n.add(e)})),t){e.next=11;break}c.signatures=[],t=JSON.stringify(c),e.next=15;break;case 11:if(c.signatures=[],t===JSON.stringify(c)){e.next=15;break}return r.error(ke),e.abrupt("return",{v:!1});case 15:case"end":return e.stop()}}),e)})),o.s();case 18:if((u=o.n()).done){e.next=25;break}return e.delegateYield(f(),"t0",20);case 20:if(!(d=e.t0)){e.next=23;break}return e.abrupt("return",d.v);case 23:e.next=18;break;case 25:e.next=30;break;case 27:e.prev=27,e.t1=e.catch(15),o.e(e.t1);case 30:return e.prev=30,o.f(),e.finish(30);case 33:m=j.YW.from(JSON.parse(t)),g=[],x=new Set,m.actions.forEach((function(e){x.add(e.account.toString())})),m.context_free_actions.forEach((function(e){x.add(e.account.toString())})),v=l()(x),e.prev=39,v.s();case 41:if((b=v.n()).done){e.next=57;break}return k=b.value,e.next=45,(0,h.zI)(s.client.v1.chain.get_abi(k));case 45:if(S=e.sent,w=p()(S,2),y=w[0],C=w[1],!y){e.next=54;break}return r.error(y),e.abrupt("return",!1);case 54:g.push({abi:j.dL.from(C.abi),account:j.VG.from(k)});case 55:e.next=41;break;case 57:e.next=62;break;case 59:e.prev=59,e.t2=e.catch(39),v.e(e.t2);case 62:return e.prev=62,v.f(),e.finish(62);case 65:return e.next=67,(0,h.zI)(s.transact({transaction:m},{broadcast:!1,transactPlugins:[],abis:g}));case 67:if(N=e.sent,M=p()(N,2),T=M[0],F=M[1],!T){e.next=76;break}return r.error(T),e.abrupt("return",!1);case 76:return O=F.resolved.transaction,P=F.signatures[0],n.add(P),Z=j.uQ.from(i()(i()({},O),{},{signatures:Array.from(n)})),e.next=82,s.client.v1.chain.push_transaction(Z);case 82:(I=e.sent)&&I.processed&&"executed"===I.processed.receipt.status?r.success(Se):r.error(we);case 84:e.next=89;break;case 86:e.prev=86,e.t3=e.catch(11),(0,h.Tv)(e.t3,r,"handleConfirmSignAndSend");case 89:case"end":return e.stop()}}),e,null,[[11,86],[15,27,30,33],[39,59,62,65]])}))),[B,r,s,c]);return(0,R.jsxs)(v._z,{className:"msig",ghost:!0,children:[(0,R.jsxs)("div",{className:"flex justify-evenly flex-wrap items-start",children:[(0,R.jsxs)(b.Z,{className:" mb-4",title:(0,R.jsx)("div",{className:" font-semibold text-lg hardline",children:ye}),children:[(0,R.jsx)("div",{children:je}),(0,R.jsx)("div",{children:Ce}),(0,R.jsx)("div",{children:Ne}),(0,R.jsx)(N.Z,{src:g,width:300})]}),(0,R.jsx)(b.Z,{className:" mb-4",title:(0,R.jsx)("div",{className:" font-semibold text-lg hardline",children:ue}),children:(0,R.jsxs)(k.A,{style:{overflowWrap:"anywhere"},formRef:u,onFinish:function(){var e=d()(a()().mark((function e(n){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Me(n));case 1:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),onReset:function(){var e;null===(e=u.current)||void 0===e||e.resetFields(),J("")},submitter:{searchConfig:{submitText:le},render:function(e,n){return(0,R.jsxs)("div",{style:{marginTop:"10px"},children:[(0,R.jsxs)("div",{className:"flex",children:[(0,R.jsx)(M.Z,{className:"mr-[8px]",accept:".json",maxCount:1,showUploadList:!1,onChange:Fe,beforeUpload:function(){return!1},children:(0,R.jsx)(T.ZP,{type:"primary",children:fe})},"upload"),(0,R.jsx)("div",{className:"mr-[8px]",children:n[1]}),(0,R.jsx)(T.ZP,{className:"mr-[8px]",type:"primary",onClick:Pe,children:de},"export")]}),(0,R.jsxs)("div",{className:"flex mt-[14px]",children:[(0,R.jsx)(T.ZP,{className:"mr-[8px]",onClick:Te,children:me},"copy"),(0,R.jsx)("div",{className:"mr-[8px]",children:n[0]})]})]})}},children:[(0,R.jsx)(S.Z,{name:"transactionInfo",label:pe,fieldProps:{autoSize:{minRows:7},autoFocus:!1,size:"large"},rules:[{required:!0,whitespace:!0,message:"".concat(re)}]}),(0,R.jsx)(S.Z,{name:"signedTransaction",label:ue,placeholder:ve,fieldProps:{autoSize:{minRows:7},autoFocus:!1,onChange:void 0,value:Z,size:"large"}})]})}),(0,R.jsx)(b.Z,{title:(0,R.jsx)("div",{className:" font-semibold text-lg hardline mb-4",children:ge}),children:(0,R.jsx)(k.A,{formRef:f,onFinish:d()(a()().mark((function e(){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ze());case 1:case"end":return e.stop()}}),e)}))),onReset:function(){var e;null===(e=f.current)||void 0===e||e.resetFields(),K([])},submitter:{searchConfig:{submitText:xe},render:function(e,n){return[n[1],(0,R.jsx)(T.ZP,{onClick:Ie,children:he},"send"),n[0]]}},children:(0,R.jsx)(w.Z,{label:pe,name:"transactionInfo",action:"upload.do",fieldProps:{accept:".json",onChange:Oe,beforeUpload:function(){return!1},listType:"picture",onPreview:function(e){return m.current.handleOpen(e)},fileList:B}})})}),(0,R.jsx)(x.s,{ref:m})]}),t]})}},99646:function(){},64599:function(e,n,r){var t=r(96263);e.exports=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var a=0,s=function(){};return{s:s,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){o=!0,i=e},f:function(){try{c||null==r.return||r.return()}finally{if(o)throw i}}}},e.exports.__esModule=!0,e.exports.default=e.exports}}]);