-
Notifications
You must be signed in to change notification settings - Fork 2
/
deposit-withdraw.bbb8449dec512b86ca03.js
2 lines (2 loc) · 324 KB
/
deposit-withdraw.bbb8449dec512b86ca03.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[16,1],{1756:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(1798),o=a.n(i),r=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var l=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={animateEnter:!1},e.timer=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),r(t,[{key:"componentDidMount",value:function(){this.enableAnimation()}},{key:"resetAnimation",value:function(){this.setState({animateEnter:!1}),this.enableAnimation()}},{key:"enableAnimation",value:function(){var e=this;this.timer=setTimeout(function(){e.timer&&e.setState({animateEnter:!0})},2e3)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){return this.props.children?s.a.createElement(o.a,{className:this.props.className,component:this.props.component,transitionName:this.props.transitionName,transitionEnterTimeout:this.props.enterTimeout,transitionEnter:this.state.animateEnter,transitionLeave:!1},this.props.children):s.a.createElement(this.props.component)}}]),t}();l.defaultProps={component:"span",enterTimeout:2e3},t.a=l},1757:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(119),o=a(1),r=a.n(o),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},c=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(e){u(this,t);var a=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={imgError:!1},a}return d(t,s.a.Component),c(t,[{key:"shouldComponentUpdate",value:function(e,t){return this.props.asset!==e.asset||this.props.maxWidth!==e.maxWidth||this.props.whiteList!==e.whiteList||this.state.imgError!==t.imgError}},{key:"_onError",value:function(e){this.state.imgError||(this.props.replaceNoneToBts?this.refs[e.toLowerCase()].src="asset-symbols/bts.png":this.refs[e.toLowerCase()].remove(),this.setState({imgError:!0}))}},{key:"render",value:function(){var e=function(e){return e.get("symbol")}(this.props.asset);return s.a.createElement("img",{ref:e.toLowerCase(),className:"column-hide-small",onError:this._onError.bind(this,e),style:{maxWidth:this.props.maxWidth,marginRight:5},src:"asset-symbols/"+e.toLowerCase()+".png"})}}]),t}();m.propTypes={replaceNoneToBts:r.a.bool,maxWidth:r.a.number},m.defaultProps={replaceNoneToBts:!0,maxWidth:20},m=Object(i.a)(m);var h=function(e){function t(){return u(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,s.a.Component),c(t,[{key:"render",value:function(){return s.a.createElement(m,l({},this.props,{asset:this.props.name}))}}]),t}();t.a=h},1761:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(140),o=a(39),r=a(48),l=a(332),c=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),c(t,[{key:"render",value:function(){var e=this.props.asset.get("id"),t=this.props.account.getIn(["balances",e]);return t?s.a.createElement(l.a,{balance:t,replace:this.props.replace}):s.a.createElement("span",null,"0 ",s.a.createElement(i.a,{name:this.props.asset.get("symbol"),replace:this.props.replace}))}}]),t}();u.propTypes={account:o.a.ChainAccount.isRequired,asset:o.a.ChainAsset.isRequired},u.defaultProps={autosubscribe:!1},t.a=Object(r.a)(u)},1766:function(e,t,a){"use strict";a.d(t,"a",function(){return D}),a.d(t,"b",function(){return W});var n=a(0),s=a.n(n),i=a(3),o=a.n(i),r=a(338),l=a(533),c=a(39),u=a(48),p=a(16),d=a(10),m=a(1760),h=a.n(m),_=a(14),f=a.n(_),y=a(21),g=a(5),w=a.n(g),v=a(1),b=a.n(v),E=a(1768),k=a(1782),C=a.n(k),S=a(41),A=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function N(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function T(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var x=d.ChainTypes.operations,j={textAlign:"left"},I=Object.keys(x);function P(e,t){return t.block_num===e.block_num?t.virtual_op-e.virtual_op:t.block_num-e.block_num}var D=function(e){function t(e){N(this,t);var a=O(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={limit:e.limit,fetchingAccountHistory:!1,headerHeight:85,filter:"all",accountHistoryError:!1},a}return T(t,s.a.Component),A(t,[{key:"componentDidMount",value:function(){if(!this.props.fullHeight){var e=this.refs.transactions;h.a.initialize(e),this._setHeaderHeight()}}},{key:"_setHeaderHeight",value:function(){var e=this.refs.header.offsetHeight;e!==this.state.headerHeight&&this.setState({headerHeight:e})}},{key:"shouldComponentUpdate",value:function(e,t){if(!p.a.are_equal_shallow(this.props.accountsList,e.accountsList))return!0;if(this.props.maxHeight!==e.maxHeight)return!0;if(this.state.headerHeight!==t.headerHeight)return!0;if(this.state.filter!==t.filter)return!0;if(this.props.customFilter&&(!p.a.are_equal_shallow(this.props.customFilter.fields,e.customFilter.fields)||!p.a.are_equal_shallow(this.props.customFilter.values,e.customFilter.values)))return!0;if(this.props.maxHeight!==e.maxHeight)return!0;if(t.limit!==this.state.limit||t.fetchingAccountHistory!==this.state.fetchingAccountHistory)return!0;for(var a=0;a<e.accountsList.length;++a){var n=e.accountsList[a],s=this.props.accountsList[a];if(n&&s&&n.get("history")!==s.get("history"))return!0}return!1}},{key:"_onIncreaseLimit",value:function(){this.setState({limit:this.state.limit+30})}},{key:"_getAccountHistoryES",value:function(e,t,a){var n="https://wrapper.elasticsearch.bitshares.ws";return console.log("query",n+"/get_account_history?account_id="+e+"&from_="+a+"&size="+t+"&sort_by=block_data.block_time&type=data&agg_field=operation_type"),new Promise(function(s,i){fetch(n+"/get_account_history?account_id="+e+"&from_="+a+"&size="+t+"&sort_by=block_data.block_time&type=data&agg_field=operation_type").then(function(e){return e.json()}).then(function(e){var t=e.map(function(e){return console.log(e),{id:e.account_history.operation_id,op:{type:e.operation_type,data:e.operation_history.op_object},result:JSON.parse(e.operation_history.operation_result),block_num:e.block_data.block_num,block_time:e.block_data.block_time+"Z"}});s(t)}).catch(function(e){console.warn("query failed",e),s([])})})}},{key:"_getHistory",value:function(e,t,a){var n=[],s=new Set,i=!0,o=!1,r=void 0;try{for(var l,c=e[Symbol.iterator]();!(i=(l=c.next()).done);i=!0){var u=l.value;if(u){var p=u.get("history");p&&(n=n.concat(p.toJS().filter(function(e){return!s.has(e.id)&&s.add(e.id)})))}}}catch(e){o=!0,r=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw r}}return t&&(n=n.filter(function(e){return e.op[0]===x[t]})),a&&(n=n.filter(function(e){return a.fields.reduce(function(t,n){switch(n){case"asset_id":return t&&e.op[1].amount[n]===a.values[n];default:return t&&e.op[1][n]===a.values[n]}},!0)})),n}},{key:"_generateCSV",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,a){return function n(s,i){try{var o=t[s](i),r=o.value}catch(e){return void a(e)}if(!o.done)return Promise.resolve(r).then(function(e){n("next",e)},function(e){n("throw",e)});e(r)}("next")})}}(regeneratorRuntime.mark(function e(){var t,a,n,s,i,o,l,c,u,p,m,h,_,f,y,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.setState({fetchingAccountHistory:!0}),t=0,a=150,n=this.props.accountsList[0].get("id"),e.next=6,Object(d.FetchChain)("getAccount",n);case 6:s=e.sent.get("name"),i={};case 8:return e.next=11,this._getAccountHistoryES(n,a,t);case 11:if((o=e.sent).length){e.next=14;break}return e.abrupt("break",22);case 14:return e.next=16,C.a.resolveBlockTimes(o);case 16:return e.next=18,C.a.resolveAssets(o);case 18:o.map(function(e){var t=e.id,a=I[e.op.type],n=e.op.data;switch(a){case"vesting_balance_withdraw":case"transfer":n.amount=n.amount_}i[t]={timestamp:new Date(e.block_time),type:a,data:n}}),t+=o.length,e.next=8;break;case 22:if(Object.keys(i).length){e.next=24;break}return e.abrupt("return",this.setState({fetchingAccountHistory:!1,accountHistoryError:!0}));case 24:for(i=C.a.groupEntries(i),l=C.a.parseData(i,n,s),c="",u=!0,p=!1,m=void 0,e.prev=30,h=l[Symbol.iterator]();!(u=(_=h.next()).done);u=!0)f=_.value,c+=f.join(",")+"\n";e.next=38;break;case 34:e.prev=34,e.t0=e.catch(30),p=!0,m=e.t0;case 38:e.prev=38,e.prev=39,!u&&h.return&&h.return();case 41:if(e.prev=41,!p){e.next=44;break}throw m;case 44:return e.finish(41);case 45:return e.finish(38);case 46:y=new Blob([c],{type:"text/csv;charset=utf-8"}),g=new Date,Object(r.saveAs)(y,"bitshares-account-history-"+s+"-"+g.getFullYear()+"-"+("0"+(g.getMonth()+1)).slice(-2)+"-"+("0"+g.getDate()).slice(-2)+"-"+("0"+g.getHours()).slice(-2)+("0"+g.getMinutes()).slice(-2)+".csv"),this.setState({fetchingAccountHistory:!1,accountHistoryError:null});case 50:case"end":return e.stop()}},e,this,[[30,34,38,46],[39,,41,45]])}));return function(){return e.apply(this,arguments)}}()},{key:"_onChangeFilter",value:function(e){this.setState({filter:e.target.value})}},{key:"render",value:function(){var e=this.props,t=e.accountsList,a=e.compactView,n=e.filter,i=e.customFilter,r=e.style,c=e.maxHeight,u=this.state,p=u.limit,d=u.headerHeight,m=1===t.length&&t[0]?t[0].get("id"):null,h=this._getHistory(t,this.props.showFilters&&"all"!==this.state.filter?this.state.filter:n,i).sort(P),_=h.length;r=r||{width:"100%",height:"100%"};var g=null;g=["all","transfer","limit_order_create","limit_order_cancel","fill_order","account_create","account_update","asset_create","witness_withdraw_pay","vesting_balance_withdraw"].map(function(e){return s.a.createElement("option",{value:e,key:e},f.a.translate("transaction.trxTypes."+e))});var v=h.length?h.slice(0,p).map(function(e){return s.a.createElement(l.a,{includeOperationId:!0,operationId:e.id,style:j,key:e.id,op:e.op,result:e.result,txIndex:e.trx_in_block,block:e.block_num,current:m,hideFee:!0,inverted:!1,hideOpLabel:a,fullDate:!0})}):[s.a.createElement("tr",{key:"no_recent"},s.a.createElement("td",{colSpan:a?"2":"3"},s.a.createElement(o.a,{content:"operation.no_recent"})))],b=s.a.createElement("tr",{className:"total-value",key:"total_value"},s.a.createElement("td",{style:{textAlign:"center"}},_>0?s.a.createElement("span",null,s.a.createElement("a",{className:"inline-block",onClick:this._generateCSV.bind(this),"data-tip":f.a.translate("transaction.csv_tip"),"data-place":"bottom"},s.a.createElement(y.a,{name:"excel",title:"icons.excel",className:"icon-14px"}))):null),s.a.createElement("td",{className:"column-hide-tiny"}),s.a.createElement("td",{style:{textAlign:"center"}}," ",this.props.showMore&&_>this.props.limit||p<_?s.a.createElement("a",{onClick:this._onIncreaseLimit.bind(this)},s.a.createElement(y.a,{name:"chevron-down",title:"icons.chevron_down.transactions",className:"icon-14px"})):null),s.a.createElement("td",null));return s.a.createElement("div",{className:"recent-transactions no-overflow",style:r},s.a.createElement("div",{className:"generic-bordered-box"},this.props.dashboard?null:s.a.createElement("div",{ref:"header"},s.a.createElement("div",{className:"block-content-header"},s.a.createElement("span",null,this.props.title?this.props.title:s.a.createElement(o.a,{content:"account.recent"})))),s.a.createElement("div",{className:"header-selector"},s.a.createElement("div",{className:"selector"},s.a.createElement("div",{className:w()("inline-block")},this.props.showFilters?s.a.createElement("select",{"data-place":"left","data-tip":f.a.translate("tooltip.filter_ops"),style:{paddingTop:5,width:"auto"},className:"bts-select no-margin",value:this.state.filter,onChange:this._onChangeFilter.bind(this)},g):null)),this.state.accountHistoryError&&s.a.createElement("div",{className:"has-error",style:{paddingLeft:"0.75rem"}},s.a.createElement(o.a,{content:"account.history_error"}))),s.a.createElement("div",{className:"box-content grid-block no-margin",style:this.props.fullHeight?null:{maxHeight:c-d},ref:"transactions"},s.a.createElement(E.a,{withTransition:!0,className:"table table-striped "+(a?"compact":"")+(this.props.dashboard?" dashboard-table table-hover":""),header:s.a.createElement("tr",null,s.a.createElement("th",{className:"column-hide-tiny",style:j},s.a.createElement(o.a,{content:"account.transactions.id"})),s.a.createElement("th",{className:"column-hide-tiny",style:j},s.a.createElement(o.a,{content:"account.transactions.type"})),s.a.createElement("th",{style:j},s.a.createElement(o.a,{content:"account.transactions.info"})),s.a.createElement("th",null,s.a.createElement(o.a,{content:"account.transactions.time"}))),rows:v,label:"utility.total_x_operations",extraRow:b})),this.state.fetchingAccountHistory&&s.a.createElement(S.a,null)))}}]),t}();D.propTypes={accountsList:c.a.ChainAccountsList.isRequired,compactView:b.a.bool,limit:b.a.number,maxHeight:b.a.number,fullHeight:b.a.bool,showFilters:b.a.bool},D.defaultProps={limit:25,maxHeight:500,fullHeight:!1,showFilters:!1},D=Object(u.a)(D);var W=function(e){function t(){return N(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return T(t,s.a.Component),A(t,[{key:"render",value:function(){return s.a.createElement("span",{className:"wrapper"},this.props.children(this.props))}}]),t}();W.propTypes={asset:c.a.ChainAsset.isRequired,to:c.a.ChainAccount.isRequired,fromAccount:c.a.ChainAccount.isRequired},W.defaultProps={asset:"1.3.0"},W=Object(u.a)(W)},1768:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(270),o=a(14),r=a.n(o),l=a(1756),c=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={page:1,pageSize:e.pageSize},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),c(t,[{key:"onChange",value:function(e,t){this.setState({page:e,pageSize:t})}},{key:"render",value:function(){var e=this,t=this.state,a=t.page,n=t.pageSize,o=this.props,c=o.header,u=o.rows,p=o.extraRow,d=u.length,m=h(a,n);function h(e,t){for(var a=[],n=(e-1)*t;n<Math.min(d,e*t);n++)a.push(u[n]);return a}return!m.length&&d&&(m=h(1,n)),s.a.createElement("div",{className:"grid-content",style:this.props.style},s.a.createElement("table",{className:this.props.className},c?s.a.createElement("thead",null,c):null,this.props.withTransition&&1===a?s.a.createElement(l.a,{component:"tbody",transitionName:"newrow"},m,p):s.a.createElement("tbody",null,m,p)),d>n?s.a.createElement(i.a,{style:{paddingTop:"1rem",paddingBottom:"1rem",paddingLeft:this.props.leftPadding||null},total:d,showTotal:function(t){return r.a.translate(e.props.label,{count:t})},pageSize:n,current:a,onChange:this.onChange.bind(this)}):null,this.props.children)}}]),t}();u.defaultProps={rows:[],pageSize:15,label:"utility.total_x_items",className:"table",extraRow:null,style:{paddingBottom:"1rem"}},t.a=u},1826:function(e,t,a){"use strict";(function(e){var n=a(305),s=a(0),i=a.n(s),o=a(252),r=a.n(o),l=a(3),c=a.n(l),u=a(39),p=a(48),d=a(16),m=a(332),h=a(14),_=a.n(h),f=a(304),y=a(47),g=a(42),w=a.n(g),v=a(78),b=a(10),E=a(527),k=a.n(E),C=a(142),S=a(28),A=a(1),N=a.n(A),O=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var T=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={withdraw_amount:t.props.amount_to_withdraw,withdraw_address:v.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:v.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),O(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},fee_asset_id:"1.3.0",feeAmount:new S.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(C.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(C.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),d.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=v.a.get(this.props.output_wallet_type)[e];v.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(v.m)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(C.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state.feeAmount,i=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),o=void 0!==this.props.gateFee?parseFloat(String.prototype.replace.call(this.props.gateFee,/,/g,"")):0,r=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:i}),l=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:0});void 0!==this.props.balance&&(l=r.clone(this.props.balance.get("balance")));var c=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:o});r.plus(c),l.lt(r)&&(r=l),y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),r.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,s?s.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else w.a.publish(this.getWithdrawModalId(),"open")}},{key:"onSubmitConfirmation",value:function(){if(w.a.publish(this.getWithdrawModalId(),"close"),v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=d.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state.feeAmount;y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,o?o.asset_id:"1.3.0")}},{key:"onDropDownList",value:function(){v.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new S.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(d.a.sortID),s){var o=b.ChainStore.getObject(i),r=b.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new S.h({base:new S.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new S.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=v.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),u=this.getWithdrawModalId(),p=null,d=null,h=null;this.state.options_is_valid&&(d=i.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(p=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(c.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),h=i.a.createElement(k.a,{id:u,overlay:!0},i.a.createElement(r.a,{close:u},i.a.createElement("a",{href:"#",className:"close-button"},"×")),i.a.createElement("br",null),i.a.createElement("label",null,i.a.createElement(c.a,{content:"modal.confirmation.title"})),i.a.createElement("br",null),i.a.createElement("div",{className:"content-block"},i.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitConfirmation.bind(this),value:_.a.translate("modal.confirmation.accept")}),i.a.createElement(r.a,{close:u},i.a.createElement("a",{className:"secondary button"},i.a.createElement(c.a,{content:"modal.confirmation.cancel"})))))));var y=1,g=null;this.props.output_supports_memos&&(g=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(c.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:y++,onChange:this.onMemoChanged.bind(this)})));var w=this._getAvailableAssets().fee_asset_types;if(l.length>0){var b=this.props.asset.get("id");if(b){var E=o[b];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(c.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},E?i.a.createElement(m.a,{balance:o[b]}):0))}else s="No funds"}else s="No funds";var C=this.state.error||this.state.balanceError||!this.state.withdraw_amount;return i.a.createElement("form",{className:"grid-block vertical full-width-content"},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement("h3",null,i.a.createElement(c.a,{content:"gateway.withdraw_coin",coin:this.props.output_coin_name,symbol:this.props.output_coin_symbol}))),i.a.createElement("div",{className:"content-block"},i.a.createElement(f.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.insufficient"})):null),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(f.a,{refCallback:this.setNestedRef.bind(this),label:"transfer.fee",disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:w,tabIndex:y++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"blocktrades-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"blocktrades-position-options"},d),p),g,i.a.createElement("div",{className:"button-group"},i.a.createElement("div",{onClick:this.onSubmit.bind(this),className:"button"+(C?" disabled":"")},i.a.createElement(c.a,{content:"modal.withdraw.submit"})),i.a.createElement(r.a,{close:this.props.modal_id},i.a.createElement("div",{className:"button"},i.a.createElement(c.a,{content:"account.perm.cancel"})))),h))}}]),a}();T.propTypes={account:u.a.ChainAccount.isRequired,issuer:u.a.ChainAccount.isRequired,asset:u.a.ChainAsset.isRequired,output_coin_name:N.a.string.isRequired,output_coin_symbol:N.a.string.isRequired,output_coin_type:N.a.string.isRequired,url:N.a.string,output_wallet_type:N.a.string,output_supports_memos:N.a.bool.isRequired,amount_to_withdraw:N.a.string,balance:u.a.ChainObject},t.a=Object(p.a)(T)}).call(this,a(118).Buffer)},1827:function(e,t,a){"use strict";(function(e){var n=a(305),s=a(0),i=a.n(s),o=a(252),r=a.n(o),l=a(3),c=a.n(l),u=a(39),p=a(48),d=a(16),m=a(332),h=a(14),_=a.n(h),f=a(304),y=a(47),g=a(42),w=a.n(g),v=a(78),b=a(10),E=a(527),k=a.n(E),C=a(142),S=a(28),A=a(1),N=a.n(A),O=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var T=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={withdraw_amount:t.props.amount_to_withdraw,withdraw_address:v.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:v.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),O(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},fee_asset_id:"1.3.0",feeAmount:new S.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(C.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(C.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),d.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=v.a.get(this.props.output_wallet_type)[e];v.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(v.m)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(C.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state.feeAmount,i=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),o=void 0!==this.props.gateFee?parseFloat(String.prototype.replace.call(this.props.gateFee,/,/g,"")):0,r=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:i}),l=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:0});void 0!==this.props.balance&&(l=r.clone(this.props.balance.get("balance")));var c=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:o});r.plus(c),l.lt(r)&&(r=l),y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),r.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,s?s.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else w.a.publish(this.getWithdrawModalId(),"open")}},{key:"onSubmitConfirmation",value:function(){if(w.a.publish(this.getWithdrawModalId(),"close"),v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=d.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state.feeAmount;y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,o?o.asset_id:"1.3.0")}},{key:"onDropDownList",value:function(){v.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new S.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(d.a.sortID),s){var o=b.ChainStore.getObject(i),r=b.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new S.h({base:new S.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new S.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=v.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),u=this.getWithdrawModalId(),p=null,d=null,h=null;this.state.options_is_valid&&(d=i.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(p=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(c.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),h=i.a.createElement(k.a,{id:u,overlay:!0},i.a.createElement(r.a,{close:u},i.a.createElement("a",{href:"#",className:"close-button"},"×")),i.a.createElement("br",null),i.a.createElement("label",null,i.a.createElement(c.a,{content:"modal.confirmation.title"})),i.a.createElement("br",null),i.a.createElement("div",{className:"content-block"},i.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitConfirmation.bind(this),value:_.a.translate("modal.confirmation.accept")}),i.a.createElement(r.a,{close:u},i.a.createElement("a",{className:"secondary button"},i.a.createElement(c.a,{content:"modal.confirmation.cancel"})))))));var y=1,g=null;this.props.output_supports_memos&&(g=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(c.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:y++,onChange:this.onMemoChanged.bind(this)})));var w=this._getAvailableAssets().fee_asset_types;if(l.length>0){var b=this.props.asset.get("id");if(b){var E=o[b];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(c.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},E?i.a.createElement(m.a,{balance:o[b]}):0))}else s="No funds"}else s="No funds";var C=this.state.error||this.state.balanceError||!this.state.withdraw_amount;return i.a.createElement("form",{className:"grid-block vertical full-width-content"},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement("h3",null,i.a.createElement(c.a,{content:"gateway.withdraw_coin",coin:this.props.output_coin_name,symbol:this.props.output_coin_symbol}))),i.a.createElement("div",{className:"content-block"},i.a.createElement(f.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.insufficient"})):null),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(f.a,{refCallback:this.setNestedRef.bind(this),label:"transfer.fee",disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:w,tabIndex:y++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"blocktrades-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"blocktrades-position-options"},d),p),g,i.a.createElement("div",{className:"button-group"},i.a.createElement("div",{onClick:this.onSubmit.bind(this),className:"button"+(C?" disabled":"")},i.a.createElement(c.a,{content:"modal.withdraw.submit"})),i.a.createElement(r.a,{close:this.props.modal_id},i.a.createElement("div",{className:"button"},i.a.createElement(c.a,{content:"account.perm.cancel"})))),h))}}]),a}();T.propTypes={account:u.a.ChainAccount.isRequired,issuer:u.a.ChainAccount.isRequired,asset:u.a.ChainAsset.isRequired,output_coin_name:N.a.string.isRequired,output_coin_symbol:N.a.string.isRequired,output_coin_type:N.a.string.isRequired,url:N.a.string,output_wallet_type:N.a.string,output_supports_memos:N.a.bool.isRequired,amount_to_withdraw:N.a.string,balance:u.a.ChainObject},t.a=Object(p.a)(T)}).call(this,a(118).Buffer)},1828:function(e,t,a){"use strict";a.d(t,"b",function(){return o}),a.d(t,"c",function(){return r}),a.d(t,"a",function(){return l});var n=a(98),s=a(43),i=new n.a("");function o(e){var t=e.walletType,a=e.inputCoinType,n=e.outputCoinType,i=e.outputAddress,o=e.url,r=void 0===o?s.g.BASE:o,l=e.stateCallback,c={inputCoinType:a,outputCoinType:n,outputAddress:i},u=JSON.stringify(c);fetch(r+"/wallets/"+t+"/new-deposit-address",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:u}).then(function(e){e.json().then(function(e){var t={address:e.inputAddress||"unknown",memo:e.inputMemo,error:e.error||null};l&&l(t)},function(e){l&&l({address:"unknown",memo:null})})},function(e){l&&l({address:"unknown",memo:null})}).catch(function(e){console.log("fetch error:",e)})}function r(e){var t=e.url,a=void 0===t?s.g.BASE:t,n=e.walletType,i=e.newAddress;return i?fetch(a+"/wallets/"+n+"/check-address",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({address:i})}).then(function(e){return e.json().then(function(e){return e.isValid})}).catch(function(e){console.log("validate error:",e)}):new Promise(function(e){return e()})}var l={has:function(e){return i.has("history_address_"+e)},set:function(e){var t=e.wallet,a=e.addresses;i.set("history_address_"+t,a)},get:function(e){return i.get("history_address_"+e,[])},setLast:function(e){var t=e.wallet,a=e.address;i.set("history_address_last_"+t,a)},getLast:function(e){return i.get("history_address_last_"+e,"")}}},1948:function(e,t,a){"use strict";(function(e){var t=a(305),n=a(0),s=a.n(n),i=a(3),o=a.n(i),r=a(39),l=a(48),c=a(104),u=a(42),p=a.n(u),d=a(1761),m=a(1827),h=a(530),_=a(16),f=a(47),y=a(101),g=a(43),w=a(142),v=a(28),b=a(78),E=a(1),k=a.n(E),C=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,s=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(n=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);n=!0);}catch(e){s=!0,i=e}finally{try{!n&&r.return&&r.return()}finally{if(s)throw i}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function A(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function N(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function T(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var x=function(a){function n(e){N(this,n);var a=O(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return a.state={error:null,conversion_memo:null,feeStatus:{}},a._updateFee=Object(t.a)(a._updateFee.bind(a),150),a._checkFeeStatus=a._checkFeeStatus.bind(a),a._checkBalance=a._checkBalance.bind(a),a}return T(n,s.a.Component),S(n,[{key:"_getFeeID",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=this._getCurrentBalance(e);return e.account.get("balances").has("1.3.0")?"1.3.0":t?t.get("asset_type"):"1.3.0"}},{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){e.amount.equals(this.props.amount)&&e.account_id===this.props.account_id||this._updateFee()}},{key:"_updateFee",value:function(){var e=this,t=this._getFeeID();Object(b.i)(this.props).then(function(a){Object(w.b)({accountID:e.props.account_id,feeID:t,options:["price_per_kbyte"],data:{type:"memo",content:a.inputMemo}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkFeeStatus)})})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.account;if(t){var a=Object.keys(this.props.account.get("balances").toJS());a.length||(a=["1.3.0"]);var n={},s=[];Object(b.i)(this.props).then(function(i){a.forEach(function(e){s.push(Object(w.b)({accountID:t.get("id"),feeID:e,options:["price_per_kbyte"],data:{type:"memo",content:i.inputMemo}}))}),Promise.all(s).then(function(t){e.unMounted||(a.forEach(function(e,a){n[e]=t[a]}),_.a.are_equal_shallow(e.state.feeStatus,n)||e.setState({feeStatus:n}),e._checkBalance())}).catch(function(e){console.error(e)})})}}},{key:"_getCurrentBalance",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props).balance}},{key:"_checkBalance",value:function(){var e=this.state.feeAmount,t=this.props,a=t.asset,n=t.amount,s=this._getCurrentBalance();if(s&&e){var i=Object(w.a)(n.getAmount({real:!0}),a,e,s);if(null!==i)return this.setState({balanceError:!i}),i}}},{key:"onTrxIncluded",value:function(e){e.included&&e.broadcasted_transaction?(y.a.unlisten(this.onTrxIncluded),y.a.reset()):e.closed&&(y.a.unlisten(this.onTrxIncluded),y.a.reset())}},{key:"onConvert",value:function(){var t=this,a=this.props,n=a.input_coin_type,s=a.output_coin_type,i=a.amount,o=this.state.balanceError;Object(b.i)(this.props).then(function(a){if(a.inputCoinType!=n||a.outputCoinType!=s)throw new Error("unexpected reply from initiate-trade");n!=a.inputCoinType||s!=a.outputCoinType||o||(t.setState({conversion_memo:a.inputMemo}),t.setState({error:null}),f.a.transfer(t.props.account_id,"1.2.32567",i.getAmount(),t.props.asset.get("id"),a.inputMemo?new e(a.inputMemo,"utf-8"):"",null,t._getFeeID()).then(function(){y.a.unlisten(t.onTrxIncluded),y.a.listen(t.onTrxIncluded)}).catch(function(e){var a=e.message?e.message.split("\n")[1]:null;console.log("error: ",e,a),t.setState({error:a})}))}).catch(function(){t.setState({conversion_memo:null})})}},{key:"render",value:function(){var e="button disabled";return Object.keys(this.props.account_balances.toJS()).includes(this.props.asset.get("id"))&&!this.state.balanceError&&this.state.hasBalance&&this.props.amount.getAmount()>0&&(e="button"),s.a.createElement("span",null,s.a.createElement("button",{className:e,onClick:this.onConvert.bind(this)},s.a.createElement(o.a,{content:""}),s.a.createElement(o.a,{content:"gateway.convert_now"})),this.state.balanceError?s.a.createElement("div",{style:{paddingTop:15},className:"has-error"},s.a.createElement(o.a,{content:"transfer.errors.insufficient"})):null)}}]),n}();x.propTypes={balance:r.a.ChainObject,input_coin_type:k.a.string.isRequired,output_coin_type:k.a.string.isRequired,account_name:k.a.string.isRequired,account_id:k.a.string.isRequired,url:k.a.string.isRequired},x=Object(l.a)(x);var j=function(e){function t(){return N(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return T(t,s.a.Component),S(t,[{key:"render",value:function(){var e=s.a.createElement(x,{asset:this.props.asset,account:this.props.account,input_coin_type:this.props.input_coin_type,output_coin_type:this.props.output_coin_type,account_name:this.props.account_name,amount:new v.a({real:this.props.amount,asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")}),account_id:this.props.account_id,account_balances:this.props.account_balances,url:this.props.url,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]});return s.a.createElement("span",null,e)}}]),t}();j.propTypes={asset:r.a.ChainAsset.isRequired,input_coin_type:k.a.string.isRequired,output_coin_type:k.a.string.isRequired,account_name:k.a.string.isRequired,account_id:k.a.string.isRequired,url:k.a.string.isRequired},j=Object(l.a)(j);var I=function(e){function t(){return N(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return T(t,s.a.Component),S(t,[{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){p.a.publish(this.getWithdrawModalId(),"open")}},{key:"render",value:function(){var e=this.getWithdrawModalId(),t="button disabled";return Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))&&this.props.amount_to_withdraw&&!(this.props.amount_to_withdraw.indexOf(" ")>=0)&&!isNaN(this.props.amount_to_withdraw)&&this.props.amount_to_withdraw>0&&this.props.amount_to_withdraw<=this.props.balance.toJS().balance/_.a.get_asset_precision(this.props.asset.get("precision"))&&(t="button"),s.a.createElement("span",null,s.a.createElement("span",null,s.a.createElement("button",{className:t,onClick:this.onWithdraw.bind(this)},s.a.createElement(o.a,{content:""}),s.a.createElement(o.a,{content:"gateway.withdraw_now"})," ")),s.a.createElement(c.a,{id:e,overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(m.a,{key:""+this.props.key,account:this.props.account.get("name"),issuer:this.props.issuer,asset:this.props.asset.get("id"),output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,modal_id:e,url:this.props.url,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]}))))}}]),t}();I.propTypes={balance:r.a.ChainObject,url:k.a.string.isRequired},I=Object(l.a)(I);var P=function(e){function t(){return N(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return T(t,s.a.Component),S(t,[{key:"render",value:function(){var e=s.a.createElement(I,{key:this.props.key,account:this.props.account,issuer:this.props.issuer,asset:this.props.asset,output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,url:this.props.url,gateway:this.props.gateway,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]});return s.a.createElement("span",null,e)}}]),t}();P.propTypes={account:r.a.ChainAccount.isRequired,asset:r.a.ChainAsset.isRequired,output_coin_type:k.a.string.isRequired,url:k.a.string.isRequired},P=Object(l.a)(P);var D=function(e){function t(e){N(this,t);var a=O(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.refresh_interval=12e4,a.deposit_address_cache=new h.a,a.coin_info_request_states={request_in_progress:0,request_complete:1,request_failed:2},a.estimation_directions={output_from_input:0,input_from_output:1},a.state={coin_symbol:"btc",key_for_withdrawal_dialog:"btc",supports_output_memos:"",url:g.a.BASE,error:null,deposit_input_coin_type:null,deposit_output_coin_type:null,input_address_and_memo:null,deposit_estimated_input_amount:a.props.initial_deposit_estimated_input_amount||"1.0",deposit_estimated_output_amount:null,deposit_limit:null,deposit_error:null,failed_calculate_deposit:null,withdraw_input_coin_type:null,withdraw_output_coin_type:null,withdraw_estimated_input_amount:a.props.initial_withdraw_estimated_input_amount||"1.0",withdraw_estimated_output_amount:null,withdraw_limit:null,withdraw_error:null,failed_calculate_withdraw:null,conversion_input_coin_type:null,conversion_output_coin_type:null,conversion_estimated_input_amount:a.props.initial_conversion_estimated_input_amount||"1.0",conversion_estimated_output_amount:null,conversion_limit:null,conversion_error:null,failed_calculate_conversion:null,coin_info_request_state:a.coin_info_request_states.request_in_progress,input_address_requests_in_progress:{},deposit_estimate_direction:a.estimation_directions.output_from_input,deposit_limit_cache:{},deposit_limit_requests_in_progress:{},coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,allowed_mappings_for_conversion:null,conversion_memo:null,announcements:[]},a}return T(t,s.a.Component),S(t,[{key:"urlConnection",value:function(e,t){var a=this;this.setState({url:e});var n=fetch(e+"/announcements/enabled/trade",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.resolve(n).then(function(e){e.sort(function(e,t){return e.priority<t.priority?-1:e.priority>t.priority?1:0}),a.setState({announcements:e})}).catch(function(e){a.setState({announcements:[]})});var s=fetch(e+"/coins",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),i=fetch(e+"/wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),o=fetch(e+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),r=fetch(e+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([s,i,o,r]).then(function(e){var t=C(e,4),n=t[0],s=(t[1],t[2]),i=t[3],o={};n.forEach(function(e){return o[e.coinType]=e});var r={},l={},c={};s.forEach(function(e){var t=o[e.inputCoinType],a=o[e.outputCoinType];t.backingCoinType!=e.outputCoinType&&a&&a.backingCoinType!=e.inputCoinType&&t&&0==t.restricted&&0==a.restricted&&-1!=i.indexOf(t.walletType)&&-1!=i.indexOf(a.walletType)&&("bitshares2"!=t.walletType&&"bitshares2"==a.walletType?(r[e.inputCoinType]=r[e.inputCoinType]||[],r[e.inputCoinType].push(e.outputCoinType)):"bitshares2"==t.walletType&&"bitshares2"!=a.walletType?(l[e.inputCoinType]=l[e.inputCoinType]||[],l[e.inputCoinType].push(e.outputCoinType)):"bitshares2"==t.walletType&&"bitshares2"==a.walletType&&(c[e.inputCoinType]=c[e.inputCoinType]||[],c[e.inputCoinType].push(e.outputCoinType)))});var u=null,p=null,d=Object.keys(r);if(d.forEach(function(e){r[e].sort()}),d.length){u=a.props.initial_deposit_input_coin_type&&a.props.initial_deposit_input_coin_type in r?a.props.initial_deposit_input_coin_type:d[0];var m=r[u];p=a.props.initial_deposit_output_coin_type&&-1!=m.indexOf(a.props.initial_deposit_output_coin_type)?a.props.initial_deposit_output_coin_type:m[0]}var h=null,_=null,f=null,y=null,g=Object.keys(l);if(g.forEach(function(e){l[e].sort()}),g.length){h=a.props.initial_withdraw_input_coin_type&&a.props.initial_withdraw_input_coin_type in l?a.props.initial_withdraw_input_coin_type:g[0];var w=l[h];_=a.props.initial_withdraw_output_coin_type&&-1!=w.indexOf(a.props.initial_withdraw_output_coin_type)?a.props.initial_withdraw_output_coin_type:w[0]}var v=Object.keys(c);if(v.forEach(function(e){c[e].sort()}),v.length){f=a.props.initial_conversion_input_coin_type&&a.props.initial_conversion_input_coin_type in c?a.props.initial_conversion_input_coin_type:v[0];var b=c[f];y=a.props.initial_conversion_output_coin_type&&-1!=b.indexOf(a.props.initial_conversion_output_coin_type)?a.props.initial_conversion_output_coin_type:b[0]}var E=a.getCachedOrGeneratedInputAddress(u,p),k=a.getCachedOrFreshDepositLimit("deposit",u,p),S=a.getAndUpdateOutputEstimate("deposit",u,p,a.state.deposit_estimated_input_amount),A=a.getAndUpdateOutputEstimate("withdraw",h,_,a.state.withdraw_estimated_input_amount),N=a.getCachedOrFreshDepositLimit("withdraw",h,_),O=a.getAndUpdateOutputEstimate("conversion",f,y,a.state.conversion_estimated_input_amount),T=a.getCachedOrFreshDepositLimit("conversion",f,y);a.unMounted||a.setState({coin_info_request_state:a.coin_info_request_states.request_complete,coins_by_type:o,allowed_mappings_for_deposit:r,allowed_mappings_for_withdraw:l,allowed_mappings_for_conversion:c,deposit_input_coin_type:u,deposit_output_coin_type:p,input_address_and_memo:E,deposit_limit:k,deposit_estimated_output_amount:S,deposit_estimate_direction:a.estimation_directions.output_from_input,withdraw_input_coin_type:h,withdraw_output_coin_type:_,withdraw_limit:N,withdraw_estimated_output_amount:A,conversion_input_coin_type:f,conversion_output_coin_type:y,conversion_limit:T,conversion_estimated_output_amount:O,withdraw_estimate_direction:a.estimation_directions.output_from_input,conversion_estimate_direction:a.estimation_directions.output_from_input,supports_output_memos:o.btc.supportsOutputMemos})}).catch(function(e){a.setState({coin_info_request_state:t,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,allowed_mappings_for_conversion:null})})}},{key:"updateEstimates",value:function(){if(this.state.deposit_input_coin_type&&this.state.deposit_output_coin_type){var e=this.getCachedOrGeneratedInputAddress(this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),t=this.getCachedOrFreshDepositLimit("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),a=this.state.deposit_estimated_input_amount,n=this.state.deposit_estimated_output_amount;this.state.deposit_estimate_direction==this.estimation_directions.output_from_input?n=this.getAndUpdateOutputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,a):a=this.getAndUpdateInputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,n);var s=this.getCachedOrFreshDepositLimit("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type),i=this.state.withdraw_estimated_input_amount,o=this.state.withdraw_estimated_output_amount;this.state.withdraw_estimate_direction==this.estimation_directions.output_from_input?o=this.getAndUpdateOutputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,i):i=this.getAndUpdateinputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,o);var r=this.getCachedOrFreshDepositLimit("conversion",this.state.conversion_input_coin_type,this.state.conversion_output_coin_type),l=this.state.conversion_estimated_input_amount,c=this.state.conversion_estimated_output_amount;this.state.conversion_estimate_direction==this.estimation_directions.output_from_input?c=this.getAndUpdateOutputEstimate("conversion",this.state.conversion_input_coin_type,this.state.conversion_output_coin_type,l):l=this.getAndUpdateinputEstimate("conversion",this.state.conversion_input_coin_type,this.state.conversion_output_coin_type,c),this.setState({input_address_and_memo:e,deposit_limit:t,deposit_estimated_input_amount:a,deposit_estimated_output_amount:n,withdraw_limit:s,withdraw_estimated_input_amount:i,withdraw_estimated_output_amount:o,conversion_limit:r,conversion_estimated_input_amount:l,conversion_estimated_output_amount:c,key_for_withdrawal_dialog:i})}}},{key:"componentWillMount",value:function(){var e=this,t=this.state.url;this.urlConnection(t,0);var a=fetch(t+"/coins",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),n=fetch(t+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),s=fetch(t+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([a,n,s]).then(function(e){var t=C(e,3),a=t[0],n=t[1],s=(t[2],{});a.forEach(function(e){return s[e.coinType]=e}),n.forEach(function(e){var t=s[e.inputCoinType],a=s[e.outputCoinType];t.backingCoinType!=e.outputCoinType&&a.backingCoinType!=e.inputCoinType&&a&&a.backingCoinType!=e.inputCoinType&&e.outputCoinType&&t&&(t.backingCoinType,e.outputCoinType)})}).catch(function(t){e.urlConnection("https://api.blocktrades.info/v2",2),e.setState({coin_info_request_state:0,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,allowed_mappings_for_conversion:null})})}},{key:"componentDidMount",value:function(){this.update_timer=setInterval(this.updateEstimates.bind(this),this.refresh_interval)}},{key:"componentWillUnmount",value:function(){clearInterval(this.update_timer),this.unMounted=!0}},{key:"getCachedInputAddress",value:function(e,t,a){var n=this.props.account.get("name");return this.deposit_address_cache.getCachedInputAddress(this.props.gateway,n,e,t)}},{key:"cacheInputAddress",value:function(e,t,a,n){var s=this.props.account.get("name");this.deposit_address_cache.cacheInputAddress(this.props.gateway,s,e,t,a,n)}},{key:"getCachedOrGeneratedInputAddress",value:function(e,t){var a=this,n=this.getCachedInputAddress(e,t);if(n)return n;if(this.state.input_address_requests_in_progress[e]=this.state.input_address_requests_in_progress[e]||{},this.state.input_address_requests_in_progress[e][t])return null;var s=JSON.stringify({inputCoinType:e,outputCoinType:t,outputAddress:this.props.account.get("name")});return this.state.input_address_requests_in_progress[e][t]=!0,fetch(this.state.url+"/simple-api/initiate-trade",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:s}).then(function(n){n.json().then(function(n){if(console.assert(n.inputCoinType==e,"unexpected reply from initiate-trade"),console.assert(n.outputCoinType==t,"unexpected reply from initiate-trade"),n.inputCoinType!=e||n.outputCoinType!=t)throw Error("unexpected reply from initiate-trade");a.cacheInputAddress(n.inputCoinType,n.outputCoinType,n.inputAddress,n.inputMemo),delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==n.inputCoinType&&a.state.deposit_output_coin_type==n.outputCoinType&&a.setState({input_address_and_memo:{address:n.inputAddress,memo:n.inputMemo}})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})}),null}},{key:"getCachedDepositLimit",value:function(e,t){if(this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]){var a=this.state.deposit_limit_cache[e][t];if(new Date-a.timestamp<this.refresh_interval)return a;delete this.state.deposit_limit_cache[e][t]}return null}},{key:"cacheDepositLimit",value:function(e,t,a){a.timestamp=new Date,this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]=a}},{key:"getCachedOrFreshDepositLimit",value:function(e,t,a){var n=this,s=this.getCachedDepositLimit(t,a);if(s)return s;this.state.deposit_limit_requests_in_progress[t]=this.state.input_address_requests_in_progress[t]||{},this.state.deposit_limit_requests_in_progress[t][a]=!0;var i=this.state.url+"/deposit-limits?inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(s){if(!n.unMounted){if(console.assert(s.inputCoinType==t&&s.outputCoinType==a,"unexpected reply from deposit-limits"),s.inputCoinType!=t||s.outputCoinType!=a)throw Error("unexpected reply from deposit-limits");var i={timestamp:new Date,limit:s.depositLimit};n.cacheDepositLimit(t,a,i),delete n.state.deposit_limit_requests_in_progress[t][a],n.state[e+"_input_coin_type"]==t&&n.state[e+"_output_coin_type"]==a&&n.setState(A({},e+"_limit",i))}},function(e){delete n.state.deposit_limit_requests_in_progress[t][a]}),null}},{key:"getAndUpdateOutputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null}),"conversion"==e&&this.setState({failed_calculate_conversion:null});var i=this.state.url+"/estimate-output-amount?inputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(i){if(!s.unMounted)if(i.error){if(s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input){var o=i.error.message;"deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"}),"conversion"==e&&s.setState({failed_calculate_conversion:"Failed to calculate"});o.startsWith("Internal Server Error: ")&&(o=o.substr("Internal Server Error: ".length)),s.setState(A({},e+"_error",o))}}else{var r;if(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.inputAmount==n,"unexpected reply from estimate-output-amount"),i.inputCoinType!=t||i.outputCoinType!=a||i.inputAmount!=n)throw Error("unexpected reply from estimate-output-amount");s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input&&s.setState((A(r={},e+"_estimated_output_amount",i.outputAmount),A(r,e+"_error",null),r))}},function(e){}),null}}},{key:"getAndUpdateInputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null}),"conversion"==e&&this.setState({failed_calculate_conversion:null});var i=this.state.url+"/estimate-input-amount?outputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(i){var o;s.unMounted||(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n,"unexpected reply from estimate-input-amount"),i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n||("deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"}),"conversion"==e&&s.setState({failed_calculate_conversion:"Failed to calculate"})),s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_output_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.input_from_output&&s.setState((A(o={},e+"_estimated_input_amount",i.inputAmount),A(o,"key_for_withdrawal_dialog",i.inputAmount),o)))},function(e){}),null}}},{key:"onInputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((A(a={},e+"_estimated_input_amount",n),A(a,e+"_estimated_output_amount",s),A(a,e+"_estimate_direction",this.estimation_directions.output_from_input),A(a,"key_for_withdrawal_dialog",n),a))}},{key:"onOutputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((A(a={},e+"_estimated_output_amount",n),A(a,e+"_estimated_input_amount",s),A(a,e+"_estimate_direction",this.estimation_directions.input_from_output),a))}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){p.a.publish(this.getWithdrawModalId(),"open")}},{key:"onInputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state["allowed_mappings_for_"+e][o],l=r[0];-1!=r.indexOf(this.state[e+"_output_coin_type"])&&(l=this.state[e+"_output_coin_type"]);var c=this.state.input_address_and_memo;"deposit"==e&&(c=this.getCachedOrGeneratedInputAddress(o,l));var u=this.getCachedOrFreshDepositLimit(e,o,l);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,o,l,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,o,l,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),"withdraw"==e&&r.forEach(function(e){l===e&&n.setState({coin_symbol:o+"input",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos})}),this.setState((A(a={},e+"_input_coin_type",o),A(a,e+"_output_coin_type",l),A(a,"input_address_and_memo",c),A(a,e+"_limit",u),A(a,e+i,s),A(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"onOutputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type];"withdraw"==e&&r.forEach(function(e){o===e&&n.setState({coin_symbol:o+"output",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos,key_for_withdrawal_dialog:o})});var l=this.state.input_address_and_memo;"deposit"==e&&(l=this.getCachedOrGeneratedInputAddress(this.state[e+"_input_coin_type"],o));var c=this.getCachedOrFreshDepositLimit(e,this.state[e+"_input_coin_type"],o);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),this.setState((A(a={},e+"_output_coin_type",o),A(a,"input_address_and_memo",l),A(a,e+"_limit",c),A(a,e+i,s),A(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"render",value:function(){var e=this;if(!this.props.account||!this.props.issuer_account||!this.props.gateway)return s.a.createElement("div",null);var t=void 0,a=void 0,n=void 0,i=void 0,r=void 0,l=void 0,c=void 0;if(this.state.coin_info_request_state==this.coin_info_request_states.request_failed)return s.a.createElement("div",null,s.a.createElement("p",null,"Error connecting to blocktrades.us, please try again later"));if(this.state.coin_info_request_state==this.coin_info_request_states.never_requested||this.state.coin_info_request_state==this.coin_info_request_states.request_in_progress)return s.a.createElement("div",null,s.a.createElement("p",null,"Retrieving current trade data from blocktrades.us"));var u=null,p=s.a.createElement(o.a,{content:"gateway.calc"});null!=this.state.failed_calculate_deposit&&(p=this.state.failed_calculate_deposit);var m=s.a.createElement(o.a,{content:"gateway.calc"});null!=this.state.failed_calculate_withdraw&&(m=this.state.failed_calculate_withdraw);var h=s.a.createElement(o.a,{content:"gateway.calc"});if(null!=this.state.failed_calculate_conversion&&(h=this.state.failed_calculate_conversion),Object.getOwnPropertyNames(this.state.allowed_mappings_for_deposit).length>0){var f=[];Object.keys(this.state.allowed_mappings_for_deposit).sort().forEach(function(t){f.push(s.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].symbol))});var y=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.deposit_input_coin_type||"",onChange:this.onInputCoinTypeChanged.bind(this,"deposit")},f),g=[];this.state.allowed_mappings_for_deposit[this.state.deposit_input_coin_type].forEach(function(t){g.push(s.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].walletSymbol))});var w=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.deposit_output_coin_type||"",onChange:this.onOutputCoinTypeChanged.bind(this,"deposit")},g),v=this.state.input_address_and_memo?this.state.input_address_and_memo:{address:"unknown",memo:null},b=this.state.deposit_estimated_input_amount,E=this.state.deposit_estimated_output_amount,k=b?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:b||"",onChange:this.onInputAmountChanged.bind(this,"deposit")}):p,C=E?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:E||"",onChange:this.onOutputAmountChanged.bind(this,"deposit")}):p,S=s.a.createElement("span",null,"updating");this.state.deposit_limit&&(S=this.state.deposit_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(o.a,{content:"gateway.limit",amount:_.a.format_number(this.state.deposit_limit.limit,8),symbol:this.state.coins_by_type[this.state.deposit_input_coin_type].walletSymbol}))):null);var A=null;this.state.deposit_error&&(A=s.a.createElement("div",null,this.state.deposit_error)),n=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.deposit"})),s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.balance"})),s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.deposit_to",asset:this.state.deposit_input_coin_type}))));var N=null;N=v.memo?s.a.createElement(o.a,{unsafe:!0,content:"gateway.address_with_memo",address:v.address,memo:v.memo}):s.a.createElement("span",null,v.address),a=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,y),s.a.createElement("div",null,k)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,w),s.a.createElement("div",null,C)),s.a.createElement("div",null,A))),s.a.createElement("td",null,s.a.createElement(d.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.deposit_output_coin_type].walletSymbol})),s.a.createElement("td",null,N,s.a.createElement("br",null),S)))}if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_withdraw).length>0){this.getWithdrawModalId();this.state.coins_by_type[this.state.withdraw_input_coin_type].symbol;u=this.state.withdraw_estimated_input_amount;var O=[];Object.keys(this.state.allowed_mappings_for_withdraw).sort().forEach(function(t){O.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].walletSymbol))});var T=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.withdraw_input_coin_type,onChange:this.onInputCoinTypeChanged.bind(this,"withdraw")},O),x=[];this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type].forEach(function(t){x.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].symbol))});var I=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.withdraw_output_coin_type,onChange:this.onOutputCoinTypeChanged.bind(this,"withdraw")},x),D=this.state.withdraw_estimated_input_amount,W=D?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:D||"",onChange:this.onInputAmountChanged.bind(this,"withdraw")}):m,B=this.state.withdraw_estimated_output_amount,F=B?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:B||"",onChange:this.onOutputAmountChanged.bind(this,"withdraw")}):m,R=s.a.createElement(P,{key:this.state.key_for_withdrawal_dialog,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol,output_coin_name:this.state.coins_by_type[this.state.withdraw_output_coin_type].name,output_coin_symbol:this.state.coins_by_type[this.state.withdraw_output_coin_type].symbol,output_coin_type:this.state.withdraw_output_coin_type,output_supports_memos:this.state.supports_output_memos,amount_to_withdraw:u,url:this.state.url,gateway:this.props.gateway,output_wallet_type:this.state.coins_by_type[this.state.withdraw_output_coin_type].walletType}),q=null;this.state.withdraw_error&&(q=s.a.createElement("div",null,this.state.withdraw_error));var M=s.a.createElement("span",null,"...");this.state.withdraw_limit&&(M=this.state.withdraw_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(o.a,{content:"gateway.limit",amount:_.a.format_number(this.state.withdraw_limit.limit,8),symbol:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol}))):s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},"no limit"))),r=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.withdraw"})),s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.balance"})),s.a.createElement("th",null))),i=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,T),s.a.createElement("div",null,W)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,I),s.a.createElement("div",null,F)),s.a.createElement("div",null,q))),s.a.createElement("td",null,s.a.createElement(d.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol})),s.a.createElement("td",null,R,s.a.createElement("br",null),M)))}if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_conversion).length>0){var L=[];Object.keys(this.state.allowed_mappings_for_conversion).sort().forEach(function(t){L.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].walletSymbol))});var U=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.conversion_input_coin_type,onChange:this.onInputCoinTypeChanged.bind(this,"conversion")},L),H=[];this.state.allowed_mappings_for_conversion[this.state.conversion_input_coin_type].forEach(function(t){H.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].symbol))});var J=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.conversion_output_coin_type,onChange:this.onOutputCoinTypeChanged.bind(this,"conversion")},H),z=this.state.conversion_estimated_input_amount,G=z?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:z||"",onChange:this.onInputAmountChanged.bind(this,"conversion")}):h,V=this.state.conversion_estimated_output_amount,X=V?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:V||"",onChange:this.onOutputAmountChanged.bind(this,"conversion")}):h,K=s.a.createElement(j,{asset:this.state.coins_by_type[this.state.conversion_input_coin_type].walletSymbol,account:this.props.account,input_coin_type:this.state.conversion_input_coin_type,output_coin_type:this.state.conversion_output_coin_type,account_name:this.props.account.get("name"),amount:this.state.conversion_estimated_input_amount,account_id:this.props.account.get("id"),account_balances:this.props.account.get("balances"),url:this.state.url}),Y=null;this.state.conversion_error&&(Y=s.a.createElement("div",null,this.state.conversion_error));var Q=s.a.createElement("span",null,"...");this.state.conversion_limit&&(Q=this.state.conversion_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(o.a,{content:"gateway.limit",amount:_.a.format_number(this.state.conversion_limit.limit,8),symbol:this.state.coins_by_type[this.state.conversion_input_coin_type].walletSymbol}))):s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},"no limit"))),c=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.convert"})),s.a.createElement("th",null,s.a.createElement(o.a,{content:"gateway.balance"})),s.a.createElement("th",null))),l=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,U),s.a.createElement("div",null,G)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,J),s.a.createElement("div",null,X)),s.a.createElement("div",null,Y))),s.a.createElement("td",null,s.a.createElement(d.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.conversion_input_coin_type].walletSymbol})),s.a.createElement("td",null,K,s.a.createElement("br",null),Q)))}return this.state.announcements.length>0&&(t=s.a.createElement("div",{className:"blocktrades-announcements-container"},this.state.announcements.map(function(e,t){var a="txtann info";return 10===e.status?a="txtann error":20===e.status?a="txtann warning":30===e.status?a="txtann success":40===e.status&&(a="txtann info"),1===e.format&&e.message.replace(/\r\n|\r|\n/g,"<br />"),s.a.createElement("div",{className:"blocktrades-announcements "+a,key:t},e.message)},this))),s.a.createElement("div",null,s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement(o.a,{component:"h5",content:"gateway.bridge_text"})),t,s.a.createElement("table",{className:"table"},n,a,r,i,c,l))}}]),t}();D.propTypes={url:k.a.string,gateway:k.a.string,account:r.a.ChainAccount,issuer_account:r.a.ChainAccount,initial_deposit_input_coin_type:k.a.string,initial_deposit_output_coin_type:k.a.string,initial_deposit_estimated_input_amount:k.a.string,initial_withdraw_input_coin_type:k.a.string,initial_withdraw_output_coin_type:k.a.string,initial_withdraw_estimated_input_amount:k.a.string,initial_conversion_input_coin_type:k.a.string,initial_conversion_output_coin_type:k.a.string,initial_conversion_estimated_input_amount:k.a.string};Object(l.a)(D)}).call(this,a(118).Buffer)},1949:function(e,t,a){"use strict";(function(e){var n=a(0),s=a.n(n),i=a(39),o=a(48),r=a(3),l=a.n(r),c=a(5),u=a.n(c),p=a(101),d=a(47),m=a(23),h=a(1761),_=a(16),f=(a(22),function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}());var y=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));return t.state={action:e.viewSettings.get("bktAction","deposit"),min:50,max:1e5},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,s.a.Component),f(a,[{key:"_renderDeposits",value:function(){}},{key:"_renderWithdrawals",value:function(){return s.a.createElement("form",{onSubmit:this._onSubmit.bind(this)},s.a.createElement("div",{style:{padding:"20px 0"}},s.a.createElement(l.a,{content:"gateway.balance"}),": ",s.a.createElement("span",{style:{fontWeight:"bold",color:"#4A90E2",textAlign:"right"}},s.a.createElement(h.a,{account:this.props.account.get("name"),asset:this.props.asset.get("symbol")}))),s.a.createElement("label",null,s.a.createElement(l.a,{content:"exchange.quantity"}),s.a.createElement("input",{ref:"amount",required:!0,id:"amount",type:"number",min:this.state.min,max:this.state.max})),s.a.createElement("label",null,s.a.createElement(l.a,{content:"gateway.iban"}),s.a.createElement("input",{ref:"iban",required:!0,id:"iban",type:"text"})),s.a.createElement("button",{className:"button",type:"submit"},s.a.createElement(l.a,{content:"gateway.withdraw_now"})))}},{key:"changeAction",value:function(e){this.setState({action:e}),m.a.changeViewSetting({bktAction:e})}},{key:"_onSubmit",value:function(t){var a=this;t.preventDefault();var n=this.state,s=n.min,i=n.max,o=this.props,r=o.asset,l=o.account,c=o.bitKapital,u=parseInt(this.refs.amount.value,10),m=this.refs.iban.value;console.log("amount:",u,"iban:",m);var h=_.a.get_asset_precision(r.get("precision"));u<s||u>i||d.a.transfer(l.get("id"),c.get("id"),parseInt(u*h,10),r.get("id"),new e("BOZDURMA - "+m.toUpperCase(),"utf-8"),null,r.get("id")).then(function(){p.a.unlisten(a.onTrxIncluded),p.a.listen(a.onTrxIncluded)})}},{key:"onTrxIncluded",value:function(e){e.included&&e.broadcasted_transaction?(p.a.unlisten(this.onTrxIncluded),p.a.reset()):e.closed&&(p.a.unlisten(this.onTrxIncluded),p.a.reset())}},{key:"render",value:function(){var e=this.props,t=(e.jianjolly,e.onay,e.account,this.state.action);return s.a.createElement("div",{className:"BitKapital"},s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("div",{style:{marginRight:10},onClick:this.changeAction.bind(this,"deposit"),className:u()("button","deposit"===t?"active":"outline")},s.a.createElement(l.a,{content:"gateway.deposit"})),s.a.createElement("div",{onClick:this.changeAction.bind(this,"withdraw"),className:u()("button","withdraw"===t?"active":"outline")},s.a.createElement(l.a,{content:"gateway.withdraw"}))),"deposit"===t?this._renderDeposits():this._renderWithdrawals()))}}]),a}();y.propTypes={jianjolly:i.a.ChainAccount.isRequired,onay:i.a.ChainAccount.isRequired,bitKapital:i.a.ChainAccount.isRequired,asset:i.a.ChainAsset.isRequired},y.defaultProps={jianjolly:"1.2.126253",bitKapital:"1.2.130090",onay:"1.2.139289",asset:"KAPITAL"},t.a=Object(o.a)(y)}).call(this,a(118).Buffer)},1950:function(e,t,a){"use strict";(function(e){var n=a(305),s=a(0),i=a.n(s),o=a(252),r=a.n(o),l=a(3),c=a.n(l),u=a(39),p=a(48),d=a(16),m=a(332),h=a(14),_=a.n(h),f=a(304),y=a(47),g=a(42),w=a.n(g),v=a(1828),b=a(10),E=a(527),k=a.n(E),C=a(142),S=a(28),A=a(1),N=a.n(A),O=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var T=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={withdraw_amount:t.props.amount_to_withdraw,withdraw_address:v.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:v.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._checkMinAmount=t._checkMinAmount.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),O(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},fee_asset_id:"1.3.0",feeAmount:new S.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(C.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(C.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),d.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},function(){this._checkBalance,this._checkMinAmount()})}},{key:"onSelectChanged",value:function(e){var t=v.a.get(this.props.output_wallet_type)[e];v.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(v.c)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(C.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"_checkMinAmount",value:function(){var e=this.state.withdraw_amount;if(null!==e){var t=e<this.props.min_amount/d.a.get_asset_precision(this.props.asset_precision);return console.log("X",e,this.props.min_amount/d.a.get_asset_precision(this.props.asset_precision)),this.setState({minAmountError:t}),t}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state.feeAmount,i=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),o=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:i});y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),o.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,s?s.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else w.a.publish(this.getWithdrawModalId(),"open")}},{key:"onSubmitConfirmation",value:function(){if(w.a.publish(this.getWithdrawModalId(),"close"),v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=d.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state.feeAmount;y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,o?o.asset_id:"1.3.0")}},{key:"onDropDownList",value:function(){v.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new S.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(d.a.sortID),s){var o=b.ChainStore.getObject(i),r=b.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new S.h({base:new S.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new S.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=v.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),u=this.getWithdrawModalId(),p=null,h=null,y=null;this.state.options_is_valid&&(h=i.a.createElement("div",{className:n.length?"rudex-options":"rudex-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(p=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(c.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),y=i.a.createElement(k.a,{id:u,overlay:!0},i.a.createElement(r.a,{close:u},i.a.createElement("a",{href:"#",className:"close-button"},"×")),i.a.createElement("br",null),i.a.createElement("label",null,i.a.createElement(c.a,{content:"modal.confirmation.title"})),i.a.createElement("br",null),i.a.createElement("div",{className:"content-block"},i.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitConfirmation.bind(this),value:_.a.translate("modal.confirmation.accept")}),i.a.createElement(r.a,{close:u},i.a.createElement("a",{className:"secondary button"},i.a.createElement(c.a,{content:"modal.confirmation.cancel"})))))));var g=1,w=null;this.props.output_supports_memos&&(w=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(c.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:g++,onChange:this.onMemoChanged.bind(this)})));var b=this._getAvailableAssets().fee_asset_types;if(l.length>0){var E=this.props.asset.get("id");if(E){var C=o[E];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(c.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},C?i.a.createElement(m.a,{balance:o[E]}):0))}else s="No funds"}else s="No funds";var S=d.a.format_number(this.props.min_amount/d.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1),A=this.props.withdraw_fee?d.a.format_number(this.props.withdraw_fee/d.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1):null;return i.a.createElement("form",{className:"grid-block vertical full-width-content"},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement("h3",null,i.a.createElement(c.a,{content:"gateway.withdraw_coin",coin:this.props.output_coin_name,symbol:this.props.output_coin_symbol}))),i.a.createElement("div",{className:"content-block"},i.a.createElement(f.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.insufficient"})):null,this.state.minAmountError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"gateway.rudex.min_amount_error"})):null,i.a.createElement("p",{className:"no-margin",style:{paddingTop:10}},i.a.createElement("b",null,i.a.createElement(c.a,{content:"gateway.rudex.min_amount",minAmount:S,symbol:this.props.output_coin_symbol})))),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(f.a,{refCallback:this.setNestedRef.bind(this),label:"transfer.fee",disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:b,tabIndex:g++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noPoolBalance"}))):null,A?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:A}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"rudex-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"rudex-position-options"},h),p),w,i.a.createElement("div",{className:"button-group"},i.a.createElement("div",{onClick:this.onSubmit.bind(this),className:"button"+(this.state.error||this.state.balanceError||this.state.minAmountError?" disabled":"")},i.a.createElement(c.a,{content:"modal.withdraw.submit"})),i.a.createElement(r.a,{close:this.props.modal_id},i.a.createElement("div",{className:"button"},i.a.createElement(c.a,{content:"account.perm.cancel"})))),y))}}]),a}();T.propTypes={account:u.a.ChainAccount.isRequired,issuer:u.a.ChainAccount.isRequired,asset:u.a.ChainAsset.isRequired,output_coin_name:N.a.string.isRequired,output_coin_symbol:N.a.string.isRequired,output_coin_type:N.a.string.isRequired,url:N.a.string,output_wallet_type:N.a.string,output_supports_memos:N.a.bool.isRequired,amount_to_withdraw:N.a.string,balance:u.a.ChainObject,min_amount:N.a.number,withdraw_fee:N.a.number},t.a=Object(p.a)(T,{keep_updating:!0})}).call(this,a(118).Buffer)},1973:function(e,t){},1974:function(e,t){},2032:function(e,t,a){"use strict";(function(e){var n=a(305),s=a(0),i=a.n(s),o=a(252),r=a.n(o),l=a(3),c=a.n(l),u=a(39),p=a(48),d=a(16),m=a(332),h=a(14),_=a.n(h),f=a(304),y=a(47),g=a(42),w=a.n(g),v=a(78),b=a(10),E=a(527),k=a.n(E),C=a(142),S=a(28),A=a(1),N=a.n(A),O=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var T=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={withdraw_amount:t.props.amount_to_withdraw,withdraw_address:v.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:v.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),O(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},fee_asset_id:"1.3.0",feeAmount:new S.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(C.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(C.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),d.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkWithdrawAmount(t),this._validMinAmount(t),this._calFinalNumber(t))}},{key:"onSelectChanged",value:function(e){var t=v.a.get(this.props.output_wallet_type)[e];v.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(v.m)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(C.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"_checkWithdrawAmount",value:function(e){var t=this.state.feeAmount,a=this.props,n=a.asset,s=a.balance;if(s&&t){var i=Object(C.a)(e,n,t,s);if(null!==i)return this.setState({balanceError:!i}),i}}},{key:"_validMinAmount",value:function(e){var t=this.props.min_withdraw_amount,a=!1;return parseFloat(e)<t&&(a=!0),this.setState({minWithdrawError:a}),a}},{key:"_calFinalNumber",value:function(e){e||(e="0");var t=this.props,a=t.fee_type,n=t.gateFee,s=parseFloat(e),i=parseFloat(n);"1"===a?this.setState({finalNumber:(s-s*i).toFixed(8)}):this.setState({finalNumber:(s-i).toFixed(8)})}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state.feeAmount,i=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),o=new S.a({asset_id:n.get("id"),precision:n.get("precision"),real:i});y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),o.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,s?s.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else w.a.publish(this.getWithdrawModalId(),"open")}},{key:"onSubmitConfirmation",value:function(){if(w.a.publish(this.getWithdrawModalId(),"close"),v.a.has(this.props.output_wallet_type)){var t=v.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),v.a.set({wallet:this.props.output_wallet_type,addresses:a})}v.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=d.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state.feeAmount;y.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,o?o.asset_id:"1.3.0")}},{key:"onDropDownList",value:function(){v.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new S.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(d.a.sortID),s){var o=b.ChainStore.getObject(i),r=b.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new Price({base:new S.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new S.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=v.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),u=this.getWithdrawModalId(),p=null,d=null,h=null;this.state.options_is_valid&&(d=i.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(p=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(c.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),h=i.a.createElement(k.a,{id:u,overlay:!0},i.a.createElement(r.a,{close:u},i.a.createElement("a",{href:"#",className:"close-button"},"×")),i.a.createElement("br",null),i.a.createElement("label",null,i.a.createElement(c.a,{content:"modal.confirmation.title"})),i.a.createElement("br",null),i.a.createElement("div",{className:"content-block"},i.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitConfirmation.bind(this),value:_.a.translate("modal.confirmation.accept")}),i.a.createElement(r.a,{close:u},i.a.createElement("a",{className:"secondary button"},i.a.createElement(c.a,{content:"modal.confirmation.cancel"})))))));var y=1;this.props.output_supports_memos&&i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(c.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:y++,onChange:this.onMemoChanged.bind(this)}));var g=this._getAvailableAssets().fee_asset_types;if(l.length>0){var w=this.props.asset.get("id");if(w){var b=o[w];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(c.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},b?i.a.createElement(m.a,{balance:o[w]}):0))}else s="No funds"}else s="No funds";return i.a.createElement("form",{className:"grid-block vertical full-width-content"},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement("h3",null,i.a.createElement(c.a,{content:"gateway.withdraw_coin",coin:this.props.output_coin_name,symbol:this.props.output_coin_symbol}))),i.a.createElement("div",{className:"content-block"},i.a.createElement(f.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{content:"winex.withdraw.winAmount",min_amount:this.props.min_withdraw_amount,asset:this.props.asset.get("symbol")})),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.insufficient"})):null,this.state.minWithdrawError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"winex.transfer.errors.minWithdraw",min_amount:this.props.min_withdraw_amount+this.props.asset.get("symbol")})):null),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(f.a,{refCallback:this.setNestedRef.bind(this),label:"transfer.fee",disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:g,tabIndex:y++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(c.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:100*this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,"1"===this.props.fee_type?"%":this.props.output_coin_symbol)))),i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{content:"winex.withdraw.finalNumber",final_number:this.state.finalNumber}))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(c.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"blocktrades-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"blocktrades-position-options"},d),p),i.a.createElement("div",{className:"button-group"},i.a.createElement("div",{onClick:this.onSubmit.bind(this),className:"button"+(this.state.error||this.state.balanceError||this.state.minWithdrawError?" disabled":"")},i.a.createElement(c.a,{content:"modal.withdraw.submit"})),i.a.createElement(r.a,{close:this.props.modal_id},i.a.createElement("div",{className:"button"},i.a.createElement(c.a,{content:"account.perm.cancel"})))),h))}}]),a}();T.propTypes={account:u.a.ChainAccount.isRequired,issuer:u.a.ChainAccount.isRequired,asset:u.a.ChainAsset.isRequired,output_coin_name:N.a.string.isRequired,output_coin_symbol:N.a.string.isRequired,output_coin_type:N.a.string.isRequired,url:N.a.string,output_wallet_type:N.a.string,output_supports_memos:N.a.bool.isRequired,amount_to_withdraw:N.a.string,min_withdraw_amount:N.a.string,max_withdraw_amount:N.a.any,fee_type:N.a.string,balance:u.a.ChainObject},t.a=Object(p.a)(T)}).call(this,a(118).Buffer)},2064:function(e,t,a){"use strict";a.r(t);var n=a(0),s=a.n(n),i=a(35),o=a(126),r=a(124),l=a(16),c=a(3),u=a.n(c),p=a(39),d=a(48),m=a(10),h=a(1826),_=a(104),f=a(42),y=a.n(f),g=a(1761),w=a(140),v=a(141),b=a(78),E=a(43),k=a(41),C=a(14),S=a.n(C),A=a(1),N=a.n(A),O=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var T=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n={blocktrades:E.a.BASE,openledger:E.f.BASE,citadel:E.b.BASE};return a.state={receive_address:null,url:e.url||n[e.gateway],loading:!1,emptyAddressDeposit:!1},a.addDepositAddress=a.addDepositAddress.bind(a),a._copy=a._copy.bind(a),document.addEventListener("copy",a._copy),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),O(t,[{key:"_copy",value:function(e){try{this.state.clipboardText?e.clipboardData.setData("text/plain",this.state.clipboardText):e.clipboardData.setData("text/plain",S.a.translate("gateway.use_copy_button").toUpperCase()),e.preventDefault()}catch(e){console.error(e)}}},{key:"_getDepositObject",value:function(){return{inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),url:this.state.url,stateCallback:this.addDepositAddress}}},{key:"componentWillMount",value:function(){Object(b.j)({coin:this.props.receive_coin_type,account:this.props.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"componentWillReceiveProps",value:function(e){e.account!==this.props.account&&Object(b.j)({coin:e.receive_coin_type,account:e.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"addDepositAddress",value:function(e){e.error&&("no_address"===e.error.message?this.setState({emptyAddressDeposit:!0}):this.setState({emptyAddressDeposit:!1})),this.setState({receive_address:e}),this.setState({loading:!1}),this.setState({receive_address:e})}},{key:"requestDepositAddressLoad",value:function(){this.setState({loading:!0,emptyAddressDeposit:!1}),Object(b.l)(this._getDepositObject())}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e="deposit"===this.props.action,t=s.a.createElement(k.a,null);if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return t;var a=this.props.account.get("balances"),n=this.props.gateFee;this.props.receive_asset.get("symbol");if(this.props.deprecated_in_favor_of){var i=!1,o=a.get(this.props.receive_asset.get("id"));if(o){var r=m.ChainStore.getObject(o);if(r)0!=r.get("balance")&&(i=!0)}if(!i)return t}var l=this.state.receive_address,c=this.state.emptyAddressDeposit,p=this.state.loading;if(!l)return s.a.createElement("div",{style:{margin:"3rem"}},s.a.createElement(k.a,{type:"three-bounce"}));var d=this.getWithdrawModalId(),f=null,y=null,b="",E=void 0;if(this.props.deposit_account){f=s.a.createElement("span",null,this.props.deposit_account),b=this.props.receive_coin_type+":"+this.props.account.get("name"),y=s.a.createElement("span",null,b);var C=this.props.deposit_coin_type+":"}else{l.memo?(E=l.memo,b=l.address,f=s.a.createElement("span",null,l.address),y=s.a.createElement("span",null,l.memo)):(b=l.address,f=s.a.createElement("span",null,l.address));C=""}return!this.props.isAvailable||e&&!this.props.deposit_account&&!l||l&&"unknown"===l.address?s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"})):e?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"fz_12 left-label"},s.a.createElement(u.a,{content:"gateway.deposit_notice_delay"})),s.a.createElement("div",null,c?s.a.createElement(u.a,{content:"gateway.please_generate_address"}):f,s.a.createElement("div",null,y&&s.a.createElement("span",null,"memo: ",y)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},f?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,b)},s.a.createElement(u.a,{content:"gateway.copy_address"})):null,E?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,E)},s.a.createElement(u.a,{content:"gateway.copy_memo"})):null,s.a.createElement("button",{className:"button spinner-button-circle",onClick:this.requestDepositAddressLoad.bind(this)},p?s.a.createElement(k.a,{type:"circle"}):null,s.a.createElement(u.a,{content:"gateway.generate_new"}))),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_amount",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset}),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_asset",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset})))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(_.a,{id:d,overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(h.a,{account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),url:this.state.url,output_coin_name:this.props.deposit_asset_name,gateFee:n,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:C,modal_id:d,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]}))))}}]),t}();T.propTypes={url:N.a.string,gateway:N.a.string,deposit_coin_type:N.a.string,deposit_asset_name:N.a.string,deposit_account:N.a.string,receive_coin_type:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:N.a.string,deposit_wallet_type:N.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:N.a.string,action:N.a.string,supports_output_memos:N.a.bool.isRequired},T.defaultProps={autosubscribe:!1};var x=Object(d.a)(T),j=a(22),I=a(23),P=a(1766),D=a(11),W=a.n(D),B=(a(5),function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}());var F=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={activeCoin:a._getActiveCoin(e,{action:n}),action:n},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),B(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_citadel_"+t.action,null),n=null;return"deposit"==t.action&&(n="XMR"),"withdraw"==t.action&&(n="XMR"),a||n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_citadel_"+this.state.action]=e.target.value,I.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),I.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=t.provider,o=this.state,r=o.activeCoin,l=o.action;if(!a.length)return s.a.createElement(k.a,null);var c=a.filter(function(e){return!(!e||!e.symbol)&&("deposit"===l?e.depositAllowed:e.withdrawalAllowed)}),p=c.map(function(e){var t="deposit"===l?e.backingCoinType.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),d=c.filter(function(e){return"deposit"===l?e.backingCoinType.toUpperCase()===r:e.symbol===r})[0];d||(d=c[0]);var m="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+l}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:r},p))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),d?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(x,{key:i+"."+d.symbol,gateway:i,issuer_account:d.intermediateAccount,account:n,deposit_asset:d.backingCoinType.toUpperCase(),deposit_asset_name:d.name,deposit_coin_type:d.backingCoinType.toLowerCase(),deposit_account:d.depositAccount,deposit_wallet_type:d.walletType,gateFee:d.gateFee,receive_asset:d.symbol,receive_coin_type:d.symbol.toLowerCase(),supports_output_memos:d.supportsMemos,isAvailable:d.isAvailable,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.citadel.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:"https://citadel.li",target:"_blank",rel:"noopener noreferrer"},"https://citadel.li"))),d&&d.symbol?s.a.createElement(P.b,{asset:d.symbol,fromAccount:m?issuer.id:this.props.account.get("id"),to:m?this.props.account.get("id"):issuer.id},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(P.a,{accountsList:W.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),R=(Object(i.a)(F,{listenTo:function(){return[j.a]},getProps:function(){return{viewSettings:j.a.getState().viewSettings}}}),a(1827)),q=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var M=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n={blocktrades:E.a.BASE,openledger:E.f.BASE};return a.state={receive_address:null,url:e.url||n[e.gateway],loading:!1,emptyAddressDeposit:!1},a.addDepositAddress=a.addDepositAddress.bind(a),a._copy=a._copy.bind(a),document.addEventListener("copy",a._copy),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),q(t,[{key:"_copy",value:function(e){try{this.state.clipboardText?e.clipboardData.setData("text/plain",this.state.clipboardText):e.clipboardData.setData("text/plain",S.a.translate("gateway.use_copy_button").toUpperCase()),e.preventDefault()}catch(e){console.error(e)}}},{key:"_getDepositObject",value:function(){return{inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),url:this.state.url,stateCallback:this.addDepositAddress}}},{key:"componentWillMount",value:function(){Object(b.j)({coin:this.props.receive_coin_type,account:this.props.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"componentWillReceiveProps",value:function(e){e.account!==this.props.account&&Object(b.j)({coin:e.receive_coin_type,account:e.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"addDepositAddress",value:function(e){e.error&&("no_address"===e.error.message?this.setState({emptyAddressDeposit:!0}):this.setState({emptyAddressDeposit:!1})),this.setState({receive_address:e}),this.setState({loading:!1}),this.setState({receive_address:e})}},{key:"requestDepositAddressLoad",value:function(){this.setState({loading:!0,emptyAddressDeposit:!1}),Object(b.l)(this._getDepositObject())}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e="deposit"===this.props.action,t=s.a.createElement(k.a,null);if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return t;var a=this.props.account.get("balances"),n=this.props.gateFee;this.props.receive_asset.get("symbol");if(this.props.deprecated_in_favor_of){var i=!1,o=a.get(this.props.receive_asset.get("id"));if(o){var r=m.ChainStore.getObject(o);if(r)0!=r.get("balance")&&(i=!0)}if(!i)return t}var l=this.state.receive_address,c=this.state.emptyAddressDeposit,p=this.state.loading;if(!l)return s.a.createElement("div",{style:{margin:"3rem"}},s.a.createElement(k.a,{type:"three-bounce"}));var d=this.getWithdrawModalId(),h=null,f=null,y="",b=void 0;if(this.props.deposit_account){h=s.a.createElement("span",null,this.props.deposit_account),y=this.props.receive_coin_type+":"+this.props.account.get("name"),f=s.a.createElement("span",null,y);var E=this.props.deposit_coin_type+":"}else{l.memo?(b=l.memo,y=l.address,h=s.a.createElement("span",null,l.address),f=s.a.createElement("span",null,l.memo)):(y=l.address,h=s.a.createElement("span",null,l.address));E=""}return!this.props.isAvailable||e&&!this.props.deposit_account&&!l||l&&"unknown"===l.address?s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"})):e?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"fz_12 left-label"},s.a.createElement(u.a,{content:"gateway.deposit_notice_delay"})),s.a.createElement("div",null,c?s.a.createElement(u.a,{content:"gateway.please_generate_address"}):h,s.a.createElement("div",null,f&&s.a.createElement("span",null,"memo: ",f)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},h?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,y)},s.a.createElement(u.a,{content:"gateway.copy_address"})):null,b?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,b)},s.a.createElement(u.a,{content:"gateway.copy_memo"})):null,s.a.createElement("button",{className:"button spinner-button-circle",onClick:this.requestDepositAddressLoad.bind(this)},p?s.a.createElement(k.a,{type:"circle"}):null,s.a.createElement(u.a,{content:"gateway.generate_new"}))),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_amount",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset}),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_asset",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset})))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(_.a,{id:d,overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(R.a,{account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),url:this.state.url,output_coin_name:this.props.deposit_asset_name,gateFee:n,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:E,modal_id:d,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]}))))}}]),t}();M.propTypes={url:N.a.string,gateway:N.a.string,deposit_coin_type:N.a.string,deposit_asset_name:N.a.string,deposit_account:N.a.string,receive_coin_type:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:N.a.string,deposit_wallet_type:N.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:N.a.string,action:N.a.string,supports_output_memos:N.a.bool.isRequired},M.defaultProps={autosubscribe:!1};var L=Object(d.a)(M),U=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var H=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={activeCoin:a._getActiveCoin(e,{action:n}),action:n},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),U(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_"+e.provider+"_"+t.action,null),n=null;return"blocktrades"==e.provider&&"deposit"==t.action&&(n="BTC"),"openledger"==e.provider&&"deposit"==t.action&&(n="BTC"),"blocktrades"==e.provider&&"withdraw"==t.action&&(n="TRADE.BTC"),"openledger"==e.provider&&"withdraw"==t.action&&(n="OPEN.BTC"),a||n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_"+this.props.provider+"_"+this.state.action]=e.target.value,I.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),I.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=t.provider,o=this.state,r=o.activeCoin,l=o.action;if(!a.length)return s.a.createElement(k.a,null);var c=a.filter(function(e){return!(!e||!e.symbol)&&("deposit"===l?e.depositAllowed:e.withdrawalAllowed)}),p=c.map(function(e){var t="deposit"===l?e.backingCoinType.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),d=c.filter(function(e){return"deposit"===l?e.backingCoinType.toUpperCase()===r:e.symbol===r})[0];d||(d=c[0]);var m={blocktrades:{name:"blocktrades",id:"1.2.32567",support:"[email protected]"},openledger:{name:d.intermediateAccount,id:"1.2.96397",support:"https://dex.openledger.io"}}[i],h="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+l}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:r},p))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),d?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(L,{key:i+"."+d.symbol,gateway:i,issuer_account:m.name,account:n,deposit_asset:d.backingCoinType.toUpperCase(),deposit_asset_name:d.name,deposit_coin_type:d.backingCoinType.toLowerCase(),deposit_account:d.depositAccount,deposit_wallet_type:d.walletType,gateFee:d.gateFee,receive_asset:d.symbol,receive_coin_type:d.symbol.toLowerCase(),supports_output_memos:d.supportsMemos,isAvailable:d.isAvailable,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:(-1===m.support.indexOf("@")?"":"mailto:")+m.support,rel:"noopener noreferrer"},m.support))),d&&d.symbol?s.a.createElement(P.b,{asset:d.symbol,fromAccount:h?m.id:this.props.account.get("id"),to:h?this.props.account.get("id"):m.id},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(P.a,{accountsList:W.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),J=Object(i.a)(H,{listenTo:function(){return[j.a]},getProps:function(){return{viewSettings:j.a.getState().viewSettings}}}),z=a(19),G=a(252),V=a.n(G),X=a(332),K=a(304),Y=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Q=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={deposit_amount:null,deposit_info:null,deposit_error:null},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Y(t,[{key:"onDepositAmountChange",value:function(e){var t=e.amount;e.asset;this.setState({deposit_amount:t})}},{key:"onSubmitDeposit",value:function(){var e=this,t=this.props.receive_asset,a=(l.a.get_asset_precision(t.get("precision")),this.state.deposit_amount.replace(/,/g,""));console.log("deposit_amount: ",a);var n={jsonrpc:"2.0",method:"getDepositAccount",params:{bitsharesAccountName:this.props.account.get("name"),currency:this.props.deposit_asset,amount:a},id:1};fetch(this.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(n))}).then(function(e){return e.json()}).then(function(t){"result"in t?e.setState({deposit_info:t.result}):"error"in json_reponse&&"message"in t.error?e.setState({deposit_error:t.error.message}):e.setState({deposit_error:"Unable to approve deposit, please contact OpenLedger or try again later"})}).catch(function(t){e.setState({deposit_error:"Unable to approve deposit, please contact OpenLedger or try again later"})})}},{key:"onClose",value:function(){this.setState({deposit_amount:null,deposit_info:null,deposit_error:null}),y.a.publish(this.props.modal_id,"close")}},{key:"render",value:function(){if(this.state.deposit_error)return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit Error")),s.a.createElement("div",{className:"content-block"},s.a.createElement("p",null,this.state.deposit_error)),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onClose.bind(this),value:"Close"}))));if(this.state.deposit_info){if("link"in this.state.deposit_info)return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit Information")),s.a.createElement("div",{className:"content-block"},s.a.createElement("p",null,"Click"," ",s.a.createElement("a",{href:this.state.deposit_info.link,rel:"noopener noreferrer",target:"_blank"},"here")," ","for deposit instructions")),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onClose.bind(this),value:"Close"}))));var e=[];for(var t in this.state.deposit_info)this.state.deposit_info.hasOwnProperty(t)&&e.push(s.a.createElement("tr",null,s.a.createElement("td",null,t),s.a.createElement("td",null,this.state.deposit_info[t])));return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit Information")),s.a.createElement("div",{className:"content-block"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,e))),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onClose.bind(this),value:S.a.translate("account.perm.cancel")}))))}return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit ",this.props.deposit_asset)),s.a.createElement("div",{className:"content-block"},s.a.createElement(K.a,{label:"modal.deposit.amount",amount:this.state.deposit_amount,asset:this.props.receive_asset.get("id"),assets:[this.props.receive_asset.get("id")],placeholder:"0.0",onChange:this.onDepositAmountChange.bind(this),display_balance:null})),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitDeposit.bind(this),value:S.a.translate("modal.deposit.submit")}),s.a.createElement("input",{type:"submit",className:" button",onClick:this.onClose.bind(this),value:S.a.translate("account.perm.cancel")}))))}}]),t}();Q.propTypes={account:p.a.ChainAccount.isRequired,issuer_account:p.a.ChainAccount.isRequired,deposit_asset:N.a.string,receive_asset:p.a.ChainAsset.isRequired,rpc_url:N.a.string};var Z=Object(d.a)(Q),$=a(47),ee=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var te=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={withdraw_amount:null},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),ee(t,[{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;e.asset;this.setState({withdraw_amount:t})}},{key:"onSubmit",value:function(){var e=this,t=this.props.receive_asset,a=l.a.get_asset_precision(t.get("precision")),n=this.state.withdraw_amount.replace(/,/g,""),s={jsonrpc:"2.0",method:"getMemoForFiatWithdrawal",params:{bitsharesAccountName:this.props.account.get("name"),currency:this.props.deposit_asset,amount:n},id:1};fetch(this.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(s))}).then(function(e){return e.json()}).then(function(s){if(!("result"in s))throw"error"in s&&"message"in s.error?json_repsonse.error.message:"Unable to approve withdrawal, please contact OpenLedger or try again later";$.a.transfer(e.props.account.get("id"),e.props.issuer_account.get("id"),parseInt(n*a,10),t.get("id"),s.result)}).catch(function(e){alert(e)})}},{key:"render",value:function(){var e=null,t=this.props.account.get("balances").toJS();if(Object.keys(t).length>0){var a=this.props.receive_asset.get("id");e=a?s.a.createElement("span",null,s.a.createElement(u.a,{component:"span",content:"transfer.available"}),":"," ",s.a.createElement(X.a,{balance:t[a]})):"No funds"}else e="No funds";return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Withdraw ",this.props.deposit_asset)),s.a.createElement("div",{className:"content-block"},s.a.createElement(K.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.receive_asset.get("id"),assets:[this.props.receive_asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:e})),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmit.bind(this),value:S.a.translate("modal.withdraw.submit")}),s.a.createElement(V.a,{close:this.props.modal_id},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"account.perm.cancel"}))))))}}]),t}();te.propTypes={account:p.a.ChainAccount.isRequired,issuer_account:p.a.ChainAccount.isRequired,deposit_asset:N.a.string,receive_asset:p.a.ChainAsset.isRequired,rpc_url:N.a.string};var ae=Object(d.a)(te),ne=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ie(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function oe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var re=function(e){function t(e){se(this,t);var a=ie(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={},a}return oe(t,s.a.Component),ne(t,[{key:"getWithdrawModalId",value:function(){return"withdraw_fiat_openledger_"+this.props.receive_asset.get("symbol")}},{key:"getDepositModalId",value:function(){return"deposit_fiat_openledger_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"onDeposit",value:function(){y.a.publish(this.getDepositModalId(),"open")}},{key:"render",value:function(){if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return s.a.createElement("tr",{style:{display:"none"}},s.a.createElement("td",null),s.a.createElement("td",null),s.a.createElement("td",null),s.a.createElement("td",null));z.a.getWallet();var e=this.props.account.get("balances"),t=(this.props.receive_asset.get("symbol"),e.toJS());if(Object.keys(t).length>0){var a=this.props.receive_asset.get("id");a&&s.a.createElement("span",null,s.a.createElement(u.a,{component:"span",content:"transfer.available"}),":"," ",s.a.createElement(X.a,{balance:t[a]}))}var n=this.getDepositModalId(),i=this.getWithdrawModalId(),o=null;o=this.props.deposit_allowed?s.a.createElement("td",null,s.a.createElement("button",{className:"button outline",onClick:this.onDeposit.bind(this)}," ",s.a.createElement(u.a,{content:"gateway.deposit"})," "),s.a.createElement(_.a,{id:n,overlay:!0},s.a.createElement(V.a,{close:n},s.a.createElement("a",{href:"#",className:"close-button"},"×")),s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(Z,{account:this.props.account.get("name"),issuer_account:this.props.issuer_account.get("name"),receive_asset:this.props.receive_asset.get("symbol"),rpc_url:this.props.rpc_url,deposit_asset:this.props.deposit_asset,modal_id:n})))):s.a.createElement("td",null,"Click"," ",s.a.createElement("a",{href:"https://openledger.info/v/",rel:"noopener noreferrer",target:"_blank"},"here")," ","to register for deposits of ",this.props.deposit_asset);var r=null;return r=this.props.withdraw_allowed?s.a.createElement("td",null,s.a.createElement("button",{className:"button outline",onClick:this.onWithdraw.bind(this)}," ",s.a.createElement(u.a,{content:"gateway.withdraw"})," "),s.a.createElement(_.a,{id:i,overlay:!0},s.a.createElement(V.a,{close:i},s.a.createElement("a",{href:"#",className:"close-button"},"×")),s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(ae,{account:this.props.account.get("name"),issuer_account:this.props.issuer_account.get("name"),receive_asset:this.props.receive_asset.get("symbol"),rpc_url:this.props.rpc_url,deposit_asset:this.props.deposit_asset,modal_id:i})))):s.a.createElement("td",null,"Click"," ",s.a.createElement("a",{href:"https://openledger.info/v/",rel:"noopener noreferrer",target:"_blank"},"here")," ","to register for withdrawals of ",this.props.deposit_asset),s.a.createElement("tr",null,s.a.createElement("td",null,this.props.deposit_asset),o,s.a.createElement("td",null,s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol")})),r)}}]),t}();re.propTypes={url:N.a.string,gateway:N.a.string,deposit_coin_type:N.a.string,deposit_asset_name:N.a.string,deposit_account:N.a.string,receive_coin_type:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:N.a.string,receive_asset:p.a.ChainAsset,deposit_allowed:N.a.bool,withdraw_allowed:N.a.bool},re=Object(d.a)(re);var le=function(e){function t(e){se(this,t);var a=ie(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));a.state={allowedFiatCurrencies:{deposit:[],withdraw:[]}};var n={jsonrpc:"2.0",id:1,method:"isValidatedForFiat",params:{bitsharesAccountName:a.props.account.get("name")}};return fetch(a.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(n))}).then(function(e){return e.json()}).then(function(e){"result"in e&&a.setState({allowedFiatCurrencies:e.result})}).catch(function(e){a.setState({allowedFiatCurrencies:{deposit:[],withdraw:[]}})}),a}return oe(t,s.a.Component),ne(t,[{key:"componentWillUnmount",value:function(){clearInterval(this.update_timer)}},{key:"render",value:function(){return this.props.account&&this.props.issuer_account,s.a.createElement("div",null)}}]),t}();le.propTypes={rpc_url:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount};var ce=le=Object(d.a)(le),ue=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var pe=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={current_status:"never_loaded",withdrawals:null,deposits:null,error:null},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),ue(t,[{key:"onShowOpenLedgerTransactionHistory",value:function(){var e=this,t={jsonrpc:"2.0",method:"getRequestsList",params:{bitsharesAccountName:this.props.account.get("name")},id:1};fetch(this.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(t))}).then(function(e){return e.json()}).then(function(t){if(!("result"in t))throw"error"in t&&"message"in t.error?json_repsonse.error.message:"Unexpected response";e.setState({current_status:"loaded",withdrawals:t.result.withdrawals,deposits:t.result.deposits,error:null})}).catch(function(t){e.setState({current_status:"error",withdrawals:null,deposits:null,error:"Error getting transaction history: "+t})})}},{key:"render",value:function(){if(!this.props.account)return null;var e=null;if("loaded"===this.state.current_status){var t=[];if(this.state.withdrawals.length){for(var a=0;a<this.state.withdrawals.length;++a)t.push(s.a.createElement("tr",null,s.a.createElement("td",null,this.state.withdrawals[a].amount," ",this.state.withdrawals[a].currency),s.a.createElement("td",null,this.state.withdrawals[a].status)));e=s.a.createElement("table",{className:"table"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.withdraw_amount"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.status"})))),s.a.createElement("tbody",null,t))}else e=s.a.createElement(u.a,{component:"p",content:"openledger.withdraw_none"})}var n=null;if("loaded"===this.state.current_status)if(this.state.deposits.length){var i=[];for(a=0;a<this.state.deposits.length;++a)i.push(s.a.createElement("tr",null,s.a.createElement("td",null,this.state.deposits[a].amount," ",this.state.deposits[a].currency),s.a.createElement("td",null,s.a.createElement("a",{href:this.state.deposits[a].link,rel:"noopener noreferrer",target:"_blank"},"link")),s.a.createElement("td",null,this.state.deposits[a].status)));n=s.a.createElement("table",{className:"table"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.deposit_amount"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.deposit_details"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.status"})))),s.a.createElement("tbody",null,i))}else n=s.a.createElement(u.a,{component:"p",content:"openledger.deposit_none"});var o=null;if("error"===this.state.current_status)o=s.a.createElement("div",{className:"content-block"},s.a.createElement("button",{className:"button outline",onClick:this.onShowOpenLedgerTransactionHistory.bind(this)},s.a.createElement(u.a,{content:"openledger.retry"})),s.a.createElement("p",null,this.state.error));else if("loading"===this.state.current_status)o=s.a.createElement("div",{className:"content-block"},s.a.createElement("button",{className:"button outline",onClick:this.onShowOpenLedgerTransactionHistory.bind(this),disabled:"true"},s.a.createElement(u.a,{content:"openledger.show_transaction_history"})),s.a.createElement(u.a,{component:"p",content:"openledger.loading"}));else{var r="never_loaded"===this.state.current_status?s.a.createElement(u.a,{content:"openledger.show_transaction_history"}):s.a.createElement(u.a,{content:"openledger.refresh_transaction_history"});o=s.a.createElement("div",{className:"content-block"},s.a.createElement("br",null),s.a.createElement(u.a,{component:"h4",content:"openledger.header_transaction_history"}),s.a.createElement("button",{className:"button outline",onClick:this.onShowOpenLedgerTransactionHistory.bind(this)},r),e,n)}return o}}]),t}();pe.propTypes={rpc_url:N.a.string,account:p.a.ChainAccount};var de=Object(d.a)(pe),me=(a(1948),a(98)),he=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var _e=new me.a("__bts__"),fe=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_citadel_address_cache_version_string="2"}return he(e,[{key:"getIndexForDepositKeyInExchange",value:function(e,t,a){return[this.current_citadel_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a,n){var s=z.a.getWallet(),i=this.getIndexForDepositKeyInExchange(t,a,n);if(s){s.deposit_keys=s.deposit_keys||{},s.deposit_keys[e]=s.deposit_keys[e]||{},s.deposit_keys[e][i]=s.deposit_keys[e][i]||[];var o=s.deposit_keys[e][i].length;return o?s.deposit_keys[e][i][o-1]:null}var r=_e.get("deposit_keys",{});r[e]=r[e]||{},r[e][i]=r[e][i]||[];var l=r[e][i].length;return l?r[e][i][l-1]:null}},{key:"cacheInputAddress",value:function(e,t,a,n,s,i){if(s){var o=z.a.getWallet(),r=this.getIndexForDepositKeyInExchange(t,a,n);if(o)delete o.deposit_keys.undefined,Object.keys(o.deposit_keys||{}).forEach(function(e){for(var t in o.deposit_keys[e])if(o.deposit_keys[e][t]&&o.deposit_keys[e][t].length)for(var a=o.deposit_keys[e][t].length-1;a>=0;a--)o.deposit_keys[e][t][a]&&"unknown"===o.deposit_keys[e][t][a].address&&o.deposit_keys[e][t].splice(a,1)}),o.deposit_keys=o.deposit_keys||{},o.deposit_keys[e]=o.deposit_keys[e]||{},o.deposit_keys[e][r]=o.deposit_keys[e][r]||[],o.deposit_keys[e][r].push({address:s,memo:i}),z.a._updateWallet();else{var l=_e.get("deposit_keys",{});l[e]=l[e]||{},l[e][r]=l[e][r]||[],l[e][r].push({address:s,memo:i}),_e.set("deposit_keys",l)}}}}]),e}(),ye=(a(101),a(142)),ge=a(28),we=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,s=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(n=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);n=!0);}catch(e){s=!0,i=e}finally{try{!n&&r.return&&r.return()}finally{if(s)throw i}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),ve=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function be(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ke(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function Ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Se=function(e){function t(){return Ee(this,t),ke(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Ce(t,s.a.Component),ve(t,[{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"render",value:function(){var e=this.getWithdrawModalId(),t="button disabled";return Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))&&this.props.amount_to_withdraw&&!(this.props.amount_to_withdraw.indexOf(" ")>=0)&&!isNaN(this.props.amount_to_withdraw)&&this.props.amount_to_withdraw>0&&this.props.amount_to_withdraw<=this.props.balance.toJS().balance/l.a.get_asset_precision(this.props.asset.get("precision"))&&(t="button"),s.a.createElement("span",null,s.a.createElement("span",null,s.a.createElement("button",{className:t,onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:""}),s.a.createElement(u.a,{content:"gateway.withdraw_now"})," ")),s.a.createElement(_.a,{id:e,overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(h.a,{key:""+this.props.key,account:this.props.account.get("name"),issuer:this.props.issuer,asset:this.props.asset.get("id"),output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,modal_id:e,url:this.props.url,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]}))))}}]),t}();Se.propTypes={balance:p.a.ChainObject,url:N.a.string.isRequired},Se=Object(d.a)(Se);var Ae=function(e){function t(){return Ee(this,t),ke(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Ce(t,s.a.Component),ve(t,[{key:"render",value:function(){var e=s.a.createElement(Se,{key:this.props.key,account:this.props.account,issuer:this.props.issuer,asset:this.props.asset,output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,url:this.props.url,gateway:this.props.gateway,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]});return s.a.createElement("span",null,e)}}]),t}();Ae.propTypes={account:p.a.ChainAccount.isRequired,asset:p.a.ChainAsset.isRequired,output_coin_type:N.a.string.isRequired,url:N.a.string.isRequired},Ae=Object(d.a)(Ae);var Ne=function(e){function t(e){Ee(this,t);var a=ke(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.refresh_interval=12e4,a.deposit_address_cache=new fe,a.coin_info_request_states={request_in_progress:0,request_complete:1,request_failed:2},a.estimation_directions={output_from_input:0,input_from_output:1},a.state={coin_symbol:"xmr",key_for_withdrawal_dialog:"xmr",supports_output_memos:"",url:E.b.BASE,error:null,deposit_input_coin_type:null,deposit_output_coin_type:null,input_address_and_memo:null,deposit_estimated_input_amount:a.props.initial_deposit_estimated_input_amount||"1.0",deposit_estimated_output_amount:null,deposit_limit:null,deposit_error:null,failed_calculate_deposit:null,withdraw_input_coin_type:null,withdraw_output_coin_type:null,withdraw_estimated_input_amount:a.props.initial_withdraw_estimated_input_amount||"1.0",withdraw_estimated_output_amount:null,withdraw_limit:null,withdraw_error:null,failed_calculate_withdraw:null,coin_info_request_state:a.coin_info_request_states.request_in_progress,input_address_requests_in_progress:{},deposit_estimate_direction:a.estimation_directions.output_from_input,deposit_limit_cache:{},deposit_limit_requests_in_progress:{},coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,announcements:[]},a}return Ce(t,s.a.Component),ve(t,[{key:"urlConnection",value:function(e,t){var a=this;this.setState({url:e});var n=fetch(e+"/coins",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),s=fetch(e+"/wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),i=fetch(e+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),o=fetch(e+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([n,s,i,o]).then(function(e){var t=we(e,4),n=t[0],s=(t[1],t[2]),i=t[3],o={};n.forEach(function(e){return o[e.coinType]=e});var r={},l={};s.forEach(function(e){var t=o[e.inputCoinType],a=o[e.outputCoinType];(t.backingCoinType!=e.outputCoinType||a.backingCoinType!=e.inputCoinType&&0==t.restricted&&0==a.restricted)&&-1!=i.indexOf(t.walletType)&&-1!=i.indexOf(a.walletType)&&("bitshares2"!=t.walletType&&"bitshares2"==a.walletType?(r[e.inputCoinType]=r[e.inputCoinType]||[],r[e.inputCoinType].push(e.outputCoinType)):(l[e.inputCoinType]=l[e.inputCoinType]||[],l[e.inputCoinType].push(e.outputCoinType)))});var c=null,u=null,p=Object.keys(r);if(p.forEach(function(e){r[e].sort()}),p.length){c=a.props.initial_deposit_input_coin_type&&a.props.initial_deposit_input_coin_type in r?a.props.initial_deposit_input_coin_type:p[0];var d=r[c];u=a.props.initial_deposit_output_coin_type&&-1!=d.indexOf(a.props.initial_deposit_output_coin_type)?a.props.initial_deposit_output_coin_type:d[0]}var m=null,h=null,_=Object.keys(l);if(_.forEach(function(e){l[e].sort()}),_.length){m=a.props.initial_withdraw_input_coin_type&&a.props.initial_withdraw_input_coin_type in l?a.props.initial_withdraw_input_coin_type:_[0];var f=l[m];h=a.props.initial_withdraw_output_coin_type&&-1!=f.indexOf(a.props.initial_withdraw_output_coin_type)?a.props.initial_withdraw_output_coin_type:f[0]}var y=a.getCachedOrGeneratedInputAddress(c,u),g=a.getCachedOrFreshDepositLimit("deposit",c,u),w=a.getAndUpdateOutputEstimate("deposit",c,u,a.state.deposit_estimated_input_amount),v=a.getAndUpdateOutputEstimate("withdraw",m,h,a.state.withdraw_estimated_input_amount),b=a.getCachedOrFreshDepositLimit("withdraw",m,h);a.unMounted||a.setState({coin_info_request_state:a.coin_info_request_states.request_complete,coins_by_type:o,allowed_mappings_for_deposit:r,allowed_mappings_for_withdraw:l,deposit_input_coin_type:c,deposit_output_coin_type:u,input_address_and_memo:y,deposit_limit:g,deposit_estimated_output_amount:w,deposit_estimate_direction:a.estimation_directions.output_from_input,withdraw_input_coin_type:m,withdraw_output_coin_type:h,withdraw_limit:b,withdraw_estimated_output_amount:v,withdraw_estimate_direction:a.estimation_directions.output_from_input,supports_output_memos:o.xmr.supportsOutputMemos})}).catch(function(e){a.setState({coin_info_request_state:t,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null})})}},{key:"updateEstimates",value:function(){if(this.state.deposit_input_coin_type&&this.state.deposit_output_coin_type){var e=this.getCachedOrGeneratedInputAddress(this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),t=this.getCachedOrFreshDepositLimit("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),a=this.state.deposit_estimated_input_amount,n=this.state.deposit_estimated_output_amount;this.state.deposit_estimate_direction==this.estimation_directions.output_from_input?n=this.getAndUpdateOutputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,a):a=this.getAndUpdateInputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,n);var s=this.getCachedOrFreshDepositLimit("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type),i=this.state.withdraw_estimated_input_amount,o=this.state.withdraw_estimated_output_amount;this.state.withdraw_estimate_direction==this.estimation_directions.output_from_input?o=this.getAndUpdateOutputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,i):i=this.getAndUpdateinputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,o),this.setState({input_address_and_memo:e,deposit_limit:t,deposit_estimated_input_amount:a,deposit_estimated_output_amount:n,withdraw_limit:s,withdraw_estimated_input_amount:i,withdraw_estimated_output_amount:o,key_for_withdrawal_dialog:i})}}},{key:"componentWillMount",value:function(){var e=this,t=this.state.url;this.urlConnection(t,0);var a=fetch(t+"/coins",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),n=fetch(t+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),s=fetch(t+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([a,n,s]).then(function(e){var t=we(e,3),a=t[0],n=t[1],s=t[2],i={};a.forEach(function(e){return i[e.coinType]=e}),n.forEach(function(e){var t=i[e.inputCoinType],a=i[e.outputCoinType];t.backingCoinType!=e.outputCoinType&&a.backingCoinType!=e.inputCoinType&&-1!=s.indexOf(t.walletType)&&s.indexOf(a.walletType)})}).catch(function(t){e.urlConnection("https://citadel.li/trade",2),e.setState({coin_info_request_state:0,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null})})}},{key:"componentDidMount",value:function(){this.update_timer=setInterval(this.updateEstimates.bind(this),this.refresh_interval)}},{key:"componentWillUnmount",value:function(){clearInterval(this.update_timer),this.unMounted=!0}},{key:"getCachedInputAddress",value:function(e,t,a){var n=this.props.account.get("name");return this.deposit_address_cache.getCachedInputAddress(this.props.gateway,n,e,t)}},{key:"cacheInputAddress",value:function(e,t,a,n){var s=this.props.account.get("name");this.deposit_address_cache.cacheInputAddress(this.props.gateway,s,e,t,a,n)}},{key:"getCachedOrGeneratedInputAddress",value:function(e,t){var a=this,n=this.getCachedInputAddress(e,t);if(n)return n;if(this.state.input_address_requests_in_progress[e]=this.state.input_address_requests_in_progress[e]||{},this.state.input_address_requests_in_progress[e][t])return null;var s=JSON.stringify({inputCoinType:e,outputCoinType:t,outputAddress:this.props.account.get("name")});return this.state.input_address_requests_in_progress[e][t]=!0,fetch(this.state.url+"/simple-api/initiate-trade",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:s}).then(function(n){n.json().then(function(n){if(console.assert(n.inputCoinType==e,"unexpected reply from initiate-trade"),console.assert(n.outputCoinType==t,"unexpected reply from initiate-trade"),n.inputCoinType!=e||n.outputCoinType!=t)throw Error("unexpected reply from initiate-trade");a.cacheInputAddress(n.inputCoinType,n.outputCoinType,n.inputAddress,n.inputMemo),delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==n.inputCoinType&&a.state.deposit_output_coin_type==n.outputCoinType&&a.setState({input_address_and_memo:{address:n.inputAddress,memo:n.inputMemo}})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})}),null}},{key:"getCachedDepositLimit",value:function(e,t){if(this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]){var a=this.state.deposit_limit_cache[e][t];if(new Date-a.timestamp<this.refresh_interval)return a;delete this.state.deposit_limit_cache[e][t]}return null}},{key:"cacheDepositLimit",value:function(e,t,a){a.timestamp=new Date,this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]=a}},{key:"getCachedOrFreshDepositLimit",value:function(e,t,a){var n=this,s=this.getCachedDepositLimit(t,a);if(s)return s;this.state.deposit_limit_requests_in_progress[t]=this.state.input_address_requests_in_progress[t]||{},this.state.deposit_limit_requests_in_progress[t][a]=!0;var i=this.state.url+"/deposit-limits?inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(s){if(!n.unMounted){if(console.assert(s.inputCoinType==t&&s.outputCoinType==a,"unexpected reply from deposit-limits"),s.inputCoinType!=t||s.outputCoinType!=a)throw Error("unexpected reply from deposit-limits");var i={timestamp:new Date,limit:s.depositLimit};n.cacheDepositLimit(t,a,i),delete n.state.deposit_limit_requests_in_progress[t][a],n.state[e+"_input_coin_type"]==t&&n.state[e+"_output_coin_type"]==a&&n.setState(be({},e+"_limit",i))}},function(e){delete n.state.deposit_limit_requests_in_progress[t][a]}),null}},{key:"getAndUpdateOutputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null});var i=this.state.url+"/estimate-output-amount?inputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(i){if(!s.unMounted)if(i.error){if(s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input){var o=i.error.message;"deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"});o.startsWith("Internal Server Error: ")&&(o=o.substr("Internal Server Error: ".length)),s.setState(be({},e+"_error",o))}}else{var r,l;if(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.inputAmount==n,"unexpected reply from estimate-output-amount"),i.inputCoinType!=t||i.outputCoinType!=a||i.inputAmount!=n)s.setState((be(r={},e+"_estimated_output_amount",i.outputAmount),be(r,e+"_error",null),r));if(s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input)s.setState((be(l={},e+"_estimated_output_amount",i.outputAmount),be(l,e+"_error",null),l))}},function(e){}),null}}},{key:"getAndUpdateInputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null});var i=this.state.url+"/estimate-input-amount?outputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(i){var o;s.unMounted||(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n,"unexpected reply from estimate-input-amount"),i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n||("deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"})),s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_output_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.input_from_output&&s.setState((be(o={},e+"_estimated_input_amount",i.inputAmount),be(o,"key_for_withdrawal_dialog",i.inputAmount),o)))},function(e){}),null}}},{key:"onInputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((be(a={},e+"_estimated_input_amount",n),be(a,e+"_estimated_output_amount",s),be(a,e+"_estimate_direction",this.estimation_directions.output_from_input),be(a,"key_for_withdrawal_dialog",n),a))}},{key:"onOutputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((be(a={},e+"_estimated_output_amount",n),be(a,e+"_estimated_input_amount",s),be(a,e+"_estimate_direction",this.estimation_directions.input_from_output),a))}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"onInputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state["allowed_mappings_for_"+e][o],l=r[0];-1!=r.indexOf(this.state[e+"_output_coin_type"])&&(l=this.state[e+"_output_coin_type"]);var c=this.state.input_address_and_memo;"deposit"==e&&(c=this.getCachedOrGeneratedInputAddress(o,l));var u=this.getCachedOrFreshDepositLimit(e,o,l);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,o,l,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,o,l,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),"withdraw"==e&&r.forEach(function(e){l===e&&n.setState({coin_symbol:o+"input",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos})}),this.setState((be(a={},e+"_input_coin_type",o),be(a,e+"_output_coin_type",l),be(a,"input_address_and_memo",c),be(a,e+"_limit",u),be(a,e+i,s),be(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"onOutputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type];"withdraw"==e&&r.forEach(function(e){o===e&&n.setState({coin_symbol:o+"output",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos,key_for_withdrawal_dialog:o})});var l=this.state.input_address_and_memo;"deposit"==e&&(l=this.getCachedOrGeneratedInputAddress(this.state[e+"_input_coin_type"],o));var c=this.getCachedOrFreshDepositLimit(e,this.state[e+"_input_coin_type"],o);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),this.setState((be(a={},e+"_output_coin_type",o),be(a,"input_address_and_memo",l),be(a,e+"_limit",c),be(a,e+i,s),be(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"render",value:function(){var e=this;if(!this.props.account||!this.props.issuer_account||!this.props.gateway)return s.a.createElement("div",null);var t=void 0,a=void 0,n=void 0,i=void 0,o=void 0;if(this.state.coin_info_request_state==this.coin_info_request_states.request_failed)return s.a.createElement("div",null,s.a.createElement("p",null,"Error connecting to citadel.li, please try again later"));if(this.state.coin_info_request_state==this.coin_info_request_states.never_requested||this.state.coin_info_request_state==this.coin_info_request_states.request_in_progress)return s.a.createElement("div",null,s.a.createElement("p",null,"Retrieving current trade data from citadel.li"));var r=null,c=s.a.createElement(u.a,{content:"gateway.calc"});null!=this.state.failed_calculate_deposit&&(c=this.state.failed_calculate_deposit);var p=s.a.createElement(u.a,{content:"gateway.calc"});null!=this.state.failed_calculate_withdraw&&(p=this.state.failed_calculate_withdraw);s.a.createElement(u.a,{content:"gateway.calc"});if(null!=this.state.failed_calculate_conversion&&this.state.failed_calculate_conversion,Object.getOwnPropertyNames(this.state.allowed_mappings_for_deposit).length>0){var d=[];Object.keys(this.state.allowed_mappings_for_deposit).sort().forEach(function(t){d.push(s.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].symbol))});var m=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.deposit_input_coin_type||"",onChange:this.onInputCoinTypeChanged.bind(this,"deposit")},d),h=[];this.state.allowed_mappings_for_deposit[this.state.deposit_input_coin_type].forEach(function(t){h.push(s.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].walletSymbol))});var _=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.deposit_output_coin_type||"",onChange:this.onOutputCoinTypeChanged.bind(this,"deposit")},h),f=this.state.input_address_and_memo?this.state.input_address_and_memo:{address:"unknown",memo:null},y=this.state.deposit_estimated_input_amount,w=this.state.deposit_estimated_output_amount,v=y?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:y||"",onChange:this.onInputAmountChanged.bind(this,"deposit")}):c,b=w?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:w||"",onChange:this.onOutputAmountChanged.bind(this,"deposit")}):c,E=s.a.createElement("span",null,"updating");this.state.deposit_limit&&(E=this.state.deposit_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(u.a,{content:"gateway.limit",amount:l.a.format_number(this.state.deposit_limit.limit,8),symbol:this.state.coins_by_type[this.state.deposit_input_coin_type].walletSymbol}))):null);var k=null;this.state.deposit_error&&(k=s.a.createElement("div",null,this.state.deposit_error)),n=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.deposit"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.balance"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.state.deposit_input_coin_type}))));var C=null;C=f.memo?s.a.createElement(u.a,{unsafe:!0,content:"gateway.address_with_memo",address:f.address,memo:f.memo}):s.a.createElement("span",null,f.address),a=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge",style:{display:"flex",alignItems:"center"}},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,m),s.a.createElement("div",null,v)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,_),s.a.createElement("div",null,b)),s.a.createElement("div",null,k))),s.a.createElement("td",null,s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.deposit_output_coin_type].walletSymbol})),s.a.createElement("td",{style:{wordBreak:"break-all"}},C,s.a.createElement("br",null),E)))}if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_withdraw).length>0){this.getWithdrawModalId();this.state.coins_by_type[this.state.withdraw_input_coin_type].symbol;r=this.state.withdraw_estimated_input_amount;var S=[];Object.keys(this.state.allowed_mappings_for_withdraw).sort().forEach(function(t){S.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].walletSymbol))});var A=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.withdraw_input_coin_type,onChange:this.onInputCoinTypeChanged.bind(this,"withdraw")},S),N=[];this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type].forEach(function(t){N.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].symbol))});var O=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.withdraw_output_coin_type,onChange:this.onOutputCoinTypeChanged.bind(this,"withdraw")},N),T=this.state.withdraw_estimated_input_amount,x=T?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:T||"",onChange:this.onInputAmountChanged.bind(this,"withdraw")}):p,j=this.state.withdraw_estimated_output_amount,I=j?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:j||"",onChange:this.onOutputAmountChanged.bind(this,"withdraw")}):p,P=s.a.createElement(Ae,{key:this.state.key_for_withdrawal_dialog,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol,output_coin_name:this.state.coins_by_type[this.state.withdraw_output_coin_type].name,output_coin_symbol:this.state.coins_by_type[this.state.withdraw_output_coin_type].symbol,output_coin_type:this.state.withdraw_output_coin_type,output_supports_memos:this.state.supports_output_memos,amount_to_withdraw:r,url:this.state.url,gateway:this.props.gateway,output_wallet_type:this.state.coins_by_type[this.state.withdraw_output_coin_type].walletType}),D=null;this.state.withdraw_error&&(D=s.a.createElement("div",null,this.state.withdraw_error));var W=s.a.createElement("span",null,"...");this.state.withdraw_limit&&(W=this.state.withdraw_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(u.a,{content:"gateway.limit",amount:l.a.format_number(this.state.withdraw_limit.limit,8),symbol:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol}))):s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},"no limit"))),o=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.withdraw"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.balance"})),s.a.createElement("th",null))),i=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,A),s.a.createElement("div",null,x)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,O),s.a.createElement("div",null,I)),s.a.createElement("div",null,D))),s.a.createElement("td",null,s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol})),s.a.createElement("td",null,P,s.a.createElement("br",null),W)))}return this.state.announcements.length>0&&(t=s.a.createElement("div",{className:"blocktrades-announcements-container"},this.state.announcements.map(function(e,t){var a="txtann info";return 10===e.status?a="txtann error":20===e.status?a="txtann warning":30===e.status?a="txtann success":40===e.status&&(a="txtann info"),1===e.format&&e.message.replace(/\r\n|\r|\n/g,"<br />"),s.a.createElement("div",{className:"blocktrades-announcements "+a,key:t},e.message)},this))),s.a.createElement("div",null,s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement(u.a,{component:"h5",content:"gateway.bridge_text"})),t,s.a.createElement("table",{className:"table"},n,a,o,i))}}]),t}();Ne.propTypes={url:N.a.string,gateway:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,initial_deposit_input_coin_type:N.a.string,initial_deposit_output_coin_type:N.a.string,initial_deposit_estimated_input_amount:N.a.string,initial_withdraw_input_coin_type:N.a.string,initial_withdraw_output_coin_type:N.a.string,initial_withdraw_estimated_input_amount:N.a.string};Object(d.a)(Ne);var Oe=a(526),Te=a(26),xe=a(1949),je=a(1950),Ie=a(527),Pe=a.n(Ie),De=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var We=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_rudex_address_cache_version_string="1"}return De(e,[{key:"getIndexForDepositKeyInExchange",value:function(e,t,a){return[this.current_rudex_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a,n){var s=z.a.getWallet();if(!s)return null;s.deposit_keys=s.deposit_keys||{},s.deposit_keys[e]=s.deposit_keys[e]||{};var i=this.getIndexForDepositKeyInExchange(t,a,n);s.deposit_keys[e][i]=s.deposit_keys[e][i]||[];var o=s.deposit_keys[e][i].length;return o?s.deposit_keys[e][i][o-1]:null}},{key:"cacheInputAddress",value:function(e,t,a,n,s,i){var o=z.a.getWallet();if(!o)return null;o.deposit_keys=o.deposit_keys||{},o.deposit_keys[e]=o.deposit_keys[e]||{};var r=this.getIndexForDepositKeyInExchange(t,a,n);o.deposit_keys[e][r]=o.deposit_keys[e][r]||[],o.deposit_keys[e][r].push({address:s,memo:i}),z.a._updateWallet()}}]),e}(),Be=a(1828),Fe=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Re=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.deposit_address_cache=new We,a.state={account_name:null,receive_address:null},a.addDepositAddress=a.addDepositAddress.bind(a),a._copy=a._copy.bind(a),document.addEventListener("copy",a._copy),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Fe(t,[{key:"_copy",value:function(e){try{this.state.clipboardText?e.clipboardData.setData("text/plain",this.state.clipboardText):e.clipboardData.setData("text/plain",S.a.translate("gateway.use_copy_button").toUpperCase()),e.preventDefault()}catch(e){console.error(e)}}},{key:"_getDepositObject",value:function(){return{walletType:this.props.deposit_wallet_type,inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),stateCallback:this.addDepositAddress}}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"addDepositAddress",value:function(e){var t=this.props.account.get("name");this.setState({account_name:t}),this.setState({receive_address:e})}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e=s.a.createElement("div",{style:{display:"none",minHeight:150}});if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return e;var t=this.props.account.get("balances");if(this.props.deprecated_in_favor_of){var a=!1,n=t.get(this.props.receive_asset.get("id"));if(n){var i=m.ChainStore.getObject(n);if(i)0!=i.get("balance")&&(a=!0)}if(!a)return e}var o=null;if(this.state.account_name===this.props.account.get("name")&&(o=this.state.receive_address),!o)this.props.account.get("name");if(!o)return Object(Be.b)(this._getDepositObject()),e;var r=null;this.props.confirmations&&this.props.confirmations.type&&("irreversible"===this.props.confirmations.type?r=s.a.createElement(u.a,{content:"gateway.rudex.confirmations.last_irreversible"}):"blocks"===this.props.confirmations.type&&this.props.confirmations.value&&(r=s.a.createElement(u.a,{content:"gateway.rudex.confirmations.n_blocks",blocks:this.props.confirmations.value})));var c=this.getWithdrawModalId(),p=null,d=null,h="",_=void 0;if(this.props.deposit_account){p=s.a.createElement("span",null,this.props.deposit_account),h=this.props.deposit_account,_=this.props.memo_version&&2===this.props.memo_version?"btsid-"+this.props.account.get("id").replace("1.2.",""):"dex:"+this.props.account.get("name"),d=s.a.createElement("span",null,_);var f=this.props.deposit_coin_type+":"}else{o.memo?(_=o.memo,h=o.address,p=s.a.createElement("span",null,o.address),d=s.a.createElement("span",null,o.memo)):(h=o.address,p=s.a.createElement("span",null,o.address));f=""}var y=l.a.format_number(this.props.min_amount/l.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1);if("deposit"===this.props.action){var b=s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),E=s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"left-label"},s.a.createElement("b",null,s.a.createElement(u.a,{content:"gateway.rudex.min_amount",minAmount:y,symbol:this.props.deposit_coin_type}))),r?s.a.createElement("span",null,"(",s.a.createElement("i",null,r),")"):null,s.a.createElement("div",{style:{padding:"10px 0",fontSize:"1.1rem"}},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{style:{textTransform:"uppercase"},content:"gateway.address"}),": ",s.a.createElement("b",null,p))),d?s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{style:{textTransform:"uppercase"},content:"gateway.memo"}),": ",s.a.createElement("b",null,d))):null)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},p?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,h)},s.a.createElement(u.a,{content:"gateway.copy_address"})):null,_?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,_)},s.a.createElement(u.a,{content:"gateway.copy_memo"})):null),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_amount",minDeposit:y,coin:this.props.deposit_asset}),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_asset",minDeposit:y,coin:this.props.deposit_asset})));return this.props.deposit_allowed||(E=s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement(u.a,{className:"has-error fz_14",component:"h1",content:"gateway.rudex.deposit_disabled"}))),s.a.createElement("div",{className:"rudex__gateway grid-block no-padding no-margin"},b,E)}var k=s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),C=s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," ")));return this.props.withdraw_allowed||(C=s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement(u.a,{className:"has-error fz_14",component:"h1",content:"gateway.rudex.withdraw_disabled"}))),s.a.createElement("div",{className:"rudex__gateway grid-block no-padding no-margin"},k,C,s.a.createElement(Pe.a,{id:c,overlay:!0},s.a.createElement(V.a,{close:c},s.a.createElement("a",{href:"#",className:"close-button"},"×")),s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(je.a,{account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),output_coin_name:this.props.deposit_asset_name,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:f,modal_id:c,min_amount:this.props.min_amount,withdraw_fee:this.props.withdraw_fee,asset_precision:this.props.asset_precision,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]}))))}}]),t}();Re.propTypes={gateway:N.a.string,deposit_allowed:N.a.bool.isRequired,withdraw_allowed:N.a.bool.isRequired,deposit_coin_type:N.a.string,deposit_asset_name:N.a.string,deposit_account:N.a.string,receive_coin_type:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:N.a.string,deposit_wallet_type:N.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:N.a.string,action:N.a.string,supports_output_memos:N.a.bool.isRequired,memo_version:N.a.number,min_amount:N.a.number,deposit_fee:N.a.number,withdraw_fee:N.a.number,asset_precision:N.a.number,confirmations:N.a.object};var qe=Object(d.a)(Re,{keep_updating:!0}),Me=a(1757),Le=a(1805),Ue=(a(1748),function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}());var He=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get("rudexAction","deposit");return a.state={activeCoin:a._getActiveCoin(e,{action:n}),action:n},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Ue(t,[{key:"_findCoinByName",value:function(e,t){for(var a=0;a<e.coins.length;a++){var n=e.coins[a];if(n.backingCoin.toUpperCase()===t)return n}return e.coins[0]}},{key:"_findCoinBySymbol",value:function(e,t){for(var a=0;a<e.coins.length;a++){var n=e.coins[a];if(n.symbol.toUpperCase()===t)return n}return null}},{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_rudex",null),n=a||"PPY";return"withdraw"===t.action&&(n=this._findCoinByName(e,n).symbol),n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.value});var t={},a=e.value;"withdraw"===this.state.action&&(a=this._findCoinBySymbol(this.props,a).backingCoin),t.activeCoin_rudex=a,I.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),I.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},"rudexAction",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=this.state,o=i.activeCoin,r=i.action;if(!a.length)return s.a.createElement(k.a,null);var l=a.filter(function(e){return!(!e||!e.symbol)}),c=l.map(function(e){var t="deposit"===r?e.backingCoin.toUpperCase():e.symbol,a=t.replace("RUDEX.",""),n="PPY"===a?"":"RUDEX.";return{value:t,label:s.a.createElement("div",null,s.a.createElement(Me.a,{replaceNoneToBts:!1,maxWidth:20,name:n+a}),t.replace("RUDEX.",""))}}).filter(function(e){return null!==e}),p=l.filter(function(e){return"deposit"===r?e.backingCoin.toUpperCase()===o:e.symbol===o})[0];p||(p=l[0]);var d="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+r}),":"," "),s.a.createElement(Le.a,{onChange:this.onSelectCoin.bind(this),clearable:!1,searchable:!1,value:o,options:c}))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===r?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===r?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),p?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(qe,{key:""+p.symbol,gateway:p.gatewayWallet,issuer_account:p.issuer,account:n,deposit_allowed:p.depositAllowed,withdraw_allowed:p.withdrawalAllowed,deposit_asset:p.backingCoin.toUpperCase(),deposit_asset_name:p.name,deposit_coin_type:p.backingCoin.toLowerCase(),deposit_account:p.gatewayWallet,deposit_wallet_type:p.walletType,receive_asset:p.symbol,receive_coin_type:p.symbol.toLowerCase(),supports_output_memos:p.memoSupport,memo_version:p.memoVersion,min_amount:p.minAmount,withdraw_fee:p.withdrawFee,deposit_fee:p.depositFee,asset_precision:p.precision,confirmations:p.confirmations,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.rudex.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:"https://rudex.freshdesk.com",target:"_blank",rel:"noopener noreferrer"},"https://rudex.freshdesk.com"))),p&&p.symbol?s.a.createElement(P.b,{asset:p.symbol,fromAccount:d?p.issuerId:this.props.account.get("id"),to:d?this.props.account.get("id"):p.issuerId},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(P.a,{accountsList:W.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),Je=Object(i.a)(He,{listenTo:function(){return[j.a]},getProps:function(){return{viewSettings:j.a.getState().viewSettings}}}),ze=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Ge=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),ze(t,[{key:"componentWillUnmount",value:function(){}},{key:"render",value:function(){if(!this.props.account)return s.a.createElement("div",null);var e=s.a.createElement("a",{style:{padding:"12px 1.75rem"},href:"https://mrkt.cash/?r=102",target:"_blank"},s.a.createElement("img",{style:{margin:0,height:80},src:"images/partner-mrktcash.png"}));return s.a.createElement("div",null,s.a.createElement("h1",null,s.a.createElement(u.a,{content:"gateway.rudex.partners.mrktcash.title"})),s.a.createElement("h3",null,s.a.createElement(u.a,{content:"gateway.rudex.partners.mrktcash.description"})),s.a.createElement("p",null,e))}}]),t}();Ge.propTypes={account:p.a.ChainAccount};var Ve=Ge=Object(d.a)(Ge),Xe=a(177),Ke=a(336),Ye=new me.a(""),Qe={},Ze=1e4;function $e(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;return 1==t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return et(e,E.e.BASE+E.e.DEPOSIT_RECORD_LIST,t)}(e,a):2==t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return et(e,E.e.BASE+E.e.WITHDRAW_RECORD_LIST,t)}(e,a):new Promise(function(e){return e()})}function et(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;return-1==a?tt(e,t,Ze):0==a?function(e,t){e.requestChannel||(e.requestChannel=0);e.version||(e.version="1.0");e.timestamp||(e.timestamp=(new Date).getTime());e.outerChannel||(e.outerChannel="Bitshares");var a=JSON.stringify(e);if(Qe[a])return;Qe[a]=!0,new Promise(function(e,n){fetch(t,{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:a}).then(function(t){t.json().then(function(t){delete Qe[a],0!==t.code&&(console.log(t),n({code:t.code,message:t.message})),e(t.data)}).catch(function(e){delete Qe[a],n({code:-1,message:e.message})})})})}(e,t):tt(e,t,a)}function tt(e,t,a){e.requestChannel||(e.requestChannel=0),e.version||(e.version="1.0"),e.timestamp||(e.timestamp=(new Date).getTime()),e.outerChannel||(e.outerChannel="Bitshares");var n=JSON.stringify(e);if(!Qe[n])return Qe[n]=!0,Promise.race([new Promise(function(e,a){fetch(t,{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:n}).then(function(t){t.json().then(function(t){delete Qe[n],0!==t.code&&(console.log(t),a({code:t.code,message:t.message})),e(t.data)}).catch(function(e){delete Qe[n],a({code:-1,message:e.message})})})}),new Promise(function(e,t){setTimeout(function(){t({code:-2,message:"Request timeout."})},a)})])}var at={has:function(e){return Ye.has("gdex_history_address_"+e)},set:function(e){var t=e.wallet,a=e.addresses;Ye.set("gdex_history_address_"+t,a)},get:function(e){return Ye.get("gdex_history_address_"+e,[])},setLast:function(e){var t=e.wallet,a=e.address;Ye.set("gdex_history_address_last_"+t,a)},getLast:function(e){return Ye.get("gdex_history_address_last_"+e,"")}},nt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var st=new me.a("__gdex__user_"),it=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_gdex_address_cache_version_string="1",this.day=86400}return nt(e,[{key:"getUserInfo",value:function(e){var t=st.get(e,null);if(!t)return null;var a=Math.floor((new Date).getTime()/1e3);return Math.abs(t.ctime-a)>this.day?(st.remove(e),null):t}},{key:"cacheUserInfo",value:function(e,t,a){var n=st.get(e,{});n!={}&&(n={user_id:t,status:a,ctime:Math.floor((new Date).getTime()/1e3)},st.set(e,n))}},{key:"delUserInfo",value:function(e){st.has(e)&&st.del(e)}},{key:"getIndexForDepositKey",value:function(e,t,a){return[this.current_gdex_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a){var n=this.getIndexForDepositKey(e,t,a),s=st.get("deposit_keys",{})[n]||null;if(s){if(s.address){var i=Math.floor((new Date).getTime()/1e3);return Math.abs(s.ctime-i)>this.day?(this.clearInputAddress(e,t,a),null):s}return null}}},{key:"cacheInputAddress",value:function(e,t,a,n,s){var i=this.getIndexForDepositKey(e,t,a),o=st.get("deposit_keys",{});o[i]={address:n,memo:s,ctime:Math.floor((new Date).getTime()/1e3)},st.set("deposit_keys",o)}},{key:"clearInputAddress",value:function(e,t,a){var n=this.getIndexForDepositKey(e,t,a),s=st.get("deposit_keys",null);s&&s[n]&&(s[n]={address:null,memo:null,ctime:null},st.set("deposit_keys",s))}}]),e}(),ot=a(528),rt=a.n(ot),lt=a(305),ct=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var ut=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={withdraw_amount:a.props.amount_to_withdraw,withdraw_address:at.getLast(e.output_coin_name),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,withdraw_address_selected:at.getLast(e.output_coin_name),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,below_minumum_withdraw_value:!1,precision_error:!1,memo_error:!1,memo_length_error:!1,from_account:e.account,fee_asset_id:"1.3.0",feeStatus:{},withdraw_address_error_code:null,withdraw_address_error_message:null},a._validateAddress(a.state.withdraw_address,e),a._checkBalance=a._checkBalance.bind(a),a._updateFee=Object(lt.a)(a._updateFee.bind(a),250),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),ct(t,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.output_coin_name!=this.props.output_coin_name&&this.setState({withdraw_address:at.getLast(e.output_coin_name),withdraw_address_selected:at.getLast(e.output_coin_name)}),e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},fee_asset_id:"1.3.0",feeAmount:new ge.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"_assembleMemo",value:function(){var e=this,t=this.props.memo_rule,a="";try{if(t)return t.split(";").forEach(function(t){switch(t[0]){case"C":a+=t.slice(2);break;case"D":a+=e.state.withdraw_address;break;case"B":a+=t.slice(2);break;case"S":a+=e.state.memo}}),a.length>100?(this.setState({memo_length_error:!0}),null):(this.setState({memo_length_error:!1}),this.setState({memo_error:!1}),a)}catch(e){console.log(e)}return this.setState({memo_error:!0}),null}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(ye.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this._assembleMemo()}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(ye.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_name+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),l.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=at.get(this.props.output_coin_symbol)[e];at.setLast({wallet:this.props.output_coin_symbol,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.address?et(e,E.e.BASE+E.e.CHECK_WITHDRAY_ADDRESS,t):new Promise(function(e){return e()})})({assetId:a.output_coin_id,assetName:a.output_coin_name,address:e}).then(function(e){t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:e.valid,withdraw_address_error_code:null,withdraw_address_error_message:null})}).catch(function(e){var a=e.message;e.code<0&&(a="System error: please try again later"),t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:null,withdraw_address_error_code:e.code,withdraw_address_error_message:a})})}},{key:"_checkPrecision",value:function(){var e=this.state.withdraw_amount,t=this.props.output_coin_precision;"undefined"!==t&&("string"!=typeof e&&(e=e.toString()),-1!==(e=e.trim()).indexOf(".")&&e.length-e.indexOf(".")-1>t?this.setState({precision_error:!0}):this.setState({precision_error:!1}))}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance,o=n.minWithdrawAmount;if(i){if(t){var r=Object(ye.a)(a,s,t,i);if(null!==r){if(this.setState({balanceError:!r}),"string"==typeof a&&(a=parseFloat(String.prototype.replace.call(a,/,/g,""))),"string"==typeof o&&(o=parseFloat(String.prototype.replace.call(o,/,/g,""))),!(a<o))return this.setState({below_minumum_withdraw_value:!1}),this._checkPrecision(),r;this.setState({below_minumum_withdraw_value:!0})}}}else this.setState({balanceError:!0})}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(at.has(this.props.output_coin_symbol)){var e=at.get(this.props.output_coin_symbol);-1==e.indexOf(this.state.withdraw_address)&&(e.push(this.state.withdraw_address),at.set({wallet:this.props.output_coin_symbol,addresses:e}))}else{var t=[];t.push(this.state.withdraw_address),at.set({wallet:this.props.output_coin_symbol,addresses:t})}at.setLast({wallet:this.props.output_coin_symbol,address:this.state.withdraw_address});var a=this.props.asset,n=this.state.feeAmount,s=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),i=new ge.a({asset_id:a.get("id"),precision:a.get("precision"),real:s});$.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),i.getAmount(),a.get("id"),this._assembleMemo(),null,n?n.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else y.a.publish(this.getWithdrawModalId(),"open")}},{key:"onSubmitConfirmation",value:function(){if(y.a.publish(this.getWithdrawModalId(),"close"),at.has(this.props.output_coin_symbol)){var e=at.get(this.props.output_coin_symbol);-1==e.indexOf(this.state.withdraw_address)&&(e.push(this.state.withdraw_address),at.set({wallet:this.props.output_coin_symbol,addresses:e}))}else{var t=[];t.push(this.state.withdraw_address),at.set({wallet:this.props.output_coin_symbol,addresses:t})}at.setLast({wallet:this.props.output_coin_symbol,address:this.state.withdraw_address});var a=this.props.asset,n=l.a.get_asset_precision(a.get("precision")),s=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),i=this.state.feeAmount;$.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(s*n,10),a.get("id"),this._assembleMemo(),null,i?i.asset_id:"1.3.0")}},{key:"onDropDownList",value:function(){at.has(this.props.output_coin_symbol)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new ge.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(l.a.sortID),s){var o=m.ChainStore.getObject(i),r=m.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var c=!1;try{c=new ge.h({base:new ge.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new ge.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){c=!1}"1.3.0"===o.get("id")||c||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=at.get(this.props.output_coin_symbol),i=null,o=this.props.account.get("balances").toJS(),r=Object.keys(o),l=this.getWithdrawModalId(),c=null,p=null,d=null;this.state.options_is_valid&&(p=s.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return s.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(c=this.state.withdraw_address_error_code?s.a.createElement("div",{className:"has-error",style:{paddingTop:10}},this.state.withdraw_address_error_code,":"," ",this.state.withdraw_address_error_message):s.a.createElement("div",{className:"has-error",style:{paddingTop:10}},s.a.createElement(u.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_name})),d=s.a.createElement(Pe.a,{id:l,overlay:!0},s.a.createElement(V.a,{close:l},s.a.createElement("a",{href:"#",className:"close-button"},"×")),s.a.createElement("br",null),s.a.createElement("label",null,s.a.createElement(u.a,{content:"modal.confirmation.title"})),s.a.createElement("br",null),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitConfirmation.bind(this),value:S.a.translate("modal.confirmation.accept")}),s.a.createElement(V.a,{close:l},s.a.createElement("a",{className:"secondary button"},s.a.createElement(u.a,{content:"modal.confirmation.cancel"})))))));var m=1,h=null;this.props.output_supports_memos&&(h=s.a.createElement("div",{className:"content-block"},s.a.createElement("label",null,s.a.createElement(u.a,{component:"span",content:"transfer.memo"})),s.a.createElement("textarea",{rows:"3",value:a,tabIndex:m++,onChange:this.onMemoChanged.bind(this)}),this.state.memo_error?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.memo_error"})):null,this.state.memo_length_error?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.memo_length_error"})):null));var _=this._getAvailableAssets().fee_asset_types;if(r.length>0){var f=this.props.asset.get("id");if(f){var y=o[f];i=s.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},s.a.createElement(u.a,{component:"span",content:"transfer.available"})," : ",s.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},y?s.a.createElement(X.a,{balance:o[f]}):0))}else i="No funds"}else i="No funds";return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,s.a.createElement(u.a,{content:"gateway.withdraw_coin",coin:this.props.output_coin_symbol,symbol:this.props.output_coin_name}))),s.a.createElement("div",{className:"content-block"},s.a.createElement(K.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:i}),this.state.empty_withdraw_value?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.insufficient"})):null,this.state.below_minumum_withdraw_value?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.minimum_amount",amount:this.props.minWithdrawAmount,symbol:this.props.asset.get("symbol")})):null,this.state.precision_error?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.precision",precision:this.props.output_coin_precision})):null),this.state.feeAmount?s.a.createElement("div",{className:"content-block gate_fee"},s.a.createElement(K.a,{refCallback:this.setNestedRef.bind(this),label:"transfer.fee",disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:_,tabIndex:m++}),this.state.hasBalance?null:s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?s.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.fee"})),s.a.createElement("div",{className:"inline-label input-wrapper"},s.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),s.a.createElement("div",{className:"form-label select floating-dropdown"},s.a.createElement("div",{className:"dropdown-wrapper inactive"},s.a.createElement("div",null,this.props.output_coin_symbol))))):null,s.a.createElement("div",{className:"content-block"},s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{component:"span",content:"modal.withdraw.address"})),s.a.createElement("div",{className:"blocktrades-select-dropdown"},s.a.createElement("div",{className:"inline-label"},s.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),s.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),s.a.createElement("div",{className:"blocktrades-position-options"},p),c),h,s.a.createElement("div",{className:"button-group"},s.a.createElement("div",{onClick:this.onSubmit.bind(this),className:"button"+(this.state.below_minumum_withdraw_value||this.state.memo_error||this.state.memo_length_error||this.state.error||this.state.balanceError||this.state.precision_error?" disabled":"")},s.a.createElement(u.a,{content:"modal.withdraw.submit"})),s.a.createElement(V.a,{close:this.props.modal_id},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"account.perm.cancel"})))),d))}}]),t}();ut.propTypes={account:p.a.ChainAccount.isRequired,issuer:p.a.ChainAccount.isRequired,asset:p.a.ChainAsset.isRequired,memo_rule:N.a.string.isRequired,balance:p.a.ChainObject,output_supports_memos:N.a.bool.isRequired};var pt=Object(d.a)(ut),dt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function mt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ht(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _t(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var ft=function(e){function t(){mt(this,t);var e=ht(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={receive_address:null,isAvailable:!0,qrcode:""},e.deposit_address_cache=new it,e._copy=e._copy.bind(e),document.addEventListener("copy",e._copy),e}return _t(t,s.a.Component),dt(t,[{key:"getDepositAddress",value:function(){this._getDepositAddress(this.props.user_id,this.props.account.get("name"),this.props.coin,this.props.action)}},{key:"_getDepositAddress",value:function(e,t,a,n){if("deposit"==n){var s=this.deposit_address_cache.getCachedInputAddress(t,a.outerSymbol,a.innerSymbol);if(s&&s!=this.state.receive_address)this.setState({receive_address:s});else{var i=this;(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return et(e,E.e.BASE+E.e.GET_DEPOSIT_ADDRESS,t)})({btsAssetId:a.innerAssetId,outAssetId:a.outerAssetId,uid:e,userAccount:t}).then(function(e){if(e.address&&e.address.address){var n={address:e.address.address,memo:e.address.memo};i.deposit_address_cache.cacheInputAddress(t,a.outerSymbol,a.innerSymbol,n.address,n.memo),i.setState({receive_address:n})}else i.setState({receive_address:null})}).catch(function(e){i.setState({receive_address:null}),console.log(e)})}}}},{key:"componentWillMount",value:function(){this.getDepositAddress()}},{key:"componentWillReceiveProps",value:function(e){e.user_id===this.props.user_id&&e.action===this.props.action&&e.coin==this.props.coin||this._getDepositAddress(e.user_id,e.account.get("name"),e.coin,e.action)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.coin.innerSymbol}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"onShowQrcode",value:function(e){this.setState({qrcode:e},function(){return y.a.publish("qrcode","open")})}},{key:"_copy",value:function(e){try{this.state.clipboardText?e.clipboardData.setData("text/plain",this.state.clipboardText):e.clipboardData.setData("text/plain",S.a.translate("gateway.use_copy_button").toUpperCase()),e.preventDefault()}catch(e){console.error(e)}}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e=s.a.createElement("div",{style:{display:"none",minHeight:150}});if(!this.props.account||!this.props.issuer_account||!this.props.coin)return e;var t=this.props,a=t.coin,n=t.btsCoin;if(!n)return e;var i=this.state.receive_address,o=this.state.qrcode,r=this.getWithdrawModalId(),l=null,c="",p="",d=a.outerSymbol+":";"deposit"===this.props.action&&(i&&(l=s.a.createElement("span",null,i.address),c=i.address,i.memo&&(s.a.createElement("span",null,i.memo),p=i.memo)),d="");var m=null,h=this.props.account.get("balances");return h&&(m=h.toJS()[n.get("id")]),"deposit"===this.props.action?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},a.outerSymbol)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:a.innerSymbol,replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:a.innerSymbol,replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:a.outerSymbol}),":"),s.a.createElement("p",{style:{color:"red"}},s.a.createElement(u.a,{content:"gateway.deposit_warning",asset:a.outerSymbol})),p?s.a.createElement("p",{style:{color:"red"}},s.a.createElement(u.a,{content:"gateway.deposit_warning_memo",asset:a.outerSymbol})):null,s.a.createElement("div",null,s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.address"}),":"),s.a.createElement("td",null,l),s.a.createElement("td",null,s.a.createElement("div",{style:{width:"125px"},className:"button",onClick:this.toClipboard.bind(this,c)},s.a.createElement(u.a,{content:"transfer.copy_address"}))),s.a.createElement("td",null,s.a.createElement("div",{className:"button",onClick:this.onShowQrcode.bind(this,c)},s.a.createElement(u.a,{content:"modal.qrcode.label"})))),p?s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.memo"}),":"),s.a.createElement("td",null,p),s.a.createElement("td",null,s.a.createElement("div",{style:{width:"125px"},className:"button",onClick:this.toClipboard.bind(this,p)},s.a.createElement(u.a,{content:"transfer.copy_memo"}))),s.a.createElement("td",null,s.a.createElement("div",{className:"button",onClick:this.onShowQrcode.bind(this,p)},s.a.createElement(u.a,{content:"modal.qrcode.label"})))):null)),s.a.createElement(_.a,{id:"qrcode",overlay:!0},s.a.createElement(yt,{text:o}))))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:a.innerSymbol,replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},a.outerSymbol)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:a.innerSymbol,replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(_.a,{id:r,overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(pt,{account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:a.innerSymbol,output_coin_name:a.outerAssetName,gateFee:a.gateFee,output_coin_id:a.outerAssetId,output_coin_symbol:a.outerSymbol,output_supports_memos:1==a.needMemo,minWithdrawAmount:a.minTransactionAmount,output_coin_precision:a.relationPrecision,memo_prefix:d,memo_rule:this.props.memo_rule,modal_id:r,balance:m}))))}}]),t}();ft.propTypes={account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,gateway:N.a.string,btsCoin:p.a.ChainAsset,memo_rule:N.a.string},ft.defaultProps={autosubscribe:!1};var yt=function(e){function t(e){return mt(this,t),ht(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return _t(t,s.a.Component),dt(t,[{key:"render",value:function(){var e=this.props.text;return s.a.createElement("div",{className:"small-12",style:{textAlign:"center"}},s.a.createElement(rt.a,{size:200,value:e}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("label",null,e))}}]),t}(),gt=Object(d.a)(ft),wt=a(21),vt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var bt={1:"confirming",2:"waiting",3:"transfering",4:"success",5:"fail"},Et={1:"confirming",2:"auditing",3:"audited",4:"refused",5:"transfering",6:"success",7:"fail"},kt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={headerHeight:85,pageNum:0,totalNum:0,nextPageEnabled:!1,allData:{},historyStatusType:1==e.recordType?"deposit_history_status":"withdraw_history_status",historyStatusValue:1==e.recordType?bt:Et},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),vt(t,[{key:"componentWillMount",value:function(){this.getTransactionHistory()}},{key:"componentWillReceiveProps",value:function(e){this.props.recordType==e.recordType&&this.props.assetId==e.assetId&&this.props.assetName==e.assetName&&this.props.userId==e.userId&&this.props.userAccount==e.userAccount||this._getTransactionHistory(e.userId,e.assetId,e.assetName,e.recordType,e.userAccount,!0)}},{key:"shouldComponentUpdate",value:function(e,t){return!l.a.are_equal_shallow(this.props.userId,e.userId)||(this.state.allData!=t.allData||this.state.pageNum!=t.pageNum)}},{key:"_getTransactionHistory",value:function(e,t,a,n,s){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=this.props.pageSize,r=this.state,l=r.pageNum,c=r.allData,u=r.historyStatusValue,p=r.historyStatusType;1==i?(l=1,c={},p=1==n?"deposit_history_status":"withdraw_history_status",u=1==n?bt:Et):l+=1;var d=this;$e({uid:e,assetId:t,pageNum:l,pageSize:o,userAccount:s},n).then(function(e){e.records&&(e.records.forEach(function(e){c[e.txid]={txid:e.txid,amount:e.amount,time:e.ctime,unixtime:Date.parse(e.ctime),status:["gateway",p,u[e.status]].join("."),failReason:e.failReason,assetName:a}}),d.setState({totalNum:e.total,nextPageEnabled:e.total>l*o,allData:c,pageNum:l,historyStatusType:p,historyStatusValue:u}))}).catch(function(){d.setState({totalNum:0,nextPageEnabled:!1,allData:{},pageNum:0})})}},{key:"getTransactionHistory",value:function(){var e=this.props,t=e.userId,a=e.assetId,n=e.assetName,s=e.recordType,i=e.userAccount;this._getTransactionHistory(t,a,n,s,i,!1)}},{key:"render",value:function(){var e=this.props,t=e.assetName,a=e.compactView,n=e.style,i=e.maxHeight,o=this.state,r=o.headerHeight,l=o.allData,c=[];Object.keys(l).forEach(function(e){c.push(l[e])}),c.sort(function(e,t){return t.unixtime-e.unixtime}),(n=n||{}).width="100%",n.height="100%",l.length;var p=c.length?c.map(function(e){return s.a.createElement("tr",{key:e.txid},s.a.createElement("td",{style:{textAlign:"left"},className:"left-td column-hide-tiny"},s.a.createElement(u.a,{content:e.status})),s.a.createElement("td",{style:{padding:"8px 5px",textAlign:"left",fontSize:14}},s.a.createElement(u.a,{content:"gateway.transaction_history_info",amount:e.amount,assetName:t,txid:e.txid})),s.a.createElement("td",null,e.time))}):[s.a.createElement("tr",{key:"no_recent"},s.a.createElement("td",{colSpan:a?"2":"3"},s.a.createElement(u.a,{content:"operation.no_recent"})))];return p.push(s.a.createElement("tr",{className:"total-value",key:"total_value"},s.a.createElement("td",{className:"column-hide-tiny"}),s.a.createElement("td",null),s.a.createElement("td",{style:{textAlign:"center"}}," ",this.state.nextPageEnabled?s.a.createElement("a",{onClick:this.getTransactionHistory.bind(this)},s.a.createElement(wt.a,{name:"chevron-down",title:"icons.chevron_down.transactions",className:"icon-14px"})):null))),s.a.createElement("div",{className:"recent-transactions no-overflow",style:n},s.a.createElement("div",{className:"generic-bordered-box"},this.props.dashboard?null:s.a.createElement("div",{ref:"header"},s.a.createElement("div",{className:"block-content-header"},s.a.createElement("span",null,this.props.title?this.props.title:s.a.createElement(u.a,{content:"account.recent"})))),s.a.createElement("div",{className:"box-content grid-block no-margin",style:this.props.fullHeight?null:{maxHeight:i-r},ref:"transactions"},s.a.createElement("table",{className:"table"+(a?" compact":"")+(this.props.dashboard?" dashboard-table":"")},s.a.createElement("thead",null,s.a.createElement("tr",{key:"history_header"},s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.status"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.info"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.time"})))),s.a.createElement("tbody",null,p)))))}}]),t}();kt.propTypes={compactView:N.a.bool,maxHeight:N.a.number,fullHeight:N.a.bool,userId:N.a.number,assetId:N.a.number,assetName:N.a.string,recordType:N.a.number,userAccount:N.a.string},kt.defaultProps={maxHeight:500,fullHeight:!1,pageSize:10};var Ct=kt,St=a(1760),At=a.n(St),Nt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Ot=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={locale:e.settings.get("locale","en")},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Nt(t,[{key:"componentDidMount",value:function(){if(this.refs.agreement){var e=this.refs.agreement;At.a.initialize(e)}}},{key:"componentDidUpdate",value:function(){if(this.refs.agreement){var e=this.refs.agreement;At.a.update(e)}}},{key:"_getAgreement",value:function(e){switch(e){case"zh":case"cn":return s.a.createElement("div",{className:"container",ref:"agreement",style:{height:"500px",overflow:"auto",position:"relative"}},s.a.createElement("h2",{style:{textAlign:"center"}},"用户服务协议"),s.a.createElement("p",null,"OBSIDIAN TECHNOLOGY CO. PTE. LTD. 是一家根据新加坡共和国法律成立的公司,GDEX是由该公司运营的比特股网关(以下称“GDEX”或“本网关”),主访问入口为https://www.gdex.io,GDEX是一个在比特股平台为用户提供数字资产充提服务(以下称“该服务”或“服务”)的平台。为了本协议表述之方便,公司和该网关在本协议中合称使用“我们”或其他第一人称称呼。使用该服务的自然人或其他主体均为本网关的用户,本协议为表述之便利,以下使用“您”或其他第二人称。我们和您在本协议中合称为“双方”,我们或您单称为“一方”。"),s.a.createElement("p",null,"重要提示:"),s.a.createElement("p",null,"我们在此特别提醒您:"),s.a.createElement("p",null," ","1. 数字资产本身不由任何金融机构或公司或本网关发行;"),s.a.createElement("p",null," ","2. 数字资产市场是全新的、未经确认的,而且可能不会增长;"),s.a.createElement("p",null," ","3. 数字资产主要由投机者大量使用,零售和商业市场使用相对较少,数字资产交易存在极高风险,其全天不间断交易,没有涨跌限制,价格容易受庄家、全球政府政策的影响而大幅波动;"),s.a.createElement("p",null," ","4. 因各国法律、法规和规范性文件的制定或者修改,数字资产交易随时可能被暂停或被禁止。"),s.a.createElement("p",null,"数字资产交易有极高风险,并不适合绝大部分人士。您了解和理解此投资有可能导致部分损失或全部损失,所以您应该以能承受的损失程度来决定投资的金额。您了解和理解数字资产会产生衍生风险,所以如有任何疑问,建议先寻求理财顾问的协助。此外,除了上述提及过的风险以外,还会有未能预测的风险存在。您应慎重考虑并用清晰的判断能力去评估自己的财政状况及上述各项风险而作出任何买卖数字资产的决定,并承担由此产生的全部损失,我们对此不承担任何责任。"),s.a.createElement("p",null,"敬告您:"),s.a.createElement("p",null,"1.您了解比特股是基于区块链的去中心化交易平台,其基础账号服务和交易撮合服务都由比特股平台提供。亦有其它机构或个人在比特股平台上发行资产及/或提供服务。您了解本网关仅作为您向比特股平台充提数字资产的工具。本网关只对自身发行的交易代币资产(名称以GDEX.为前缀)负责,不对比特股上其它机构或个人发行的资产负责,本网关不参与您的任何交易,您应自行谨慎判断确定相关数字资产及/或信息的真实性、合法性和有效性,并自行承担因此产生的责任与损失。"),s.a.createElement("p",null," ","2. 比特股去中心化交易系统存有风险,包括但不限于软件,硬件和互联网链结的失败,用户账户系统的安全风险等。由于我们不能控制互联网以及比特股平台的可靠性和可用性,我们不会对上述风险造成的用户损失承担任何责任。"),s.a.createElement("p",null," ","3. 禁止使用本网关从事洗钱、走私、商业贿赂等一切非法交易活动,若发现此类事件,本网关将采取各种可使用之手段,包括但不限于中止提供服务,通知相关权力机关等,我们不承担由此产生的所有责任并保留向相关人士追究责任的权利。"),s.a.createElement("p",null,"一、总则"),s.a.createElement("p",null," ","1.1 您在使用本网关提供的服务之前,应仔细阅读本协议,如有不理解之处或其他必要,请咨询专业律师。如您不同意本协议及/或随时对其的修改,请您立即停止使用本网关提供的服务。使用本网关的任何服务即表示您已了解并完全同意本协议各项内容,包括本网关对本协议随时所做的任何修改。"),s.a.createElement("p",null," ","1.2 使用本网关提供的服务和功能,您将被视为已阅读,理解并:"),s.a.createElement("p",null," 1.2.1 接受本协议所有条款及条件的约束。"),s.a.createElement("p",null," ","1.2.2 您确认您已年满21周岁或根据不同的可适用的法律规定的具有可订立合同的法定年龄,并有充分的能力接受这些条款,并订立交易,使用本网关进行数字资产交易。"),s.a.createElement("p",null," ","1.2.3 您保证交易中涉及到的属于您的数字资产均为合法取得并所有。"),s.a.createElement("p",null," ","1.2.4 您同意您为您自身的交易或非交易行为承担全部责任和任何收益或亏损。"),s.a.createElement("p",null," ","1.2.5 您同意遵守任何有关法律的规定,就税务目的而言,包括报告任何交易利润。"),s.a.createElement("p",null," ","1.2.6 本协议只是就您与我们之间达成的权利义务关系进行约束,而并不涉及本网关用户之间或其他网关和您之间因数字资产交易而产生的法律关系及法律纠纷。"),s.a.createElement("p",null,"二、协议修订"),s.a.createElement("p",null,"我们保留不时修订本协议、并以公示的方式进行公告、不再单独通知您的权利,变更后的协议会在本协议首页标注变更时间,一经在公布,立即自动生效。您应不时浏览及关注本协议的更新变更时间及更新内容,如您不同意相关变更,应当立即停止使用本网关服务;您继续使用本网关服务,即表示您接受并同意经修订的协议的约束。"),s.a.createElement("p",null,"三、服务"),s.a.createElement("p",null,"本网关只为您提供向比特股平台冲入和提取数字资产的服务,本网关并不作为买家或卖家参与买卖数字资产行为本身;本网关不提供任何国家法定货币充入和提取的相关服务。"),s.a.createElement("p",null," 3.1 服务内容"),s.a.createElement("p",null," ","3.1.1 您有权通过本网关向比特股平台冲入或提取数字资产。"),s.a.createElement("p",null," 3.1.2 本网关承诺为您提供的其他服务。"),s.a.createElement("p",null," 3.2.服务规则"),s.a.createElement("p",null," 您承诺遵守下列本网关服务规则:"),s.a.createElement("p",null," ","3.2.1 您应当遵守法律法规、规章、及政策要求的规定,保证账户中所有数字资产来源的合法性,不得在本网关或利用本网关服务从事非法或其他损害本网关或第三方权益的活动,如发送或接收任何违法、违规、侵犯他人权益的信息,发送或接收传销材料或存在其他危害的信息或言论,未经本网关授权使用或伪造本网关电子邮件题头信息等。"),s.a.createElement("p",null," ","3.2.2 您在使用本网关服务之前应充分了解比特股账号的使用常识,做好相应账号的备份及密码保存工作,对于比特股账户安全问题造成的损失,本网关不承担任何责任。"),s.a.createElement("p",null," ","3.2.3 您在使用本网关提供的服务过程中,所产生的应纳税赋,以及一切硬件、软件、服务及其它方面的费用,均由您独自承担。"),s.a.createElement("p",null," ","3.2.4 您应当遵守本网关不时发布和更新的本协议以及其他服务条款和操作规则,有权随时终止使用本网关提供的服务。"),s.a.createElement("p",null,"四、本网关的权利和义务"),s.a.createElement("p",null,"4.1 本网关有权在发现本网关上显示的任何信息存在明显错误时,对信息予以更正。"),s.a.createElement("p",null,"4.2 本网关保留随时修改、中止或终止本网关服务的权利,本网关行使修改或中止服务的权利不需事先告知您;本网关终止本网关一项或多项服务的,终止自本网关在网关上发布终止公告之日生效。"),s.a.createElement("p",null," ","4.3 本网关应当采取必要的技术手段和管理措施保障本网关的正常运行。"),s.a.createElement("p",null,"五、赔偿"),s.a.createElement("p",null," ","5.1 在任何情况下,我们对您的直接损害的赔偿责任均不会超过您从使用本网关服务产生的为期三( 3)个月的总费用。"),s.a.createElement("p",null,"六、寻求禁令救济的权利"),s.a.createElement("p",null,"我们和您均承认普通法对违约或可能违约情况的救济措施是可能是不足以弥补我们遭受的全部损失的,故非违约方有权在违约或可能违约情况下寻求禁令救济以及普通法或衡平法允许的其他所有的补救措施。"),s.a.createElement("p",null,"七、责任限制与免责"),s.a.createElement("p",null," ","7.1 您了解并同意,在任何情况下,我们不就以下各事项承担责任:"),s.a.createElement("p",null," 7.1.1 收入的损失;"),s.a.createElement("p",null," 7.1.2 交易利润或合同损失;"),s.a.createElement("p",null," 7.1.3 业务中断"),s.a.createElement("p",null," 7.1.4 预期可节省的货币的损失;"),s.a.createElement("p",null," 7.1.5 信息的损失;"),s.a.createElement("p",null," 7.1.6 机会、商誉或声誉的损失;"),s.a.createElement("p",null," 7.1.7 数据的损坏或损失;"),s.a.createElement("p",null," 7.1.8 购买替代产品或服务的成本;"),s.a.createElement("p",null," ","7.1.9 任何由于侵权(包括过失)、违约或其他任何原因产生的间接的、特殊的或附带性的损失或损害,不论这种损失或损害是否可以为我们合理预见;不论我们是否事先被告知存在此种损 失或损害的可能性。"),s.a.createElement("p",null," ","7.2 您了解并同意,我们不对因下述任一情况而导致您的任何损害赔偿承担责任:"),s.a.createElement("p",null," ","7.2.1 我们有合理的理由认为您的具体交易事项可能存在重大违法或违约情形。"),s.a.createElement("p",null," ","7.2.2 我们有合理的理由认为您在本网关的行为涉嫌违法或不当。"),s.a.createElement("p",null," ","7.2.3 通过本网关服务购买或获取任何数据、信息或进行交易等行为或替代行为产生的费用及损失。"),s.a.createElement("p",null," 7.2.4 您对本网关服务的误解。"),s.a.createElement("p",null," ","7.2.5 任何非因我们的原因而引起的与本网关提供的服务有关的其它损失。"),s.a.createElement("p",null," ","7.3 我们对由于信息网络设备维护、信息网络连接故障、电脑、通讯或其他系统的故障、电力故障、天气原因、意外事故、罢工、劳动争议、暴乱、起义、骚乱、生产力或生产资料不足、火灾、洪水、风暴、爆炸、战争、银行或其他合作方原因、数字资产市场崩溃、政府行为、 司法或行政机关的命令、其他不在我们可控范围内或我们无能力控制的行为或第三方的原因而造成的不能服务或延迟服务,以及造成的您的损失,我们不承担任何责任。"),s.a.createElement("p",null," ","7.4 我们不能保证本网关包含的全部信息、程序、文本等完全安全,不受任何病毒、木马等恶意程序的干扰和破坏,故您登陆、使用本网关任何服务或下载及使用该下载的任何程序、信息、数据等均是您个人的决定并自行承担风险及可能产生的损失。"),s.a.createElement("p",null," ","7.5 我们对本网关中链接的任何第三方网关的任何信息、产品及业务及其他任何形式的不属于我们的主体的内容等不做任何保证和承诺,您如果使用第三方网关提供的任何服务、信息及产品等均为您个人决定且承担由此产生的一切责任。"),s.a.createElement("p",null," ","7.6 我们对于您使用本网关服务不做任何明示或暗示的保证,包括但不限于本网关提供服务的适用性、没有错误或疏漏、持续性、准确性、可靠性、适用于某一特定用途。同时,我们也不对本网关提供的服务所涉及的技术及信息的有效性、准确性、正确性、可靠性、质量、稳定、完整和及时性作出任何承诺和保证。是否登陆或使用本网关提供的服务是您个人的决定且自行承担风险及可能产生的损失。我们对于数字资产的市场、价值及价格等不做任何明示或暗示的保证,您理解并了解数字资产市场是不稳定的,价格和价值随时会大幅波动或崩盘,交易数字资产是您个人的自由选择及决定且自行承担风险及可能产生的损失。"),s.a.createElement("p",null," ","7.7 本协议中规定的我们的保证和承诺是由我们就本协议和本网关提供的服务的唯一保证和陈述,并取代任何其他途径和方式产生的保证和承诺,无论是书面的或口头的,明示的或暗示的。所有这些保证和陈述仅仅代表我们自身的承诺和保证,并不保证任何第三方遵守本协议中的保证和承诺。"),s.a.createElement("p",null," ","7.8 我们并不放弃本协议中未提及的在法律适用的最大范围内我们享有的限制、免除或抵销我们损害赔偿责任的任何权利。"),s.a.createElement("p",null," ","7.9 使用本网关服务即表示认可我们按照本协议中规定的规则进行的任何操作,产生的任何风险均由您承担。"),s.a.createElement("p",null,"八、知识产权"),s.a.createElement("p",null," ","8.1 本网关所包含的全部智力成果包括但不限于网关标志、数据库、网关设计、文字和图表、软件、照片、录像、音乐、声音及其前述组合,软件编译、相关源代码和软件 (包括小应用程序和脚本) 的知识产权权利均归本网关所有。您不得为商业目的复制、更改、拷贝、发送或使用前述任何材料或内容。"),s.a.createElement("p",null," ","8.2 本网关名称中包含的所有权利 (包括但不限于商誉和商标、标志) 均归公司所有。"),s.a.createElement("p",null," ","8.3 您接受本协议即视为您主动将其在本网关发表的任何形式的信息的著作权, 包括但不限于:复制权、发行权、出租权、展览权、表演权、放映权、广播权、信息网络传播权、摄制权、改编权、翻译权、汇编权 以及应当由著作权人享有的其他可转让权利无偿独家转让给本网关所有,本网关有权利就任何主体侵权单独提起诉讼并获得全部赔偿。 本协议效力及于您在本网关发布的任何受著作权法保护的作品内容, 无论该内容形成于本协议签订前还是本协议签订后。"),s.a.createElement("p",null," ","8.4 您在使用本网关服务过程中不得非法使用或处分本网关或他人的知识产权权利。您不得将已发表于本网关的信息以任何形式发布或授权其它网关(及媒体)使用。"),s.a.createElement("p",null," ","8.5 您使用本网关提供的任何服务均不视为我们向您转让任何知识产权。"),s.a.createElement("p",null,"九、可分割性"),s.a.createElement("p",null,"如本协议中的任何条款被任何有管辖权的法院认定为不可执行的,无效的或非法的,并不影响本协议的其余条款的效力。"),s.a.createElement("p",null,"十、非代理关系"),s.a.createElement("p",null,"本协议中的任何规定均不可被认为创造了、暗示了或以其他方式将我们视为您的代理人、受托人或其他代表人,本协议有其他规定的除外。"),s.a.createElement("p",null,"十一、弃权"),s.a.createElement("p",null,"我们或您任何一方对追究本协议约定的违约责任或其他责任的弃权并不能认定或解释为对其他违约责任的弃权;未行使任何权利或救济不得以任何方式被解释为对该等权利或救济的放弃。"),s.a.createElement("p",null,"十二、标题"),s.a.createElement("p",null,"所有标题仅供协议表述方便,并不用于扩大或限制该协议条款的内容或范围。"),s.a.createElement("p",null,"十三、适用法律"),s.a.createElement("p",null,"本协议全部内容均为根据新加坡共和国法律订立的合同,其成立、解释、内容及执行均适用新加坡共和国相关法律规定;任何因或与本协议约定的服务有关而产生的索赔或诉讼,都应依照新加坡共和国的法律进行管辖并加以解释和执行。为避免疑义,这一条款明确适用于任何针对我们的侵权索赔。任何针对我们或者是和我们有关的索赔或诉讼的管辖法院或诉讼地均在新加坡共和国。您无条件地获得在新加坡共和国法院进行诉讼和上诉的排他性的管辖权。您也无条件地同意与本协议款有关的争议或问题或产生的任何索赔请求和诉讼的发生地或法院均排他性得在新加坡共和国。不方便法院的原则不适用于根据本服务条款的选择的法院。"),s.a.createElement("p",null,"十四、协议的生效和解释"),s.a.createElement("p",null,"14.1 本协议于您点击本网关注册页面的同意注册并完成注册程序、获得本网关账号和密码时生效,对本网关和您均具有约束力。"),s.a.createElement("p",null,"14.2 本协议的最终解释权归本网关所有。"));default:return s.a.createElement("div",{className:"container",ref:"agreement",style:{height:"500px",overflow:"auto",position:"relative"}},s.a.createElement("h2",{style:{textAlign:"center"}},"Service Agreement"),s.a.createElement("p",null,"OBSIDIAN TECHNOLOGY CO. PTE. LTD. (hereinafter referred to as the 'Company') is a company incorporated under the laws in Singapore Republic, GDEX (hereinafter referred to as 'GDEX' or 'the Gateway') is a cryptocurrency gateway to Bitshares which is operated by the company. The main access point for GDEX is https://gdex.io, GDEX is a gateway that provide cryptocurrency deposit and withdraw service (hereinafter referred to as 'the Service') to/from Bitshares. For the convenience of wording in this Agreement, the Company and the Gateway are referred to as 'We' or other applicable forms of first person pronouns in this Agreement. All natural persons or other subjects who use the Service shall be users of the Gateway. For the convenience of wording in this Agreement, the users are referred to as 'You' or any other applicable forms of the second-person pronouns. For the convenience of wording in this Agreement, you and us are collectively referred to as 'both parties', and individually as 'one party'."),s.a.createElement("p",null,"Important reminder:"),s.a.createElement("p",null,"We hereby remind you that:"),s.a.createElement("p",null,"1. The digital assets themselves are not offered by any financial institution, corporation or the Gateway;"),s.a.createElement("p",null,"2. The digital asset market is new and unconfirmed, and will not necessarily expand;"),s.a.createElement("p",null,"3. Digital assets are primarily used by speculators, and are used relatively less on retail and commercial markets; digital asset transactions are highly risky, due to the fact that they are traded throughout 24-hour a day without limits on the rise or fall in price, and market makers and global government policies may cause major fluctuations in their prices;"),s.a.createElement("p",null,"4. Digital asset transactions may be suspended or prohibited at any time due to the enactment or modification of national laws, regulations and regulatory documents. Digital assets trading is highly risky and therefore not suitable for the vast majority of people. You acknowledge and understand that investment in digital assets may result in partial or total loss of your investment and therefore you are advised to decide the amount of your investment on the basis of your loss-bearing capacity. You acknowledge and understand that digital assets may generate derivative risks. Therefore, if you have any doubt, you are advised to seek assistance from a financial adviser first. Furthermore, aside from the above-mentioned risks, there may also be unpredictable risks. Therefore, you are advised to carefully consider and use clear judgment to assess your financial position and the abovementioned risks before making any decisions on buying and selling digital assets; any and all losses arising therefrom will be borne by you and we shall not be held liable in any manner whatsoever."),s.a.createElement("p",null,"5. You understand that Bitshares is a decentralized exchange based on blockchain, the basic account service and the trade processing service are provided by Bitshares, there are also other institutions or single persons that issue assets and/or provide service on Bitshares. You understand that the Gateway is only used for you to deposit/withdraw cryptocurrency to/from Bitshares. The Gateway only undertake the due obligations for the availability of own issued assets (with 'GDEX.' as prefix of the name), do not undertake the due obligations for the account service and the trade processing service provided by Bitshares, do not undertake the due obligations for availability of the assets issued by other institutions or single persons."," "),s.a.createElement("p",null,"6. There are risk in both Internet and Bitshares, include but not limit to failure for software, hardware to connect to Internet, security risk for Bitshares accounting system. As the availability and reliability of Internet and Bitshares are not under our control, we do not undertake obligations for the loss caused by the risks mentioned above."),s.a.createElement("p",null,"7.it is prohibited to use the Gateway for money laundering, smuggling, bribery,if any user are found relevant to these actions, the Gateway will take various actions, include but not limited to terminating the Service to the user, informing relevant authority."))}}},{key:"render",value:function(){var e=this.props.locale;return this._getAgreement(e)}}]),t}();Ot.propTypes={locale:N.a.string};var Tt=Object(i.a)(Ot,{listenTo:function(){return[j.a]},getProps:function(){return{settings:j.a.getState().settings}}}),xt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var jt=new(a(1951))("-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCH+QtHPKcWxdL25xL4pCuu16tKh6yPx/TFnd/8\ncSt2TC+sPuYsD0h/sy4VKNxhBb7F7U/TLXjMxNcSfPVPjPM3X2LvOlmU9LOEcJGrmlmOOiyO/kws\nyKKOhR4UyZ1NghhfHjuyDBj6V8fCL+xBZTJWsh/X61Z0wLCwOzXcQCsNJwIDAQAB\n-----END PUBLIC KEY-----"),It=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={coins:null,activeCoinInfo:a._getActiveCoinInfo(e,{action:n}),action:n,down:!1,isAvailable:!0,user_info:null,isAgree:!1,agreeChecked:!0,agreeNotice:!1,locale:e.viewSettings.get("locale"),intermediate:null,memo_rule:null},a.user_info_cache=new it,a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),xt(t,[{key:"_getActiveCoinInfo",value:function(e,t){var a=e.viewSettings.get("activeCoin_"+e.provider+"_"+t.action,null),n=e.viewSettings.get("activeCoinId_"+e.provider,null),s=null;s="deposit"==t.action?"BTC":"GDEX.BTC";var i=a||s,o=n||1002;return this._getWithdrawRule(o),{name:i,id:o}}},{key:"_transformCoin",value:function(e){var t=[];try{e.filter(function(e){return 0!=e.status}).forEach(function(e){var a={};1==e.type?(a.innerAssetId=e.assetId,a.innerAssetName=e.assetName,a.innerSymbol=e.assetSymbol,a.outerAssetId=e.relationId,a.outerAssetName=e.relationSymbol,a.outerSymbol=e.relationSymbol,a.status=e.withdrawStatus,a.gateFee=e.withdrawFees,a.needMemo=e.needMemo,a.minTransactionAmount=e.minWithdrawAmount,a.type=e.type,a.relationPrecision=e.relationPrecision):2==e.type?(a.innerAssetId=e.relationId,a.innerAssetName=e.relationSymbol,a.innerSymbol=e.relationSymbol,a.outerAssetId=e.assetId,a.outerAssetName=e.assetName,a.outerSymbol=e.assetSymbol,a.status=e.depositStatus,a.gateFee=e.depositFees,a.needMemo=e.needMemo,a.minTransactionAmount=e.minDepositAmount,a.type=e.type,a.relationPrecision=e.relationPrecision):a=null,a&&t.push(a)})}catch(e){console.log("Transform coin failed: ",e)}return t}},{key:"_getUserInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e||(e=this.props.account.get("name")),t||(t=this.state.isAgree),t){var a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return et(e,E.e.BASE+E.e.GET_USER_INFO,t)}({userAccount:e,isAgree:t}),n=this;a.then(function(t){var a=t.user;n.setState({isAgree:!0,user_info:{user_id:a.uid,status:a.status}}),0==a.status&&a.agreeAgreement?n.user_info_cache.cacheUserInfo(e,a.uid,a.status):n.user_info_cache.delUserInfo(e)}),a.catch(function(e){console.log("Exception in fetching user info: "+e)})}}},{key:"_getCoins",value:function(){var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.requestType||(e.requestType=0),e.assetType||(e.assetType=0),e.version||(e.version="1.1"),et(e,E.e.BASE+E.e.ASSET_LIST,t)}({userAccount:this.props.account.get("name")}),t=this;e.then(function(e){var a=t._transformCoin(e.assets);t.setState({isAvailable:!0,coins:a})},function(e){console.log("fail"+e)}),e.catch(function(e){console.log(e),t.setState({isAvailable:!1})})}},{key:"_checkIsAgree",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e=this.props.account.get("name"));var t=this.user_info_cache.getUserInfo(e);if(t)this.setState({user_info:t,isAgree:!0});else{var a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return et(e,E.e.BASE+E.e.USER_AGREEMENT,t)}({userAccount:e}),n=this;a.then(function(t){t.agree?(n.setState({isAgree:!0}),n._getUserInfo(e,!0)):n.setState({isAgree:!1})},function(e){console.log("fail"+e)}),a.catch(function(e){console.log(e),n.setState({isAvailable:!1})})}}},{key:"componentWillMount",value:function(){this._checkIsAgree(),this._getCoins()}},{key:"_getWithdrawAssetId",value:function(e){var t=1,a="innerSymbol";return"deposit"==this.state.action&&(t=2,a="outerSymbol"),this.state.coins.filter(function(n){return n.type==t&&n[a]==e})[0].innerAssetId}},{key:"onSelectCoin",value:function(e){var t=this.state.activeCoinInfo;t.name=e.target.value;var a=this._getWithdrawAssetId(e.target.value);t.id=a,this.setState({activeCoinInfo:t}),this._getWithdrawRule(a);var n={};n["activeCoin_"+this.props.provider+"_"+this.state.action]=e.target.value,n["activeCoinId_"+this.props.provider]=a,I.a.changeViewSetting(n)}},{key:"_getWithdrawRule",value:function(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return et(e,E.e.BASE+E.e.WITHDRAW_RULE,t)}({assetId:e}),a=this;t.then(function(e){var t=jt.decryptPublic(e.transferToAccount,"utf-8");a.setState({intermediate:t,memo_rule:e.memoRule})},function(e){console.log("fail"+e),a.setState({intermediate:null})}),t.catch(function(e){console.log(e),a.setState({intermediate:null})})}},{key:"changeAction",value:function(e){var t=this._getActiveCoinInfo(this.props,{action:e});this.setState({action:e,activeCoinInfo:t}),I.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"componentWillReceiveProps",value:function(e){this.props.account!=e.account&&this._checkIsAgree(e.account.get("name"))}},{key:"_updateCheck",value:function(){this.setState({agreeChecked:!this.state.agreeChecked}),this.setState({agreeNotice:!1})}},{key:"_showUserAgreement",value:function(){y.a.publish("gdex_agreement","open")}},{key:"_registerUser",value:function(){this.state.agreeChecked?this._getUserInfo(null,!0):this.setState({agreeNotice:!0})}},{key:"render",value:function(){var e=this.props.account,t=this.state,a=t.coins,n=t.activeCoinInfo,i=t.action,o=t.isAvailable,r=t.user_info,l=t.isAgree,c=t.agreeChecked,p=t.agreeNotice,d=t.intermediate,m=t.memo_rule,h="https://support.gdex.io/",f="602573197",y="https://t.me/GDEXer",g=s.a.createElement("div",null,s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement(u.a,{content:"gateway.support_gdex"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("p",null,"Help:"," ",s.a.createElement("a",{href:h,target:"_blank",rel:"noopener noreferrer"},h)),s.a.createElement("p",null,"QQ:"," ",s.a.createElement("a",{target:"_blank",href:"//shang.qq.com/wpa/qunwpa?idkey=5d192c325146762cf5a9256038fed9faef4fcace21a36882854354dd1d599f11",rel:"noopener noreferrer"},f)),s.a.createElement("p",null,"Telegram:"," ",s.a.createElement("a",{href:y,target:"_blank",rel:"noopener noreferrer"},y)));if(!l)return s.a.createElement("div",null,s.a.createElement("span",null,s.a.createElement("input",{type:"checkbox",style:{marginRight:"10px"},checked:c,onChange:this._updateCheck.bind(this)}),s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.hint"}),s.a.createElement("a",{onClick:this._showUserAgreement.bind(this)}," ",s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.name"}))),p?s.a.createElement("div",{className:"has-error",style:{paddingTop:10}},s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.notice"})):null,s.a.createElement("div",{className:"buttonGroup"},s.a.createElement("span",{style:{marginTop:"20px"},onClick:this._registerUser.bind(this),className:" button"},s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.register"}))),s.a.createElement(_.a,{id:"gdex_agreement",overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(Tt,{locale:this.props.settings.get("locale","en")}))),g);if(!a&&o)return s.a.createElement(k.a,null);if(!o)return s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"}));var w=null,v=null,b=null;"deposit"==i?(v="outerAssetId",w="outerSymbol",b=2):(v="innerAssetId",w="innerSymbol",b=1);var E=(a=a.filter(function(e){return e.type==b})).map(function(e){return s.a.createElement("option",{value:e[w],key:e[w]},e[w])}).filter(function(e){return null!==e}),C=a.filter(function(e){return e[w]==n.name})[0],S=null;return C&&0==C.status?r?0!=r.status&&(S=s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.frozen",account:e.get("name"),component:"h4"}))):S=s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.user_unavailable",component:"h4"})):S=s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.asset_unavailable",asset:n.name,component:"h4"})),s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+i}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:n.name},E))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===i?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===i?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),S||s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(gt,{account:e,coin:C,issuer_account:d,user_id:r.user_id,action:this.state.action,gateway:"gdex",btsCoin:C.innerSymbol,memo_rule:m})),s.a.createElement(Ct,{userId:r.user_id,userAccount:e.get("name"),assetId:C[v],assetName:C[w],compactView:!0,fullHeight:!0,recordType:"deposit"==i?1:2,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+this.state.action})})),g)}}]),t}(),Pt=Object(i.a)(It,{listenTo:function(){return[j.a]},getProps:function(){return{viewSettings:j.a.getState().viewSettings,settings:j.a.getState().settings}}}),Dt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Wt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={trans_history:[]},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Dt(t,[{key:"_history",value:function(e,t){var a=this,n="";n="deposit"===t?E.i.BASE+E.i.DEPOSIT_HISTORY+"?account="+e:E.i.BASE+E.i.WITHDRAW_HISTORY+"?account="+e;var s={method:"GET",headers:new Headers({Accept:"application/json"}),mode:"cors",cache:"default"};fetch(n,s).then(function(e){if(e.ok)return e.json();this.LogError(e)}).then(function(e){return e}).then(function(e){return e}).then(function(e){a.setState({trans_history:e})})}},{key:"componentWillMount",value:function(){var e=this.props,t=e.account,a=e.action;this._history(t,a)}},{key:"componentWillUpdate",value:function(e,t){return e.action!==this.props.action&&(this._history(e.account,e.action),!0)}},{key:"LogError",value:function(e){console.error("服务器繁忙,请稍后重试; \r\nCode:"+e.status)}},{key:"render",value:function(){var e=[];return this.state.trans_history.forEach(function(t,a){e.push(s.a.createElement("tr",{key:a},s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,t.status)))),s.a.createElement("td",null,s.a.createElement("div",null,t.amount+t.inputCoinType)),s.a.createElement("td",null,s.a.createElement("div",null,s.a.createElement("a",{href:"https://www.cryptofresh.com/tx/"+t.txid,target:"_blank",rel:"noopener noreferrer"},t.txid))),s.a.createElement("td",null,t.createDate)))}),s.a.createElement("div",null,s.a.createElement("div",{className:"block-content-header"},s.a.createElement("span",null,this.props.action?s.a.createElement(u.a,{content:"gateway.recent_"+this.props.action}):s.a.createElement(u.a,{content:"account.recent"}))),s.a.createElement("table",{className:"table"},s.a.createElement("thead",null,e.length<=0?s.a.createElement("tr",{key:"no_recent"},s.a.createElement("td",{colSpan:"2"},s.a.createElement(u.a,{content:"operation.no_recent"}))):null,s.a.createElement("tr",null,s.a.createElement("th",null,"状态"),s.a.createElement("th",null,"deposit"===this.props.action?"充值数量":"提现数量"),s.a.createElement("th",null,"流水号"),s.a.createElement("th",null,"创建时间"))),s.a.createElement("tbody",null,e)))}}]),t}();Wt.propTypes={account:N.a.string,action:N.a.string};var Bt=Object(d.a)(Wt),Ft=a(2032),Rt=a(530),qt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Mt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));a.deposit_address_cache=new Rt.a;var n={Winex:E.i.BASE};return a.state={receive_address:{},url:e.url||n[e.gateway]},a.addDepositAddress=a.addDepositAddress.bind(a),a._copy=a._copy.bind(a),document.addEventListener("copy",a._copy),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),qt(t,[{key:"_copy",value:function(e){try{e.clipboardData.setData("text/plain",this.state.clipboardText),e.preventDefault()}catch(e){console.error(e)}}},{key:"_getDepositObject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{inputCoinType:e.deposit_coin_type,outputCoinType:e.receive_coin_type,outputAddress:e.account.get("name"),url:this.state.url,stateCallback:this.addDepositAddress}}},{key:"componentWillMount",value:function(){}},{key:"componentWillReceiveProps",value:function(e){e.account!==this.props.account&&this.setState({receive_address:{}})}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"addDepositAddress",value:function(e){var t=this.props.account.get("name");this.deposit_address_cache.cacheInputAddress(this.props.gateway,t,this.props.deposit_coin_type,this.props.receive_coin_type,e.address,e.memo),this.setState({receive_address:e})}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){y.a.publish(this.getWithdrawModalId(),"open")}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e="deposit"===this.props.action,t=s.a.createElement("div",{style:{display:"none",minHeight:150}});if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return t;var a=this.props.account.get("balances"),n=this.props.gateFee;this.props.receive_asset.get("symbol");if(this.props.deprecated_in_favor_of){var i=!1,o=a.get(this.props.receive_asset.get("id"));if(o){var r=m.ChainStore.getObject(o);if(r)0!=r.get("balance")&&(i=!0)}if(!i)return t}var l=this.state.receive_address;if(!Object.keys(l).length){var c=this.props.account.get("name");l=this.deposit_address_cache.getCachedInputAddress(this.props.gateway,c,this.props.deposit_coin_type,this.props.receive_coin_type)}if(!l)return Object(b.l)(this._getDepositObject()),s.a.createElement("div",{style:{margin:"3rem"}},s.a.createElement(k.a,{type:"three-bounce"}));var p=this.getWithdrawModalId(),d=null,h=null,f="",y=void 0;if(this.props.deposit_account){d=s.a.createElement("span",null,this.props.deposit_account),f=this.props.receive_coin_type+":"+this.props.account.get("name"),h=s.a.createElement("span",null,f);var E=this.props.deposit_coin_type+":"}else{l.memo?(y=l.memo,f=l.address,d=s.a.createElement("span",null,l.address),h=s.a.createElement("span",null,l.memo)):(f=l.address,d=s.a.createElement("span",null,l.address));E=""}if(!this.props.isAvailable||e&&!this.props.deposit_account&&!this.state.receive_address)return s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"}));var C={name:"Winex",qq:"623556771",support:"[email protected]"},S=s.a.createElement("div",null,s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"winex.gateway.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("span",null,"Mail:"),s.a.createElement("a",{href:(-1===C.support.indexOf("@")?"":"mailto:")+C.support,target:"_blank",rel:"noopener noreferrer"},C.support),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("span",null,"QQ群:"),s.a.createElement("a",{target:"_blank",href:"//shang.qq.com/wpa/qunwpa?idkey=5346c21c6da5f4990daf9b178e2c71a160e0d4cfd2bbb7bbae21eea80f44a11f",rel:"noopener noreferrer"},"623556771")));return e?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1})))))),S),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"left-label"},s.a.createElement("p",{style:{color:"red"}},s.a.createElement(u.a,{content:"winex.gateway.deposit_warning",asset:this.props.deposit_asset}))),s.a.createElement("div",{style:{padding:"10px 0",fontSize:"1.1rem",fontWeight:"bold"}},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,l.address&&"unknown"!==l.address?s.a.createElement(rt.a,{size:120,value:l.address}):null)),s.a.createElement("tr",null,s.a.createElement("td",null,l.address&&"unknown"!==l.address?l.address:s.a.createElement(u.a,{content:"winex.gateway.click_getaddress"}))),h?s.a.createElement("tr",null,s.a.createElement("td",null,"memo: ",h)):null)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},d?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,f)},"Copy address"):null,y?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,y)},"Copy memo"):null,s.a.createElement("button",{className:"button",onClick:b.l.bind(null,this._getDepositObject())},s.a.createElement(u.a,{content:"winex.gateway.get_deposit_address"})))))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(w.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(v.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(g.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(_.a,{id:p,overlay:!0},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(Ft.a,{account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),url:this.state.url,output_coin_name:this.props.deposit_asset_name,gateFee:n,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,min_withdraw_amount:this.props.min_withdraw_amount,max_withdraw_amount:this.props.max_withdraw_amount,fee_type:this.props.fee_type,memo_prefix:E,modal_id:p,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]}))),S)}}]),t}();Mt.propTypes={url:N.a.string,gateway:N.a.string,deposit_coin_type:N.a.string,deposit_asset_name:N.a.string,deposit_account:N.a.string,receive_coin_type:N.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:N.a.string,deposit_wallet_type:N.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:N.a.string,action:N.a.string,supports_output_memos:N.a.bool.isRequired,min_withdraw_amount:N.a.any,max_withdraw_amount:N.a.any,fee_type:N.a.string},Mt.defaultProps={autosubscribe:!1};var Lt=Object(d.a)(Mt),Ut=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,s=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(n=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);n=!0);}catch(e){s=!0,i=e}finally{try{!n&&r.return&&r.return()}finally{if(s)throw i}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Ht=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Jt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={coins:[],activeCoin:a._getActiveCoin(e,{action:n}),action:n},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Ht(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_Winex_"+t.action,null),n=null;return"deposit"==t.action&&(n="HSR"),"withdraw"==t.action&&(n="WIN.HSR"),a||n}},{key:"componentWillMount",value:function(){this._getCoins()}},{key:"componentWillReceiveProps",value:function(e){e.provider===this.props.provider&&e.action===this.props.action||this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_"+this.props.provider+"_"+this.state.action]=e.target.value,I.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),I.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"_getCoins",value:function(){var e=this;Promise.all([Object(b.d)(E.i.BASE+E.i.COINS_LIST),Object(b.f)(E.i.BASE+E.i.TRADING_PAIRS),Object(b.g)(E.i.BASE+E.i.ACTIVE_WALLETS)]).then(function(t){var a=Ut(t,3),n=a[0],s=a[1],i=a[2],o=e._getBackedCoins({allCoins:n,tradingPairs:s}).filter(function(e){return!!e.walletType});o.forEach(function(e){e.isAvailable=-1!==i.indexOf(e.walletType)}),e.setState({coins:o})})}},{key:"_getBackedCoins",value:function(e){var t=e.allCoins,a=e.tradingPairs,n={};t.forEach(function(e){return n[e.coinType]=e});var s={};a.forEach(function(e){s[e.inputCoinType]||(s[e.inputCoinType]={}),s[e.inputCoinType][e.outputCoinType]=!0});var i=[];return t.forEach(function(e){if(e.backingCoinType&&n[e.backingCoinType]){var t=s[e.backingCoinType]&&s[e.backingCoinType][e.coinType],a=s[e.coinType]&&s[e.coinType][e.backingCoinType];i.push({name:n[e.backingCoinType].name,intermediateAccount:n[e.backingCoinType].intermediateAccount,gateFee:n[e.backingCoinType].gateFee,walletType:n[e.backingCoinType].walletType,backingCoinType:n[e.backingCoinType].walletSymbol,symbol:e.walletSymbol,supportsMemos:n[e.backingCoinType].supportsOutputMemos,depositAllowed:t,withdrawalAllowed:a,minWithdrawAmount:n[e.backingCoinType].minAmount,maxWithdrawAmount:n[e.backingCoinType].maxAmount,feeType:n[e.backingCoinType].gateFeeType})}}),i}},{key:"render",value:function(){var e=this.props,t=e.account,a=e.provider,n=this.state,i=n.activeCoin,o=n.action,r=n.coins;if(!r.length)return s.a.createElement(k.a,null);var l=r.filter(function(e){return!(!e||!e.symbol)&&("deposit"===o?e.depositAllowed:e.withdrawalAllowed)}),c=l.map(function(e){var t="deposit"===o?e.backingCoinType.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),p=l.filter(function(e){return"deposit"===o?e.backingCoinType.toUpperCase()===i:e.symbol===i})[0];return p||(p=l[0]),s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+o}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:i},c))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===this.state.action?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===this.state.action?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),p?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(Lt,{key:a+"."+p.symbol,gateway:a,issuer_account:p.intermediateAccount,account:t,deposit_asset:p.backingCoinType.toUpperCase(),deposit_asset_name:p.name,deposit_coin_type:p.backingCoinType.toLowerCase(),deposit_account:p.depositAccount,deposit_wallet_type:p.walletType,gateFee:p.gateFee,receive_asset:p.symbol,receive_coin_type:p.symbol.toLowerCase(),supports_output_memos:p.supportsMemos,isAvailable:p.isAvailable,min_withdraw_amount:p.minWithdrawAmount,max_withdraw_amount:p.maxWithdrawAmount,fee_type:p.feeType,action:this.state.action})),s.a.createElement(Bt,{account:t.get("name"),action:this.state.action})):null)}}]),t}(),zt=(Object(i.a)(Jt,{listenTo:function(){return[j.a]},getProps:function(){return{viewSettings:j.a.getState().viewSettings}}}),function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}());function Gt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vt(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function Xt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Kt=function(e){function t(e){Gt(this,t);var a=Vt(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={olService:e.viewSettings.get("olService","gateway"),rudexService:e.viewSettings.get("rudexService","gateway"),btService:e.viewSettings.get("btService","bridge"),citadelService:e.viewSettings.get("citadelService","bridge"),metaService:e.viewSettings.get("metaService","bridge"),activeService:e.viewSettings.get("activeService",0),olNotice1Informed:!1},a}return Xt(t,s.a.Component),zt(t,[{key:"shouldComponentUpdate",value:function(e,t){return e.account!==this.props.account||e.servicesDown!==this.props.servicesDown||!l.a.are_equal_shallow(e.blockTradesBackedCoins,this.props.blockTradesBackedCoins)||!l.a.are_equal_shallow(e.openLedgerBackedCoins,this.props.openLedgerBackedCoins)||!l.a.are_equal_shallow(e.citadelBackedCoins,this.props.citadelBackedCoins)||t.olService!==this.state.olService||t.rudexService!==this.state.rudexService||t.btService!==this.state.btService||t.citadelService!==this.state.citadelService||t.metaService!==this.state.metaService||t.activeService!==this.state.activeService||t.olNotice1Informed!==this.state.olNotice1Informed}},{key:"componentWillMount",value:function(){o.a.getFinalFeeAsset(this.props.account,"transfer")}},{key:"toggleOLService",value:function(e){this.setState({olService:e}),I.a.changeViewSetting({olService:e})}},{key:"toggleRuDEXService",value:function(e){this.setState({rudexService:e}),I.a.changeViewSetting({rudexService:e})}},{key:"toggleBTService",value:function(e){this.setState({btService:e}),I.a.changeViewSetting({btService:e})}},{key:"onolNotice1Informed",value:function(){this.setState({olNotice1Informed:!this.state.olNotice1Informed})}},{key:"toggleCitadelService",value:function(e){this.setState({citadelService:e}),I.a.changeViewSetting({citadelService:e})}},{key:"toggleMetaService",value:function(e){this.setState({metaService:e}),I.a.changeViewSetting({metaService:e})}},{key:"onSetService",value:function(e){this.setState({activeService:parseInt(e.target.value)}),I.a.changeViewSetting({activeService:parseInt(e.target.value)})}},{key:"renderServices",value:function(e,t){var a=[],n=this.props.account,i=this.state,o=i.olService,r=(i.btService,i.rudexService),l=i.olNotice1Informed;i.citadelService;return a.push({name:"RuDEX (RUDEX.X)",template:s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleRuDEXService.bind(this,"gateway"),className:"gateway"===r?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.gateway"}))),s.a.createElement("li",{onClick:this.toggleRuDEXService.bind(this,"fiat"),className:"fiat"===r?"is-active":""},s.a.createElement(u.a,{component:"a",content:"gateway.fiat"})))),"gateway"===r&&t.length?s.a.createElement(Je,{account:n,coins:t}):null,"fiat"===r?s.a.createElement("div",null,s.a.createElement(Ve,{account:n})):null)}),a.push({name:"Openledger (OPEN.X)",template:s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleOLService.bind(this,"gateway"),className:"gateway"===o?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.gateway"}))),s.a.createElement("li",{onClick:this.toggleOLService.bind(this,"fiat"),className:"fiat"===o?"is-active":""},s.a.createElement(u.a,{component:"a",content:"gateway.fiat"})))),"gateway"===o&&e.length?s.a.createElement("div",null,s.a.createElement("p",null,s.a.createElement(u.a,{style:{color:"darkred",marginBottom:"1em",display:"block"},component:"h5",content:"gateway.rudex.openledger_notice1"}),s.a.createElement("a",{href:"https://blog.openledger.info/2017/12/18/openledger-official-web-sites-get-updates-by-the-first",target:"_blank"},"https://blog.openledger.info/2017/12/18/openledger-official-web-sites-get-updates-by-the-first")),s.a.createElement("p",null,s.a.createElement("h5",null,s.a.createElement("input",{type:"checkbox",defaultChecked:this.state.olNotice1Informed,onChange:this.onolNotice1Informed.bind(this)})," ","-"," ",s.a.createElement(u.a,{content:"gateway.rudex.openledger_notice1_informed"}))),s.a.createElement("hr",null),l?s.a.createElement(J,{account:n,coins:e,provider:"openledger"}):null):null,"fiat"===o?s.a.createElement("div",null,s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement(u.a,{component:"h5",content:"gateway.fiat_text",unsafe:!0})),s.a.createElement(ce,{rpc_url:E.f.RPC_URL,account:n,issuer_account:"openledger-fiat"}),s.a.createElement(de,{rpc_url:E.f.RPC_URL,account:n})):null)}),a.push({name:"BitKapital",template:s.a.createElement(xe.a,{viewSettings:this.props.viewSettings,account:n})}),a.push({name:"GDEX",template:s.a.createElement("div",null,s.a.createElement(Pt,{account:n,provider:"gdex"}))}),a}},{key:"render",value:function(){var e=this.props,t=e.account,a=e.servicesDown,n=this.state.activeService,i=this.props.openLedgerBackedCoins.map(function(e){return e}).sort(function(e,t){return e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0}),o=this.props.rudexBackedCoins.map(function(e){return e}).sort(function(e,t){return e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0}),r=this.renderServices(i,o),l=r.map(function(e,t){return s.a.createElement("option",{key:t,value:t},e.name)}),c=["RUDEX","Winex","GDEX","OPEN","TRADE"][n],p=a.get(c);return s.a.createElement("div",{className:this.props.contained?"grid-content":"grid-container"},s.a.createElement("div",{className:this.props.contained?"":"grid-content",style:{paddingTop:"2rem"}},s.a.createElement(u.a,{content:"gateway.title",component:"h2"}),s.a.createElement("div",{className:"grid-block vertical medium-horizontal no-margin no-padding"},s.a.createElement("div",{className:"medium-6 show-for-medium"},s.a.createElement(Oe.a,{path:"components/DepositWithdraw",section:"deposit-short"})),s.a.createElement("div",{className:"medium-5 medium-offset-1"},s.a.createElement(Oe.a,{account:t.get("name"),path:"components/DepositWithdraw",section:"receive"}))),s.a.createElement("div",null,s.a.createElement("div",{className:"grid-block vertical medium-horizontal no-margin no-padding"},s.a.createElement("div",{className:"medium-6 small-order-2 medium-order-1"},s.a.createElement(u.a,{component:"label",className:"left-label",content:"gateway.service"}),s.a.createElement("select",{onChange:this.onSetService.bind(this),className:"bts-select",value:n},l),p?s.a.createElement(u.a,{style:{color:"red",marginBottom:"1em",display:"block"},content:"gateway.unavailable_"+c}):null),s.a.createElement("div",{className:"medium-5 medium-offset-1 small-order-1 medium-order-2",style:{paddingBottom:20}},s.a.createElement(u.a,{component:"label",className:"left-label",content:"gateway.your_account"}),s.a.createElement("div",{className:"inline-label"},s.a.createElement(Ke.a,{size:{height:40,width:40},account:t.get("name"),custom_image:null}),s.a.createElement("input",{type:"text",value:t.get("name"),placeholder:null,disabled:!0,onChange:function(){},onKeyDown:function(){},tabIndex:1}))))),s.a.createElement("div",{className:"grid-content no-padding",style:{paddingTop:15}},p?null:n&&r[n]?r[n].template:r[0].template)))}}]),t}();Kt.propTypes={account:p.a.ChainAccount.isRequired,contained:N.a.bool},Kt.defaultProps={contained:!1},Kt=Object(d.a)(Kt);var Yt=function(e){function t(){return Gt(this,t),Vt(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Xt(t,s.a.Component),zt(t,[{key:"componentWillMount",value:function(){Object(r.g)()}},{key:"render",value:function(){return s.a.createElement(Kt,this.props)}}]),t}();t.default=Object(i.a)(Yt,{listenTo:function(){return[Te.a,j.a,Xe.a]},getProps:function(){return{account:Te.a.getState().currentAccount,viewSettings:j.a.getState().viewSettings,openLedgerBackedCoins:Xe.a.getState().backedCoins.get("OPEN",[]),rudexBackedCoins:Xe.a.getState().backedCoins.get("RUDEX",[]),blockTradesBackedCoins:Xe.a.getState().backedCoins.get("TRADE",[]),citadelBackedCoins:Xe.a.getState().backedCoins.get("CITADEL",[]),winexBackedCoins:Xe.a.getState().backedCoins.get("WIN",[]),servicesDown:Xe.a.getState().down||{}}}})}}]);
//# sourceMappingURL=deposit-withdraw.js.map