-
Notifications
You must be signed in to change notification settings - Fork 1
/
67.b15f96724b52a6c0fbc7.js
1 lines (1 loc) · 12.3 KB
/
67.b15f96724b52a6c0fbc7.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[67],{"W/np":function(e,r,n){"use strict";function t(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function a(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach(function(r){o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function u(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var t,a,o=[],u=!0,i=!1;try{for(n=n.call(e);!(u=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);u=!0);}catch(c){i=!0,a=c}finally{try{u||null==n.return||n.return()}finally{if(i)throw a}}return o}}(e,r)||c(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,r){if(e){if("string"==typeof e)return s(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,r):void 0}}function s(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function l(e,r,n,t,a,o,u){try{var i=e[o](u),c=i.value}catch(s){return void n(s)}i.done?r(c):Promise.resolve(c).then(t,a)}function p(e){return function(){var r=this,n=arguments;return new Promise(function(t,a){var o=e.apply(r,n);function u(e){l(o,t,a,u,i,"next",e)}function i(e){l(o,t,a,u,i,"throw",e)}u(void 0)})}}function f(e){return d.apply(this,arguments)}function d(){return(d=p(regeneratorRuntime.mark(function e(r){var t,o,c,s,l,f,d,h,m,w,g,y,b,v,x,k,P,R,S,O,A,E,L,j,T,C,z,I,M,N,B,U,D,V,W,Z,K,H,J,_,F,G,Q,$,q,X,Y,ee,re;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return re=function(){return(re=p(regeneratorRuntime.mark(function e(r){var n,t,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==E.size){e.next=3;break}return e.next=3,B();case 3:return n=u(i(E.entries())[0],2),t=n[0],a=n[1],e.abrupt("return",new Promise(function(e,n){m.ethereumSignMessage({path:a,message:s.stripHexPrefix(r.data),hex:!0}).then(function(r){if(r.success){r.payload.address!==s.toChecksumAddress(t)&&n(new Error("signature doesnt match the right address"));var a="0x".concat(r.payload.signature);e(a)}else n(new Error(r.payload&&r.payload.error||"There was an error signing a message"))})}));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)},ee=function(e){return re.apply(this,arguments)},Y=function(){return(Y=p(regeneratorRuntime.mark(function e(r){var n,t,u,l,p,f,d,h,m,w;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==E.size){e.next=3;break}return e.next=3,B();case 3:return t=i(E.values())[0],u=s.BN,l=s.toBuffer,p=new c({chain:S||R(b)}),(f=o.fromTxData(a(a({},r),{},{gasLimit:null!==(n=r.gas)&&void 0!==n?n:r.gasLimit}),{common:p,freeze:!1})).v=new u(l(b)),f.r=f.s=new u(l(0)),e.next=11,q(t,r);case 11:if((d=e.sent).success){e.next=14;break}throw new Error(d.payload.error);case 14:return h=d.payload.v.toString(16),(m=parseInt(h,16))!==(w=2*b+35)&&(m&w)!==m&&(w+=1),h=w.toString(16),f.v=new u(l("0x".concat(h))),f.r=new u(l("".concat(d.payload.r))),f.s=new u(l("".concat(d.payload.s))),e.abrupt("return","0x".concat(f.serialize().toString("hex")));case 23:case"end":return e.stop()}},e)}))).apply(this,arguments)},X=function(e){return Y.apply(this,arguments)},q=function(e,r){return m.ethereumSignTransaction({path:e,transaction:{nonce:r.nonce,gasPrice:r.gasPrice,gasLimit:r.gas,to:r.to,value:r.value||"",data:r.data||"",chainId:b}})},$=function(e){return new Promise(function(r,n){C.sendAsync({jsonrpc:"2.0",method:"eth_getBalance",params:[e,"latest"],id:42},function(e,t){e&&n(e);var a=t&&t.result;r(null!=a?new P(a).toString(10):null)})})},Q=function(e){return Promise.all(e.map(function(e){return new Promise(function(){var r=p(regeneratorRuntime.mark(function r(n){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,$(e);case 2:n({address:e,balance:r.sent});case 4:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}())}))},G=function(){return(G=p(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(L){e.next=2;break}return e.abrupt("return",[void 0]);case 2:if(!(E.size>0)||r){e.next=4;break}return e.abrupt("return",V());case 4:if(""===A&&(A=y),T){e.next=15;break}return e.prev=6,e.next=9,Z();case 9:T=e.sent,e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(6),e.t0;case 15:return d(T,E.size).forEach(function(e){E.set(e.address,e.dPath)}),e.abrupt("return",V());case 18:case"end":return e.stop()}},e,null,[[6,12]])}))).apply(this,arguments)},F=function(e){return G.apply(this,arguments)},_=function(){return(_=p(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F(!0);case 2:return e.abrupt("return",Q(e.sent));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)},J=function(){return _.apply(this,arguments)},H=function(){return L?V()[0]:void 0},K=function(){return(K=p(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(A){e.next=2;break}throw new Error("a derivation path is needed to get the public key");case 2:return e.prev=2,e.next=5,m.getPublicKey({path:A,coin:"eth"});case 5:if((r=e.sent).success){e.next=8;break}throw new Error(r.payload.error);case 8:return e.abrupt("return",T={publicKey:r.payload.publicKey,chainCode:r.payload.chainCode,path:r.payload.serializedPath});case 12:throw e.prev=12,e.t0=e.catch(2),new Error("There was an error accessing your Trezor accounts.");case 15:case"end":return e.stop()}},e,null,[[2,12]])}))).apply(this,arguments)},Z=function(){return K.apply(this,arguments)},W=function(e){var r=i(E.entries()),n=r.findIndex(function(r){return u(r,1)[0]===e});r.unshift(r.splice(n,1)[0]),E=new Map(r)},V=function(){return Array.from(E.keys())},D=function(){return(D=p(regeneratorRuntime.mark(function e(r){var n,t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="Unable to derive address from path ".concat(r),e.prev=1,e.next=4,m.ethereumGetAddress({path:r,showOnTrezor:!1});case 4:if((t=e.sent).success){e.next=7;break}throw new Error(n);case 7:return e.abrupt("return",t.payload.address);case 10:throw e.prev=10,e.t0=e.catch(1),new Error(n);case 13:case"end":return e.stop()}},e,null,[[1,10]])}))).apply(this,arguments)},U=function(e){return D.apply(this,arguments)},B=function(){return L=!0,F()},N=function(){return j},M=function(){return(M=p(regeneratorRuntime.mark(function e(r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(h(r)){e.next=2;break}return e.abrupt("return",!1);case 2:if(r!==A&&(E=new Map),!n){e.next=17;break}return e.prev=4,e.next=7,U(r);case 7:return E.set(e.sent,r),A=r,j=!0,e.abrupt("return",!0);case 14:throw e.prev=14,e.t0=e.catch(4),new Error("There was a problem deriving an address from path ".concat(r));case 17:return j=!1,A=r,e.abrupt("return",!0);case 20:case"end":return e.stop()}},e,null,[[4,14]])}))).apply(this,arguments)},I=function(e,r){return M.apply(this,arguments)},z=function(){A="",E=new Map,L=!1,C.stop()},e.next=25,n.e(21).then(n.t.bind(null,"hga2",7));case 25:return t=e.sent,e.next=28,Promise.resolve().then(n.t.bind(null,"ztCV",7));case 28:return o=e.sent.Transaction,e.next=32,Promise.resolve().then(n.t.bind(null,"Z6rx",7));case 32:return c=e.sent.default,e.next=36,Promise.resolve().then(n.t.bind(null,"tnHP",7));case 36:return s=e.sent,e.next=39,Promise.all([n.e(1),n.e(2),n.e(3),n.e(4),n.e(5)]).then(n.bind(null,"468V"));case 39:return l=e.sent.default,e.next=43,n.e(8).then(n.bind(null,"QFga"));case 43:return d=(f=e.sent).generateAddresses,h=f.isValidPath,m=t.default,w=t.DEVICE_EVENT,g=t.DEVICE,y="m/44'/60'/0'/0",b=r.networkId,v=r.email,x=r.appUrl,k=r.rpcUrl,P=r.BigNumber,R=r.networkName,S=r.customNetwork,O=r.resetWalletState,A="",E=new Map,L=!1,j=!1,m.manifest({email:v,appUrl:x}),C=l({getAccounts:function(e){F().then(function(r){return e(null,r)}).catch(function(r){return e(r,null)})},signTransaction:function(e,r){X(e).then(function(e){return r(null,e)}).catch(function(e){return r(e,null)})},processMessage:function(e,r){ee(e).then(function(e){return r(null,e)}).catch(function(e){return r(e,null)})},processPersonalMessage:function(e,r){ee(e).then(function(e){return r(null,e)}).catch(function(e){return r(e,null)})},signMessage:function(e,r){ee(e).then(function(e){return r(null,e)}).catch(function(e){return r(e,null)})},signPersonalMessage:function(e,r){ee(e).then(function(e){return r(null,e)}).catch(function(e){return r(e,null)})},rpcUrl:k}),m.on(w,function(e){e.type===g.DISCONNECT&&(C.stop(),O({disconnected:!0,walletName:"Trezor"}))}),C.setPath=I,C.dPath=A,C.enable=B,C.setPrimaryAccount=W,C.getPrimaryAddress=H,C.getAccounts=F,C.getMoreAccounts=J,C.getBalance=$,C.getBalances=Q,C.send=C.sendAsync,C.disconnect=z,C.isCustomPath=N,e.abrupt("return",C);case 69:case"end":return e.stop()}},e)}))).apply(this,arguments)}n.r(r),r.default=function(e){var r,n=e.rpcUrl,t=e.networkId,a=e.email,o=e.appUrl,u=e.preferred,i=e.customNetwork;return{name:e.label||"Trezor",svg:e.svg||'\n\t<svg width="40px" height="40px" viewBox="0 0 114 166" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n\t\t<g id="Styles" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n\t\t\t<path d="M17,51.453125 L17,40 C17,17.90861 34.90861,-1.0658141e-14 57,-1.0658141e-14 C79.09139,-1.0658141e-14 97,17.90861 97,40 L97,51.453125 L113.736328,51.453125 L113.736328,139.193359 L57.5,166 L0,139.193359 L0,51.453125 L17,51.453125 Z M37,51.453125 L77,51.453125 L77,40 L76.9678398,40 C76.3750564,29.406335 67.6617997,21 57,21 C46.3382003,21 37.6249436,29.406335 37.0321602,40 L37,40 L37,51.453125 Z M23,72 L23,125 L56.8681641,140.966797 L91,125 L91,72 L23,72 Z" id="Trezor-logo" fill="currentColor"></path>\n\t\t</g>\n\t</svg>\n',iconSrc:e.iconSrc,wallet:(r=p(regeneratorRuntime.mark(function e(r){var u,c,s,l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u=r.BigNumber,c=r.networkName,s=r.resetWalletState,e.next=3,f({rpcUrl:n,networkId:t,email:a,appUrl:o,BigNumber:u,networkName:c,customNetwork:i,resetWalletState:s});case 3:return e.abrupt("return",{provider:l=e.sent,interface:{name:"Trezor",connect:l.enable,disconnect:l.disconnect,address:{get:function(){var e=p(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",l.getPrimaryAddress());case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},network:{get:function(){var e=p(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t);case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},balance:{get:function(){var e=p(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getPrimaryAddress(),e.abrupt("return",r&&l.getBalance(r));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()}}});case 5:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)}),type:"hardware",desktop:!0,mobile:!0,osExclusions:["iOS"],preferred:u}}}}]);