Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shapeshiftoss/hdwallet-core

Package Overview
Dependencies
Maintainers
3
Versions
274
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.4.0 to 0.5.0

9

dist/bitcoin.d.ts

@@ -51,3 +51,3 @@ import { ExchangeType, BIP32Path, Coin } from './wallet';

sequence?: number;
amount: number;
amount: string;
vout: number;

@@ -70,3 +70,3 @@ txid: string;

addressType: BTCOutputAddressType;
amount: number;
amount: string;
isChange: boolean;

@@ -132,2 +132,3 @@ /**

export interface BTCAccountPath {
coin: Coin;
scriptType: BTCInputScriptType;

@@ -180,2 +181,6 @@ addressNList: BIP32Path;

btcIsSameAccount(msg: Array<BTCAccountPath>): boolean;
/**
* Returns the "next" account path, if any.
*/
btcNextAccountPath(msg: BTCAccountPath): BTCAccountPath | undefined;
}

@@ -182,0 +187,0 @@ export interface BTCWallet extends BTCWalletInfo {

@@ -10,2 +10,3 @@ import { ExchangeType, BIP32Path } from './wallet';

export interface ETHAccountPath {
addressNList: BIP32Path;
hardenedPath: BIP32Path;

@@ -94,2 +95,6 @@ relPath: BIP32Path;

ethGetAccountPaths(msg: ETHGetAccountPath): Array<ETHAccountPath>;
/**
* Returns the "next" ETH account, if any.
*/
ethNextAccountPath(msg: ETHAccountPath): ETHAccountPath | undefined;
}

@@ -96,0 +101,0 @@ export interface ETHWallet extends ETHWalletInfo {

@@ -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 p(t){return t.replace("0x","")}var s,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);(s=exports.BTCInputScriptType||(exports.BTCInputScriptType={})).CashAddr="cashaddr",s.SpendAddress="p2pkh",s.SpendMultisig="p2sh",s.External="external",s.SpendWitness="p2wpkh",s.SpendP2SHWitness="p2sh-p2wpkh",(c=exports.BTCOutputScriptType||(exports.BTCOutputScriptType={})).PayToAddress="p2pkh",c.PayToMultisig="p2sh",c.PayToWitness="p2wpkh",c.PayToP2SHWitness="p2sh-p2wpkh",(a=exports.BTCOutputAddressType||(exports.BTCOutputAddressType={})).Spend="spend",a.Transfer="transfer",a.Change="change",a.Exchange="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 h,y=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.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].disconnect()).then(function(){})},p=-1,function t(e){try{for(;++p<r.length;)if((e=o(p))&&e.then){if(!((s=e)instanceof l&&1&s.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 s}(),n);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,o,n,i,p},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);(h=exports.HDWalletErrorType||(exports.HDWalletErrorType={})).ActionCancelled="ActionCancelled",h.DeviceDisconnected="DeviceDisconnected",h.PopupClosedError="PopupClosedError",h.ConflictingApp="ConflictingApp",h.SelectApp="SelectApp",h.WrongApp="WrongApp",h.FirmwareUpdateRequired="FirmwareUpdateRequired",h.WebUSBNotAvailable="WebUSBNotAvailable",h.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),b=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),S=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),T=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=p,exports.stripHexPrefixAndLower=function(t){return p(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=y,exports.HDWalletError=d,exports.ActionCancelled=v,exports.DeviceDisconnected=E,exports.PopupClosedError=x,exports.ConflictingApp=b,exports.SelectApp=S,exports.WrongApp=T,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 p(t){return t.replace("0x","")}var s,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);(s=exports.BTCInputScriptType||(exports.BTCInputScriptType={})).CashAddr="cashaddr",s.SpendAddress="p2pkh",s.SpendMultisig="p2sh",s.External="external",s.SpendWitness="p2wpkh",s.SpendP2SHWitness="p2sh-p2wpkh",(c=exports.BTCOutputScriptType||(exports.BTCOutputScriptType={})).PayToAddress="p2pkh",c.PayToMultisig="p2sh",c.PayToWitness="p2wpkh",c.PayToP2SHWitness="p2sh-p2wpkh",(a=exports.BTCOutputAddressType||(exports.BTCOutputAddressType={})).Spend="spend",a.Transfer="transfer",a.Change="change",a.Exchange="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 h,y=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.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].disconnect()).then(function(){})},p=-1,function t(e){try{for(;++p<r.length;)if((e=o(p))&&e.then){if(!((s=e)instanceof l&&1&s.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 s}(),n);return e&&e.then?e.then(function(){}):void 0}catch(t){return Promise.reject(t)}var r,o,n,i,p},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);(h=exports.HDWalletErrorType||(exports.HDWalletErrorType={})).ActionCancelled="ActionCancelled",h.DeviceDisconnected="DeviceDisconnected",h.PopupClosedError="PopupClosedError",h.ConflictingApp="ConflictingApp",h.SelectApp="SelectApp",h.WrongApp="WrongApp",h.FirmwareUpdateRequired="FirmwareUpdateRequired",h.WebUSBNotAvailable="WebUSBNotAvailable",h.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),b=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),S=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),T=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=p,exports.stripHexPrefixAndLower=function(t){return p(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.hardenedPath=function(t){return t.filter(function(t){return t>=2147483648})},exports.relativePath=function(t){return t.filter(function(t){return t<2147483648})},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=y,exports.HDWalletError=d,exports.ActionCancelled=v,exports.DeviceDisconnected=E,exports.PopupClosedError=x,exports.ConflictingApp=b,exports.SelectApp=S,exports.WrongApp=T,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,u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))};function p(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function l(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 _(t){return b(t).toLowerCase()}function S(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 w(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)}var g,E,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 O(t){return"object"==typeof t&&!0===t._supportsBTCInfo}function T(t){return"object"==typeof t&&!0===t._supportsETH}function P(t){return"object"==typeof t&&!0===t._supportsETHInfo}function U(t){return"object"==typeof t&&!0===t._supportsDebugLink}!function(t){t.CashAddr="cashaddr",t.SpendAddress="p2pkh",t.SpendMultisig="p2sh",t.External="external",t.SpendWitness="p2wpkh",t.SpendP2SHWitness="p2sh-p2wpkh"}(g||(g={})),function(t){t.PayToAddress="p2pkh",t.PayToMultisig="p2sh",t.PayToWitness="p2wpkh",t.PayToP2SHWitness="p2sh-p2wpkh"}(E||(E={})),function(t){t.Spend="spend",t.Transfer="transfer",t.Change="change",t.Exchange="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 x,W=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.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].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"}(x||(x={}));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",x.ActionCancelled)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),k=function(t){function e(){t.call(this,"Device disconnected",x.DeviceDisconnected)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),B=function(t){function e(){t.call(this,"TrezorConnect popup closed",x.PopupClosedError)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),H=function(t){function e(e){t.call(this,"Conflicting Application: Another wallet is trying to connect with your "+e+".",x.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+".",x.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+".",x.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.",x.FirmwareUpdateRequired)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),q=function(t){function e(){t.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",x.WebUSBNotAvailable)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(D),z=function(t){function e(e,r){t.call(this,"Could not pair "+e+": "+r,x.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,u as isArray,s as fromHexString,p as toHexString,l as arrayify,h as bip32ToAddressNList,y as addressNListToBIP32,d as bip32Like,v as takeFirstOfManyEvents,b as stripHexPrefix,_ as stripHexPrefixAndLower,S as base64toHEX,m as slip44ByCoin,w as satsFromStr,C as Transport,j as supportsBTC,O as infoBTC,T as supportsETH,P as infoETH,U as supportsDebugLink,g as BTCInputScriptType,E as BTCOutputScriptType,A as BTCOutputAddressType,W as Keyring,x as HDWalletErrorType,D as HDWalletError,I as ActionCancelled,k as DeviceDisconnected,B as PopupClosedError,H as ConflictingApp,Q as SelectApp,F as WrongApp,L as FirmwareUpdateRequired,q as WebUSBNotAvailable,z 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,u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=function(t){var e=t.match(/.{1,2}/g)||[];return new Uint8Array(e.map(function(t){return parseInt(t,16)}))};function p(t){return Array.prototype.map.call(t,function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function l(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 _(t){return b(t).toLowerCase()}function S(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 w(t){var e=t.indexOf("."),r=e>0?8-(t.length-e-1):8;return Number(t.replace(/\./g,""))*Math.pow(10,r)}function g(t){return t.filter(function(t){return t>=2147483648})}function E(t){return t.filter(function(t){return t<2147483648})}var A,C,j,O=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 T(t){return"object"==typeof t&&!0===t._supportsBTC}function P(t){return"object"==typeof t&&!0===t._supportsBTCInfo}function U(t){return"object"==typeof t&&!0===t._supportsETH}function R(t){return"object"==typeof t&&!0===t._supportsETHInfo}function N(t){return"object"==typeof t&&!0===t._supportsDebugLink}!function(t){t.CashAddr="cashaddr",t.SpendAddress="p2pkh",t.SpendMultisig="p2sh",t.External="external",t.SpendWitness="p2wpkh",t.SpendP2SHWitness="p2sh-p2wpkh"}(A||(A={})),function(t){t.PayToAddress="p2pkh",t.PayToMultisig="p2sh",t.PayToWitness="p2wpkh",t.PayToP2SHWitness="p2sh-p2wpkh"}(C||(C={})),function(t){t.Spend="spend",t.Transfer="transfer",t.Change="change",t.Exchange="exchange"}(j||(j={}));var x=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{W(n,1,i(this.v))}catch(t){W(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?W(n,1,e?e(o):o):r?W(n,1,r(o)):W(n,2,o)}catch(t){W(n,2,t)}},n},t}();function W(t,e,r){if(!t.s){if(r instanceof x){if(!r.s)return void(r.o=W.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(W.bind(null,t,e),W.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,I=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.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].disconnect()).then(function(){})},c=-1,function t(e){try{for(;++c<r.length;)if((e=n(c))&&e.then){if(!((a=e)instanceof x&&1&a.s))return void e.then(t,i||(i=W.bind(null,o=new x,2)));e=e.v}o?W(o,1,e):o=e}catch(t){W(o||(o=new x),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"}(D||(D={}));var k=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),B=function(t){function e(){t.call(this,"Action cancelled",D.ActionCancelled)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),H=function(t){function e(){t.call(this,"Device disconnected",D.DeviceDisconnected)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),Q=function(t){function e(){t.call(this,"TrezorConnect popup closed",D.PopupClosedError)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),F=function(t){function e(e){t.call(this,"Conflicting Application: Another wallet is trying to connect with your "+e+".",D.ConflictingApp),this.model=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),L=function(t){function e(e,r){t.call(this,"Please open the "+r+" app on your "+e+".",D.SelectApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),q=function(t){function e(e,r){t.call(this,"Wrong app selected. Please open the "+r+" app on your "+e+".",D.WrongApp)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),z=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.",D.FirmwareUpdateRequired)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),M=function(t){function e(){t.call(this,"WebUSB is not available in this browser. We recommend trying Chrome.",D.WebUSBNotAvailable)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k),V=function(t){function e(e,r){t.call(this,"Could not pair "+e+": "+r,D.WebUSBCouldNotPair)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(k);export{o as Events,i as makeEvent,c as DEFAULT_TIMEOUT,a as LONG_TIMEOUT,u as isArray,s as fromHexString,p as toHexString,l as arrayify,h as bip32ToAddressNList,y as addressNListToBIP32,d as bip32Like,v as takeFirstOfManyEvents,b as stripHexPrefix,_ as stripHexPrefixAndLower,S as base64toHEX,m as slip44ByCoin,w as satsFromStr,g as hardenedPath,E as relativePath,O as Transport,T as supportsBTC,P as infoBTC,U as supportsETH,R as infoETH,N as supportsDebugLink,A as BTCInputScriptType,C as BTCOutputScriptType,j as BTCOutputAddressType,I as Keyring,D as HDWalletErrorType,k as HDWalletError,B as ActionCancelled,H as DeviceDisconnected,Q as PopupClosedError,F as ConflictingApp,L as SelectApp,q as WrongApp,z as FirmwareUpdateRequired,M as WebUSBNotAvailable,V 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 p,s,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);(p=t.BTCInputScriptType||(t.BTCInputScriptType={})).CashAddr="cashaddr",p.SpendAddress="p2pkh",p.SpendMultisig="p2sh",p.External="external",p.SpendWitness="p2wpkh",p.SpendP2SHWitness="p2sh-p2wpkh",(s=t.BTCOutputScriptType||(t.BTCOutputScriptType={})).PayToAddress="p2pkh",s.PayToMultisig="p2sh",s.PayToWitness="p2wpkh",s.PayToP2SHWitness="p2sh-p2wpkh",(u=t.BTCOutputAddressType||(t.BTCOutputAddressType={})).Spend="spend",u.Transfer="transfer",u.Change="change",u.Exchange="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{h(n,1,i(this.v))}catch(t){h(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?h(n,1,e?e(o):o):r?h(n,1,r(o)):h(n,2,o)}catch(t){h(n,2,t)}},n},t}();function h(t,e,r){if(!t.s){if(r instanceof f){if(!r.s)return void(r.o=h.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(h.bind(null,t,e),h.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,d=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.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].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=h.bind(null,o=new f,2)));e=e.v}o?h(o,1,e):o=e}catch(t){h(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),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),b=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),S=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=d,t.HDWalletError=v,t.ActionCancelled=E,t.DeviceDisconnected=b,t.PopupClosedError=S,t.ConflictingApp=T,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 p,s,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);(p=t.BTCInputScriptType||(t.BTCInputScriptType={})).CashAddr="cashaddr",p.SpendAddress="p2pkh",p.SpendMultisig="p2sh",p.External="external",p.SpendWitness="p2wpkh",p.SpendP2SHWitness="p2sh-p2wpkh",(s=t.BTCOutputScriptType||(t.BTCOutputScriptType={})).PayToAddress="p2pkh",s.PayToMultisig="p2sh",s.PayToWitness="p2wpkh",s.PayToP2SHWitness="p2sh-p2wpkh",(u=t.BTCOutputAddressType||(t.BTCOutputAddressType={})).Spend="spend",u.Transfer="transfer",u.Change="change",u.Exchange="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{h(n,1,i(this.v))}catch(t){h(n,2,t)}return n}return this}return this.o=function(t){try{var o=t.v;1&t.s?h(n,1,e?e(o):o):r?h(n,1,r(o)):h(n,2,o)}catch(t){h(n,2,t)}},n},t}();function h(t,e,r){if(!t.s){if(r instanceof f){if(!r.s)return void(r.o=h.bind(null,t,e));1&e&&(e=r.s),r=r.v}if(r&&r.then)return void r.then(h.bind(null,t,e),h.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,d=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.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].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=h.bind(null,o=new f,2)));e=e.v}o?h(o,1,e):o=e}catch(t){h(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),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),b=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),S=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.hardenedPath=function(t){return t.filter(function(t){return t>=2147483648})},t.relativePath=function(t){return t.filter(function(t){return t<2147483648})},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=d,t.HDWalletError=v,t.ActionCancelled=E,t.DeviceDisconnected=b,t.PopupClosedError=S,t.ConflictingApp=T,t.SelectApp=_,t.WrongApp=m,t.FirmwareUpdateRequired=C,t.WebUSBNotAvailable=g,t.WebUSBCouldNotPair=A});
//# sourceMappingURL=index.umd.js.map
import * as eventemitter2 from 'eventemitter2';
import { Observable } from 'rxjs';
import { Coin } from './wallet';
import { BIP32Path } from './wallet';
export declare type Constructor<T = {}> = new (...args: any[]) => T;

@@ -20,1 +21,3 @@ export declare const DEFAULT_TIMEOUT = 5000;

export declare function satsFromStr(coins: string): number;
export declare function hardenedPath(path: BIP32Path): BIP32Path;
export declare function relativePath(path: BIP32Path): BIP32Path;
{
"name": "@shapeshiftoss/hdwallet-core",
"version": "0.4.0",
"version": "0.5.0",
"license": "MIT",

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

},
"gitHead": "a7906673b76eee74f3e6ba5d127015ca36de5b23"
"gitHead": "bf9a71ae4ac24945b434b53eb4727d7342c07559"
}

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