-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaccount~dashboard~dashboard-accounts~transfer.2bfcdd1ba09c11f29910.js
2 lines (2 loc) · 14.4 KB
/
account~dashboard~dashboard-accounts~transfer.2bfcdd1ba09c11f29910.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{1756:function(e,t,n){"use strict";var a=n(0),r=n.n(a),o=n(1798),i=n.n(o),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();var c=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,r.a.Component),s(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?r.a.createElement(i.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):r.a.createElement(this.props.component)}}]),t}();c.defaultProps={component:"span",enterTimeout:2e3},t.a=c},1766:function(e,t,n){"use strict";n.d(t,"a",function(){return F}),n.d(t,"b",function(){return L});var a=n(0),r=n.n(a),o=n(3),i=n.n(o),s=n(338),c=n(533),l=n(39),u=n(48),p=n(16),h=n(10),f=n(1760),m=n.n(f),d=n(14),y=n.n(d),b=n(21),_=n(5),g=n.n(_),v=n(1),w=n.n(v),E=n(1768),k=n(1782),x=n.n(k),H=n(41),O=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N(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 S(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 A=h.ChainTypes.operations,C={textAlign:"left"},P=Object.keys(A);function T(e,t){return t.block_num===e.block_num?t.virtual_op-e.virtual_op:t.block_num-e.block_num}var F=function(e){function t(e){j(this,t);var n=N(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.state={limit:e.limit,fetchingAccountHistory:!1,headerHeight:85,filter:"all",accountHistoryError:!1},n}return S(t,r.a.Component),O(t,[{key:"componentDidMount",value:function(){if(!this.props.fullHeight){var e=this.refs.transactions;m.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 n=0;n<e.accountsList.length;++n){var a=e.accountsList[n],r=this.props.accountsList[n];if(a&&r&&a.get("history")!==r.get("history"))return!0}return!1}},{key:"_onIncreaseLimit",value:function(){this.setState({limit:this.state.limit+30})}},{key:"_getAccountHistoryES",value:function(e,t,n){var a="https://wrapper.elasticsearch.bitshares.ws";return console.log("query",a+"/get_account_history?account_id="+e+"&from_="+n+"&size="+t+"&sort_by=block_data.block_time&type=data&agg_field=operation_type"),new Promise(function(r,o){fetch(a+"/get_account_history?account_id="+e+"&from_="+n+"&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"}});r(t)}).catch(function(e){console.warn("query failed",e),r([])})})}},{key:"_getHistory",value:function(e,t,n){var a=[],r=new Set,o=!0,i=!1,s=void 0;try{for(var c,l=e[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;if(u){var p=u.get("history");p&&(a=a.concat(p.toJS().filter(function(e){return!r.has(e.id)&&r.add(e.id)})))}}}catch(e){i=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw s}}return t&&(a=a.filter(function(e){return e.op[0]===A[t]})),n&&(a=a.filter(function(e){return n.fields.reduce(function(t,a){switch(a){case"asset_id":return t&&e.op[1].amount[a]===n.values[a];default:return t&&e.op[1][a]===n.values[a]}},!0)})),a}},{key:"_generateCSV",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function a(r,o){try{var i=t[r](o),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});e(s)}("next")})}}(regeneratorRuntime.mark(function e(){var t,n,a,r,o,i,c,l,u,p,f,m,d,y,b,_;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.setState({fetchingAccountHistory:!0}),t=0,n=150,a=this.props.accountsList[0].get("id"),e.next=6,Object(h.FetchChain)("getAccount",a);case 6:r=e.sent.get("name"),o={};case 8:return e.next=11,this._getAccountHistoryES(a,n,t);case 11:if((i=e.sent).length){e.next=14;break}return e.abrupt("break",22);case 14:return e.next=16,x.a.resolveBlockTimes(i);case 16:return e.next=18,x.a.resolveAssets(i);case 18:i.map(function(e){var t=e.id,n=P[e.op.type],a=e.op.data;switch(n){case"vesting_balance_withdraw":case"transfer":a.amount=a.amount_}o[t]={timestamp:new Date(e.block_time),type:n,data:a}}),t+=i.length,e.next=8;break;case 22:if(Object.keys(o).length){e.next=24;break}return e.abrupt("return",this.setState({fetchingAccountHistory:!1,accountHistoryError:!0}));case 24:for(o=x.a.groupEntries(o),c=x.a.parseData(o,a,r),l="",u=!0,p=!1,f=void 0,e.prev=30,m=c[Symbol.iterator]();!(u=(d=m.next()).done);u=!0)y=d.value,l+=y.join(",")+"\n";e.next=38;break;case 34:e.prev=34,e.t0=e.catch(30),p=!0,f=e.t0;case 38:e.prev=38,e.prev=39,!u&&m.return&&m.return();case 41:if(e.prev=41,!p){e.next=44;break}throw f;case 44:return e.finish(41);case 45:return e.finish(38);case 46:b=new Blob([l],{type:"text/csv;charset=utf-8"}),_=new Date,Object(s.saveAs)(b,"bitshares-account-history-"+r+"-"+_.getFullYear()+"-"+("0"+(_.getMonth()+1)).slice(-2)+"-"+("0"+_.getDate()).slice(-2)+"-"+("0"+_.getHours()).slice(-2)+("0"+_.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,n=e.compactView,a=e.filter,o=e.customFilter,s=e.style,l=e.maxHeight,u=this.state,p=u.limit,h=u.headerHeight,f=1===t.length&&t[0]?t[0].get("id"):null,m=this._getHistory(t,this.props.showFilters&&"all"!==this.state.filter?this.state.filter:a,o).sort(T),d=m.length;s=s||{width:"100%",height:"100%"};var _=null;_=["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 r.a.createElement("option",{value:e,key:e},y.a.translate("transaction.trxTypes."+e))});var v=m.length?m.slice(0,p).map(function(e){return r.a.createElement(c.a,{includeOperationId:!0,operationId:e.id,style:C,key:e.id,op:e.op,result:e.result,txIndex:e.trx_in_block,block:e.block_num,current:f,hideFee:!0,inverted:!1,hideOpLabel:n,fullDate:!0})}):[r.a.createElement("tr",{key:"no_recent"},r.a.createElement("td",{colSpan:n?"2":"3"},r.a.createElement(i.a,{content:"operation.no_recent"})))],w=r.a.createElement("tr",{className:"total-value",key:"total_value"},r.a.createElement("td",{style:{textAlign:"center"}},d>0?r.a.createElement("span",null,r.a.createElement("a",{className:"inline-block",onClick:this._generateCSV.bind(this),"data-tip":y.a.translate("transaction.csv_tip"),"data-place":"bottom"},r.a.createElement(b.a,{name:"excel",title:"icons.excel",className:"icon-14px"}))):null),r.a.createElement("td",{className:"column-hide-tiny"}),r.a.createElement("td",{style:{textAlign:"center"}}," ",this.props.showMore&&d>this.props.limit||p<d?r.a.createElement("a",{onClick:this._onIncreaseLimit.bind(this)},r.a.createElement(b.a,{name:"chevron-down",title:"icons.chevron_down.transactions",className:"icon-14px"})):null),r.a.createElement("td",null));return r.a.createElement("div",{className:"recent-transactions no-overflow",style:s},r.a.createElement("div",{className:"generic-bordered-box"},this.props.dashboard?null:r.a.createElement("div",{ref:"header"},r.a.createElement("div",{className:"block-content-header"},r.a.createElement("span",null,this.props.title?this.props.title:r.a.createElement(i.a,{content:"account.recent"})))),r.a.createElement("div",{className:"header-selector"},r.a.createElement("div",{className:"selector"},r.a.createElement("div",{className:g()("inline-block")},this.props.showFilters?r.a.createElement("select",{"data-place":"left","data-tip":y.a.translate("tooltip.filter_ops"),style:{paddingTop:5,width:"auto"},className:"bts-select no-margin",value:this.state.filter,onChange:this._onChangeFilter.bind(this)},_):null)),this.state.accountHistoryError&&r.a.createElement("div",{className:"has-error",style:{paddingLeft:"0.75rem"}},r.a.createElement(i.a,{content:"account.history_error"}))),r.a.createElement("div",{className:"box-content grid-block no-margin",style:this.props.fullHeight?null:{maxHeight:l-h},ref:"transactions"},r.a.createElement(E.a,{withTransition:!0,className:"table table-striped "+(n?"compact":"")+(this.props.dashboard?" dashboard-table table-hover":""),header:r.a.createElement("tr",null,r.a.createElement("th",{className:"column-hide-tiny",style:C},r.a.createElement(i.a,{content:"account.transactions.id"})),r.a.createElement("th",{className:"column-hide-tiny",style:C},r.a.createElement(i.a,{content:"account.transactions.type"})),r.a.createElement("th",{style:C},r.a.createElement(i.a,{content:"account.transactions.info"})),r.a.createElement("th",null,r.a.createElement(i.a,{content:"account.transactions.time"}))),rows:v,label:"utility.total_x_operations",extraRow:w})),this.state.fetchingAccountHistory&&r.a.createElement(H.a,null)))}}]),t}();F.propTypes={accountsList:l.a.ChainAccountsList.isRequired,compactView:w.a.bool,limit:w.a.number,maxHeight:w.a.number,fullHeight:w.a.bool,showFilters:w.a.bool},F.defaultProps={limit:25,maxHeight:500,fullHeight:!1,showFilters:!1},F=Object(u.a)(F);var L=function(e){function t(){return j(this,t),N(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return S(t,r.a.Component),O(t,[{key:"render",value:function(){return r.a.createElement("span",{className:"wrapper"},this.props.children(this.props))}}]),t}();L.propTypes={asset:l.a.ChainAsset.isRequired,to:l.a.ChainAccount.isRequired,fromAccount:l.a.ChainAccount.isRequired},L.defaultProps={asset:"1.3.0"},L=Object(u.a)(L)},1768:function(e,t,n){"use strict";var a=n(0),r=n.n(a),o=n(270),i=n(14),s=n.n(i),c=n(1756),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),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 n=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 n.state={page:1,pageSize:e.pageSize},n}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,r.a.Component),l(t,[{key:"onChange",value:function(e,t){this.setState({page:e,pageSize:t})}},{key:"render",value:function(){var e=this,t=this.state,n=t.page,a=t.pageSize,i=this.props,l=i.header,u=i.rows,p=i.extraRow,h=u.length,f=m(n,a);function m(e,t){for(var n=[],a=(e-1)*t;a<Math.min(h,e*t);a++)n.push(u[a]);return n}return!f.length&&h&&(f=m(1,a)),r.a.createElement("div",{className:"grid-content",style:this.props.style},r.a.createElement("table",{className:this.props.className},l?r.a.createElement("thead",null,l):null,this.props.withTransition&&1===n?r.a.createElement(c.a,{component:"tbody",transitionName:"newrow"},f,p):r.a.createElement("tbody",null,f,p)),h>a?r.a.createElement(o.a,{style:{paddingTop:"1rem",paddingBottom:"1rem",paddingLeft:this.props.leftPadding||null},total:h,showTotal:function(t){return s.a.translate(e.props.label,{count:t})},pageSize:a,current:n,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}}]);
//# sourceMappingURL=account~dashboard~dashboard-accounts~transfer.js.map