diff --git a/.github/workflows/link-checker-pr.yml b/.github/workflows/link-checker-pr.yml index 54efdfa31e..873b23574a 100644 --- a/.github/workflows/link-checker-pr.yml +++ b/.github/workflows/link-checker-pr.yml @@ -68,7 +68,6 @@ jobs: - name: Summarize Output uses: thollander/actions-comment-pull-request@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - msg: "${{ env.LINKREPORT }}\n\nPreview: https://${{ github.repository_owner }}.github.io/${{ github.event.pull_request.base.repo.name }}/pr-preview/${{ github.head_ref }}/\n\n[Style Report](https://${{ github.repository_owner }}.github.io/${{ github.event.pull_request.base.repo.name }}/pr-preview/${{ github.head_ref }}/style_report.txt)" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + message: "${{ env.LINKREPORT }}\n\nPreview: https://${{ github.repository_owner }}.github.io/${{ github.event.pull_request.base.repo.name }}/pr-preview/${{ github.head_ref }}/\n\n[Style Report](https://${{ github.repository_owner }}.github.io/${{ github.event.pull_request.base.repo.name }}/pr-preview/${{ github.head_ref }}/style_report.txt)" diff --git a/README.md b/README.md index 4c43db37d5..5cb92ebcba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # XRPL Dev Portal -The [XRP Ledger Dev Portal](https://xrpl.org) is the authoritative source for XRP Ledger documentation, including the `rippled` server, RippleAPI, the Ripple Data API, and other open-source XRP Ledger software. +The [XRP Ledger Dev Portal](https://xrpl.org) is the authoritative source for XRP Ledger documentation, including the `rippled` server, client libraries, and other open-source XRP Ledger software. To build the site locally: diff --git a/assets/js/rpc-tool.js b/assets/js/rpc-tool.js index 4c6d892843..07bf98d121 100644 --- a/assets/js/rpc-tool.js +++ b/assets/js/rpc-tool.js @@ -11,9 +11,7 @@ jQuery(function ($) { api.on('connected', () => { const target = location.hash.slice(1); - // TODO: switch back to isValidAddress - if (api.isValidClassicAddress(target) || - api.isValidXAddress(target) || + if (api.isValidAddress(target) reTxId.exec(target) || reLedgerSeq.exec(target)) { $('#target').val(target); @@ -47,8 +45,7 @@ jQuery(function ($) { $("#permalink").attr("href", locationWithoutHash + "#" + target); $("#explorerlink").attr("href", ""); // Reset - // TODO: switch back to isValidAddress() - if (api.isValidClassicAddress(target)) { // Account ------------------------------- + if (api.isValidAddress(target)) { // Account ------------------------------- let account = target; previousMarkers = [] nextMarker = undefined @@ -221,7 +218,7 @@ jQuery(function ($) { if (err.error === "remoteError" && "object" === typeof err.remote) { - // TODO: is this "remoteError" thing still valid with ripple-lib 1.x+? + // TODO: is this "remoteError" thing still valid with xrpl.js 2.x+? err = err.remote; } diff --git a/assets/js/tutorials/require-destination-tags.js b/assets/js/tutorials/require-destination-tags.js index 7fe39e3b5f..5c8bd06ae3 100644 --- a/assets/js/tutorials/require-destination-tags.js +++ b/assets/js/tutorials/require-destination-tags.js @@ -38,14 +38,12 @@ $(document).ready(() => { "ledger_index": "validated" }) console.log(account_info) - // TODO: what's the replacement for parseAccountFlags? - //const flags = api.parseAccountFlags(account_info.account_data.Flags) + const flags = xrpl.parseAccountRootFlags(account_info.account_data.Flags) block.find(".loader").hide() block.find(".output-area").append( `
${pretty_print(account_info.result.account_data)}`)
- // if (flags.requireDestinationTag) {
- if (account_info.result.account_data.Flags | 0x00020000) { // TODO: change this back if there's a better way
+ if (flags.lsfRequireDestTag) {
block.find(".output-area").append(`Require Destination Tag is enabled.
`) } else { diff --git a/assets/js/tx-sender.js b/assets/js/tx-sender.js index 1c5cfed278..fe12e099c9 100644 --- a/assets/js/tx-sender.js +++ b/assets/js/tx-sender.js @@ -136,7 +136,7 @@ const set_up_tx_sender = async function() { try { const {tx_blob, hash} = use_wallet.sign(prepared) - const final_result_data = await api.submitSignedReliable(tx_blob) + const final_result_data = await api.submitAndWait(tx_blob) console.log("final_result_data is", final_result_data) let final_result = final_result_data.result.meta.TransactionResult if (!silent) { diff --git a/assets/js/xrp-ledger-toml-checker.js b/assets/js/xrp-ledger-toml-checker.js index 2a4ea36a7b..44023c510b 100644 --- a/assets/js/xrp-ledger-toml-checker.js +++ b/assets/js/xrp-ledger-toml-checker.js @@ -182,50 +182,66 @@ async function parse_xrpl_toml(data, domain) { } } -const testnet = new ripple.RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'}) -testnet.connect() -const mainnet = new ripple.RippleAPI({server: 'wss://s1.ripple.com'}) -mainnet.connect() +// Decode a hexadecimal string into a regular string, assuming 8-bit characters. +// Not proper unicode decoding, but it'll work for domains which are supposed +// to be a subset of ASCII anyway. +function decode_hex(hex) { + let str = ''; + for (let i = 0; i < hex.length; i += 2) { + str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)) + } + return str +} async function validate_address_domain_on_net(address, domain, net) { + if (!domain) { return undefined } // Can't validate an empty domain value + let api if (net === "main") { - let settings - try { - settings = await mainnet.getSettings(address) - } catch(e) { - console.error("failed to look up address on mainnet:", address, e) - return undefined - } + api = new xrpl.Client('wss://s1.ripple.com') + } else if (net == "testnet") { + api = new xrpl.Client('wss://s.altnet.rippletest.net:51233') + } + await api.connect() - if (settings.domain === domain) { - return true - } else if (settings.domain === undefined) { - console.debug(address, ": Domain is undefined in settings") - return undefined - } else { - console.debug(address, ": Domain mismatch ("+settings.domain+" vs. "+domain+")") - return false - } - } else if (net === "testnet") { - let settings - try { - settings = await testnet.getSettings(address) - } catch(e) { - console.error("failed to look up address on testnet:", address, e) - return undefined - } - - if (settings.domain === domain) { - return true - } else if (settings.domain === undefined) { - console.debug(address, ": Domain is undefined in settings") - return undefined - } else { - return false - } - } else { + let ai + try { + ai = await api.request({ + "command": "account_info", + "account": address + }) + } catch(e) { + console.warn(`failed to look up address ${address} on ${net} network"`, e) + api.disconnect() return undefined } + + if (ai.result.account_data.Domain === undefined) { + console.info(`Address ${address} has no Domain defined on-ledger`) + api.disconnect() + return undefined + } + + let domain_decoded + try { + domain_decoded = decode_hex(ai.result.account_data.Domain) + } catch(e) { + console.warn("error decoding domain value", ai.result.account_data.Domain, e) + api.disconnect() + return undefined + } + + if (domain_decoded === domain) { + api.disconnect() + return true + } else if (domain_decoded === undefined) { + console.debug(address, ": Domain is undefined in settings") + api.disconnect() + return undefined + } else { + console.debug(address, ": Domain mismatch ("+domain_decoded+" vs. "+domain+")") + api.disconnect() + return false + } } function handle_submit(event) { diff --git a/assets/js/xrpl-2.0.0b5.min.js b/assets/js/xrpl-2.0.0b5.min.js deleted file mode 100644 index 619f12eefc..0000000000 --- a/assets/js/xrpl-2.0.0b5.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see xrpl-latest-min.js.LICENSE.txt */ -var xrpl;(()=>{var t={2855:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t={}){var e,r;this.factor=2,this.numAttempts=0,this.ms=null!==(e=t.min)&&void 0!==e?e:100,this.max=null!==(r=t.max)&&void 0!==r?r:1e3}get attempts(){return this.numAttempts}duration(){const t=this.ms*Math.pow(this.factor,this.numAttempts);return this.numAttempts+=1,Math.floor(Math.min(t,this.max))}reset(){this.numAttempts=0}}},9374:function(t,e,r){"use strict";var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const n=r(5518);class o extends n.Client{constructor(t,e={}){super(t[0],e);const r=t.map((t=>new n.Client(t,e)));this.clients=r,this.getMethodNames().forEach((t=>{this[t]=(...e)=>i(this,void 0,void 0,(function*(){return Promise.race(r.map((r=>i(this,void 0,void 0,(function*(){return r[t](...e)})))))}))})),this.connect=()=>i(this,void 0,void 0,(function*(){yield Promise.all(r.map((t=>i(this,void 0,void 0,(function*(){return t.connect()})))))})),this.disconnect=()=>i(this,void 0,void 0,(function*(){yield Promise.all(r.map((t=>i(this,void 0,void 0,(function*(){return t.disconnect()})))))})),this.isConnected=()=>r.map((t=>t.isConnected())).every(Boolean),r.forEach((t=>{t.on("error",((t,e,r)=>this.emit("error",t,e,r)))}))}getMethodNames(){const t=[],e=this.clients[0],r=Object.getOwnPropertyNames(e);r.push(...Object.getOwnPropertyNames(Object.getPrototypeOf(e)));for(const i of r)"function"==typeof e[i]&&"constructor"!==i&&"on"!==i&&t.push(i);return t}}e.default=o},8234:function(t,e,r){"use strict";var i=r(8764).Buffer,n=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Connection=e.INTENTIONAL_DISCONNECT_CODE=void 0;const a=r(7187),s=o(r(6486)),u=o(r(1442)),h=r(2959),l=o(r(2855)),c=o(r(3790)),f=o(r(1196));e.INTENTIONAL_DISCONNECT_CODE=4e3;class d extends a.EventEmitter{constructor(t,e={}){super(),this.ws=null,this.reconnectTimeoutID=null,this.heartbeatIntervalID=null,this.retryConnectionBackoff=new l.default({min:100,max:6e4}),this.requestManager=new f.default,this.connectionManager=new c.default,this.trace=()=>{},this.setMaxListeners(1/0),this.url=t,this.config=Object.assign({timeout:2e4,connectionTimeout:5e3},e),"function"==typeof e.trace?this.trace=e.trace:e.trace&&(this.trace=console.log)}isConnected(){return this.state===u.default.OPEN}connect(){return n(this,void 0,void 0,(function*(){if(this.isConnected())return Promise.resolve();if(this.state===u.default.CONNECTING)return this.connectionManager.awaitConnection();if(!this.url)return Promise.reject(new h.ConnectionError("Cannot connect because no server was specified"));if(null!=this.ws)return Promise.reject(new h.XrplError("Websocket connection never cleaned up.",{state:this.state}));const t=setTimeout((()=>{this.onConnectionFailed(new h.ConnectionError(`Error: connect() timed out after ${this.config.connectionTimeout} ms. If your internet connection is working, the rippled server may be blocked or inaccessible. You can also try setting the 'connectionTimeout' option in the Client constructor.`))}),this.config.connectionTimeout);if(this.ws=function(t,e){const n={};if(n.agent=function(t,e){if(null==e.proxy)return;const i=new URL(t),n=new URL(e.proxy),o=s.default.omitBy({secureEndpoint:"wss:"===i.protocol,secureProxy:"https:"===n.protocol,auth:e.proxyAuthorization,ca:e.trustedCertificates,key:e.key,passphrase:e.passphrase,cert:e.certificate,href:n.href,origin:n.origin,protocol:n.protocol,username:n.username,password:n.password,host:n.host,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash},(t=>null==t));let a;try{a=r(174)}catch(t){throw new Error('"proxy" option is not supported in the browser')}return new a(o)}(t,e),null!=e.authorization){const t=i.from(e.authorization).toString("base64");n.headers={Authorization:`Basic ${t}`}}const o=s.default.omitBy({ca:e.trustedCertificates,key:e.key,passphrase:e.passphrase,cert:e.certificate},(t=>null==t)),a=Object.assign(Object.assign({},n),o),h=new u.default(t,a);return"function"==typeof h.setMaxListeners&&h.setMaxListeners(1/0),h}(this.url,this.config),null==this.ws)throw new Error("Connect: created null websocket");return this.ws.on("error",(t=>this.onConnectionFailed(t))),this.ws.on("error",(()=>clearTimeout(t))),this.ws.on("close",(t=>this.onConnectionFailed(t))),this.ws.on("close",(()=>clearTimeout(t))),this.ws.once("open",(()=>{this.onceOpen(t)})),this.connectionManager.awaitConnection()}))}disconnect(){return n(this,void 0,void 0,(function*(){return null!==this.reconnectTimeoutID&&(clearTimeout(this.reconnectTimeoutID),this.reconnectTimeoutID=null),this.state===u.default.CLOSED||null==this.ws?Promise.resolve(void 0):new Promise((t=>{null==this.ws&&t(void 0),null!=this.ws&&this.ws.once("close",(e=>t(e))),null!=this.ws&&this.state!==u.default.CLOSING&&this.ws.close(e.INTENTIONAL_DISCONNECT_CODE)}))}))}reconnect(){return n(this,void 0,void 0,(function*(){this.emit("reconnect"),yield this.disconnect(),yield this.connect()}))}request(t,e){return n(this,void 0,void 0,(function*(){if(!this.shouldBeConnected||null==this.ws)throw new h.NotConnectedError;const[r,i,o]=this.requestManager.createRequest(t,null!=e?e:this.config.timeout);return this.trace("send",i),function(t,e){return n(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{t.send(e,(t=>{t?i(new h.DisconnectedError(t.message,t)):r()}))}))}))}(this.ws,i).catch((t=>{this.requestManager.reject(r,t)})),o}))}getUrl(){var t;return null!==(t=this.url)&&void 0!==t?t:""}onMessage(t){let e;this.trace("receive",t);try{e=JSON.parse(t)}catch(e){return void(e instanceof Error&&this.emit("error","badMessage",e.message,t))}if(null==e.type&&e.error)this.emit("error",e.error,e.error_message,e);else if(e.type&&this.emit(e.type,e),"response"===e.type)try{this.requestManager.handleResponse(e)}catch(e){e instanceof Error?this.emit("error","badMessage",e.message,t):this.emit("error","badMessage",e,e)}}get state(){return this.ws?this.ws.readyState:u.default.CLOSED}get shouldBeConnected(){return null!==this.ws}onceOpen(t){return n(this,void 0,void 0,(function*(){if(null==this.ws)throw new Error("onceOpen: ws is null");this.ws.removeAllListeners(),clearTimeout(t),this.ws.on("message",(t=>this.onMessage(t))),this.ws.on("error",(t=>this.emit("error","websocket",t.message,t))),this.ws.once("close",((t,r)=>{if(null==this.ws)throw new Error("onceClose: ws is null");this.clearHeartbeatInterval(),this.requestManager.rejectAll(new h.DisconnectedError(`websocket was closed, ${r}`)),this.ws.removeAllListeners(),this.ws=null,this.emit("disconnected",t),t!==e.INTENTIONAL_DISCONNECT_CODE&&this.intentionalDisconnect()}));try{this.retryConnectionBackoff.reset(),this.startHeartbeatInterval(),this.connectionManager.resolveAllAwaiting(),this.emit("connected")}catch(t){t instanceof Error&&(this.connectionManager.rejectAllAwaiting(t),yield this.disconnect().catch((()=>{})))}}))}intentionalDisconnect(){const t=this.retryConnectionBackoff.duration();this.trace("reconnect",`Retrying connection in ${t}ms.`),this.emit("reconnecting",this.retryConnectionBackoff.attempts),this.reconnectTimeoutID=setTimeout((()=>{this.reconnect().catch((t=>{this.emit("error","reconnect",t.message,t)}))}),t)}clearHeartbeatInterval(){this.heartbeatIntervalID&&clearInterval(this.heartbeatIntervalID)}startHeartbeatInterval(){this.clearHeartbeatInterval(),this.heartbeatIntervalID=setInterval((()=>{this.heartbeat()}),this.config.timeout)}heartbeat(){return n(this,void 0,void 0,(function*(){this.request({command:"ping"}).catch((()=>n(this,void 0,void 0,(function*(){return this.reconnect().catch((t=>{this.emit("error","reconnect",t.message,t)}))}))))}))}onConnectionFailed(t){this.ws&&(this.ws.removeAllListeners(),this.ws.on("error",(()=>{})),this.ws.close(),this.ws=null),"number"==typeof t?this.connectionManager.rejectAllAwaiting(new h.NotConnectedError(`Connection failed with code ${t}.`,{code:t})):(null==t?void 0:t.message)?this.connectionManager.rejectAllAwaiting(new h.NotConnectedError(t.message,t)):this.connectionManager.rejectAllAwaiting(new h.NotConnectedError("Connection failed."))}}e.Connection=d},3790:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(){this.promisesAwaitingConnection=[]}resolveAllAwaiting(){this.promisesAwaitingConnection.map((({resolve:t})=>t())),this.promisesAwaitingConnection=[]}rejectAllAwaiting(t){this.promisesAwaitingConnection.map((({reject:e})=>e(t))),this.promisesAwaitingConnection=[]}awaitConnection(){return r(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.promisesAwaitingConnection.push({resolve:t,reject:e})}))}))}}},5518:function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e},a=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Client=void 0;const u=o(r(9282)),h=r(7187),l=r(2959),c=o(r(2959)),f=s(r(7478)),d=s(r(9889)),p=s(r(2289)),m=s(r(6491)),g=s(r(7015)),v=r(1179),y=r(7635),b=s(r(9561)),w=r(8234),M=r(9155);class _ extends h.EventEmitter{constructor(t,e={}){var r,i;if(super(),this.autofill=f.default,this.prepareTransaction=f.default,this.getFee=p.default,this.getLedgerIndex=m.default,this.submit=v.submit,this.submitSigned=v.submitSigned,this.submitReliable=v.submitReliable,this.submitSignedReliable=v.submitSignedReliable,this.getBalances=d.default,this.getOrderbook=g.default,this.fundWallet=b.default,"string"!=typeof t||!/wss?(?:\+unix)?:\/\//u.exec(t))throw new l.ValidationError("server URI must start with `wss://`, `ws://`, `wss+unix://`, or `ws+unix://`.");this.feeCushion=null!==(r=e.feeCushion)&&void 0!==r?r:1.2,this.maxFeeXRP=null!==(i=e.maxFeeXRP)&&void 0!==i?i:"2",this.connection=new w.Connection(t,e),this.connection.on("error",((t,e,r)=>{this.emit("error",t,e,r)})),this.connection.on("connected",(()=>{this.emit("connected")})),this.connection.on("disconnected",(t=>{let e=t;e===w.INTENTIONAL_DISCONNECT_CODE&&(e=1e3),this.emit("disconnected",e)})),this.connection.on("ledgerClosed",(t=>{this.emit("ledgerClosed",t)})),this.connection.on("transaction",(t=>{(0,M.handleStreamPartialPayment)(t),this.emit("transaction",t)})),this.connection.on("validationReceived",(t=>{this.emit("validationReceived",t)})),this.connection.on("manifestReceived",(t=>{this.emit("manifestReceived",t)})),this.connection.on("peerStatusChange",(t=>{this.emit("peerStatusChange",t)})),this.connection.on("consensusPhase",(t=>{this.emit("consensusPhase",t)})),this.connection.on("path_find",(t=>{this.emit("path_find",t)}))}static hasNextPage(t){return Boolean(t.result.marker)}request(t){return a(this,void 0,void 0,(function*(){const e=yield this.connection.request(Object.assign(Object.assign({},t),{account:t.account?(0,y.ensureClassicAddress)(t.account):void 0}));return(0,M.handlePartialPayment)(t.command,e),e}))}requestNextPage(t,e){return a(this,void 0,void 0,(function*(){if(!e.result.marker)return Promise.reject(new c.NotFoundError("response does not have a next page"));const r=Object.assign(Object.assign({},t),{marker:e.result.marker});return this.request(r)}))}on(t,e){return super.on(t,e)}requestAll(t,e){return a(this,void 0,void 0,(function*(){const r=null!=e?e:function(t){switch(t){case"account_channels":return"channels";case"account_lines":return"lines";case"account_objects":return"account_objects";case"account_tx":return"transactions";case"account_offers":case"book_offers":return"offers";case"ledger_data":return"state";default:return null}}(t.command);if(!r)throw new l.ValidationError(`no collect key for command ${t.command}`);const i=null==t.limit?1/0:t.limit;let n,o=0,a=t.marker;const s=[];do{const e=(h=i-o,10,400,u.ok(!0,"Illegal clamp bounds"),Math.min(Math.max(h,10),400)),c=Object.assign(Object.assign({},t),{limit:e,marker:a}),f=yield this.connection.request(c),d=f.result;if(!(r in d))throw new l.XrplError(`${r} not in result`);const p=d[r];a=d.marker,s.push(f),Array.isArray(p)?(o+=p.length,n=p.length):n=0}while(Boolean(a)&&ou(t.tx,t.meta)))}(e);default:return!1}}(t,e)){const t=null!==(r=e.warnings)&&void 0!==r?r:[],i={id:2001,message:"This response contains a Partial Payment"};t.push(i),e.warnings=t}},e.handleStreamPartialPayment=function(t){var e;if(u(t.transaction,t.meta)){const r=null!==(e=t.warnings)&&void 0!==e?e:[],i={id:2001,message:"This response contains a Partial Payment"};r.push(i),t.warnings=r}}},1196:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=r(2959);e.default=class{constructor(){this.nextId=0,this.promisesAwaitingResponse=new Map}cancel(t){const e=this.promisesAwaitingResponse.get(t);if(null==e)throw new Error(`No existing promise with id ${t}`);clearTimeout(e.timer),this.deletePromise(t)}resolve(t,e){const r=this.promisesAwaitingResponse.get(t);if(null==r)throw new Error(`No existing promise with id ${t}`);clearTimeout(r.timer),r.resolve(e),this.deletePromise(t)}reject(t,e){const r=this.promisesAwaitingResponse.get(t);if(null==r)throw new Error(`No existing promise with id ${t}`);clearTimeout(r.timer),r.reject(e),this.deletePromise(t)}rejectAll(t){this.promisesAwaitingResponse.forEach(((e,r,i)=>{this.reject(r,t),this.deletePromise(r)}))}createRequest(t,e){let r;null==t.id?(r=this.nextId,this.nextId+=1):r=t.id;const n=JSON.stringify(Object.assign(Object.assign({},t),{id:r})),o=setTimeout((()=>this.reject(r,new i.TimeoutError)),e);if(o.unref&&o.unref(),this.promisesAwaitingResponse.has(r))throw new i.XrplError(`Response with id '${r}' is already pending`);const a=new Promise(((t,e)=>{this.promisesAwaitingResponse.set(r,{resolve:t,reject:e,timer:o})}));return[r,n,a]}handleResponse(t){var e,r;if(null==t.id||"string"!=typeof t.id&&"number"!=typeof t.id)throw new i.ResponseFormatError("valid id not found in response",t);if(this.promisesAwaitingResponse.has(t.id)){if(null==t.status){const e=new i.ResponseFormatError("Response has no status");this.reject(t.id,e)}if("error"!==t.status)if("success"===t.status)delete t.status,this.resolve(t.id,t);else{const e=new i.ResponseFormatError(`unrecognized response.status: ${null!==(r=t.status)&&void 0!==r?r:""}`,t);this.reject(t.id,e)}else{const r=t,n=new i.RippledError(null!==(e=r.error_message)&&void 0!==e?e:r.error,r);this.reject(t.id,n)}}}deletePromise(t){this.promisesAwaitingResponse.delete(t)}}},1442:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=r(7187);class n extends i.EventEmitter{constructor(t,e,r){super(),this.setMaxListeners(1/0),this.ws=new WebSocket(t),this.ws.onclose=()=>{this.emit("close")},this.ws.onopen=()=>{this.emit("open")},this.ws.onerror=t=>{this.emit("error",t)},this.ws.onmessage=t=>{this.emit("message",t.data)}}close(){1===this.readyState&&this.ws.close()}send(t){this.ws.send(t)}get readyState(){return this.ws.readyState}}e.default=n,n.CONNECTING=0,n.OPEN=1,n.CLOSING=2,n.CLOSED=3},7269:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.ed25519="ed25519",t.secp256k1="ecdsa-secp256k1"}(r||(r={})),e.default=r},2959:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.XRPLFaucetError=e.LedgerVersionError=e.NotFoundError=e.ValidationError=e.ResponseFormatError=e.TimeoutError=e.RippledNotInitializedError=e.DisconnectedError=e.NotConnectedError=e.RippledError=e.ConnectionError=e.UnexpectedError=e.XrplError=void 0;const i=r(9539);class n extends Error{constructor(t="",e){super(t),this.name=this.constructor.name,this.message=t,this.data=e,null!=Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(){let t=`[${this.name}(${this.message}`;return this.data&&(t+=`, ${(0,i.inspect)(this.data)}`),t+=")]",t}inspect(){return this.toString()}}e.XrplError=n,e.RippledError=class extends n{},e.UnexpectedError=class extends n{},e.LedgerVersionError=class extends n{};class o extends n{}e.ConnectionError=o,e.NotConnectedError=class extends o{},e.DisconnectedError=class extends o{},e.RippledNotInitializedError=class extends o{},e.TimeoutError=class extends o{},e.ResponseFormatError=class extends o{},e.ValidationError=class extends n{},e.XRPLFaucetError=class extends n{},e.NotFoundError=class extends n{constructor(t="Not found"){super(t)}}},3081:function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||i(e,t,r)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Wallet=e.Client=e.BroadcastClient=void 0;var a=r(9374);Object.defineProperty(e,"BroadcastClient",{enumerable:!0,get:function(){return o(a).default}});var s=r(5518);Object.defineProperty(e,"Client",{enumerable:!0,get:function(){return s.Client}}),n(r(9970),e),n(r(4197),e),n(r(7859),e),n(r(2959),e);var u=r(4786);Object.defineProperty(e,"Wallet",{enumerable:!0,get:function(){return o(u).default}}),n(r(4898),e)},9070:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.AccountRootFlags=void 0,(r=e.AccountRootFlags||(e.AccountRootFlags={}))[r.lsfPasswordSpent=65536]="lsfPasswordSpent",r[r.lsfRequireDestTag=131072]="lsfRequireDestTag",r[r.lsfRequireAuth=262144]="lsfRequireAuth",r[r.lsfDisallowXRP=524288]="lsfDisallowXRP",r[r.lsfDisableMaster=1048576]="lsfDisableMaster",r[r.lsfNoFreeze=2097152]="lsfNoFreeze",r[r.lsfGlobalFreeze=4194304]="lsfGlobalFreeze",r[r.lsfDefaultRipple=8388608]="lsfDefaultRipple",r[r.lsfDepositAuth=16777216]="lsfDepositAuth"},7254:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.OfferFlags=void 0,(r=e.OfferFlags||(e.OfferFlags={}))[r.lsfPassive=65536]="lsfPassive",r[r.lsfSell=131072]="lsfSell"},9970:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},9584:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateAccountDelete=void 0;const i=r(2959),n=r(3870);e.validateAccountDelete=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Destination)throw new i.ValidationError("AccountDelete: missing field Destination");if("string"!=typeof t.Destination)throw new i.ValidationError("AccountDelete: invalid Destination");if(void 0!==t.DestinationTag&&"number"!=typeof t.DestinationTag)throw new i.ValidationError("AccountDelete: invalid DestinationTag")}},9942:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateAccountSet=e.AccountSetTfFlags=e.AccountSetAsfFlags=void 0;const i=r(2959),n=r(3870);var o,a;!function(t){t[t.asfRequireDest=1]="asfRequireDest",t[t.asfRequireAuth=2]="asfRequireAuth",t[t.asfDisallowXRP=3]="asfDisallowXRP",t[t.asfDisableMaster=4]="asfDisableMaster",t[t.asfAccountTxnID=5]="asfAccountTxnID",t[t.asfNoFreeze=6]="asfNoFreeze",t[t.asfGlobalFreeze=7]="asfGlobalFreeze",t[t.asfDefaultRipple=8]="asfDefaultRipple",t[t.asfDepositAuth=9]="asfDepositAuth"}(o=e.AccountSetAsfFlags||(e.AccountSetAsfFlags={})),(a=e.AccountSetTfFlags||(e.AccountSetTfFlags={}))[a.tfRequireDestTag=65536]="tfRequireDestTag",a[a.tfOptionalDestTag=131072]="tfOptionalDestTag",a[a.tfRequireAuth=262144]="tfRequireAuth",a[a.tfOptionalAuth=524288]="tfOptionalAuth",a[a.tfDisallowXRP=1048576]="tfDisallowXRP",a[a.tfAllowXRP=2097152]="tfAllowXRP",e.validateAccountSet=function(t){if((0,n.validateBaseTransaction)(t),void 0!==t.ClearFlag){if("number"!=typeof t.ClearFlag)throw new i.ValidationError("AccountSet: invalid ClearFlag");if(!Object.values(o).includes(t.ClearFlag))throw new i.ValidationError("AccountSet: invalid ClearFlag")}if(void 0!==t.Domain&&"string"!=typeof t.Domain)throw new i.ValidationError("AccountSet: invalid Domain");if(void 0!==t.EmailHash&&"string"!=typeof t.EmailHash)throw new i.ValidationError("AccountSet: invalid EmailHash");if(void 0!==t.MessageKey&&"string"!=typeof t.MessageKey)throw new i.ValidationError("AccountSet: invalid MessageKey");if(void 0!==t.SetFlag){if("number"!=typeof t.SetFlag)throw new i.ValidationError("AccountSet: invalid SetFlag");if(!Object.values(o).includes(t.SetFlag))throw new i.ValidationError("AccountSet: invalid SetFlag")}if(void 0!==t.TransferRate&&"number"!=typeof t.TransferRate)throw new i.ValidationError("AccountSet: invalid TransferRate");if(void 0!==t.TickSize){if("number"!=typeof t.TickSize)throw new i.ValidationError("AccountSet: invalid TickSize");if(0!==t.TickSize&&(t.TickSize<3||t.TickSize>15))throw new i.ValidationError("AccountSet: invalid TickSize")}}},2520:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateCheckCancel=void 0;const i=r(2959),n=r(3870);e.validateCheckCancel=function(t){if((0,n.validateBaseTransaction)(t),void 0!==t.CheckID&&"string"!=typeof t.CheckID)throw new i.ValidationError("CheckCancel: invalid CheckID")}},6385:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateCheckCash=void 0;const i=r(2959),n=r(3870);e.validateCheckCash=function(t){if((0,n.validateBaseTransaction)(t),null==t.Amount&&null==t.DeliverMin)throw new i.ValidationError("CheckCash: must have either Amount or DeliverMin");if(null!=t.Amount&&null!=t.DeliverMin)throw new i.ValidationError("CheckCash: cannot have both Amount and DeliverMin");if(null!=t.Amount&&void 0!==t.Amount&&!(0,n.isAmount)(t.Amount))throw new i.ValidationError("CheckCash: invalid Amount");if(null!=t.DeliverMin&&void 0!==t.DeliverMin&&!(0,n.isAmount)(t.DeliverMin))throw new i.ValidationError("CheckCash: invalid DeliverMin");if(void 0!==t.CheckID&&"string"!=typeof t.CheckID)throw new i.ValidationError("CheckCash: invalid CheckID")}},90:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateCheckCreate=void 0;const i=r(2959),n=r(3870);e.validateCheckCreate=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.SendMax)throw new i.ValidationError("CheckCreate: missing field SendMax");if(void 0===t.Destination)throw new i.ValidationError("CheckCreate: missing field Destination");if("string"!=typeof t.SendMax&&!(0,n.isIssuedCurrency)(t.SendMax))throw new i.ValidationError("CheckCreate: invalid SendMax");if("string"!=typeof t.Destination)throw new i.ValidationError("CheckCreate: invalid Destination");if(void 0!==t.DestinationTag&&"number"!=typeof t.DestinationTag)throw new i.ValidationError("CheckCreate: invalid DestinationTag");if(void 0!==t.Expiration&&"number"!=typeof t.Expiration)throw new i.ValidationError("CheckCreate: invalid Expiration");if(void 0!==t.InvoiceID&&"string"!=typeof t.InvoiceID)throw new i.ValidationError("CheckCreate: invalid InvoiceID")}},3870:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateBaseTransaction=e.isAmount=e.isIssuedCurrency=void 0;const i=r(2959),n=r(7197),o=["AccountSet","AccountDelete","CheckCancel","CheckCash","CheckCreate","DepositPreauth","EscrowCancel","EscrowCreate","EscrowFinish","OfferCancel","OfferCreate","Payment","PaymentChannelClaim","PaymentChannelCreate","PaymentChannelFund","SetRegularKey","SignerListSet","TicketCreate","TrustSet"];function a(t){if(null==t.Memo)return!1;const e=t.Memo,r=Object.keys(e).length,i=null==e.MemoData||"string"==typeof e.MemoData,o=null==e.MemoFormat||"string"==typeof e.MemoFormat,a=null==e.MemoType||"string"==typeof e.MemoType;return r>=1&&r<=3&&i&&o&&a&&(0,n.onlyHasFields)(e,["MemoFormat","MemoData","MemoType"])}function s(t){const e=t;if(null==e.Signer)return!1;const r=e.Signer;return 3===Object.keys(r).length&&"string"==typeof r.Account&&"string"==typeof r.TxnSignature&&"string"==typeof r.SigningPubKey}function u(t){return 3===Object.keys(t).length&&"string"==typeof t.value&&"string"==typeof t.issuer&&"string"==typeof t.currency}e.isIssuedCurrency=u,e.isAmount=function(t){return"string"==typeof t||u(t)},e.validateBaseTransaction=function(t){if(void 0===t.Account)throw new i.ValidationError("BaseTransaction: missing field Account");if("string"!=typeof t.Account)throw new i.ValidationError("BaseTransaction: Account not string");if(void 0===t.TransactionType)throw new i.ValidationError("BaseTransaction: missing field TransactionType");if("string"!=typeof t.TransactionType)throw new i.ValidationError("BaseTransaction: TransactionType not string");if(!o.includes(t.TransactionType))throw new i.ValidationError("BaseTransaction: Unknown TransactionType");if(void 0!==t.Fee&&"string"!=typeof t.Fee)throw new i.ValidationError("BaseTransaction: invalid Fee");if(void 0!==t.Sequence&&"number"!=typeof t.Sequence)throw new i.ValidationError("BaseTransaction: invalid Sequence");if(void 0!==t.AccountTxnID&&"string"!=typeof t.AccountTxnID)throw new i.ValidationError("BaseTransaction: invalid AccountTxnID");if(void 0!==t.LastLedgerSequence&&"number"!=typeof t.LastLedgerSequence)throw new i.ValidationError("BaseTransaction: invalid LastLedgerSequence");const e=t.Memos;if(void 0!==e&&!e.every(a))throw new i.ValidationError("BaseTransaction: invalid Memos");const r=t.Signers;if(void 0!==r&&(0===r.length||!r.every(s)))throw new i.ValidationError("BaseTransaction: invalid Signers");if(void 0!==t.SourceTag&&"number"!=typeof t.SourceTag)throw new i.ValidationError("BaseTransaction: invalid SourceTag");if(void 0!==t.SigningPubKey&&"string"!=typeof t.SigningPubKey)throw new i.ValidationError("BaseTransaction: invalid SigningPubKey");if(void 0!==t.TicketSequence&&"number"!=typeof t.TicketSequence)throw new i.ValidationError("BaseTransaction: invalid TicketSequence");if(void 0!==t.TxnSignature&&"string"!=typeof t.TxnSignature)throw new i.ValidationError("BaseTransaction: invalid TxnSignature")}},7417:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateDepositPreauth=void 0;const i=r(2959),n=r(3870);e.validateDepositPreauth=function(t){if((0,n.validateBaseTransaction)(t),void 0!==t.Authorize&&void 0!==t.Unauthorize)throw new i.ValidationError("DepositPreauth: can't provide both Authorize and Unauthorize fields");if(void 0===t.Authorize&&void 0===t.Unauthorize)throw new i.ValidationError("DepositPreauth: must provide either Authorize or Unauthorize field");if(void 0!==t.Authorize){if("string"!=typeof t.Authorize)throw new i.ValidationError("DepositPreauth: Authorize must be a string");if(t.Account===t.Authorize)throw new i.ValidationError("DepositPreauth: Account can't preauthorize its own address")}if(void 0!==t.Unauthorize){if("string"!=typeof t.Unauthorize)throw new i.ValidationError("DepositPreauth: Unauthorize must be a string");if(t.Account===t.Unauthorize)throw new i.ValidationError("DepositPreauth: Account can't unauthorize its own address")}}},8809:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateEscrowCancel=void 0;const i=r(2959),n=r(3870);e.validateEscrowCancel=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Owner)throw new i.ValidationError("EscrowCancel: missing Owner");if("string"!=typeof t.Owner)throw new i.ValidationError("EscrowCancel: Owner must be a string");if(void 0===t.OfferSequence)throw new i.ValidationError("EscrowCancel: missing OfferSequence");if("number"!=typeof t.OfferSequence)throw new i.ValidationError("EscrowCancel: OfferSequence must be a number")}},3521:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateEscrowCreate=void 0;const i=r(2959),n=r(3870);e.validateEscrowCreate=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Amount)throw new i.ValidationError("EscrowCreate: missing field Amount");if("string"!=typeof t.Amount)throw new i.ValidationError("EscrowCreate: Amount must be a string");if(void 0===t.Destination)throw new i.ValidationError("EscrowCreate: missing field Destination");if("string"!=typeof t.Destination)throw new i.ValidationError("EscrowCreate: Destination must be a string");if(void 0===t.CancelAfter&&void 0===t.FinishAfter)throw new i.ValidationError("EscrowCreate: Either CancelAfter or FinishAfter must be specified");if(void 0===t.FinishAfter&&void 0===t.Condition)throw new i.ValidationError("EscrowCreate: Either Condition or FinishAfter must be specified");if(void 0!==t.CancelAfter&&"number"!=typeof t.CancelAfter)throw new i.ValidationError("EscrowCreate: CancelAfter must be a number");if(void 0!==t.FinishAfter&&"number"!=typeof t.FinishAfter)throw new i.ValidationError("EscrowCreate: FinishAfter must be a number");if(void 0!==t.Condition&&"string"!=typeof t.Condition)throw new i.ValidationError("EscrowCreate: Condition must be a string");if(void 0!==t.DestinationTag&&"number"!=typeof t.DestinationTag)throw new i.ValidationError("EscrowCreate: DestinationTag must be a number")}},2093:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateEscrowFinish=void 0;const i=r(2959),n=r(3870);e.validateEscrowFinish=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Owner)throw new i.ValidationError("EscrowFinish: missing field Owner");if("string"!=typeof t.Owner)throw new i.ValidationError("EscrowFinish: Owner must be a string");if(void 0===t.OfferSequence)throw new i.ValidationError("EscrowFinish: missing field OfferSequence");if("number"!=typeof t.OfferSequence)throw new i.ValidationError("EscrowFinish: OfferSequence must be a number");if(void 0!==t.Condition&&"string"!=typeof t.Condition)throw new i.ValidationError("EscrowFinish: Condition must be a string");if(void 0!==t.Fulfillment&&"string"!=typeof t.Fulfillment)throw new i.ValidationError("EscrowFinish: Fulfillment must be a string")}},4197:function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||i(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.validateTrustSet=e.validatePaymentChannelClaim=e.validatePayment=e.validateOfferCreate=e.validateAccountSet=void 0,n(r(3329),e);var o=r(9942);Object.defineProperty(e,"validateAccountSet",{enumerable:!0,get:function(){return o.validateAccountSet}}),n(r(9584),e),n(r(2520),e),n(r(6385),e),n(r(90),e),n(r(7417),e),n(r(8809),e),n(r(3521),e),n(r(2093),e),n(r(4453),e);var a=r(3310);Object.defineProperty(e,"validateOfferCreate",{enumerable:!0,get:function(){return a.validateOfferCreate}});var s=r(8538);Object.defineProperty(e,"validatePayment",{enumerable:!0,get:function(){return s.validatePayment}});var u=r(8230);Object.defineProperty(e,"validatePaymentChannelClaim",{enumerable:!0,get:function(){return u.validatePaymentChannelClaim}}),n(r(7903),e),n(r(7347),e),n(r(3103),e),n(r(3390),e),n(r(2180),e);var h=r(8015);Object.defineProperty(e,"validateTrustSet",{enumerable:!0,get:function(){return h.validateTrustSet}})},4453:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateOfferCancel=void 0;const i=r(2959),n=r(3870);e.validateOfferCancel=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.OfferSequence)throw new i.ValidationError("OfferCancel: missing field OfferSequence");if("number"!=typeof t.OfferSequence)throw new i.ValidationError("OfferCancel: OfferSequence must be a number")}},3310:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateOfferCreate=e.OfferCreateFlags=void 0;const i=r(2959),n=r(3870);var o;(o=e.OfferCreateFlags||(e.OfferCreateFlags={}))[o.tfPassive=65536]="tfPassive",o[o.tfImmediateOrCancel=131072]="tfImmediateOrCancel",o[o.tfFillOrKill=262144]="tfFillOrKill",o[o.tfSell=524288]="tfSell",e.validateOfferCreate=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.TakerGets)throw new i.ValidationError("OfferCreate: missing field TakerGets");if(void 0===t.TakerPays)throw new i.ValidationError("OfferCreate: missing field TakerPays");if("string"!=typeof t.TakerGets&&!(0,n.isAmount)(t.TakerGets))throw new i.ValidationError("OfferCreate: invalid TakerGets");if("string"!=typeof t.TakerPays&&!(0,n.isAmount)(t.TakerPays))throw new i.ValidationError("OfferCreate: invalid TakerPays");if(void 0!==t.Expiration&&"number"!=typeof t.Expiration)throw new i.ValidationError("OfferCreate: invalid Expiration");if(void 0!==t.OfferSequence&&"number"!=typeof t.OfferSequence)throw new i.ValidationError("OfferCreate: invalid OfferSequence")}},8538:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validatePayment=e.PaymentFlags=void 0;const i=r(2959),n=r(7197),o=r(3870);var a;function s(t){return!(void 0!==t.account&&"string"!=typeof t.account||void 0!==t.currency&&"string"!=typeof t.currency||void 0!==t.issuer&&"string"!=typeof t.issuer||(void 0===t.account||void 0!==t.currency||void 0!==t.issuer)&&void 0===t.currency&&void 0===t.issuer)}function u(t){for(const e of t)if(!s(e))return!1;return!0}!function(t){t[t.tfNoDirectRipple=65536]="tfNoDirectRipple",t[t.tfPartialPayment=131072]="tfPartialPayment",t[t.tfLimitQuality=262144]="tfLimitQuality"}(a=e.PaymentFlags||(e.PaymentFlags={})),e.validatePayment=function(t){if((0,o.validateBaseTransaction)(t),void 0===t.Amount)throw new i.ValidationError("PaymentTransaction: missing field Amount");if(!(0,o.isAmount)(t.Amount))throw new i.ValidationError("PaymentTransaction: invalid Amount");if(void 0===t.Destination)throw new i.ValidationError("PaymentTransaction: missing field Destination");if(!(0,o.isAmount)(t.Destination))throw new i.ValidationError("PaymentTransaction: invalid Destination");if(null!=t.DestinationTag&&"number"!=typeof t.DestinationTag)throw new i.ValidationError("PaymentTransaction: DestinationTag must be a number");if(void 0!==t.InvoiceID&&"string"!=typeof t.InvoiceID)throw new i.ValidationError("PaymentTransaction: InvoiceID must be a string");if(void 0!==t.Paths&&!function(t){if(!Array.isArray(t)||0===t.length)return!1;for(const e of t){if(!Array.isArray(e)||0===e.length)return!1;if(!u(e))return!1}return!0}(t.Paths))throw new i.ValidationError("PaymentTransaction: invalid Paths");if(void 0!==t.SendMax&&!(0,o.isAmount)(t.SendMax))throw new i.ValidationError("PaymentTransaction: invalid SendMax");!function(t){var e;if(null!=t.DeliverMin){if(null==t.Flags)throw new i.ValidationError("PaymentTransaction: tfPartialPayment flag required with DeliverMin");const r=t.Flags;if(!("number"==typeof r?(0,n.isFlagEnabled)(r,a.tfPartialPayment):null!==(e=r.tfPartialPayment)&&void 0!==e&&e))throw new i.ValidationError("PaymentTransaction: tfPartialPayment flag required with DeliverMin");if(!(0,o.isAmount)(t.DeliverMin))throw new i.ValidationError("PaymentTransaction: invalid DeliverMin")}}(t)}},8230:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validatePaymentChannelClaim=e.PaymentChannelClaimFlags=void 0;const i=r(2959),n=r(3870);var o;(o=e.PaymentChannelClaimFlags||(e.PaymentChannelClaimFlags={}))[o.tfRenew=65536]="tfRenew",o[o.tfClose=131072]="tfClose",e.validatePaymentChannelClaim=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Channel)throw new i.ValidationError("PaymentChannelClaim: missing Channel");if("string"!=typeof t.Channel)throw new i.ValidationError("PaymentChannelClaim: Channel must be a string");if(void 0!==t.Balance&&"string"!=typeof t.Balance)throw new i.ValidationError("PaymentChannelClaim: Balance must be a string");if(void 0!==t.Amount&&"string"!=typeof t.Amount)throw new i.ValidationError("PaymentChannelClaim: Amount must be a string");if(void 0!==t.Signature&&"string"!=typeof t.Signature)throw new i.ValidationError("PaymentChannelClaim: Signature must be a string");if(void 0!==t.PublicKey&&"string"!=typeof t.PublicKey)throw new i.ValidationError("PaymentChannelClaim: PublicKey must be a string")}},7903:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validatePaymentChannelCreate=void 0;const i=r(2959),n=r(3870);e.validatePaymentChannelCreate=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Amount)throw new i.ValidationError("PaymentChannelCreate: missing Amount");if("string"!=typeof t.Amount)throw new i.ValidationError("PaymentChannelCreate: Amount must be a string");if(void 0===t.Destination)throw new i.ValidationError("PaymentChannelCreate: missing Destination");if("string"!=typeof t.Destination)throw new i.ValidationError("PaymentChannelCreate: Destination must be a string");if(void 0===t.SettleDelay)throw new i.ValidationError("PaymentChannelCreate: missing SettleDelay");if("number"!=typeof t.SettleDelay)throw new i.ValidationError("PaymentChannelCreate: SettleDelay must be a number");if(void 0===t.PublicKey)throw new i.ValidationError("PaymentChannelCreate: missing PublicKey");if("string"!=typeof t.PublicKey)throw new i.ValidationError("PaymentChannelCreate: PublicKey must be a string");if(void 0!==t.CancelAfter&&"number"!=typeof t.CancelAfter)throw new i.ValidationError("PaymentChannelCreate: CancelAfter must be a number");if(void 0!==t.DestinationTag&&"number"!=typeof t.DestinationTag)throw new i.ValidationError("PaymentChannelCreate: DestinationTag must be a number")}},7347:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validatePaymentChannelFund=void 0;const i=r(2959),n=r(3870);e.validatePaymentChannelFund=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.Channel)throw new i.ValidationError("PaymentChannelFund: missing Channel");if("string"!=typeof t.Channel)throw new i.ValidationError("PaymentChannelFund: Channel must be a string");if(void 0===t.Amount)throw new i.ValidationError("PaymentChannelFund: missing Amount");if("string"!=typeof t.Amount)throw new i.ValidationError("PaymentChannelFund: Amount must be a string");if(void 0!==t.Expiration&&"number"!=typeof t.Expiration)throw new i.ValidationError("PaymentChannelFund: Expiration must be a number")}},3103:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateSetRegularKey=void 0;const i=r(2959),n=r(3870);e.validateSetRegularKey=function(t){if((0,n.validateBaseTransaction)(t),void 0!==t.RegularKey&&"string"!=typeof t.RegularKey)throw new i.ValidationError("SetRegularKey: RegularKey must be a string")}},3390:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateSignerListSet=void 0;const i=r(2959),n=r(3870);e.validateSignerListSet=function(t){if((0,n.validateBaseTransaction)(t),void 0===t.SignerQuorum)throw new i.ValidationError("SignerListSet: missing field SignerQuorum");if("number"!=typeof t.SignerQuorum)throw new i.ValidationError("SignerListSet: invalid SignerQuorum");if(void 0===t.SignerEntries)throw new i.ValidationError("SignerListSet: missing field SignerEntries");if(!Array.isArray(t.SignerEntries))throw new i.ValidationError("SignerListSet: invalid SignerEntries");if(0===t.SignerEntries.length)throw new i.ValidationError("SignerListSet: need atleast 1 member in SignerEntries");if(t.SignerEntries.length>8)throw new i.ValidationError("SignerListSet: maximum of 8 members allowed in SignerEntries")}},2180:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateTicketCreate=void 0;const i=r(2959),n=r(3870);e.validateTicketCreate=function(t){(0,n.validateBaseTransaction)(t);const{TicketCount:e}=t;if(void 0===e)throw new i.ValidationError("TicketCreate: missing field TicketCount");if("number"!=typeof e)throw new i.ValidationError("TicketCreate: TicketCount must be a number");if(!Number.isInteger(e)||e<1||e>250)throw new i.ValidationError("TicketCreate: TicketCount must be an integer from 1 to 250")}},3329:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TrustSetFlags=e.PaymentChannelClaimFlags=e.PaymentFlags=e.OfferCreateFlags=e.AccountSetTfFlags=e.AccountSetAsfFlags=e.validate=void 0;const n=i(r(6486)),o=r(2353),a=r(2959),s=i(r(6983)),u=r(9584),h=r(9942);Object.defineProperty(e,"AccountSetAsfFlags",{enumerable:!0,get:function(){return h.AccountSetAsfFlags}}),Object.defineProperty(e,"AccountSetTfFlags",{enumerable:!0,get:function(){return h.AccountSetTfFlags}});const l=r(2520),c=r(6385),f=r(90),d=r(7417),p=r(8809),m=r(3521),g=r(2093),v=r(4453),y=r(3310);Object.defineProperty(e,"OfferCreateFlags",{enumerable:!0,get:function(){return y.OfferCreateFlags}});const b=r(8538);Object.defineProperty(e,"PaymentFlags",{enumerable:!0,get:function(){return b.PaymentFlags}});const w=r(8230);Object.defineProperty(e,"PaymentChannelClaimFlags",{enumerable:!0,get:function(){return w.PaymentChannelClaimFlags}});const M=r(7903),_=r(7347),S=r(3103),E=r(3390),k=r(2180),A=r(8015);Object.defineProperty(e,"TrustSetFlags",{enumerable:!0,get:function(){return A.TrustSetFlags}}),e.validate=function(t){const e=Object.assign({},t);if(null==e.TransactionType)throw new a.ValidationError("Object does not have a `TransactionType`");if("string"!=typeof e.TransactionType)throw new a.ValidationError("Object's `TransactionType` is not a string");switch((0,s.default)(e),e.TransactionType){case"AccountDelete":(0,u.validateAccountDelete)(e);break;case"AccountSet":(0,h.validateAccountSet)(e);break;case"CheckCancel":(0,l.validateCheckCancel)(e);break;case"CheckCash":(0,c.validateCheckCash)(e);break;case"CheckCreate":(0,f.validateCheckCreate)(e);break;case"DepositPreauth":(0,d.validateDepositPreauth)(e);break;case"EscrowCancel":(0,p.validateEscrowCancel)(e);break;case"EscrowCreate":(0,m.validateEscrowCreate)(e);break;case"EscrowFinish":(0,g.validateEscrowFinish)(e);break;case"OfferCancel":(0,v.validateOfferCancel)(e);break;case"OfferCreate":(0,y.validateOfferCreate)(e);break;case"Payment":(0,b.validatePayment)(e);break;case"PaymentChannelClaim":(0,w.validatePaymentChannelClaim)(e);break;case"PaymentChannelCreate":(0,M.validatePaymentChannelCreate)(e);break;case"PaymentChannelFund":(0,_.validatePaymentChannelFund)(e);break;case"SetRegularKey":(0,S.validateSetRegularKey)(e);break;case"SignerListSet":(0,E.validateSignerListSet)(e);break;case"TicketCreate":(0,k.validateTicketCreate)(e);break;case"TrustSet":(0,A.validateTrustSet)(e);break;default:throw new a.ValidationError(`Invalid field TransactionType: ${e.TransactionType}`)}if(!n.default.isEqual((0,o.decode)((0,o.encode)(e)),n.default.omitBy(e,(t=>null==t))))throw new a.ValidationError(`Invalid Transaction: ${e.TransactionType}`)}},8015:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validateTrustSet=e.TrustSetFlags=void 0;const i=r(2959),n=r(3870);var o;(o=e.TrustSetFlags||(e.TrustSetFlags={}))[o.tfSetfAuth=65536]="tfSetfAuth",o[o.tfSetNoRipple=131072]="tfSetNoRipple",o[o.tfClearNoRipple=262144]="tfClearNoRipple",o[o.tfSetFreeze=1048576]="tfSetFreeze",o[o.tfClearFreeze=2097152]="tfClearFreeze",e.validateTrustSet=function(t){(0,n.validateBaseTransaction)(t);const{LimitAmount:e,QualityIn:r,QualityOut:o}=t;if(void 0===e)throw new i.ValidationError("TrustSet: missing field LimitAmount");if(!(0,n.isAmount)(e))throw new i.ValidationError("TrustSet: invalid LimitAmount");if(void 0!==r&&"number"!=typeof r)throw new i.ValidationError("TrustSet: QualityIn must be a number");if(void 0!==o&&"number"!=typeof o)throw new i.ValidationError("TrustSet: QualityOut must be a number")}},6983:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccountRootFlags=void 0;const i=r(2959),n=r(9070),o=r(9942),a=r(3310),s=r(8538),u=r(8230),h=r(8015),l=r(7197);function c(t,e){return Object.keys(t).reduce(((r,n)=>{if(null==e[n])throw new i.ValidationError(`flag ${n} doesn't exist in flagEnum: ${JSON.stringify(e)}`);return t[n]?r|e[n]:r}),0)}e.parseAccountRootFlags=function(t){const e={};return Object.keys(n.AccountRootFlags).forEach((r=>{(0,l.isFlagEnabled)(t,n.AccountRootFlags[r])&&(e[r]=!0)})),e},e.default=function(t){var e;if(null!=t.Flags){if("number"!=typeof t.Flags)switch(t.TransactionType){case"AccountSet":return void(t.Flags=(e=t.Flags,c(e,o.AccountSetTfFlags)));case"OfferCreate":return void(t.Flags=function(t){return c(t,a.OfferCreateFlags)}(t.Flags));case"PaymentChannelClaim":return void(t.Flags=function(t){return c(t,u.PaymentChannelClaimFlags)}(t.Flags));case"Payment":return void(t.Flags=function(t){return c(t,s.PaymentFlags)}(t.Flags));case"TrustSet":return void(t.Flags=function(t){return c(t,h.TrustSetFlags)}(t.Flags));default:t.Flags=0}}else t.Flags=0}},7197:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isFlagEnabled=e.onlyHasFields=void 0,e.onlyHasFields=function(t,e){return Object.keys(t).every((t=>e.includes(t)))},e.isFlagEnabled=function(t,e){return(e&t)===e}},7478:function(t,e,r){"use strict";var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(4431)),a=r(8914),s=r(2959),u=n(r(6983)),h=r(7859);function l(t,e,r){const{classicAccount:i,tag:n}=c(t[e]);if(t[e]=i,null!=n&&!1!==n){if(t[r]&&t[r]!==n)throw new s.ValidationError(`The ${r}, if present, must match the tag of the ${e} X-address`);t[r]=n}}function c(t,e){if((0,a.isValidXAddress)(t)){const r=(0,a.xAddressToClassicAddress)(t);if(null!=e&&r.tag!==e)throw new s.ValidationError("address includes a tag that does not match the tag specified in the transaction");return{classicAccount:r.classicAddress,tag:r.tag}}return{classicAccount:t,tag:e}}function f(t,e){const r=t[e];if("string"==typeof r){const{classicAccount:i}=c(r);t[e]=i}}function d(t,e){return new o.default(t).times(e).toString()}e.default=function(t,e){return i(this,void 0,void 0,(function*(){const r=Object.assign({},t);!function(t){l(t,"Account","SourceTag"),null!=t.Destination&&l(t,"Destination","DestinationTag"),f(t,"Authorize"),f(t,"Unauthorize"),f(t,"Owner"),f(t,"RegularKey")}(r),(0,u.default)(r);const n=[];return null==r.Sequence&&n.push(function(t,e){return i(this,void 0,void 0,(function*(){const r={command:"account_info",account:e.Account,ledger_index:"validated"},i=yield t.request(r);e.Sequence=i.result.account_data.Sequence}))}(this,r)),null==r.Fee&&n.push(function(t,e,r=0){return i(this,void 0,void 0,(function*(){const n=yield t.getFee(),a=(0,h.xrpToDrops)(n);let s=new o.default(a);if("EscrowFinish"===e.TransactionType&&null!=e.Fulfillment){const t=Math.ceil(e.Fulfillment.length/2);s=new o.default(d(a,33+t/16)).dp(0,o.default.ROUND_CEIL)}"AccountDelete"===e.TransactionType&&(s=yield function(t){var e;return i(this,void 0,void 0,(function*(){const r=yield t.request({command:"server_state"}),i=null===(e=r.result.state.validated_ledger)||void 0===e?void 0:e.reserve_inc;return null==i?Promise.reject(new Error("Could not fetch Owner Reserve.")):new o.default(i)}))}(t)),r>0&&(s=o.default.sum(s,d(a,1+r)));const u=(0,h.xrpToDrops)(t.maxFeeXRP),l="AccountDelete"===e.TransactionType?s:o.default.min(s,u);e.Fee=l.dp(0,o.default.ROUND_CEIL).toString(10)}))}(this,r,e)),null==r.LastLedgerSequence&&n.push(function(t,e){return i(this,void 0,void 0,(function*(){const r=yield t.getLedgerIndex();e.LastLedgerSequence=r+20}))}(this,r)),"AccountDelete"===r.TransactionType&&n.push(function(t,e){return i(this,void 0,void 0,(function*(){const r={command:"account_objects",account:e.Account,ledger_index:"validated",deletion_blockers_only:!0},i=yield t.request(r);return new Promise(((t,r)=>{i.result.account_objects.length>0&&r(new s.XrplError(`Account ${e.Account} cannot be deleted; there are Escrows, PayChannels, RippleStates, or Checks associated with the account.`,i.result.account_objects)),t()}))}))}(this,r)),Promise.all(n).then((()=>r))}))}},9889:function(t,e,r){"use strict";var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(6486)),a=r(7859);e.default=function(t,e={}){var r,n;return i(this,void 0,void 0,(function*(){const i=[];if(!e.peer){const n={command:"account_info",account:t,ledger_index:null!==(r=e.ledger_index)&&void 0!==r?r:"validated",ledger_hash:e.ledger_hash},o=yield this.request(n).then((t=>t.result.account_data.Balance));i.push({currency:"XRP",value:(0,a.dropsToXrp)(o)})}const s={command:"account_lines",account:t,ledger_index:null!==(n=e.ledger_index)&&void 0!==n?n:"validated",ledger_hash:e.ledger_hash,peer:e.peer,limit:e.limit},u=yield this.requestAll(s),h=o.default.flatMap(u,(t=>t.result.lines.map((t=>({value:t.balance,currency:t.currency,issuer:t.account})))));return[...i,...h].slice(0,e.limit)}))}},2289:function(t,e,r){"use strict";var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(4431));e.default=function(t){var e;return i(this,void 0,void 0,(function*(){const r=null!=t?t:this.feeCushion,i=(yield this.request({command:"server_info"})).result.info,n=null===(e=i.validated_ledger)||void 0===e?void 0:e.base_fee_xrp;if(null==n)throw new Error("getFee: Could not get base_fee_xrp from server_info");const a=new o.default(n);null==i.load_factor&&(i.load_factor=1);let s=a.times(i.load_factor).times(r);return s=o.default.min(s,this.maxFeeXRP),new o.default(s.toFixed(6)).toString(10)}))}},6491:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return r(this,void 0,void 0,(function*(){return(yield this.request({command:"ledger",ledger_index:"validated"})).result.ledger_index}))}},7015:function(t,e,r){"use strict";var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(4431)),a=n(r(6486)),s=r(7254);function u(t){return t.sort(((t,e)=>{var r,i;const n=null!==(r=t.quality)&&void 0!==r?r:0,a=null!==(i=e.quality)&&void 0!==i?i:0;return new o.default(n).comparedTo(a)}))}e.default=function(t,e,r={}){var n,o;return i(this,void 0,void 0,(function*(){const i={command:"book_offers",taker_pays:t,taker_gets:e,ledger_index:null!==(n=r.ledger_index)&&void 0!==n?n:"validated",ledger_hash:r.ledger_hash,limit:null!==(o=r.limit)&&void 0!==o?o:20,taker:r.taker},h=yield this.requestAll(i);i.taker_gets=t,i.taker_pays=e;const l=yield this.requestAll(i),c=[...a.default.flatMap(h,(t=>t.result.offers)),...a.default.flatMap(l,(t=>t.result.offers))],f=[],d=[];return c.forEach((t=>{0==(t.Flags&s.OfferFlags.lsfSell)?f.push(t):d.push(t)})),{buy:u(f).slice(0,r.limit),sell:u(d).slice(0,r.limit)}}))}},1179:function(t,e,r){"use strict";var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.submitSignedReliable=e.submitReliable=e.submitSigned=e.submit=void 0;const n=r(2353),o=r(2959),a=r(7859);function s(t,e){return i(this,void 0,void 0,(function*(){yield function(t){return i(this,void 0,void 0,(function*(){return new Promise((t=>{setTimeout(t,4e3)}))}))}();const r=yield t.request({command:"tx",transaction:e});if(r.result.validated)return r;const n=r.result.LastLedgerSequence;if(null==n)throw new o.XrplError("LastLedgerSequence cannot be null");const a=yield t.getLedgerIndex();if(n>a)return s(t,e);throw new o.XrplError(`The latest ledger sequence ${a} is greater than the transaction's LastLedgerSequence (${n}).`)}))}function u(t){const e="string"==typeof t?(0,n.decode)(t):t;return"string"!=typeof e&&(null!=e.SigningPubKey||null!=e.TxnSignature)}function h(t){return"AccountDelete"===("string"==typeof t?(0,n.decode)(t):t).TransactionType}e.submit=function(t,e){return i(this,void 0,void 0,(function*(){const r=yield this.autofill(e),{tx_blob:i}=t.sign(r);return this.submitSigned(i)}))},e.submitSigned=function(t){return i(this,void 0,void 0,(function*(){if(!u(t))throw new o.ValidationError("Transaction must be signed");const e={command:"submit",tx_blob:"string"==typeof t?t:(0,n.encode)(t),fail_hard:h(t)};return this.request(e)}))},e.submitReliable=function(t,e){return i(this,void 0,void 0,(function*(){const r=yield this.autofill(e),{tx_blob:i}=t.sign(r);return this.submitSignedReliable(i)}))},e.submitSignedReliable=function(t){return i(this,void 0,void 0,(function*(){if(!u(t))throw new o.ValidationError("Transaction must be signed");if(!function(t){const e="string"==typeof t?(0,n.decode)(t):t;return"string"!=typeof e&&null!=e.LastLedgerSequence}(t))throw new o.ValidationError("Transaction must contain a LastLedgerSequence value for reliable submission.");const e="string"==typeof t?t:(0,n.encode)(t),r=a.hashes.hashSignedTx(t),i={command:"submit",tx_blob:e,fail_hard:h(t)};return yield this.request(i),s(this,r)}))}},7635:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ensureClassicAddress=void 0;const i=r(8914);e.ensureClassicAddress=function(t){if((0,i.isValidXAddress)(t)){const{classicAddress:e,tag:r}=(0,i.xAddressToClassicAddress)(t);if(!1!==r)throw new Error("This command does not support the use of a tag. Use an address without a tag.");return e}return t}},7311:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(4431)),o=i(r(6486)),a=r(9162);function s(t){const e=Object.keys(t)[0],r=t[e];return Object.assign(Object.assign({},r),{NodeType:e,LedgerEntryType:r.LedgerEntryType,LedgerIndex:r.LedgerIndex,NewFields:r.NewFields,FinalFields:r.FinalFields,PreviousFields:r.PreviousFields})}function u(t){return"string"==typeof t?new n.default(t):new n.default(t.value)}function h(t){var e,r,i;let n=null;return(null===(e=t.NewFields)||void 0===e?void 0:e.Balance)?n=u(t.NewFields.Balance):(null===(r=t.PreviousFields)||void 0===r?void 0:r.Balance)&&(null===(i=t.FinalFields)||void 0===i?void 0:i.Balance)&&(n=u(t.FinalFields.Balance).minus(u(t.PreviousFields.Balance))),null===n||n.isZero()?null:n}function l(t){const e=new n.default(t.balance.value).negated();return{account:t.balance.issuer,balance:{issuer:t.account,currency:t.balance.currency,value:e.toString()}}}e.default=function(t){const e=function(t){return 0===t.AffectedNodes.length?[]:t.AffectedNodes.map(s)}(t).map((t=>{if("AccountRoot"===t.LedgerEntryType){const e=function(t){var e,r,i;const n=h(t);return null===n?null:{account:null!==(r=null===(e=t.FinalFields)||void 0===e?void 0:e.Account)&&void 0!==r?r:null===(i=t.NewFields)||void 0===i?void 0:i.Account,balance:{currency:"XRP",value:(0,a.dropsToXrp)(n).toString()}}}(t);return null==e?[]:[e]}if("RippleState"===t.LedgerEntryType){const e=function(t){var e,r;const i=h(t);if(null===i)return null;const n=null==t.NewFields?t.FinalFields:t.NewFields,o={account:null===(e=null==n?void 0:n.LowLimit)||void 0===e?void 0:e.issuer,balance:{issuer:null===(r=null==n?void 0:n.HighLimit)||void 0===r?void 0:r.issuer,currency:(null==n?void 0:n.Balance).currency,value:i.toString()}};return[o,l(o)]}(t);return null==e?[]:e}return[]}));return function(t){const e=o.default.groupBy(t,(t=>t.account));return Object.entries(e).map((([t,e])=>({account:t,balances:e.map((t=>t.balance))})))}(o.default.flatten(e))}},9422:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.deriveXAddress=e.deriveKeypair=void 0;const i=r(8914),n=r(9140);Object.defineProperty(e,"deriveKeypair",{enumerable:!0,get:function(){return n.deriveKeypair}}),e.deriveXAddress=function(t){const e=(0,n.deriveAddress)(t.publicKey);return(0,i.classicAddressToXAddress)(e,t.tag,t.test)}},6708:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.generateXAddress=void 0;const n=r(8914),o=i(r(9140)),a=r(2959);e.generateXAddress=function(t={}){var e;try{const r={algorithm:t.algorithm};t.entropy&&(r.entropy=Uint8Array.from(t.entropy));const i=o.default.generateSeed(r),a=o.default.deriveKeypair(i),s=o.default.deriveAddress(a.publicKey),u={xAddress:(0,n.classicAddressToXAddress)(s,!1,null!==(e=t.test)&&void 0!==e&&e),secret:i};return t.includeClassicAddress&&(u.classicAddress=s),u}catch(t){if(t instanceof Error)throw new a.UnexpectedError(t.message);throw t}}},6567:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.TRANSACTION_ID=1415073280]="TRANSACTION_ID",t[t.TRANSACTION_NODE=1397638144]="TRANSACTION_NODE",t[t.INNER_NODE=1296649728]="INNER_NODE",t[t.LEAF_NODE=1296846336]="LEAF_NODE",t[t.TRANSACTION_SIGN=1398036480]="TRANSACTION_SIGN",t[t.TRANSACTION_SIGN_TESTNET=1937012736]="TRANSACTION_SIGN_TESTNET",t[t.TRANSACTION_MULTISIGN=1397576704]="TRANSACTION_MULTISIGN",t[t.LEDGER=1280791040]="LEDGER"}(r||(r={})),e.default=r},3617:function(t,e,r){"use strict";var i=r(8764).Buffer,n=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashTxTree=e.hashStateTree=e.hashLedger=e.hashSignedTx=e.hashLedgerHeader=e.hashPaymentChannel=e.hashEscrow=e.hashTrustline=e.hashOfferId=e.hashSignerListId=e.hashAccountRoot=e.hashTx=void 0;const u=s(r(4431)),h=r(8914),l=s(r(6567)),c=a(r(3538));e.hashLedger=c.default,Object.defineProperty(e,"hashLedgerHeader",{enumerable:!0,get:function(){return c.hashLedgerHeader}}),Object.defineProperty(e,"hashSignedTx",{enumerable:!0,get:function(){return c.hashSignedTx}}),Object.defineProperty(e,"hashTxTree",{enumerable:!0,get:function(){return c.hashTxTree}}),Object.defineProperty(e,"hashStateTree",{enumerable:!0,get:function(){return c.hashStateTree}});const f=s(r(5590)),d=s(r(5333)),p=16;function m(t){return i.from((0,h.decodeAccountID)(t)).toString("hex")}function g(t){return f.default[t].charCodeAt(0).toString(p).padStart(4,"0")}e.hashTx=function(t){const e=l.default.TRANSACTION_SIGN.toString(p).toUpperCase();return(0,d.default)(e+t)},e.hashAccountRoot=function(t){return(0,d.default)(g("account")+m(t))},e.hashSignerListId=function(t){return(0,d.default)(`${g("signerList")+m(t)}00000000`)},e.hashOfferId=function(t,e){const r=f.default.offer.charCodeAt(0).toString(p).padStart(2,"0"),i=e.toString(p).padStart(8,"0"),n=`00${r}`;return(0,d.default)(n+m(t)+i)},e.hashTrustline=function(t,e,r){const n=m(t),o=m(e),a=new u.default(n,16).isGreaterThan(new u.default(o,16)),s=a?o:n,h=a?n:o,l=g("rippleState");return(0,d.default)(l+s+h+function(t){if(3!==t.length)return t;const e=Array(20).fill(0);return e[12]=255&t.charCodeAt(0),e[13]=255&t.charCodeAt(1),e[14]=255&t.charCodeAt(2),i.from(e).toString("hex")}(r))},e.hashEscrow=function(t,e){return(0,d.default)(g("escrow")+m(t)+e.toString(p).padStart(8,"0"))},e.hashPaymentChannel=function(t,e,r){return(0,d.default)(g("paychan")+m(t)+m(e)+r.toString(p).padStart(8,"0"))}},3538:function(t,e,r){"use strict";var i=r(8764).Buffer,n=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.hashStateTree=e.hashTxTree=e.hashLedgerHeader=e.hashSignedTx=void 0;const u=s(r(4431)),h=r(2353),l=r(2959),c=s(r(6567)),f=s(r(5333)),d=a(r(7935));function p(t,e){return Number(t).toString(16).padStart(2*e,"0")}function m(t){return i.from(t).toString("hex")}function g(t){const e=t.length/2;if(e<=192)return m([e])+t;if(e<=12480){const r=e-193;return m([193+(r>>>8),255&r])+t}if(e<=918744){const r=e-12481;return m([241+(r>>>16),r>>>8&255,255&r])+t}throw new Error("Variable integer overflow.")}function v(t){let e,r;if("string"==typeof t?(e=t,r=(0,h.decode)(t)):(e=(0,h.encode)(t),r=t),void 0===r.TxnSignature&&void 0===r.Signers)throw new l.ValidationError("The transaction must be signed to hash it.");const i=c.default.TRANSACTION_ID.toString(16).toUpperCase();return(0,f.default)(i.concat(e))}function y(t){const e=c.default.LEDGER.toString(16).toUpperCase()+p(Number(t.ledger_index),4)+(r=t.total_coins,8,new u.default(r).toString(16).padStart(16,"0"))+t.parent_hash+t.transaction_hash+t.account_hash+p(t.parent_close_time,4)+p(t.close_time,4)+p(t.close_time_resolution,1)+p(t.close_flags,1);var r;return(0,f.default)(e)}function b(t){var e;const r=new d.default;for(const i of t){const t=(0,h.encode)(i),n=(0,h.encode)(null!==(e=i.metaData)&&void 0!==e?e:{}),o=v(t),a=g(t)+g(n);r.addItem(o,a,d.NodeType.TRANSACTION_METADATA)}return r.hash}function w(t){const e=new d.default;return t.forEach((t=>{const r=(0,h.encode)(t);e.addItem(t.index,r,d.NodeType.ACCOUNT_STATE)})),e.hash}function M(t,e){const{transaction_hash:r}=t;if(!e.computeTreeHashes)return r;if(null==t.transactions)throw new l.ValidationError("transactions is missing from the ledger");const i=b(t.transactions);if(r!==i)throw new l.ValidationError("transactionHash in header does not match computed hash of transactions",{transactionHashInHeader:r,computedHashOfTransactions:i});return i}function _(t,e){const{account_hash:r}=t;if(!e.computeTreeHashes)return r;if(null==t.accountState)throw new l.ValidationError("accountState is missing from the ledger");const i=w(t.accountState);if(r!==i)throw new l.ValidationError("stateHash in header does not match computed hash of state");return i}e.hashSignedTx=v,e.hashLedgerHeader=y,e.hashTxTree=b,e.hashStateTree=w,e.default=function(t,e={}){const r={transaction_hash:M(t,e),account_hash:_(t,e)};return y(Object.assign(Object.assign({},t),r))}},5590:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={account:"a",dirNode:"d",generatorMap:"g",rippleState:"r",offer:"o",ownerDir:"O",bookDir:"B",contract:"c",skipList:"s",escrow:"u",amendment:"f",feeSettings:"e",ticket:"T",signerList:"S",paychan:"x",check:"C",depositPreauth:"p"}},5333:(t,e,r)=>{"use strict";var i=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const n=r(5835);e.default=function(t){return(0,n.createHash)("sha512").update(i.from(t,"hex")).digest("hex").toUpperCase().slice(0,64)}},7935:function(t,e,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||i(e,t,r)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const a=o(r(6615)),s=o(r(8340));n(r(3888),e),e.default=class{constructor(){this.root=new a.default(0)}addItem(t,e,r){this.root.addItem(t,new s.default(t,e,r))}get hash(){return this.root.hash}}},6615:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(6567)),o=i(r(5333)),a=i(r(8340)),s=r(3888),u="0000000000000000000000000000000000000000000000000000000000000000";class h extends s.Node{constructor(t=0){super(),this.leaves={},this.type=s.NodeType.INNER,this.depth=t,this.empty=!0}addItem(t,e){const r=this.getNode(parseInt(t[this.depth],16));if(void 0!==r){if(r instanceof h)r.addItem(t,e);else if(r instanceof a.default){if(r.tag===t)throw new Error("Tried to add a node to a SHAMap that was already in there.");{const i=new h(this.depth+1);i.addItem(r.tag,r),i.addItem(t,e),this.setNode(parseInt(t[this.depth],16),i)}}}else this.setNode(parseInt(t[this.depth],16),e)}setNode(t,e){if(t<0||t>15)throw new Error("Invalid slot: slot must be between 0-15.");this.leaves[t]=e,this.empty=!1}getNode(t){if(t<0||t>15)throw new Error("Invalid slot: slot must be between 0-15.");return this.leaves[t]}get hash(){if(this.empty)return u;let t="";for(let e=0;e<=15;e++){const r=this.leaves[e];t+=null==r?u:r.hash}const e=n.default.INNER_NODE.toString(16);return(0,o.default)(e+t)}}e.default=h},8340:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(6567)),o=i(r(5333)),a=r(3888);class s extends a.Node{constructor(t,e,r){super(),this.tag=t,this.type=r,this.data=e}addItem(t,e){throw new Error("Cannot call addItem on a LeafNode")}get hash(){switch(this.type){case a.NodeType.ACCOUNT_STATE:{const t=n.default.LEAF_NODE.toString(16);return(0,o.default)(t+this.data+this.tag)}case a.NodeType.TRANSACTION_NO_METADATA:{const t=n.default.TRANSACTION_ID.toString(16);return(0,o.default)(t+this.data)}case a.NodeType.TRANSACTION_METADATA:{const t=n.default.TRANSACTION_NODE.toString(16);return(0,o.default)(t+this.data+this.tag)}default:throw new Error("Tried to hash a SHAMap node of unknown type.")}}}e.default=s},3888:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.Node=e.NodeType=void 0,(r=e.NodeType||(e.NodeType={}))[r.INNER=1]="INNER",r[r.TRANSACTION_NO_METADATA=2]="TRANSACTION_NO_METADATA",r[r.TRANSACTION_METADATA=3]="TRANSACTION_METADATA",r[r.ACCOUNT_STATE=4]="ACCOUNT_STATE",e.Node=class{}},7859:function(t,e,r){"use strict";var i=r(8764).Buffer,n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decodeXAddress=e.encodeXAddress=e.decodeAccountPublic=e.encodeAccountPublic=e.decodeNodePublic=e.encodeNodePublic=e.decodeAccountID=e.encodeAccountID=e.decodeSeed=e.encodeSeed=e.isValidClassicAddress=e.isValidXAddress=e.xAddressToClassicAddress=e.classicAddressToXAddress=e.convertStringToHex=e.verifyPaymentChannelClaim=e.signPaymentChannelClaim=e.deriveXAddress=e.deriveKeypair=e.generateXAddress=e.hashes=e.isValidAddress=e.isValidSecret=e.unixTimeToRippleTime=e.rippleTimeToUnixTime=e.ISOTimeToRippleTime=e.rippleTimeToISOTime=e.removeUndefined=e.xrpToDrops=e.dropsToXrp=e.getBalanceChanges=void 0;const o=r(8914);Object.defineProperty(e,"classicAddressToXAddress",{enumerable:!0,get:function(){return o.classicAddressToXAddress}}),Object.defineProperty(e,"decodeAccountID",{enumerable:!0,get:function(){return o.decodeAccountID}}),Object.defineProperty(e,"decodeAccountPublic",{enumerable:!0,get:function(){return o.decodeAccountPublic}}),Object.defineProperty(e,"decodeNodePublic",{enumerable:!0,get:function(){return o.decodeNodePublic}}),Object.defineProperty(e,"decodeSeed",{enumerable:!0,get:function(){return o.decodeSeed}}),Object.defineProperty(e,"decodeXAddress",{enumerable:!0,get:function(){return o.decodeXAddress}}),Object.defineProperty(e,"encodeAccountID",{enumerable:!0,get:function(){return o.encodeAccountID}}),Object.defineProperty(e,"encodeAccountPublic",{enumerable:!0,get:function(){return o.encodeAccountPublic}}),Object.defineProperty(e,"encodeNodePublic",{enumerable:!0,get:function(){return o.encodeNodePublic}}),Object.defineProperty(e,"encodeSeed",{enumerable:!0,get:function(){return o.encodeSeed}}),Object.defineProperty(e,"encodeXAddress",{enumerable:!0,get:function(){return o.encodeXAddress}}),Object.defineProperty(e,"isValidClassicAddress",{enumerable:!0,get:function(){return o.isValidClassicAddress}}),Object.defineProperty(e,"isValidXAddress",{enumerable:!0,get:function(){return o.isValidXAddress}}),Object.defineProperty(e,"xAddressToClassicAddress",{enumerable:!0,get:function(){return o.xAddressToClassicAddress}});const a=n(r(7311));e.getBalanceChanges=a.default;const s=r(9422);Object.defineProperty(e,"deriveKeypair",{enumerable:!0,get:function(){return s.deriveKeypair}}),Object.defineProperty(e,"deriveXAddress",{enumerable:!0,get:function(){return s.deriveXAddress}});const u=r(6708);Object.defineProperty(e,"generateXAddress",{enumerable:!0,get:function(){return u.generateXAddress}});const h=r(3617),l=n(r(7030));e.signPaymentChannelClaim=l.default;const c=r(1755);Object.defineProperty(e,"rippleTimeToISOTime",{enumerable:!0,get:function(){return c.rippleTimeToISOTime}}),Object.defineProperty(e,"ISOTimeToRippleTime",{enumerable:!0,get:function(){return c.ISOTimeToRippleTime}}),Object.defineProperty(e,"rippleTimeToUnixTime",{enumerable:!0,get:function(){return c.rippleTimeToUnixTime}}),Object.defineProperty(e,"unixTimeToRippleTime",{enumerable:!0,get:function(){return c.unixTimeToRippleTime}});const f=n(r(1610));e.verifyPaymentChannelClaim=f.default;const d=r(9162);Object.defineProperty(e,"xrpToDrops",{enumerable:!0,get:function(){return d.xrpToDrops}}),Object.defineProperty(e,"dropsToXrp",{enumerable:!0,get:function(){return d.dropsToXrp}}),e.isValidSecret=function(t){try{return(0,s.deriveKeypair)(t),!0}catch(t){return!1}},e.isValidAddress=function(t){return(0,o.isValidXAddress)(t)||(0,o.isValidClassicAddress)(t)},e.removeUndefined=function(t){const e=Object.assign({},t);return Object.entries(t).forEach((([t,r])=>{null==r&&delete e[t]})),e},e.convertStringToHex=function(t){return i.from(t,"utf8").toString("hex").toUpperCase()};const p={hashSignedTx:h.hashSignedTx,hashTx:h.hashTx,hashAccountRoot:h.hashAccountRoot,hashSignerListId:h.hashSignerListId,hashOfferId:h.hashOfferId,hashTrustline:h.hashTrustline,hashTxTree:h.hashTxTree,hashStateTree:h.hashStateTree,hashLedger:h.hashLedger,hashLedgerHeader:h.hashLedgerHeader,hashEscrow:h.hashEscrow,hashPaymentChannel:h.hashPaymentChannel};e.hashes=p},7030:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(2353)),o=i(r(9140)),a=r(9162);e.default=function(t,e,r){const i=n.default.encodeForSigningClaim({channel:t,amount:(0,a.xrpToDrops)(e)});return o.default.sign(i,r)}},1755:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ISOTimeToRippleTime=e.rippleTimeToISOTime=e.unixTimeToRippleTime=e.rippleTimeToUnixTime=void 0;const r=946684800;function i(t){return 1e3*(t+r)}function n(t){return Math.round(t/1e3)-r}e.rippleTimeToUnixTime=i,e.unixTimeToRippleTime=n,e.rippleTimeToISOTime=function(t){return new Date(i(t)).toISOString()},e.ISOTimeToRippleTime=function(t){return n(Date.parse(t))}},1610:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(r(2353)),o=i(r(9140)),a=r(9162);e.default=function(t,e,r,i){const s=n.default.encodeForSigningClaim({channel:t,amount:(0,a.xrpToDrops)(e)});return o.default.verify(s,r,i)}},9162:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.xrpToDrops=e.dropsToXrp=void 0;const n=i(r(4431)),o=r(2959),a=1e6,s=/^-?[0-9.]+$/u;e.dropsToXrp=function(t){let e=t;if("string"==typeof e){if(!/^-?[0-9]*\.?[0-9]*$/u.exec(e))throw new o.ValidationError(`dropsToXrp: invalid value '${e}', should be a number matching (^-?[0-9]*\\.?[0-9]*$).`);if("."===e)throw new o.ValidationError(`dropsToXrp: invalid value '${e}', should be a BigNumber or string-encoded number.`)}if(e=new n.default(e).toString(10),e.includes("."))throw new o.ValidationError(`dropsToXrp: value '${e}' has too many decimal places.`);if(!s.exec(e))throw new o.ValidationError(`dropsToXrp: failed sanity check - value '${e}', does not match (^-?[0-9]+$).`);return new n.default(e).dividedBy(a).toString(10)},e.xrpToDrops=function(t){let e=t;if("string"==typeof e){if(!/^-?[0-9]*\.?[0-9]*$/u.exec(e))throw new o.ValidationError(`xrpToDrops: invalid value '${e}', should be a number matching (^-?[0-9]*\\.?[0-9]*$).`);if("."===e)throw new o.ValidationError(`xrpToDrops: invalid value '${e}', should be a BigNumber or string-encoded number.`)}if(e=new n.default(e).toString(10),!s.exec(e))throw new o.ValidationError(`xrpToDrops: failed sanity check - value '${e}', does not match (^-?[0-9.]+$).`);const r=e.split(".");if(r.length>2)throw new o.ValidationError(`xrpToDrops: failed sanity check - value '${e}' has too many decimal points.`);if((r[1]||"0").length>6)throw new o.ValidationError(`xrpToDrops: value '${e}' has too many decimal places.`);return new n.default(e).times(a).integerValue(n.default.ROUND_FLOOR).toString(10)}},9561:function(t,e,r){"use strict";var i=r(8764).Buffer,n=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e._private=void 0;const a=r(9267),s=r(8914),u=r(2959),h=o(r(4786));var l;function c(t,e){return n(this,void 0,void 0,(function*(){try{return(yield t.request({command:"account_info",account:e,ledger_index:"validated"})).result.account_data.Balance}catch(t){if(t instanceof Error)throw new u.XRPLFaucetError(`Unable to retrieve balance of ${e}. Error: ${t.message}`);throw t}}))}function f(t,e,r){return n(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{let a=20;const s=setInterval((()=>n(this,void 0,void 0,(function*(){a<0?(clearInterval(s),i(r)):a-=1;try{let n;try{n=Number(yield c(t,e))}catch(t){}n>r&&(clearInterval(s),i(n))}catch(t){clearInterval(s),t instanceof Error&&o(new u.XRPLFaucetError(`Unable to check if the address ${e} balance has increased. Error: ${t.message}`)),o(t)}}))),1e3)}))}))}function d(t){const e=t.connection.getUrl();if(e.includes("altnet")||e.includes("testnet"))return l.Testnet;if(e.includes("devnet"))return l.Devnet;throw new u.XRPLFaucetError("Faucet URL is not defined or inferrable.")}!function(t){t.Testnet="faucet.altnet.rippletest.net",t.Devnet="faucet.devnet.rippletest.net"}(l||(l={})),e.default=function(t){return n(this,void 0,void 0,(function*(){if(!this.isConnected())throw new u.RippledError("Client not connected, cannot call faucet");const e=t&&(0,s.isValidClassicAddress)(t.classicAddress)?t:h.default.generate(),r=i.from((new TextEncoder).encode(JSON.stringify({destination:e.classicAddress})));let o=0;try{o=Number(yield c(this,e.classicAddress))}catch(t){}return function(t,e,r,o,s){return n(this,void 0,void 0,(function*(){return new Promise(((h,l)=>{const c=(0,a.request)(t,(t=>{const a=[];t.on("data",(t=>a.push(t))),t.on("end",(()=>n(this,void 0,void 0,(function*(){return function(t,e,r,o,a,s,h){var l;return n(this,void 0,void 0,(function*(){const c=i.concat(e).toString();(null===(l=t.headers["content-type"])||void 0===l?void 0:l.startsWith("application/json"))?yield function(t,e,r,i,o,a){return n(this,void 0,void 0,(function*(){const n=JSON.parse(e).account.classicAddress;if(n)try{(yield f(t,n,r))>r?o({wallet:i,balance:yield f(t,i.getClassicAddress(),r)}):a(new u.XRPLFaucetError("Unable to fund address with faucet after waiting 20 seconds"))}catch(t){t instanceof Error&&a(new u.XRPLFaucetError(t.message)),a(t)}else a(new u.XRPLFaucetError("The faucet account is undefined"))}))}(r,c,o,a,s,h):h(new u.XRPLFaucetError(`Content type is not \`application/json\`: ${JSON.stringify({statusCode:t.statusCode,contentType:t.headers["content-type"],body:c})}`))}))}(t,a,e,r,o,h,l)}))))}));c.write(s),c.on("error",(t=>{l(t)})),c.end()}))}))}(function(t,e){return{hostname:d(t),port:443,path:"/accounts",method:"POST",headers:{"Content-Type":"application/json","Content-Length":e.length}}}(this,r),this,o,e,r)}))};const p={FaucetNetwork:l,getFaucetUrl:d};e._private=p},4786:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=r(7786),o=r(2153),a=i(r(6486)),s=r(8914),u=r(2353),h=r(9140),l=i(r(7269)),c=r(2959),f=r(3538),d=l.default.ed25519;function p(t){return t.toString("hex").toUpperCase()}class m{constructor(t,e,r){this.publicKey=t,this.privateKey=e,this.classicAddress=(0,h.deriveAddress)(t),this.seed=r}get address(){return this.classicAddress}static generate(t=d){const e=(0,h.generateSeed)({algorithm:t});return m.fromSeed(e)}static fromSeed(t,e=d){return m.deriveWallet(t,e)}static fromMnemonic(t,e="m/44'/144'/0'/0/0"){const r=(0,o.mnemonicToSeedSync)(t),i=(0,n.fromSeed)(r).derivePath(e);if(void 0===i.privateKey)throw new c.ValidationError("Unable to derive privateKey from mnemonic input");const a=p(i.publicKey),s=p(i.privateKey);return new m(a,`00${s}`)}static fromEntropy(t,e=d){const r={entropy:Uint8Array.from(t),algorithm:e},i=(0,h.generateSeed)(r);return m.deriveWallet(i,e)}static deriveWallet(t,e=d){const{publicKey:r,privateKey:i}=(0,h.deriveKeypair)(t,{algorithm:e});return new m(r,i,t)}sign(t,e){let r=!1;if("string"==typeof e&&e.startsWith("X")?r=e:e&&(r=this.getClassicAddress()),t.TxnSignature||t.Signers)throw new c.ValidationError('txJSON must not contain "TxnSignature" or "Signers" properties');const i=Object.assign({},t);if(i.SigningPubKey=r?"":this.publicKey,r){const t={Account:r,SigningPubKey:this.publicKey,TxnSignature:g(i,this.privateKey,r)};i.Signers=[{Signer:t}]}else i.TxnSignature=g(i,this.privateKey);const n=(0,u.encode)(i);return this.checkTxSerialization(n,t),{tx_blob:n,hash:(0,f.hashSignedTx)(n)}}verifyTransaction(t){const e=(0,u.decode)(t),r=(0,u.encodeForSigning)(e),i=e.TxnSignature;return(0,h.verify)(r,i,this.publicKey)}getXAddress(t=!1,e=!1){return(0,s.classicAddressToXAddress)(this.classicAddress,t,e)}getClassicAddress(){return this.classicAddress}checkTxSerialization(t,e){var r;const i=(0,u.decode)(t),n=Object.assign({},e);if(!i.TxnSignature&&!i.Signers)throw new c.ValidationError("Serialized transaction must have a TxnSignature or Signers property");if(delete i.TxnSignature,delete i.Signers,e.SigningPubKey||delete i.SigningPubKey,null===(r=n.Memos)||void 0===r||r.map((t=>{const e=Object.assign({},t);return t.Memo.MemoData&&(e.Memo.MemoData=t.Memo.MemoData.toUpperCase()),t.Memo.MemoType&&(e.Memo.MemoType=t.Memo.MemoType.toUpperCase()),t.Memo.MemoFormat&&(e.Memo.MemoFormat=t.Memo.MemoFormat.toUpperCase()),t})),!a.default.isEqual(i,e)){const t={decoded:i,tx:e};throw new c.ValidationError("Serialized transaction does not match original txJSON. See error.data",t)}}}function g(t,e,r){if(r){const i=(0,s.isValidXAddress)(r)?(0,s.xAddressToClassicAddress)(r).classicAddress:r;return(0,h.sign)((0,u.encodeForMultisigning)(t,i),e)}return(0,h.sign)((0,u.encodeForSigning)(t),e)}m.fromSecret=m.fromSeed,e.default=m},4898:(t,e,r)=>{"use strict";var i=r(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.multisign=e.verifySignature=e.authorizeChannel=void 0;const n=r(4431),o=r(6486),a=r(8914),s=r(2353),u=r(9140),h=r(2959),l=r(3870);function c(t,e){return f(t.Signer.Account).comparedTo(f(e.Signer.Account))}function f(t){const e=i.from((0,a.decodeAccountID)(t)).toString("hex");return new n.BigNumber(e,16)}function d(t){return"object"==typeof t?t:(0,s.decode)(t)}e.multisign=function(t){if(0===t.length)throw new h.ValidationError("There were 0 transactions to multisign");t.forEach((t=>{const e=d(t);if((0,l.validateBaseTransaction)(e),null==e.Signers||0===e.Signers.length)throw new h.ValidationError("For multisigning all transactions must include a Signers field containing an array of signatures. You may have forgotten to pass the 'forMultisign' parameter when signing.");if(""!==e.SigningPubKey)throw new h.ValidationError("SigningPubKey must be an empty string for all transactions when multisigning.")}));const e=t.map((t=>d(t)));return function(t){const e=JSON.stringify(Object.assign(Object.assign({},t[0]),{Signers:null}));if(t.slice(1).some((t=>JSON.stringify(Object.assign(Object.assign({},t),{Signers:null}))!==e)))throw new h.ValidationError("txJSON is not the same for all signedTransactions")}(e),(0,s.encode)(function(t){const e=(0,o.flatMap)(t,(t=>{var e;return null!==(e=t.Signers)&&void 0!==e?e:[]})).sort(c);return Object.assign(Object.assign({},t[0]),{Signers:e})}(e))},e.authorizeChannel=function(t,e,r){const i=(0,s.encodeForSigningClaim)({channel:e,amount:r});return(0,u.sign)(i,t.privateKey)},e.verifySignature=function(t){const e=d(t);return(0,u.verify)((0,s.encodeForSigning)(e),e.TxnSignature,e.SigningPubKey)}},9809:(t,e,r)=>{"use strict";const i=e;i.bignum=r(4590),i.define=r(2500).define,i.base=r(1979),i.constants=r(6826),i.decoders=r(8307),i.encoders=r(6579)},2500:(t,e,r)=>{"use strict";const i=r(6579),n=r(8307),o=r(5717);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return o(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},6625:(t,e,r)=>{"use strict";const i=r(5717),n=r(8465).b,o=r(2399).Buffer;function a(t,e){n.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}i(a,n),e.C=a,a.isDecoderBuffer=function(t){return t instanceof a||"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.R=s,s.isEncoderBuffer=function(t){return t instanceof s||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},1979:(t,e,r)=>{"use strict";const i=e;i.Reporter=r(8465).b,i.DecoderBuffer=r(6625).C,i.EncoderBuffer=r(6625).R,i.Node=r(1949)},1949:(t,e,r)=>{"use strict";const i=r(8465).b,n=r(6625).R,o=r(6625).C,a=r(9746),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function h(t,e,r){const i={};this._baseState=i,i.name=r,i.enc=t,i.parent=e||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=h;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];h.prototype.clone=function(){const t=this._baseState,e={};l.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},h.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},h.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},h.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){h.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){h.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),h.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},h.prototype.optional=function(){return this._baseState.optional=!0,this},h.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},h.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},h.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},h.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},h.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},h.prototype.any=function(){return this._baseState.any=!0,this},h.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},h.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},h.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let i,n=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let i=null;if(null!==r.explicit?i=r.explicit:null!==r.implicit?i=r.implicit:null!==r.tag&&(i=r.tag),null!==i||r.any){if(a=this._peekTag(t,i,r.any),t.isError(a))return a}else{const i=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(i)}}if(r.obj&&a&&(i=t.enterObject()),a){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const i=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const i=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(i))return i;r.any?n=t.raw(e):t=i}if(e&&e.track&&null!==r.tag&&e.track(t.path(),i,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const i=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(i,e)}}return r.obj&&a&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},h.prototype._decodeGeneric=function(t,e,r){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},h.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},h.prototype._decodeChoice=function(t,e){const r=this._baseState;let i=null,n=!1;return Object.keys(r.choice).some((function(o){const a=t.save(),s=r.choice[o];try{const r=s._decode(t,e);if(t.isError(r))return!1;i={type:o,value:r},n=!0}catch(e){return t.restore(a),!1}return!0}),this),n?i:t.error("Choice not matched")},h.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},h.prototype._encode=function(t,e,r){const i=this._baseState;if(null!==i.default&&i.default===t)return;const n=this._encodeValue(t,e,r);return void 0===n||this._skipDefault(n,e,r)?void 0:n},h.prototype._encodeValue=function(t,e,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);let o=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}let a=null,s=!1;if(n.any)o=this._createEncoderBuffer(t);else if(n.choice)o=this._encodeChoice(t,e);else if(n.contains)a=this._getUse(n.contains,r)._encode(t,e),s=!0;else if(n.children)a=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){const i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),r))}else null!==n.use?o=this._getUse(n.use,r)._encode(t,e):(a=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){const t=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===t?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(t,s,r,a))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},h.prototype._encodeChoice=function(t,e){const r=this._baseState,i=r.choice[t.type];return i||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},h.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},h.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},h.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},8465:(t,e,r)=>{"use strict";const i=r(5717);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.b=n,n.prototype.isError=function(t){return t instanceof o},n.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){let e;const r=this._reporterState,i=t instanceof o;if(e=i?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},n.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},160:(t,e)=>{"use strict";function r(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const i=t[r];e[i]=r})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=r(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=r(e.tag)},6826:(t,e,r)=>{"use strict";const i=e;i._reverse=function(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const i=t[r];e[i]=r})),e},i.der=r(160)},1671:(t,e,r)=>{"use strict";const i=r(5717),n=r(4590),o=r(6625).C,a=r(1949),s=r(160);function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){a.call(this,"der",t)}function l(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const i=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){let i=r;for(r=0;128==(128&i);){if(i=t.readUInt8(e),t.isError(i))return i;r<<=7,r|=127&i}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function c(t,e,r){let i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;const n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(let e=0;e=0;i--){for(var h=e.words[i],l=u-1;l>=0;l--){var c=h>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===l)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9282:(t,e,r)=>{"use strict";var i=r(4155);function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o,a,s=r(2136).codes,u=s.ERR_AMBIGUOUS_ARGUMENT,h=s.ERR_INVALID_ARG_TYPE,l=s.ERR_INVALID_ARG_VALUE,c=s.ERR_INVALID_RETURN_VALUE,f=s.ERR_MISSING_ARGS,d=r(5961),p=r(9539).inspect,m=r(9539).types,g=m.isPromise,v=m.isRegExp,y=Object.assign?Object.assign:r(8091).assign,b=Object.is?Object.is:r(609);function w(){var t=r(9158);o=t.isDeepEqual,a=t.isDeepStrictEqual}new Map;var M=!1,_=t.exports=A,S={};function E(t){if(t.message instanceof Error)throw t.message;throw new d(t)}function k(t,e,r,i){if(!r){var n=!1;if(0===e)n=!0,i="No value argument passed to `assert.ok()`";else if(i instanceof Error)throw i;var o=new d({actual:r,expected:!0,message:i,operator:"==",stackStartFn:t});throw o.generatedMessage=n,o}}function A(){for(var t=arguments.length,e=new Array(t),r=0;r =0;i--){for(var h=e.words[i],l=u-1;l>=0;l--){var c=h>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===l)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},n(x,A),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9931:(t,e,r)=>{var i;function n(t){this.rand=t}if(t.exports=function(t){return i||(i=new n(null)),i.generate(t)},t.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,i){for(var n,o,a=[],s=e;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},4736:(t,e,r)=>{var i;t=r.nmd(t);var n=function(t){"use strict";var e=1e7,r=9007199254740992,i=f(r),o="0123456789abcdefghijklmnopqrstuvwxyz",a="function"==typeof BigInt;function s(t,e,r,i){return void 0===t?s[0]:void 0===e||10==+e&&!r?G(t):H(t,e,r,i)}function u(t,e){this.value=t,this.sign=e,this.isSmall=!1}function h(t){this.value=t,this.sign=t<0,this.isSmall=!0}function l(t){this.value=t}function c(t){return-r-r?new h(t-1):new u(i,!0)},l.prototype.prev=function(){return new l(this.value-BigInt(1))};for(var B=[1];2*B[B.length-1]<=e;)B.push(2*B[B.length-1]);var P=B.length,R=B[P-1];function N(t){return Math.abs(t)<=e}function C(t,e,r){e=G(e);for(var i=t.isNegative(),o=e.isNegative(),a=i?t.not():t,s=o?e.not():e,u=0,h=0,l=null,c=null,f=[];!a.isZero()||!s.isZero();)u=(l=T(a,R))[1].toJSNumber(),i&&(u=R-1-u),h=(c=T(s,R))[1].toJSNumber(),o&&(h=R-1-h),a=l[0],s=c[0],f.push(r(u,h));for(var d=0!==r(i?1:0,o?1:0)?n(-1):n(0),p=f.length-1;p>=0;p-=1)d=d.multiply(R).add(n(f[p]));return d}u.prototype.shiftLeft=function(t){var e=G(t).toJSNumber();if(!N(e))throw new Error(String(e)+" is too large for shifting.");if(e<0)return this.shiftRight(-e);var r=this;if(r.isZero())return r;for(;e>=P;)r=r.multiply(R),e-=P-1;return r.multiply(B[e])},l.prototype.shiftLeft=h.prototype.shiftLeft=u.prototype.shiftLeft,u.prototype.shiftRight=function(t){var e,r=G(t).toJSNumber();if(!N(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var i=this;r>=P;){if(i.isZero()||i.isNegative()&&i.isUnit())return i;i=(e=T(i,R))[1].isNegative()?e[0].prev():e[0],r-=P-1}return(e=T(i,B[r]))[1].isNegative()?e[0].prev():e[0]},l.prototype.shiftRight=h.prototype.shiftRight=u.prototype.shiftRight,u.prototype.not=function(){return this.negate().prev()},l.prototype.not=h.prototype.not=u.prototype.not,u.prototype.and=function(t){return C(this,t,(function(t,e){return t&e}))},l.prototype.and=h.prototype.and=u.prototype.and,u.prototype.or=function(t){return C(this,t,(function(t,e){return t|e}))},l.prototype.or=h.prototype.or=u.prototype.or,u.prototype.xor=function(t){return C(this,t,(function(t,e){return t^e}))},l.prototype.xor=h.prototype.xor=u.prototype.xor;var L=1<<30;function q(t){var r=t.value,i="number"==typeof r?r|L:"bigint"==typeof r?r|BigInt(L):r[0]+r[1]*e|1073758208;return i&-i}function D(t,e){if(e.compareTo(t)<=0){var r=D(t,e.square(e)),i=r.p,o=r.e,a=i.multiply(e);return a.compareTo(t)<=0?{p:a,e:2*o+1}:{p:i,e:2*o}}return{p:n(1),e:0}}function U(t,e){return t=G(t),e=G(e),t.greater(e)?t:e}function F(t,e){return t=G(t),e=G(e),t.lesser(e)?t:e}function V(t,e){if(t=G(t).abs(),e=G(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=s[1];t.isEven()&&e.isEven();)r=F(q(t),q(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(q(t));do{for(;e.isEven();)e=e.divide(q(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}u.prototype.bitLength=function(){var t=this;return t.compareTo(n(0))<0&&(t=t.negate().subtract(n(1))),0===t.compareTo(n(0))?n(0):n(D(t,n(2)).e).add(n(1))},l.prototype.bitLength=h.prototype.bitLength=u.prototype.bitLength;var H=function(t,e,r,i){r=r||o,t=String(t),i||(t=t.toLowerCase(),r=r.toLowerCase());var n,a=t.length,s=Math.abs(e),u={};for(n=0;no[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function w(t,e,r,i){if(t=49?h-49+10:h>=17?h-17+10:h,i(h>=0&&a>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?"s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let i=0;in&&(i=n):i=n;const o=e.length;let a;for(i>o/2&&(i=o/2),a=0;a>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function k(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);const i=[];let n=e;for(;n>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return M(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function O(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"