Files
pezkuwi-apps/modu.a8abe0ee63723dc1.js
T
github-actions[bot] f3ee114735 Updates
2026-01-18 03:14:49 +00:00

1 line
38 KiB
JavaScript

"use strict";(("undefined"!=typeof self?self:this).webpackChunk_pezkuwi_apps=("undefined"!=typeof self?self:this).webpackChunk_pezkuwi_apps||[]).push([[3602],{7087(e,r){var t;Object.defineProperty(r,"__esModule",{value:!0}),r.ERROR_DESCRIPTION_OVERRIDE=r.LedgerError=r.PAYLOAD_TYPE=r.LEDGER_DASHBOARD_CLA=r.HARDENED=void 0,r.HARDENED=2147483648,r.LEDGER_DASHBOARD_CLA=176,r.PAYLOAD_TYPE={INIT:0,ADD:1,LAST:2},function(e){e[e.U2FUnknown=1]="U2FUnknown",e[e.U2FBadRequest=2]="U2FBadRequest",e[e.U2FConfigurationUnsupported=3]="U2FConfigurationUnsupported",e[e.U2FDeviceIneligible=4]="U2FDeviceIneligible",e[e.U2FTimeout=5]="U2FTimeout",e[e.Timeout=14]="Timeout",e[e.GpAuthFailed=25344]="GpAuthFailed",e[e.PinRemainingAttempts=25536]="PinRemainingAttempts",e[e.ExecutionError=25600]="ExecutionError",e[e.WrongLength=26368]="WrongLength",e[e.IncorrectLength=26368]="IncorrectLength",e[e.MissingCriticalParameter=26624]="MissingCriticalParameter",e[e.ErrorDerivingKeys=26626]="ErrorDerivingKeys",e[e.EmptyBuffer=27010]="EmptyBuffer",e[e.SecurityStatusNotSatisfied=27010]="SecurityStatusNotSatisfied",e[e.OutputBufferTooSmall=27011]="OutputBufferTooSmall",e[e.DataIsInvalid=27012]="DataIsInvalid",e[e.ConditionsOfUseNotSatisfied=27013]="ConditionsOfUseNotSatisfied",e[e.CommandIncompatibleFileStructure=27009]="CommandIncompatibleFileStructure",e[e.TransactionRejected=27014]="TransactionRejected",e[e.BadKeyHandle=27264]="BadKeyHandle",e[e.IncorrectData=27264]="IncorrectData",e[e.ReferencedDataNotFound=27272]="ReferencedDataNotFound",e[e.NotEnoughMemorySpace=27268]="NotEnoughMemorySpace",e[e.FileAlreadyExists=27273]="FileAlreadyExists",e[e.InvalidP1P2=27392]="InvalidP1P2",e[e.IncorrectP1P2=27392]="IncorrectP1P2",e[e.InstructionNotSupported=27904]="InstructionNotSupported",e[e.InsNotSupported=27904]="InsNotSupported",e[e.UnknownApdu=27906]="UnknownApdu",e[e.DeviceNotOnboarded=27911]="DeviceNotOnboarded",e[e.DeviceNotOnboarded2=26129]="DeviceNotOnboarded2",e[e.CustomImageBootloader=26159]="CustomImageBootloader",e[e.CustomImageEmpty=26158]="CustomImageEmpty",e[e.AppDoesNotSeemToBeOpen=28161]="AppDoesNotSeemToBeOpen",e[e.ClaNotSupported=28160]="ClaNotSupported",e[e.Licensing=28482]="Licensing",e[e.UnknownError=28416]="UnknownError",e[e.TechnicalProblem=28416]="TechnicalProblem",e[e.SignVerifyError=28417]="SignVerifyError",e[e.Halted=28586]="Halted",e[e.NoErrors=36864]="NoErrors",e[e.DeviceIsBusy=36865]="DeviceIsBusy",e[e.UnknownTransportError=65535]="UnknownTransportError",e[e.AccessConditionNotFulfilled=38916]="AccessConditionNotFulfilled",e[e.AlgorithmNotSupported=38020]="AlgorithmNotSupported",e[e.CodeBlocked=38976]="CodeBlocked",e[e.CodeNotInitialized=38914]="CodeNotInitialized",e[e.ContradictionInvalidation=38928]="ContradictionInvalidation",e[e.ContradictionSecretCodeStatus=38920]="ContradictionSecretCodeStatus",e[e.InvalidKcv=38021]="InvalidKcv",e[e.InvalidOffset=37890]="InvalidOffset",e[e.LockedDevice=21781]="LockedDevice",e[e.MaxValueReached=38992]="MaxValueReached",e[e.MemoryProblem=37440]="MemoryProblem",e[e.NoEfSelected=37888]="NoEfSelected",e[e.InconsistentFile=37896]="InconsistentFile",e[e.FileNotFound=37892]="FileNotFound",e[e.UserRefusedOnDevice=21761]="UserRefusedOnDevice",e[e.NotEnoughSpace=20738]="NotEnoughSpace",e[e.GenericError=4294967295]="GenericError"}(t||(r.LedgerError=t={})),r.ERROR_DESCRIPTION_OVERRIDE={[t.U2FUnknown]:"U2F: Unknown",[t.U2FBadRequest]:"U2F: Bad request",[t.U2FConfigurationUnsupported]:"U2F: Configuration unsupported",[t.U2FDeviceIneligible]:"U2F: Device Ineligible",[t.U2FTimeout]:"U2F: Timeout",[t.Timeout]:"Timeout",[t.NoErrors]:"No errors",[t.DeviceIsBusy]:"Device is busy",[t.ErrorDerivingKeys]:"Error deriving keys",[t.ExecutionError]:"Execution Error",[t.WrongLength]:"Wrong Length",[t.EmptyBuffer]:"Empty Buffer",[t.OutputBufferTooSmall]:"Output buffer too small",[t.DataIsInvalid]:"Data is invalid",[t.TransactionRejected]:"Transaction rejected",[t.BadKeyHandle]:"Bad key handle",[t.InvalidP1P2]:"Invalid P1/P2",[t.InstructionNotSupported]:"Instruction not supported",[t.AppDoesNotSeemToBeOpen]:"App does not seem to be open",[t.UnknownError]:"Unknown error",[t.SignVerifyError]:"Sign/verify error",[t.UnknownTransportError]:"Unknown transport error",[t.GpAuthFailed]:"GP Authentication Failed",[t.PinRemainingAttempts]:"PIN Remaining Attempts",[t.MissingCriticalParameter]:"Missing Critical Parameter",[t.ConditionsOfUseNotSatisfied]:"Conditions of Use Not Satisfied",[t.CommandIncompatibleFileStructure]:"Command Incompatible with File Structure",[t.ReferencedDataNotFound]:"Referenced Data Not Found",[t.NotEnoughMemorySpace]:"Not Enough Memory Space",[t.FileAlreadyExists]:"File Already Exists",[t.UnknownApdu]:"Unknown APDU",[t.DeviceNotOnboarded]:"Device Not Onboarded",[t.DeviceNotOnboarded2]:"Device Not Onboarded (Secondary)",[t.CustomImageBootloader]:"Custom Image Bootloader Error",[t.CustomImageEmpty]:"Custom Image Empty",[t.ClaNotSupported]:"CLA Not Supported",[t.Licensing]:"Licensing Error",[t.Halted]:"Device Halted",[t.AccessConditionNotFulfilled]:"Access Condition Not Fulfilled",[t.AlgorithmNotSupported]:"Algorithm Not Supported",[t.CodeBlocked]:"Code Blocked",[t.CodeNotInitialized]:"Code Not Initialized",[t.ContradictionInvalidation]:"Contradiction Invalidation",[t.ContradictionSecretCodeStatus]:"Contradiction with Secret Code Status",[t.InvalidKcv]:"Invalid KCV",[t.InvalidOffset]:"Invalid Offset",[t.LockedDevice]:"Device Locked",[t.MaxValueReached]:"Maximum Value Reached",[t.MemoryProblem]:"Memory Problem",[t.NoEfSelected]:"No EF Selected",[t.InconsistentFile]:"Inconsistent File",[t.FileNotFound]:"File Not Found",[t.UserRefusedOnDevice]:"User Refused on Device",[t.NotEnoughSpace]:"Not Enough Space",[t.GenericError]:"Generic Error"}},9494(e,r,t){var n=t(1048).Buffer;Object.defineProperty(r,"__esModule",{value:!0}),r.SubstrateApp=void 0;const s=t(67744);class o{constructor(e,r,t){if(null==e)throw new Error("Transport has not been defined");this.transport=e,this.cla=r,this.slip0044=t}static serializePath(e,r,t,s){if(!Number.isInteger(r))throw new Error("Input must be an integer");if(!Number.isInteger(t))throw new Error("Input must be an integer");if(!Number.isInteger(s))throw new Error("Input must be an integer");const o=n.alloc(20);return o.writeUInt32LE(2147483692,0),o.writeUInt32LE(e,4),o.writeUInt32LE(r,8),o.writeUInt32LE(t,12),o.writeUInt32LE(s,16),o}static GetChunks(e){const r=[],t=n.from(e);for(let e=0;e<t.length;e+=s.CHUNK_SIZE){let n=e+s.CHUNK_SIZE;e>t.length&&(n=t.length),r.push(t.subarray(e,n))}return r}static signGetChunks(e,r,t,n,s){const a=[],i=o.serializePath(e,r,t,n);return a.push(i),a.push(...o.GetChunks(s)),a}async getVersion(){try{return await(0,s.getVersion)(this.transport,this.cla)}catch(e){return(0,s.processErrorResponse)(e)}}async appInfo(){return await this.transport.send(176,1,0,0).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];let n="",o="",a=0,i=0;if(1!==e[0])return{return_code:36865,error_message:"response format ID not recognized"};{const r=e[1];n=e.subarray(2,2+r).toString("ascii");let t=2+r;const s=e[t];t+=1,o=e.subarray(t,t+s).toString("ascii"),t+=s;const d=e[t];t+=1,a=d,i=e[t]}return{return_code:t,error_message:(0,s.errorCodeToString)(t),appName:""===n||"err",appVersion:""===o||"err",flagLen:a,flagsValue:i,flag_recovery:!!(1&i),flag_signed_mcu_code:!!(2&i),flag_onboarded:!!(4&i),flag_pin_validated:!!(128&i)}},s.processErrorResponse)}async getAddress(e,r,t,n=!1,a=0){const i=o.serializePath(this.slip0044,e,r,t);let d=0;n&&(d=1);let c=0;return isNaN(a)||(c=a),await this.transport.send(this.cla,1,d,c,i).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];let n=32;return 2==a&&(n=33),{pubKey:e.subarray(0,n).toString("hex"),address:e.subarray(n,e.length-2).toString("ascii"),return_code:t,error_message:(0,s.errorCodeToString)(t)}},s.processErrorResponse)}async signSendChunk(e,r,t,n=0,o=2){let a=1;1===e&&(a=0),e===r&&(a=2);let i=0;return isNaN(n)||(i=n),await this.transport.send(this.cla,o,a,i,t,[36864,27012,27264]).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];let n=(0,s.errorCodeToString)(t),o=null;return 27264===t||27012===t?n=e.subarray(0,e.length-2).toString("ascii"):e.length>2&&(o=e.subarray(0,e.length-2)),{signature:o,return_code:t,error_message:n}},s.processErrorResponse)}async signImpl(e,r,t,n,a,i=0){const d=o.signGetChunks(this.slip0044,e,r,t,n);return await this.signSendChunk(1,d.length,d[0],i,a).then(async()=>{let e;for(let r=1;r<d.length&&(e=await this.signSendChunk(1+r,d.length,d[r],i,a),36864===e.return_code);r+=1);return{return_code:e.return_code,error_message:e.error_message,signature:e.signature}},s.processErrorResponse)}async sign(e,r,t,n,s=0){return await this.signImpl(e,r,t,n,2,s)}async signRaw(e,r,t,n,s=0){return await this.signImpl(e,r,t,n,3,s)}async getAllowlistPubKey(){return await this.transport.send(this.cla,144,0,0).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];console.log(e);const n=e.subarray(0,32);return 34!==e.length?{return_code:27012,error_message:(0,s.errorCodeToString)(27012)}:{return_code:t,error_message:(0,s.errorCodeToString)(t),pubkey:n}},s.processErrorResponse)}async setAllowlistPubKey(e){return await this.transport.send(this.cla,145,0,0,e).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];return{return_code:t,error_message:(0,s.errorCodeToString)(t)}},s.processErrorResponse)}async getAllowlistHash(){return await this.transport.send(this.cla,146,0,0).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];console.log(e);const n=e.subarray(0,32);return 34!==e.length?{return_code:27012,error_message:(0,s.errorCodeToString)(27012)}:{return_code:t,error_message:(0,s.errorCodeToString)(t),hash:n}},s.processErrorResponse)}async uploadSendChunk(e,r,t){let n=1;return 1===e&&(n=0),e===r&&(n=2),await this.transport.send(this.cla,147,n,0,t,[36864]).then(e=>{const r=e.subarray(-2),t=256*r[0]+r[1];return{return_code:t,error_message:(0,s.errorCodeToString)(t)}},s.processErrorResponse)}async uploadAllowlist(e){const r=[];return r.push(n.from([0])),r.push(...o.GetChunks(e)),await this.uploadSendChunk(1,r.length,r[0]).then(async e=>{if(36864!==e.return_code)return{return_code:e.return_code,error_message:e.error_message};for(let t=1;t<r.length&&36864===(e=await this.uploadSendChunk(1+t,r.length,r[t])).return_code;t+=1);return{return_code:e.return_code,error_message:e.error_message}},s.processErrorResponse)}}r.SubstrateApp=o},12907(e,r,t){var n=this&&this.__createBinding||(Object.create?function(e,r,t,n){void 0===n&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);s&&!("get"in s?!r.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]}),s=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});const a=o(t(37456));r.default=a.default,s(t(75474),r),s(t(7087),r),s(t(79005),r),s(t(94765),r),s(t(86108),r),s(t(68593),r)},14706(e,r,t){t.d(r,{A:()=>s});const n={}.hasOwnProperty;function s(e,r){const t=r||{};function s(r,...t){let o=s.invalid;const a=s.handlers;if(r&&n.call(r,e)){const t=String(r[e]);o=n.call(a,t)?a[t]:s.unknown}if(o)return o.call(this,r,...t)}return s.handlers=t.handlers||{},s.invalid=t.invalid,s.unknown=t.unknown,s}},14884(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.errorCodeToString=function(e,r){let t=`Unknown Return Code: 0x${e.toString(16).toUpperCase()}`;return e in n.ERROR_DESCRIPTION_OVERRIDE?n.ERROR_DESCRIPTION_OVERRIDE[e]:r&&e in r?r[e]:t};const n=t(7087)},17716(e,r,t){var n,s=t(1048).Buffer,o=this&&this.__createBinding||(Object.create?function(e,r,t,n){void 0===n&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);s&&!("get"in s?!r.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]}),a=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),i=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var r=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[r.length]=t);return r},n(e)},function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t=n(e),s=0;s<t.length;s++)"default"!==t[s]&&o(r,e,t[s]);return a(r,e),r}),d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.PolkadotGenericApp=void 0;const c=d(t(47764)),u=i(t(12907)),p=t(67744);class l extends u.default{constructor(e,r,t){if(super(e,l._params),this.txMetadataSrvUrl=t,this.txMetadataChainId=r,!this.transport)throw new Error("Transport has not been defined")}async getTxMetadata(e,r,t){const n=r??this.txMetadataChainId,o=t??this.txMetadataSrvUrl;if(!n)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataSrvUrl is not defined or is empty. The use of the method requires access to a metadata shortening service.");if(!o)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataChainId is not defined or is empty. These values are configured in the metadata shortening service. Check the corresponding configuration in the service.");let a=(await c.default.post(o,{txBlob:e.toString("hex"),chain:{id:n}})).data.txMetadata;return"0x"===a.slice(0,2)&&(a=a.slice(2)),s.from(a,"hex")}async getAddress(e,r,t=!1,n=0){if(!Number.isInteger(r)||r<0||r>>16)throw new u.ResponseError(u.LedgerError.ConditionsOfUseNotSatisfied,`Unexpected ss58prefix ${r}. Needs to be a non-negative integer up to 2^16`);if(2!=n&&0!=n)throw new u.ResponseError(u.LedgerError.ConditionsOfUseNotSatisfied,`Unexpected scheme ${n}. Needs to be ECDSA (2) or ED25519 (0)`);const o=this.serializePath(e),a=s.alloc(2);a.writeUInt16LE(r);let i=o;0===n&&(i=s.concat([i,a]));const d=t?1:0;try{const e=await this.transport.send(this.CLA,this.INS.GET_ADDR,d,n??0,i),r=(0,u.processResponse)(e),t=n??0,s=2===t?p.ECDSA_PUBKEY_LEN:p.ED25519_PUBKEY_LEN,o=r.readBytes(s).toString("hex");let a="";return a=2===t?r.readBytes(r.length()).toString("hex"):r.readBytes(r.length()).toString("ascii"),{pubKey:o,address:a}}catch(e){throw(0,u.processErrorResponse)(e)}}async getAddressEcdsa(e,r=!1){return this.getAddress(e,0,r,2)}async getAddressEd25519(e,r,t=!1){return this.getAddress(e,r,t)}splitBufferToChunks(e,r){const t=[],n=s.from(e);for(let e=0;e<n.length;e+=r){let s=e+r;e>n.length&&(s=n.length),t.push(n.subarray(e,s))}return t}getSignReqChunks(e,r,t){const n=[],o=this.serializePath(e),a=s.alloc(2);return a.writeUInt16LE(r.length),n.push(s.concat([o,a])),null==t?n.push(...this.splitBufferToChunks(r,this.CHUNK_SIZE)):n.push(...this.splitBufferToChunks(s.concat([r,t]),this.CHUNK_SIZE)),n}async signImplEd25519(e,r,t,n){const s=this.getSignReqChunks(e,t,n);try{let e=await this.sendGenericChunk(r,0,1,s.length,s[0]);for(let t=1;t<s.length;t+=1)e=await this.sendGenericChunk(r,0,1+t,s.length,s[t]);return{signature:e.readBytes(e.length())}}catch(e){throw(0,u.processErrorResponse)(e)}}async signImplEcdsa(e,r,t,n){const s=this.getSignReqChunks(e,t,n);try{let e=await this.sendGenericChunk(r,2,1,s.length,s[0]);for(let t=1;t<s.length;t+=1)e=await this.sendGenericChunk(r,2,1+t,s.length,s[t]);return{r:e.readBytes(32),s:e.readBytes(32),v:e.readBytes(1)}}catch(e){throw(0,u.processErrorResponse)(e)}}async sign(e,r,t=0){if(2!=t&&0!=t)throw new u.ResponseError(u.LedgerError.ConditionsOfUseNotSatisfied,`Unexpected scheme ${t}. Needs to be ECDSA (2) or ED25519 (0)`);return 2===t?await this.signEcdsa(e,r):await this.signEd25519(e,r)}async signEd25519(e,r){if(!this.txMetadataSrvUrl)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataSrvUrl is not defined or is empty. The use of the method requires access to a metadata shortening service.");if(!this.txMetadataChainId)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataChainId is not defined or is empty. These values are configured in the metadata shortening service. Check the corresponding configuration in the service.");const t=await this.getTxMetadata(r);return await this.signImplEd25519(e,this.INS.SIGN,r,t)}async signEcdsa(e,r){if(!this.txMetadataSrvUrl)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataSrvUrl is not defined or is empty. The use of the method requires access to a metadata shortening service.");if(!this.txMetadataChainId)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataChainId is not defined or is empty. These values are configured in the metadata shortening service. Check the corresponding configuration in the service.");const t=await this.getTxMetadata(r);return await this.signImplEcdsa(e,this.INS.SIGN,r,t)}async signMigration(e,r,t,n){if(!this.txMetadataSrvUrl)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataSrvUrl is not defined or is empty. The use of the method requires access to a metadata shortening service.");if(!this.txMetadataChainId)throw new u.ResponseError(u.LedgerError.GenericError,"txMetadataChainId is not defined or is empty. These values are configured in the metadata shortening service. Check the corresponding configuration in the service.");const s=await this.getTxMetadata(r,t,n);return await this.signImplEd25519(e,this.INS.SIGN,r,s)}async signRaw(e,r,t=0){if(2!=t&&0!=t)throw new u.ResponseError(u.LedgerError.ConditionsOfUseNotSatisfied,`Unexpected scheme ${t}. Needs to be ECDSA (2) or ED25519 (0)`);return 2===t?await this.signRawEcdsa(e,r):await this.signRawEd25519(e,r)}async signRawEd25519(e,r){return await this.signImplEd25519(e,this.INS.SIGN_RAW,r)}async signRawEcdsa(e,r){return await this.signImplEcdsa(e,this.INS.SIGN_RAW,r)}async signWithMetadata(e,r,t,n){if(2!=n&&0!=n)throw new u.ResponseError(u.LedgerError.ConditionsOfUseNotSatisfied,`Unexpected scheme ${n}. Needs to be ECDSA (2) or ED25519 (0)`);return 2===n?await this.signWithMetadataEcdsa(e,r,t):await this.signWithMetadataEd25519(e,r,t)}async signWithMetadataEcdsa(e,r,t){return await this.signImplEcdsa(e,this.INS.SIGN,r,t)}async signWithMetadataEd25519(e,r,t){return await this.signImplEd25519(e,this.INS.SIGN,r,t)}}r.PolkadotGenericApp=l,l._INS={GET_VERSION:0,GET_ADDR:1,SIGN:2,SIGN_RAW:3},l._params={cla:249,ins:{...l._INS},p1Values:{ONLY_RETRIEVE:0,SHOW_ADDRESS_IN_DEVICE:1},chunkSize:250,requiredPathLengths:[5]}},32849(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.newKusamaApp=function(e){return(0,n.newSubstrateApp)(e,"Kusama")},r.newPolkadotApp=function(e){return(0,n.newSubstrateApp)(e,"Polkadot")},r.newPolymeshApp=function(e){return(0,n.newSubstrateApp)(e,"Polymesh")},r.newDockApp=function(e){return(0,n.newSubstrateApp)(e,"Dock")},r.newCentrifugeApp=function(e){return(0,n.newSubstrateApp)(e,"Centrifuge")},r.newEdgewareApp=function(e){return(0,n.newSubstrateApp)(e,"Edgeware")},r.newEquilibriumApp=function(e){return(0,n.newSubstrateApp)(e,"Equilibrium")},r.newGenshiroApp=function(e){return(0,n.newSubstrateApp)(e,"Genshiro")},r.newStatemintApp=function(e){return(0,n.newSubstrateApp)(e,"Statemint")},r.newStatemineApp=function(e){return(0,n.newSubstrateApp)(e,"Statemine")},r.newNodleApp=function(e){return(0,n.newSubstrateApp)(e,"Nodle")},r.newSoraApp=function(e){return(0,n.newSubstrateApp)(e,"Sora")},r.newPolkadexApp=function(e){return(0,n.newSubstrateApp)(e,"Polkadex")},r.newBifrostApp=function(e){return(0,n.newSubstrateApp)(e,"Bifrost")},r.newKaruraApp=function(e){return(0,n.newSubstrateApp)(e,"Karura")},r.newReefApp=function(e){return(0,n.newSubstrateApp)(e,"Reef")},r.newAcalaApp=function(e){return(0,n.newSubstrateApp)(e,"Acala")},r.newXXNetworkApp=function(e){return(0,n.newSubstrateApp)(e,"XXNetwork")},r.newParallelApp=function(e){return(0,n.newSubstrateApp)(e,"Parallel")},r.newAstarApp=function(e){return(0,n.newSubstrateApp)(e,"Astar")},r.newComposableApp=function(e){return(0,n.newSubstrateApp)(e,"Composable")},r.newStafiApp=function(e){return(0,n.newSubstrateApp)(e,"Stafi")},r.newAlephZeroApp=function(e){return(0,n.newSubstrateApp)(e,"AlephZero")},r.newInterlayApp=function(e){return(0,n.newSubstrateApp)(e,"Interlay")},r.newUniqueApp=function(e){return(0,n.newSubstrateApp)(e,"Unique")},r.newBifrostKusamaApp=function(e){return(0,n.newSubstrateApp)(e,"BifrostKusama")};const n=t(66342)},37456(e,r,t){var n=t(1048).Buffer;Object.defineProperty(r,"__esModule",{value:!0});const s=t(94765),o=t(75474),a=t(7087),i=t(86108);r.default=class{constructor(e,r){if(null==e)throw new Error("Transport has not been defined");this.transport=e,this.CLA=r.cla,this.INS=r.ins,this.P1_VALUES=r.p1Values,this.CHUNK_SIZE=r.chunkSize,this.REQUIRED_PATH_LENGTHS=r.acceptedPathLengths,this.CUSTOM_APP_ERROR_DESCRIPTION=r.customAppErrorDescription}serializePath(e){return(0,s.serializePath)(e,this.REQUIRED_PATH_LENGTHS)}prepareChunks(e,r){const t=this.serializePath(e),n=this.messageToChunks(r);return n.unshift(t),n}messageToChunks(e){const r=[],t=n.from(e);for(let e=0;e<t.length;e+=this.CHUNK_SIZE){const n=Math.min(e+this.CHUNK_SIZE,t.length);r.push(t.subarray(e,n))}return r}async sendGenericChunk(e,r,t,s,i){let d=a.PAYLOAD_TYPE.ADD;1===t&&(d=a.PAYLOAD_TYPE.INIT),t===s&&(d=a.PAYLOAD_TYPE.LAST);const c=[a.LedgerError.NoErrors,a.LedgerError.DataIsInvalid,a.LedgerError.BadKeyHandle];try{const t=await this.transport.send(this.CLA,e,d,r,i,c);return(0,o.processResponse)(t,this.CUSTOM_APP_ERROR_DESCRIPTION)}catch(e){const r=e.statusCode||e.returnCode||a.LedgerError.UnknownTransportError,t=e.message;let s;if(t?.length>0){const e=n.from(t,"utf8");s=n.concat([e,n.allocUnsafe(2)]),s.writeUInt16BE(r,s.length-2)}else s=n.allocUnsafe(2),s.writeUInt16BE(r,0);return(0,o.processResponse)(s,this.CUSTOM_APP_ERROR_DESCRIPTION)}}async signSendChunk(e,r,t,n){return this.sendGenericChunk(e,0,r,t,n)}async getVersion(){try{const e=await this.transport.send(this.CLA,this.INS.GET_VERSION,0,0),r=(0,o.processResponse)(e,this.CUSTOM_APP_ERROR_DESCRIPTION);let t,n,s,d;if(5===r.length()||9===r.length())t=0!==r.readBytes(1).readUInt8(),n=r.readBytes(1).readUInt8(),s=r.readBytes(1).readUInt8(),d=r.readBytes(1).readUInt8();else if(8===r.length()||12===r.length())t=0!==r.readBytes(1).readUInt8(),n=r.readBytes(2).readUInt16BE(),s=r.readBytes(2).readUInt16BE(),d=r.readBytes(2).readUInt16BE();else{if(14!==r.length()&&18!==r.length())throw new i.ResponseError(a.LedgerError.TechnicalProblem,"Invalid response length");t=0!==r.readBytes(1).readUInt8(),n=r.readBytes(4).readUInt32BE(),s=r.readBytes(4).readUInt32BE(),d=r.readBytes(4).readUInt32BE()}const c=1===r.readBytes(1).readUInt8();let u="";return r.length()>=4&&(u=r.readBytes(4).readUInt32BE().toString(16).padStart(8,"0")),{testMode:t,major:n,minor:s,patch:d,deviceLocked:c,targetId:u}}catch(e){throw(0,o.processErrorResponse)(e)}}async appInfo(){try{const e=await this.transport.send(a.LEDGER_DASHBOARD_CLA,1,0,0),r=(0,o.processResponse)(e,this.CUSTOM_APP_ERROR_DESCRIPTION);if(1!==r.readBytes(1).readUInt8())throw new i.ResponseError(a.LedgerError.TechnicalProblem,"Format ID not recognized");const t=r.readBytes(1).readUInt8(),n=r.readBytes(t).toString("ascii"),s=r.readBytes(1).readUInt8(),d=r.readBytes(s).toString("ascii"),c=r.readBytes(1).readUInt8(),u=r.readBytes(c).readUInt8();return{appName:n,appVersion:d,flagLen:c,flagsValue:u,flagRecovery:!!(1&u),flagSignedMcuCode:!!(2&u),flagOnboarded:!!(4&u),flagPINValidated:!!(128&u)}}catch(e){throw(0,o.processErrorResponse)(e)}}async deviceInfo(){try{const e=await this.transport.send(224,1,0,0,n.from([]),[a.LedgerError.NoErrors,28160]),r=(0,o.processResponse)(e,this.CUSTOM_APP_ERROR_DESCRIPTION),t=r.readBytes(4).toString("hex"),s=r.readBytes(1).readUInt8(),i=r.readBytes(s).toString(),d=r.readBytes(1).readUInt8(),c=r.readBytes(d).toString("hex"),u=r.readBytes(1).readUInt8();let p=r.readBytes(u);const l=p.indexOf(0);return-1!==l&&(p=p.subarray(0,l)),{targetId:t,seVersion:i,flag:c,mcuVersion:p.toString()}}catch(e){throw(0,o.processErrorResponse)(e)}}}},39385(e,r,t){var n=this&&this.__createBinding||(Object.create?function(e,r,t,n){void 0===n&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);s&&!("get"in s?!r.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]}),s=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.supportedApps=r.newSubstrateApp=r.SubstrateApp=void 0,s(t(32849),r),s(t(17716),r),s(t(40400),r);var o=t(9494);Object.defineProperty(r,"SubstrateApp",{enumerable:!0,get:function(){return o.SubstrateApp}});var a=t(66342);Object.defineProperty(r,"newSubstrateApp",{enumerable:!0,get:function(){return a.newSubstrateApp}}),Object.defineProperty(r,"supportedApps",{enumerable:!0,get:function(){return a.supportedApps}})},40400(e,r,t){var n=t(1048).Buffer;Object.defineProperty(r,"__esModule",{value:!0}),r.PolkadotGenericAppLegacy=void 0;const s=t(12907),o=t(17716);r.PolkadotGenericAppLegacy=class{constructor(e,r,t,n){this.genericApp=new o.PolkadotGenericApp(e,t,n),this.ss58prefix=r}convertToLegacyError(e){return{error_message:e.errorMessage,return_code:e.returnCode}}convertLegacyPath(e,r,t){return(0,s.numbersToBip32Path)([2147483692,2147484002,e,r,t])}async getVersion(){try{const e=await this.genericApp.getVersion();return{...this.convertToLegacyError(s.ResponseError.fromReturnCode(s.LedgerError.NoErrors)),major:e.major??0,minor:e.minor??0,patch:e.patch??0,device_locked:e.deviceLocked??!1,test_mode:e.testMode??!1}}catch(e){return{device_locked:!1,major:0,minor:0,patch:0,test_mode:!1,...this.convertToLegacyError(e)}}}async appInfo(){try{const e=await this.genericApp.appInfo();return{...this.convertToLegacyError(s.ResponseError.fromReturnCode(s.LedgerError.NoErrors)),...e}}catch(e){return{...this.convertToLegacyError(e)}}}async getAddress(e,r,t,n,o){if(0!==o)throw s.ResponseError.fromReturnCode(s.LedgerError.AlgorithmNotSupported);try{const o=this.convertLegacyPath(e,r,t),a=await this.genericApp.getAddress(o,this.ss58prefix,n);return{...this.convertToLegacyError(s.ResponseError.fromReturnCode(s.LedgerError.NoErrors)),...a}}catch(e){return{address:"ERROR",pubKey:"ERROR",...this.convertToLegacyError(e)}}}async sign(e,r,t,o,a){try{if(0!==a)throw s.ResponseError.fromReturnCode(s.LedgerError.AlgorithmNotSupported);const n=this.convertLegacyPath(e,r,t),i=await this.genericApp.signEd25519(n,o);return{...this.convertToLegacyError(s.ResponseError.fromReturnCode(s.LedgerError.NoErrors)),...i}}catch(e){const r=this.convertToLegacyError(e);return{signature:n.alloc(0),...r}}}async signRaw(e,r,t,o,a){try{if(0!==a)throw s.ResponseError.fromReturnCode(s.LedgerError.AlgorithmNotSupported);const n=this.convertLegacyPath(e,r,t),i=await this.genericApp.signRawEd25519(n,o);return{...this.convertToLegacyError(s.ResponseError.fromReturnCode(s.LedgerError.NoErrors)),...i}}catch(e){const r=this.convertToLegacyError(e);return{signature:n.alloc(0),...r}}}}},45397(e,r,t){var n=t(1048).Buffer;Object.defineProperty(r,"__esModule",{value:!0}),r.ByteStream=void 0;const s=t(7087),o=t(86108);r.ByteStream=class{constructor(e){this.readOffset=0,this.writeOffset=0,this.internalBuffer=e?n.from(e):n.alloc(0),this.readOffset=0,this.writeOffset=this.internalBuffer.length}appendUint8(e){const r=n.from([e]);this.appendBytes(r)}appendUint16(e){const r=n.alloc(2);r.writeUInt16LE(e,0),this.appendBytes(r)}appendUint32(e){const r=n.alloc(4);r.writeUInt32LE(e,0),this.appendBytes(r)}appendUint64(e){const r=n.alloc(8);r.writeBigUInt64LE(e,0),this.appendBytes(r)}readBytes(e){if(this.readOffset+e>this.internalBuffer.length)throw new o.ResponseError(s.LedgerError.UnknownError,"Attempt to read beyond buffer length");const r=this.internalBuffer.subarray(this.readOffset,this.readOffset+e);return this.readOffset+=e,r}readBytesAt(e,r){if(r+e>this.internalBuffer.length)throw new o.ResponseError(s.LedgerError.UnknownError,"Attempt to read beyond buffer length");return this.internalBuffer.subarray(r,r+e)}appendBytes(e){if(this.writeOffset+e.length>this.internalBuffer.length){const r=n.alloc(this.writeOffset+e.length);this.internalBuffer.copy(r,0,0,this.writeOffset),this.internalBuffer=r}e.copy(this.internalBuffer,this.writeOffset),this.writeOffset+=e.length}insertBytesAt(e,r){if(r>this.internalBuffer.length){const t=n.alloc(r-this.internalBuffer.length,0);this.internalBuffer=n.concat([this.internalBuffer,t,e])}else{const t=this.internalBuffer.subarray(0,r),s=this.internalBuffer.subarray(r);this.internalBuffer=n.concat([t,e,s])}}writeBytesAt(e,r){if(r+e.length>this.internalBuffer.length){const t=n.alloc(r+e.length);this.internalBuffer.copy(t,0,0,r),this.internalBuffer=t}e.copy(this.internalBuffer,r),this.writeOffset=r+e.length}skipBytes(e){if(this.readOffset+e>this.internalBuffer.length)throw new o.ResponseError(s.LedgerError.UnknownError,"Attempt to skip beyond buffer length");this.readOffset+=e}clear(){this.internalBuffer=n.alloc(0),this.readOffset=0,this.writeOffset=0}resetOffset(){this.readOffset=0,this.writeOffset=0}getCompleteBuffer(){return n.from(this.internalBuffer)}getAvailableBuffer(){return n.from(this.internalBuffer.subarray(this.readOffset))}length(){return this.internalBuffer.length-this.readOffset}capacity(){return this.internalBuffer.length}getReadOffset(){return this.readOffset}getWriteOffset(){return this.writeOffset}setReadOffset(e){if(e<0||e>this.internalBuffer.length)throw new o.ResponseError(s.LedgerError.UnknownError,"Invalid read offset");this.readOffset=e}setWriteOffset(e){if(e<0||e>this.internalBuffer.length)throw new o.ResponseError(s.LedgerError.UnknownError,"Invalid write offset");this.writeOffset=e}}},66342(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.supportedApps=void 0,r.newSubstrateApp=function(e,t){const s=r.supportedApps.find(e=>e.name.toLowerCase()===t.toLowerCase());if(null!=s)return new n.SubstrateApp(e,s.cla,s.slip0044);throw new Error(`Error: ${t} not supported`)},r.getAppParams=function(e){return r.supportedApps.find(r=>r.name.toLowerCase()===e.toLowerCase())};const n=t(9494);r.supportedApps=[{name:"Polkadot",cla:144,slip0044:2147484002,ss58_addr_type:0},{name:"Polymesh",cla:145,slip0044:2147484243,ss58_addr_type:12},{name:"Dock",cla:146,slip0044:2147484242,ss58_addr_type:22},{name:"Centrifuge",cla:147,slip0044:2147484395,ss58_addr_type:36},{name:"Edgeware",cla:148,slip0044:2147484171,ss58_addr_type:7},{name:"Equilibrium",cla:149,slip0044:2247483645,ss58_addr_type:67},{name:"Statemint",cla:150,slip0044:2147484002,ss58_addr_type:0},{name:"Statemine",cla:151,slip0044:2147484082,ss58_addr_type:2},{name:"Nodle",cla:152,slip0044:2147484651,ss58_addr_type:37},{name:"Kusama",cla:153,slip0044:2147484082,ss58_addr_type:2},{name:"Karura",cla:154,slip0044:2147484334,ss58_addr_type:8},{name:"Acala",cla:155,slip0044:2147484435,ss58_addr_type:10},{name:"VTB",cla:156,slip0044:2147484342,ss58_addr_type:42},{name:"Peer",cla:157,slip0044:2147484366,ss58_addr_type:42},{name:"Genshiro",cla:158,slip0044:2247483644,ss58_addr_type:67},{name:"Sora",cla:159,slip0044:2147484265,ss58_addr_type:69},{name:"Polkadex",cla:160,slip0044:2147484447,ss58_addr_type:88},{name:"Bifrost",cla:161,slip0044:2147484436,ss58_addr_type:6},{name:"Reef",cla:162,slip0044:2147484467,ss58_addr_type:42},{name:"XXNetwork",cla:163,slip0044:2147485603,ss58_addr_type:55},{name:"AlephZero",cla:164,slip0044:2147484291,ss58_addr_type:42},{name:"Interlay",cla:165,slip0044:2147484002,ss58_addr_type:2032},{name:"Parallel",cla:166,slip0044:2147484002,ss58_addr_type:172},{name:"Picasso",cla:167,slip0044:2147484082,ss58_addr_type:49},{name:"Composable",cla:168,slip0044:2147484002,ss58_addr_type:49},{name:"Astar",cla:169,slip0044:2147484458,ss58_addr_type:5},{name:"OriginTrail",cla:170,slip0044:2147484002,ss58_addr_type:101},{name:"HydraDX",cla:171,slip0044:2147484002,ss58_addr_type:63},{name:"Stafi",cla:172,slip0044:2147484555,ss58_addr_type:20},{name:"Unique",cla:173,slip0044:2147484309,ss58_addr_type:7391},{name:"BifrostKusama",cla:174,slip0044:2147484436,ss58_addr_type:6},{name:"Phala",cla:175,slip0044:2147484002,ss58_addr_type:30},{name:"Khala",cla:177,slip0044:2147484082,ss58_addr_type:30},{name:"Darwinia",cla:178,slip0044:2147484002,ss58_addr_type:18},{name:"Ajuna",cla:179,slip0044:2147484002,ss58_addr_type:1328},{name:"Bittensor",cla:180,slip0044:2147484653,ss58_addr_type:42},{name:"Ternoa",cla:181,slip0044:2147484643,ss58_addr_type:42},{name:"Pendulum",cla:182,slip0044:2147484002,ss58_addr_type:56},{name:"Zeitgeist",cla:183,slip0044:2147484002,ss58_addr_type:73},{name:"Joystream",cla:184,slip0044:2147484185,ss58_addr_type:126},{name:"Enjin",cla:185,slip0044:2147484803,ss58_addr_type:2135},{name:"Matrixchain",cla:186,slip0044:2147484803,ss58_addr_type:1110},{name:"Quartz",cla:187,slip0044:2147484279,ss58_addr_type:255},{name:"Avail",cla:188,slip0044:2147484357,ss58_addr_type:42},{name:"Entropy",cla:189,slip0044:2147484960,ss58_addr_type:42},{name:"Peaq",cla:97,slip0044:2147483708,ss58_addr_type:42},{name:"AvailRecovery",cla:190,slip0044:2147484002,ss58_addr_type:42}]},67744(e,r,t){var n=t(1048).Buffer;function s(e){return e in r.ERROR_DESCRIPTION?r.ERROR_DESCRIPTION[e]:`Unknown Status Code: ${e}`}function o(e){if(null!=e){if(!("object"!=typeof(r=e)||null===r||r instanceof Array||r instanceof Date)){if(Object.prototype.hasOwnProperty.call(e,"returnCode"))return{return_code:e.returnCode,error_message:s(e.returnCode)};if(Object.prototype.hasOwnProperty.call(e,"statusCode"))return{return_code:e.statusCode,error_message:s(e.statusCode)};if(Object.prototype.hasOwnProperty.call(e,"return_code")&&Object.prototype.hasOwnProperty.call(e,"error_message"))return e}return{return_code:65535,error_message:e.toString()}}var r;return{return_code:65535,error_message:e.toString()}}Object.defineProperty(r,"__esModule",{value:!0}),r.ERROR_DESCRIPTION=r.ECDSA_PUBKEY_LEN=r.ED25519_PUBKEY_LEN=r.CHUNK_SIZE=void 0,r.errorCodeToString=s,r.processErrorResponse=o,r.getVersion=async function(e,r){try{const t=await e.send(r,0,0,0),n=t.subarray(-2),o=256*n[0]+n[1];if(14!==t.length&&20!==t.length)return{return_code:27012,error_message:s(27012)};let a,i,d,c,u;return 14===t.length?(a=t.readUInt16BE(1),i=t.readUInt16BE(3),d=t.readUInt16BE(5),c=1===t[7],u=(t[8]<<24)+(t[9]<<16)+(t[10]<<8)+(0|t[11])):(a=t.readUInt32BE(1),i=t.readUInt32BE(5),d=t.readUInt32BE(9),c=1===t[13],u=(t[14]<<24)+(t[15]<<16)+(t[16]<<8)+(0|t[17])),{return_code:o,error_message:s(o),test_mode:0!==t[0],major:a,minor:i,patch:d,deviceLocked:c,target_id:u.toString(16)}}catch(e){return o(e)}},r.serializePath=function(e,r,t,s){if(!Number.isInteger(r))throw new Error("Input must be an integer");if(!Number.isInteger(t))throw new Error("Input must be an integer");if(!Number.isInteger(s))throw new Error("Input must be an integer");const o=n.alloc(20);return o.writeUInt32LE(2147483692,0),o.writeUInt32LE(e,4),o.writeUInt32LE(r,8),o.writeUInt32LE(t,12),o.writeUInt32LE(s,16),o},r.CHUNK_SIZE=250,r.ED25519_PUBKEY_LEN=32,r.ECDSA_PUBKEY_LEN=33,r.ERROR_DESCRIPTION={1:"U2F: Unknown",2:"U2F: Bad request",3:"U2F: Configuration unsupported",4:"U2F: Device Ineligible",5:"U2F: Timeout",14:"Timeout",36864:"No errors",36865:"Device is busy",26626:"Error deriving keys",25600:"Execution Error",26368:"Wrong Length",27010:"Empty Buffer",27011:"Output buffer too small",27012:"Data is invalid",27013:"Conditions not satisfied",27014:"Transaction rejected",27264:"Bad key handle",27392:"Invalid P1/P2",27904:"Instruction not supported",28161:"App does not seem to be open",28416:"Unknown error",28417:"Sign/verify error"}},68593(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.ResponsePayload=void 0;const n=t(45397);class s extends n.ByteStream{constructor(e){super(e)}}r.ResponsePayload=s},75474(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.processResponse=function(e,r){if(e.length<2)throw a.ResponseError.fromReturnCode(n.LedgerError.EmptyBuffer);const t=e.readUInt16BE(e.length-2);let i=(0,s.errorCodeToString)(t,r);const d=e.subarray(0,e.length-2);if(t===n.LedgerError.NoErrors)return new o.ResponsePayload(d);if(d.length>0){const e=d.toString("utf8");e.includes(i)?i=e:i+=` : ${e}`}throw new a.ResponseError(t,i)},r.processErrorResponse=function(e,r){if(!("object"!=typeof(t=e)||null===t||t instanceof Array||t instanceof Date)){if(Object.prototype.hasOwnProperty.call(e,"statusCode"))return a.ResponseError.fromReturnCode(e.statusCode,r);if(Object.prototype.hasOwnProperty.call(e,"returnCode")&&Object.prototype.hasOwnProperty.call(e,"errorMessage"))return e}var t;return a.ResponseError.fromReturnCode(n.LedgerError.UnknownTransportError)};const n=t(7087),s=t(14884),o=t(68593),a=t(86108)},79005(e,r){Object.defineProperty(r,"__esModule",{value:!0})},86108(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.ResponseError=void 0;const n=t(14884);class s extends Error{constructor(e,r){super(r),this.errorMessage=r,this.returnCode=e}static fromReturnCode(e,r){return new s(e,(0,n.errorCodeToString)(e,r))}}r.ResponseError=s},94765(e,r,t){var n=t(1048).Buffer;Object.defineProperty(r,"__esModule",{value:!0}),r.serializePath=function(e,r){if("string"!=typeof e)throw new o.ResponseError(s.LedgerError.GenericError,"Path should be a string (e.g \"m/44'/461'/5'/0/3\")");if(!e.startsWith("m/"))throw new o.ResponseError(s.LedgerError.GenericError,'Path should start with "m/" (e.g "m/44\'/461\'/5\'/0/3")');const t=e.split("/");if(t.shift(),r&&r.length>0&&!r.includes(t.length))throw new o.ResponseError(s.LedgerError.GenericError,"Invalid path length. (e.g \"m/44'/5757'/5'/0/3\")");const a=n.alloc(4*t.length);return t.forEach((e,r)=>{let t=0;e.endsWith("'")&&(t+=s.HARDENED,e=e.slice(0,-1));const n=Number(e);if(Number.isNaN(n))throw new o.ResponseError(s.LedgerError.GenericError,`Invalid path : ${e} is not a number. (e.g "m/44'/461'/5'/0/3")`);if(n>=s.HARDENED)throw new o.ResponseError(s.LedgerError.GenericError,"Incorrect child value (bigger or equal to 0x80000000)");t+=n,a.writeUInt32LE(t,4*r)}),a},r.numbersToBip32Path=a,r.bufferToBip32Path=function(e){if(e.length%4!=0)throw new o.ResponseError(s.LedgerError.GenericError,"The buffer length must be a multiple of 4.");const r=[];for(let t=0;t<e.length;t+=4)r.push(e.readUInt32LE(t));return a(r)};const s=t(7087),o=t(86108);function a(e){if(0===e.length)throw new o.ResponseError(s.LedgerError.GenericError,"The items array cannot be empty.");const r=[];for(let t=0;t<e.length;t++){let n=e[t];if(!Number.isInteger(n)||n<0)throw new o.ResponseError(s.LedgerError.GenericError,"Each item must be a positive integer.");let a=n&~s.HARDENED;n>=s.HARDENED?r.push(`${a}'`):r.push(`${a}`)}return"m/"+r.join("/")}}}]);