-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdashboard~dashboard-accounts.js.map
1 lines (1 loc) · 17.1 KB
/
dashboard~dashboard-accounts.js.map
1
{"version":3,"file":"dashboard~dashboard-accounts.5a6c1b0a4b9d1c826711.js","sources":["webpack:///dashboard~dashboard-accounts.5a6c1b0a4b9d1c826711.js"],"sourcesContent":["(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{1771:function(e,t,n){var a=n(30),r=n(1772),o={},s={},c={};function i(e,t,n,a){o[e]||(o[e]=[]),s[e]||(s[e]=[]),o[e].push(t),s[e].push([n,t,new Date(a)]),c[e]||(c[e]={}),c[e][n]||(c[e][n]={deposit:[],withdrawal:[]}),c[e][n][t>0?\"deposit\":\"withdrawal\"].push(t)}function l(e,t,n,a,o,s,c,l,u){return n||(n={amount:\"\",currency:\"\"}),a||(a={amount:\"\",currency:\"\"}),o||(o={amount:\"\",currency:\"\"}),n.amount&&i(n.currency,n.amount,c,s),a.amount&&i(a.currency,-a.amount,c,s),o.amount&&i(o.currency,-o.amount,c,s),e.push([t,r.printAmount(n),n.currency,r.printAmount(a),a.currency,r.printAmount(o),o.currency,\"BTS-DEX\",u||\"\",l||\"\",s]),e}e.exports={parseData:function(e,t,n){var a=[];a.push([\"Type\",\"Buy Amount\",\"Buy Currency\",\"Sell Amount\",\"Sell Currency\",\"Fee Amount\",\"Fee Currency\",\"Exchange\",\"Trade Group\",\"Comment\",\"Date\"]);var o={};function s(e){o[e]||(o[e]=0),o[e]++}var c=Object.keys(e),i=Array.isArray(c),u=0;for(c=i?c:c[Symbol.iterator]();;){var p;if(i){if(u>=c.length)break;p=c[u++]}else{if((u=c.next()).done)break;p=u.value}var d=e[p],m=d.timestamp,h=d.type,f=d.data,_=null;switch(h){case\"vesting_balance_withdraw\":var y=r.parseCurrency(f.amount);_=r.parseCurrency(f.fee),a=l(a,\"1.2.30665\"===f.owner&&y.amount>1e4?\"Income\":\"Deposit\",y,null,_,m,h,n+\" : Vesting balance withdraw\"),s(h);break;case\"balance_claim\":a=l(a,\"Deposit\",r.parseCurrency(f.total_claimed),null,null,m,h,n+\" : Balance claim\"),s(h);break;case\"transfer\":var g=r.parseCurrency(f.amount);_=r.parseCurrency(f.fee),a=f.to==t?l(a,\"1.2.391938\"===f.to&&\"1.2.381086\"===f.from?\"Income\":\"Deposit\",g,null,null,m,h,n+\" : From \"+f.from):l(a,\"Withdrawal\",null,g,_,m,h,n+\": To \"+f.to),s(h);break;case\"fill_order\":var b=r.parseCurrency(f.pays),v=r.parseCurrency(f.receives);\"BTS\"!==(_=r.parseCurrency(f.fee)).currency&&(v.currency===_.currency?(v.amount-=_.amount,_.amount=0):b.currency===_.currency&&(b.amount-=_.amount,_.amount=0)),a=l(a,\"Trade\",v,b,_,m,h),s(h);break;case\"asset_issue\":var w=r.parseCurrency(f.asset_to_issue);_=f.issuer===t?r.parseCurrency(f.fee):null,f.issue_to_account===t&&(a=l(a,\"Deposit\",w,null,_,m,h,n+\" : Issued to account\")),s(h);break;case\"account_update\":case\"proposal_create\":case\"proposal_update\":case\"account_whitelist\":case\"worker_create\":case\"limit_order_create\":case\"limit_order_cancel\":case\"call_order_update\":(_=r.parseCurrency(f.fee)).amount>0&&(a=l(a,\"Withdrawal\",null,_,null,m,h,h+\" fee\"),s(h));break;case\"account_create\":f.registrar===t&&(a=l(a,\"Withdrawal\",null,_=r.parseCurrency(f.fee),null,m,h,h+\" fee\"),s(h));break;case\"asset_fund_fee_pool\":_=r.parseCurrency(f.fee),a=l(a,\"Withdrawal\",null,r.parseCurrency({amount:f.amount,asset_id:\"1.3.0\"}),_,m,h,\"\"+h),s(h);break;default:console.log(\"Unhandled type:\",h,f)}}return a},filterEntries:function(e,t,n){if(!t&&!n)return e;for(var a=Object.keys(e),r=a.length-1;r>=0;r--){var o=a[r],s=e[o],c=s.timestamp,i=s.type;s.data,t&&i!==t?delete e[o]:n&&new Date(c).getTime()<n&&delete e[o]}return console.log(\"Removed \"+(a.length-Object.keys(e).length)+\" entries by filtering\"),e},groupEntries:function(e){for(var t={},n=Object.keys(e),r=n.length-1;r>=0;r--){var o=n[r],s=e[o],c=s.timestamp,i=s.type,l=s.data;switch(i){case\"fill_order\":var u=a(c),p=l.receives.asset_id+\"_\"+l.pays.asset_id,d=t[p],m=d?a(d.timestamp):null;d&&u.isSame(m,\"day\")&&d.data.pays.asset_id===l.pays.asset_id&&d.data.receives.asset_id===l.receives.asset_id&&(l.pays.amount=parseInt(l.pays.amount,10)+parseInt(d.data.pays.amount,10),l.receives.amount=parseInt(l.receives.amount,10)+parseInt(d.data.receives.amount,10),l.fee.amount=parseInt(l.fee.amount,10)+parseInt(d.data.fee.amount,10),e[o].data=l,delete e[d.trx_id]),t[p]={data:l,timestamp:c,trx_id:o}}}return console.log(\"Removed \"+(n.length-Object.keys(e).length)+\" fill_order entries by grouping\"),e}}},1772:function(e,t,n){var a=n(10).ChainStore;e.exports={parseCurrency:function(e){var t=a.getAsset(e.asset_id),n=function(e){if(\"number\"!=typeof e)throw new Error(\"Input must be a number\");return Math.pow(10,e)}((t=t?t.toJS():{precision:5}).precision);return{amount:e.amount/n,currency:t.symbol,asset_id:e.asset_id}},printAmount:function(e){if(!e.amount||!e.currency)return\"\";var t=a.getAsset(e.asset_id);return t=t?t.toJS():{precision:5},e.amount.toFixed(t.precision)},getIndex:function(e){var t=e.split(\".\");return parseInt(t[2],10)}}},1773:function(e,t,n){var a=n(1774),r=n(13),o=n(10),s=o.ChainTypes,c=o.ChainStore,i=o.FetchChain,l=s.operations,u=Object.keys(l),p={},d={};function m(e){return new Promise(function(t,n){if(p[e])return t(p[e]);r.Apis.instance().db_api().exec(\"get_block\",[e]).then(function(n){p[e]=new Date(n.timestamp+\"Z\"),t(p[e])}).catch(n)})}function h(e){return new Promise(function(t,n){var a;if(d[e])return t(d[e]);i(\"getObject\",e,void 0,(a={},a[e]=!1,a)).then(function(n){var a=n.toJS();d[e]={symbol:a.symbol.replace(/OPEN\\.|BRIDGE\\.|RUDEX\\.|GDEX\\.|BLOCK\\./,\"\"),precision:a.precision},t(d[e])}).catch(function(e){n()})})}e.exports={connect:function(){return new Promise(function(e){r.Apis.instance(a.apiNode,!0).init_promise.then(function(t){c.init(!1).then(function(){e(t)})}).catch(function(e){console.error(\"Error connection to node:\",e)})})},disconnect:function(){r.Apis.instance().close()},getUser:function(e){return new Promise(function(t,n){var a;i(\"getAccount\",e,void 0,(a={},a[e]=!1,a)).then(function(e){var n=e.toJS();n.balances||(n.balances={}),n.call_orders||(n.call_orders=[]);var a=Object.keys(n.balances);t({accountId:n.id,assets:a,balances:n.balances})}).catch(n)})},getBlockTime:m,getAssetData:h,resolveAssets:function(e,t){return new Promise(function(n,a){var r=[],o={};e&&e.forEach(function(e){switch(u[e.op[0]]){case\"transfer\":o[e.op[1].amount.asset_id]=!0,o[e.op[1].fee.asset_id]=!0;break;case\"fill_order\":o[e.op[1].pays.asset_id]=!0,o[e.op[1].receives.asset_id]=!0,o[e.op[1].fee.asset_id]=!0;break;case\"asset_issue\":o[e.op[1].asset_to_issue.asset_id]=!0,o[e.op[1].fee.asset_id]=!0}}),t&&t.forEach(function(e){o[e]=!0}),Object.keys(o).forEach(function(e){!d[e]&&e&&r.push(h(e))}),Promise.all(r).then(n).catch(a)})},resolveBlockTimes:function(e){return new Promise(function(t,n){var a=e.map(function(e){return e.block_time&&(p[e.block_num]=new Date(e.block_time)),m(e.block_num)});Promise.all(a).then(t).catch(n)})},getAsset:function(e){return d[e]},getBlock:function(e){return p[e]}}},1774:function(e,t){e.exports={apiNode:\"wss://eu.nodes.bitshares.ws\",useES:!0,esNode:\"https://eswrapper.bitshares.eu\",botPaymentAccounts:[]}},1775:function(e,t,n){var a=n(13),r=void 0;e.exports=function(e){return r=e?fetch:n(1776),{getAccountHistory:function(e,t,n,r){return new Promise(function(o,s){a.Apis.instance().history_api().exec(\"get_account_history\",[e,t,n,r]).then(function(e){o(e)}).catch(s)})},getAccountHistoryES:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:\"https://eswrapper.bitshares.eu\";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(o,s){r(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{id:e.account_history.operation_id,op:JSON.parse(e.operation_history.op),result:JSON.parse(e.operation_history.operation_result),block_num:e.block_data.block_num,block_time:e.block_data.block_time+\"Z\"}});o(t)}).catch(function(){o([])})})}}}},1776:function(e,t){},1782:function(e,t,n){var a=n(1771),r=a.groupEntries,o=a.parseData,s=n(1773),c=s.resolveBlockTimes,i=s.resolveAssets,l=n(1775)(!0),u=l.getAccountHistoryES,p=l.getAccountHistory;e.exports={groupEntries:r,parseData:o,getAccountHistoryES:u,getAccountHistory:p,resolveBlockTimes:c,resolveAssets:i}},1861:function(e,t,n){\"use strict\";var a=n(0),r=n.n(a),o=n(11),s=n.n(o),c=n(16),i=n(3),l=n.n(i),u=n(35),p=n(22),d=n(111),m=n(39),h=n(48),f=n(23),_=n(47),y=n(21),g=n(10),b=n(535),v=n(26),w=n(14),k=n.n(w),A=n(19),E=n(2073),C=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 S(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function x(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 O(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 I=function(e){function t(e){S(this,t);var n=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.state={inverseSort:e.viewSettings.get(\"dashboardSortInverse\",!0),sortBy:e.viewSettings.get(\"dashboardSort\",\"star\"),dashboardFilter:e.viewSettings.get(\"dashboardFilter\",\"\")},n}return O(t,r.a.Component),C(t,[{key:\"shouldComponentUpdate\",value:function(e,t){return!c.a.are_equal_shallow(e.accounts,this.props.accounts)||e.isContactsList!==this.props.isContactsList||e.showMyAccounts!==this.props.showMyAccounts||e.width!==this.props.width||e.showIgnored!==this.props.showIgnored||e.locked!==this.props.locked||e.passwordAccount!==this.props.passwordAccount||!c.a.are_equal_shallow(e.starredAccounts,this.props.starredAccounts)||!c.a.are_equal_shallow(t,this.state)}},{key:\"_onStar\",value:function(e,t,n){n.preventDefault(),t?_.a.removeStarAccount(e):_.a.addStarAccount(e)}},{key:\"_goAccount\",value:function(e,t){this.props.history.push(\"/account/\"+e),f.a.changeViewSetting({overviewTab:t})}},{key:\"_createAccount\",value:function(){this.props.history.push(\"/create-account/wallet\")}},{key:\"_onFilter\",value:function(e){this.setState({dashboardFilter:e.target.value.toLowerCase()}),f.a.changeViewSetting({dashboardFilter:e.target.value.toLowerCase()})}},{key:\"_setSort\",value:function(e){var t=e===this.state.sortBy?!this.state.inverseSort:this.state.inverseSort;this.setState({sortBy:e,inverseSort:t}),f.a.changeViewSetting({dashboardSort:e,dashboardSortInverse:t})}},{key:\"_onAddContact\",value:function(e){_.a.addAccountContact(e)}},{key:\"_onRemoveContact\",value:function(e){_.a.removeAccountContact(e)}},{key:\"_renderList\",value:function(e,t){var n=this,a=this.props,o=a.width,i=a.starredAccounts,l=a.isContactsList,u=a.passwordAccount,p=this.state,d=p.dashboardFilter,m=p.sortBy,h=p.inverseSort,f=s.a.List();return e.filter(function(e){if(!e)return!1;var t=e.get(\"name\"),a=v.a.isMyAccount(e)||t===u;return!!l||a===n.props.showMyAccounts}).filter(function(e){return!!e&&-1!==e.get(\"name\").toLowerCase().indexOf(d)}).sort(function(e,t){switch(m){case\"star\":return function(e,t,n,a){var r=e.get(\"name\"),o=t.get(\"name\"),s=a.has(r),i=a.has(o);return s&&!i?n?-1:1:i&&!s?n?1:-1:r>o?n?1:-1:r<o?n?-1:1:c.a.sortText(r,o,!n)}(e,t,h,i);case\"name\":return c.a.sortText(e.get(\"name\"),t.get(\"name\"),h)}}).map(function(e){if(e){var a={},s={},c={};f=f.clear();var p=e.get(\"name\"),d=e.get(\"lifetime_referrer_name\")===p;e.get(\"orders\")&&e.get(\"orders\").forEach(function(e,t){var n=g.ChainStore.getObject(e);if(n){var a=n.getIn([\"sell_price\",\"base\",\"asset_id\"]);c[a]?c[a]+=parseInt(n.get(\"for_sale\"),10):c[a]=parseInt(n.get(\"for_sale\"),10)}}),e.get(\"call_orders\")&&e.get(\"call_orders\").forEach(function(e,t){var n=g.ChainStore.getObject(e);if(n){var r=n.getIn([\"call_price\",\"base\",\"asset_id\"]);a[r]?a[r]+=parseInt(n.get(\"collateral\"),10):a[r]=parseInt(n.get(\"collateral\"),10);var o=n.getIn([\"call_price\",\"quote\",\"asset_id\"]);s[o]?s[o]+=parseInt(n.get(\"debt\"),10):s[o]=parseInt(n.get(\"debt\"),10)}});var m=e.get(\"balances\");e.get(\"balances\")&&m.forEach(function(e){var t=g.ChainStore.getObject(e);if(!t||!t.get(\"balance\"))return null;f=f.push(e)});var h=v.a.isMyAccount(e)||p===u,_=i.has(p),w=_?\"gold-star\":\"grey-star\";return r.a.createElement(\"tr\",{key:p},r.a.createElement(\"td\",{className:\"clickable\",onClick:n._onStar.bind(n,p,_)},r.a.createElement(y.a,{className:w,name:\"fi-star\",title:\"icons.fi_star.account\"})),l?t&&r.a.createElement(\"td\",{onClick:n._onAddContact.bind(n,p)},r.a.createElement(y.a,{name:\"plus-circle\",title:\"icons.plus_circle.add_contact\"}))||r.a.createElement(\"td\",{onClick:n._onRemoveContact.bind(n,p)},r.a.createElement(y.a,{name:\"minus-circle\",title:\"icons.minus_circle.remove_contact\"})):null,r.a.createElement(\"td\",{style:{textAlign:\"left\"}},e.get(\"id\")),r.a.createElement(\"td\",{style:{textAlign:\"left\",paddingLeft:10},onClick:n._goAccount.bind(n,p,0),className:\"clickable\"+(h?\" my-account\":\"\")},r.a.createElement(\"span\",{className:d?\"lifetime\":\"\"},p)),r.a.createElement(\"td\",{className:\"clickable\",onClick:n._goAccount.bind(n,p,1),style:{textAlign:\"right\"}},r.a.createElement(b.a,{noTip:!0,balances:[],openOrders:c})),o>=750?r.a.createElement(\"td\",{className:\"clickable\",onClick:n._goAccount.bind(n,p,2),style:{textAlign:\"right\"}},r.a.createElement(b.a,{noTip:!0,balances:[],collateral:a})):null,o>=1200?r.a.createElement(\"td\",{className:\"clickable\",onClick:n._goAccount.bind(n,p,2),style:{textAlign:\"right\"}},r.a.createElement(b.a,{noTip:!0,balances:[],debt:s})):null,r.a.createElement(\"td\",{className:\"clickable\",onClick:n._goAccount.bind(n,p,0),style:{textAlign:\"right\"}},r.a.createElement(b.a,{noTip:!0,balances:f,collateral:a,debt:s,openOrders:c})))}})}},{key:\"render\",value:function(){var e=this.props,t=e.width,n=e.showIgnored,a=e.isContactsList,o=this.state.dashboardFilter,s=this._renderList(this.props.accounts),c=this._renderList(this.props.ignoredAccounts,!0),i=a?k.a.translate(\"explorer.accounts.filter_contacts\"):k.a.translate(\"explorer.accounts.filter\");i+=\"...\";var u=!!A.a.getWallet();return r.a.createElement(\"div\",{style:this.props.style},this.props.compact?null:r.a.createElement(\"section\",{style:{paddingTop:\"1rem\",paddingLeft:\"2rem\"}},r.a.createElement(\"input\",{placeholder:i,style:{maxWidth:\"20rem\",display:\"inline-block\"},type:\"text\",value:o,onChange:this._onFilter.bind(this)}),u&&!a?r.a.createElement(\"div\",{onClick:this._createAccount.bind(this),style:{display:\"inline-block\",marginLeft:5,marginBottom:\"1rem\"},className:\"button small\"},r.a.createElement(l.a,{content:\"header.create_account\"})):null,c&&c.length?r.a.createElement(\"div\",{onClick:this.props.onToggleIgnored,style:{display:\"inline-block\",float:\"right\",marginRight:\"20px\"},className:\"button small\"},r.a.createElement(l.a,{content:\"account.\"+(this.props.showIgnored?\"hide_ignored\":\"show_ignored\")})):null),r.a.createElement(\"table\",{className:\"table table-hover dashboard-table\",style:{fontSize:\"0.85rem\"}},this.props.compact?null:r.a.createElement(\"thead\",null,r.a.createElement(\"tr\",null,r.a.createElement(\"th\",{onClick:this._setSort.bind(this,\"star\"),className:\"clickable\"},r.a.createElement(y.a,{className:\"grey-star\",name:\"fi-star\",title:\"icons.fi_star.sort_accounts\"})),a?r.a.createElement(\"th\",null,r.a.createElement(y.a,{name:\"user\",title:\"icons.user.account\"})):null,r.a.createElement(\"th\",{style:{textAlign:\"left\"}},\"ID\"),r.a.createElement(\"th\",{style:{textAlign:\"left\",paddingLeft:10},onClick:this._setSort.bind(this,\"name\"),className:\"clickable\"},r.a.createElement(l.a,{content:\"header.account\"})),r.a.createElement(\"th\",{style:{textAlign:\"right\"}},r.a.createElement(l.a,{content:\"account.open_orders\"})),t>=750?r.a.createElement(\"th\",{style:{textAlign:\"right\"}},r.a.createElement(l.a,{content:\"account.as_collateral\"})):null,t>=1200?r.a.createElement(\"th\",{style:{textAlign:\"right\"}},r.a.createElement(l.a,{content:\"transaction.borrow_amount\"})):null,r.a.createElement(\"th\",{style:{textAlign:\"right\",marginRight:20}},r.a.createElement(l.a,{content:\"account.total_value\"})))),r.a.createElement(\"tbody\",null,s,n&&c.length?r.a.createElement(\"tr\",{className:\"dashboard-table--hiddenAccounts\",style:{backgroundColor:\"transparent\"},key:\"hidden\"},r.a.createElement(\"td\",{colSpan:\"8\"},k.a.translate(\"account.hidden_accounts_row\"),\":\")):null,n&&c)))}}]),t}();I.propTypes={accounts:m.a.ChainAccountsList.isRequired,ignoredAccounts:m.a.ChainAccountsList},I.defaultProps={width:2e3,compact:!1},I=Object(h.a)(I);var T=function(e){function t(){return S(this,t),x(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return O(t,r.a.Component),C(t,[{key:\"render\",value:function(){return r.a.createElement(I,this.props)}}]),t}();T=Object(E.a)(T),t.a=Object(u.a)(T,{listenTo:function(){return[p.a,d.a,v.a]},getProps:function(){return{locked:d.a.getState().locked,starredAccounts:v.a.getState().starredAccounts,viewSettings:p.a.getState().viewSettings}}})}}]);"],"mappings":"AAAA","sourceRoot":""}