-
Notifications
You must be signed in to change notification settings - Fork 13
/
282.2d207c0a4d8374a94f33.js
1 lines (1 loc) · 35.1 KB
/
282.2d207c0a4d8374a94f33.js
1
"use strict";(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[282],{1282:(e,t,a)=>{a.d(t,{$:()=>X,k:()=>ee});var n=a(96540),o=a(80849),r=a.n(o),s=a(12569),c=a(72342),l=a(87040),i=a(41654),u=a(46128),p=a(72090),m=a(10658),_=a.n(m),d=a(36234),g=a(32485),h=a.n(g),y=a(5556),b=a.n(y),E=a(72257),v=a(40702),k=a(54625),f=a(96366),w=a(57242),A=a(63024),S=a(24873),N=a(16e3),x=a(27960),C=a.n(x),T=a(30795),H=a(62623),O=a(88587);const M=({objectId:e})=>{if("string"==typeof e){const t=e.split("."),{length:a}=t;if(a>0)return"#"+t[a-1]}return e};var I=a(74248),L=a(9476),q=a(9404),j=a.n(q);class F extends n.Component{static propTypes={blockNumber:b().number.isRequired,dynGlobalObject:s.A.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(r(),{content:"operation.pending",blocks:e-a}),")"):null}}const z=(0,c.A)(F);var D=a(91936),R=a(56438),P=a.n(R);const{operations:V}=p.ChainTypes,B=Object.keys(V),W="FULL",J="COINBASE",Y=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,o=0,r=e[0].get("id"),s=(await(0,p.FetchChain)("getAccount",r)).get("name"),c={};for(;;){let e=await this._getAccountHistoryES(r,150,o,t);if(!e.length)break;await P().resolveBlockTimes(e),await P().resolveAssets(e),e.map((function(e){const t=e.id,a=B[e.op.type],n=e.op.data;if(n){switch(a){case"vesting_balance_withdraw":case"transfer":n.amount||(n.amount=n.amount_)}c[t]={timestamp:new Date(e.block_time),type:a,data:n}}})),o+=e.length}if(!Object.keys(c).length)return;if(a===W){n=[];for(let e in c)n.push([e,c[e]])}else c=P().groupEntries(c),n=P().parseData(c,r,s);let l=this.dataToCSV(n,a),i=new Date;(0,D.saveAs)(l,"bitshares-account-history-"+s+"-"+i.getFullYear()+"-"+("0"+(i.getMonth()+1)).slice(-2)+"-"+("0"+i.getDate()).slice(-2)+"-"+("0"+i.getHours()).slice(-2)+("0"+i.getMinutes()).slice(-2)+".csv"),console.log("Export file generated")}_getAccountHistoryES(e,t,a,n){let o="get_account_history";-1===n.indexOf("explorer")&&-1===n.indexOf("api")||(o="es/account_history");let r=n+"/"+o+"?account_id="+e+"&from_="+a+"&size="+t+"&sort_by=block_data.block_time&type=data&agg_field=operation_type";return console.log("query",r),new Promise(((e,t)=>{fetch(r).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===J?(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"})}};var $=a(18450);const{operations:G}=p.ChainTypes,U=Object.keys(G),Z=new class{linkToAccount(e){return e?l.A.is_object_id(e)?n.createElement(A.A,{account:e}):n.createElement(k.N_,{to:`/account/${e}`},e):n.createElement("span",null,"-")}linkToAsset(e){return e?l.A.is_object_id(e)?n.createElement(S.A,{asset:e}):n.createElement(k.N_,{to:`/asset/${e}`},e):n.createElement("span",null,"-")}getColumn(e,t,a,o,s){const{operations:i}=p.ChainTypes;let m=Object.keys(i),d=C().account_listing,g=null,h="info",y=null,b=null;switch(m[e[0]]){case"transfer":e[1].memo&&(y=n.createElement(T.A,{memo:e[1].memo})),h="success",e[1].amount.amount=parseFloat(e[1].amount.amount),g=n.createElement("span",{className:"right-td"},n.createElement(N.A,{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":h="warning",b=e[1],g=n.createElement("span",null,n.createElement(c.A.Wrapper,{base:b.min_to_receive.asset_id,quote:b.amount_to_sell.asset_id},(({base:t,quote:a})=>{const{marketName:r,first:c,second:l}=O.A.getMarketName(t,a),i=s.get(r),u=b.amount_to_sell.asset_id===(i?c.get("id"):l.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=o&&"string"==typeof o[1]?"#"+o[1].substring(4):"";return n.createElement(N.A,{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":h="cancel",g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.create_key"}));break;case"account_create":g=n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(N.A,{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";g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",e[1].memo&&(y=n.createElement(T.A,{memo:e[1].memo})),e[1].asset_to_issue.amount=parseInt(e[1].asset_to_issue.amount,10),g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":h="warning";const E=e[1].amount,v=2;if(o&&o[0]==v){const t=o[1];g=n.createElement("span",null,n.createElement(N.A,{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 g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":h="warning",g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(N.A,{string:"operation.witness_create",keys:[{type:"account",value:e[1].witness_account,arg:"account"}]}));break;case"witness_update":g=n.createElement("span",null,n.createElement(N.A,{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),g=t===e[1].witness_account?n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.witness_pay"})," ",n.createElement(f.A,{amount:e[1].amount,asset:"1.3.0"}),n.createElement(r(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].witness_account)):n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.received"})," ",n.createElement(f.A,{amount:e[1].amount,asset:"1.3.0"}),n.createElement(r(),{component:"span",content:"transaction.from"})," ",this.linkToAccount(e[1].witness_account));break;case"proposal_create":g=n.createElement("div",{className:"inline-block"},n.createElement("span",null,n.createElement(N.A,{string:"operation.proposal_create",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"},{value:o?n.createElement(M,{objectId:o[1]}):"",arg:"proposal"}]}),":"),n.createElement("div",null,e[1].proposed_ops.map(((e,t)=>n.createElement(H.A,{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"];g=n.createElement("div",null,n.createElement("span",null,n.createElement(N.A,{string:"operation.proposal_update",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"},{value:n.createElement(M,{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(r(),{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":g=n.createElement("span",null,n.createElement(N.A,{string:"operation.proposal_delete",keys:[{type:"account",value:e[1].fee_paying_account,arg:"account"},{value:n.createElement(M,{objectId:e[1].proposal}),arg:"proposal"}]}));break;case"withdraw_permission_create":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.withdraw_permission_create"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(r(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].authorized_account));break;case"withdraw_permission_update":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.withdraw_permission_update"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(r(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].authorized_account));break;case"withdraw_permission_claim":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.withdraw_permission_claim"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(r(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].withdraw_to_account));break;case"withdraw_permission_delete":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.withdraw_permission_delete"})," ",this.linkToAccount(e[1].withdraw_from_account),n.createElement(r(),{component:"span",content:"transaction.to"})," ",this.linkToAccount(e[1].authorized_account));break;case"fill_order":h="success",b=e[1],g=n.createElement("span",null,n.createElement(c.A.Wrapper,{base:b.receives.asset_id,quote:b.pays.asset_id},(({base:t,quote:a})=>{const{marketName:o,first:r,second:c}=O.A.getMarketName(t,a),l=s.get(o),i=b.pays.asset_id===(l?r.get("id"):c.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.A,{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":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.global_parameters_update"}));break;case"vesting_balance_create":g=n.createElement("span",null," ",this.linkToAccount(e[1].creator),n.createElement(r(),{component:"span",content:"transaction.vesting_balance_create"})," ",n.createElement(f.A,{amount:e[1].amount.amount,asset:e[1].amount.asset_id})," ",this.linkToAccount(e[1].owner));break;case"vesting_balance_withdraw":g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(N.A,{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":h="success",e[1].total_claimed.amount=parseInt(e[1].total_claimed.amount,10),g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.committee_member_create"})," ",this.linkToAccount(e[1].committee_member_account));break;case"transfer_to_blind":g=n.createElement("span",null,this.linkToAccount(e[1].from)," ",n.createElement(r(),{component:"span",content:"transaction.sent"})," ",n.createElement(f.A,{amount:e[1].amount.amount,asset:e[1].amount.asset_id}));break;case"transfer_from_blind":g=n.createElement("span",null,this.linkToAccount(e[1].to)," ",n.createElement(r(),{component:"span",content:"transaction.received"})," ",n.createElement(f.A,{amount:e[1].amount.amount,asset:e[1].amount.asset_id}));break;case"asset_claim_fees":h="success",e[1].amount_to_claim.amount=parseInt(e[1].amount_to_claim.amount,10),g=n.createElement("span",null,this.linkToAccount(e[1].issuer)," ",n.createElement(c.A.Wrapper,{asset:e[1].amount_to_claim.asset_id},(({asset:t})=>n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(r(),{component:"span",content:"transaction.custom"}));break;case"asset_reserve":g=n.createElement("span",null,n.createElement(N.A,{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":g=n.createElement("span",null,n.createElement(N.A,{string:"operation.committee_member_update_global_parameters",keys:[{type:"account",value:"1.2.0",arg:"account"}]}));break;case"override_transfer":g=n.createElement(N.A,{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":g=n.createElement(N.A,{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":g=n.createElement(N.A,{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":g=n.createElement(N.A,{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":g=n.createElement(N.A,{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 A=p.ChainStore.getObject("2.0.0"),S=p.ChainStore.getObject("2.1.0");let x=l.A.calc_block_time(a,A,S),C=!1;x||(x=l.A.calc_block_time(a,A,S,!0),C=!0),e[1].amount.amount=parseFloat(e[1].amount.amount);let I=new Date;I.setTime(x.getTime()+1e3*e[1].claim_period_seconds),g=n.createElement(n.Fragment,null,n.createElement("span",{className:"right-td"},n.createElement(N.A,{string:"operation.htlc_create",keys:[{type:"date",arg:"lock_period",value:I},{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"},C?"*":"")),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":h="success",g=n.createElement(n.Fragment,null,n.createElement("span",{className:"right-td"},n.createElement(N.A,{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":g=n.createElement("span",{className:"right-td"},n.createElement(N.A,{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":g=n.createElement("span",{className:"right-td"},n.createElement(N.A,{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":h="warning",g=n.createElement("span",{className:"right-td"},n.createElement(N.A,{string:"operation.htlc_refund",keys:[{value:e[1].htlc_id,arg:"htlc_id"},{type:"account",value:e[1].to,arg:"to"}]}));break;case"ticket_create":const L=Object.keys(p.ChainTypes.ticket_type).find((t=>p.ChainTypes.ticket_type[t]===e[1].target_type));g=n.createElement("span",null,n.createElement(N.A,{string:"operation.ticket_create",keys:[{type:"account",value:e[1].account,arg:"account"},{type:"amount",value:e[1].amount,arg:"amount"}]})," (",_().translate("operation.ticket_types."+L),")");break;case"credit_offer_delete":h="cancel",g=n.createElement(N.A,{string:"operation.credit_offer_delete",keys:[{type:"account",value:e[1].owner_account,arg:"account"},{value:e[1].offer_id,arg:"id"}]});break;case"credit_deal_repay":h="success",g=n.createElement(N.A,{string:"operation.credit_deal_repay",keys:[{type:"account",value:e[1].account,arg:"account"},{type:"amount",value:e[1].repay_amount,arg:"amount"},{type:"amount",value:e[1].credit_fee,arg:"fee"}]});break;case"credit_offer_accept":h="success",g=n.createElement(N.A,{string:"operation.credit_offer_accept",keys:[{type:"account",value:e[1].borrower,arg:"account"},{type:"amount",value:e[1].borrow_amount,arg:"amount"}]});break;case"credit_offer_update":h="warning",g=n.createElement(N.A,{string:"operation.credit_offer_update",keys:[{type:"account",value:e[1].owner_account,arg:"account"},{value:e[1].offer_id,arg:"id"}]});break;case"credit_offer_create":h="warning";let q={asset_id:e[1].asset_type,amount:e[1].balance};g=n.createElement(N.A,{string:"operation.credit_offer_create",keys:[{type:"account",value:e[1].owner_account,arg:"account"},{type:"amount",value:q,arg:"amount"},{value:parseFloat(e[1].fee_rate)/1e6*100+"%",arg:"fee"}]});break;case"credit_deal_expired":h="cancel",g=n.createElement(N.A,{string:"operation.credit_deal_expired",keys:[{type:"account",value:e[1].borrower,arg:"account"}]});break;case"liquidity_pool_create":h="warning",g=n.createElement(N.A,{string:"operation.liquidity_pool_create",keys:[{type:"account",value:e[1].account,arg:"account"},{type:"asset",value:e[1].asset_a,arg:"asset_a"},{type:"asset",value:e[1].asset_b,arg:"asset_b"},{value:o[1].new_objects[0],arg:"id"}]});break;case"liquidity_pool_delete":h="cancel",g=n.createElement(N.A,{string:"operation.liquidity_pool_delete",keys:[{type:"account",value:e[1].account,arg:"account"},{value:e[1].pool,arg:"id"}]});break;case"liquidity_pool_deposit":h="warning",g=n.createElement(N.A,{string:"operation.liquidity_pool_deposit",keys:[{type:"account",value:e[1].account,arg:"account"},{value:e[1].pool,arg:"id"},{type:"amount",value:o[1].paid[0],arg:"amount_a"},{type:"amount",value:o[1].paid[1],arg:"amount_b"},{type:"amount",value:o[1].received[0],arg:"received"}]});break;case"liquidity_pool_withdraw":h="warning",g=n.createElement(N.A,{string:"operation.liquidity_pool_withdraw",keys:[{type:"account",value:e[1].account,arg:"account"},{value:e[1].pool,arg:"id"},{type:"amount",value:o[1].received[0],arg:"amount_a"},{type:"amount",value:o[1].received[1],arg:"amount_b"},{type:"amount",value:o[1].paid[0],arg:"amount_c"}]});break;case"liquidity_pool_exchange":h="success",g=n.createElement(N.A,{string:"operation.liquidity_pool_exchange",keys:[{type:"account",value:e[1].account,arg:"account"},{value:e[1].pool,arg:"id"},{type:"amount",value:o[1].paid[0],arg:"amount_a"},{type:"amount",value:o[1].received[0],arg:"amount_b"}]});break;case"samet_fund_create":h="warning",g=n.createElement(N.A,{string:"operation.samet_fund_create",keys:[{type:"account",value:e[1].owner_account,arg:"account"},{type:"amount",value:{asset_id:e[1].asset_type,amount:e[1].balance},arg:"amount"},{value:parseFloat(e[1].fee_rate)/1e6*100+"%",arg:"fee"}]});break;case"samet_fund_update":h="warning",g=n.createElement(N.A,{string:"operation.samet_fund_update",keys:[{type:"account",value:e[1].owner_account,arg:"account"},{value:e[1].fund_id,arg:"id"}]});break;case"samet_fund_delete":h="cancel",g=n.createElement(N.A,{string:"operation.samet_fund_delete",keys:[{type:"account",value:e[1].owner_account,arg:"account"},{value:e[1].fund_id,arg:"id"},{type:"amount",value:o[1],arg:"amount"}]});break;case"samet_fund_borrow":h="success",g=n.createElement(N.A,{string:"operation.samet_fund_borrow",keys:[{type:"account",value:e[1].borrower,arg:"account"},{value:e[1].fund_id,arg:"id"},{type:"amount",value:e[1].borrow_amount,arg:"amount"}]});break;case"samet_fund_repay":h="success",g=n.createElement(N.A,{string:"operation.samet_fund_repay",keys:[{type:"account",value:e[1].account,arg:"account"},{value:e[1].fund_id,arg:"id"},{type:"amount",value:e[1].repay_amount,arg:"amount"},{type:"amount",value:e[1].fund_fee,arg:"fee"}]});break;default:console.log("unimplemented op '"+m[e[0]]+"':",e),g=n.createElement("span",null,n.createElement(k.N_,{to:`/block/${a}`},"#",a))}return{column:g,color:h}}},K=u.Select.Option;function Q(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 X extends n.Component{static propTypes={accountsList:s.A.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:$.NY.ES_WRAPPER_LIST.length>0?$.NY.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(!l.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&&(!l.A.are_equal_shallow(this.props.customFilter.fields,e.customFilter.fields)||!l.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(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=[],o=new Set;for(let t of e)if(t){let e=t.get("history");e&&(n=n.concat(e.toJS().filter((e=>!o.has(e.id)&&o.add(e.id)))))}return t&&(n=n.filter((e=>e.op[0]===G[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 Y;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:$.NY.ES_WRAPPER_LIST.length>0?$.NY.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,o=_().translate("transaction.trxTypes");const r=Z.getColumn(e.op,t,e.block_num,e.result,this.props.marketDirections);a.amount=parseInt(a.amount,10);const s=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.A,{visible:this.state.visibleId===e.id,operation:e.op,title:o[U[e.op[0]]||""],hideModal:this.closeJSONModal})),type:n.createElement(k.N_,{className:"inline-block","data-place":"bottom","data-tip":_().translate("tooltip.show_block",{block:l.A.format_number(e.block_num,0)}),to:`/block/${e.block_num}/${e.trx_in_block}`},n.createElement("span",{className:h()("label",r.color||"info")},o[U[e.op[0]]])),info:n.createElement("div",null,n.createElement("div",null,n.createElement("span",null,r.column)),n.createElement("div",{style:{fontSize:14,paddingTop:5}},e.block_num>s?n.createElement(z,{blockNumber:e.block_num}):null)),fee:n.createElement(f.A,{amount:a.amount,asset:a.asset_id}),time:n.createElement(w.A,{block_number:e.block_num,fullDate:!0})}}render(){let{accountsList:e,compactView:t,filter:a,customFilter:o,style:s,maxHeight:c}=this.props,{limit:l,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,o).sort(Q),g=m.length;s=s||{width:"100%",height:"100%"};let h=null;h=["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(K,{value:e,key:e},_().translate("transaction.trxTypes."+e))));let y=m.length?m.slice(0,l).map((e=>this.getDataSource(e,p))):[],b=n.createElement("div",{className:"total-value",key:"total_value"},n.createElement("span",{style:{textAlign:"center"}}," "));const k=n.createElement("div",null,n.createElement(u.Button,{onClick:()=>this._generateCSV(W),type:"primary"},n.createElement(r(),{content:"account.export_modal.full_report"})),n.createElement(u.Button,{onClick:()=>this._generateCSV(J),type:"primary"},n.createElement(r(),{content:"account.export_modal.coinbase_report"})));return n.createElement("div",{className:"recent-transactions no-overflow",style:s},n.createElement(u.Modal,{wrapClassName:"modal--transaction-confirm",title:n.createElement(r(),{content:"account.export_modal.title"}),visible:this.state.showModal,id:"transaction_confirm_modal",ref:"modal",footer:k,overlay:!0,onCancel:this.hideExportModal,noCloseBtn:!0},n.createElement("p",null,n.createElement(r(),{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%"}},$.NY.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(r(),{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)},h)):null,g>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.A,{name:"excel",size:"1x"}),n.createElement(r(),{content:"account.download_history"}))):null),this.state.accountHistoryError&&n.createElement("div",{className:"has-error",style:{paddingLeft:"0.75rem"}},n.createElement(r(),{content:"account.history_error"}))),n.createElement(E.A,{withTransition:!0,className:"table table-striped "+(t?"compact":"")+(this.props.dashboard?" dashboard-table table-hover":""),header:[{title:n.createElement(r(),{content:"account.transactions.id"}),dataIndex:"id",align:"left",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)},t?{}:{title:n.createElement(r(),{content:"account.transactions.type"}),dataIndex:"type",align:"left"},{title:n.createElement(r(),{content:"account.transactions.info"}),dataIndex:"info",align:"left",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:n.createElement(r(),{content:"account.transactions.fee"}),dataIndex:"fee",align:"left",render:e=>n.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:n.createElement(r(),{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(v.A,null)))}}X=(0,c.A)(X),X=(0,L.N)(X,{listenTo:()=>[I.A],getProps:()=>({marketDirections:I.A.getState().marketDirections})});class ee extends n.Component{static propTypes={asset:s.A.ChainAsset.isRequired,to:s.A.ChainAccount.isRequired,fromAccount:s.A.ChainAccount.isRequired};static defaultProps={asset:"1.3.0"};render(){return n.createElement("span",{className:"wrapper"},this.props.children(this.props))}}ee=(0,c.A)(ee)},72257:(e,t,a)=>{a.d(t,{A:()=>c});var n=a(96540),o=a(10658),r=a.n(o),s=a(46128);class c 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:o,loading:c}=this.props,l=[10,20,30,40,50,100].filter((e=>e<Math.max(this.props.pageSize,a.length)));l.push(Math.max(this.props.pageSize,a.length));let i=null;return null!==this.props.label?i=e=>r().translate(this.props.label,{count:e}):"string"==typeof this.props.totalLabel?i=e=>r().translate(this.props.totalLabel,{count:e}):"object"==typeof this.props.totalLabel&&(i=e=>r().translate(this.props.totalLabel.key,{count:e,...this.props.totalLabel.args})),n.createElement("div",{className:"paginated-list",style:this.props.style},n.createElement(s.Table,{loading:c,dataSource:a,uns:!0,columns:Array.isArray(t)?t:[],footer:()=>o||n.createElement("span",null," "),onChange:this.props.toggleSortOrder,pagination:{showSizeChanger:!0,hideOnSinglePage:!1,defaultPageSize:e,pageSizeOptions:l.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)}}}}]);