@xoxno/sdk-js 1.0.214 → 1.0.215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/utils/__tests__/request-timeout.test.d.ts +1 -0
- package/dist/cjs/utils/api.d.ts +21 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/utils/__tests__/request-timeout.test.d.ts +1 -0
- package/dist/utils/api.d.ts +21 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.cjs.LICENSE.txt */
|
|
2
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{var e={526(e,t){"use strict";t.byteLength=function(e){var t=a(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){var t,r,i=a(e),u=i[0],s=i[1],l=new n(function(e,t,r){return 3*(t+r)/4-r}(0,u,s)),p=0,d=s>0?u-4:u;for(r=0;r<d;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],l[p++]=t>>16&255,l[p++]=t>>8&255,l[p++]=255&t;return 2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[p++]=255&t),1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[p++]=t>>8&255,l[p++]=255&t),l},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],u=16383,a=0,l=o-n;a<l;a+=u)i.push(s(e,a,a+u>l?l:a+u));return 1===n?(t=e[o-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[o-2]<<8)+e[o-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)r[u]=i[u],o[i.charCodeAt(u)]=u;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,o){for(var n,i,u=[],a=t;a<o;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),u.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(e,t,r){"use strict";const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=s,t.IS=50;const u=2147483647;function a(e){if(e>u)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let o=a(r);const n=o.write(e,t);return n!==r&&(o=o.slice(0,n)),o}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return s.from(o,t,r);const n=function(e){if(s.isBuffer(e)){const t=0|h(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function p(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return p(e),a(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),r=a(t);for(let o=0;o<t;o+=1)r[o]=255&e[o];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(o,s.prototype),o}function h(e){if(e>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|e}function g(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(n)return o?-1:V(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){let o=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return q(this,t,r);case"ascii":return E(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function b(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function S(e,t,r,o,n){if(0===e.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=s.from(t,o)),s.isBuffer(t))return 0===t.length?-1:m(e,t,r,o,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,o,n){let i,u=1,a=e.length,s=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;u=2,a/=2,s/=2,r/=2}function l(e,t){return 1===u?e[t]:e.readUInt16BE(t*u)}if(n){let o=-1;for(i=r;i<a;i++)if(l(e,i)===l(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===s)return o*u}else-1!==o&&(i-=i-o),o=-1}else for(r+s>a&&(r=a-s),i=r;i>=0;i--){let r=!0;for(let o=0;o<s;o++)if(l(e,i+o)!==l(t,o)){r=!1;break}if(r)return i}return-1}function T(e,t,r,o){r=Number(r)||0;const n=e.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=t.length;let u;for(o>i/2&&(o=i/2),u=0;u<o;++u){const o=parseInt(t.substr(2*u,2),16);if(Z(o))return u;e[r+u]=o}return u}function w(e,t,r,o){return X(V(t,e.length-r),e,r,o)}function v(e,t,r,o){return X(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,o)}function x(e,t,r,o){return X(j(t),e,r,o)}function A(e,t,r,o){return X(function(e,t){let r,o,n;const i=[];for(let u=0;u<e.length&&!((t-=2)<0);++u)r=e.charCodeAt(u),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function P(e,t,r){return 0===t&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function q(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,u=t>239?4:t>223?3:t>191?2:1;if(n+u<=r){let r,o,a,s;switch(u){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(s=(31&t)<<6|63&r,s>127&&(i=s));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(s=(15&t)<<12|(63&r)<<6|63&o,s>2047&&(s<55296||s>57343)&&(i=s));break;case 4:r=e[n+1],o=e[n+2],a=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(s=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&a,s>65535&&s<1114112&&(i=s))}}null===i?(i=65533,u=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=u}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=k));return r}(o)}s.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return function(e,t,r){return p(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,o=t.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(e[n]!==t[n]){r=e[n],o=t[n];break}return r<o?-1:o<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=s.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))n+t.length>o.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(o,n)):Uint8Array.prototype.set.call(o,t,n);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},s.byteLength=g,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)b(this,t,t+1);return this},s.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},s.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},s.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?q(this,0,e):y.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(e,t,r,o,n){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),t<0||r>e.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&t>=r)return 0;if(o>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(n>>>=0)-(o>>>=0),u=(r>>>=0)-(t>>>=0);const a=Math.min(i,u),l=this.slice(o,n),p=e.slice(t,r);for(let e=0;e<a;++e)if(l[e]!==p[e]){i=l[e],u=p[e];break}return i<u?-1:u<i?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return S(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return S(this,e,t,r,!1)},s.prototype.write=function(e,t,r,o){if(void 0===t)o="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)o=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return T(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function E(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(127&e[n]);return o}function _(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(e[n]);return o}function I(e,t,r){const o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=t;o<r;++o)n+=Q[e[o]];return n}function R(e,t,r){const o=e.slice(t,r);let n="";for(let e=0;e<o.length-1;e+=2)n+=String.fromCharCode(o[e]+256*o[e+1]);return n}function O(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,o,n,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}function M(e,t,r,o,n){W(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let u=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=u,u>>=8,e[r++]=u,u>>=8,e[r++]=u,u>>=8,e[r++]=u,r}function U(e,t,r,o,n){W(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let u=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=u,u>>=8,e[r+2]=u,u>>=8,e[r+1]=u,u>>=8,e[r]=u,r+8}function C(e,t,r,o,n,i){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,o,i){return t=+t,r>>>=0,i||C(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function $(e,t,r,o,i){return t=+t,r>>>=0,i||C(e,0,r,8),n.write(e,t,r,o,52,8),r+8}s.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const o=this.subarray(e,t);return Object.setPrototypeOf(o,s.prototype),o},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),s.prototype.readBigUInt64BE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=t,n=1,i=this[e+--o];for(;o>0&&(n*=256);)i+=this[e+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),s.prototype.readBigInt64BE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||B(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[t]=255&e;++i<r&&(n*=256);)this[t+i]=e/n&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||B(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[t+n]=255&e;--n>=0&&(i*=256);)this[t+n]=e/i&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=Y((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Y((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);B(this,e,t,r,o-1,-o)}let n=0,i=1,u=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===u&&0!==this[t+n-1]&&(u=1),this[t+n]=(e/i|0)-u&255;return t+r},s.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);B(this,e,t,r,o-1,-o)}let n=r-1,i=1,u=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===u&&0!==this[t+n+1]&&(u=1),this[t+n]=(e/i|0)-u&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=Y((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Y((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return $(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return $(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,o){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-r&&(o=e.length-t+r);const n=o-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,o):Uint8Array.prototype.set.call(e,this.subarray(r,o),t),n},s.prototype.fill=function(e,t,r,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===e.length){const t=e.charCodeAt(0);("utf8"===o&&t<128||"latin1"===o)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const i=s.isBuffer(e)?e:s.from(e,o),u=i.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%u]}return this};const N={};function D(e,t,r){N[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function G(e){let t="",r=e.length;const o="-"===e[0]?1:0;for(;r>=o+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function W(e,t,r,o,n,i){if(e>r||e<t){const o="bigint"==typeof t?"n":"";let n;throw n=i>3?0===t||t===BigInt(0)?`>= 0${o} and < 2${o} ** ${8*(i+1)}${o}`:`>= -(2${o} ** ${8*(i+1)-1}${o}) and < 2 ** ${8*(i+1)-1}${o}`:`>= ${t}${o} and <= ${r}${o}`,new N.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){F(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(o,n,i)}function F(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw F(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,r){let o=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=G(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=G(n)),n+="n"),o+=` It must be ${t}. Received ${n}`,o}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function V(e,t){let r;t=t||1/0;const o=e.length;let n=null;const i=[];for(let u=0;u<o;++u){if(r=e.charCodeAt(u),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(u+1===o){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(e){return o.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,r,o){let n;for(n=0;n<o&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)t[o+n]=e[r]+e[n]}return t}();function Y(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,r,o,n){var i,u,a=8*n-o-1,s=(1<<a)-1,l=s>>1,p=-7,d=r?n-1:0,c=r?-1:1,f=e[t+d];for(d+=c,i=f&(1<<-p)-1,f>>=-p,p+=a;p>0;i=256*i+e[t+d],d+=c,p-=8);for(u=i&(1<<-p)-1,i>>=-p,p+=o;p>0;u=256*u+e[t+d],d+=c,p-=8);if(0===i)i=1-l;else{if(i===s)return u?NaN:1/0*(f?-1:1);u+=Math.pow(2,o),i-=l}return(f?-1:1)*u*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var u,a,s,l=8*i-n-1,p=(1<<l)-1,d=p>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=p):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),(t+=u+d>=1?c/s:c*Math.pow(2,1-d))*s>=2&&(u++,s/=2),u+d>=p?(a=0,u=p):u+d>=1?(a=(t*s-1)*Math.pow(2,n),u+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,n),u=0));n>=8;e[r+f]=255&a,f+=h,a/=256,n-=8);for(u=u<<n|a,l+=n;l>0;e[r+f]=255&u,f+=h,u/=256,l-=8);e[r+f-h]|=128*g}},586(e,t,r){"use strict";r.d(t,{STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Bt,STELLAR_LENDING_TOPICS:()=>Jr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>u,SYNTHETIC_EVENT_ORDER_STRIDE:()=>to,buildSameTokenRepaySwapSteps:()=>wo,buildStellarAcceptOwnershipTx:()=>dt,buildStellarAddRewardsTx:()=>Rt,buildStellarApproveBlendPoolTx:()=>bt,buildStellarApproveTokenTx:()=>mt,buildStellarBatchSwapTx:()=>co,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>D,buildStellarCctpForwardTx:()=>xo,buildStellarClaimRevenueTx:()=>It,buildStellarCreateLiquidityPoolTx:()=>Et,buildStellarExecuteCancellerResetTx:()=>_r,buildStellarExecuteStrategyTx:()=>po,buildStellarFlashLoanTx:()=>j,buildStellarGovernanceAddSpokeImmediateTx:()=>Br,buildStellarGovernanceCreateHubImmediateTx:()=>Or,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>vr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Ar,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Pr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>qr,buildStellarGovernanceExecuteTx:()=>wr,buildStellarGovernanceExecuteUpdateDelayTx:()=>xr,buildStellarGovernancePauseTx:()=>Ur,buildStellarGovernanceRevokeRoleImmediateTx:()=>Mr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Rr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Ir,buildStellarGrantRoleTx:()=>st,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>z,buildStellarMigrateFromBlendTx:()=>X,buildStellarMigrateTx:()=>it,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>ut,buildStellarProposeAddAssetToSpokeTx:()=>Zt,buildStellarProposeAddSpokeTx:()=>Xt,buildStellarProposeApproveBlendPoolTx:()=>nr,buildStellarProposeApproveTokenTx:()=>rr,buildStellarProposeCancellerResetTx:()=>Er,buildStellarProposeConfigureAssetOracleTx:()=>fr,buildStellarProposeConfigureMarketOracleTx:()=>hr,buildStellarProposeCreateHubTx:()=>jt,buildStellarProposeCreateLiquidityPoolTx:()=>ur,buildStellarProposeDeployPoolTx:()=>sr,buildStellarProposeEditAssetInSpokeTx:()=>Qt,buildStellarProposeEditOracleToleranceTx:()=>gr,buildStellarProposeGovernanceUpgradeTx:()=>yr,buildStellarProposeGrantGovernanceRoleTx:()=>Sr,buildStellarProposeMigrateControllerTx:()=>dr,buildStellarProposeRemoveAssetFromSpokeTx:()=>Yt,buildStellarProposeRemoveSpokeTx:()=>Kt,buildStellarProposeRevokeBlendPoolTx:()=>ir,buildStellarProposeRevokeGovernanceRoleTx:()=>mr,buildStellarProposeRevokeTokenTx:()=>or,buildStellarProposeSetAccumulatorTx:()=>zt,buildStellarProposeSetAggregatorTx:()=>Ht,buildStellarProposeSetMinBorrowCollatTx:()=>tr,buildStellarProposeSetPositionLimitsTx:()=>Vt,buildStellarProposeSetPositionManagerTx:()=>er,buildStellarProposeSetPriceAggregatorTx:()=>Ft,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Jt,buildStellarProposeSetSwapAggregatorTx:()=>Wt,buildStellarProposeTransferCtrlOwnershipTx:()=>cr,buildStellarProposeTransferGovOwnTx:()=>Tr,buildStellarProposeUnpauseTx:()=>Cr,buildStellarProposeUpdateDelayTx:()=>br,buildStellarProposeUpgradeControllerTx:()=>pr,buildStellarProposeUpgradePoolParamsTx:()=>ar,buildStellarProposeUpgradePoolTx:()=>lr,buildStellarRenewAccountTx:()=>kt,buildStellarRepayBatchTx:()=>F,buildStellarRepayDebtWithCollateralTx:()=>Y,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>St,buildStellarRevokeRoleTx:()=>lt,buildStellarRevokeTokenTx:()=>Tt,buildStellarSetAccumulatorTx:()=>gt,buildStellarSetAggregatorTx:()=>ht,buildStellarSetMarketOracleConfigTx:()=>vt,buildStellarSetOracleSanityBoundsTx:()=>Pt,buildStellarSetOracleToleranceTx:()=>xt,buildStellarSetOracleTx:()=>wt,buildStellarSetPositionLimitsTx:()=>yt,buildStellarSetPriceAggregatorTx:()=>ft,buildStellarSetSpokeAssetFlagsTx:()=>At,buildStellarSetSwapAggregatorTx:()=>ct,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>$,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>pt,buildStellarUnpauseTx:()=>at,buildStellarUpdateAccountThresholdTx:()=>Ot,buildStellarUpdateIndexesTx:()=>qt,buildStellarUpgradeControllerTx:()=>nt,buildStellarUpgradeLiquidityPoolParamsTx:()=>_t,buildStellarWithdrawBatchTx:()=>G,buildStellarWithdrawTx:()=>W,buildTx:()=>U,decodeStellarLendingEvent:()=>eo,decodeStellarLiquidateReturn:()=>V,encodeAssetOracle:()=>rt,encodeInterestRateModel:()=>ze,encodeMarketOracleConfigInput:()=>ot,encodeMarketParamsRaw:()=>Ve,encodePositionLimits:()=>je,encodePriceKey:()=>Xe,encodeStrategyPayloadToRouteXdr:()=>lo,extractEventOrder:()=>oo,getStellarAccountPositions:()=>fe,getStellarActiveUsersSeries:()=>Le,getStellarAggregatorQuote:()=>ao,getStellarAsset:()=>le,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>ye,getStellarAssetPage:()=>ge,getStellarAssets:()=>ne,getStellarCampaignLeaderboard:()=>Re,getStellarCampaignMe:()=>Fe,getStellarDefiLlamaDimensions:()=>Ne,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>oe,getStellarFeeRevenueSeries:()=>Me,getStellarGovernanceProposals:()=>qe,getStellarHolderDistribution:()=>Ie,getStellarHub:()=>pe,getStellarHubGraph:()=>we,getStellarHubHolders:()=>Se,getStellarHubs:()=>ie,getStellarLendingContext:()=>te,getStellarLendingLiveState:()=>re,getStellarLiquidationsLeaderboard:()=>_e,getStellarLiquidationsSeries:()=>Ue,getStellarParticipantCounts:()=>Ee,getStellarPnlByScope:()=>We,getStellarPositionsLeaderboard:()=>ke,getStellarPositionsPnl:()=>Ge,getStellarQuoteTokens:()=>so,getStellarRateSpreadSeries:()=>$e,getStellarReserve:()=>se,getStellarReserveGraph:()=>xe,getStellarReserveHolders:()=>be,getStellarReserves:()=>ae,getStellarRevenueSeries:()=>Be,getStellarSpoke:()=>de,getStellarSpokeGraph:()=>ve,getStellarSpokeHolders:()=>me,getStellarSpokes:()=>ue,getStellarStatsHistory:()=>Oe,getStellarUserActivity:()=>Ae,getStellarUserActivityPage:()=>Pe,getStellarUserHistory:()=>De,getStellarUserPositions:()=>ce,getStellarVolumeSeries:()=>Ce,getStellarWalletBalance:()=>he,mapQuoteResponseToAggregatorSwap:()=>go,mapQuoteResponseToStrategyPayload:()=>fo,mapQuoteResponseToStrategySwap:()=>ho,mapSorobanError:()=>Po,mapStellarPositionActivityType:()=>io,prepareStellarBuiltTx:()=>mo,prepareStellarTxXdr:()=>So,stellarLendingDispatchKey:()=>Nr,stellarLendingRead:()=>He,stellarNetworks:()=>n,syntheticEventOrder:()=>no,tagStellarInvokedContractError:()=>bo,toBase64Xdr:()=>Lr,toStellarPositionMode:()=>To});const o={stellarMainnet:{name:"mainnet",passphrase:"Public Global Stellar Network ; September 2015",horizonUrl:"https://horizon.stellar.org",sorobanRpcUrl:"https://stellar-gateway.xoxno.com",quoteUrl:"https://stellar-swap.xoxno.com",explorerNetwork:"public",aquariusApiUrl:"https://amm-api.aqua.network",aquariusRouter:"CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK",lendingController:"CAUCMIN5KSXEVZ7NMXR3LZATGD5EFIEUI5XWTFLYRO2R5OTXI22WE5JX",aggregatorRouter:"CCVENFSVCBYDHVOACFZXMNNYVOZ3LKXPZYU5LUI4N7KTXOKRVYD7F3TR",governance:"CC44PEQW7HSEPKAZ5ZRPH2JS5M5KVJXCUBLJ2ZX4E3WCDKMNFILHC2AD",priceAggregator:"CBGUF2G2Q7HCVCWYISDXBHPVBGMYNXA7PG2VET66YBZX6IKOOV27NSMV",positionNftContract:"CAWCSG77AY2W24QZ6ZXLHZU4UXEFHZBM6EI4A4IF7JB5CTY4XND3TI6C"},stellarTestnet:{name:"testnet",passphrase:"Test SDF Network ; September 2015",horizonUrl:"https://horizon-testnet.stellar.org",sorobanRpcUrl:"https://stellar-testnet-gateway.xoxno.com",quoteUrl:"https://testnet-stellar-swap.xoxno.com",explorerNetwork:"testnet",aquariusApiUrl:"https://amm-api-testnet.aqua.network",aquariusRouter:"CBCFTQSPDBAIZ6R6PJQKSQWKNKWH2QIV3I4J72SHWBIK3ADRRAM5A6GD",lendingController:"CCXRWJ6SIU2WPFEGLFGJVITPL57QAYIMIO6OAM2NBGNDQSSCK2FFV3F3",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},n=o;function i(e){return o["testnet"===e?"stellarTestnet":"stellarMainnet"]}const u={mainnet:o.stellarMainnet.passphrase,testnet:o.stellarTestnet.passphrase},a=require("@stellar/stellar-sdk");var s=r(287);const l=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],p={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},d=1e6,c=e=>new a.Address(e).toScVal(),f=e=>new a.ScInt(e).toI128(),h=e=>a.xdr.ScVal.scvU32(e),g=e=>{if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new a.ScInt("string"==typeof e?e:e.toString()).toU64()},y=e=>a.xdr.ScVal.scvBool(e),b=e=>a.xdr.ScVal.scvString(e),S=e=>a.xdr.ScVal.scvSymbol(e),m=()=>a.xdr.ScVal.scvVoid(),T=e=>a.xdr.ScVal.scvVec(e),w=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=s.hp.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return a.xdr.ScVal.scvBytes(o)},v=(e,t)=>null==e?m():t(e),x=(e,t)=>k({asset:c(t),hub_id:h(e)}),A=(e,t,r)=>a.xdr.ScVal.scvVec([x(e,t),f(r)]),P=e=>a.xdr.ScVal.scvVec(e.map((e=>A(e.hubId,e.asset,e.amount)))),q=e=>{if("Transfer"===e)return T([S("Transfer")]);if(e&&"object"==typeof e&&"Credit"in e){const t=e.Credit;if("number"==typeof t&&!Number.isInteger(t))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${t}`);return T([S("Credit"),g(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},k=e=>{const t=Object.keys(e).sort().map((t=>new a.xdr.ScMapEntry({key:S(t),val:e[t]})));return a.xdr.ScVal.scvMap(t)};class E{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>d)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(p[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(i>d)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const u=i===d;let a=d;n.forEach(((e,o)=>{r[e]=!0;const i=t[e];let s;if(o+1===n.length&&u)s=0;else{if(0===a)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(i.splitPpm*d/a);a-=Math.min(i.splitPpm,a),s=128+this.weight(e)}this.emitPath(i,s)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return s.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const _=e=>{const t=new E(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,i]=o,[u,a]=e.preSwapFromA?[n,i]:[i,n];t.emit(p.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(u),t.asset(a))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return k({amounts:a.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:a.xdr.ScVal.scvVec(t.assetList.map((e=>c(e)))),ops:a.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},I=e=>{const t=s.hp.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return a.xdr.ScVal.scvBytes(t)},R=()=>a.xdr.ScVal.scvBytes(s.hp.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return s.hp.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=s.hp.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},B=e=>{if("string"==typeof e)return I(O(e));if(e instanceof Uint8Array)return 0===e.length?R():I(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?I(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?I(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?I(O(e.bytes)):0===e.bytes.length?R():I(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length&&!t.burnPool&&!t.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!l.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>d)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==d)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),a.xdr.ScVal.scvBytes(s.hp.from(_(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},M=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=s.hp.from(t,"hex");return a.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return a.xdr.ScVal.scvBytes(s.hp.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function U(e,t,r){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const o=new a.Contract(e.controllerAddress),n=new a.Account(e.caller,e.sourceSequence);return{xdr:new a.TransactionBuilder(n,{fee:e.fee??a.BASE_FEE,networkPassphrase:u[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function C(e){if(!Number.isInteger(e)||e<1||e>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return h(e)}function L(e,t){const r=t.accountNonce??0;return U(e,"supply",[c(e.caller),g(r),C(t.spokeId),P([...t.assets])])}function $(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return U(e,"borrow",[c(e.caller),g(t.accountNonce),P([...t.borrows]),v(t.to,c)])}function D(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return U(e,"withdraw",[c(e.caller),g(t.accountNonce),P([...t.withdrawals]),v(t.to,c)])}function W(e,t){return G(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"repay",[c(e.caller),g(t.accountNonce),P([...t.payments])])}function H(e,t){return F(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function z(e,t){return U(e,"liquidate",[c(e.caller),g(t.accountNonce),P([...t.debtPayments]),q(t.seizeMode??"Transfer")])}function V(e){const t=(0,a.scValToNative)(a.xdr.ScVal.fromXDR(e,"base64"));if("bigint"==typeof t||"number"==typeof t)return t.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof t)}function j(e,t){return U(e,"flash_loan",[c(e.caller),x(t.hubId,t.asset),f(t.amount),c(t.receiver),M(t.data)])}function X(e,t){return U(e,"migrate_from_blend",[c(e.caller),g(t.accountId),C(t.spokeId),h(t.hubId),c(t.blendPool),T(t.collateralTokens.map(c)),T(t.supplyTokens.map(c)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),a.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,a.xdr.ScVal.scvVec([c(t),f(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0;return U(e,"multiply",[c(e.caller),g(r),C(t.spokeId),x(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),x(t.debt.hubId,t.debt.asset),h(t.mode),B(t.steps),v(t.initialPayment,(e=>A(e.hubId,e.asset,e.amount))),v(t.convertSwap,B)])}function Z(e,t){return U(e,"swap_debt",[c(e.caller),g(t.accountNonce),x(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),x(t.newDebt.hubId,t.newDebt.asset),B(t.steps)])}function Q(e,t){return U(e,"swap_collateral",[c(e.caller),g(t.accountNonce),x(t.current.hubId,t.current.asset),f(t.fromAmount),x(t.newCollateral.hubId,t.newCollateral.asset),B(t.steps)])}function Y(e,t){return U(e,"repay_debt_with_collateral",[c(e.caller),g(t.accountNonce),x(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),x(t.debt.hubId,t.debt.asset),B(t.steps),y(t.closePosition)])}const J="/stellar-lending",ee=encodeURIComponent,te=(e,t)=>e.fetchWithTimeout(`${J}/context`,t),re=(e,t)=>e.fetchWithTimeout(`${J}/live-state`,t),oe=(e,t)=>e.fetchWithTimeout(`${J}/markets/detailed`,t),ne=(e,t)=>e.fetchWithTimeout(`${J}/assets`,t),ie=(e,t)=>e.fetchWithTimeout(`${J}/hubs`,t),ue=(e,t)=>e.fetchWithTimeout(`${J}/spokes`,t),ae=(e,t={},r)=>e.fetchWithTimeout(`${J}/reserves`,{...r,params:{...t}}),se=(e,t,r,o,n)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}`,n),le=(e,t,r)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}`,r),pe=(e,t,r)=>e.fetchWithTimeout(`${J}/hubs/${t}`,r),de=(e,t,r)=>e.fetchWithTimeout(`${J}/spokes/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/positions`,r),fe=(e,t,r)=>e.fetchWithTimeout(`${J}/accounts/${ee(t)}/positions`,r),he=(e,t,r,o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/assets/${ee(r)}/balance`,o),ge=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/page`,{...o,params:{...r}}),ye=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/markets`,{...o,params:{side:r}}),be=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/holders`,{...i,params:{side:n}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/holders`,{...o,params:{side:r}}),me=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/holders`,{...o,params:{side:r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/graph`,{...o,params:{...r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/graph`,{...o,params:{...r}}),xe=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/graph`,{...i,params:{...n}}),Ae=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity`,{...o,params:{...r}}),Pe=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity/page`,{...o,params:{...r}}),qe=(e,t={},r)=>e.fetchWithTimeout(`${J}/governance/proposals`,{...r,params:{...t}}),ke=(e,t={},r)=>e.fetchWithTimeout(`${J}/positions`,{...r,params:{...t}}),Ee=(e,t={},r)=>e.fetchWithTimeout(`${J}/participants`,{...r,params:{...t}}),_e=(e,t={},r)=>e.fetchWithTimeout(`${J}/liquidations/leaderboard`,{...r,params:{...t}}),Ie=(e,t={},r)=>e.fetchWithTimeout(`${J}/distribution`,{...r,params:{...t}}),Re=(e,t={},r)=>e.fetchWithTimeout(`${J}/campaign/leaderboard`,{...r,params:{...t}}),Oe=(e,t,r)=>e.fetchWithTimeout(`${J}/stats/history`,{...r,params:{...t}}),Be=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue`,{...r,params:{...t}}),Me=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue/fees`,{...r,params:{...t}}),Ue=(e,t,r)=>e.fetchWithTimeout(`${J}/liquidations`,{...r,params:{...t}}),Ce=(e,t,r)=>e.fetchWithTimeout(`${J}/volume`,{...r,params:{...t}}),Le=(e,t,r)=>e.fetchWithTimeout(`${J}/active-users`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${J}/rate-spread`,{...r,params:{...t}}),Ne=(e,t,r)=>e.fetchWithTimeout(`${J}/defillama`,{...r,params:{...t}}),De=(e,t,r,o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/history`,{...o,params:{...r}}),Ge=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl`,{...r,params:{accountId:t}}),We=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl/scope`,{...r,params:{scope:t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${J}/campaign/me`,{...r,params:{owner:t}}),He=e=>({context:t=>te(e,t),liveState:t=>re(e,t),marketsDetailed:t=>oe(e,t),assets:t=>ne(e,t),hubs:t=>ie(e,t),spokes:t=>ue(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?ae(e,t,r):ae(e,{},t),reserve:(t,r,o,n)=>se(e,t,r,o,n),asset:(t,r)=>le(e,t,r),hub:(t,r)=>pe(e,t,r),spoke:(t,r)=>de(e,t,r),userPositions:(t,r)=>ce(e,t,r),accountPositions:(t,r)=>fe(e,t,r),walletBalance:(t,r,o)=>he(e,t,r,o),assetPage:(t,r,o)=>ge(e,t,r,o),assetMarkets:(t,r,o)=>ye(e,t,r,o),reserveHolders:(t,r,o,n,i)=>be(e,t,r,o,n,i),hubHolders:(t,r,o)=>Se(e,t,r,o),spokeHolders:(t,r,o)=>me(e,t,r,o),assetGraph:(t,r,o)=>Te(e,t,r,o),hubGraph:(t,r,o)=>we(e,t,r,o),spokeGraph:(t,r,o)=>ve(e,t,r,o),reserveGraph:(t,r,o,n,i)=>xe(e,t,r,o,n,i),userActivity:(t,r={},o)=>Ae(e,t,r,o),userActivityPage:(t,r={},o)=>Pe(e,t,r,o),governanceProposals:(t={},r)=>qe(e,t,r),positionsLeaderboard:(t={},r)=>ke(e,t,r),participants:(t={},r)=>Ee(e,t,r),liquidationsLeaderboard:(t={},r)=>_e(e,t,r),distribution:(t={},r)=>Ie(e,t,r),campaignLeaderboard:(t={},r)=>Re(e,t,r),statsHistory:(t,r)=>Oe(e,t,r),revenue:(t,r)=>Be(e,t,r),feeRevenue:(t,r)=>Me(e,t,r),liquidations:(t,r)=>Ue(e,t,r),volume:(t,r)=>Ce(e,t,r),activeUsers:(t,r)=>Le(e,t,r),rateSpread:(t,r)=>$e(e,t,r),defillama:(t,r)=>Ne(e,t,r),userHistory:(t,r,o)=>De(e,t,r,o),positionsPnl:(t,r)=>Ge(e,t,r),pnlByScope:(t,r)=>We(e,t,r),campaignMe:(t,r)=>Fe(e,t,r)}),ze=e=>k({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Ve=e=>k({asset_decimals:h(e.assetDecimals),asset_id:c(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:y(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),je=e=>k({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),Xe=e=>{if("Token"in e&&e.Token)return T([S("Token"),c(e.Token)]);if("Ref"in e&&e.Ref)return T([S("Ref"),S(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Ke=e=>{if("Stellar"in e)return T([S("Stellar"),c(e.Stellar)]);if("Symbol"in e)return T([S("Symbol"),S(e.Symbol)]);if("String"in e)return T([S("String"),b(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ze=e=>{if("Spot"===e)return T([S("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return T([S("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Qe=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return T([S(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Ye=e=>{if("Market"===e||"Fundamental"===e)return T([S(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Je=e=>{if("Reflector"in e){const t=e.Reflector;return T([S("Reflector"),k({asset:Ke(t.asset),contract:c(t.contract),read_mode:Ze(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return T([S("MultiFeed"),k({contract:c(t.contract),feed_id:b(t.feedId),kind:Qe(t.kind),nature:Ye(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},et=e=>{const t=e;return k({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:Je(t.provider)})},tt=e=>{if("RequireDisjoint"===e)return T([S("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return T([S("AllowShared"),T(t.map((e=>k({contract:c(e.contract),kind:Qe(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},rt=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return k({asset_decimals:h(Number(t.assetDecimals)),independence:tt(t.independence),max_price_stale_seconds:g(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:f(String(t.maxSanityPriceWad)),min_sanity_price_wad:f(String(t.minSanityPriceWad)),sources:T(r.map((e=>(e=>{if("Feed"in e)return T([S("Feed"),et(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return T([S("Scaled"),k({factor:et(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:Xe(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return T([S("LpShare"),k({key_a:Xe(t.keyA),key_b:Xe(t.keyB),kind:T([S(t.kind||"ConstantProduct")]),pool:c(t.pool),reserve_a_decimals:h(t.reserveADecimals),reserve_b_decimals:h(t.reserveBDecimals),share_decimals:h(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:k({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})},ot=rt;function nt(e,t){return U(e,"upgrade",[w(t.wasmHash)])}function it(e,t){return U(e,"migrate",[h(t.newVersion)])}function ut(e){return U(e,"pause",[])}function at(e){return U(e,"unpause",[])}function st(e,t){return U(e,"grant_role",[c(t.account),S(t.role)])}function lt(e,t){return U(e,"revoke_role",[c(t.account),S(t.role)])}function pt(e,t){return U(e,"transfer_ownership",[c(t.newOwner),h(t.liveUntilLedger)])}function dt(e){return U(e,"accept_ownership",[])}function ct(e,t){return U(e,"set_swap_aggregator",[c(t.aggregator)])}function ft(e,t){return U(e,"set_price_aggregator",[c(t.aggregator)])}const ht=ct;function gt(e,t){return U(e,"set_accumulator",[c(t.accumulator)])}function yt(e,t){return U(e,"set_position_limits",[je(t)])}function bt(e,t){return U(e,"approve_blend_pool",[c(t.pool)])}function St(e,t){return U(e,"revoke_blend_pool",[c(t.pool)])}const mt=bt,Tt=St;function wt(e,t){return U(e,"set_oracle",[Xe(t.key),rt(t.oracle)])}const vt=wt;function xt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[Xe(t.key),k({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function At(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),x(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Pt(e,t){return U(e,"set_oracle_sanity_bounds",[c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function qt(e,t){return U(e,"update_indexes",[c(e.caller),T(t.assets.map((e=>x(e.hubId,e.asset))))])}function kt(e,t){return U(e,"renew_account",[c(e.caller),g(t.accountNonce)])}function Et(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),c(t.asset),Ve(t.params)])}function _t(e,t){return U(e,"upgrade_liquidity_pool_params",[x(t.hubId,t.asset),ze(t.params)])}function It(e,t){return U(e,"claim_revenue",[c(e.caller),T(t.assets.map((e=>x(e.hubId,e.asset))))])}function Rt(e,t){return U(e,"add_rewards",[c(e.caller),P(t.rewards)])}function Ot(e,t){return U(e,"update_account_threshold",[c(e.caller),y(t.hasRisks),T(t.accountNonces.map((e=>g(e))))])}const Bt="00".repeat(32),Mt=e=>{if("string"==typeof e)return w(e);const t=s.hp.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return a.xdr.ScVal.scvBytes(t)},Ut=(e,...t)=>T([S(e),...t]),Ct=e=>k({new_owner:c(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Lt=e=>k({asset:c(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:y(e.canBorrow),can_collateral:y(e.canCollateral),frozen:y(e.frozen),hub_id:h(e.hubId),paused:y(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:y(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),$t=e=>k({account:c(e.account),role:S(e.role)});function Nt(e,t,r){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const o=new a.Contract(e.governanceAddress),n=new a.Account(e.caller,e.sourceSequence);return{xdr:new a.TransactionBuilder(n,{fee:e.fee??a.BASE_FEE,networkPassphrase:u[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Dt=(e,t,r)=>Nt(e,"propose",[c(e.caller),t,Mt(r)]),Gt=(e,t,r)=>Nt(e,"execute_self",[m(),t,Mt(r)]);function Wt(e,t,r){return Dt(e,Ut("SetSwapAggregator",c(t.aggregator)),r)}function Ft(e,t,r){return Dt(e,Ut("SetPriceAggregator",c(t.aggregator)),r)}const Ht=Wt;function zt(e,t,r){return Dt(e,Ut("SetAccumulator",c(t.accumulator)),r)}function Vt(e,t,r){return Dt(e,Ut("SetPositionLimits",je(t)),r)}function jt(e,t){return Dt(e,Ut("CreateHub"),t)}function Xt(e,t){return Dt(e,Ut("AddSpoke"),t)}function Kt(e,t,r){return Dt(e,Ut("RemoveSpoke",h(t.spokeId)),r)}function Zt(e,t,r){return Dt(e,Ut("AddAssetToSpoke",Lt(t)),r)}function Qt(e,t,r){return Dt(e,Ut("EditAssetInSpoke",Lt(t)),r)}function Yt(e,t,r){return Dt(e,Ut("RemoveAssetFromSpoke",k({hub_asset:x((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function Jt(e,t,r){return Dt(e,Ut("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:f((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:h(o.liquidationBonusFactorBps),spoke_id:h(o.spokeId),target_hf_wad:f(o.targetHfWad)})),r);var o}function er(e,t,r){return Dt(e,Ut("SetPositionManager",c(t.manager),y(t.isActive)),r)}function tr(e,t,r){return Dt(e,Ut("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function rr(e,t,r){return Dt(e,Ut("ApproveToken",c(t.token)),r)}function or(e,t,r){return Dt(e,Ut("RevokeToken",c(t.token)),r)}function nr(e,t,r){return Dt(e,Ut("ApproveBlendPool",c(t.pool)),r)}function ir(e,t,r){return Dt(e,Ut("RevokeBlendPool",c(t.pool)),r)}function ur(e,t,r){return Dt(e,Ut("CreateLiquidityPool",k({asset:c((o=t).asset),hub_id:h(o.hubId),params:Ve(o.params)})),r);var o}function ar(e,t,r){return Dt(e,Ut("UpgradeLiquidityPoolParams",k({hub_asset:x((o=t).hubId,o.asset),params:ze(o.params)})),r);var o}function sr(e,t,r){return Dt(e,Ut("DeployPool",w(t.wasmHash)),r)}function lr(e,t,r){return Dt(e,Ut("UpgradePool",w(t.wasmHash)),r)}function pr(e,t,r){return Dt(e,Ut("UpgradeController",w(t.wasmHash)),r)}function dr(e,t,r){return Dt(e,Ut("MigrateController",h(t.newVersion)),r)}function cr(e,t,r){return Dt(e,Ut("TransferCtrlOwnership",Ct(t)),r)}function fr(e,t,r){return Dt(e,Ut("ConfigureAssetOracle",k({key:Xe((o=t).key),oracle:rt(o.oracle)})),r);var o}const hr=fr;function gr(e,t,r){return Dt(e,Ut("EditOracleTolerance",k({key:Xe((o=t).key),tolerance:h(o.tolerance)})),r);var o}function yr(e,t,r){return Dt(e,Ut("UpgradeGov",w(t.wasmHash)),r)}function br(e,t,r){return Dt(e,Ut("UpdateGovDelay",h(t.newDelay)),r)}function Sr(e,t,r){return Dt(e,Ut("GrantGovRole",$t(t)),r)}function mr(e,t,r){return Dt(e,Ut("RevokeGovRole",$t(t)),r)}function Tr(e,t,r){return Dt(e,Ut("TransferGovOwnership",Ct(t)),r)}function wr(e,t){const r=T(t.argsXdr.map((e=>a.xdr.ScVal.fromXDR(e,"base64")))),o=Mt(t.predecessor??Bt);return Nt(e,"execute",[m(),c(t.target),S(t.functionName),r,o,Mt(t.salt)])}function vr(e,t,r){return Gt(e,Ut("UpgradeGov",w(t.wasmHash)),r)}function xr(e,t,r){return Gt(e,Ut("UpdateGovDelay",h(t.newDelay)),r)}function Ar(e,t,r){return Gt(e,Ut("GrantGovRole",$t(t)),r)}function Pr(e,t,r){return Gt(e,Ut("RevokeGovRole",$t(t)),r)}function qr(e,t,r){return Gt(e,Ut("TransferGovOwnership",Ct(t)),r)}const kr=e=>T(e.map(c));function Er(e,t,r){return Nt(e,"propose_canceller_reset",[kr(t.newCancellers),Mt(r)])}function _r(e,t,r){return Nt(e,"execute_canceller_reset",[v(t.executor,c),kr(t.newCancellers),Mt(r)])}function Ir(e,t){return Nt(e,"set_spoke_asset_flags",[c(e.caller),h(t.spokeId),x(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Rr(e,t){return Nt(e,"set_oracle_sanity_bounds",[c(e.caller),c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Or(e){return Nt(e,"create_hub",[c(e.caller)])}function Br(e){return Nt(e,"add_spoke",[c(e.caller)])}function Mr(e,t){return Nt(e,"revoke_role_immediate",[c(t.account),S(t.role)])}function Ur(e){return Nt(e,"pause",[c(e.caller)])}function Cr(e,t){return Dt(e,Ut("Unpause"),t)}const Lr=e=>e.toXDR("base64"),$r=e=>a.xdr.ScVal.fromXDR(e,"base64"),Nr=e=>e.map((e=>String((0,a.scValToNative)($r(e))))).join(":"),Dr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Gr=e=>Number(e),Wr=e=>String(e),Fr=e=>e instanceof Uint8Array?s.hp.from(e).toString("hex"):s.hp.isBuffer(e)?e.toString("hex"):String(e),Hr=["None","Multiply","Long","Short"],zr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net","liq_credit"],Vr=e=>Array.isArray(e)?e:[],jr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],zr[Gr(o)]??Dr(o)),positionType:t,hubId:Gr(e[1]),asset:Wr(e[2]),scaledAmountRay:Dr(e[3]),indexRay:Dr(e[4]),amount:Dr(e[5]),liquidationThresholdBps:r?void 0:Gr(e[6]),liquidationBonusBps:r?void 0:Gr(e[7]),loanToValueBps:r?void 0:Gr(e[8]),liquidationFeesBps:r?void 0:Gr(e[9])};var o},Xr=e=>{return{owner:Wr(e[0]),spokeId:Gr(e[1]),mode:(t=e[2],Hr[Gr(t)]??"None")};var t},Kr=e=>Array.isArray(e)?e[1]:void 0,Zr=e=>{const t=(r=e,Array.isArray(r)?Wr(r[0]):Wr(r));var r;if("Token"===t)return{Token:Wr(Kr(e))};if("Ref"===t)return{Ref:Wr(Kr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Wr(t.Token)};if(void 0!==t.Ref)return{Ref:Wr(t.Ref)}}return{Token:Wr(e)}},Qr=e=>{const t=e.tolerance??{};return{assetDecimals:Gr(e.asset_decimals),maxPriceStaleSeconds:Gr(e.max_price_stale_seconds),sources:Vr(e.sources).map((e=>e)),tolerance:{upperRatio:Gr(t.upper_ratio_bps),lowerRatio:Gr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Dr(e.min_sanity_price_wad),maxSanityPriceWad:Dr(e.max_sanity_price_wad)}},Yr={"market:create":e=>({topic:"market:create",data:{hubId:Gr(e.hub_id),baseAsset:Wr(e.base_asset),maxBorrowRate:Dr(e.max_borrow_rate),baseBorrowRate:Dr(e.base_borrow_rate),slope1:Dr(e.slope1),slope2:Dr(e.slope2),slope3:Dr(e.slope3),midUtilization:Dr(e.mid_utilization),optimalUtilization:Dr(e.optimal_utilization),maxUtilization:Dr(e.max_utilization),reserveFactor:Gr(e.reserve_factor),marketAddress:Wr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Wr(e.asset),maxBorrowRateRay:Dr(e.max_borrow_rate),baseBorrowRateRay:Dr(e.base_borrow_rate),slope1Ray:Dr(e.slope1),slope2Ray:Dr(e.slope2),slope3Ray:Dr(e.slope3),midUtilizationRay:Dr(e.mid_utilization),optimalUtilizationRay:Dr(e.optimal_utilization),maxUtilizationRay:Dr(e.max_utilization),reserveFactorBps:Gr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Vr(e).map((e=>{return t=Vr(e),{hubId:Gr(t[0]),asset:Wr(t[1]),timestamp:Gr(t[2]),supplyIndexRay:Dr(t[3]),borrowIndexRay:Dr(t[4]),cash:Dr(t[5]),suppliedRay:Dr(t[6]),borrowedRay:Dr(t[7]),revenueRay:Dr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Vr(e).map((e=>{const t=e;return{hubId:Gr(t.hub_id),asset:Wr(t.asset),params:(r=t.params,{maxBorrowRateRay:Dr(r.max_borrow_rate),baseBorrowRateRay:Dr(r.base_borrow_rate),slope1Ray:Dr(r.slope1),slope2Ray:Dr(r.slope2),slope3Ray:Dr(r.slope3),midUtilizationRay:Dr(r.mid_utilization),optimalUtilizationRay:Dr(r.optimal_utilization),maxUtilizationRay:Dr(r.max_utilization),reserveFactorBps:Gr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Gr(r.flashloan_fee),assetId:Wr(r.asset_id),assetDecimals:Gr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Vr(e);return{topic:"position:batch_update",data:{accountId:Dr(t[0]),accountAttributes:Xr(Vr(t[1])),updates:[...Vr(t[2]).map((e=>jr(Vr(e),"Deposit"))),...Vr(t[3]).map((e=>jr(Vr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Gr(e.hub_id),asset:Wr(e.asset),receiver:Wr(e.receiver),caller:Wr(e.caller),amount:Dr(e.amount),fee:Dr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Zr(e.key),oracle:Qr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Wr(e.asset),oracle:Qr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Wr(e.liquidator),accountId:Dr(e.account_id),repaidUsdWad:Dr(e.repaid_usd_wad),bonusBps:Dr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Dr(e.account_id),totalBorrowUsdWad:Dr(e.total_borrow_usd_wad),totalCollateralUsdWad:Dr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Wr(e.token),amount:Dr(e.amount),usdValueWad:Dr(e.usd_value_wad),accountId:Dr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Gr(e.hub_id),asset:Wr(e.asset),amount:Dr(e.amount),fee:Dr(e.fee),amountSent:Dr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Wr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:Fr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Wr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Wr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Wr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Wr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Fr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Gr(e.max_supply_positions),maxBorrowPositions:Gr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Dr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Wr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Gr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Dr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Dr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Gr(t.liquidation_bonus_factor_bps)}}}},Jr=Object.freeze(Object.keys(Yr));function eo(e,t){const r=Nr(e),o=Yr[r];return o?o((0,a.scValToNative)($r(t))):null}const to=1e4;function ro(e,t){return`${e}-${BigInt(t).toString(10)}`}function oo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function no(e,t=0){return e*to+t}function io(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const uo=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()};async function ao(e,t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=uo(t.baseUrl,"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,referralId:e.referralId,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function so(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=uo(e.baseUrl,"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const lo=e=>_(e).toXDR("base64");function po(e,t){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const r=new a.Contract(e.routerAddress),o=new a.Account(e.caller,e.sourceSequence),n=B(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new a.TransactionBuilder(o,{fee:e.fee??a.BASE_FEE,networkPassphrase:u[e.network]}).addOperation(r.call("execute_strategy",c(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function co(e,t){return po(e,t)}function fo(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(yo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(yo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function ho(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:fo(e,t)}const go=fo,yo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function bo(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function So(e,t,r){const o=a.TransactionBuilder.fromXDR(t,r?.network?u[r.network]:"");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw bo(r.invokedContractId,e);throw e}}async function mo(e,t,r){return So(e,t.xdr,r)}function To(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function wo(e,t){return new Uint8Array(0)}const vo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return s.hp.from(t,"hex")};function xo(e){const t=new a.Account(e.caller,e.sourceSequence),r=new a.Contract(e.forwarderAddress).call("mint_and_forward",a.xdr.ScVal.scvBytes(vo(e.message)),a.xdr.ScVal.scvBytes(vo(e.attestation)));return{xdr:new a.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:u[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ao={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Po(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=Ao[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{Chain:()=>i,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>h.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>h.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>h.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>h.STELLAR_NETWORK_PASSPHRASE,SYNTHETIC_EVENT_ORDER_STRIDE:()=>h.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>u,buildSameTokenRepaySwapSteps:()=>h.buildSameTokenRepaySwapSteps,buildSdk:()=>S,buildStellarAcceptOwnershipTx:()=>h.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>h.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>h.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>h.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>h.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>h.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>h.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>h.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>h.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>h.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>h.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>h.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>h.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>h.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>h.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>h.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>h.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>h.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>h.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>h.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>h.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>h.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>h.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>h.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>h.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>h.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>h.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>h.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>h.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>h.buildStellarMigrateTx,buildStellarMultiplyTx:()=>h.buildStellarMultiplyTx,buildStellarPauseTx:()=>h.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>h.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>h.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>h.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>h.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>h.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>h.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>h.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>h.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>h.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>h.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>h.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>h.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>h.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>h.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>h.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>h.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>h.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>h.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>h.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>h.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>h.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>h.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>h.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>h.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>h.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>h.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>h.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>h.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>h.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>h.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>h.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>h.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>h.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>h.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>h.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>h.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>h.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>h.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>h.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>h.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>h.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>h.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>h.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>h.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>h.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>h.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>h.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>h.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>h.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>h.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>h.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>h.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>h.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>h.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>h.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>h.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>h.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>h.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>h.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>h.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>h.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>h.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>h.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>h.buildStellarWithdrawTx,buildTx:()=>h.buildTx,decodeStellarLendingEvent:()=>h.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>h.decodeStellarLiquidateReturn,encodeAssetOracle:()=>h.encodeAssetOracle,encodeInterestRateModel:()=>h.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>h.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>h.encodeMarketParamsRaw,encodePositionLimits:()=>h.encodePositionLimits,encodePriceKey:()=>h.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>h.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>h.extractEventOrder,getStellarAccountPositions:()=>h.getStellarAccountPositions,getStellarActiveUsersSeries:()=>h.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>h.getStellarAggregatorQuote,getStellarAsset:()=>h.getStellarAsset,getStellarAssetGraph:()=>h.getStellarAssetGraph,getStellarAssetMarkets:()=>h.getStellarAssetMarkets,getStellarAssetPage:()=>h.getStellarAssetPage,getStellarAssets:()=>h.getStellarAssets,getStellarCampaignLeaderboard:()=>h.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>h.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>h.getStellarDefiLlamaDimensions,getStellarDeployment:()=>h.getStellarDeployment,getStellarDetailedMarkets:()=>h.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>h.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>h.getStellarGovernanceProposals,getStellarHolderDistribution:()=>h.getStellarHolderDistribution,getStellarHub:()=>h.getStellarHub,getStellarHubGraph:()=>h.getStellarHubGraph,getStellarHubHolders:()=>h.getStellarHubHolders,getStellarHubs:()=>h.getStellarHubs,getStellarLendingContext:()=>h.getStellarLendingContext,getStellarLendingLiveState:()=>h.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>h.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>h.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>h.getStellarParticipantCounts,getStellarPnlByScope:()=>h.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>h.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>h.getStellarPositionsPnl,getStellarQuoteTokens:()=>h.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>h.getStellarRateSpreadSeries,getStellarReserve:()=>h.getStellarReserve,getStellarReserveGraph:()=>h.getStellarReserveGraph,getStellarReserveHolders:()=>h.getStellarReserveHolders,getStellarReserves:()=>h.getStellarReserves,getStellarRevenueSeries:()=>h.getStellarRevenueSeries,getStellarSpoke:()=>h.getStellarSpoke,getStellarSpokeGraph:()=>h.getStellarSpokeGraph,getStellarSpokeHolders:()=>h.getStellarSpokeHolders,getStellarSpokes:()=>h.getStellarSpokes,getStellarStatsHistory:()=>h.getStellarStatsHistory,getStellarUserActivity:()=>h.getStellarUserActivity,getStellarUserActivityPage:()=>h.getStellarUserActivityPage,getStellarUserHistory:()=>h.getStellarUserHistory,getStellarUserPositions:()=>h.getStellarUserPositions,getStellarVolumeSeries:()=>h.getStellarVolumeSeries,getStellarWalletBalance:()=>h.getStellarWalletBalance,isValidCollectionTicker:()=>a,isValidNftIdentifier:()=>s,mapQuoteResponseToAggregatorSwap:()=>h.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>h.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>h.mapQuoteResponseToStrategySwap,mapSorobanError:()=>h.mapSorobanError,mapStellarPositionActivityType:()=>h.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>h.prepareStellarBuiltTx,prepareStellarTxXdr:()=>h.prepareStellarTxXdr,stellarLendingDispatchKey:()=>h.stellarLendingDispatchKey,stellarLendingRead:()=>h.stellarLendingRead,stellarNetworks:()=>h.stellarNetworks,syntheticEventOrder:()=>h.syntheticEventOrder,tagStellarInvokedContractError:()=>h.tagStellarInvokedContractError,toBase64Xdr:()=>h.toBase64Xdr,toStellarPositionMode:()=>h.toStellarPositionMode});const e="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",t="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",n="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var i;!function(e){e.MAINNET="1",e.DEVNET="D"}(i||(i={}));class u{apiUrl;chain;init;config;constructor(r){if(!r?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:o=i.MAINNET,apiUrl:u,...a}=r;this.apiUrl=u.trim().replace(/\/$/,""),this.chain=o,this.init=a,this.config=o==i.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:e,DR_SC:t,KG_SC:n,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:e,DR_SC:t,KG_SC:n,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:i,...u}=this.init,{next:a,cache:s,debug:l,headers:p,method:d="GET",...c}=r,f=p?.Authorization,h="Bearer undefined"===f?void 0:f,g="GET"!==d&&"HEAD"!==d&&"PUT"!==d,y={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...g?{"Content-Type":"application/json"}:{},...h?{Authorization:h}:{}},b=Object.entries(t??{}).filter((([,e])=>void 0!==e)).flatMap((([e,t])=>Array.isArray(t)?t.filter((e=>void 0!==e)).map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),S=`${this.apiUrl}${e}${b.length?`?${b}`:""}`,{revalidate:m,...T}=o??{},{revalidate:w,...v}=a??{},x="GET"!==d||h?void 0:w??m,A="GET"!==d||h||x?void 0:s??n,P={...u,...c,method:d,...Object.keys(y).length?{headers:y}:{},cache:A,next:{...T,...v,revalidate:x}};(l??i)&&console.debug("SDK fetch: ",S,P);const q=await fetch(S,P).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${S}: ${e.message}`),{cause:e});throw e})),k=await q.text();if(!q.ok){let e;try{e=JSON.parse(k)}catch{e={message:k}}const t=[S,q.status,q.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(k)}catch{return k}}}const a=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e),o=/^C[A-Z2-7]{55}$/.test(e);return t||r||o},s=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e),o=/^C[A-Z2-7]{55}-\d+$/.test(e);return t||r||o};class l extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class p extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const d=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^[GC][A-Z2-7]{55}$/.test(e)),c={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/integrations/liquid-staking/multiversx/revenue":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/multiversx":{input:{},output:{}},"/integrations/lending/multiversx/revenue":{input:{},output:{}},"/integrations/lending/multiversx/liquidations":{input:{},output:{}},"/integrations/lending/multiversx/active-users":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/stellar-lending/users/:owner/assets/:asset/balance":{input:{},output:{}},"/stellar-lending/users/:owner/activity/page":{input:{},output:{}}},f=["PATCH","POST","DELETE","PUT"];var h=r(586);const g=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),y=()=>({static:{},params:{},leaves:[]});function b(e,t,r,o){const{input:n,output:i,...u}=t,s=async(t={})=>{const n={...r,...t},i=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),u=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),s=Object.fromEntries(Object.entries(n).filter((([e])=>!u.includes(e)))),c=/:address[^A-Z]/.test(e)||"address"in s,f=/:collection[^A-Z]/.test(e)||"collection"in s;if(c){const e=n.address;if(!d(e))throw new p(e)}if(f){const e=n.collection;if(Array.isArray(e)?e.some((e=>!a(e))):!a(e))throw new l(e)}const h=Object.fromEntries(Object.entries(s).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:y,method:b,headers:S,cache:m,next:T,debug:w,signal:v,credentials:x,mode:A,redirect:P,referrer:q,referrerPolicy:k,integrity:E,keepalive:_,priority:I,window:R,continuationToken:O,...B}=h,M=y?`Bearer ${y}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==O&&(B.continuationToken=O);const U={...S,...M?{Authorization:M}:{},...O&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(O)}:{}},C={...T,tags:[...T?.tags??[],i]};return o.fetchWithTimeout(i,{method:b,params:B,body:g,headers:U,cache:m,debug:w,...Object.fromEntries(Object.entries({signal:v,credentials:x,mode:A,redirect:P,referrer:q,referrerPolicy:k,integrity:E,keepalive:_,priority:I,window:R}).filter((([,e])=>void 0!==e))),...C?{next:C}:{}})},c=(e={})=>s(e);for(const e of Object.keys(u))f.includes(e)&&(c[e]=t=>s({...t,method:t.method??e.toUpperCase()}));return c}function S(e){const t=function(){const e=y();for(const[t,r]of Object.entries(c)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=g(e.slice(1));n=n.params[t]||=y()}else{const t=g(e);n=n.static[t]||=y()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,i=Object.keys(t.static).length,u=Object.keys(t.params).length;let a;if(1===n&&i+u>0){const{rawPath:r,def:n}=t.leaves[0];a=b(r,n,o,e)}else{a={};for(const{rawPath:r,def:n}of t.leaves)a[g(r.split("/").pop().replace(/^:/,""))]=b(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let i=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),i=r)}void 0===a[e]?a[e]=i:"function"==typeof a[e]?Object.assign(a[e],i):"function"==typeof i?(Object.assign(i,a[e]),a[e]=i):Object.assign(a[e],i)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const i=r(n,{...o,[e]:t});if(i&&"object"==typeof i&&1===Object.keys(i).length&&e in i&&"function"==typeof i[e]){const t=i[e],r=(...e)=>t(...e);return Object.assign(r,t)}return i};if(a[e]){const r=a[e];a[e]=e=>({...r(e),...t(e)})}else a[e]=t}return a};return r(t,{})}})(),module.exports=o})();
|
|
2
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{var e={526(e,t){"use strict";t.byteLength=function(e){var t=a(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){var t,r,i=a(e),u=i[0],s=i[1],l=new n(function(e,t,r){return 3*(t+r)/4-r}(0,u,s)),p=0,d=s>0?u-4:u;for(r=0;r<d;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],l[p++]=t>>16&255,l[p++]=t>>8&255,l[p++]=255&t;return 2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[p++]=255&t),1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[p++]=t>>8&255,l[p++]=255&t),l},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],u=16383,a=0,l=o-n;a<l;a+=u)i.push(s(e,a,a+u>l?l:a+u));return 1===n?(t=e[o-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[o-2]<<8)+e[o-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)r[u]=i[u],o[i.charCodeAt(u)]=u;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,o){for(var n,i,u=[],a=t;a<o;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),u.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(e,t,r){"use strict";const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=s,t.IS=50;const u=2147483647;function a(e){if(e>u)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let o=a(r);const n=o.write(e,t);return n!==r&&(o=o.slice(0,n)),o}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return s.from(o,t,r);const n=function(e){if(s.isBuffer(e)){const t=0|h(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function p(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return p(e),a(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),r=a(t);for(let o=0;o<t;o+=1)r[o]=255&e[o];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(o,s.prototype),o}function h(e){if(e>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|e}function g(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(n)return o?-1:V(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){let o=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return q(this,t,r);case"ascii":return E(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function b(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function S(e,t,r,o,n){if(0===e.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=s.from(t,o)),s.isBuffer(t))return 0===t.length?-1:m(e,t,r,o,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,o,n){let i,u=1,a=e.length,s=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;u=2,a/=2,s/=2,r/=2}function l(e,t){return 1===u?e[t]:e.readUInt16BE(t*u)}if(n){let o=-1;for(i=r;i<a;i++)if(l(e,i)===l(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===s)return o*u}else-1!==o&&(i-=i-o),o=-1}else for(r+s>a&&(r=a-s),i=r;i>=0;i--){let r=!0;for(let o=0;o<s;o++)if(l(e,i+o)!==l(t,o)){r=!1;break}if(r)return i}return-1}function T(e,t,r,o){r=Number(r)||0;const n=e.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=t.length;let u;for(o>i/2&&(o=i/2),u=0;u<o;++u){const o=parseInt(t.substr(2*u,2),16);if(Z(o))return u;e[r+u]=o}return u}function w(e,t,r,o){return X(V(t,e.length-r),e,r,o)}function v(e,t,r,o){return X(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,o)}function x(e,t,r,o){return X(j(t),e,r,o)}function A(e,t,r,o){return X(function(e,t){let r,o,n;const i=[];for(let u=0;u<e.length&&!((t-=2)<0);++u)r=e.charCodeAt(u),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function P(e,t,r){return 0===t&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function q(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,u=t>239?4:t>223?3:t>191?2:1;if(n+u<=r){let r,o,a,s;switch(u){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(s=(31&t)<<6|63&r,s>127&&(i=s));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(s=(15&t)<<12|(63&r)<<6|63&o,s>2047&&(s<55296||s>57343)&&(i=s));break;case 4:r=e[n+1],o=e[n+2],a=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(s=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&a,s>65535&&s<1114112&&(i=s))}}null===i?(i=65533,u=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=u}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=k));return r}(o)}s.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return function(e,t,r){return p(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,o=t.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(e[n]!==t[n]){r=e[n],o=t[n];break}return r<o?-1:o<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=s.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))n+t.length>o.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(o,n)):Uint8Array.prototype.set.call(o,t,n);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},s.byteLength=g,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)b(this,t,t+1);return this},s.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},s.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},s.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?q(this,0,e):y.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(e,t,r,o,n){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),t<0||r>e.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&t>=r)return 0;if(o>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(n>>>=0)-(o>>>=0),u=(r>>>=0)-(t>>>=0);const a=Math.min(i,u),l=this.slice(o,n),p=e.slice(t,r);for(let e=0;e<a;++e)if(l[e]!==p[e]){i=l[e],u=p[e];break}return i<u?-1:u<i?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return S(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return S(this,e,t,r,!1)},s.prototype.write=function(e,t,r,o){if(void 0===t)o="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)o=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return T(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function E(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(127&e[n]);return o}function _(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(e[n]);return o}function I(e,t,r){const o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=t;o<r;++o)n+=Q[e[o]];return n}function R(e,t,r){const o=e.slice(t,r);let n="";for(let e=0;e<o.length-1;e+=2)n+=String.fromCharCode(o[e]+256*o[e+1]);return n}function O(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,o,n,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}function M(e,t,r,o,n){W(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let u=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=u,u>>=8,e[r++]=u,u>>=8,e[r++]=u,u>>=8,e[r++]=u,r}function U(e,t,r,o,n){W(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let u=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=u,u>>=8,e[r+2]=u,u>>=8,e[r+1]=u,u>>=8,e[r]=u,r+8}function C(e,t,r,o,n,i){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,o,i){return t=+t,r>>>=0,i||C(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function $(e,t,r,o,i){return t=+t,r>>>=0,i||C(e,0,r,8),n.write(e,t,r,o,52,8),r+8}s.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const o=this.subarray(e,t);return Object.setPrototypeOf(o,s.prototype),o},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),s.prototype.readBigUInt64BE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let o=t,n=1,i=this[e+--o];for(;o>0&&(n*=256);)i+=this[e+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),s.prototype.readBigInt64BE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||B(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[t]=255&e;++i<r&&(n*=256);)this[t+i]=e/n&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||B(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[t+n]=255&e;--n>=0&&(i*=256);)this[t+n]=e/i&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=Y((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Y((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);B(this,e,t,r,o-1,-o)}let n=0,i=1,u=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===u&&0!==this[t+n-1]&&(u=1),this[t+n]=(e/i|0)-u&255;return t+r},s.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);B(this,e,t,r,o-1,-o)}let n=r-1,i=1,u=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===u&&0!==this[t+n+1]&&(u=1),this[t+n]=(e/i|0)-u&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=Y((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Y((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return $(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return $(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,o){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-r&&(o=e.length-t+r);const n=o-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,o):Uint8Array.prototype.set.call(e,this.subarray(r,o),t),n},s.prototype.fill=function(e,t,r,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===e.length){const t=e.charCodeAt(0);("utf8"===o&&t<128||"latin1"===o)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const i=s.isBuffer(e)?e:s.from(e,o),u=i.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%u]}return this};const N={};function D(e,t,r){N[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function G(e){let t="",r=e.length;const o="-"===e[0]?1:0;for(;r>=o+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function W(e,t,r,o,n,i){if(e>r||e<t){const o="bigint"==typeof t?"n":"";let n;throw n=i>3?0===t||t===BigInt(0)?`>= 0${o} and < 2${o} ** ${8*(i+1)}${o}`:`>= -(2${o} ** ${8*(i+1)-1}${o}) and < 2 ** ${8*(i+1)-1}${o}`:`>= ${t}${o} and <= ${r}${o}`,new N.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){F(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(o,n,i)}function F(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw F(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,r){let o=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=G(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=G(n)),n+="n"),o+=` It must be ${t}. Received ${n}`,o}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function V(e,t){let r;t=t||1/0;const o=e.length;let n=null;const i=[];for(let u=0;u<o;++u){if(r=e.charCodeAt(u),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(u+1===o){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(e){return o.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,r,o){let n;for(n=0;n<o&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)t[o+n]=e[r]+e[n]}return t}();function Y(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,r,o,n){var i,u,a=8*n-o-1,s=(1<<a)-1,l=s>>1,p=-7,d=r?n-1:0,c=r?-1:1,f=e[t+d];for(d+=c,i=f&(1<<-p)-1,f>>=-p,p+=a;p>0;i=256*i+e[t+d],d+=c,p-=8);for(u=i&(1<<-p)-1,i>>=-p,p+=o;p>0;u=256*u+e[t+d],d+=c,p-=8);if(0===i)i=1-l;else{if(i===s)return u?NaN:1/0*(f?-1:1);u+=Math.pow(2,o),i-=l}return(f?-1:1)*u*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var u,a,s,l=8*i-n-1,p=(1<<l)-1,d=p>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=p):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),(t+=u+d>=1?c/s:c*Math.pow(2,1-d))*s>=2&&(u++,s/=2),u+d>=p?(a=0,u=p):u+d>=1?(a=(t*s-1)*Math.pow(2,n),u+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,n),u=0));n>=8;e[r+f]=255&a,f+=h,a/=256,n-=8);for(u=u<<n|a,l+=n;l>0;e[r+f]=255&u,f+=h,u/=256,l-=8);e[r+f-h]|=128*g}},586(e,t,r){"use strict";r.d(t,{STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Bt,STELLAR_LENDING_TOPICS:()=>Jr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>u,SYNTHETIC_EVENT_ORDER_STRIDE:()=>to,buildSameTokenRepaySwapSteps:()=>wo,buildStellarAcceptOwnershipTx:()=>dt,buildStellarAddRewardsTx:()=>Rt,buildStellarApproveBlendPoolTx:()=>bt,buildStellarApproveTokenTx:()=>mt,buildStellarBatchSwapTx:()=>co,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>D,buildStellarCctpForwardTx:()=>xo,buildStellarClaimRevenueTx:()=>It,buildStellarCreateLiquidityPoolTx:()=>Et,buildStellarExecuteCancellerResetTx:()=>_r,buildStellarExecuteStrategyTx:()=>po,buildStellarFlashLoanTx:()=>j,buildStellarGovernanceAddSpokeImmediateTx:()=>Br,buildStellarGovernanceCreateHubImmediateTx:()=>Or,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>vr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Ar,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Pr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>qr,buildStellarGovernanceExecuteTx:()=>wr,buildStellarGovernanceExecuteUpdateDelayTx:()=>xr,buildStellarGovernancePauseTx:()=>Ur,buildStellarGovernanceRevokeRoleImmediateTx:()=>Mr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Rr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Ir,buildStellarGrantRoleTx:()=>st,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>z,buildStellarMigrateFromBlendTx:()=>X,buildStellarMigrateTx:()=>it,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>ut,buildStellarProposeAddAssetToSpokeTx:()=>Zt,buildStellarProposeAddSpokeTx:()=>Xt,buildStellarProposeApproveBlendPoolTx:()=>nr,buildStellarProposeApproveTokenTx:()=>rr,buildStellarProposeCancellerResetTx:()=>Er,buildStellarProposeConfigureAssetOracleTx:()=>fr,buildStellarProposeConfigureMarketOracleTx:()=>hr,buildStellarProposeCreateHubTx:()=>jt,buildStellarProposeCreateLiquidityPoolTx:()=>ur,buildStellarProposeDeployPoolTx:()=>sr,buildStellarProposeEditAssetInSpokeTx:()=>Qt,buildStellarProposeEditOracleToleranceTx:()=>gr,buildStellarProposeGovernanceUpgradeTx:()=>yr,buildStellarProposeGrantGovernanceRoleTx:()=>Sr,buildStellarProposeMigrateControllerTx:()=>dr,buildStellarProposeRemoveAssetFromSpokeTx:()=>Yt,buildStellarProposeRemoveSpokeTx:()=>Kt,buildStellarProposeRevokeBlendPoolTx:()=>ir,buildStellarProposeRevokeGovernanceRoleTx:()=>mr,buildStellarProposeRevokeTokenTx:()=>or,buildStellarProposeSetAccumulatorTx:()=>zt,buildStellarProposeSetAggregatorTx:()=>Ht,buildStellarProposeSetMinBorrowCollatTx:()=>tr,buildStellarProposeSetPositionLimitsTx:()=>Vt,buildStellarProposeSetPositionManagerTx:()=>er,buildStellarProposeSetPriceAggregatorTx:()=>Ft,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Jt,buildStellarProposeSetSwapAggregatorTx:()=>Wt,buildStellarProposeTransferCtrlOwnershipTx:()=>cr,buildStellarProposeTransferGovOwnTx:()=>Tr,buildStellarProposeUnpauseTx:()=>Cr,buildStellarProposeUpdateDelayTx:()=>br,buildStellarProposeUpgradeControllerTx:()=>pr,buildStellarProposeUpgradePoolParamsTx:()=>ar,buildStellarProposeUpgradePoolTx:()=>lr,buildStellarRenewAccountTx:()=>kt,buildStellarRepayBatchTx:()=>F,buildStellarRepayDebtWithCollateralTx:()=>Y,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>St,buildStellarRevokeRoleTx:()=>lt,buildStellarRevokeTokenTx:()=>Tt,buildStellarSetAccumulatorTx:()=>gt,buildStellarSetAggregatorTx:()=>ht,buildStellarSetMarketOracleConfigTx:()=>vt,buildStellarSetOracleSanityBoundsTx:()=>Pt,buildStellarSetOracleToleranceTx:()=>xt,buildStellarSetOracleTx:()=>wt,buildStellarSetPositionLimitsTx:()=>yt,buildStellarSetPriceAggregatorTx:()=>ft,buildStellarSetSpokeAssetFlagsTx:()=>At,buildStellarSetSwapAggregatorTx:()=>ct,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>$,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>pt,buildStellarUnpauseTx:()=>at,buildStellarUpdateAccountThresholdTx:()=>Ot,buildStellarUpdateIndexesTx:()=>qt,buildStellarUpgradeControllerTx:()=>nt,buildStellarUpgradeLiquidityPoolParamsTx:()=>_t,buildStellarWithdrawBatchTx:()=>G,buildStellarWithdrawTx:()=>W,buildTx:()=>U,decodeStellarLendingEvent:()=>eo,decodeStellarLiquidateReturn:()=>V,encodeAssetOracle:()=>rt,encodeInterestRateModel:()=>ze,encodeMarketOracleConfigInput:()=>ot,encodeMarketParamsRaw:()=>Ve,encodePositionLimits:()=>je,encodePriceKey:()=>Xe,encodeStrategyPayloadToRouteXdr:()=>lo,extractEventOrder:()=>oo,getStellarAccountPositions:()=>fe,getStellarActiveUsersSeries:()=>Le,getStellarAggregatorQuote:()=>ao,getStellarAsset:()=>le,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>ye,getStellarAssetPage:()=>ge,getStellarAssets:()=>ne,getStellarCampaignLeaderboard:()=>Re,getStellarCampaignMe:()=>Fe,getStellarDefiLlamaDimensions:()=>Ne,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>oe,getStellarFeeRevenueSeries:()=>Me,getStellarGovernanceProposals:()=>qe,getStellarHolderDistribution:()=>Ie,getStellarHub:()=>pe,getStellarHubGraph:()=>we,getStellarHubHolders:()=>Se,getStellarHubs:()=>ie,getStellarLendingContext:()=>te,getStellarLendingLiveState:()=>re,getStellarLiquidationsLeaderboard:()=>_e,getStellarLiquidationsSeries:()=>Ue,getStellarParticipantCounts:()=>Ee,getStellarPnlByScope:()=>We,getStellarPositionsLeaderboard:()=>ke,getStellarPositionsPnl:()=>Ge,getStellarQuoteTokens:()=>so,getStellarRateSpreadSeries:()=>$e,getStellarReserve:()=>se,getStellarReserveGraph:()=>xe,getStellarReserveHolders:()=>be,getStellarReserves:()=>ae,getStellarRevenueSeries:()=>Be,getStellarSpoke:()=>de,getStellarSpokeGraph:()=>ve,getStellarSpokeHolders:()=>me,getStellarSpokes:()=>ue,getStellarStatsHistory:()=>Oe,getStellarUserActivity:()=>Ae,getStellarUserActivityPage:()=>Pe,getStellarUserHistory:()=>De,getStellarUserPositions:()=>ce,getStellarVolumeSeries:()=>Ce,getStellarWalletBalance:()=>he,mapQuoteResponseToAggregatorSwap:()=>go,mapQuoteResponseToStrategyPayload:()=>fo,mapQuoteResponseToStrategySwap:()=>ho,mapSorobanError:()=>Po,mapStellarPositionActivityType:()=>io,prepareStellarBuiltTx:()=>mo,prepareStellarTxXdr:()=>So,stellarLendingDispatchKey:()=>Nr,stellarLendingRead:()=>He,stellarNetworks:()=>n,syntheticEventOrder:()=>no,tagStellarInvokedContractError:()=>bo,toBase64Xdr:()=>Lr,toStellarPositionMode:()=>To});const o={stellarMainnet:{name:"mainnet",passphrase:"Public Global Stellar Network ; September 2015",horizonUrl:"https://horizon.stellar.org",sorobanRpcUrl:"https://stellar-gateway.xoxno.com",quoteUrl:"https://stellar-swap.xoxno.com",explorerNetwork:"public",aquariusApiUrl:"https://amm-api.aqua.network",aquariusRouter:"CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK",lendingController:"CAUCMIN5KSXEVZ7NMXR3LZATGD5EFIEUI5XWTFLYRO2R5OTXI22WE5JX",aggregatorRouter:"CCVENFSVCBYDHVOACFZXMNNYVOZ3LKXPZYU5LUI4N7KTXOKRVYD7F3TR",governance:"CC44PEQW7HSEPKAZ5ZRPH2JS5M5KVJXCUBLJ2ZX4E3WCDKMNFILHC2AD",priceAggregator:"CBGUF2G2Q7HCVCWYISDXBHPVBGMYNXA7PG2VET66YBZX6IKOOV27NSMV",positionNftContract:"CAWCSG77AY2W24QZ6ZXLHZU4UXEFHZBM6EI4A4IF7JB5CTY4XND3TI6C"},stellarTestnet:{name:"testnet",passphrase:"Test SDF Network ; September 2015",horizonUrl:"https://horizon-testnet.stellar.org",sorobanRpcUrl:"https://stellar-testnet-gateway.xoxno.com",quoteUrl:"https://testnet-stellar-swap.xoxno.com",explorerNetwork:"testnet",aquariusApiUrl:"https://amm-api-testnet.aqua.network",aquariusRouter:"CBCFTQSPDBAIZ6R6PJQKSQWKNKWH2QIV3I4J72SHWBIK3ADRRAM5A6GD",lendingController:"CCXRWJ6SIU2WPFEGLFGJVITPL57QAYIMIO6OAM2NBGNDQSSCK2FFV3F3",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},n=o;function i(e){return o["testnet"===e?"stellarTestnet":"stellarMainnet"]}const u={mainnet:o.stellarMainnet.passphrase,testnet:o.stellarTestnet.passphrase},a=require("@stellar/stellar-sdk");var s=r(287);const l=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],p={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},d=1e6,c=e=>new a.Address(e).toScVal(),f=e=>new a.ScInt(e).toI128(),h=e=>a.xdr.ScVal.scvU32(e),g=e=>{if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new a.ScInt("string"==typeof e?e:e.toString()).toU64()},y=e=>a.xdr.ScVal.scvBool(e),b=e=>a.xdr.ScVal.scvString(e),S=e=>a.xdr.ScVal.scvSymbol(e),m=()=>a.xdr.ScVal.scvVoid(),T=e=>a.xdr.ScVal.scvVec(e),w=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=s.hp.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return a.xdr.ScVal.scvBytes(o)},v=(e,t)=>null==e?m():t(e),x=(e,t)=>k({asset:c(t),hub_id:h(e)}),A=(e,t,r)=>a.xdr.ScVal.scvVec([x(e,t),f(r)]),P=e=>a.xdr.ScVal.scvVec(e.map((e=>A(e.hubId,e.asset,e.amount)))),q=e=>{if("Transfer"===e)return T([S("Transfer")]);if(e&&"object"==typeof e&&"Credit"in e){const t=e.Credit;if("number"==typeof t&&!Number.isInteger(t))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${t}`);return T([S("Credit"),g(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},k=e=>{const t=Object.keys(e).sort().map((t=>new a.xdr.ScMapEntry({key:S(t),val:e[t]})));return a.xdr.ScVal.scvMap(t)};class E{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>d)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(p[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(i>d)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const u=i===d;let a=d;n.forEach(((e,o)=>{r[e]=!0;const i=t[e];let s;if(o+1===n.length&&u)s=0;else{if(0===a)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(i.splitPpm*d/a);a-=Math.min(i.splitPpm,a),s=128+this.weight(e)}this.emitPath(i,s)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return s.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const _=e=>{const t=new E(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,i]=o,[u,a]=e.preSwapFromA?[n,i]:[i,n];t.emit(p.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(u),t.asset(a))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return k({amounts:a.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:a.xdr.ScVal.scvVec(t.assetList.map((e=>c(e)))),ops:a.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},I=e=>{const t=s.hp.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return a.xdr.ScVal.scvBytes(t)},R=()=>a.xdr.ScVal.scvBytes(s.hp.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return s.hp.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=s.hp.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},B=e=>{if("string"==typeof e)return I(O(e));if(e instanceof Uint8Array)return 0===e.length?R():I(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?I(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?I(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?I(O(e.bytes)):0===e.bytes.length?R():I(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length&&!t.burnPool&&!t.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!l.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>d)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==d)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),a.xdr.ScVal.scvBytes(s.hp.from(_(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},M=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=s.hp.from(t,"hex");return a.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return a.xdr.ScVal.scvBytes(s.hp.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function U(e,t,r){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const o=new a.Contract(e.controllerAddress),n=new a.Account(e.caller,e.sourceSequence);return{xdr:new a.TransactionBuilder(n,{fee:e.fee??a.BASE_FEE,networkPassphrase:u[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function C(e){if(!Number.isInteger(e)||e<1||e>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return h(e)}function L(e,t){const r=t.accountNonce??0;return U(e,"supply",[c(e.caller),g(r),C(t.spokeId),P([...t.assets])])}function $(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return U(e,"borrow",[c(e.caller),g(t.accountNonce),P([...t.borrows]),v(t.to,c)])}function D(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return U(e,"withdraw",[c(e.caller),g(t.accountNonce),P([...t.withdrawals]),v(t.to,c)])}function W(e,t){return G(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"repay",[c(e.caller),g(t.accountNonce),P([...t.payments])])}function H(e,t){return F(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function z(e,t){return U(e,"liquidate",[c(e.caller),g(t.accountNonce),P([...t.debtPayments]),q(t.seizeMode??"Transfer")])}function V(e){const t=(0,a.scValToNative)(a.xdr.ScVal.fromXDR(e,"base64"));if("bigint"==typeof t||"number"==typeof t)return t.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof t)}function j(e,t){return U(e,"flash_loan",[c(e.caller),x(t.hubId,t.asset),f(t.amount),c(t.receiver),M(t.data)])}function X(e,t){return U(e,"migrate_from_blend",[c(e.caller),g(t.accountId),C(t.spokeId),h(t.hubId),c(t.blendPool),T(t.collateralTokens.map(c)),T(t.supplyTokens.map(c)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),a.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,a.xdr.ScVal.scvVec([c(t),f(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0;return U(e,"multiply",[c(e.caller),g(r),C(t.spokeId),x(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),x(t.debt.hubId,t.debt.asset),h(t.mode),B(t.steps),v(t.initialPayment,(e=>A(e.hubId,e.asset,e.amount))),v(t.convertSwap,B)])}function Z(e,t){return U(e,"swap_debt",[c(e.caller),g(t.accountNonce),x(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),x(t.newDebt.hubId,t.newDebt.asset),B(t.steps)])}function Q(e,t){return U(e,"swap_collateral",[c(e.caller),g(t.accountNonce),x(t.current.hubId,t.current.asset),f(t.fromAmount),x(t.newCollateral.hubId,t.newCollateral.asset),B(t.steps)])}function Y(e,t){return U(e,"repay_debt_with_collateral",[c(e.caller),g(t.accountNonce),x(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),x(t.debt.hubId,t.debt.asset),B(t.steps),y(t.closePosition)])}const J="/stellar-lending",ee=encodeURIComponent,te=(e,t)=>e.fetchWithTimeout(`${J}/context`,t),re=(e,t)=>e.fetchWithTimeout(`${J}/live-state`,t),oe=(e,t)=>e.fetchWithTimeout(`${J}/markets/detailed`,t),ne=(e,t)=>e.fetchWithTimeout(`${J}/assets`,t),ie=(e,t)=>e.fetchWithTimeout(`${J}/hubs`,t),ue=(e,t)=>e.fetchWithTimeout(`${J}/spokes`,t),ae=(e,t={},r)=>e.fetchWithTimeout(`${J}/reserves`,{...r,params:{...t}}),se=(e,t,r,o,n)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}`,n),le=(e,t,r)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}`,r),pe=(e,t,r)=>e.fetchWithTimeout(`${J}/hubs/${t}`,r),de=(e,t,r)=>e.fetchWithTimeout(`${J}/spokes/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/positions`,r),fe=(e,t,r)=>e.fetchWithTimeout(`${J}/accounts/${ee(t)}/positions`,r),he=(e,t,r,o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/assets/${ee(r)}/balance`,o),ge=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/page`,{...o,params:{...r}}),ye=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/markets`,{...o,params:{side:r}}),be=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/holders`,{...i,params:{side:n}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/holders`,{...o,params:{side:r}}),me=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/holders`,{...o,params:{side:r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/graph`,{...o,params:{...r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/graph`,{...o,params:{...r}}),xe=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/graph`,{...i,params:{...n}}),Ae=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity`,{...o,params:{...r}}),Pe=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity/page`,{...o,params:{...r}}),qe=(e,t={},r)=>e.fetchWithTimeout(`${J}/governance/proposals`,{...r,params:{...t}}),ke=(e,t={},r)=>e.fetchWithTimeout(`${J}/positions`,{...r,params:{...t}}),Ee=(e,t={},r)=>e.fetchWithTimeout(`${J}/participants`,{...r,params:{...t}}),_e=(e,t={},r)=>e.fetchWithTimeout(`${J}/liquidations/leaderboard`,{...r,params:{...t}}),Ie=(e,t={},r)=>e.fetchWithTimeout(`${J}/distribution`,{...r,params:{...t}}),Re=(e,t={},r)=>e.fetchWithTimeout(`${J}/campaign/leaderboard`,{...r,params:{...t}}),Oe=(e,t,r)=>e.fetchWithTimeout(`${J}/stats/history`,{...r,params:{...t}}),Be=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue`,{...r,params:{...t}}),Me=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue/fees`,{...r,params:{...t}}),Ue=(e,t,r)=>e.fetchWithTimeout(`${J}/liquidations`,{...r,params:{...t}}),Ce=(e,t,r)=>e.fetchWithTimeout(`${J}/volume`,{...r,params:{...t}}),Le=(e,t,r)=>e.fetchWithTimeout(`${J}/active-users`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${J}/rate-spread`,{...r,params:{...t}}),Ne=(e,t,r)=>e.fetchWithTimeout(`${J}/defillama`,{...r,params:{...t}}),De=(e,t,r,o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/history`,{...o,params:{...r}}),Ge=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl`,{...r,params:{accountId:t}}),We=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl/scope`,{...r,params:{scope:t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${J}/campaign/me`,{...r,params:{owner:t}}),He=e=>({context:t=>te(e,t),liveState:t=>re(e,t),marketsDetailed:t=>oe(e,t),assets:t=>ne(e,t),hubs:t=>ie(e,t),spokes:t=>ue(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?ae(e,t,r):ae(e,{},t),reserve:(t,r,o,n)=>se(e,t,r,o,n),asset:(t,r)=>le(e,t,r),hub:(t,r)=>pe(e,t,r),spoke:(t,r)=>de(e,t,r),userPositions:(t,r)=>ce(e,t,r),accountPositions:(t,r)=>fe(e,t,r),walletBalance:(t,r,o)=>he(e,t,r,o),assetPage:(t,r,o)=>ge(e,t,r,o),assetMarkets:(t,r,o)=>ye(e,t,r,o),reserveHolders:(t,r,o,n,i)=>be(e,t,r,o,n,i),hubHolders:(t,r,o)=>Se(e,t,r,o),spokeHolders:(t,r,o)=>me(e,t,r,o),assetGraph:(t,r,o)=>Te(e,t,r,o),hubGraph:(t,r,o)=>we(e,t,r,o),spokeGraph:(t,r,o)=>ve(e,t,r,o),reserveGraph:(t,r,o,n,i)=>xe(e,t,r,o,n,i),userActivity:(t,r={},o)=>Ae(e,t,r,o),userActivityPage:(t,r={},o)=>Pe(e,t,r,o),governanceProposals:(t={},r)=>qe(e,t,r),positionsLeaderboard:(t={},r)=>ke(e,t,r),participants:(t={},r)=>Ee(e,t,r),liquidationsLeaderboard:(t={},r)=>_e(e,t,r),distribution:(t={},r)=>Ie(e,t,r),campaignLeaderboard:(t={},r)=>Re(e,t,r),statsHistory:(t,r)=>Oe(e,t,r),revenue:(t,r)=>Be(e,t,r),feeRevenue:(t,r)=>Me(e,t,r),liquidations:(t,r)=>Ue(e,t,r),volume:(t,r)=>Ce(e,t,r),activeUsers:(t,r)=>Le(e,t,r),rateSpread:(t,r)=>$e(e,t,r),defillama:(t,r)=>Ne(e,t,r),userHistory:(t,r,o)=>De(e,t,r,o),positionsPnl:(t,r)=>Ge(e,t,r),pnlByScope:(t,r)=>We(e,t,r),campaignMe:(t,r)=>Fe(e,t,r)}),ze=e=>k({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Ve=e=>k({asset_decimals:h(e.assetDecimals),asset_id:c(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:y(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),je=e=>k({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),Xe=e=>{if("Token"in e&&e.Token)return T([S("Token"),c(e.Token)]);if("Ref"in e&&e.Ref)return T([S("Ref"),S(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Ke=e=>{if("Stellar"in e)return T([S("Stellar"),c(e.Stellar)]);if("Symbol"in e)return T([S("Symbol"),S(e.Symbol)]);if("String"in e)return T([S("String"),b(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ze=e=>{if("Spot"===e)return T([S("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return T([S("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Qe=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return T([S(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Ye=e=>{if("Market"===e||"Fundamental"===e)return T([S(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Je=e=>{if("Reflector"in e){const t=e.Reflector;return T([S("Reflector"),k({asset:Ke(t.asset),contract:c(t.contract),read_mode:Ze(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return T([S("MultiFeed"),k({contract:c(t.contract),feed_id:b(t.feedId),kind:Qe(t.kind),nature:Ye(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},et=e=>{const t=e;return k({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:Je(t.provider)})},tt=e=>{if("RequireDisjoint"===e)return T([S("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return T([S("AllowShared"),T(t.map((e=>k({contract:c(e.contract),kind:Qe(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},rt=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return k({asset_decimals:h(Number(t.assetDecimals)),independence:tt(t.independence),max_price_stale_seconds:g(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:f(String(t.maxSanityPriceWad)),min_sanity_price_wad:f(String(t.minSanityPriceWad)),sources:T(r.map((e=>(e=>{if("Feed"in e)return T([S("Feed"),et(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return T([S("Scaled"),k({factor:et(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:Xe(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return T([S("LpShare"),k({key_a:Xe(t.keyA),key_b:Xe(t.keyB),kind:T([S(t.kind||"ConstantProduct")]),pool:c(t.pool),reserve_a_decimals:h(t.reserveADecimals),reserve_b_decimals:h(t.reserveBDecimals),share_decimals:h(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:k({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})},ot=rt;function nt(e,t){return U(e,"upgrade",[w(t.wasmHash)])}function it(e,t){return U(e,"migrate",[h(t.newVersion)])}function ut(e){return U(e,"pause",[])}function at(e){return U(e,"unpause",[])}function st(e,t){return U(e,"grant_role",[c(t.account),S(t.role)])}function lt(e,t){return U(e,"revoke_role",[c(t.account),S(t.role)])}function pt(e,t){return U(e,"transfer_ownership",[c(t.newOwner),h(t.liveUntilLedger)])}function dt(e){return U(e,"accept_ownership",[])}function ct(e,t){return U(e,"set_swap_aggregator",[c(t.aggregator)])}function ft(e,t){return U(e,"set_price_aggregator",[c(t.aggregator)])}const ht=ct;function gt(e,t){return U(e,"set_accumulator",[c(t.accumulator)])}function yt(e,t){return U(e,"set_position_limits",[je(t)])}function bt(e,t){return U(e,"approve_blend_pool",[c(t.pool)])}function St(e,t){return U(e,"revoke_blend_pool",[c(t.pool)])}const mt=bt,Tt=St;function wt(e,t){return U(e,"set_oracle",[Xe(t.key),rt(t.oracle)])}const vt=wt;function xt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[Xe(t.key),k({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function At(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),x(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Pt(e,t){return U(e,"set_oracle_sanity_bounds",[c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function qt(e,t){return U(e,"update_indexes",[c(e.caller),T(t.assets.map((e=>x(e.hubId,e.asset))))])}function kt(e,t){return U(e,"renew_account",[c(e.caller),g(t.accountNonce)])}function Et(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),c(t.asset),Ve(t.params)])}function _t(e,t){return U(e,"upgrade_liquidity_pool_params",[x(t.hubId,t.asset),ze(t.params)])}function It(e,t){return U(e,"claim_revenue",[c(e.caller),T(t.assets.map((e=>x(e.hubId,e.asset))))])}function Rt(e,t){return U(e,"add_rewards",[c(e.caller),P(t.rewards)])}function Ot(e,t){return U(e,"update_account_threshold",[c(e.caller),y(t.hasRisks),T(t.accountNonces.map((e=>g(e))))])}const Bt="00".repeat(32),Mt=e=>{if("string"==typeof e)return w(e);const t=s.hp.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return a.xdr.ScVal.scvBytes(t)},Ut=(e,...t)=>T([S(e),...t]),Ct=e=>k({new_owner:c(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Lt=e=>k({asset:c(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:y(e.canBorrow),can_collateral:y(e.canCollateral),frozen:y(e.frozen),hub_id:h(e.hubId),paused:y(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:y(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),$t=e=>k({account:c(e.account),role:S(e.role)});function Nt(e,t,r){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const o=new a.Contract(e.governanceAddress),n=new a.Account(e.caller,e.sourceSequence);return{xdr:new a.TransactionBuilder(n,{fee:e.fee??a.BASE_FEE,networkPassphrase:u[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Dt=(e,t,r)=>Nt(e,"propose",[c(e.caller),t,Mt(r)]),Gt=(e,t,r)=>Nt(e,"execute_self",[m(),t,Mt(r)]);function Wt(e,t,r){return Dt(e,Ut("SetSwapAggregator",c(t.aggregator)),r)}function Ft(e,t,r){return Dt(e,Ut("SetPriceAggregator",c(t.aggregator)),r)}const Ht=Wt;function zt(e,t,r){return Dt(e,Ut("SetAccumulator",c(t.accumulator)),r)}function Vt(e,t,r){return Dt(e,Ut("SetPositionLimits",je(t)),r)}function jt(e,t){return Dt(e,Ut("CreateHub"),t)}function Xt(e,t){return Dt(e,Ut("AddSpoke"),t)}function Kt(e,t,r){return Dt(e,Ut("RemoveSpoke",h(t.spokeId)),r)}function Zt(e,t,r){return Dt(e,Ut("AddAssetToSpoke",Lt(t)),r)}function Qt(e,t,r){return Dt(e,Ut("EditAssetInSpoke",Lt(t)),r)}function Yt(e,t,r){return Dt(e,Ut("RemoveAssetFromSpoke",k({hub_asset:x((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function Jt(e,t,r){return Dt(e,Ut("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:f((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:h(o.liquidationBonusFactorBps),spoke_id:h(o.spokeId),target_hf_wad:f(o.targetHfWad)})),r);var o}function er(e,t,r){return Dt(e,Ut("SetPositionManager",c(t.manager),y(t.isActive)),r)}function tr(e,t,r){return Dt(e,Ut("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function rr(e,t,r){return Dt(e,Ut("ApproveToken",c(t.token)),r)}function or(e,t,r){return Dt(e,Ut("RevokeToken",c(t.token)),r)}function nr(e,t,r){return Dt(e,Ut("ApproveBlendPool",c(t.pool)),r)}function ir(e,t,r){return Dt(e,Ut("RevokeBlendPool",c(t.pool)),r)}function ur(e,t,r){return Dt(e,Ut("CreateLiquidityPool",k({asset:c((o=t).asset),hub_id:h(o.hubId),params:Ve(o.params)})),r);var o}function ar(e,t,r){return Dt(e,Ut("UpgradeLiquidityPoolParams",k({hub_asset:x((o=t).hubId,o.asset),params:ze(o.params)})),r);var o}function sr(e,t,r){return Dt(e,Ut("DeployPool",w(t.wasmHash)),r)}function lr(e,t,r){return Dt(e,Ut("UpgradePool",w(t.wasmHash)),r)}function pr(e,t,r){return Dt(e,Ut("UpgradeController",w(t.wasmHash)),r)}function dr(e,t,r){return Dt(e,Ut("MigrateController",h(t.newVersion)),r)}function cr(e,t,r){return Dt(e,Ut("TransferCtrlOwnership",Ct(t)),r)}function fr(e,t,r){return Dt(e,Ut("ConfigureAssetOracle",k({key:Xe((o=t).key),oracle:rt(o.oracle)})),r);var o}const hr=fr;function gr(e,t,r){return Dt(e,Ut("EditOracleTolerance",k({key:Xe((o=t).key),tolerance:h(o.tolerance)})),r);var o}function yr(e,t,r){return Dt(e,Ut("UpgradeGov",w(t.wasmHash)),r)}function br(e,t,r){return Dt(e,Ut("UpdateGovDelay",h(t.newDelay)),r)}function Sr(e,t,r){return Dt(e,Ut("GrantGovRole",$t(t)),r)}function mr(e,t,r){return Dt(e,Ut("RevokeGovRole",$t(t)),r)}function Tr(e,t,r){return Dt(e,Ut("TransferGovOwnership",Ct(t)),r)}function wr(e,t){const r=T(t.argsXdr.map((e=>a.xdr.ScVal.fromXDR(e,"base64")))),o=Mt(t.predecessor??Bt);return Nt(e,"execute",[m(),c(t.target),S(t.functionName),r,o,Mt(t.salt)])}function vr(e,t,r){return Gt(e,Ut("UpgradeGov",w(t.wasmHash)),r)}function xr(e,t,r){return Gt(e,Ut("UpdateGovDelay",h(t.newDelay)),r)}function Ar(e,t,r){return Gt(e,Ut("GrantGovRole",$t(t)),r)}function Pr(e,t,r){return Gt(e,Ut("RevokeGovRole",$t(t)),r)}function qr(e,t,r){return Gt(e,Ut("TransferGovOwnership",Ct(t)),r)}const kr=e=>T(e.map(c));function Er(e,t,r){return Nt(e,"propose_canceller_reset",[kr(t.newCancellers),Mt(r)])}function _r(e,t,r){return Nt(e,"execute_canceller_reset",[v(t.executor,c),kr(t.newCancellers),Mt(r)])}function Ir(e,t){return Nt(e,"set_spoke_asset_flags",[c(e.caller),h(t.spokeId),x(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Rr(e,t){return Nt(e,"set_oracle_sanity_bounds",[c(e.caller),c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Or(e){return Nt(e,"create_hub",[c(e.caller)])}function Br(e){return Nt(e,"add_spoke",[c(e.caller)])}function Mr(e,t){return Nt(e,"revoke_role_immediate",[c(t.account),S(t.role)])}function Ur(e){return Nt(e,"pause",[c(e.caller)])}function Cr(e,t){return Dt(e,Ut("Unpause"),t)}const Lr=e=>e.toXDR("base64"),$r=e=>a.xdr.ScVal.fromXDR(e,"base64"),Nr=e=>e.map((e=>String((0,a.scValToNative)($r(e))))).join(":"),Dr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Gr=e=>Number(e),Wr=e=>String(e),Fr=e=>e instanceof Uint8Array?s.hp.from(e).toString("hex"):s.hp.isBuffer(e)?e.toString("hex"):String(e),Hr=["None","Multiply","Long","Short"],zr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net","liq_credit"],Vr=e=>Array.isArray(e)?e:[],jr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],zr[Gr(o)]??Dr(o)),positionType:t,hubId:Gr(e[1]),asset:Wr(e[2]),scaledAmountRay:Dr(e[3]),indexRay:Dr(e[4]),amount:Dr(e[5]),liquidationThresholdBps:r?void 0:Gr(e[6]),liquidationBonusBps:r?void 0:Gr(e[7]),loanToValueBps:r?void 0:Gr(e[8]),liquidationFeesBps:r?void 0:Gr(e[9])};var o},Xr=e=>{return{owner:Wr(e[0]),spokeId:Gr(e[1]),mode:(t=e[2],Hr[Gr(t)]??"None")};var t},Kr=e=>Array.isArray(e)?e[1]:void 0,Zr=e=>{const t=(r=e,Array.isArray(r)?Wr(r[0]):Wr(r));var r;if("Token"===t)return{Token:Wr(Kr(e))};if("Ref"===t)return{Ref:Wr(Kr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Wr(t.Token)};if(void 0!==t.Ref)return{Ref:Wr(t.Ref)}}return{Token:Wr(e)}},Qr=e=>{const t=e.tolerance??{};return{assetDecimals:Gr(e.asset_decimals),maxPriceStaleSeconds:Gr(e.max_price_stale_seconds),sources:Vr(e.sources).map((e=>e)),tolerance:{upperRatio:Gr(t.upper_ratio_bps),lowerRatio:Gr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Dr(e.min_sanity_price_wad),maxSanityPriceWad:Dr(e.max_sanity_price_wad)}},Yr={"market:create":e=>({topic:"market:create",data:{hubId:Gr(e.hub_id),baseAsset:Wr(e.base_asset),maxBorrowRate:Dr(e.max_borrow_rate),baseBorrowRate:Dr(e.base_borrow_rate),slope1:Dr(e.slope1),slope2:Dr(e.slope2),slope3:Dr(e.slope3),midUtilization:Dr(e.mid_utilization),optimalUtilization:Dr(e.optimal_utilization),maxUtilization:Dr(e.max_utilization),reserveFactor:Gr(e.reserve_factor),marketAddress:Wr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Wr(e.asset),maxBorrowRateRay:Dr(e.max_borrow_rate),baseBorrowRateRay:Dr(e.base_borrow_rate),slope1Ray:Dr(e.slope1),slope2Ray:Dr(e.slope2),slope3Ray:Dr(e.slope3),midUtilizationRay:Dr(e.mid_utilization),optimalUtilizationRay:Dr(e.optimal_utilization),maxUtilizationRay:Dr(e.max_utilization),reserveFactorBps:Gr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Vr(e).map((e=>{return t=Vr(e),{hubId:Gr(t[0]),asset:Wr(t[1]),timestamp:Gr(t[2]),supplyIndexRay:Dr(t[3]),borrowIndexRay:Dr(t[4]),cash:Dr(t[5]),suppliedRay:Dr(t[6]),borrowedRay:Dr(t[7]),revenueRay:Dr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Vr(e).map((e=>{const t=e;return{hubId:Gr(t.hub_id),asset:Wr(t.asset),params:(r=t.params,{maxBorrowRateRay:Dr(r.max_borrow_rate),baseBorrowRateRay:Dr(r.base_borrow_rate),slope1Ray:Dr(r.slope1),slope2Ray:Dr(r.slope2),slope3Ray:Dr(r.slope3),midUtilizationRay:Dr(r.mid_utilization),optimalUtilizationRay:Dr(r.optimal_utilization),maxUtilizationRay:Dr(r.max_utilization),reserveFactorBps:Gr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Gr(r.flashloan_fee),assetId:Wr(r.asset_id),assetDecimals:Gr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Vr(e);return{topic:"position:batch_update",data:{accountId:Dr(t[0]),accountAttributes:Xr(Vr(t[1])),updates:[...Vr(t[2]).map((e=>jr(Vr(e),"Deposit"))),...Vr(t[3]).map((e=>jr(Vr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Gr(e.hub_id),asset:Wr(e.asset),receiver:Wr(e.receiver),caller:Wr(e.caller),amount:Dr(e.amount),fee:Dr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Zr(e.key),oracle:Qr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Wr(e.asset),oracle:Qr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Wr(e.liquidator),accountId:Dr(e.account_id),repaidUsdWad:Dr(e.repaid_usd_wad),bonusBps:Dr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Dr(e.account_id),totalBorrowUsdWad:Dr(e.total_borrow_usd_wad),totalCollateralUsdWad:Dr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Wr(e.token),amount:Dr(e.amount),usdValueWad:Dr(e.usd_value_wad),accountId:Dr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Gr(e.hub_id),asset:Wr(e.asset),amount:Dr(e.amount),fee:Dr(e.fee),amountSent:Dr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Wr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:Fr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Wr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Wr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Wr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Wr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Fr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Gr(e.max_supply_positions),maxBorrowPositions:Gr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Dr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Wr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Gr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Dr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Dr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Gr(t.liquidation_bonus_factor_bps)}}}},Jr=Object.freeze(Object.keys(Yr));function eo(e,t){const r=Nr(e),o=Yr[r];return o?o((0,a.scValToNative)($r(t))):null}const to=1e4;function ro(e,t){return`${e}-${BigInt(t).toString(10)}`}function oo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function no(e,t=0){return e*to+t}function io(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const uo=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()};async function ao(e,t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=uo(t.baseUrl,"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,referralId:e.referralId,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function so(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=uo(e.baseUrl,"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const lo=e=>_(e).toXDR("base64");function po(e,t){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const r=new a.Contract(e.routerAddress),o=new a.Account(e.caller,e.sourceSequence),n=B(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new a.TransactionBuilder(o,{fee:e.fee??a.BASE_FEE,networkPassphrase:u[e.network]}).addOperation(r.call("execute_strategy",c(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function co(e,t){return po(e,t)}function fo(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(yo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(yo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function ho(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:fo(e,t)}const go=fo,yo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function bo(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function So(e,t,r){const o=a.TransactionBuilder.fromXDR(t,r?.network?u[r.network]:"");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw bo(r.invokedContractId,e);throw e}}async function mo(e,t,r){return So(e,t.xdr,r)}function To(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function wo(e,t){return new Uint8Array(0)}const vo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return s.hp.from(t,"hex")};function xo(e){const t=new a.Account(e.caller,e.sourceSequence),r=new a.Contract(e.forwarderAddress).call("mint_and_forward",a.xdr.ScVal.scvBytes(vo(e.message)),a.xdr.ScVal.scvBytes(vo(e.attestation)));return{xdr:new a.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:u[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ao={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Po(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=Ao[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{Chain:()=>u,DEFAULT_REQUEST_TIMEOUT_MS:()=>i,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>g.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>g.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>g.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>g.STELLAR_NETWORK_PASSPHRASE,SYNTHETIC_EVENT_ORDER_STRIDE:()=>g.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>a,buildSameTokenRepaySwapSteps:()=>g.buildSameTokenRepaySwapSteps,buildSdk:()=>m,buildStellarAcceptOwnershipTx:()=>g.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>g.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>g.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>g.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>g.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>g.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>g.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>g.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>g.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>g.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>g.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>g.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>g.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>g.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>g.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>g.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>g.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>g.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>g.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>g.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>g.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>g.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>g.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>g.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>g.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>g.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>g.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>g.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>g.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>g.buildStellarMigrateTx,buildStellarMultiplyTx:()=>g.buildStellarMultiplyTx,buildStellarPauseTx:()=>g.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>g.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>g.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>g.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>g.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>g.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>g.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>g.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>g.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>g.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>g.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>g.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>g.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>g.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>g.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>g.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>g.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>g.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>g.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>g.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>g.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>g.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>g.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>g.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>g.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>g.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>g.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>g.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>g.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>g.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>g.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>g.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>g.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>g.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>g.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>g.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>g.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>g.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>g.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>g.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>g.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>g.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>g.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>g.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>g.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>g.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>g.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>g.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>g.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>g.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>g.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>g.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>g.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>g.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>g.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>g.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>g.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>g.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>g.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>g.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>g.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>g.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>g.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>g.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>g.buildStellarWithdrawTx,buildTx:()=>g.buildTx,decodeStellarLendingEvent:()=>g.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>g.decodeStellarLiquidateReturn,encodeAssetOracle:()=>g.encodeAssetOracle,encodeInterestRateModel:()=>g.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>g.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>g.encodeMarketParamsRaw,encodePositionLimits:()=>g.encodePositionLimits,encodePriceKey:()=>g.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>g.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>g.extractEventOrder,getStellarAccountPositions:()=>g.getStellarAccountPositions,getStellarActiveUsersSeries:()=>g.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>g.getStellarAggregatorQuote,getStellarAsset:()=>g.getStellarAsset,getStellarAssetGraph:()=>g.getStellarAssetGraph,getStellarAssetMarkets:()=>g.getStellarAssetMarkets,getStellarAssetPage:()=>g.getStellarAssetPage,getStellarAssets:()=>g.getStellarAssets,getStellarCampaignLeaderboard:()=>g.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>g.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>g.getStellarDefiLlamaDimensions,getStellarDeployment:()=>g.getStellarDeployment,getStellarDetailedMarkets:()=>g.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>g.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>g.getStellarGovernanceProposals,getStellarHolderDistribution:()=>g.getStellarHolderDistribution,getStellarHub:()=>g.getStellarHub,getStellarHubGraph:()=>g.getStellarHubGraph,getStellarHubHolders:()=>g.getStellarHubHolders,getStellarHubs:()=>g.getStellarHubs,getStellarLendingContext:()=>g.getStellarLendingContext,getStellarLendingLiveState:()=>g.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>g.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>g.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>g.getStellarParticipantCounts,getStellarPnlByScope:()=>g.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>g.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>g.getStellarPositionsPnl,getStellarQuoteTokens:()=>g.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>g.getStellarRateSpreadSeries,getStellarReserve:()=>g.getStellarReserve,getStellarReserveGraph:()=>g.getStellarReserveGraph,getStellarReserveHolders:()=>g.getStellarReserveHolders,getStellarReserves:()=>g.getStellarReserves,getStellarRevenueSeries:()=>g.getStellarRevenueSeries,getStellarSpoke:()=>g.getStellarSpoke,getStellarSpokeGraph:()=>g.getStellarSpokeGraph,getStellarSpokeHolders:()=>g.getStellarSpokeHolders,getStellarSpokes:()=>g.getStellarSpokes,getStellarStatsHistory:()=>g.getStellarStatsHistory,getStellarUserActivity:()=>g.getStellarUserActivity,getStellarUserActivityPage:()=>g.getStellarUserActivityPage,getStellarUserHistory:()=>g.getStellarUserHistory,getStellarUserPositions:()=>g.getStellarUserPositions,getStellarVolumeSeries:()=>g.getStellarVolumeSeries,getStellarWalletBalance:()=>g.getStellarWalletBalance,isValidCollectionTicker:()=>s,isValidNftIdentifier:()=>l,mapQuoteResponseToAggregatorSwap:()=>g.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>g.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>g.mapQuoteResponseToStrategySwap,mapSorobanError:()=>g.mapSorobanError,mapStellarPositionActivityType:()=>g.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>g.prepareStellarBuiltTx,prepareStellarTxXdr:()=>g.prepareStellarTxXdr,stellarLendingDispatchKey:()=>g.stellarLendingDispatchKey,stellarLendingRead:()=>g.stellarLendingRead,stellarNetworks:()=>g.stellarNetworks,syntheticEventOrder:()=>g.syntheticEventOrder,tagStellarInvokedContractError:()=>g.tagStellarInvokedContractError,toBase64Xdr:()=>g.toBase64Xdr,toStellarPositionMode:()=>g.toStellarPositionMode});const e="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",t="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",n="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",i=3e4;var u;!function(e){e.MAINNET="1",e.DEVNET="D"}(u||(u={}));class a{apiUrl;chain;init;config;constructor(r){if(!r?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:o=u.MAINNET,apiUrl:i,...a}=r;this.apiUrl=i.trim().replace(/\/$/,""),this.chain=o,this.init=a,this.config=o==u.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:e,DR_SC:t,KG_SC:n,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:e,DR_SC:t,KG_SC:n,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,timeout:a,...s}=this.init,{next:l,cache:p,debug:d,timeout:c,headers:f,method:h="GET",...g}=r,y=f?.Authorization,b="Bearer undefined"===y?void 0:y,S="GET"!==h&&"HEAD"!==h&&"PUT"!==h,m={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...S?{"Content-Type":"application/json"}:{},...b?{Authorization:b}:{}},T=Object.entries(t??{}).filter((([,e])=>void 0!==e)).flatMap((([e,t])=>Array.isArray(t)?t.filter((e=>void 0!==e)).map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),w=`${this.apiUrl}${e}${T.length?`?${T}`:""}`,{revalidate:v,...x}=o??{},{revalidate:A,...P}=l??{},q="GET"!==h||b?void 0:A??v,k="GET"!==h||b||q?void 0:p??n,E=g.body,_=c??a??(null==E?i:0),I=_>0?AbortSignal.timeout(_):void 0,R=g.signal??s.signal,O=I&&R?AbortSignal.any([R,I]):I??R,B={...s,...g,method:h,...Object.keys(m).length?{headers:m}:{},...O?{signal:O}:{},cache:k,next:{...x,...P,revalidate:q}};(d??u)&&console.debug("SDK fetch: ",w,B);const M=await fetch(w,B).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${w}: ${e.message}`),{cause:e});throw e})),U=await M.text();if(!M.ok){let e;try{e=JSON.parse(U)}catch{e={message:U}}const t=[w,M.status,M.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(U)}catch{return U}}}const s=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e),o=/^C[A-Z2-7]{55}$/.test(e);return t||r||o},l=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e),o=/^C[A-Z2-7]{55}-\d+$/.test(e);return t||r||o};class p extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class d extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const c=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^[GC][A-Z2-7]{55}$/.test(e)),f={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/integrations/liquid-staking/multiversx/revenue":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/multiversx":{input:{},output:{}},"/integrations/lending/multiversx/revenue":{input:{},output:{}},"/integrations/lending/multiversx/liquidations":{input:{},output:{}},"/integrations/lending/multiversx/active-users":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/stellar-lending/users/:owner/assets/:asset/balance":{input:{},output:{}},"/stellar-lending/users/:owner/activity/page":{input:{},output:{}}},h=["PATCH","POST","DELETE","PUT"];var g=r(586);const y=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),b=()=>({static:{},params:{},leaves:[]});function S(e,t,r,o){const{input:n,output:i,...u}=t,a=async(t={})=>{const n={...r,...t},i=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),u=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),a=Object.fromEntries(Object.entries(n).filter((([e])=>!u.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in a,f=/:collection[^A-Z]/.test(e)||"collection"in a;if(l){const e=n.address;if(!c(e))throw new d(e)}if(f){const e=n.collection;if(Array.isArray(e)?e.some((e=>!s(e))):!s(e))throw new p(e)}const h=Object.fromEntries(Object.entries(a).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:y,method:b,headers:S,cache:m,next:T,debug:w,signal:v,credentials:x,mode:A,redirect:P,referrer:q,referrerPolicy:k,integrity:E,keepalive:_,priority:I,window:R,continuationToken:O,...B}=h,M=y?`Bearer ${y}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==O&&(B.continuationToken=O);const U={...S,...M?{Authorization:M}:{},...O&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(O)}:{}},C={...T,tags:[...T?.tags??[],i]};return o.fetchWithTimeout(i,{method:b,params:B,body:g,headers:U,cache:m,debug:w,...Object.fromEntries(Object.entries({signal:v,credentials:x,mode:A,redirect:P,referrer:q,referrerPolicy:k,integrity:E,keepalive:_,priority:I,window:R}).filter((([,e])=>void 0!==e))),...C?{next:C}:{}})},l=(e={})=>a(e);for(const e of Object.keys(u))h.includes(e)&&(l[e]=t=>a({...t,method:t.method??e.toUpperCase()}));return l}function m(e){const t=function(){const e=b();for(const[t,r]of Object.entries(f)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=y(e.slice(1));n=n.params[t]||=b()}else{const t=y(e);n=n.static[t]||=b()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,i=Object.keys(t.static).length,u=Object.keys(t.params).length;let a;if(1===n&&i+u>0){const{rawPath:r,def:n}=t.leaves[0];a=S(r,n,o,e)}else{a={};for(const{rawPath:r,def:n}of t.leaves)a[y(r.split("/").pop().replace(/^:/,""))]=S(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let i=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),i=r)}void 0===a[e]?a[e]=i:"function"==typeof a[e]?Object.assign(a[e],i):"function"==typeof i?(Object.assign(i,a[e]),a[e]=i):Object.assign(a[e],i)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const i=r(n,{...o,[e]:t});if(i&&"object"==typeof i&&1===Object.keys(i).length&&e in i&&"function"==typeof i[e]){const t=i[e],r=(...e)=>t(...e);return Object.assign(r,t)}return i};if(a[e]){const r=a[e];a[e]=e=>({...r(e),...t(e)})}else a[e]=t}return a};return r(t,{})}})(),module.exports=o})();
|