From ffc849fd664e45e39ea19178f0fdb44fd460cac2 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Wed, 7 Mar 2018 00:01:56 -0300 Subject: [PATCH 1/2] Fix mist/wallet detection --- app/client/lib/helpers/templateHelpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/lib/helpers/templateHelpers.js b/app/client/lib/helpers/templateHelpers.js index bd86af684..186677568 100644 --- a/app/client/lib/helpers/templateHelpers.js +++ b/app/client/lib/helpers/templateHelpers.js @@ -28,7 +28,7 @@ Check if in mist @method (isMist) **/ Template.registerHelper('isMist', function(){ - return window.mistMode === 'mist'; + return (typeof window.mistMode === 'undefined'); }); /** From 0a31f1f411672d1de1ef37ea344b1d6b2d1c6296 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Wed, 7 Mar 2018 00:05:43 -0300 Subject: [PATCH 2/2] Build Wallet --- ...7f34b05dd.js => b50e0e14de1913823d2ae9985aa5a0e6ff550a50.js} | 2 +- build/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename build/{37af1f9b831e6c9025fee32f8568eaf7f34b05dd.js => b50e0e14de1913823d2ae9985aa5a0e6ff550a50.js} (99%) diff --git a/build/37af1f9b831e6c9025fee32f8568eaf7f34b05dd.js b/build/b50e0e14de1913823d2ae9985aa5a0e6ff550a50.js similarity index 99% rename from build/37af1f9b831e6c9025fee32f8568eaf7f34b05dd.js rename to build/b50e0e14de1913823d2ae9985aa5a0e6ff550a50.js index 88ac75f6e..7b2f0237e 100644 --- a/build/37af1f9b831e6c9025fee32f8568eaf7f34b05dd.js +++ b/build/b50e0e14de1913823d2ae9985aa5a0e6ff550a50.js @@ -339,7 +339,7 @@ stub:["0x60606040523615600d57600d565b606a5b7328aa4f0b12d6b0601e45836a14caa9ab1ad (function(){function e(e){var t="0x0000000000000000000000000000000000000000000000000000000000000000";if(""!=e)for(var a=e.split("."),s=a.length-1;s>=0;s--)t=n(t+n(a[s]).slice(2),{encoding:"hex"});return t.toString()}Helpers={},Helpers.getDefaultContractExample=function(e){var n="contract MyContract {\n /* Constructor */\n function MyContract() public {\n\n }\n}";if(e)return n;var t;return t="undefined"!=typeof mist&&mist.solidity&&mist.solidity.version?mist.solidity.version:"0.4.6","pragma solidity ^"+t+";\n\n"+n},Helpers.rerun={"10s":new ReactiveTimer(10),"1s":new ReactiveTimer(1)},Helpers.sortByBalance=function(e,n){return!n.disabled&&new BigNumber(n.balance,10).gt(new BigNumber(e.balance,10))?1:-1},Helpers.getOwnedAccountFrom=function(e){var n=EthAccounts.find({},{sort:{balance:1}}).fetch();n.sort(Helpers.sortByBalance);var t=_.find(n,function(n){return e.indexOf(n.address)>=0});return t?t.address:""},Helpers.getLocalStorageSize=function(){var e=0;return localStorage&&_.each(Object.keys(localStorage),function(n){e+=2*localStorage[n].length/1024/1024}),e},Helpers.makeId=function(e,n){return _.isString(n)?e+"_"+n.replace("0x","").substr(0,10):null},Helpers.formatNumberByDecimals=function(e,n){var t="0,0.";for(i=0;i$1 '),-1!==e.type.indexOf("[")||"string"!==e.typeShort&&"uint"!==e.typeShort&&"int"!=e.typeShort&&"address"!=e.typeShort&&"bool"!=e.typeShort&&"bytes"!=e.typeShort?e.template="elements_input_json":e.template="elements_input_"+e.typeShort,e},Helpers.addInputValue=function(e,n,t){return _.map(e,function(e){var a=_.isUndefined(e.value)?"":e.value;if(n.name===e.name&&n.type===e.type&&n.index===e.index){if(-1!==e.type.indexOf("["))try{a=JSON.parse(t.value)}catch(s){a=[]}else a=_.isEmpty(t.value)||"bytes"!==e.typeShort&&"address"!==e.typeShort?"bool"===e.typeShort?!!t.checked:t.value||"":/^[0-9a-f]+$/i.test(t.value.replace("0x",""))?"0x"+t.value.replace("0x",""):null;e.value=a}return a})||[]},Helpers.toSentence=function(e,n){return"undefined"==typeof e?!1:(e=e.replace(/[^a-z0-9_]/gi,""),n===!0?e.replace(/([A-Z]+|[0-9]+)/g," $1").trim():e.replace(/([A-Z]+|[0-9]+)/g," $1").trim().replace(/([\_])/g,'$1'))},Helpers.isOnMainNetwork=function(){return"main"==Session.get("network")};var n=function(e,n){return"0x"+web3.sha3(e,n).replace("0x","")},t=[{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"resolver",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"ttl",outputs:[{name:"",type:"uint64"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"label",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"}],a=[{constant:!0,inputs:[{name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{name:"",type:"bool"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"},{name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"content",outputs:[{name:"ret",type:"bytes32"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"addr",outputs:[{name:"ret",type:"address"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],name:"setABI",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"name",outputs:[{name:"ret",type:"string"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"name",type:"string"}],name:"setName",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"hash",type:"bytes32"}],name:"setContent",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"pubkey",outputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"addr",type:"address"}],name:"setAddr",outputs:[],payable:!1,type:"function"},{inputs:[{name:"ensAddr",type:"address"}],payable:!1,type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"hash",type:"bytes32"}],name:"ContentChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"x",type:"bytes32"},{indexed:!1,name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"}],s="0x314159265dd8dbb310642f98f50c066173c1259b";Helpers.getENSName=function(n,o){if("main"!==Session.get("network"))return void o("Cannot retrieve ENS addresses unless fully synced on main chain",null,null);var r=e(n.toLowerCase().replace("0x","")+".addr.reverse"),i=web3.eth.contract(t),p=web3.eth.contract(a);i.at(s,function(n,t){t.resolver(r,function(n,a){n?o(n,null,null):0==a?o("no resolver address",null,null):p.at(a).name(r,function(a,s){if(n)o(n,null,null);else if(0==s)o("Found resolver but no name",null,null);else{var r=e(s);t.resolver(r,function(e,n){e?o(e,null,null):0==n?o("Name has no resolver",null,null):p.at(n).addr(r,function(n,t){e?o(e,null,null):0==t?o("No address returned",null,null):o(n,s,t)})})}})})})}}).call(this); -(function(){Template.registerHelper("debug",function(e){console.log(e)}),Template.registerHelper("isMist",function(){return"mist"===window.mistMode}),Template.registerHelper("isWalletMode",function(){return"wallet"===window.mistMode||"undefined"==typeof mist}),Template.registerHelper("isEtherUnit",function(){var e=EthTools.getUnit();return!("usd"===e||"eur"===e||"btc"===e||"gbp"===e||"brl"===e)}),Template.registerHelper("isVulnerable",function(e){var t=_.isString(e)?Helpers.getAccountByAddress(e):this;if(t){if(_.find(t.vulnerabilities||[],function(e){return e}))return t;var r=_.map(Wallets.find({vulnerabilities:{$exists:!0}}).fetch(),function(e){return _.find(e.vulnerabilities||[],function(e){return e})?e:!1}),n=_.find(r,function(e){return _.contains(e.owners,t.address)});return n?(t.vulnerabilities=n.vulnerabilities,t):!1}}),Template.registerHelper("unit",function(){return EthTools.getUnit()}),Template.registerHelper("latestBlock",function(){return EthBlocks.latest}),Template.registerHelper("selectAccounts",function(e){var t=EthAccounts.find({balance:{$ne:"0"}},{sort:{balance:1}}).fetch();return e!==!0&&(t=_.union(Wallets.find({owners:{$in:_.pluck(EthAccounts.find().fetch(),"address")},address:{$exists:!0}},{sort:{name:1}}).fetch(),t)),t}),Template.registerHelper("isWatchOnly",Helpers.isWatchOnly),Template.registerHelper("walletIcon",function(){var e="";return e=_.isUndefined(this.owners)?'':Helpers.isWatchOnly(this._id)?'':'',new Spacebars.SafeString(e)}),Template.registerHelper("accountNameOrAddress",function(e){return(account=Helpers.getAccountByAddress(e))?account.name:e}),Template.registerHelper("formatNumberByDecimals",Helpers.formatNumberByDecimals),Template.registerHelper("formatTime",Helpers.formatTime),Template.registerHelper("formatTransactionBalance",Helpers.formatTransactionBalance),Template.registerHelper("toChecksumAddress",function(e){return _.isString(e)?web3.toChecksumAddress(e):""}),Template.registerHelper("toSentence",Helpers.toSentence)}).call(this); +(function(){Template.registerHelper("debug",function(e){console.log(e)}),Template.registerHelper("isMist",function(){return"undefined"==typeof window.mistMode}),Template.registerHelper("isWalletMode",function(){return"wallet"===window.mistMode||"undefined"==typeof mist}),Template.registerHelper("isEtherUnit",function(){var e=EthTools.getUnit();return!("usd"===e||"eur"===e||"btc"===e||"gbp"===e||"brl"===e)}),Template.registerHelper("isVulnerable",function(e){var t=_.isString(e)?Helpers.getAccountByAddress(e):this;if(t){if(_.find(t.vulnerabilities||[],function(e){return e}))return t;var r=_.map(Wallets.find({vulnerabilities:{$exists:!0}}).fetch(),function(e){return _.find(e.vulnerabilities||[],function(e){return e})?e:!1}),n=_.find(r,function(e){return _.contains(e.owners,t.address)});return n?(t.vulnerabilities=n.vulnerabilities,t):!1}}),Template.registerHelper("unit",function(){return EthTools.getUnit()}),Template.registerHelper("latestBlock",function(){return EthBlocks.latest}),Template.registerHelper("selectAccounts",function(e){var t=EthAccounts.find({balance:{$ne:"0"}},{sort:{balance:1}}).fetch();return e!==!0&&(t=_.union(Wallets.find({owners:{$in:_.pluck(EthAccounts.find().fetch(),"address")},address:{$exists:!0}},{sort:{name:1}}).fetch(),t)),t}),Template.registerHelper("isWatchOnly",Helpers.isWatchOnly),Template.registerHelper("walletIcon",function(){var e="";return e=_.isUndefined(this.owners)?'':Helpers.isWatchOnly(this._id)?'':'',new Spacebars.SafeString(e)}),Template.registerHelper("accountNameOrAddress",function(e){return(account=Helpers.getAccountByAddress(e))?account.name:e}),Template.registerHelper("formatNumberByDecimals",Helpers.formatNumberByDecimals),Template.registerHelper("formatTime",Helpers.formatTime),Template.registerHelper("formatTransactionBalance",Helpers.formatTransactionBalance),Template.registerHelper("toChecksumAddress",function(e){return _.isString(e)?web3.toChecksumAddress(e):""}),Template.registerHelper("toSentence",Helpers.toSentence)}).call(this); (function(){!function(){function e(e){var t=function(e,t){return s("",e,t)},o=i;e&&(i[e]||(i[e]={}),o=i[e]),o.define&&o.define.packaged||(n.original=o.define,o.define=n,o.define.packaged=!0),o.require&&o.require.packaged||(s.original=o.require,o.require=t,o.require.packaged=!0)}var t="ace",i=function(){return this}();if(t||"undefined"==typeof requirejs){var n=function(e,t,i){return"string"!=typeof e?void(n.original?n.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace())):(2==arguments.length&&(i=t),n.modules||(n.modules={},n.payloads={}),n.payloads[e]=i,n.modules[e]=null,void 0)},s=function(e,t,i){if("[object Array]"===Object.prototype.toString.call(t)){for(var n=[],o=0,a=t.length;a>o;++o){var l=r(e,t[o]);if(!l&&s.original)return s.original.apply(window,arguments);n.push(l)}i&&i.apply(null,n)}else{if("string"==typeof t){var h=r(e,t);return!h&&s.original?s.original.apply(window,arguments):(i&&i(),h)}if(s.original)return s.original.apply(window,arguments)}},o=function(e,t){if(-1!==t.indexOf("!")){var i=t.split("!");return o(e,i[0])+"!"+o(e,i[1])}if("."==t.charAt(0)){var n=e.split("/").slice(0,-1).join("/");for(t=n+"/"+t;-1!==t.indexOf(".")&&s!=t;){var s=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},r=function(e,t){t=o(e,t);var i=n.modules[t];if(!i){if(i=n.payloads[t],"function"==typeof i){var r={},a={id:t,uri:"",exports:r,packaged:!0},l=function(e,i){return s(t,e,i)},h=i(l,r,a);r=h||a.exports,n.modules[t]=r,delete n.payloads[t]}i=n.modules[t]=r||i}return i};e(t)}}(),ace.define("ace/lib/regexp",["require","exports","module"],function(e,t,i){"use strict";function n(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function s(e,t,i){if(Array.prototype.indexOf)return e.indexOf(t,i);for(var n=i||0;n1&&s(t,"")>-1&&(l=RegExp(this.source,o.replace.call(n(this),"g","")),o.replace.call(e.slice(t.index),l,function(){for(var e=1;et.index&&this.lastIndex--}return t},a||(RegExp.prototype.test=function(e){var t=o.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t}))}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(e,t,i){function n(){}function s(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function o(e){return e=+e,e!==e?e=0:0!==e&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function r(e){var t=typeof e;return null===e||"undefined"===t||"boolean"===t||"number"===t||"string"===t}function a(e){var t,i,n;if(r(e))return e;if(i=e.valueOf,"function"==typeof i&&(t=i.call(e),r(t)))return t;if(n=e.toString,"function"==typeof n&&(t=n.call(e),r(t)))return t;throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError("Function.prototype.bind called on incompatible "+t);var i=u.call(arguments,1),s=function(){if(this instanceof s){var n=t.apply(this,i.concat(u.call(arguments)));return Object(n)===n?n:this}return t.apply(e,i.concat(u.call(arguments)))};return t.prototype&&(n.prototype=t.prototype,s.prototype=new n,n.prototype=null),s});var l=Function.prototype.call,h=Array.prototype,c=Object.prototype,u=h.slice,d=l.bind(c.toString),g=l.bind(c.hasOwnProperty),f,m,p,A,C;if((C=g(c,"__defineGetter__"))&&(f=l.bind(c.__defineGetter__),m=l.bind(c.__defineSetter__),p=l.bind(c.__lookupGetter__),A=l.bind(c.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],i;return t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),i=t.length,t.splice(5,0,"XXX"),i+1==t.length,i+1==t.length?!0:void 0}()){var F=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?F.apply(this,[void 0===e?0:e,void 0===t?this.length-e:t].concat(u.call(arguments,2))):[]}}else Array.prototype.splice=function(e,t){var i=this.length;e>0?e>i&&(e=i):void 0==e?e=0:0>e&&(e=Math.max(i+e,0)),i>e+t||(t=i-e);var n=this.slice(e,e+t),s=u.call(arguments,2),o=s.length;if(e===i)o&&this.push.apply(this,s);else{var r=Math.min(t,i-e),a=e+r,l=a+o-r,h=i-a,c=i-r;if(a>l)for(var d=0;h>d;++d)this[l+d]=this[a+d];else if(l>a)for(d=h;d--;)this[l+d]=this[a+d];if(o&&e===c)this.length=c,this.push.apply(this,s);else for(this.length=c+o,d=0;o>d;++d)this[e+d]=s[d]}return n};Array.isArray||(Array.isArray=function(e){return"[object Array]"==d(e)});var v=Object("a"),w="a"!=v[0]||!(0 in v);if(Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=I(this),i=w&&"[object String]"==d(this)?this.split(""):t,n=arguments[1],s=-1,o=i.length>>>0;if("[object Function]"!=d(e))throw new TypeError;for(;++s>>0,s=Array(n),o=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var r=0;n>r;r++)r in i&&(s[r]=e.call(o,i[r],r,t));return s}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=I(this),i=w&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0,s=[],o,r=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var a=0;n>a;a++)a in i&&(o=i[a],e.call(r,o,a,t)&&s.push(o));return s}),Array.prototype.every||(Array.prototype.every=function(e){var t=I(this),i=w&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0,s=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var o=0;n>o;o++)if(o in i&&!e.call(s,i[o],o,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=I(this),i=w&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0,s=arguments[1];if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");for(var o=0;n>o;o++)if(o in i&&e.call(s,i[o],o,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=I(this),i=w&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else for(;;){if(s in i){o=i[s++];break}if(++s>=n)throw new TypeError("reduce of empty array with no initial value")}for(;n>s;s++)s in i&&(o=e.call(void 0,o,i[s],s,t));return o}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=I(this),i=w&&"[object String]"==d(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=d(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var s,o=n-1;if(arguments.length>=2)s=arguments[1];else for(;;){if(o in i){s=i[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}do o in this&&(s=e.call(void 0,s,i[o],o,t));while(o--);return s}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(e){var t=w&&"[object String]"==d(this)?this.split(""):I(this),i=t.length>>>0;if(!i)return-1;var n=0;for(arguments.length>1&&(n=o(arguments[1])),n=n>=0?n:Math.max(0,i+n);i>n;n++)if(n in t&&t[n]===e)return n;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(e){var t=w&&"[object String]"==d(this)?this.split(""):I(this),i=t.length>>>0;if(!i)return-1;var n=i-1;for(arguments.length>1&&(n=Math.min(n,o(arguments[1]))),n=n>=0?n:i-Math.abs(n);n>=0;n--)if(n in t&&e===t[n])return n;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:c)}),!Object.getOwnPropertyDescriptor){var E="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(e,t){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(E+e);if(g(e,t)){var i,n,s;if(i={enumerable:!0,configurable:!0},C){var o=e.__proto__;e.__proto__=c;var n=p(e,t),s=A(e,t);if(e.__proto__=o,n||s)return n&&(i.get=n),s&&(i.set=s),i}return i.value=e[t],i}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)}),!Object.create){var $;$=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var i;if(null===e)i=$();else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var n=function(){};n.prototype=e,i=new n,i.__proto__=e}return void 0!==t&&Object.defineProperties(i,t),i}}if(Object.defineProperty){var b=s({}),y="undefined"==typeof document||s(document.createElement("div"));if(!b||!y)var B=Object.defineProperty}if(!Object.defineProperty||B){var D="Property description must be an object: ",S="Object.defineProperty called on non-object: ",k="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(e,t,i){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(S+e);if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError(D+i);if(B)try{return B.call(Object,e,t,i)}catch(n){}if(g(i,"value"))if(C&&(p(e,t)||A(e,t))){var s=e.__proto__;e.__proto__=c,delete e[t],e[t]=i.value,e.__proto__=s}else e[t]=i.value;else{if(!C)throw new TypeError(k);g(i,"get")&&f(e,t,i.get),g(i,"set")&&m(e,t,i.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var i in t)g(t,i)&&Object.defineProperty(e,i,t[i]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(x){Object.freeze=function(e){return function(t){return"function"==typeof t?t:e(t)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;for(var t="";g(e,t);)t+="?";e[t]=!0;var i=g(e,t);return delete e[t],i}),!Object.keys){var L=!0,R=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],M=R.length;for(var T in{toString:null})L=!1;Object.keys=function P(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on a non-object");var P=[];for(var t in e)g(e,t)&&P.push(t);if(L)for(var i=0,n=M;n>i;i++){var s=R[i];g(e,s)&&P.push(s)}return P}}Date.now||(Date.now=function(){return(new Date).getTime()});var _=" \n \f\r   ᠎              \u2028\u2029\ufeff";if(!String.prototype.trim||_.trim()){_="["+_+"]";var O=new RegExp("^"+_+_+"*"),W=new RegExp(_+_+"*$");String.prototype.trim=function(){return String(this).replace(O,"").replace(W,"")}}var I=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)}}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e,t,i){"use strict";e("./regexp"),e("./es5-shim")}),ace.define("ace/lib/dom",["require","exports","module"],function(e,t,i){"use strict";var n="http://www.w3.org/1999/xhtml";t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||n,e):document.createElement(e)},t.hasCssClass=function(e,t){var i=(e.className||"").split(/\s+/g);return-1!==i.indexOf(t)},t.addCssClass=function(e,i){t.hasCssClass(e,i)||(e.className+=" "+i)},t.removeCssClass=function(e,t){for(var i=e.className.split(/\s+/g);;){var n=i.indexOf(t);if(-1==n)break;i.splice(n,1)}e.className=i.join(" ")},t.toggleCssClass=function(e,t){for(var i=e.className.split(/\s+/g),n=!0;;){var s=i.indexOf(t);if(-1==s)break;n=!1,i.splice(s,1)}return n&&i.push(t),e.className=i.join(" "),n},t.setCssClass=function(e,i,n){n?t.addCssClass(e,i):t.removeCssClass(e,i)},t.hasCssString=function(e,t){var i=0,n;if(t=t||document,t.createStyleSheet&&(n=t.styleSheets)){for(;i=0?(s.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]:(s.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=(window.Controllers||window.controllers)&&"Gecko"===window.navigator.product,t.isOldGecko=t.isGecko&&parseInt((s.match(/rv\:(\d+)/)||[])[1],10)<4,t.isOpera=window.opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(s.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(s.split(" Chrome/")[1])||void 0,t.isAIR=s.indexOf("AdobeAIR")>=0,t.isIPad=s.indexOf("iPad")>=0,t.isTouchPad=s.indexOf("TouchPad")>=0,t.isChromeOS=s.indexOf(" CrOS ")>=0}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,i){"use strict";function n(e,t,i){var n=r(t);if(!o.isMac&&a){if((a[91]||a[92])&&(n|=8),a.altGr){if(3==(3&n))return;a.altGr=0}if(18===i||17===i){var h="location"in t?t.location:t.keyLocation;if(17===i&&1===h)l=t.timeStamp;else if(18===i&&3===n&&2===h){var c=-l;l=t.timeStamp,c+=l,3>c&&(a.altGr=!0)}}}if(i in s.MODIFIER_KEYS){switch(s.MODIFIER_KEYS[i]){case"Alt":n=2;break;case"Shift":n=4;break;case"Ctrl":n=1;break;default:n=8}i=-1}if(8&n&&(91===i||93===i)&&(i=-1),!n&&13===i){var h="location"in t?t.location:t.keyLocation;if(3===h&&(e(t,n,-i),t.defaultPrevented))return}if(o.isChromeOS&&8&n){if(e(t,n,i),t.defaultPrevented)return;n&=-9}return n||i in s.FUNCTION_KEYS||i in s.PRINTABLE_KEYS?e(t,n,i):!1}var s=e("./keys"),o=e("./useragent");t.addListener=function(e,t,i){if(e.addEventListener)return e.addEventListener(t,i,!1);if(e.attachEvent){var n=function(){i.call(e,window.event)};i._wrapper=n,e.attachEvent("on"+t,n)}},t.removeListener=function(e,t,i){return e.removeEventListener?e.removeEventListener(t,i,!1):void(e.detachEvent&&e.detachEvent("on"+t,i._wrapper||i))},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||o.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,i,n){function s(e){i&&i(e),n&&n(e),t.removeListener(document,"mousemove",i,!0),t.removeListener(document,"mouseup",s,!0),t.removeListener(document,"dragstart",s,!0)}return t.addListener(document,"mousemove",i,!0),t.addListener(document,"mouseup",s,!0),t.addListener(document,"dragstart",s,!0),s},t.addMouseWheelListener=function(e,i){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;void 0!==e.wheelDeltaX?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),i(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=5*(e.deltaX||0),e.wheelY=5*(e.deltaY||0)}i(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=5*(e.detail||0),e.wheelY=0):(e.wheelX=0,e.wheelY=5*(e.detail||0)),i(e)})},t.addMultiMouseDownListener=function(e,i,n,s){var r=0,a,l,h,c={2:"dblclick",3:"tripleclick",4:"quadclick"};t.addListener(e,"mousedown",function(e){if(0!==t.getButton(e)?r=0:e.detail>1?(r++,r>4&&(r=1)):r=1,o.isIE){var u=Math.abs(e.clientX-a)>5||Math.abs(e.clientY-l)>5;(!h||u)&&(r=1),h&&clearTimeout(h),h=setTimeout(function(){h=null},i[r-1]||600),1==r&&(a=e.clientX,l=e.clientY)}if(e._clicks=r,n[s]("mousedown",e),r>4)r=0;else if(r>1)return n[s](c[r],e)}),o.isOldIE&&t.addListener(e,"dblclick",function(e){r=2,h&&clearTimeout(h),h=setTimeout(function(){h=null},i[r-1]||600),n[s]("mousedown",e),n[s](c[r],e)})};var r=!o.isMac||!o.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return s.KEY_MODS[r(e)]};var a=null,l=0;if(t.addCommandKeyListener=function(e,i){var s=t.addListener;if(o.isOldGecko||o.isOpera&&!("KeyboardEvent"in window)){var r=null;s(e,"keydown",function(e){r=e.keyCode}),s(e,"keypress",function(e){return n(i,e,r)})}else{var l=null;s(e,"keydown",function(e){a[e.keyCode]=!0;var t=n(i,e,e.keyCode);return l=e.defaultPrevented,t}),s(e,"keypress",function(e){l&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),l=null)}),s(e,"keyup",function(e){a[e.keyCode]=null}),a||(a=Object.create(null),s(window,"focus",function(e){a=Object.create(null)}))}},window.postMessage&&!o.isOldIE){var h=1;t.nextTick=function(e,i){i=i||window;var n="zero-timeout-message-"+h;t.addListener(i,"message",function s(o){o.data==n&&(t.stopPropagation(o),t.removeListener(i,"message",s),e())}),i.postMessage(n,"*")}}t.nextFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/lib/lang",["require","exports","module"],function(e,t,i){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var i="";t>0;)1&t&&(i+=e),(t>>=1)&&(e+=e);return i};var n=/^\s\s*/,s=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(n,"")},t.stringTrimRight=function(e){return e.replace(s,"")},t.copyObject=function(e){var t={};for(var i in e)t[i]=e[i];return t},t.copyArray=function(e){for(var t=[],i=0,n=e.length;n>i;i++)e[i]&&"object"==typeof e[i]?t[i]=this.copyObject(e[i]):t[i]=e[i];return t},t.deepCopy=function(e){if("object"!=typeof e||!e)return e;var i=e.constructor;if(i===RegExp)return e;var n=i();for(var s in e)"object"==typeof e[s]?n[s]=t.deepCopy(e[s]):n[s]=e[s];return n},t.arrayToMap=function(e){for(var t={},i=0;i - + Ethereum Wallet