-
Notifications
You must be signed in to change notification settings - Fork 0
/
src__pages__Coffee__CoffeeEOS.async.js
1 lines (1 loc) · 3.55 KB
/
src__pages__Coffee__CoffeeEOS.async.js
1
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2280,2569],{13191:function(e,a,r){r.r(a);var n=r(15009),t=r.n(n),s=r(99289),o=r.n(s),c=r(5574),i=r.n(c),u=r(64119),l=r(11774),f=r(38345),m=r(97269),d=r(5966),p=r(59530),b=r(80507),g=r(45360),x=r(15867),h=r(62435),k=(r(82267),r(86074));a.default=function(){var e=g.ZP.useMessage(),a=i()(e,2),r=a[0],n=a[1],s=(0,p.useSelector)((function(e){return e.global.session})),c=(0,p.useSelector)((function(e){return e.global.account})),v=(0,p.useIntl)(),M=v.formatMessage({id:"common.intlCopy"}),w=v.formatMessage({id:"common.intlTransferSuccess"}),y=v.formatMessage({id:"common.intlTransferFail"}),j=v.formatMessage({id:"common.intlCopySuccess"}),C=v.formatMessage({id:"coffee.inputException"}),_=v.formatMessage({id:"coffee.account"}),P=v.formatMessage({id:"coffee.pleaseInputTokenNumber"},{symbol:s?s.chain.name:"DFS"}),S=v.formatMessage({id:"coffee.cardTitle"}),F=v.formatMessage({id:"coffee.message"}),q=v.formatMessage({id:"coffee.leaveAMessage"}),z=v.formatMessage({id:"common.intlPleaseConnectWallet"}),N=v.formatMessage({id:"common.intlPleaseConnectNetwork"}),Z=v.formatMessage({id:"common.intlInsufficientBalance"}),T=(0,h.useCallback)(function(){var e=o()(t()().mark((function e(a){var n,o,l,f,m,d,p,g,x,h;return t()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s&&s.broadcast){e.next=5;break}return r.error("".concat(z)),e.abrupt("return");case 5:if(c){e.next=8;break}return r.error("".concat(N)),e.abrupt("return");case 8:if(c.data.core_liquid_balance){e.next=11;break}return r.error("".concat(Z)),e.abrupt("return");case 11:if(n=c.data.core_liquid_balance.value,o=c.data.core_liquid_balance.symbol.name,l=c.data.core_liquid_balance.symbol.precision,!((f=Number(a.value))>n)){e.next=18;break}return r.error("".concat(Z)),e.abrupt("return");case 18:return m=b.xR.from(f,b.xR.Symbol.fromParts(o,l)),d={action:{account:"eosio.token",name:"transfer",authorization:[s.permissionLevel],data:{from:s.actor,to:a.to,quantity:m.toString(),memo:a.memo}}},e.next=22,(0,u.zI)(s.transact(d));case 22:return p=e.sent,g=i()(p,2),x=g[0],h=g[1],x?r.error(x):h&&h.response?r.success("".concat(w)):r.error("".concat(y)),e.abrupt("return",!0);case 28:case"end":return e.stop()}}),e)})));return function(a){return e.apply(this,arguments)}}(),[s,c]),I=(0,h.useCallback)(o()(t()().mark((function e(){return t()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.navigator.clipboard.writeText("davidaccount");case 2:r.success("".concat(j));case 3:case"end":return e.stop()}}),e)}))),[]);return(0,k.jsxs)(l._z,{className:"coffee",ghost:!0,children:[(0,k.jsx)("div",{className:"flex justify-center",children:(0,k.jsx)(f.Z,{title:(0,k.jsx)("span",{className:" font-semibold text-lg",children:S}),style:{width:"450px"},children:(0,k.jsxs)(m.A,{initialValues:{memo:""},onFinish:function(){var e=o()(t()().mark((function e(a){return t()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",T(a));case 1:case"end":return e.stop()}}),e)})));return function(a){return e.apply(this,arguments)}}(),submitter:{render:function(e,a){return[a[1],a[0],(0,k.jsx)(x.ZP,{onClick:I,children:M},"copy")]}},children:[(0,k.jsx)(d.Z,{name:"to",label:_,disabled:!0,initialValue:"davidaccount",fieldProps:{size:"large",autoFocus:!1}}),(0,k.jsx)(d.Z,{name:"memo",label:F,placeholder:q,fieldProps:{size:"large",autoFocus:!1}}),(0,k.jsx)(d.Z,{name:"value",label:s?s.chain.name:"DFS",placeholder:P,rules:[{required:!0,message:"".concat(C),whitespace:!0,pattern:/^\d+(\.\d{1,8})?$/}],fieldProps:{size:"large",autoFocus:!1}})]})})}),n]})}},82267:function(){}}]);