diff --git a/.eslintignore b/.eslintignore index d3c328e2c1..9fb0480a5a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,6 @@ *~ app/dist/ -app/dist-trezor/ +app/trezor-prebuild/build/ app/main.js app/main.js.map app/i18n/lib/ diff --git a/.gitignore b/.gitignore index c0bb7983b9..716a443a48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *~ app/dist/ -app/dist-trezor/ app/main.js app/main.js.map app/main.js.LICENSE.txt diff --git a/.prettierignore b/.prettierignore index c1acc4068f..949e849d8a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,7 +3,7 @@ /bin /node_modules /app/dist -/app/dist-trezor +/app/trezor-prebuild/build /app/middleware/ln/*_pb.js /app/middleware/ln/google/api/*_pb.js /app/middleware/walletrpc/*_pb.js diff --git a/app/actions/TrezorActions.js b/app/actions/TrezorActions.js index 96e1175897..1488f302a8 100644 --- a/app/actions/TrezorActions.js +++ b/app/actions/TrezorActions.js @@ -23,14 +23,13 @@ import { SIGNMESSAGE_SUCCESS } from "./ControlActions"; import { getAmountFromTxInputs, getTxFromInputs } from "./TransactionActions"; - -const session = require("trezor-connect").default; +const session = require("@trezor/connect-web").default; const { TRANSPORT_EVENT, UI, UI_EVENT, DEVICE_EVENT -} = require("trezor-connect"); +} = require("@trezor/connect-web"); const CHANGE = "device-changed"; const DISCONNECT = "device-disconnect"; const CONNECT = "device-connect"; @@ -61,11 +60,10 @@ export const initTransport = async (session, debug) => { await session .init({ connectSrc: "./", - env: "web", + transports: ["BridgeTransport"], lazyLoad: false, popup: false, transportReconnect: false, - webusb: false, manifest: { email: "joegruffins@gmail.com", appUrl: "https://github.com/decred/decrediton" @@ -288,6 +286,18 @@ function setDeviceListeners(dispatch, getState) { case UI.FIRMWARE_PROGRESS: { console.log("Trezor update progress: " + event.payload.progress + "%"); + break; + } + + case UI.SELECT_DEVICE: { + if (event.payload.devices.length > 0) { + session.uiResponse({ + type: UI.RECEIVE_DEVICE, + payload: event.payload.devices[0] + }); + } else { + // no devices connected, waiting for connection + } } } }); diff --git a/app/trezor-iframe.development.html b/app/trezor-iframe.development.html deleted file mode 100644 index 5fac75fc35..0000000000 --- a/app/trezor-iframe.development.html +++ /dev/null @@ -1,24 +0,0 @@ - - -
- - - -=0;i--){for(var h=t.words[i],l=u-1;l>=0;l--){var d=h>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==d||0!==o?(o<<=1,o|=d,(4===++a||0===i&&0===l)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}u=26}return n},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new E(e)},n(E,M),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},"../transport/lib/sessions/background-sharedworker.js":(e,t,r)=>{"use strict";function i(){return new SharedWorker(r.p+"./workers/sessions-background-sharedworker.f94223d1a920641f41b9.js")}r.r(t),r.d(t,{default:()=>i})},"../analytics/src/index.ts":(e,t,r)=>{"use strict";r.r(t),r.d(t,{Analytics:()=>a,getRandomId:()=>s,getTrackingRandomId:()=>n});var i=r("../utils/lib/index.js");const n=()=>(0,i.getWeakRandomId)(10),s=()=>(0,i.getWeakRandomId)(10),o=async({type:e,url:t,options:r,retry:i})=>{try{const e=await fetch(t,r);e.ok||console.error(`Analytics response not ok. Response status: ${e.status}.`)}catch(n){((e,t,r)=>{let i=r?.error?.message||r?.message;"string"!=typeof i&&(i="Unknown error."),i.includes("Failed to fetch")&&(i="Failed to analytics fetch.");const n=`Analytics report failed. Reporting '${e}' ${t?"again":"was unsuccessful"}. ${i}`;console.error(n)})(e,i,n),i&&setTimeout((()=>o({type:e,url:t,options:r,retry:!1})),1e3)}};class a{enabled=!1;useQueue=!1;queue=new Array;constructor(e,t){this.version=e,this.app=t}init=(e,t)=>{this.enabled=e,this.instanceId=t.instanceId||s(),this.sessionId=t.sessionId||s(),this.commitId=t.commitId,this.url=((e,t,r)=>{let i=`https://data.trezor.io/${e}/log`;return r&&(i=`${i}/${r}`),t?`${i}/develop.log`:`${i}/stable.log`})(this.app,t.isDev,t.environment),this.callbacks=t.callbacks,this.useQueue=!e&&!!t.useQueue};enable=()=>{this.enabled=!0,this.callbacks?.onEnable?.(),this.useQueue&&(this.queue.map((e=>this.report(e))),this.useQueue=!1,this.queue=[])};disable=()=>{this.enabled=!1,this.callbacks?.onDisable?.(),this.useQueue&&(this.useQueue=!1,this.queue=[])};isEnabled=()=>this.enabled;report=(e,t)=>{if(!(this.url&&this.instanceId&&this.sessionId&&this.commitId&&this.version)){const t=(this.url?"":"url, ")+(this.instanceId?"":"instanceId, ")+(this.sessionId?"":"sessionId, ")+(this.commitId?"":"commitId, ")+(this.version?"":"version, ");return void console.error(`Unable to report ${e.type}. Analytics is not initialized! Missing: ${t}`)}const{anonymize:r,force:i}=t??{};if(!this.useQueue||this.enabled||i||this.queue.push(e),!this.enabled&&!i)return;const n=((e,t,r,i,n)=>{const{type:o}=n,a=new URLSearchParams({c_v:i,c_type:o||"",c_commit:r,c_instance_id:e,c_session_id:t,c_timestamp:Date.now().toString(),c_message_id:s()});return n.payload&&Object.entries(n.payload).forEach((([e,t])=>a.append(e,t?.toString()??""))),a.toString()})(r?s():this.instanceId,r?s():this.sessionId,this.commitId,this.version,e);o({type:e.type,url:`${this.url}?${n}`,options:{method:"GET",keepalive:!0},retry:!0})}}},"../blockchain-link-types/lib/constants/errors.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CustomError=void 0;const r="blockchain_link/",i={worker_not_found:"Worker not found",worker_invalid:"Invalid worker object",worker_timeout:"Worker timeout",worker_unknown_request:"Unknown message type:",worker_runtime:void 0,invalid_param:"Invalid parameter:",websocket_not_initialized:"WebSocket not initialized",websocket_no_url:"Cannot connect because no server was specified",websocket_timeout:"Websocket timeout",websocket_error_message:void 0,websocket_runtime_error:void 0};class n extends Error{constructor(e,t=""){if(super(t),this.message="",this.message=t,"string"==typeof e){const n=0===e.indexOf(r)?e.substring(16,e.length):e;this.code=`${r}${n}`;const s=i[n];"string"==typeof s&&(""===this.message?this.message=s:0===t.indexOf("+")&&(this.message=`${s} ${t.substring(1)}`))}"string"==typeof this.message&&""!==this.message||(this.message="Message not set")}}t.CustomError=n},"../blockchain-link-types/lib/constants/index.js":function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.NETWORKS=t.RESPONSES=t.MESSAGES=void 0;const o=s(r("../blockchain-link-types/lib/constants/messages.js"));t.MESSAGES=o;const a=s(r("../blockchain-link-types/lib/constants/responses.js"));t.RESPONSES=a,t.NETWORKS={RIPPLE:"ripple",BLOCKBOOK:"blockbook",BLOCKFROST:"blockfrost"}},"../blockchain-link-types/lib/constants/messages.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TERMINATE=t.PUSH_TRANSACTION=t.UNSUBSCRIBE=t.SUBSCRIBE=t.ESTIMATE_FEE=t.GET_TRANSACTION=t.GET_ACCOUNT_UTXO=t.GET_ACCOUNT_INFO=t.GET_BLOCK=t.GET_BLOCK_HASH=t.GET_FIAT_RATES_TICKERS_LIST=t.GET_ACCOUNT_BALANCE_HISTORY=t.GET_FIAT_RATES_FOR_TIMESTAMPS=t.GET_CURRENT_FIAT_RATES=t.GET_INFO=t.DISCONNECT=t.CONNECT=t.INIT=t.HANDSHAKE=void 0,t.HANDSHAKE="m_handshake",t.INIT="m_init",t.CONNECT="m_connect",t.DISCONNECT="m_disconnect",t.GET_INFO="m_get_info",t.GET_CURRENT_FIAT_RATES="m_get_current_fiat_rates",t.GET_FIAT_RATES_FOR_TIMESTAMPS="m_get_fiat_rates_for_timestamps",t.GET_ACCOUNT_BALANCE_HISTORY="m_get_account_balance_history",t.GET_FIAT_RATES_TICKERS_LIST="m_get_fiat_rates_tickers_list",t.GET_BLOCK_HASH="m_get_block_hash",t.GET_BLOCK="m_get_block",t.GET_ACCOUNT_INFO="m_get_account_info",t.GET_ACCOUNT_UTXO="m_get_account_utxo",t.GET_TRANSACTION="m_get_transaction",t.ESTIMATE_FEE="m_estimate_fee",t.SUBSCRIBE="m_subscribe",t.UNSUBSCRIBE="m_unsubscribe",t.PUSH_TRANSACTION="m_push_tx",t.TERMINATE="terminate"},"../blockchain-link-types/lib/constants/responses.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NOTIFICATION=t.DISCONNECTED=t.CONNECTED=t.PUSH_TRANSACTION=t.UNSUBSCRIBE=t.SUBSCRIBE=t.ESTIMATE_FEE=t.GET_TRANSACTION=t.GET_ACCOUNT_BALANCE_HISTORY=t.GET_ACCOUNT_UTXO=t.GET_ACCOUNT_INFO=t.GET_FIAT_RATES_TICKERS_LIST=t.GET_FIAT_RATES_FOR_TIMESTAMPS=t.GET_CURRENT_FIAT_RATES=t.GET_BLOCK=t.GET_BLOCK_HASH=t.GET_INFO=t.CONNECT=t.ERROR=void 0,t.ERROR="r_error",t.CONNECT="r_connect",t.GET_INFO="r_info",t.GET_BLOCK_HASH="r_get_block_hash",t.GET_BLOCK="r_get_block",t.GET_CURRENT_FIAT_RATES="r_get_current_fiat_rates",t.GET_FIAT_RATES_FOR_TIMESTAMPS="r_get_fiat_rates_for_timestamps",t.GET_FIAT_RATES_TICKERS_LIST="r_GET_FIAT_RATES_TICKERS_LIST",t.GET_ACCOUNT_INFO="r_account_info",t.GET_ACCOUNT_UTXO="r_get_account_utxo",t.GET_ACCOUNT_BALANCE_HISTORY="r_get_account_balance_history",t.GET_TRANSACTION="r_get_transaction",t.ESTIMATE_FEE="r_estimate_fee",t.SUBSCRIBE="r_subscribe",t.UNSUBSCRIBE="r_unsubscribe",t.PUSH_TRANSACTION="r_push_tx",t.CONNECTED="r_connected",t.DISCONNECTED="r_disconnected",t.NOTIFICATION="r_notification"},"../blockchain-link/lib/index.js":(e,t,r)=>{"use strict";const i=r("../utils/lib/typedEventEmitter.js"),n=r("../utils/lib/createDeferred.js"),s=r("../blockchain-link-types/lib/constants/errors.js"),o=r("../blockchain-link-types/lib/constants/index.js"),a=r("../blockchain-link/lib/workers/throttler.js"),u=e=>{const t=(0,n.createDeferred)(-1),r=(e=>{if("function"==typeof e)return e();if("string"==typeof e&&"undefined"!=typeof Worker)return new Worker(e);throw new s.CustomError("worker_not_found")})(e.worker);if("object"!=typeof r||"function"!=typeof r.postMessage)throw new s.CustomError("worker_invalid");const i=setTimeout((()=>{r.onmessage=null,r.onerror=null,t.reject(new s.CustomError("worker_timeout"))}),e.timeout||3e4);return r.onmessage=n=>{n.data.type===o.MESSAGES.HANDSHAKE&&(clearTimeout(i),r.postMessage({type:o.MESSAGES.HANDSHAKE,settings:Object.assign(e,{worker:void 0})}),t.resolve(r))},r.onerror=e=>{clearTimeout(i),r.onmessage=null,r.onerror=null;try{r.terminate()}catch(e){}const n=e.message?`Worker runtime error: Line ${e.lineno} in ${e.filename}: ${e.message}`:"Worker handshake error";t.reject(new s.CustomError("worker_runtime",n))},t.promise};class h extends i.TypedEmitter{constructor(e){super(),this.messageId=0,this.deferred=[],this.onMessage=e=>{if(!e.data)return;const{data:t}=e;if(-1===t.id)return void this.onEvent(t);const r=this.deferred.find((e=>e.id===t.id));r&&(t.type===o.RESPONSES.ERROR?r.reject(new s.CustomError(t.payload.code,t.payload.message)):r.resolve(t.payload),this.deferred=this.deferred.filter((e=>e!==r)))},this.onEvent=e=>{if(e.type===o.RESPONSES.CONNECTED&&this.emit("connected"),e.type===o.RESPONSES.DISCONNECTED&&this.emit("disconnected"),e.type===o.RESPONSES.NOTIFICATION){const t=e.payload;if("block"===t.type)this.throttler.throttle("block",(()=>{this.emit(t.type,t.payload)}));else if("notification"===t.type){const e=`${t.payload.descriptor}:${t.payload.tx.txid}`;this.throttler.throttle(e,(()=>{this.emit(t.type,t.payload)}))}else this.emit(t.type,t.payload)}},this.onError=e=>{const t=e.message?`Worker runtime error: Line ${e.lineno} in ${e.filename}: ${e.message}`:"Worker handshake error",r=new s.CustomError("worker_runtime",t);this.deferred.forEach((e=>{e.reject(r)})),this.deferred=[]},this.settings=e;const t="number"==typeof e.throttleBlockEvent?e.throttleBlockEvent:500;this.throttler=new a.Throttler(t)}async getWorker(){return this.worker||(this.worker=await u(this.settings),this.worker.onmessage=this.onMessage.bind(this),this.worker.onerror=this.onError.bind(this)),this.worker}async sendMessage(e){const t=await this.getWorker(),r=(0,n.createDeferred)(this.messageId);return this.deferred.push(r),t.postMessage(Object.assign({id:this.messageId},e)),this.messageId++,r.promise}connect(){return this.sendMessage({type:o.MESSAGES.CONNECT})}getInfo(){return this.sendMessage({type:o.MESSAGES.GET_INFO})}getBlockHash(e){return this.sendMessage({type:o.MESSAGES.GET_BLOCK_HASH,payload:e})}getBlock(e){return this.sendMessage({type:o.MESSAGES.GET_BLOCK,payload:e})}getAccountInfo(e){return this.sendMessage({type:o.MESSAGES.GET_ACCOUNT_INFO,payload:e})}getAccountUtxo(e){return this.sendMessage({type:o.MESSAGES.GET_ACCOUNT_UTXO,payload:e})}getTransaction(e){return this.sendMessage({type:o.MESSAGES.GET_TRANSACTION,payload:e})}getAccountBalanceHistory(e){return this.sendMessage({type:o.MESSAGES.GET_ACCOUNT_BALANCE_HISTORY,payload:e})}getCurrentFiatRates(e){return this.sendMessage({type:o.MESSAGES.GET_CURRENT_FIAT_RATES,payload:e})}getFiatRatesForTimestamps(e){return this.sendMessage({type:o.MESSAGES.GET_FIAT_RATES_FOR_TIMESTAMPS,payload:e})}getFiatRatesTickersList(e){return this.sendMessage({type:o.MESSAGES.GET_FIAT_RATES_TICKERS_LIST,payload:e})}estimateFee(e){return this.sendMessage({type:o.MESSAGES.ESTIMATE_FEE,payload:e})}subscribe(e){return this.sendMessage({type:o.MESSAGES.SUBSCRIBE,payload:e})}unsubscribe(e){return this.sendMessage({type:o.MESSAGES.UNSUBSCRIBE,payload:e})}pushTransaction(e){return this.sendMessage({type:o.MESSAGES.PUSH_TRANSACTION,payload:e})}async disconnect(){return!this.worker||this.sendMessage({type:o.MESSAGES.DISCONNECT})}dispose(){this.removeAllListeners(),this.throttler.dispose();const{worker:e}=this;e&&(e.terminate(),delete this.worker)}}t.Z=h},"../blockchain-link/lib/workers/throttler.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Throttler=void 0;t.Throttler=class{constructor(e){this.delay=e,this.timeouts={}}throttle(e,t){const r=this.timeouts[e];r&&clearTimeout(r),this.timeouts[e]=setTimeout((()=>{t(),this.cancel(e)}),this.delay)}cancel(e){clearTimeout(this.timeouts[e]),delete this.timeouts[e]}dispose(){Object.keys(this.timeouts).forEach(this.cancel,this)}}},"../connect-analytics/lib/constants.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventType=void 0,function(e){e.AppReady="app/ready",e.AppInfo="app/info",e.ViewChange="view/change",e.ViewChangeError="view/change-error",e.SettingsTracking="settings/tracking",e.SettingsPermissions="settings/permissions",e.WalletType="wallet/type",e.DeviceSelected="device/selected"}(t.EventType||(t.EventType={}))},"../connect-analytics/lib/index.js":function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.getRandomId=t.analytics=void 0;const s=r("../analytics/src/index.ts");Object.defineProperty(t,"getRandomId",{enumerable:!0,get:function(){return s.getRandomId}});const o=new s.Analytics("9.0.0","connect");t.analytics=o,n(r("../connect-analytics/lib/types/events.js"),t),n(r("../connect-analytics/lib/constants.js"),t)},"../connect-analytics/lib/types/events.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect-common/lib/index.js":function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.storage=void 0;var s=r("../connect-common/lib/storage.js");t.storage=s,n(r("../connect-common/lib/systemInfo.js"),t)},"../connect-common/lib/storage.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.load=t.save=void 0;var i="storage_v".concat(1),n={},s=function(){var e=localStorage.getItem(i);return e?JSON.parse(e):{}};t.save=function(e,t){if(void 0===t&&(t=!1),!t&&r.g.window){var o=e(s());localStorage.setItem(i,JSON.stringify(o))}else n=e(n)};t.load=function(e){var t;return void 0===e&&(e=!1),e||!(null===(t=null===r.g||void 0===r.g?void 0:r.g.window)||void 0===t?void 0:t.localStorage)?n:s()}},"../connect-common/lib/systemInfo.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSystemInfo=t.getInstallerPackage=void 0;var i=r("../env-utils/lib/index.js");t.getInstallerPackage=function(){var e=(0,i.getUserAgent)();switch((0,i.getOsFamily)()){case"MacOS":return"mac";case"Windows":var t=e.match(/(Win64|WOW64)/)?"64":"32";return"win".concat(t);case"Linux":var r=e.match(/CentOS|Fedora|Mandriva|Mageia|Red Hat|Scientific|SUSE/)?"rpm":"deb",n=e.match(/Linux i[3456]86/)?"32":"64";return"".concat(r).concat(n)}};t.getSystemInfo=function(e){var t=(0,i.getBrowserName)(),r=(0,i.getBrowserVersion)(),n=t?e[t.toLowerCase()]:void 0,s=!!n&&n.version>parseInt(r,10),o="mobile"===(0,i.getDeviceType)(),a=!o||"usb"in navigator,u=!(!n||s||!a);return{os:{family:(0,i.getOsFamily)(),mobile:o},browser:{supported:u,outdated:s}}}},"../connect/lib/constants/cardano.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NETWORK_IDS=t.PROTOCOL_MAGICS=void 0,function(e){e[e.mainnet=764824073]="mainnet",e[e.testnet_preprod=1]="testnet_preprod",e[e.testnet_preview=2]="testnet_preview",e[e.testnet_legacy=1097911063]="testnet_legacy"}(t.PROTOCOL_MAGICS||(t.PROTOCOL_MAGICS={})),function(e){e[e.mainnet=1]="mainnet",e[e.testnet=0]="testnet"}(t.NETWORK_IDS||(t.NETWORK_IDS={}))},"../connect/lib/constants/errors.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LIBUSB_ERROR_MESSAGE=t.serializeError=t.TypedError=t.TrezorError=t.ERROR_CODES=void 0,t.ERROR_CODES={Init_NotInitialized:"TrezorConnect not initialized",Init_AlreadyInitialized:"TrezorConnect has been already initialized",Init_IframeBlocked:"Iframe blocked",Init_IframeTimeout:"Iframe timeout",Init_ManifestMissing:"Manifest not set. Read more at https://github.com/trezor/trezor-suite/blob/develop/docs/packages/connect/index.md",Popup_ConnectionMissing:"Unable to establish connection with iframe",Transport_Missing:"Transport is missing",Transport_InvalidProtobuf:"",Method_InvalidPackage:"This package is not suitable to work with browser. Use @trezor/connect-web package instead",Method_InvalidParameter:"",Method_NotAllowed:"Method not allowed for this configuration",Method_PermissionsNotGranted:"Permissions not granted",Method_Cancel:"Cancelled",Method_Interrupted:"Popup closed",Method_UnknownCoin:"Coin not found",Method_AddressNotMatch:"Addresses do not match",Method_FirmwareUpdate_DownloadFailed:"Failed to download firmware binary",Method_Discovery_BundleException:"",Method_Override:"override",Method_NoResponse:"Call resolved without response",Backend_NotSupported:"BlockchainLink settings not found in coins.json",Backend_WorkerMissing:"",Backend_Disconnected:"Backend disconnected",Backend_Invalid:"Invalid backend",Backend_Error:"",Runtime:"",Device_NotFound:"Device not found",Device_InitializeFailed:"",Device_FwException:"",Device_ModeException:"",Device_Disconnected:"Device disconnected",Device_UsedElsewhere:"Device is used in another window",Device_InvalidState:"Passphrase is incorrect",Device_CallInProgress:"Device call in progress"};class r extends Error{constructor(e,t){super(t),this.code=e,this.message=t}}t.TrezorError=r;t.TypedError=(e,i)=>new r(e,i||t.ERROR_CODES[e]);t.serializeError=e=>e&&e.error instanceof Error?{error:e.error.message,code:e.error.code}:e,t.LIBUSB_ERROR_MESSAGE="LIBUSB_ERROR"},"../connect/lib/constants/index.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PROTO=t.NEM=t.CARDANO=t.NETWORK=t.ERRORS=void 0;const i=r("../../node_modules/tslib/tslib.es6.mjs");t.ERRORS=i.__importStar(r("../connect/lib/constants/errors.js")),t.NETWORK=i.__importStar(r("../connect/lib/constants/network.js")),t.CARDANO=i.__importStar(r("../connect/lib/constants/cardano.js")),t.NEM=i.__importStar(r("../connect/lib/constants/nem.js")),t.PROTO=i.__importStar(r("../protobuf/lib/messages.js"))},"../connect/lib/constants/nem.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TxVersion=t.TxType=t.Networks=void 0,function(e){e[e.mainnet=104]="mainnet",e[e.testnet=152]="testnet",e[e.mijin=96]="mijin"}(t.Networks||(t.Networks={})),function(e){e[e.TRANSFER=257]="TRANSFER",e[e.COSIGNING=258]="COSIGNING",e[e.IMPORTANCE_TRANSFER=2049]="IMPORTANCE_TRANSFER",e[e.AGGREGATE_MODIFICATION=4097]="AGGREGATE_MODIFICATION",e[e.MULTISIG_SIGNATURE=4098]="MULTISIG_SIGNATURE",e[e.MULTISIG=4100]="MULTISIG",e[e.PROVISION_NAMESPACE=8193]="PROVISION_NAMESPACE",e[e.MOSAIC_CREATION=16385]="MOSAIC_CREATION",e[e.SUPPLY_CHANGE=16386]="SUPPLY_CHANGE"}(t.TxType||(t.TxType={})),function(e){e[e.mainnet=1744830464]="mainnet",e[e.testnet=-1744830464]="testnet",e[e.mijin=1610612736]="mijin"}(t.TxVersion||(t.TxVersion={}))},"../connect/lib/constants/network.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TYPES=void 0,t.TYPES={bitcoin:"Bitcoin",ethereum:"Ethereum",eos:"Eos",nem:"NEM",stellar:"Stellar",cardano:"Cardano",ripple:"Ripple",tezos:"Tezos",binance:"Binance"}},"../connect/lib/data/connectSettings.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseConnectSettings=t.corsValidator=t.DEFAULT_PRIORITY=void 0;const i=r("../connect/lib/data/version.js");t.DEFAULT_PRIORITY=2;const n={configSrc:"./data/config.json",version:i.VERSION,debug:!1,priority:t.DEFAULT_PRIORITY,trustedHost:!0,connectSrc:i.DEFAULT_DOMAIN,iframeSrc:`${i.DEFAULT_DOMAIN}iframe.html`,popup:!1,popupSrc:`${i.DEFAULT_DOMAIN}popup.html`,webusbSrc:`${i.DEFAULT_DOMAIN}webusb.html`,transports:void 0,pendingTransportEvent:!0,env:"node",lazyLoad:!1,timestamp:(new Date).getTime(),interactionTimeout:600};t.corsValidator=e=>{if("string"==typeof e)return e.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*trezor\.io\//)||e.match(/^https?:\/\/localhost:[58][0-9]{3}\//)||e.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*sldev\.cz\//)||e.match(/^https?:\/\/([A-Za-z0-9\-_]+\.)*trezoriovpjcahpzkrewelclulmszwbqpzmzgub37gbcjlvluxtruqad\.onion\//)?e:void 0};t.parseConnectSettings=(e={})=>{var r;const s={...n};"debug"in e&&("boolean"==typeof e.debug?s.debug=e.debug:"string"==typeof e.debug&&(s.debug="true"===e.debug)),"string"==typeof e.connectSrc&&(null===(r=e.connectSrc)||void 0===r?void 0:r.startsWith("http"))?s.connectSrc=(0,t.corsValidator)(e.connectSrc):s.trustedHost&&(s.connectSrc=e.connectSrc);const o=s.connectSrc||i.DEFAULT_DOMAIN;return s.iframeSrc=`${o}iframe.html`,s.popupSrc=`${o}popup.html`,s.webusbSrc=`${o}webusb.html`,"boolean"==typeof e.transportReconnect&&(s.transportReconnect=e.transportReconnect),"boolean"==typeof e.webusb&&(s.webusb=e.webusb),Array.isArray(e.transports)&&(s.transports=e.transports),"boolean"==typeof e.popup&&(s.popup=e.popup),"boolean"==typeof e.lazyLoad&&(s.lazyLoad=e.lazyLoad),"boolean"==typeof e.pendingTransportEvent&&(s.pendingTransportEvent=e.pendingTransportEvent),"string"==typeof e.extension&&(s.extension=e.extension),"string"==typeof e.env&&(s.env=e.env),"number"==typeof e.timestamp&&(s.timestamp=e.timestamp),"number"==typeof e.interactionTimeout&&(s.interactionTimeout=e.interactionTimeout),"object"==typeof e.manifest&&(s.manifest=(e=>{if(e&&"string"==typeof e.email&&"string"==typeof e.appUrl)return{email:e.email,appUrl:e.appUrl}})(e.manifest)),s}},"../connect/lib/data/version.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_DOMAIN=t.VERSION=void 0,t.VERSION="9.1.4";const r=t.VERSION.split(".").map((e=>parseInt(e,10)));t.DEFAULT_DOMAIN=`https://connect.trezor.io/${r[0]}/`},"../connect/lib/events/blockchain.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createBlockchainMessage=t.BLOCKCHAIN=t.BLOCKCHAIN_EVENT=void 0,t.BLOCKCHAIN_EVENT="BLOCKCHAIN_EVENT",t.BLOCKCHAIN={CONNECT:"blockchain-connect",ERROR:"blockchain-error",BLOCK:"blockchain-block",NOTIFICATION:"blockchain-notification",FIAT_RATES_UPDATE:"fiat-rates-update"};t.createBlockchainMessage=(e,r)=>({event:t.BLOCKCHAIN_EVENT,type:e,payload:r})},"../connect/lib/events/call.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseMessage=t.RESPONSE_EVENT=void 0;const i=r("../connect/lib/constants/errors.js");t.RESPONSE_EVENT="RESPONSE_EVENT";t.createResponseMessage=(e,r,n)=>({event:t.RESPONSE_EVENT,type:t.RESPONSE_EVENT,id:e,success:r,payload:r?n:(0,i.serializeError)(n)})},"../connect/lib/events/core.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorMessage=t.parseMessage=t.CORE_EVENT=void 0,t.CORE_EVENT="CORE_EVENT";t.parseMessage=e=>{const t={event:e.event,type:e.type,payload:e.payload};return"number"==typeof e.id&&(t.id=e.id),"boolean"==typeof e.success&&(t.success=e.success),t};t.createErrorMessage=e=>({success:!1,payload:{error:e.message,code:e.code}})},"../connect/lib/events/device.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDeviceMessage=t.DEVICE=t.DEVICE_EVENT=void 0,t.DEVICE_EVENT="DEVICE_EVENT",t.DEVICE={CONNECT:"device-connect",CONNECT_UNACQUIRED:"device-connect_unacquired",DISCONNECT:"device-disconnect",CHANGED:"device-changed",ACQUIRE:"device-acquire",RELEASE:"device-release",ACQUIRED:"device-acquired",RELEASED:"device-released",USED_ELSEWHERE:"device-used_elsewhere",LOADING:"device-loading",BUTTON:"button",PIN:"pin",PASSPHRASE:"passphrase",PASSPHRASE_ON_DEVICE:"passphrase_on_device",WORD:"word"};t.createDeviceMessage=(e,r)=>({event:t.DEVICE_EVENT,type:e,payload:r})},"../connect/lib/events/iframe.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createIFrameMessage=t.IFRAME=void 0;const i=r("../connect/lib/events/ui-request.js");t.IFRAME={BOOTSTRAP:"iframe-bootstrap",LOADED:"iframe-loaded",INIT:"iframe-init",ERROR:"iframe-error",CALL:"iframe-call",LOG:"iframe-log"};t.createIFrameMessage=(e,t)=>({event:i.UI_EVENT,type:e,payload:t})},"../connect/lib/events/index.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UI=void 0;const i=r("../../node_modules/tslib/tslib.es6.mjs"),n=r("../connect/lib/events/ui-request.js"),s=r("../connect/lib/events/ui-response.js");i.__exportStar(r("../connect/lib/events/blockchain.js"),t),i.__exportStar(r("../connect/lib/events/call.js"),t),i.__exportStar(r("../connect/lib/events/core.js"),t),i.__exportStar(r("../connect/lib/events/device.js"),t),i.__exportStar(r("../connect/lib/events/iframe.js"),t),i.__exportStar(r("../connect/lib/events/popup.js"),t),i.__exportStar(r("../connect/lib/events/transport.js"),t),i.__exportStar(r("../connect/lib/events/ui-promise.js"),t),i.__exportStar(r("../connect/lib/events/ui-request.js"),t),i.__exportStar(r("../connect/lib/events/ui-response.js"),t),t.UI={...n.UI_REQUEST,...s.UI_RESPONSE}},"../connect/lib/events/popup.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPopupMessage=t.POPUP=void 0;const i=r("../connect/lib/events/ui-request.js");t.POPUP={BOOTSTRAP:"popup-bootstrap",LOADED:"popup-loaded",INIT:"popup-init",ERROR:"popup-error",EXTENSION_USB_PERMISSIONS:"open-usb-permissions",HANDSHAKE:"popup-handshake",CLOSED:"popup-closed",CANCEL_POPUP_REQUEST:"ui-cancel-popup-request",CLOSE_WINDOW:"window.close",ANALYTICS_RESPONSE:"popup-analytics-response"};t.createPopupMessage=(e,t)=>({event:i.UI_EVENT,type:e,payload:t})},"../connect/lib/events/transport.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createTransportMessage=t.TRANSPORT_EVENT=t.TRANSPORT=void 0;const i=r("../connect/lib/constants/errors.js");var n=r("../transport/lib/constants.js");Object.defineProperty(t,"TRANSPORT",{enumerable:!0,get:function(){return n.TRANSPORT}}),t.TRANSPORT_EVENT="TRANSPORT_EVENT";t.createTransportMessage=(e,r)=>({event:t.TRANSPORT_EVENT,type:e,payload:"error"in r?(0,i.serializeError)(r):r})},"../connect/lib/events/ui-promise.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/events/ui-request.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createUiMessage=t.UI_REQUEST=t.UI_EVENT=void 0,t.UI_EVENT="UI_EVENT",t.UI_REQUEST={TRANSPORT:"ui-no_transport",BOOTLOADER:"ui-device_bootloader_mode",NOT_IN_BOOTLOADER:"ui-device_not_in_bootloader_mode",REQUIRE_MODE:"ui-device_require_mode",INITIALIZE:"ui-device_not_initialized",SEEDLESS:"ui-device_seedless",FIRMWARE_OLD:"ui-device_firmware_old",FIRMWARE_OUTDATED:"ui-device_firmware_outdated",FIRMWARE_NOT_SUPPORTED:"ui-device_firmware_unsupported",FIRMWARE_NOT_COMPATIBLE:"ui-device_firmware_not_compatible",FIRMWARE_NOT_INSTALLED:"ui-device_firmware_not_installed",FIRMWARE_PROGRESS:"ui-firmware-progress",DEVICE_NEEDS_BACKUP:"ui-device_needs_backup",REQUEST_UI_WINDOW:"ui-request_window",CLOSE_UI_WINDOW:"ui-close_window",REQUEST_PERMISSION:"ui-request_permission",REQUEST_CONFIRMATION:"ui-request_confirmation",REQUEST_PIN:"ui-request_pin",INVALID_PIN:"ui-invalid_pin",REQUEST_PASSPHRASE:"ui-request_passphrase",REQUEST_PASSPHRASE_ON_DEVICE:"ui-request_passphrase_on_device",INVALID_PASSPHRASE:"ui-invalid_passphrase",CONNECT:"ui-connect",LOADING:"ui-loading",SET_OPERATION:"ui-set_operation",SELECT_DEVICE:"ui-select_device",SELECT_ACCOUNT:"ui-select_account",SELECT_FEE:"ui-select_fee",UPDATE_CUSTOM_FEE:"ui-update_custom_fee",INSUFFICIENT_FUNDS:"ui-insufficient_funds",REQUEST_BUTTON:"ui-button",REQUEST_WORD:"ui-request_word",LOGIN_CHALLENGE_REQUEST:"ui-login_challenge_request",BUNDLE_PROGRESS:"ui-bundle_progress",ADDRESS_VALIDATION:"ui-address_validation",IFRAME_FAILURE:"ui-iframe_failure"};t.createUiMessage=(e,r)=>({event:t.UI_EVENT,type:e,payload:r})},"../connect/lib/events/ui-response.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createUiResponse=t.UI_RESPONSE=void 0;const i=r("../connect/lib/events/ui-request.js");t.UI_RESPONSE={RECEIVE_PERMISSION:"ui-receive_permission",RECEIVE_CONFIRMATION:"ui-receive_confirmation",RECEIVE_PIN:"ui-receive_pin",RECEIVE_PASSPHRASE:"ui-receive_passphrase",RECEIVE_DEVICE:"ui-receive_device",RECEIVE_ACCOUNT:"ui-receive_account",RECEIVE_FEE:"ui-receive_fee",RECEIVE_WORD:"ui-receive_word",INVALID_PASSPHRASE_ACTION:"ui-invalid_passphrase_action",CHANGE_SETTINGS:"ui-change_settings",LOGIN_CHALLENGE_RESPONSE:"ui-login_challenge_response"};t.createUiResponse=(e,t)=>({event:i.UI_EVENT,type:e,payload:t})},"../connect/lib/exports.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseConnectSettings=void 0;const i=r("../../node_modules/tslib/tslib.es6.mjs");i.__exportStar(r("../connect/lib/constants/index.js"),t),i.__exportStar(r("../connect/lib/events/index.js"),t),i.__exportStar(r("../connect/lib/types/index.js"),t);var n=r("../connect/lib/data/connectSettings.js");Object.defineProperty(t,"parseConnectSettings",{enumerable:!0,get:function(){return n.parseConnectSettings}})},"../connect/lib/factory.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.factory=void 0;const i=r("../connect/lib/events/index.js");t.factory=({eventEmitter:e,manifest:t,init:r,call:n,requestLogin:s,uiResponse:o,renderWebUSBButton:a,disableWebUSB:u,requestWebUSBDevice:h,cancel:l,dispose:d})=>({manifest:t,init:r,getSettings:()=>n({method:"getSettings"}),on:(t,r)=>{e.on(t,r)},off:(t,r)=>{e.removeListener(t,r)},removeAllListeners:t=>{"string"==typeof t?e.removeAllListeners(t):e.removeAllListeners()},uiResponse:o,blockchainGetAccountBalanceHistory:e=>n({...e,method:"blockchainGetAccountBalanceHistory"}),blockchainGetCurrentFiatRates:e=>n({...e,method:"blockchainGetCurrentFiatRates"}),blockchainGetFiatRatesForTimestamps:e=>n({...e,method:"blockchainGetFiatRatesForTimestamps"}),blockchainDisconnect:e=>n({...e,method:"blockchainDisconnect"}),blockchainEstimateFee:e=>n({...e,method:"blockchainEstimateFee"}),blockchainGetTransactions:e=>n({...e,method:"blockchainGetTransactions"}),blockchainSetCustomBackend:e=>n({...e,method:"blockchainSetCustomBackend"}),blockchainSubscribe:e=>n({...e,method:"blockchainSubscribe"}),blockchainSubscribeFiatRates:e=>n({...e,method:"blockchainSubscribeFiatRates"}),blockchainUnsubscribe:e=>n({...e,method:"blockchainUnsubscribe"}),blockchainUnsubscribeFiatRates:e=>n({...e,method:"blockchainUnsubscribeFiatRates"}),requestLogin:e=>s(e),cardanoGetAddress:t=>n({...t,method:"cardanoGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),cardanoGetNativeScriptHash:e=>n({...e,method:"cardanoGetNativeScriptHash"}),cardanoGetPublicKey:e=>n({...e,method:"cardanoGetPublicKey"}),cardanoSignTransaction:e=>n({...e,method:"cardanoSignTransaction"}),cipherKeyValue:e=>n({...e,method:"cipherKeyValue"}),composeTransaction:e=>n({...e,method:"composeTransaction"}),ethereumGetAddress:t=>n({...t,method:"ethereumGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),ethereumGetPublicKey:e=>n({...e,method:"ethereumGetPublicKey"}),ethereumSignMessage:e=>n({...e,method:"ethereumSignMessage"}),ethereumSignTransaction:e=>n({...e,method:"ethereumSignTransaction"}),ethereumSignTypedData:e=>n({...e,method:"ethereumSignTypedData"}),ethereumVerifyMessage:e=>n({...e,method:"ethereumVerifyMessage"}),getAccountInfo:e=>n({...e,method:"getAccountInfo"}),getAddress:t=>n({...t,method:"getAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),getDeviceState:e=>n({...e,method:"getDeviceState"}),getFeatures:e=>n({...e,method:"getFeatures"}),getFirmwareHash:e=>n({...e,method:"getFirmwareHash"}),getOwnershipId:e=>n({...e,method:"getOwnershipId"}),getOwnershipProof:e=>n({...e,method:"getOwnershipProof"}),getPublicKey:e=>n({...e,method:"getPublicKey"}),nemGetAddress:t=>n({...t,method:"nemGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),nemSignTransaction:e=>n({...e,method:"nemSignTransaction"}),pushTransaction:e=>n({...e,method:"pushTransaction"}),rippleGetAddress:t=>n({...t,method:"rippleGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),rippleSignTransaction:e=>n({...e,method:"rippleSignTransaction"}),signMessage:e=>n({...e,method:"signMessage"}),signTransaction:e=>n({...e,method:"signTransaction"}),stellarGetAddress:t=>n({...t,method:"stellarGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),stellarSignTransaction:e=>n({...e,method:"stellarSignTransaction"}),tezosGetAddress:t=>n({...t,method:"tezosGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),tezosGetPublicKey:e=>n({...e,method:"tezosGetPublicKey"}),tezosSignTransaction:e=>n({...e,method:"tezosSignTransaction"}),unlockPath:e=>n({...e,method:"unlockPath"}),eosGetPublicKey:e=>n({...e,method:"eosGetPublicKey"}),eosSignTransaction:e=>n({...e,method:"eosSignTransaction"}),binanceGetAddress:t=>n({...t,method:"binanceGetAddress",useEventListener:e.listenerCount(i.UI.ADDRESS_VALIDATION)>0}),binanceGetPublicKey:e=>n({...e,method:"binanceGetPublicKey"}),binanceSignTransaction:e=>n({...e,method:"binanceSignTransaction"}),verifyMessage:e=>n({...e,method:"verifyMessage"}),resetDevice:e=>n({...e,method:"resetDevice"}),wipeDevice:e=>n({...e,method:"wipeDevice"}),checkFirmwareAuthenticity:e=>n({...e,method:"checkFirmwareAuthenticity"}),applyFlags:e=>n({...e,method:"applyFlags"}),applySettings:e=>n({...e,method:"applySettings"}),authorizeCoinjoin:e=>n({...e,method:"authorizeCoinjoin"}),cancelCoinjoinAuthorization:e=>n({...e,method:"cancelCoinjoinAuthorization"}),showDeviceTutorial:e=>n({...e,method:"showDeviceTutorial"}),backupDevice:e=>n({...e,method:"backupDevice"}),changePin:e=>n({...e,method:"changePin"}),firmwareUpdate:e=>n({...e,method:"firmwareUpdate"}),recoveryDevice:e=>n({...e,method:"recoveryDevice"}),getCoinInfo:e=>n({...e,method:"getCoinInfo"}),rebootToBootloader:e=>n({...e,method:"rebootToBootloader"}),setBusy:e=>n({...e,method:"setBusy"}),setProxy:e=>n({...e,method:"setProxy"}),dispose:d,cancel:l,renderWebUSBButton:a,disableWebUSB:u,requestWebUSBDevice:h})},"../connect/lib/index-browser.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r("../../node_modules/tslib/tslib.es6.mjs"),n=r("../connect/lib/constants/errors.js"),s=()=>{throw(0,n.TypedError)("Method_InvalidPackage")},o=(0,r("../connect/lib/factory.js").factory)({eventEmitter:{on:s,off:s,removeAllListeners:s,listenerCount:s},manifest:s,init:s,call:s,requestLogin:s,requestWebUSBDevice:s,uiResponse:s,renderWebUSBButton:s,disableWebUSB:s,cancel:s,dispose:s});t.default=o,i.__exportStar(r("../connect/lib/exports.js"),t)},"../connect/lib/types/account.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/binance/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/bitcoin/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/cardano/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/eos/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/ethereum/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/ripple/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/stellar/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/api/tezos/index.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/coinInfo.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/device.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceModelInternal=t.FirmwareType=void 0,function(e){e.BitcoinOnly="bitcoin-only",e.Regular="regular"}(t.FirmwareType||(t.FirmwareType={}));var i=r("../protobuf/lib/messages.js");Object.defineProperty(t,"DeviceModelInternal",{enumerable:!0,get:function(){return i.DeviceModelInternal}})},"../connect/lib/types/fees.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/firmware.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/index.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=r("../../node_modules/tslib/tslib.es6.mjs");i.__exportStar(r("../connect/lib/types/api/index.js"),t),i.__exportStar(r("../connect/lib/types/account.js"),t),i.__exportStar(r("../connect/lib/types/coinInfo.js"),t),i.__exportStar(r("../connect/lib/types/device.js"),t),i.__exportStar(r("../connect/lib/types/fees.js"),t),i.__exportStar(r("../connect/lib/types/firmware.js"),t),i.__exportStar(r("../connect/lib/types/params.js"),t),i.__exportStar(r("../connect/lib/types/settings.js"),t),i.__exportStar(r("../connect/lib/types/api/cardano/index.js"),t),i.__exportStar(r("../connect/lib/types/api/binance/index.js"),t),i.__exportStar(r("../connect/lib/types/api/bitcoin/index.js"),t),i.__exportStar(r("../connect/lib/types/api/eos/index.js"),t),i.__exportStar(r("../connect/lib/types/api/ripple/index.js"),t),i.__exportStar(r("../connect/lib/types/api/ethereum/index.js"),t),i.__exportStar(r("../connect/lib/types/api/stellar/index.js"),t),i.__exportStar(r("../connect/lib/types/api/tezos/index.js"),t)},"../connect/lib/types/params.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../connect/lib/types/settings.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../env-utils/lib/envUtils.js":function(e,t,r){"use strict";var i=r("../../node_modules/process/browser.js"),n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.envUtils=t.getEnvironment=t.isDesktop=t.isWeb=void 0;const s=n(r("../../node_modules/ua-parser-js/src/ua-parser.js"));t.isWeb=()=>"web"==={VERSION:"9.0.0",COMMIT_HASH:"109db0a3f6fc6fc5cdb24098ee50480692c92dbf"}.SUITE_TYPE;t.isDesktop=()=>"desktop"==={VERSION:"9.0.0",COMMIT_HASH:"109db0a3f6fc6fc5cdb24098ee50480692c92dbf"}.SUITE_TYPE;let o;t.getEnvironment=()=>(0,t.isWeb)()?"web":"desktop";const a=()=>window.navigator.userAgent,u=()=>{if(!o){const e=a();o=new s.default(e)}return o},h=()=>/Android/.test(a()),l=()=>/CrOS/.test(a()),d=()=>{const e=u().getBrowser().name;return(null==e?void 0:e.toLowerCase())||""},c=()=>window.navigator.platform,f=()=>i.platform,p=()=>"darwin"===f()||("undefined"!=typeof window?c().startsWith("Mac"):void 0),m=()=>"win32"===f()||("undefined"!=typeof window?c().startsWith("Win"):void 0),b=()=>["iPhone","iPad","iPod"].includes(c()),g=()=>"linux"===f()||("undefined"!=typeof window?!h()&&!l()&&c().startsWith("Linux"):void 0);t.envUtils={isWeb:t.isWeb,isDesktop:t.isDesktop,getEnvironment:t.getEnvironment,getUserAgent:a,isAndroid:h,isChromeOs:l,getOsVersion:()=>u().getOS().version||"",getBrowserName:d,getBrowserVersion:()=>u().getBrowser().version||"",getCommitHash:()=>({VERSION:"9.0.0",COMMIT_HASH:"109db0a3f6fc6fc5cdb24098ee50480692c92dbf"}.COMMITHASH||""),getDeviceType:()=>u().getDevice().type,getSuiteVersion:()=>"9.0.0",isFirefox:()=>"firefox"===d(),getPlatform:c,getPlatformLanguages:()=>window.navigator.languages,getScreenWidth:()=>window.screen.width,getScreenHeight:()=>window.screen.height,getWindowWidth:()=>window.innerWidth,getWindowHeight:()=>window.innerHeight,getLocationOrigin:()=>window.location.origin,getLocationHostname:()=>window.location.hostname,getProcessPlatform:f,isMacOs:p,isWindows:m,isIOs:b,isLinux:g,getOsName:()=>m()?"windows":p()?"macos":h()?"android":l()?"chromeos":g()?"linux":b()?"ios":"",getOsNameWeb:()=>u().getOS().name,getOsFamily:()=>{const e=u().getOS().name;return"Windows"===e?"Windows":"Mac OS"===e?"MacOS":"Linux"}}},"../env-utils/lib/index.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOsFamily=t.getOsNameWeb=t.getOsName=t.isLinux=t.isIOs=t.isWindows=t.isMacOs=t.getProcessPlatform=t.getLocationHostname=t.getLocationOrigin=t.getWindowHeight=t.getWindowWidth=t.getScreenHeight=t.getScreenWidth=t.getPlatformLanguages=t.getPlatform=t.isFirefox=t.getSuiteVersion=t.getOsVersion=t.getDeviceType=t.getCommitHash=t.getBrowserName=t.getBrowserVersion=t.isChromeOs=t.isAndroid=t.getUserAgent=t.getEnvironment=t.isDesktop=t.isWeb=void 0;const i=r("../env-utils/lib/envUtils.js");t.isWeb=i.envUtils.isWeb,t.isDesktop=i.envUtils.isDesktop,t.getEnvironment=i.envUtils.getEnvironment,t.getUserAgent=i.envUtils.getUserAgent,t.isAndroid=i.envUtils.isAndroid,t.isChromeOs=i.envUtils.isChromeOs,t.getBrowserVersion=i.envUtils.getBrowserVersion,t.getBrowserName=i.envUtils.getBrowserName,t.getCommitHash=i.envUtils.getCommitHash,t.getDeviceType=i.envUtils.getDeviceType,t.getOsVersion=i.envUtils.getOsVersion,t.getSuiteVersion=i.envUtils.getSuiteVersion,t.isFirefox=i.envUtils.isFirefox,t.getPlatform=i.envUtils.getPlatform,t.getPlatformLanguages=i.envUtils.getPlatformLanguages,t.getScreenWidth=i.envUtils.getScreenWidth,t.getScreenHeight=i.envUtils.getScreenHeight,t.getWindowWidth=i.envUtils.getWindowWidth,t.getWindowHeight=i.envUtils.getWindowHeight,t.getLocationOrigin=i.envUtils.getLocationOrigin,t.getLocationHostname=i.envUtils.getLocationHostname,t.getProcessPlatform=i.envUtils.getProcessPlatform,t.isMacOs=i.envUtils.isMacOs,t.isWindows=i.envUtils.isWindows,t.isIOs=i.envUtils.isIOs,t.isLinux=i.envUtils.isLinux,t.getOsName=i.envUtils.getOsName,t.getOsNameWeb=i.envUtils.getOsNameWeb,t.getOsFamily=i.envUtils.getOsFamily},"../protobuf/lib/decode.js":function(e,t,r){"use strict";var i=this&&this.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n f)throw new TypeError("Invalid program length for segwit address");const i=e[0]-g;if(im)throw new TypeError("Invalid version for segwit address");if(e[1]!==r.length)throw new TypeError("Invalid script for segwit address");return c(r,i,t.bech32)}(e,t)}catch(e){}throw new Error(`${o.toASM(e)} has no matching Address`)},t.getAddressType=function(e,t=u.bitcoin){const{success:r,format:i,version:n,hash:s}=y(e,t);return r?v(i,n,s,t):"unknown"},t.toOutputScript=function(e,t=u.bitcoin){const{success:r,format:i,version:n,hash:s,error:h}=y(e,t);if(r){const e=v(i,n,s,t);if("unknown"!==e)return function(e,t,r){switch(e){case"p2pkh":return a.p2pkh({hash:t}).output;case"p2sh":return a.p2sh({hash:t}).output;case"p2wpkh":return a.p2wpkh({hash:t}).output;case"p2wsh":return a.p2wsh({hash:t}).output;case"p2tr":case"p2w-unknown":return o.compile([r+g,t])}}(e,s,n)}else if("bech32-invalid-prefix"===h)throw new Error(`${e} has an invalid prefix`);throw new Error(`${e} has no matching Script`)}},"../utxo-lib/lib/bip32.js":(e,t,r)=>{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fromSeed=t.fromPublicKey=t.fromPrivateKey=t.fromBase58=void 0;const i=r("../../node_modules/tiny-secp256k1/js.js"),n=r("../../node_modules/wif/index.js"),s=r("../../node_modules/typeforce/index.js"),o=r("../utxo-lib/lib/bs58check.js"),a=r("../utxo-lib/lib/crypto.js"),u=r("../utxo-lib/lib/networks.js"),h=s.BufferN(32),l=s.compile({wif:s.UInt8,bip32:{public:s.UInt32,private:s.UInt32}}),d=2147483648,c=Math.pow(2,31)-1;function f(e){return s.String(e)&&null!==e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function p(e){return s.UInt32(e)&&e<=c}function m(e,t,r,n,o,a){if(s({privateKey:h,chainCode:h},{privateKey:e,chainCode:t}),r=r||u.bitcoin,!i.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new g(e,void 0,t,r,n,o,a)}function b(e,t,r,n,o,a){if(s({publicKey:s.BufferN(33),chainCode:h},{publicKey:e,chainCode:t}),r=r||u.bitcoin,!i.isPoint(e))throw new TypeError("Point is not on the curve");return new g(void 0,e,t,r,n,o,a)}class g{constructor(e,t,r,i,n=0,o=0,a=0){this.__D=e,this.__Q=t,this.chainCode=r,this.network=i,this.__DEPTH=n,this.__INDEX=o,this.__PARENT_FINGERPRINT=a,s(l,i),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return void 0===this.__Q&&(this.__Q=i.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return(0,u.isNetworkType)("decred",this.network)?a.hash160blake256(this.publicKey):a.hash160(this.publicKey)}get fingerprint(){return this.identifier.subarray(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return b(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const{network:e}=this,t=this.isNeutered()?e.bip32.public:e.bip32.private,r=Buffer.allocUnsafe(78);return r.writeUInt32BE(t,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),o.encode(r,e)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return n.encode(this.network.wif,this.privateKey,!0)}derive(e){s(s.UInt32,e);const t=e>=d,r=Buffer.allocUnsafe(37);if(t){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(e,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(e,33);const n=a.hmacSHA512(this.chainCode,r),o=n.subarray(0,32),u=n.subarray(32);if(!i.isPrivate(o))return this.derive(e+1);let h;if(this.isNeutered()){const t=i.pointAddScalar(this.publicKey,o,!0);if(null===t)return this.derive(e+1);h=b(t,u,this.network,this.depth+1,e,this.fingerprint.readUInt32BE(0))}else{const t=i.privateAdd(this.privateKey,o);if(null==t)return this.derive(e+1);h=m(t,u,this.network,this.depth+1,e,this.fingerprint.readUInt32BE(0))}return h}deriveHardened(e){return s(p,e),this.derive(e+d)}derivePath(e){s(f,e);let t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");t=t.slice(1)}return t.reduce(((e,t)=>{let r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))}),this)}sign(e,t){if(!this.privateKey)throw new Error("Missing private key");if(void 0===t&&(t=this.lowR),!1===t)return i.sign(e,this.privateKey);let r=i.sign(e,this.privateKey);const n=Buffer.alloc(32,0);let s=0;for(;r[0]>127;)s++,n.writeUIntLE(s,0,6),r=i.signWithEntropy(e,this.privateKey,n);return r}verify(e,t){return i.verify(e,this.publicKey,t)}}function y(e,t,r){return m(e,t,r)}t.fromBase58=function(e,t){const r=Buffer.from((0,u.isNetworkType)("decred",t)?o.decodeBlake256Key(e):o.decode(e,t));if(78!==r.length)throw new TypeError("Invalid buffer length");t=t||u.bitcoin;const i=r.readUInt32BE(0);if(i!==t.bip32.private&&i!==t.bip32.public)throw new TypeError("Invalid network version");const n=r[4],s=r.readUInt32BE(5);if(0===n&&0!==s)throw new TypeError("Invalid parent fingerprint");const a=r.readUInt32BE(9);if(0===n&&0!==a)throw new TypeError("Invalid index");const h=r.subarray(13,45);let l;if(i===t.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");l=m(r.subarray(46,78),h,t,n,a,s)}else{l=b(r.subarray(45,78),h,t,n,a,s)}return l},t.fromPrivateKey=y,t.fromPublicKey=function(e,t,r){return b(e,t,r)},t.fromSeed=function(e,t){if(s(s.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||u.bitcoin;const r=a.hmacSHA512(Buffer.from("Bitcoin seed","utf8"),e);return y(r.subarray(0,32),r.subarray(32),t)}},"../utxo-lib/lib/bs58check.js":(e,t,r)=>{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encodeAddress=t.decodeAddress=t.decode=t.encode=t.encodeBlake256=t.decodeBlake256=t.decodeBlake256Key=t.decodeBlake=void 0;const i=r("../utxo-lib/lib/networks.js"),n=r("../../node_modules/bchaddrjs/src/bchaddr.js"),s=r("../../node_modules/bs58/index.js"),o=r("../../node_modules/bs58check/index.js"),a=r("../utxo-lib/lib/crypto.js");function u(e){const t=e.subarray(-4),r=e.subarray(0,-4),i=(0,a.blake256)((0,a.blake256)(r)).subarray(0,4);if(t[0]^i[0]|t[1]^i[1]|t[2]^i[2]|t[3]^i[3])throw new Error("invalid checksum");return r}function h(e){const t=s.decode(e),r=Buffer.from(t);if(26!==r.length)throw new Error(`${e} invalid address length`);let i;try{i=u(r)}catch(t){if(t instanceof Error)throw new Error(`${e} ${t.message}`);throw new Error(`${e} ${t}`)}return i}function l(e){const t=(0,a.blake256)((0,a.blake256)(e)).subarray(0,4);return s.encode(Buffer.concat([e,t]))}function d(e,t=i.bitcoin){return(0,i.isNetworkType)("decred",t)?l(e):o.encode(e)}function c(e,t=i.bitcoin){return(0,i.isNetworkType)("decred",t)?h(e):o.decode(e)}t.decodeBlake=u,t.decodeBlake256Key=function(e){const t=s.decode(e);return u(Buffer.from(t))},t.decodeBlake256=h,t.encodeBlake256=l,t.encode=d,t.decode=c,t.decodeAddress=function(e,t=i.bitcoin){let r;if((0,i.isNetworkType)("bitcoinCash",t)){if(!n.isCashAddress(e))throw Error(`${e} is not a cash address`);r=Buffer.from(o.decode(n.toLegacyAddress(e)))}else r=Buffer.from(c(e,t));if(r.length<21)throw new TypeError(`${e} is too short`);if(r.length>22)throw new TypeError(`${e} is too long`);const s=22===r.length,a=s?2:1;return{version:s?r.readUInt16BE(0):r[0],hash:r.subarray(a)}},t.encodeAddress=function(e,t,r=i.bitcoin){const s=t>255,o=s?22:21,a=s?2:1,u=Buffer.allocUnsafe(o);s?u.writeUInt16BE(t,0):u.writeUInt8(t,0),e.copy(u,a);const h=d(u,r);return(0,i.isNetworkType)("bitcoinCash",r)?n.toCashAddress(h):h}},"../utxo-lib/lib/bufferutils.js":(e,t,r)=>{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BufferReader=t.BufferWriter=t.getChunkSize=t.reverseBuffer=t.writePushDataInt=t.varIntSize=t.readPushDataInt=t.pushDataSize=t.cloneBuffer=t.writeVarInt=t.readVarInt=t.writeInt64LE=t.writeUInt64LEasString=t.writeUInt64LE=t.readInt64LE=t.readUInt64LEasString=t.readUInt64LE=t.verifuint=void 0;const i=r("../../node_modules/bn.js/lib/bn.js"),n=r("../../node_modules/pushdata-bitcoin/index.js"),s=r("../../node_modules/varuint-bitcoin/index.js"),o=r("../../node_modules/int64-buffer/int64-buffer.js"),a=r("../../node_modules/typeforce/index.js"),u=r("../utils/lib/index.js"),h=r("../utxo-lib/lib/types/index.js");function l(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function d(e,t){const r=e.readUInt32LE(t);let i=e.readUInt32LE(t+4);return i*=4294967296,l(i+r,9007199254740991),i+r}function c(e,t){try{return d(e,t).toString()}catch(r){const n=e.readUInt32LE(t),s=e.readUInt32LE(t+4),o=new i(4294967296),a=new i(n),u=new i(s).mul(o);return a.add(u).toString()}}function f(e,t){const r=e.readUInt32LE(t);let i=e.readInt32LE(t+4);return i*=4294967296,i+r}function p(e,t,r){return l(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}function m(e,t,r){if("string"!=typeof t)return p(e,t,r);return new o.Int64LE(t).toBuffer().copy(e,r),r+8}function b(e,t,r){const i=new o.Int64LE(t).toArray();for(let t=0;t<8;t++)e.writeUInt8(i[t],r+t);return r+8}t.verifuint=l,t.readUInt64LE=d,t.readUInt64LEasString=c,t.readInt64LE=f,t.writeUInt64LE=p,t.writeUInt64LEasString=m,t.writeInt64LE=b,t.readVarInt=function(e,t){return{number:s.decode(e,t),size:s.decode.bytes}},t.writeVarInt=function(e,t,r){return s.encode(t,e,r),s.encode.bytes},t.cloneBuffer=function(e){const t=Buffer.allocUnsafe(e.length);return e.copy(t),t},t.pushDataSize=n.encodingLength,t.readPushDataInt=n.decode,t.varIntSize=s.encodingLength,t.writePushDataInt=n.encode,t.reverseBuffer=u.bufferUtils.reverseBuffer,t.getChunkSize=u.bufferUtils.getChunkSize;t.BufferWriter=class{constructor(e,t=0){this.buffer=e,this.offset=t,a(h.tuple(h.Buffer,h.UInt32),[e,t])}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeUInt16(e){this.offset=this.buffer.writeUInt16LE(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeInt64(e){this.offset=b(this.buffer,e,this.offset)}writeUInt64(e){this.offset="string"==typeof e?m(this.buffer,e,this.offset):p(this.buffer,e,this.offset)}writeVarInt(e){s.encode(e,this.buffer,this.offset),this.offset+=s.encode.bytes}writeSlice(e){if(this.buffer.length {"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fromBuffer=t.fromConstructor=void 0;const i=r("../../node_modules/varuint-bitcoin/index.js"),n=r("../utxo-lib/lib/bufferutils.js"),s=r("../utxo-lib/lib/transaction/base.js"),o=0;function a(e,t=!0){var r;const n=t&&e.hasWitnesses();return(n?10:8)+(e.timestamp?4:0)+i.encodingLength(e.ins.length)+i.encodingLength(e.outs.length)+e.ins.reduce(((e,t)=>e+40+(0,s.varSliceSize)(t.script)),0)+e.outs.reduce(((e,t)=>e+8+(0,s.varSliceSize)(t.script)),0)+((null===(r=e.specific)||void 0===r?void 0:r.extraPayload)?(0,s.varSliceSize)(e.specific.extraPayload):0)+(n?e.ins.reduce(((e,t)=>e+(0,s.vectorSize)(t.witness)),0):0)}function u(e,t,r,i=!0){var s;t||(t=Buffer.allocUnsafe(e.byteLength(i)));const a=new n.BufferWriter(t,r||0);return e.version>=3&&e.type!==o?(a.writeUInt16(e.version),a.writeUInt16(e.type)):a.writeInt32(e.version),a.writeVarInt(e.ins.length),e.ins.forEach((e=>{a.writeSlice(e.hash),a.writeUInt32(e.index),a.writeVarSlice(e.script),a.writeUInt32(e.sequence)})),a.writeVarInt(e.outs.length),e.outs.forEach((e=>{a.writeUInt64(e.value),a.writeVarSlice(e.script)})),a.writeUInt32(e.locktime),(null===(s=e.specific)||void 0===s?void 0:s.extraPayload)&&a.writeVarSlice(e.specific.extraPayload),void 0!==r?t.subarray(r,a.offset):t}function h(e){var t;if(!(null===(t=e.specific)||void 0===t?void 0:t.extraPayload))return;const r=i.encode(e.specific.extraPayload.length);return Buffer.concat([r,e.specific.extraPayload])}function l(e){const t=new s.TransactionBase(e);return t.specific=t.specific||{type:"dash"},t.byteLength=a.bind(null,t),t.toBuffer=u.bind(null,t),t.getExtraData=h.bind(null,t),t}t.fromConstructor=l,t.fromBuffer=function(e,t){const r=new n.BufferReader(e),i=l(t);if(i.version=r.readInt32(),i.type=i.version>>16,i.version&=65535,3===i.version&&(i.type =0;i--){for(var h=t.words[i],l=u-1;l>=0;l--){var d=h>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==d||0!==o?(o<<=1,o|=d,(4===++a||0===i&&0===l)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}u=26}return n},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new I(e)},n(I,T),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},"../../node_modules/brorand/index.js":(e,t,r)=>{var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r=3&&i.type!==o&&(i.specific.extraPayload=r.readVarSlice()),t.nostrict)return i;if(r.offset!==e.length)throw new Error("Transaction has unexpected data");return i}},"../utxo-lib/lib/transaction/decred.js":(e,t,r)=>{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fromBuffer=t.fromConstructor=void 0;const i=r("../../node_modules/varuint-bitcoin/index.js"),n=r("../utxo-lib/lib/bufferutils.js"),s=r("../utxo-lib/lib/crypto.js"),o=r("../utxo-lib/lib/transaction/base.js"),a=0,u=1;function h(e){return e.type===a}function l(e,t=!0){let r=4+i.encodingLength(e.ins.length),n=0;const s=t&&e.hasWitnesses();return r+=e.ins.reduce(((e,t)=>(e+=41,s&&(n+=1,e+=16,e+=(0,o.varSliceSize)(t.decredWitness.script)),e)),0),s&&(r+=i.encodingLength(n)),r+=i.encodingLength(e.outs.length),r+=e.outs.reduce(((e,t)=>(e+=10,e+=(0,o.varSliceSize)(t.script))),0),r+=8,r}function d(e,t,r,i=!0){t||(t=Buffer.allocUnsafe(l(e,i)));const s=new n.BufferWriter(t,r||0);return s.writeUInt16(e.version),s.writeUInt16(i?e.type:u),s.writeVarInt(e.ins.length),e.ins.forEach((e=>{s.writeSlice(e.hash),s.writeUInt32(e.index),s.writeUInt8(e.decredTree),s.writeUInt32(e.sequence)})),s.writeVarInt(e.outs.length),e.outs.forEach((e=>{s.writeUInt64(e.value),s.writeUInt16(e.decredVersion),s.writeVarSlice(e.script)})),s.writeUInt32(e.locktime),s.writeUInt32(e.expiry),i&&e.hasWitnesses()&&(s.writeVarInt(e.ins.length),e.ins.forEach((e=>{s.writeUInt64(e.decredWitness.value),s.writeUInt32(e.decredWitness.height),s.writeUInt32(e.decredWitness.blockIndex),s.writeVarSlice(e.decredWitness.script)}))),void 0!==r?t.subarray(r,s.offset):t}function c(e,t=!1){return t&&e.isCoinbase()?Buffer.alloc(32,0):s.blake256(d(e,void 0,void 0,t))}function f(e){return e.byteLength(!0)}function p(e){const t=new o.TransactionBase(e);return t.byteLength=l.bind(null,t),t.toBuffer=d.bind(null,t),t.hasWitnesses=h.bind(null,t),t.getHash=c.bind(null,t),t.weight=f.bind(null,t),t}t.fromConstructor=p,t.fromBuffer=function(e,t){const r=new n.BufferReader(e),i=p(t);if(i.version=r.readInt32(),i.type=i.version>>16,i.version&=65535,1!==i.version)throw new Error("Unsupported Decred transaction version");if(i.type!==a&&i.type!==u)throw new Error("Unsupported Decred transaction type");const s=r.readVarInt();for(let e=0;e{e.decredWitness={value:r.readUInt64String(),height:r.readUInt32(),blockIndex:r.readUInt32(),script:r.readVarSlice()}}))}if(t.nostrict)return i;if(r.offset!==e.length)throw new Error("Transaction has unexpected data");return i}},"../utxo-lib/lib/transaction/index.js":(e,t,r)=>{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Transaction=void 0;const i=r("../utxo-lib/lib/networks.js"),n=r("../utxo-lib/lib/transaction/base.js"),s=r("../utxo-lib/lib/transaction/bitcoin.js"),o=r("../utxo-lib/lib/transaction/dash.js"),a=r("../utxo-lib/lib/transaction/decred.js"),u=r("../utxo-lib/lib/transaction/peercoin.js"),h=r("../utxo-lib/lib/transaction/zcash.js");class l extends n.TransactionBase{constructor(e={}){return super(e),(0,i.isNetworkType)("dash",this.network)?o.fromConstructor(e):(0,i.isNetworkType)("decred",this.network)?a.fromConstructor(e):(0,i.isNetworkType)("peercoin",this.network)?u.fromConstructor(e):(0,i.isNetworkType)("zcash",this.network)?h.fromConstructor(e):s.fromConstructor(e)}static isCoinbaseHash(e){return(0,n.isCoinbaseHash)(e)}static fromBuffer(e,t={}){return(0,i.isNetworkType)("dash",t.network)?o.fromBuffer(e,t):(0,i.isNetworkType)("decred",t.network)?a.fromBuffer(e,t):(0,i.isNetworkType)("peercoin",t.network)?u.fromBuffer(e,t):(0,i.isNetworkType)("zcash",t.network)?h.fromBuffer(e,t):s.fromBuffer(e,t)}static fromHex(e,t={}){return this.fromBuffer(Buffer.from(e,"hex"),Object.assign(t,{nostrict:!1}))}}t.Transaction=l},"../utxo-lib/lib/transaction/peercoin.js":(e,t,r)=>{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fromBuffer=t.fromConstructor=void 0;const i=r("../utxo-lib/lib/bufferutils.js"),n=r("../utxo-lib/lib/transaction/base.js");function s(e,t,r){t||(t=Buffer.allocUnsafe(e.byteLength(!1)));const n=new i.BufferWriter(t,r||0);return n.writeInt32(e.version),n.writeUInt32(e.timestamp),n.writeVarInt(e.ins.length),e.ins.forEach((e=>{n.writeSlice(e.hash),n.writeUInt32(e.index),n.writeVarSlice(e.script),n.writeUInt32(e.sequence)})),n.writeVarInt(e.outs.length),e.outs.forEach((e=>{n.writeUInt64(e.value),n.writeVarSlice(e.script)})),n.writeUInt32(e.locktime),void 0!==r?t.subarray(r,n.offset):t}function o(e){const t=new n.TransactionBase(e);return t.toBuffer=s.bind(null,t),t}t.fromConstructor=o,t.fromBuffer=function(e,t){const r=new i.BufferReader(e),n=o(t);n.version=r.readInt32(),n.timestamp=r.readUInt32();const s=r.readVarInt();for(let e=0;e{"use strict";var Buffer=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fromBuffer=t.fromConstructor=void 0;const i=r("../../node_modules/varuint-bitcoin/index.js"),n=r("../../node_modules/blakejs/index.js"),s=r("../utxo-lib/lib/bufferutils.js"),o=r("../utxo-lib/lib/transaction/base.js"),a=r("../utxo-lib/lib/crypto.js"),u=2,h=3,l=4,d=5,c=2,f=10;function p(e){const t=e.version>=h?8:0,r=e.specific,n=e.version===l?8+i.encodingLength(r.vShieldedSpend.length)+384*r.vShieldedSpend.length+i.encodingLength(r.vShieldedOutput.length)+948*r.vShieldedOutput.length+(r.vShieldedSpend.length+r.vShieldedOutput.length>0?64:0):0,a=e.version>=d?7:0;return 4+i.encodingLength(e.ins.length)+i.encodingLength(e.outs.length)+e.ins.reduce(((e,t)=>e+40+(0,o.varSliceSize)(t.script)),0)+e.outs.reduce(((e,t)=>e+8+(0,o.varSliceSize)(t.script)),0)+4+t+(()=>{if(e.version=d)return 0;const t=r.joinsplits.length;return t<1?(0,s.varIntSize)(t):(0,s.varIntSize)(t)+(e.version>=l?1698*t:1802*t)+32+64})()+n+a}function m(e,t,r){t||(t=Buffer.allocUnsafe(p(e)));const i=new s.BufferWriter(t,r||0),n=e.specific;if(e.version>=h){const t=n.overwintered?1:0;i.writeInt32(e.version|t<<31),i.writeUInt32(n.versionGroupId)}else i.writeInt32(e.version);function o(e){i.writeUInt8(c|e.yLsb),i.writeSlice(e.x)}return e.version>=d&&(i.writeUInt32(n.consensusBranchId),i.writeUInt32(e.locktime),i.writeUInt32(e.expiry)),i.writeVarInt(e.ins.length),e.ins.forEach((e=>{i.writeSlice(e.hash),i.writeUInt32(e.index),i.writeVarSlice(e.script),i.writeUInt32(e.sequence)})),i.writeVarInt(e.outs.length),e.outs.forEach((e=>{i.writeUInt64(e.value),i.writeVarSlice(e.script)})),e.version>>0,l[f]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");s=c,r++}for(var p=o-s;p!==o&&0===l[p];)p++;var m=i.allocUnsafe(n+(o-p));m.fill(0,0,n);for(var b=n;p!==o;)m[b++]=l[p++];return m}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var h=(o-s)*l+1>>>0,d=new Uint8Array(h);s!==o;){for(var c=t[s],f=0,p=h-1;(0!==c||f=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i>>=1)n++;return 1<o)for(this.length-=o,h=0;he.length)throw new RangeError("Index out of range")}function P(e,t,r,i,n){F(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function N(e,t,r,i,n){F(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function C(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,i,s){return t=+t,r>>>=0,s||C(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,s){return t=+t,r>>>=0,s||C(e,0,r,8),n.write(e,t,r,i,52,8),r+8}Buffer.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>3,o=0,a=[];for(e+=i.length;s--;)r=this.readByte(e++),a[o++]=!!(1&r),a[o++]=!!(2&r),a[o++]=!!(4&r),a[o++]=!!(8&r),a[o++]=!!(16&r),a[o++]=!!(32&r),a[o++]=!!(64&r),a[o++]=!!(128&r);if(o255)throw RangeError("illegal char code: "+i);o.view[n++]=i}return o.limit=s,o},r.toDebug=function(e){for(var t,r=-1,i=this.buffer.byteLength,n="",s="",o="";r32&&t<127?String.fromCharCode(t):".")),++r,e&&r>0&&r%16==0&&r!==i){for(;n.length<51;)n+=" ";o+=n+s+"\n",n=s=""}r===this.offset&&r===this.limit?n+=r===this.markedOffset?"!":"|":r===this.offset?n+=r===this.markedOffset?"[":"<":r===this.limit?n+=r===this.markedOffset?"]":">":n+=r===this.markedOffset?"'":e||0!==r&&r!==i?" ":""}if(e&&" "!==n){for(;n.length<51;)n+=" ";o+=n+s+"\n"}return e?o:n},t.fromDebug=function(e,r,i){for(var n,s,o=e.length,a=new t((o+1)/3|0,r,i),u=0,h=0,l=!1,d=!1,c=!1,f=!1,p=!1;u