-
Notifications
You must be signed in to change notification settings - Fork 13
/
poolmart.7d5d86611de759ef6806.js
1 lines (1 loc) · 7.29 KB
/
poolmart.7d5d86611de759ef6806.js
1
"use strict";(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[37],{72162:(t,e,s)=>{s.r(e),s.d(e,{default:()=>E});var a=s(96540),i=s(9476),l=s(46128),o=(s(9404),s(54625)),r=s(10658),n=s.n(r),_=(s(72090),s(80849),s(12569)),d=s(91001),h=s(72342),p=s(27584),c=s(66897),m=s(74806),u=s(36234),y=s(17071),g=s(78740),A=s(55840);class b extends a.Component{static propTypes={defaultAsset:_.A.ChainAsset.isRequired};static defaultProps={defaultAsset:"1.3.0"};constructor(t){super(t),this.state={filterAssetA:this.props.defaultAsset?this.props.defaultAsset.get("symbol"):null,filterAssetB:null,filterShareAsset:null,start:"1.19.0",limit:10,total:0,isExchangeModalVisible:!1,isStakeModalVisible:!1,selectedPool:null},this.timer=null}componentDidMount(){this._getLiquidityPools()}componentWillReceiveProps(t){if(t.liquidityPools!==this.props.liquidityPools){const{liquidityPools:e}=t;e.size>0&&e.last().id!==this.props.lastPoolId&&this.setState({start:e.last().id},(()=>this._getLiquidityPools()))}}_getLiquidityPools(){const{filterAssetA:t,filterAssetB:e,filterShareAsset:s,GetLimit:a,start:i}=this.state;this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{s?m.A.getLiquidityPoolsByShareAsset.defer(s):m.A.getLiquidityPools.defer(t,e,a,i)}),500)}_resetLiquidityPools(){this.setState({start:"1.19.0",lastPoolId:null,total:0}),m.A.resetLiquidityPools()}_onFilterAssetA(t){t.target.value?this.setState({filterAssetA:t.target.value.toUpperCase()},(()=>{this._getLiquidityPools(),this._resetLiquidityPools()})):(this.setState({filterAssetA:""}),this._resetLiquidityPools())}_onFilterAssetB(t){t.target.value?this.setState({filterAssetB:t.target.value.toUpperCase()},(()=>{this._getLiquidityPools(),this._resetLiquidityPools()})):(this.setState({filterAssetB:""}),this._resetLiquidityPools())}_onFilterShareAsset(t){t.target.value?this.setState({filterAssetA:null,filterAssetB:null,filterShareAsset:t.target.value.toUpperCase()},(()=>{this._getLiquidityPools(),this._resetLiquidityPools()})):(this.setState({filterShareAsset:""}),this._resetLiquidityPools())}_handleRowsChange(t){this.setState({limit:parseInt(t,10),start:"1.19.0"},(()=>{this._resetLiquidityPools(),this._getLiquidityPools()}))}_showExchangeModal(t){this.setState({isExchangeModalVisible:!0,selectedPool:t})}_hideExchangeModal(){this.setState({isExchangeModalVisible:!1,selectedPool:null})}_showStakeModal(t){this.setState({isStakeModalVisible:!0,selectedPool:t})}_hideStakeModal(){this.setState({isStakeModalVisible:!1,selectedPool:null})}render(){let t=A.A.getState().myActiveAccounts.length>0||!!A.A.getState().currentAccount;console.log();const e=[{key:"id",dataIndex:"id",title:n().translate("poolmart.liquidity_pools.pool_id"),sorter:(t,e)=>t.id.split(".")[2]-e.id.split(".")[2]},{key:"share_asset_str",dataIndex:"share_asset_str",title:n().translate("poolmart.liquidity_pools.share_asset"),render:t=>t?a.createElement(o.N_,{to:`/asset/${t}`},a.createElement(d.A,{name:t})):null,sorter:(t,e)=>t.share_asset_str>e.share_asset_str?1:t.share_asset_str<e.share_asset_str?-1:0},{key:"asset_a_str",dataIndex:"asset_a_str",title:n().translate("poolmart.liquidity_pools.asset_a"),render:t=>t?a.createElement(o.N_,{to:`/asset/${t}`},a.createElement(d.A,{name:t})):null,sorter:(t,e)=>t.asset_a_str>e.asset_a_str?1:t.asset_a_str<e.asset_a_str?-1:0},{key:"asset_a_qty",dataIndex:"asset_a_qty",title:n().translate("poolmart.liquidity_pools.asset_a_qty"),sorter:(t,e)=>t.asset_a_qty-e.asset_a_qty},{key:"asset_b_str",dataIndex:"asset_b_str",title:n().translate("poolmart.liquidity_pools.asset_b"),render:t=>t?a.createElement(o.N_,{to:`/asset/${t}`},a.createElement(d.A,{name:t})):null,sorter:(t,e)=>t.asset_b_str>e.asset_b_str?1:t.asset_b_str<e.asset_b_str?-1:0},{key:"asset_b_qty",dataIndex:"asset_b_qty",title:n().translate("poolmart.liquidity_pools.asset_b_qty"),sorter:(t,e)=>t.asset_b_qty-e.asset_b_qty},{key:"taker_fee_percent",dataIndex:"taker_fee_percent_str",title:n().translate("poolmart.liquidity_pools.taker_fee_percent")},{key:"withdrawal_fee_percent",dataIndex:"withdrawal_fee_percent_str",title:n().translate("poolmart.liquidity_pools.withdrawal_fee_percent")},{key:"exchange",title:n().translate("poolmart.liquidity_pools.exchange"),render:e=>t?a.createElement("a",{onClick:()=>this._showExchangeModal(e)},a.createElement(u.A,{name:"poolmart"})):a.createElement(u.A,{name:"poolmart"})},{key:"stake_unstake",title:n().translate("poolmart.liquidity_pools.stake_unstake"),render:e=>t?a.createElement("a",{onClick:()=>this._showStakeModal(e)},a.createElement(u.A,{name:"deposit"})):a.createElement(u.A,{name:"deposit"})}],s=[];return this.props.liquidityPools.forEach((t=>{const e=t;e.share_asset_str=t.share_asset_obj?t.share_asset_obj.get("symbol"):t.share_asset,e.asset_a_str=t.asset_a_obj?t.asset_a_obj.get("symbol"):t.asset_a,e.asset_b_str=t.asset_b_obj?t.asset_b_obj.get("symbol"):t.asset_b,e.asset_a_qty=t.asset_a_obj?t.balance_a/Math.pow(10,t.asset_a_obj.get("precision")):0,e.asset_b_qty=t.asset_b_obj?t.balance_b/Math.pow(10,t.asset_b_obj.get("precision")):0,e.taker_fee_percent_str=t.taker_fee_percent/100+"%",e.withdrawal_fee_percent_str=t.withdrawal_fee_percent/100+"%",s.push(e)})),a.createElement("div",{className:"grid-block vertical"},a.createElement("div",{className:"grid-content no-padding"},a.createElement(p.A,{placeholder:n().translate("poolmart.liquidity_pools.asset_a"),value:this.state.filterAssetA,onChange:this._onFilterAssetA.bind(this),style:{width:"200px",marginBottom:"12px",marginTop:"4px"}}),a.createElement(p.A,{placeholder:n().translate("poolmart.liquidity_pools.asset_b"),value:this.state.filterAssetB,onChange:this._onFilterAssetB.bind(this),style:{width:"200px",marginLeft:"20px",marginBottom:"12px",marginTop:"4px"}}),a.createElement(p.A,{placeholder:n().translate("poolmart.liquidity_pools.share_asset"),value:this.state.filterShareAsset,onChange:this._onFilterShareAsset.bind(this),style:{width:"200px",marginLeft:"20px",marginBottom:"12px",marginTop:"4px"}}),a.createElement(l.Select,{style:{width:"150px",marginLeft:"24px",marginTop:"4px"},value:this.state.limit,onChange:this._handleRowsChange.bind(this)},a.createElement(l.Select.Option,{key:"10"},"10 rows"),a.createElement(l.Select.Option,{key:"25"},"25 rows"),a.createElement(l.Select.Option,{key:"50"},"50 rows"),a.createElement(l.Select.Option,{key:"100"},"100 rows"))),a.createElement("div",{className:"grid-content no-padding"},a.createElement(l.Table,{columns:e,rowKey:"id",dataSource:s,pagination:{pageSize:this.state.limit,total:s.length}})),this.state.isExchangeModalVisible&&a.createElement(y.A,{isModalVisible:this.state.isExchangeModalVisible,onHideModal:this._hideExchangeModal.bind(this),pool:this.state.selectedPool.share_asset}),this.state.isStakeModalVisible&&a.createElement(g.A,{isModalVisible:this.state.isStakeModalVisible,onHideModal:this._hideStakeModal.bind(this),pool:this.state.selectedPool.share_asset}))}}b=(0,h.A)(b,{show_loader:!0});class q extends a.Component{render(){return a.createElement(b,this.props)}}const S=(0,i.N)(q,{listenTo:()=>[c.A],getProps:()=>({liquidityPools:c.A.getState().liquidityPools,liquidityPoolsLoading:c.A.getState().liquidityPoolsLoading,lastPoolId:c.A.getState().lastPoolId})});class f extends a.Component{constructor(t){super(t),this.state={}}render(){return a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-wrapper padding"},a.createElement(S,null)))}}const E=f}}]);