UNPKG

xrpl

Version:

A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser

2 lines 475 kB
/*! For license information please see xrpl-latest-min.js.LICENSE.txt */ var xrpl;(()=>{var e={1862(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1227);t.default=function(e){return Array.isArray(e)?new Uint8Array(e):"string"==typeof e?(0,i.utf8ToBytes)(e):e}},2635(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1862));t.default=function(e){function t(t){return e((0,r.default)(t))}return t.create=()=>{const t=e.create();return{update(e){return t.update((0,r.default)(e)),this},digest:()=>t.digest()}},t}},1658(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=void 0;const r=n(7915),o=i(n(2635));t.ripemd160=(0,o.default)(r.ripemd160)},7377(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const r=n(232),o=i(n(2635));t.sha256=(0,o.default)(r.sha256)},2896(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha512=void 0;const r=n(232),o=i(n(2635));t.sha512=(0,o.default)(r.sha512)},619(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.stringToHex=t.hexToString=t.hexToBytes=t.bytesToHex=void 0;const o=n(1227),a=n(1602);t.bytesToHex=e=>(0,o.bytesToHex)(e instanceof Uint8Array?e:Uint8Array.from(e)).toUpperCase(),t.hexToBytes=e=>{const t=e.length,n=new Uint8Array(t/2);if(!a.HEX_REGEX.test(e))throw new Error("Invalid hex string");for(let t=0;t<n.length;t++){const i=2*t,r=e.slice(i,i+2),o=Number.parseInt(r,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[t]=o}return n},t.hexToString=(e,n="utf8")=>new TextDecoder(n).decode((0,t.hexToBytes)(e)),t.stringToHex=e=>(0,t.bytesToHex)((new TextEncoder).encode(e)),t.randomBytes=o.randomBytes,r(n(1602),t)},1602(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.equal=t.concat=t.HEX_REGEX=void 0;const i=n(1227);t.HEX_REGEX=/^[A-F0-9]*$/iu,t.concat=function(e){return(0,i.concatBytes)(...e)},t.equal=function(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new Int8Array(e),i=new Int8Array(t);for(let t=0;t!==e.byteLength;t++)if(n[t]!==i[t])return!1;return!0}},964(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2427);class r extends i.EventEmitter{constructor(e,t,n){super(),this.ws=new WebSocket(e),this.ws.onclose=e=>{let t;e.reason&&(t=(new TextEncoder).encode(e.reason)),this.emit("close",e.code,t)},this.ws.onopen=()=>{this.emit("open")},this.ws.onerror=e=>{this.emit("error",e)},this.ws.onmessage=e=>{this.emit("message",e.data)}}get readyState(){return this.ws.readyState}close(e,t){1===this.readyState&&this.ws.close(e,t)}send(e){this.ws.send(e)}}r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,t.default=r},2427(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,o||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,a=new Array(o);r<o;r++)a[r]=i[r].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,o),!0;case 6:return u.fn.call(u.context,t,i,r,o,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,r);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||a(this,o);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||r&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s},3767(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(2588),t),r(n(8161),t)},2588(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const i=n(5442),r=n(8161);t.Account=class{constructor(e,t="ed25519"){this._account={familySeed:"",address:"",keypair:{publicKey:"",privateKey:""}},this._algorithm=t,"string"==typeof e?this._secret=(0,r.parseSecretString)(e):Array.isArray(e)?this._secret=e:e instanceof Uint8Array?this._secret=(0,r.entropyToSecret)(e):this._secret=(0,r.randomSecret)(),function(e){if(8!==e.length)throw new Error("Secret must have 8 numbers");e.forEach(e=>{if(6!==e.length)throw new Error("Each secret number must be 6 digits")})}(this._secret),this.derive()}getSecret(){return this._secret}getSecretString(){return this._secret.join(" ")}getAddress(){return this._account.address}getFamilySeed(){return this._account.familySeed}getKeypair(){return this._account.keypair}toString(){return this.getSecretString()}derive(){try{const e=(0,r.secretToEntropy)(this._secret);this._account.familySeed=(0,i.generateSeed)({entropy:e,algorithm:this._algorithm}),this._account.keypair=(0,i.deriveKeypair)(this._account.familySeed),this._account.address=(0,i.deriveAddress)(this._account.keypair.publicKey)}catch(e){let t="Unknown Error";throw e instanceof Error&&(t=e.message),new Error(t)}}}},8161(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseSecretString=t.checkChecksum=t.calculateChecksum=t.secretToEntropy=t.entropyToSecret=t.randomSecret=t.randomEntropy=void 0;const i=n(619);function r(){return(0,i.randomBytes)(16)}function o(e,t){return t*(2*e+1)%9}function a(e,t,n){let i,r;if("string"==typeof t){if(6!==t.length)throw new Error("value must have a length of 6");i=parseInt(t.slice(5),10),r=parseInt(t.slice(0,5),10)}else{if("number"!=typeof n)throw new Error("checksum must be a number when value is a number");i=n,r=t}return r*(2*e+1)%9===i}function s(e){const t=new Array(Math.ceil(e.length/2)),n=Array.from(t,(t,n)=>{const r=e.slice(2*n,2*(n+1)),a=parseInt((0,i.bytesToHex)(r),16);return"0".repeat(5-String(a).length)+String(a)+String(o(n,a))});if(8!==n.length)throw new Error("Chucks must have 8 digits");return n}t.randomEntropy=r,t.calculateChecksum=o,t.checkChecksum=a,t.entropyToSecret=s,t.randomSecret=function(){return s(r())},t.secretToEntropy=function(e){return(0,i.concat)(e.map((e,t)=>{const n=Number(e.slice(0,5)),r=Number(e.slice(5));if(6!==e.length)throw new Error("Invalid secret: number invalid");if(!a(t,n,r))throw new Error("Invalid secret part: checksum invalid");const o=`0000${n.toString(16)}`.slice(-4);return(0,i.hexToBytes)(o)}))},t.parseSecretString=function(e){const t=e.replace(/[^0-9]/gu,"");if(48!==t.length)throw new Error("Invalid secret string (should contain 8 blocks of 6 digits");return Array.from(new Array(8),(e,n)=>t.slice(6*n,6*(n+1)))}},9819(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,o||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,a=new Array(o);r<o;r++)a[r]=i[r].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,o),!0;case 6:return u.fn.call(u.context,t,i,r,o,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,r);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||a(this,o);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||r&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s},6085(e){"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},o={key:i,value:e[i]};return n(r,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n<t.length;n++)n&&(a+=","),a+=e(t[n])||"null";return a+"]"}if(null===t)return"null";if(-1!==o.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=o.push(t)-1,l=Object.keys(t).sort(r&&r(t));for(a="",n=0;n<l.length;n++){var c=l[n],u=e(t[c]);u&&(a&&(a+=","),a+=JSON.stringify(c)+":"+u)}return o.splice(s,1),"{"+a+"}"}}(e)}},6333(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidXAddress=t.decodeXAddress=t.xAddressToClassicAddress=t.encodeXAddress=t.classicAddressToXAddress=t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.decodeNodePublic=t.encodeNodePublic=t.decodeAccountID=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const i=n(619),r=n(5516);Object.defineProperty(t,"codec",{enumerable:!0,get:function(){return r.codec}}),Object.defineProperty(t,"encodeSeed",{enumerable:!0,get:function(){return r.encodeSeed}}),Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return r.decodeSeed}}),Object.defineProperty(t,"encodeAccountID",{enumerable:!0,get:function(){return r.encodeAccountID}}),Object.defineProperty(t,"decodeAccountID",{enumerable:!0,get:function(){return r.decodeAccountID}}),Object.defineProperty(t,"encodeNodePublic",{enumerable:!0,get:function(){return r.encodeNodePublic}}),Object.defineProperty(t,"decodeNodePublic",{enumerable:!0,get:function(){return r.decodeNodePublic}}),Object.defineProperty(t,"encodeAccountPublic",{enumerable:!0,get:function(){return r.encodeAccountPublic}}),Object.defineProperty(t,"decodeAccountPublic",{enumerable:!0,get:function(){return r.decodeAccountPublic}}),Object.defineProperty(t,"isValidClassicAddress",{enumerable:!0,get:function(){return r.isValidClassicAddress}});const o={main:Uint8Array.from([5,68]),test:Uint8Array.from([4,147])};function a(e,t,n){if(20!==e.length)throw new Error("Account ID must be 20 bytes");if(!1!==t&&t>4294967295)throw new Error("Invalid tag");const a=t||0,s=!1===t||null==t?0:1,l=(0,i.concat)([n?o.test:o.main,e,Uint8Array.from([s,255&a,a>>8&255,a>>16&255,a>>24&255,0,0,0,0])]);return r.codec.encodeChecked(l)}function s(e){const t=r.codec.decodeChecked(e),n=function(e){const t=e.slice(0,2);if((0,i.equal)(o.main,t))return!1;if((0,i.equal)(o.test,t))return!0;throw new Error("Invalid X-address: bad prefix")}(t);return{accountId:t.slice(2,22),tag:function(e){const t=e[22];if(t>=2)throw new Error("Unsupported X-address");if(1===t)return e[23]+256*e[24]+65536*e[25]+16777216*e[26];if(0!==t)throw new Error("flag must be zero to indicate no tag");if(!(0,i.equal)((0,i.hexToBytes)("0000000000000000"),e.slice(23,31)))throw new Error("remaining bytes must be zero");return!1}(t),test:n}}t.classicAddressToXAddress=function(e,t,n){return a((0,r.decodeAccountID)(e),t,n)},t.encodeXAddress=a,t.xAddressToClassicAddress=function(e){const{accountId:t,tag:n,test:i}=s(e);return{classicAddress:(0,r.encodeAccountID)(t),tag:n,test:i}},t.decodeXAddress=s,t.isValidXAddress=function(e){try{s(e)}catch(e){return!1}return!0}},2824(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatArgs=t.arrayEqual=void 0,t.arrayEqual=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let i=0;i<e.length;i++)n|=e[i]^t[i];return 0===n},t.concatArgs=function(...e){return e.flatMap(e=>"number"==typeof e?[e]:Array.from(e))}},5516(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.encodeNodePublic=t.decodeNodePublic=t.decodeAddress=t.decodeAccountID=t.encodeAddress=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const i=n(791),r=n(7377),o=n(2824),a=[1,225,75],s={sha256:r.sha256},l=new class{constructor(e){this._sha256=e.sha256,this._codec=i.base58xrp}encode(e,t){const n=t.versions;return this._encodeVersioned(e,n,t.expectedLength)}decode(e,t){var n;const i=t.versions,r=t.versionTypes,a=this.decodeChecked(e);if(i.length>1&&!t.expectedLength)throw new Error("expectedLength is required because there are >= 2 possible versions");const s="number"==typeof i[0]?1:i[0].length,l=null!==(n=t.expectedLength)&&void 0!==n?n:a.length-s,c=a.slice(0,-l),u=a.slice(-l);for(let e=0;e<i.length;e++){const t=Array.isArray(i[e])?i[e]:[i[e]];if((0,o.arrayEqual)(c,t))return{version:t,bytes:u,type:r?r[e]:null}}throw new Error("version_invalid: version bytes do not match any of the provided version(s)")}encodeChecked(e){const t=this._sha256(this._sha256(e)).slice(0,4);return this._encodeRaw(Uint8Array.from((0,o.concatArgs)(e,t)))}decodeChecked(e){const t=this._decodeRaw(e);if(t.byteLength<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this._verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)}_encodeVersioned(e,t,n){if(!d(e,n))throw new Error("unexpected_payload_length: bytes.length does not match expectedLength. Ensure that the bytes are a Uint8Array.");return this.encodeChecked((0,o.concatArgs)(t,e))}_encodeRaw(e){return this._codec.encode(Uint8Array.from(e))}_decodeRaw(e){return this._codec.decode(e)}_verifyCheckSum(e){const t=this._sha256(this._sha256(e.slice(0,-4))).slice(0,4),n=e.slice(-4);return(0,o.arrayEqual)(t,n)}}(s);function c(e){return l.encode(e,{versions:[0],expectedLength:20})}function u(e){return l.decode(e,{versions:[0],expectedLength:20}).bytes}function d(e,t){return"byteLength"in e?e.byteLength===t:e.length===t}t.codec=l,t.encodeSeed=function(e,t){if(!d(e,16))throw new Error("entropy must have length 16");const n={expectedLength:16,versions:"ed25519"===t?a:[33]};return l.encode(e,n)},t.decodeSeed=function(e,t={versionTypes:["ed25519","secp256k1"],versions:[a,33],expectedLength:16}){return l.decode(e,t)},t.encodeAccountID=c,t.encodeAddress=c,t.decodeAccountID=u,t.decodeAddress=u,t.decodeNodePublic=function(e){return l.decode(e,{versions:[28],expectedLength:33}).bytes},t.encodeNodePublic=function(e){return l.encode(e,{versions:[28],expectedLength:33})},t.encodeAccountPublic=function(e){return l.encode(e,{versions:[35],expectedLength:33})},t.decodeAccountPublic=function(e){return l.decode(e,{versions:[35],expectedLength:33}).bytes},t.isValidClassicAddress=function(e){try{u(e)}catch(e){return!1}return!0}},9543(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signingBatchData=t.transactionID=t.sha512Half=t.binaryToJSON=t.signingClaimData=t.signingData=t.multiSigningData=t.readJSON=t.serializeObject=t.makeParser=t.BytesList=t.BinarySerializer=t.BinaryParser=void 0;const i=n(619),r=n(6986),o=n(892);Object.defineProperty(t,"BinaryParser",{enumerable:!0,get:function(){return o.BinaryParser}});const a=n(7375),s=n(7995);Object.defineProperty(t,"BinarySerializer",{enumerable:!0,get:function(){return s.BinarySerializer}}),Object.defineProperty(t,"BytesList",{enumerable:!0,get:function(){return s.BytesList}});const l=n(7410);Object.defineProperty(t,"sha512Half",{enumerable:!0,get:function(){return l.sha512Half}}),Object.defineProperty(t,"transactionID",{enumerable:!0,get:function(){return l.transactionID}});const c=n(1141),u=(e,t)=>new o.BinaryParser(e instanceof Uint8Array?(0,i.bytesToHex)(e):e,t);t.makeParser=u;const d=(e,t=c.DEFAULT_DEFINITIONS)=>e.readType(r.coreTypes.STObject).toJSON(t);function f(e,t={}){const{prefix:n,suffix:i,signingFieldsOnly:o=!1,definitions:a}=t,l=new s.BytesList;n&&l.put(n);const c=o?e=>e.isSigningField:void 0;return r.coreTypes.STObject.from(e,c,a).toBytesSink(l),i&&l.put(i),l.toBytes()}t.readJSON=d,t.binaryToJSON=(e,t)=>d(u(e,t),t),t.serializeObject=f,t.signingData=function(e,t=a.HashPrefix.transactionSig,n={}){return f(e,{prefix:t,signingFieldsOnly:!0,definitions:n.definitions})},t.signingClaimData=function(e){const t=BigInt(String(e.amount)),n=a.HashPrefix.paymentChannelClaim,i=r.coreTypes.Hash256.from(e.channel).toBytes(),o=r.coreTypes.UInt64.from(t).toBytes(),l=new s.BytesList;return l.put(n),l.put(i),l.put(o),l.toBytes()},t.multiSigningData=function(e,t,n={definitions:c.DEFAULT_DEFINITIONS}){return f(e,{prefix:a.HashPrefix.transactionMultiSig,suffix:r.coreTypes.AccountID.from(t).toBytes(),signingFieldsOnly:!0,definitions:n.definitions})},t.signingBatchData=function(e){if(null==e.flags)throw Error("No field `flags'");if(null==e.txIDs)throw Error("No field `txIDs`");const t=a.HashPrefix.batch,n=r.coreTypes.UInt32.from(e.flags).toBytes(),i=r.coreTypes.UInt32.from(e.txIDs.length).toBytes(),o=new s.BytesList;return o.put(t),o.put(n),o.put(i),e.txIDs.forEach(e=>{o.put(r.coreTypes.Hash256.from(e).toBytes())}),o.toBytes()}},4184(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.types=t.ShaMap=t.HashPrefix=t.quality=t.TransactionResult=t.Type=t.LedgerEntryType=t.TransactionType=t.Field=t.DEFAULT_DEFINITIONS=t.ledgerHashes=t.binary=t.hashes=void 0;const a=n(1141);Object.defineProperty(t,"DEFAULT_DEFINITIONS",{enumerable:!0,get:function(){return a.DEFAULT_DEFINITIONS}}),Object.defineProperty(t,"Field",{enumerable:!0,get:function(){return a.Field}}),Object.defineProperty(t,"TransactionType",{enumerable:!0,get:function(){return a.TransactionType}}),Object.defineProperty(t,"LedgerEntryType",{enumerable:!0,get:function(){return a.LedgerEntryType}}),Object.defineProperty(t,"Type",{enumerable:!0,get:function(){return a.Type}}),Object.defineProperty(t,"TransactionResult",{enumerable:!0,get:function(){return a.TransactionResult}});const s=o(n(6986));t.types=s;const l=o(n(9543));t.binary=l;const c=n(8390);Object.defineProperty(t,"ShaMap",{enumerable:!0,get:function(){return c.ShaMap}});const u=o(n(2476));t.ledgerHashes=u;const d=o(n(7410));t.hashes=d;const f=n(8213);Object.defineProperty(t,"quality",{enumerable:!0,get:function(){return f.quality}});const h=n(7375);Object.defineProperty(t,"HashPrefix",{enumerable:!0,get:function(){return h.HashPrefix}})},2942(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BytesLookup=t.Bytes=void 0;class n{constructor(e,t,n){this.name=e,this.ordinal=t,this.ordinalWidth=n,this.bytes=new Uint8Array(n);for(let e=0;e<n;e++)this.bytes[n-e-1]=t>>>8*e&255}toJSON(){return this.name}toBytesSink(e){e.put(this.bytes)}toBytes(){return this.bytes}}t.Bytes=n,t.BytesLookup=class{constructor(e,t){this.ordinalWidth=t,Object.entries(e).forEach(([e,t])=>{this.add(e,t)})}add(e,t){if(this[e])throw new SyntaxError(`Attempted to add a value with a duplicate name "${e}". This is not allowed because it is unclear how to decode.`);if(this[t.toString()])throw new SyntaxError(`Attempted to add a duplicate value under a different name (Given name: "${e}" and previous name: "${this[t.toString()]}. This is not allowed because it is unclear how to decode.\nGiven value: ${t.toString()}`);this[e]=new n(e,t,this.ordinalWidth),this[t.toString()]=this[e]}from(e){return e instanceof n?e:this[e]}fromParser(e){return this.from(e.readUIntN(this.ordinalWidth).toString())}}},8188(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DELEGATABLE_PERMISSIONS_WIDTH=t.TRANSACTION_RESULT_WIDTH=t.TRANSACTION_TYPE_WIDTH=t.LEDGER_ENTRY_WIDTH=t.TYPE_WIDTH=void 0,t.TYPE_WIDTH=2,t.LEDGER_ENTRY_WIDTH=2,t.TRANSACTION_TYPE_WIDTH=2,t.TRANSACTION_RESULT_WIDTH=1,t.DELEGATABLE_PERMISSIONS_WIDTH=4},3733(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldLookup=void 0;const i=n(2942),r=n(1275),o=n(8188);t.FieldLookup=class{constructor(e,t){e.forEach(([e,n])=>{const a=t[n.type];this[e]=function([e,t],n){const a=function(e,t){const n=[];return e<16?t<16?n.push(e<<4|t):n.push(e<<4,t):t<16?n.push(t,e):n.push(0,e,t),Uint8Array.from(n)}(n,t.nth);return{name:e,nth:t.nth,isVariableLengthEncoded:t.isVLEncoded,isSerialized:t.isSerialized,isSigningField:t.isSigningField,ordinal:n<<16|t.nth,type:new i.Bytes(t.type,n,o.TYPE_WIDTH),header:a,associatedType:r.SerializedType}}([e,n],a),this[this[e].ordinal.toString()]=this[e]})}fromString(e){return this[e]}}},1141(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TRANSACTION_TYPES=t.TransactionType=t.TransactionResult=t.LedgerEntryType=t.Type=t.Field=t.DEFAULT_DEFINITIONS=t.XrplDefinitionsBase=t.Bytes=void 0;const r=i(n(8102)),o=n(8816);Object.defineProperty(t,"XrplDefinitionsBase",{enumerable:!0,get:function(){return o.XrplDefinitionsBase}}),Object.defineProperty(t,"Bytes",{enumerable:!0,get:function(){return o.Bytes}});const a=new o.XrplDefinitionsBase(r.default,{});t.DEFAULT_DEFINITIONS=a;const s=a.type;t.Type=s;const l=a.ledgerEntryType;t.LedgerEntryType=l;const c=a.transactionType;t.TransactionType=c;const u=a.transactionResult;t.TransactionResult=u;const d=a.field;t.Field=d;const f=a.transactionNames;t.TRANSACTION_TYPES=f},8816(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BytesLookup=t.Bytes=t.FieldLookup=t.XrplDefinitionsBase=void 0;const i=n(2942);Object.defineProperty(t,"Bytes",{enumerable:!0,get:function(){return i.Bytes}}),Object.defineProperty(t,"BytesLookup",{enumerable:!0,get:function(){return i.BytesLookup}});const r=n(3733);Object.defineProperty(t,"FieldLookup",{enumerable:!0,get:function(){return r.FieldLookup}});const o=n(8188);t.XrplDefinitionsBase=class{constructor(e,t){this.type=new i.BytesLookup(e.TYPES,o.TYPE_WIDTH),this.ledgerEntryType=new i.BytesLookup(e.LEDGER_ENTRY_TYPES,o.LEDGER_ENTRY_WIDTH),this.transactionType=new i.BytesLookup(e.TRANSACTION_TYPES,o.TRANSACTION_TYPE_WIDTH),this.transactionResult=new i.BytesLookup(e.TRANSACTION_RESULTS,o.TRANSACTION_RESULT_WIDTH),this.field=new r.FieldLookup(e.FIELDS,e.TYPES),this.transactionNames=Object.entries(e.TRANSACTION_TYPES).filter(([e,t])=>t>=0).map(([e,t])=>e),this.dataTypes={},this.associateTypes(t),this.granularPermissions={TrustlineAuthorize:65537,TrustlineFreeze:65538,TrustlineUnfreeze:65539,AccountDomainSet:65540,AccountEmailHashSet:65541,AccountMessageKeySet:65542,AccountTransferRateSet:65543,AccountTickSizeSet:65544,PaymentMint:65545,PaymentBurn:65546,MPTokenIssuanceLock:65547,MPTokenIssuanceUnlock:65548};const n=Object.fromEntries(Object.entries(e.TRANSACTION_TYPES).map(([e,t])=>[e,t+1])),a=Object.assign(Object.assign({},this.granularPermissions),n);this.delegatablePermissions=new i.BytesLookup(a,o.DELEGATABLE_PERMISSIONS_WIDTH)}associateTypes(e){this.dataTypes=Object.assign({},this.dataTypes,e),Object.values(this.field).forEach(e=>{e.associatedType=this.dataTypes[e.type.name]}),this.field.TransactionType.associatedType=this.transactionType,this.field.TransactionResult.associatedType=this.transactionResult,this.field.LedgerEntryType.associatedType=this.ledgerEntryType,this.field.PermissionValue&&(this.field.PermissionValue.associatedType=this.delegatablePermissions)}getAssociatedTypes(){return this.dataTypes}}},4660(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XrplDefinitions=void 0;const i=n(8816),r=n(6986);class o extends i.XrplDefinitionsBase{constructor(e,t){super(e,Object.assign({},r.coreTypes,t))}}t.XrplDefinitions=o},7375(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HashPrefix=void 0;const i=n(5517);function r(e){const t=new Uint8Array(4);return(0,i.writeUInt32BE)(t,e,0),t}const o={transactionID:r(1415073280),transaction:r(1397638144),accountStateEntry:r(1296846336),innerNode:r(1296649728),ledgerHeader:r(1280791040),transactionSig:r(1398036480),transactionMultiSig:r(1397576704),validation:r(1447119872),proposal:r(1347571712),paymentChannelClaim:r(1129073920),batch:r(1111705600)};t.HashPrefix=o},7410(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transactionID=t.sha512Half=t.Sha512Half=void 0;const i=n(7375),r=n(6986),o=n(7995),a=n(2896);class s extends o.BytesList{constructor(){super(...arguments),this.hash=a.sha512.create()}static put(e){return(new s).put(e)}put(e){return this.hash.update(e),this}finish256(){return Uint8Array.from(this.hash.digest().slice(0,32))}finish(){return new r.Hash256(this.finish256())}}function l(...e){const t=new s;return e.forEach(e=>t.put(e)),t.finish256()}t.Sha512Half=s,t.sha512Half=l,t.transactionID=function(e){return new r.Hash256(l(i.HashPrefix.transactionID,e))}},5620(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coreTypes=t.DEFAULT_DEFINITIONS=t.XrplDefinitionsBase=t.XrplDefinitions=t.TRANSACTION_TYPES=t.decodeLedgerData=t.decodeQuality=t.encodeQuality=t.encodeForSigningBatch=t.encodeForMultisigning=t.encodeForSigningClaim=t.encodeForSigning=t.encode=t.decode=void 0;const i=n(4184),r=n(2476);Object.defineProperty(t,"decodeLedgerData",{enumerable:!0,get:function(){return r.decodeLedgerData}});const o=n(1141);Object.defineProperty(t,"XrplDefinitionsBase",{enumerable:!0,get:function(){return o.XrplDefinitionsBase}}),Object.defineProperty(t,"TRANSACTION_TYPES",{enumerable:!0,get:function(){return o.TRANSACTION_TYPES}}),Object.defineProperty(t,"DEFAULT_DEFINITIONS",{enumerable:!0,get:function(){return o.DEFAULT_DEFINITIONS}});const a=n(4660);Object.defineProperty(t,"XrplDefinitions",{enumerable:!0,get:function(){return a.XrplDefinitions}});const s=n(6986);Object.defineProperty(t,"coreTypes",{enumerable:!0,get:function(){return s.coreTypes}});const l=n(619),{signingData:c,signingClaimData:u,multiSigningData:d,signingBatchData:f,binaryToJSON:h,serializeObject:y}=i.binary;t.decode=function(e,t){if("string"!=typeof e)throw new Error("binary must be a hex string");return h(e,t)},t.encode=function(e,t){if("object"!=typeof e)throw new Error;return(0,l.bytesToHex)(y(e,{definitions:t}))},t.encodeForSigning=function(e,t){if("object"!=typeof e)throw new Error;return(0,l.bytesToHex)(c(e,i.HashPrefix.transactionSig,{definitions:t}))},t.encodeForSigningClaim=function(e){if("object"!=typeof e)throw new Error;return(0,l.bytesToHex)(u(e))},t.encodeForMultisigning=function(e,t,n){if("object"!=typeof e)throw new Error;const i=n?{definitions:n}:void 0;return(0,l.bytesToHex)(d(e,t,i))},t.encodeForSigningBatch=function(e){if("object"!=typeof e)throw new Error("Need an object to encode a Batch transaction");return(0,l.bytesToHex)(f(e))},t.encodeQuality=function(e){if("string"!=typeof e)throw new Error;return(0,l.bytesToHex)(i.quality.encode(e))},t.decodeQuality=function(e){if("string"!=typeof e)throw new Error;return i.quality.decode(e).toString()}},2476(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeLedgerData=t.ledgerHash=t.transactionTreeHash=t.accountStateHash=void 0;const i=n(8390),r=n(7375),o=n(7410),a=n(9543),s=n(8264),l=n(8847),c=n(5463),u=n(4200),d=n(401),f=n(892);function h(e,t){const n=new i.ShaMap;return t.forEach(t=>n.addItem(...e(t))),n.hash()}function y(e){if(!e.hash)throw new Error;return[s.Hash256.from(e.hash),{hashPrefix:()=>r.HashPrefix.transaction,toBytesSink(t){const n=new a.BinarySerializer(t);n.writeLengthEncoded(l.STObject.from(e)),n.writeLengthEncoded(l.STObject.from(e.metaData))}},void 0]}function p(e){const t=s.Hash256.from(e.index),n=(0,a.serializeObject)(e);return[t,{hashPrefix:()=>r.HashPrefix.accountStateEntry,toBytesSink(e){e.put(n)}},void 0]}t.transactionTreeHash=function(e){return h(y,e)},t.accountStateHash=function(e){return h(p,e)},t.ledgerHash=function(e){const t=new o.Sha512Half;if(t.put(r.HashPrefix.ledgerHeader),void 0===e.parent_close_time||void 0===e.close_flags)throw new Error;return u.UInt32.from(e.ledger_index).toBytesSink(t),c.UInt64.from(BigInt(String(e.total_coins))).toBytesSink(t),s.Hash256.from(e.parent_hash).toBytesSink(t),s.Hash256.from(e.transaction_hash).toBytesSink(t),s.Hash256.from(e.account_hash).toBytesSink(t),u.UInt32.from(e.parent_close_time).toBytesSink(t),u.UInt32.from(e.close_time).toBytesSink(t),d.UInt8.from(e.close_time_resolution).toBytesSink(t),d.UInt8.from(e.close_flags).toBytesSink(t),t.finish()},t.decodeLedgerData=function(e,t){if("string"!=typeof e)throw new Error("binary must be a hex string");const n=new f.BinaryParser(e,t);return{ledger_index:n.readUInt32(),total_coins:n.readType(c.UInt64).valueOf().toString(),parent_hash:n.readType(s.Hash256).toHex(),transaction_hash:n.readType(s.Hash256).toHex(),account_hash:n.readType(s.Hash256).toHex(),parent_close_time:n.readUInt32(),close_time:n.readUInt32(),close_time_resolution:n.readUInt8(),close_flags:n.readUInt8()}}},8213(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.quality=void 0;const r=n(6986),o=i(n(6382)),a=n(619);t.quality=class{static encode(e){let t;try{t=new o.default(e)}catch(t){throw new Error(`${e} is not a valid quality`)}const n=(t.e||0)-15,i=t.times("1e"+-n).abs().toString(),a=r.coreTypes.UInt64.from(BigInt(i)).toBytes();return a[0]=n+100,a}static decode(e){const t=(0,a.hexToBytes)(e).slice(-8),n=t[0]-100;let i;try{i=new o.default(`0x${(0,a.bytesToHex)(t.slice(1))}`)}catch(t){throw new Error(`${e} is not a valid quality`)}return i.times(`1e${n}`)}}},892(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryParser=void 0;const i=n(1141),r=n(619);t.BinaryParser=class{constructor(e,t=i.DEFAULT_DEFINITIONS){this.bytes=(0,r.hexToBytes)(e),this.definitions=t}peek(){if(0===this.bytes.byteLength)throw new Error;return this.bytes[0]}skip(e){if(e<0)throw new Error(`skip: negative length ${e}`);if(e>this.bytes.byteLength)throw new Error(`skip: requested ${e} bytes but only ${this.bytes.byteLength} available`);this.bytes=this.bytes.slice(e)}read(e){if(e<0)throw new Error(`read: negative length ${e}`);if(e>this.bytes.byteLength)throw new Error(`read: requested ${e} bytes but only ${this.bytes.byteLength} available`);const t=this.bytes.slice(0,e);return this.skip(e),t}readUIntN(e){if(0>=e||e>4)throw new Error("invalid n");return this.read(e).reduce((e,t)=>e<<8|t)>>>0}readUInt8(){return this.readUIntN(1)}readUInt16(){return this.readUIntN(2)}readUInt32(){return this.readUIntN(4)}size(){return this.bytes.byteLength}end(e){const t=this.bytes.byteLength;return 0===t||void 0!==e&&t<=e}readVariableLength(){return this.read(this.readVariableLengthLength())}readVariableLengthLength(){const e=this.readUInt8();if(e<=192)return e;if(e<=240)return 193+256*(e-193)+this.readUInt8();if(e<=254)return 12481+65536*(e-241)+256*this.readUInt8()+this.readUInt8();throw new Error("Invalid variable length indicator")}readFieldOrdinal(){let e=this.readUInt8(),t=15&e;if(e>>=4,0===e&&(e=this.readUInt8(),0===e||e<16))throw new Error(`Cannot read FieldOrdinal, type_code ${e} out of range`);if(0===t&&(t=this.readUInt8(),0===t||t<16))throw new Error(`Cannot read FieldOrdinal, field_code ${t} out of range`);return e<<16|t}readField(){return this.definitions.field.fromString(this.readFieldOrdinal().toString())}readType(e){return e.fromParser(this)}typeForField(e){return e.associatedType}readFieldValue(e){const t=this.typeForField(e);if(!t)throw new Error(`unsupported: (${e.name}, ${e.type.name})`);const n=e.isVariableLengthEncoded?this.readVariableLengthLength():void 0,i=t.fromParser(this,n);if(void 0===i)throw new Error(`fromParser for (${e.name}, ${e.type.name}) -> undefined `);return i}readFieldAndValue(){const e=this.readField();return[e,this.readFieldValue(e)]}}},7995(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BinarySerializer=t.BytesList=void 0;const i=n(619);class r{constructor(){this.bytesArray=[]}getLength(){return(0,i.concat)(this.bytesArray).byteLength}put(e){const t=Uint8Array.from(e);return this.bytesArray.push(t),this}toBytesSink(e){e.put(this.toBytes())}toBytes(){return(0,i.concat)(this.bytesArray)}toHex(){return(0,i.bytesToHex)(this.toBytes())}}t.BytesList=r,t.BinarySerializer=class{constructor(e){this.sink=new r,this.sink=e}write(e){e.toBytesSink(this.sink)}put(e){this.sink.put(e)}writeType(e,t){this.write(e.from(t))}writeBytesList(e){e.toBytesSink(this.sink)}encodeVariableLength(e){const t=new Uint8Array(3);if(e<=192)return t[0]=e,t.slice(0,1);if(e<=12480)return e-=193,t[0]=193+(e>>>8),t[1]=255&e,t.slice(0,2);if(e<=918744)return e-=12481,t[0]=241+(e>>>16),t[1]=e>>8&255,t[2]=255&e,t.slice(0,3);throw new Error("Overflow error")}writeFieldAndValue(e,t,n=!1){const i=e.associatedType.from(t);if(void 0===i.toBytesSink||void 0===e.name)throw new Error;this.sink.put(e.header),e.isVariableLengthEncoded?this.writeLengthEncoded(i,n):i.toBytesSink(this.sink)}writeLengthEncoded(e,t=!1){const n=new r;t||e.toBytesSink(n),this.put(this.encodeVariableLength(n.getLength())),this.writeBytesList(n)}}},8390(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShaMapLeaf=t.ShaMapNode=t.ShaMap=void 0;const i=n(6986),r=n(7375),o=n(7410);class a{}t.ShaMapNode=a;class s extends a{constructor(e,t){super(),this.index=e,this.item=t}isLeaf(){return!0}isInner(){return!1}hashPrefix(){return void 0===this.item?new Uint8Array(0):this.item.hashPrefix()}hash(){const e=o.Sha512Half.put(this.hashPrefix());return this.toBytesSink(e),e.finish()}toBytesSink(e){void 0!==this.item&&this.item.toBytesSink(e),this.index.toBytesSink(e)}}t.ShaMapLeaf=s;class l extends a{constructor(e=0){super(),this.depth=e,this.slotBits=0,this.branches=Array(16)}isInner(){return!0}isLeaf(){return!1}hashPrefix(){return r.HashPrefix.innerNode}setBranch(e,t){this.slotBits=this.slotBits|1<<e,this.branches[e]=t}empty(){return 0===this.slotBits}hash(){if(this.empty())return i.coreTypes.Hash256.ZERO_256;const e=o.Sha512Half.put(this.hashPrefix());return this.toBytesSink(e),e.finish()}toBytesSink(e){for(let t=0;t<this.branches.length;t++){const n=this.branches[t];(n?n.hash():i.coreTypes.Hash256.ZERO_256).toBytesSink(e)}}addItem(e,t,n){if(void 0===e)throw new Error;if(void 0!==e){const i=e.nibblet(this.depth),r=this.branches[i];if(void 0===r)this.setBranch(i,n||new s(e,t));else if(r instanceof s){const o=new l(this.depth+1);o.addItem(r.index,void 0,r),o.addItem(e,t,n),this.setBranch(i,o)}else{if(!(r instanceof l))throw new Error("invalid ShaMap.addItem call");r.addItem(e,t,n)}}}}t.ShaMap=class extends l{}},5763(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccountID=void 0;const i=n(6333),r=n(7284),o=n(619),a=/^[A-F0-9]{40}$/;class s extends r.Hash160{constructor(e){super(null!=e?e:s.defaultAccountID.bytes)}static from(e){if(e instanceof s)return e;if("string"==typeof e)return""===e?new s:a.test(e)?new s((0,o.hexToBytes)(e)):this.fromBase58(e);throw new Error("Cannot construct AccountID from value given")}static fromBase58(e){if((0,i.isValidXAddress)(e)){const t=(0,i.xAddressToClassicAddress)(e);if(!1!==t.tag)throw new Error("Only allowed to have tag on Account or Destination");e=t.classicAddress}return new s(Uint8Array.from((0,i.decodeAccountID)(e)))}toJSON(){return this.toBase58()}toBase58(){return(0,i.encodeAccountID)(this.bytes)}}t.AccountID=s,s.defaultAccountID=new s(new Uint8Array(20))},9492(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Amount=void 0;const r=n(892),o=n(5763),a=n(5967),s=n(1275),l=i(n(6382)),c=n(619),u=n(5517),d=n(6905),f=new l.default("1e17"),h=new l.default("1e-6"),y=BigInt(4294967295),p=BigInt(0x8000000000000000);l.default.config({EXPONENTIAL_AT:[-112,96]});class m extends s.SerializedType{constructor(e){super(null!=e?e:m.defaultAmount.bytes)}static from(e){if(e instanceof m)return e;let t=new Uint8Array(8);if("string"==typeof e){m.assertXrpIsValid(e);const n=BigInt(e),i=[new Uint8Array(4),new Uint8Array(4)];return(0,u.writeUInt32BE)(i[0],Number(n>>BigInt(32)),0),(0,u.writeUInt32BE)(i[1],Number(n&BigInt(y)),0),t=(0,c.concat)(i),t[0]|=64,new m(t)}if(function(e){const t=Object.keys(e).sort();return 3===t.length&&"currency"===t[0]&&"issuer"===t[1]&&"value"===t[2]}(e)){let n;try{n=new l.default(e.value)}catch(t){throw new Error(`${e.value} is an illegal amount`)}if(m.assertIouIsValid(n),n.isZero())t[0]|=128;else{const e=n.times("1e"+-((n.e||0)-15)).abs().toString(),i=BigInt(e),r=[new Uint8Array(4),new Uint8Array(4)];(0,u.writeUInt32BE)(r[0],Number(i>>BigInt(32)),0),(0,u.writeUInt32BE)(r[1],Number(i&BigInt(y)),0),t=(0,c.concat)(r),t[0]|=128,n.gt(new l.default(0))&&(t[0]|=64);const o=(n.e||0)-15+97;t[0]|=o>>>2,t[1]|=(3&o)<<6}const i=a.Currency.from(e.currency).toBytes(),r=o.AccountID.from(e.issuer).toBytes();return new m((0,c.concat)([t,i,r]))}if(function(e){const t=Object.keys(e).sort();return 2===t.length&&"mpt_issuance_id"===t[0]&&"value"===t[1]}(e)){m.assertMptIsValid(e.value);let n=new Uint8Array(1);n[0]|=96;const i=BigInt(e.value),r=[new Uint8Array(4),new Uint8Array(4)];(0,u.writeUInt32BE)(r[0],Number(i>>BigInt(32)),0),(0,u.writeUInt32BE)(r[1],Number(i&BigInt(y)),0),t=(0,c.concat)(r);const o=d.Hash192.from(e.mpt_issuance_id).toBytes();return new m((0,c.concat)([n,t,o]))}throw new Error("Invalid type to construct an Amount")}static fromParser(e){if(128&e.peek())return new m(e.read(48));const t=32&e.peek()?33:8;return new m(e.read(t))}toJSON(){if(this.isNative()){const e=this.bytes.slice(),t=64&e[0]?"":"-";e[0]&=63;const n=BigInt((0,u.readUInt32BE)(e.slice(0,4),0)),i=BigInt((0,u.readUInt32BE)(e.slice(4),0));return`${t}${(n<<BigInt(32)|i).toString()}`}if(this.isIOU()){const e=new r.BinaryParser(this.toString()),t=e.read(8),n=a.Currency.fromParser(e),i=o.AccountID.fromParser(e),s=t[0],u=64&s?"":"-",d=((63&s)<<2)+((255&t[1])>>6)-97;t[0]=0,t[1]&=63;const f=new l.default(`${u}0x${(0,c.bytesToHex)(t)}`).times(`1e${d}`);return m.assertIouIsValid(f),{value:f.toString(),currency:n.toJSON(),issuer:i.toJSON()}}if(this.isMPT()){const e=new r.BinaryParser(this.toString()),t=e.read(1),n=e.read(8),i=d.Hash192.fromParser(e),o=64&t[0]?"":"-",a=BigInt((0,u.readUInt32BE)(n.slice(0,4),0)),s=BigInt((0,u.readUInt32BE)(n.slice(4),0));return{value:`${o}${(a<<BigInt(32)|s).toString()}`,mpt_issuance_id:i.toString()}}throw new Error("Invalid amount to construct JSON")}static assertXrpIsValid(e){if(-1!==e.indexOf("."))throw new Error(`${e.toString()} is an illegal amount`);let t;try{t=new l.default(e)}catch(t){throw new Error(`${e.toString()} is an illegal amount`)}if(!t.isZero()&&(t.lt(h)||t.gt(f)))throw new Error(`${e.toString()} is an illegal amount`)}static assertIouIsValid(e){if(!e.isZero()){const t=e.precision(),n=(e.e||0)-15;if(t>16||n>80||n<-96)throw new Error("Decimal precision out of range");this.verifyNoDecimal(e)}}static assertMptIsValid(e){if(-1!==e.indexOf("."))throw new Error(`${e.toString()} is an illegal amount`);let t;try{t=new l.default(e)}catch(t){throw new Error(`${e.toString()} is an illegal amount`)}if(!t.isZero()){if(t<(0,l.default)(0))throw new Error(`${e.toString()} is an illegal amount`);if(0!=Number(BigInt(e)&BigInt(p)))throw new Error(`${e.toString()} is an illegal amount`)}}static verifyNoDecimal(e){if(-1!==e.times("1e"+-((e.e||0)-15)).abs().toString().indexOf("."))throw new Error("Decimal place found in integerNumberString")}isNative(){return!(128&this.bytes[0]||32&this.bytes[0])}isMPT(){return!(128&this.bytes[0]||!(32&this.bytes[0]))}isIOU(){return!!(128&this.bytes[0])}}t.Amount=m,m.defaultAmount=new m((0,c.hexToBytes)("4000000000000000"))},5755(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Blob=void 0;const i=n(1275),r=n(619);class o extends i.SerializedType{constructor(e){super(e)}static fromParser(e,t){return new o(e.read(t))}static from(e){if(e instanceof o)return e;if("string"==typeof e){if(!/^[A-F0-9]*$/iu.test(e))throw new Error("Cannot construct Blob from a non-hex string");return new o((0,r.hexToBytes)(e))}throw new Error("Cannot construct Blob from value given")}}t.Blob=o},5967(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Currency=void 0;const i=n(7284),r=n(619),o=/^0{40}$/,a=/^[A-Z0-9a-z?!@#$%^&*(){}[\]|]{3}$/,s=/^[A-F0-9]{40}$/,l=/^0{24}[\x00-\x7F]{6}0{10}$/;function c(e){if(!function(e){return e instanceof Uint8Array?20===e.byteLength:function(e){return 3===e.length||(t=e,s.test(t));var t}(e)}(e))throw new Error(`Unsupported Currency representation: ${e}`);return 3===e.length?function(e){const t=new Uint8Array(20);if("XRP"!==e){const n=e.split("").map(e=>e.charCodeAt(0));t.set(n,12)}return t}(e):(0,r.hexToBytes)(e)}class u extends i.Hash160{constructor(e){super(null!=e?e:u.XRP.bytes);const t=(0,r.bytesToHex)(this.bytes);o.test(t)?this._iso="XRP":l.test(t)?this._iso=function(e){const t=(0,r.hexToString)((0,r.bytesToHex)(e));return"XRP"===t?null:function(e){return a.test(e)}(t)?t:null}(this.bytes.slice(12,15)):this._iso=null}iso(){return this._iso}static from(e){if(e instanceof u)return e;if("string"==typeof e)return new u(c(e));throw new Error("Cannot construct Currency from value given")}toJSON(){const e=this.iso();return null!==e?e:(0,r.bytesToHex)(this.bytes)}}t.Currency=u,u.XRP=new u(new Uint8Array(20))},24(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash128=void 0;const i=n(3776),r=n(619);class o extends i.Hash{constructor(e){0===(null==e?void 0:e.byteLength)&&(e=o.ZERO_128.bytes),super(null!=e?e:o.ZERO_128.bytes)}toHex(){const e=(0,r.bytesToHex)(this.toBytes());return/^0+$/.exec(e)?"":e}}t.Hash128=o,o.width=16,o.ZERO_128=new o(new Uint8Array(o.width))},7284(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash160=void 0;const i=n(3776);class r extends i.Hash{constructor(e){0===(null==e?void 0:e.byteLength)&&(e=r.ZERO_160.bytes),super(null!=e?e:r.ZERO_160.bytes)}}t.Hash160=r,r.width=20,r.ZERO_160=new r(new Uint8Array(r.width))},6905(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash192=void 0;const i=n(3776);class r extends i.Hash{constructor(e){0===(null==e?void 0:e.byteLength)&&(e=r.ZERO_192.bytes),super(null!=e?e:r.ZERO_192.bytes)}}t.Hash192=r,r.width=24,r.ZERO_192=new r(new Uint8Array(r.width))},8264(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash256=void 0;const i=n(3776);class r extends i.Hash{constructor(e){super(null!=e?e:r.ZERO_256.bytes)}}t.Hash256=r,r.width=32,r.ZERO_256=new r(new Uint8Array(r.width))},3776(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=void 0;const i=n(1275),r=n(619),o=n(5517);class a extends i.Comparable{constructor(e){if(super(e),this.bytes.length!==this.constructor.width)throw new Error(`Invalid Hash length ${this.bytes.byteLength}`)}static from(e){if(e instanceof this)return e;if("string"==typeof e){if(!r.HEX_REGEX.test(e))throw new Error(`Invalid hash string ${e}`);return new this((0,r.hexToBytes)(e))}throw new Error("Cannot construct Hash from given value")}static fromParser(e,t){return new this(e.read(null!=t?t:this.width))}compareTo(e){return(0,o.compare)(this.bytes,this.constructor.from(e).bytes)}toString(){return this.toHex()}nibblet(e){const t=e>0?e/2|0:0;let n=this.bytes[t];return e%2==0?n=(240&n)>>>4:n&=15,n}}t.Hash=a},6986(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Vector256=t.UInt64=t.UInt32=t.UInt16=t.UInt8=t.STObject=t.STArray=t.PathSet=t.Int32=t.Hash256=t.Hash192=t.Hash160=t.Hash128=t.Currency=t.Blob=t.Amount=t.AccountID=t.coreTypes=void 0;const i=n(5763);Object.defineProperty(t,"AccountID",{enumerable:!0,get:function(){return i.AccountID}});const r=n(9492);Object.defineProperty(t,"Amount",{enumerable:!0,get:function(){return r.Amount}});const o=n(5755);Object.defineProperty(t,"Blob",{enumerable:!0,get:function(){return o.Blob}});const a=n(5967);Object.defineProperty(t,"Currency",{enumerable:!0,get:function(){return a.Currency}});const s=n(24);Object.defineProperty(t,"Hash128",{enumerable:!0,get:function(){return s.Hash128}});const l=n(7284);Object.defineProperty(t,"Hash160",{enumerable:!0,get:function(){return l.Hash160}});const c=n(6905);Object.defineProperty(t,"Hash192",{enumerable:!0,get:function(){return c.Hash192}});const u=n(8264);Object.defineProperty(t,"Hash256",{enumerable:!0,get:function(){return u.Hash256}});const d=n(9953);Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return d.Int32}});const f=n(1837),h=n(8741),y=n(3914);Object.defineProperty(t,"PathSet",{enumerable:!0,get:function(){return y.PathSet}});const p=n(8239);Object.defineProperty(t,"STArray",{enumerable:!0,get:function(){return p.STArray}});const m=n(8847);Object.defineProperty(t,"STObject",{enumerable:!0,get:function(){return m.STObject}});const g=n(1366);Object.defineProperty(t,"UInt16",{enumerable:!0,get:function(){return g.UInt16}});const A=n(4200);Object.defineProperty(t,"UInt32",{enumerable:!0,get:function(){return A.UInt32}});const E=n(5463);Object.defineProperty(t,"UInt64",{enumerable:!0,get:function(){return E.UInt64}});const b=n(401);Object.defineProperty(t,"UInt8",{enumerable:!0,get:function(){return b.UInt8}});const v=n(371