@xoxno/sdk-js 1.0.237 → 1.0.238
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 +0 -3
- package/dist/cjs/sdk/swagger.d.ts +0 -4
- package/dist/esm/sdk/swagger.js +0 -4
- package/dist/esm/utils/regex.js +2 -4
- package/dist/index.cjs +1 -1
- package/dist/sdk/swagger.d.ts +0 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -666,9 +666,6 @@ sdk.liquid.xoxno.stats(...); // XoxnoLiquidStatsDto
|
|
|
666
666
|
// GET /liquid/egld/stats
|
|
667
667
|
sdk.liquid.egld.stats(...); // XoxnoLiquidStatsDto
|
|
668
668
|
|
|
669
|
-
// GET /liquid/sui/stats
|
|
670
|
-
sdk.liquid.sui.stats(...); // XoxnoLiquidStatsDto
|
|
671
|
-
|
|
672
669
|
// GET /liquid/egld/rate
|
|
673
670
|
sdk.liquid.egld.rate(...); // RateType
|
|
674
671
|
|
|
@@ -305,10 +305,6 @@ export declare const endpoints: {
|
|
|
305
305
|
readonly input: {};
|
|
306
306
|
readonly output: XoxnoLiquidStatsDto;
|
|
307
307
|
};
|
|
308
|
-
readonly "/liquid/sui/stats": {
|
|
309
|
-
readonly input: {};
|
|
310
|
-
readonly output: XoxnoLiquidStatsDto;
|
|
311
|
-
};
|
|
312
308
|
readonly "/analytics/marketplace-unique-users": {
|
|
313
309
|
readonly input: {
|
|
314
310
|
before: string;
|
package/dist/esm/sdk/swagger.js
CHANGED
package/dist/esm/utils/regex.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export const isValidCollectionTicker = (ticker)=>{
|
|
2
|
-
const isSuiCollection = /* (ticker.length >= 4 && ticker.length <= 40) || */ /^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(ticker));
|
|
3
2
|
const isXoxnoCollection = /^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(ticker);
|
|
4
3
|
// Stellar: the collection IS the NFT contract (Soroban contract strkey)
|
|
5
4
|
const isStellarCollection = /^C[A-Z2-7]{55}$/.test(ticker);
|
|
6
|
-
return
|
|
5
|
+
return isXoxnoCollection || isStellarCollection;
|
|
7
6
|
};
|
|
8
7
|
export const isValidNftIdentifier = (identifier)=>{
|
|
9
|
-
const isSuiNft = /^0x[a-fA-F0-9]{1,64}$/.test(identifier);
|
|
10
8
|
const isXoxnoNft = /^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(identifier);
|
|
11
9
|
// Stellar: `{contract strkey}-{decimal token id}`
|
|
12
10
|
const isStellarNft = /^C[A-Z2-7]{55}-\d+$/.test(identifier);
|
|
13
|
-
return
|
|
11
|
+
return isXoxnoNft || isStellarNft;
|
|
14
12
|
};
|
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,c=u>0?a-4:a;for(r=0;r<c;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 c(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 p(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):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(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 c(e){return d(e),s(e<0?0:0|h(e))}function p(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 m(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 _(this,t,r);case"utf8":case"utf-8":return R(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 q(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function y(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 R(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<=E)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=E));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 c(e)},u.allocUnsafeSlow=function(e){return c(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)y(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)y(this,t,t+3),y(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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):m.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 E=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 _(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 q(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 B(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 C(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 U(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||U(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function N(e,t,r,o,i){return t=+t,r>>>=0,i||U(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||B(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||B(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||B(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(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||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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||B(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||B(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||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||B(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||B(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||B(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||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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||B(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(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 C(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 C(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 N(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return N(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 D={};function $(e,t,r){D[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 D.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(o,n,i)}function z(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw z(e,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),$("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 H=/[^+/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(H,"")).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,c=r?n-1:0,p=r?-1:1,f=e[t+c];for(c+=p,i=f&(1<<-d)-1,f>>=-d,d+=s;d>0;i=256*i+e[t+c],c+=p,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=o;d>0;a=256*a+e[t+c],c+=p,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,c=d>>1,p=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+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=d?(s=0,a=d):a+c>=1?(s=(t*u-1)*Math.pow(2,n),a+=c):(s=t*Math.pow(2,c-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:()=>Jo,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>On,LIQUIDATION_BUFFER_BPS:()=>Yn,RAY:()=>Yo,RAY_DECIMALS:()=>en,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Mt,STELLAR_LENDING_TOPICS:()=>Jr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>a,STELLAR_ROUTE_MAX_BYTES:()=>ho,SYNTHETIC_EVENT_ORDER_STRIDE:()=>to,StellarAuthPolicyError:()=>Eo,StellarRouteVerificationError:()=>go,WAD:()=>Qo,WAD_DECIMALS:()=>tn,aggregateAccountRisk:()=>Kn,annualBorrowRateRay:()=>kn,assertStellarAuthEntries:()=>Mo,assertStellarPreparedTxAuth:()=>zo,baseToRay:()=>bn,baseToShort:()=>An,baseValueWad:()=>wn,buildLiveSnapshot:()=>Dn,buildSameTokenRepaySwapSteps:()=>jo,buildStellarAcceptOwnershipTx:()=>yt,buildStellarAddRewardsTx:()=>Ot,buildStellarApproveBlendPoolTx:()=>Tt,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>Zo,buildStellarClaimRevenueTx:()=>Bt,buildStellarCreateLiquidityPoolTx:()=>_t,buildStellarExecuteCancellerResetTx:()=>kr,buildStellarExecuteStrategyTx:()=>To,buildStellarFlashLoanTx:()=>Y,buildStellarGovernanceAddSpokeImmediateTx:()=>Or,buildStellarGovernanceCreateHubImmediateTx:()=>Br,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Tr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>xr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ir,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Rr,buildStellarGovernanceExecuteTx:()=>vr,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ar,buildStellarGovernancePauseTx:()=>Mr,buildStellarGovernanceRevokeRoleImmediateTx:()=>Cr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>qr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>_r,buildStellarGrantRoleTx:()=>ht,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>V,buildStellarLiquidationEstimateTx:()=>j,buildStellarMigrateFromBlendTx:()=>Q,buildStellarMigrateTx:()=>ct,buildStellarMultiplyTx:()=>J,buildStellarPauseTx:()=>pt,buildStellarProposeAddAssetToSpokeTx:()=>Yt,buildStellarProposeAddSpokeTx:()=>Kt,buildStellarProposeApproveBlendPoolTx:()=>ir,buildStellarProposeApproveTokenTx:()=>or,buildStellarProposeCancellerResetTx:()=>Pr,buildStellarProposeConfigureAssetOracleTx:()=>hr,buildStellarProposeCreateHubTx:()=>jt,buildStellarProposeCreateLiquidityPoolTx:()=>sr,buildStellarProposeDeployPoolTx:()=>lr,buildStellarProposeEditAssetInSpokeTx:()=>Qt,buildStellarProposeEditOracleToleranceTx:()=>gr,buildStellarProposeGovernanceUpgradeTx:()=>mr,buildStellarProposeGrantGovernanceRoleTx:()=>br,buildStellarProposeMigrateControllerTx:()=>pr,buildStellarProposeRemoveAssetFromSpokeTx:()=>Jt,buildStellarProposeRemoveSpokeTx:()=>Zt,buildStellarProposeRevokeBlendPoolTx:()=>ar,buildStellarProposeRevokeGovernanceRoleTx:()=>Sr,buildStellarProposeRevokeTokenTx:()=>nr,buildStellarProposeSetAccumulatorTx:()=>Vt,buildStellarProposeSetMinBorrowCollatTx:()=>rr,buildStellarProposeSetPositionLimitsTx:()=>Xt,buildStellarProposeSetPositionManagerTx:()=>tr,buildStellarProposeSetPriceAggregatorTx:()=>Ht,buildStellarProposeSetSpokeLiquidationCurveTx:()=>er,buildStellarProposeSetSwapAggregatorTx:()=>Gt,buildStellarProposeTransferCtrlOwnershipTx:()=>fr,buildStellarProposeTransferGovOwnTx:()=>wr,buildStellarProposeUnpauseTx:()=>Ur,buildStellarProposeUpdateDelayTx:()=>yr,buildStellarProposeUpgradeControllerTx:()=>cr,buildStellarProposeUpgradePoolParamsTx:()=>ur,buildStellarProposeUpgradePoolTx:()=>dr,buildStellarRenewAccountTx:()=>kt,buildStellarRepayBatchTx:()=>G,buildStellarRepayDebtWithCollateralTx:()=>re,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>At,buildStellarRevokeRoleTx:()=>gt,buildStellarSetAccumulatorTx:()=>wt,buildStellarSetOracleSanityBoundsTx:()=>Et,buildStellarSetOracleToleranceTx:()=>It,buildStellarSetOracleTx:()=>xt,buildStellarSetPositionLimitsTx:()=>vt,buildStellarSetPriceAggregatorTx:()=>St,buildStellarSetSpokeAssetFlagsTx:()=>Rt,buildStellarSetSwapAggregatorTx:()=>bt,buildStellarSupplyBatchTx:()=>N,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>te,buildStellarSwapDebtTx:()=>ee,buildStellarTransferOwnershipTx:()=>mt,buildStellarUnpauseTx:()=>ft,buildStellarUpdateAccountThresholdTx:()=>Ct,buildStellarUpdateIndexesTx:()=>Pt,buildStellarUpgradeControllerTx:()=>dt,buildStellarUpgradeLiquidityPoolParamsTx:()=>qt,buildStellarWithdrawBatchTx:()=>F,buildStellarWithdrawTx:()=>z,buildTx:()=>U,burnShares:()=>Gn,computeAccountRisk:()=>Zn,createStellarLendingReadClient:()=>Ye.createStellarLendingReadClient,decodeStellarLendingEvent:()=>eo,decodeStellarLiquidateReturn:()=>X,decodeStellarLiquidationEstimate:()=>Z,decodeStellarRouteBytes:()=>yo,decodeStellarSwapEnvelope:()=>Ro,depositRateRay:()=>_n,divByIntHalfUp:()=>sn,encodeAssetOracle:()=>lt,encodeInterestRateModel:()=>Qe,encodeMarketParamsRaw:()=>Je,encodePositionLimits:()=>et,encodePriceKey:()=>tt,encodeStrategyPayloadToRouteXdr:()=>vo,extractEventOrder:()=>oo,getStellarAccountPositions:()=>be,getStellarActiveUsersSeries:()=>ze,getStellarAggregatorQuote:()=>so,getStellarAsset:()=>he,getStellarAssetGraph:()=>Re,getStellarAssetMarkets:()=>Te,getStellarAssetPage:()=>ve,getStellarAssets:()=>le,getStellarCampaignLeaderboard:()=>Le,getStellarCampaignMe:()=>Ke,getStellarDefiLlamaDimensions:()=>He,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>ue,getStellarFeeRevenueSeries:()=>$e,getStellarGovernanceProposals:()=>Be,getStellarHolderDistribution:()=>Ue,getStellarHub:()=>ge,getStellarHubGraph:()=>Ee,getStellarHubHolders:()=>xe,getStellarHubs:()=>de,getStellarLendingContext:()=>ae,getStellarLendingLiveState:()=>se,getStellarLiquidationsLeaderboard:()=>Me,getStellarLiquidationsSeries:()=>We,getStellarParticipantCounts:()=>Ce,getStellarPnlByScope:()=>je,getStellarPositionsLeaderboard:()=>Oe,getStellarPositionsPnl:()=>Xe,getStellarQuoteTokens:()=>uo,getStellarRateSpreadSeries:()=>Ge,getStellarReserve:()=>fe,getStellarReserveGraph:()=>ke,getStellarReserveHolders:()=>Ae,getStellarReserves:()=>pe,getStellarRevenueSeries:()=>De,getStellarSpoke:()=>me,getStellarSpokeGraph:()=>Pe,getStellarSpokeHolders:()=>Ie,getStellarSpokes:()=>ce,getStellarStatsHistory:()=>Ne,getStellarUserActivity:()=>_e,getStellarUserActivityPage:()=>qe,getStellarUserHistory:()=>Ve,getStellarUserPositions:()=>ye,getStellarVolumeSeries:()=>Fe,getStellarWalletBalance:()=>we,getStellarWalletTokens:()=>Se,lendingAssetsSchema:()=>Ye.lendingAssetsSchema,lendingPositionsSchema:()=>Ye.lendingPositionsSchema,liveIndexKey:()=>Nn,mapQuoteResponseToStrategyPayload:()=>Ao,mapQuoteResponseToStrategySwap:()=>xo,mapSorobanError:()=>vi,mapStellarPositionActivityType:()=>io,maxBorrow:()=>ai,maxRepay:()=>li,maxSupply:()=>ui,maxWithdraw:()=>si,mintShares:()=>zn,mulDivCeil:()=>nn,mulDivFloor:()=>on,mulDivHalfUp:()=>an,numberToScaled:()=>xn,numberToWad:()=>In,parseStellarTokenAmount:()=>M,positionValueWad:()=>Sn,prepareStellarBuiltTx:()=>Vo,prepareStellarTxXdr:()=>Ho,projectAccountRisk:()=>pi,projectReserveApy:()=>hi,rayAprToApy:()=>Bn,rayAprToNumber:()=>qn,rayToNumber:()=>Tn,rescaleCeil:()=>dn,rescaleFloor:()=>ln,rescaleHalfUp:()=>cn,reserveKey:()=>Cn,resolveReserve:()=>Mn,stellarAuthPolicyForInvocation:()=>$o,stellarLendingDispatchKey:()=>Dr,stellarLendingRead:()=>Ze,stellarNetworks:()=>n,stellarTokenContractId:()=>bo,syntheticEventOrder:()=>no,tagStellarInvokedContractError:()=>Go,toBase64Xdr:()=>Lr,toBigInt:()=>rn,toStellarPositionMode:()=>Xo,unscale:()=>hn,unscaleBorrowCeil:()=>mn,unscaleHalfUp:()=>yn,unscaleSupplyFloor:()=>gn,utilizationRay:()=>Pn,valueBasePosition:()=>Hn,valueScaledPosition:()=>Fn,verifyStellarRouteBytes:()=>wo,wadToNumber:()=>vn});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:"CBMARXSYE56NPDLX42TTICM5GS5XQCYRD5VMCJME624TS6C2S53VETYU",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","Curve"],d={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4,Curve:7},c=1e6,p=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()},m=e=>s.xdr.ScVal.scvBool(e),y=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)=>E({asset:p(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)))),R=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)}`)},E=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>c)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>c)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const a=i===c;let s=c;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*c/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 E({amounts:s.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:s.xdr.ScVal.scvVec(t.assetList.map((e=>p(e)))),ops:s.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},_=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)},q=()=>s.xdr.ScVal.scvBytes(u.hp.alloc(0)),B=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 _(B(e));if(e instanceof Uint8Array)return 0===e.length?q():_(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?_(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?_(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?_(B(e.bytes)):0===e.bytes.length?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>c)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==c)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)")},C=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){if("number"!=typeof t||!Number.isInteger(t)||t<0||t>18)throw new Error("Token decimals must be an integer from 0 to 18");if("string"!=typeof e||!/^\d+(?:\.\d+)?$/.test(e))throw new Error("Token amount must be plain decimal text");const r=s.Soroban.parseTokenAmount(e,t),o=BigInt(r);if(o<=0n||o>(1n<<127n)-1n)throw new Error("Token amount must be within the positive i128 range");return r}function U(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.sourceAccount??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 L(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 N(e,t){const r=t.accountNonce??0;return U(e,"supply",[p(e.caller),g(r),L(t.spokeId),I([...t.assets])])}function D(e,t){return N(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return U(e,"borrow",[p(e.caller),g(t.accountNonce),I([...t.borrows]),T(t.to,p)])}function W(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"withdraw",[p(e.caller),g(t.accountNonce),I([...t.withdrawals]),T(t.to,p)])}function z(e,t){return F(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return U(e,"repay",[p(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 V(e,t){return U(e,"liquidate",[p(e.caller),g(t.accountNonce),I([...t.debtPayments]),R(t.seizeMode??"Transfer")])}function X(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 j(e,t){return U(e,"get_liquidation_estimate",[g(t.accountNonce),I([...t.debtPayments]),R(t.seizeMode??"Transfer")])}const K=e=>(Array.isArray(e)?e:[]).map((e=>{const t=e;return{asset:String(t.asset),amount:String(t.amount)}}));function Z(e){const t=(0,s.scValToNative)(s.xdr.ScVal.fromXDR(e,"base64"));if(!t||"object"!=typeof t||Array.isArray(t))throw new Error("Stellar builder: liquidation estimate must be a struct");return{seizedCollaterals:K(t.seized_collaterals),protocolFees:K(t.protocol_fees),refunds:K(t.refunds),maxPaymentWad:String(t.max_payment_wad),bonusRateBps:String(t.bonus_rate_bps)}}function Y(e,t){return U(e,"flash_loan",[p(e.caller),A(t.hubId,t.asset),f(t.amount),p(t.receiver),C(t.data)])}function Q(e,t){return U(e,"migrate_from_blend",[p(e.caller),g(t.accountId),L(t.spokeId),h(t.hubId),p(t.blendPool),w(t.collateralTokens.map(p)),w(t.supplyTokens.map(p)),(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([p(t),f(r)]);var t,r}))))]);var r}function J(e,t){const r=t.accountNonce??0;return U(e,"multiply",[p(e.caller),g(r),L(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 ee(e,t){return U(e,"swap_debt",[p(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 te(e,t){return U(e,"swap_collateral",[p(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 re(e,t){return U(e,"repay_debt_with_collateral",[p(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),m(t.closePosition)])}var oe=r(928);const ne="/stellar-lending",ie=encodeURIComponent,ae=(e,t)=>e.fetchWithTimeout(`${ne}/context`,t),se=(e,t)=>e.fetchWithTimeout(`${ne}/live-state`,t),ue=(e,t)=>e.fetchWithTimeout(`${ne}/markets/detailed`,t),le=(e,t)=>e.fetchWithTimeout(`${ne}/assets`,t),de=(e,t)=>e.fetchWithTimeout(`${ne}/hubs`,t),ce=(e,t)=>e.fetchWithTimeout(`${ne}/spokes`,t),pe=(e,t={},r)=>e.fetchWithTimeout(`${ne}/reserves`,{...r,params:{...t}}),fe=(e,t,r,o,n)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}`,n),he=(e,t,r)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}`,r),ge=(e,t,r)=>e.fetchWithTimeout(`${ne}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${ne}/spokes/${t}`,r),ye=(e,t,r)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/positions`,r),be=(e,t,r)=>e.fetchWithTimeout(`${ne}/accounts/${ie(t)}/positions`,r),Se=(e,t,r)=>e.fetchWithTimeout(`/user/${ie(t)}/token-inventory`,r),we=async(e,t,r,o)=>{const n=await Se(e,t,o),i=e.chain===oe.sW.MAINNET?"mainnet":"testnet",a=(n?.tokens??[]).find((e=>e.identifier===r));if(a)return{owner:t,network:a.stellarNetwork??i,asset:r,amount:String(a.balance),decimals:a.decimals};const{decimals:s}=await he(e,r,o);if("number"!=typeof s)throw new Error(`Stellar lending: no decimals for ${r}; it is not a lending asset`);return{owner:t,network:i,asset:r,amount:"0",decimals:s}},ve=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/page`,{...o,params:{...r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/markets`,{...o,params:{side:r}}),Ae=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}/holders`,{...i,params:{side:n}}),xe=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/hubs/${t}/holders`,{...o,params:{side:r}}),Ie=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/spokes/${t}/holders`,{...o,params:{side:r}}),Re=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/graph`,{...o,params:{...r}}),Ee=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/hubs/${t}/graph`,{...o,params:{...r}}),Pe=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/spokes/${t}/graph`,{...o,params:{...r}}),ke=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}/graph`,{...i,params:{...n}}),_e=(e,t,r={},o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/activity`,{...o,params:{...r}}),qe=(e,t,r={},o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/activity/page`,{...o,params:{...r}}),Be=(e,t={},r)=>e.fetchWithTimeout(`${ne}/governance/proposals`,{...r,params:{...t}}),Oe=(e,t={},r)=>e.fetchWithTimeout(`${ne}/positions`,{...r,params:{...t}}),Ce=(e,t={},r)=>e.fetchWithTimeout(`${ne}/participants`,{...r,params:{...t}}),Me=(e,t={},r)=>e.fetchWithTimeout(`${ne}/liquidations/leaderboard`,{...r,params:{...t}}),Ue=(e,t={},r)=>e.fetchWithTimeout(`${ne}/distribution`,{...r,params:{...t}}),Le=(e,t={},r)=>e.fetchWithTimeout(`${ne}/campaign/leaderboard`,{...r,params:{...t}}),Ne=(e,t,r)=>e.fetchWithTimeout(`${ne}/stats/history`,{...r,params:{...t}}),De=(e,t,r)=>e.fetchWithTimeout(`${ne}/revenue`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${ne}/revenue/fees`,{...r,params:{...t}}),We=(e,t,r)=>e.fetchWithTimeout(`${ne}/liquidations`,{...r,params:{...t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${ne}/volume`,{...r,params:{...t}}),ze=(e,t,r)=>e.fetchWithTimeout(`${ne}/active-users`,{...r,params:{...t}}),Ge=(e,t,r)=>e.fetchWithTimeout(`${ne}/rate-spread`,{...r,params:{...t}}),He=(e,t,r)=>e.fetchWithTimeout(`${ne}/defillama`,{...r,params:{...t}}),Ve=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/history`,{...o,params:{...r}}),Xe=(e,t,r)=>e.fetchWithTimeout(`${ne}/pnl`,{...r,params:{accountId:t}}),je=(e,t,r)=>e.fetchWithTimeout(`${ne}/pnl/scope`,{...r,params:{scope:t}}),Ke=(e,t,r)=>e.fetchWithTimeout(`${ne}/campaign/me`,{...r,params:{owner:t}}),Ze=e=>({context:t=>ae(e,t),liveState:t=>se(e,t),marketsDetailed:t=>ue(e,t),assets:t=>le(e,t),hubs:t=>de(e,t),spokes:t=>ce(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?pe(e,t,r):pe(e,{},t),reserve:(t,r,o,n)=>fe(e,t,r,o,n),asset:(t,r)=>he(e,t,r),hub:(t,r)=>ge(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>ye(e,t,r),accountPositions:(t,r)=>be(e,t,r),walletTokens:(t,r)=>Se(e,t,r),walletBalance:(t,r,o)=>we(e,t,r,o),assetPage:(t,r,o)=>ve(e,t,r,o),assetMarkets:(t,r,o)=>Te(e,t,r,o),reserveHolders:(t,r,o,n,i)=>Ae(e,t,r,o,n,i),hubHolders:(t,r,o)=>xe(e,t,r,o),spokeHolders:(t,r,o)=>Ie(e,t,r,o),assetGraph:(t,r,o)=>Re(e,t,r,o),hubGraph:(t,r,o)=>Ee(e,t,r,o),spokeGraph:(t,r,o)=>Pe(e,t,r,o),reserveGraph:(t,r,o,n,i)=>ke(e,t,r,o,n,i),userActivity:(t,r={},o)=>_e(e,t,r,o),userActivityPage:(t,r={},o)=>qe(e,t,r,o),governanceProposals:(t={},r)=>Be(e,t,r),positionsLeaderboard:(t={},r)=>Oe(e,t,r),participants:(t={},r)=>Ce(e,t,r),liquidationsLeaderboard:(t={},r)=>Me(e,t,r),distribution:(t={},r)=>Ue(e,t,r),campaignLeaderboard:(t={},r)=>Le(e,t,r),statsHistory:(t,r)=>Ne(e,t,r),revenue:(t,r)=>De(e,t,r),feeRevenue:(t,r)=>$e(e,t,r),liquidations:(t,r)=>We(e,t,r),volume:(t,r)=>Fe(e,t,r),activeUsers:(t,r)=>ze(e,t,r),rateSpread:(t,r)=>Ge(e,t,r),defillama:(t,r)=>He(e,t,r),userHistory:(t,r,o)=>Ve(e,t,r,o),positionsPnl:(t,r)=>Xe(e,t,r),pnlByScope:(t,r)=>je(e,t,r),campaignMe:(t,r)=>Ke(e,t,r)});var Ye=r(468);const Qe=e=>E({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)}),Je=e=>E({asset_decimals:h(e.assetDecimals),asset_id:p(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:m(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)}),et=e=>E({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),tt=e=>{if("Token"in e&&e.Token)return w([b("Token"),p(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)}`)},rt=e=>{if("Stellar"in e)return w([b("Stellar"),p(e.Stellar)]);if("Symbol"in e)return w([b("Symbol"),b(e.Symbol)]);if("String"in e)return w([b("String"),y(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},ot=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)}`)},nt=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},it=e=>{if("Market"===e||"Fundamental"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},at=e=>{if("Reflector"in e){const t=e.Reflector;return w([b("Reflector"),E({asset:rt(t.asset),contract:p(t.contract),read_mode:ot(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([b("MultiFeed"),E({contract:p(t.contract),feed_id:y(t.feedId),kind:nt(t.kind),nature:it(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},st=e=>{const t=e;return E({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:at(t.provider)})},ut=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=>E({contract:p(e.contract),kind:nt(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},lt=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 E({asset_decimals:h(Number(t.assetDecimals)),independence:ut(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"),st(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([b("Scaled"),E({factor:st(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:tt(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([b("LpShare"),E({key_a:tt(t.keyA),key_b:tt(t.keyB),kind:w([b(t.kind||"ConstantProduct")]),pool:p(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:E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})};function dt(e,t){return U(e,"upgrade",[v(t.wasmHash)])}function ct(e,t){return U(e,"migrate",[h(t.newVersion)])}function pt(e){return U(e,"pause",[])}function ft(e){return U(e,"unpause",[])}function ht(e,t){return U(e,"grant_role",[p(t.account),b(t.role)])}function gt(e,t){return U(e,"revoke_role",[p(t.account),b(t.role)])}function mt(e,t){return U(e,"transfer_ownership",[p(t.newOwner),h(t.liveUntilLedger)])}function yt(e){return U(e,"accept_ownership",[])}function bt(e,t){return U(e,"set_swap_aggregator",[p(t.aggregator)])}function St(e,t){return U(e,"set_price_aggregator",[p(t.aggregator)])}function wt(e,t){return U(e,"set_accumulator",[p(t.accumulator)])}function vt(e,t){return U(e,"set_position_limits",[et(t)])}function Tt(e,t){return U(e,"approve_blend_pool",[p(t.pool)])}function At(e,t){return U(e,"revoke_blend_pool",[p(t.pool)])}function xt(e,t){return U(e,"set_oracle",[tt(t.key),lt(t.oracle)])}function It(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[tt(t.key),E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function Rt(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),A(t.hubId,t.asset),m(t.paused),m(t.frozen),m(t.noSeize)])}function Et(e,t){return U(e,"set_oracle_sanity_bounds",[p(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Pt(e,t){return U(e,"update_indexes",[p(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function kt(e,t){return U(e,"renew_account",[p(e.caller),g(t.accountNonce)])}function _t(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),p(t.asset),Je(t.params)])}function qt(e,t){return U(e,"upgrade_liquidity_pool_params",[A(t.hubId,t.asset),Qe(t.params)])}function Bt(e,t){return U(e,"claim_revenue",[p(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Ot(e,t){return U(e,"add_rewards",[p(e.caller),I(t.rewards)])}function Ct(e,t){return U(e,"update_account_threshold",[p(e.caller),m(t.hasRisks),w(t.accountNonces.map((e=>g(e))))])}const Mt="00".repeat(32),Ut=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)},Lt=(e,...t)=>w([b(e),...t]),Nt=e=>E({new_owner:p(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Dt=e=>E({asset:p(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:h(e.hubId),paused:m(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:m(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),$t=e=>E({account:p(e.account),role:b(e.role)});function Wt(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.sourceAccount??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 Ft=(e,t,r)=>Wt(e,"propose",[p(e.caller),t,Ut(r)]),zt=(e,t,r)=>Wt(e,"execute_self",[S(),t,Ut(r)]);function Gt(e,t,r){return Ft(e,Lt("SetSwapAggregator",p(t.aggregator)),r)}function Ht(e,t,r){return Ft(e,Lt("SetPriceAggregator",p(t.aggregator)),r)}function Vt(e,t,r){return Ft(e,Lt("SetAccumulator",p(t.accumulator)),r)}function Xt(e,t,r){return Ft(e,Lt("SetPositionLimits",et(t)),r)}function jt(e,t){return Ft(e,Lt("CreateHub"),t)}function Kt(e,t){return Ft(e,Lt("AddSpoke"),t)}function Zt(e,t,r){return Ft(e,Lt("RemoveSpoke",h(t.spokeId)),r)}function Yt(e,t,r){return Ft(e,Lt("AddAssetToSpoke",Dt(t)),r)}function Qt(e,t,r){return Ft(e,Lt("EditAssetInSpoke",Dt(t)),r)}function Jt(e,t,r){return Ft(e,Lt("RemoveAssetFromSpoke",E({hub_asset:A((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function er(e,t,r){return Ft(e,Lt("SetSpokeLiquidationCurve",E({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 tr(e,t,r){return Ft(e,Lt("SetPositionManager",p(t.manager),m(t.isActive)),r)}function rr(e,t,r){return Ft(e,Lt("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function or(e,t,r){return Ft(e,Lt("ApproveToken",p(t.token)),r)}function nr(e,t,r){return Ft(e,Lt("RevokeToken",p(t.token)),r)}function ir(e,t,r){return Ft(e,Lt("ApproveBlendPool",p(t.pool)),r)}function ar(e,t,r){return Ft(e,Lt("RevokeBlendPool",p(t.pool)),r)}function sr(e,t,r){return Ft(e,Lt("CreateLiquidityPool",E({asset:p((o=t).asset),hub_id:h(o.hubId),params:Je(o.params)})),r);var o}function ur(e,t,r){return Ft(e,Lt("UpgradeLiquidityPoolParams",E({hub_asset:A((o=t).hubId,o.asset),params:Qe(o.params)})),r);var o}function lr(e,t,r){return Ft(e,Lt("DeployPool",v(t.wasmHash)),r)}function dr(e,t,r){return Ft(e,Lt("UpgradePool",v(t.wasmHash)),r)}function cr(e,t,r){return Ft(e,Lt("UpgradeController",v(t.wasmHash)),r)}function pr(e,t,r){return Ft(e,Lt("MigrateController",h(t.newVersion)),r)}function fr(e,t,r){return Ft(e,Lt("TransferCtrlOwnership",Nt(t)),r)}function hr(e,t,r){return Ft(e,Lt("ConfigureAssetOracle",E({key:tt((o=t).key),oracle:lt(o.oracle)})),r);var o}function gr(e,t,r){return Ft(e,Lt("EditOracleTolerance",E({key:tt((o=t).key),tolerance:h(o.tolerance)})),r);var o}function mr(e,t,r){return Ft(e,Lt("UpgradeGov",v(t.wasmHash)),r)}function yr(e,t,r){return Ft(e,Lt("UpdateGovDelay",h(t.newDelay)),r)}function br(e,t,r){return Ft(e,Lt("GrantGovRole",$t(t)),r)}function Sr(e,t,r){return Ft(e,Lt("RevokeGovRole",$t(t)),r)}function wr(e,t,r){return Ft(e,Lt("TransferGovOwnership",Nt(t)),r)}function vr(e,t){const r=w(t.argsXdr.map((e=>s.xdr.ScVal.fromXDR(e,"base64")))),o=Ut(t.predecessor??Mt);return Wt(e,"execute",[S(),p(t.target),b(t.functionName),r,o,Ut(t.salt)])}function Tr(e,t,r){return zt(e,Lt("UpgradeGov",v(t.wasmHash)),r)}function Ar(e,t,r){return zt(e,Lt("UpdateGovDelay",h(t.newDelay)),r)}function xr(e,t,r){return zt(e,Lt("GrantGovRole",$t(t)),r)}function Ir(e,t,r){return zt(e,Lt("RevokeGovRole",$t(t)),r)}function Rr(e,t,r){return zt(e,Lt("TransferGovOwnership",Nt(t)),r)}const Er=e=>w(e.map(p));function Pr(e,t,r){return Wt(e,"propose_canceller_reset",[Er(t.newCancellers),Ut(r)])}function kr(e,t,r){return Wt(e,"execute_canceller_reset",[T(t.executor,p),Er(t.newCancellers),Ut(r)])}function _r(e,t){return Wt(e,"set_spoke_asset_flags",[p(e.caller),h(t.spokeId),A(t.hubId,t.asset),m(t.paused),m(t.frozen),m(t.noSeize)])}function qr(e,t){return Wt(e,"set_oracle_sanity_bounds",[p(e.caller),p(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Br(e){return Wt(e,"create_hub",[p(e.caller)])}function Or(e){return Wt(e,"add_spoke",[p(e.caller)])}function Cr(e,t){return Wt(e,"revoke_role_immediate",[p(t.account),b(t.role)])}function Mr(e){return Wt(e,"pause",[p(e.caller)])}function Ur(e,t){return Ft(e,Lt("Unpause"),t)}const Lr=e=>e.toXDR("base64"),Nr=e=>s.xdr.ScVal.fromXDR(e,"base64"),Dr=e=>e.map((e=>String((0,s.scValToNative)(Nr(e))))).join(":"),$r=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Wr=e=>Number(e),Fr=e=>String(e),zr=e=>e instanceof Uint8Array?u.hp.from(e).toString("hex"):u.hp.isBuffer(e)?e.toString("hex"):String(e),Gr=["None","Multiply","Long","Short"],Hr=["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","flash_pos"],Vr=e=>Array.isArray(e)?e:[],Xr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Hr[Wr(o)]??$r(o)),positionType:t,hubId:Wr(e[1]),asset:Fr(e[2]),scaledAmountRay:$r(e[3]),indexRay:$r(e[4]),amount:$r(e[5]),liquidationThresholdBps:r?void 0:Wr(e[6]),liquidationBonusBps:r?void 0:Wr(e[7]),loanToValueBps:r?void 0:Wr(e[8]),liquidationFeesBps:r?void 0:Wr(e[9])};var o},jr=e=>{return{owner:Fr(e[0]),spokeId:Wr(e[1]),mode:(t=e[2],Gr[Wr(t)]??"None")};var t},Kr=e=>Array.isArray(e)?e[1]:void 0,Zr=e=>{const t=(r=e,Array.isArray(r)?Fr(r[0]):Fr(r));var r;if("Token"===t)return{Token:Fr(Kr(e))};if("Ref"===t)return{Ref:Fr(Kr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Fr(t.Token)};if(void 0!==t.Ref)return{Ref:Fr(t.Ref)}}return{Token:Fr(e)}},Yr=e=>{const t=e.tolerance??{};return{assetDecimals:Wr(e.asset_decimals),maxPriceStaleSeconds:Wr(e.max_price_stale_seconds),sources:Vr(e.sources).map((e=>e)),tolerance:{upperRatio:Wr(t.upper_ratio_bps),lowerRatio:Wr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:$r(e.min_sanity_price_wad),maxSanityPriceWad:$r(e.max_sanity_price_wad)}},Qr={"market:create":e=>({topic:"market:create",data:{hubId:Wr(e.hub_id),baseAsset:Fr(e.base_asset),maxBorrowRate:$r(e.max_borrow_rate),baseBorrowRate:$r(e.base_borrow_rate),slope1:$r(e.slope1),slope2:$r(e.slope2),slope3:$r(e.slope3),midUtilization:$r(e.mid_utilization),optimalUtilization:$r(e.optimal_utilization),maxUtilization:$r(e.max_utilization),reserveFactor:Wr(e.reserve_factor),marketAddress:Fr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{hubId:void 0===e.hub_id?void 0:Wr(e.hub_id),asset:Fr(e.asset),maxBorrowRateRay:$r(e.max_borrow_rate),baseBorrowRateRay:$r(e.base_borrow_rate),slope1Ray:$r(e.slope1),slope2Ray:$r(e.slope2),slope3Ray:$r(e.slope3),midUtilizationRay:$r(e.mid_utilization),optimalUtilizationRay:$r(e.optimal_utilization),maxUtilizationRay:$r(e.max_utilization),reserveFactorBps:Wr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Vr(e).map((e=>{return t=Vr(e),{hubId:Wr(t[0]),asset:Fr(t[1]),timestamp:Wr(t[2]),supplyIndexRay:$r(t[3]),borrowIndexRay:$r(t[4]),cash:$r(t[5]),suppliedRay:$r(t[6]),borrowedRay:$r(t[7]),revenueRay:$r(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Vr(e).map((e=>{const t=e;return{hubId:Wr(t.hub_id),asset:Fr(t.asset),params:(r=t.params,{maxBorrowRateRay:$r(r.max_borrow_rate),baseBorrowRateRay:$r(r.base_borrow_rate),slope1Ray:$r(r.slope1),slope2Ray:$r(r.slope2),slope3Ray:$r(r.slope3),midUtilizationRay:$r(r.mid_utilization),optimalUtilizationRay:$r(r.optimal_utilization),maxUtilizationRay:$r(r.max_utilization),reserveFactorBps:Wr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Wr(r.flashloan_fee),assetId:Fr(r.asset_id),assetDecimals:Wr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Vr(e);return{topic:"position:batch_update",data:{accountId:$r(t[0]),accountAttributes:jr(Vr(t[1])),updates:[...Vr(t[2]).map((e=>Xr(Vr(e),"Deposit"))),...Vr(t[3]).map((e=>Xr(Vr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),receiver:Fr(e.receiver),caller:Fr(e.caller),amount:$r(e.amount),fee:$r(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Zr(e.key),oracle:Yr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Fr(e.asset),oracle:Yr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Fr(e.liquidator),accountId:$r(e.account_id),repaidUsdWad:$r(e.repaid_usd_wad),bonusBps:$r(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:$r(e.account_id),totalBorrowUsdWad:$r(e.total_borrow_usd_wad),totalCollateralUsdWad:$r(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Fr(e.token),amount:$r(e.amount),usdValueWad:void 0===e.usd_value_wad?void 0:$r(e.usd_value_wad),accountId:$r(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),amount:$r(e.amount),fee:$r(e.fee),amountSent:$r(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Fr(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:zr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Fr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Fr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Fr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Fr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:zr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Wr(e.max_supply_positions),maxBorrowPositions:Wr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:$r(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Fr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Wr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:$r(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:$r(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Wr(t.liquidation_bonus_factor_bps)}}},"position:flash_position":e=>({topic:"position:flash_position",data:{accountId:$r(e.account_id),hubId:Wr(e.hub_id),asset:Fr(e.asset),receiver:Fr(e.receiver),caller:Fr(e.caller),amount:$r(e.amount),amountReceived:$r(e.amount_received),fee:$r(e.fee)}}),"revenue:claim":e=>({topic:"revenue:claim",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),caller:Fr(e.caller),accumulator:Fr(e.accumulator),amount:$r(e.amount)}}),"account:delegate":e=>({topic:"account:delegate",data:{accountId:$r(e.account_id),owner:Fr(e.owner),delegate:Fr(e.delegate),granted:Boolean(e.granted)}}),"config:hub":e=>({topic:"config:hub",data:{hubId:Wr(e.hub_id)}}),"config:spoke_asset":e=>{const t=e.config;return{topic:"config:spoke_asset",data:{spokeId:Wr(e.spoke_id),hubId:Wr(e.hub_id),asset:Fr(e.asset),config:{isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),paused:Boolean(t.paused),frozen:Boolean(t.frozen),noSeize:Boolean(t.no_seize),loanToValueBps:Wr(t.loan_to_value),liquidationThresholdBps:Wr(t.liquidation_threshold),liquidationBonusBps:Wr(t.liquidation_bonus),liquidationFeesBps:Wr(t.liquidation_fees),supplyCap:$r(t.supply_cap),borrowCap:$r(t.borrow_cap)}}}},"config:remove_spoke_asset":e=>({topic:"config:remove_spoke_asset",data:{spokeId:Wr(e.spoke_id),hubId:Wr(e.hub_id),asset:Fr(e.asset)}}),"strategy:blend_migration":e=>({topic:"strategy:blend_migration",data:{accountId:$r(e.account_id),blendPool:Fr(e.blend_pool),collateralCount:Wr(e.collateral_count),supplyCount:Wr(e.supply_count),debtCount:Wr(e.debt_count)}}),"strategy:harvest":e=>({topic:"strategy:harvest",data:{from:Fr(e.from),amount:$r(e.amount),pricePerShare:$r(e.price_per_share)}}),"governance:deploy_controller":e=>({topic:"governance:deploy_controller",data:{controller:Fr(e.controller),wasmHash:zr(e.wasm_hash)}}),"governance:deploy_price_aggregator":e=>({topic:"governance:deploy_price_aggregator",data:{priceAggregator:Fr(e.price_aggregator),wasmHash:zr(e.wasm_hash)}})},Jr=Object.freeze(Object.keys(Qr));function eo(e,t){const r=Dr(e),o=Qr[r];return o?o((0,s.scValToNative)(Nr(t))):null}const to=1e4;function ro(e,t){return`${e}-${BigInt(t).toString(10)}`}function oo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function no(e,t=0){return e*to+t}function io(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const ao=(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 so(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=ao(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,sourceAccount:e.sourceAccount,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 uo(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=ao(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 lo(e,t){const r=e[t];return"function"==typeof r?r.call(e):r}function co(e){if(!e||"object"!=typeof e)return;const t=e;return"function"==typeof t.switch?t.switch().name:t.type}function po(e){return fo(lo(e,"bytes"))}function fo(e){const t=e;return u.hp.from("value"in t?t.value:t)}const ho=16384;class go extends Error{code;constructor(e,t){super(`Stellar route verification failed [${e}]: ${t}`),this.name="StellarRouteVerificationError",this.code=e}}const mo=(e,t)=>{throw new go(e,t)};function yo(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*ho)return mo("OVERSIZED",`encoded route has ${t.length} characters`);try{return po(O(e))}catch(e){return mo("MALFORMED",e instanceof Error?e.message:String(e))}})(e);0===t.length&&mo("MALFORMED","route is empty"),t.length>ho&&mo("OVERSIZED",`route has ${t.length} bytes, above ${ho}`);const r=(e=>{let t;try{t=s.xdr.ScVal.fromXDR(e)}catch(e){return mo("MALFORMED",`payload is not one XDR ScVal: ${e instanceof Error?e.message:String(e)}`)}if("scvMap"!==co(t))return mo("MALFORMED","payload must be a StrategyPayload map");const r=lo(t,"map")??[];if("amounts,assets,ops"!==r.map((e=>"scvSymbol"===co(lo(e,"key"))?lo(lo(e,"key"),"sym").toString():"")).join(","))return mo("MALFORMED","payload fields must be exactly amounts, assets, ops");const[o,n,i]=r.map((e=>lo(e,"val")));return"scvVec"!==co(o)||"scvVec"!==co(n)||"scvBytes"!==co(i)?mo("MALFORMED","payload field has the wrong type"):{amounts:lo(o,"vec")??[],assets:lo(n,"vec")??[],ops:po(i)}})(t),o=r.assets.length,n=r.amounts.length;0===o&&mo("MALFORMED","asset registry is empty"),(o>256||n>126)&&mo("OVERSIZED",`registries hold ${o} assets and ${n} amounts`);const i=r.assets.map(((e,t)=>"scvAddress"!==co(e)?mo("MALFORMED",`assets[${t}] is not an address`):s.Address.fromScAddress(lo(e,"address")).toString())),a=r.amounts.map(((e,t)=>"scvI128"!==co(e)?mo("MALFORMED",`amounts[${t}] is not an i128`):(0,s.scValToBigInt)(e))),u=r.ops;u.length<10&&mo("MALFORMED","program header is truncated"),u.length>346&&mo("OVERSIZED",`program has ${u.length} bytes, above 346`);const p=e=>{const t=u[e];return void 0===t?mo("MALFORMED",`program byte ${e} is missing`):t},f=p(0);1!==f&&mo("UNSUPPORTED_VERSION",`program version ${f}, expected 1`);const h=p(8),g=p(9);0===h&&mo("INVALID_STRUCTURE","program has no instructions"),(h>48||g>32)&&mo("OVERSIZED",`program declares ${h} instructions and ${g} weights`);const m=10+5*h;u.length!==m+3*g&&mo("MALFORMED","program length does not match its instruction and weight counts");const y=p(1),b=p(2),S=p(3);(y>=o||b>=o||S>=n)&&mo("MALFORMED","header index is outside its registry"),y===b&&mo("INVALID_STRUCTURE","token_in equals token_out");const w=u.readUInt32BE(4),v=[];for(let e=0;e<g;e+=1){const t=u.readUIntBE(m+3*e,3);(0===t||t>c)&&mo("INVALID_STRUCTURE",`split weight ${t} outside 1..=1000000`),v.push(t)}const T=e=>i[e]??mo("MALFORMED",`asset index ${e} is outside the registry`),A=e=>a[e]??mo("MALFORMED",`amount index ${e} is outside the registry`),x=[];let I;for(let e=0;e<h;e+=1){const t=10+5*e,r=p(t),o=p(t+1),i=p(t+2),a=p(t+3),s=p(t+4),u=l.find((e=>d[e]===r));let c;if(u||5===r||6===r||mo("UNKNOWN_OPCODE",`instruction ${e} has opcode ${r}`),0===o)c={kind:"all"};else if(1===o)void 0!==I&&I===a||mo("INVALID_STRUCTURE",`instruction ${e} does not chain onto its predecessor`),c={kind:"prev"};else if(o>=128){const t=v[o-128];void 0===t&&mo("MALFORMED",`instruction ${e} weight index is out of range`),c={kind:"ppm",ppm:t}}else c={kind:"fixed",amount:A(o-2)};const f=T(i);5!==r&&6!==r?(a===s&&mo("INVALID_STRUCTURE",`instruction ${e} swaps a token for itself`),x.push({kind:"swap",venue:u,mode:c,pool:f,tokenIn:T(a),tokenOut:T(s)}),I=s):("all"!==c.kind&&mo("MALFORMED",`liquidity instruction ${e} must use mode All`),s>=n&&mo("MALFORMED",`instruction ${e} amount index is out of range`),x.push({kind:5===r?"burn":"mint",pool:f,shareToken:T(a),amountIndex:s}),I=6===r?a:void 0)}const R=A(S);return R<=0n&&mo("MIN_OUT_TOO_LOW",`encoded total_min_out is ${R}`),{version:f,tokenIn:T(y),tokenOut:T(b),totalMinOut:R,referralId:w,assets:i,amounts:a,ops:x,weights:v}}function bo(e,t){if(s.StrKey.isValidContract(e))return e;if(!t)return mo("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 mo("MALFORMED",`token id ${e} is not a contract id or a classic asset`)}}const So=(e,t)=>"bigint"==typeof e?e:/^\d+$/.test(e)?BigInt(e):mo("EXPECTATION_MISSING",`${t} must be a base-unit integer string`);function wo(e,t){const r=So(t.minOut,"expected.minOut");r<=0n&&mo("EXPECTATION_MISSING","expected.minOut must be positive");const o=yo(e);if(o.tokenIn!==t.tokenIn&&mo("TOKEN_IN_MISMATCH",`route spends ${o.tokenIn}, expected ${t.tokenIn}`),o.tokenOut!==t.tokenOut&&mo("TOKEN_OUT_MISMATCH",`route delivers ${o.tokenOut}, expected ${t.tokenOut}`),o.totalMinOut<r&&mo("MIN_OUT_TOO_LOW",`route enforces a minimum of ${o.totalMinOut}, below the expected ${r}`),void 0!==t.amountIn){const e=So(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&&mo("AMOUNT_IN_EXCEEDED",`a leg spends ${t.mode.amount}, above the input ${e}`)}return o}const vo=e=>k(e).toXDR("base64");function To(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.sourceAccount??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",p(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ao(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(Io),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Io),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function xo(e,t={}){const r=t.expected??{},o="string"==typeof e.routeXdr&&e.routeXdr.length>0?{routeXdr:e.routeXdr}:Ao(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 go("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 go("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return wo(o,{tokenIn:bo(r.tokenIn??e.from,t.network),tokenOut:bo(r.tokenOut??e.to,t.network),minOut:n,amountIn:r.amountIn??e.amountIn}),o}const Io=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Ro(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"!==co(r))continue;const a=lo(r,"invokeContract");if(s.Address.fromScAddress(lo(a,"contractAddress")).toString()!==o||"execute_strategy"!==lo(a,"functionName").toString())continue;const u=lo(a,"args"),[d,c,p]=u;if(3!==u.length||!d||!c||!p||"scvAddress"!==co(d)||"scvI128"!==co(c)||"scvBytes"!==co(p))return null;if(s.Address.fromScAddress(lo(d,"address")).toString()!==n)continue;const f=(0,s.scValToBigInt)(c);if(f<=0n)return null;const h=yo(po(p));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 Eo 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 Po=e=>e&&"scvAddress"===co(e)?s.Address.fromScAddress(lo(e,"address")).toString():void 0,ko=e=>e&&"scvI128"===co(e)?(0,s.scValToBigInt)(e):void 0,_o=e=>e&&"scvVec"===co(e)?lo(e,"vec")??[]:void 0,qo=(e,t)=>{if(!e||"scvMap"!==co(e))return;const r=(lo(e,"map")??[]).find((e=>"scvSymbol"===co(lo(e,"key"))&&lo(lo(e,"key"),"sym").toString()===t));return r?lo(r,"val"):void 0},Bo=e=>Po(e)??ko(e)?.toString()??e.toXDR("base64"),Oo=e=>({contract:s.Address.fromScAddress(lo(e,"contractAddress")).toString(),fn:lo(e,"functionName").toString(),args:lo(e,"args").map(Bo)}),Co=e=>{const t=lo(e,"function");return"sorobanAuthorizedFunctionTypeContractFn"===co(t)?lo(t,"contractFn"):void 0};function Mo(e,t,r){const o=e.filter((e=>{const o=lo(e,"credentials"),n=co(o);if("sorobanCredentialsAddress"!==n&&"sorobanCredentialsSourceAccount"!==n)throw new Eo("MALFORMED_TRANSACTION","unsupported authorization credentials");return("sorobanCredentialsAddress"===n?s.Address.fromScAddress(lo(lo(o,"address"),"address")).toString():r??t.caller)===t.caller}));if(o.length>1)throw new Eo("DUPLICATE_ENTRY",`${o.length} authorization entries for ${t.caller}, expected one`);const n=o[0];if(!n)return;const i=Co(lo(n,"rootInvocation"));if(!i)throw new Eo("UNEXPECTED_ROOT","root is not a contract call");const a=Oo(i);if(a.contract!==t.root.contract||a.fn!==t.root.fn)throw new Eo("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 lo(lo(n,"rootInvocation"),"subInvocations")){const r=Co(e);if(!r)throw new Eo("UNEXPECTED_CALL","sub-invocation is not a contract call");const o=Oo(r);if(lo(e,"subInvocations").length>0)throw new Eo("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(lo(r,"args"));if(i)throw new Eo("UNEXPECTED_CALL",i,o);if(l[n]=(l[n]??0)+1,(l[n]??0)>e.maxCount)throw new Eo("UNEXPECTED_CALL",`more than ${e.maxCount} calls`,o);continue}if("transfer"!==o.fn||3!==lo(r,"args").length)throw new Eo("UNEXPECTED_CALL","only `transfer` is allowed",o);if(!t.transfers.some((e=>e.token===o.contract)))throw new Eo("UNEXPECTED_TOKEN","transfer on an unexpected token",o);const[i,a,s]=lo(r,"args");if(Po(i)!==t.caller)throw new Eo("UNEXPECTED_SENDER","transfer is not from the caller",o);const d=Po(a),c=t.transfers.findIndex((e=>e.token===o.contract&&e.to===d));if(-1===c)throw new Eo("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",o);const p=ko(s),f=t.transfers[c],h=(u[c]??0n)+(p??0n);if(void 0===p||p<=0n||h>f.maxAmount)throw new Eo("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,o);u[c]=h}}const Uo=e=>{throw new Eo("MALFORMED_TRANSACTION",e)},Lo=(e,t)=>{const r=new Map;for(const t of _o(e)??Uo("payments argument is not a vector")){const[e,o]=_o(t)??[],n=Po(qo(e,"asset")),i=ko(o);if(void 0===n||void 0===i||i<0n)return Uo("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})))},No=new Set([1,3,5]),Do=(e,t,r)=>({contract:e,fn:"submit",maxCount:2,reject:e=>{if(4!==e.length)return"submit must have four arguments";if(Po(e[0])!==t)return"`from` is not the caller";if(Po(e[1])!==r||Po(e[2])!==r)return"`spender` and `to` must be the lending controller";const o=_o(e[3]);if(!o)return"requests is not a vector";for(const e of o){const t=qo(e,"request_type");if(!t||"scvU32"!==co(t)||!No.has(lo(t,"u32")))return"request is not a withdraw, withdraw-collateral, or repay"}}});function $o(e,t,r){const{contract:o,fn:n}=Oo(t),i=lo(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=ko(i[1]);if(Po(i[0])!==e||void 0===t||"scvBytes"!==co(i[2]))return Uo("execute_strategy arguments must be (caller, total_in, swap_xdr)");const r=yo(po(i[2]));return a.transfers=[{token:r.tokenIn,to:o,maxAmount:t}],a.calls=[{contract:r.tokenOut,fn:"trust",maxCount:1,reject:t=>1===t.length&&Po(t[0])===e?void 0:"`trust` is not for the caller"}],a}if(o!==r.lendingController)throw new Eo("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${o}; pass an explicit policy`);if(Po(i[0])!==e)throw new Eo("CALLER_MISMATCH",`${n} is not invoked for ${e}`);switch(n){case"supply":a.transfers=Lo(i[3],r.lendingPool);break;case"repay":case"liquidate":a.transfers=Lo(i[2],r.lendingPool);break;case"multiply":{const e=i[8];e&&"scvVoid"!==co(e)&&(a.transfers=Lo(s.xdr.ScVal.scvVec([e]),o));break}case"migrate_from_blend":{const t=Po(i[4])??Uo("blend_pool is not an address");a.calls=[Do(t,e,o)];break}}return a}const Wo=e=>s.StrKey.encodeEd25519PublicKey(fo("keyTypeMuxedEd25519"===co(e)?lo(lo(e,"med25519"),"ed25519"):lo(e,"ed25519"))),Fo=e=>{let t;try{t=s.xdr.TransactionEnvelope.fromXDR(e,"base64")}catch{return Uo("not a transaction envelope")}if("envelopeTypeTx"!==co(t))return Uo("expected a regular (v1) transaction");const r=lo(lo(t,"v1"),"tx"),o=lo(r,"operations")[0];if(!o||1!==lo(r,"operations").length)return Uo("expected exactly one operation");const n=lo(o,"body");if("invokeHostFunction"!==co(n))return Uo("operation is not a contract invocation");const i=lo(n,"invokeHostFunctionOp");return"hostFunctionTypeInvokeContract"!==co(lo(i,"hostFunction"))?Uo("host function is not a contract call"):{source:Wo(lo(o,"sourceAccount")??lo(r,"sourceAccount")),transactionSource:Wo(lo(r,"sourceAccount")),op:i,call:lo(lo(i,"hostFunction"),"invokeContract")}};function zo(e,t){const r=Fo(e);if(void 0!==t.builtXdr){const e=Fo(t.builtXdr);if(e.source!==r.source||e.transactionSource!==r.transactionSource)throw new Eo("SOURCE_CHANGED","the prepared transaction changes the source account")}if(void 0!==t.builtXdr&&lo(Fo(t.builtXdr).op,"hostFunction").toXDR("base64")!==lo(r.op,"hostFunction").toXDR("base64"))throw new Eo("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Oo(r.call));const o=t.policy??$o(t.caller,r.call,{...i(t.network),...t.deployment});if(o.caller!==t.caller)throw new Eo("CALLER_MISMATCH","the policy caller differs from the authorizing caller");if(t.caller!==r.source)for(const e of lo(r.op,"auth")){const t=lo(e,"credentials");if("sorobanCredentialsSourceAccount"===co(t)||"sorobanCredentialsAddress"===co(t)&&s.Address.fromScAddress(lo(lo(t,"address"),"address")).toString()===r.source)throw new Eo("UNEXPECTED_SENDER","the separate source account must not authorize contract calls")}Mo(lo(r.op,"auth"),o,r.source)}function Go(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Ho(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{if(r?.authorization){if(!r.network)throw new Error("network is required for address authorization");return await async function(e,t,r,o,n){if("innerTransaction"in t||0!==t.signatures.length||1!==t.operations.length)throw new Error("address authorization requires an unsigned single-operation transaction");const i=t.operations[0];if("invokeHostFunction"!==i.type)throw new Error("address authorization requires a contract invocation");const u=s.TransactionBuilder.cloneFrom(t).clearOperations().addOperation(s.Operation.invokeHostFunction({...i,auth:[]})).build(),l={cpuInstructions:o},d=await e.simulateTransaction(u,l,"record");if(s.rpc.Api.isSimulationError(d))throw new Error(d.error);const c=s.rpc.assembleTransaction(u,d).build();zo(c.toXDR(),{...n,network:r,builtXdr:t.toXDR()});const p=c.operations[0];if("invokeHostFunction"!==p.type)throw new Error("simulation changed the operation type");const f=p.auth??[];for(const e of f){const t=lo(lo(e,"rootInvocation"),"function");if("sorobanAuthorizedFunctionTypeContractFn"!==co(t)||lo(t,"contractFn").toXDR("base64")!==lo(p.func,"invokeContract").toXDR("base64"))throw new Error("recorded authorization root differs from the built invocation");const r=lo(e,"credentials"),o=co(r);if("sorobanCredentialsSourceAccount"!==o&&("sorobanCredentialsAddress"!==o||s.Address.fromScAddress(lo(lo(r,"address"),"address")).toString()!==n.caller))throw new Error("unexpected signer in recorded address authorization")}const h=[],g=Object.freeze({networkPassphrase:a[r],latestLedger:d.latestLedger});for(const e of f){const t=lo(e,"credentials");if("sorobanCredentialsSourceAccount"===co(t)){h.push(e);continue}const r=s.xdr.SorobanAuthorizationEntry.fromXDR(await n.authorizeEntry(e.toXDR("base64"),g),"base64"),o=lo(r,"credentials");if("sorobanCredentialsAddress"!==co(o))throw new Error("authorization callback changed the credentials type");const i=lo(t,"address"),a=lo(o,"address");if(lo(i,"address").toXDR("base64")!==lo(a,"address").toXDR("base64")||lo(i,"nonce").toString()!==lo(a,"nonce").toString()||lo(e,"rootInvocation").toXDR("base64")!==lo(r,"rootInvocation").toXDR("base64"))throw new Error("authorization callback changed the signer, nonce or invocation");h.push(r)}const m=s.TransactionBuilder.cloneFrom(c).clearOperations().addOperation(s.Operation.invokeHostFunction({...p,auth:h})).build(),y=await e.simulateTransaction(m,l,"enforce");if(s.rpc.Api.isSimulationError(y))throw new Error(y.error);return s.rpc.assembleTransaction(m,y).build().toXDR()}(e,n,r.network,o,r.authorization)}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 Go(r.invokedContractId,e);throw e}}async function Vo(e,t,r){return Ho(e,t.xdr,r)}function Xo(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 jo(e,t){return new Uint8Array(0)}const Ko=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 Zo(e){const t=new s.Account(e.sourceAccount??e.caller,e.sourceSequence),r=new s.Contract(e.forwarderAddress).call("mint_and_forward",s.xdr.ScVal.scvBytes(Ko(e.message)),s.xdr.ScVal.scvBytes(Ko(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 Yo=10n**27n,Qo=10n**18n,Jo=10000n,en=27,tn=18;function rn(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 on(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return e*t/r}function nn(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 an(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return(e*t+r/2n)/r}function sn(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 un=e=>10n**BigInt(e);function ln(e,t,r){return t===r?e:r>t?e*un(r-t):e/un(t-r)}function dn(e,t,r){if(t===r)return e;if(r>t)return e*un(r-t);const o=un(t-r),n=e/o;return e%o===0n?n:n+1n}function cn(e,t,r){return t===r?e:r>t?e*un(r-t):sn(e,un(t-r))}const pn={floor:on,ceil:nn,halfUp:an},fn={floor:ln,ceil:dn,halfUp:cn};function hn(e,t,r,o){return fn[o](pn[o](e,t,Yo),en,r)}function gn(e,t,r){return hn(rn(e,"scaledRay"),rn(t,"indexRay"),r,"floor")}function mn(e,t,r){return hn(rn(e,"scaledRay"),rn(t,"indexRay"),r,"ceil")}function yn(e,t,r){return hn(rn(e,"scaledRay"),rn(t,"indexRay"),r,"halfUp")}function bn(e,t){if(t>en)throw new Error(`Stellar math: decimals ${t} exceed RAY scale`);return ln(e,t,en)}function Sn(e,t,r,o){const n=pn[o](e,t,Yo),i=fn[o](n,en,tn);return pn[o](i,r,Qo)}function wn(e,t,r,o){const n=fn[o](bn(e,t),en,tn);return pn[o](n,r,Qo)}const vn=e=>Number(e)/1e18,Tn=e=>Number(e)/1e27,An=(e,t)=>Number(e)/10**t;function xn(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 In=e=>xn(e,tn),Rn=(e,t)=>an(e,t,Yo),En=(e,t)=>an(e,Yo,t);function Pn(e,t){return 0n===t?0n:En(e,t)}function kn(e,t){const r=e>Yo?Yo:e,o=rn(t.baseRateRay,"irm.baseRateRay"),n=rn(t.slope1Ray,"irm.slope1Ray"),i=rn(t.slope2Ray,"irm.slope2Ray"),a=rn(t.slope3Ray,"irm.slope3Ray"),s=rn(t.midUtilizationRay,"irm.midUtilizationRay"),u=rn(t.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=rn(t.maxBorrowRateRay,"irm.maxBorrowRateRay");let d;if(r<s)d=o+En(Rn(r,n),s);else if(r<u){const e=u-s;d=o+n+En(Rn(r-s,i),e)}else{const e=Yo-u;d=o+n+i+(0n===e?0n:En(Rn(r-u,a),e))}return d>l?l:d}function _n(e,t,r){return 0n===e||!Number.isInteger(r)||r<0||r>=1e4?0n:an(Rn(e,t),Jo-BigInt(r),Jo)}const qn=e=>Tn(e),Bn=e=>Math.expm1(Tn(e)),On=5n*Qo,Cn=(e,t,r)=>`${e}:${t}:${r}`;function Mn(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[Cn(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 ${Cn(t,r,o)}`);return i}const Un=/^0*[1-9]\d*$/,Ln=e=>"string"==typeof e&&Un.test(e)?BigInt(e).toString():null,Nn=(e,t)=>`${e}:${t}`;function Dn(e){const t=new Map,r=new Map,o=new Set,n=new Set;for(const i of e?.indexes??[]){const e=Nn(i.hubId,i.asset),a=Ln(i.supplyIndex),s=Ln(i.borrowIndex),u=Ln(i.usdPrice),l=t.get(e),d=l&&Ln(l.supplyIndex)===a&&Ln(l.borrowIndex)===s&&Ln(l.usdPrice)===u;null==a||null==s||null==u||l&&!d?o.add(e):l||t.set(e,i);const c=!1===i.valid||!0===i.stale||!0===i.deviation,p=r.get(i.asset);null==u||c||void 0!==p&&p.toString()!==u?n.add(i.asset):void 0===p&&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)=>on(e,BigInt(t),Jo);function Wn(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:vn(e.priceWad),amountBase:t.toString(),amountShort:An(t,e.decimals),usdWad:r.toString(),usd:vn(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 Fn(e){if("supply"===e.side)return Wn(e,hn(e.scaledRay,e.indexRay,e.decimals,"floor"),Sn(e.scaledRay,e.indexRay,e.priceWad,"halfUp"),Sn(e.scaledRay,e.indexRay,e.priceWad,"floor"));const t=hn(e.scaledRay,e.indexRay,e.decimals,"ceil"),r=Sn(e.scaledRay,e.indexRay,e.priceWad,"ceil");return Wn(e,t,r,r)}function zn(e,t,r,o){const n=bn(t,r);return"supply"===e?on(n,Yo,o):nn(n,Yo,o)}function Gn(e,t,r,o){const n=bn(t,r);return"supply"===e?nn(n,Yo,o):on(n,Yo,o)}function Hn(e,t){return Fn({...e,scaledRay:zn(e.side,t,e.decimals,e.indexRay)})}const Vn=(...e)=>{for(const t of e){const e=Ln(t);if(null!=e)return BigInt(e)}return Yo};function Xn(e,t,r,o){const n=rn("supply"===e?t.supplyScaledRay:t.borrowScaledRay,`${e}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(Nn(t.hubId,t.asset)),a=o.prices.get(t.asset),s="supply"===e?Vn(i?.supplyIndex,t.liveSupplyIndexRay,r.liveSupplyIndexRay,t.supplyIndexRay):Vn(i?.borrowIndex,t.liveBorrowIndexRay,r.liveBorrowIndexRay,t.borrowIndexRay),u=a??In(r.usdPrice);return Fn({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 jn=(e,t)=>e.reduce(((e,r)=>e+BigInt(t(r))),0n);function Kn(e,t,r,o,n){const i=jn(t,(e=>e.usdWad)),a=jn(t,(e=>e.ltvWeightedUsdWad)),s=jn(t,(e=>e.liquidationWeightedUsdWad)),u=jn(r,(e=>e.usdWad)),l=0n===u?null:on(s,Qo,u),d=0n===s?0:Number(u)/Number(s)*100,c=a<o||a<=u?0n:a-u;return{...e,supplies:t,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:vn(i),ltvWeightedCollateralUsdWad:a.toString(),ltvWeightedCollateralUsd:vn(a),liquidationWeightedCollateralUsdWad:s.toString(),liquidationWeightedCollateralUsd:vn(s),totalDebtUsdWad:u.toString(),totalDebtUsd:vn(u),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:vn(l),healthPercent:d,borrowLimitUsdWad:a.toString(),borrowLimitUsd:vn(a),availableBorrowUsdWad:c.toString(),availableBorrowUsd:vn(c),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:vn(o),isLiquidatable:null!==l&&l<Qo,liveDataValid:n}}function Zn(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=Dn(o),a=[],s=[];for(const e of t){const t=Mn(r,e.spokeId,e.hubId,e.asset),o=Xn("supply",e,t,i);o&&a.push(o);const n=Xn("borrow",e,t,i);n&&s.push(n)}const u=null!=o?.minBorrowCollateralUsdWad?rn(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):On,l=void 0!==o&&[...a,...s].every((e=>e.liveDataUsed));return Kn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},a,s,u,l)}const Yn=200n,Qn=e=>e.reduce(((e,t)=>t.amount<e.amount?t:e)),Jn=e=>e<0n?0n:e,ei=(e,t,r,o)=>({amountBase:e.amount,amountShort:An(e.amount,t),isFullClose:r,reason:e.reason,projectedUtilization:o}),ti=e=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:e,projectedUtilization:null});function ri(e){const t=e.assetDecimals,r=rn(e.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:xn(e.hubPool.suppliedShort,t),borrowedBase:xn(e.hubPool.borrowedShort,t),cashBase:xn(e.availableLiquidityShort,t),spokeSuppliedBase:xn(e.suppliedShort,t),spokeBorrowedBase:xn(e.borrowedShort,t),maxUtilizationRay:r>=Yo?null:r}}const oi=(e,t)=>e<=0n?null:Number(t)/Number(e);function ni(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 ii=(e,t)=>e.find((e=>e.hubId===t.hubId&&e.asset===t.asset));function ai(e,t,r){if(t.paused)return ti("paused");if(t.frozen)return ti("frozen");if(!t.isBorrowable)return ti("cap");const o=t.assetDecimals,n=ri(t),i=ii(e.borrows,t),a=Dn(r).indexes.get(Nn(t.hubId,t.asset)),s=i?BigInt(i.indexRay):rn(a?.borrowIndex??t.liveBorrowIndexRay,"borrowIndex"),u=i?BigInt(i.usdPriceWad):function(e,t){return Dn(t).prices.get(e.asset)??In(e.usdPrice)}(t,r),l=i?BigInt(i.scaledRay):0n,d=BigInt(e.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),c=BigInt(e.ltvWeightedCollateralUsdWad),p=BigInt(e.minBorrowCollateralUsdWad),f=[];if(c<p)f.push({amount:0n,reason:"minCollateral"});else{const t=c-BigInt(e.totalDebtUsdWad),r=t<=0n||u<=0n?0n:on(t,10n**BigInt(o),u),n=e=>d+Sn(l+zn("borrow",e,o,s),s,u,"ceil");f.push({amount:0n===r?0n:ni(r+16n,(e=>n(e)<=c)),reason:"ltv"})}f.push({amount:Jn(rn(t.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=an(n.suppliedBase,Yn,Jo);f.push({amount:Jn(n.cashBase-h),reason:"liquidity"});const g=function(e,t){const r=e.maxUtilizationRay;if(null===r)return null;const o=bn(e.suppliedBase,t);return 0n===o?null:ni(Jn(on(e.suppliedBase,r,Yo)-e.borrowedBase)+16n,(n=>Pn(bn(e.borrowedBase+n,t),o)<=r))}(n,o);null!==g&&f.push({amount:g,reason:"utilizationCap"});const m=Qn(f);return ei(m,o,!1,oi(n.suppliedBase,n.borrowedBase+m.amount))}function si(e,t,r){if(t.paused)return ti("paused");const o=ii(e.supplies,t);if(!o)return ti(null);const n=o.decimals,i=ri(t),a=BigInt(o.scaledRay),s=BigInt(o.indexRay),u=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),d=hn(a,s,n,"halfUp"),c=BigInt(e.totalDebtUsdWad),p=BigInt(e.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let g=!0;if(c>0n&&f>0n){const t=c>p?c:p,r=p>c?"minCollateral":"healthFactor",i=BigInt(e.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<t){g=!1;const e=t-i,l=nn(e,Jo,f),c=BigInt(o.gateUsdWad)-l,p=c<=0n?0n:on(c,10n**BigInt(n),u),m=d>0n?d-1n:0n,y=p+16n>m?m:p+16n,b=e=>{const t=Gn("supply",e,n,s);return on(Sn(t>=a?0n:a-t,s,u,"floor"),f,Jo)};h.push({amount:ni(y,(t=>b(t)>=e)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const m=function(e,t){const r=e.maxUtilizationRay;if(null===r||0n===e.borrowedBase)return null;if(0n===r)return 0n;const o=nn(e.borrowedBase,Yo,r),n=e.suppliedBase<o?0n:e.suppliedBase-o+16n,i=bn(e.borrowedBase,t);return ni(n>e.suppliedBase?e.suppliedBase:n,(o=>{const n=bn(e.suppliedBase-o,t);return n>0n&&Pn(i,n)<=r}))}(i,n);null!==m&&h.push({amount:m,reason:"utilizationCap"});const y=Qn(h),b=g&&y.amount>=l;return ei(y,n,b,oi(i.suppliedBase-y.amount,i.borrowedBase))}function ui(e){if(e.paused)return ti("paused");if(e.frozen)return ti("frozen");const t=e.assetDecimals,r=ri(e),o={amount:Jn(rn(e.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return ei(o,t,!1,oi(r.suppliedBase+o.amount,r.borrowedBase))}function li(e,t,r){if(t.paused)return ti("paused");const o=ii(e.borrows,t);if(!o)return ti(null);const n=o.decimals,i=ri(t),a=BigInt(o.amountBase),s=void 0===r?null:rn(r,"walletBalance"),u=null!==s&&s<a?{amount:s,reason:"liquidity"}:{amount:a,reason:null};return ei(u,n,u.amount>=a,oi(i.suppliedBase,Jn(i.borrowedBase-u.amount)))}const di=(e,t)=>e.hubId===t.hubId&&e.asset===t.asset,ci=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 pi(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=>di(t,e))),i=-1===n?void 0:t[n],a=ci(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+zn(e.side,a,e.decimals,e.indexRay);else{const o=-a,n=o>=("supply"===e.side?hn(t,e.indexRay,e.decimals,"halfUp"):BigInt(i.amountBase))?t:Gn(e.side,o,e.decimals,e.indexRay);r=n>=t?0n:t-n}s=0n===r?null:Fn({...e,scaledRay:r})}else s=a<=0n?null:Hn(fi(e),a);-1===n?s&&t.push(s):s?t[n]=s:t.splice(n,1)}return Kn({accountId:e.accountId,owner:e.owner,spokeId:e.spokeId,mode:e.mode},r,o,BigInt(e.minBorrowCollateralUsdWad),e.liveDataValid)}function fi(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:rn("supply"===e.side?t.liveSupplyIndexRay:t.liveBorrowIndexRay,"reserve live index"),priceWad:In(t.usdPrice),entryLtvBps:t.collateralFactorBps,entryLiquidationThresholdBps:t.liquidationThresholdBps,entryLiquidationBonusBps:t.liquidationPenaltyBps,entryLiquidationFeesBps:t.liquidationFeesBps,liveDataUsed:!1}}function hi(e,t=0n,r=0n){const o=e.assetDecimals,n=e=>e<0n?0n:e,i=n(xn(e.hubPool.suppliedShort,o)+ci(t)),a=Pn(bn(n(xn(e.hubPool.borrowedShort,o)+ci(r)),o),bn(i,o)),s=kn(a,e.irm),u=_n(a,s,e.irm.reserveFactorBps);return{utilization:Tn(a),utilizationRay:a.toString(),borrowAprRay:s.toString(),supplyAprRay:u.toString(),borrowApr:qn(s),supplyApr:qn(u),borrowApy:Bn(s),supplyApy:Bn(u)}}const gi={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."},5:{name:"PoolAlreadyDeployed",message:"Singleton pool, controller, or price aggregator already recorded."},6:{name:"InvalidAsset",message:"Invalid asset address."},7:{name:"AssetsAreTheSame",message:"Same market or token where distinct HubAssetKeys or underlying assets, respectively, are required."},8:{name:"WrongToken",message:"Params.asset_id differs from the market's asset."},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."},13:{name:"AccountNotInMarket",message:"Caller lacks the account's position NFT, or the account has no metadata."},14:{name:"AmountMustBePositive",message:"The amount must be greater than zero."},16:{name:"InvalidPayments",message:"Payments or route list empty when required, non-empty when forbidden, or over the view limit."},18:{name:"NotSmartContract",message:"Address is not a deployed contract."},24:{name:"AccountNotFound",message:"Account id has no state, or its NFT owner is unresolvable."},25:{name:"AccountModeMismatch",message:"Account mode differs from the call's required mode."},27:{name:"AggregatorNotSet",message:"Swap or price aggregator not configured."},29:{name:"PositionLimitsNotSet",message:"No position limits stored."},30:{name:"PoolNotInitialized",message:"Pool or controller unset, or market params/state missing."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},33:{name:"MathOverflow",message:"Checked arithmetic overflow or failed narrowing conversion."},34:{name:"InternalError",message:"Internal invariant failed. Report it."},36:{name:"InvalidPositionLimits",message:"Supply or borrow limit is zero or above POSITION_LIMIT_MAX (5)."},38:{name:"SpotOnlyNotProductionSafe",message:"Every oracle source reads an unsmoothed spot market."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},40:{name:"TimelockOperationExpired",message:"Scheduled operation's grace period elapsed."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},42:{name:"BlendPoolNotApproved",message:"Blend pool not approved."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},45:{name:"RegistryCapReached",message:"Account already has MAX_DELEGATES (16)."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},47:{name:"BorrowRoundsToZeroShares",message:"Positive borrow mints zero scaled debt shares."},48:{name:"CannotRemoveLastProposer",message:"Revoke would leave no proposer."},49:{name:"WithdrawRoundsToZeroShares",message:"Positive withdrawal burns zero scaled supply shares."},50:{name:"NetSettleRoundsToZeroShares",message:"Positive net settlement burns zero shares."},51:{name:"SupplyRoundsToZeroShares",message:"Positive supply mints zero scaled shares."},52:{name:"RepayRoundsToZeroShares",message:"Positive net repayment burns zero scaled debt shares."},53:{name:"PositionNftNotSet",message:"NFT address unset on a path needing it, such as account creation. Ownership lookup can return #24 instead."},54:{name:"PositionNftAlreadyDeployed",message:"Position-NFT address already recorded."},55:{name:"DivisionByZero",message:"Fixed-point multiply-divide with zero denominator."},100:{name:"InsufficientCollateral",message:"Post-operation LTV-weighted collateral below total debt, or health factor below 1 WAD."},101:{name:"HealthFactorTooHigh",message:"Target has no debt or health factor >= 1 WAD; not liquidatable."},102:{name:"HealthFactorTooLow",message:"Update_account_threshold with has_risks = true ends below 1.05 WAD. A gated liquidation-tuple refresh skips a tuple that fails its hypothetical health-factor check."},104:{name:"NotCollateral",message:"Spoke listing disallows the asset as collateral."},107:{name:"AssetNotBorrowable",message:"Spoke listing disallows borrowing the asset."},109:{name:"PositionLimitExceeded",message:"New slot exceeds the position limit, or a sub-3-decimal supply leg would coexist with another supply slot."},110:{name:"PositionNotFound",message:"Reserved code; no longer emitted."},111:{name:"InvalidPositionMode",message:"Mode is not Multiply, Long, or Short."},112:{name:"InsufficientLiquidity",message:"Market cash below the draw, or the draw breaks the liquidation buffer."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},114:{name:"CannotCleanBadDebt",message:"Account fails the bad-debt gate."},115:{name:"WithdrawLessThanFee",message:"Liquidation protocol fee exceeds the gross withdrawal."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},118:{name:"OptUtilTooHigh",message:"Optimal utilization >= 100%."},119:{name:"InvalidReserveFactor",message:"Reserve factor >= 100%."},120:{name:"DebtPositionNotFound",message:"No debt position for that hub asset."},121:{name:"CollateralPositionNotFound",message:"No supply position for that hub asset."},122:{name:"CannotCloseWithRemainingDebt",message:"Close_position with borrow positions open."},123:{name:"PoolInsolvent",message:"Supplier claims exceed cash plus debt, or zero supply with debt outstanding."},126:{name:"MinBorrowCollateralNotMet",message:"With debt outstanding, LTV-weighted collateral below the USD floor, or a sub-3-decimal supply leg under 2 raw units after floor conversion."},127:{name:"UtilizationAboveMax",message:"Post-operation utilization above max_utilization."},128:{name:"BaseRateNegative",message:"Negative base borrow rate."},129:{name:"SlopeNonMonotonic",message:"Rate slopes do not increase monotonically."},130:{name:"MaxRateBelowBase",message:"Max borrow rate not strictly above base."},131:{name:"MaxBorrowRateTooHigh",message:"Max borrow rate exceeds MAX_BORROW_RATE_RAY (200% APR)."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},133:{name:"SelfLiquidationNotAllowed",message:"SeizeMode::Credit(id) receiver is the liquidated account. Owners may still liquidate their own account."},134:{name:"InvalidLiquidationCurve",message:"Curve bounds fail validation."},135:{name:"FullCloseRequired",message:"Retired; no error site."},201:{name:"InvalidAggregator",message:"Proposed aggregator is not a deployed contract."},204:{name:"InvalidOracleTokenType",message:"Reflector asset given as string; only address or symbol accepted."},205:{name:"UnsafePriceNotAllowed",message:"Two legs disagree beyond tolerance, or only one produced a reading."},206:{name:"PriceFeedStale",message:"Observation exceeds its staleness budget. Timestamps over 60 s ahead are dropped; the error then depends on remaining sources."},208:{name:"BadLastTolerance",message:"Upper ratio outside 10150..12500 (excess over BPS outside 150..2500 bps), or lower ratio is not the required rounded reciprocal."},210:{name:"NoLastPrice",message:"No readable source, or an Aquarius LP read failed (for example, reserves or shares)."},211:{name:"NoAccumulator",message:"Controller has no revenue accumulator."},212:{name:"ReflectorHistoryEmpty",message:"Reflector returns no price history."},216:{name:"OracleNotConfigured",message:"No oracle for the price key, or the response omits a requested asset."},217:{name:"InvalidPrice",message:"Price <= 0, or LP fair-value math non-representable."},218:{name:"InvalidStalenessConfig",message:"Max_stale_seconds out of range or below the source's guaranteed freshness."},219:{name:"TwapInsufficientObservations",message:"Record count zero or below the smoothing minimum, or history too short, too long, or denser than feed resolution."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},222:{name:"InvalidOracleResolution",message:"Reflector resolution below minimum, above max_stale_seconds, or implying a TWAP span above it."},223:{name:"SanityBoundViolated",message:"Price outside the stored sanity band."},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."},226:{name:"SanityBandTooWideForSingleSource",message:"Band exceeds the tighter limit for single-source, LP, or dual-source oracles with identical provider trust sets."},227:{name:"SanityBandMustTighten",message:"Set_sanity_band would widen the band. Widen via timelocked ConfigureAssetOracle."},228:{name:"TwapRecordsOutOfRange",message:"Record count above MAX_TWAP_RECORDS (12)."},229:{name:"OracleDepthExceeded",message:"Composition nests deeper than MAX_RESOLUTION_DEPTH (3)."},230:{name:"FactorOutOfBounds",message:"Scaled source's factor price outside its min/max."},231:{name:"SourceCountOutOfRange",message:"Zero or over two sources, or Aquarius LP combined with another source."},232:{name:"IndependenceNotDeclared",message:"Sources violate RequireDisjoint, or AllowShared is empty or not exactly the shared providers."},234:{name:"UnsupportedAquariusPool",message:"Aquarius pool of wrong type, or zero reserve or total shares."},235:{name:"InsufficientAquariusLiquidity",message:"Pool value below min_pool_value_wad."},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."},310:{name:"SpokeMismatch",message:"Account's spoke differs from the targeted spoke."},311:{name:"SpokeSupplyCapReached",message:"Supply would exceed the spoke supply cap."},312:{name:"SpokeBorrowCapReached",message:"Borrow would exceed the spoke borrow cap."},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."},319:{name:"SpokeFlagsEpochMismatch",message:"RelaxSpokeAssetFlags epoch is stale or wrong; checked at proposal and execution."},400:{name:"FlashLoanOngoing",message:"Flash loan in progress; re-entrant calls refused."},401:{name:"FlashloanNotEnabled",message:"Market is_flashloanable is false."},402:{name:"InvalidFlashloanRepay",message:"Allowance below principal plus fee, or a pool balance check after payout, callback, or repayment fails."},409:{name:"StrategyFeeExceeds",message:"Strategy fee exceeds the borrowed amount."},412:{name:"InvalidFlashloanReceiver",message:"Receiver not a deployed Wasm contract, or a controller payout targets the controller or pool."},500:{name:"ConvertStepsRequired",message:"Multiply initial payment is neither collateral nor debt asset, with no convert_swap."},501:{name:"RouterOverspend",message:"Controller input balance rose during the swap, or router spent over amount_in."},502:{name:"NoSwapOutput",message:"Swap produced no positive measured output."},503:{name:"CollateralRequired",message:"Flash_position collateral list has no positive minimum. Empty list raises #16."},504:{name:"CollateralMinimumNotMet",message:"Measured deposit below its minimum, or none positive."},505:{name:"FlashPositionClosed",message:"Flash_position ended without supply or positive debt in its debt market."}},mi=new Set([1,3,6,10,11,12]),yi=/Error\(Contract,\s*#(\d+)\)/,bi=/contract:(C[A-Z2-7]{55})[^\n]*?Error\(Contract,\s*#(\d+)\)/g,Si=/\[xoxno-invoked:(C[A-Z2-7]{55})\]/,wi=/contract:C[A-Z2-7]{55}/;function vi(e,t){let r;if(t?.contracts?.length)r=((e,t)=>{for(const r of e.matchAll(bi))if(t.has(r[1]))return Number(r[2]);if(wi.test(e))return null;const r=e.match(Si),o=e.match(yi);if(!r||!t.has(r[1])||!o)return null;const n=Number(o[1]);return mi.has(n)?null:n})(e,new Set(t.contracts));else{const t=e.match(yi);r=t?Number(t[1]):null}if(null===r)return null;const o=gi[r];return o?{code:r,...o}:null}},468(e,t,r){"use strict";r.d(t,{createStellarLendingReadClient:()=>w,lendingAssetsSchema:()=>b,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,t=[]){return{type:"object",required:Object.keys(e).filter((e=>!t.includes(e))),properties:e}}const c={sac:o,symbol:o,name:o,decimals:s,logoUrl:a},p=d({valid:i,stale:i,deviation:i,timestamp:s}),f={type:"object",properties:{nativeApy:n,feesApr:n},description:"Embedded annualized yield fractions, separate from base lending interest."},h=d({extraApy:f,...c,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:p,indexRay:a,indexedAt:n,indexedLedger:n},["extraApy"]),g=d({amountRaw:a,amount:a,usd:s}),m=d({spokeId:n,spokeName:o,ltvBps:n,supplyCapacity:g,borrowCapacity:g,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:h},borrow:{type:"array",items:h},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})},b={type:"array",items:d({extraApy:f,...c,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:p,spokes:{type:"array",items:m},dataStatus:l,indexedAt:{...n,description:"Pool state timestamp. Capacities are indexed snapshot estimates; prepare/simulate before signing."},indexedLedger:n},["extraApy"])};function S(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 w(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:"manual"});if("opaqueredirect"===e.type||e.status>=300&&e.status<400||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=S(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)}}}},928(e,t,r){"use strict";r.d(t,{sW:()=>s,Zc:()=>a,GW:()=>u});const o="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",n="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",a=3e4;var s;!function(e){e.MAINNET="1",e.DEVNET="D"}(s||(s={}));class u{apiUrl;chain;init;config;constructor(e){if(!e?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:t=s.MAINNET,apiUrl:r,...a}=e;this.apiUrl=r.trim().replace(/\/$/,""),this.chain=t,this.init=a,this.config=t==s.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:o,DR_SC:n,KG_SC:i,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:o,DR_SC:n,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:i,timeout:s,...u}=this.init,{next:l,cache:d,debug:c,timeout:p,headers:f,method:h="GET",...g}=r,m=f?.Authorization,y="Bearer undefined"===m?void 0:m,b="GET"!==h&&"HEAD"!==h&&"PUT"!==h,S={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...b?{"Content-Type":"application/json"}:{},...y?{Authorization:y}:{}},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??{},R="GET"!==h||y?void 0:x??T,E="GET"!==h||y||R?void 0:d??n,P=g.body,k=p??s??(null==P?a:0),_=k>0?AbortSignal.timeout(k):void 0,q=g.signal??u.signal,B=_&&q?AbortSignal.any([q,_]):_??q,O={...u,...g,method:h,...Object.keys(S).length?{headers:S}:{},...B?{signal:B}:{},cache:E,next:{...A,...I,revalidate:R}};(c??i)&&console.debug("SDK fetch: ",v,O);const C=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 C.text();if(!C.ok){let e;try{e=JSON.parse(M)}catch{e={message:M}}const t=[v,C.status,C.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(M)}catch{return M}}}}},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:()=>d.BPS,Chain:()=>e.sW,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>d.DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD,DEFAULT_REQUEST_TIMEOUT_MS:()=>e.Zc,LIQUIDATION_BUFFER_BPS:()=>d.LIQUIDATION_BUFFER_BPS,RAY:()=>d.RAY,RAY_DECIMALS:()=>d.RAY_DECIMALS,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>d.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>d.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>d.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>d.STELLAR_NETWORK_PASSPHRASE,STELLAR_ROUTE_MAX_BYTES:()=>d.STELLAR_ROUTE_MAX_BYTES,SYNTHETIC_EVENT_ORDER_STRIDE:()=>d.SYNTHETIC_EVENT_ORDER_STRIDE,StellarAuthPolicyError:()=>d.StellarAuthPolicyError,StellarRouteVerificationError:()=>d.StellarRouteVerificationError,WAD:()=>d.WAD,WAD_DECIMALS:()=>d.WAD_DECIMALS,XOXNOClient:()=>e.GW,aggregateAccountRisk:()=>d.aggregateAccountRisk,annualBorrowRateRay:()=>d.annualBorrowRateRay,assertStellarAuthEntries:()=>d.assertStellarAuthEntries,assertStellarPreparedTxAuth:()=>d.assertStellarPreparedTxAuth,baseToRay:()=>d.baseToRay,baseToShort:()=>d.baseToShort,baseValueWad:()=>d.baseValueWad,buildLiveSnapshot:()=>d.buildLiveSnapshot,buildSameTokenRepaySwapSteps:()=>d.buildSameTokenRepaySwapSteps,buildSdk:()=>h,buildStellarAcceptOwnershipTx:()=>d.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>d.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>d.buildStellarApproveBlendPoolTx,buildStellarBorrowBatchTx:()=>d.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>d.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>d.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>d.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>d.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>d.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>d.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>d.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>d.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>d.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>d.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>d.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>d.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>d.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>d.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>d.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>d.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>d.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>d.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>d.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>d.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>d.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>d.buildStellarLiquidateTx,buildStellarLiquidationEstimateTx:()=>d.buildStellarLiquidationEstimateTx,buildStellarMigrateFromBlendTx:()=>d.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>d.buildStellarMigrateTx,buildStellarMultiplyTx:()=>d.buildStellarMultiplyTx,buildStellarPauseTx:()=>d.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>d.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>d.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>d.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>d.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>d.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>d.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeCreateHubTx:()=>d.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>d.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>d.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>d.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>d.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>d.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>d.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>d.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>d.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>d.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>d.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>d.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>d.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>d.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>d.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>d.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>d.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>d.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>d.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>d.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>d.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>d.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>d.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>d.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>d.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>d.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>d.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>d.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>d.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>d.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>d.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>d.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>d.buildStellarRevokeRoleTx,buildStellarSetAccumulatorTx:()=>d.buildStellarSetAccumulatorTx,buildStellarSetOracleSanityBoundsTx:()=>d.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>d.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>d.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>d.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>d.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>d.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>d.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>d.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>d.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>d.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>d.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>d.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>d.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>d.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>d.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>d.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>d.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>d.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>d.buildStellarWithdrawTx,buildTx:()=>d.buildTx,burnShares:()=>d.burnShares,computeAccountRisk:()=>d.computeAccountRisk,createStellarLendingReadClient:()=>d.createStellarLendingReadClient,decodeStellarLendingEvent:()=>d.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>d.decodeStellarLiquidateReturn,decodeStellarLiquidationEstimate:()=>d.decodeStellarLiquidationEstimate,decodeStellarRouteBytes:()=>d.decodeStellarRouteBytes,decodeStellarSwapEnvelope:()=>d.decodeStellarSwapEnvelope,depositRateRay:()=>d.depositRateRay,divByIntHalfUp:()=>d.divByIntHalfUp,encodeAssetOracle:()=>d.encodeAssetOracle,encodeInterestRateModel:()=>d.encodeInterestRateModel,encodeMarketParamsRaw:()=>d.encodeMarketParamsRaw,encodePositionLimits:()=>d.encodePositionLimits,encodePriceKey:()=>d.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>d.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>d.extractEventOrder,getStellarAccountPositions:()=>d.getStellarAccountPositions,getStellarActiveUsersSeries:()=>d.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>d.getStellarAggregatorQuote,getStellarAsset:()=>d.getStellarAsset,getStellarAssetGraph:()=>d.getStellarAssetGraph,getStellarAssetMarkets:()=>d.getStellarAssetMarkets,getStellarAssetPage:()=>d.getStellarAssetPage,getStellarAssets:()=>d.getStellarAssets,getStellarCampaignLeaderboard:()=>d.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>d.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>d.getStellarDefiLlamaDimensions,getStellarDeployment:()=>d.getStellarDeployment,getStellarDetailedMarkets:()=>d.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>d.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>d.getStellarGovernanceProposals,getStellarHolderDistribution:()=>d.getStellarHolderDistribution,getStellarHub:()=>d.getStellarHub,getStellarHubGraph:()=>d.getStellarHubGraph,getStellarHubHolders:()=>d.getStellarHubHolders,getStellarHubs:()=>d.getStellarHubs,getStellarLendingContext:()=>d.getStellarLendingContext,getStellarLendingLiveState:()=>d.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>d.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>d.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>d.getStellarParticipantCounts,getStellarPnlByScope:()=>d.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>d.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>d.getStellarPositionsPnl,getStellarQuoteTokens:()=>d.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>d.getStellarRateSpreadSeries,getStellarReserve:()=>d.getStellarReserve,getStellarReserveGraph:()=>d.getStellarReserveGraph,getStellarReserveHolders:()=>d.getStellarReserveHolders,getStellarReserves:()=>d.getStellarReserves,getStellarRevenueSeries:()=>d.getStellarRevenueSeries,getStellarSpoke:()=>d.getStellarSpoke,getStellarSpokeGraph:()=>d.getStellarSpokeGraph,getStellarSpokeHolders:()=>d.getStellarSpokeHolders,getStellarSpokes:()=>d.getStellarSpokes,getStellarStatsHistory:()=>d.getStellarStatsHistory,getStellarUserActivity:()=>d.getStellarUserActivity,getStellarUserActivityPage:()=>d.getStellarUserActivityPage,getStellarUserHistory:()=>d.getStellarUserHistory,getStellarUserPositions:()=>d.getStellarUserPositions,getStellarVolumeSeries:()=>d.getStellarVolumeSeries,getStellarWalletBalance:()=>d.getStellarWalletBalance,getStellarWalletTokens:()=>d.getStellarWalletTokens,isValidCollectionTicker:()=>t,isValidNftIdentifier:()=>n,lendingAssetsSchema:()=>d.lendingAssetsSchema,lendingPositionsSchema:()=>d.lendingPositionsSchema,liveIndexKey:()=>d.liveIndexKey,mapQuoteResponseToStrategyPayload:()=>d.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>d.mapQuoteResponseToStrategySwap,mapSorobanError:()=>d.mapSorobanError,mapStellarPositionActivityType:()=>d.mapStellarPositionActivityType,maxBorrow:()=>d.maxBorrow,maxRepay:()=>d.maxRepay,maxSupply:()=>d.maxSupply,maxWithdraw:()=>d.maxWithdraw,mintShares:()=>d.mintShares,mulDivCeil:()=>d.mulDivCeil,mulDivFloor:()=>d.mulDivFloor,mulDivHalfUp:()=>d.mulDivHalfUp,numberToScaled:()=>d.numberToScaled,numberToWad:()=>d.numberToWad,parseStellarTokenAmount:()=>d.parseStellarTokenAmount,positionValueWad:()=>d.positionValueWad,prepareStellarBuiltTx:()=>d.prepareStellarBuiltTx,prepareStellarTxXdr:()=>d.prepareStellarTxXdr,projectAccountRisk:()=>d.projectAccountRisk,projectReserveApy:()=>d.projectReserveApy,rayAprToApy:()=>d.rayAprToApy,rayAprToNumber:()=>d.rayAprToNumber,rayToNumber:()=>d.rayToNumber,rescaleCeil:()=>d.rescaleCeil,rescaleFloor:()=>d.rescaleFloor,rescaleHalfUp:()=>d.rescaleHalfUp,reserveKey:()=>d.reserveKey,resolveReserve:()=>d.resolveReserve,stellarAuthPolicyForInvocation:()=>d.stellarAuthPolicyForInvocation,stellarLendingDispatchKey:()=>d.stellarLendingDispatchKey,stellarLendingRead:()=>d.stellarLendingRead,stellarNetworks:()=>d.stellarNetworks,stellarTokenContractId:()=>d.stellarTokenContractId,syntheticEventOrder:()=>d.syntheticEventOrder,tagStellarInvokedContractError:()=>d.tagStellarInvokedContractError,toBase64Xdr:()=>d.toBase64Xdr,toBigInt:()=>d.toBigInt,toStellarPositionMode:()=>d.toStellarPositionMode,unscale:()=>d.unscale,unscaleBorrowCeil:()=>d.unscaleBorrowCeil,unscaleHalfUp:()=>d.unscaleHalfUp,unscaleSupplyFloor:()=>d.unscaleSupplyFloor,utilizationRay:()=>d.utilizationRay,valueBasePosition:()=>d.valueBasePosition,valueScaledPosition:()=>d.valueScaledPosition,verifyStellarRouteBytes:()=>d.verifyStellarRouteBytes,wadToNumber:()=>d.wadToNumber});var e=r(928);const t=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},n=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 i extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class a extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const s=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)),u={"/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:{}}},l=["PATCH","POST","DELETE","PUT"];var d=r(999);const c=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),p=()=>({static:{},params:{},leaves:[]});function f(e,r,o,n){const{input:u,output:d,...c}=r,p=async(r={})=>{const u={...o,...r},l=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),d=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),c=Object.fromEntries(Object.entries(u).filter((([e])=>!d.includes(e)))),p=/:address[^A-Z]/.test(e)||"address"in c,f=/:collection[^A-Z]/.test(e)||"collection"in c;if(p){const e=u.address;if(!s(e))throw new a(e)}if(f){const e=u.collection;if(Array.isArray(e)?e.some((e=>!t(e))):!t(e))throw new i(e)}const h=Object.fromEntries(Object.entries(c).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:m,method:y,headers:b,cache:S,next:w,debug:v,signal:T,credentials:A,mode:x,redirect:I,referrer:R,referrerPolicy:E,integrity:P,keepalive:k,priority:_,window:q,continuationToken:B,...O}=h,C=m?`Bearer ${m}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==B&&(O.continuationToken=B);const M={...b,...C?{Authorization:C}:{},...B&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(B)}:{}},U={...w,tags:[...w?.tags??[],l]};return n.fetchWithTimeout(l,{method:y,params:O,body:g,headers:M,cache:S,debug:v,...Object.fromEntries(Object.entries({signal:T,credentials:A,mode:x,redirect:I,referrer:R,referrerPolicy:E,integrity:P,keepalive:k,priority:_,window:q}).filter((([,e])=>void 0!==e))),...U?{next:U}:{}})},f=(e={})=>p(e);for(const e of Object.keys(c))l.includes(e)&&(f[e]=t=>p({...t,method:t.method??e.toUpperCase()}));return f}function h(e){const t=function(){const e=p();for(const[t,r]of Object.entries(u)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=c(e.slice(1));n=n.params[t]||=p()}else{const t=c(e);n=n.static[t]||=p()}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=f(r,n,o,e)}else{s={};for(const{rawPath:r,def:n}of t.leaves)s[c(r.split("/").pop().replace(/^:/,""))]=f(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,c=u>0?a-4:a;for(r=0;r<c;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 c(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 p(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):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(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 c(e){return d(e),s(e<0?0:0|h(e))}function p(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 m(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 _(this,t,r);case"utf8":case"utf-8":return R(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 q(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function y(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 R(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<=E)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=E));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 c(e)},u.allocUnsafeSlow=function(e){return c(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)y(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)y(this,t,t+3),y(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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):m.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 E=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 _(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 q(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 B(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 C(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 U(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||U(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function N(e,t,r,o,i){return t=+t,r>>>=0,i||U(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||B(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||B(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||B(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(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||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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||B(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||B(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||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||B(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||B(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||B(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||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(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||B(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(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 C(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 C(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 N(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return N(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 D={};function $(e,t,r){D[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 D.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(o,n,i)}function z(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw z(e,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),$("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 H=/[^+/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(H,"")).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,c=r?n-1:0,p=r?-1:1,f=e[t+c];for(c+=p,i=f&(1<<-d)-1,f>>=-d,d+=s;d>0;i=256*i+e[t+c],c+=p,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=o;d>0;a=256*a+e[t+c],c+=p,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,c=d>>1,p=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+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=d?(s=0,a=d):a+c>=1?(s=(t*u-1)*Math.pow(2,n),a+=c):(s=t*Math.pow(2,c-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:()=>Jo,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>On,LIQUIDATION_BUFFER_BPS:()=>Yn,RAY:()=>Yo,RAY_DECIMALS:()=>en,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Mt,STELLAR_LENDING_TOPICS:()=>Jr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>a,STELLAR_ROUTE_MAX_BYTES:()=>ho,SYNTHETIC_EVENT_ORDER_STRIDE:()=>to,StellarAuthPolicyError:()=>Eo,StellarRouteVerificationError:()=>go,WAD:()=>Qo,WAD_DECIMALS:()=>tn,aggregateAccountRisk:()=>Kn,annualBorrowRateRay:()=>kn,assertStellarAuthEntries:()=>Mo,assertStellarPreparedTxAuth:()=>zo,baseToRay:()=>bn,baseToShort:()=>An,baseValueWad:()=>wn,buildLiveSnapshot:()=>Dn,buildSameTokenRepaySwapSteps:()=>jo,buildStellarAcceptOwnershipTx:()=>yt,buildStellarAddRewardsTx:()=>Ot,buildStellarApproveBlendPoolTx:()=>Tt,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>Zo,buildStellarClaimRevenueTx:()=>Bt,buildStellarCreateLiquidityPoolTx:()=>_t,buildStellarExecuteCancellerResetTx:()=>kr,buildStellarExecuteStrategyTx:()=>To,buildStellarFlashLoanTx:()=>Y,buildStellarGovernanceAddSpokeImmediateTx:()=>Or,buildStellarGovernanceCreateHubImmediateTx:()=>Br,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Tr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>xr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ir,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Rr,buildStellarGovernanceExecuteTx:()=>vr,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ar,buildStellarGovernancePauseTx:()=>Mr,buildStellarGovernanceRevokeRoleImmediateTx:()=>Cr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>qr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>_r,buildStellarGrantRoleTx:()=>ht,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>V,buildStellarLiquidationEstimateTx:()=>j,buildStellarMigrateFromBlendTx:()=>Q,buildStellarMigrateTx:()=>ct,buildStellarMultiplyTx:()=>J,buildStellarPauseTx:()=>pt,buildStellarProposeAddAssetToSpokeTx:()=>Yt,buildStellarProposeAddSpokeTx:()=>Kt,buildStellarProposeApproveBlendPoolTx:()=>ir,buildStellarProposeApproveTokenTx:()=>or,buildStellarProposeCancellerResetTx:()=>Pr,buildStellarProposeConfigureAssetOracleTx:()=>hr,buildStellarProposeCreateHubTx:()=>jt,buildStellarProposeCreateLiquidityPoolTx:()=>sr,buildStellarProposeDeployPoolTx:()=>lr,buildStellarProposeEditAssetInSpokeTx:()=>Qt,buildStellarProposeEditOracleToleranceTx:()=>gr,buildStellarProposeGovernanceUpgradeTx:()=>mr,buildStellarProposeGrantGovernanceRoleTx:()=>br,buildStellarProposeMigrateControllerTx:()=>pr,buildStellarProposeRemoveAssetFromSpokeTx:()=>Jt,buildStellarProposeRemoveSpokeTx:()=>Zt,buildStellarProposeRevokeBlendPoolTx:()=>ar,buildStellarProposeRevokeGovernanceRoleTx:()=>Sr,buildStellarProposeRevokeTokenTx:()=>nr,buildStellarProposeSetAccumulatorTx:()=>Vt,buildStellarProposeSetMinBorrowCollatTx:()=>rr,buildStellarProposeSetPositionLimitsTx:()=>Xt,buildStellarProposeSetPositionManagerTx:()=>tr,buildStellarProposeSetPriceAggregatorTx:()=>Ht,buildStellarProposeSetSpokeLiquidationCurveTx:()=>er,buildStellarProposeSetSwapAggregatorTx:()=>Gt,buildStellarProposeTransferCtrlOwnershipTx:()=>fr,buildStellarProposeTransferGovOwnTx:()=>wr,buildStellarProposeUnpauseTx:()=>Ur,buildStellarProposeUpdateDelayTx:()=>yr,buildStellarProposeUpgradeControllerTx:()=>cr,buildStellarProposeUpgradePoolParamsTx:()=>ur,buildStellarProposeUpgradePoolTx:()=>dr,buildStellarRenewAccountTx:()=>kt,buildStellarRepayBatchTx:()=>G,buildStellarRepayDebtWithCollateralTx:()=>re,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>At,buildStellarRevokeRoleTx:()=>gt,buildStellarSetAccumulatorTx:()=>wt,buildStellarSetOracleSanityBoundsTx:()=>Et,buildStellarSetOracleToleranceTx:()=>It,buildStellarSetOracleTx:()=>xt,buildStellarSetPositionLimitsTx:()=>vt,buildStellarSetPriceAggregatorTx:()=>St,buildStellarSetSpokeAssetFlagsTx:()=>Rt,buildStellarSetSwapAggregatorTx:()=>bt,buildStellarSupplyBatchTx:()=>N,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>te,buildStellarSwapDebtTx:()=>ee,buildStellarTransferOwnershipTx:()=>mt,buildStellarUnpauseTx:()=>ft,buildStellarUpdateAccountThresholdTx:()=>Ct,buildStellarUpdateIndexesTx:()=>Pt,buildStellarUpgradeControllerTx:()=>dt,buildStellarUpgradeLiquidityPoolParamsTx:()=>qt,buildStellarWithdrawBatchTx:()=>F,buildStellarWithdrawTx:()=>z,buildTx:()=>U,burnShares:()=>Gn,computeAccountRisk:()=>Zn,createStellarLendingReadClient:()=>Ye.createStellarLendingReadClient,decodeStellarLendingEvent:()=>eo,decodeStellarLiquidateReturn:()=>X,decodeStellarLiquidationEstimate:()=>Z,decodeStellarRouteBytes:()=>yo,decodeStellarSwapEnvelope:()=>Ro,depositRateRay:()=>_n,divByIntHalfUp:()=>sn,encodeAssetOracle:()=>lt,encodeInterestRateModel:()=>Qe,encodeMarketParamsRaw:()=>Je,encodePositionLimits:()=>et,encodePriceKey:()=>tt,encodeStrategyPayloadToRouteXdr:()=>vo,extractEventOrder:()=>oo,getStellarAccountPositions:()=>be,getStellarActiveUsersSeries:()=>ze,getStellarAggregatorQuote:()=>so,getStellarAsset:()=>he,getStellarAssetGraph:()=>Re,getStellarAssetMarkets:()=>Te,getStellarAssetPage:()=>ve,getStellarAssets:()=>le,getStellarCampaignLeaderboard:()=>Le,getStellarCampaignMe:()=>Ke,getStellarDefiLlamaDimensions:()=>He,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>ue,getStellarFeeRevenueSeries:()=>$e,getStellarGovernanceProposals:()=>Be,getStellarHolderDistribution:()=>Ue,getStellarHub:()=>ge,getStellarHubGraph:()=>Ee,getStellarHubHolders:()=>xe,getStellarHubs:()=>de,getStellarLendingContext:()=>ae,getStellarLendingLiveState:()=>se,getStellarLiquidationsLeaderboard:()=>Me,getStellarLiquidationsSeries:()=>We,getStellarParticipantCounts:()=>Ce,getStellarPnlByScope:()=>je,getStellarPositionsLeaderboard:()=>Oe,getStellarPositionsPnl:()=>Xe,getStellarQuoteTokens:()=>uo,getStellarRateSpreadSeries:()=>Ge,getStellarReserve:()=>fe,getStellarReserveGraph:()=>ke,getStellarReserveHolders:()=>Ae,getStellarReserves:()=>pe,getStellarRevenueSeries:()=>De,getStellarSpoke:()=>me,getStellarSpokeGraph:()=>Pe,getStellarSpokeHolders:()=>Ie,getStellarSpokes:()=>ce,getStellarStatsHistory:()=>Ne,getStellarUserActivity:()=>_e,getStellarUserActivityPage:()=>qe,getStellarUserHistory:()=>Ve,getStellarUserPositions:()=>ye,getStellarVolumeSeries:()=>Fe,getStellarWalletBalance:()=>we,getStellarWalletTokens:()=>Se,lendingAssetsSchema:()=>Ye.lendingAssetsSchema,lendingPositionsSchema:()=>Ye.lendingPositionsSchema,liveIndexKey:()=>Nn,mapQuoteResponseToStrategyPayload:()=>Ao,mapQuoteResponseToStrategySwap:()=>xo,mapSorobanError:()=>vi,mapStellarPositionActivityType:()=>io,maxBorrow:()=>ai,maxRepay:()=>li,maxSupply:()=>ui,maxWithdraw:()=>si,mintShares:()=>zn,mulDivCeil:()=>nn,mulDivFloor:()=>on,mulDivHalfUp:()=>an,numberToScaled:()=>xn,numberToWad:()=>In,parseStellarTokenAmount:()=>M,positionValueWad:()=>Sn,prepareStellarBuiltTx:()=>Vo,prepareStellarTxXdr:()=>Ho,projectAccountRisk:()=>pi,projectReserveApy:()=>hi,rayAprToApy:()=>Bn,rayAprToNumber:()=>qn,rayToNumber:()=>Tn,rescaleCeil:()=>dn,rescaleFloor:()=>ln,rescaleHalfUp:()=>cn,reserveKey:()=>Cn,resolveReserve:()=>Mn,stellarAuthPolicyForInvocation:()=>$o,stellarLendingDispatchKey:()=>Dr,stellarLendingRead:()=>Ze,stellarNetworks:()=>n,stellarTokenContractId:()=>bo,syntheticEventOrder:()=>no,tagStellarInvokedContractError:()=>Go,toBase64Xdr:()=>Lr,toBigInt:()=>rn,toStellarPositionMode:()=>Xo,unscale:()=>hn,unscaleBorrowCeil:()=>mn,unscaleHalfUp:()=>yn,unscaleSupplyFloor:()=>gn,utilizationRay:()=>Pn,valueBasePosition:()=>Hn,valueScaledPosition:()=>Fn,verifyStellarRouteBytes:()=>wo,wadToNumber:()=>vn});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:"CBMARXSYE56NPDLX42TTICM5GS5XQCYRD5VMCJME624TS6C2S53VETYU",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","Curve"],d={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4,Curve:7},c=1e6,p=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()},m=e=>s.xdr.ScVal.scvBool(e),y=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)=>E({asset:p(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)))),R=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)}`)},E=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>c)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>c)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const a=i===c;let s=c;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*c/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 E({amounts:s.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:s.xdr.ScVal.scvVec(t.assetList.map((e=>p(e)))),ops:s.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},_=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)},q=()=>s.xdr.ScVal.scvBytes(u.hp.alloc(0)),B=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 _(B(e));if(e instanceof Uint8Array)return 0===e.length?q():_(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?_(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?_(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?_(B(e.bytes)):0===e.bytes.length?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>c)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==c)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)")},C=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){if("number"!=typeof t||!Number.isInteger(t)||t<0||t>18)throw new Error("Token decimals must be an integer from 0 to 18");if("string"!=typeof e||!/^\d+(?:\.\d+)?$/.test(e))throw new Error("Token amount must be plain decimal text");const r=s.Soroban.parseTokenAmount(e,t),o=BigInt(r);if(o<=0n||o>(1n<<127n)-1n)throw new Error("Token amount must be within the positive i128 range");return r}function U(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.sourceAccount??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 L(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 N(e,t){const r=t.accountNonce??0;return U(e,"supply",[p(e.caller),g(r),L(t.spokeId),I([...t.assets])])}function D(e,t){return N(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return U(e,"borrow",[p(e.caller),g(t.accountNonce),I([...t.borrows]),T(t.to,p)])}function W(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"withdraw",[p(e.caller),g(t.accountNonce),I([...t.withdrawals]),T(t.to,p)])}function z(e,t){return F(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return U(e,"repay",[p(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 V(e,t){return U(e,"liquidate",[p(e.caller),g(t.accountNonce),I([...t.debtPayments]),R(t.seizeMode??"Transfer")])}function X(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 j(e,t){return U(e,"get_liquidation_estimate",[g(t.accountNonce),I([...t.debtPayments]),R(t.seizeMode??"Transfer")])}const K=e=>(Array.isArray(e)?e:[]).map((e=>{const t=e;return{asset:String(t.asset),amount:String(t.amount)}}));function Z(e){const t=(0,s.scValToNative)(s.xdr.ScVal.fromXDR(e,"base64"));if(!t||"object"!=typeof t||Array.isArray(t))throw new Error("Stellar builder: liquidation estimate must be a struct");return{seizedCollaterals:K(t.seized_collaterals),protocolFees:K(t.protocol_fees),refunds:K(t.refunds),maxPaymentWad:String(t.max_payment_wad),bonusRateBps:String(t.bonus_rate_bps)}}function Y(e,t){return U(e,"flash_loan",[p(e.caller),A(t.hubId,t.asset),f(t.amount),p(t.receiver),C(t.data)])}function Q(e,t){return U(e,"migrate_from_blend",[p(e.caller),g(t.accountId),L(t.spokeId),h(t.hubId),p(t.blendPool),w(t.collateralTokens.map(p)),w(t.supplyTokens.map(p)),(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([p(t),f(r)]);var t,r}))))]);var r}function J(e,t){const r=t.accountNonce??0;return U(e,"multiply",[p(e.caller),g(r),L(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 ee(e,t){return U(e,"swap_debt",[p(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 te(e,t){return U(e,"swap_collateral",[p(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 re(e,t){return U(e,"repay_debt_with_collateral",[p(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),m(t.closePosition)])}var oe=r(928);const ne="/stellar-lending",ie=encodeURIComponent,ae=(e,t)=>e.fetchWithTimeout(`${ne}/context`,t),se=(e,t)=>e.fetchWithTimeout(`${ne}/live-state`,t),ue=(e,t)=>e.fetchWithTimeout(`${ne}/markets/detailed`,t),le=(e,t)=>e.fetchWithTimeout(`${ne}/assets`,t),de=(e,t)=>e.fetchWithTimeout(`${ne}/hubs`,t),ce=(e,t)=>e.fetchWithTimeout(`${ne}/spokes`,t),pe=(e,t={},r)=>e.fetchWithTimeout(`${ne}/reserves`,{...r,params:{...t}}),fe=(e,t,r,o,n)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}`,n),he=(e,t,r)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}`,r),ge=(e,t,r)=>e.fetchWithTimeout(`${ne}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${ne}/spokes/${t}`,r),ye=(e,t,r)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/positions`,r),be=(e,t,r)=>e.fetchWithTimeout(`${ne}/accounts/${ie(t)}/positions`,r),Se=(e,t,r)=>e.fetchWithTimeout(`/user/${ie(t)}/token-inventory`,r),we=async(e,t,r,o)=>{const n=await Se(e,t,o),i=e.chain===oe.sW.MAINNET?"mainnet":"testnet",a=(n?.tokens??[]).find((e=>e.identifier===r));if(a)return{owner:t,network:a.stellarNetwork??i,asset:r,amount:String(a.balance),decimals:a.decimals};const{decimals:s}=await he(e,r,o);if("number"!=typeof s)throw new Error(`Stellar lending: no decimals for ${r}; it is not a lending asset`);return{owner:t,network:i,asset:r,amount:"0",decimals:s}},ve=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/page`,{...o,params:{...r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/markets`,{...o,params:{side:r}}),Ae=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}/holders`,{...i,params:{side:n}}),xe=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/hubs/${t}/holders`,{...o,params:{side:r}}),Ie=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/spokes/${t}/holders`,{...o,params:{side:r}}),Re=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/graph`,{...o,params:{...r}}),Ee=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/hubs/${t}/graph`,{...o,params:{...r}}),Pe=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/spokes/${t}/graph`,{...o,params:{...r}}),ke=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}/graph`,{...i,params:{...n}}),_e=(e,t,r={},o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/activity`,{...o,params:{...r}}),qe=(e,t,r={},o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/activity/page`,{...o,params:{...r}}),Be=(e,t={},r)=>e.fetchWithTimeout(`${ne}/governance/proposals`,{...r,params:{...t}}),Oe=(e,t={},r)=>e.fetchWithTimeout(`${ne}/positions`,{...r,params:{...t}}),Ce=(e,t={},r)=>e.fetchWithTimeout(`${ne}/participants`,{...r,params:{...t}}),Me=(e,t={},r)=>e.fetchWithTimeout(`${ne}/liquidations/leaderboard`,{...r,params:{...t}}),Ue=(e,t={},r)=>e.fetchWithTimeout(`${ne}/distribution`,{...r,params:{...t}}),Le=(e,t={},r)=>e.fetchWithTimeout(`${ne}/campaign/leaderboard`,{...r,params:{...t}}),Ne=(e,t,r)=>e.fetchWithTimeout(`${ne}/stats/history`,{...r,params:{...t}}),De=(e,t,r)=>e.fetchWithTimeout(`${ne}/revenue`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${ne}/revenue/fees`,{...r,params:{...t}}),We=(e,t,r)=>e.fetchWithTimeout(`${ne}/liquidations`,{...r,params:{...t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${ne}/volume`,{...r,params:{...t}}),ze=(e,t,r)=>e.fetchWithTimeout(`${ne}/active-users`,{...r,params:{...t}}),Ge=(e,t,r)=>e.fetchWithTimeout(`${ne}/rate-spread`,{...r,params:{...t}}),He=(e,t,r)=>e.fetchWithTimeout(`${ne}/defillama`,{...r,params:{...t}}),Ve=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/history`,{...o,params:{...r}}),Xe=(e,t,r)=>e.fetchWithTimeout(`${ne}/pnl`,{...r,params:{accountId:t}}),je=(e,t,r)=>e.fetchWithTimeout(`${ne}/pnl/scope`,{...r,params:{scope:t}}),Ke=(e,t,r)=>e.fetchWithTimeout(`${ne}/campaign/me`,{...r,params:{owner:t}}),Ze=e=>({context:t=>ae(e,t),liveState:t=>se(e,t),marketsDetailed:t=>ue(e,t),assets:t=>le(e,t),hubs:t=>de(e,t),spokes:t=>ce(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?pe(e,t,r):pe(e,{},t),reserve:(t,r,o,n)=>fe(e,t,r,o,n),asset:(t,r)=>he(e,t,r),hub:(t,r)=>ge(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>ye(e,t,r),accountPositions:(t,r)=>be(e,t,r),walletTokens:(t,r)=>Se(e,t,r),walletBalance:(t,r,o)=>we(e,t,r,o),assetPage:(t,r,o)=>ve(e,t,r,o),assetMarkets:(t,r,o)=>Te(e,t,r,o),reserveHolders:(t,r,o,n,i)=>Ae(e,t,r,o,n,i),hubHolders:(t,r,o)=>xe(e,t,r,o),spokeHolders:(t,r,o)=>Ie(e,t,r,o),assetGraph:(t,r,o)=>Re(e,t,r,o),hubGraph:(t,r,o)=>Ee(e,t,r,o),spokeGraph:(t,r,o)=>Pe(e,t,r,o),reserveGraph:(t,r,o,n,i)=>ke(e,t,r,o,n,i),userActivity:(t,r={},o)=>_e(e,t,r,o),userActivityPage:(t,r={},o)=>qe(e,t,r,o),governanceProposals:(t={},r)=>Be(e,t,r),positionsLeaderboard:(t={},r)=>Oe(e,t,r),participants:(t={},r)=>Ce(e,t,r),liquidationsLeaderboard:(t={},r)=>Me(e,t,r),distribution:(t={},r)=>Ue(e,t,r),campaignLeaderboard:(t={},r)=>Le(e,t,r),statsHistory:(t,r)=>Ne(e,t,r),revenue:(t,r)=>De(e,t,r),feeRevenue:(t,r)=>$e(e,t,r),liquidations:(t,r)=>We(e,t,r),volume:(t,r)=>Fe(e,t,r),activeUsers:(t,r)=>ze(e,t,r),rateSpread:(t,r)=>Ge(e,t,r),defillama:(t,r)=>He(e,t,r),userHistory:(t,r,o)=>Ve(e,t,r,o),positionsPnl:(t,r)=>Xe(e,t,r),pnlByScope:(t,r)=>je(e,t,r),campaignMe:(t,r)=>Ke(e,t,r)});var Ye=r(468);const Qe=e=>E({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)}),Je=e=>E({asset_decimals:h(e.assetDecimals),asset_id:p(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:m(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)}),et=e=>E({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),tt=e=>{if("Token"in e&&e.Token)return w([b("Token"),p(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)}`)},rt=e=>{if("Stellar"in e)return w([b("Stellar"),p(e.Stellar)]);if("Symbol"in e)return w([b("Symbol"),b(e.Symbol)]);if("String"in e)return w([b("String"),y(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},ot=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)}`)},nt=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},it=e=>{if("Market"===e||"Fundamental"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},at=e=>{if("Reflector"in e){const t=e.Reflector;return w([b("Reflector"),E({asset:rt(t.asset),contract:p(t.contract),read_mode:ot(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([b("MultiFeed"),E({contract:p(t.contract),feed_id:y(t.feedId),kind:nt(t.kind),nature:it(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},st=e=>{const t=e;return E({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:at(t.provider)})},ut=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=>E({contract:p(e.contract),kind:nt(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},lt=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 E({asset_decimals:h(Number(t.assetDecimals)),independence:ut(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"),st(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([b("Scaled"),E({factor:st(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:tt(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([b("LpShare"),E({key_a:tt(t.keyA),key_b:tt(t.keyB),kind:w([b(t.kind||"ConstantProduct")]),pool:p(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:E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})};function dt(e,t){return U(e,"upgrade",[v(t.wasmHash)])}function ct(e,t){return U(e,"migrate",[h(t.newVersion)])}function pt(e){return U(e,"pause",[])}function ft(e){return U(e,"unpause",[])}function ht(e,t){return U(e,"grant_role",[p(t.account),b(t.role)])}function gt(e,t){return U(e,"revoke_role",[p(t.account),b(t.role)])}function mt(e,t){return U(e,"transfer_ownership",[p(t.newOwner),h(t.liveUntilLedger)])}function yt(e){return U(e,"accept_ownership",[])}function bt(e,t){return U(e,"set_swap_aggregator",[p(t.aggregator)])}function St(e,t){return U(e,"set_price_aggregator",[p(t.aggregator)])}function wt(e,t){return U(e,"set_accumulator",[p(t.accumulator)])}function vt(e,t){return U(e,"set_position_limits",[et(t)])}function Tt(e,t){return U(e,"approve_blend_pool",[p(t.pool)])}function At(e,t){return U(e,"revoke_blend_pool",[p(t.pool)])}function xt(e,t){return U(e,"set_oracle",[tt(t.key),lt(t.oracle)])}function It(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[tt(t.key),E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function Rt(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),A(t.hubId,t.asset),m(t.paused),m(t.frozen),m(t.noSeize)])}function Et(e,t){return U(e,"set_oracle_sanity_bounds",[p(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Pt(e,t){return U(e,"update_indexes",[p(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function kt(e,t){return U(e,"renew_account",[p(e.caller),g(t.accountNonce)])}function _t(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),p(t.asset),Je(t.params)])}function qt(e,t){return U(e,"upgrade_liquidity_pool_params",[A(t.hubId,t.asset),Qe(t.params)])}function Bt(e,t){return U(e,"claim_revenue",[p(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Ot(e,t){return U(e,"add_rewards",[p(e.caller),I(t.rewards)])}function Ct(e,t){return U(e,"update_account_threshold",[p(e.caller),m(t.hasRisks),w(t.accountNonces.map((e=>g(e))))])}const Mt="00".repeat(32),Ut=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)},Lt=(e,...t)=>w([b(e),...t]),Nt=e=>E({new_owner:p(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Dt=e=>E({asset:p(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:h(e.hubId),paused:m(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:m(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),$t=e=>E({account:p(e.account),role:b(e.role)});function Wt(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.sourceAccount??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 Ft=(e,t,r)=>Wt(e,"propose",[p(e.caller),t,Ut(r)]),zt=(e,t,r)=>Wt(e,"execute_self",[S(),t,Ut(r)]);function Gt(e,t,r){return Ft(e,Lt("SetSwapAggregator",p(t.aggregator)),r)}function Ht(e,t,r){return Ft(e,Lt("SetPriceAggregator",p(t.aggregator)),r)}function Vt(e,t,r){return Ft(e,Lt("SetAccumulator",p(t.accumulator)),r)}function Xt(e,t,r){return Ft(e,Lt("SetPositionLimits",et(t)),r)}function jt(e,t){return Ft(e,Lt("CreateHub"),t)}function Kt(e,t){return Ft(e,Lt("AddSpoke"),t)}function Zt(e,t,r){return Ft(e,Lt("RemoveSpoke",h(t.spokeId)),r)}function Yt(e,t,r){return Ft(e,Lt("AddAssetToSpoke",Dt(t)),r)}function Qt(e,t,r){return Ft(e,Lt("EditAssetInSpoke",Dt(t)),r)}function Jt(e,t,r){return Ft(e,Lt("RemoveAssetFromSpoke",E({hub_asset:A((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function er(e,t,r){return Ft(e,Lt("SetSpokeLiquidationCurve",E({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 tr(e,t,r){return Ft(e,Lt("SetPositionManager",p(t.manager),m(t.isActive)),r)}function rr(e,t,r){return Ft(e,Lt("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function or(e,t,r){return Ft(e,Lt("ApproveToken",p(t.token)),r)}function nr(e,t,r){return Ft(e,Lt("RevokeToken",p(t.token)),r)}function ir(e,t,r){return Ft(e,Lt("ApproveBlendPool",p(t.pool)),r)}function ar(e,t,r){return Ft(e,Lt("RevokeBlendPool",p(t.pool)),r)}function sr(e,t,r){return Ft(e,Lt("CreateLiquidityPool",E({asset:p((o=t).asset),hub_id:h(o.hubId),params:Je(o.params)})),r);var o}function ur(e,t,r){return Ft(e,Lt("UpgradeLiquidityPoolParams",E({hub_asset:A((o=t).hubId,o.asset),params:Qe(o.params)})),r);var o}function lr(e,t,r){return Ft(e,Lt("DeployPool",v(t.wasmHash)),r)}function dr(e,t,r){return Ft(e,Lt("UpgradePool",v(t.wasmHash)),r)}function cr(e,t,r){return Ft(e,Lt("UpgradeController",v(t.wasmHash)),r)}function pr(e,t,r){return Ft(e,Lt("MigrateController",h(t.newVersion)),r)}function fr(e,t,r){return Ft(e,Lt("TransferCtrlOwnership",Nt(t)),r)}function hr(e,t,r){return Ft(e,Lt("ConfigureAssetOracle",E({key:tt((o=t).key),oracle:lt(o.oracle)})),r);var o}function gr(e,t,r){return Ft(e,Lt("EditOracleTolerance",E({key:tt((o=t).key),tolerance:h(o.tolerance)})),r);var o}function mr(e,t,r){return Ft(e,Lt("UpgradeGov",v(t.wasmHash)),r)}function yr(e,t,r){return Ft(e,Lt("UpdateGovDelay",h(t.newDelay)),r)}function br(e,t,r){return Ft(e,Lt("GrantGovRole",$t(t)),r)}function Sr(e,t,r){return Ft(e,Lt("RevokeGovRole",$t(t)),r)}function wr(e,t,r){return Ft(e,Lt("TransferGovOwnership",Nt(t)),r)}function vr(e,t){const r=w(t.argsXdr.map((e=>s.xdr.ScVal.fromXDR(e,"base64")))),o=Ut(t.predecessor??Mt);return Wt(e,"execute",[S(),p(t.target),b(t.functionName),r,o,Ut(t.salt)])}function Tr(e,t,r){return zt(e,Lt("UpgradeGov",v(t.wasmHash)),r)}function Ar(e,t,r){return zt(e,Lt("UpdateGovDelay",h(t.newDelay)),r)}function xr(e,t,r){return zt(e,Lt("GrantGovRole",$t(t)),r)}function Ir(e,t,r){return zt(e,Lt("RevokeGovRole",$t(t)),r)}function Rr(e,t,r){return zt(e,Lt("TransferGovOwnership",Nt(t)),r)}const Er=e=>w(e.map(p));function Pr(e,t,r){return Wt(e,"propose_canceller_reset",[Er(t.newCancellers),Ut(r)])}function kr(e,t,r){return Wt(e,"execute_canceller_reset",[T(t.executor,p),Er(t.newCancellers),Ut(r)])}function _r(e,t){return Wt(e,"set_spoke_asset_flags",[p(e.caller),h(t.spokeId),A(t.hubId,t.asset),m(t.paused),m(t.frozen),m(t.noSeize)])}function qr(e,t){return Wt(e,"set_oracle_sanity_bounds",[p(e.caller),p(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Br(e){return Wt(e,"create_hub",[p(e.caller)])}function Or(e){return Wt(e,"add_spoke",[p(e.caller)])}function Cr(e,t){return Wt(e,"revoke_role_immediate",[p(t.account),b(t.role)])}function Mr(e){return Wt(e,"pause",[p(e.caller)])}function Ur(e,t){return Ft(e,Lt("Unpause"),t)}const Lr=e=>e.toXDR("base64"),Nr=e=>s.xdr.ScVal.fromXDR(e,"base64"),Dr=e=>e.map((e=>String((0,s.scValToNative)(Nr(e))))).join(":"),$r=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Wr=e=>Number(e),Fr=e=>String(e),zr=e=>e instanceof Uint8Array?u.hp.from(e).toString("hex"):u.hp.isBuffer(e)?e.toString("hex"):String(e),Gr=["None","Multiply","Long","Short"],Hr=["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","flash_pos"],Vr=e=>Array.isArray(e)?e:[],Xr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Hr[Wr(o)]??$r(o)),positionType:t,hubId:Wr(e[1]),asset:Fr(e[2]),scaledAmountRay:$r(e[3]),indexRay:$r(e[4]),amount:$r(e[5]),liquidationThresholdBps:r?void 0:Wr(e[6]),liquidationBonusBps:r?void 0:Wr(e[7]),loanToValueBps:r?void 0:Wr(e[8]),liquidationFeesBps:r?void 0:Wr(e[9])};var o},jr=e=>{return{owner:Fr(e[0]),spokeId:Wr(e[1]),mode:(t=e[2],Gr[Wr(t)]??"None")};var t},Kr=e=>Array.isArray(e)?e[1]:void 0,Zr=e=>{const t=(r=e,Array.isArray(r)?Fr(r[0]):Fr(r));var r;if("Token"===t)return{Token:Fr(Kr(e))};if("Ref"===t)return{Ref:Fr(Kr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Fr(t.Token)};if(void 0!==t.Ref)return{Ref:Fr(t.Ref)}}return{Token:Fr(e)}},Yr=e=>{const t=e.tolerance??{};return{assetDecimals:Wr(e.asset_decimals),maxPriceStaleSeconds:Wr(e.max_price_stale_seconds),sources:Vr(e.sources).map((e=>e)),tolerance:{upperRatio:Wr(t.upper_ratio_bps),lowerRatio:Wr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:$r(e.min_sanity_price_wad),maxSanityPriceWad:$r(e.max_sanity_price_wad)}},Qr={"market:create":e=>({topic:"market:create",data:{hubId:Wr(e.hub_id),baseAsset:Fr(e.base_asset),maxBorrowRate:$r(e.max_borrow_rate),baseBorrowRate:$r(e.base_borrow_rate),slope1:$r(e.slope1),slope2:$r(e.slope2),slope3:$r(e.slope3),midUtilization:$r(e.mid_utilization),optimalUtilization:$r(e.optimal_utilization),maxUtilization:$r(e.max_utilization),reserveFactor:Wr(e.reserve_factor),marketAddress:Fr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{hubId:void 0===e.hub_id?void 0:Wr(e.hub_id),asset:Fr(e.asset),maxBorrowRateRay:$r(e.max_borrow_rate),baseBorrowRateRay:$r(e.base_borrow_rate),slope1Ray:$r(e.slope1),slope2Ray:$r(e.slope2),slope3Ray:$r(e.slope3),midUtilizationRay:$r(e.mid_utilization),optimalUtilizationRay:$r(e.optimal_utilization),maxUtilizationRay:$r(e.max_utilization),reserveFactorBps:Wr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Vr(e).map((e=>{return t=Vr(e),{hubId:Wr(t[0]),asset:Fr(t[1]),timestamp:Wr(t[2]),supplyIndexRay:$r(t[3]),borrowIndexRay:$r(t[4]),cash:$r(t[5]),suppliedRay:$r(t[6]),borrowedRay:$r(t[7]),revenueRay:$r(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Vr(e).map((e=>{const t=e;return{hubId:Wr(t.hub_id),asset:Fr(t.asset),params:(r=t.params,{maxBorrowRateRay:$r(r.max_borrow_rate),baseBorrowRateRay:$r(r.base_borrow_rate),slope1Ray:$r(r.slope1),slope2Ray:$r(r.slope2),slope3Ray:$r(r.slope3),midUtilizationRay:$r(r.mid_utilization),optimalUtilizationRay:$r(r.optimal_utilization),maxUtilizationRay:$r(r.max_utilization),reserveFactorBps:Wr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Wr(r.flashloan_fee),assetId:Fr(r.asset_id),assetDecimals:Wr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Vr(e);return{topic:"position:batch_update",data:{accountId:$r(t[0]),accountAttributes:jr(Vr(t[1])),updates:[...Vr(t[2]).map((e=>Xr(Vr(e),"Deposit"))),...Vr(t[3]).map((e=>Xr(Vr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),receiver:Fr(e.receiver),caller:Fr(e.caller),amount:$r(e.amount),fee:$r(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Zr(e.key),oracle:Yr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Fr(e.asset),oracle:Yr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Fr(e.liquidator),accountId:$r(e.account_id),repaidUsdWad:$r(e.repaid_usd_wad),bonusBps:$r(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:$r(e.account_id),totalBorrowUsdWad:$r(e.total_borrow_usd_wad),totalCollateralUsdWad:$r(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Fr(e.token),amount:$r(e.amount),usdValueWad:void 0===e.usd_value_wad?void 0:$r(e.usd_value_wad),accountId:$r(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),amount:$r(e.amount),fee:$r(e.fee),amountSent:$r(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Fr(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:zr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Fr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Fr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Fr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Fr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:zr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Wr(e.max_supply_positions),maxBorrowPositions:Wr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:$r(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Fr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Wr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:$r(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:$r(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Wr(t.liquidation_bonus_factor_bps)}}},"position:flash_position":e=>({topic:"position:flash_position",data:{accountId:$r(e.account_id),hubId:Wr(e.hub_id),asset:Fr(e.asset),receiver:Fr(e.receiver),caller:Fr(e.caller),amount:$r(e.amount),amountReceived:$r(e.amount_received),fee:$r(e.fee)}}),"revenue:claim":e=>({topic:"revenue:claim",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),caller:Fr(e.caller),accumulator:Fr(e.accumulator),amount:$r(e.amount)}}),"account:delegate":e=>({topic:"account:delegate",data:{accountId:$r(e.account_id),owner:Fr(e.owner),delegate:Fr(e.delegate),granted:Boolean(e.granted)}}),"config:hub":e=>({topic:"config:hub",data:{hubId:Wr(e.hub_id)}}),"config:spoke_asset":e=>{const t=e.config;return{topic:"config:spoke_asset",data:{spokeId:Wr(e.spoke_id),hubId:Wr(e.hub_id),asset:Fr(e.asset),config:{isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),paused:Boolean(t.paused),frozen:Boolean(t.frozen),noSeize:Boolean(t.no_seize),loanToValueBps:Wr(t.loan_to_value),liquidationThresholdBps:Wr(t.liquidation_threshold),liquidationBonusBps:Wr(t.liquidation_bonus),liquidationFeesBps:Wr(t.liquidation_fees),supplyCap:$r(t.supply_cap),borrowCap:$r(t.borrow_cap)}}}},"config:remove_spoke_asset":e=>({topic:"config:remove_spoke_asset",data:{spokeId:Wr(e.spoke_id),hubId:Wr(e.hub_id),asset:Fr(e.asset)}}),"strategy:blend_migration":e=>({topic:"strategy:blend_migration",data:{accountId:$r(e.account_id),blendPool:Fr(e.blend_pool),collateralCount:Wr(e.collateral_count),supplyCount:Wr(e.supply_count),debtCount:Wr(e.debt_count)}}),"strategy:harvest":e=>({topic:"strategy:harvest",data:{from:Fr(e.from),amount:$r(e.amount),pricePerShare:$r(e.price_per_share)}}),"governance:deploy_controller":e=>({topic:"governance:deploy_controller",data:{controller:Fr(e.controller),wasmHash:zr(e.wasm_hash)}}),"governance:deploy_price_aggregator":e=>({topic:"governance:deploy_price_aggregator",data:{priceAggregator:Fr(e.price_aggregator),wasmHash:zr(e.wasm_hash)}})},Jr=Object.freeze(Object.keys(Qr));function eo(e,t){const r=Dr(e),o=Qr[r];return o?o((0,s.scValToNative)(Nr(t))):null}const to=1e4;function ro(e,t){return`${e}-${BigInt(t).toString(10)}`}function oo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function no(e,t=0){return e*to+t}function io(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const ao=(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 so(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=ao(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,sourceAccount:e.sourceAccount,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 uo(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=ao(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 lo(e,t){const r=e[t];return"function"==typeof r?r.call(e):r}function co(e){if(!e||"object"!=typeof e)return;const t=e;return"function"==typeof t.switch?t.switch().name:t.type}function po(e){return fo(lo(e,"bytes"))}function fo(e){const t=e;return u.hp.from("value"in t?t.value:t)}const ho=16384;class go extends Error{code;constructor(e,t){super(`Stellar route verification failed [${e}]: ${t}`),this.name="StellarRouteVerificationError",this.code=e}}const mo=(e,t)=>{throw new go(e,t)};function yo(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*ho)return mo("OVERSIZED",`encoded route has ${t.length} characters`);try{return po(O(e))}catch(e){return mo("MALFORMED",e instanceof Error?e.message:String(e))}})(e);0===t.length&&mo("MALFORMED","route is empty"),t.length>ho&&mo("OVERSIZED",`route has ${t.length} bytes, above ${ho}`);const r=(e=>{let t;try{t=s.xdr.ScVal.fromXDR(e)}catch(e){return mo("MALFORMED",`payload is not one XDR ScVal: ${e instanceof Error?e.message:String(e)}`)}if("scvMap"!==co(t))return mo("MALFORMED","payload must be a StrategyPayload map");const r=lo(t,"map")??[];if("amounts,assets,ops"!==r.map((e=>"scvSymbol"===co(lo(e,"key"))?lo(lo(e,"key"),"sym").toString():"")).join(","))return mo("MALFORMED","payload fields must be exactly amounts, assets, ops");const[o,n,i]=r.map((e=>lo(e,"val")));return"scvVec"!==co(o)||"scvVec"!==co(n)||"scvBytes"!==co(i)?mo("MALFORMED","payload field has the wrong type"):{amounts:lo(o,"vec")??[],assets:lo(n,"vec")??[],ops:po(i)}})(t),o=r.assets.length,n=r.amounts.length;0===o&&mo("MALFORMED","asset registry is empty"),(o>256||n>126)&&mo("OVERSIZED",`registries hold ${o} assets and ${n} amounts`);const i=r.assets.map(((e,t)=>"scvAddress"!==co(e)?mo("MALFORMED",`assets[${t}] is not an address`):s.Address.fromScAddress(lo(e,"address")).toString())),a=r.amounts.map(((e,t)=>"scvI128"!==co(e)?mo("MALFORMED",`amounts[${t}] is not an i128`):(0,s.scValToBigInt)(e))),u=r.ops;u.length<10&&mo("MALFORMED","program header is truncated"),u.length>346&&mo("OVERSIZED",`program has ${u.length} bytes, above 346`);const p=e=>{const t=u[e];return void 0===t?mo("MALFORMED",`program byte ${e} is missing`):t},f=p(0);1!==f&&mo("UNSUPPORTED_VERSION",`program version ${f}, expected 1`);const h=p(8),g=p(9);0===h&&mo("INVALID_STRUCTURE","program has no instructions"),(h>48||g>32)&&mo("OVERSIZED",`program declares ${h} instructions and ${g} weights`);const m=10+5*h;u.length!==m+3*g&&mo("MALFORMED","program length does not match its instruction and weight counts");const y=p(1),b=p(2),S=p(3);(y>=o||b>=o||S>=n)&&mo("MALFORMED","header index is outside its registry"),y===b&&mo("INVALID_STRUCTURE","token_in equals token_out");const w=u.readUInt32BE(4),v=[];for(let e=0;e<g;e+=1){const t=u.readUIntBE(m+3*e,3);(0===t||t>c)&&mo("INVALID_STRUCTURE",`split weight ${t} outside 1..=1000000`),v.push(t)}const T=e=>i[e]??mo("MALFORMED",`asset index ${e} is outside the registry`),A=e=>a[e]??mo("MALFORMED",`amount index ${e} is outside the registry`),x=[];let I;for(let e=0;e<h;e+=1){const t=10+5*e,r=p(t),o=p(t+1),i=p(t+2),a=p(t+3),s=p(t+4),u=l.find((e=>d[e]===r));let c;if(u||5===r||6===r||mo("UNKNOWN_OPCODE",`instruction ${e} has opcode ${r}`),0===o)c={kind:"all"};else if(1===o)void 0!==I&&I===a||mo("INVALID_STRUCTURE",`instruction ${e} does not chain onto its predecessor`),c={kind:"prev"};else if(o>=128){const t=v[o-128];void 0===t&&mo("MALFORMED",`instruction ${e} weight index is out of range`),c={kind:"ppm",ppm:t}}else c={kind:"fixed",amount:A(o-2)};const f=T(i);5!==r&&6!==r?(a===s&&mo("INVALID_STRUCTURE",`instruction ${e} swaps a token for itself`),x.push({kind:"swap",venue:u,mode:c,pool:f,tokenIn:T(a),tokenOut:T(s)}),I=s):("all"!==c.kind&&mo("MALFORMED",`liquidity instruction ${e} must use mode All`),s>=n&&mo("MALFORMED",`instruction ${e} amount index is out of range`),x.push({kind:5===r?"burn":"mint",pool:f,shareToken:T(a),amountIndex:s}),I=6===r?a:void 0)}const R=A(S);return R<=0n&&mo("MIN_OUT_TOO_LOW",`encoded total_min_out is ${R}`),{version:f,tokenIn:T(y),tokenOut:T(b),totalMinOut:R,referralId:w,assets:i,amounts:a,ops:x,weights:v}}function bo(e,t){if(s.StrKey.isValidContract(e))return e;if(!t)return mo("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 mo("MALFORMED",`token id ${e} is not a contract id or a classic asset`)}}const So=(e,t)=>"bigint"==typeof e?e:/^\d+$/.test(e)?BigInt(e):mo("EXPECTATION_MISSING",`${t} must be a base-unit integer string`);function wo(e,t){const r=So(t.minOut,"expected.minOut");r<=0n&&mo("EXPECTATION_MISSING","expected.minOut must be positive");const o=yo(e);if(o.tokenIn!==t.tokenIn&&mo("TOKEN_IN_MISMATCH",`route spends ${o.tokenIn}, expected ${t.tokenIn}`),o.tokenOut!==t.tokenOut&&mo("TOKEN_OUT_MISMATCH",`route delivers ${o.tokenOut}, expected ${t.tokenOut}`),o.totalMinOut<r&&mo("MIN_OUT_TOO_LOW",`route enforces a minimum of ${o.totalMinOut}, below the expected ${r}`),void 0!==t.amountIn){const e=So(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&&mo("AMOUNT_IN_EXCEEDED",`a leg spends ${t.mode.amount}, above the input ${e}`)}return o}const vo=e=>k(e).toXDR("base64");function To(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.sourceAccount??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",p(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ao(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(Io),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Io),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function xo(e,t={}){const r=t.expected??{},o="string"==typeof e.routeXdr&&e.routeXdr.length>0?{routeXdr:e.routeXdr}:Ao(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 go("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 go("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return wo(o,{tokenIn:bo(r.tokenIn??e.from,t.network),tokenOut:bo(r.tokenOut??e.to,t.network),minOut:n,amountIn:r.amountIn??e.amountIn}),o}const Io=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Ro(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"!==co(r))continue;const a=lo(r,"invokeContract");if(s.Address.fromScAddress(lo(a,"contractAddress")).toString()!==o||"execute_strategy"!==lo(a,"functionName").toString())continue;const u=lo(a,"args"),[d,c,p]=u;if(3!==u.length||!d||!c||!p||"scvAddress"!==co(d)||"scvI128"!==co(c)||"scvBytes"!==co(p))return null;if(s.Address.fromScAddress(lo(d,"address")).toString()!==n)continue;const f=(0,s.scValToBigInt)(c);if(f<=0n)return null;const h=yo(po(p));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 Eo 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 Po=e=>e&&"scvAddress"===co(e)?s.Address.fromScAddress(lo(e,"address")).toString():void 0,ko=e=>e&&"scvI128"===co(e)?(0,s.scValToBigInt)(e):void 0,_o=e=>e&&"scvVec"===co(e)?lo(e,"vec")??[]:void 0,qo=(e,t)=>{if(!e||"scvMap"!==co(e))return;const r=(lo(e,"map")??[]).find((e=>"scvSymbol"===co(lo(e,"key"))&&lo(lo(e,"key"),"sym").toString()===t));return r?lo(r,"val"):void 0},Bo=e=>Po(e)??ko(e)?.toString()??e.toXDR("base64"),Oo=e=>({contract:s.Address.fromScAddress(lo(e,"contractAddress")).toString(),fn:lo(e,"functionName").toString(),args:lo(e,"args").map(Bo)}),Co=e=>{const t=lo(e,"function");return"sorobanAuthorizedFunctionTypeContractFn"===co(t)?lo(t,"contractFn"):void 0};function Mo(e,t,r){const o=e.filter((e=>{const o=lo(e,"credentials"),n=co(o);if("sorobanCredentialsAddress"!==n&&"sorobanCredentialsSourceAccount"!==n)throw new Eo("MALFORMED_TRANSACTION","unsupported authorization credentials");return("sorobanCredentialsAddress"===n?s.Address.fromScAddress(lo(lo(o,"address"),"address")).toString():r??t.caller)===t.caller}));if(o.length>1)throw new Eo("DUPLICATE_ENTRY",`${o.length} authorization entries for ${t.caller}, expected one`);const n=o[0];if(!n)return;const i=Co(lo(n,"rootInvocation"));if(!i)throw new Eo("UNEXPECTED_ROOT","root is not a contract call");const a=Oo(i);if(a.contract!==t.root.contract||a.fn!==t.root.fn)throw new Eo("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 lo(lo(n,"rootInvocation"),"subInvocations")){const r=Co(e);if(!r)throw new Eo("UNEXPECTED_CALL","sub-invocation is not a contract call");const o=Oo(r);if(lo(e,"subInvocations").length>0)throw new Eo("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(lo(r,"args"));if(i)throw new Eo("UNEXPECTED_CALL",i,o);if(l[n]=(l[n]??0)+1,(l[n]??0)>e.maxCount)throw new Eo("UNEXPECTED_CALL",`more than ${e.maxCount} calls`,o);continue}if("transfer"!==o.fn||3!==lo(r,"args").length)throw new Eo("UNEXPECTED_CALL","only `transfer` is allowed",o);if(!t.transfers.some((e=>e.token===o.contract)))throw new Eo("UNEXPECTED_TOKEN","transfer on an unexpected token",o);const[i,a,s]=lo(r,"args");if(Po(i)!==t.caller)throw new Eo("UNEXPECTED_SENDER","transfer is not from the caller",o);const d=Po(a),c=t.transfers.findIndex((e=>e.token===o.contract&&e.to===d));if(-1===c)throw new Eo("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",o);const p=ko(s),f=t.transfers[c],h=(u[c]??0n)+(p??0n);if(void 0===p||p<=0n||h>f.maxAmount)throw new Eo("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,o);u[c]=h}}const Uo=e=>{throw new Eo("MALFORMED_TRANSACTION",e)},Lo=(e,t)=>{const r=new Map;for(const t of _o(e)??Uo("payments argument is not a vector")){const[e,o]=_o(t)??[],n=Po(qo(e,"asset")),i=ko(o);if(void 0===n||void 0===i||i<0n)return Uo("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})))},No=new Set([1,3,5]),Do=(e,t,r)=>({contract:e,fn:"submit",maxCount:2,reject:e=>{if(4!==e.length)return"submit must have four arguments";if(Po(e[0])!==t)return"`from` is not the caller";if(Po(e[1])!==r||Po(e[2])!==r)return"`spender` and `to` must be the lending controller";const o=_o(e[3]);if(!o)return"requests is not a vector";for(const e of o){const t=qo(e,"request_type");if(!t||"scvU32"!==co(t)||!No.has(lo(t,"u32")))return"request is not a withdraw, withdraw-collateral, or repay"}}});function $o(e,t,r){const{contract:o,fn:n}=Oo(t),i=lo(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=ko(i[1]);if(Po(i[0])!==e||void 0===t||"scvBytes"!==co(i[2]))return Uo("execute_strategy arguments must be (caller, total_in, swap_xdr)");const r=yo(po(i[2]));return a.transfers=[{token:r.tokenIn,to:o,maxAmount:t}],a.calls=[{contract:r.tokenOut,fn:"trust",maxCount:1,reject:t=>1===t.length&&Po(t[0])===e?void 0:"`trust` is not for the caller"}],a}if(o!==r.lendingController)throw new Eo("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${o}; pass an explicit policy`);if(Po(i[0])!==e)throw new Eo("CALLER_MISMATCH",`${n} is not invoked for ${e}`);switch(n){case"supply":a.transfers=Lo(i[3],r.lendingPool);break;case"repay":case"liquidate":a.transfers=Lo(i[2],r.lendingPool);break;case"multiply":{const e=i[8];e&&"scvVoid"!==co(e)&&(a.transfers=Lo(s.xdr.ScVal.scvVec([e]),o));break}case"migrate_from_blend":{const t=Po(i[4])??Uo("blend_pool is not an address");a.calls=[Do(t,e,o)];break}}return a}const Wo=e=>s.StrKey.encodeEd25519PublicKey(fo("keyTypeMuxedEd25519"===co(e)?lo(lo(e,"med25519"),"ed25519"):lo(e,"ed25519"))),Fo=e=>{let t;try{t=s.xdr.TransactionEnvelope.fromXDR(e,"base64")}catch{return Uo("not a transaction envelope")}if("envelopeTypeTx"!==co(t))return Uo("expected a regular (v1) transaction");const r=lo(lo(t,"v1"),"tx"),o=lo(r,"operations")[0];if(!o||1!==lo(r,"operations").length)return Uo("expected exactly one operation");const n=lo(o,"body");if("invokeHostFunction"!==co(n))return Uo("operation is not a contract invocation");const i=lo(n,"invokeHostFunctionOp");return"hostFunctionTypeInvokeContract"!==co(lo(i,"hostFunction"))?Uo("host function is not a contract call"):{source:Wo(lo(o,"sourceAccount")??lo(r,"sourceAccount")),transactionSource:Wo(lo(r,"sourceAccount")),op:i,call:lo(lo(i,"hostFunction"),"invokeContract")}};function zo(e,t){const r=Fo(e);if(void 0!==t.builtXdr){const e=Fo(t.builtXdr);if(e.source!==r.source||e.transactionSource!==r.transactionSource)throw new Eo("SOURCE_CHANGED","the prepared transaction changes the source account")}if(void 0!==t.builtXdr&&lo(Fo(t.builtXdr).op,"hostFunction").toXDR("base64")!==lo(r.op,"hostFunction").toXDR("base64"))throw new Eo("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Oo(r.call));const o=t.policy??$o(t.caller,r.call,{...i(t.network),...t.deployment});if(o.caller!==t.caller)throw new Eo("CALLER_MISMATCH","the policy caller differs from the authorizing caller");if(t.caller!==r.source)for(const e of lo(r.op,"auth")){const t=lo(e,"credentials");if("sorobanCredentialsSourceAccount"===co(t)||"sorobanCredentialsAddress"===co(t)&&s.Address.fromScAddress(lo(lo(t,"address"),"address")).toString()===r.source)throw new Eo("UNEXPECTED_SENDER","the separate source account must not authorize contract calls")}Mo(lo(r.op,"auth"),o,r.source)}function Go(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Ho(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{if(r?.authorization){if(!r.network)throw new Error("network is required for address authorization");return await async function(e,t,r,o,n){if("innerTransaction"in t||0!==t.signatures.length||1!==t.operations.length)throw new Error("address authorization requires an unsigned single-operation transaction");const i=t.operations[0];if("invokeHostFunction"!==i.type)throw new Error("address authorization requires a contract invocation");const u=s.TransactionBuilder.cloneFrom(t).clearOperations().addOperation(s.Operation.invokeHostFunction({...i,auth:[]})).build(),l={cpuInstructions:o},d=await e.simulateTransaction(u,l,"record");if(s.rpc.Api.isSimulationError(d))throw new Error(d.error);const c=s.rpc.assembleTransaction(u,d).build();zo(c.toXDR(),{...n,network:r,builtXdr:t.toXDR()});const p=c.operations[0];if("invokeHostFunction"!==p.type)throw new Error("simulation changed the operation type");const f=p.auth??[];for(const e of f){const t=lo(lo(e,"rootInvocation"),"function");if("sorobanAuthorizedFunctionTypeContractFn"!==co(t)||lo(t,"contractFn").toXDR("base64")!==lo(p.func,"invokeContract").toXDR("base64"))throw new Error("recorded authorization root differs from the built invocation");const r=lo(e,"credentials"),o=co(r);if("sorobanCredentialsSourceAccount"!==o&&("sorobanCredentialsAddress"!==o||s.Address.fromScAddress(lo(lo(r,"address"),"address")).toString()!==n.caller))throw new Error("unexpected signer in recorded address authorization")}const h=[],g=Object.freeze({networkPassphrase:a[r],latestLedger:d.latestLedger});for(const e of f){const t=lo(e,"credentials");if("sorobanCredentialsSourceAccount"===co(t)){h.push(e);continue}const r=s.xdr.SorobanAuthorizationEntry.fromXDR(await n.authorizeEntry(e.toXDR("base64"),g),"base64"),o=lo(r,"credentials");if("sorobanCredentialsAddress"!==co(o))throw new Error("authorization callback changed the credentials type");const i=lo(t,"address"),a=lo(o,"address");if(lo(i,"address").toXDR("base64")!==lo(a,"address").toXDR("base64")||lo(i,"nonce").toString()!==lo(a,"nonce").toString()||lo(e,"rootInvocation").toXDR("base64")!==lo(r,"rootInvocation").toXDR("base64"))throw new Error("authorization callback changed the signer, nonce or invocation");h.push(r)}const m=s.TransactionBuilder.cloneFrom(c).clearOperations().addOperation(s.Operation.invokeHostFunction({...p,auth:h})).build(),y=await e.simulateTransaction(m,l,"enforce");if(s.rpc.Api.isSimulationError(y))throw new Error(y.error);return s.rpc.assembleTransaction(m,y).build().toXDR()}(e,n,r.network,o,r.authorization)}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 Go(r.invokedContractId,e);throw e}}async function Vo(e,t,r){return Ho(e,t.xdr,r)}function Xo(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 jo(e,t){return new Uint8Array(0)}const Ko=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 Zo(e){const t=new s.Account(e.sourceAccount??e.caller,e.sourceSequence),r=new s.Contract(e.forwarderAddress).call("mint_and_forward",s.xdr.ScVal.scvBytes(Ko(e.message)),s.xdr.ScVal.scvBytes(Ko(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 Yo=10n**27n,Qo=10n**18n,Jo=10000n,en=27,tn=18;function rn(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 on(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return e*t/r}function nn(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 an(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return(e*t+r/2n)/r}function sn(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 un=e=>10n**BigInt(e);function ln(e,t,r){return t===r?e:r>t?e*un(r-t):e/un(t-r)}function dn(e,t,r){if(t===r)return e;if(r>t)return e*un(r-t);const o=un(t-r),n=e/o;return e%o===0n?n:n+1n}function cn(e,t,r){return t===r?e:r>t?e*un(r-t):sn(e,un(t-r))}const pn={floor:on,ceil:nn,halfUp:an},fn={floor:ln,ceil:dn,halfUp:cn};function hn(e,t,r,o){return fn[o](pn[o](e,t,Yo),en,r)}function gn(e,t,r){return hn(rn(e,"scaledRay"),rn(t,"indexRay"),r,"floor")}function mn(e,t,r){return hn(rn(e,"scaledRay"),rn(t,"indexRay"),r,"ceil")}function yn(e,t,r){return hn(rn(e,"scaledRay"),rn(t,"indexRay"),r,"halfUp")}function bn(e,t){if(t>en)throw new Error(`Stellar math: decimals ${t} exceed RAY scale`);return ln(e,t,en)}function Sn(e,t,r,o){const n=pn[o](e,t,Yo),i=fn[o](n,en,tn);return pn[o](i,r,Qo)}function wn(e,t,r,o){const n=fn[o](bn(e,t),en,tn);return pn[o](n,r,Qo)}const vn=e=>Number(e)/1e18,Tn=e=>Number(e)/1e27,An=(e,t)=>Number(e)/10**t;function xn(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 In=e=>xn(e,tn),Rn=(e,t)=>an(e,t,Yo),En=(e,t)=>an(e,Yo,t);function Pn(e,t){return 0n===t?0n:En(e,t)}function kn(e,t){const r=e>Yo?Yo:e,o=rn(t.baseRateRay,"irm.baseRateRay"),n=rn(t.slope1Ray,"irm.slope1Ray"),i=rn(t.slope2Ray,"irm.slope2Ray"),a=rn(t.slope3Ray,"irm.slope3Ray"),s=rn(t.midUtilizationRay,"irm.midUtilizationRay"),u=rn(t.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=rn(t.maxBorrowRateRay,"irm.maxBorrowRateRay");let d;if(r<s)d=o+En(Rn(r,n),s);else if(r<u){const e=u-s;d=o+n+En(Rn(r-s,i),e)}else{const e=Yo-u;d=o+n+i+(0n===e?0n:En(Rn(r-u,a),e))}return d>l?l:d}function _n(e,t,r){return 0n===e||!Number.isInteger(r)||r<0||r>=1e4?0n:an(Rn(e,t),Jo-BigInt(r),Jo)}const qn=e=>Tn(e),Bn=e=>Math.expm1(Tn(e)),On=5n*Qo,Cn=(e,t,r)=>`${e}:${t}:${r}`;function Mn(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[Cn(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 ${Cn(t,r,o)}`);return i}const Un=/^0*[1-9]\d*$/,Ln=e=>"string"==typeof e&&Un.test(e)?BigInt(e).toString():null,Nn=(e,t)=>`${e}:${t}`;function Dn(e){const t=new Map,r=new Map,o=new Set,n=new Set;for(const i of e?.indexes??[]){const e=Nn(i.hubId,i.asset),a=Ln(i.supplyIndex),s=Ln(i.borrowIndex),u=Ln(i.usdPrice),l=t.get(e),d=l&&Ln(l.supplyIndex)===a&&Ln(l.borrowIndex)===s&&Ln(l.usdPrice)===u;null==a||null==s||null==u||l&&!d?o.add(e):l||t.set(e,i);const c=!1===i.valid||!0===i.stale||!0===i.deviation,p=r.get(i.asset);null==u||c||void 0!==p&&p.toString()!==u?n.add(i.asset):void 0===p&&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)=>on(e,BigInt(t),Jo);function Wn(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:vn(e.priceWad),amountBase:t.toString(),amountShort:An(t,e.decimals),usdWad:r.toString(),usd:vn(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 Fn(e){if("supply"===e.side)return Wn(e,hn(e.scaledRay,e.indexRay,e.decimals,"floor"),Sn(e.scaledRay,e.indexRay,e.priceWad,"halfUp"),Sn(e.scaledRay,e.indexRay,e.priceWad,"floor"));const t=hn(e.scaledRay,e.indexRay,e.decimals,"ceil"),r=Sn(e.scaledRay,e.indexRay,e.priceWad,"ceil");return Wn(e,t,r,r)}function zn(e,t,r,o){const n=bn(t,r);return"supply"===e?on(n,Yo,o):nn(n,Yo,o)}function Gn(e,t,r,o){const n=bn(t,r);return"supply"===e?nn(n,Yo,o):on(n,Yo,o)}function Hn(e,t){return Fn({...e,scaledRay:zn(e.side,t,e.decimals,e.indexRay)})}const Vn=(...e)=>{for(const t of e){const e=Ln(t);if(null!=e)return BigInt(e)}return Yo};function Xn(e,t,r,o){const n=rn("supply"===e?t.supplyScaledRay:t.borrowScaledRay,`${e}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(Nn(t.hubId,t.asset)),a=o.prices.get(t.asset),s="supply"===e?Vn(i?.supplyIndex,t.liveSupplyIndexRay,r.liveSupplyIndexRay,t.supplyIndexRay):Vn(i?.borrowIndex,t.liveBorrowIndexRay,r.liveBorrowIndexRay,t.borrowIndexRay),u=a??In(r.usdPrice);return Fn({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 jn=(e,t)=>e.reduce(((e,r)=>e+BigInt(t(r))),0n);function Kn(e,t,r,o,n){const i=jn(t,(e=>e.usdWad)),a=jn(t,(e=>e.ltvWeightedUsdWad)),s=jn(t,(e=>e.liquidationWeightedUsdWad)),u=jn(r,(e=>e.usdWad)),l=0n===u?null:on(s,Qo,u),d=0n===s?0:Number(u)/Number(s)*100,c=a<o||a<=u?0n:a-u;return{...e,supplies:t,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:vn(i),ltvWeightedCollateralUsdWad:a.toString(),ltvWeightedCollateralUsd:vn(a),liquidationWeightedCollateralUsdWad:s.toString(),liquidationWeightedCollateralUsd:vn(s),totalDebtUsdWad:u.toString(),totalDebtUsd:vn(u),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:vn(l),healthPercent:d,borrowLimitUsdWad:a.toString(),borrowLimitUsd:vn(a),availableBorrowUsdWad:c.toString(),availableBorrowUsd:vn(c),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:vn(o),isLiquidatable:null!==l&&l<Qo,liveDataValid:n}}function Zn(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=Dn(o),a=[],s=[];for(const e of t){const t=Mn(r,e.spokeId,e.hubId,e.asset),o=Xn("supply",e,t,i);o&&a.push(o);const n=Xn("borrow",e,t,i);n&&s.push(n)}const u=null!=o?.minBorrowCollateralUsdWad?rn(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):On,l=void 0!==o&&[...a,...s].every((e=>e.liveDataUsed));return Kn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},a,s,u,l)}const Yn=200n,Qn=e=>e.reduce(((e,t)=>t.amount<e.amount?t:e)),Jn=e=>e<0n?0n:e,ei=(e,t,r,o)=>({amountBase:e.amount,amountShort:An(e.amount,t),isFullClose:r,reason:e.reason,projectedUtilization:o}),ti=e=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:e,projectedUtilization:null});function ri(e){const t=e.assetDecimals,r=rn(e.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:xn(e.hubPool.suppliedShort,t),borrowedBase:xn(e.hubPool.borrowedShort,t),cashBase:xn(e.availableLiquidityShort,t),spokeSuppliedBase:xn(e.suppliedShort,t),spokeBorrowedBase:xn(e.borrowedShort,t),maxUtilizationRay:r>=Yo?null:r}}const oi=(e,t)=>e<=0n?null:Number(t)/Number(e);function ni(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 ii=(e,t)=>e.find((e=>e.hubId===t.hubId&&e.asset===t.asset));function ai(e,t,r){if(t.paused)return ti("paused");if(t.frozen)return ti("frozen");if(!t.isBorrowable)return ti("cap");const o=t.assetDecimals,n=ri(t),i=ii(e.borrows,t),a=Dn(r).indexes.get(Nn(t.hubId,t.asset)),s=i?BigInt(i.indexRay):rn(a?.borrowIndex??t.liveBorrowIndexRay,"borrowIndex"),u=i?BigInt(i.usdPriceWad):function(e,t){return Dn(t).prices.get(e.asset)??In(e.usdPrice)}(t,r),l=i?BigInt(i.scaledRay):0n,d=BigInt(e.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),c=BigInt(e.ltvWeightedCollateralUsdWad),p=BigInt(e.minBorrowCollateralUsdWad),f=[];if(c<p)f.push({amount:0n,reason:"minCollateral"});else{const t=c-BigInt(e.totalDebtUsdWad),r=t<=0n||u<=0n?0n:on(t,10n**BigInt(o),u),n=e=>d+Sn(l+zn("borrow",e,o,s),s,u,"ceil");f.push({amount:0n===r?0n:ni(r+16n,(e=>n(e)<=c)),reason:"ltv"})}f.push({amount:Jn(rn(t.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=an(n.suppliedBase,Yn,Jo);f.push({amount:Jn(n.cashBase-h),reason:"liquidity"});const g=function(e,t){const r=e.maxUtilizationRay;if(null===r)return null;const o=bn(e.suppliedBase,t);return 0n===o?null:ni(Jn(on(e.suppliedBase,r,Yo)-e.borrowedBase)+16n,(n=>Pn(bn(e.borrowedBase+n,t),o)<=r))}(n,o);null!==g&&f.push({amount:g,reason:"utilizationCap"});const m=Qn(f);return ei(m,o,!1,oi(n.suppliedBase,n.borrowedBase+m.amount))}function si(e,t,r){if(t.paused)return ti("paused");const o=ii(e.supplies,t);if(!o)return ti(null);const n=o.decimals,i=ri(t),a=BigInt(o.scaledRay),s=BigInt(o.indexRay),u=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),d=hn(a,s,n,"halfUp"),c=BigInt(e.totalDebtUsdWad),p=BigInt(e.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let g=!0;if(c>0n&&f>0n){const t=c>p?c:p,r=p>c?"minCollateral":"healthFactor",i=BigInt(e.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<t){g=!1;const e=t-i,l=nn(e,Jo,f),c=BigInt(o.gateUsdWad)-l,p=c<=0n?0n:on(c,10n**BigInt(n),u),m=d>0n?d-1n:0n,y=p+16n>m?m:p+16n,b=e=>{const t=Gn("supply",e,n,s);return on(Sn(t>=a?0n:a-t,s,u,"floor"),f,Jo)};h.push({amount:ni(y,(t=>b(t)>=e)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const m=function(e,t){const r=e.maxUtilizationRay;if(null===r||0n===e.borrowedBase)return null;if(0n===r)return 0n;const o=nn(e.borrowedBase,Yo,r),n=e.suppliedBase<o?0n:e.suppliedBase-o+16n,i=bn(e.borrowedBase,t);return ni(n>e.suppliedBase?e.suppliedBase:n,(o=>{const n=bn(e.suppliedBase-o,t);return n>0n&&Pn(i,n)<=r}))}(i,n);null!==m&&h.push({amount:m,reason:"utilizationCap"});const y=Qn(h),b=g&&y.amount>=l;return ei(y,n,b,oi(i.suppliedBase-y.amount,i.borrowedBase))}function ui(e){if(e.paused)return ti("paused");if(e.frozen)return ti("frozen");const t=e.assetDecimals,r=ri(e),o={amount:Jn(rn(e.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return ei(o,t,!1,oi(r.suppliedBase+o.amount,r.borrowedBase))}function li(e,t,r){if(t.paused)return ti("paused");const o=ii(e.borrows,t);if(!o)return ti(null);const n=o.decimals,i=ri(t),a=BigInt(o.amountBase),s=void 0===r?null:rn(r,"walletBalance"),u=null!==s&&s<a?{amount:s,reason:"liquidity"}:{amount:a,reason:null};return ei(u,n,u.amount>=a,oi(i.suppliedBase,Jn(i.borrowedBase-u.amount)))}const di=(e,t)=>e.hubId===t.hubId&&e.asset===t.asset,ci=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 pi(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=>di(t,e))),i=-1===n?void 0:t[n],a=ci(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+zn(e.side,a,e.decimals,e.indexRay);else{const o=-a,n=o>=("supply"===e.side?hn(t,e.indexRay,e.decimals,"halfUp"):BigInt(i.amountBase))?t:Gn(e.side,o,e.decimals,e.indexRay);r=n>=t?0n:t-n}s=0n===r?null:Fn({...e,scaledRay:r})}else s=a<=0n?null:Hn(fi(e),a);-1===n?s&&t.push(s):s?t[n]=s:t.splice(n,1)}return Kn({accountId:e.accountId,owner:e.owner,spokeId:e.spokeId,mode:e.mode},r,o,BigInt(e.minBorrowCollateralUsdWad),e.liveDataValid)}function fi(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:rn("supply"===e.side?t.liveSupplyIndexRay:t.liveBorrowIndexRay,"reserve live index"),priceWad:In(t.usdPrice),entryLtvBps:t.collateralFactorBps,entryLiquidationThresholdBps:t.liquidationThresholdBps,entryLiquidationBonusBps:t.liquidationPenaltyBps,entryLiquidationFeesBps:t.liquidationFeesBps,liveDataUsed:!1}}function hi(e,t=0n,r=0n){const o=e.assetDecimals,n=e=>e<0n?0n:e,i=n(xn(e.hubPool.suppliedShort,o)+ci(t)),a=Pn(bn(n(xn(e.hubPool.borrowedShort,o)+ci(r)),o),bn(i,o)),s=kn(a,e.irm),u=_n(a,s,e.irm.reserveFactorBps);return{utilization:Tn(a),utilizationRay:a.toString(),borrowAprRay:s.toString(),supplyAprRay:u.toString(),borrowApr:qn(s),supplyApr:qn(u),borrowApy:Bn(s),supplyApy:Bn(u)}}const gi={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."},5:{name:"PoolAlreadyDeployed",message:"Singleton pool, controller, or price aggregator already recorded."},6:{name:"InvalidAsset",message:"Invalid asset address."},7:{name:"AssetsAreTheSame",message:"Same market or token where distinct HubAssetKeys or underlying assets, respectively, are required."},8:{name:"WrongToken",message:"Params.asset_id differs from the market's asset."},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."},13:{name:"AccountNotInMarket",message:"Caller lacks the account's position NFT, or the account has no metadata."},14:{name:"AmountMustBePositive",message:"The amount must be greater than zero."},16:{name:"InvalidPayments",message:"Payments or route list empty when required, non-empty when forbidden, or over the view limit."},18:{name:"NotSmartContract",message:"Address is not a deployed contract."},24:{name:"AccountNotFound",message:"Account id has no state, or its NFT owner is unresolvable."},25:{name:"AccountModeMismatch",message:"Account mode differs from the call's required mode."},27:{name:"AggregatorNotSet",message:"Swap or price aggregator not configured."},29:{name:"PositionLimitsNotSet",message:"No position limits stored."},30:{name:"PoolNotInitialized",message:"Pool or controller unset, or market params/state missing."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},33:{name:"MathOverflow",message:"Checked arithmetic overflow or failed narrowing conversion."},34:{name:"InternalError",message:"Internal invariant failed. Report it."},36:{name:"InvalidPositionLimits",message:"Supply or borrow limit is zero or above POSITION_LIMIT_MAX (5)."},38:{name:"SpotOnlyNotProductionSafe",message:"Every oracle source reads an unsmoothed spot market."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},40:{name:"TimelockOperationExpired",message:"Scheduled operation's grace period elapsed."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},42:{name:"BlendPoolNotApproved",message:"Blend pool not approved."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},45:{name:"RegistryCapReached",message:"Account already has MAX_DELEGATES (16)."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},47:{name:"BorrowRoundsToZeroShares",message:"Positive borrow mints zero scaled debt shares."},48:{name:"CannotRemoveLastProposer",message:"Revoke would leave no proposer."},49:{name:"WithdrawRoundsToZeroShares",message:"Positive withdrawal burns zero scaled supply shares."},50:{name:"NetSettleRoundsToZeroShares",message:"Positive net settlement burns zero shares."},51:{name:"SupplyRoundsToZeroShares",message:"Positive supply mints zero scaled shares."},52:{name:"RepayRoundsToZeroShares",message:"Positive net repayment burns zero scaled debt shares."},53:{name:"PositionNftNotSet",message:"NFT address unset on a path needing it, such as account creation. Ownership lookup can return #24 instead."},54:{name:"PositionNftAlreadyDeployed",message:"Position-NFT address already recorded."},55:{name:"DivisionByZero",message:"Fixed-point multiply-divide with zero denominator."},100:{name:"InsufficientCollateral",message:"Post-operation LTV-weighted collateral below total debt, or health factor below 1 WAD."},101:{name:"HealthFactorTooHigh",message:"Target has no debt or health factor >= 1 WAD; not liquidatable."},102:{name:"HealthFactorTooLow",message:"Update_account_threshold with has_risks = true ends below 1.05 WAD. A gated liquidation-tuple refresh skips a tuple that fails its hypothetical health-factor check."},104:{name:"NotCollateral",message:"Spoke listing disallows the asset as collateral."},107:{name:"AssetNotBorrowable",message:"Spoke listing disallows borrowing the asset."},109:{name:"PositionLimitExceeded",message:"New slot exceeds the position limit, or a sub-3-decimal supply leg would coexist with another supply slot."},110:{name:"PositionNotFound",message:"Reserved code; no longer emitted."},111:{name:"InvalidPositionMode",message:"Mode is not Multiply, Long, or Short."},112:{name:"InsufficientLiquidity",message:"Market cash below the draw, or the draw breaks the liquidation buffer."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},114:{name:"CannotCleanBadDebt",message:"Account fails the bad-debt gate."},115:{name:"WithdrawLessThanFee",message:"Liquidation protocol fee exceeds the gross withdrawal."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},118:{name:"OptUtilTooHigh",message:"Optimal utilization >= 100%."},119:{name:"InvalidReserveFactor",message:"Reserve factor >= 100%."},120:{name:"DebtPositionNotFound",message:"No debt position for that hub asset."},121:{name:"CollateralPositionNotFound",message:"No supply position for that hub asset."},122:{name:"CannotCloseWithRemainingDebt",message:"Close_position with borrow positions open."},123:{name:"PoolInsolvent",message:"Supplier claims exceed cash plus debt, or zero supply with debt outstanding."},126:{name:"MinBorrowCollateralNotMet",message:"With debt outstanding, LTV-weighted collateral below the USD floor, or a sub-3-decimal supply leg under 2 raw units after floor conversion."},127:{name:"UtilizationAboveMax",message:"Post-operation utilization above max_utilization."},128:{name:"BaseRateNegative",message:"Negative base borrow rate."},129:{name:"SlopeNonMonotonic",message:"Rate slopes do not increase monotonically."},130:{name:"MaxRateBelowBase",message:"Max borrow rate not strictly above base."},131:{name:"MaxBorrowRateTooHigh",message:"Max borrow rate exceeds MAX_BORROW_RATE_RAY (200% APR)."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},133:{name:"SelfLiquidationNotAllowed",message:"SeizeMode::Credit(id) receiver is the liquidated account. Owners may still liquidate their own account."},134:{name:"InvalidLiquidationCurve",message:"Curve bounds fail validation."},135:{name:"FullCloseRequired",message:"Retired; no error site."},201:{name:"InvalidAggregator",message:"Proposed aggregator is not a deployed contract."},204:{name:"InvalidOracleTokenType",message:"Reflector asset given as string; only address or symbol accepted."},205:{name:"UnsafePriceNotAllowed",message:"Two legs disagree beyond tolerance, or only one produced a reading."},206:{name:"PriceFeedStale",message:"Observation exceeds its staleness budget. Timestamps over 60 s ahead are dropped; the error then depends on remaining sources."},208:{name:"BadLastTolerance",message:"Upper ratio outside 10150..12500 (excess over BPS outside 150..2500 bps), or lower ratio is not the required rounded reciprocal."},210:{name:"NoLastPrice",message:"No readable source, or an Aquarius LP read failed (for example, reserves or shares)."},211:{name:"NoAccumulator",message:"Controller has no revenue accumulator."},212:{name:"ReflectorHistoryEmpty",message:"Reflector returns no price history."},216:{name:"OracleNotConfigured",message:"No oracle for the price key, or the response omits a requested asset."},217:{name:"InvalidPrice",message:"Price <= 0, or LP fair-value math non-representable."},218:{name:"InvalidStalenessConfig",message:"Max_stale_seconds out of range or below the source's guaranteed freshness."},219:{name:"TwapInsufficientObservations",message:"Record count zero or below the smoothing minimum, or history too short, too long, or denser than feed resolution."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},222:{name:"InvalidOracleResolution",message:"Reflector resolution below minimum, above max_stale_seconds, or implying a TWAP span above it."},223:{name:"SanityBoundViolated",message:"Price outside the stored sanity band."},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."},226:{name:"SanityBandTooWideForSingleSource",message:"Band exceeds the tighter limit for single-source, LP, or dual-source oracles with identical provider trust sets."},227:{name:"SanityBandMustTighten",message:"Set_sanity_band would widen the band. Widen via timelocked ConfigureAssetOracle."},228:{name:"TwapRecordsOutOfRange",message:"Record count above MAX_TWAP_RECORDS (12)."},229:{name:"OracleDepthExceeded",message:"Composition nests deeper than MAX_RESOLUTION_DEPTH (3)."},230:{name:"FactorOutOfBounds",message:"Scaled source's factor price outside its min/max."},231:{name:"SourceCountOutOfRange",message:"Zero or over two sources, or Aquarius LP combined with another source."},232:{name:"IndependenceNotDeclared",message:"Sources violate RequireDisjoint, or AllowShared is empty or not exactly the shared providers."},234:{name:"UnsupportedAquariusPool",message:"Aquarius pool of wrong type, or zero reserve or total shares."},235:{name:"InsufficientAquariusLiquidity",message:"Pool value below min_pool_value_wad."},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."},310:{name:"SpokeMismatch",message:"Account's spoke differs from the targeted spoke."},311:{name:"SpokeSupplyCapReached",message:"Supply would exceed the spoke supply cap."},312:{name:"SpokeBorrowCapReached",message:"Borrow would exceed the spoke borrow cap."},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."},319:{name:"SpokeFlagsEpochMismatch",message:"RelaxSpokeAssetFlags epoch is stale or wrong; checked at proposal and execution."},400:{name:"FlashLoanOngoing",message:"Flash loan in progress; re-entrant calls refused."},401:{name:"FlashloanNotEnabled",message:"Market is_flashloanable is false."},402:{name:"InvalidFlashloanRepay",message:"Allowance below principal plus fee, or a pool balance check after payout, callback, or repayment fails."},409:{name:"StrategyFeeExceeds",message:"Strategy fee exceeds the borrowed amount."},412:{name:"InvalidFlashloanReceiver",message:"Receiver not a deployed Wasm contract, or a controller payout targets the controller or pool."},500:{name:"ConvertStepsRequired",message:"Multiply initial payment is neither collateral nor debt asset, with no convert_swap."},501:{name:"RouterOverspend",message:"Controller input balance rose during the swap, or router spent over amount_in."},502:{name:"NoSwapOutput",message:"Swap produced no positive measured output."},503:{name:"CollateralRequired",message:"Flash_position collateral list has no positive minimum. Empty list raises #16."},504:{name:"CollateralMinimumNotMet",message:"Measured deposit below its minimum, or none positive."},505:{name:"FlashPositionClosed",message:"Flash_position ended without supply or positive debt in its debt market."}},mi=new Set([1,3,6,10,11,12]),yi=/Error\(Contract,\s*#(\d+)\)/,bi=/contract:(C[A-Z2-7]{55})[^\n]*?Error\(Contract,\s*#(\d+)\)/g,Si=/\[xoxno-invoked:(C[A-Z2-7]{55})\]/,wi=/contract:C[A-Z2-7]{55}/;function vi(e,t){let r;if(t?.contracts?.length)r=((e,t)=>{for(const r of e.matchAll(bi))if(t.has(r[1]))return Number(r[2]);if(wi.test(e))return null;const r=e.match(Si),o=e.match(yi);if(!r||!t.has(r[1])||!o)return null;const n=Number(o[1]);return mi.has(n)?null:n})(e,new Set(t.contracts));else{const t=e.match(yi);r=t?Number(t[1]):null}if(null===r)return null;const o=gi[r];return o?{code:r,...o}:null}},468(e,t,r){"use strict";r.d(t,{createStellarLendingReadClient:()=>w,lendingAssetsSchema:()=>b,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,t=[]){return{type:"object",required:Object.keys(e).filter((e=>!t.includes(e))),properties:e}}const c={sac:o,symbol:o,name:o,decimals:s,logoUrl:a},p=d({valid:i,stale:i,deviation:i,timestamp:s}),f={type:"object",properties:{nativeApy:n,feesApr:n},description:"Embedded annualized yield fractions, separate from base lending interest."},h=d({extraApy:f,...c,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:p,indexRay:a,indexedAt:n,indexedLedger:n},["extraApy"]),g=d({amountRaw:a,amount:a,usd:s}),m=d({spokeId:n,spokeName:o,ltvBps:n,supplyCapacity:g,borrowCapacity:g,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:h},borrow:{type:"array",items:h},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})},b={type:"array",items:d({extraApy:f,...c,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:p,spokes:{type:"array",items:m},dataStatus:l,indexedAt:{...n,description:"Pool state timestamp. Capacities are indexed snapshot estimates; prepare/simulate before signing."},indexedLedger:n},["extraApy"])};function S(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 w(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:"manual"});if("opaqueredirect"===e.type||e.status>=300&&e.status<400||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=S(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)}}}},928(e,t,r){"use strict";r.d(t,{sW:()=>s,Zc:()=>a,GW:()=>u});const o="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",n="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",a=3e4;var s;!function(e){e.MAINNET="1",e.DEVNET="D"}(s||(s={}));class u{apiUrl;chain;init;config;constructor(e){if(!e?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:t=s.MAINNET,apiUrl:r,...a}=e;this.apiUrl=r.trim().replace(/\/$/,""),this.chain=t,this.init=a,this.config=t==s.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:o,DR_SC:n,KG_SC:i,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:o,DR_SC:n,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:i,timeout:s,...u}=this.init,{next:l,cache:d,debug:c,timeout:p,headers:f,method:h="GET",...g}=r,m=f?.Authorization,y="Bearer undefined"===m?void 0:m,b="GET"!==h&&"HEAD"!==h&&"PUT"!==h,S={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...b?{"Content-Type":"application/json"}:{},...y?{Authorization:y}:{}},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??{},R="GET"!==h||y?void 0:x??T,E="GET"!==h||y||R?void 0:d??n,P=g.body,k=p??s??(null==P?a:0),_=k>0?AbortSignal.timeout(k):void 0,q=g.signal??u.signal,B=_&&q?AbortSignal.any([q,_]):_??q,O={...u,...g,method:h,...Object.keys(S).length?{headers:S}:{},...B?{signal:B}:{},cache:E,next:{...A,...I,revalidate:R}};(c??i)&&console.debug("SDK fetch: ",v,O);const C=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 C.text();if(!C.ok){let e;try{e=JSON.parse(M)}catch{e={message:M}}const t=[v,C.status,C.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(M)}catch{return M}}}}},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:()=>d.BPS,Chain:()=>e.sW,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>d.DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD,DEFAULT_REQUEST_TIMEOUT_MS:()=>e.Zc,LIQUIDATION_BUFFER_BPS:()=>d.LIQUIDATION_BUFFER_BPS,RAY:()=>d.RAY,RAY_DECIMALS:()=>d.RAY_DECIMALS,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>d.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>d.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>d.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>d.STELLAR_NETWORK_PASSPHRASE,STELLAR_ROUTE_MAX_BYTES:()=>d.STELLAR_ROUTE_MAX_BYTES,SYNTHETIC_EVENT_ORDER_STRIDE:()=>d.SYNTHETIC_EVENT_ORDER_STRIDE,StellarAuthPolicyError:()=>d.StellarAuthPolicyError,StellarRouteVerificationError:()=>d.StellarRouteVerificationError,WAD:()=>d.WAD,WAD_DECIMALS:()=>d.WAD_DECIMALS,XOXNOClient:()=>e.GW,aggregateAccountRisk:()=>d.aggregateAccountRisk,annualBorrowRateRay:()=>d.annualBorrowRateRay,assertStellarAuthEntries:()=>d.assertStellarAuthEntries,assertStellarPreparedTxAuth:()=>d.assertStellarPreparedTxAuth,baseToRay:()=>d.baseToRay,baseToShort:()=>d.baseToShort,baseValueWad:()=>d.baseValueWad,buildLiveSnapshot:()=>d.buildLiveSnapshot,buildSameTokenRepaySwapSteps:()=>d.buildSameTokenRepaySwapSteps,buildSdk:()=>h,buildStellarAcceptOwnershipTx:()=>d.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>d.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>d.buildStellarApproveBlendPoolTx,buildStellarBorrowBatchTx:()=>d.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>d.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>d.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>d.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>d.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>d.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>d.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>d.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>d.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>d.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>d.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>d.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>d.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>d.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>d.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>d.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>d.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>d.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>d.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>d.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>d.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>d.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>d.buildStellarLiquidateTx,buildStellarLiquidationEstimateTx:()=>d.buildStellarLiquidationEstimateTx,buildStellarMigrateFromBlendTx:()=>d.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>d.buildStellarMigrateTx,buildStellarMultiplyTx:()=>d.buildStellarMultiplyTx,buildStellarPauseTx:()=>d.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>d.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>d.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>d.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>d.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>d.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>d.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeCreateHubTx:()=>d.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>d.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>d.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>d.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>d.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>d.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>d.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>d.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>d.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>d.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>d.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>d.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>d.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>d.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>d.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>d.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>d.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>d.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>d.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>d.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>d.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>d.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>d.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>d.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>d.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>d.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>d.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>d.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>d.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>d.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>d.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>d.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>d.buildStellarRevokeRoleTx,buildStellarSetAccumulatorTx:()=>d.buildStellarSetAccumulatorTx,buildStellarSetOracleSanityBoundsTx:()=>d.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>d.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>d.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>d.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>d.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>d.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>d.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>d.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>d.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>d.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>d.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>d.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>d.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>d.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>d.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>d.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>d.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>d.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>d.buildStellarWithdrawTx,buildTx:()=>d.buildTx,burnShares:()=>d.burnShares,computeAccountRisk:()=>d.computeAccountRisk,createStellarLendingReadClient:()=>d.createStellarLendingReadClient,decodeStellarLendingEvent:()=>d.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>d.decodeStellarLiquidateReturn,decodeStellarLiquidationEstimate:()=>d.decodeStellarLiquidationEstimate,decodeStellarRouteBytes:()=>d.decodeStellarRouteBytes,decodeStellarSwapEnvelope:()=>d.decodeStellarSwapEnvelope,depositRateRay:()=>d.depositRateRay,divByIntHalfUp:()=>d.divByIntHalfUp,encodeAssetOracle:()=>d.encodeAssetOracle,encodeInterestRateModel:()=>d.encodeInterestRateModel,encodeMarketParamsRaw:()=>d.encodeMarketParamsRaw,encodePositionLimits:()=>d.encodePositionLimits,encodePriceKey:()=>d.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>d.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>d.extractEventOrder,getStellarAccountPositions:()=>d.getStellarAccountPositions,getStellarActiveUsersSeries:()=>d.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>d.getStellarAggregatorQuote,getStellarAsset:()=>d.getStellarAsset,getStellarAssetGraph:()=>d.getStellarAssetGraph,getStellarAssetMarkets:()=>d.getStellarAssetMarkets,getStellarAssetPage:()=>d.getStellarAssetPage,getStellarAssets:()=>d.getStellarAssets,getStellarCampaignLeaderboard:()=>d.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>d.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>d.getStellarDefiLlamaDimensions,getStellarDeployment:()=>d.getStellarDeployment,getStellarDetailedMarkets:()=>d.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>d.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>d.getStellarGovernanceProposals,getStellarHolderDistribution:()=>d.getStellarHolderDistribution,getStellarHub:()=>d.getStellarHub,getStellarHubGraph:()=>d.getStellarHubGraph,getStellarHubHolders:()=>d.getStellarHubHolders,getStellarHubs:()=>d.getStellarHubs,getStellarLendingContext:()=>d.getStellarLendingContext,getStellarLendingLiveState:()=>d.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>d.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>d.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>d.getStellarParticipantCounts,getStellarPnlByScope:()=>d.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>d.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>d.getStellarPositionsPnl,getStellarQuoteTokens:()=>d.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>d.getStellarRateSpreadSeries,getStellarReserve:()=>d.getStellarReserve,getStellarReserveGraph:()=>d.getStellarReserveGraph,getStellarReserveHolders:()=>d.getStellarReserveHolders,getStellarReserves:()=>d.getStellarReserves,getStellarRevenueSeries:()=>d.getStellarRevenueSeries,getStellarSpoke:()=>d.getStellarSpoke,getStellarSpokeGraph:()=>d.getStellarSpokeGraph,getStellarSpokeHolders:()=>d.getStellarSpokeHolders,getStellarSpokes:()=>d.getStellarSpokes,getStellarStatsHistory:()=>d.getStellarStatsHistory,getStellarUserActivity:()=>d.getStellarUserActivity,getStellarUserActivityPage:()=>d.getStellarUserActivityPage,getStellarUserHistory:()=>d.getStellarUserHistory,getStellarUserPositions:()=>d.getStellarUserPositions,getStellarVolumeSeries:()=>d.getStellarVolumeSeries,getStellarWalletBalance:()=>d.getStellarWalletBalance,getStellarWalletTokens:()=>d.getStellarWalletTokens,isValidCollectionTicker:()=>t,isValidNftIdentifier:()=>n,lendingAssetsSchema:()=>d.lendingAssetsSchema,lendingPositionsSchema:()=>d.lendingPositionsSchema,liveIndexKey:()=>d.liveIndexKey,mapQuoteResponseToStrategyPayload:()=>d.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>d.mapQuoteResponseToStrategySwap,mapSorobanError:()=>d.mapSorobanError,mapStellarPositionActivityType:()=>d.mapStellarPositionActivityType,maxBorrow:()=>d.maxBorrow,maxRepay:()=>d.maxRepay,maxSupply:()=>d.maxSupply,maxWithdraw:()=>d.maxWithdraw,mintShares:()=>d.mintShares,mulDivCeil:()=>d.mulDivCeil,mulDivFloor:()=>d.mulDivFloor,mulDivHalfUp:()=>d.mulDivHalfUp,numberToScaled:()=>d.numberToScaled,numberToWad:()=>d.numberToWad,parseStellarTokenAmount:()=>d.parseStellarTokenAmount,positionValueWad:()=>d.positionValueWad,prepareStellarBuiltTx:()=>d.prepareStellarBuiltTx,prepareStellarTxXdr:()=>d.prepareStellarTxXdr,projectAccountRisk:()=>d.projectAccountRisk,projectReserveApy:()=>d.projectReserveApy,rayAprToApy:()=>d.rayAprToApy,rayAprToNumber:()=>d.rayAprToNumber,rayToNumber:()=>d.rayToNumber,rescaleCeil:()=>d.rescaleCeil,rescaleFloor:()=>d.rescaleFloor,rescaleHalfUp:()=>d.rescaleHalfUp,reserveKey:()=>d.reserveKey,resolveReserve:()=>d.resolveReserve,stellarAuthPolicyForInvocation:()=>d.stellarAuthPolicyForInvocation,stellarLendingDispatchKey:()=>d.stellarLendingDispatchKey,stellarLendingRead:()=>d.stellarLendingRead,stellarNetworks:()=>d.stellarNetworks,stellarTokenContractId:()=>d.stellarTokenContractId,syntheticEventOrder:()=>d.syntheticEventOrder,tagStellarInvokedContractError:()=>d.tagStellarInvokedContractError,toBase64Xdr:()=>d.toBase64Xdr,toBigInt:()=>d.toBigInt,toStellarPositionMode:()=>d.toStellarPositionMode,unscale:()=>d.unscale,unscaleBorrowCeil:()=>d.unscaleBorrowCeil,unscaleHalfUp:()=>d.unscaleHalfUp,unscaleSupplyFloor:()=>d.unscaleSupplyFloor,utilizationRay:()=>d.utilizationRay,valueBasePosition:()=>d.valueBasePosition,valueScaledPosition:()=>d.valueScaledPosition,verifyStellarRouteBytes:()=>d.verifyStellarRouteBytes,wadToNumber:()=>d.wadToNumber});var e=r(928);const t=e=>{const t=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e),r=/^C[A-Z2-7]{55}$/.test(e);return t||r},n=e=>{const t=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e),r=/^C[A-Z2-7]{55}-\d+$/.test(e);return t||r};class i extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class a extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const s=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)),u={"/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:{}},"/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:{}}},l=["PATCH","POST","DELETE","PUT"];var d=r(999);const c=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),p=()=>({static:{},params:{},leaves:[]});function f(e,r,o,n){const{input:u,output:d,...c}=r,p=async(r={})=>{const u={...o,...r},l=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),d=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),c=Object.fromEntries(Object.entries(u).filter((([e])=>!d.includes(e)))),p=/:address[^A-Z]/.test(e)||"address"in c,f=/:collection[^A-Z]/.test(e)||"collection"in c;if(p){const e=u.address;if(!s(e))throw new a(e)}if(f){const e=u.collection;if(Array.isArray(e)?e.some((e=>!t(e))):!t(e))throw new i(e)}const h=Object.fromEntries(Object.entries(c).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:m,method:y,headers:b,cache:S,next:w,debug:v,signal:T,credentials:A,mode:x,redirect:I,referrer:R,referrerPolicy:E,integrity:P,keepalive:k,priority:_,window:q,continuationToken:B,...O}=h,C=m?`Bearer ${m}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==B&&(O.continuationToken=B);const M={...b,...C?{Authorization:C}:{},...B&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(B)}:{}},U={...w,tags:[...w?.tags??[],l]};return n.fetchWithTimeout(l,{method:y,params:O,body:g,headers:M,cache:S,debug:v,...Object.fromEntries(Object.entries({signal:T,credentials:A,mode:x,redirect:I,referrer:R,referrerPolicy:E,integrity:P,keepalive:k,priority:_,window:q}).filter((([,e])=>void 0!==e))),...U?{next:U}:{}})},f=(e={})=>p(e);for(const e of Object.keys(c))l.includes(e)&&(f[e]=t=>p({...t,method:t.method??e.toUpperCase()}));return f}function h(e){const t=function(){const e=p();for(const[t,r]of Object.entries(u)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=c(e.slice(1));n=n.params[t]||=p()}else{const t=c(e);n=n.static[t]||=p()}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=f(r,n,o,e)}else{s={};for(const{rawPath:r,def:n}of t.leaves)s[c(r.split("/").pop().replace(/^:/,""))]=f(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})();
|
package/dist/sdk/swagger.d.ts
CHANGED
|
@@ -305,10 +305,6 @@ export declare const endpoints: {
|
|
|
305
305
|
readonly input: {};
|
|
306
306
|
readonly output: XoxnoLiquidStatsDto;
|
|
307
307
|
};
|
|
308
|
-
readonly "/liquid/sui/stats": {
|
|
309
|
-
readonly input: {};
|
|
310
|
-
readonly output: XoxnoLiquidStatsDto;
|
|
311
|
-
};
|
|
312
308
|
readonly "/analytics/marketplace-unique-users": {
|
|
313
309
|
readonly input: {
|
|
314
310
|
before: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.238",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"dependencies": {
|
|
141
141
|
"@multiversx/sdk-core": "^15.3.2",
|
|
142
142
|
"@multiversx/sdk-network-providers": "^2.9.3",
|
|
143
|
-
"@xoxno/types": "1.0.
|
|
143
|
+
"@xoxno/types": "1.0.505",
|
|
144
144
|
"buffer": "^6.0.3"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|