plugeth/dist/ethereum.min.js

1 line
8.2 KiB
JavaScript
Raw Normal View History

require=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[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:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return i(n?n:t)},u,u.exports,t,e,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(t,e){function n(t){return{jsonrpc:"2.0",method:t.call,params:t.args,id:t._id}}function r(t){var e=JSON.parse(t);return{_id:e.id,data:e.result}}var i=function(t){this.handlers=[],this.host=t};i.prototype.sendRequest=function(t,e){var r=n(t),i=new XMLHttpRequest;i.open("POST",this.host,!0),i.send(JSON.stringify(r)),i.onreadystatechange=function(){4===i.readyState&&e&&e(i)}},i.prototype.send=function(t){var e=this;this.sendRequest(t,function(t){e.handlers.forEach(function(n){n.call(e,r(t.responseText))})})},i.prototype.poll=function(t,e){var n=this;this.sendRequest(t,function(r){var i=JSON.parse(r.responseText);(i.result instanceof Array?0!==i.result.length:i.result)&&n.handlers.forEach(function(r){r.call(n,{_event:t.call,_id:e,data:i.result})})})},Object.defineProperty(i.prototype,"onmessage",{set:function(t){this.handlers.push(t)}}),e.exports=i},{}],2:[function(t,e){function n(t){return t instanceof Promise?Promise.resolve(t):t instanceof Array?new Promise(function(e){var r=t.map(function(t){return n(t)});return Promise.all(r).then(function(n){for(var r=0;r<t.length;r++)t[r]=n[r];e(t)})}):t instanceof Object?new Promise(function(e){var r=Object.keys(t),i=r.map(function(e){return n(t[e])});return Promise.all(i).then(function(n){for(var i=0;i<r.length;i++)t[r[i]]=n[i];e(t)})}):Promise.resolve(t)}function r(t){if(void 0!==t._event)return void v.trigger(t._event,t._id,t.data);if(t._id){var e=v._callbacks[t._id];e&&(e.call(this,t.data),delete v._callbacks[t._id])}}var i,o,s,a,c=function(){var t=function(t){return"string"==typeof t[0]?"blockByHash":"blockByNumber"},e=function(t){return"string"==typeof t[0]?"transactionByHash":"transactionByNumber"},n=function(t){return"string"==typeof t[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:t},{name:"transaction",call:e},{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"}]},p=function(){return[{name:"post",call:"post"},{name:"newIdentity",call:"newIdentity"},{name:"haveIdentity",call:"haveIdentity"},{name:"newGroup",call:"newGroup"},{name:"addToGroup",call:"addToGroup"}]},d=function(){var t=function(t){return"string"==typeof t[0]?"newFilterString":"newFilter"};return[{name:"newFilter",call:t},{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(t,e){e.forEach(function(e){t[e.name]=function(){return n(Array.prototype.slice.call(arguments)).then(function(t){var n="function"==typeof e.call?e.call(t):e.call;return{call:n,args:t}}).then(function(t){return new Promise(function(e,n){v.provider.send(t,function(t){return t||"boolean"==typeof t?void e(t):void n(t)})})}).catch(function(t){console.error(t)})}})},g=function(t,e){e.forEach(function(e){var r={};r.get=function(){re