-
Notifications
You must be signed in to change notification settings - Fork 13
/
pm.560198ed605377e06591.js
1 lines (1 loc) · 46.3 KB
/
pm.560198ed605377e06591.js
1
"use strict";(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[981],{21910:(e,t,s)=>{s.r(t),s.d(t,{default:()=>J});var i=s(96540),n=s(9476),a=s(37556),r=s(44352),o=s(72181),l=s(64143),c=s(36247),p=s(10658),d=s.n(p),m=s(5556),h=s.n(m),u=s(24873),g=s(63024),b=s(46128),_=s(72090),k=s(72257),A=s(12569),f=s(83599),y=s(96366),v=s(87040);s(47048);class E extends i.Component{constructor(e){super(e),this.state={ticker:{}},this.tickersLoaded={}}onMarketAction(e,t="yes"){this.props.onMarketAction({market:e,action:t})}onRowAction=e=>({onClick:this.onMarketAction.bind(this,e)});getHeader(){const e=e=>this.props.currentAccount.get("id")===e;return[{title:d().translate("account.asset"),dataIndex:"asset_id",align:"left",defaultSortOrder:"ascend",sorter:(e,t)=>e.symbol>t.symbol?1:e.symbol<t.symbol?-1:0,render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement(u.A,{asset:e}))},{title:d().translate("prediction.overview.issuer"),dataIndex:"issuer",align:"left",sorter:(e,t)=>{let s=_.ChainStore.getAccount(e.issuer),i=_.ChainStore.getAccount(t.issuer),n=null,a=null;return s&&i&&(n=s.get("name"),a=i.get("name")),n>a?1:n<a?-1:0},render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement(g.A,{account:e}))},{title:d().translate("prediction.overview.prediction"),dataIndex:"condition",align:"left",sorter:(e,t)=>e.condition&&""!==e.condition?t.condition&&""!==t.condition?e.condition.localeCompare(t.condition):1:-1,render:e=>i.createElement("div",{style:{whiteSpace:"normal"}},i.createElement("span",null,e))},{title:d().translate("prediction.overview.market_confidence"),dataIndex:"marketConfidence",align:"left",sorter:(e,t)=>e.marketConfidence>t.marketConfidence?1:e.marketConfidence<t.marketConfidence?-1:0,render:(e,t)=>{const s=Object.assign({},this.state.ticker[t.asset_id]);return this.state.ticker[t.asset_id]?(s.quote_volume&&"0"!==s.quote_volume&&"1"!==s.quote_volume&&"NaN"!==s.quote_volume&&"-NaN"!==s.quote_volume?s.quote_volume=v.A.convert_typed_to_satoshi(parseFloat(s.quote_volume),_.ChainStore.getAsset(t.short_backing_asset)):s.quote_volume=0,s.percent_change&&"NaN"!==s.percent_change&&"-NaN"!==s.percent_change?"0"==s.percent_change?s.percent_change="0%":s.percent_change=(parseFloat(s.latest)>0?"+":"-")+s.percent_change+"%":s.percent_change="-",i.createElement("span",null,d().translate("exchange.vol_short")," ",i.createElement(y.A,{amount:s.quote_volume,asset:t.short_backing_asset})," ")):null}},{title:d().translate("prediction.overview.market_predicated_likelihood"),dataIndex:"marketLikelihood",align:"left",sorter:(e,t)=>e.marketLikelihood>t.marketLikelihood?1:e.marketLikelihood<t.marketLikelihood?-1:0,render:(e,t)=>{const s=Object.assign({},this.state.ticker[t.asset_id]);return this.state.ticker[t.asset_id]?(s.latest&&"0"!==s.latest&&"1"!==s.latest&&"NaN"!==s.latest&&"-NaN"!==s.latest?s.latest=(100*parseFloat(s.latest)).toPrecision(3)+"%":s.latest="-",s.highest_bid&&"0"!==s.highest_bid&&"1"!==s.highest_bid&&"NaN"!==s.highest_bid&&"-NaN"!==s.highest_bid?s.highest_bid=(100*parseFloat(s.highest_bid)).toPrecision(3)+"%":s.highest_bid="-",s.lowest_ask&&"0"!==s.lowest_ask&&"1"!==s.lowest_ask&&"NaN"!==s.lowest_ask&&"-NaN"!==s.lowest_ask?s.lowest_ask=(100*parseFloat(s.lowest_ask)).toPrecision(3)+"%":s.lowest_ask="-","-"!==s.latest?i.createElement(i.Fragment,null,i.createElement("span",null,s.latest," "),i.createElement("span",{className:"supsub"},i.createElement("sup",{className:"superscript"},s.highest_bid),i.createElement("sub",{className:"subscript"},s.lowest_ask))," "):"-"):null}},{title:d().translate("prediction.overview.description"),dataIndex:"description",align:"left",sorter:(e,t)=>e.description&&""!==e.description?t.description&&""!==t.description?e.description.localeCompare(t.description):1:-1,render:e=>i.createElement("div",{style:{whiteSpace:"normal"}},i.createElement("span",null,e))},{title:d().translate("prediction.overview.expiry"),dataIndex:"expiry",align:"left",sorter:(e,t)=>e.expiry&&""!==e.expiry?t.expiry&&""!==t.expiry?e.expiry.localeCompare(t.expiry):1:-1,render:e=>i.createElement("div",{style:{whiteSpace:"normal"}},i.createElement("span",null,e))},{title:d().translate("prediction.overview.action"),align:"center",render:t=>i.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e(t.issuer)?i.createElement(b.Button,{style:{width:"170px"},className:"align-middle",onClick:()=>this.onMarketAction(t,"resolve")},d().translate("prediction.overview.resolve")):i.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},i.createElement(b.Button,{style:{marginRight:"5px"},className:"align-middle",onClick:()=>this.onMarketAction(t,"yes")},"Details")))}]}_decideRowClassName(e,t){return this.props.selectedPredictionMarket?"selected-row":""}componentDidUpdate(e){e.predictionMarkets.length!==this.props.predictionMarkets.length&&this.props.predictionMarkets.forEach((e=>{e.asset.id in Object.keys(this.tickersLoaded)||(this.tickersLoaded[e.asset.id]={},c.A.getTicker(e.short_backing_asset,e.asset.id).then((t=>{let s=Object.assign(this.tickersLoaded,this.state.ticker);s[e.asset.id]=t,this.tickersLoaded[e.asset.id]=t,this.setState({ticker:s})})).catch((e=>console.error(e))))}))}render(){const e=this.getHeader();let t=[];if(this.props.selectedPredictionMarket)t=[this.props.selectedPredictionMarket];else if(this.props.predictionMarkets){t=this.props.predictionMarkets;let e=0;t=t.map((t=>({...t,key:`${t.asset_id}${e++}`})))}const s={type:this.props.selectedPredictionMarket?void 0:"radio",hideDefaultSelections:!0,onChange:(e,t)=>{t.length>0?this.onMarketAction(t[0],null):this.onMarketAction(null,null)},selectedRowKeys:this.props.selectedPredictionMarket?[this.props.selectedPredictionMarket.key]:[]};return i.createElement(k.A,{rowSelection:s,rows:t,header:e,pageSize:10,rowClassName:this._decideRowClassName.bind(this),loading:this.props.loading,totalLabel:"utility.total_x_assets"})}}E.propTypes={predictionMarkets:h().array.isRequired,onMarketAction:h().func.isRequired,currentAccount:A.A.ChainAccount.isRequired,selectedPredictionMarket:h().object},E.defaultProps={predictionMarkets:[]};const w=E=(0,f.Ay)(E,150,{leading:!1});class C extends i.Component{getHeader(){const e=this.props.currentAccount.get("id");return[{title:"#",dataIndex:"order_id",align:"left",sorter_inactive:(e,t)=>e.order_id>t.order_id?1:e.order_id<t.order_id?-1:0,render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement("span",null,e))},{title:d().translate("prediction.details.predictor"),dataIndex:"opinionator",align:"left",sorter_inactive:(e,t)=>{let s=_.ChainStore.getAccount(e.opinionator).get("name"),i=_.ChainStore.getAccount(t.opinionator).get("name");return s>i?1:s<i?-1:0},render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement(g.A,{account:e}))},{title:d().translate("prediction.details.prediction"),dataIndex:"opinion",align:"left",sorter_inactive:(e,t)=>e.opinion>t.opinion?1:e.opinion<t.opinion?-1:0,render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement("span",null,d().translate("prediction.details."+("yes"==e?"proves_true":"incorrect"))))},{title:d().translate("prediction.details.predicated_likelihood"),dataIndex:"likelihood",align:"left",sortOrder:"yes"==this.props.opinionFilter?"descend":"ascend",sorter:(e,t)=>e.likelihood>t.likelihood?1:e.likelihood<t.likelihood?-1:0,render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement("span",null,(100*e).toPrecision(3),"%"))},{title:d().translate("prediction.details.premium"),dataIndex:"premium",align:"left",sorter_inactive:(e,t)=>e.amount>t.amount?1:e.amount<t.amount?-1:0,render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement(y.A,{amount:e.amount,asset:e.asset_id}))},{title:d().translate("prediction.details.commission"),dataIndex:"commission",align:"left",sorter_inactive:(e,t)=>e.fee>t.fee?1:e.fee<t.fee?-1:0,render:(e,t)=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement(y.A,{amount:e.amount,asset:e.asset_id})," (",(t.commission.amount/t.premium.amount*100).toPrecision(3),"%)")},{title:d().translate("prediction.details.potential_profit"),dataIndex:"potentialProfit",align:"left",sorter_inactive:(e,t)=>e.amount>t.amount?1:e.amount<t.amount?-1:0,render:e=>i.createElement("div",{style:{whiteSpace:"nowrap"}},i.createElement(y.A,{amount:e.amount,asset:e.asset_id}))},{title:d().translate("prediction.overview.action"),align:"left",render:t=>i.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"right"}},e&&t.opinionator===e?i.createElement(b.Button,{onClick:()=>{this.props.onCancel(t)}},d().translate("prediction.details.cancel")):i.createElement(i.Fragment,null,i.createElement("span",null,i.createElement(b.Tooltip,{title:d().translate("yes"==t.opinion?"prediction.tooltips.oppose_proves_true":"prediction.tooltips.oppose_is_incorrect")},i.createElement(b.Icon,{style:{fontSize:"1.3rem",marginRight:"0.5rem"},type:"question-circle",theme:"filled"})),i.createElement(b.Button,{onClick:()=>{this.props.onOppose(t)}},d().translate("prediction.details.oppose")))))}]}render(){const e=this.getHeader();let t=this.props.predictionMarketData.opinions.filter((e=>{let t=_.ChainStore.getAccount(e.opinionator)?_.ChainStore.getAccount(e.opinionator).get("name"):null;if(this.props.detailsSearchTerm&&-1===(t+"\0"+e.opinion).toUpperCase().indexOf(this.props.detailsSearchTerm))return!1;if(this.props.opinionFilter){if("all"==this.props.opinionFilter)return!0;if(this.props.opinionFilter!=e.opinion)return!1}return!0})),s=0;return t=t.map((e=>({...e,key:`${e.order_id}${s++}`}))),i.createElement(k.A,{rows:t,header:e,pageSize:10})}}C.propTypes={predictionMarketData:h().any.isRequired,onOppose:h().func.isRequired,onCancel:h().func.isRequired,currentAccount:A.A.ChainAccount.isRequired,detailsSearchTerm:h().string,opinionFilter:h().string},C.defaultProps={predictionMarketData:{}};var M=s(27584),P=s(81428),O=s(80849),S=s.n(O),x=s(50548),N=s(24609),I=s(63806);class F extends b.Modal{constructor(e){super(e),this.state={newOpinionParameters:{opinionator:null,opinion:this.props.preselectedOpinion,amount:this.props.preselectedAmount/Math.pow(10,this.props.baseAsset.get("precision"))||" ",probability:this.props.preselectedProbability||null,fee:null},showWarning:!1,inProgress:!1,selectedOpinion:this.props.preselectedOpinion,selectedAsset:null,wrongPropability:!1},this.handleOpinionChange=this.handleOpinionChange.bind(this),this.handleAmountChange=this.handleAmountChange.bind(this),this.onSubmit=this.onSubmit.bind(this),this.handleProbabilityChange=this.handleProbabilityChange.bind(this)}_createOrder(){this.setState({inProgress:!0});const e="yes"===this.state.newOpinionParameters.opinion?"buy":"shortAndSell",t=this.props.baseAsset.get("id");let s=new Date;s.setFullYear(s.getFullYear()+1);let i={for_sale:new N.Vd({asset_id:this.props.baseAsset.get("id"),precision:this.props.baseAsset.get("precision"),amount:this.state.newOpinionParameters.amount*Math.pow(10,this.props.quoteAsset.get("precision"))*this.state.newOpinionParameters.probability}),to_receive:new N.Vd({asset_id:this.props.quoteAsset.get("id"),precision:this.props.quoteAsset.get("precision"),amount:this.state.newOpinionParameters.amount*Math.pow(10,this.props.quoteAsset.get("precision"))})};i.price=new N.gm({base:i.for_sale,quote:i.to_receive});let n={for_sale:new N.Vd({asset_id:this.props.quoteAsset.get("id"),precision:this.props.quoteAsset.get("precision"),amount:this.state.newOpinionParameters.amount*Math.pow(10,this.props.quoteAsset.get("precision"))}),to_receive:new N.Vd({asset_id:this.props.baseAsset.get("id"),precision:this.props.baseAsset.get("precision"),amount:this.state.newOpinionParameters.amount*Math.pow(10,this.props.quoteAsset.get("precision"))*this.state.newOpinionParameters.probability})};n.price=new N.gm({base:n.for_sale,quote:n.to_receive});let a="buy"===e?n:i;if("buy"===e){const e=new N.uw({for_sale:new N.Vd({asset_id:this.props.baseAsset.get("id"),precision:this.props.baseAsset.get("precision"),amount:v.A.convert_typed_to_satoshi(this.state.newOpinionParameters.amount,this.props.baseAsset)}),expiration:null,to_receive:new N.Vd({asset_id:this.props.quoteAsset.get("id"),precision:this.props.quoteAsset.get("precision"),amount:v.A.convert_typed_to_satoshi(this.state.newOpinionParameters.amount,this.props.quoteAsset)/parseFloat(this.state.newOpinionParameters.probability)}),seller:this.props.currentAccount.get("id"),fee:{asset_id:t,amount:0}});return c.A.createLimitOrder2(e).then((e=>{this.setState({inProgress:!1}),e.error&&"wallet locked"!==e.error.message&&b.Notification.error({message:d().translate("notifications.exchange_unknown_error_place_order",{amount:a.to_receive.getAmount({real:!0}),symbol:a.to_receive.asset_id})})})).catch((e=>{console.error("order failed:",e)}))}if("shortAndSell"===e){const e=new N.uw({for_sale:new N.Vd({asset_id:this.props.quoteAsset.get("id"),precision:this.props.quoteAsset.get("precision"),amount:v.A.convert_typed_to_satoshi(this.state.newOpinionParameters.amount,this.props.quoteAsset)}),expiration:null,to_receive:new N.Vd({asset_id:this.props.baseAsset.get("id"),precision:this.props.baseAsset.get("precision"),amount:v.A.convert_typed_to_satoshi(this.state.newOpinionParameters.amount,this.props.baseAsset)*parseFloat(this.state.newOpinionParameters.probability)}),seller:this.props.currentAccount.get("id"),fee:{asset_id:t,amount:0}});let s=new N.Vd({amount:e.amount_for_sale.getAmount(),asset_id:this.props.baseAsset.get("id"),precision:this.props.baseAsset.get("precision")});c.A.createPredictionShort(e,s).then((e=>{this.setState({inProgress:!1}),e.error&&"wallet locked"!==e.error.message&&b.Notification.error({message:d().translate("notifications.exchange_unknown_error_place_order",{amount:buyAssetAmount,symbol:buyAsset.symbol})})}))}}componentDidUpdate(e){this.props.preselectedOpinion===e.preselectedOpinion&&this.props.preselectedAmount===e.preselectedAmount&&this.props.preselectedProbability===e.preselectedProbability||this._updateStateFromProps()}componentDidMount(){this._updateStateFromProps()}_updateStateFromProps(){let e=this.state.newOpinionParameters;e=Object.assign({},e),e.opinion=this.props.preselectedOpinion,e.amount=this.props.preselectedAmount/Math.pow(10,this.props.baseAsset.get("precision"))||" ",e.probability=this.props.preselectedProbability||null,this.setState({newOpinionParameters:e,selectedOpinion:this.props.preselectedOpinion})}handleOpinionChange(){let e=this.state.newOpinionParameters;e.opinion="no"===e.opinion?"yes":"no",e.opinionator=this.props.currentAccount.get("id"),this.setState({newOpinionParameters:e,selectedOpinion:e.opinion})}handleAmountChange({amount:e,asset:t}){let s=this.state.newOpinionParameters;s.amount=e,s.opinionator=this.props.currentAccount.get("id"),this.setState({newOpinionParameter:s}),"string"==typeof t&&this.setState({selectedAsset:t})}handleProbabilityChange(e){let t=this.state.newOpinionParameters;t.probability=e.target.value,this.setState({newOpinionParameter:t,wrongProbability:!this._isProbabilityValid(t)})}_isProbabilityValid(e=null){return null==e&&(e=this.state.newOpinionParameters),!(!e.probability||e.probability<=.01||e.probability>=.99)}_isFormValid(){return this._isProbabilityValid()&&parseFloat(this.state.newOpinionParameters.amount)>0}_getPotentialWinnings(){return this.state.newOpinionParameters.probability&&this.state.newOpinionParameters.amount?"yes"===this.state.newOpinionParameters.opinion?v.A.format_number(this.state.newOpinionParameters.amount/parseFloat(this.state.newOpinionParameters.probability),this.props.baseAsset.get("precision"),!1):v.A.format_number(this.state.newOpinionParameters.amount*(1+(this.state.newOpinionParameters.probability?parseFloat(this.state.newOpinionParameters.probability):0)),this.props.baseAsset.get("precision"),!1):0}onSubmit(){this._isFormValid()?this._createOrder.call(this):this.setState({showWarning:!0})}render(){const{showWarning:e,newOpinionParameters:t,wrongProbability:s}=this.state,n=[i.createElement(b.Button,{type:"primary",key:"submit",onClick:this.onSubmit,disabled:this.state.inProgress},d().translate("global.confirm")),i.createElement(b.Button,{key:"cancel",onClick:this.props.onClose,disabled:this.state.inProgress},d().translate("global.cancel"))];return i.createElement(b.Modal,{title:i.createElement(S(),{content:"prediction.add_opinion_modal.title"}),visible:this.props.visible,onCancel:this.props.onClose,overlay:!0,closable:!this.state.inProgress,footer:n},i.createElement("div",{className:"prediction-markets--add-prediction-offer"},i.createElement(b.Form,{className:"full-width",layout:"vertical"},i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.add_opinion_modal.symbol"}),i.createElement(b.Input,{type:"text",disabled:!0,tabIndex:1,value:this.props.predictionMarket.symbol}))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.details.prediction"}),i.createElement(b.Input,{type:"text",disabled:!0,tabIndex:2,value:this.props.predictionMarket.condition}))),i.createElement(b.Form.Item,null,i.createElement("span",{className:!t.probability&&e||s?"has-error":""},i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.details.predicated_likelihood"}),i.createElement(I.A,{placeholder:"0.0",onChange:this.handleProbabilityChange,value:this.state.newOpinionParameters.probability})))),i.createElement(b.Form.Item,{style:{marginBottom:"1rem"}},i.createElement("span",null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.details.i_think_that"}))),i.createElement(b.Radio.Group,{value:this.state.selectedOpinion,onChange:this.handleOpinionChange},i.createElement(b.Radio,{value:"yes"},d().translate("prediction.details.proves_true")),i.createElement(b.Radio,{value:"no"},d().translate("prediction.details.incorrect")))),i.createElement(b.Form.Item,null,i.createElement("span",null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.details.premium"}),i.createElement(x.A,{onChange:this.handleAmountChange,placeholder:"0.0",tabIndex:6,amount:this.state.newOpinionParameters.amount,asset:this.props.baseAsset.get("id")})))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.details.commission"}),i.createElement(x.A,{disabled:!0,amount:Math.min(this.props.predictionMarket.max_market_fee,this.state.newOpinionParameters.amount*this.props.predictionMarket.market_fee/1e4),asset:this.props.baseAsset.get("id")}))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.details.potential_profit"}),i.createElement(x.A,{disabled:!0,amount:this._getPotentialWinnings(),asset:this.props.baseAsset.get("id")}))),this.state.inProgress?i.createElement(S(),{content:"footer.loading"}):null)))}}F.propTypes={visible:h().bool,onClose:h().func,predictionMarket:h().any.isRequired,opinion:h().any,currentAccount:A.A.ChainAccount.isRequired,preselectedOpinion:h().string,preselectedAmount:h().number,preselectedProbability:h().number,baseAsset:h().object,quoteAsset:h().object},F.defaultProps={visible:!1,predictionMarket:null,opinion:{}};var R=s(79260),L=s(93711),q=s.n(L),T=s(95093),D=s.n(T);const H=!0;class V extends b.Modal{constructor(e){super(e),this.state={marketOptions:{precision:"5",max_supply:1e5,max_market_fee:0,market_fee_percent:0,description:{main:""},reward_percent:0,taker_fee_percent:0,symbol:""},showWarning:!1,wrongSymbol:!1,wrongDate:!1,core_exchange_rate:{quote:{asset_id:null,amount:1},base:{asset_id:"1.3.0",amount:1}},bitasset_opts:{feed_lifetime_sec:86400,minimum_feeds:7,force_settlement_delay_sec:86400,force_settlement_offset_percent:1*q().GRAPHENE_1_PERCENT,maximum_force_settlement_volume:20*q().GRAPHENE_1_PERCENT,short_backing_asset:"1.3.0"},inProgress:!1},this.handleChange=this.handleChange.bind(this),this.handleAssetChange=this.handleAssetChange.bind(this),this.handleFeeChange=this.handleFeeChange.bind(this),this.onSubmit=this.onSubmit.bind(this)}_getPermissionsAndFlags(){let e=l.A.getFlagBooleans(0,H),t=l.A.getFlagBooleans("all",H);return e.charge_market_fee=!0,{flags:l.A.getFlags(e,H),permissions:l.A.getPermissions(t,H)}}_createAsset(){let{marketOptions:e,core_exchange_rate:t,bitasset_opts:s}=this.state;const{permissions:i,flags:n}=this._getPermissionsAndFlags(),a=JSON.stringify(this.state.marketOptions.description);this.setState({inProgress:!0});const o=_.ChainStore.getAccount(this.props.currentAccount).get("id");r.A.createAsset(o,e,n,i,t,H,!0,s,a).then((t=>{this.setState({inProgress:!1}),console.log("... AssetActions.createAsset(account_id, update)",o,e,n,i),this.props.onMarketCreated(e.symbol)})).catch((e=>{console.error(e),this.setState({inProgress:!1})}))}handleChange(e){let t=this.state.marketOptions;switch(e instanceof D()&&(e.set("milliseconds",0),e={target:{name:"expiry",value:e.toISOString()}}),e.target.name){case"symbol":t[e.target.name]=e.target.value.toUpperCase();break;case"main":case"condition":case"expiry":t.description[e.target.name]=e.target.value;break;default:t[e.target.name]=e.target.value}this.setState({marketOptions:t})}handleAssetChange(e){if(e){let t=this.state.bitasset_opts,s=this.state.marketOptions,i=this.state.core_exchange_rate;t.short_backing_asset=e,s.precision=_.ChainStore.getAsset(e).get("precision"),i.base.asset_id=e,this.setState({bitasset_opts:t,core_exchange_rate:i,marketOptions:s})}}_forcePositive(e){return parseFloat(e)<0?"0":e}handleFeeChange(e){console.log(e);let t=this.state.marketOptions;t.market_fee_percent=this._forcePositive(e.target.value),this.setState({marketOptions:t})}_isFormValid(){return this.props.symbols.includes(this.state.marketOptions.symbol)?(this.setState({wrongSymbol:!0}),!1):(this.setState({wrongSymbol:!1}),new Date>new Date(this.state.marketOptions.description.expiry)?(this.setState({wrongDate:!0}),!1):(this.setState({wrongDate:!1}),this.state.marketOptions.symbol&&this.state.marketOptions.description.main&&this.state.marketOptions.description.condition&&this.state.marketOptions.description.expiry))}onSubmit(e){this._isFormValid()?(e&&e.preventDefault(),this._createAsset().call(this)):this.setState({showWarning:!0})}render(){const{showWarning:e,marketOptions:t,wrongSymbol:s,wrongDate:n}=this.state,a=[i.createElement(b.Button,{type:"primary",key:"submit",onClick:this.onSubmit,disabled:this.state.inProgress},d().translate("global.confirm")),i.createElement(b.Button,{key:"cancel",onClick:this.props.onClose,disabled:this.state.inProgress},d().translate("global.cancel"))];return i.createElement(b.Modal,{title:i.createElement(S(),{content:"prediction.create_market_modal.title"}),visible:this.props.visible,onCancel:this.props.onClose,overlay:!0,closable:!this.state.inProgress,footer:a},i.createElement("div",{className:"prediction-markets--create-prediction-market"},i.createElement(b.Form,{className:"full-width",layout:"vertical"},i.createElement(b.Form.Item,null,i.createElement("span",{className:!t.symbol&&e||s?"has-error":""},i.createElement("label",{className:"left-label"},i.createElement(b.Tooltip,{title:d().translate("prediction.create_market_modal.tooltip_symbol"),placement:"topLeft"},i.createElement(S(),{content:"prediction.create_market_modal.symbol"}),i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},theme:"filled",type:"question-circle"})),i.createElement(b.Input,{name:"symbol",type:"text",onChange:this.handleChange,tabIndex:1,value:this.state.marketOptions.symbol})))),i.createElement(b.Form.Item,null,i.createElement("span",{className:!t.description.condition&&e?"has-error":""},i.createElement("label",{className:"left-label"},i.createElement(b.Tooltip,{title:d().translate("prediction.create_market_modal.tooltip_condition"),placement:"topLeft"},i.createElement(S(),{content:"prediction.create_market_modal.condition"}),i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},theme:"filled",type:"question-circle"})),i.createElement(b.Input,{name:"condition",type:"text",onChange:this.handleChange,tabIndex:2})))),i.createElement(b.Form.Item,null,i.createElement("span",{className:!t.description.main&&e?"has-error":""},i.createElement("label",{className:"left-label"},i.createElement(b.Tooltip,{title:d().translate("prediction.create_market_modal.tooltip_description"),placement:"topLeft"},i.createElement(S(),{content:"prediction.create_market_modal.description"}),i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},theme:"filled",type:"question-circle"})),i.createElement(b.Input.TextArea,{name:"main",onChange:this.handleChange,tabIndex:3})))),i.createElement(b.Form.Item,null,i.createElement("span",{className:!t.description.expiry&&e||n?"has-error":""},i.createElement("label",{className:"left-label"},i.createElement(b.Tooltip,{title:d().translate("prediction.create_market_modal.tooltip_resolution_date"),placement:"topLeft"},i.createElement(S(),{content:"prediction.create_market_modal.resolution_date"}),i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},theme:"filled",type:"question-circle"})),i.createElement("div",null,i.createElement(b.DatePicker,{style:{width:"100%"},name:"expiry",showTime:!0,placeholder:d().translate("prediction.create_market_modal.select_date_and_time"),onChange:this.handleChange,onOk:this.handleChange,tabIndex:4}))))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(b.Tooltip,{title:d().translate("prediction.create_market_modal.tooltip_backing_asset"),placement:"topLeft"},i.createElement(S(),{content:"prediction.create_market_modal.backing_asset"}),i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},theme:"filled",type:"question-circle"})),i.createElement(R.A,{assets:["1.3.0","1.3.113","1.3.120","1.3.121"],value:this.state.bitasset_opts.short_backing_asset,onChange:this.handleAssetChange,tabIndex:5}))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(b.Tooltip,{title:d().translate("prediction.create_market_modal.tooltip_commission"),placement:"topLeft"},i.createElement(S(),{content:"prediction.create_market_modal.commission"}),i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},theme:"filled",type:"question-circle"})),i.createElement(b.Input,{tabIndex:6,type:"number",value:this.state.marketOptions.market_fee_percent,onChange:this.handleFeeChange}))),this.state.inProgress?i.createElement(S(),{content:"footer.loading"}):null)))}}V.propTypes={visible:h().bool,onClose:h().func,currentAccount:h().string,symbols:h().array,onMarketCreated:h().func},V.defaultProps={visible:!1};class z extends b.Modal{constructor(e){super(e),this.state={resolveParameters:{asset_id:this.props.predictionMarket.asset_id,result:"yes"},result:"yes"},this.handleResultChange=this.handleResultChange.bind(this)}handleResultChange(e){const t=e.target.value;this.setState({resolveParameters:{...this.state.resolveParameters,result:t},result:t})}render(){const e=[i.createElement(b.Button,{type:"primary",key:"submit",onClick:()=>this.props.onResolveMarket(this.state.resolveParameters),disabled:this.state.inProgress},d().translate("global.confirm")),i.createElement(b.Button,{key:"cancel",onClick:this.props.onClose,disabled:this.state.inProgress},d().translate("global.cancel"))];return i.createElement(b.Modal,{title:i.createElement(S(),{content:"prediction.resolve_modal.title"}),visible:this.props.visible,onCancel:this.props.onClose,overlay:!0,closable:!this.state.inProgress,footer:e},i.createElement("div",{className:"prediction-markets--resolve-prediction-market-asset"},i.createElement(b.Form,{className:"full-width",layout:"vertical"},i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.resolve_modal.symbol"}),i.createElement(b.Input,{type:"text",disabled:!0,tabIndex:1,value:this.props.predictionMarket.symbol}))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.resolve_modal.prediction"}),i.createElement(b.Input,{type:"text",disabled:!0,tabIndex:2,value:this.props.predictionMarket.condition}))),i.createElement(b.Form.Item,null,i.createElement("label",{className:"left-label"},i.createElement(S(),{content:"prediction.resolve_modal.the_prediction_has"})),i.createElement(b.Radio.Group,{value:this.state.result,onChange:this.handleResultChange},i.createElement(b.Radio,{value:"yes"},d().translate("prediction.resolve_modal.proven_true")),i.createElement(b.Radio,{value:"no"},d().translate("prediction.resolve_modal.was_incorrect")))))))}}z.propTypes={predictionMarket:h().any.isRequired,onResolveMarket:h().func.isRequired,visible:h().bool,onClose:h().func},z.defaultProps={visible:!1,predictionMarket:null};var B=s(58586);class U extends i.Component{constructor(e){super(e),this.state={loading:!1,searchTerm:"",detailsSearchTerm:"",selectedPredictionMarket:null,opinions:[],preselectedOpinion:"yes",preselectedAmount:0,preselectedProbability:0,isCreateMarketModalOpen:!1,isAddOpinionModalOpen:!1,isResolveModalOpen:!1,isHideUnknownHousesChecked:!0,isHideInvalidAssetsChecked:!0,opinionFilter:"yes",predictionMarketAssetFilter:"open"},this.onCreatePredictionMarketModalOpen=this.onCreatePredictionMarketModalOpen.bind(this),this.onCreatePredictionMarketModalClose=this.onCreatePredictionMarketModalClose.bind(this),this.onAddOpinionModalOpen=this.onAddOpinionModalOpen.bind(this),this.onAddOpinionModalClose=this.onAddOpinionModalClose.bind(this),this.onSearch=this.onSearch.bind(this),this.onSearchDetails=this.onSearchDetails.bind(this),this.onMarketAction=this.onMarketAction.bind(this),this.onResolveModalOpen=this.onResolveModalOpen.bind(this),this.onResolveModalClose=this.onResolveModalClose.bind(this),this.updateAsset=this.updateAsset.bind(this),this.handleUnknownHousesToggleChange=this.handleUnknownHousesToggleChange.bind(this),this.handleInvalidAssetsChecked=this.handleInvalidAssetsChecked.bind(this)}componentDidUpdate(e){e.marketLimitOrders!==this.props.marketLimitOrders&&this._updateOpinionsList(this.props.marketLimitOrders)}_isKnownIssuer(e){return this.props.whitelistedIssuers.includes(e.issuer)}_isValidPredictionMarketAsset(e){const t=new Date(e.forPredictions.description.expiry);return!(t instanceof Date&&isNaN(t.getTime())||!e.forPredictions.description.condition||!e.forPredictions.description.main||e.forPredictions.description.condition.length<10||e.forPredictions.description.main.length<20||e.options.market_fee_percent/100>=10)}_updateOpinionsList(e){let t=[];const s=this.state.selectedPredictionMarket;e.forEach(((e,i)=>{const n=e.market_base===e.sell_price.base.asset_id?"no":"yes",a=e.market_base===e.sell_price.base.asset_id?e.sell_price.invert().toReal():e.sell_price.toReal(),r=e.market_base===e.sell_price.base.asset_id?e.amountForSale():e.amountToReceive(),o=e.market_base===e.sell_price.base.asset_id?e.amountToReceive():e.amountForSale();let c=0;l.A.getFlagBooleans(s.options.flags,!0).charge_market_fee&&(c=Math.min(s.options.max_market_fee,r.amount*s.options.market_fee_percent/1e4)),a<1&&t.push({order_id:i,opinionator:e.seller,opinion:n,amount:r,likelihood:a,potentialProfit:new N.Vd({amount:r.amount,asset_id:o.asset_id,precision:o.precision}),premium:o,commission:new N.Vd({amount:c*a,asset_id:o.asset_id,precision:o.precision})})})),this.setState({opinions:[...t]})}async getMarketOpinions(e){this.state.subscribedMarket&&await c.A.unSubscribeMarket(this.state.subscribedMarket.quote.get("id"),this.state.subscribedMarket.base.get("id"));const t=_.ChainStore.getObject(e.options.core_exchange_rate.base.asset_id),s=_.ChainStore.getAsset(e.options.core_exchange_rate.quote.asset_id);await c.A.subscribeMarket(t,s,this.props.bucketSize,this.props.currentGroupOrderLimit),this.setState({subscribedMarket:{base:t,quote:s}})}onMarketAction({market:e,action:t}){if("string"==typeof t)switch(this.state.selectedPredictionMarket||this.setState({selectedPredictionMarket:e}),t){case"resolve":this.setState({preselectedAmount:0,preselectedProbability:0}),this.onResolveModalOpen();break;case"yes":this.state.subscribedMarket&&(this.setState({preselectedAmount:0,preselectedProbability:0,preselectedOpinion:"yes"}),this.onAddOpinionModalOpen());break;case"no":this.state.subscribedMarket&&(this.setState({preselectedAmount:0,preselectedProbability:0,preselectedOpinion:"no"}),this.onAddOpinionModalOpen());break;default:this.setState({preselectedAmount:0,preselectedProbability:0})}else this.state.selectedPredictionMarket?this.setState({selectedPredictionMarket:null}):this.setState({selectedPredictionMarket:e},(()=>this.getMarketOpinions(e)))}onSearch(e){this.setState({searchTerm:e.target.value||""})}onSearchDetails(e){this.setState({detailsSearchTerm:e.target.value||""})}onCreatePredictionMarketModalOpen(){this.setState({isCreateMarketModalOpen:!0})}onCreatePredictionMarketModalClose(){this.setState({isCreateMarketModalOpen:!1})}onAddOpinionModalOpen(){this.setState({isAddOpinionModalOpen:!0})}onAddOpinionModalClose(){this.setState({isAddOpinionModalOpen:!1,preselectedOpinion:"no",preselectedAmount:0,preselectedProbability:0})}onResolveModalOpen(){this.setState({isResolveModalOpen:!0})}onResolveModalClose(){this.setState({isResolveModalOpen:!1})}handleUnknownHousesToggleChange(){const e=!this.state.isHideUnknownHousesChecked;this.setState({isHideUnknownHousesChecked:e,selectedPredictionMarket:null},(()=>this.props.fetchAllAssets()))}handleInvalidAssetsChecked(){this.setState({isHideInvalidAssetsChecked:!this.state.isHideInvalidAssetsChecked,selectedPredictionMarket:null})}onOppose=e=>{this.setState({preselectedOpinion:"no"===e.opinion?"yes":"no",preselectedAmount:e.amount,preselectedProbability:e.probability}),this.onAddOpinionModalOpen()};onCancelOpinion=e=>{c.A.cancelLimitOrders(this.props.currentAccount.get("id"),[e.order_id]).catch((e=>{console.log("cancel orders error:",e)}))};onResolveMarket=e=>{const t=this.props.currentAccount.get("id"),s="yes"===e.result?1:0,i=_.ChainStore.getAsset(e.asset_id).toJS();let n=new N.Vd({real:1,asset_id:i.id,precision:i.precision}),a=_.ChainStore.getAsset(i.bitasset.options.short_backing_asset),o=new N.Vd({real:s,asset_id:i.bitasset.options.short_backing_asset,precision:a.get("precision")}),l=new N.gm({quote:o,base:n});r.A.assetGlobalSettle(i,t,l).then((()=>{new Promise((e=>setTimeout(e,1e3))).then((()=>{this.updateAsset(i.symbol)}))})),this.setState({isResolveModalOpen:!1})};updateAsset(e){r.A.getAssetList.defer(e,1)}_filterMarkets(){const e=this.state.predictionMarketAssetFilter;return this.props.predictionMarkets.filter((t=>{const s=t.asset;if(!s)return!1;const i=s.bitasset_data||s.bitasset||{};if(this.state.isHideUnknownHousesChecked&&!this._isKnownIssuer(s))return!1;if(this.state.isHideInvalidAssetsChecked&&!this._isValidPredictionMarketAsset(s))return!1;{let t=_.ChainStore.getAccount(s.issuer)?_.ChainStore.getAccount(s.issuer).get("name"):null;if(t&&this.state.searchTerm&&-1!==(t+"\0"+s.condition+"\0"+s.description).toUpperCase().indexOf(this.state.searchTerm))return!1;if(e&&"all"!==e){const t=new Date(s.forPredictions.description.expiry),n=(i.settlement_fund||0)>0||t<new Date;return"open"===e?!n:"past_resolution_date"===e&&n}return!0}}))}getOverviewSection(){const e=this._filterMarkets();return i.createElement("div",null,i.createElement("div",{className:"header-selector",style:{display:"inline-block",width:"100%"}},i.createElement("div",{className:"filter-block"},i.createElement(M.A,{onChange:this.onSearch,value:this.state.searchTerm}),i.createElement(b.Radio.Group,{style:{marginLeft:"20px"},value:this.state.predictionMarketAssetFilter,onChange:e=>{this.setState({predictionMarketAssetFilter:e.target.value})}},i.createElement(b.Radio,{value:"all"},d().translate("prediction.overview.all")),i.createElement(b.Radio,{value:"open"},d().translate("prediction.overview.open")),i.createElement(b.Radio,{value:"past_resolution_date"},d().translate("prediction.overview.past_resolution_date"))),i.createElement("span",null,i.createElement(b.Switch,{style:{marginLeft:"20px",cursor:"pointer"},onChange:this.handleUnknownHousesToggleChange,checked:this.state.isHideUnknownHousesChecked}),i.createElement(S(),{onClick:this.handleUnknownHousesToggleChange,content:"prediction.overview.hide_unknown_houses",style:{marginLeft:"10px",cursor:"pointer"}}),i.createElement(b.Tooltip,{title:d().translate("prediction.tooltips.hide_unknown_houses")},i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},type:"question-circle",theme:"filled"})),i.createElement(b.Switch,{style:{marginLeft:"20px",cursor:"pointer"},onChange:this.handleInvalidAssetsChecked,checked:this.state.isHideInvalidAssetsChecked}),i.createElement(S(),{onClick:this.handleInvalidAssetsChecked,content:"prediction.overview.hide_invalid_asset",style:{marginLeft:"10px",cursor:"pointer"}}),i.createElement(b.Tooltip,{title:d().translate("prediction.tooltips.hide_invalid_asset")},i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},type:"question-circle",theme:"filled"})))),i.createElement("div",{className:"filter-status"},d().translate("utility.x_assets_hidden",{count:this.props.predictionMarkets.length-e.length,total:this.props.predictionMarkets.length}))),i.createElement("div",{className:"header-selector",style:{display:"inline-block",width:"100%",paddingTop:"0rem"}},i.createElement("span",{className:"action-buttons"},i.createElement(b.Tooltip,{title:d().translate("prediction.tooltips.create_prediction_market_asset")},i.createElement(b.Icon,{style:{fontSize:"1.3rem",marginRight:"0.5rem"},type:"question-circle",theme:"filled"})),i.createElement(b.Button,{onClick:this.onCreatePredictionMarketModalOpen},d().translate("prediction.overview.create_market")))),i.createElement(w,{predictionMarkets:e,currentAccount:this.props.currentAccount,onMarketAction:this.onMarketAction,selectedPredictionMarket:this.state.selectedPredictionMarket,loading:this.props.loading}))}getDetailsSection(){return i.createElement("div",null,i.createElement("h3",null,d().translate("prediction.details.list_of_current_prediction_offers"),i.createElement(b.Tooltip,{title:d().translate("prediction.tooltips.what_is_a_prediction_offer")},i.createElement(b.Icon,{style:{marginLeft:"0.5rem"},type:"question-circle",theme:"filled"}))),i.createElement("div",{className:"header-selector",style:{display:"inline-block",width:"100%"}},i.createElement("div",{className:"filter-block"},i.createElement(M.A,{onChange:this.onSearchDetails,value:this.state.detailsSearchTerm,autoComplete:"off"}),i.createElement(b.Radio.Group,{style:{marginLeft:"20px"},value:this.state.opinionFilter,onChange:e=>{this.setState({opinionFilter:e.target.value})}},i.createElement(b.Radio,{value:"all"},d().translate("prediction.details.all")),i.createElement(b.Radio,{value:"yes"},d().translate("prediction.details.proves_true")),i.createElement(b.Radio,{value:"no"},d().translate("prediction.details.incorrect")))),i.createElement("span",{className:"action-buttons"},i.createElement(b.Tooltip,{title:d().translate("prediction.tooltips.add_prediction")},i.createElement(b.Icon,{style:{fontSize:"1.3rem",marginRight:"0.5rem"},type:"question-circle",theme:"filled"})),i.createElement(b.Button,{onClick:this.onAddOpinionModalOpen},d().translate("prediction.details.add_prediction")))),this.state.opinions?i.createElement(C,{predictionMarketData:{predictionMarket:this.state.selectedPredictionMarket,opinions:this.state.opinions},currentAccount:this.props.currentAccount,onOppose:this.onOppose,onCancel:this.onCancelOpinion,detailsSearchTerm:this.state.detailsSearchTerm.toUpperCase(),opinionFilter:this.state.opinionFilter}):null)}render(){const e=[...this.props.assets].map((e=>e[1].symbol));return i.createElement("div",{className:"prediction-markets grid-block vertical",style:{overflow:"visible",margin:"15px"}},i.createElement("div",{className:"grid-block small-12 shrink",style:{overflow:"visible"}},i.createElement(P.A,{path:"components/PredictionMarkets"})),this.getOverviewSection(),this.state.selectedPredictionMarket?this.getDetailsSection():null,this.state.isCreateMarketModalOpen?i.createElement(V,{visible:this.state.isCreateMarketModalOpen,onClose:this.onCreatePredictionMarketModalClose,currentAccount:this.props.currentAccount.get("id"),symbols:e,onMarketCreated:this.updateAsset}):null,this.state.isAddOpinionModalOpen?i.createElement(F,{visible:this.state.isAddOpinionModalOpen,onClose:this.onAddOpinionModalClose,predictionMarket:this.state.selectedPredictionMarket,opinion:this.state.initialOpinion,currentAccount:this.props.currentAccount,preselectedOpinion:this.state.preselectedOpinion,preselectedAmount:this.state.preselectedAmount,preselectedProbability:this.state.preselectedProbability,baseAsset:this.state.subscribedMarket.base,quoteAsset:this.state.subscribedMarket.quote}):null,this.state.isResolveModalOpen?i.createElement(z,{visible:this.state.isResolveModalOpen,onClose:this.onResolveModalClose,predictionMarket:this.state.selectedPredictionMarket,onResolveMarket:this.onResolveMarket}):null)}}U=(0,n.N)(U,{listenTo:()=>[o.A,B.A],getProps:()=>({assets:o.A.getState().assets,bucketSize:B.A.getState().bucketSize,currentGroupOrderLimit:B.A.getState().currentGroupLimit,marketLimitOrders:B.A.getState().marketLimitOrders})});const j=U=(0,a.V)(U);var G=s(30061);class W extends i.Component{constructor(e){super(e),this.state={lastAssetSymbol:"",predictionMarkets:[],fetching:!0,whitelistedIssuers:[],fetchAllAssets:!1}}_getPredictionMarketList(e){return[...e].map((e=>e[1])).filter(this._isPredictionMarket).map(this._normalizePredictionMarketAsset)}componentDidUpdate(e){if(e.assets!==this.props.assets&&this.state.fetchAllAssets){const e=this.props.assets.sort(((e,t)=>e.symbol>t.symbol?1:e.symbol<t.symbol?-1:0)).last(),t=this._getPredictionMarketList(this.props.assets);r.A.getAssetList.defer(e.symbol,100);const s=this.state.lastAssetSymbol===e.symbol;setTimeout((()=>{this.setState({predictionMarkets:t,lastAssetSymbol:e.symbol,fetchAllAssets:!s,fetching:!s})}),0)}}UNSAFE_componentWillMount(){(0,G.Ag)().then((e=>{this._getWhitelistedAssets(e).then((t=>{const s=t.filter(this._isPredictionMarket).map(this._normalizePredictionMarketAsset);this.setState({whitelistedIssuers:e,predictionMarkets:s,fetching:!1})}))}))}_normalizePredictionMarketAsset(e){return e.forPredictions||(e.forPredictions={description:l.A.parseDescription(e.options.description),flagBooleans:l.A.getFlagBooleans(e.options.flags,!0)}),(e=>{let t=0,s=0;return e.forPredictions.flagBooleans.charge_market_fee&&(t=e.options.market_fee_percent,s=e.options.max_market_fee),{asset:e,short_backing_asset:(e.bitasset_data||e.bitasset||{}).options.short_backing_asset||"1.3.0",asset_id:e.id,issuer:e.issuer,description:e.forPredictions.description.main,symbol:e.symbol,condition:e.forPredictions.description.condition,expiry:e.forPredictions.description.expiry,options:e.options,marketConfidence:0,marketLikelihood:0,market_fee:t,max_market_fee:s}})(e)}_isPredictionMarket(e){return!!e&&(e.bitasset_data||e.bitasset||{}).is_prediction_market}async _getWhitelistedAssets(e){let t=[];return(await(0,_.FetchChainObjects)(_.ChainStore.getAccount,e,void 0,{})).forEach((e=>{e&&(e=e.toJS(),t=[...t,...e.assets])})),(await(0,_.FetchChainObjects)(_.ChainStore.getAsset,t,void 0,{})).map((e=>e.toJS()))}fetchAllAssets(){this.setState({fetching:!0,fetchAllAssets:!0},(()=>{setTimeout((()=>r.A.getAssetList("",100)),300)}))}render(){return i.createElement(j,{assets:this.props.assets,whitelistedIssuers:this.state.whitelistedIssuers,predictionMarkets:this.state.predictionMarkets,loading:this.state.fetching,fetchAllAssets:()=>{this.fetchAllAssets()}})}}W=(0,n.N)(W,{listenTo:()=>[o.A,B.A],getProps:()=>({assets:o.A.getState().assets,bucketSize:B.A.getState().bucketSize,currentGroupOrderLimit:B.A.getState().currentGroupLimit,marketLimitOrders:B.A.getState().marketLimitOrders})});const J=W=(0,a.V)(W)},37556:(e,t,s)=>{s.d(t,{K:()=>p,V:()=>d});var i=s(96540),n=s(12569),a=s(83599),r=s(72342),o=s(9476),l=s(55840),c=s(40702);const p=function(e){return!!e&&!!e.get("id")},d=function(e){let t=class extends i.Component{static propTypes={currentAccount:n.A.ChainAccount};static defaultProps={autosubscribe:!0};constructor(e){super(e)}render(){return p(this.props.currentAccount)?i.createElement(e,this.props):i.createElement(c.A,null)}};return t=(0,r.A)(t),t=(0,a.Ay)(t,100,{leading:!1}),(0,o.N)(t,{listenTo:()=>[l.A],getProps(){let e=l.A.getState().currentAccount||l.A.getState().passwordAccount||"please-login";return{currentAccount:new Map([["name",e]])}}})}},72257:(e,t,s)=>{s.d(t,{A:()=>o});var i=s(96540),n=s(10658),a=s.n(n),r=s(46128);class o extends i.Component{static defaultProps={rows:[],pageSize:20,className:"table",extraRow:null,style:{paddingBottom:"1rem"},loading:!1,totalLabel:"utility.total_x_items",label:null};constructor(e){super(e),this.state={pageSize:e.pageSize}}render(){const{pageSize:e}=this.state,{header:t,rows:s,extraRow:n,loading:o}=this.props,l=[10,20,30,40,50,100].filter((e=>e<Math.max(this.props.pageSize,s.length)));l.push(Math.max(this.props.pageSize,s.length));let c=null;return null!==this.props.label?c=e=>a().translate(this.props.label,{count:e}):"string"==typeof this.props.totalLabel?c=e=>a().translate(this.props.totalLabel,{count:e}):"object"==typeof this.props.totalLabel&&(c=e=>a().translate(this.props.totalLabel.key,{count:e,...this.props.totalLabel.args})),i.createElement("div",{className:"paginated-list",style:this.props.style},i.createElement(r.Table,{loading:o,dataSource:s,uns:!0,columns:Array.isArray(t)?t:[],footer:()=>n||i.createElement("span",null," "),onChange:this.props.toggleSortOrder,pagination:{showSizeChanger:!0,hideOnSinglePage:!1,defaultPageSize:e,pageSizeOptions:l.map((e=>e.toString())),showTotal:(e,t)=>c(e)},rowClassName:null==this.props.rowClassName?void 0:(e,t)=>this.props.rowClassName(e,t),rowSelection:this.props.rowSelection}),this.props.children)}}},27584:(e,t,s)=>{s.d(t,{A:()=>d});var i=s(96540),n=s(5556),a=s.n(n),r=s(46128),o=s(10658),l=s.n(o);function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},c.apply(this,arguments)}const p=i.createRef();function d({onChange:e,value:t,placeholder:s,maxLength:n,style:a,className:o,name:l,autoComplete:d,onClear:m,type:h,...u}){return null==m&&(m=()=>{e({target:{value:""}}),p.current.focus()}),i.createElement(r.Input,c({ref:p,autoComplete:d,style:a,type:h,className:o+" search-input",placeholder:s,maxLength:n,name:l,value:t,onChange:e,addonAfter:i.createElement(r.Icon,{type:"search"}),suffix:m?i.createElement(r.Icon,{onClick:m,type:"close",className:t?"cursor-pointer":"hide"}):i.createElement("span",null)},u))}d.propTypes={onChange:a().func.isRequired,value:a().string,placeholder:a().string,style:a().object,className:a().string,type:a().string,name:a().string,autoComplete:a().string,maxLength:a().number,onClear:a().func},d.defaultProps={placeholder:l().translate("exchange.filter"),style:{width:"200px"},className:"",type:"text",name:"focus",autoComplete:"off",maxLength:16,onClear:void 0}},47048:(e,t,s)=>{s.r(t)}}]);