@initia/initia.js 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("@ledgerhq/hw-transport"),f=require("./index-CGO7OOZz.js");var I=function(){var u=function(i,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},u(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");u(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),l=function(u,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function d(a){try{o(t.next(a))}catch(v){c(v)}}function s(a){try{o(t.throw(a))}catch(v){c(v)}}function o(a){a.done?n(a.value):r(a.value).then(d,s)}o((t=t.apply(u,i||[])).next())})},h=function(u,i){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,c;return c={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function d(o){return function(a){return s([o,a])}}function s(o){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,r&&(n=o[0]&2?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,r=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]<n[3])){e.label=o[1];break}if(o[0]===6&&e.label<n[1]){e.label=n[1],n=o;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(o);break}n[2]&&e.ops.pop(),e.trys.pop();continue}o=i.call(u,e)}catch(a){o=[6,a],r=0}finally{t=n=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},k=function(u,i){var e=typeof Symbol=="function"&&u[Symbol.iterator];if(!e)return u;var t=e.call(u),r,n=[],c;try{for(;(i===void 0||i-- >0)&&!(r=t.next()).done;)n.push(r.value)}catch(d){c={error:d}}finally{try{r&&!r.done&&(e=t.return)&&e.call(t)}finally{if(c)throw c.error}}return n},E=[{vendorId:f.ledgerUSBVendorId}],O=function(){return Promise.resolve(!!(window.navigator&&window.navigator.hid))},w=function(){var u=navigator.hid;if(!u)throw new f.TransportError("navigator.hid is not supported","HIDNotSupported");return u};function S(){return l(this,void 0,void 0,function(){var u;return h(this,function(i){switch(i.label){case 0:return[4,w().requestDevice({filters:E})];case 1:return u=i.sent(),Array.isArray(u)?[2,u]:[2,[u]]}})})}function _(){return l(this,void 0,void 0,function(){var u;return h(this,function(i){switch(i.label){case 0:return[4,w().getDevices()];case 1:return u=i.sent(),[2,u.filter(function(e){return e.vendorId===f.ledgerUSBVendorId})]}})})}function T(){return l(this,void 0,void 0,function(){var u,i;return h(this,function(e){switch(e.label){case 0:return[4,_()];case 1:return u=e.sent(),u.length>0?[2,u[0]]:[4,S()];case 2:return i=e.sent(),[2,i[0]]}})})}var C=function(u){I(i,u);function i(e){var t=u.call(this)||this;return t.channel=Math.floor(Math.random()*65535),t.packetSize=64,t.inputs=[],t.read=function(){return t.inputs.length?Promise.resolve(t.inputs.shift()):new Promise(function(r){t.inputCallback=r})},t.onInputReport=function(r){var n=Buffer.from(r.data.buffer);t.inputCallback?(t.inputCallback(n),t.inputCallback=null):t.inputs.push(n)},t._disconnectEmitted=!1,t._emitDisconnect=function(r){t._disconnectEmitted||(t._disconnectEmitted=!0,t.emit("disconnect",r))},t.exchange=function(r){return l(t,void 0,void 0,function(){var n,c=this;return h(this,function(d){switch(d.label){case 0:return[4,this.exchangeAtomicImpl(function(){return l(c,void 0,void 0,function(){var s,o,a,v,g,y,b,m,D;return h(this,function(p){switch(p.label){case 0:s=this,o=s.channel,a=s.packetSize,f.log("apdu","=> "+r.toString("hex")),v=f.createHIDframing(o,a),g=v.makeBlocks(r),y=0,p.label=1;case 1:return y<g.length?[4,this.device.sendReport(0,g[y])]:[3,4];case 2:p.sent(),p.label=3;case 3:return y++,[3,1];case 4:return(b=v.getReducedResult(m))?[3,6]:[4,this.read()];case 5:return D=p.sent(),m=v.reduceResponse(m,D),[3,4];case 6:return f.log("apdu","<= "+b.toString("hex")),[2,b]}})})}).catch(function(s){throw s&&s.message&&s.message.includes("write")?(c._emitDisconnect(s),new f.DisconnectedDeviceDuringOperation(s.message)):s})];case 1:return n=d.sent(),[2,n]}})})},t.device=e,t.deviceModel=typeof e.productId=="number"?f.identifyUSBProductId(e.productId):void 0,e.addEventListener("inputreport",t.onInputReport),t}return i.request=function(){return l(this,void 0,void 0,function(){var e,t;return h(this,function(r){switch(r.label){case 0:return[4,S()];case 1:return e=k.apply(void 0,[r.sent(),1]),t=e[0],[2,i.open(t)]}})})},i.openConnected=function(){return l(this,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,_()];case 1:return e=t.sent(),e.length===0?[2,null]:[2,i.open(e[0])]}})})},i.open=function(e){return l(this,void 0,void 0,function(){var t,r;return h(this,function(n){switch(n.label){case 0:return[4,e.open()];case 1:return n.sent(),t=new i(e),r=function(c){e===c.device&&(w().removeEventListener("disconnect",r),t._emitDisconnect(new f.DisconnectedDevice))},w().addEventListener("disconnect",r),[2,t]}})})},i.prototype.close=function(){return l(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return[4,this.exchangeBusyPromise];case 1:return e.sent(),this.device.removeEventListener("inputreport",this.onInputReport),[4,this.device.close()];case 2:return e.sent(),[2]}})})},i.prototype.setScrambleKey=function(){},i.isSupported=O,i.list=_,i.listen=function(e){var t=!1;T().then(function(n){if(!n)e.error(new f.TransportOpenUserCancelled("Access denied to use Ledger device"));else if(!t){var c=typeof n.productId=="number"?f.identifyUSBProductId(n.productId):void 0;e.next({type:"add",descriptor:n,deviceModel:c}),e.complete()}},function(n){e.error(new f.TransportOpenUserCancelled(n.message))});function r(){t=!0}return{unsubscribe:r}},i}(x);exports.default=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@ledgerhq/hw-transport"),d=require("./index-CGO7OOZz.js");var p=function(o,c,e,i){function r(n){return n instanceof e?n:new e(function(u){u(n)})}return new(e||(e=Promise))(function(n,u){function f(s){try{t(i.next(s))}catch(l){u(l)}}function a(s){try{t(i.throw(s))}catch(l){u(l)}}function t(s){s.done?n(s.value):r(s.value).then(f,a)}t((i=i.apply(o,c||[])).next())})},m=function(o,c){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(t){return function(s){return a([t,s])}}function a(t){if(i)throw new TypeError("Generator is already executing.");for(;e;)try{if(i=1,r&&(n=t[0]&2?r.return:t[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,t[1])).done)return n;switch(r=0,n&&(t=[t[0]&2,n.value]),t[0]){case 0:case 1:n=t;break;case 4:return e.label++,{value:t[1],done:!1};case 5:e.label++,r=t[1],t=[0];continue;case 7:t=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(t[0]===6||t[0]===2)){e=0;continue}if(t[0]===3&&(!n||t[1]>n[0]&&t[1]<n[3])){e.label=t[1];break}if(t[0]===6&&e.label<n[1]){e.label=n[1],n=t;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(t);break}n[2]&&e.ops.pop(),e.trys.pop();continue}t=c.call(o,e)}catch(s){t=[6,s],r=0}finally{i=n=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}},B=[{vendorId:d.ledgerUSBVendorId}];function I(){return p(this,void 0,void 0,function(){var o;return m(this,function(c){switch(c.label){case 0:return[4,navigator.usb.requestDevice({filters:B})];case 1:return o=c.sent(),[2,o]}})})}function y(){return p(this,void 0,void 0,function(){var o;return m(this,function(c){switch(c.label){case 0:return[4,navigator.usb.getDevices()];case 1:return o=c.sent(),[2,o.filter(function(e){return e.vendorId===d.ledgerUSBVendorId})]}})})}function O(){return p(this,void 0,void 0,function(){var o;return m(this,function(c){switch(c.label){case 0:return[4,y()];case 1:return o=c.sent(),o.length>0?[2,o[0]]:[2,I()]}})})}var T=function(){return Promise.resolve(!!navigator&&!!navigator.usb&&typeof navigator.usb.getDevices=="function")},E=function(){var o=function(c,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[n]=r[n])},o(c,e)};return function(c,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");o(c,e);function i(){this.constructor=c}c.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),h=function(o,c,e,i){function r(n){return n instanceof e?n:new e(function(u){u(n)})}return new(e||(e=Promise))(function(n,u){function f(s){try{t(i.next(s))}catch(l){u(l)}}function a(s){try{t(i.throw(s))}catch(l){u(l)}}function t(s){s.done?n(s.value):r(s.value).then(f,a)}t((i=i.apply(o,c||[])).next())})},v=function(o,c){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(t){return function(s){return a([t,s])}}function a(t){if(i)throw new TypeError("Generator is already executing.");for(;e;)try{if(i=1,r&&(n=t[0]&2?r.return:t[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,t[1])).done)return n;switch(r=0,n&&(t=[t[0]&2,n.value]),t[0]){case 0:case 1:n=t;break;case 4:return e.label++,{value:t[1],done:!1};case 5:e.label++,r=t[1],t=[0];continue;case 7:t=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(t[0]===6||t[0]===2)){e=0;continue}if(t[0]===3&&(!n||t[1]>n[0]&&t[1]<n[3])){e.label=t[1];break}if(t[0]===6&&e.label<n[1]){e.label=n[1],n=t;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(t);break}n[2]&&e.ops.pop(),e.trys.pop();continue}t=c.call(o,e)}catch(s){t=[6,s],r=0}finally{i=n=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}},U=1,D=3,N=function(o){E(c,o);function c(e,i){var r=o.call(this)||this;return r.channel=Math.floor(Math.random()*65535),r.packetSize=64,r._disconnectEmitted=!1,r._emitDisconnect=function(n){r._disconnectEmitted||(r._disconnectEmitted=!0,r.emit("disconnect",n))},r.device=e,r.interfaceNumber=i,r.deviceModel=d.identifyUSBProductId(e.productId),r}return c.request=function(){return h(this,void 0,void 0,function(){var e;return v(this,function(i){switch(i.label){case 0:return[4,I()];case 1:return e=i.sent(),[2,c.open(e)]}})})},c.openConnected=function(){return h(this,void 0,void 0,function(){var e;return v(this,function(i){switch(i.label){case 0:return[4,y()];case 1:return e=i.sent(),e.length===0?[2,null]:[2,c.open(e[0])]}})})},c.open=function(e){return h(this,void 0,void 0,function(){var i,r,n,u,f;return v(this,function(a){switch(a.label){case 0:return[4,e.open()];case 1:return a.sent(),e.configuration!==null?[3,3]:[4,e.selectConfiguration(U)];case 2:a.sent(),a.label=3;case 3:return[4,_(e)];case 4:if(a.sent(),i=e.configurations[0].interfaces.find(function(t){var s=t.alternates;return s.some(function(l){return l.interfaceClass===255})}),!i)throw new d.TransportInterfaceNotAvailable("No WebUSB interface found for your Ledger device. Please upgrade firmware or contact techsupport.");r=i.interfaceNumber,a.label=5;case 5:return a.trys.push([5,7,,9]),[4,e.claimInterface(r)];case 6:return a.sent(),[3,9];case 7:return n=a.sent(),[4,e.close()];case 8:throw a.sent(),new d.TransportInterfaceNotAvailable(n.message);case 9:return u=new c(e,r),f=function(t){e===t.device&&(navigator.usb.removeEventListener("disconnect",f),u._emitDisconnect(new d.DisconnectedDevice))},navigator.usb.addEventListener("disconnect",f),[2,u]}})})},c.prototype.close=function(){return h(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return[4,this.exchangeBusyPromise];case 1:return e.sent(),[4,this.device.releaseInterface(this.interfaceNumber)];case 2:return e.sent(),[4,_(this.device)];case 3:return e.sent(),[4,this.device.close()];case 4:return e.sent(),[2]}})})},c.prototype.exchange=function(e){return h(this,void 0,void 0,function(){var i,r=this;return v(this,function(n){switch(n.label){case 0:return[4,this.exchangeAtomicImpl(function(){return h(r,void 0,void 0,function(){var u,f,a,t,s,l,w,g,x,S;return v(this,function(b){switch(b.label){case 0:u=this,f=u.channel,a=u.packetSize,d.log("apdu","=> "+e.toString("hex")),t=d.createHIDframing(f,a),s=t.makeBlocks(e),l=0,b.label=1;case 1:return l<s.length?[4,this.device.transferOut(D,s[l])]:[3,4];case 2:b.sent(),b.label=3;case 3:return l++,[3,1];case 4:return(w=t.getReducedResult(g))?[3,6]:[4,this.device.transferIn(D,a)];case 5:return x=b.sent(),S=Buffer.from(x.data.buffer),g=t.reduceResponse(g,S),[3,4];case 6:return d.log("apdu","<= "+w.toString("hex")),[2,w]}})})}).catch(function(u){throw u&&u.message&&u.message.includes("disconnected")?(r._emitDisconnect(u),new d.DisconnectedDeviceDuringOperation(u.message)):u})];case 1:return i=n.sent(),[2,i]}})})},c.prototype.setScrambleKey=function(){},c.isSupported=T,c.list=y,c.listen=function(e){var i=!1;O().then(function(n){if(!i){var u=d.identifyUSBProductId(n.productId);e.next({type:"add",descriptor:n,deviceModel:u}),e.complete()}},function(n){window.DOMException&&n instanceof window.DOMException&&n.code===18?e.error(new d.TransportWebUSBGestureRequired(n.message)):e.error(new d.TransportOpenUserCancelled(n.message))});function r(){i=!0}return{unsubscribe:r}},c}(k);function _(o){return h(this,void 0,void 0,function(){var c;return v(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,o.reset()];case 1:return e.sent(),[3,3];case 2:return c=e.sent(),console.warn(c),[3,3];case 3:return[2]}})})}exports.default=N;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const N=require("semver");var y=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(o[i]=a[i])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),R={},A=function(r,t){R[r]=t},e=function(r){var t=function(n){y(o,n);function o(a,i,u){var c=n.call(this,a||r,u)||this;if(Object.setPrototypeOf(c,o.prototype),c.name=r,i)for(var d in i)c[d]=i[d];if(u&&L(u)&&"cause"in u&&!("cause"in c)){var v=u.cause;c.cause=v,"stack"in v&&(c.stack=c.stack+`
|
|
2
|
+
CAUSE: `+v.stack)}return c}return o}(Error);return t};function L(r){return typeof r=="object"}var C=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(o[i]=a[i])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();e("AccountNameRequired");e("AccountNotSupported");e("AmountRequired");e("BluetoothRequired");e("BtcUnmatchedApp");e("CantOpenDevice");e("CashAddrNotSupported");e("CurrencyNotSupported");e("DeviceAppVerifyNotSupported");e("DeviceGenuineSocketEarlyClose");e("DeviceNotGenuine");e("DeviceOnDashboardExpected");e("DeviceOnDashboardUnexpected");e("DeviceInOSUExpected");e("DeviceHalted");e("DeviceNameInvalid");e("DeviceSocketFail");e("DeviceSocketNoBulkStatus");var B=e("LockedDeviceError"),P=e("DisconnectedDevice"),w=e("DisconnectedDeviceDuringOperation");e("DeviceExtractOnboardingStateError");e("DeviceOnboardingStatePollingError");e("EnpointConfig");e("EthAppPleaseEnableContractData");e("FeeEstimationFailed");e("FirmwareNotRecognized");e("HardResetFail");e("InvalidXRPTag");e("InvalidAddress");e("InvalidAddressBecauseDestinationIsAlsoSource");e("LatestMCUInstalledError");e("UnknownMCU");e("LedgerAPIError");e("LedgerAPIErrorWithMessage");e("LedgerAPINotAvailable");e("ManagerAppAlreadyInstalled");e("ManagerAppRelyOnBTC");e("ManagerAppDepInstallRequired");e("ManagerAppDepUninstallRequired");e("ManagerDeviceLocked");e("ManagerFirmwareNotEnoughSpace");e("ManagerNotEnoughSpace");e("ManagerUninstallBTCDep");e("NetworkDown");e("NoAddressesFound");e("NotEnoughBalance");e("NotEnoughBalanceToDelegate");e("NotEnoughBalanceInParentAccount");e("NotEnoughSpendableBalance");e("NotEnoughBalanceBecauseDestinationNotCreated");e("NoAccessToCamera");e("NotEnoughGas");e("NotSupportedLegacyAddress");e("GasLessThanEstimate");e("PriorityFeeTooLow");e("PriorityFeeTooHigh");e("PriorityFeeHigherThanMaxFee");e("MaxFeeTooLow");e("PasswordsDontMatch");e("PasswordIncorrect");e("RecommendSubAccountsToEmpty");e("RecommendUndelegation");e("TimeoutTagged");e("UnexpectedBootloader");e("MCUNotGenuineToDashboard");e("RecipientRequired");e("UnavailableTezosOriginatedAccountReceive");e("UnavailableTezosOriginatedAccountSend");e("UpdateFetchFileFail");e("UpdateIncorrectHash");e("UpdateIncorrectSig");e("UpdateYourApp");e("UserRefusedDeviceNameChange");e("UserRefusedAddress");e("UserRefusedFirmwareUpdate");e("UserRefusedAllowManager");e("UserRefusedOnDevice");var b=e("TransportOpenUserCancelled"),M=e("TransportInterfaceNotAvailable");e("TransportRaceCondition");var F=e("TransportWebUSBGestureRequired");e("DeviceShouldStayInApp");e("WebsocketConnectionError");e("WebsocketConnectionFailed");e("WrongDeviceForAccount");e("WrongAppForCurrency");e("ETHAddressNonEIP");e("CantScanQRCode");e("FeeNotLoaded");e("FeeRequired");e("FeeTooHigh");e("DustLimit");e("PendingOperation");e("SyncError");e("PairingFailed");e("GenuineCheckFailed");e("LedgerAPI4xx");e("LedgerAPI5xx");e("FirmwareOrAppUpdateRequired");e("LanguageNotFound");e("NoDBPathGiven");e("DBWrongPassword");e("DBNotReset");var x;(function(r){r[r.Unknown=0]="Unknown",r[r.BleLocationServicesDisabled=1]="BleLocationServicesDisabled",r[r.BleBluetoothUnauthorized=2]="BleBluetoothUnauthorized",r[r.BleScanStartFailed=3]="BleScanStartFailed"})(x||(x={}));(function(r){C(t,r);function t(n,o){var a=r.call(this,o)||this;return a.name="HwTransportError",a.type=n,Object.setPrototypeOf(a,t.prototype),a}return t})(Error);var E=function(r){C(t,r);function t(n,o){var a=this,i="TransportError";return a=r.call(this,n||i)||this,a.name=i,a.message=n,a.stack=new Error().stack,a.id=o,a}return t}(Error);A("TransportError",function(r){return new E(r.message,r.id)});var g={ACCESS_CONDITION_NOT_FULFILLED:38916,ALGORITHM_NOT_SUPPORTED:38020,CLA_NOT_SUPPORTED:28160,CODE_BLOCKED:38976,CODE_NOT_INITIALIZED:38914,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,CONDITIONS_OF_USE_NOT_SATISFIED:27013,CONTRADICTION_INVALIDATION:38928,CONTRADICTION_SECRET_CODE_STATUS:38920,CUSTOM_IMAGE_BOOTLOADER:26159,CUSTOM_IMAGE_EMPTY:26158,FILE_ALREADY_EXISTS:27273,FILE_NOT_FOUND:37892,GP_AUTH_FAILED:25344,HALTED:28586,INCONSISTENT_FILE:37896,INCORRECT_DATA:27264,INCORRECT_LENGTH:26368,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,INVALID_KCV:38021,INVALID_OFFSET:37890,LICENSING:28482,LOCKED_DEVICE:21781,MAX_VALUE_REACHED:38992,MEMORY_PROBLEM:37440,MISSING_CRITICAL_PARAMETER:26624,NO_EF_SELECTED:37888,NOT_ENOUGH_MEMORY_SPACE:27268,OK:36864,PIN_REMAINING_ATTEMPTS:25536,REFERENCED_DATA_NOT_FOUND:27272,SECURITY_STATUS_NOT_SATISFIED:27010,TECHNICAL_PROBLEM:28416,UNKNOWN_APDU:27906,USER_REFUSED_ON_DEVICE:21761};function k(r){switch(r){case 26368:return"Incorrect length";case 26624:return"Missing critical parameter";case 27010:return"Security not satisfied (dongle locked or have invalid access rights)";case 27013:return"Condition of use not satisfied (denied by the user?)";case 27264:return"Invalid data received";case 27392:return"Invalid parameter received";case 21781:return"Locked device"}if(28416<=r&&r<=28671)return"Internal error, please report"}function m(r){var t=Object.keys(g).find(function(i){return g[i]===r})||"UNKNOWN_ERROR",n=k(r)||t,o=r.toString(16),a="Ledger device: ".concat(n," (0x").concat(o,")");if(r===g.LOCKED_DEVICE)throw new B(a);this.name="TransportStatusError",this.message=a,this.stack=new Error().stack,this.statusCode=r,this.statusText=t}m.prototype=new Error;A("TransportStatusError",function(r){return new m(r.statusCode)});var D=5;function G(r){var t=Buffer.alloc(2);return t.writeUInt16BE(r,0),t}var q={data:Buffer.alloc(0),dataLength:0,sequence:0},z=function(r,t){return{makeBlocks:function(n){var o=Buffer.concat([G(n.length),n]),a=t-5,i=Math.ceil(o.length/a);o=Buffer.concat([o,Buffer.alloc(i*a-o.length+1).fill(0)]);for(var u=[],c=0;c<i;c++){var d=Buffer.alloc(5);d.writeUInt16BE(r,0),d.writeUInt8(D,2),d.writeUInt16BE(c,3);var v=o.slice(c*a,(c+1)*a);u.push(Buffer.concat([d,v]))}return u},reduceResponse:function(n,o){var a=n||q,i=a.data,u=a.dataLength,c=a.sequence;if(o.readUInt16BE(0)!==r)throw new E("Invalid channel","InvalidChannel");if(o.readUInt8(2)!==D)throw new E("Invalid tag","InvalidTag");if(o.readUInt16BE(3)!==c)throw new E("Invalid sequence","InvalidSequence");n||(u=o.readUInt16BE(5)),c++;var d=o.slice(n?5:7);return i=Buffer.concat([i,d]),i.length>u&&(i=i.slice(0,u)),{data:i,dataLength:u,sequence:c}},getReducedResult:function(n){if(n&&n.dataLength===n.data.length)return n.data}}},_=function(){return _=Object.assign||function(r){for(var t,n=1,o=arguments.length;n<o;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a])}return r},_.apply(this,arguments)},f,s;(function(r){r.blue="blue",r.nanoS="nanoS",r.nanoSP="nanoSP",r.nanoX="nanoX",r.stax="stax"})(s||(s={}));var O=(f={},f[s.blue]={id:s.blue,productName:"Ledger Blue",productIdMM:0,legacyUsbProductId:0,usbOnly:!0,memorySize:480*1024,masks:[822083584,822149120],getBlockSize:function(r){return 4*1024}},f[s.nanoS]={id:s.nanoS,productName:"Ledger Nano S",productIdMM:16,legacyUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160],getBlockSize:function(r){var t;return N.lt((t=N.coerce(r))!==null&&t!==void 0?t:"","2.0.0")?4*1024:2*1024}},f[s.nanoSP]={id:s.nanoSP,productName:"Ledger Nano S Plus",productIdMM:80,legacyUsbProductId:5,usbOnly:!0,memorySize:1536*1024,masks:[856686592],getBlockSize:function(r){return 32}},f[s.nanoX]={id:s.nanoX,productName:"Ledger Nano X",productIdMM:64,legacyUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],getBlockSize:function(r){return 4*1024},bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]},f[s.stax]={id:s.stax,productName:"Ledger Stax",productIdMM:96,legacyUsbProductId:6,usbOnly:!1,memorySize:1536*1024,masks:[857735168],getBlockSize:function(r){return 32},bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]},f);s.blue,s.nanoS,s.nanoSP,s.nanoX,s.stax;var T=Object.values(O),j=11415,V=function(r){var t=T.find(function(a){return a.legacyUsbProductId===r});if(t)return t;var n=r>>8,o=T.find(function(a){return a.productIdMM===n});return o},H=[],U={};for(var W in O){var h=O[W],S=h.bluetoothSpec;if(S)for(var I=0;I<S.length;I++){var p=S[I];H.push(p.serviceUuid),U[p.serviceUuid]=U[p.serviceUuid.replace(/-/g,"")]=_({deviceModel:h},p)}}var X=0,l=[],K=function(r,t,n){var o={type:r,id:String(++X),date:new Date};t&&(o.message=t),Q(o)},Y=function(r){return l.push(r),function(){var t=l.indexOf(r);t!==-1&&(l[t]=l[l.length-1],l.pop())}};function Q(r){for(var t=0;t<l.length;t++)try{l[t](r)}catch(n){console.error(n)}}typeof window<"u"&&(window.__ledgerLogsListen=Y);exports.DisconnectedDevice=P;exports.DisconnectedDeviceDuringOperation=w;exports.TransportError=E;exports.TransportInterfaceNotAvailable=M;exports.TransportOpenUserCancelled=b;exports.TransportWebUSBGestureRequired=F;exports.createHIDframing=z;exports.identifyUSBProductId=V;exports.ledgerUSBVendorId=j;exports.log=K;
|