|
|
|
require=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t){function n(e){return{jsonrpc:"2.0",method:e.call,params:e.args,id:e._id}}function r(e){var t=JSON.parse(e);return{_id:t.id,data:t.result,error:t.error}}var i=function(e){this.handlers=[],this.host=e};i.prototype.sendRequest=function(e,t){var r=n(e),i=new XMLHttpRequest;i.open("POST",this.host,!0),i.send(JSON.stringify(r)),i.onreadystatechange=function(){4===i.readyState&&t&&t(i)}},i.prototype.send=function(e){var t=this;this.sendRequest(e,function(e){t.handlers.forEach(function(n){n.call(t,r(e.responseText))})})},i.prototype.poll=function(e,t){var n=this;this.sendRequest(e,function(r){var i=JSON.parse(r.responseText);!i.error&&(i.result instanceof Array?0!==i.result.length:i.result)&&n.handlers.forEach(function(r){r.call(n,{_event:e.call,_id:t,data:i.result})})})},Object.defineProperty(i.prototype,"onmessage",{set:function(e){this.handlers.push(e)}}),t.exports=i},{}],2:[function(e,t){function n(e){return e instanceof Promise?Promise.resolve(e):e instanceof Array?new Promise(function(t){var r=e.map(function(e){return n(e)});return Promise.all(r).then(function(n){for(var r=0;r<e.length;r++)e[r]=n[r];t(e)})}):e instanceof Object?new Promise(function(t){var r=Object.keys(e),i=r.map(function(t){return n(e[t])});return Promise.all(i).then(function(n){for(var i=0;i<r.length;i++)e[r[i]]=n[i];t(e)})}):Promise.resolve(e)}function r(e){if(void 0!==e._event)return void g.trigger(e._event,e._id,e.data);if(e._id){var t=g._callbacks[e._id];t&&(t.call(this,e.error,e.data),delete g._callbacks[e._id])}}var i,o,s,a,c=function(){var e=function(e){return"string"==typeof e[0]?"blockByHash":"blockByNumber"},t=function(e){return"string"==typeof e[0]?"transactionByHash":"transactionByNumber"},n=function(e){return"string"==typeof e[0]?"uncleByHash":"uncleByNumber"},r=[{name:"balanceAt",call:"balanceAt"},{name:"stateAt",call:"stateAt"},{name:"countAt",call:"countAt"},{name:"codeAt",call:"codeAt"},{name:"transact",call:"transact"},{name:"call",call:"call"},{name:"block",call:e},{name:"transaction",call:t},{name:"uncle",call:n},{name:"compile",call:"compile"}];return r},l=function(){return[{name:"coinbase",getter:"coinbase",setter:"setCoinbase"},{name:"listening",getter:"listening",setter:"setListening"},{name:"mining",getter:"mining",setter:"setMining"},{name:"gasPrice",getter:"gasPrice"},{name:"account",getter:"account"},{name:"accounts",getter:"accounts"},{name:"peerCount",getter:"peerCount"},{name:"defaultBlock",getter:"defaultBlock",setter:"setDefaultBlock"},{name:"number",getter:"number"}]},u=function(){return[{name:"put",call:"put"},{name:"get",call:"get"},{name:"putString",call:"putString"},{name:"getString",call:"getString"}]},d=function(){return[{name:"post",call:"post"},{name:"newIdentity",call:"newIdentity"},{name:"haveIdentity",call:"haveIdentity"},{name:"newGroup",call:"newGroup"},{name:"addToGroup",call:"addToGroup"}]},p=function(){var e=function(e){return"string"==typeof e[0]?"newFilterString":"newFilter"};return[{name:"newFilter",call:e},{name:"uninstallFilter",call:"uninstallFilter"},{name:"getMessages",call:"getMessages"}]},h=function(){return[{name:"newFilter",call:"shhNewFilter"},{name:"uninstallFilter",call:"shhUninstallFilter"},{name:"getMessage",call:"shhGetMessages"}]},f=function(e,t){t.forEach(function(t){e[t.name]=function(){return n(Array.prototype.slice.call(arguments)).then(function(e){var n="function"==typeof t.call?t.call(e):t.call;return{call:n,args:e}}).then(function(e){return new Promise(function(t,n){g.provider.send(e,function(e,r){return e?void n(e):void t(r)})})}).catch(function(e){console.error(e)})}})},v=function(e,t){t.forEach(function(t){var r={};r.get=
|