text: (this["webpackJsonpmy-app"]=this["webpackJsonpmy-app"]||[]).push([[0],{116:function(e,t,n){},117:function(e,t,n){},118:function(e,t,n){},216:function(e,t,n){e.exports=n(500)},221:function(e,t,n){},222:function(e,t,n){},236:function(e,t){},245:function(e,t){},263:function(e,t){},265:function(e,t){},282:function(e,t){},283:function(e,t){},348:function(e,t){},350:function(e,t){},359:function(e,t){},361:function(e,t){},386:function(e,t){},388:function(e,t){},389:function(e,t){},395:function(e,t){},397:function(e,t){},410:function(e,t){},422:function(e,t){},425:function(e,t){},430:function(e,t){},441:function(e,t){},444:function(e,t){},500:function(e,t,n){"use strict";n.r(t);var a=n(0),o=n.n(a),r=n(209),s=n.n(r),c=(n(221),n(3)),i=n(4),l=n(10),u=n(9),d=n(77),p=n(14),m=(n(222),n(116),n(117),function(e){Object(l.a)(n,e);var t=Object(u.a)(n);function n(e){var a;return Object(c.a)(this,n),(a=t.call(this,e)).responseObject=null,console.log("Consturctor:"),console.log(e),a.responseObject=null,a}return Object(i.a)(n,[{key:"componentWillMount",value:function(){}},{key:"componentDidMount",value:function(){}},{key:"componentWillUpdate",value:function(){}},{key:"componentDidUpdate",value:function(){}},{key:"render",value:function(){return o.a.createElement("div",{className:"TableCreator"})}}]),n}(a.Component)),f=function(e){Object(l.a)(n,e);var t=Object(u.a)(n);function n(){var e;Object(c.a)(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return(e=t.call.apply(t,[this].concat(o))).state={address:null},e}return Object(i.a)(n,[{key:"render",value:function(){var e=this,t=""!==this.state.address?o.a.createElement(m,{address:this.state.address}):null;return o.a.createElement("div",{className:"AddressViewer"},o.a.createElement("div",{id:"banner"},o.a.createElement("h1",{className:"title"},"Adderss Viewer")),o.a.createElement("div",{id:"searchbar"},o.a.createElement("div",{id:"address_input"},o.a.createElement("div",{class:"input-group mb-3"},o.a.createElement("input",{type:"text",id:"input",class:"form-control",placeholder:"Enter address...","aria-label":"Enter address...","aria-describedby":"button-addon2"}),o.a.createElement("div",{class:"input-group-append"},o.a.createElement("button",{class:"btn btn-outline-secondary",type:"button",id:"button-addon2",onClick:function(){var t=document.getElementById("input").value;""!=t?(console.log("address -> "+t),e.setState({address:t})):window.alert("Inputfield is empty.")}},"Search"))))),o.a.createElement("div",{id:"table_box"},t))}}]),n}(a.Component),g=(n(118),n(28)),h=n(78),b=n(19),v=n.n(b),y=n(55),E=function(e){Object(l.a)(a,e);var t=Object(u.a)(a);function a(e){var n;return Object(c.a)(this,a),(n=t.call(this,e)).transactionMap=null,n.tempMap=null,n.transactionMap=new Map,n.tempMap=new Map,n}return Object(i.a)(a,[{key:"getData",value:function(){var e=Object(y.a)(v.a.mark((function e(t,n,a){var o,r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.setLoadingbar(0),this.transactionMap=new Map,this.tempMap=new Map,console.log("Function - getContractList(page, offsett):"),e.next=6,this.getContractList(t,n);case 6:return o=e.sent,console.log("CONTRACTLIST:"),console.log(o),console.log("Function - getTransactionFromContractList(contractList):"),e.next=12,this.getTransactionFromContractList(o);case 12:return console.log("TRANSACTIONMAP BEFORE DEEEP SEARCH:"),console.log(this.transactionMap),console.log("Function - deepSearch(depth, round):"),e.next=17,this.copyMap(this.transactionMap);case 17:if(this.tempMap=e.sent,0==a){e.next=28;break}r=1;case 20:if(!(r<=a)){e.next=26;break}return e.next=23,this.deepSearch(a,r);case 23:r++,e.next=20;break;case 26:console.log("TRANSACTIONMAP AFTER DEEEP SEARCH:"),console.log(this.transactionMap);case 28:return document.getElementById("loading_informaiton").innerHTML="Loading...",e.abrupt("return",this.convertMapToArray(this.transactionMap));case 30:case"end":return e.stop()}}),e,this)})));return function(t,n,a){return e.apply(this,arguments)}}()},{key:"getContractList",value:function(){var e=Object(y.a)(v.a.mark((function e(t,n){var a,o;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a="https://blockexplorer.bloxberg.org/api/api?module=contract&action=listcontracts&page="+t+"&offset="+n,e.next=3,fetch(a).then((function(e){return e.json()}));case 3:return o=e.sent,e.abrupt("return",o.result);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"getTransactionFromContractList",value:function(){var e=Object(y.a)(v.a.mark((function e(t){var n,a,o,r,s,c,i,l,u,d;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("Searching for contract transactions:"),n=1,a=Object(h.a)(t),e.prev=3,a.s();case 5:if((o=a.n()).done){e.next=41;break}return r=o.value,s="https://blockexplorer.bloxberg.org/api/api?module=account&action=txlist&address=",s+=r.Address,e.next=11,fetch(s).then((function(e){return e.json()}));case 11:c=e.sent,i=Object.keys(c.result).length,l=c.result,console.log("   Recived "+i+" Transaction entries."),u=0;case 16:if(!(u<i)){e.next=36;break}if(""===l[u].from||""===l[u].to||this.mapContains(this.transactionMap,l[u].from,l[u].to)){e.next=33;break}return e.t0=this.transactionMap,e.t1=l[u].from+l[u].to,e.t2=l[u].from,e.t3=l[u].to,e.next=24,this.isContract(l[u].from);case 24:if(!e.sent){e.next=28;break}e.t4="Contract",e.next=29;break;case 28:e.t4="Account";case 29:e.t5=e.t4,e.t6={source:e.t2,target:e.t3,sourceType:e.t5,targetType:"Contract"},e.t0.set.call(e.t0,e.t1,e.t6),console.log("      Transaction entry number "+(u+1)+" added.");case 33:u++,e.next=16;break;case 36:d=Math.round(100*n/t.length*100)/100,this.setLoadingbar(d),n++;case 39:e.next=5;break;case 41:e.next=46;break;case 43:e.prev=43,e.t7=e.catch(3),a.e(e.t7);case 46:return e.prev=46,a.f(),e.finish(46);case 49:this.setLoadingbar(0);case 50:case"end":return e.stop()}}),e,this,[[3,43,46,49]])})));return function(t){return e.apply(this,arguments)}}()},{key:"deepSearch",value:function(){var e=Object(y.a)(v.a.mark((function e(t,n){var a,o,r,s,c,i,l,u,d,p,m,f,g;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=this.copyMap(this.tempMap),this.tempMap=new Map,o=1,console.log("DEEP SEARCH ROUND "+n+"/"+t),r=Object(h.a)(a),e.prev=5,r.s();case 7:if((s=r.n()).done){e.next=81;break}return c=s.value,console.log("   Look up for map entry "+o+" of "+a.size),document.getElementById("loading_informaiton").innerHTML="Address look up ("+o+"/"+a.size+")<br>Depth search level ("+n+"/"+t+")",i="https://blockexplorer.bloxberg.org/api/api?module=account&action=txlist&address=",i+=c[1].source,console.log("      Searching transactions for address "+c[1].source+" ..."),e.next=16,fetch(i).then((function(e){return e.json()}));case 16:l=e.sent,u=Object.keys(l.result).length,d=l.result,console.log("         Recived "+u+" Transaction entries."),p=1,m=0;case 22:if(!(m<u)){e.next=76;break}if(d[m].to!==c[1].source&&(f=d[m].from,d[m].from=d[m].to,d[m].to=f),""===d[m].from||""===d[m].to||this.mapContains(this.transactionMap,d[m].from,d[m].to)){e.next=72;break}return e.t0=this.transactionMap,e.t1=d[m].from+d[m].to,e.t2=d[m].from,e.t3=d[m].to,e.next=31,this.isContract(d[m].from);case 31:if(!e.sent){e.next=35;break}e.t4="Contract",e.next=36;break;case 35:e.t4="Account";case 36:return e.t5=e.t4,e.next=39,this.isContract(d[m].to);case 39:if(!e.sent){e.next=43;break}e.t6="Contract",e.next=44;break;case 43:e.t6="Account";case 44:return e.t7=e.t6,e.t8={source:e.t2,target:e.t3,sourceType:e.t5,targetType:e.t7},e.t0.set.call(e.t0,e.t1,e.t8),e.t9=this.tempMap,e.t10=d[m].from+d[m].to,e.t11=d[m].from,e.t12=d[m].to,e.next=53,this.isContract(d[m].from);case 53:if(!e.sent){e.next=57;break}e.t13="Contract",e.next=58;break;case 57:e.t13="Account";case 58:return e.t14=e.t13,e.next=61,this.isContract(d[m].to);case 61:if(!e.sent){e.next=65;break}e.t15="Contract",e.next=66;break;case 65:e.t15="Account";case 66:e.t16=e.t15,e.t17={source:e.t11,target:e.t12,sourceType:e.t14,targetType:e.t16},e.t9.set.call(e.t9,e.t10,e.t17),console.log("            Transaction entry number "+p+" added."),g=Math.round(100*p/u*100)/100,this.setLoadingbar(g);case 72:p++;case 73:m++,e.next=22;break;case 76:p=1,o++,this.setLoadingbar(0);case 79:e.next=7;break;case 81:e.next=86;break;case 83:e.prev=83,e.t18=e.catch(5),r.e(e.t18);case 86:return e.prev=86,r.f(),e.finish(86);case 89:console.log("----- MAP for round "+n+" -----"),console.log(a),console.log("---------------------------");case 92:case"end":return e.stop()}}),e,this,[[5,83,86,89]])})));return function(t,n){return e.apply(this,arguments)}}()},{key:"isContract",value:function(){var e=Object(y.a)(v.a.mark((function e(t){var a,o,r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=!0,o=n(224),r=new o(new o.providers.HttpProvider("https://core.bloxberg.org/")),e.next=5,r.eth.getCode(t);case 5:return"0x"===e.sent&&(a=!1),e.abrupt("return",a);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{key:"convertMapToArray",value:function(e){var t=new Array;return e.forEach((function(e,n){t.push({source:e.source,target:e.target,sourceType:e.sourceType,targetType:e.targetType})})),t}},{key:"copyMap",value:function(e){var t,n=new Map,a=Object(h.a)(e);try{for(a.s();!(t=a.n()).done;){var o=t.value;n.set(o[1].source+o[1].target,{source:o[1].source,target:o[1].target,sourceType:o[1].sourceType,targetType:o[1].targetType})}}catch(r){a.e(r)}finally{a.f()}return n}},{key:"mapContains",value:function(e,t,n){return e.has(t+n)||e.has(n+t)}},{key:"setLoadingbar",value:function(e){document.getElementById("progress").style.width=e+"%",document.getElementById("progress").innerHTML=e+"%"}}]),a}(o.a.Component),k=function(e){Object(l.a)(n,e);var t=Object(u.a)(n);function n(e){var a;return Object(c.a)(this,n),(a=t.call(this,e)).responseObject=null,a.zoomEnable=!0,console.log("Consturctor:"),console.log(e),a.responseObject=new E,a}return Object(i.a)(n,[{key:"createGraph",value:function(e){console.log("Function - createGraph():");var t=window.innerHeight-document.getElementById("address_information").offsetHeight;document.getElementById("graph_box").style.height=t+"px";var n=t,a=window.innerWidth;console.log("PROMISE:"),console.log(e);var o=e;console.log("LINKS:"),console.log(o);var r={};o.forEach((function(e){e.source=r[e.source]||(r[e.source]={nodeAddress:e.source,source:e.source,target:e.target,typeSource:e.sourceType,typeTarget:e.targetType}),e.target=r[e.target]||(r[e.target]={nodeAddress:e.target,source:e.source,target:e.target,typeSource:e.sourceType,typeTarget:e.targetType})})),console.log("NODES:"),console.log(r);var s=document.getElementById("address_information").offsetWidth-2,c=n-20,i=g.behavior.zoom().on("zoom",(function(){l.attr("transform","translate("+g.event.translate+") scale("+g.event.scale+")")}));document.getElementById("container").innerHTML="";var l=g.select("#container").append("svg").attr("width",s).attr("height",c).style("cursor","move").call(i).append("g"),u=g.layout.force().size([s,c]).nodes(g.values(r)).links(o).on("tick",(function(e){p.attr("cx",(function(e){return e.x})).attr("cy",(function(e){return e.y})).call(u.drag),d.attr("x1",(function(e){return e.source.x})).attr("y1",(function(e){return e.source.y})).attr("x2",(function(e){return e.target.x})).attr("y2",(function(e){return e.target.y}))})).linkDistance(300).charge((function(e){var t=-200;return 0===e.index&&(t*=2.5),t})).start(),d=l.selectAll(".link").data(o).enter().append("line").attr("class","link"),p=l.selectAll(".node").data(u.nodes()).enter().append("circle").style("cursor","auto").style("fill",(function(e){return e.nodeAddress===e.source&&"Contract"===e.typeSource||e.nodeAddress===e.target&&"Contract"===e.typeTarget?"orange":void 0})).attr("class","node").attr("r",.005*a).on("click",(function(e){console.log(e),e.nodeAddress===e.source&&(document.getElementById("address_information").innerHTML=" <p class='labels'>Type:</p><p class='values'>"+e.typeSource+"</p><p class='labels'>Address:</p><p class='values'><a href='https://blockexplorer.bloxberg.org/address/"+e.source+"' target='_blank'>"+e.source+"</a></p>"),e.nodeAddress===e.target&&(document.getElementById("address_information").innerHTML=" <p class='labels'>Type:</p><p class='values'>"+e.typeTarget+"</p><p class='labels'>Address:</p><p class='values'><a href='https://blockexplorer.bloxberg.org/address/"+e.target+"' target='_blank'>"+e.target+"</a></p>")})).on("mousedown",(function(e){console.log("----- Node Information -----"),console.log("nodeAddress: "+e.nodeAddress),console.log("source: "+e.source),console.log("target: "+e.target),console.log("typeSource:   "+e.typeSource),console.log("typeTarget:   "+e.typeTarget),this.zoomEnable=!1,g.select("#container").select("svg").call(g.behavior.zoom().on("zoom",null))})).on("mouseup",(function(){this.zoomEnable=!0,g.select("#container").select("svg").call(i)})).on("focus",(function(){g.select(this).style("border-color","red")}));console.log("Graph drawed.")}},{key:"timeStap",value:function(){return Math.floor(Date.now())}},{key:"calculationTime",value:function(e,t){console.log("Graph created in "+(t-e)/1e3+" seconds.")}},{key:"showLoader",value:function(){document.getElementById("address_information").innerHTML="Select a node for node information.",document.getElementById("address_information").style.visibility="hidden",document.getElementById("container").style.visibility="hidden",document.getElementById("loader").style.visibility="visible"}},{key:"hideLoader",value:function(){document.getElementById("address_information").style.visibility="visible",document.getElementById("container").style.visibility="visible",document.getElementById("loader").style.visibility="hidden",document.getElementById("progress").style.width="0%",document.getElementById("progress").innerHTML="0%"}},{key:"scrollAnimation",value:function(){document.getElementById("address_information").scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}},{key:"widthResizeListener",value:function(){window.onresize=function(){document.getElementsByTagName("svg")[0].style.width=document.getElementById("address_information").offsetWidth-2}}},{key:"componentWillMount",value:function(){console.log("Component will mount.")}},{key:"componentDidMount",value:function(){var e=this;console.log("Component did mount.");var t=this.timeStap();this.showLoader(),this.responseObject.getData(this.props.page,this.props.offset,this.props.depth).then((function(n){e.hideLoader(),e.createGraph(n);var a=e.timeStap();e.calculationTime(t,a),e.scrollAnimation(),e.widthResizeListener()}))}},{key:"componentWillUpdate",value:function(e){var t=this;console.log("Component will update.");var n=this.timeStap();this.showLoader(),this.responseObject.getData(e.page,e.offset,e.depth).then((function(e){t.hideLoader(),t.createGraph(e);var a=t.timeStap();t.calculationTime(n,a),t.scrollAnimation(),t.widthResizeListener()}))}},{key:"componentDidUpdate",value:function(){console.log("Component did update.")}},{key:"render",value:function(){return o.a.createElement("div",{id:"container"})}}]),n}(a.Component),x=function(e){Object(l.a)(n,e);var t=Object(u.a)(n);function n(){var e;Object(c.a)(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return(e=t.call.apply(t,[this].concat(o))).state={page:0,offset:0,depth:0},e}return Object(i.a)(n,[{key:"render",value:function(){for(var e=this,t=0!==this.state.page?o.a.createElement(k,{page:this.state.page,offset:this.state.offset,depth:this.state.depth}):null,n=[],a=1;a<=100;a++)n.push(o.a.createElement("option",{key:a,value:a},a));for(var r=[],s=1;s<=1800;s++)r.push(o.a.createElement("option",{key:s,value:s},s));for(var c=[],i=0;i<=5;i++)c.push(o.a.createElement("option",{key:i,value:i},i));return o.a.createElement("div",{className:"VBN"},o.a.createElement("div",{id:"banner"},o.a.createElement("h1",{className:"title"},"Visualisation of Bloxberg-Network")),o.a.createElement("div",{id:"site_informaiton"},o.a.createElement("p",null,"This website will produce a force directed d3 graph, that will visualizise the Bloxberg Network",o.a.createElement("br",null),"by using the ",o.a.createElement("a",{href:"https://blockexplorer.bloxberg.org/api_docs",target:"_blank"},"Bloxberg RPC API")," and the ",o.a.createElement("a",{href:"https://web3js.readthedocs.io/en/v1.3.0/",target:"_blank"},"Web3")," framework for JavaScript.")),o.a.createElement("div",{id:"values_informaiton"},o.a.createElement("p",{id:"text"},o.a.createElement("b",null,"Page")," represents the page number to be used for pagination."),o.a.createElement("p",{id:"text"},o.a.createElement("b",null,"Offset")," represents the maximum number of records to return when paginating."),o.a.createElement("p",{id:"text"},o.a.createElement("b",null,"Depth")," represents how deep the http requests will search into to network.")),o.a.createElement("div",{id:"control"},o.a.createElement("label",null,"Page:"),o.a.createElement("select",{id:"page_selection",defaultValue:2},n),o.a.createElement("label",null,"Offset:"),o.a.createElement("select",{id:"offset_selection",defaultValue:1},r),o.a.createElement("label",null,"Depth:"),o.a.createElement("select",{id:"depth_selection",defaultValue:0},c),o.a.createElement("input",{type:"submit",id:"button",value:"Create Graph",onClick:function(){var t=document.getElementById("page_selection").value,n=document.getElementById("offset_selection").value,a=document.getElementById("depth_selection").value;console.log("page -> "+t),console.log("offset -> "+n),console.log("depth -> "+a),e.setState({page:t,offset:n,depth:a})}})),o.a.createElement("div",{id:"loader",style:{visibility:"visable"}},o.a.createElement("div",{id:"progressbar"},o.a.createElement("div",{id:"progress"}),o.a.createElement("p",{id:"loading_informaiton"},"Loading..."))),o.a.createElement("div",{id:"address_information"},o.a.createElement("p",{class:"labels"},"Select a node for node information.")),o.a.createElement("div",{id:"graph_box"},t))}}]),n}(a.Component),w=function(e){Object(l.a)(n,e);var t=Object(u.a)(n);function n(){return Object(c.a)(this,n),t.apply(this,arguments)}return Object(i.a)(n,[{key:"render",value:function(){return o.a.createElement(d.a,null,o.a.createElement("div",{className:"App"},o.a.createElement("div",{id:"navigation"},o.a.createElement("nav",null,o.a.createElement("ul",{id:"nav-links"},o.a.createElement(d.b,{to:"/AddressViewer",class:"link"},o.a.createElement("li",null,"AddressViewer")),o.a.createElement(d.b,{to:"/VBN",class:"link"},o.a.createElement("li",null,"VBN"))))),o.a.createElement(p.c,null,o.a.createElement(p.a,{path:"/AddressViewer",exact:!0,component:f}),o.a.createElement(p.a,{path:"/VBN",exact:!0,component:x}))))}}]),n}(a.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));s.a.render(o.a.createElement(w,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))}},[[216,1,2]]]);
  //# sourceMappingURL=main.f7594316.chunk.js.map