Socket
Socket
Sign inDemoInstall

@shapeshiftoss/hdwallet-core

Package Overview
Dependencies
Maintainers
3
Versions
254
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shapeshiftoss/hdwallet-core - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

dist/index.js

@@ -1,2 +0,2 @@

var t,e=require("rxjs"),r=require("rxjs/operators"),o=require("eventemitter2");(t=exports.Events||(exports.Events={})).BUTTON_REQUEST="BUTTON_REQUEST",t.CANCEL="CANCEL",t.CHARACTER_REQUEST="CHARACTER_REQUEST",t.CONNECT="CONNECT",t.DISCONNECT="DISCONNECT",t.FAILURE="FAILURE",t.PASSPHRASE_REQUEST="PASSPHRASE_REQUEST",t.PIN_REQUEST="PIN_REQUEST",t.SUCCESS="SUCCESS",t.WORD_REQUEST="WORD_REQUEST";var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t){return"m/"==t||/^m(((\/[0-9]+h)+|(\/[0-9]+H)+|(\/[0-9]+')*)((\/[0-9]+)*))$/.test(t)}function s(t){return t.replace("0x","")}var p,c,a,u=function(t){function e(e){t.call(this),this.keyring=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.connect=function(){},e.prototype.listen=function(){},e.prototype.disconnect=function(){},e}(o.EventEmitter2);(p=exports.BTCInputScriptType||(exports.BTCInputScriptType={}))[p.CashAddr=0]="CashAddr",p[p.SpendAddress=1]="SpendAddress",p[p.SpendMultisig=2]="SpendMultisig",p[p.External=3]="External",p[p.SpendWitness=4]="SpendWitness",p[p.SpendP2SHWitness=5]="SpendP2SHWitness",(c=exports.BTCOutputScriptType||(exports.BTCOutputScriptType={}))[c.PayToAddress=0]="PayToAddress",c[c.PayToMultisig=1]="PayToMultisig",c[c.PayToWitness=2]="PayToWitness",c[c.PayToP2SHWitness=3]="PayToP2SHWitness",(a=exports.BTCOutputAddressType||(exports.BTCOutputAddressType={}))[a.Spend=0]="Spend",a[a.Transfer=1]="Transfer",a[a.Change=2]="Change",a[a.Exchange=3]="Exchange";var l=function(){function t(){}return t.prototype.then=function(e,r){var o=new t,n=this.s;if(n){var i=1&n?e:r;if(i){try{f(o,1,i(this.v))}catch(t){f(o,2,t)}return o}return this}return this.o=function(t){try{var n=t.v;1&t.s?f(o,1,e?e(n):n):r?f(o,1,r(n)):f(o,2,n)}catch(t){f(o,2,t)}},o},t}();function f(t,e,r){if(!t.s){if(r instanceof l){if(!r.s)return void(r.o=f.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(f.bind(null,t,e),f.bind(null,t,2));t.s=e,t.v=r;var o=t.o;o&&o(t)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var d,h=function(t){function e(){t.call(this,{wildcard:!0}),this.wallets={},this.aliases={}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={initializedCount:{configurable:!0}};return r.initializedCount.get=function(){return Object.keys(this.wallets).length},e.prototype.add=function(t,e){var r=e||(new Date).toString();return!this.wallets[r]&&(this.wallets[r]=t,this.decorateEvents(e,t.transport),!0)},e.prototype.addAlias=function(t,e){this.aliases[e]=t},e.prototype.getAlias=function(t){var e=Object.keys(this.aliases),r=Object.values(this.aliases).indexOf(t);return-1!==r?e[r]:t},e.prototype.exec=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];try{var o=this;return Promise.all(Object.values(o.wallets).map(function(r){return r[t].apply(r,e)})).then(function(t){return t.reduce(function(t,e,r){return t[Object.keys(o.wallets)[r]]=e,t},{})})}catch(t){return Promise.reject(t)}},e.prototype.get=function(t){return this.aliases[t]&&this.wallets[this.aliases[t]]?this.wallets[this.aliases[t]]:this.wallets[t]?this.wallets[t]:this.initializedCount&&!t?Object.values(this.wallets)[0]:null},e.prototype.remove=function(t){try{var e=this;if(!e.get(t))return;var r=function(r,o){try{var n=function(r,o){try{var n=(i=e.get(t),Promise.resolve(i.transport.disconnect()).then(function(){}))}catch(t){return o(t)}var i;return n&&n.then?n.then(void 0,o):n}(0,function(t){console.error(t)})}catch(t){return o(!0,t)}return n&&n.then?n.then(o.bind(null,!1),o.bind(null,!0)):o(!1,value)}(0,function(r,o){var n=e.aliases[t];if(n?(delete e.aliases[t],delete e.wallets[n]):delete e.wallets[t],r)throw o;return o});return r&&r.then?r.then(function(){}):void 0}catch(t){return Promise.reject(t)}},e.prototype.removeAll=function(){try{var t=this;return Promise.resolve(Promise.all(Object.keys(t.wallets).map(t.remove.bind(t)))).then(function(){t.aliases={}})}catch(t){return Promise.reject(t)}},e.prototype.disconnectAll=function(){try{var t=Object.values(this.wallets),e=(r=t,o=function(e){return Promise.resolve(t[e].transport.disconnect()).then(function(){})},s=-1,function t(e){try{for(;++s<r.length;)if((e=o(s))&&e.then){if(!((p=e)instanceof l&&1&p.s))return void e.then(t,i||(i=f.bind(null,n=new l,2)));e=e.v}n?f(n,1,e):n=e}catch(t){f(n||(n=new l),2,t)}var p}(),n);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,o,n,i,s},e.prototype.decorateEvents=function(t,e){try{var r=this,o=r.get(t).getVendor();e.onAny(function(e){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];return r.emit([o,t,e],[t].concat(n))})}catch(t){return Promise.reject(t)}},Object.defineProperties(e.prototype,r),e}(o.EventEmitter2);(d=exports.HDWalletErrorType||(exports.HDWalletErrorType={})).ActionCancelled="ActionCancelled",d.DeviceDisconnected="DeviceDisconnected",d.PopupClosedError="PopupClosedError",d.ConflictingApp="ConflictingApp",d.SelectApp="SelectApp",d.WrongApp="WrongApp",d.FirmwareUpdateRequired="FirmwareUpdateRequired",d.WebUSBNotAvailable="WebUSBNotAvailable",d.WebUSBCouldNotPair="WebUSBCouldNotPair";var y=function(t){function e(e,r){t.call(this,e),t.captureStackTrace(this,this.constructor),this.name=r,this.type=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),v=function(t){function e(){t.call(this,"Action cancelled",exports.HDWalletErrorType.ActionCancelled)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),E=function(t){function e(){t.call(this,"Device disconnected",exports.HDWalletErrorType.DeviceDisconnected)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),x=function(t){function e(){t.call(this,"TrezorConnect popup closed",exports.HDWalletErrorType.PopupClosedError)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),S=function(t){function e(e){t.call(this,"Conflicting Application: Another wallet is trying to connect with your "+e+".",exports.HDWalletErrorType.ConflictingApp),this.model=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),T=function(t){function e(e,r){t.call(this,"Please open the "+r+" app on your "+e+".",exports.HDWalletErrorType.SelectApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),b=function(t){function e(e,r){t.call(this,"Wrong app selected. Please open the "+r+" app on your "+e+".",exports.HDWalletErrorType.WrongApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),_=function(t){function e(e,r){t.call(this,"Firmware "+r+" or later is required to use your "+e+" with this client. Please update your device.",exports.HDWalletErrorType.FirmwareUpdateRequired)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),C=function(t){function e(){t.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",exports.HDWalletErrorType.WebUSBNotAvailable)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),g=function(t){function e(e,r){t.call(this,"Could not pair "+e+": "+r,exports.HDWalletErrorType.WebUSBCouldNotPair)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y);exports.makeEvent=function(t){return Object.assign({},{date:Date.now()},t)},exports.DEFAULT_TIMEOUT=5e3,exports.LONG_TIMEOUT=3e5,exports.isArray=n,exports.fromHexString=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))},exports.toHexString=function(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")},exports.arrayify=function(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],o=0;o<t.length;o+=2)r.push(parseInt(t.substr(o,2),16));return new Uint8Array(r)}},exports.bip32ToAddressNList=function(t){if(!i(t))throw new Error("Not a bip32 path: '"+t+"'");/^m\//i.test(t)&&(t=t.slice(2));var e=t.split("/");if(1===e.length&&""===e[0])return[];for(var r=new Array(e.length),o=0;o<e.length;o++){var n=/(\d+)([hH\']?)/.exec(e[o]);if(null===n)throw new Error("Invalid input");if(r[o]=parseInt(n[1],10),r[o]>=2147483648)throw new Error("Invalid child index");if("h"===n[2]||"H"===n[2]||"'"===n[2])r[o]+=2147483648;else if(0!==n[2].length)throw new Error("Invalid modifier")}return r},exports.addressNListToBIP32=function(t){return"m/"+t.map(function(t){return t>=2147483648?t-2147483648+"'":t}).join("/")},exports.bip32Like=i,exports.takeFirstOfManyEvents=function(t,o){return e.merge.apply(void 0,o.map(function(r){return e.fromEvent(t,r)})).pipe(r.first())},exports.stripHexPrefix=s,exports.stripHexPrefixAndLower=function(t){return s(t).toLowerCase()},exports.base64toHEX=function(t){for(var e=atob(t),r="",o=0;o<e.length;o++){var n=e.charCodeAt(o).toString(16);r+=2==n.length?n:"0"+n}return"0x"+r.toUpperCase()},exports.slip44ByCoin=function(t){return{Bitcoin:0,Testnet:1,BitcoinCash:145,BitcoinGold:156,Litecoin:2,Dash:5,DigiByte:20,Dogecoin:3,BitcoinSV:236,Ethereum:60}[t]},exports.satsFromStr=function(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)},exports.Transport=u,exports.supportsBTC=function(t){return void 0!==t._supportsBTC},exports.infoBTC=function(t){return void 0!==t._supportsBTCInfo},exports.supportsETH=function(t){return void 0!==t._supportsETH},exports.infoETH=function(t){return void 0!==t._supportsETHInfo},exports.supportsDebugLink=function(t){return void 0!==t._supportsDebugLink},exports.Keyring=h,exports.HDWalletError=y,exports.ActionCancelled=v,exports.DeviceDisconnected=E,exports.PopupClosedError=x,exports.ConflictingApp=S,exports.SelectApp=T,exports.WrongApp=b,exports.FirmwareUpdateRequired=_,exports.WebUSBNotAvailable=C,exports.WebUSBCouldNotPair=g;
var t,e=require("rxjs"),r=require("rxjs/operators"),o=require("eventemitter2");(t=exports.Events||(exports.Events={})).BUTTON_REQUEST="BUTTON_REQUEST",t.CANCEL="CANCEL",t.CHARACTER_REQUEST="CHARACTER_REQUEST",t.CONNECT="CONNECT",t.DISCONNECT="DISCONNECT",t.FAILURE="FAILURE",t.PASSPHRASE_REQUEST="PASSPHRASE_REQUEST",t.PIN_REQUEST="PIN_REQUEST",t.SUCCESS="SUCCESS",t.WORD_REQUEST="WORD_REQUEST";var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t){return"m/"==t||/^m(((\/[0-9]+h)+|(\/[0-9]+H)+|(\/[0-9]+')*)((\/[0-9]+)*))$/.test(t)}function s(t){return t.replace("0x","")}var p,c,a,u=function(t){function e(e){t.call(this),this.keyring=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.connect=function(){},e.prototype.listen=function(){},e.prototype.disconnect=function(){},e}(o.EventEmitter2);(p=exports.BTCInputScriptType||(exports.BTCInputScriptType={}))[p.CashAddr=0]="CashAddr",p[p.SpendAddress=1]="SpendAddress",p[p.SpendMultisig=2]="SpendMultisig",p[p.External=3]="External",p[p.SpendWitness=4]="SpendWitness",p[p.SpendP2SHWitness=5]="SpendP2SHWitness",(c=exports.BTCOutputScriptType||(exports.BTCOutputScriptType={}))[c.PayToAddress=0]="PayToAddress",c[c.PayToMultisig=1]="PayToMultisig",c[c.PayToWitness=2]="PayToWitness",c[c.PayToP2SHWitness=3]="PayToP2SHWitness",(a=exports.BTCOutputAddressType||(exports.BTCOutputAddressType={}))[a.Spend=0]="Spend",a[a.Transfer=1]="Transfer",a[a.Change=2]="Change",a[a.Exchange=3]="Exchange";var l=function(){function t(){}return t.prototype.then=function(e,r){var o=new t,n=this.s;if(n){var i=1&n?e:r;if(i){try{f(o,1,i(this.v))}catch(t){f(o,2,t)}return o}return this}return this.o=function(t){try{var n=t.v;1&t.s?f(o,1,e?e(n):n):r?f(o,1,r(n)):f(o,2,n)}catch(t){f(o,2,t)}},o},t}();function f(t,e,r){if(!t.s){if(r instanceof l){if(!r.s)return void(r.o=f.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(f.bind(null,t,e),f.bind(null,t,2));t.s=e,t.v=r;var o=t.o;o&&o(t)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var y,h=function(t){function e(){t.call(this,{wildcard:!0}),this.wallets={},this.aliases={}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={initializedCount:{configurable:!0}};return r.initializedCount.get=function(){return Object.keys(this.wallets).length},e.prototype.add=function(t,e){var r=e||(new Date).toString();return!this.wallets[r]&&(this.wallets[r]=t,this.decorateEvents(e,t.transport),!0)},e.prototype.addAlias=function(t,e){this.aliases[e]=t},e.prototype.getAlias=function(t){var e=Object.keys(this.aliases),r=Object.values(this.aliases).indexOf(t);return-1!==r?e[r]:t},e.prototype.exec=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];try{var o=this;return Promise.all(Object.values(o.wallets).map(function(r){return r[t].apply(r,e)})).then(function(t){return t.reduce(function(t,e,r){return t[Object.keys(o.wallets)[r]]=e,t},{})})}catch(t){return Promise.reject(t)}},e.prototype.get=function(t){return this.aliases[t]&&this.wallets[this.aliases[t]]?this.wallets[this.aliases[t]]:this.wallets[t]?this.wallets[t]:this.initializedCount&&!t?Object.values(this.wallets)[0]:null},e.prototype.remove=function(t){try{var e=this;if(!e.get(t))return;var r=function(r,o){try{var n=function(r,o){try{var n=(i=e.get(t),Promise.resolve(i.transport.disconnect()).then(function(){}))}catch(t){return o(t)}var i;return n&&n.then?n.then(void 0,o):n}(0,function(t){console.error(t)})}catch(t){return o(!0,t)}return n&&n.then?n.then(o.bind(null,!1),o.bind(null,!0)):o(!1,value)}(0,function(r,o){var n=e.aliases[t];if(n?(delete e.aliases[t],delete e.wallets[n]):delete e.wallets[t],r)throw o;return o});return r&&r.then?r.then(function(){}):void 0}catch(t){return Promise.reject(t)}},e.prototype.removeAll=function(){try{var t=this;return Promise.resolve(Promise.all(Object.keys(t.wallets).map(t.remove.bind(t)))).then(function(){t.aliases={}})}catch(t){return Promise.reject(t)}},e.prototype.disconnectAll=function(){try{var t=Object.values(this.wallets),e=(r=t,o=function(e){return Promise.resolve(t[e].transport.disconnect()).then(function(){})},s=-1,function t(e){try{for(;++s<r.length;)if((e=o(s))&&e.then){if(!((p=e)instanceof l&&1&p.s))return void e.then(t,i||(i=f.bind(null,n=new l,2)));e=e.v}n?f(n,1,e):n=e}catch(t){f(n||(n=new l),2,t)}var p}(),n);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,o,n,i,s},e.prototype.decorateEvents=function(t,e){try{var r=this,o=r.get(t).getVendor();e.onAny(function(e){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];return r.emit([o,t,e],[t].concat(n))})}catch(t){return Promise.reject(t)}},Object.defineProperties(e.prototype,r),e}(o.EventEmitter2);(y=exports.HDWalletErrorType||(exports.HDWalletErrorType={})).ActionCancelled="ActionCancelled",y.DeviceDisconnected="DeviceDisconnected",y.PopupClosedError="PopupClosedError",y.ConflictingApp="ConflictingApp",y.SelectApp="SelectApp",y.WrongApp="WrongApp",y.FirmwareUpdateRequired="FirmwareUpdateRequired",y.WebUSBNotAvailable="WebUSBNotAvailable",y.WebUSBCouldNotPair="WebUSBCouldNotPair";var d=function(t){function e(e,r){t.call(this,e),this.name=r,this.type=r,"function"==typeof t.captureStackTrace?t.captureStackTrace(this,this.constructor):this.stack=new t(e).stack}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),v=function(t){function e(){t.call(this,"Action cancelled",exports.HDWalletErrorType.ActionCancelled)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),E=function(t){function e(){t.call(this,"Device disconnected",exports.HDWalletErrorType.DeviceDisconnected)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),x=function(t){function e(){t.call(this,"TrezorConnect popup closed",exports.HDWalletErrorType.PopupClosedError)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),S=function(t){function e(e){t.call(this,"Conflicting Application: Another wallet is trying to connect with your "+e+".",exports.HDWalletErrorType.ConflictingApp),this.model=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),T=function(t){function e(e,r){t.call(this,"Please open the "+r+" app on your "+e+".",exports.HDWalletErrorType.SelectApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),b=function(t){function e(e,r){t.call(this,"Wrong app selected. Please open the "+r+" app on your "+e+".",exports.HDWalletErrorType.WrongApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),_=function(t){function e(e,r){t.call(this,"Firmware "+r+" or later is required to use your "+e+" with this client. Please update your device.",exports.HDWalletErrorType.FirmwareUpdateRequired)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),C=function(t){function e(){t.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",exports.HDWalletErrorType.WebUSBNotAvailable)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d),g=function(t){function e(e,r){t.call(this,"Could not pair "+e+": "+r,exports.HDWalletErrorType.WebUSBCouldNotPair)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(d);exports.makeEvent=function(t){return Object.assign({},{date:Date.now()},t)},exports.DEFAULT_TIMEOUT=5e3,exports.LONG_TIMEOUT=3e5,exports.isArray=n,exports.fromHexString=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))},exports.toHexString=function(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")},exports.arrayify=function(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],o=0;o<t.length;o+=2)r.push(parseInt(t.substr(o,2),16));return new Uint8Array(r)}},exports.bip32ToAddressNList=function(t){if(!i(t))throw new Error("Not a bip32 path: '"+t+"'");/^m\//i.test(t)&&(t=t.slice(2));var e=t.split("/");if(1===e.length&&""===e[0])return[];for(var r=new Array(e.length),o=0;o<e.length;o++){var n=/(\d+)([hH\']?)/.exec(e[o]);if(null===n)throw new Error("Invalid input");if(r[o]=parseInt(n[1],10),r[o]>=2147483648)throw new Error("Invalid child index");if("h"===n[2]||"H"===n[2]||"'"===n[2])r[o]+=2147483648;else if(0!==n[2].length)throw new Error("Invalid modifier")}return r},exports.addressNListToBIP32=function(t){return"m/"+t.map(function(t){return t>=2147483648?t-2147483648+"'":t}).join("/")},exports.bip32Like=i,exports.takeFirstOfManyEvents=function(t,o){return e.merge.apply(void 0,o.map(function(r){return e.fromEvent(t,r)})).pipe(r.first())},exports.stripHexPrefix=s,exports.stripHexPrefixAndLower=function(t){return s(t).toLowerCase()},exports.base64toHEX=function(t){for(var e=atob(t),r="",o=0;o<e.length;o++){var n=e.charCodeAt(o).toString(16);r+=2==n.length?n:"0"+n}return"0x"+r.toUpperCase()},exports.slip44ByCoin=function(t){return{Bitcoin:0,Testnet:1,BitcoinCash:145,BitcoinGold:156,Litecoin:2,Dash:5,DigiByte:20,Dogecoin:3,BitcoinSV:236,Ethereum:60}[t]},exports.satsFromStr=function(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)},exports.Transport=u,exports.supportsBTC=function(t){return"object"==typeof t&&!0===t._supportsBTC},exports.infoBTC=function(t){return"object"==typeof t&&!0===t._supportsBTCInfo},exports.supportsETH=function(t){return"object"==typeof t&&!0===t._supportsETH},exports.infoETH=function(t){return"object"==typeof t&&!0===t._supportsETHInfo},exports.supportsDebugLink=function(t){return"object"==typeof t&&!0===t._supportsDebugLink},exports.Keyring=h,exports.HDWalletError=d,exports.ActionCancelled=v,exports.DeviceDisconnected=E,exports.PopupClosedError=x,exports.ConflictingApp=S,exports.SelectApp=T,exports.WrongApp=b,exports.FirmwareUpdateRequired=_,exports.WebUSBNotAvailable=C,exports.WebUSBCouldNotPair=g;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{fromEvent as t,merge as e}from"rxjs";import{first as r}from"rxjs/operators";import{EventEmitter2 as n}from"eventemitter2";var o;function i(t){return Object.assign({},{date:Date.now()},t)}!function(t){t.BUTTON_REQUEST="BUTTON_REQUEST",t.CANCEL="CANCEL",t.CHARACTER_REQUEST="CHARACTER_REQUEST",t.CONNECT="CONNECT",t.DISCONNECT="DISCONNECT",t.FAILURE="FAILURE",t.PASSPHRASE_REQUEST="PASSPHRASE_REQUEST",t.PIN_REQUEST="PIN_REQUEST",t.SUCCESS="SUCCESS",t.WORD_REQUEST="WORD_REQUEST"}(o||(o={}));var c=5e3,a=3e5,s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},u=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))};function l(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function p(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return new Uint8Array(r)}}var f=2147483648;function h(t){if(!y(t))throw new Error("Not a bip32 path: '"+t+"'");/^m\//i.test(t)&&(t=t.slice(2));var e=t.split("/");if(1===e.length&&""===e[0])return[];for(var r=new Array(e.length),n=0;n<e.length;n++){var o=/(\d+)([hH\']?)/.exec(e[n]);if(null===o)throw new Error("Invalid input");if(r[n]=parseInt(o[1],10),r[n]>=f)throw new Error("Invalid child index");if("h"===o[2]||"H"===o[2]||"'"===o[2])r[n]+=f;else if(0!==o[2].length)throw new Error("Invalid modifier")}return r}function d(t){return"m/"+t.map(function(t){return t>=f?t-f+"'":t}).join("/")}function y(t){return"m/"==t||/^m(((\/[0-9]+h)+|(\/[0-9]+H)+|(\/[0-9]+')*)((\/[0-9]+)*))$/.test(t)}function v(n,o){return e.apply(void 0,o.map(function(e){return t(n,e)})).pipe(r())}function S(t){return t.replace("0x","")}function _(t){return S(t).toLowerCase()}function b(t){for(var e=atob(t),r="",n=0;n<e.length;n++){var o=e.charCodeAt(n).toString(16);r+=2==o.length?o:"0"+o}return"0x"+r.toUpperCase()}function m(t){return{Bitcoin:0,Testnet:1,BitcoinCash:145,BitcoinGold:156,Litecoin:2,Dash:5,DigiByte:20,Dogecoin:3,BitcoinSV:236,Ethereum:60}[t]}function g(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)}var E,A,w,C=function(t){function e(e){t.call(this),this.keyring=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.connect=function(){},e.prototype.listen=function(){},e.prototype.disconnect=function(){},e}(n);function P(t){return void 0!==t._supportsBTC}function T(t){return void 0!==t._supportsBTCInfo}function j(t){return void 0!==t._supportsETH}function O(t){return void 0!==t._supportsETHInfo}function U(t){return void 0!==t._supportsDebugLink}!function(t){t[t.CashAddr=0]="CashAddr",t[t.SpendAddress=1]="SpendAddress",t[t.SpendMultisig=2]="SpendMultisig",t[t.External=3]="External",t[t.SpendWitness=4]="SpendWitness",t[t.SpendP2SHWitness=5]="SpendP2SHWitness"}(E||(E={})),function(t){t[t.PayToAddress=0]="PayToAddress",t[t.PayToMultisig=1]="PayToMultisig",t[t.PayToWitness=2]="PayToWitness",t[t.PayToP2SHWitness=3]="PayToP2SHWitness"}(A||(A={})),function(t){t[t.Spend=0]="Spend",t[t.Transfer=1]="Transfer",t[t.Change=2]="Change",t[t.Exchange=3]="Exchange"}(w||(w={}));var R=function(){function t(){}return t.prototype.then=function(e,r){var n=new t,o=this.s;if(o){var i=1&o?e:r;if(i){try{N(n,1,i(this.v))}catch(t){N(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?N(n,1,e?e(o):o):r?N(n,1,r(o)):N(n,2,o)}catch(t){N(n,2,t)}},n},t}();function N(t,e,r){if(!t.s){if(r instanceof R){if(!r.s)return void(r.o=N.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(N.bind(null,t,e),N.bind(null,t,2));t.s=e,t.v=r;var n=t.o;n&&n(t)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var W,x=function(t){function e(){t.call(this,{wildcard:!0}),this.wallets={},this.aliases={}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={initializedCount:{configurable:!0}};return r.initializedCount.get=function(){return Object.keys(this.wallets).length},e.prototype.add=function(t,e){var r=e||(new Date).toString();return!this.wallets[r]&&(this.wallets[r]=t,this.decorateEvents(e,t.transport),!0)},e.prototype.addAlias=function(t,e){this.aliases[e]=t},e.prototype.getAlias=function(t){var e=Object.keys(this.aliases),r=Object.values(this.aliases).indexOf(t);return-1!==r?e[r]:t},e.prototype.exec=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];try{var n=this;return Promise.all(Object.values(n.wallets).map(function(r){return r[t].apply(r,e)})).then(function(t){return t.reduce(function(t,e,r){return t[Object.keys(n.wallets)[r]]=e,t},{})})}catch(t){return Promise.reject(t)}},e.prototype.get=function(t){return this.aliases[t]&&this.wallets[this.aliases[t]]?this.wallets[this.aliases[t]]:this.wallets[t]?this.wallets[t]:this.initializedCount&&!t?Object.values(this.wallets)[0]:null},e.prototype.remove=function(t){try{var e=this;if(!e.get(t))return;var r=function(r,n){try{var o=function(r,n){try{var o=(i=e.get(t),Promise.resolve(i.transport.disconnect()).then(function(){}))}catch(t){return n(t)}var i;return o&&o.then?o.then(void 0,n):o}(0,function(t){console.error(t)})}catch(t){return n(!0,t)}return o&&o.then?o.then(n.bind(null,!1),n.bind(null,!0)):n(!1,value)}(0,function(r,n){var o=e.aliases[t];if(o?(delete e.aliases[t],delete e.wallets[o]):delete e.wallets[t],r)throw n;return n});return r&&r.then?r.then(function(){}):void 0}catch(t){return Promise.reject(t)}},e.prototype.removeAll=function(){try{var t=this;return Promise.resolve(Promise.all(Object.keys(t.wallets).map(t.remove.bind(t)))).then(function(){t.aliases={}})}catch(t){return Promise.reject(t)}},e.prototype.disconnectAll=function(){try{var t=Object.values(this.wallets),e=(r=t,n=function(e){return Promise.resolve(t[e].transport.disconnect()).then(function(){})},c=-1,function t(e){try{for(;++c<r.length;)if((e=n(c))&&e.then){if(!((a=e)instanceof R&&1&a.s))return void e.then(t,i||(i=N.bind(null,o=new R,2)));e=e.v}o?N(o,1,e):o=e}catch(t){N(o||(o=new R),2,t)}var a}(),o);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,n,o,i,c},e.prototype.decorateEvents=function(t,e){try{var r=this,n=r.get(t).getVendor();e.onAny(function(e){for(var o=[],i=arguments.length-1;i-- >0;)o[i]=arguments[i+1];return r.emit([n,t,e],[t].concat(o))})}catch(t){return Promise.reject(t)}},Object.defineProperties(e.prototype,r),e}(n);!function(t){t.ActionCancelled="ActionCancelled",t.DeviceDisconnected="DeviceDisconnected",t.PopupClosedError="PopupClosedError",t.ConflictingApp="ConflictingApp",t.SelectApp="SelectApp",t.WrongApp="WrongApp",t.FirmwareUpdateRequired="FirmwareUpdateRequired",t.WebUSBNotAvailable="WebUSBNotAvailable",t.WebUSBCouldNotPair="WebUSBCouldNotPair"}(W||(W={}));var D=function(t){function e(e,r){t.call(this,e),t.captureStackTrace(this,this.constructor),this.name=r,this.type=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),I=function(t){function e(){t.call(this,"Action cancelled",W.ActionCancelled)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),B=function(t){function e(){t.call(this,"Device disconnected",W.DeviceDisconnected)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),H=function(t){function e(){t.call(this,"TrezorConnect popup closed",W.PopupClosedError)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),Q=function(t){function e(e){t.call(this,"Conflicting Application: Another wallet is trying to connect with your "+e+".",W.ConflictingApp),this.model=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),k=function(t){function e(e,r){t.call(this,"Please open the "+r+" app on your "+e+".",W.SelectApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),F=function(t){function e(e,r){t.call(this,"Wrong app selected. Please open the "+r+" app on your "+e+".",W.WrongApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),L=function(t){function e(e,r){t.call(this,"Firmware "+r+" or later is required to use your "+e+" with this client. Please update your device.",W.FirmwareUpdateRequired)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),M=function(t){function e(){t.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",W.WebUSBNotAvailable)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),q=function(t){function e(e,r){t.call(this,"Could not pair "+e+": "+r,W.WebUSBCouldNotPair)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D);export{o as Events,i as makeEvent,c as DEFAULT_TIMEOUT,a as LONG_TIMEOUT,s as isArray,u as fromHexString,l as toHexString,p as arrayify,h as bip32ToAddressNList,d as addressNListToBIP32,y as bip32Like,v as takeFirstOfManyEvents,S as stripHexPrefix,_ as stripHexPrefixAndLower,b as base64toHEX,m as slip44ByCoin,g as satsFromStr,C as Transport,P as supportsBTC,T as infoBTC,j as supportsETH,O as infoETH,U as supportsDebugLink,E as BTCInputScriptType,A as BTCOutputScriptType,w as BTCOutputAddressType,x as Keyring,W as HDWalletErrorType,D as HDWalletError,I as ActionCancelled,B as DeviceDisconnected,H as PopupClosedError,Q as ConflictingApp,k as SelectApp,F as WrongApp,L as FirmwareUpdateRequired,M as WebUSBNotAvailable,q as WebUSBCouldNotPair};
import{fromEvent as t,merge as e}from"rxjs";import{first as r}from"rxjs/operators";import{EventEmitter2 as n}from"eventemitter2";var o;function i(t){return Object.assign({},{date:Date.now()},t)}!function(t){t.BUTTON_REQUEST="BUTTON_REQUEST",t.CANCEL="CANCEL",t.CHARACTER_REQUEST="CHARACTER_REQUEST",t.CONNECT="CONNECT",t.DISCONNECT="DISCONNECT",t.FAILURE="FAILURE",t.PASSPHRASE_REQUEST="PASSPHRASE_REQUEST",t.PIN_REQUEST="PIN_REQUEST",t.SUCCESS="SUCCESS",t.WORD_REQUEST="WORD_REQUEST"}(o||(o={}));var c=5e3,a=3e5,s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},u=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))};function l(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function p(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return new Uint8Array(r)}}var f=2147483648;function h(t){if(!d(t))throw new Error("Not a bip32 path: '"+t+"'");/^m\//i.test(t)&&(t=t.slice(2));var e=t.split("/");if(1===e.length&&""===e[0])return[];for(var r=new Array(e.length),n=0;n<e.length;n++){var o=/(\d+)([hH\']?)/.exec(e[n]);if(null===o)throw new Error("Invalid input");if(r[n]=parseInt(o[1],10),r[n]>=f)throw new Error("Invalid child index");if("h"===o[2]||"H"===o[2]||"'"===o[2])r[n]+=f;else if(0!==o[2].length)throw new Error("Invalid modifier")}return r}function y(t){return"m/"+t.map(function(t){return t>=f?t-f+"'":t}).join("/")}function d(t){return"m/"==t||/^m(((\/[0-9]+h)+|(\/[0-9]+H)+|(\/[0-9]+')*)((\/[0-9]+)*))$/.test(t)}function v(n,o){return e.apply(void 0,o.map(function(e){return t(n,e)})).pipe(r())}function b(t){return t.replace("0x","")}function S(t){return b(t).toLowerCase()}function _(t){for(var e=atob(t),r="",n=0;n<e.length;n++){var o=e.charCodeAt(n).toString(16);r+=2==o.length?o:"0"+o}return"0x"+r.toUpperCase()}function m(t){return{Bitcoin:0,Testnet:1,BitcoinCash:145,BitcoinGold:156,Litecoin:2,Dash:5,DigiByte:20,Dogecoin:3,BitcoinSV:236,Ethereum:60}[t]}function g(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)}var E,w,A,C=function(t){function e(e){t.call(this),this.keyring=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.connect=function(){},e.prototype.listen=function(){},e.prototype.disconnect=function(){},e}(n);function j(t){return"object"==typeof t&&!0===t._supportsBTC}function P(t){return"object"==typeof t&&!0===t._supportsBTCInfo}function T(t){return"object"==typeof t&&!0===t._supportsETH}function O(t){return"object"==typeof t&&!0===t._supportsETHInfo}function U(t){return"object"==typeof t&&!0===t._supportsDebugLink}!function(t){t[t.CashAddr=0]="CashAddr",t[t.SpendAddress=1]="SpendAddress",t[t.SpendMultisig=2]="SpendMultisig",t[t.External=3]="External",t[t.SpendWitness=4]="SpendWitness",t[t.SpendP2SHWitness=5]="SpendP2SHWitness"}(E||(E={})),function(t){t[t.PayToAddress=0]="PayToAddress",t[t.PayToMultisig=1]="PayToMultisig",t[t.PayToWitness=2]="PayToWitness",t[t.PayToP2SHWitness=3]="PayToP2SHWitness"}(w||(w={})),function(t){t[t.Spend=0]="Spend",t[t.Transfer=1]="Transfer",t[t.Change=2]="Change",t[t.Exchange=3]="Exchange"}(A||(A={}));var R=function(){function t(){}return t.prototype.then=function(e,r){var n=new t,o=this.s;if(o){var i=1&o?e:r;if(i){try{N(n,1,i(this.v))}catch(t){N(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?N(n,1,e?e(o):o):r?N(n,1,r(o)):N(n,2,o)}catch(t){N(n,2,t)}},n},t}();function N(t,e,r){if(!t.s){if(r instanceof R){if(!r.s)return void(r.o=N.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(N.bind(null,t,e),N.bind(null,t,2));t.s=e,t.v=r;var n=t.o;n&&n(t)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var W,x=function(t){function e(){t.call(this,{wildcard:!0}),this.wallets={},this.aliases={}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={initializedCount:{configurable:!0}};return r.initializedCount.get=function(){return Object.keys(this.wallets).length},e.prototype.add=function(t,e){var r=e||(new Date).toString();return!this.wallets[r]&&(this.wallets[r]=t,this.decorateEvents(e,t.transport),!0)},e.prototype.addAlias=function(t,e){this.aliases[e]=t},e.prototype.getAlias=function(t){var e=Object.keys(this.aliases),r=Object.values(this.aliases).indexOf(t);return-1!==r?e[r]:t},e.prototype.exec=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];try{var n=this;return Promise.all(Object.values(n.wallets).map(function(r){return r[t].apply(r,e)})).then(function(t){return t.reduce(function(t,e,r){return t[Object.keys(n.wallets)[r]]=e,t},{})})}catch(t){return Promise.reject(t)}},e.prototype.get=function(t){return this.aliases[t]&&this.wallets[this.aliases[t]]?this.wallets[this.aliases[t]]:this.wallets[t]?this.wallets[t]:this.initializedCount&&!t?Object.values(this.wallets)[0]:null},e.prototype.remove=function(t){try{var e=this;if(!e.get(t))return;var r=function(r,n){try{var o=function(r,n){try{var o=(i=e.get(t),Promise.resolve(i.transport.disconnect()).then(function(){}))}catch(t){return n(t)}var i;return o&&o.then?o.then(void 0,n):o}(0,function(t){console.error(t)})}catch(t){return n(!0,t)}return o&&o.then?o.then(n.bind(null,!1),n.bind(null,!0)):n(!1,value)}(0,function(r,n){var o=e.aliases[t];if(o?(delete e.aliases[t],delete e.wallets[o]):delete e.wallets[t],r)throw n;return n});return r&&r.then?r.then(function(){}):void 0}catch(t){return Promise.reject(t)}},e.prototype.removeAll=function(){try{var t=this;return Promise.resolve(Promise.all(Object.keys(t.wallets).map(t.remove.bind(t)))).then(function(){t.aliases={}})}catch(t){return Promise.reject(t)}},e.prototype.disconnectAll=function(){try{var t=Object.values(this.wallets),e=(r=t,n=function(e){return Promise.resolve(t[e].transport.disconnect()).then(function(){})},c=-1,function t(e){try{for(;++c<r.length;)if((e=n(c))&&e.then){if(!((a=e)instanceof R&&1&a.s))return void e.then(t,i||(i=N.bind(null,o=new R,2)));e=e.v}o?N(o,1,e):o=e}catch(t){N(o||(o=new R),2,t)}var a}(),o);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,n,o,i,c},e.prototype.decorateEvents=function(t,e){try{var r=this,n=r.get(t).getVendor();e.onAny(function(e){for(var o=[],i=arguments.length-1;i-- >0;)o[i]=arguments[i+1];return r.emit([n,t,e],[t].concat(o))})}catch(t){return Promise.reject(t)}},Object.defineProperties(e.prototype,r),e}(n);!function(t){t.ActionCancelled="ActionCancelled",t.DeviceDisconnected="DeviceDisconnected",t.PopupClosedError="PopupClosedError",t.ConflictingApp="ConflictingApp",t.SelectApp="SelectApp",t.WrongApp="WrongApp",t.FirmwareUpdateRequired="FirmwareUpdateRequired",t.WebUSBNotAvailable="WebUSBNotAvailable",t.WebUSBCouldNotPair="WebUSBCouldNotPair"}(W||(W={}));var D=function(t){function e(e,r){t.call(this,e),this.name=r,this.type=r,"function"==typeof t.captureStackTrace?t.captureStackTrace(this,this.constructor):this.stack=new t(e).stack}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),I=function(t){function e(){t.call(this,"Action cancelled",W.ActionCancelled)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),B=function(t){function e(){t.call(this,"Device disconnected",W.DeviceDisconnected)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),H=function(t){function e(){t.call(this,"TrezorConnect popup closed",W.PopupClosedError)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),k=function(t){function e(e){t.call(this,"Conflicting Application: Another wallet is trying to connect with your "+e+".",W.ConflictingApp),this.model=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),Q=function(t){function e(e,r){t.call(this,"Please open the "+r+" app on your "+e+".",W.SelectApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),F=function(t){function e(e,r){t.call(this,"Wrong app selected. Please open the "+r+" app on your "+e+".",W.WrongApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),L=function(t){function e(e,r){t.call(this,"Firmware "+r+" or later is required to use your "+e+" with this client. Please update your device.",W.FirmwareUpdateRequired)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),M=function(t){function e(){t.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",W.WebUSBNotAvailable)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),q=function(t){function e(e,r){t.call(this,"Could not pair "+e+": "+r,W.WebUSBCouldNotPair)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D);export{o as Events,i as makeEvent,c as DEFAULT_TIMEOUT,a as LONG_TIMEOUT,s as isArray,u as fromHexString,l as toHexString,p as arrayify,h as bip32ToAddressNList,y as addressNListToBIP32,d as bip32Like,v as takeFirstOfManyEvents,b as stripHexPrefix,S as stripHexPrefixAndLower,_ as base64toHEX,m as slip44ByCoin,g as satsFromStr,C as Transport,j as supportsBTC,P as infoBTC,T as supportsETH,O as infoETH,U as supportsDebugLink,E as BTCInputScriptType,w as BTCOutputScriptType,A as BTCOutputAddressType,x as Keyring,W as HDWalletErrorType,D as HDWalletError,I as ActionCancelled,B as DeviceDisconnected,H as PopupClosedError,k as ConflictingApp,Q as SelectApp,F as WrongApp,L as FirmwareUpdateRequired,M as WebUSBNotAvailable,q as WebUSBCouldNotPair};
//# sourceMappingURL=index.m.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rxjs"),require("rxjs/operators"),require("eventemitter2")):"function"==typeof define&&define.amd?define(["exports","rxjs","rxjs/operators","eventemitter2"],e):e(t.core={},t.rxjs,t.operators,t.eventemitter2)}(this,function(t,e,r,n){var o;(o=t.Events||(t.Events={})).BUTTON_REQUEST="BUTTON_REQUEST",o.CANCEL="CANCEL",o.CHARACTER_REQUEST="CHARACTER_REQUEST",o.CONNECT="CONNECT",o.DISCONNECT="DISCONNECT",o.FAILURE="FAILURE",o.PASSPHRASE_REQUEST="PASSPHRASE_REQUEST",o.PIN_REQUEST="PIN_REQUEST",o.SUCCESS="SUCCESS",o.WORD_REQUEST="WORD_REQUEST";var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function c(t){return"m/"==t||/^m(((\/[0-9]+h)+|(\/[0-9]+H)+|(\/[0-9]+')*)((\/[0-9]+)*))$/.test(t)}function a(t){return t.replace("0x","")}var s,p,u,l=function(t){function e(e){t.call(this),this.keyring=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.connect=function(){},e.prototype.listen=function(){},e.prototype.disconnect=function(){},e}(n.EventEmitter2);(s=t.BTCInputScriptType||(t.BTCInputScriptType={}))[s.CashAddr=0]="CashAddr",s[s.SpendAddress=1]="SpendAddress",s[s.SpendMultisig=2]="SpendMultisig",s[s.External=3]="External",s[s.SpendWitness=4]="SpendWitness",s[s.SpendP2SHWitness=5]="SpendP2SHWitness",(p=t.BTCOutputScriptType||(t.BTCOutputScriptType={}))[p.PayToAddress=0]="PayToAddress",p[p.PayToMultisig=1]="PayToMultisig",p[p.PayToWitness=2]="PayToWitness",p[p.PayToP2SHWitness=3]="PayToP2SHWitness",(u=t.BTCOutputAddressType||(t.BTCOutputAddressType={}))[u.Spend=0]="Spend",u[u.Transfer=1]="Transfer",u[u.Change=2]="Change",u[u.Exchange=3]="Exchange";var f=function(){function t(){}return t.prototype.then=function(e,r){var n=new t,o=this.s;if(o){var i=1&o?e:r;if(i){try{d(n,1,i(this.v))}catch(t){d(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?d(n,1,e?e(o):o):r?d(n,1,r(o)):d(n,2,o)}catch(t){d(n,2,t)}},n},t}();function d(t,e,r){if(!t.s){if(r instanceof f){if(!r.s)return void(r.o=d.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(d.bind(null,t,e),d.bind(null,t,2));t.s=e,t.v=r;var n=t.o;n&&n(t)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var y,h=function(t){function e(){t.call(this,{wildcard:!0}),this.wallets={},this.aliases={}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={initializedCount:{configurable:!0}};return r.initializedCount.get=function(){return Object.keys(this.wallets).length},e.prototype.add=function(t,e){var r=e||(new Date).toString();return!this.wallets[r]&&(this.wallets[r]=t,this.decorateEvents(e,t.transport),!0)},e.prototype.addAlias=function(t,e){this.aliases[e]=t},e.prototype.getAlias=function(t){var e=Object.keys(this.aliases),r=Object.values(this.aliases).indexOf(t);return-1!==r?e[r]:t},e.prototype.exec=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];try{var n=this;return Promise.all(Object.values(n.wallets).map(function(r){return r[t].apply(r,e)})).then(function(t){return t.reduce(function(t,e,r){return t[Object.keys(n.wallets)[r]]=e,t},{})})}catch(t){return Promise.reject(t)}},e.prototype.get=function(t){return this.aliases[t]&&this.wallets[this.aliases[t]]?this.wallets[this.aliases[t]]:this.wallets[t]?this.wallets[t]:this.initializedCount&&!t?Object.values(this.wallets)[0]:null},e.prototype.remove=function(t){try{var e=this;if(!e.get(t))return;var r=function(r,n){try{var o=function(r,n){try{var o=(i=e.get(t),Promise.resolve(i.transport.disconnect()).then(function(){}))}catch(t){return n(t)}var i;return o&&o.then?o.then(void 0,n):o}(0,function(t){console.error(t)})}catch(t){return n(!0,t)}return o&&o.then?o.then(n.bind(null,!1),n.bind(null,!0)):n(!1,value)}(0,function(r,n){var o=e.aliases[t];if(o?(delete e.aliases[t],delete e.wallets[o]):delete e.wallets[t],r)throw n;return n});return r&&r.then?r.then(function(){}):void 0}catch(t){return Promise.reject(t)}},e.prototype.removeAll=function(){try{var t=this;return Promise.resolve(Promise.all(Object.keys(t.wallets).map(t.remove.bind(t)))).then(function(){t.aliases={}})}catch(t){return Promise.reject(t)}},e.prototype.disconnectAll=function(){try{var t=Object.values(this.wallets),e=(r=t,n=function(e){return Promise.resolve(t[e].transport.disconnect()).then(function(){})},c=-1,function t(e){try{for(;++c<r.length;)if((e=n(c))&&e.then){if(!((a=e)instanceof f&&1&a.s))return void e.then(t,i||(i=d.bind(null,o=new f,2)));e=e.v}o?d(o,1,e):o=e}catch(t){d(o||(o=new f),2,t)}var a}(),o);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,n,o,i,c},e.prototype.decorateEvents=function(t,e){try{var r=this,n=r.get(t).getVendor();e.onAny(function(e){for(var o=[],i=arguments.length-1;i-- >0;)o[i]=arguments[i+1];return r.emit([n,t,e],[t].concat(o))})}catch(t){return Promise.reject(t)}},Object.defineProperties(e.prototype,r),e}(n.EventEmitter2);(y=t.HDWalletErrorType||(t.HDWalletErrorType={})).ActionCancelled="ActionCancelled",y.DeviceDisconnected="DeviceDisconnected",y.PopupClosedError="PopupClosedError",y.ConflictingApp="ConflictingApp",y.SelectApp="SelectApp",y.WrongApp="WrongApp",y.FirmwareUpdateRequired="FirmwareUpdateRequired",y.WebUSBNotAvailable="WebUSBNotAvailable",y.WebUSBCouldNotPair="WebUSBCouldNotPair";var v=function(t){function e(e,r){t.call(this,e),t.captureStackTrace(this,this.constructor),this.name=r,this.type=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),E=function(e){function r(){e.call(this,"Action cancelled",t.HDWalletErrorType.ActionCancelled)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),S=function(e){function r(){e.call(this,"Device disconnected",t.HDWalletErrorType.DeviceDisconnected)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),T=function(e){function r(){e.call(this,"TrezorConnect popup closed",t.HDWalletErrorType.PopupClosedError)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),b=function(e){function r(r){e.call(this,"Conflicting Application: Another wallet is trying to connect with your "+r+".",t.HDWalletErrorType.ConflictingApp),this.model=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),_=function(e){function r(r,n){e.call(this,"Please open the "+n+" app on your "+r+".",t.HDWalletErrorType.SelectApp)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),m=function(e){function r(r,n){e.call(this,"Wrong app selected. Please open the "+n+" app on your "+r+".",t.HDWalletErrorType.WrongApp)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),C=function(e){function r(r,n){e.call(this,"Firmware "+n+" or later is required to use your "+r+" with this client. Please update your device.",t.HDWalletErrorType.FirmwareUpdateRequired)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),g=function(e){function r(){e.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",t.HDWalletErrorType.WebUSBNotAvailable)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),A=function(e){function r(r,n){e.call(this,"Could not pair "+r+": "+n,t.HDWalletErrorType.WebUSBCouldNotPair)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v);t.makeEvent=function(t){return Object.assign({},{date:Date.now()},t)},t.DEFAULT_TIMEOUT=5e3,t.LONG_TIMEOUT=3e5,t.isArray=i,t.fromHexString=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))},t.toHexString=function(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")},t.arrayify=function(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return new Uint8Array(r)}},t.bip32ToAddressNList=function(t){if(!c(t))throw new Error("Not a bip32 path: '"+t+"'");/^m\//i.test(t)&&(t=t.slice(2));var e=t.split("/");if(1===e.length&&""===e[0])return[];for(var r=new Array(e.length),n=0;n<e.length;n++){var o=/(\d+)([hH\']?)/.exec(e[n]);if(null===o)throw new Error("Invalid input");if(r[n]=parseInt(o[1],10),r[n]>=2147483648)throw new Error("Invalid child index");if("h"===o[2]||"H"===o[2]||"'"===o[2])r[n]+=2147483648;else if(0!==o[2].length)throw new Error("Invalid modifier")}return r},t.addressNListToBIP32=function(t){return"m/"+t.map(function(t){return t>=2147483648?t-2147483648+"'":t}).join("/")},t.bip32Like=c,t.takeFirstOfManyEvents=function(t,n){return e.merge.apply(void 0,n.map(function(r){return e.fromEvent(t,r)})).pipe(r.first())},t.stripHexPrefix=a,t.stripHexPrefixAndLower=function(t){return a(t).toLowerCase()},t.base64toHEX=function(t){for(var e=atob(t),r="",n=0;n<e.length;n++){var o=e.charCodeAt(n).toString(16);r+=2==o.length?o:"0"+o}return"0x"+r.toUpperCase()},t.slip44ByCoin=function(t){return{Bitcoin:0,Testnet:1,BitcoinCash:145,BitcoinGold:156,Litecoin:2,Dash:5,DigiByte:20,Dogecoin:3,BitcoinSV:236,Ethereum:60}[t]},t.satsFromStr=function(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)},t.Transport=l,t.supportsBTC=function(t){return void 0!==t._supportsBTC},t.infoBTC=function(t){return void 0!==t._supportsBTCInfo},t.supportsETH=function(t){return void 0!==t._supportsETH},t.infoETH=function(t){return void 0!==t._supportsETHInfo},t.supportsDebugLink=function(t){return void 0!==t._supportsDebugLink},t.Keyring=h,t.HDWalletError=v,t.ActionCancelled=E,t.DeviceDisconnected=S,t.PopupClosedError=T,t.ConflictingApp=b,t.SelectApp=_,t.WrongApp=m,t.FirmwareUpdateRequired=C,t.WebUSBNotAvailable=g,t.WebUSBCouldNotPair=A});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rxjs"),require("rxjs/operators"),require("eventemitter2")):"function"==typeof define&&define.amd?define(["exports","rxjs","rxjs/operators","eventemitter2"],e):e(t.core={},t.rxjs,t.operators,t.eventemitter2)}(this,function(t,e,r,n){var o;(o=t.Events||(t.Events={})).BUTTON_REQUEST="BUTTON_REQUEST",o.CANCEL="CANCEL",o.CHARACTER_REQUEST="CHARACTER_REQUEST",o.CONNECT="CONNECT",o.DISCONNECT="DISCONNECT",o.FAILURE="FAILURE",o.PASSPHRASE_REQUEST="PASSPHRASE_REQUEST",o.PIN_REQUEST="PIN_REQUEST",o.SUCCESS="SUCCESS",o.WORD_REQUEST="WORD_REQUEST";var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function c(t){return"m/"==t||/^m(((\/[0-9]+h)+|(\/[0-9]+H)+|(\/[0-9]+')*)((\/[0-9]+)*))$/.test(t)}function a(t){return t.replace("0x","")}var s,p,u,l=function(t){function e(e){t.call(this),this.keyring=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.connect=function(){},e.prototype.listen=function(){},e.prototype.disconnect=function(){},e}(n.EventEmitter2);(s=t.BTCInputScriptType||(t.BTCInputScriptType={}))[s.CashAddr=0]="CashAddr",s[s.SpendAddress=1]="SpendAddress",s[s.SpendMultisig=2]="SpendMultisig",s[s.External=3]="External",s[s.SpendWitness=4]="SpendWitness",s[s.SpendP2SHWitness=5]="SpendP2SHWitness",(p=t.BTCOutputScriptType||(t.BTCOutputScriptType={}))[p.PayToAddress=0]="PayToAddress",p[p.PayToMultisig=1]="PayToMultisig",p[p.PayToWitness=2]="PayToWitness",p[p.PayToP2SHWitness=3]="PayToP2SHWitness",(u=t.BTCOutputAddressType||(t.BTCOutputAddressType={}))[u.Spend=0]="Spend",u[u.Transfer=1]="Transfer",u[u.Change=2]="Change",u[u.Exchange=3]="Exchange";var f=function(){function t(){}return t.prototype.then=function(e,r){var n=new t,o=this.s;if(o){var i=1&o?e:r;if(i){try{y(n,1,i(this.v))}catch(t){y(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?y(n,1,e?e(o):o):r?y(n,1,r(o)):y(n,2,o)}catch(t){y(n,2,t)}},n},t}();function y(t,e,r){if(!t.s){if(r instanceof f){if(!r.s)return void(r.o=y.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(y.bind(null,t,e),y.bind(null,t,2));t.s=e,t.v=r;var n=t.o;n&&n(t)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var d,h=function(t){function e(){t.call(this,{wildcard:!0}),this.wallets={},this.aliases={}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={initializedCount:{configurable:!0}};return r.initializedCount.get=function(){return Object.keys(this.wallets).length},e.prototype.add=function(t,e){var r=e||(new Date).toString();return!this.wallets[r]&&(this.wallets[r]=t,this.decorateEvents(e,t.transport),!0)},e.prototype.addAlias=function(t,e){this.aliases[e]=t},e.prototype.getAlias=function(t){var e=Object.keys(this.aliases),r=Object.values(this.aliases).indexOf(t);return-1!==r?e[r]:t},e.prototype.exec=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];try{var n=this;return Promise.all(Object.values(n.wallets).map(function(r){return r[t].apply(r,e)})).then(function(t){return t.reduce(function(t,e,r){return t[Object.keys(n.wallets)[r]]=e,t},{})})}catch(t){return Promise.reject(t)}},e.prototype.get=function(t){return this.aliases[t]&&this.wallets[this.aliases[t]]?this.wallets[this.aliases[t]]:this.wallets[t]?this.wallets[t]:this.initializedCount&&!t?Object.values(this.wallets)[0]:null},e.prototype.remove=function(t){try{var e=this;if(!e.get(t))return;var r=function(r,n){try{var o=function(r,n){try{var o=(i=e.get(t),Promise.resolve(i.transport.disconnect()).then(function(){}))}catch(t){return n(t)}var i;return o&&o.then?o.then(void 0,n):o}(0,function(t){console.error(t)})}catch(t){return n(!0,t)}return o&&o.then?o.then(n.bind(null,!1),n.bind(null,!0)):n(!1,value)}(0,function(r,n){var o=e.aliases[t];if(o?(delete e.aliases[t],delete e.wallets[o]):delete e.wallets[t],r)throw n;return n});return r&&r.then?r.then(function(){}):void 0}catch(t){return Promise.reject(t)}},e.prototype.removeAll=function(){try{var t=this;return Promise.resolve(Promise.all(Object.keys(t.wallets).map(t.remove.bind(t)))).then(function(){t.aliases={}})}catch(t){return Promise.reject(t)}},e.prototype.disconnectAll=function(){try{var t=Object.values(this.wallets),e=(r=t,n=function(e){return Promise.resolve(t[e].transport.disconnect()).then(function(){})},c=-1,function t(e){try{for(;++c<r.length;)if((e=n(c))&&e.then){if(!((a=e)instanceof f&&1&a.s))return void e.then(t,i||(i=y.bind(null,o=new f,2)));e=e.v}o?y(o,1,e):o=e}catch(t){y(o||(o=new f),2,t)}var a}(),o);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,n,o,i,c},e.prototype.decorateEvents=function(t,e){try{var r=this,n=r.get(t).getVendor();e.onAny(function(e){for(var o=[],i=arguments.length-1;i-- >0;)o[i]=arguments[i+1];return r.emit([n,t,e],[t].concat(o))})}catch(t){return Promise.reject(t)}},Object.defineProperties(e.prototype,r),e}(n.EventEmitter2);(d=t.HDWalletErrorType||(t.HDWalletErrorType={})).ActionCancelled="ActionCancelled",d.DeviceDisconnected="DeviceDisconnected",d.PopupClosedError="PopupClosedError",d.ConflictingApp="ConflictingApp",d.SelectApp="SelectApp",d.WrongApp="WrongApp",d.FirmwareUpdateRequired="FirmwareUpdateRequired",d.WebUSBNotAvailable="WebUSBNotAvailable",d.WebUSBCouldNotPair="WebUSBCouldNotPair";var v=function(t){function e(e,r){t.call(this,e),this.name=r,this.type=r,"function"==typeof t.captureStackTrace?t.captureStackTrace(this,this.constructor):this.stack=new t(e).stack}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),E=function(e){function r(){e.call(this,"Action cancelled",t.HDWalletErrorType.ActionCancelled)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),S=function(e){function r(){e.call(this,"Device disconnected",t.HDWalletErrorType.DeviceDisconnected)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),b=function(e){function r(){e.call(this,"TrezorConnect popup closed",t.HDWalletErrorType.PopupClosedError)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),T=function(e){function r(r){e.call(this,"Conflicting Application: Another wallet is trying to connect with your "+r+".",t.HDWalletErrorType.ConflictingApp),this.model=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),_=function(e){function r(r,n){e.call(this,"Please open the "+n+" app on your "+r+".",t.HDWalletErrorType.SelectApp)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),m=function(e){function r(r,n){e.call(this,"Wrong app selected. Please open the "+n+" app on your "+r+".",t.HDWalletErrorType.WrongApp)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),C=function(e){function r(r,n){e.call(this,"Firmware "+n+" or later is required to use your "+r+" with this client. Please update your device.",t.HDWalletErrorType.FirmwareUpdateRequired)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),g=function(e){function r(){e.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",t.HDWalletErrorType.WebUSBNotAvailable)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v),A=function(e){function r(r,n){e.call(this,"Could not pair "+r+": "+n,t.HDWalletErrorType.WebUSBCouldNotPair)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r}(v);t.makeEvent=function(t){return Object.assign({},{date:Date.now()},t)},t.DEFAULT_TIMEOUT=5e3,t.LONG_TIMEOUT=3e5,t.isArray=i,t.fromHexString=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))},t.toHexString=function(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")},t.arrayify=function(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return new Uint8Array(r)}},t.bip32ToAddressNList=function(t){if(!c(t))throw new Error("Not a bip32 path: '"+t+"'");/^m\//i.test(t)&&(t=t.slice(2));var e=t.split("/");if(1===e.length&&""===e[0])return[];for(var r=new Array(e.length),n=0;n<e.length;n++){var o=/(\d+)([hH\']?)/.exec(e[n]);if(null===o)throw new Error("Invalid input");if(r[n]=parseInt(o[1],10),r[n]>=2147483648)throw new Error("Invalid child index");if("h"===o[2]||"H"===o[2]||"'"===o[2])r[n]+=2147483648;else if(0!==o[2].length)throw new Error("Invalid modifier")}return r},t.addressNListToBIP32=function(t){return"m/"+t.map(function(t){return t>=2147483648?t-2147483648+"'":t}).join("/")},t.bip32Like=c,t.takeFirstOfManyEvents=function(t,n){return e.merge.apply(void 0,n.map(function(r){return e.fromEvent(t,r)})).pipe(r.first())},t.stripHexPrefix=a,t.stripHexPrefixAndLower=function(t){return a(t).toLowerCase()},t.base64toHEX=function(t){for(var e=atob(t),r="",n=0;n<e.length;n++){var o=e.charCodeAt(n).toString(16);r+=2==o.length?o:"0"+o}return"0x"+r.toUpperCase()},t.slip44ByCoin=function(t){return{Bitcoin:0,Testnet:1,BitcoinCash:145,BitcoinGold:156,Litecoin:2,Dash:5,DigiByte:20,Dogecoin:3,BitcoinSV:236,Ethereum:60}[t]},t.satsFromStr=function(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)},t.Transport=l,t.supportsBTC=function(t){return"object"==typeof t&&!0===t._supportsBTC},t.infoBTC=function(t){return"object"==typeof t&&!0===t._supportsBTCInfo},t.supportsETH=function(t){return"object"==typeof t&&!0===t._supportsETH},t.infoETH=function(t){return"object"==typeof t&&!0===t._supportsETHInfo},t.supportsDebugLink=function(t){return"object"==typeof t&&!0===t._supportsDebugLink},t.Keyring=h,t.HDWalletError=v,t.ActionCancelled=E,t.DeviceDisconnected=S,t.PopupClosedError=b,t.ConflictingApp=T,t.SelectApp=_,t.WrongApp=m,t.FirmwareUpdateRequired=C,t.WebUSBNotAvailable=g,t.WebUSBCouldNotPair=A});
//# sourceMappingURL=index.umd.js.map
{
"name": "@shapeshiftoss/hdwallet-core",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",

@@ -29,3 +29,3 @@ "publishConfig": {

},
"gitHead": "a652ed19552df9ec088c9bf28561131750e4801b"
"gitHead": "1f4015b49715650e6cf0f86d47ac0a6d39577734"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc