-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path49.d3a1f821e63c57ebe843.js
1 lines (1 loc) · 30.6 KB
/
49.d3a1f821e63c57ebe843.js
1
"use strict";(this.webpackChunkRuDEX3_light=this.webpackChunkRuDEX3_light||[]).push([[49],{32049:(e,t,a)=>{a.d(t,{t:()=>K,k:()=>Q});var n=a(67294),s=a(58074),o=a.n(s),r=a(23037),l=a(82267),c=a(13973),i=a(91410),u=a(76660),p=a(30806),m=a(112),_=a.n(m),d=a(91684),h=a(94184),g=a.n(h),y=a(45697),b=a.n(y),E=a(99869),k=a(52531),v=a(73727),f=a(21019),w=a(74656),Z=a(3841),S=a(38715),N=a(58466),C=a(17315),x=a.n(C),T=a(9739),A=a(53528),M=a(5833);const H=({objectId:e})=>{if("string"==typeof e){const t=e.split("."),{length:a}=t;if(a>0)return"#"+t[a-1]}return e};var O=a(39014),I=a(89449),L=a(43393),j=a.n(L);class F extends n.Component{static propTypes={blockNumber:b().number.isRequired,dynGlobalObject:r.Z.ChainObject.isRequired};static defaultProps={dynGlobalObject:"2.1.0"};shouldComponentUpdate(e){return!j().is(this.props.dynGlobalObject,e.dynGlobalObject)}render(){const{blockNumber:e,dynGlobalObject:t}=this.props,a=t.get("last_irreversible_block_num");return e>a?n.createElement("span",null," - ","(",n.createElement(o(),{content:"operation.pending",blocks:e-a}),")"):null}}const D=(0,l.Z)(F);var R=a(78598),z=a(89473),P=a.n(z);const{operations:q}=p.ChainTypes,U=Object.keys(q),V="FULL",W="COINBASE";var J=a(21712);const{operations:B}=p.ChainTypes,$=Object.keys(B),G=new class{linkToAccount(e){return e?c.Z.is_object_id(e)?n.createElement(Z.Z,{account:e}):n.createElement(v.rU,{to:`/account/${e}`},e):n.createElement("span",null,"-")}linkToAsset(e){return e?c.Z.is_object_id(e)?n.createElement(S.Z,{asset:e}):n.createElement(v.rU,{to:`/asset/${e}`},e):n.createElement("span",null,"-")}getColumn(e,t,a,s,r){const{operations:i}=p.ChainTypes;let m=Object.keys(i),d=x().account_listing,h=null,g="info",y=null,b=null;switch(m[e[0]]){case"transfer":e[1].memo&&(y=n.createElement(T.Z,{memo:e[1].memo})),g="success",e[1].amount.amount=parseFloat(e[1].amount.amount),h=n.createElement("span",{className:"right-td"},n.createElement(N.Z,{string:"operation.transfer",keys:[{type:"account",value:e[1].from,arg:"from"},{type:"amount",value:e[1].amount,arg:"amount",decimalOffset:"1.3.0"===e[1].amount.asset_id?5:null},{type:"account",value:e[1].to,arg:"to"}]}),y);break;case"limit_order_create":g="warning",b=e[1],h=n.createElement("span",null,n.createElement(l.Z.Wrapper,{base:b.min_to_receive.asset_id,quote:b.amount_to_sell.asset_id},(({base:t,quote:a})=>{const{marketName:o,first:l,second:c}=M.Z.getMarketName(t,a),i=r.get(o),u=b.amount_to_sell.asset_id===(i?l.get("id"):c.get("id"));let p=u?b.amount_to_sell:b.min_to_receive,m=u?b.min_to_receive:b.amount_to_sell;const _=u?e[1].min_to_receive:e[1].amount_to_sell;let d=s&&"string"==typeof s[1]?"#"+s[1].substring(4):"";return n.createElement(N.Z,{string:u?"operation.limit_order_buy":"operation.limit_order_sell",keys:[{type:"account",value:e[1].seller,arg:"account"},{type:"amount",value:_,arg:"amount"},{type:"price",value:{base:p,quote:m},arg:"price"}],params:{order:d}})})));break;case"limit_order_cancel":g="cancel",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.limit_order_cancel",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"}],params:{order:e[1].order.substring(4)}}));break;case"call_order_update":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.call_order_update",keys:[{type:"account",value:e[1].funding_account,arg:"account"},{type:"asset",value:e[1].delta_debt.asset_id,arg:"debtSymbol"},{type:"amount",value:e[1].delta_debt,arg:"debt"},{type:"amount",value:e[1].delta_collateral,arg:"collateral"}]}));break;case"key_create":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.create_key"}));break;case"account_create":h=n.createElement(N.Z,{string:"operation.reg_account",keys:[{type:"account",value:e[1].registrar,arg:"registrar"},{type:"account",value:e[1].name,arg:"new_account"}]});break;case"account_update":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.update_account",keys:[{type:"account",value:e[1].account,arg:"account"}]}));break;case"account_whitelist":let i=e[1].new_listing===d.no_listing?"unlisted_by":e[1].new_listing===d.white_listed?"whitelisted_by":"blacklisted_by";h=n.createElement("span",null,n.createElement(N.Z,{string:"operation."+i,keys:[{type:"account",value:e[1].authorizing_account,arg:"lister"},{type:"account",value:e[1].account_to_list,arg:"listee"}]}));break;case"account_upgrade":h=n.createElement("span",null,n.createElement(N.Z,{string:e[1].upgrade_to_lifetime_member?"operation.lifetime_upgrade_account":"operation.annual_upgrade_account",keys:[{type:"account",value:e[1].account_to_upgrade,arg:"account"}]}));break;case"account_transfer":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.account_transfer",keys:[{type:"account",value:e[1].account_id,arg:"account"},{type:"account",value:e[1].new_owner,arg:"to"}]}));break;case"asset_create":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_create",keys:[{type:"account",value:e[1].issuer,arg:"account"},{type:"asset",value:e[1].symbol,arg:"asset"}]}));break;case"asset_update":case"asset_update_bitasset":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_update",keys:[{type:"account",value:e[1].issuer,arg:"account"},{type:"asset",value:e[1].asset_to_update,arg:"asset"}]}));break;case"asset_update_feed_producers":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_update_feed_producers",keys:[{type:"account",value:e[1].issuer,arg:"account"},{type:"asset",value:e[1].asset_to_update,arg:"asset"}]}));break;case"asset_issue":g="warning",e[1].memo&&(y=n.createElement(T.Z,{memo:e[1].memo})),e[1].asset_to_issue.amount=parseInt(e[1].asset_to_issue.amount,10),h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_issue",keys:[{type:"account",value:e[1].issuer,arg:"account"},{type:"amount",value:e[1].asset_to_issue,arg:"amount"},{type:"account",value:e[1].issue_to_account,arg:"to"}]}),y);break;case"asset_fund_fee_pool":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_fund_fee_pool",keys:[{type:"account",value:e[1].from_account,arg:"account"},{type:"asset",value:e[1].asset_id,arg:"asset"},{type:"amount",value:{amount:e[1].amount,asset_id:"1.3.0"},arg:"amount"}]}));break;case"asset_settle":g="warning";const E=e[1].amount,k=2;if(s&&s[0]==k){const t=s[1];h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_settle_instant",keys:[{type:"account",value:e[1].account,arg:"account"},{type:"amount",value:E,arg:"amount"},{type:"price",value:{base:E,quote:t},arg:"price"}]}))}else h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_settle",keys:[{type:"account",value:e[1].account,arg:"account"},{type:"amount",value:e[1].amount,arg:"amount"}]}));break;case"asset_global_settle":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_global_settle",keys:[{type:"account",value:e[1].issuer,arg:"account"},{type:"asset",value:e[1].asset_to_settle,arg:"asset"},{type:"price",value:e[1].settle_price,arg:"price"}]}));break;case"asset_publish_feed":g="warning",h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.publish_feed",keys:[{type:"account",value:e[1].publisher,arg:"account"},{type:"price",value:e[1].feed.settlement_price,arg:"price"}]}));break;case"witness_create":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.witness_create",keys:[{type:"account",value:e[1].witness_account,arg:"account"}]}));break;case"witness_update":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.witness_update",keys:[{type:"account",value:e[1].witness_account,arg:"account"}]}));break;case"witness_withdraw_pay":console.log("witness_withdraw_pay:",e[1].witness_account),h=t===e[1].witness_account?n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.witness_pay"})," ",n.createElement(f.Z,{amount:e[1].amount,asset:"1.3.0"}),n.createElement(o(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].witness_account)):n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.received"})," ",n.createElement(f.Z,{amount:e[1].amount,asset:"1.3.0"}),n.createElement(o(),{component:"span",content:"transaction.from"})," ",this.linkToAccount(e[1].witness_account));break;case"proposal_create":h=n.createElement("div",{className:"inline-block"},n.createElement("span",null,n.createElement(N.Z,{string:"operation.proposal_create",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"},{value:s?n.createElement(H,{objectId:s[1]}):"",arg:"proposal"}]}),":"),n.createElement("div",null,e[1].proposed_ops.map(((e,t)=>n.createElement(A.Z,{op:e.op,key:t,index:t,inverted:!1,hideFee:!0,hideOpLabel:!0,hideDate:!0,proposal:!0})))));break;case"proposal_update":const w=["active_approvals_to_add","active_approvals_to_remove","owner_approvals_to_add","owner_approvals_to_remove","key_approvals_to_add","key_approvals_to_remove"];h=n.createElement("div",null,n.createElement("span",null,n.createElement(N.Z,{string:"operation.proposal_update",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"},{value:n.createElement(H,{objectId:e[1].proposal}),arg:"proposal"}]})),n.createElement("div",{className:"proposal-update"},w.map((t=>e[1][t].length?n.createElement("div",{key:t},n.createElement(o(),{content:`proposal.updated.${t}`}),n.createElement("ul",null,e[1][t].map((e=>n.createElement("li",{key:e},t.startsWith("key")?e:this.linkToAccount(e)))))):null))));break;case"proposal_delete":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.proposal_delete",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"},{value:n.createElement(H,{objectId:e[1].proposal}),arg:"proposal"}]}));break;case"withdraw_permission_create":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.withdraw_permission_create"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(o(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].authorized_account));break;case"withdraw_permission_update":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.withdraw_permission_update"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(o(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].authorized_account));break;case"withdraw_permission_claim":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.withdraw_permission_claim"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(o(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].withdraw_to_account));break;case"withdraw_permission_delete":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.withdraw_permission_delete"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(o(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].authorized_account));break;case"fill_order":g="success",b=e[1],h=n.createElement("span",null,n.createElement(l.Z.Wrapper,{base:b.receives.asset_id,quote:b.pays.asset_id},(({base:t,quote:a})=>{const{marketName:s,first:o,second:l}=M.Z.getMarketName(t,a),c=r.get(s),i=b.pays.asset_id===(c?o.get("id"):l.get("id"));let u=i?b.receives:b.pays,p=i?b.pays:b.receives,m=i?b.receives:b.pays,_=b.fee.asset_id===m.asset_id?m.amount-b.fee.amount:m.amount;return n.createElement(N.Z,{string:"operation.fill_order_"+(i?"buy":"sell"),keys:[{type:"account",value:e[1].account_id,arg:"account"},{type:"amount",value:{amount:_,asset_id:m.asset_id},arg:"amount"},{type:"price",value:{base:u,quote:p},arg:"price"}],params:{order:b.order_id.substring(4)}})})));break;case"global_parameters_update":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.global_parameters_update"}));break;case"vesting_balance_create":h=n.createElement("span",null," ",this.linkToAccount(e[1].creator),n.createElement(o(),{component:"span",content:"transaction.vesting_balance_create"})," ",n.createElement(f.Z,{amount:e[1].amount.amount,asset:e[1].amount.asset_id})," ",this.linkToAccount(e[1].owner));break;case"vesting_balance_withdraw":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.vesting_balance_withdraw",keys:[{type:"account",value:e[1].owner,arg:"account"},{type:"amount",value:e[1].amount,arg:"amount"}]}));break;case"worker_create":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.worker_create",keys:[{type:"account",value:e[1].owner,arg:"account"},{type:"amount",value:{amount:e[1].daily_pay,asset_id:"1.3.0"},arg:"pay"}],params:{name:e[1].name}}));break;case"balance_claim":g="success",e[1].total_claimed.amount=parseInt(e[1].total_claimed.amount,10),h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.balance_claim",keys:[{type:"account",value:e[1].deposit_to_account,arg:"account"},{type:"amount",value:e[1].total_claimed,arg:"amount"}]}));break;case"committee_member_create":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.committee_member_create"})," ",this.linkToAccount(e[1].committee_member_account));break;case"transfer_to_blind":h=n.createElement("span",null,this.linkToAccount(e[1].from)," ",n.createElement(o(),{component:"span",content:"transaction.sent"})," ",n.createElement(f.Z,{amount:e[1].amount.amount,asset:e[1].amount.asset_id}));break;case"transfer_from_blind":h=n.createElement("span",null,this.linkToAccount(e[1].to)," ",n.createElement(o(),{component:"span",content:"transaction.received"})," ",n.createElement(f.Z,{amount:e[1].amount.amount,asset:e[1].amount.asset_id}));break;case"asset_claim_fees":g="success",e[1].amount_to_claim.amount=parseInt(e[1].amount_to_claim.amount,10),h=n.createElement("span",null,this.linkToAccount(e[1].issuer)," ",n.createElement(l.Z.Wrapper,{asset:e[1].amount_to_claim.asset_id},(({asset:t})=>n.createElement(N.Z,{string:"transaction.asset_claim_fees",keys:[{type:"amount",value:e[1].amount_to_claim,arg:"balance_amount"},{type:"asset",value:t.get("id"),arg:"asset"}]}))));break;case"custom":h=n.createElement("span",null,n.createElement(o(),{component:"span",content:"transaction.custom"}));break;case"asset_reserve":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.asset_reserve",keys:[{type:"account",value:e[1].payer,arg:"account"},{type:"amount",value:e[1].amount_to_reserve,arg:"amount"}]}));break;case"committee_member_update_global_parameters":h=n.createElement("span",null,n.createElement(N.Z,{string:"operation.committee_member_update_global_parameters",keys:[{type:"account",value:"1.2.0",arg:"account"}]}));break;case"override_transfer":h=n.createElement(N.Z,{string:"operation.override_transfer",keys:[{type:"account",value:e[1].issuer,arg:"issuer"},{type:"account",value:e[1].from,arg:"from"},{type:"account",value:e[1].to,arg:"to"},{type:"amount",value:e[1].amount,arg:"amount"}]});break;case"asset_settle_cancel":h=n.createElement(N.Z,{string:"operation.asset_settle_cancel",keys:[{type:"account",value:e[1].account,arg:"account"},{type:"amount",value:e[1].amount,arg:"amount"}]});break;case"asset_claim_pool":h=n.createElement(N.Z,{string:"operation.asset_claim_pool",keys:[{type:"account",value:e[1].issuer,arg:"account"},{type:"asset",value:e[1].asset_id,arg:"asset"},{type:"amount",value:e[1].amount_to_claim,arg:"amount"}]});break;case"asset_update_issuer":h=n.createElement(N.Z,{string:"operation.asset_update_issuer",keys:[{type:"account",value:e[1].issuer,arg:"from_account"},{type:"account",value:e[1].new_issuer,arg:"to_account"},{type:"asset",value:e[1].asset_to_update,arg:"asset"}]});break;case"bid_collateral":h=n.createElement(N.Z,{string:"operation.bid_collateral",keys:[{type:"account",value:e[1].bidder,arg:"bid_account"},{type:"amount",value:e[1].additional_collateral,arg:"collateral"},{type:"amount",value:e[1].debt_covered,arg:"debt"}]});break;case"htlc_create":const Z=p.ChainStore.getObject("2.0.0"),S=p.ChainStore.getObject("2.1.0");let C=c.Z.calc_block_time(a,Z,S),x=!1;C||(C=c.Z.calc_block_time(a,Z,S,!0),x=!0),e[1].amount.amount=parseFloat(e[1].amount.amount);let O=new Date;O.setTime(C.getTime()+1e3*e[1].claim_period_seconds),h=n.createElement(n.Fragment,null,n.createElement("span",{className:"right-td"},n.createElement(N.Z,{string:"operation.htlc_create",keys:[{type:"date",arg:"lock_period",value:O},{type:"account",value:e[1].from,arg:"from"},{type:"amount",value:e[1].amount,arg:"amount"},{type:"account",value:e[1].to,arg:"to"}]}),n.createElement(u.Tooltip,{title:"Estimated"},x?"*":"")),n.createElement("div",{className:"memo",style:{paddingTop:5,cursor:"help"}},n.createElement(u.Tooltip,{placement:"bottom",title:_().translate("htlc.preimage_hash_explanation")},n.createElement("span",{className:"inline-block"},_().translate("htlc.preimage_hash")+" ("+e[1].preimage_size+", "+e[1].preimage_hash[0]+"): "+e[1].preimage_hash[1]))));break;case"htlc_redeem":g="success",h=n.createElement(n.Fragment,null,n.createElement("span",{className:"right-td"},n.createElement(N.Z,{string:"operation.htlc_redeem",keys:[{type:"account",value:e[1].redeemer,arg:"redeemer"},{value:e[1].htlc_id,arg:"htlc_id"}]})),n.createElement("div",{className:"memo",style:{paddingTop:5,cursor:"help"}},n.createElement(u.Tooltip,{placement:"bottom",title:_().translate("htlc.preimage_explanation")},n.createElement("span",{className:"inline-block"},_().translate("htlc.preimage")+": "+e[1].preimage))));break;case"htlc_extend":h=n.createElement("span",{className:"right-td"},n.createElement(N.Z,{string:"operation.htlc_extend",keys:[{type:"account",value:e[1].update_issuer,arg:"update_issuer"},{type:"amount",arg:"seconds_to_add",value:e[1].seconds_to_add},{value:e[1].htlc_id,arg:"htlc_id"}]}));break;case"htlc_redeemed":h=n.createElement("span",{className:"right-td"},n.createElement(N.Z,{string:"operation.htlc_redeemed",keys:[{type:"account",value:e[1].to,arg:"to"},{type:"account",value:e[1].from,arg:"from"},{type:"amount",value:e[1].amount,arg:"amount",decimalOffset:"1.3.0"===e[1].amount.asset_id?5:null},{value:e[1].htlc_id,arg:"htlc_id"}]}));break;case"htlc_refund":g="warning",h=n.createElement("span",{className:"right-td"},n.createElement(N.Z,{string:"operation.htlc_refund",keys:[{value:e[1].htlc_id,arg:"htlc_id"},{type:"account",value:e[1].to,arg:"to"}]}));break;default:console.log("unimplemented op '"+m[e[0]]+"':",e),h=n.createElement("span",null,n.createElement(v.rU,{to:`/block/${a}`},"#",a))}return{column:h,color:g}}},X=u.Select.Option;function Y(e,t){return t.block_num===e.block_num?t.trx_in_block!==e.trx_in_block?t.trx_in_block-e.trx_in_block:t.op_in_trx!==e.op_in_trx?t.op_in_trx-e.op_in_trx:t.virtual_op-e.virtual_op:t.block_num-e.block_num}class K extends n.Component{static propTypes={accountsList:r.Z.ChainAccountsList.isRequired,compactView:b().bool,limit:b().number,maxHeight:b().number,fullHeight:b().bool,showFilters:b().bool};static defaultProps={limit:25,maxHeight:500,fullHeight:!1,showFilters:!1};constructor(e){super(),this.state={limit:e.limit,fetchingAccountHistory:!1,headerHeight:85,filter:"all",accountHistoryError:!1,rows:[],showModal:!1,esNodeCustom:!1,esNode:J.MU.ES_WRAPPER_LIST.length>0?J.MU.ES_WRAPPER_LIST[0].url:null,visibleId:""},this.getDataSource=this.getDataSource.bind(this),this.useCustom=_().translate("account.export_modal.use_custom"),this.showExportModal=this.showExportModal.bind(this),this.hideExportModal=this.hideExportModal.bind(this),this.esNodeChange=this.esNodeChange.bind(this),this._generateCSV=this._generateCSV.bind(this)}componentDidMount(){this.props.fullHeight||(this.refs.transactions,this._setHeaderHeight())}esNodeChange(e){let t=null;t=e.target?e.target.value:e,t==this.useCustom?this.setState({esNode:"",esNodeCustom:!0}):this.setState({esNode:t})}showExportModal(){this.setState({showModal:!0})}hideExportModal(){this.setState({showModal:!1})}_setHeaderHeight(){let e=this.refs.header.offsetHeight;e!==this.state.headerHeight&&this.setState({headerHeight:e})}shouldComponentUpdate(e,t){if(!c.Z.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&&(!c.Z.are_equal_shallow(this.props.customFilter.fields,e.customFilter.fields)||!c.Z.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(let t=0;t<e.accountsList.length;++t){let a=e.accountsList[t],n=this.props.accountsList[t];if(a&&n&&a.get("history")!==n.get("history"))return!0}return this.state.showModal!==t.showModal||this.state.esNode!==t.esNode||this.state.esNodeCustom!==t.esNodeCustom||this.state.visibleId!==t.visibleId}_onIncreaseLimit(){this.setState({limit:this.state.limit+30})}_getHistory(e,t,a){let n=[],s=new Set;for(let t of e)if(t){let e=t.get("history");e&&(n=n.concat(e.toJS().filter((e=>!s.has(e.id)&&s.add(e.id)))))}return t&&(n=n.filter((e=>e.op[0]===B[t]))),a&&(n=n.filter((e=>a.fields.reduce(((t,n)=>"asset_id"===n?t&&e.op[1].amount[n]===a.values[n]:t&&e.op[1][n]===a.values[n]),!0)))),n}async _generateCSV(e){try{const t=new class{pad(e,t){let a=""+e;for(;a.length<t;)a="0"+a;return a}formatDate(e){return("0"+e.getDate()).slice(-2)+"."+("0"+(e.getMonth()+1)).slice(-2)+"."+e.getFullYear()+" "+("0"+e.getHours()).slice(-2)+":"+("0"+e.getMinutes()).slice(-2)+":"+("0"+e.getSeconds()).slice(-2)+" GMT"+(e.getTimezoneOffset()<0?"+":"-")+this.pad(parseInt(Math.floor(Math.abs(e.getTimezoneOffset()/60))),2)+this.pad(Math.abs(e.getTimezoneOffset()%60),2)}async generateCSV(e,t,a){let n,s=0,o=e[0].get("id"),r=(await(0,p.FetchChain)("getAccount",o)).get("name"),l={},c=!1;for(;;){let e=!1;try{e=await this._getAccountHistoryES(o,1e4,s,t)}catch(e){c=!0}if(!e.length||c)break;await P().resolveBlockTimes(e),await P().resolveAssets(e),e.map((function(e){const t=e.id,a=U[e.op.type],n=e.op.data;if(n){switch(a){case"vesting_balance_withdraw":case"transfer":n.amount||(n.amount=n.amount_)}l[t]={timestamp:new Date(e.block_time),type:a,data:n}}})),s+=e.length}if(!Object.keys(l).length)return;if(a===V){n=[];for(let e in l)n.push([e,l[e]])}else l=P().groupEntries(l),n=P().parseData(l,o,r);let i=this.dataToCSV(n,a),u=new Date;(0,R.saveAs)(i,"graphene-account-history-"+r+"-"+u.getFullYear()+"-"+("0"+(u.getMonth()+1)).slice(-2)+"-"+("0"+u.getDate()).slice(-2)+"-"+("0"+u.getHours()).slice(-2)+("0"+u.getMinutes()).slice(-2)+".csv"),console.log("Export file generated")}_getAccountHistoryES(e,t,a,n){let s="get_account_history";-1!==n.indexOf("es-wrapper")&&(s="es/account_history");let o=n+"/"+s+"?account_id="+e+"&from_="+a+"&size="+t+"&sort_by=block_data.block_time&type=data&agg_field=operation_type";return console.log("query",o),new Promise(((e,t)=>{fetch(o).then((e=>e.json())).then((t=>{let a=t.map((e=>{let t=e.operation_history.op_object;return t||(t=JSON.parse(e.operation_history.op)[1]),{id:e.account_history.operation_id,op:{type:e.operation_type,data:t},result:JSON.parse(e.operation_history.operation_result),block_num:e.block_data.block_num,block_time:e.block_data.block_time+"Z"}}));e(a)})).catch((e=>{t(e)}))}))}dataToCSV(e,t){let a="";for(let n of e)t===W?(n.length>=11&&n[10]instanceof Date&&(n[10]=this.formatDate(n[10])),a+=n.join(",")+"\n"):a+=JSON.stringify(n)+"\n";return new Blob([a],{type:"text/csv;charset=utf-8"})}};this.setState({fetchingAccountHistory:!0,showModal:!1}),await t.generateCSV(this.props.accountsList,this.state.esNode,e),this.setState({fetchingAccountHistory:!1,accountHistoryError:null})}catch(e){console.error(e),this.setState({fetchingAccountHistory:!1,accountHistoryError:e,esNodeCustom:!1,esNode:J.MU.ES_WRAPPER_LIST.length>0?J.MU.ES_WRAPPER_LIST[0].url:null})}}_onChangeFilter(e){this.setState({filter:e})}openJSONModal(e){this.setState({visibleId:e})}closeJSONModal=()=>{this.setState({visibleId:""})};getDataSource(e,t){let a=e.op[1].fee,s=_().translate("transaction.trxTypes");const o=G.getColumn(e.op,t,e.block_num,e.result,this.props.marketDirections);a.amount=parseInt(a.amount,10);const r=p.ChainStore.getObject("2.1.0").get("last_irreversible_block_num");return{key:e.id,id:n.createElement(n.Fragment,null,n.createElement("span",{className:"cursor-pointer",onClick:()=>this.openJSONModal(e.id)},e.id," ",n.createElement(u.Icon,{type:"file-search"})),n.createElement(i.Z,{visible:this.state.visibleId===e.id,operation:e.op,title:s[$[e.op[0]]||""],hideModal:this.closeJSONModal})),type:n.createElement(v.rU,{className:"inline-block","data-place":"bottom","data-tip":_().translate("tooltip.show_block",{block:c.Z.format_number(e.block_num,0)}),to:`/block/${e.block_num}/${e.trx_in_block}`},n.createElement("span",{className:g()("label",o.color||"info")},s[$[e.op[0]]])),info:n.createElement("div",null,n.createElement("div",null,n.createElement("span",null,o.column)),n.createElement("div",{style:{fontSize:14,paddingTop:5}},e.block_num>r?n.createElement(D,{blockNumber:e.block_num}):null)),fee:n.createElement(f.Z,{amount:a.amount,asset:a.asset_id}),time:n.createElement(w.Z,{block_number:e.block_num,fullDate:!0})}}render(){let{accountsList:e,compactView:t,filter:a,customFilter:s,style:r,maxHeight:l}=this.props,{limit:c,headerHeight:i}=this.state,p=1===e.length&&e[0]?e[0].get("id"):null,m=this._getHistory(e,this.props.showFilters&&"all"!==this.state.filter?this.state.filter:a,s).sort(Y),h=m.length;r=r||{width:"100%",height:"100%"};let 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((e=>n.createElement(X,{value:e,key:e},_().translate("transaction.trxTypes."+e))));let y=m.length?m.slice(0,c).map((e=>this.getDataSource(e,p))):[],b=n.createElement("div",{className:"total-value",key:"total_value"},n.createElement("span",{style:{textAlign:"center"}}," "));const v=n.createElement("div",null,n.createElement(u.Button,{onClick:()=>this._generateCSV(V),type:"primary"},n.createElement(o(),{content:"account.export_modal.full_report"})),n.createElement(u.Button,{onClick:()=>this._generateCSV(W),type:"primary"},n.createElement(o(),{content:"account.export_modal.coinbase_report"})));return n.createElement("div",{className:"recent-transactions no-overflow",style:r},n.createElement(u.Modal,{wrapClassName:"modal--transaction-confirm",title:n.createElement(o(),{content:"account.export_modal.title"}),visible:this.state.showModal,id:"transaction_confirm_modal",ref:"modal",footer:v,overlay:!0,onCancel:this.hideExportModal,noCloseBtn:!0},n.createElement("p",null,n.createElement(o(),{content:"account.export_modal.description"})),this.state.esNodeCustom?n.createElement(u.Input,{type:"text",value:this.state.esNode,onChange:this.esNodeChange}):n.createElement(u.Select,{showSearch:!0,value:this.state.esNode,onChange:this.esNodeChange,style:{width:"100%"}},J.MU.ES_WRAPPER_LIST.concat([{url:this.useCustom}]).map((e=>n.createElement(u.Select.Option,{key:e.url},e.url))))),n.createElement("div",{className:"generic-bordered-box"},this.props.dashboard?null:n.createElement("div",{ref:"header"},n.createElement("div",{className:"block-content-header"},n.createElement("span",null,this.props.title?this.props.title:n.createElement(o(),{content:"account.recent"})))),n.createElement("div",{className:"header-selector"},n.createElement("div",{className:"filter inline-block"},this.props.showFilters?n.createElement(u.Tooltip,{placement:"bottom",title:_().translate("tooltip.filter_ops")},n.createElement(u.Select,{style:{width:"210px"},value:this.state.filter,onChange:this._onChangeFilter.bind(this)},g)):null,h>0&&this.props.dashboard&&null!==this.state.esNode?n.createElement(u.Tooltip,{placement:"bottom",title:_().translate("transaction.csv_tip")},n.createElement("a",{className:"inline-block iconLinkAndLabel",onClick:this.showExportModal,style:{marginLeft:"1rem"}},n.createElement(d.Z,{name:"excel",size:"1x"}),n.createElement(o(),{content:"account.download_history"}))):null),this.state.accountHistoryError&&n.createElement("div",{className:"has-error",style:{paddingLeft:"0.75rem"}},n.createElement(o(),{content:"account.history_error"}))),n.createElement(E.Z,{withTransition:!0,className:"table table-striped "+(t?"compact":"")+(this.props.dashboard?" dashboard-table table-hover":""),header:[{title:n.createElement(o(),{content:"account.transactions.id"}),dataIndex:"id",align:"left",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)},t?{}:{title:n.createElement(o(),{content:"account.transactions.type"}),dataIndex:"type",align:"left"},{title:n.createElement(o(),{content:"account.transactions.info"}),dataIndex:"info",align:"left",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:n.createElement(o(),{content:"account.transactions.fee"}),dataIndex:"fee",align:"left",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:n.createElement(o(),{style:{whiteSpace:"nowrap"},content:"account.transactions.time"}),dataIndex:"time",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)}],rows:y,label:"utility.total_x_operations",extraRow:b}),this.state.fetchingAccountHistory&&n.createElement(k.Z,null)))}}K=(0,l.Z)(K),K=(0,I.$)(K,{listenTo:()=>[O.Z],getProps:()=>({marketDirections:O.Z.getState().marketDirections})});class Q extends n.Component{static propTypes={asset:r.Z.ChainAsset.isRequired,to:r.Z.ChainAccount.isRequired,fromAccount:r.Z.ChainAccount.isRequired};static defaultProps={asset:"1.3.0"};render(){return n.createElement("span",{className:"wrapper"},this.props.children(this.props))}}Q=(0,l.Z)(Q)},99869:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),s=a(112),o=a.n(s),r=a(76660);class l extends n.Component{static defaultProps={rows:[],pageSize:20,className:"table",extraRow:null,style:{paddingBottom:"1rem"},loading:!1,totalLabel:"utility.total_x_items",label:null};constructor(e){super(e),this.state={pageSize:e.pageSize}}render(){const{pageSize:e}=this.state,{header:t,rows:a,extraRow:s,loading:l}=this.props,c=[10,20,30,40,50,100].filter((e=>e<Math.max(this.props.pageSize,a.length)));c.push(Math.max(this.props.pageSize,a.length));let i=null;return null!==this.props.label?i=e=>o().translate(this.props.label,{count:e}):"string"==typeof this.props.totalLabel?i=e=>o().translate(this.props.totalLabel,{count:e}):"object"==typeof this.props.totalLabel&&(i=e=>o().translate(this.props.totalLabel.key,{count:e,...this.props.totalLabel.args})),n.createElement("div",{className:"paginated-list",style:this.props.style},n.createElement(r.Table,{loading:l,dataSource:a,uns:!0,columns:Array.isArray(t)?t:[],footer:()=>s||n.createElement("span",null," "),onChange:this.props.toggleSortOrder,pagination:{showSizeChanger:!0,hideOnSinglePage:!1,defaultPageSize:e,pageSizeOptions:c.map((e=>e.toString())),showTotal:(e,t)=>i(e)},rowClassName:null==this.props.rowClassName?void 0:(e,t)=>this.props.rowClassName(e,t),rowSelection:this.props.rowSelection}),this.props.children)}}}}]);