-
Notifications
You must be signed in to change notification settings - Fork 6
/
asset.1366ce26e68e36057dbe.js
1 lines (1 loc) · 57.6 KB
/
asset.1366ce26e68e36057dbe.js
1
"use strict";(this.webpackChunkRuDEX3_light=this.webpackChunkRuDEX3_light||[]).push([[521],{1514:(e,t,a)=>{a.r(t),a.d(t,{default:()=>ae});var s=a(67294),n=a(73727),r=a(58074),l=a.n(r),o=a(3841),i=a(38715),c=a(52521),m=a(21019),d=a(33951),u=a(3894),p=a(99349),h=a(80314),_=a(21660),b=a(7581),g=a(13973);class E extends s.Component{constructor(e){super(e),this.state={time:e.time}}getHours(e){return e/3600}render(){return s.createElement("div",null,this.getHours(this.state.time),"h")}}const f=E;var x=a(30806),y=a(55420),v=a(74366),C=a(65601),k=a(94184),A=a.n(k),w=a(108),P=a(57351),S=a(7453);const Z=(e,t,a=(e=>e))=>s=>e.setState({[t]:a(s)});class N extends s.Component{static defaultProps={type:"fund"};constructor(e){super(e),this.state=this.initialState()}onAccountNameChanged=Z(this,"funderAccountName");onAccountChanged=Z(this,"newFunderAccount");onPoolInput=Z(this,"fundPoolAmount",(e=>e.amount));onClaimInput(e,{amount:t}){this.state[e+"Asset"].setAmount({real:t}),this.setState({[e]:t})}onFundPool=()=>S.Z.fundPool(this.state.newFunderAccount?this.state.newFunderAccount.get("id"):null,this.props.core,this.props.asset,this.state.fundPoolAmount);reset=()=>{this.setState(this.initialState())};initialState=()=>({funderAccountName:this.props.funderAccountName,fundPoolAmount:0,fundPoolAsset:new v.xR({amount:0,precision:this.props.core.get("precision"),asset_id:this.props.core.get("id")}),claimPoolAmount:0,claimPoolAmountAsset:new v.xR({amount:0,precision:this.props.core.get("precision"),asset_id:this.props.core.get("id")}),claimFeesAmount:0,claimFeesAmountAsset:new v.xR({amount:0,precision:this.props.asset.get("precision"),asset_id:this.props.asset.get("id")})});onClaimFees(){let e=x.ChainStore.getAccount(this.props.funderAccountName);e&&S.Z.claimPoolFees(e.get("id"),this.props.asset,this.state.claimFeesAmountAsset)}onClaimPool=()=>S.Z.claimPool(this.props.asset,this.state.claimPoolAmountAsset);renderFundPool(){const{props:e,state:t,onPoolInput:a,onFundPool:n,reset:r,onAccountNameChanged:o,onAccountChanged:i}=this,{asset:c,core:d,hideBalance:u,getDynamicObject:p}=e,{funderAccountName:h,fundPoolAmount:_,newFunderAccount:b}=t;let g=null;u||(g=p(c.get("dynamic_asset_data_id")));const E=d.get("id")||"1.3.0";let f=0;if(b){const e=b.getIn(["balances",E]);if(e){let t=x.ChainStore.getObject(e);t&&(f=t.get("balance"))}}const y=s.createElement("span",{onClick:()=>{this.state.fundPoolAsset.setAmount({sats:f}),this.setState({fundPoolAmount:this.state.fundPoolAsset.getAmount({real:!0})})}},s.createElement(l(),{component:"span",content:"transfer.available"}),": ",s.createElement(m.Z,{amount:f,asset:E}));return s.createElement("div",null,u||s.createElement("div",{style:{paddingBottom:"1.5rem"}},s.createElement(l(),{content:"explorer.asset.fee_pool.pool_balance"}),s.createElement("span",null,": "),g?s.createElement(m.Z,{amount:g.get("fee_pool"),asset:E}):null),s.createElement(w.Z,{label:"transaction.funding_account",accountName:h,onChange:o,onAccountChanged:i,account:h,error:null,tabIndex:1,typeahead:!0}),s.createElement(P.Z,{label:"transfer.amount",display_balance:y,amount:_,onChange:a,asset:E,assets:[E],placeholder:"0.0",tabIndex:2,style:{width:"100%",paddingTop:16}}),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement("button",{className:A()("button",{disabled:_<=0}),onClick:n},s.createElement(l(),{content:"transaction.trxTypes.asset_fund_fee_pool"})),s.createElement("button",{className:"button outline",onClick:r},s.createElement(l(),{content:"account.perm.reset"}))))}renderClaimPool(){const{props:e,onClaimPool:t,reset:a}=this,{claimPoolAmount:n}=this.state,{asset:r,core:o,getDynamicObject:i}=e;let c=i(r.get("dynamic_asset_data_id"));const d=o.get("id")||"1.3.0",u=c?s.createElement("span",{onClick:()=>{this.state.claimPoolAmountAsset.setAmount({sats:c.get("fee_pool")}),this.setState({claimPoolAmount:this.state.claimPoolAmountAsset.getAmount({real:!0})})}},s.createElement(l(),{component:"span",content:"transfer.available"}),": ",s.createElement(m.Z,{amount:c.get("fee_pool"),asset:d})):null;return s.createElement("div",null,s.createElement(l(),{component:"p",content:"explorer.asset.fee_pool.claim_pool_text"}),s.createElement(P.Z,{label:"transfer.amount",display_balance:u,amount:n,onChange:this.onClaimInput.bind(this,"claimPoolAmount"),asset:d,assets:[d],placeholder:"0.0",tabIndex:2,style:{width:"100%",paddingTop:16}}),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement("button",{className:A()("button",{disabled:n<=0}),onClick:t},s.createElement(l(),{content:"transaction.trxTypes.asset_claim_fee_pool"})),s.createElement("button",{className:"button outline",onClick:a},s.createElement(l(),{content:"account.perm.reset"}))))}renderClaimFees(){const{props:e}=this,{claimFeesAmount:t}=this.state,{asset:a,getDynamicObject:n}=e;let r=n(a.get("dynamic_asset_data_id")),o=r?r.get("accumulated_fees"):0,i=t>0&&this.state.claimFeesAmountAsset.getAmount()<=o,c=s.createElement("span",{onClick:()=>{this.state.claimFeesAmountAsset.setAmount({sats:r.get("accumulated_fees")}),this.setState({claimFeesAmount:this.state.claimFeesAmountAsset.getAmount({real:!0})})}},s.createElement(l(),{component:"span",content:"transfer.available"}),": ",s.createElement(m.Z,{amount:o,asset:a.get("id")}));return s.createElement("div",null,s.createElement(l(),{component:"p",content:"explorer.asset.fee_pool.claim_text",asset:a.get("symbol")}),s.createElement("div",{style:{paddingBottom:"1rem"}},s.createElement(l(),{content:"explorer.asset.fee_pool.unclaimed_issuer_income"}),": ",r?s.createElement(m.Z,{amount:r.get("accumulated_fees"),asset:a.get("id")}):null),s.createElement(P.Z,{label:"transfer.amount",display_balance:c,amount:t,onChange:this.onClaimInput.bind(this,"claimFeesAmount"),asset:a.get("id"),assets:[a.get("id")],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingTop:16}}),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement("button",{className:A()("button",{disabled:!i}),onClick:this.onClaimFees.bind(this)},s.createElement(l(),{content:"explorer.asset.fee_pool.claim_fees"})),s.createElement("button",{className:"button outline",onClick:this.reset.bind(this)},s.createElement(l(),{content:"account.perm.reset"}))))}render(){return"fund"===this.props.type?this.renderFundPool():"claim"===this.props.type?this.renderClaimPool():"claim_fees"===this.props.type?this.renderClaimFees():void 0}}const T=N=(0,c.Z)(N,{propNames:["asset","core"],defaultProps:{core:"1.3.0"},withDynamic:!0});var F=a(32793),I=a(89449),R=a(112),q=a.n(R),B=a(23037),O=a(82267);class D extends s.Component{static propTypes={account:B.Z.ChainAccount.isRequired,currentOwner:B.Z.ChainAccount.isRequired};constructor(){super(),this.state={new_issuer_account_id:null,issuer_account_name:null}}onAccountNameChanged(e,t){this.setState({[e]:t})}onAccountChanged(e,t){this.setState({[e]:t?t.get("id"):null})}onSubmit(){S.Z.updateOwner(this.props.asset,this.state.new_issuer_account_id).then((()=>{this.onReset()}))}onReset(){this.setState({new_issuer_account_id:null,issuer_account_name:null})}render(){const{currentOwner:e}=this.props;return s.createElement("div",null,s.createElement("div",{style:{paddingBottom:"1rem"}},s.createElement(w.Z,{label:"account.user_issued_assets.current_issuer",accountName:e.get("name"),account:e.get("name"),error:null,tabIndex:1,disabled:!0})),s.createElement(w.Z,{label:"account.user_issued_assets.new_issuer",accountName:this.state.issuer_account_name,onChange:this.onAccountNameChanged.bind(this,"issuer_account_name"),onAccountChanged:this.onAccountChanged.bind(this,"new_issuer_account_id"),account:this.state.issuer_account_name,error:null,tabIndex:1,typeahead:!0,excludeAccounts:[e.get("name")]}),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement("button",{className:A()("button",{disabled:!this.state.new_issuer_account_id}),onClick:this.onSubmit.bind(this)},s.createElement(l(),{content:"account.user_issued_assets.update_owner"})),s.createElement("button",{className:"button outline",onClick:this.onReset.bind(this)},s.createElement(l(),{content:"account.perm.reset"}))))}}const L=D=(0,O.Z)(D);class j extends s.Component{constructor(e){super();let t=new v.xR({amount:0,asset_id:e.quote.get("id"),precision:e.quote.get("precision")}),a=new v.xR({amount:0,asset_id:e.base.get("id"),precision:e.base.get("precision")}),s=new v.tA({quote:t,base:a});this.state={price:s,realPriceValue:s.toReal()}}onPriceChanged({amount:e}){this.state.price.setPriceFromReal(parseFloat(e)),this.setState({realPriceValue:e}),this.props.onPriceChanged&&this.props.onPriceChanged(this.state.price.clone())}render(){const{realPriceValue:e,price:t}=this.state;return s.createElement(P.Z,{label:this.props.label,amount:e,onChange:this.onPriceChanged.bind(this),asset:t.base.asset_id,base:this.props.quote.get("symbol"),isPrice:!0,assets:[t.quote.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingRight:"10px"}})}}const z=j=(0,c.Z)(j,{propNames:["quote","base"],defaultProps:{base:"1.3.0"}});class M extends s.Component{static propTypes={account:B.Z.ChainAccount.isRequired};constructor(e){super(),this.state=this.resetState(e)}resetState(e=this.props){let t=e.account.get("id");const a=e.asset.getIn(["bitasset","current_feed"]);let s=a.get("maintenance_collateral_ratio",1750),n=a.get("maximum_short_squeeze_ratio",1100);return{publisher:e.account.get("name"),publisher_id:t,mcr:s,mcrValue:s/1e3,mssr:n,mssrValue:n/1e3}}onAccountNameChanged(e,t){this.setState({[e]:t})}onAccountChanged(e,t){this.setState({[e]:t?t.get("id"):null})}onSubmit(){S.Z.publishFeed({publisher:this.state.publisher_id,asset_id:this.props.asset.get("id"),mcr:this.state.mcr,mssr:this.state.mssr,feedPrice:this.state.feedPrice,cer:this.state.cer})}onPriceChanged(e,t){this.setState({[e]:t})}onSetRatio(e,{amount:t}){t&&"string"==typeof t&&-1!==t.indexOf(".")&&t.indexOf(".")+4!==t.length&&(t=t.substr(0,t.indexOf(".")+4)),this.setState({[e+"Value"]:t,[e]:Math.floor(1e3*parseFloat(t))})}render(){const{asset:e}=this.props,{mcrValue:t,mssrValue:a,publisher:n}=this.state,r=e.get("id"),o=e.getIn(["bitasset","options","short_backing_asset"]);return s.createElement("div",null,s.createElement(w.Z,{label:"explorer.asset.feed_producer",accountName:n,onChange:this.onAccountNameChanged.bind(this,"publisher"),onAccountChanged:this.onAccountChanged.bind(this,"publisher_id"),account:n,error:null,tabIndex:1,typeahead:!0}),s.createElement("br",null),s.createElement(z,{onPriceChanged:this.onPriceChanged.bind(this,"cer"),label:"explorer.asset.fee_pool.core_exchange_rate",quote:"1.3.0",base:r}),s.createElement("br",null),s.createElement(z,{onPriceChanged:this.onPriceChanged.bind(this,"feedPrice"),label:"explorer.asset.price_feed.feed_price",quote:o,base:r}),s.createElement("br",null),s.createElement(P.Z,{label:"explorer.asset.price_feed.maintenance_collateral_ratio",amount:t,onChange:this.onSetRatio.bind(this,"mcr"),placeholder:"0.0",style:{width:"100%",paddingRight:"10px"}}),s.createElement("br",null),s.createElement(P.Z,{label:"explorer.asset.price_feed.maximum_short_squeeze_ratio",amount:a,onChange:this.onSetRatio.bind(this,"mssr"),placeholder:"0.0",style:{width:"100%",paddingRight:"10px"}}),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement("button",{className:A()("button",{disabled:!1}),onClick:this.onSubmit.bind(this)},s.createElement(l(),{content:"transaction.trxTypes.asset_publish_feed"}))))}}M=(0,O.Z)(M);const U=M=(0,c.Z)(M);var G=a(76660),J=a(98485);class W extends s.Component{static propTypes={account:B.Z.ChainAccount.isRequired};constructor(){super(),this.state={globalSettlementPrice:null,customPrice:!1}}shouldComponentUpdate(e,t){return e.asset.id!==this.props.asset.id||t.globalSettlementPrice!==this.state.globalSettlementPrice||t.customPrice!==this.state.customPrice}onPriceChanged(e){2!=e||this.state.customPrice?this.setState({globalSettlementPrice:e}):this.setState({globalSettlementPrice:1,customPrice:!0})}onPriceChangedObject(e){this.onPriceChanged(e.toReal())}onSubmit(){const{asset:e,account:t}=this.props;let a=new v.xR({real:1,asset_id:this.props.asset.id,precision:this.props.asset.precision}),s=x.ChainStore.getAsset(e.bitasset.options.short_backing_asset),n=new v.xR({real:this.state.globalSettlementPrice,asset_id:this.props.asset.bitasset.options.short_backing_asset,precision:s.get("precision")}),r=new v.tA({quote:n,base:a});S.Z.assetGlobalSettle(e,t.get("id"),r).then((()=>{this.onReset()}))}onReset(){this.setState({globalSettlementPrice:null,customPrice:!1})}onChange({amount:e}){this.onPriceChanged(e)}onChangeRadio(e){this.onPriceChanged(e.target.value)}render(){const{asset:e}=this.props,t=x.ChainStore.getAsset(e.bitasset.options.short_backing_asset);let a=b.Z.parseDescription(e.options.description);return s.createElement("div",null,s.createElement(G.Form,{style:{paddingBottom:"1rem"},className:"full-width",layout:"vertical"},s.createElement("div",null,s.createElement(G.Tooltip,{title:q().translate("explorer.asset.prediction_market_asset.tooltip_prediction"),placement:"topLeft"},s.createElement(l(),{content:"explorer.asset.prediction_market_asset.prediction"}),": ",s.createElement("p",null,a.condition))),s.createElement("div",null,s.createElement(G.Tooltip,{title:q().translate("explorer.asset.prediction_market_asset.tooltip_resolution_date"),placement:"topLeft"},s.createElement(l(),{content:"explorer.asset.prediction_market_asset.resolution_date"}),": ",s.createElement("p",null,a.expiry))),s.createElement(G.Radio.Group,{onChange:this.onChangeRadio.bind(this),value:this.state.globalSettlementPrice},s.createElement(G.Radio,{value:1,disabled:!!this.state.customPrice||void 0},s.createElement(l(),{content:"boolean.true"})),s.createElement(G.Radio,{value:0,disabled:!!this.state.customPrice||void 0},s.createElement(l(),{content:"boolean.false"})),s.createElement(G.Radio,{value:this.state.customPrice?this.state.globalSettlementPrice:2},s.createElement(l(),{content:"settings.custom"}))),s.createElement("br",null),s.createElement("br",null),s.createElement(J.Z,{disabled:!this.state.customPrice||void 0,label:"explorer.asset.price_feed.global_settlement_price",amount:this.state.globalSettlementPrice,onChange:this.onChange.bind(this),asset:t.get("id"),base:e.symbol,isPrice:!0,assets:[t.get("id")],placeholder:"0.0",style:{width:"100%"}}),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement(G.Button,{type:"primary",disabled:null==this.state.globalSettlementPrice||void 0,onClick:this.onSubmit.bind(this)},s.createElement(l(),{content:"account.perm.publish_prediction"})),s.createElement(G.Button,{style:{marginLeft:"8px"},onClick:this.onReset.bind(this)},s.createElement(l(),{content:"account.perm.reset"})))))}}const $=W=(0,O.Z)(W);class V extends s.Component{constructor(e){super(e),this.state=this.initialState()}initialState=()=>({account:x.ChainStore.getAccount(this.props.funderAccountName),collateralAmount:"0",debtAmount:"0"});reset(){this.setState(this.initialState())}_collateralBidInput(e){this.setState({collateralAmount:e.amount})}_debtBidInput(e){this.setState({debtAmount:e.amount})}_onBidCollateral(){let{collateralAmount:e,debtAmount:t}=this.state;e=0==e?e:e.replace(/,/g,""),t=0==t?t:t.replace(/,/g,""),S.Z.bidCollateral(this.state.account?this.state.account.get("id"):null,this.props.core,this.props.asset,e,t),setTimeout((()=>{this.props.onUpdate()}),6e3)}removeBid(){S.Z.bidCollateral(this.state.account?this.state.account.get("id"):null,this.props.core,this.props.asset,0,0),setTimeout((()=>{this.props.onUpdate()}),6e3)}renderCollateralBid(){const{asset:e,core:t}=this.props,{account:a,collateralAmount:n,debtAmount:r}=this.state;let o=1,i=0;const c=a?a.getIn(["balances",t.get("id")]):null;if(c){let e=x.ChainStore.getObject(c);e&&(i=e.get("balance"))}const u=s.createElement("span",null,s.createElement(l(),{component:"span",content:"transfer.available"}),": ",s.createElement(m.Z,{amount:i,asset:t.get("id")}));return s.createElement("div",null,s.createElement(P.Z,{label:"transaction.collateral",display_balance:u,amount:n,onChange:this._collateralBidInput.bind(this),asset:t.get("id"),assets:[t.get("id")],placeholder:"0.0",tabIndex:o++,style:{width:"100%",paddingTop:16}}),s.createElement(P.Z,{label:"transaction.borrow_amount",amount:r,onChange:this._debtBidInput.bind(this),asset:e.get("id"),assets:[e.get("id")],placeholder:"0.0",tabIndex:o++,style:{width:"100%",paddingTop:16}}),"0"!==this.state.collateralAmount&&"0"!==this.state.debtAmount&&s.createElement("div",{style:{paddingTop:"1rem"}},s.createElement(l(),{content:"explorer.asset.collateral.bid_price"})," ",s.createElement(d.Z,{base_amount:this.state.collateralAmount/1,base_asset:t.get("id"),quote_amount:this.state.debtAmount/1,quote_asset:e.get("id"),noPopOver:!0,ignorePriceFeed:!0})),s.createElement("div",{style:{paddingTop:"1rem"},className:"button-group"},s.createElement("button",{className:A()("button"),onClick:this._onBidCollateral.bind(this),tabIndex:o++},s.createElement(l(),{content:"transaction.trxTypes.bid_collateral"})),s.createElement("button",{className:"button outline",onClick:this.reset.bind(this),tabIndex:o++},s.createElement(l(),{content:"account.perm.reset"}))))}render(){return this.renderCollateralBid()}}const K=V=(0,c.Z)(V,{propNames:["asset","core"],withDynamic:!0});function H(){return H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},H.apply(this,arguments)}a(7437);const{Panel:X}=G.Collapse;class Q extends s.Component{render(){let{isSet:e,name:t}=this.props;return e?s.createElement("span",{className:"asset-flag"},s.createElement("span",{className:"label info"},s.createElement(l(),{content:"account.user_issued_assets."+t}))):s.createElement("span",null)}}class Y extends s.Component{render(){let{isSet:e,name:t}=this.props;return e?s.createElement("span",{className:"asset-flag"},s.createElement("span",{className:"label info"},s.createElement(l(),{content:"account.user_issued_assets."+t}))):s.createElement("span",null)}}class ee extends s.Component{constructor(e){super(e),this.state={callOrders:[],collateralBids:[],marginTableSort:"ratio",collateralTableSort:"price",sortDirection:!0,showCollateralBidInInfo:!1,cumulativeGrouping:!1,activeFeedTab:"margin",activeAssetTab:"info"}}UNSAFE_componentWillMount(){this._getMarginCollateral()}updateOnCollateralBid(){this._getMarginCollateral()}_getMarginCollateral(){if(this.props.asset.has("bitasset")){const e={[this.props.asset.get("id")]:this.props.asset.toJS(),[this.props.backingAsset.get("id")]:this.props.backingAsset.toJS()},t=this.props.asset.getIn(["bitasset","is_prediction_market"],!1);let a=this._getFeedPrice();if(a){try{let s=this.props.asset.getIn(["bitasset","current_feed","maintenance_collateral_ratio"]);y.Apis.instance().db_api().exec("get_call_orders",[this.props.asset.get("id"),300]).then((n=>{let r=n.map((n=>new v.Gy(n,e,this.props.asset.get("id"),a,s,t)));this.setState({callOrders:r})}))}catch(e){}try{y.Apis.instance().db_api().exec("get_collateral_bids",[this.props.asset.get("id"),100,0]).then((t=>{let s=t.map((t=>new v.DI(t,e,this.props.asset.get("id"),a)));this.setState({collateralBids:s})}))}catch(e){console.log("get_collateral_bids Error: ",e)}}}}_getFeedPrice(){const e={[this.props.asset.get("id")]:this.props.asset.toJS(),[this.props.backingAsset.get("id")]:this.props.backingAsset.toJS()},t=this.props.asset.getIn(["bitasset","is_prediction_market"],!1);let a,s=this.props.asset.getIn(["bitasset","current_feed","maximum_short_squeeze_ratio"]),n=b.Z.extractRawFeedPrice(this.props.asset);return 0==n.getIn(["base","amount"])&&0==n.getIn(["quote","amount"])?null:(t&&n.getIn(["base","asset_id"])===n.getIn(["quote","asset_id"])&&(e[this.props.backingAsset.get("id")]||(e[this.props.backingAsset.get("id")]={precision:this.props.asset.get("precision")}),n=n.setIn(["base","amount"],1),n=n.setIn(["base","asset_id"],this.props.backingAsset.get("id")),n=n.setIn(["quote","amount"],1),n=n.setIn(["quote","asset_id"],this.props.asset.get("id")),s=1e3),!n.toJS||e[n.toJS().base.asset_id]?(a=new v.ad({priceObject:n,market_base:this.props.asset.get("id"),sqr:s,assets:e}),a):void 0)}_toggleCumulativeGrouping(){this.setState({cumulativeGrouping:!this.state.cumulativeGrouping})}_assetType(e){return"bitasset"in e?e.bitasset.is_prediction_market?"Prediction":"Smart":"Simple"}formattedPrice(e,t=!1,a=!1,n=0,r=!1){if("number"==typeof e&&isNaN(e))return"-";var l=e.base,o=e.quote;return s.createElement(d.Z,{base_amount:l.amount,base_asset:l.asset_id,quote_amount:o.amount,quote_asset:o.asset_id,hide_value:a,hide_symbols:t,factor:n,negative_invert:r})}renderFlagIndicators(e,t){return s.createElement("div",null,t.map((t=>s.createElement(Q,{key:`flag_${t}`,name:t,isSet:e[t]}))))}renderPermissionIndicators(e,t){return s.createElement("div",null,t.map((t=>s.createElement(Y,{key:`perm_${t}`,name:t,isSet:e[t]}))))}renderAuthorityList(e){return e.map((function(e){return s.createElement("span",{key:e},s.createElement(o.Z,{account:e})," ")}))}renderMarketList(e,t){var a=e.symbol;return t.map(function(e){if(e==a)return null;var t=e+"_"+a,r=e+"/"+a;return s.createElement("span",{key:t},s.createElement(n.rU,{to:`/market/${t}`},r)," ")}.bind(this))}renderAboutBox(e,t){var a=x.ChainStore.getObject(e.issuer,!1,!1),r=a?a.get("name"):"";let o=b.Z.parseDescription(e.options.description),i=o.main,c=o.short_name?o.short_name:null;i=i&&i.length>0?i+" ":i;let m=i.match(/(http?):\/\/(www\.)?[a-z0-9\.:].*?(?=\s)/g);const d=this.props.coreAsset.get("symbol");let p=o.market?o.market:d;e.bitasset&&(p=x.ChainStore.getAsset(e.bitasset.options.short_backing_asset),p=p&&p.get?p.get("symbol"):d),e.symbol===d&&(p="USD"),m&&m.length&&m.forEach((e=>{let t=`<a target="_blank" class="external-link" rel="noopener noreferrer" href="${e}">${e}</a>`;i=i.replace(e,t)}));let{name:h,prefix:E}=g.Z.replaceName(t);return s.createElement("div",{style:{overflow:"visible"}},s.createElement("h2",null,e&&a&&"1.3.0"!=e.id&&"1.2.0"!=a.get("id")&&s.createElement(G.Alert,{message:q().translate("explorer.asset.asset_owner_responsible"),type:"info",showIcon:!0,style:{marginTop:"1em"}}),s.createElement(u.Z,{maxWidth:50,replaceNoneToBts:!1,name:e.symbol}),c?s.createElement("span",{style:{marginRight:15}},c):null,s.createElement(n.rU,{className:"button market-button",to:`/market/${e.symbol}_${p}`},s.createElement(l(),{content:"exchange.market"}))),s.createElement(_.Z,{path:"assets/"+e.symbol,alt_path:"assets/Asset",section:"summary",symbol:(E||"")+h,description:i,issuer:r,hide_issuer:"true"}))}renderSummary(e){let t=this.props.getDynamicObject(e.dynamic_asset_data_id);t&&(t=t.toJS());var a=e.options;let n=b.Z.getFlagBooleans(e.options.flags,this.props.asset.has("bitasset_data_id")),r=Object.keys(n),c="bitasset"in e&&e.bitasset.is_prediction_market,d=null;if(c){let t=b.Z.parseDescription(e.options.description);d=s.createElement(s.Fragment,null,s.createElement("tr",null,s.createElement("td",null,s.createElement(G.Tooltip,{title:q().translate("explorer.asset.prediction_market_asset.tooltip_prediction")},s.createElement(l(),{content:"explorer.asset.prediction_market_asset.prediction"}))),s.createElement("td",null,s.createElement(G.Tooltip,{title:q().translate("explorer.asset.prediction_market_asset.tooltip_prediction")},t.condition))),s.createElement("tr",null,s.createElement("td",null,s.createElement(G.Tooltip,{title:q().translate("explorer.asset.prediction_market_asset.tooltip_resolution_date")},s.createElement(l(),{content:"explorer.asset.prediction_market_asset.resolution_date"}))),s.createElement("td",null,s.createElement(G.Tooltip,{title:q().translate("explorer.asset.prediction_market_asset.tooltip_resolution_date")},t.expiry))))}var u=t?s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.summary.current_supply"})),s.createElement("td",null,s.createElement(m.Z,{amount:t.current_supply,asset:e.id}))):null,h=t?s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.summary.stealth_supply"})),s.createElement("td",null,s.createElement(m.Z,{amount:t.confidential_supply,asset:e.id}))):null,_=n.charge_market_fee?s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.summary.market_fee"})),s.createElement("td",null," ",a.market_fee_percent/100," % ")):null,g=n.charge_market_fee&&a.extensions&&a.extensions.reward_percent>=0?s.createElement("tr",null,s.createElement("td",null,s.createElement(G.Tooltip,{title:q().translate("account.user_issued_assets.reward_percent_tooltip")},s.createElement(l(),{content:"explorer.asset.summary.market_fee_referral_reward_percent"})," ",s.createElement(G.Icon,{type:"question-circle",theme:"filled"}))),s.createElement("td",null," ",a.extensions.reward_percent/100," % ")):null;return s.createElement("div",{className:"asset-card no-padding"},s.createElement("div",{className:"card-divider"},s.createElement(p.Z,{name:e.symbol})),s.createElement("table",{className:"table key-value-table table-hover"},s.createElement("tbody",null,s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.summary.asset_type"})),s.createElement("td",null," ",this._assetType(e)," ")),c&&d,s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.summary.issuer"})),s.createElement("td",null,s.createElement(o.Z,{account:e.issuer}))),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.assets.precision"})),s.createElement("td",null," ",e.precision," ")),e.bitasset?s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.assets.backing_asset"})),s.createElement("td",null,s.createElement(i.Z,{asset:e.bitasset.options.short_backing_asset}))):null,u,h,_,g)),s.createElement("br",null),this.renderFlagIndicators(n,r))}renderPriceFeed(e){var t=e.bitasset;if(!("current_feed"in t))return s.createElement("div",{header:r});var a=t.current_feed,n=this.formattedPrice(b.Z.extractRawFeedPrice(e)),r=s.createElement("div",null,s.createElement(l(),{content:"explorer.asset.price_feed.title"}),s.createElement("span",{className:"float-right"},n));return s.createElement(X,{header:r},s.createElement("table",{className:"table key-value-table table-hover",style:{padding:"1.2rem"}},s.createElement("tbody",null,s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.external_feed_price"})),s.createElement("td",null,n)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.feed_lifetime"})),s.createElement("td",null,t.options.feed_lifetime_sec/60/60)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.min_feeds"})),s.createElement("td",null,t.options.minimum_feeds)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.maintenance_collateral_ratio"})),s.createElement("td",null,a.maintenance_collateral_ratio/1e3)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.maximum_short_squeeze_ratio"})),s.createElement("td",null,a.maximum_short_squeeze_ratio/1e3)))))}_analyzeBids(e){let t=e,a=0,s=0;return this.state.collateralBids.sort(((e,t)=>t.bid.toReal()-e.bid.toReal())).forEach((e=>{let n=e.collateral,r=e.debt;s<t?(s+r>=t?(r=t-s,n=r/e.debt*n,e.consideredIfRevived=2):e.consideredIfRevived=1,a+=n,s+=r):e.consideredIfRevived=0})),{collateral:a,debt:s}}renderSettlement(e){var t=e.bitasset;if(!("current_feed"in t))return s.createElement("div",{header:w});let a=this.props.getDynamicObject(e.dynamic_asset_data_id);a&&(a=a.toJS());var n=a?a.current_supply:0,r=t.current_feed,o=e.bitasset.settlement_fund>0;let i=null,c=null,u=null;if(o){var p=t.settlement_fund,h=this.formattedPrice(t.settlement_price),_=this.formattedPrice(t.settlement_price,!1,!1,r.maintenance_collateral_ratio/1e3,!0);const a={[this.props.asset.get("id")]:this.props.asset.toJS(),[this.props.backingAsset.get("id")]:this.props.backingAsset.toJS()};let l=n,o=t.settlement_fund,m=this._analyzeBids(l);u=s.createElement(d.Z,{base_amount:t.settlement_fund/1+m.collateral,base_asset:a[t.options.short_backing_asset].id,quote_amount:m.debt,quote_asset:e.id,hide_value:!1,hide_symbols:!1,factor:r.maintenance_collateral_ratio/1e3,negative_invert:!0}),l/=Math.pow(10,e.precision),o/=Math.pow(10,a[t.options.short_backing_asset].precision);let b=m.collateral/Math.pow(10,a[t.options.short_backing_asset].precision),g=this._getFeedPrice();g&&(i=o/g.toReal()/l,c=(o+b)/g.toReal()/l)}else var g=this.getGlobalSettlementPrice(),E=this.getGlobalSettlementPrice(r.maximum_short_squeeze_ratio/1e3),x=t.force_settled_volume,y=t.options.force_settlement_offset_percent,v=t.options.force_settlement_delay_sec,C=t.options.maximum_force_settlement_volume,k=this.formattedPrice(b.Z.extractRawFeedPrice(e),!1,!1,r.maximum_short_squeeze_ratio/1e3),A=this.formattedPrice(b.Z.extractRawFeedPrice(e),!1,!1,1-y/1e4);var w=s.createElement("div",null,s.createElement(l(),{content:"explorer.asset.settlement.title"}),s.createElement("span",{className:"float-right"},o?h:A));return s.createElement(X,{header:w},o&&s.createElement(l(),{component:"p",content:"explorer.asset.settlement.gs_description"}),o&&s.createElement("p",null,s.createElement(l(),{content:"explorer.asset.settlement.gs_revive"})," (",s.createElement(l(),{content:"explorer.asset.settlement.gs_see_actions"}),", ",s.createElement(l(),{content:"explorer.asset.settlement.gs_or"})," ",s.createElement("a",{onClick:()=>{this.setState({showCollateralBidInInfo:!this.state.showCollateralBidInInfo})}},s.createElement(l(),{content:"explorer.asset.settlement.gs_place_bid"})),")."),s.createElement("table",{className:"table key-value-table table-hover",style:{padding:"1.2rem"}},o?s.createElement("tbody",null,s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.settlement_price"})),s.createElement("td",null,h)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.settlement_funds"})),s.createElement("td",null,s.createElement(m.Z,{asset:t.options.short_backing_asset,amount:p}))),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.settlement_funds_collateral_ratio"})),s.createElement("td",null,i?i.toFixed(6):"-")),s.createElement("tr",null,s.createElement("td",null," "),s.createElement("td",null," ")),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{style:{fontWeight:"bold"},content:"explorer.asset.settlement.gs_revert"})),s.createElement("td",null," ")),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.gs_auto_revive_price"})),s.createElement("td",null,_," / ",u)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.gs_collateral_valuation",mcr:r.maintenance_collateral_ratio/1e3})),s.createElement("td",null,c?c.toFixed(6):"-"))):s.createElement("tbody",null,s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.maximum_short_squeeze_price"})),s.createElement("td",null,k)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.global_settlement_trigger"})),s.createElement("td",null,E||"-")),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.price_feed.global_settlement_price"})),s.createElement("td",null,g||"-")),s.createElement("tr",null,s.createElement("td",null," "),s.createElement("td",null," ")),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{style:{fontWeight:"bold"},content:"explorer.asset.settlement.force_settlement"})),s.createElement("td",null," ")),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.price"})," (",y/100,"%"," ",s.createElement(l(),{content:"explorer.asset.settlement.offset"}),")"),s.createElement("td",null,A)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.delay"})),s.createElement("td",null,s.createElement(f,{time:v}))),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.max_settle_volume"})," (",C/100,"%)"),s.createElement("td",null,s.createElement(m.Z,{asset:e.id,amount:n*(C/1e4)}))),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.current_settled"})),s.createElement("td",null,s.createElement(m.Z,{asset:e.id,amount:x}))),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.settlement.settle_remaining_volume"})),s.createElement("td",null,0==x?100:Math.round(100-x/(n*(C/1e4))*100,2),"%")))))}renderFeePool(e){let t=this.props.getDynamicObject(e.dynamic_asset_data_id);t&&(t=t.toJS());var a=e.options;const n=this.props.coreAsset;return s.createElement(X,{header:s.createElement("div",null,s.createElement(l(),{content:"explorer.asset.fee_pool.title"}),t?s.createElement("span",{className:"float-right"},s.createElement(m.Z,{asset:"1.3.0",amount:t.fee_pool})):null)},s.createElement("div",null,s.createElement(l(),{component:"p",content:"explorer.asset.fee_pool.pool_text",unsafe:!0,asset:e.symbol,core:n.get("symbol")}),s.createElement("table",{className:"table key-value-table",style:{padding:"1.2rem"}},s.createElement("tbody",null,s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.fee_pool.core_exchange_rate"})),s.createElement("td",null,this.formattedPrice(a.core_exchange_rate))),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.fee_pool.pool_balance"})),s.createElement("td",null,t?s.createElement(m.Z,{asset:"1.3.0",amount:t.fee_pool}):null)),s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.fee_pool.unclaimed_issuer_income"})),s.createElement("td",null,t?s.createElement(m.Z,{asset:e.id,amount:t.accumulated_fees}):null))))))}renderAssetOwnerUpdate(e){return s.createElement(X,{header:s.createElement(l(),{content:"account.user_issued_assets.update_owner"})},s.createElement(l(),{component:"p",content:"account.user_issued_assets.update_owner_text",asset:e.symbol}),s.createElement(L,{asset:e,account:this.props.currentAccount,currentOwner:e.issuer}))}renderFeedPublish(e){return s.createElement(X,{header:s.createElement(l(),{content:"transaction.trxTypes.asset_publish_feed"})},s.createElement(l(),{component:"p",content:"explorer.asset.feed_producer_text"}),s.createElement(U,{asset:e.id,account:this.props.currentAccount,currentOwner:e.issuer}))}renderCollateralBid(e){return s.createElement(X,{header:s.createElement(l(),{content:"explorer.asset.collateral.bid"})},s.createElement(l(),{component:"p",content:"explorer.asset.collateral.bid_text",asset:e.symbol}),s.createElement(l(),{component:"p",content:"explorer.asset.settlement.gs_included_on_revival"}),s.createElement(l(),{component:"p",content:"explorer.asset.collateral.remove_bid"}),s.createElement(K,{asset:e.symbol,core:e.bitasset.options.short_backing_asset,funderAccountName:this.props.currentAccount,onUpdate:this.updateOnCollateralBid.bind(this),hideBalance:!0}))}renderFeePoolFunding(e){return s.createElement(X,{header:s.createElement(l(),{content:"explorer.asset.fee_pool.fund"})},s.createElement(l(),{component:"p",content:"explorer.asset.fee_pool.fund_text",asset:e.symbol}),s.createElement(T,{asset:e.symbol,funderAccountName:this.props.currentAccount,hideBalance:!0}))}renderFeePoolClaiming(e){let t=this.props.getDynamicObject(e.dynamic_asset_data_id);return t&&(t=t.toJS()),s.createElement(X,{header:s.createElement(l(),{content:"explorer.asset.fee_pool.claim_balance"})},s.createElement(T,{asset:e.symbol,funderAccountName:this.props.currentAccount,dynamic:t,hideBalance:!0,type:"claim"}))}renderFeesClaiming(e){let t=this.props.getDynamicObject(e.dynamic_asset_data_id);return t&&(t=t.toJS()),s.createElement(X,{header:s.createElement(l(),{content:"transaction.trxTypes.asset_claim_fees"})},s.createElement(T,{asset:e.symbol,dynamic:t,funderAccountName:this.props.currentAccount,hideBalance:!0,type:"claim_fees"}))}renderPermissions(e){var t=e.options;let a=b.Z.getFlagBooleans(e.options.issuer_permissions,this.props.asset.has("bitasset_data_id")),n=Object.keys(a);var r=a.charge_market_fee?s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.permissions.max_market_fee"})),s.createElement("td",null,s.createElement(m.Z,{amount:+t.max_market_fee,asset:e.id}))):null,o=s.createElement("tr",null,s.createElement("td",null,s.createElement(l(),{content:"explorer.asset.permissions.max_supply"})),s.createElement("td",null,s.createElement(m.Z,{amount:+t.max_supply,asset:e.id}))),i=a.white_list?s.createElement("div",null,s.createElement("br",null),!!t.blacklist_authorities&&!!t.blacklist_authorities.length&&s.createElement(s.Fragment,null,s.createElement(l(),{content:"explorer.asset.permissions.blacklist_authorities"}),": ",this.renderAuthorityList(t.blacklist_authorities)),!!t.blacklist_markets&&!!t.blacklist_markets.length&&s.createElement(s.Fragment,null,s.createElement("br",null),s.createElement(l(),{content:"explorer.asset.permissions.blacklist_markets"}),": ",this.renderMarketList(e,t.blacklist_markets)),!!t.whitelist_authorities&&!!t.whitelist_authorities.length&&s.createElement(s.Fragment,null,s.createElement("br",null),s.createElement(l(),{content:"explorer.asset.permissions.whitelist_authorities"}),": ",this.renderAuthorityList(t.whitelist_authorities)),!!t.whitelist_markets&&!!t.whitelist_markets.length&&s.createElement(s.Fragment,null,s.createElement("br",null),s.createElement(l(),{content:"explorer.asset.permissions.whitelist_markets"}),": ",this.renderMarketList(e,t.whitelist_markets))):null;let c=e.options.extensions.whitelist_market_fee_sharing&&s.createElement(s.Fragment,null,s.createElement("br",null),s.createElement(l(),{content:"explorer.asset.permissions.accounts_in_whitelist_market_fee_sharing"}),": ",this.renderAuthorityList(e.options.extensions.whitelist_market_fee_sharing));return s.createElement(X,{header:s.createElement(l(),{content:"explorer.asset.permissions.title"})},s.createElement("div",null,s.createElement("table",{className:"table key-value-table table-hover",style:{padding:"1.2rem"}},s.createElement("tbody",null,r,o)),s.createElement("br",null),this.renderPermissionIndicators(a,n),s.createElement("br",null),i,c))}getGlobalSettlementPrice(e=1){if(!this.state.callOrders)return null;for(var t=null,a=null,n=this.state.callOrders.length,r=0;r<n;r++){let e=this.state.callOrders[r];null==t?(t=e,a=e.getRatio()):e.getRatio()<a&&(a=e.getRatio(),t=e)}if(null==t)return null;let l=t.debt*e,o=t.collateral;return s.createElement(d.Z,{base_amount:o,base_asset:t.call_price.base.asset_id,quote_amount:l,quote_asset:t.call_price.quote.asset_id})}_renderFeedTable(e){var t=e.bitasset;if(!("feeds"in t)||0==t.feeds.length||t.is_prediction_market||!t.feeds.length)return null;var a=t.feeds,n=b.Z.extractRawFeedPrice(a[0][1][1]),r=a[0][1][1].core_exchange_rate;let i=(new Date).getTime(),c=new Date(i-1e3*e.bitasset.options.feed_lifetime_sec);a=a.filter((e=>new Date(e[1][0])>c)).sort((function(e,t){return new Date(t[1][0])-new Date(e[1][0])}));let m=b.Z.extractRawFeedPrice(e),d=m.base.amount/m.quote.amount,u=[],p=[];p=[{key:"publisher",fixed:"left",width:150,title:s.createElement(l(),{content:"explorer.asset.price_feed_data.publisher"}),dataIndex:"publisher",sorter:(e,t)=>{let a=x.ChainStore.getAccount(e.publisher,!1);a&&(a=a.get("name"));let s=x.ChainStore.getAccount(t.publisher,!1);return s&&(s=s.get("name")),a>s?1:a<s?-1:0},render:e=>s.createElement(o.Z,{account:e})},{key:"feed_price",title:s.createElement(s.Fragment,null,s.createElement(l(),{content:"explorer.asset.price_feed_data.feed_price"})," ","(",this.formattedPrice(n,!1,!0),")"),dataIndex:"feed_price",sorter:(e,t)=>{let a=parseFloat(e.feed_price.base.amount/e.feed_price.quote.amount),s=parseFloat(t.feed_price.base.amount/t.feed_price.quote.amount);return a>s?1:a<s?-1:0},render:e=>{let t=(parseFloat(e.base.amount/e.quote.amount)/d*100-100).toFixed(2);return s.createElement(s.Fragment,null,this.formattedPrice(e,!0),"(",s.createElement("span",{className:t>0?"txtlabel success":t<0?"txtlabel warning":"txtlabel"},t,"%"),")")}},{key:"core_exchange_rate",title:s.createElement(s.Fragment,null,s.createElement(l(),{content:"explorer.asset.price_feed_data.core_exchange_rate"})," ","(",this.formattedPrice(r,!1,!0),")"),dataIndex:"core_exchange_rate",render:e=>this.formattedPrice(e,!0)},{key:"maintenance_collateral_ratio",title:s.createElement(l(),{content:"explorer.asset.price_feed_data.maintenance_collateral_ratio"}),dataIndex:"maintenance_collateral_ratio",render:e=>e},{key:"maximum_short_squeeze_ratio",title:s.createElement(l(),{content:"explorer.asset.price_feed_data.maximum_short_squeeze_ratio"}),dataIndex:"maximum_short_squeeze_ratio",render:e=>e},{key:"publishDate",fixed:"right",width:150,title:s.createElement(l(),{content:"explorer.asset.price_feed_data.published"}),dataIndex:"publishDate",sorter:(e,t)=>e.publishDate.getTime()>t.publishDate.getTime()?1:e.publishDate.getTime()<t.publishDate.getTime()?-1:0,render:e=>s.createElement(h.Z,{time:e})}];for(var _=0;_<a.length;_++){var g=a[_],E=g[0],f=new Date(g[1][0]+"Z"),y=b.Z.extractRawFeedPrice(g[1][1]),v=g[1][1].core_exchange_rate,C=""+g[1][1].maintenance_collateral_ratio/1e3,k=""+g[1][1].maximum_short_squeeze_ratio/1e3;u.push({publisher:E,feed_price:y,core_exchange_rate:v,maintenance_collateral_ratio:C,maximum_short_squeeze_ratio:k,publishDate:f})}return s.createElement(G.Table,{style:{width:"100%"},rowKey:"feedPublisher",columns:p,dataSource:u,pagination:!1,locale:{emptyText:s.createElement(l(),{content:"explorer.asset.price_feed_data.empty"})}})}_renderMarginTable(){let{cumulativeGrouping:e}=this.state,t=[],a=[];if(this.state.callOrders&&this.state.callOrders.length>0){const n=e?s.createElement("span",null," (",s.createElement(l(),{content:"explorer.asset.cumulative"}),")"):s.createElement("span",null," ");let r=0,i=0;this.state.callOrders.map((t=>{r+=t.debt,i+=t.collateral,a.push({borrower:t.borrower,collateral:{amount:e?i:t.collateral,asset:t.getCollateral().asset_id},debt:{amount:e?r:t.debt,asset:t.amountToReceive().asset_id},call:t.call_price,tcr:t.order.target_collateral_ratio,cr:{ratio:t.getRatio(),status:t.getStatus()}})}));const c=e=>{let t=a[0][e];return a.length?s.createElement("span",null,s.createElement("br",null),t.base?this.formattedPrice(t,!1,!0):s.createElement(m.Z,{asset:t.asset,amount:t.amount,hide_amount:!0})):null};t=[{key:"borrower",fixed:"left",width:200,title:s.createElement(l(),{content:"transaction.borrower"}),dataIndex:"borrower",sorter:(e,t)=>{let a=x.ChainStore.getAccount(e.borrower,!1);a&&(a=a.get("name"));let s=x.ChainStore.getAccount(t.borrower,!1);return s&&(s=s.get("name")),a>s?1:a<s?-1:0},render:e=>s.createElement(o.Z,{account:e})},{key:"collateral",title:s.createElement(s.Fragment,null,s.createElement(l(),{content:"transaction.collateral"}),n,c("collateral")),dataIndex:"collateral",sorter:(e,t)=>e.collateral.amount>t.collateral.amount?1:e.collateral.amount<t.collateral.amount?-1:0,render:e=>s.createElement(G.Tooltip,{title:q().translate("explorer.asset.margin_positions.click_to_switch_to_cumulative"),mouseEnterDelay:.5},s.createElement("span",{onClick:this._toggleCumulativeGrouping.bind(this),style:{cursor:"pointer"}},s.createElement(m.Z,{amount:e.amount,asset:e.asset,hide_asset:!0})))},{key:"debt",title:s.createElement(s.Fragment,null,s.createElement(l(),{content:"transaction.borrow_amount"}),n,c("debt")),dataIndex:"debt",sorter:(e,t)=>e.debt.amount>t.debt.amount?1:e.debt.amount<t.debt.amount?-1:0,render:e=>s.createElement("div",{onClick:this._toggleCumulativeGrouping.bind(this),style:{cursor:"pointer"}},s.createElement(G.Tooltip,{title:q().translate("explorer.asset.margin_positions.click_to_switch_to_cumulative"),mouseEnterDelay:.5},s.createElement(m.Z,{amount:e.amount,asset:e.asset,hide_asset:!0})))},{key:"call",title:s.createElement("span",null,s.createElement(l(),{content:"exchange.call"}),c("call")),dataIndex:"call",render:e=>this.formattedPrice(e,!0,!1)},{key:"tcr",title:s.createElement(G.Tooltip,{title:q().translate("borrow.target_collateral_ratio_explanation")},s.createElement(l(),{content:"borrow.target_collateral_ratio_short"})),dataIndex:"tcr",render:e=>e?(e/1e3).toFixed(3):"-"},{key:"cr",title:s.createElement(l(),{content:"borrow.coll_ratio"}),dataIndex:"cr",fixed:"right",width:100,sorter:(e,t)=>e.cr.ratio>t.cr.ratio?1:e.cr.ratio<t.cr.ratio?-1:0,render:e=>{let t="margin-ratio "+e.status;return s.createElement(s.Fragment,null,s.createElement("div",{className:t},e.ratio.toFixed(3)))}}]}return s.createElement(G.Table,{style:{width:"100%"},rowKey:"feedMargins",columns:t,dataSource:a,rowClassName:"margin-row",pagination:{pageSize:Number(25)},locale:{emptyText:s.createElement(l(),{content:"explorer.asset.margin_positions.empty"})}})}_renderCollBidTable(){let e=[],t=[];e=[{key:"bidder",title:s.createElement(l(),{content:"transaction.bidder"}),dataIndex:"bidder",fixed:"left",width:200,render:e=>s.createElement(o.Z,{account:e})},{key:"collateral",title:s.createElement(l(),{content:"transaction.collateral"}),dataIndex:"collateral",render:e=>s.createElement(m.Z,{amount:e.amount,asset:e.asset_id,hide_asset:!0})},{key:"debt",title:s.createElement(l(),{content:"transaction.borrow_amount"}),dataIndex:"debt",render:e=>s.createElement(m.Z,{amount:e.amount,asset:e.asset_id,hide_asset:!0})},{key:"debt_cum",title:s.createElement(l(),{content:"transaction.cumulative_borrow_amount"}),dataIndex:"debt_cum",render:e=>s.createElement(m.Z,{amount:e.amount,asset:e.asset_id,hide_asset:!0})},{key:"price",title:s.createElement(l(),{content:"explorer.asset.collateral_bid.bid"}),dataIndex:"price",render:e=>s.createElement(d.Z,{base_amount:e.base.amount,base_asset:e.base.asset_id,quote_amount:e.quote.amount,quote_asset:e.quote.asset_id,hide_symbols:!0})},{key:"cr",title:s.createElement(l(),{content:"borrow.coll_ratio"}),dataIndex:"cr",render:e=>e.toFixed(3)},{key:"included",title:s.createElement(l(),{content:"borrow.considered_on_revival"}),dataIndex:"included",render:e=>2==e?s.createElement(l(),{content:"explorer.asset.collateral_bid.included.partial"}):1==e?s.createElement(l(),{content:"explorer.asset.collateral_bid.included.yes"}):s.createElement(l(),{content:"explorer.asset.collateral_bid.included.no"})}];let a=0;return this.state.collateralBids.map((e=>{a+=e.debt,t.push({bidder:e.bidder,collateral:{amount:e.bid.base.amount,asset:e.bid.base.asset_id},debt:{amount:e.bid.quote.amount,asset:e.bid.quote.asset_id},debt_cum:{amount:a,asset:e.bid.quote.asset_id},price:e.bid,cr:e.getRatio(),included:e.consideredIfRevived})})),s.createElement(G.Table,{style:{width:"100%"},rowKey:"feedCollBid",columns:e,dataSource:t,pagination:{pageSize:Number(25)},locale:{emptyText:s.createElement(l(),{content:"explorer.asset.collateral_bid.empty"})}})}_setFeedTab(e){this.setState({activeFeedTab:e})}_setAssetTab(e){this.setState({activeAssetTab:e})}renderFeedTables(e){var t=e.bitasset;if(!("feeds"in t)||0==t.feeds.length||t.is_prediction_market||!t.feeds.length)return null;let a=t.settlement_fund>0;return s.createElement(G.Tabs,{onChange:this._setFeedTab.bind(this),activeKey:this.state.activeFeedTab},s.createElement(G.Tabs.TabPane,{tab:q().translate(a?"explorer.asset.collateral_bid.title":"explorer.asset.margin_positions.title"),key:"margin"},"margin"==this.state.activeFeedTab?a?this._renderCollBidTable():this._renderMarginTable():null),s.createElement(G.Tabs.TabPane,{tab:q().translate("explorer.asset.price_feed_data.title"),key:"feed"},"feed"==this.state.activeFeedTab?this._renderFeedTable(e):null))}renderAssetResolvePrediction(e){return s.createElement(X,{header:s.createElement(l(),{content:"account.user_issued_assets.resolve_prediction"})},s.createElement(l(),{component:"p",content:"account.user_issued_assets.resolve_prediction_text"}),s.createElement($,{asset:e,account:this.props.currentAccount}))}render(){if(null===this.props.backingAsset)return s.createElement(C.Z,{subtitle:"asset_not_found_subtitle"});if(!this.props.backingAsset.get||!this.props.coreAsset.get)return null;var e=this.props.asset.toJS(),t="bitasset"in e?this.renderPriceFeed(e):null,a="bitasset"in e?this.renderFeedTables(e):null;return s.createElement("div",{className:"grid-container asset-page"},s.createElement("div",{className:"grid-block page-layout"},s.createElement("div",{className:"grid-block main-content wrap"},s.createElement("div",{className:"grid-block medium-up-1",style:{width:"100%"}},this.renderAboutBox(e,this.props.asset)),s.createElement(G.Tabs,{onChange:this._setAssetTab.bind(this),activeKey:this.state.activeAssetTab,className:"grid-block vertical"},s.createElement(G.Tabs.TabPane,{tab:q().translate("explorer.asset.info"),key:"info"},s.createElement("div",{className:"grid-block vertical large-horizontal medium-up-1 large-up-2",style:{paddingTop:"1rem"}},s.createElement("div",{className:"grid-content small-no-padding"},this.renderSummary(e)),s.createElement("div",null,s.createElement(G.Collapse,{className:"asset-collapse"},this.renderPermissions(e),this.renderFeePool(e),t?this.renderPriceFeed(e):null,t?this.renderSettlement(e):null,this.state.showCollateralBidInInfo?this.renderCollateralBid(e):null))),a||null),s.createElement(G.Tabs.TabPane,{tab:q().translate("explorer.asset.actions"),key:"actions"},s.createElement(G.Collapse,{className:"asset-collapse"},this.renderFeePoolFunding(e),this.renderFeePoolClaiming(e),this.renderFeesClaiming(e),this.renderAssetOwnerUpdate(e),"bitasset"in e&&!e.bitasset.is_prediction_market&&this.renderFeedPublish(e),this.state.collateralBids.length>0&&this.renderCollateralBid(e),"bitasset"in e&&e.bitasset.is_prediction_market&&this.renderAssetResolvePrediction(e)))))))}}ee=(0,I.$)(ee,{listenTo:()=>[F.Z],getProps:()=>({currentAccount:F.Z.getState().currentAccount||F.Z.getState().passwordAccount})}),ee=(0,c.Z)(ee,{propNames:["backingAsset","coreAsset"]});class te extends s.Component{render(){if(null===this.props.asset)return s.createElement(C.Z,{subtitle:"asset_not_found_subtitle"});if(!this.props.asset.get)return null;let e=this.props.asset.has("bitasset")?this.props.asset.getIn(["bitasset","options","short_backing_asset"]):"1.3.0";return s.createElement(ee,H({},this.props,{backingAsset:e,coreAsset:"1.3.0"}))}}te=(0,c.Z)(te,{withDynamic:!0});class ae extends s.Component{render(){let e=this.props.match.params.symbol.toUpperCase();return s.createElement(te,H({},this.props,{asset:e}))}}},57351:(e,t,a)=>{a.d(t,{Z:()=>f});var s=a(67294),n=a(58074),r=a.n(n),l=a(21019),o=a(57906),i=a(43393),c=a.n(i),m=a(112),d=a.n(m),u=a(52521),p=a(13973),h=a(45697),_=a.n(h),b=a(34961);class g extends s.Component{static propTypes={value:_().string,onChange:_().func,scroll_length:_().number};shouldComponentUpdate(e){return!p.Z.are_equal_shallow(e.assets,this.props.assets)||e.value!==this.props.value||e.scroll_length!==this.props.scroll_length}render(){return this.props.assets.length?s.createElement(o.Z,{entries:this.props.assets.map((e=>e&&e.get("symbol"))).filter((e=>!!e)),values:this.props.assets.reduce(((e,t)=>(t&&t.get("symbol")&&(e[t.get("symbol")]=t),e)),{}),singleEntry:this.props.assets[0]?s.createElement(l.Z,{asset:this.props.assets[0].get("id"),amount:0,hide_amount:!0}):null,value:this.props.value,onChange:this.props.onChange,scroll_length:this.props.scroll_length}):null}}g=(0,u.Z)(g,{asList:!0});class E extends b.C{static propTypes={label:_().string,assets:_().array,amount:_().any,placeholder:_().string,onChange:_().func,tabIndex:_().number,error:_().string,scroll_length:_().number};static defaultProps={disabled:!1,tabIndex:0};componentDidMount(){this.onAssetChange(this.props.asset)}formatAmount(e){return e||(e=""),"number"==typeof e&&(e=e.toString()),e.trim().replace(/,/g,"")}_onChange(e){this.props.onChange&&this.props.onChange({amount:this.getNumericEventValue(e),asset:this.props.asset})}onAssetChange(e){this.props.onChange&&this.props.onChange({amount:this.props.amount,asset:e})}render(){let e=this.props.error?d().translate(this.props.error):this.formatAmount(this.props.amount);return s.createElement("div",{className:"amount-selector",style:this.props.style},s.createElement("label",{className:"right-label"},this.props.display_balance),s.createElement(r(),{className:"left-label",component:"label",content:this.props.label}),s.createElement("div",{className:"inline-label input-wrapper"},s.createElement("input",{disabled:this.props.disabled,type:"text",value:e||"",placeholder:this.props.placeholder,onChange:this._onChange.bind(this),tabIndex:this.props.tabIndex,onPaste:this.props.onPaste||this.onPaste.bind(this),onKeyPress:this.onKeyPress.bind(this)}),s.createElement("div",{className:"form-label select floating-dropdown"},this.props.isPrice?s.createElement("div",{className:"dropdown-wrapper inactive"},s.createElement("div",null,this.props.asset.get("symbol"),"/",this.props.base)):s.createElement(g,{ref:this.props.refCallback,value:this.props.asset.get("symbol"),assets:c().List(this.props.assets),onChange:this.onAssetChange.bind(this),scroll_length:this.props.scroll_length}))))}}const f=E=(0,u.Z)(E)},3894:(e,t,a)=>{a.d(t,{Z:()=>h});var s=a(67294),n=a(13863),r=a(23037),l=a(82267),o=a(43393);class i extends s.Component{static propTypes={dos:r.Z.ChainObjectsList};static defaultProps={dos:(0,o.List)()};constructor(){super(),this.getDynamicObject=this.getDynamicObject.bind(this)}getDynamicObject(e){return this.props.dos.find((t=>t&&t.get("id")===e))}render(){return s.cloneElement(s.Children.only(this.props.children),{...this.props,getDynamicObject:this.getDynamicObject})}}i=(0,l.Z)(i);var c=a(45697),m=a.n(c),d=a(60567);function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},u.apply(this,arguments)}class p extends s.Component{static propTypes={replaceNoneToBts:m().bool,maxWidth:m().number};static defaultProps={replaceNoneToBts:!0,maxWidth:20};constructor(e){super(e),this.state={imgError:!1}}shouldComponentUpdate(e,t){return this.props.asset!==e.asset||this.props.maxWidth!==e.maxWidth||this.props.whiteList!==e.whiteList||this.state.imgError!==t.imgError}_onError(e){this.state.imgError||(this.props.replaceNoneToBts?this.refs[e.toLowerCase()].src="asset-symbols/unknown.png":this.refs[e.toLowerCase()].remove(),this.setState({imgError:!0}))}render(){let{asset:e}=this.props;const t=function(e){if(null===e)return"unknown";let t=e.get("symbol");return(0,d.sA)(t)}(e);return s.createElement("img",{ref:t.toLowerCase(),className:"column-hide-small",onError:this._onError.bind(this,t),style:{maxWidth:this.props.maxWidth,marginRight:5,marginTop:"-3px"},src:`asset-symbols/${t.toLowerCase()}.png`})}}p=function(e,t={}){t.propNames=t.propNames||[t.asList?"assets":"asset"];const a=t.propNames.reduce(((e,a)=>(e[a]=t.asList?r.Z.ChainAssetsList:r.Z.ChainAsset.isRequired,e)),{});let c=Object.keys(a).reduce(((e,a)=>{let s=t.defaultProps&&t.defaultProps[a];return e[a]=t.asList?(0,o.List)(s||[]):s||"1.3.0",e}),{});t.defaultProps&&t.defaultProps.tempComponent&&(c.tempComponent=t.defaultProps.tempComponent);class m extends s.Component{static propTypes=a;static defaultProps=c;render(){let e={},a={},n=(0,o.List)();Object.keys(this.props).forEach((s=>{this.props[s]&&-1!==t.propNames.indexOf(s)?(t.withDynamic&&(t.asList?this.props[s].forEach((e=>{e&&(n=n.push(e.get("dynamic_asset_data_id")))})):n=n.push(this.props[s].get("dynamic_asset_data_id"))),e[s]=t.asList?this.props[s].filter((e=>!!e)):this.props[s]):a[s]=this.props[s]}));let r=s.cloneElement(s.Children.only(this.props.children),{...a,...e});return t.withDynamic?s.createElement(i,{dos:n},r):r}}m=(0,l.Z)(m);class d extends s.Component{render(){return s.createElement(m,this.props,s.createElement(e,{ref:"bound_component"}))}}return d.displayName=`Wrapper(${(0,n.G)(e)})`,d}(p);class h extends s.Component{render(){return s.createElement(p,u({},this.props,{asset:this.props.name}))}}},57906:(e,t,a)=>{a.d(t,{Z:()=>i});var s=a(67294),n=a(13973),r=a(45697),l=a.n(r);class o extends s.Component{static propTypes={scroll_length:l().number};static defaultProps={scroll_length:9};constructor(e){e.scroll_length,super(e),this.state={active:!1},this.listener=!1,this.onBodyClick=this.onBodyClick.bind(this)}componentDidMount(){this._setListener()}shouldComponentUpdate(e,t){return!n.Z.are_equal_shallow(e.entries,this.props.entries)||!n.Z.are_equal_shallow(t,this.state)||e.value!==this.props.value}_setListener(e=this.props){e.entries.length>1&&!this.listener&&(this.listener=!0,document.body.addEventListener("click",this.onBodyClick,{capture:!1,passive:!0}))}_removeListener(){document.body.removeEventListener("click",this.onBodyClick),this.listener=!1}UNSAFE_componentWillReceiveProps(e){1===e.entries.length?this._removeListener():e.entries.length>1&&this._setListener(e)}componentWillUnmount(){this._removeListener()}onBodyClick(e){let t=e.target,a=!1;do{if(t.classList&&t.classList.contains("dropdown")&&t.id===this.props.id){a=!0;break}}while(t=t.parentNode);a?e.stopPropagation():this.setState({active:!1})}onChange(e,t){t.preventDefault(),t.stopPropagation(),this.props.onChange(e),this.setState({active:!1})}_toggleDropdown(){this.setState({active:!this.state.active})}render(){const{entries:e,value:t}=this.props;let{active:a}=this.state;if(0===e.length)return null;if(1==e.length)return s.createElement("div",{className:"dropdown-wrapper inactive"+(this.props.upperCase?" upper-case":"")},s.createElement("div",null,this.props.singleEntry?this.props.singleEntry:e[0]));{let n=e.map((e=>s.createElement("li",{className:this.props.upperCase?"upper-case":"",key:e,onClick:this.onChange.bind(this,this.props.values[e])},s.createElement("span",null,e))));return s.createElement("div",{onClick:this._toggleDropdown.bind(this),className:"dropdown-wrapper"+(a?" active":"")+(this.props.upperCase?" upper-case":"")},s.createElement("div",{style:{paddingRight:15}},t||s.createElement("span",{className:"hidden"},"A")),s.createElement("ul",{className:"dropdown",style:{overflow:e.length>this.props.scroll_length?"auto":"hidden"}},n))}}}const i=o}}]);