@xoxno/sdk-js 1.0.225 → 1.0.227
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/README.md +39 -0
- package/dist/cjs/sdk/stellar/index.d.ts +1 -0
- package/dist/cjs/sdk/stellar/read/__tests__/client.test.d.ts +1 -0
- package/dist/cjs/sdk/stellar/read/client.d.ts +19 -0
- package/dist/cjs/sdk/stellar/read/index.d.ts +4 -0
- package/dist/cjs/sdk/stellar/read/schemas.d.ts +375 -0
- package/dist/cjs/sdk/stellar/read/types.d.ts +85 -0
- package/dist/esm/sdk/stellar/index.js +1 -0
- package/dist/esm/sdk/stellar/read/client.js +82 -0
- package/dist/esm/sdk/stellar/read/index.js +3 -0
- package/dist/esm/sdk/stellar/read/schemas.js +163 -0
- package/dist/esm/sdk/stellar/read/types.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.d.ts +1 -0
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/read/__tests__/client.test.d.ts +1 -0
- package/dist/sdk/stellar/read/client.d.ts +19 -0
- package/dist/sdk/stellar/read/index.cjs +1 -0
- package/dist/sdk/stellar/read/index.d.ts +4 -0
- package/dist/sdk/stellar/read/index.esm.js +1 -0
- package/dist/sdk/stellar/read/schemas.d.ts +375 -0
- package/dist/sdk/stellar/read/types.d.ts +85 -0
- package/package.json +19 -3
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=s(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],u=i[1],l=new n(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),d=0,p=u>0?a-4:a;for(r=0;r<p;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[d++]=t>>16&255,l[d++]=t>>8&255,l[d++]=255&t;return 2===u&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[d++]=255&t),1===u&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t),l},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],a=16383,s=0,l=o-n;s<l;s+=a)i.push(u(e,s,s+a>l?l:s+a));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+/",a=0;a<64;++a)r[a]=i[a],o[i.charCodeAt(a)]=a;function s(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 u(e,t,o){for(var n,i,a=[],s=t;s<o;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.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=u,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(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 p(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"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let o=s(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 u.from(o,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?s(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 u.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 d(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 p(e){return d(e),s(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),r=s(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,u.prototype),o}function h(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(u.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 X(e).length;default:if(n)return o?-1:V(e).length;t=(""+t).toLowerCase(),n=!0}}function g(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 q(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function b(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=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:S(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):S(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,o,n){let i,a=1,s=e.length,u=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;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let o=-1;for(i=r;i<s;i++)if(l(e,i)===l(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===u)return o*a}else-1!==o&&(i-=i-o),o=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){let r=!0;for(let o=0;o<u;o++)if(l(e,i+o)!==l(t,o)){r=!1;break}if(r)return i}return-1}function w(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 a;for(o>i/2&&(o=i/2),a=0;a<o;++a){const o=parseInt(t.substr(2*a,2),16);if(Z(o))return a;e[r+a]=o}return a}function v(e,t,r,o){return j(V(t,e.length-r),e,r,o)}function T(e,t,r,o){return j(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 A(e,t,r,o){return j(X(t),e,r,o)}function x(e,t,r,o){return j(function(e,t){let r,o,n;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function I(e,t,r){return 0===t&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,o,s,u;switch(a){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(i=u));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(u=(15&t)<<12|(63&r)<<6|63&o,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=e[n+1],o=e[n+2],s=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=a}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=R));return r}(o)}u.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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return p(e)},u.allocUnsafeSlow=function(e){return p(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.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},u.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}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=u.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?(u.isBuffer(t)||(t=u.from(t)),t.copy(o,n)):Uint8Array.prototype.set.call(o,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},u.byteLength=y,u.prototype._isBuffer=!0,u.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)m(this,t,t+1);return this},u.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)m(this,t,t+3),m(this,t+1,t+2);return this},u.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)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.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&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(e,t,r,o,n){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.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),a=(r>>>=0)-(t>>>=0);const s=Math.min(i,a),l=this.slice(o,n),d=e.slice(t,r);for(let e=0;e<s;++e)if(l[e]!==d[e]){i=l[e],a=d[e];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.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 w(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(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 k(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 q(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+=Y[e[o]];return n}function B(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 _(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 O(e,t,r,o,n,i){if(!u.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 U(e,t,r,o,n){F(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 a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function M(e,t,r,o,n){F(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 a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,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 D(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}u.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,u.prototype),o},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){G(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))})),u.prototype.readBigUInt64BE=Q((function(e){G(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)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(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},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(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},u.prototype.readInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){G(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)})),u.prototype.readBigInt64BE=Q((function(e){G(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)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(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},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(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},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeBigUInt64LE=Q((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=0,i=1,a=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=r-1,i=1,a=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeBigInt64LE=Q((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,o){if(!u.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},u.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&&!u.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=u.isBuffer(e)?e:u.from(e,o),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%a]}return this};const $={};function N(e,t,r){$[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 W(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 F(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 $.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(o,n,i)}function G(e,t){if("number"!=typeof e)throw new $.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),N("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=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(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 a=0;a<o;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+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 X(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 j(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 Y=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 Q(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,a,s=8*n-o-1,u=(1<<s)-1,l=u>>1,d=-7,p=r?n-1:0,c=r?-1:1,f=e[t+p];for(p+=c,i=f&(1<<-d)-1,f>>=-d,d+=s;d>0;i=256*i+e[t+p],p+=c,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=o;d>0;a=256*a+e[t+p],p+=c,d-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,o),i-=l}return(f?-1:1)*a*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var a,s,u,l=8*i-n-1,d=(1<<l)-1,p=d>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+p>=1?c/u:c*Math.pow(2,1-p))*u>=2&&(a++,u/=2),a+p>=d?(s=0,a=d):a+p>=1?(s=(t*u-1)*Math.pow(2,n),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&s,f+=h,s/=256,n-=8);for(a=a<<n|s,l+=n;l>0;e[r+f]=255&a,f+=h,a/=256,l-=8);e[r+f-h]|=128*y}},999(e,t,r){"use strict";r.d(t,{BPS:()=>zo,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>In,LIQUIDATION_BUFFER_BPS:()=>Gn,RAY:()=>Go,RAY_DECIMALS:()=>Vo,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Pt,STELLAR_LENDING_TOPICS:()=>Vr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>a,STELLAR_ROUTE_MAX_BYTES:()=>ao,SYNTHETIC_EVENT_ORDER_STRIDE:()=>jr,StellarAuthPolicyError:()=>wo,StellarRouteVerificationError:()=>so,WAD:()=>Ho,WAD_DECIMALS:()=>Xo,aggregateAccountRisk:()=>Wn,annualBorrowRateRay:()=>vn,assertStellarAuthEntries:()=>Po,assertStellarPreparedTxAuth:()=>Mo,baseToRay:()=>dn,baseToShort:()=>yn,baseValueWad:()=>cn,buildLiveSnapshot:()=>Bn,buildSameTokenRepaySwapSteps:()=>No,buildStellarAcceptOwnershipTx:()=>dt,buildStellarAddRewardsTx:()=>Et,buildStellarApproveBlendPoolTx:()=>yt,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>N,buildStellarCctpForwardTx:()=>Fo,buildStellarClaimRevenueTx:()=>It,buildStellarCreateLiquidityPoolTx:()=>At,buildStellarExecuteCancellerResetTx:()=>Tr,buildStellarExecuteStrategyTx:()=>yo,buildStellarFlashLoanTx:()=>X,buildStellarGovernanceAddSpokeImmediateTx:()=>Er,buildStellarGovernanceCreateHubImmediateTx:()=>Ir,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>yr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>mr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>br,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Sr,buildStellarGovernanceExecuteTx:()=>hr,buildStellarGovernanceExecuteUpdateDelayTx:()=>gr,buildStellarGovernancePauseTx:()=>Pr,buildStellarGovernanceRevokeRoleImmediateTx:()=>Rr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>xr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Ar,buildStellarGrantRoleTx:()=>st,buildStellarLendingIdentifier:()=>Kr,buildStellarLiquidateTx:()=>z,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>nt,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>it,buildStellarProposeAddAssetToSpokeTx:()=>Ht,buildStellarProposeAddSpokeTx:()=>Ft,buildStellarProposeApproveBlendPoolTx:()=>Qt,buildStellarProposeApproveTokenTx:()=>Zt,buildStellarProposeCancellerResetTx:()=>vr,buildStellarProposeConfigureAssetOracleTx:()=>sr,buildStellarProposeCreateHubTx:()=>Wt,buildStellarProposeCreateLiquidityPoolTx:()=>er,buildStellarProposeDeployPoolTx:()=>rr,buildStellarProposeEditAssetInSpokeTx:()=>zt,buildStellarProposeEditOracleToleranceTx:()=>ur,buildStellarProposeGovernanceUpgradeTx:()=>lr,buildStellarProposeGrantGovernanceRoleTx:()=>pr,buildStellarProposeMigrateControllerTx:()=>ir,buildStellarProposeRemoveAssetFromSpokeTx:()=>Vt,buildStellarProposeRemoveSpokeTx:()=>Gt,buildStellarProposeRevokeBlendPoolTx:()=>Jt,buildStellarProposeRevokeGovernanceRoleTx:()=>cr,buildStellarProposeRevokeTokenTx:()=>Yt,buildStellarProposeSetAccumulatorTx:()=>$t,buildStellarProposeSetMinBorrowCollatTx:()=>Kt,buildStellarProposeSetPositionLimitsTx:()=>Nt,buildStellarProposeSetPositionManagerTx:()=>jt,buildStellarProposeSetPriceAggregatorTx:()=>Dt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Xt,buildStellarProposeSetSwapAggregatorTx:()=>Lt,buildStellarProposeTransferCtrlOwnershipTx:()=>ar,buildStellarProposeTransferGovOwnTx:()=>fr,buildStellarProposeUnpauseTx:()=>kr,buildStellarProposeUpdateDelayTx:()=>dr,buildStellarProposeUpgradeControllerTx:()=>nr,buildStellarProposeUpgradePoolParamsTx:()=>tr,buildStellarProposeUpgradePoolTx:()=>or,buildStellarRenewAccountTx:()=>Tt,buildStellarRepayBatchTx:()=>G,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>gt,buildStellarRevokeRoleTx:()=>ut,buildStellarSetAccumulatorTx:()=>ft,buildStellarSetOracleSanityBoundsTx:()=>wt,buildStellarSetOracleToleranceTx:()=>bt,buildStellarSetOracleTx:()=>mt,buildStellarSetPositionLimitsTx:()=>ht,buildStellarSetPriceAggregatorTx:()=>ct,buildStellarSetSpokeAssetFlagsTx:()=>St,buildStellarSetSwapAggregatorTx:()=>pt,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>Y,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>lt,buildStellarUnpauseTx:()=>at,buildStellarUpdateAccountThresholdTx:()=>Rt,buildStellarUpdateIndexesTx:()=>vt,buildStellarUpgradeControllerTx:()=>ot,buildStellarUpgradeLiquidityPoolParamsTx:()=>xt,buildStellarWithdrawBatchTx:()=>W,buildStellarWithdrawTx:()=>F,buildTx:()=>M,burnShares:()=>Cn,computeAccountRisk:()=>Fn,decodeStellarLendingEvent:()=>Xr,decodeStellarLiquidateReturn:()=>V,decodeStellarRouteBytes:()=>lo,decodeStellarSwapEnvelope:()=>So,depositRateRay:()=>Tn,divByIntHalfUp:()=>Qo,encodeAssetOracle:()=>rt,encodeInterestRateModel:()=>ze,encodeMarketParamsRaw:()=>Ve,encodePositionLimits:()=>Xe,encodePriceKey:()=>je,encodeStrategyPayloadToRouteXdr:()=>ho,extractEventOrder:()=>Zr,getStellarAccountPositions:()=>fe,getStellarActiveUsersSeries:()=>Le,getStellarAggregatorQuote:()=>eo,getStellarAsset:()=>le,getStellarAssetGraph:()=>we,getStellarAssetMarkets:()=>ge,getStellarAssetPage:()=>ye,getStellarAssets:()=>ne,getStellarCampaignLeaderboard:()=>Be,getStellarCampaignMe:()=>Ge,getStellarDefiLlamaDimensions:()=>$e,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>oe,getStellarFeeRevenueSeries:()=>Ue,getStellarGovernanceProposals:()=>Ee,getStellarHolderDistribution:()=>qe,getStellarHub:()=>de,getStellarHubGraph:()=>ve,getStellarHubHolders:()=>be,getStellarHubs:()=>ie,getStellarLendingContext:()=>te,getStellarLendingLiveState:()=>re,getStellarLiquidationsLeaderboard:()=>ke,getStellarLiquidationsSeries:()=>Me,getStellarParticipantCounts:()=>Pe,getStellarPnlByScope:()=>Fe,getStellarPositionsLeaderboard:()=>Re,getStellarPositionsPnl:()=>We,getStellarQuoteTokens:()=>to,getStellarRateSpreadSeries:()=>De,getStellarReserve:()=>ue,getStellarReserveGraph:()=>Ae,getStellarReserveHolders:()=>me,getStellarReserves:()=>se,getStellarRevenueSeries:()=>Oe,getStellarSpoke:()=>pe,getStellarSpokeGraph:()=>Te,getStellarSpokeHolders:()=>Se,getStellarSpokes:()=>ae,getStellarStatsHistory:()=>_e,getStellarUserActivity:()=>xe,getStellarUserActivityPage:()=>Ie,getStellarUserHistory:()=>Ne,getStellarUserPositions:()=>ce,getStellarVolumeSeries:()=>Ce,getStellarWalletBalance:()=>he,liveIndexKey:()=>qn,mapQuoteResponseToStrategyPayload:()=>go,mapQuoteResponseToStrategySwap:()=>mo,mapSorobanError:()=>ui,mapStellarPositionActivityType:()=>Qr,maxBorrow:()=>Qn,maxRepay:()=>ti,maxSupply:()=>ei,maxWithdraw:()=>Jn,mintShares:()=>Mn,mulDivCeil:()=>Zo,mulDivFloor:()=>Ko,mulDivHalfUp:()=>Yo,numberToScaled:()=>gn,numberToWad:()=>mn,positionValueWad:()=>pn,prepareStellarBuiltTx:()=>Do,prepareStellarTxXdr:()=>Lo,projectAccountRisk:()=>ni,projectReserveApy:()=>ai,rayAprToApy:()=>xn,rayAprToNumber:()=>An,rayToNumber:()=>hn,rescaleCeil:()=>tn,rescaleFloor:()=>en,rescaleHalfUp:()=>rn,reserveKey:()=>En,resolveReserve:()=>Rn,stellarAuthPolicyForInvocation:()=>Oo,stellarLendingDispatchKey:()=>_r,stellarLendingRead:()=>He,stellarNetworks:()=>n,stellarTokenContractId:()=>po,syntheticEventOrder:()=>Yr,tagStellarInvokedContractError:()=>Co,toBase64Xdr:()=>qr,toBigInt:()=>jo,toStellarPositionMode:()=>$o,unscale:()=>an,unscaleBorrowCeil:()=>un,unscaleHalfUp:()=>ln,unscaleSupplyFloor:()=>sn,utilizationRay:()=>wn,valueBasePosition:()=>Ln,valueScaledPosition:()=>Un,verifyStellarRouteBytes:()=>fo,wadToNumber:()=>fn});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",lendingPool:"CBXRNDQMAJFG4VUKMKFEMFS75UUXE2SPSNV4LEEFCSNBCN66PYRWBKXO",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",lendingPool:"CBSGF6QOQAMPFBEVSYPEQHSZRIHJ6RCGUPCRDMUX36DEKRWFAO2PZB5A",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},n=o;function i(e){return o["testnet"===e?"stellarTestnet":"stellarMainnet"]}const a={mainnet:o.stellarMainnet.passphrase,testnet:o.stellarTestnet.passphrase},s=require("@stellar/stellar-sdk");var u=r(287);const l=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],d={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},p=1e6,c=e=>new s.Address(e).toScVal(),f=e=>new s.ScInt(e).toI128(),h=e=>s.xdr.ScVal.scvU32(e),y=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 s.ScInt("string"==typeof e?e:e.toString()).toU64()},g=e=>s.xdr.ScVal.scvBool(e),m=e=>s.xdr.ScVal.scvString(e),b=e=>s.xdr.ScVal.scvSymbol(e),S=()=>s.xdr.ScVal.scvVoid(),w=e=>s.xdr.ScVal.scvVec(e),v=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=u.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 s.xdr.ScVal.scvBytes(o)},T=(e,t)=>null==e?S():t(e),A=(e,t)=>R({asset:c(t),hub_id:h(e)}),x=(e,t,r)=>s.xdr.ScVal.scvVec([A(e,t),f(r)]),I=e=>s.xdr.ScVal.scvVec(e.map((e=>x(e.hubId,e.asset,e.amount)))),E=e=>{if("Transfer"===e)return w([b("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 w([b("Credit"),y(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},R=e=>{const t=Object.keys(e).sort().map((t=>new s.xdr.ScMapEntry({key:b(t),val:e[t]})));return s.xdr.ScVal.scvMap(t)};class P{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>p)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(d[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>p)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const a=i===p;let s=p;n.forEach(((e,o)=>{r[e]=!0;const i=t[e];let u;if(o+1===n.length&&a)u=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(i.splitPpm*p/s);s-=Math.min(i.splitPpm,s),u=128+this.weight(e)}this.emitPath(i,u)}))}}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 u.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const k=e=>{const t=new P(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,[a,s]=e.preSwapFromA?[n,i]:[i,n];t.emit(d.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(s))}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 R({amounts:s.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:s.xdr.ScVal.scvVec(t.assetList.map((e=>c(e)))),ops:s.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},q=e=>{const t=u.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 s.xdr.ScVal.scvBytes(t)},B=()=>s.xdr.ScVal.scvBytes(u.hp.alloc(0)),_=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 u.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=u.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},O=e=>{if("string"==typeof e)return q(_(e));if(e instanceof Uint8Array)return 0===e.length?B():q(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?q(_(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?q(_(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?q(_(e.bytes)):0===e.bytes.length?B():q(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>p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),s.xdr.ScVal.scvBytes(u.hp.from(k(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},U=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=u.hp.from(t,"hex");return s.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return s.xdr.ScVal.scvBytes(u.hp.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function M(e,t,r){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const o=new s.Contract(e.controllerAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[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 M(e,"supply",[c(e.caller),y(r),C(t.spokeId),I([...t.assets])])}function D(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return M(e,"borrow",[c(e.caller),y(t.accountNonce),I([...t.borrows]),T(t.to,c)])}function N(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return M(e,"withdraw",[c(e.caller),y(t.accountNonce),I([...t.withdrawals]),T(t.to,c)])}function F(e,t){return W(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return M(e,"repay",[c(e.caller),y(t.accountNonce),I([...t.payments])])}function H(e,t){return G(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function z(e,t){return M(e,"liquidate",[c(e.caller),y(t.accountNonce),I([...t.debtPayments]),E(t.seizeMode??"Transfer")])}function V(e){const t=(0,s.scValToNative)(s.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 X(e,t){return M(e,"flash_loan",[c(e.caller),A(t.hubId,t.asset),f(t.amount),c(t.receiver),U(t.data)])}function j(e,t){return M(e,"migrate_from_blend",[c(e.caller),y(t.accountId),C(t.spokeId),h(t.hubId),c(t.blendPool),w(t.collateralTokens.map(c)),w(t.supplyTokens.map(c)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),s.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,s.xdr.ScVal.scvVec([c(t),f(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0;return M(e,"multiply",[c(e.caller),y(r),C(t.spokeId),A(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),h(t.mode),O(t.steps),T(t.initialPayment,(e=>x(e.hubId,e.asset,e.amount))),T(t.convertSwap,O)])}function Z(e,t){return M(e,"swap_debt",[c(e.caller),y(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),O(t.steps)])}function Y(e,t){return M(e,"swap_collateral",[c(e.caller),y(t.accountNonce),A(t.current.hubId,t.current.asset),f(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),O(t.steps)])}function Q(e,t){return M(e,"repay_debt_with_collateral",[c(e.caller),y(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),A(t.debt.hubId,t.debt.asset),O(t.steps),g(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),ae=(e,t)=>e.fetchWithTimeout(`${J}/spokes`,t),se=(e,t={},r)=>e.fetchWithTimeout(`${J}/reserves`,{...r,params:{...t}}),ue=(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),de=(e,t,r)=>e.fetchWithTimeout(`${J}/hubs/${t}`,r),pe=(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),ye=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/page`,{...o,params:{...r}}),ge=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/markets`,{...o,params:{side:r}}),me=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/holders`,{...i,params:{side:n}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/holders`,{...o,params:{side:r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/holders`,{...o,params:{side:r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/graph`,{...o,params:{...r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/graph`,{...o,params:{...r}}),Ae=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/graph`,{...i,params:{...n}}),xe=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity`,{...o,params:{...r}}),Ie=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity/page`,{...o,params:{...r}}),Ee=(e,t={},r)=>e.fetchWithTimeout(`${J}/governance/proposals`,{...r,params:{...t}}),Re=(e,t={},r)=>e.fetchWithTimeout(`${J}/positions`,{...r,params:{...t}}),Pe=(e,t={},r)=>e.fetchWithTimeout(`${J}/participants`,{...r,params:{...t}}),ke=(e,t={},r)=>e.fetchWithTimeout(`${J}/liquidations/leaderboard`,{...r,params:{...t}}),qe=(e,t={},r)=>e.fetchWithTimeout(`${J}/distribution`,{...r,params:{...t}}),Be=(e,t={},r)=>e.fetchWithTimeout(`${J}/campaign/leaderboard`,{...r,params:{...t}}),_e=(e,t,r)=>e.fetchWithTimeout(`${J}/stats/history`,{...r,params:{...t}}),Oe=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue`,{...r,params:{...t}}),Ue=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue/fees`,{...r,params:{...t}}),Me=(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}}),De=(e,t,r)=>e.fetchWithTimeout(`${J}/rate-spread`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${J}/defillama`,{...r,params:{...t}}),Ne=(e,t,r,o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/history`,{...o,params:{...r}}),We=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl`,{...r,params:{accountId:t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl/scope`,{...r,params:{scope:t}}),Ge=(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=>ae(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?se(e,t,r):se(e,{},t),reserve:(t,r,o,n)=>ue(e,t,r,o,n),asset:(t,r)=>le(e,t,r),hub:(t,r)=>de(e,t,r),spoke:(t,r)=>pe(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)=>ye(e,t,r,o),assetMarkets:(t,r,o)=>ge(e,t,r,o),reserveHolders:(t,r,o,n,i)=>me(e,t,r,o,n,i),hubHolders:(t,r,o)=>be(e,t,r,o),spokeHolders:(t,r,o)=>Se(e,t,r,o),assetGraph:(t,r,o)=>we(e,t,r,o),hubGraph:(t,r,o)=>ve(e,t,r,o),spokeGraph:(t,r,o)=>Te(e,t,r,o),reserveGraph:(t,r,o,n,i)=>Ae(e,t,r,o,n,i),userActivity:(t,r={},o)=>xe(e,t,r,o),userActivityPage:(t,r={},o)=>Ie(e,t,r,o),governanceProposals:(t={},r)=>Ee(e,t,r),positionsLeaderboard:(t={},r)=>Re(e,t,r),participants:(t={},r)=>Pe(e,t,r),liquidationsLeaderboard:(t={},r)=>ke(e,t,r),distribution:(t={},r)=>qe(e,t,r),campaignLeaderboard:(t={},r)=>Be(e,t,r),statsHistory:(t,r)=>_e(e,t,r),revenue:(t,r)=>Oe(e,t,r),feeRevenue:(t,r)=>Ue(e,t,r),liquidations:(t,r)=>Me(e,t,r),volume:(t,r)=>Ce(e,t,r),activeUsers:(t,r)=>Le(e,t,r),rateSpread:(t,r)=>De(e,t,r),defillama:(t,r)=>$e(e,t,r),userHistory:(t,r,o)=>Ne(e,t,r,o),positionsPnl:(t,r)=>We(e,t,r),pnlByScope:(t,r)=>Fe(e,t,r),campaignMe:(t,r)=>Ge(e,t,r)}),ze=e=>R({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=>R({asset_decimals:h(e.assetDecimals),asset_id:c(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:g(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)}),Xe=e=>R({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),je=e=>{if("Token"in e&&e.Token)return w([b("Token"),c(e.Token)]);if("Ref"in e&&e.Ref)return w([b("Ref"),b(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Ke=e=>{if("Stellar"in e)return w([b("Stellar"),c(e.Stellar)]);if("Symbol"in e)return w([b("Symbol"),b(e.Symbol)]);if("String"in e)return w([b("String"),m(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ze=e=>{if("Spot"===e)return w([b("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return w([b("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Ye=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Qe=e=>{if("Market"===e||"Fundamental"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Je=e=>{if("Reflector"in e){const t=e.Reflector;return w([b("Reflector"),R({asset:Ke(t.asset),contract:c(t.contract),read_mode:Ze(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([b("MultiFeed"),R({contract:c(t.contract),feed_id:m(t.feedId),kind:Ye(t.kind),nature:Qe(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},et=e=>{const t=e;return R({decimals:h(t.decimals),max_stale_seconds:y(t.maxStaleSeconds),provider:Je(t.provider)})},tt=e=>{if("RequireDisjoint"===e)return w([b("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return w([b("AllowShared"),w(t.map((e=>R({contract:c(e.contract),kind:Ye(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 R({asset_decimals:h(Number(t.assetDecimals)),independence:tt(t.independence),max_price_stale_seconds:y(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:f(String(t.maxSanityPriceWad)),min_sanity_price_wad:f(String(t.minSanityPriceWad)),sources:w(r.map((e=>(e=>{if("Feed"in e)return w([b("Feed"),et(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([b("Scaled"),R({factor:et(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:je(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([b("LpShare"),R({key_a:je(t.keyA),key_b:je(t.keyB),kind:w([b(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:R({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})};function ot(e,t){return M(e,"upgrade",[v(t.wasmHash)])}function nt(e,t){return M(e,"migrate",[h(t.newVersion)])}function it(e){return M(e,"pause",[])}function at(e){return M(e,"unpause",[])}function st(e,t){return M(e,"grant_role",[c(t.account),b(t.role)])}function ut(e,t){return M(e,"revoke_role",[c(t.account),b(t.role)])}function lt(e,t){return M(e,"transfer_ownership",[c(t.newOwner),h(t.liveUntilLedger)])}function dt(e){return M(e,"accept_ownership",[])}function pt(e,t){return M(e,"set_swap_aggregator",[c(t.aggregator)])}function ct(e,t){return M(e,"set_price_aggregator",[c(t.aggregator)])}function ft(e,t){return M(e,"set_accumulator",[c(t.accumulator)])}function ht(e,t){return M(e,"set_position_limits",[Xe(t)])}function yt(e,t){return M(e,"approve_blend_pool",[c(t.pool)])}function gt(e,t){return M(e,"revoke_blend_pool",[c(t.pool)])}function mt(e,t){return M(e,"set_oracle",[je(t.key),rt(t.oracle)])}function bt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return M(e,"set_tolerance",[je(t.key),R({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function St(e,t){return M(e,"set_spoke_asset_flags",[h(t.spokeId),A(t.hubId,t.asset),g(t.paused),g(t.frozen),g(t.noSeize)])}function wt(e,t){return M(e,"set_oracle_sanity_bounds",[c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function vt(e,t){return M(e,"update_indexes",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Tt(e,t){return M(e,"renew_account",[c(e.caller),y(t.accountNonce)])}function At(e,t){return M(e,"create_liquidity_pool",[h(t.hubId),c(t.asset),Ve(t.params)])}function xt(e,t){return M(e,"upgrade_liquidity_pool_params",[A(t.hubId,t.asset),ze(t.params)])}function It(e,t){return M(e,"claim_revenue",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Et(e,t){return M(e,"add_rewards",[c(e.caller),I(t.rewards)])}function Rt(e,t){return M(e,"update_account_threshold",[c(e.caller),g(t.hasRisks),w(t.accountNonces.map((e=>y(e))))])}const Pt="00".repeat(32),kt=e=>{if("string"==typeof e)return v(e);const t=u.hp.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return s.xdr.ScVal.scvBytes(t)},qt=(e,...t)=>w([b(e),...t]),Bt=e=>R({new_owner:c(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),_t=e=>R({asset:c(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:g(e.canBorrow),can_collateral:g(e.canCollateral),frozen:g(e.frozen),hub_id:h(e.hubId),paused:g(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:g(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),Ot=e=>R({account:c(e.account),role:b(e.role)});function Ut(e,t,r){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const o=new s.Contract(e.governanceAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Mt=(e,t,r)=>Ut(e,"propose",[c(e.caller),t,kt(r)]),Ct=(e,t,r)=>Ut(e,"execute_self",[S(),t,kt(r)]);function Lt(e,t,r){return Mt(e,qt("SetSwapAggregator",c(t.aggregator)),r)}function Dt(e,t,r){return Mt(e,qt("SetPriceAggregator",c(t.aggregator)),r)}function $t(e,t,r){return Mt(e,qt("SetAccumulator",c(t.accumulator)),r)}function Nt(e,t,r){return Mt(e,qt("SetPositionLimits",Xe(t)),r)}function Wt(e,t){return Mt(e,qt("CreateHub"),t)}function Ft(e,t){return Mt(e,qt("AddSpoke"),t)}function Gt(e,t,r){return Mt(e,qt("RemoveSpoke",h(t.spokeId)),r)}function Ht(e,t,r){return Mt(e,qt("AddAssetToSpoke",_t(t)),r)}function zt(e,t,r){return Mt(e,qt("EditAssetInSpoke",_t(t)),r)}function Vt(e,t,r){return Mt(e,qt("RemoveAssetFromSpoke",R({hub_asset:A((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function Xt(e,t,r){return Mt(e,qt("SetSpokeLiquidationCurve",R({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 jt(e,t,r){return Mt(e,qt("SetPositionManager",c(t.manager),g(t.isActive)),r)}function Kt(e,t,r){return Mt(e,qt("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function Zt(e,t,r){return Mt(e,qt("ApproveToken",c(t.token)),r)}function Yt(e,t,r){return Mt(e,qt("RevokeToken",c(t.token)),r)}function Qt(e,t,r){return Mt(e,qt("ApproveBlendPool",c(t.pool)),r)}function Jt(e,t,r){return Mt(e,qt("RevokeBlendPool",c(t.pool)),r)}function er(e,t,r){return Mt(e,qt("CreateLiquidityPool",R({asset:c((o=t).asset),hub_id:h(o.hubId),params:Ve(o.params)})),r);var o}function tr(e,t,r){return Mt(e,qt("UpgradeLiquidityPoolParams",R({hub_asset:A((o=t).hubId,o.asset),params:ze(o.params)})),r);var o}function rr(e,t,r){return Mt(e,qt("DeployPool",v(t.wasmHash)),r)}function or(e,t,r){return Mt(e,qt("UpgradePool",v(t.wasmHash)),r)}function nr(e,t,r){return Mt(e,qt("UpgradeController",v(t.wasmHash)),r)}function ir(e,t,r){return Mt(e,qt("MigrateController",h(t.newVersion)),r)}function ar(e,t,r){return Mt(e,qt("TransferCtrlOwnership",Bt(t)),r)}function sr(e,t,r){return Mt(e,qt("ConfigureAssetOracle",R({key:je((o=t).key),oracle:rt(o.oracle)})),r);var o}function ur(e,t,r){return Mt(e,qt("EditOracleTolerance",R({key:je((o=t).key),tolerance:h(o.tolerance)})),r);var o}function lr(e,t,r){return Mt(e,qt("UpgradeGov",v(t.wasmHash)),r)}function dr(e,t,r){return Mt(e,qt("UpdateGovDelay",h(t.newDelay)),r)}function pr(e,t,r){return Mt(e,qt("GrantGovRole",Ot(t)),r)}function cr(e,t,r){return Mt(e,qt("RevokeGovRole",Ot(t)),r)}function fr(e,t,r){return Mt(e,qt("TransferGovOwnership",Bt(t)),r)}function hr(e,t){const r=w(t.argsXdr.map((e=>s.xdr.ScVal.fromXDR(e,"base64")))),o=kt(t.predecessor??Pt);return Ut(e,"execute",[S(),c(t.target),b(t.functionName),r,o,kt(t.salt)])}function yr(e,t,r){return Ct(e,qt("UpgradeGov",v(t.wasmHash)),r)}function gr(e,t,r){return Ct(e,qt("UpdateGovDelay",h(t.newDelay)),r)}function mr(e,t,r){return Ct(e,qt("GrantGovRole",Ot(t)),r)}function br(e,t,r){return Ct(e,qt("RevokeGovRole",Ot(t)),r)}function Sr(e,t,r){return Ct(e,qt("TransferGovOwnership",Bt(t)),r)}const wr=e=>w(e.map(c));function vr(e,t,r){return Ut(e,"propose_canceller_reset",[wr(t.newCancellers),kt(r)])}function Tr(e,t,r){return Ut(e,"execute_canceller_reset",[T(t.executor,c),wr(t.newCancellers),kt(r)])}function Ar(e,t){return Ut(e,"set_spoke_asset_flags",[c(e.caller),h(t.spokeId),A(t.hubId,t.asset),g(t.paused),g(t.frozen),g(t.noSeize)])}function xr(e,t){return Ut(e,"set_oracle_sanity_bounds",[c(e.caller),c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Ir(e){return Ut(e,"create_hub",[c(e.caller)])}function Er(e){return Ut(e,"add_spoke",[c(e.caller)])}function Rr(e,t){return Ut(e,"revoke_role_immediate",[c(t.account),b(t.role)])}function Pr(e){return Ut(e,"pause",[c(e.caller)])}function kr(e,t){return Mt(e,qt("Unpause"),t)}const qr=e=>e.toXDR("base64"),Br=e=>s.xdr.ScVal.fromXDR(e,"base64"),_r=e=>e.map((e=>String((0,s.scValToNative)(Br(e))))).join(":"),Or=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Ur=e=>Number(e),Mr=e=>String(e),Cr=e=>e instanceof Uint8Array?u.hp.from(e).toString("hex"):u.hp.isBuffer(e)?e.toString("hex"):String(e),Lr=["None","Multiply","Long","Short"],Dr=["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"],$r=e=>Array.isArray(e)?e:[],Nr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Dr[Ur(o)]??Or(o)),positionType:t,hubId:Ur(e[1]),asset:Mr(e[2]),scaledAmountRay:Or(e[3]),indexRay:Or(e[4]),amount:Or(e[5]),liquidationThresholdBps:r?void 0:Ur(e[6]),liquidationBonusBps:r?void 0:Ur(e[7]),loanToValueBps:r?void 0:Ur(e[8]),liquidationFeesBps:r?void 0:Ur(e[9])};var o},Wr=e=>{return{owner:Mr(e[0]),spokeId:Ur(e[1]),mode:(t=e[2],Lr[Ur(t)]??"None")};var t},Fr=e=>Array.isArray(e)?e[1]:void 0,Gr=e=>{const t=(r=e,Array.isArray(r)?Mr(r[0]):Mr(r));var r;if("Token"===t)return{Token:Mr(Fr(e))};if("Ref"===t)return{Ref:Mr(Fr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Mr(t.Token)};if(void 0!==t.Ref)return{Ref:Mr(t.Ref)}}return{Token:Mr(e)}},Hr=e=>{const t=e.tolerance??{};return{assetDecimals:Ur(e.asset_decimals),maxPriceStaleSeconds:Ur(e.max_price_stale_seconds),sources:$r(e.sources).map((e=>e)),tolerance:{upperRatio:Ur(t.upper_ratio_bps),lowerRatio:Ur(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Or(e.min_sanity_price_wad),maxSanityPriceWad:Or(e.max_sanity_price_wad)}},zr={"market:create":e=>({topic:"market:create",data:{hubId:Ur(e.hub_id),baseAsset:Mr(e.base_asset),maxBorrowRate:Or(e.max_borrow_rate),baseBorrowRate:Or(e.base_borrow_rate),slope1:Or(e.slope1),slope2:Or(e.slope2),slope3:Or(e.slope3),midUtilization:Or(e.mid_utilization),optimalUtilization:Or(e.optimal_utilization),maxUtilization:Or(e.max_utilization),reserveFactor:Ur(e.reserve_factor),marketAddress:Mr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Mr(e.asset),maxBorrowRateRay:Or(e.max_borrow_rate),baseBorrowRateRay:Or(e.base_borrow_rate),slope1Ray:Or(e.slope1),slope2Ray:Or(e.slope2),slope3Ray:Or(e.slope3),midUtilizationRay:Or(e.mid_utilization),optimalUtilizationRay:Or(e.optimal_utilization),maxUtilizationRay:Or(e.max_utilization),reserveFactorBps:Ur(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:$r(e).map((e=>{return t=$r(e),{hubId:Ur(t[0]),asset:Mr(t[1]),timestamp:Ur(t[2]),supplyIndexRay:Or(t[3]),borrowIndexRay:Or(t[4]),cash:Or(t[5]),suppliedRay:Or(t[6]),borrowedRay:Or(t[7]),revenueRay:Or(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:$r(e).map((e=>{const t=e;return{hubId:Ur(t.hub_id),asset:Mr(t.asset),params:(r=t.params,{maxBorrowRateRay:Or(r.max_borrow_rate),baseBorrowRateRay:Or(r.base_borrow_rate),slope1Ray:Or(r.slope1),slope2Ray:Or(r.slope2),slope3Ray:Or(r.slope3),midUtilizationRay:Or(r.mid_utilization),optimalUtilizationRay:Or(r.optimal_utilization),maxUtilizationRay:Or(r.max_utilization),reserveFactorBps:Ur(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Ur(r.flashloan_fee),assetId:Mr(r.asset_id),assetDecimals:Ur(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=$r(e);return{topic:"position:batch_update",data:{accountId:Or(t[0]),accountAttributes:Wr($r(t[1])),updates:[...$r(t[2]).map((e=>Nr($r(e),"Deposit"))),...$r(t[3]).map((e=>Nr($r(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Ur(e.hub_id),asset:Mr(e.asset),receiver:Mr(e.receiver),caller:Mr(e.caller),amount:Or(e.amount),fee:Or(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Gr(e.key),oracle:Hr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Mr(e.asset),oracle:Hr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Mr(e.liquidator),accountId:Or(e.account_id),repaidUsdWad:Or(e.repaid_usd_wad),bonusBps:Or(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Or(e.account_id),totalBorrowUsdWad:Or(e.total_borrow_usd_wad),totalCollateralUsdWad:Or(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Mr(e.token),amount:Or(e.amount),usdValueWad:Or(e.usd_value_wad),accountId:Or(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Ur(e.hub_id),asset:Mr(e.asset),amount:Or(e.amount),fee:Or(e.fee),amountSent:Or(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Mr(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:Cr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Mr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Mr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Mr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Mr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Cr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Ur(e.max_supply_positions),maxBorrowPositions:Ur(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Or(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Mr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Ur(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Or(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Or(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Ur(t.liquidation_bonus_factor_bps)}}}},Vr=Object.freeze(Object.keys(zr));function Xr(e,t){const r=_r(e),o=zr[r];return o?o((0,s.scValToNative)(Br(t))):null}const jr=1e4;function Kr(e,t){return`${e}-${BigInt(t).toString(10)}`}function Zr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Yr(e,t=0){return e*jr+t}function Qr(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 Jr=(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 eo(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=Jr(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,simulate:e.simulate,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 to(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=Jr(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()}function ro(e,t){const r=e[t];return"function"==typeof r?r.call(e):r}function oo(e){if(!e||"object"!=typeof e)return;const t=e;return"function"==typeof t.switch?t.switch().name:t.type}function no(e){return io(ro(e,"bytes"))}function io(e){const t=e;return u.hp.from("value"in t?t.value:t)}const ao=16384;class so extends Error{code;constructor(e,t){super(`Stellar route verification failed [${e}]: ${t}`),this.name="StellarRouteVerificationError",this.code=e}}const uo=(e,t)=>{throw new so(e,t)};function lo(e){const t=(e=>{const t="string"==typeof e?e:e&&"object"==typeof e&&"routeXdr"in e?e.routeXdr:void 0;if("string"==typeof t&&t.length>2*ao)return uo("OVERSIZED",`encoded route has ${t.length} characters`);try{return no(O(e))}catch(e){return uo("MALFORMED",e instanceof Error?e.message:String(e))}})(e);0===t.length&&uo("MALFORMED","route is empty"),t.length>ao&&uo("OVERSIZED",`route has ${t.length} bytes, above ${ao}`);const r=(e=>{let t;try{t=s.xdr.ScVal.fromXDR(e)}catch(e){return uo("MALFORMED",`payload is not one XDR ScVal: ${e instanceof Error?e.message:String(e)}`)}if("scvMap"!==oo(t))return uo("MALFORMED","payload must be a StrategyPayload map");const r=ro(t,"map")??[];if("amounts,assets,ops"!==r.map((e=>"scvSymbol"===oo(ro(e,"key"))?ro(ro(e,"key"),"sym").toString():"")).join(","))return uo("MALFORMED","payload fields must be exactly amounts, assets, ops");const[o,n,i]=r.map((e=>ro(e,"val")));return"scvVec"!==oo(o)||"scvVec"!==oo(n)||"scvBytes"!==oo(i)?uo("MALFORMED","payload field has the wrong type"):{amounts:ro(o,"vec")??[],assets:ro(n,"vec")??[],ops:no(i)}})(t),o=r.assets.length,n=r.amounts.length;0===o&&uo("MALFORMED","asset registry is empty"),(o>256||n>126)&&uo("OVERSIZED",`registries hold ${o} assets and ${n} amounts`);const i=r.assets.map(((e,t)=>"scvAddress"!==oo(e)?uo("MALFORMED",`assets[${t}] is not an address`):s.Address.fromScAddress(ro(e,"address")).toString())),a=r.amounts.map(((e,t)=>"scvI128"!==oo(e)?uo("MALFORMED",`amounts[${t}] is not an i128`):(0,s.scValToBigInt)(e))),u=r.ops;u.length<10&&uo("MALFORMED","program header is truncated"),u.length>346&&uo("OVERSIZED",`program has ${u.length} bytes, above 346`);const d=e=>{const t=u[e];return void 0===t?uo("MALFORMED",`program byte ${e} is missing`):t},c=d(0);1!==c&&uo("UNSUPPORTED_VERSION",`program version ${c}, expected 1`);const f=d(8),h=d(9);0===f&&uo("INVALID_STRUCTURE","program has no instructions"),(f>48||h>32)&&uo("OVERSIZED",`program declares ${f} instructions and ${h} weights`);const y=10+5*f;u.length!==y+3*h&&uo("MALFORMED","program length does not match its instruction and weight counts");const g=d(1),m=d(2),b=d(3);(g>=o||m>=o||b>=n)&&uo("MALFORMED","header index is outside its registry"),g===m&&uo("INVALID_STRUCTURE","token_in equals token_out");const S=u.readUInt32BE(4),w=[];for(let e=0;e<h;e+=1){const t=u.readUIntBE(y+3*e,3);(0===t||t>p)&&uo("INVALID_STRUCTURE",`split weight ${t} outside 1..=1000000`),w.push(t)}const v=e=>i[e]??uo("MALFORMED",`asset index ${e} is outside the registry`),T=e=>a[e]??uo("MALFORMED",`amount index ${e} is outside the registry`),A=[];let x;for(let e=0;e<f;e+=1){const t=10+5*e,r=d(t),o=d(t+1),i=d(t+2),a=d(t+3),s=d(t+4);let u;if(r>6&&uo("UNKNOWN_OPCODE",`instruction ${e} has opcode ${r}`),0===o)u={kind:"all"};else if(1===o)void 0!==x&&x===a||uo("INVALID_STRUCTURE",`instruction ${e} does not chain onto its predecessor`),u={kind:"prev"};else if(o>=128){const t=w[o-128];void 0===t&&uo("MALFORMED",`instruction ${e} weight index is out of range`),u={kind:"ppm",ppm:t}}else u={kind:"fixed",amount:T(o-2)};const p=v(i);5!==r&&6!==r?(a===s&&uo("INVALID_STRUCTURE",`instruction ${e} swaps a token for itself`),A.push({kind:"swap",venue:l[r],mode:u,pool:p,tokenIn:v(a),tokenOut:v(s)}),x=s):("all"!==u.kind&&uo("MALFORMED",`liquidity instruction ${e} must use mode All`),s>=n&&uo("MALFORMED",`instruction ${e} amount index is out of range`),A.push({kind:5===r?"burn":"mint",pool:p,shareToken:v(a),amountIndex:s}),x=6===r?a:void 0)}const I=T(b);return I<=0n&&uo("MIN_OUT_TOO_LOW",`encoded total_min_out is ${I}`),{version:c,tokenIn:v(g),tokenOut:v(m),totalMinOut:I,referralId:S,assets:i,amounts:a,ops:A,weights:w}}function po(e,t){if(s.StrKey.isValidContract(e))return e;if(!t)return uo("EXPECTATION_MISSING",`token ${e} is not a contract id; pass \`network\` to derive its asset contract`);try{const r=e.indexOf(":");return("XLM"===e||"native"===e?s.Asset.native():new s.Asset(e.slice(0,r),e.slice(r+1))).contractId(a[t])}catch{return uo("MALFORMED",`token id ${e} is not a contract id or a classic asset`)}}const co=(e,t)=>"bigint"==typeof e?e:/^\d+$/.test(e)?BigInt(e):uo("EXPECTATION_MISSING",`${t} must be a base-unit integer string`);function fo(e,t){const r=co(t.minOut,"expected.minOut");r<=0n&&uo("EXPECTATION_MISSING","expected.minOut must be positive");const o=lo(e);if(o.tokenIn!==t.tokenIn&&uo("TOKEN_IN_MISMATCH",`route spends ${o.tokenIn}, expected ${t.tokenIn}`),o.tokenOut!==t.tokenOut&&uo("TOKEN_OUT_MISMATCH",`route delivers ${o.tokenOut}, expected ${t.tokenOut}`),o.totalMinOut<r&&uo("MIN_OUT_TOO_LOW",`route enforces a minimum of ${o.totalMinOut}, below the expected ${r}`),void 0!==t.amountIn){const e=co(t.amountIn,"expected.amountIn");for(const t of o.ops)"swap"===t.kind&&"fixed"===t.mode.kind&&t.tokenIn===o.tokenIn&&t.mode.amount>e&&uo("AMOUNT_IN_EXCEEDED",`a leg spends ${t.mode.amount}, above the input ${e}`)}return o}const ho=e=>k(e).toXDR("base64");function yo(e,t){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const r=new s.Contract(e.routerAddress),o=new s.Account(e.caller,e.sourceSequence),n=O(((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 s.TransactionBuilder(o,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(r.call("execute_strategy",c(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function go(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(bo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(bo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function mo(e,t={}){const r=t.expected??{},o="string"==typeof e.routeXdr&&e.routeXdr.length>0?{routeXdr:e.routeXdr}:go(e,t),n=[e.amountOutMin,r.minOut].filter((e=>void 0!==e)).map((e=>{if("bigint"==typeof e)return e;if("string"!=typeof e||!/^\d+$/.test(e))throw new so("MALFORMED","minimum output must be a base-unit integer string");return BigInt(e)})).reduce(((e,t)=>void 0===e||t>e?t:e),void 0);if(void 0===n)throw new so("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return fo(o,{tokenIn:po(r.tokenIn??e.from,t.network),tokenOut:po(r.tokenOut??e.to,t.network),minOut:n,amountIn:r.amountIn??e.amountIn}),o}const bo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function So(e){try{const{envelopeXdr:t,networkPassphrase:r,routerAddress:o,viewer:n,operationIndex:i}=e;if(!r||!s.StrKey.isValidContract(o)||new s.Address(n).toString()!==n||"string"!=typeof t||t.length>1048576||t.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t)||void 0!==i&&(!Number.isSafeInteger(i)||i<0))return null;const a=s.TransactionBuilder.fromXDR(t,r),u="innerTransaction"in a?a.innerTransaction:a;if(void 0!==i&&i>=u.operations.length)return null;let l=null;for(const[e,t]of u.operations.entries()){if(void 0!==i&&e!==i)continue;if("invokeHostFunction"!==t.type)continue;const r=t.func;if("hostFunctionTypeInvokeContract"!==oo(r))continue;const a=ro(r,"invokeContract");if(s.Address.fromScAddress(ro(a,"contractAddress")).toString()!==o||"execute_strategy"!==ro(a,"functionName").toString())continue;const u=ro(a,"args"),[d,p,c]=u;if(3!==u.length||!d||!p||!c||"scvAddress"!==oo(d)||"scvI128"!==oo(p)||"scvBytes"!==oo(c))return null;if(s.Address.fromScAddress(ro(d,"address")).toString()!==n)continue;const f=(0,s.scValToBigInt)(p);if(f<=0n)return null;const h=lo(no(c));if(h.tokenIn===h.tokenOut||!s.StrKey.isValidContract(h.tokenIn)||!s.StrKey.isValidContract(h.tokenOut))return null;if(l)return null;l={tokenIn:h.tokenIn,tokenOut:h.tokenOut,amountInAtoms:f.toString(),operationIndex:e}}return l}catch{return null}}class wo extends Error{code;offender;constructor(e,t,r){super(`Stellar authorization check failed [${e}]: ${t}${r?` — ${r.contract}.${r.fn}(${r.args.join(", ")})`:""}`),this.name="StellarAuthPolicyError",this.code=e,this.offender=r}}const vo=e=>e&&"scvAddress"===oo(e)?s.Address.fromScAddress(ro(e,"address")).toString():void 0,To=e=>e&&"scvI128"===oo(e)?(0,s.scValToBigInt)(e):void 0,Ao=e=>e&&"scvVec"===oo(e)?ro(e,"vec")??[]:void 0,xo=(e,t)=>{if(!e||"scvMap"!==oo(e))return;const r=(ro(e,"map")??[]).find((e=>"scvSymbol"===oo(ro(e,"key"))&&ro(ro(e,"key"),"sym").toString()===t));return r?ro(r,"val"):void 0},Io=e=>vo(e)??To(e)?.toString()??e.toXDR("base64"),Eo=e=>({contract:s.Address.fromScAddress(ro(e,"contractAddress")).toString(),fn:ro(e,"functionName").toString(),args:ro(e,"args").map(Io)}),Ro=e=>{const t=ro(e,"function");return"sorobanAuthorizedFunctionTypeContractFn"===oo(t)?ro(t,"contractFn"):void 0};function Po(e,t,r){const o=e.filter((e=>{const o=ro(e,"credentials"),n=oo(o);if("sorobanCredentialsAddress"!==n&&"sorobanCredentialsSourceAccount"!==n)throw new wo("MALFORMED_TRANSACTION","unsupported authorization credentials");return("sorobanCredentialsAddress"===n?s.Address.fromScAddress(ro(ro(o,"address"),"address")).toString():r??t.caller)===t.caller}));if(o.length>1)throw new wo("DUPLICATE_ENTRY",`${o.length} authorization entries for ${t.caller}, expected one`);const n=o[0];if(!n)return;const i=Ro(ro(n,"rootInvocation"));if(!i)throw new wo("UNEXPECTED_ROOT","root is not a contract call");const a=Eo(i);if(a.contract!==t.root.contract||a.fn!==t.root.fn)throw new wo("UNEXPECTED_ROOT",`expected ${t.root.contract}.${t.root.fn}`,a);const u=t.transfers.map((()=>0n)),l=(t.calls??[]).map((()=>0));for(const e of ro(ro(n,"rootInvocation"),"subInvocations")){const r=Ro(e);if(!r)throw new wo("UNEXPECTED_CALL","sub-invocation is not a contract call");const o=Eo(r);if(ro(e,"subInvocations").length>0)throw new wo("NESTED_INVOCATION","sub-invocation carries its own sub-invocations",o);const n=(t.calls??[]).findIndex((e=>e.contract===o.contract&&e.fn===o.fn));if(-1!==n){const e=(t.calls??[])[n],i=e.reject(ro(r,"args"));if(i)throw new wo("UNEXPECTED_CALL",i,o);if(l[n]=(l[n]??0)+1,(l[n]??0)>e.maxCount)throw new wo("UNEXPECTED_CALL",`more than ${e.maxCount} calls`,o);continue}if("transfer"!==o.fn||3!==ro(r,"args").length)throw new wo("UNEXPECTED_CALL","only `transfer` is allowed",o);if(!t.transfers.some((e=>e.token===o.contract)))throw new wo("UNEXPECTED_TOKEN","transfer on an unexpected token",o);const[i,a,s]=ro(r,"args");if(vo(i)!==t.caller)throw new wo("UNEXPECTED_SENDER","transfer is not from the caller",o);const d=vo(a),p=t.transfers.findIndex((e=>e.token===o.contract&&e.to===d));if(-1===p)throw new wo("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",o);const c=To(s),f=t.transfers[p],h=(u[p]??0n)+(c??0n);if(void 0===c||c<=0n||h>f.maxAmount)throw new wo("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,o);u[p]=h}}const ko=e=>{throw new wo("MALFORMED_TRANSACTION",e)},qo=(e,t)=>{const r=new Map;for(const t of Ao(e)??ko("payments argument is not a vector")){const[e,o]=Ao(t)??[],n=vo(xo(e,"asset")),i=To(o);if(void 0===n||void 0===i||i<0n)return ko("payment is not a (HubAssetKey, i128) tuple");r.set(n,(r.get(n)??0n)+i)}return[...r].map((([e,r])=>({token:e,to:t,maxAmount:r})))},Bo=new Set([1,3,5]),_o=(e,t,r)=>({contract:e,fn:"submit",maxCount:2,reject:e=>{if(4!==e.length)return"submit must have four arguments";if(vo(e[0])!==t)return"`from` is not the caller";if(vo(e[1])!==r||vo(e[2])!==r)return"`spender` and `to` must be the lending controller";const o=Ao(e[3]);if(!o)return"requests is not a vector";for(const e of o){const t=xo(e,"request_type");if(!t||"scvU32"!==oo(t)||!Bo.has(ro(t,"u32")))return"request is not a withdraw, withdraw-collateral, or repay"}}});function Oo(e,t,r){const{contract:o,fn:n}=Eo(t),i=ro(t,"args"),a={caller:e,root:{contract:o,fn:n},transfers:[]};if(o===r.governance)return a;if(o===r.aggregatorRouter){if("execute_strategy"!==n)return a;const t=To(i[1]);if(vo(i[0])!==e||void 0===t||"scvBytes"!==oo(i[2]))return ko("execute_strategy arguments must be (caller, total_in, swap_xdr)");const r=lo(no(i[2]));return a.transfers=[{token:r.tokenIn,to:o,maxAmount:t}],a}if(o!==r.lendingController)throw new wo("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${o}; pass an explicit policy`);if(vo(i[0])!==e)throw new wo("CALLER_MISMATCH",`${n} is not invoked for ${e}`);switch(n){case"supply":a.transfers=qo(i[3],r.lendingPool);break;case"repay":case"liquidate":a.transfers=qo(i[2],r.lendingPool);break;case"multiply":{const e=i[8];e&&"scvVoid"!==oo(e)&&(a.transfers=qo(s.xdr.ScVal.scvVec([e]),o));break}case"migrate_from_blend":{const t=vo(i[4])??ko("blend_pool is not an address");a.calls=[_o(t,e,o)];break}}return a}const Uo=e=>{let t;try{t=s.xdr.TransactionEnvelope.fromXDR(e,"base64")}catch{return ko("not a transaction envelope")}if("envelopeTypeTx"!==oo(t))return ko("expected a regular (v1) transaction");const r=ro(ro(t,"v1"),"tx"),o=ro(r,"operations")[0];if(!o||1!==ro(r,"operations").length)return ko("expected exactly one operation");const n=ro(o,"body");if("invokeHostFunction"!==oo(n))return ko("operation is not a contract invocation");const i=ro(n,"invokeHostFunctionOp");return"hostFunctionTypeInvokeContract"!==oo(ro(i,"hostFunction"))?ko("host function is not a contract call"):{source:(a=ro(o,"sourceAccount")??ro(r,"sourceAccount"),s.StrKey.encodeEd25519PublicKey(io("keyTypeMuxedEd25519"===oo(a)?ro(ro(a,"med25519"),"ed25519"):ro(a,"ed25519")))),op:i,call:ro(ro(i,"hostFunction"),"invokeContract")};var a};function Mo(e,t){const r=Uo(e);if(void 0!==t.builtXdr&&ro(Uo(t.builtXdr).op,"hostFunction").toXDR("base64")!==ro(r.op,"hostFunction").toXDR("base64"))throw new wo("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Eo(r.call));const o=t.policy??Oo(t.caller,r.call,{...i(t.network),...t.deployment});Po(ro(r.op,"auth"),o,r.source)}function Co(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Lo(e,t,r){const o=r?.instructionLeeway??2e7;if(!Number.isInteger(o)||o<0||o>4294967295)throw new Error("instructionLeeway must be an integer from 0 to 4294967295");const n=s.TransactionBuilder.fromXDR(t,r?.network?a[r.network]:"");try{const t=await e.simulateTransaction(n,{cpuInstructions:o});if(s.rpc.Api.isSimulationError(t))throw new Error(t.error);return s.rpc.assembleTransaction(n,t).build().toXDR()}catch(e){if(r?.invokedContractId)throw Co(r.invokedContractId,e);throw e}}async function Do(e,t,r){return Lo(e,t.xdr,r)}function $o(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 No(e,t){return new Uint8Array(0)}const Wo=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 u.hp.from(t,"hex")};function Fo(e){const t=new s.Account(e.caller,e.sourceSequence),r=new s.Contract(e.forwarderAddress).call("mint_and_forward",s.xdr.ScVal.scvBytes(Wo(e.message)),s.xdr.ScVal.scvBytes(Wo(e.attestation)));return{xdr:new s.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:a[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Go=10n**27n,Ho=10n**18n,zo=10000n,Vo=27,Xo=18;function jo(e,t="value"){let r;if("bigint"==typeof e)r=e;else if("number"==typeof e){if(!Number.isSafeInteger(e))throw new Error(`Stellar math: ${t} must be a safe integer, got ${e}`);r=BigInt(e)}else{const o=e.trim();if(!/^-?\d+$/.test(o))throw new Error(`Stellar math: ${t} must be a decimal integer string, got "${e}"`);r=BigInt(o)}if(r<0n)throw new Error(`Stellar math: ${t} must be non-negative, got ${r}`);return r}function Ko(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return e*t/r}function Zo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");const o=e*t,n=o/r;return o%r===0n?n:n+1n}function Yo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return(e*t+r/2n)/r}function Qo(e,t){if(0n===t)throw new Error("Stellar math: division by zero");const r=e/t;return e%t>=t/2n+t%2n?r+1n:r}const Jo=e=>10n**BigInt(e);function en(e,t,r){return t===r?e:r>t?e*Jo(r-t):e/Jo(t-r)}function tn(e,t,r){if(t===r)return e;if(r>t)return e*Jo(r-t);const o=Jo(t-r),n=e/o;return e%o===0n?n:n+1n}function rn(e,t,r){return t===r?e:r>t?e*Jo(r-t):Qo(e,Jo(t-r))}const on={floor:Ko,ceil:Zo,halfUp:Yo},nn={floor:en,ceil:tn,halfUp:rn};function an(e,t,r,o){return nn[o](on[o](e,t,Go),Vo,r)}function sn(e,t,r){return an(jo(e,"scaledRay"),jo(t,"indexRay"),r,"floor")}function un(e,t,r){return an(jo(e,"scaledRay"),jo(t,"indexRay"),r,"ceil")}function ln(e,t,r){return an(jo(e,"scaledRay"),jo(t,"indexRay"),r,"halfUp")}function dn(e,t){if(t>Vo)throw new Error(`Stellar math: decimals ${t} exceed RAY scale`);return en(e,t,Vo)}function pn(e,t,r,o){const n=on[o](e,t,Go),i=nn[o](n,Vo,Xo);return on[o](i,r,Ho)}function cn(e,t,r,o){const n=nn[o](dn(e,t),Vo,Xo);return on[o](n,r,Ho)}const fn=e=>Number(e)/1e18,hn=e=>Number(e)/1e27,yn=(e,t)=>Number(e)/10**t;function gn(e,t){if(!Number.isFinite(e)||e<=0||e>=1e21)return 0n;const r=e.toFixed(t),[o="0",n=""]=r.split(".");return BigInt(o+n.padEnd(t,"0"))}const mn=e=>gn(e,Xo),bn=(e,t)=>Yo(e,t,Go),Sn=(e,t)=>Yo(e,Go,t);function wn(e,t){return 0n===t?0n:Sn(e,t)}function vn(e,t){const r=e>Go?Go:e,o=jo(t.baseRateRay,"irm.baseRateRay"),n=jo(t.slope1Ray,"irm.slope1Ray"),i=jo(t.slope2Ray,"irm.slope2Ray"),a=jo(t.slope3Ray,"irm.slope3Ray"),s=jo(t.midUtilizationRay,"irm.midUtilizationRay"),u=jo(t.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=jo(t.maxBorrowRateRay,"irm.maxBorrowRateRay");let d;if(r<s)d=o+Sn(bn(r,n),s);else if(r<u){const e=u-s;d=o+n+Sn(bn(r-s,i),e)}else{const e=Go-u;d=o+n+i+(0n===e?0n:Sn(bn(r-u,a),e))}return d>l?l:d}function Tn(e,t,r){return 0n===e||!Number.isInteger(r)||r<0||r>=1e4?0n:Yo(bn(e,t),zo-BigInt(r),zo)}const An=e=>hn(e),xn=e=>Math.expm1(hn(e)),In=5n*Ho,En=(e,t,r)=>`${e}:${t}:${r}`;function Rn(e,t,r,o){const n=Array.isArray(e)?e:void 0,i=n?n.find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o)):e[En(t,r,o)]??Object.values(e).find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o));if(!i)throw new Error(`Stellar math: no reserve for ${En(t,r,o)}`);return i}const Pn=/^0*[1-9]\d*$/,kn=e=>"string"==typeof e&&Pn.test(e)?BigInt(e).toString():null,qn=(e,t)=>`${e}:${t}`;function Bn(e){const t=new Map,r=new Map,o=new Set,n=new Set;for(const i of e?.indexes??[]){const e=qn(i.hubId,i.asset),a=kn(i.supplyIndex),s=kn(i.borrowIndex),u=kn(i.usdPrice),l=t.get(e),d=l&&kn(l.supplyIndex)===a&&kn(l.borrowIndex)===s&&kn(l.usdPrice)===u;null==a||null==s||null==u||l&&!d?o.add(e):l||t.set(e,i);const p=!1===i.valid||!0===i.stale||!0===i.deviation,c=r.get(i.asset);null==u||p||void 0!==c&&c.toString()!==u?n.add(i.asset):void 0===c&&r.set(i.asset,BigInt(u))}for(const e of o)t.delete(e);for(const e of n)r.delete(e);return{indexes:t,prices:r,rejectedIndexKeys:o,rejectedAssets:n}}const _n=(e,t)=>Ko(e,BigInt(t),zo);function On(e,t,r,o){const n="supply"===e.side,i=Math.min(e.entryLtvBps,e.entryLiquidationThresholdBps);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:e.decimals,scaledRay:e.scaledRay.toString(),indexRay:e.indexRay.toString(),usdPriceWad:e.priceWad.toString(),usdPrice:fn(e.priceWad),amountBase:t.toString(),amountShort:yn(t,e.decimals),usdWad:r.toString(),usd:fn(r),gateUsdWad:o.toString(),entryLtvBps:e.entryLtvBps,entryLiquidationThresholdBps:e.entryLiquidationThresholdBps,entryLiquidationBonusBps:e.entryLiquidationBonusBps,entryLiquidationFeesBps:e.entryLiquidationFeesBps,ltvWeightedUsdWad:n?_n(o,i).toString():"0",liquidationWeightedUsdWad:n?_n(o,e.entryLiquidationThresholdBps).toString():"0",liveDataUsed:e.liveDataUsed}}function Un(e){if("supply"===e.side)return On(e,an(e.scaledRay,e.indexRay,e.decimals,"floor"),pn(e.scaledRay,e.indexRay,e.priceWad,"halfUp"),pn(e.scaledRay,e.indexRay,e.priceWad,"floor"));const t=an(e.scaledRay,e.indexRay,e.decimals,"ceil"),r=pn(e.scaledRay,e.indexRay,e.priceWad,"ceil");return On(e,t,r,r)}function Mn(e,t,r,o){const n=dn(t,r);return"supply"===e?Ko(n,Go,o):Zo(n,Go,o)}function Cn(e,t,r,o){const n=dn(t,r);return"supply"===e?Zo(n,Go,o):Ko(n,Go,o)}function Ln(e,t){return Un({...e,scaledRay:Mn(e.side,t,e.decimals,e.indexRay)})}const Dn=(...e)=>{for(const t of e){const e=kn(t);if(null!=e)return BigInt(e)}return Go};function $n(e,t,r,o){const n=jo("supply"===e?t.supplyScaledRay:t.borrowScaledRay,`${e}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(qn(t.hubId,t.asset)),a=o.prices.get(t.asset),s="supply"===e?Dn(i?.supplyIndex,t.liveSupplyIndexRay,r.liveSupplyIndexRay,t.supplyIndexRay):Dn(i?.borrowIndex,t.liveBorrowIndexRay,r.liveBorrowIndexRay,t.borrowIndexRay),u=a??mn(r.usdPrice);return Un({side:e,hubId:t.hubId,asset:t.asset,decimals:r.assetDecimals,scaledRay:n,indexRay:s,priceWad:u,entryLtvBps:t.entryLtvBps,entryLiquidationThresholdBps:t.entryLiquidationThresholdBps,entryLiquidationBonusBps:t.entryLiquidationBonusBps,entryLiquidationFeesBps:t.entryLiquidationFeesBps,liveDataUsed:void 0!==i&&void 0!==a})}const Nn=(e,t)=>e.reduce(((e,r)=>e+BigInt(t(r))),0n);function Wn(e,t,r,o,n){const i=Nn(t,(e=>e.usdWad)),a=Nn(t,(e=>e.ltvWeightedUsdWad)),s=Nn(t,(e=>e.liquidationWeightedUsdWad)),u=Nn(r,(e=>e.usdWad)),l=0n===u?null:Ko(s,Ho,u),d=0n===s?0:Number(u)/Number(s)*100,p=a<o||a<=u?0n:a-u;return{...e,supplies:t,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:fn(i),ltvWeightedCollateralUsdWad:a.toString(),ltvWeightedCollateralUsd:fn(a),liquidationWeightedCollateralUsdWad:s.toString(),liquidationWeightedCollateralUsd:fn(s),totalDebtUsdWad:u.toString(),totalDebtUsd:fn(u),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:fn(l),healthPercent:d,borrowLimitUsdWad:a.toString(),borrowLimitUsd:fn(a),availableBorrowUsdWad:p.toString(),availableBorrowUsd:fn(p),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:fn(o),isLiquidatable:null!==l&&l<Ho,liveDataValid:n}}function Fn(e){const{positions:t,reserves:r,liveState:o}=e,n=t[0];if(!n)throw new Error("Stellar math: computeAccountRisk needs at least one position row");for(const e of t)if(e.accountId!==n.accountId)throw new Error(`Stellar math: computeAccountRisk received mixed account ids (${n.accountId}, ${e.accountId})`);const i=Bn(o),a=[],s=[];for(const e of t){const t=Rn(r,e.spokeId,e.hubId,e.asset),o=$n("supply",e,t,i);o&&a.push(o);const n=$n("borrow",e,t,i);n&&s.push(n)}const u=null!=o?.minBorrowCollateralUsdWad?jo(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):In,l=void 0!==o&&[...a,...s].every((e=>e.liveDataUsed));return Wn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},a,s,u,l)}const Gn=200n,Hn=e=>e.reduce(((e,t)=>t.amount<e.amount?t:e)),zn=e=>e<0n?0n:e,Vn=(e,t,r,o)=>({amountBase:e.amount,amountShort:yn(e.amount,t),isFullClose:r,reason:e.reason,projectedUtilization:o}),Xn=e=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:e,projectedUtilization:null});function jn(e){const t=e.assetDecimals,r=jo(e.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:gn(e.hubPool.suppliedShort,t),borrowedBase:gn(e.hubPool.borrowedShort,t),cashBase:gn(e.availableLiquidityShort,t),spokeSuppliedBase:gn(e.suppliedShort,t),spokeBorrowedBase:gn(e.borrowedShort,t),maxUtilizationRay:r>=Go?null:r}}const Kn=(e,t)=>e<=0n?null:Number(t)/Number(e);function Zn(e,t){if(e<=0n||!t(0n))return 0n;let r=0n,o=e+1n;for(;o-r>1n;){const e=(r+o)/2n;t(e)?r=e:o=e}return r}const Yn=(e,t)=>e.find((e=>e.hubId===t.hubId&&e.asset===t.asset));function Qn(e,t,r){if(t.paused)return Xn("paused");if(t.frozen)return Xn("frozen");if(!t.isBorrowable)return Xn("cap");const o=t.assetDecimals,n=jn(t),i=Yn(e.borrows,t),a=Bn(r).indexes.get(qn(t.hubId,t.asset)),s=i?BigInt(i.indexRay):jo(a?.borrowIndex??t.liveBorrowIndexRay,"borrowIndex"),u=i?BigInt(i.usdPriceWad):function(e,t){return Bn(t).prices.get(e.asset)??mn(e.usdPrice)}(t,r),l=i?BigInt(i.scaledRay):0n,d=BigInt(e.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),p=BigInt(e.ltvWeightedCollateralUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=[];if(p<c)f.push({amount:0n,reason:"minCollateral"});else{const t=p-BigInt(e.totalDebtUsdWad),r=t<=0n||u<=0n?0n:Ko(t,10n**BigInt(o),u),n=e=>d+pn(l+Mn("borrow",e,o,s),s,u,"ceil");f.push({amount:0n===r?0n:Zn(r+16n,(e=>n(e)<=p)),reason:"ltv"})}f.push({amount:zn(jo(t.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=Yo(n.suppliedBase,Gn,zo);f.push({amount:zn(n.cashBase-h),reason:"liquidity"});const y=function(e,t){const r=e.maxUtilizationRay;if(null===r)return null;const o=dn(e.suppliedBase,t);return 0n===o?null:Zn(zn(Ko(e.suppliedBase,r,Go)-e.borrowedBase)+16n,(n=>wn(dn(e.borrowedBase+n,t),o)<=r))}(n,o);null!==y&&f.push({amount:y,reason:"utilizationCap"});const g=Hn(f);return Vn(g,o,!1,Kn(n.suppliedBase,n.borrowedBase+g.amount))}function Jn(e,t,r){if(t.paused)return Xn("paused");const o=Yn(e.supplies,t);if(!o)return Xn(null);const n=o.decimals,i=jn(t),a=BigInt(o.scaledRay),s=BigInt(o.indexRay),u=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),d=an(a,s,n,"halfUp"),p=BigInt(e.totalDebtUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let y=!0;if(p>0n&&f>0n){const t=p>c?p:c,r=c>p?"minCollateral":"healthFactor",i=BigInt(e.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<t){y=!1;const e=t-i,l=Zo(e,zo,f),p=BigInt(o.gateUsdWad)-l,c=p<=0n?0n:Ko(p,10n**BigInt(n),u),g=d>0n?d-1n:0n,m=c+16n>g?g:c+16n,b=e=>{const t=Cn("supply",e,n,s);return Ko(pn(t>=a?0n:a-t,s,u,"floor"),f,zo)};h.push({amount:Zn(m,(t=>b(t)>=e)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const g=function(e,t){const r=e.maxUtilizationRay;if(null===r||0n===e.borrowedBase)return null;if(0n===r)return 0n;const o=Zo(e.borrowedBase,Go,r),n=e.suppliedBase<o?0n:e.suppliedBase-o+16n,i=dn(e.borrowedBase,t);return Zn(n>e.suppliedBase?e.suppliedBase:n,(o=>{const n=dn(e.suppliedBase-o,t);return n>0n&&wn(i,n)<=r}))}(i,n);null!==g&&h.push({amount:g,reason:"utilizationCap"});const m=Hn(h),b=y&&m.amount>=l;return Vn(m,n,b,Kn(i.suppliedBase-m.amount,i.borrowedBase))}function ei(e){if(e.paused)return Xn("paused");if(e.frozen)return Xn("frozen");const t=e.assetDecimals,r=jn(e),o={amount:zn(jo(e.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return Vn(o,t,!1,Kn(r.suppliedBase+o.amount,r.borrowedBase))}function ti(e,t,r){if(t.paused)return Xn("paused");const o=Yn(e.borrows,t);if(!o)return Xn(null);const n=o.decimals,i=jn(t),a=BigInt(o.amountBase),s=void 0===r?null:jo(r,"walletBalance"),u=null!==s&&s<a?{amount:s,reason:"liquidity"}:{amount:a,reason:null};return Vn(u,n,u.amount>=a,Kn(i.suppliedBase,zn(i.borrowedBase-u.amount)))}const ri=(e,t)=>e.hubId===t.hubId&&e.asset===t.asset,oi=e=>{if("bigint"==typeof e)return e;const t=e.trim();if(!/^-?\d+$/.test(t))throw new Error(`Stellar math: delta amountBase must be an integer string, got "${e}"`);return BigInt(t)};function ni(e,t){const r=[...e.supplies],o=[...e.borrows];for(const e of t){const t="supply"===e.side?r:o,n=t.findIndex((t=>ri(t,e))),i=-1===n?void 0:t[n],a=oi(e.amountBase);let s;if(i){const e={side:i.side,hubId:i.hubId,asset:i.asset,decimals:i.decimals,indexRay:BigInt(i.indexRay),priceWad:BigInt(i.usdPriceWad),entryLtvBps:i.entryLtvBps,entryLiquidationThresholdBps:i.entryLiquidationThresholdBps,entryLiquidationBonusBps:i.entryLiquidationBonusBps,entryLiquidationFeesBps:i.entryLiquidationFeesBps,liveDataUsed:i.liveDataUsed},t=BigInt(i.scaledRay);let r;if(a>=0n)r=t+Mn(e.side,a,e.decimals,e.indexRay);else{const o=-a,n=o>=("supply"===e.side?an(t,e.indexRay,e.decimals,"halfUp"):BigInt(i.amountBase))?t:Cn(e.side,o,e.decimals,e.indexRay);r=n>=t?0n:t-n}s=0n===r?null:Un({...e,scaledRay:r})}else s=a<=0n?null:Ln(ii(e),a);-1===n?s&&t.push(s):s?t[n]=s:t.splice(n,1)}return Wn({accountId:e.accountId,owner:e.owner,spokeId:e.spokeId,mode:e.mode},r,o,BigInt(e.minBorrowCollateralUsdWad),e.liveDataValid)}function ii(e){const t=e.reserve;if(!t)throw new Error(`Stellar math: projectAccountRisk needs \`reserve\` for a new ${e.side} position on ${e.hubId}:${e.asset}`);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:t.assetDecimals,indexRay:jo("supply"===e.side?t.liveSupplyIndexRay:t.liveBorrowIndexRay,"reserve live index"),priceWad:mn(t.usdPrice),entryLtvBps:t.collateralFactorBps,entryLiquidationThresholdBps:t.liquidationThresholdBps,entryLiquidationBonusBps:t.liquidationPenaltyBps,entryLiquidationFeesBps:t.liquidationFeesBps,liveDataUsed:!1}}function ai(e,t=0n,r=0n){const o=e.assetDecimals,n=e=>e<0n?0n:e,i=n(gn(e.hubPool.suppliedShort,o)+oi(t)),a=wn(dn(n(gn(e.hubPool.borrowedShort,o)+oi(r)),o),dn(i,o)),s=vn(a,e.irm),u=Tn(a,s,e.irm.reserveFactorBps);return{utilization:hn(a),utilizationRay:a.toString(),borrowAprRay:s.toString(),supplyAprRay:u.toString(),borrowApr:An(s),supplyApr:An(u),borrowApy:xn(s),supplyApy:xn(u)}}const si={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."},14:{name:"AmountMustBePositive",message:"The amount must be greater than zero."},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 ui(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=si[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,{BPS:()=>y.BPS,Chain:()=>a,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>y.DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD,DEFAULT_REQUEST_TIMEOUT_MS:()=>i,LIQUIDATION_BUFFER_BPS:()=>y.LIQUIDATION_BUFFER_BPS,RAY:()=>y.RAY,RAY_DECIMALS:()=>y.RAY_DECIMALS,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>y.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>y.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>y.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>y.STELLAR_NETWORK_PASSPHRASE,STELLAR_ROUTE_MAX_BYTES:()=>y.STELLAR_ROUTE_MAX_BYTES,SYNTHETIC_EVENT_ORDER_STRIDE:()=>y.SYNTHETIC_EVENT_ORDER_STRIDE,StellarAuthPolicyError:()=>y.StellarAuthPolicyError,StellarRouteVerificationError:()=>y.StellarRouteVerificationError,WAD:()=>y.WAD,WAD_DECIMALS:()=>y.WAD_DECIMALS,XOXNOClient:()=>s,aggregateAccountRisk:()=>y.aggregateAccountRisk,annualBorrowRateRay:()=>y.annualBorrowRateRay,assertStellarAuthEntries:()=>y.assertStellarAuthEntries,assertStellarPreparedTxAuth:()=>y.assertStellarPreparedTxAuth,baseToRay:()=>y.baseToRay,baseToShort:()=>y.baseToShort,baseValueWad:()=>y.baseValueWad,buildLiveSnapshot:()=>y.buildLiveSnapshot,buildSameTokenRepaySwapSteps:()=>y.buildSameTokenRepaySwapSteps,buildSdk:()=>S,buildStellarAcceptOwnershipTx:()=>y.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>y.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>y.buildStellarApproveBlendPoolTx,buildStellarBorrowBatchTx:()=>y.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>y.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>y.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>y.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>y.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>y.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>y.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>y.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>y.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>y.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>y.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>y.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>y.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>y.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>y.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>y.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>y.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>y.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>y.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>y.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>y.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>y.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>y.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>y.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>y.buildStellarMigrateTx,buildStellarMultiplyTx:()=>y.buildStellarMultiplyTx,buildStellarPauseTx:()=>y.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>y.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>y.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>y.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>y.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>y.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>y.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeCreateHubTx:()=>y.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>y.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>y.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>y.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>y.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>y.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>y.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>y.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>y.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>y.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>y.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>y.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>y.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>y.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>y.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>y.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>y.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>y.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>y.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>y.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>y.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>y.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>y.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>y.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>y.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>y.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>y.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>y.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>y.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>y.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>y.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>y.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>y.buildStellarRevokeRoleTx,buildStellarSetAccumulatorTx:()=>y.buildStellarSetAccumulatorTx,buildStellarSetOracleSanityBoundsTx:()=>y.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>y.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>y.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>y.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>y.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>y.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>y.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>y.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>y.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>y.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>y.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>y.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>y.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>y.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>y.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>y.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>y.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>y.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>y.buildStellarWithdrawTx,buildTx:()=>y.buildTx,burnShares:()=>y.burnShares,computeAccountRisk:()=>y.computeAccountRisk,decodeStellarLendingEvent:()=>y.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>y.decodeStellarLiquidateReturn,decodeStellarRouteBytes:()=>y.decodeStellarRouteBytes,decodeStellarSwapEnvelope:()=>y.decodeStellarSwapEnvelope,depositRateRay:()=>y.depositRateRay,divByIntHalfUp:()=>y.divByIntHalfUp,encodeAssetOracle:()=>y.encodeAssetOracle,encodeInterestRateModel:()=>y.encodeInterestRateModel,encodeMarketParamsRaw:()=>y.encodeMarketParamsRaw,encodePositionLimits:()=>y.encodePositionLimits,encodePriceKey:()=>y.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>y.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>y.extractEventOrder,getStellarAccountPositions:()=>y.getStellarAccountPositions,getStellarActiveUsersSeries:()=>y.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>y.getStellarAggregatorQuote,getStellarAsset:()=>y.getStellarAsset,getStellarAssetGraph:()=>y.getStellarAssetGraph,getStellarAssetMarkets:()=>y.getStellarAssetMarkets,getStellarAssetPage:()=>y.getStellarAssetPage,getStellarAssets:()=>y.getStellarAssets,getStellarCampaignLeaderboard:()=>y.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>y.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>y.getStellarDefiLlamaDimensions,getStellarDeployment:()=>y.getStellarDeployment,getStellarDetailedMarkets:()=>y.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>y.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>y.getStellarGovernanceProposals,getStellarHolderDistribution:()=>y.getStellarHolderDistribution,getStellarHub:()=>y.getStellarHub,getStellarHubGraph:()=>y.getStellarHubGraph,getStellarHubHolders:()=>y.getStellarHubHolders,getStellarHubs:()=>y.getStellarHubs,getStellarLendingContext:()=>y.getStellarLendingContext,getStellarLendingLiveState:()=>y.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>y.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>y.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>y.getStellarParticipantCounts,getStellarPnlByScope:()=>y.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>y.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>y.getStellarPositionsPnl,getStellarQuoteTokens:()=>y.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>y.getStellarRateSpreadSeries,getStellarReserve:()=>y.getStellarReserve,getStellarReserveGraph:()=>y.getStellarReserveGraph,getStellarReserveHolders:()=>y.getStellarReserveHolders,getStellarReserves:()=>y.getStellarReserves,getStellarRevenueSeries:()=>y.getStellarRevenueSeries,getStellarSpoke:()=>y.getStellarSpoke,getStellarSpokeGraph:()=>y.getStellarSpokeGraph,getStellarSpokeHolders:()=>y.getStellarSpokeHolders,getStellarSpokes:()=>y.getStellarSpokes,getStellarStatsHistory:()=>y.getStellarStatsHistory,getStellarUserActivity:()=>y.getStellarUserActivity,getStellarUserActivityPage:()=>y.getStellarUserActivityPage,getStellarUserHistory:()=>y.getStellarUserHistory,getStellarUserPositions:()=>y.getStellarUserPositions,getStellarVolumeSeries:()=>y.getStellarVolumeSeries,getStellarWalletBalance:()=>y.getStellarWalletBalance,isValidCollectionTicker:()=>u,isValidNftIdentifier:()=>l,liveIndexKey:()=>y.liveIndexKey,mapQuoteResponseToStrategyPayload:()=>y.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>y.mapQuoteResponseToStrategySwap,mapSorobanError:()=>y.mapSorobanError,mapStellarPositionActivityType:()=>y.mapStellarPositionActivityType,maxBorrow:()=>y.maxBorrow,maxRepay:()=>y.maxRepay,maxSupply:()=>y.maxSupply,maxWithdraw:()=>y.maxWithdraw,mintShares:()=>y.mintShares,mulDivCeil:()=>y.mulDivCeil,mulDivFloor:()=>y.mulDivFloor,mulDivHalfUp:()=>y.mulDivHalfUp,numberToScaled:()=>y.numberToScaled,numberToWad:()=>y.numberToWad,positionValueWad:()=>y.positionValueWad,prepareStellarBuiltTx:()=>y.prepareStellarBuiltTx,prepareStellarTxXdr:()=>y.prepareStellarTxXdr,projectAccountRisk:()=>y.projectAccountRisk,projectReserveApy:()=>y.projectReserveApy,rayAprToApy:()=>y.rayAprToApy,rayAprToNumber:()=>y.rayAprToNumber,rayToNumber:()=>y.rayToNumber,rescaleCeil:()=>y.rescaleCeil,rescaleFloor:()=>y.rescaleFloor,rescaleHalfUp:()=>y.rescaleHalfUp,reserveKey:()=>y.reserveKey,resolveReserve:()=>y.resolveReserve,stellarAuthPolicyForInvocation:()=>y.stellarAuthPolicyForInvocation,stellarLendingDispatchKey:()=>y.stellarLendingDispatchKey,stellarLendingRead:()=>y.stellarLendingRead,stellarNetworks:()=>y.stellarNetworks,stellarTokenContractId:()=>y.stellarTokenContractId,syntheticEventOrder:()=>y.syntheticEventOrder,tagStellarInvokedContractError:()=>y.tagStellarInvokedContractError,toBase64Xdr:()=>y.toBase64Xdr,toBigInt:()=>y.toBigInt,toStellarPositionMode:()=>y.toStellarPositionMode,unscale:()=>y.unscale,unscaleBorrowCeil:()=>y.unscaleBorrowCeil,unscaleHalfUp:()=>y.unscaleHalfUp,unscaleSupplyFloor:()=>y.unscaleSupplyFloor,utilizationRay:()=>y.utilizationRay,valueBasePosition:()=>y.valueBasePosition,valueScaledPosition:()=>y.valueScaledPosition,verifyStellarRouteBytes:()=>y.verifyStellarRouteBytes,wadToNumber:()=>y.wadToNumber});const e="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",t="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",n="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",i=3e4;var a;!function(e){e.MAINNET="1",e.DEVNET="D"}(a||(a={}));class s{apiUrl;chain;init;config;constructor(r){if(!r?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:o=a.MAINNET,apiUrl:i,...s}=r;this.apiUrl=i.trim().replace(/\/$/,""),this.chain=o,this.init=s,this.config=o==a.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:a,timeout:s,...u}=this.init,{next:l,cache:d,debug:p,timeout:c,headers:f,method:h="GET",...y}=r,g=f?.Authorization,m="Bearer undefined"===g?void 0:g,b="GET"!==h&&"HEAD"!==h&&"PUT"!==h,S={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...b?{"Content-Type":"application/json"}:{},...m?{Authorization:m}:{}},w=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("&"),v=`${this.apiUrl}${e}${w.length?`?${w}`:""}`,{revalidate:T,...A}=o??{},{revalidate:x,...I}=l??{},E="GET"!==h||m?void 0:x??T,R="GET"!==h||m||E?void 0:d??n,P=y.body,k=c??s??(null==P?i:0),q=k>0?AbortSignal.timeout(k):void 0,B=y.signal??u.signal,_=q&&B?AbortSignal.any([B,q]):q??B,O={...u,...y,method:h,...Object.keys(S).length?{headers:S}:{},..._?{signal:_}:{},cache:R,next:{...A,...I,revalidate:E}};(p??a)&&console.debug("SDK fetch: ",v,O);const U=await fetch(v,O).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${v}: ${e.message}`),{cause:e});throw e})),M=await U.text();if(!U.ok){let e;try{e=JSON.parse(M)}catch{e={message:M}}const t=[v,U.status,U.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(M)}catch{return M}}}const u=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 d extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class p 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 y=r(999);const g=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),m=()=>({static:{},params:{},leaves:[]});function b(e,t,r,o){const{input:n,output:i,...a}=t,s=async(t={})=>{const n={...r,...t},i=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),s=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in s,f=/:collection[^A-Z]/.test(e)||"collection"in s;if(l){const e=n.address;if(!c(e))throw new p(e)}if(f){const e=n.collection;if(Array.isArray(e)?e.some((e=>!u(e))):!u(e))throw new d(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:y,auth:g,method:m,headers:b,cache:S,next:w,debug:v,signal:T,credentials:A,mode:x,redirect:I,referrer:E,referrerPolicy:R,integrity:P,keepalive:k,priority:q,window:B,continuationToken:_,...O}=h,U=g?`Bearer ${g}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==_&&(O.continuationToken=_);const M={...b,...U?{Authorization:U}:{},..._&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(_)}:{}},C={...w,tags:[...w?.tags??[],i]};return o.fetchWithTimeout(i,{method:m,params:O,body:y,headers:M,cache:S,debug:v,...Object.fromEntries(Object.entries({signal:T,credentials:A,mode:x,redirect:I,referrer:E,referrerPolicy:R,integrity:P,keepalive:k,priority:q,window:B}).filter((([,e])=>void 0!==e))),...C?{next:C}:{}})},l=(e={})=>s(e);for(const e of Object.keys(a))h.includes(e)&&(l[e]=t=>s({...t,method:t.method??e.toUpperCase()}));return l}function S(e){const t=function(){const e=m();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=g(e.slice(1));n=n.params[t]||=m()}else{const t=g(e);n=n.static[t]||=m()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,i=Object.keys(t.static).length,a=Object.keys(t.params).length;let s;if(1===n&&i+a>0){const{rawPath:r,def:n}=t.leaves[0];s=b(r,n,o,e)}else{s={};for(const{rawPath:r,def:n}of t.leaves)s[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===s[e]?s[e]=i:"function"==typeof s[e]?Object.assign(s[e],i):"function"==typeof i?(Object.assign(i,s[e]),s[e]=i):Object.assign(s[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(s[e]){const r=s[e];s[e]=e=>({...r(e),...t(e)})}else s[e]=t}return s};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=s(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],u=i[1],l=new n(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),d=0,p=u>0?a-4:a;for(r=0;r<p;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[d++]=t>>16&255,l[d++]=t>>8&255,l[d++]=255&t;return 2===u&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[d++]=255&t),1===u&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t),l},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],a=16383,s=0,l=o-n;s<l;s+=a)i.push(u(e,s,s+a>l?l:s+a));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+/",a=0;a<64;++a)r[a]=i[a],o[i.charCodeAt(a)]=a;function s(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 u(e,t,o){for(var n,i,a=[],s=t;s<o;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.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=u,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(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 p(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"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let o=s(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 u.from(o,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?s(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 u.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 d(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 p(e){return d(e),s(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),r=s(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,u.prototype),o}function h(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(u.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 X(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 q(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function b(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=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:S(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):S(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,o,n){let i,a=1,s=e.length,u=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;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let o=-1;for(i=r;i<s;i++)if(l(e,i)===l(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===u)return o*a}else-1!==o&&(i-=i-o),o=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){let r=!0;for(let o=0;o<u;o++)if(l(e,i+o)!==l(t,o)){r=!1;break}if(r)return i}return-1}function w(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 a;for(o>i/2&&(o=i/2),a=0;a<o;++a){const o=parseInt(t.substr(2*a,2),16);if(Z(o))return a;e[r+a]=o}return a}function v(e,t,r,o){return j(V(t,e.length-r),e,r,o)}function T(e,t,r,o){return j(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 A(e,t,r,o){return j(X(t),e,r,o)}function x(e,t,r,o){return j(function(e,t){let r,o,n;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function I(e,t,r){return 0===t&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,o,s,u;switch(a){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(i=u));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(u=(15&t)<<12|(63&r)<<6|63&o,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=e[n+1],o=e[n+2],s=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=a}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=R));return r}(o)}u.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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return p(e)},u.allocUnsafeSlow=function(e){return p(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.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},u.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}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=u.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?(u.isBuffer(t)||(t=u.from(t)),t.copy(o,n)):Uint8Array.prototype.set.call(o,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},u.byteLength=g,u.prototype._isBuffer=!0,u.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)m(this,t,t+1);return this},u.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)m(this,t,t+3),m(this,t+1,t+2);return this},u.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)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.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&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(e,t,r,o,n){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.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),a=(r>>>=0)-(t>>>=0);const s=Math.min(i,a),l=this.slice(o,n),d=e.slice(t,r);for(let e=0;e<s;++e)if(l[e]!==d[e]){i=l[e],a=d[e];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.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 w(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(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 k(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 q(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+=Y[e[o]];return n}function B(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 _(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 O(e,t,r,o,n,i){if(!u.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 U(e,t,r,o,n){F(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 a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function M(e,t,r,o,n){F(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 a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,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 D(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}u.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,u.prototype),o},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){G(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))})),u.prototype.readBigUInt64BE=Q((function(e){G(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)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(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},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(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},u.prototype.readInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){G(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)})),u.prototype.readBigInt64BE=Q((function(e){G(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)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(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},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(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},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeBigUInt64LE=Q((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=0,i=1,a=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=r-1,i=1,a=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},u.prototype.writeBigInt64LE=Q((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,o){if(!u.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},u.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&&!u.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=u.isBuffer(e)?e:u.from(e,o),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%a]}return this};const $={};function N(e,t,r){$[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 W(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 F(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 $.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(o,n,i)}function G(e,t){if("number"!=typeof e)throw new $.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),N("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=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(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 a=0;a<o;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+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 X(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 j(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 Y=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 Q(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,a,s=8*n-o-1,u=(1<<s)-1,l=u>>1,d=-7,p=r?n-1:0,c=r?-1:1,f=e[t+p];for(p+=c,i=f&(1<<-d)-1,f>>=-d,d+=s;d>0;i=256*i+e[t+p],p+=c,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=o;d>0;a=256*a+e[t+p],p+=c,d-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,o),i-=l}return(f?-1:1)*a*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var a,s,u,l=8*i-n-1,d=(1<<l)-1,p=d>>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?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+p>=1?c/u:c*Math.pow(2,1-p))*u>=2&&(a++,u/=2),a+p>=d?(s=0,a=d):a+p>=1?(s=(t*u-1)*Math.pow(2,n),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&s,f+=h,s/=256,n-=8);for(a=a<<n|s,l+=n;l>0;e[r+f]=255&a,f+=h,a/=256,l-=8);e[r+f-h]|=128*g}},999(e,t,r){"use strict";r.d(t,{BPS:()=>Vo,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>En,LIQUIDATION_BUFFER_BPS:()=>Hn,RAY:()=>Ho,RAY_DECIMALS:()=>Xo,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>kt,STELLAR_LENDING_TOPICS:()=>Xr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>a,STELLAR_ROUTE_MAX_BYTES:()=>so,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Kr,StellarAuthPolicyError:()=>vo,StellarRouteVerificationError:()=>uo,WAD:()=>zo,WAD_DECIMALS:()=>jo,aggregateAccountRisk:()=>Fn,annualBorrowRateRay:()=>Tn,assertStellarAuthEntries:()=>ko,assertStellarPreparedTxAuth:()=>Co,baseToRay:()=>pn,baseToShort:()=>yn,baseValueWad:()=>fn,buildLiveSnapshot:()=>_n,buildSameTokenRepaySwapSteps:()=>Wo,buildStellarAcceptOwnershipTx:()=>pt,buildStellarAddRewardsTx:()=>Rt,buildStellarApproveBlendPoolTx:()=>yt,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>N,buildStellarCctpForwardTx:()=>Go,buildStellarClaimRevenueTx:()=>Et,buildStellarCreateLiquidityPoolTx:()=>xt,buildStellarExecuteCancellerResetTx:()=>Ar,buildStellarExecuteStrategyTx:()=>yo,buildStellarFlashLoanTx:()=>X,buildStellarGovernanceAddSpokeImmediateTx:()=>Rr,buildStellarGovernanceCreateHubImmediateTx:()=>Er,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>yr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>br,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Sr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>wr,buildStellarGovernanceExecuteTx:()=>gr,buildStellarGovernanceExecuteUpdateDelayTx:()=>mr,buildStellarGovernancePauseTx:()=>kr,buildStellarGovernanceRevokeRoleImmediateTx:()=>Pr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Ir,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>xr,buildStellarGrantRoleTx:()=>ut,buildStellarLendingIdentifier:()=>Zr,buildStellarLiquidateTx:()=>z,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>it,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>at,buildStellarProposeAddAssetToSpokeTx:()=>zt,buildStellarProposeAddSpokeTx:()=>Gt,buildStellarProposeApproveBlendPoolTx:()=>Jt,buildStellarProposeApproveTokenTx:()=>Yt,buildStellarProposeCancellerResetTx:()=>Tr,buildStellarProposeConfigureAssetOracleTx:()=>ur,buildStellarProposeCreateHubTx:()=>Ft,buildStellarProposeCreateLiquidityPoolTx:()=>tr,buildStellarProposeDeployPoolTx:()=>or,buildStellarProposeEditAssetInSpokeTx:()=>Vt,buildStellarProposeEditOracleToleranceTx:()=>lr,buildStellarProposeGovernanceUpgradeTx:()=>dr,buildStellarProposeGrantGovernanceRoleTx:()=>cr,buildStellarProposeMigrateControllerTx:()=>ar,buildStellarProposeRemoveAssetFromSpokeTx:()=>Xt,buildStellarProposeRemoveSpokeTx:()=>Ht,buildStellarProposeRevokeBlendPoolTx:()=>er,buildStellarProposeRevokeGovernanceRoleTx:()=>fr,buildStellarProposeRevokeTokenTx:()=>Qt,buildStellarProposeSetAccumulatorTx:()=>Nt,buildStellarProposeSetMinBorrowCollatTx:()=>Zt,buildStellarProposeSetPositionLimitsTx:()=>Wt,buildStellarProposeSetPositionManagerTx:()=>Kt,buildStellarProposeSetPriceAggregatorTx:()=>$t,buildStellarProposeSetSpokeLiquidationCurveTx:()=>jt,buildStellarProposeSetSwapAggregatorTx:()=>Dt,buildStellarProposeTransferCtrlOwnershipTx:()=>sr,buildStellarProposeTransferGovOwnTx:()=>hr,buildStellarProposeUnpauseTx:()=>qr,buildStellarProposeUpdateDelayTx:()=>pr,buildStellarProposeUpgradeControllerTx:()=>ir,buildStellarProposeUpgradePoolParamsTx:()=>rr,buildStellarProposeUpgradePoolTx:()=>nr,buildStellarRenewAccountTx:()=>At,buildStellarRepayBatchTx:()=>G,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>mt,buildStellarRevokeRoleTx:()=>lt,buildStellarSetAccumulatorTx:()=>ht,buildStellarSetOracleSanityBoundsTx:()=>vt,buildStellarSetOracleToleranceTx:()=>St,buildStellarSetOracleTx:()=>bt,buildStellarSetPositionLimitsTx:()=>gt,buildStellarSetPriceAggregatorTx:()=>ft,buildStellarSetSpokeAssetFlagsTx:()=>wt,buildStellarSetSwapAggregatorTx:()=>ct,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>Y,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>dt,buildStellarUnpauseTx:()=>st,buildStellarUpdateAccountThresholdTx:()=>Pt,buildStellarUpdateIndexesTx:()=>Tt,buildStellarUpgradeControllerTx:()=>nt,buildStellarUpgradeLiquidityPoolParamsTx:()=>It,buildStellarWithdrawBatchTx:()=>W,buildStellarWithdrawTx:()=>F,buildTx:()=>M,burnShares:()=>Ln,computeAccountRisk:()=>Gn,createStellarLendingReadClient:()=>ze.createStellarLendingReadClient,decodeStellarLendingEvent:()=>jr,decodeStellarLiquidateReturn:()=>V,decodeStellarRouteBytes:()=>po,decodeStellarSwapEnvelope:()=>wo,depositRateRay:()=>An,divByIntHalfUp:()=>Jo,encodeAssetOracle:()=>ot,encodeInterestRateModel:()=>Ve,encodeMarketParamsRaw:()=>Xe,encodePositionLimits:()=>je,encodePriceKey:()=>Ke,encodeStrategyPayloadToRouteXdr:()=>go,extractEventOrder:()=>Yr,getStellarAccountPositions:()=>fe,getStellarActiveUsersSeries:()=>Le,getStellarAggregatorQuote:()=>to,getStellarAsset:()=>le,getStellarAssetGraph:()=>we,getStellarAssetMarkets:()=>ye,getStellarAssetPage:()=>ge,getStellarAssets:()=>ne,getStellarCampaignLeaderboard:()=>Be,getStellarCampaignMe:()=>Ge,getStellarDefiLlamaDimensions:()=>$e,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>oe,getStellarFeeRevenueSeries:()=>Ue,getStellarGovernanceProposals:()=>Ee,getStellarHolderDistribution:()=>qe,getStellarHub:()=>de,getStellarHubGraph:()=>ve,getStellarHubHolders:()=>be,getStellarHubs:()=>ie,getStellarLendingContext:()=>te,getStellarLendingLiveState:()=>re,getStellarLiquidationsLeaderboard:()=>ke,getStellarLiquidationsSeries:()=>Me,getStellarParticipantCounts:()=>Pe,getStellarPnlByScope:()=>Fe,getStellarPositionsLeaderboard:()=>Re,getStellarPositionsPnl:()=>We,getStellarQuoteTokens:()=>ro,getStellarRateSpreadSeries:()=>De,getStellarReserve:()=>ue,getStellarReserveGraph:()=>Ae,getStellarReserveHolders:()=>me,getStellarReserves:()=>se,getStellarRevenueSeries:()=>Oe,getStellarSpoke:()=>pe,getStellarSpokeGraph:()=>Te,getStellarSpokeHolders:()=>Se,getStellarSpokes:()=>ae,getStellarStatsHistory:()=>_e,getStellarUserActivity:()=>xe,getStellarUserActivityPage:()=>Ie,getStellarUserHistory:()=>Ne,getStellarUserPositions:()=>ce,getStellarVolumeSeries:()=>Ce,getStellarWalletBalance:()=>he,lendingAssetsSchema:()=>ze.lendingAssetsSchema,lendingPositionsSchema:()=>ze.lendingPositionsSchema,liveIndexKey:()=>Bn,mapQuoteResponseToStrategyPayload:()=>mo,mapQuoteResponseToStrategySwap:()=>bo,mapSorobanError:()=>li,mapStellarPositionActivityType:()=>Jr,maxBorrow:()=>Jn,maxRepay:()=>ri,maxSupply:()=>ti,maxWithdraw:()=>ei,mintShares:()=>Cn,mulDivCeil:()=>Yo,mulDivFloor:()=>Zo,mulDivHalfUp:()=>Qo,numberToScaled:()=>mn,numberToWad:()=>bn,positionValueWad:()=>cn,prepareStellarBuiltTx:()=>$o,prepareStellarTxXdr:()=>Do,projectAccountRisk:()=>ii,projectReserveApy:()=>si,rayAprToApy:()=>In,rayAprToNumber:()=>xn,rayToNumber:()=>gn,rescaleCeil:()=>rn,rescaleFloor:()=>tn,rescaleHalfUp:()=>on,reserveKey:()=>Rn,resolveReserve:()=>Pn,stellarAuthPolicyForInvocation:()=>Uo,stellarLendingDispatchKey:()=>Or,stellarLendingRead:()=>He,stellarNetworks:()=>n,stellarTokenContractId:()=>co,syntheticEventOrder:()=>Qr,tagStellarInvokedContractError:()=>Lo,toBase64Xdr:()=>Br,toBigInt:()=>Ko,toStellarPositionMode:()=>No,unscale:()=>sn,unscaleBorrowCeil:()=>ln,unscaleHalfUp:()=>dn,unscaleSupplyFloor:()=>un,utilizationRay:()=>vn,valueBasePosition:()=>Dn,valueScaledPosition:()=>Mn,verifyStellarRouteBytes:()=>ho,wadToNumber:()=>hn});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",lendingPool:"CBXRNDQMAJFG4VUKMKFEMFS75UUXE2SPSNV4LEEFCSNBCN66PYRWBKXO",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",lendingPool:"CBSGF6QOQAMPFBEVSYPEQHSZRIHJ6RCGUPCRDMUX36DEKRWFAO2PZB5A",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},n=o;function i(e){return o["testnet"===e?"stellarTestnet":"stellarMainnet"]}const a={mainnet:o.stellarMainnet.passphrase,testnet:o.stellarTestnet.passphrase},s=require("@stellar/stellar-sdk");var u=r(287);const l=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],d={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},p=1e6,c=e=>new s.Address(e).toScVal(),f=e=>new s.ScInt(e).toI128(),h=e=>s.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 s.ScInt("string"==typeof e?e:e.toString()).toU64()},y=e=>s.xdr.ScVal.scvBool(e),m=e=>s.xdr.ScVal.scvString(e),b=e=>s.xdr.ScVal.scvSymbol(e),S=()=>s.xdr.ScVal.scvVoid(),w=e=>s.xdr.ScVal.scvVec(e),v=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=u.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 s.xdr.ScVal.scvBytes(o)},T=(e,t)=>null==e?S():t(e),A=(e,t)=>R({asset:c(t),hub_id:h(e)}),x=(e,t,r)=>s.xdr.ScVal.scvVec([A(e,t),f(r)]),I=e=>s.xdr.ScVal.scvVec(e.map((e=>x(e.hubId,e.asset,e.amount)))),E=e=>{if("Transfer"===e)return w([b("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 w([b("Credit"),g(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},R=e=>{const t=Object.keys(e).sort().map((t=>new s.xdr.ScMapEntry({key:b(t),val:e[t]})));return s.xdr.ScVal.scvMap(t)};class P{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>p)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(d[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>p)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const a=i===p;let s=p;n.forEach(((e,o)=>{r[e]=!0;const i=t[e];let u;if(o+1===n.length&&a)u=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(i.splitPpm*p/s);s-=Math.min(i.splitPpm,s),u=128+this.weight(e)}this.emitPath(i,u)}))}}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 u.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const k=e=>{const t=new P(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,[a,s]=e.preSwapFromA?[n,i]:[i,n];t.emit(d.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(s))}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 R({amounts:s.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:s.xdr.ScVal.scvVec(t.assetList.map((e=>c(e)))),ops:s.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},q=e=>{const t=u.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 s.xdr.ScVal.scvBytes(t)},B=()=>s.xdr.ScVal.scvBytes(u.hp.alloc(0)),_=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 u.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=u.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},O=e=>{if("string"==typeof e)return q(_(e));if(e instanceof Uint8Array)return 0===e.length?B():q(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?q(_(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?q(_(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?q(_(e.bytes)):0===e.bytes.length?B():q(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>p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),s.xdr.ScVal.scvBytes(u.hp.from(k(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},U=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=u.hp.from(t,"hex");return s.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return s.xdr.ScVal.scvBytes(u.hp.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function M(e,t,r){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const o=new s.Contract(e.controllerAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[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 M(e,"supply",[c(e.caller),g(r),C(t.spokeId),I([...t.assets])])}function D(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return M(e,"borrow",[c(e.caller),g(t.accountNonce),I([...t.borrows]),T(t.to,c)])}function N(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return M(e,"withdraw",[c(e.caller),g(t.accountNonce),I([...t.withdrawals]),T(t.to,c)])}function F(e,t){return W(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return M(e,"repay",[c(e.caller),g(t.accountNonce),I([...t.payments])])}function H(e,t){return G(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function z(e,t){return M(e,"liquidate",[c(e.caller),g(t.accountNonce),I([...t.debtPayments]),E(t.seizeMode??"Transfer")])}function V(e){const t=(0,s.scValToNative)(s.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 X(e,t){return M(e,"flash_loan",[c(e.caller),A(t.hubId,t.asset),f(t.amount),c(t.receiver),U(t.data)])}function j(e,t){return M(e,"migrate_from_blend",[c(e.caller),g(t.accountId),C(t.spokeId),h(t.hubId),c(t.blendPool),w(t.collateralTokens.map(c)),w(t.supplyTokens.map(c)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),s.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,s.xdr.ScVal.scvVec([c(t),f(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0;return M(e,"multiply",[c(e.caller),g(r),C(t.spokeId),A(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),h(t.mode),O(t.steps),T(t.initialPayment,(e=>x(e.hubId,e.asset,e.amount))),T(t.convertSwap,O)])}function Z(e,t){return M(e,"swap_debt",[c(e.caller),g(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),O(t.steps)])}function Y(e,t){return M(e,"swap_collateral",[c(e.caller),g(t.accountNonce),A(t.current.hubId,t.current.asset),f(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),O(t.steps)])}function Q(e,t){return M(e,"repay_debt_with_collateral",[c(e.caller),g(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),A(t.debt.hubId,t.debt.asset),O(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),ae=(e,t)=>e.fetchWithTimeout(`${J}/spokes`,t),se=(e,t={},r)=>e.fetchWithTimeout(`${J}/reserves`,{...r,params:{...t}}),ue=(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),de=(e,t,r)=>e.fetchWithTimeout(`${J}/hubs/${t}`,r),pe=(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}}),me=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/holders`,{...i,params:{side:n}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/holders`,{...o,params:{side:r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/holders`,{...o,params:{side:r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${J}/assets/${ee(t)}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${J}/hubs/${t}/graph`,{...o,params:{...r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${J}/spokes/${t}/graph`,{...o,params:{...r}}),Ae=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${J}/reserves/${t}/${r}/${ee(o)}/graph`,{...i,params:{...n}}),xe=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity`,{...o,params:{...r}}),Ie=(e,t,r={},o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/activity/page`,{...o,params:{...r}}),Ee=(e,t={},r)=>e.fetchWithTimeout(`${J}/governance/proposals`,{...r,params:{...t}}),Re=(e,t={},r)=>e.fetchWithTimeout(`${J}/positions`,{...r,params:{...t}}),Pe=(e,t={},r)=>e.fetchWithTimeout(`${J}/participants`,{...r,params:{...t}}),ke=(e,t={},r)=>e.fetchWithTimeout(`${J}/liquidations/leaderboard`,{...r,params:{...t}}),qe=(e,t={},r)=>e.fetchWithTimeout(`${J}/distribution`,{...r,params:{...t}}),Be=(e,t={},r)=>e.fetchWithTimeout(`${J}/campaign/leaderboard`,{...r,params:{...t}}),_e=(e,t,r)=>e.fetchWithTimeout(`${J}/stats/history`,{...r,params:{...t}}),Oe=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue`,{...r,params:{...t}}),Ue=(e,t,r)=>e.fetchWithTimeout(`${J}/revenue/fees`,{...r,params:{...t}}),Me=(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}}),De=(e,t,r)=>e.fetchWithTimeout(`${J}/rate-spread`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${J}/defillama`,{...r,params:{...t}}),Ne=(e,t,r,o)=>e.fetchWithTimeout(`${J}/users/${ee(t)}/history`,{...o,params:{...r}}),We=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl`,{...r,params:{accountId:t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${J}/pnl/scope`,{...r,params:{scope:t}}),Ge=(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=>ae(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?se(e,t,r):se(e,{},t),reserve:(t,r,o,n)=>ue(e,t,r,o,n),asset:(t,r)=>le(e,t,r),hub:(t,r)=>de(e,t,r),spoke:(t,r)=>pe(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)=>me(e,t,r,o,n,i),hubHolders:(t,r,o)=>be(e,t,r,o),spokeHolders:(t,r,o)=>Se(e,t,r,o),assetGraph:(t,r,o)=>we(e,t,r,o),hubGraph:(t,r,o)=>ve(e,t,r,o),spokeGraph:(t,r,o)=>Te(e,t,r,o),reserveGraph:(t,r,o,n,i)=>Ae(e,t,r,o,n,i),userActivity:(t,r={},o)=>xe(e,t,r,o),userActivityPage:(t,r={},o)=>Ie(e,t,r,o),governanceProposals:(t={},r)=>Ee(e,t,r),positionsLeaderboard:(t={},r)=>Re(e,t,r),participants:(t={},r)=>Pe(e,t,r),liquidationsLeaderboard:(t={},r)=>ke(e,t,r),distribution:(t={},r)=>qe(e,t,r),campaignLeaderboard:(t={},r)=>Be(e,t,r),statsHistory:(t,r)=>_e(e,t,r),revenue:(t,r)=>Oe(e,t,r),feeRevenue:(t,r)=>Ue(e,t,r),liquidations:(t,r)=>Me(e,t,r),volume:(t,r)=>Ce(e,t,r),activeUsers:(t,r)=>Le(e,t,r),rateSpread:(t,r)=>De(e,t,r),defillama:(t,r)=>$e(e,t,r),userHistory:(t,r,o)=>Ne(e,t,r,o),positionsPnl:(t,r)=>We(e,t,r),pnlByScope:(t,r)=>Fe(e,t,r),campaignMe:(t,r)=>Ge(e,t,r)});var ze=r(468);const Ve=e=>R({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)}),Xe=e=>R({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=>R({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),Ke=e=>{if("Token"in e&&e.Token)return w([b("Token"),c(e.Token)]);if("Ref"in e&&e.Ref)return w([b("Ref"),b(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Ze=e=>{if("Stellar"in e)return w([b("Stellar"),c(e.Stellar)]);if("Symbol"in e)return w([b("Symbol"),b(e.Symbol)]);if("String"in e)return w([b("String"),m(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ye=e=>{if("Spot"===e)return w([b("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return w([b("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 w([b(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Je=e=>{if("Market"===e||"Fundamental"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},et=e=>{if("Reflector"in e){const t=e.Reflector;return w([b("Reflector"),R({asset:Ze(t.asset),contract:c(t.contract),read_mode:Ye(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([b("MultiFeed"),R({contract:c(t.contract),feed_id:m(t.feedId),kind:Qe(t.kind),nature:Je(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},tt=e=>{const t=e;return R({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:et(t.provider)})},rt=e=>{if("RequireDisjoint"===e)return w([b("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return w([b("AllowShared"),w(t.map((e=>R({contract:c(e.contract),kind:Qe(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},ot=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 R({asset_decimals:h(Number(t.assetDecimals)),independence:rt(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:w(r.map((e=>(e=>{if("Feed"in e)return w([b("Feed"),tt(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([b("Scaled"),R({factor:tt(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:Ke(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([b("LpShare"),R({key_a:Ke(t.keyA),key_b:Ke(t.keyB),kind:w([b(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:R({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})};function nt(e,t){return M(e,"upgrade",[v(t.wasmHash)])}function it(e,t){return M(e,"migrate",[h(t.newVersion)])}function at(e){return M(e,"pause",[])}function st(e){return M(e,"unpause",[])}function ut(e,t){return M(e,"grant_role",[c(t.account),b(t.role)])}function lt(e,t){return M(e,"revoke_role",[c(t.account),b(t.role)])}function dt(e,t){return M(e,"transfer_ownership",[c(t.newOwner),h(t.liveUntilLedger)])}function pt(e){return M(e,"accept_ownership",[])}function ct(e,t){return M(e,"set_swap_aggregator",[c(t.aggregator)])}function ft(e,t){return M(e,"set_price_aggregator",[c(t.aggregator)])}function ht(e,t){return M(e,"set_accumulator",[c(t.accumulator)])}function gt(e,t){return M(e,"set_position_limits",[je(t)])}function yt(e,t){return M(e,"approve_blend_pool",[c(t.pool)])}function mt(e,t){return M(e,"revoke_blend_pool",[c(t.pool)])}function bt(e,t){return M(e,"set_oracle",[Ke(t.key),ot(t.oracle)])}function St(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return M(e,"set_tolerance",[Ke(t.key),R({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function wt(e,t){return M(e,"set_spoke_asset_flags",[h(t.spokeId),A(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function vt(e,t){return M(e,"set_oracle_sanity_bounds",[c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Tt(e,t){return M(e,"update_indexes",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function At(e,t){return M(e,"renew_account",[c(e.caller),g(t.accountNonce)])}function xt(e,t){return M(e,"create_liquidity_pool",[h(t.hubId),c(t.asset),Xe(t.params)])}function It(e,t){return M(e,"upgrade_liquidity_pool_params",[A(t.hubId,t.asset),Ve(t.params)])}function Et(e,t){return M(e,"claim_revenue",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Rt(e,t){return M(e,"add_rewards",[c(e.caller),I(t.rewards)])}function Pt(e,t){return M(e,"update_account_threshold",[c(e.caller),y(t.hasRisks),w(t.accountNonces.map((e=>g(e))))])}const kt="00".repeat(32),qt=e=>{if("string"==typeof e)return v(e);const t=u.hp.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return s.xdr.ScVal.scvBytes(t)},Bt=(e,...t)=>w([b(e),...t]),_t=e=>R({new_owner:c(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Ot=e=>R({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)}),Ut=e=>R({account:c(e.account),role:b(e.role)});function Mt(e,t,r){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const o=new s.Contract(e.governanceAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Ct=(e,t,r)=>Mt(e,"propose",[c(e.caller),t,qt(r)]),Lt=(e,t,r)=>Mt(e,"execute_self",[S(),t,qt(r)]);function Dt(e,t,r){return Ct(e,Bt("SetSwapAggregator",c(t.aggregator)),r)}function $t(e,t,r){return Ct(e,Bt("SetPriceAggregator",c(t.aggregator)),r)}function Nt(e,t,r){return Ct(e,Bt("SetAccumulator",c(t.accumulator)),r)}function Wt(e,t,r){return Ct(e,Bt("SetPositionLimits",je(t)),r)}function Ft(e,t){return Ct(e,Bt("CreateHub"),t)}function Gt(e,t){return Ct(e,Bt("AddSpoke"),t)}function Ht(e,t,r){return Ct(e,Bt("RemoveSpoke",h(t.spokeId)),r)}function zt(e,t,r){return Ct(e,Bt("AddAssetToSpoke",Ot(t)),r)}function Vt(e,t,r){return Ct(e,Bt("EditAssetInSpoke",Ot(t)),r)}function Xt(e,t,r){return Ct(e,Bt("RemoveAssetFromSpoke",R({hub_asset:A((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function jt(e,t,r){return Ct(e,Bt("SetSpokeLiquidationCurve",R({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 Kt(e,t,r){return Ct(e,Bt("SetPositionManager",c(t.manager),y(t.isActive)),r)}function Zt(e,t,r){return Ct(e,Bt("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function Yt(e,t,r){return Ct(e,Bt("ApproveToken",c(t.token)),r)}function Qt(e,t,r){return Ct(e,Bt("RevokeToken",c(t.token)),r)}function Jt(e,t,r){return Ct(e,Bt("ApproveBlendPool",c(t.pool)),r)}function er(e,t,r){return Ct(e,Bt("RevokeBlendPool",c(t.pool)),r)}function tr(e,t,r){return Ct(e,Bt("CreateLiquidityPool",R({asset:c((o=t).asset),hub_id:h(o.hubId),params:Xe(o.params)})),r);var o}function rr(e,t,r){return Ct(e,Bt("UpgradeLiquidityPoolParams",R({hub_asset:A((o=t).hubId,o.asset),params:Ve(o.params)})),r);var o}function or(e,t,r){return Ct(e,Bt("DeployPool",v(t.wasmHash)),r)}function nr(e,t,r){return Ct(e,Bt("UpgradePool",v(t.wasmHash)),r)}function ir(e,t,r){return Ct(e,Bt("UpgradeController",v(t.wasmHash)),r)}function ar(e,t,r){return Ct(e,Bt("MigrateController",h(t.newVersion)),r)}function sr(e,t,r){return Ct(e,Bt("TransferCtrlOwnership",_t(t)),r)}function ur(e,t,r){return Ct(e,Bt("ConfigureAssetOracle",R({key:Ke((o=t).key),oracle:ot(o.oracle)})),r);var o}function lr(e,t,r){return Ct(e,Bt("EditOracleTolerance",R({key:Ke((o=t).key),tolerance:h(o.tolerance)})),r);var o}function dr(e,t,r){return Ct(e,Bt("UpgradeGov",v(t.wasmHash)),r)}function pr(e,t,r){return Ct(e,Bt("UpdateGovDelay",h(t.newDelay)),r)}function cr(e,t,r){return Ct(e,Bt("GrantGovRole",Ut(t)),r)}function fr(e,t,r){return Ct(e,Bt("RevokeGovRole",Ut(t)),r)}function hr(e,t,r){return Ct(e,Bt("TransferGovOwnership",_t(t)),r)}function gr(e,t){const r=w(t.argsXdr.map((e=>s.xdr.ScVal.fromXDR(e,"base64")))),o=qt(t.predecessor??kt);return Mt(e,"execute",[S(),c(t.target),b(t.functionName),r,o,qt(t.salt)])}function yr(e,t,r){return Lt(e,Bt("UpgradeGov",v(t.wasmHash)),r)}function mr(e,t,r){return Lt(e,Bt("UpdateGovDelay",h(t.newDelay)),r)}function br(e,t,r){return Lt(e,Bt("GrantGovRole",Ut(t)),r)}function Sr(e,t,r){return Lt(e,Bt("RevokeGovRole",Ut(t)),r)}function wr(e,t,r){return Lt(e,Bt("TransferGovOwnership",_t(t)),r)}const vr=e=>w(e.map(c));function Tr(e,t,r){return Mt(e,"propose_canceller_reset",[vr(t.newCancellers),qt(r)])}function Ar(e,t,r){return Mt(e,"execute_canceller_reset",[T(t.executor,c),vr(t.newCancellers),qt(r)])}function xr(e,t){return Mt(e,"set_spoke_asset_flags",[c(e.caller),h(t.spokeId),A(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Ir(e,t){return Mt(e,"set_oracle_sanity_bounds",[c(e.caller),c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Er(e){return Mt(e,"create_hub",[c(e.caller)])}function Rr(e){return Mt(e,"add_spoke",[c(e.caller)])}function Pr(e,t){return Mt(e,"revoke_role_immediate",[c(t.account),b(t.role)])}function kr(e){return Mt(e,"pause",[c(e.caller)])}function qr(e,t){return Ct(e,Bt("Unpause"),t)}const Br=e=>e.toXDR("base64"),_r=e=>s.xdr.ScVal.fromXDR(e,"base64"),Or=e=>e.map((e=>String((0,s.scValToNative)(_r(e))))).join(":"),Ur=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Mr=e=>Number(e),Cr=e=>String(e),Lr=e=>e instanceof Uint8Array?u.hp.from(e).toString("hex"):u.hp.isBuffer(e)?e.toString("hex"):String(e),Dr=["None","Multiply","Long","Short"],$r=["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"],Nr=e=>Array.isArray(e)?e:[],Wr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],$r[Mr(o)]??Ur(o)),positionType:t,hubId:Mr(e[1]),asset:Cr(e[2]),scaledAmountRay:Ur(e[3]),indexRay:Ur(e[4]),amount:Ur(e[5]),liquidationThresholdBps:r?void 0:Mr(e[6]),liquidationBonusBps:r?void 0:Mr(e[7]),loanToValueBps:r?void 0:Mr(e[8]),liquidationFeesBps:r?void 0:Mr(e[9])};var o},Fr=e=>{return{owner:Cr(e[0]),spokeId:Mr(e[1]),mode:(t=e[2],Dr[Mr(t)]??"None")};var t},Gr=e=>Array.isArray(e)?e[1]:void 0,Hr=e=>{const t=(r=e,Array.isArray(r)?Cr(r[0]):Cr(r));var r;if("Token"===t)return{Token:Cr(Gr(e))};if("Ref"===t)return{Ref:Cr(Gr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Cr(t.Token)};if(void 0!==t.Ref)return{Ref:Cr(t.Ref)}}return{Token:Cr(e)}},zr=e=>{const t=e.tolerance??{};return{assetDecimals:Mr(e.asset_decimals),maxPriceStaleSeconds:Mr(e.max_price_stale_seconds),sources:Nr(e.sources).map((e=>e)),tolerance:{upperRatio:Mr(t.upper_ratio_bps),lowerRatio:Mr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Ur(e.min_sanity_price_wad),maxSanityPriceWad:Ur(e.max_sanity_price_wad)}},Vr={"market:create":e=>({topic:"market:create",data:{hubId:Mr(e.hub_id),baseAsset:Cr(e.base_asset),maxBorrowRate:Ur(e.max_borrow_rate),baseBorrowRate:Ur(e.base_borrow_rate),slope1:Ur(e.slope1),slope2:Ur(e.slope2),slope3:Ur(e.slope3),midUtilization:Ur(e.mid_utilization),optimalUtilization:Ur(e.optimal_utilization),maxUtilization:Ur(e.max_utilization),reserveFactor:Mr(e.reserve_factor),marketAddress:Cr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Cr(e.asset),maxBorrowRateRay:Ur(e.max_borrow_rate),baseBorrowRateRay:Ur(e.base_borrow_rate),slope1Ray:Ur(e.slope1),slope2Ray:Ur(e.slope2),slope3Ray:Ur(e.slope3),midUtilizationRay:Ur(e.mid_utilization),optimalUtilizationRay:Ur(e.optimal_utilization),maxUtilizationRay:Ur(e.max_utilization),reserveFactorBps:Mr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Nr(e).map((e=>{return t=Nr(e),{hubId:Mr(t[0]),asset:Cr(t[1]),timestamp:Mr(t[2]),supplyIndexRay:Ur(t[3]),borrowIndexRay:Ur(t[4]),cash:Ur(t[5]),suppliedRay:Ur(t[6]),borrowedRay:Ur(t[7]),revenueRay:Ur(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Nr(e).map((e=>{const t=e;return{hubId:Mr(t.hub_id),asset:Cr(t.asset),params:(r=t.params,{maxBorrowRateRay:Ur(r.max_borrow_rate),baseBorrowRateRay:Ur(r.base_borrow_rate),slope1Ray:Ur(r.slope1),slope2Ray:Ur(r.slope2),slope3Ray:Ur(r.slope3),midUtilizationRay:Ur(r.mid_utilization),optimalUtilizationRay:Ur(r.optimal_utilization),maxUtilizationRay:Ur(r.max_utilization),reserveFactorBps:Mr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Mr(r.flashloan_fee),assetId:Cr(r.asset_id),assetDecimals:Mr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Nr(e);return{topic:"position:batch_update",data:{accountId:Ur(t[0]),accountAttributes:Fr(Nr(t[1])),updates:[...Nr(t[2]).map((e=>Wr(Nr(e),"Deposit"))),...Nr(t[3]).map((e=>Wr(Nr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Mr(e.hub_id),asset:Cr(e.asset),receiver:Cr(e.receiver),caller:Cr(e.caller),amount:Ur(e.amount),fee:Ur(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Hr(e.key),oracle:zr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Cr(e.asset),oracle:zr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Cr(e.liquidator),accountId:Ur(e.account_id),repaidUsdWad:Ur(e.repaid_usd_wad),bonusBps:Ur(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Ur(e.account_id),totalBorrowUsdWad:Ur(e.total_borrow_usd_wad),totalCollateralUsdWad:Ur(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Cr(e.token),amount:Ur(e.amount),usdValueWad:Ur(e.usd_value_wad),accountId:Ur(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Mr(e.hub_id),asset:Cr(e.asset),amount:Ur(e.amount),fee:Ur(e.fee),amountSent:Ur(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Cr(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:Lr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Cr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Cr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Cr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Cr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Lr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Mr(e.max_supply_positions),maxBorrowPositions:Mr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Ur(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Cr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Mr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Ur(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Ur(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Mr(t.liquidation_bonus_factor_bps)}}}},Xr=Object.freeze(Object.keys(Vr));function jr(e,t){const r=Or(e),o=Vr[r];return o?o((0,s.scValToNative)(_r(t))):null}const Kr=1e4;function Zr(e,t){return`${e}-${BigInt(t).toString(10)}`}function Yr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Qr(e,t=0){return e*Kr+t}function Jr(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 eo=(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 to(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=eo(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,simulate:e.simulate,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 ro(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=eo(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()}function oo(e,t){const r=e[t];return"function"==typeof r?r.call(e):r}function no(e){if(!e||"object"!=typeof e)return;const t=e;return"function"==typeof t.switch?t.switch().name:t.type}function io(e){return ao(oo(e,"bytes"))}function ao(e){const t=e;return u.hp.from("value"in t?t.value:t)}const so=16384;class uo extends Error{code;constructor(e,t){super(`Stellar route verification failed [${e}]: ${t}`),this.name="StellarRouteVerificationError",this.code=e}}const lo=(e,t)=>{throw new uo(e,t)};function po(e){const t=(e=>{const t="string"==typeof e?e:e&&"object"==typeof e&&"routeXdr"in e?e.routeXdr:void 0;if("string"==typeof t&&t.length>2*so)return lo("OVERSIZED",`encoded route has ${t.length} characters`);try{return io(O(e))}catch(e){return lo("MALFORMED",e instanceof Error?e.message:String(e))}})(e);0===t.length&&lo("MALFORMED","route is empty"),t.length>so&&lo("OVERSIZED",`route has ${t.length} bytes, above ${so}`);const r=(e=>{let t;try{t=s.xdr.ScVal.fromXDR(e)}catch(e){return lo("MALFORMED",`payload is not one XDR ScVal: ${e instanceof Error?e.message:String(e)}`)}if("scvMap"!==no(t))return lo("MALFORMED","payload must be a StrategyPayload map");const r=oo(t,"map")??[];if("amounts,assets,ops"!==r.map((e=>"scvSymbol"===no(oo(e,"key"))?oo(oo(e,"key"),"sym").toString():"")).join(","))return lo("MALFORMED","payload fields must be exactly amounts, assets, ops");const[o,n,i]=r.map((e=>oo(e,"val")));return"scvVec"!==no(o)||"scvVec"!==no(n)||"scvBytes"!==no(i)?lo("MALFORMED","payload field has the wrong type"):{amounts:oo(o,"vec")??[],assets:oo(n,"vec")??[],ops:io(i)}})(t),o=r.assets.length,n=r.amounts.length;0===o&&lo("MALFORMED","asset registry is empty"),(o>256||n>126)&&lo("OVERSIZED",`registries hold ${o} assets and ${n} amounts`);const i=r.assets.map(((e,t)=>"scvAddress"!==no(e)?lo("MALFORMED",`assets[${t}] is not an address`):s.Address.fromScAddress(oo(e,"address")).toString())),a=r.amounts.map(((e,t)=>"scvI128"!==no(e)?lo("MALFORMED",`amounts[${t}] is not an i128`):(0,s.scValToBigInt)(e))),u=r.ops;u.length<10&&lo("MALFORMED","program header is truncated"),u.length>346&&lo("OVERSIZED",`program has ${u.length} bytes, above 346`);const d=e=>{const t=u[e];return void 0===t?lo("MALFORMED",`program byte ${e} is missing`):t},c=d(0);1!==c&&lo("UNSUPPORTED_VERSION",`program version ${c}, expected 1`);const f=d(8),h=d(9);0===f&&lo("INVALID_STRUCTURE","program has no instructions"),(f>48||h>32)&&lo("OVERSIZED",`program declares ${f} instructions and ${h} weights`);const g=10+5*f;u.length!==g+3*h&&lo("MALFORMED","program length does not match its instruction and weight counts");const y=d(1),m=d(2),b=d(3);(y>=o||m>=o||b>=n)&&lo("MALFORMED","header index is outside its registry"),y===m&&lo("INVALID_STRUCTURE","token_in equals token_out");const S=u.readUInt32BE(4),w=[];for(let e=0;e<h;e+=1){const t=u.readUIntBE(g+3*e,3);(0===t||t>p)&&lo("INVALID_STRUCTURE",`split weight ${t} outside 1..=1000000`),w.push(t)}const v=e=>i[e]??lo("MALFORMED",`asset index ${e} is outside the registry`),T=e=>a[e]??lo("MALFORMED",`amount index ${e} is outside the registry`),A=[];let x;for(let e=0;e<f;e+=1){const t=10+5*e,r=d(t),o=d(t+1),i=d(t+2),a=d(t+3),s=d(t+4);let u;if(r>6&&lo("UNKNOWN_OPCODE",`instruction ${e} has opcode ${r}`),0===o)u={kind:"all"};else if(1===o)void 0!==x&&x===a||lo("INVALID_STRUCTURE",`instruction ${e} does not chain onto its predecessor`),u={kind:"prev"};else if(o>=128){const t=w[o-128];void 0===t&&lo("MALFORMED",`instruction ${e} weight index is out of range`),u={kind:"ppm",ppm:t}}else u={kind:"fixed",amount:T(o-2)};const p=v(i);5!==r&&6!==r?(a===s&&lo("INVALID_STRUCTURE",`instruction ${e} swaps a token for itself`),A.push({kind:"swap",venue:l[r],mode:u,pool:p,tokenIn:v(a),tokenOut:v(s)}),x=s):("all"!==u.kind&&lo("MALFORMED",`liquidity instruction ${e} must use mode All`),s>=n&&lo("MALFORMED",`instruction ${e} amount index is out of range`),A.push({kind:5===r?"burn":"mint",pool:p,shareToken:v(a),amountIndex:s}),x=6===r?a:void 0)}const I=T(b);return I<=0n&&lo("MIN_OUT_TOO_LOW",`encoded total_min_out is ${I}`),{version:c,tokenIn:v(y),tokenOut:v(m),totalMinOut:I,referralId:S,assets:i,amounts:a,ops:A,weights:w}}function co(e,t){if(s.StrKey.isValidContract(e))return e;if(!t)return lo("EXPECTATION_MISSING",`token ${e} is not a contract id; pass \`network\` to derive its asset contract`);try{const r=e.indexOf(":");return("XLM"===e||"native"===e?s.Asset.native():new s.Asset(e.slice(0,r),e.slice(r+1))).contractId(a[t])}catch{return lo("MALFORMED",`token id ${e} is not a contract id or a classic asset`)}}const fo=(e,t)=>"bigint"==typeof e?e:/^\d+$/.test(e)?BigInt(e):lo("EXPECTATION_MISSING",`${t} must be a base-unit integer string`);function ho(e,t){const r=fo(t.minOut,"expected.minOut");r<=0n&&lo("EXPECTATION_MISSING","expected.minOut must be positive");const o=po(e);if(o.tokenIn!==t.tokenIn&&lo("TOKEN_IN_MISMATCH",`route spends ${o.tokenIn}, expected ${t.tokenIn}`),o.tokenOut!==t.tokenOut&&lo("TOKEN_OUT_MISMATCH",`route delivers ${o.tokenOut}, expected ${t.tokenOut}`),o.totalMinOut<r&&lo("MIN_OUT_TOO_LOW",`route enforces a minimum of ${o.totalMinOut}, below the expected ${r}`),void 0!==t.amountIn){const e=fo(t.amountIn,"expected.amountIn");for(const t of o.ops)"swap"===t.kind&&"fixed"===t.mode.kind&&t.tokenIn===o.tokenIn&&t.mode.amount>e&&lo("AMOUNT_IN_EXCEEDED",`a leg spends ${t.mode.amount}, above the input ${e}`)}return o}const go=e=>k(e).toXDR("base64");function yo(e,t){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const r=new s.Contract(e.routerAddress),o=new s.Account(e.caller,e.sourceSequence),n=O(((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 s.TransactionBuilder(o,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(r.call("execute_strategy",c(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function mo(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(So),splitPpm:e.splitPpm}))):[{hops:e.hops.map(So),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function bo(e,t={}){const r=t.expected??{},o="string"==typeof e.routeXdr&&e.routeXdr.length>0?{routeXdr:e.routeXdr}:mo(e,t),n=[e.amountOutMin,r.minOut].filter((e=>void 0!==e)).map((e=>{if("bigint"==typeof e)return e;if("string"!=typeof e||!/^\d+$/.test(e))throw new uo("MALFORMED","minimum output must be a base-unit integer string");return BigInt(e)})).reduce(((e,t)=>void 0===e||t>e?t:e),void 0);if(void 0===n)throw new uo("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return ho(o,{tokenIn:co(r.tokenIn??e.from,t.network),tokenOut:co(r.tokenOut??e.to,t.network),minOut:n,amountIn:r.amountIn??e.amountIn}),o}const So=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function wo(e){try{const{envelopeXdr:t,networkPassphrase:r,routerAddress:o,viewer:n,operationIndex:i}=e;if(!r||!s.StrKey.isValidContract(o)||new s.Address(n).toString()!==n||"string"!=typeof t||t.length>1048576||t.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t)||void 0!==i&&(!Number.isSafeInteger(i)||i<0))return null;const a=s.TransactionBuilder.fromXDR(t,r),u="innerTransaction"in a?a.innerTransaction:a;if(void 0!==i&&i>=u.operations.length)return null;let l=null;for(const[e,t]of u.operations.entries()){if(void 0!==i&&e!==i)continue;if("invokeHostFunction"!==t.type)continue;const r=t.func;if("hostFunctionTypeInvokeContract"!==no(r))continue;const a=oo(r,"invokeContract");if(s.Address.fromScAddress(oo(a,"contractAddress")).toString()!==o||"execute_strategy"!==oo(a,"functionName").toString())continue;const u=oo(a,"args"),[d,p,c]=u;if(3!==u.length||!d||!p||!c||"scvAddress"!==no(d)||"scvI128"!==no(p)||"scvBytes"!==no(c))return null;if(s.Address.fromScAddress(oo(d,"address")).toString()!==n)continue;const f=(0,s.scValToBigInt)(p);if(f<=0n)return null;const h=po(io(c));if(h.tokenIn===h.tokenOut||!s.StrKey.isValidContract(h.tokenIn)||!s.StrKey.isValidContract(h.tokenOut))return null;if(l)return null;l={tokenIn:h.tokenIn,tokenOut:h.tokenOut,amountInAtoms:f.toString(),operationIndex:e}}return l}catch{return null}}class vo extends Error{code;offender;constructor(e,t,r){super(`Stellar authorization check failed [${e}]: ${t}${r?` — ${r.contract}.${r.fn}(${r.args.join(", ")})`:""}`),this.name="StellarAuthPolicyError",this.code=e,this.offender=r}}const To=e=>e&&"scvAddress"===no(e)?s.Address.fromScAddress(oo(e,"address")).toString():void 0,Ao=e=>e&&"scvI128"===no(e)?(0,s.scValToBigInt)(e):void 0,xo=e=>e&&"scvVec"===no(e)?oo(e,"vec")??[]:void 0,Io=(e,t)=>{if(!e||"scvMap"!==no(e))return;const r=(oo(e,"map")??[]).find((e=>"scvSymbol"===no(oo(e,"key"))&&oo(oo(e,"key"),"sym").toString()===t));return r?oo(r,"val"):void 0},Eo=e=>To(e)??Ao(e)?.toString()??e.toXDR("base64"),Ro=e=>({contract:s.Address.fromScAddress(oo(e,"contractAddress")).toString(),fn:oo(e,"functionName").toString(),args:oo(e,"args").map(Eo)}),Po=e=>{const t=oo(e,"function");return"sorobanAuthorizedFunctionTypeContractFn"===no(t)?oo(t,"contractFn"):void 0};function ko(e,t,r){const o=e.filter((e=>{const o=oo(e,"credentials"),n=no(o);if("sorobanCredentialsAddress"!==n&&"sorobanCredentialsSourceAccount"!==n)throw new vo("MALFORMED_TRANSACTION","unsupported authorization credentials");return("sorobanCredentialsAddress"===n?s.Address.fromScAddress(oo(oo(o,"address"),"address")).toString():r??t.caller)===t.caller}));if(o.length>1)throw new vo("DUPLICATE_ENTRY",`${o.length} authorization entries for ${t.caller}, expected one`);const n=o[0];if(!n)return;const i=Po(oo(n,"rootInvocation"));if(!i)throw new vo("UNEXPECTED_ROOT","root is not a contract call");const a=Ro(i);if(a.contract!==t.root.contract||a.fn!==t.root.fn)throw new vo("UNEXPECTED_ROOT",`expected ${t.root.contract}.${t.root.fn}`,a);const u=t.transfers.map((()=>0n)),l=(t.calls??[]).map((()=>0));for(const e of oo(oo(n,"rootInvocation"),"subInvocations")){const r=Po(e);if(!r)throw new vo("UNEXPECTED_CALL","sub-invocation is not a contract call");const o=Ro(r);if(oo(e,"subInvocations").length>0)throw new vo("NESTED_INVOCATION","sub-invocation carries its own sub-invocations",o);const n=(t.calls??[]).findIndex((e=>e.contract===o.contract&&e.fn===o.fn));if(-1!==n){const e=(t.calls??[])[n],i=e.reject(oo(r,"args"));if(i)throw new vo("UNEXPECTED_CALL",i,o);if(l[n]=(l[n]??0)+1,(l[n]??0)>e.maxCount)throw new vo("UNEXPECTED_CALL",`more than ${e.maxCount} calls`,o);continue}if("transfer"!==o.fn||3!==oo(r,"args").length)throw new vo("UNEXPECTED_CALL","only `transfer` is allowed",o);if(!t.transfers.some((e=>e.token===o.contract)))throw new vo("UNEXPECTED_TOKEN","transfer on an unexpected token",o);const[i,a,s]=oo(r,"args");if(To(i)!==t.caller)throw new vo("UNEXPECTED_SENDER","transfer is not from the caller",o);const d=To(a),p=t.transfers.findIndex((e=>e.token===o.contract&&e.to===d));if(-1===p)throw new vo("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",o);const c=Ao(s),f=t.transfers[p],h=(u[p]??0n)+(c??0n);if(void 0===c||c<=0n||h>f.maxAmount)throw new vo("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,o);u[p]=h}}const qo=e=>{throw new vo("MALFORMED_TRANSACTION",e)},Bo=(e,t)=>{const r=new Map;for(const t of xo(e)??qo("payments argument is not a vector")){const[e,o]=xo(t)??[],n=To(Io(e,"asset")),i=Ao(o);if(void 0===n||void 0===i||i<0n)return qo("payment is not a (HubAssetKey, i128) tuple");r.set(n,(r.get(n)??0n)+i)}return[...r].map((([e,r])=>({token:e,to:t,maxAmount:r})))},_o=new Set([1,3,5]),Oo=(e,t,r)=>({contract:e,fn:"submit",maxCount:2,reject:e=>{if(4!==e.length)return"submit must have four arguments";if(To(e[0])!==t)return"`from` is not the caller";if(To(e[1])!==r||To(e[2])!==r)return"`spender` and `to` must be the lending controller";const o=xo(e[3]);if(!o)return"requests is not a vector";for(const e of o){const t=Io(e,"request_type");if(!t||"scvU32"!==no(t)||!_o.has(oo(t,"u32")))return"request is not a withdraw, withdraw-collateral, or repay"}}});function Uo(e,t,r){const{contract:o,fn:n}=Ro(t),i=oo(t,"args"),a={caller:e,root:{contract:o,fn:n},transfers:[]};if(o===r.governance)return a;if(o===r.aggregatorRouter){if("execute_strategy"!==n)return a;const t=Ao(i[1]);if(To(i[0])!==e||void 0===t||"scvBytes"!==no(i[2]))return qo("execute_strategy arguments must be (caller, total_in, swap_xdr)");const r=po(io(i[2]));return a.transfers=[{token:r.tokenIn,to:o,maxAmount:t}],a}if(o!==r.lendingController)throw new vo("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${o}; pass an explicit policy`);if(To(i[0])!==e)throw new vo("CALLER_MISMATCH",`${n} is not invoked for ${e}`);switch(n){case"supply":a.transfers=Bo(i[3],r.lendingPool);break;case"repay":case"liquidate":a.transfers=Bo(i[2],r.lendingPool);break;case"multiply":{const e=i[8];e&&"scvVoid"!==no(e)&&(a.transfers=Bo(s.xdr.ScVal.scvVec([e]),o));break}case"migrate_from_blend":{const t=To(i[4])??qo("blend_pool is not an address");a.calls=[Oo(t,e,o)];break}}return a}const Mo=e=>{let t;try{t=s.xdr.TransactionEnvelope.fromXDR(e,"base64")}catch{return qo("not a transaction envelope")}if("envelopeTypeTx"!==no(t))return qo("expected a regular (v1) transaction");const r=oo(oo(t,"v1"),"tx"),o=oo(r,"operations")[0];if(!o||1!==oo(r,"operations").length)return qo("expected exactly one operation");const n=oo(o,"body");if("invokeHostFunction"!==no(n))return qo("operation is not a contract invocation");const i=oo(n,"invokeHostFunctionOp");return"hostFunctionTypeInvokeContract"!==no(oo(i,"hostFunction"))?qo("host function is not a contract call"):{source:(a=oo(o,"sourceAccount")??oo(r,"sourceAccount"),s.StrKey.encodeEd25519PublicKey(ao("keyTypeMuxedEd25519"===no(a)?oo(oo(a,"med25519"),"ed25519"):oo(a,"ed25519")))),op:i,call:oo(oo(i,"hostFunction"),"invokeContract")};var a};function Co(e,t){const r=Mo(e);if(void 0!==t.builtXdr&&oo(Mo(t.builtXdr).op,"hostFunction").toXDR("base64")!==oo(r.op,"hostFunction").toXDR("base64"))throw new vo("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Ro(r.call));const o=t.policy??Uo(t.caller,r.call,{...i(t.network),...t.deployment});ko(oo(r.op,"auth"),o,r.source)}function Lo(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Do(e,t,r){const o=r?.instructionLeeway??2e7;if(!Number.isInteger(o)||o<0||o>4294967295)throw new Error("instructionLeeway must be an integer from 0 to 4294967295");const n=s.TransactionBuilder.fromXDR(t,r?.network?a[r.network]:"");try{const t=await e.simulateTransaction(n,{cpuInstructions:o});if(s.rpc.Api.isSimulationError(t))throw new Error(t.error);return s.rpc.assembleTransaction(n,t).build().toXDR()}catch(e){if(r?.invokedContractId)throw Lo(r.invokedContractId,e);throw e}}async function $o(e,t,r){return Do(e,t.xdr,r)}function No(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 Fo=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 u.hp.from(t,"hex")};function Go(e){const t=new s.Account(e.caller,e.sourceSequence),r=new s.Contract(e.forwarderAddress).call("mint_and_forward",s.xdr.ScVal.scvBytes(Fo(e.message)),s.xdr.ScVal.scvBytes(Fo(e.attestation)));return{xdr:new s.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:a[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ho=10n**27n,zo=10n**18n,Vo=10000n,Xo=27,jo=18;function Ko(e,t="value"){let r;if("bigint"==typeof e)r=e;else if("number"==typeof e){if(!Number.isSafeInteger(e))throw new Error(`Stellar math: ${t} must be a safe integer, got ${e}`);r=BigInt(e)}else{const o=e.trim();if(!/^-?\d+$/.test(o))throw new Error(`Stellar math: ${t} must be a decimal integer string, got "${e}"`);r=BigInt(o)}if(r<0n)throw new Error(`Stellar math: ${t} must be non-negative, got ${r}`);return r}function Zo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return e*t/r}function Yo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");const o=e*t,n=o/r;return o%r===0n?n:n+1n}function Qo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return(e*t+r/2n)/r}function Jo(e,t){if(0n===t)throw new Error("Stellar math: division by zero");const r=e/t;return e%t>=t/2n+t%2n?r+1n:r}const en=e=>10n**BigInt(e);function tn(e,t,r){return t===r?e:r>t?e*en(r-t):e/en(t-r)}function rn(e,t,r){if(t===r)return e;if(r>t)return e*en(r-t);const o=en(t-r),n=e/o;return e%o===0n?n:n+1n}function on(e,t,r){return t===r?e:r>t?e*en(r-t):Jo(e,en(t-r))}const nn={floor:Zo,ceil:Yo,halfUp:Qo},an={floor:tn,ceil:rn,halfUp:on};function sn(e,t,r,o){return an[o](nn[o](e,t,Ho),Xo,r)}function un(e,t,r){return sn(Ko(e,"scaledRay"),Ko(t,"indexRay"),r,"floor")}function ln(e,t,r){return sn(Ko(e,"scaledRay"),Ko(t,"indexRay"),r,"ceil")}function dn(e,t,r){return sn(Ko(e,"scaledRay"),Ko(t,"indexRay"),r,"halfUp")}function pn(e,t){if(t>Xo)throw new Error(`Stellar math: decimals ${t} exceed RAY scale`);return tn(e,t,Xo)}function cn(e,t,r,o){const n=nn[o](e,t,Ho),i=an[o](n,Xo,jo);return nn[o](i,r,zo)}function fn(e,t,r,o){const n=an[o](pn(e,t),Xo,jo);return nn[o](n,r,zo)}const hn=e=>Number(e)/1e18,gn=e=>Number(e)/1e27,yn=(e,t)=>Number(e)/10**t;function mn(e,t){if(!Number.isFinite(e)||e<=0||e>=1e21)return 0n;const r=e.toFixed(t),[o="0",n=""]=r.split(".");return BigInt(o+n.padEnd(t,"0"))}const bn=e=>mn(e,jo),Sn=(e,t)=>Qo(e,t,Ho),wn=(e,t)=>Qo(e,Ho,t);function vn(e,t){return 0n===t?0n:wn(e,t)}function Tn(e,t){const r=e>Ho?Ho:e,o=Ko(t.baseRateRay,"irm.baseRateRay"),n=Ko(t.slope1Ray,"irm.slope1Ray"),i=Ko(t.slope2Ray,"irm.slope2Ray"),a=Ko(t.slope3Ray,"irm.slope3Ray"),s=Ko(t.midUtilizationRay,"irm.midUtilizationRay"),u=Ko(t.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=Ko(t.maxBorrowRateRay,"irm.maxBorrowRateRay");let d;if(r<s)d=o+wn(Sn(r,n),s);else if(r<u){const e=u-s;d=o+n+wn(Sn(r-s,i),e)}else{const e=Ho-u;d=o+n+i+(0n===e?0n:wn(Sn(r-u,a),e))}return d>l?l:d}function An(e,t,r){return 0n===e||!Number.isInteger(r)||r<0||r>=1e4?0n:Qo(Sn(e,t),Vo-BigInt(r),Vo)}const xn=e=>gn(e),In=e=>Math.expm1(gn(e)),En=5n*zo,Rn=(e,t,r)=>`${e}:${t}:${r}`;function Pn(e,t,r,o){const n=Array.isArray(e)?e:void 0,i=n?n.find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o)):e[Rn(t,r,o)]??Object.values(e).find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o));if(!i)throw new Error(`Stellar math: no reserve for ${Rn(t,r,o)}`);return i}const kn=/^0*[1-9]\d*$/,qn=e=>"string"==typeof e&&kn.test(e)?BigInt(e).toString():null,Bn=(e,t)=>`${e}:${t}`;function _n(e){const t=new Map,r=new Map,o=new Set,n=new Set;for(const i of e?.indexes??[]){const e=Bn(i.hubId,i.asset),a=qn(i.supplyIndex),s=qn(i.borrowIndex),u=qn(i.usdPrice),l=t.get(e),d=l&&qn(l.supplyIndex)===a&&qn(l.borrowIndex)===s&&qn(l.usdPrice)===u;null==a||null==s||null==u||l&&!d?o.add(e):l||t.set(e,i);const p=!1===i.valid||!0===i.stale||!0===i.deviation,c=r.get(i.asset);null==u||p||void 0!==c&&c.toString()!==u?n.add(i.asset):void 0===c&&r.set(i.asset,BigInt(u))}for(const e of o)t.delete(e);for(const e of n)r.delete(e);return{indexes:t,prices:r,rejectedIndexKeys:o,rejectedAssets:n}}const On=(e,t)=>Zo(e,BigInt(t),Vo);function Un(e,t,r,o){const n="supply"===e.side,i=Math.min(e.entryLtvBps,e.entryLiquidationThresholdBps);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:e.decimals,scaledRay:e.scaledRay.toString(),indexRay:e.indexRay.toString(),usdPriceWad:e.priceWad.toString(),usdPrice:hn(e.priceWad),amountBase:t.toString(),amountShort:yn(t,e.decimals),usdWad:r.toString(),usd:hn(r),gateUsdWad:o.toString(),entryLtvBps:e.entryLtvBps,entryLiquidationThresholdBps:e.entryLiquidationThresholdBps,entryLiquidationBonusBps:e.entryLiquidationBonusBps,entryLiquidationFeesBps:e.entryLiquidationFeesBps,ltvWeightedUsdWad:n?On(o,i).toString():"0",liquidationWeightedUsdWad:n?On(o,e.entryLiquidationThresholdBps).toString():"0",liveDataUsed:e.liveDataUsed}}function Mn(e){if("supply"===e.side)return Un(e,sn(e.scaledRay,e.indexRay,e.decimals,"floor"),cn(e.scaledRay,e.indexRay,e.priceWad,"halfUp"),cn(e.scaledRay,e.indexRay,e.priceWad,"floor"));const t=sn(e.scaledRay,e.indexRay,e.decimals,"ceil"),r=cn(e.scaledRay,e.indexRay,e.priceWad,"ceil");return Un(e,t,r,r)}function Cn(e,t,r,o){const n=pn(t,r);return"supply"===e?Zo(n,Ho,o):Yo(n,Ho,o)}function Ln(e,t,r,o){const n=pn(t,r);return"supply"===e?Yo(n,Ho,o):Zo(n,Ho,o)}function Dn(e,t){return Mn({...e,scaledRay:Cn(e.side,t,e.decimals,e.indexRay)})}const $n=(...e)=>{for(const t of e){const e=qn(t);if(null!=e)return BigInt(e)}return Ho};function Nn(e,t,r,o){const n=Ko("supply"===e?t.supplyScaledRay:t.borrowScaledRay,`${e}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(Bn(t.hubId,t.asset)),a=o.prices.get(t.asset),s="supply"===e?$n(i?.supplyIndex,t.liveSupplyIndexRay,r.liveSupplyIndexRay,t.supplyIndexRay):$n(i?.borrowIndex,t.liveBorrowIndexRay,r.liveBorrowIndexRay,t.borrowIndexRay),u=a??bn(r.usdPrice);return Mn({side:e,hubId:t.hubId,asset:t.asset,decimals:r.assetDecimals,scaledRay:n,indexRay:s,priceWad:u,entryLtvBps:t.entryLtvBps,entryLiquidationThresholdBps:t.entryLiquidationThresholdBps,entryLiquidationBonusBps:t.entryLiquidationBonusBps,entryLiquidationFeesBps:t.entryLiquidationFeesBps,liveDataUsed:void 0!==i&&void 0!==a})}const Wn=(e,t)=>e.reduce(((e,r)=>e+BigInt(t(r))),0n);function Fn(e,t,r,o,n){const i=Wn(t,(e=>e.usdWad)),a=Wn(t,(e=>e.ltvWeightedUsdWad)),s=Wn(t,(e=>e.liquidationWeightedUsdWad)),u=Wn(r,(e=>e.usdWad)),l=0n===u?null:Zo(s,zo,u),d=0n===s?0:Number(u)/Number(s)*100,p=a<o||a<=u?0n:a-u;return{...e,supplies:t,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:hn(i),ltvWeightedCollateralUsdWad:a.toString(),ltvWeightedCollateralUsd:hn(a),liquidationWeightedCollateralUsdWad:s.toString(),liquidationWeightedCollateralUsd:hn(s),totalDebtUsdWad:u.toString(),totalDebtUsd:hn(u),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:hn(l),healthPercent:d,borrowLimitUsdWad:a.toString(),borrowLimitUsd:hn(a),availableBorrowUsdWad:p.toString(),availableBorrowUsd:hn(p),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:hn(o),isLiquidatable:null!==l&&l<zo,liveDataValid:n}}function Gn(e){const{positions:t,reserves:r,liveState:o}=e,n=t[0];if(!n)throw new Error("Stellar math: computeAccountRisk needs at least one position row");for(const e of t)if(e.accountId!==n.accountId)throw new Error(`Stellar math: computeAccountRisk received mixed account ids (${n.accountId}, ${e.accountId})`);const i=_n(o),a=[],s=[];for(const e of t){const t=Pn(r,e.spokeId,e.hubId,e.asset),o=Nn("supply",e,t,i);o&&a.push(o);const n=Nn("borrow",e,t,i);n&&s.push(n)}const u=null!=o?.minBorrowCollateralUsdWad?Ko(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):En,l=void 0!==o&&[...a,...s].every((e=>e.liveDataUsed));return Fn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},a,s,u,l)}const Hn=200n,zn=e=>e.reduce(((e,t)=>t.amount<e.amount?t:e)),Vn=e=>e<0n?0n:e,Xn=(e,t,r,o)=>({amountBase:e.amount,amountShort:yn(e.amount,t),isFullClose:r,reason:e.reason,projectedUtilization:o}),jn=e=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:e,projectedUtilization:null});function Kn(e){const t=e.assetDecimals,r=Ko(e.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:mn(e.hubPool.suppliedShort,t),borrowedBase:mn(e.hubPool.borrowedShort,t),cashBase:mn(e.availableLiquidityShort,t),spokeSuppliedBase:mn(e.suppliedShort,t),spokeBorrowedBase:mn(e.borrowedShort,t),maxUtilizationRay:r>=Ho?null:r}}const Zn=(e,t)=>e<=0n?null:Number(t)/Number(e);function Yn(e,t){if(e<=0n||!t(0n))return 0n;let r=0n,o=e+1n;for(;o-r>1n;){const e=(r+o)/2n;t(e)?r=e:o=e}return r}const Qn=(e,t)=>e.find((e=>e.hubId===t.hubId&&e.asset===t.asset));function Jn(e,t,r){if(t.paused)return jn("paused");if(t.frozen)return jn("frozen");if(!t.isBorrowable)return jn("cap");const o=t.assetDecimals,n=Kn(t),i=Qn(e.borrows,t),a=_n(r).indexes.get(Bn(t.hubId,t.asset)),s=i?BigInt(i.indexRay):Ko(a?.borrowIndex??t.liveBorrowIndexRay,"borrowIndex"),u=i?BigInt(i.usdPriceWad):function(e,t){return _n(t).prices.get(e.asset)??bn(e.usdPrice)}(t,r),l=i?BigInt(i.scaledRay):0n,d=BigInt(e.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),p=BigInt(e.ltvWeightedCollateralUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=[];if(p<c)f.push({amount:0n,reason:"minCollateral"});else{const t=p-BigInt(e.totalDebtUsdWad),r=t<=0n||u<=0n?0n:Zo(t,10n**BigInt(o),u),n=e=>d+cn(l+Cn("borrow",e,o,s),s,u,"ceil");f.push({amount:0n===r?0n:Yn(r+16n,(e=>n(e)<=p)),reason:"ltv"})}f.push({amount:Vn(Ko(t.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=Qo(n.suppliedBase,Hn,Vo);f.push({amount:Vn(n.cashBase-h),reason:"liquidity"});const g=function(e,t){const r=e.maxUtilizationRay;if(null===r)return null;const o=pn(e.suppliedBase,t);return 0n===o?null:Yn(Vn(Zo(e.suppliedBase,r,Ho)-e.borrowedBase)+16n,(n=>vn(pn(e.borrowedBase+n,t),o)<=r))}(n,o);null!==g&&f.push({amount:g,reason:"utilizationCap"});const y=zn(f);return Xn(y,o,!1,Zn(n.suppliedBase,n.borrowedBase+y.amount))}function ei(e,t,r){if(t.paused)return jn("paused");const o=Qn(e.supplies,t);if(!o)return jn(null);const n=o.decimals,i=Kn(t),a=BigInt(o.scaledRay),s=BigInt(o.indexRay),u=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),d=sn(a,s,n,"halfUp"),p=BigInt(e.totalDebtUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let g=!0;if(p>0n&&f>0n){const t=p>c?p:c,r=c>p?"minCollateral":"healthFactor",i=BigInt(e.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<t){g=!1;const e=t-i,l=Yo(e,Vo,f),p=BigInt(o.gateUsdWad)-l,c=p<=0n?0n:Zo(p,10n**BigInt(n),u),y=d>0n?d-1n:0n,m=c+16n>y?y:c+16n,b=e=>{const t=Ln("supply",e,n,s);return Zo(cn(t>=a?0n:a-t,s,u,"floor"),f,Vo)};h.push({amount:Yn(m,(t=>b(t)>=e)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const y=function(e,t){const r=e.maxUtilizationRay;if(null===r||0n===e.borrowedBase)return null;if(0n===r)return 0n;const o=Yo(e.borrowedBase,Ho,r),n=e.suppliedBase<o?0n:e.suppliedBase-o+16n,i=pn(e.borrowedBase,t);return Yn(n>e.suppliedBase?e.suppliedBase:n,(o=>{const n=pn(e.suppliedBase-o,t);return n>0n&&vn(i,n)<=r}))}(i,n);null!==y&&h.push({amount:y,reason:"utilizationCap"});const m=zn(h),b=g&&m.amount>=l;return Xn(m,n,b,Zn(i.suppliedBase-m.amount,i.borrowedBase))}function ti(e){if(e.paused)return jn("paused");if(e.frozen)return jn("frozen");const t=e.assetDecimals,r=Kn(e),o={amount:Vn(Ko(e.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return Xn(o,t,!1,Zn(r.suppliedBase+o.amount,r.borrowedBase))}function ri(e,t,r){if(t.paused)return jn("paused");const o=Qn(e.borrows,t);if(!o)return jn(null);const n=o.decimals,i=Kn(t),a=BigInt(o.amountBase),s=void 0===r?null:Ko(r,"walletBalance"),u=null!==s&&s<a?{amount:s,reason:"liquidity"}:{amount:a,reason:null};return Xn(u,n,u.amount>=a,Zn(i.suppliedBase,Vn(i.borrowedBase-u.amount)))}const oi=(e,t)=>e.hubId===t.hubId&&e.asset===t.asset,ni=e=>{if("bigint"==typeof e)return e;const t=e.trim();if(!/^-?\d+$/.test(t))throw new Error(`Stellar math: delta amountBase must be an integer string, got "${e}"`);return BigInt(t)};function ii(e,t){const r=[...e.supplies],o=[...e.borrows];for(const e of t){const t="supply"===e.side?r:o,n=t.findIndex((t=>oi(t,e))),i=-1===n?void 0:t[n],a=ni(e.amountBase);let s;if(i){const e={side:i.side,hubId:i.hubId,asset:i.asset,decimals:i.decimals,indexRay:BigInt(i.indexRay),priceWad:BigInt(i.usdPriceWad),entryLtvBps:i.entryLtvBps,entryLiquidationThresholdBps:i.entryLiquidationThresholdBps,entryLiquidationBonusBps:i.entryLiquidationBonusBps,entryLiquidationFeesBps:i.entryLiquidationFeesBps,liveDataUsed:i.liveDataUsed},t=BigInt(i.scaledRay);let r;if(a>=0n)r=t+Cn(e.side,a,e.decimals,e.indexRay);else{const o=-a,n=o>=("supply"===e.side?sn(t,e.indexRay,e.decimals,"halfUp"):BigInt(i.amountBase))?t:Ln(e.side,o,e.decimals,e.indexRay);r=n>=t?0n:t-n}s=0n===r?null:Mn({...e,scaledRay:r})}else s=a<=0n?null:Dn(ai(e),a);-1===n?s&&t.push(s):s?t[n]=s:t.splice(n,1)}return Fn({accountId:e.accountId,owner:e.owner,spokeId:e.spokeId,mode:e.mode},r,o,BigInt(e.minBorrowCollateralUsdWad),e.liveDataValid)}function ai(e){const t=e.reserve;if(!t)throw new Error(`Stellar math: projectAccountRisk needs \`reserve\` for a new ${e.side} position on ${e.hubId}:${e.asset}`);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:t.assetDecimals,indexRay:Ko("supply"===e.side?t.liveSupplyIndexRay:t.liveBorrowIndexRay,"reserve live index"),priceWad:bn(t.usdPrice),entryLtvBps:t.collateralFactorBps,entryLiquidationThresholdBps:t.liquidationThresholdBps,entryLiquidationBonusBps:t.liquidationPenaltyBps,entryLiquidationFeesBps:t.liquidationFeesBps,liveDataUsed:!1}}function si(e,t=0n,r=0n){const o=e.assetDecimals,n=e=>e<0n?0n:e,i=n(mn(e.hubPool.suppliedShort,o)+ni(t)),a=vn(pn(n(mn(e.hubPool.borrowedShort,o)+ni(r)),o),pn(i,o)),s=Tn(a,e.irm),u=An(a,s,e.irm.reserveFactorBps);return{utilization:gn(a),utilizationRay:a.toString(),borrowAprRay:s.toString(),supplyAprRay:u.toString(),borrowApr:xn(s),supplyApr:xn(u),borrowApy:In(s),supplyApy:In(u)}}const ui={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."},14:{name:"AmountMustBePositive",message:"The amount must be greater than zero."},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 li(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=ui[r];return o?{code:r,...o}:null}},468(e,t,r){"use strict";r.d(t,{createStellarLendingReadClient:()=>S,lendingAssetsSchema:()=>m,lendingPositionsSchema:()=>y});const o={type:"string"},n={type:"number"},i={type:"boolean"},a={...o,nullable:!0},s={...n,nullable:!0},u={...o,enum:["mainnet","testnet"]},l={...o,enum:["ready","stale","incomplete"]};function d(e){return{type:"object",required:Object.keys(e),properties:e}}const p={sac:o,symbol:o,name:o,decimals:s,logoUrl:a},c=d({valid:i,stale:i,deviation:i,timestamp:s}),f=d({...p,hubId:n,hubName:o,amountRaw:{...a,description:"Integer token base units, never scaled shares."},amount:a,apy:{...s,description:"Fraction: 0.05 means 5%."},priceUsd:s,valueUsd:s,priceStatus:c,indexRay:a,indexedAt:n,indexedLedger:n}),h=d({amountRaw:a,amount:a,usd:s}),g=d({spokeId:n,spokeName:o,ltvBps:n,supplyCapacity:h,borrowCapacity:h,canSupply:i,canBeCollateral:i,canBorrow:i,canOpenAccount:{...i,description:"Spoke admits new accounts; other entry gates still apply."}}),y={type:"array",items:d({accountId:o,nftContract:o,nftImage:{...o,format:"uri",description:"Dynamic position SVG served by the network's XOXNO API."},network:u,spokeId:s,spokeName:a,supplied:{type:"array",items:f},borrow:{type:"array",items:f},hasDebt:{...i,nullable:!0,description:"Null when account rows are unavailable."},healthFactor:{...s,description:"Null without debt or when risk inputs are unavailable."},borrowLimitUsd:s,availableBorrowUsd:{...s,description:"Account headroom, before per-market constraints."},netApy:{...s,description:"Net annual yield divided by positive net equity; fraction."},dataStatus:l})},m={type:"array",items:d({...p,hubId:n,hubName:o,network:u,supplyApy:{...s,description:"Fraction: 0.05 means 5%."},borrowApy:{...s,description:"Fraction: 0.05 means 5%."},priceUsd:s,priceStatus:c,spokes:{type:"array",items:g},dataStatus:l,indexedAt:{...n,description:"Pool state timestamp. Capacities are indexed snapshot estimates; prepare/simulate before signing."},indexedLedger:n})};function b(e){if(!e)return;const t=/\s*<([^<>\s]+)>\s*((?:;\s*[\w!#$%&'*+.^`|~-]+\s*=\s*(?:"(?:[^"\\\r\n]|\\.)*"|[\w!#$%&'*+.^`|~:/-]+)\s*)*)(,|$)/gy;let r,o=0;for(;o<e.length;){const n=t.exec(e);if(!n||n[3]&&t.lastIndex===e.length)throw new Error("Invalid pagination Link header");let i=!1,a=!1;for(const e of n[2].matchAll(/;\s*([\w!#$%&'*+.^`|~-]+)\s*=\s*(?:"((?:[^"\\\r\n]|\\.)*)"|([\w!#$%&'*+.^`|~:/-]+))\s*/g))if("rel"===e[1].toLowerCase()){if(a)throw new Error("Duplicate pagination link relation");a=!0,i=(e[2]??e[3]).replace(/\\(.)/g,"$1").toLowerCase().split(/\s+/).includes("next")}if(i){if(void 0!==r)throw new Error("Multiple next pagination links");r=n[1]}o=t.lastIndex}return r}function S(e){const t=new URL(e.baseUrl.trim());if(!["https:","http:"].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an HTTP API root without credentials, query or fragment");t.pathname=`${t.pathname.replace(/\/+$/,"")}/`;const r=e.fetch??globalThis.fetch?.bind(globalThis);if(!r)throw new Error("A fetch implementation is required");async function o(e,o){const n=new URL(`stellar-lending/v1/${e}`,t);let i=n;const a=new Set,s=[];for(;;){if(a.has(i.href))throw new Error("Pagination Link cycle");a.add(i.href);const e=await r(i.href,{signal:o,redirect:"error"});if(e.redirected||e.url&&new URL(e.url).href!==i.href)throw new Error("Stellar lending redirects are not allowed");if(!e.ok)throw new Error(`Stellar lending request failed: HTTP ${e.status}`);const t=await e.json();if(!Array.isArray(t))throw new Error("Stellar lending response must be an array");s.push(...t);const u=b(e.headers.get("Link"));if(!u)break;const l=new URL(u,i);if(l.origin!==n.origin||l.pathname!==n.pathname||l.username||l.password||l.hash)throw new Error("Pagination Link must stay on the same API endpoint");i=l}return s}return{assets:({usage:e,signal:t}={})=>{if(void 0!==e&&"collateral"!==e&&"borrow"!==e)throw new Error("usage must be collateral or borrow");return o("assets"+(e?`?usage=${e}`:""),t)},positions:(e,{signal:t}={})=>{if(!e.trim()||"."===e||".."===e)throw new Error("owner is required");return o(`users/${encodeURIComponent(e)}/positions`,t)}}}}},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,{BPS:()=>g.BPS,Chain:()=>a,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>g.DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD,DEFAULT_REQUEST_TIMEOUT_MS:()=>i,LIQUIDATION_BUFFER_BPS:()=>g.LIQUIDATION_BUFFER_BPS,RAY:()=>g.RAY,RAY_DECIMALS:()=>g.RAY_DECIMALS,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,STELLAR_ROUTE_MAX_BYTES:()=>g.STELLAR_ROUTE_MAX_BYTES,SYNTHETIC_EVENT_ORDER_STRIDE:()=>g.SYNTHETIC_EVENT_ORDER_STRIDE,StellarAuthPolicyError:()=>g.StellarAuthPolicyError,StellarRouteVerificationError:()=>g.StellarRouteVerificationError,WAD:()=>g.WAD,WAD_DECIMALS:()=>g.WAD_DECIMALS,XOXNOClient:()=>s,aggregateAccountRisk:()=>g.aggregateAccountRisk,annualBorrowRateRay:()=>g.annualBorrowRateRay,assertStellarAuthEntries:()=>g.assertStellarAuthEntries,assertStellarPreparedTxAuth:()=>g.assertStellarPreparedTxAuth,baseToRay:()=>g.baseToRay,baseToShort:()=>g.baseToShort,baseValueWad:()=>g.baseValueWad,buildLiveSnapshot:()=>g.buildLiveSnapshot,buildSameTokenRepaySwapSteps:()=>g.buildSameTokenRepaySwapSteps,buildSdk:()=>S,buildStellarAcceptOwnershipTx:()=>g.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>g.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>g.buildStellarApproveBlendPoolTx,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,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,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,buildStellarSetAccumulatorTx:()=>g.buildStellarSetAccumulatorTx,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,burnShares:()=>g.burnShares,computeAccountRisk:()=>g.computeAccountRisk,createStellarLendingReadClient:()=>g.createStellarLendingReadClient,decodeStellarLendingEvent:()=>g.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>g.decodeStellarLiquidateReturn,decodeStellarRouteBytes:()=>g.decodeStellarRouteBytes,decodeStellarSwapEnvelope:()=>g.decodeStellarSwapEnvelope,depositRateRay:()=>g.depositRateRay,divByIntHalfUp:()=>g.divByIntHalfUp,encodeAssetOracle:()=>g.encodeAssetOracle,encodeInterestRateModel:()=>g.encodeInterestRateModel,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:()=>u,isValidNftIdentifier:()=>l,lendingAssetsSchema:()=>g.lendingAssetsSchema,lendingPositionsSchema:()=>g.lendingPositionsSchema,liveIndexKey:()=>g.liveIndexKey,mapQuoteResponseToStrategyPayload:()=>g.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>g.mapQuoteResponseToStrategySwap,mapSorobanError:()=>g.mapSorobanError,mapStellarPositionActivityType:()=>g.mapStellarPositionActivityType,maxBorrow:()=>g.maxBorrow,maxRepay:()=>g.maxRepay,maxSupply:()=>g.maxSupply,maxWithdraw:()=>g.maxWithdraw,mintShares:()=>g.mintShares,mulDivCeil:()=>g.mulDivCeil,mulDivFloor:()=>g.mulDivFloor,mulDivHalfUp:()=>g.mulDivHalfUp,numberToScaled:()=>g.numberToScaled,numberToWad:()=>g.numberToWad,positionValueWad:()=>g.positionValueWad,prepareStellarBuiltTx:()=>g.prepareStellarBuiltTx,prepareStellarTxXdr:()=>g.prepareStellarTxXdr,projectAccountRisk:()=>g.projectAccountRisk,projectReserveApy:()=>g.projectReserveApy,rayAprToApy:()=>g.rayAprToApy,rayAprToNumber:()=>g.rayAprToNumber,rayToNumber:()=>g.rayToNumber,rescaleCeil:()=>g.rescaleCeil,rescaleFloor:()=>g.rescaleFloor,rescaleHalfUp:()=>g.rescaleHalfUp,reserveKey:()=>g.reserveKey,resolveReserve:()=>g.resolveReserve,stellarAuthPolicyForInvocation:()=>g.stellarAuthPolicyForInvocation,stellarLendingDispatchKey:()=>g.stellarLendingDispatchKey,stellarLendingRead:()=>g.stellarLendingRead,stellarNetworks:()=>g.stellarNetworks,stellarTokenContractId:()=>g.stellarTokenContractId,syntheticEventOrder:()=>g.syntheticEventOrder,tagStellarInvokedContractError:()=>g.tagStellarInvokedContractError,toBase64Xdr:()=>g.toBase64Xdr,toBigInt:()=>g.toBigInt,toStellarPositionMode:()=>g.toStellarPositionMode,unscale:()=>g.unscale,unscaleBorrowCeil:()=>g.unscaleBorrowCeil,unscaleHalfUp:()=>g.unscaleHalfUp,unscaleSupplyFloor:()=>g.unscaleSupplyFloor,utilizationRay:()=>g.utilizationRay,valueBasePosition:()=>g.valueBasePosition,valueScaledPosition:()=>g.valueScaledPosition,verifyStellarRouteBytes:()=>g.verifyStellarRouteBytes,wadToNumber:()=>g.wadToNumber});const e="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",t="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",n="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",i=3e4;var a;!function(e){e.MAINNET="1",e.DEVNET="D"}(a||(a={}));class s{apiUrl;chain;init;config;constructor(r){if(!r?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:o=a.MAINNET,apiUrl:i,...s}=r;this.apiUrl=i.trim().replace(/\/$/,""),this.chain=o,this.init=s,this.config=o==a.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:a,timeout:s,...u}=this.init,{next:l,cache:d,debug:p,timeout:c,headers:f,method:h="GET",...g}=r,y=f?.Authorization,m="Bearer undefined"===y?void 0:y,b="GET"!==h&&"HEAD"!==h&&"PUT"!==h,S={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...b?{"Content-Type":"application/json"}:{},...m?{Authorization:m}:{}},w=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("&"),v=`${this.apiUrl}${e}${w.length?`?${w}`:""}`,{revalidate:T,...A}=o??{},{revalidate:x,...I}=l??{},E="GET"!==h||m?void 0:x??T,R="GET"!==h||m||E?void 0:d??n,P=g.body,k=c??s??(null==P?i:0),q=k>0?AbortSignal.timeout(k):void 0,B=g.signal??u.signal,_=q&&B?AbortSignal.any([B,q]):q??B,O={...u,...g,method:h,...Object.keys(S).length?{headers:S}:{},..._?{signal:_}:{},cache:R,next:{...A,...I,revalidate:E}};(p??a)&&console.debug("SDK fetch: ",v,O);const U=await fetch(v,O).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${v}: ${e.message}`),{cause:e});throw e})),M=await U.text();if(!U.ok){let e;try{e=JSON.parse(M)}catch{e={message:M}}const t=[v,U.status,U.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(M)}catch{return M}}}const u=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 d extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class p 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(999);const y=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),m=()=>({static:{},params:{},leaves:[]});function b(e,t,r,o){const{input:n,output:i,...a}=t,s=async(t={})=>{const n={...r,...t},i=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),s=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in s,f=/:collection[^A-Z]/.test(e)||"collection"in s;if(l){const e=n.address;if(!c(e))throw new p(e)}if(f){const e=n.collection;if(Array.isArray(e)?e.some((e=>!u(e))):!u(e))throw new d(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:m,headers:b,cache:S,next:w,debug:v,signal:T,credentials:A,mode:x,redirect:I,referrer:E,referrerPolicy:R,integrity:P,keepalive:k,priority:q,window:B,continuationToken:_,...O}=h,U=y?`Bearer ${y}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==_&&(O.continuationToken=_);const M={...b,...U?{Authorization:U}:{},..._&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(_)}:{}},C={...w,tags:[...w?.tags??[],i]};return o.fetchWithTimeout(i,{method:m,params:O,body:g,headers:M,cache:S,debug:v,...Object.fromEntries(Object.entries({signal:T,credentials:A,mode:x,redirect:I,referrer:E,referrerPolicy:R,integrity:P,keepalive:k,priority:q,window:B}).filter((([,e])=>void 0!==e))),...C?{next:C}:{}})},l=(e={})=>s(e);for(const e of Object.keys(a))h.includes(e)&&(l[e]=t=>s({...t,method:t.method??e.toUpperCase()}));return l}function S(e){const t=function(){const e=m();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]||=m()}else{const t=y(e);n=n.static[t]||=m()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,i=Object.keys(t.static).length,a=Object.keys(t.params).length;let s;if(1===n&&i+a>0){const{rawPath:r,def:n}=t.leaves[0];s=b(r,n,o,e)}else{s={};for(const{rawPath:r,def:n}of t.leaves)s[y(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===s[e]?s[e]=i:"function"==typeof s[e]?Object.assign(s[e],i):"function"==typeof i?(Object.assign(i,s[e]),s[e]=i):Object.assign(s[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(s[e]){const r=s[e];s[e]=e=>({...r(e),...t(e)})}else s[e]=t}return s};return r(t,{})}})(),module.exports=o})();
|