@xoxno/sdk-js 1.0.217 → 1.0.219

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.
Files changed (39) hide show
  1. package/dist/cjs/sdk/stellar/__tests__/auth-policy.test.d.ts +1 -0
  2. package/dist/cjs/sdk/stellar/__tests__/math/account.test.d.ts +10 -0
  3. package/dist/cjs/sdk/stellar/__tests__/math/parity.test.d.ts +14 -0
  4. package/dist/cjs/sdk/stellar/__tests__/math/scaled-rates.test.d.ts +6 -0
  5. package/dist/cjs/sdk/stellar/__tests__/route-verify.test.d.ts +1 -0
  6. package/dist/cjs/sdk/stellar/auth-policy.d.ts +106 -0
  7. package/dist/cjs/sdk/stellar/contracts.d.ts +6 -0
  8. package/dist/cjs/sdk/stellar/index.d.ts +3 -0
  9. package/dist/cjs/sdk/stellar/math/account.d.ts +183 -0
  10. package/dist/cjs/sdk/stellar/math/index.d.ts +12 -0
  11. package/dist/cjs/sdk/stellar/math/limits.d.ts +80 -0
  12. package/dist/cjs/sdk/stellar/math/projection.d.ts +53 -0
  13. package/dist/cjs/sdk/stellar/math/rates.d.ts +34 -0
  14. package/dist/cjs/sdk/stellar/math/scaled.d.ts +99 -0
  15. package/dist/cjs/sdk/stellar/route-verify.d.ts +100 -0
  16. package/dist/cjs/sdk/stellar/scval-encode.d.ts +10 -0
  17. package/dist/cjs/sdk/stellar/swap.d.ts +26 -6
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.esm.js +1 -1
  20. package/dist/sdk/stellar/__tests__/auth-policy.test.d.ts +1 -0
  21. package/dist/sdk/stellar/__tests__/math/account.test.d.ts +10 -0
  22. package/dist/sdk/stellar/__tests__/math/parity.test.d.ts +14 -0
  23. package/dist/sdk/stellar/__tests__/math/scaled-rates.test.d.ts +6 -0
  24. package/dist/sdk/stellar/__tests__/route-verify.test.d.ts +1 -0
  25. package/dist/sdk/stellar/auth-policy.d.ts +106 -0
  26. package/dist/sdk/stellar/contracts.d.ts +6 -0
  27. package/dist/sdk/stellar/index.cjs +1 -1
  28. package/dist/sdk/stellar/index.d.ts +3 -0
  29. package/dist/sdk/stellar/index.esm.js +1 -1
  30. package/dist/sdk/stellar/math/account.d.ts +183 -0
  31. package/dist/sdk/stellar/math/index.d.ts +12 -0
  32. package/dist/sdk/stellar/math/limits.d.ts +80 -0
  33. package/dist/sdk/stellar/math/projection.d.ts +53 -0
  34. package/dist/sdk/stellar/math/rates.d.ts +34 -0
  35. package/dist/sdk/stellar/math/scaled.d.ts +99 -0
  36. package/dist/sdk/stellar/route-verify.d.ts +100 -0
  37. package/dist/sdk/stellar/scval-encode.d.ts +10 -0
  38. package/dist/sdk/stellar/swap.d.ts +26 -6
  39. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.esm.js.LICENSE.txt */
2
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as r,Contract as o,ScInt as n,TransactionBuilder as i,scValToNative as u,xdr as s}from"@stellar/stellar-sdk";var a={526(t,e){e.byteLength=function(t){var e=s(t),r=e[0],o=e[1];return 3*(r+o)/4-o},e.toByteArray=function(t){var e,r,i=s(t),u=i[0],a=i[1],p=new n(function(t,e,r){return 3*(e+r)/4-r}(0,u,a)),l=0,c=a>0?u-4:u;for(r=0;r<c;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],p[l++]=e>>16&255,p[l++]=e>>8&255,p[l++]=255&e;return 2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,p[l++]=255&e),1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,p[l++]=e>>8&255,p[l++]=255&e),p},e.fromByteArray=function(t){for(var e,o=t.length,n=o%3,i=[],u=16383,s=0,p=o-n;s<p;s+=u)i.push(a(t,s,s+u>p?p:s+u));return 1===n?(e=t[o-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[o-2]<<8)+t[o-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)r[u]=i[u],o[i.charCodeAt(u)]=u;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t,e,o){for(var n,i,u=[],s=e;s<o;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(t,e,r){const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=a,e.IS=50;const u=2147483647;function s(t){if(t>u)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return p(t,e,r)}function p(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let o=s(r);const n=o.write(t,e);return n!==r&&(o=o.slice(0,n)),o}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return f(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return f(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return a.from(o,e,r);const n=function(t){if(a.isBuffer(t)){const e=0|h(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?s(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),s(t<0?0:0|h(t))}function d(t){const e=t.length<0?0:0|h(t.length),r=s(e);for(let o=0;o<e;o+=1)r[o]=255&t[o];return r}function f(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(o,a.prototype),o}function h(t){if(t>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return o?-1:j(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){let o=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return _(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return q(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function m(t,e,r){const o=t[e];t[e]=t[r],t[r]=o}function b(t,e,r,o,n){if(0===t.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:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=a.from(e,o)),a.isBuffer(e))return 0===e.length?-1:w(t,e,r,o,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,o,n);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,o,n){let i,u=1,s=t.length,a=e.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}function p(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(n){let o=-1;for(i=r;i<s;i++)if(p(t,i)===p(e,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===a)return o*u}else-1!==o&&(i-=i-o),o=-1}else for(r+a>s&&(r=s-a),i=r;i>=0;i--){let r=!0;for(let o=0;o<a;o++)if(p(t,i+o)!==p(e,o)){r=!1;break}if(r)return i}return-1}function S(t,e,r,o){r=Number(r)||0;const n=t.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=e.length;let u;for(o>i/2&&(o=i/2),u=0;u<o;++u){const o=parseInt(e.substr(2*u,2),16);if(Z(o))return u;t[r+u]=o}return u}function v(t,e,r,o){return X(j(e,t.length-r),t,r,o)}function x(t,e,r,o){return X(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,o)}function T(t,e,r,o){return X(H(e),t,r,o)}function A(t,e,r,o){return X(function(t,e){let r,o,n;const i=[];for(let u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(e,t.length-r),t,r,o)}function q(t,e,r){return 0===e&&r===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(e,r))}function _(t,e,r){r=Math.min(t.length,r);const o=[];let n=e;for(;n<r;){const e=t[n];let i=null,u=e>239?4:e>223?3:e>191?2:1;if(n+u<=r){let r,o,s,a;switch(u){case 1:e<128&&(i=e);break;case 2:r=t[n+1],128==(192&r)&&(a=(31&e)<<6|63&r,a>127&&(i=a));break;case 3:r=t[n+1],o=t[n+2],128==(192&r)&&128==(192&o)&&(a=(15&e)<<12|(63&r)<<6|63&o,a>2047&&(a<55296||a>57343)&&(i=a));break;case 4:r=t[n+1],o=t[n+2],s=t[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(a=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&s,a>65535&&a<1114112&&(i=a))}}null===i?(i=65533,u=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=u}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let r="",o=0;for(;o<e;)r+=String.fromCharCode.apply(String,t.slice(o,o+=k));return r}(o)}a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return p(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,o=e.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(t[n]!==e[n]){r=t[n],o=e[n];break}return r<o?-1:o<r?1:0},a.isEncoding=function(t){switch(String(t).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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const o=a.allocUnsafe(e);let n=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))n+e.length>o.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(o,n)):Uint8Array.prototype.set.call(o,e,n);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(o,n)}n+=e.length}return o},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(t,e,r,o,n){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),e<0||r>t.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&e>=r)return 0;if(o>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(n>>>=0)-(o>>>=0),u=(r>>>=0)-(e>>>=0);const s=Math.min(i,u),p=this.slice(o,n),l=t.slice(e,r);for(let t=0;t<s;++t)if(p[t]!==l[t]){i=p[t],u=l[t];break}return i<u?-1:u<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.prototype.write=function(t,e,r,o){if(void 0===e)o="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)o=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return S(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function I(t,e,r){let o="";r=Math.min(t.length,r);for(let n=e;n<r;++n)o+=String.fromCharCode(127&t[n]);return o}function E(t,e,r){let o="";r=Math.min(t.length,r);for(let n=e;n<r;++n)o+=String.fromCharCode(t[n]);return o}function P(t,e,r){const o=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=e;o<r;++o)n+=K[t[o]];return n}function R(t,e,r){const o=t.slice(e,r);let n="";for(let t=0;t<o.length-1;t+=2)n+=String.fromCharCode(o[t]+256*o[t+1]);return n}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,o,n,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<i)throw new RangeError('"value" argument is out of bounds');if(r+o>t.length)throw new RangeError("Index out of range")}function B(t,e,r,o,n){F(e,o,n,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=u,u>>=8,t[r++]=u,u>>=8,t[r++]=u,u>>=8,t[r++]=u,r}function U(t,e,r,o,n){F(e,o,n,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=u,u>>=8,t[r+2]=u,u>>=8,t[r+1]=u,u>>=8,t[r]=u,r+8}function C(t,e,r,o,n,i){if(r+o>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,r,o,i){return e=+e,r>>>=0,i||C(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function N(t,e,r,o,i){return e=+e,r>>>=0,i||C(t,0,r,8),n.write(t,e,r,o,52,8),r+8}a.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const o=this.subarray(t,e);return Object.setPrototypeOf(o,a.prototype),o},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t],n=1,i=0;for(;++i<e&&(n*=256);)o+=this[t+i]*n;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t+--e],n=1;for(;e>0&&(n*=256);)o+=this[t+--e]*n;return o},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),a.prototype.readBigUInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=this[t],n=1,i=0;for(;++i<e&&(n*=256);)o+=this[t+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let o=e,n=1,i=this[t+--o];for(;o>0&&(n*=256);)i+=this[t+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),a.prototype.readBigInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const o=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||M(this,t,e,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[e]=255&t;++i<r&&(n*=256);)this[e+i]=t/n&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||M(this,t,e,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[e+n]=255&t;--n>=0&&(i*=256);)this[e+n]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=J((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=J((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,r,o){if(t=+t,e>>>=0,!o){const o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}let n=0,i=1,u=0;for(this[e]=255&t;++n<r&&(i*=256);)t<0&&0===u&&0!==this[e+n-1]&&(u=1),this[e+n]=(t/i|0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,o){if(t=+t,e>>>=0,!o){const o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}let n=r-1,i=1,u=0;for(this[e+n]=255&t;--n>=0&&(i*=256);)t<0&&0===u&&0!==this[e+n+1]&&(u=1),this[e+n]=(t/i|0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=J((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=J((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,o){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<o-r&&(o=t.length-e+r);const n=o-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,o):Uint8Array.prototype.set.call(t,this.subarray(r,o),e),n},a.prototype.fill=function(t,e,r,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=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&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){const e=t.charCodeAt(0);("utf8"===o&&e<128||"latin1"===o)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let n;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{const i=a.isBuffer(t)?t:a.from(t,o),u=i.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=i[n%u]}return this};const L={};function D(t,e,r){L[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",r=t.length;const o="-"===t[0]?1:0;for(;r>=o+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function F(t,e,r,o,n,i){if(t>r||t<e){const o="bigint"==typeof e?"n":"";let n;throw n=i>3?0===e||e===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}`:`>= ${e}${o} and <= ${r}${o}`,new L.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||G(e,t.length-(r+1))}(o,n,i)}function z(t,e){if("number"!=typeof t)throw new L.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new L.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,r){let o=`The value of "${t}" 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 ${e}. Received ${n}`,o}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function j(t,e){let r;e=e||1/0;const o=t.length;let n=null;const i=[];for(let u=0;u<o;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===o){(e-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(t){return o.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,o){let n;for(n=0;n<o&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)e[o+n]=t[r]+t[n]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},251(t,e){e.read=function(t,e,r,o,n){var i,u,s=8*n-o-1,a=(1<<s)-1,p=a>>1,l=-7,c=r?n-1:0,d=r?-1:1,f=t[e+c];for(c+=d,i=f&(1<<-l)-1,f>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=d,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=o;l>0;u=256*u+t[e+c],c+=d,l-=8);if(0===i)i=1-p;else{if(i===a)return u?NaN:1/0*(f?-1:1);u+=Math.pow(2,o),i-=p}return(f?-1:1)*u*Math.pow(2,i-o)},e.write=function(t,e,r,o,n,i){var u,s,a,p=8*i-n-1,l=(1<<p)-1,c=l>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),(e+=u+c>=1?d/a:d*Math.pow(2,1-c))*a>=2&&(u++,a/=2),u+c>=l?(s=0,u=l):u+c>=1?(s=(e*a-1)*Math.pow(2,n),u+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),u=0));n>=8;t[r+f]=255&s,f+=h,s/=256,n-=8);for(u=u<<n|s,p+=n;p>0;t[r+f]=255&u,f+=h,u/=256,p-=8);t[r+f-h]|=128*y}},34(a,p,l){l.d(p,{G_M:()=>De,fAY:()=>uo,a_O:()=>c,A$9:()=>h,gRW:()=>ao,VZJ:()=>Io,N0v:()=>be,B_D:()=>Ne,qLM:()=>Ae,eX8:()=>_e,zaA:()=>wo,xDR:()=>j,jR0:()=>H,P2l:()=>Po,W68:()=>$e,sec:()=>Ue,ZPB:()=>Cr,yrp:()=>bo,spi:()=>tt,Iu1:()=>Dr,yuB:()=>Lr,$96:()=>Er,zwJ:()=>Rr,h_A:()=>Or,e_X:()=>Mr,TkG:()=>Ir,BAg:()=>Pr,u9S:()=>Fr,biU:()=>Wr,gc5:()=>Nr,ayx:()=>$r,SXg:()=>ye,UFY:()=>po,Y5o:()=>J,mEH:()=>et,xGW:()=>de,s9Q:()=>rt,OL0:()=>fe,k6p:()=>or,djE:()=>er,kDJ:()=>cr,Yfw:()=>pr,AI1:()=>Ur,O2U:()=>Sr,c5J:()=>vr,N8y:()=>tr,qUh:()=>fr,RZj:()=>yr,nio:()=>nr,hFg:()=>xr,Qkp:()=>Tr,GwL:()=>qr,$Kr:()=>br,ujH:()=>ir,Odj:()=>rr,X7c:()=>dr,Ubz:()=>_r,Dx4:()=>lr,OAr:()=>Je,$Uh:()=>Ke,obN:()=>ar,$lZ:()=>Qe,Kaw:()=>sr,Wbk:()=>Ze,kwV:()=>ur,qAI:()=>Ye,VSx:()=>wr,HPG:()=>kr,xQk:()=>zr,YQw:()=>Ar,QY:()=>mr,osR:()=>hr,Kob:()=>gr,IJt:()=>Be,nw5:()=>Z,PrA:()=>it,ZEf:()=>K,X0W:()=>qe,evz:()=>ge,P8C:()=>ke,aVn:()=>xe,p2b:()=>ve,sVY:()=>Ee,XDq:()=>Oe,Jsu:()=>Pe,W5:()=>Ie,Dyw:()=>Te,_i2:()=>Se,FZg:()=>Re,wGh:()=>we,Nix:()=>G,v_o:()=>V,qDU:()=>nt,qRb:()=>ot,QJY:()=>me,bmW:()=>he,n_N:()=>Le,v87:()=>Me,qMI:()=>ce,gHX:()=>Ce,O3p:()=>X,Gzh:()=>Y,prJ:()=>F,Fmy:()=>so,OBV:()=>Q,Ft:()=>pe,MB4:()=>Jt,Dnk:()=>le,pqp:()=>Qt,Q3w:()=>te,Jh3:()=>ee,wfs:()=>mo,UmN:()=>lo,xO7:()=>St,R11:()=>Gt,LwT:()=>yo,mMz:()=>gt,iES:()=>kt,zpK:()=>Tt,N3x:()=>xt,bNp:()=>ct,T3v:()=>Nt,KQV:()=>Zt,S9l:()=>jt,rER:()=>f,XNg:()=>lt,VeU:()=>Wt,T_r:()=>Mt,m4Y:()=>$t,XIn:()=>mt,Lt0:()=>It,wsx:()=>qt,KKL:()=>dt,yl$:()=>at,kqD:()=>pt,dEm:()=>Ct,bu4:()=>Ft,ftY:()=>Ut,Ht0:()=>Yt,$uf:()=>Bt,wqt:()=>Xt,CHU:()=>go,Wc$:()=>Vt,Y5D:()=>yt,KGs:()=>Pt,nWw:()=>At,jFb:()=>ht,Pvd:()=>Dt,S2b:()=>bt,uSb:()=>Et,N9t:()=>_t,bNM:()=>ft,PvK:()=>Lt,O5u:()=>Rt,NYX:()=>Ot,FCB:()=>Ht,h_O:()=>wt,zu2:()=>zt,Xix:()=>vt,LAw:()=>xo,E6J:()=>So,Dsj:()=>vo,XVZ:()=>Oo,CUR:()=>fo,VxL:()=>_o,DLQ:()=>qo,ONb:()=>jr,HhT:()=>Kt,PF2:()=>d,oVm:()=>co,g57:()=>Ao,LaM:()=>Gr,Vuj:()=>ko});const c={stellarMainnet:{name:"mainnet",passphrase:"Public Global Stellar Network ; September 2015",horizonUrl:"https://horizon.stellar.org",sorobanRpcUrl:"https://stellar-gateway.xoxno.com",quoteUrl:"https://stellar-swap.xoxno.com",explorerNetwork:"public",aquariusApiUrl:"https://amm-api.aqua.network",aquariusRouter:"CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK",lendingController:"CAUCMIN5KSXEVZ7NMXR3LZATGD5EFIEUI5XWTFLYRO2R5OTXI22WE5JX",aggregatorRouter:"CCVENFSVCBYDHVOACFZXMNNYVOZ3LKXPZYU5LUI4N7KTXOKRVYD7F3TR",governance:"CC44PEQW7HSEPKAZ5ZRPH2JS5M5KVJXCUBLJ2ZX4E3WCDKMNFILHC2AD",priceAggregator:"CBGUF2G2Q7HCVCWYISDXBHPVBGMYNXA7PG2VET66YBZX6IKOOV27NSMV",positionNftContract:"CAWCSG77AY2W24QZ6ZXLHZU4UXEFHZBM6EI4A4IF7JB5CTY4XND3TI6C"},stellarTestnet:{name:"testnet",passphrase:"Test SDF Network ; September 2015",horizonUrl:"https://horizon-testnet.stellar.org",sorobanRpcUrl:"https://stellar-testnet-gateway.xoxno.com",quoteUrl:"https://testnet-stellar-swap.xoxno.com",explorerNetwork:"testnet",aquariusApiUrl:"https://amm-api-testnet.aqua.network",aquariusRouter:"CBCFTQSPDBAIZ6R6PJQKSQWKNKWH2QIV3I4J72SHWBIK3ADRRAM5A6GD",lendingController:"CCXRWJ6SIU2WPFEGLFGJVITPL57QAYIMIO6OAM2NBGNDQSSCK2FFV3F3",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},d=c;function f(t){return c["testnet"===t?"stellarTestnet":"stellarMainnet"]}const h={mainnet:c.stellarMainnet.passphrase,testnet:c.stellarTestnet.passphrase};var y=l(287);const g=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},b=1e6,w=t=>new e(t).toScVal(),S=t=>new n(t).toI128(),v=t=>s.ScVal.scvU32(t),x=t=>{if("number"==typeof t&&!Number.isSafeInteger(t))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new n("string"==typeof t?t:t.toString()).toU64()},T=t=>s.ScVal.scvBool(t),A=t=>s.ScVal.scvString(t),q=t=>s.ScVal.scvSymbol(t),_=()=>s.ScVal.scvVoid(),k=t=>s.ScVal.scvVec(t),I=(t,e=32)=>{const r=t.startsWith("0x")?t.slice(2):t,o=y.hp.from(r,"hex");if(o.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${o.length} bytes from "${t}")`);return s.ScVal.scvBytes(o)},E=(t,e)=>null==t?_():e(t),P=(t,e)=>B({asset:w(e),hub_id:v(t)}),R=(t,e,r)=>s.ScVal.scvVec([P(t,e),S(r)]),O=t=>s.ScVal.scvVec(t.map((t=>R(t.hubId,t.asset,t.amount)))),M=t=>{if("Transfer"===t)return k([q("Transfer")]);if(t&&"object"==typeof t&&"Credit"in t){const e=t.Credit;if("number"==typeof e&&!Number.isInteger(e))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${e}`);return k([q("Credit"),x(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},B=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:q(e),val:t[e]})));return s.ScVal.scvMap(e)};class U{assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>b)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,r,o,n){this.ops.push([t,e,r,o,n])}emitPath(t,e){t.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.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(m[r.venue],0===o?e:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),r=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(r[t])continue;const o=e[t].hops[0]?.tokenIn,n=[];for(let r=t;r<e.length;r+=1)e[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((t,r)=>t+e[r].splitPpm),0);if(i>b)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const u=i===b;let s=b;n.forEach(((t,o)=>{r[t]=!0;const i=e[t];let a;if(o+1===n.length&&u)a=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(i.splitPpm*b/s);s-=Math.min(i.splitPpm,s),a=128+this.weight(t)}this.emitPath(i,a)}))}}toBytes(t,e,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,t,e,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const t of this.ops)o.push(...t);for(const t of this.weights)o.push(t>>>16&255,t>>>8&255,255&t);return y.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const C=t=>{const e=new U(t.totalMinOut),r=e.asset(t.tokenIn),o=e.asset(t.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const o=e.asset(t.burnPool),n=e.amountList.length;for(const r of t.burnMinAmounts??[])e.amount(r);e.emit(5,0,o,r,n)}if(e.lowerPaths(t.paths),t.mintPool){const r=t.preSwapAmount;if(r&&BigInt(r)>0n){const o=t.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,i]=o,[u,s]=t.preSwapFromA?[n,i]:[i,n];e.emit(m.Aquarius,2+e.amount(r),e.asset(t.mintPool),e.asset(u),e.asset(s))}e.emit(6,0,e.asset(t.mintPool),o,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return B({amounts:s.ScVal.scvVec(e.amountList.map((t=>S(t)))),assets:s.ScVal.scvVec(e.assetList.map((t=>w(t)))),ops:s.ScVal.scvBytes(e.toBytes(r,o,n))})},$=t=>{const e=y.hp.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},N=()=>s.ScVal.scvBytes(y.hp.alloc(0)),L=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((r=t).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 y.hp.from(t,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=y.hp.from(e,"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},D=t=>{if("string"==typeof t)return $(L(t));if(t instanceof Uint8Array)return 0===t.length?N():$(t);if(t&&"object"==typeof t)return"routeXdr"in(r=t)&&"string"==typeof r.routeXdr?$(L(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?$(L(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?$(L(t.bytes)):0===t.bytes.length?N():$(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length&&!e.burnPool&&!e.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[t,o]of e.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[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!g.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=o.hops[0];r.set(e.tokenIn,(r.get(e.tokenIn)??0)+o.splitPpm)}for(const[t,o]of r){if(o>b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${o}, above 1000000`);if(!e.mintPool&&o!==b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${o}`)}return e})(t),s.ScVal.scvBytes(y.hp.from(C(e).toXDR("base64"),"base64")));var e,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},W=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,r=y.hp.from(e,"hex");return s.ScVal.scvBytes(r)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(y.hp.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function F(e,n,u){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const s=new o(e.controllerAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new i(a,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.call(n,...u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function z(t){if(!Number.isInteger(t)||t<1||t>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return v(t)}function G(t,e){const r=e.accountNonce??0;return F(t,"supply",[w(t.caller),x(r),z(e.spokeId),O([...e.assets])])}function V(t,e){return G(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function j(t,e){return F(t,"borrow",[w(t.caller),x(e.accountNonce),O([...e.borrows]),E(e.to,w)])}function H(t,e){return j(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function X(t,e){return F(t,"withdraw",[w(t.caller),x(e.accountNonce),O([...e.withdrawals]),E(e.to,w)])}function Y(t,e){return X(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Z(t,e){return F(t,"repay",[w(t.caller),x(e.accountNonce),O([...e.payments])])}function K(t,e){return Z(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function J(t,e){return F(t,"liquidate",[w(t.caller),x(e.accountNonce),O([...e.debtPayments]),M(e.seizeMode??"Transfer")])}function Q(t){const e=u(s.ScVal.fromXDR(t,"base64"));if("bigint"==typeof e||"number"==typeof e)return e.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof e)}function tt(t,e){return F(t,"flash_loan",[w(t.caller),P(e.hubId,e.asset),S(e.amount),w(e.receiver),W(e.data)])}function et(t,e){return F(t,"migrate_from_blend",[w(t.caller),x(e.accountId),z(e.spokeId),v(e.hubId),w(e.blendPool),k(e.collateralTokens.map(w)),k(e.supplyTokens.map(w)),(r=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(r.map((t=>{return e=t.token,r=t.amount,s.ScVal.scvVec([w(e),S(r)]);var e,r}))))]);var r}function rt(t,e){const r=e.accountNonce??0;return F(t,"multiply",[w(t.caller),x(r),z(e.spokeId),P(e.collateral.hubId,e.collateral.asset),S(e.debtToFlashLoan),P(e.debt.hubId,e.debt.asset),v(e.mode),D(e.steps),E(e.initialPayment,(t=>R(t.hubId,t.asset,t.amount))),E(e.convertSwap,D)])}function ot(t,e){return F(t,"swap_debt",[w(t.caller),x(e.accountNonce),P(e.existingDebt.hubId,e.existingDebt.asset),S(e.newDebtAmount),P(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function nt(t,e){return F(t,"swap_collateral",[w(t.caller),x(e.accountNonce),P(e.current.hubId,e.current.asset),S(e.fromAmount),P(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function it(t,e){return F(t,"repay_debt_with_collateral",[w(t.caller),x(e.accountNonce),P(e.collateral.hubId,e.collateral.asset),S(e.collateralAmount),P(e.debt.hubId,e.debt.asset),D(e.steps),T(e.closePosition)])}const ut="/stellar-lending",st=encodeURIComponent,at=(t,e)=>t.fetchWithTimeout(`${ut}/context`,e),pt=(t,e)=>t.fetchWithTimeout(`${ut}/live-state`,e),lt=(t,e)=>t.fetchWithTimeout(`${ut}/markets/detailed`,e),ct=(t,e)=>t.fetchWithTimeout(`${ut}/assets`,e),dt=(t,e)=>t.fetchWithTimeout(`${ut}/hubs`,e),ft=(t,e)=>t.fetchWithTimeout(`${ut}/spokes`,e),ht=(t,e={},r)=>t.fetchWithTimeout(`${ut}/reserves`,{...r,params:{...e}}),yt=(t,e,r,o,n)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}`,n),gt=(t,e,r)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}`,r),mt=(t,e,r)=>t.fetchWithTimeout(`${ut}/hubs/${e}`,r),bt=(t,e,r)=>t.fetchWithTimeout(`${ut}/spokes/${e}`,r),wt=(t,e,r)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/positions`,r),St=(t,e,r)=>t.fetchWithTimeout(`${ut}/accounts/${st(e)}/positions`,r),vt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/assets/${st(r)}/balance`,o),xt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/page`,{...o,params:{...r}}),Tt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/markets`,{...o,params:{side:r}}),At=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}/holders`,{...i,params:{side:n}}),qt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/hubs/${e}/holders`,{...o,params:{side:r}}),_t=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/spokes/${e}/holders`,{...o,params:{side:r}}),kt=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/assets/${st(e)}/graph`,{...o,params:{...r}}),It=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/hubs/${e}/graph`,{...o,params:{...r}}),Et=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/spokes/${e}/graph`,{...o,params:{...r}}),Pt=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${ut}/reserves/${e}/${r}/${st(o)}/graph`,{...i,params:{...n}}),Rt=(t,e,r={},o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/activity`,{...o,params:{...r}}),Ot=(t,e,r={},o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/activity/page`,{...o,params:{...r}}),Mt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/governance/proposals`,{...r,params:{...e}}),Bt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/positions`,{...r,params:{...e}}),Ut=(t,e={},r)=>t.fetchWithTimeout(`${ut}/participants`,{...r,params:{...e}}),Ct=(t,e={},r)=>t.fetchWithTimeout(`${ut}/liquidations/leaderboard`,{...r,params:{...e}}),$t=(t,e={},r)=>t.fetchWithTimeout(`${ut}/distribution`,{...r,params:{...e}}),Nt=(t,e={},r)=>t.fetchWithTimeout(`${ut}/campaign/leaderboard`,{...r,params:{...e}}),Lt=(t,e,r)=>t.fetchWithTimeout(`${ut}/stats/history`,{...r,params:{...e}}),Dt=(t,e,r)=>t.fetchWithTimeout(`${ut}/revenue`,{...r,params:{...e}}),Wt=(t,e,r)=>t.fetchWithTimeout(`${ut}/revenue/fees`,{...r,params:{...e}}),Ft=(t,e,r)=>t.fetchWithTimeout(`${ut}/liquidations`,{...r,params:{...e}}),zt=(t,e,r)=>t.fetchWithTimeout(`${ut}/volume`,{...r,params:{...e}}),Gt=(t,e,r)=>t.fetchWithTimeout(`${ut}/active-users`,{...r,params:{...e}}),Vt=(t,e,r)=>t.fetchWithTimeout(`${ut}/rate-spread`,{...r,params:{...e}}),jt=(t,e,r)=>t.fetchWithTimeout(`${ut}/defillama`,{...r,params:{...e}}),Ht=(t,e,r,o)=>t.fetchWithTimeout(`${ut}/users/${st(e)}/history`,{...o,params:{...r}}),Xt=(t,e,r)=>t.fetchWithTimeout(`${ut}/pnl`,{...r,params:{accountId:e}}),Yt=(t,e,r)=>t.fetchWithTimeout(`${ut}/pnl/scope`,{...r,params:{scope:e}}),Zt=(t,e,r)=>t.fetchWithTimeout(`${ut}/campaign/me`,{...r,params:{owner:e}}),Kt=t=>({context:e=>at(t,e),liveState:e=>pt(t,e),marketsDetailed:e=>lt(t,e),assets:e=>ct(t,e),hubs:e=>dt(t,e),spokes:e=>ft(t,e),reserves:(e={},r)=>void 0!==r||"hubId"in e||"spokeId"in e||"asset"in e?ht(t,e,r):ht(t,{},e),reserve:(e,r,o,n)=>yt(t,e,r,o,n),asset:(e,r)=>gt(t,e,r),hub:(e,r)=>mt(t,e,r),spoke:(e,r)=>bt(t,e,r),userPositions:(e,r)=>wt(t,e,r),accountPositions:(e,r)=>St(t,e,r),walletBalance:(e,r,o)=>vt(t,e,r,o),assetPage:(e,r,o)=>xt(t,e,r,o),assetMarkets:(e,r,o)=>Tt(t,e,r,o),reserveHolders:(e,r,o,n,i)=>At(t,e,r,o,n,i),hubHolders:(e,r,o)=>qt(t,e,r,o),spokeHolders:(e,r,o)=>_t(t,e,r,o),assetGraph:(e,r,o)=>kt(t,e,r,o),hubGraph:(e,r,o)=>It(t,e,r,o),spokeGraph:(e,r,o)=>Et(t,e,r,o),reserveGraph:(e,r,o,n,i)=>Pt(t,e,r,o,n,i),userActivity:(e,r={},o)=>Rt(t,e,r,o),userActivityPage:(e,r={},o)=>Ot(t,e,r,o),governanceProposals:(e={},r)=>Mt(t,e,r),positionsLeaderboard:(e={},r)=>Bt(t,e,r),participants:(e={},r)=>Ut(t,e,r),liquidationsLeaderboard:(e={},r)=>Ct(t,e,r),distribution:(e={},r)=>$t(t,e,r),campaignLeaderboard:(e={},r)=>Nt(t,e,r),statsHistory:(e,r)=>Lt(t,e,r),revenue:(e,r)=>Dt(t,e,r),feeRevenue:(e,r)=>Wt(t,e,r),liquidations:(e,r)=>Ft(t,e,r),volume:(e,r)=>zt(t,e,r),activeUsers:(e,r)=>Gt(t,e,r),rateSpread:(e,r)=>Vt(t,e,r),defillama:(e,r)=>jt(t,e,r),userHistory:(e,r,o)=>Ht(t,e,r,o),positionsPnl:(e,r)=>Xt(t,e,r),pnlByScope:(e,r)=>Yt(t,e,r),campaignMe:(e,r)=>Zt(t,e,r)}),Jt=t=>B({base_borrow_rate:S(t.baseBorrowRateRay),max_borrow_rate:S(t.maxBorrowRateRay),max_utilization:S(t.maxUtilizationRay),mid_utilization:S(t.midUtilizationRay),optimal_utilization:S(t.optimalUtilizationRay),reserve_factor:v(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),Qt=t=>B({asset_decimals:v(t.assetDecimals),asset_id:w(t.assetId),base_borrow_rate:S(t.baseBorrowRateRay),flashloan_fee:v(t.flashloanFeeBps),is_flashloanable:T(t.isFlashloanable),max_borrow_rate:S(t.maxBorrowRateRay),max_utilization:S(t.maxUtilizationRay),mid_utilization:S(t.midUtilizationRay),optimal_utilization:S(t.optimalUtilizationRay),reserve_factor:v(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),te=t=>B({max_borrow_positions:v(t.maxBorrowPositions),max_supply_positions:v(t.maxSupplyPositions)}),ee=t=>{if("Token"in t&&t.Token)return k([q("Token"),w(t.Token)]);if("Ref"in t&&t.Ref)return k([q("Ref"),q(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},re=t=>{if("Stellar"in t)return k([q("Stellar"),w(t.Stellar)]);if("Symbol"in t)return k([q("Symbol"),q(t.Symbol)]);if("String"in t)return k([q("String"),A(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},oe=t=>{if("Spot"===t)return k([q("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return k([q("Twap"),v(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},ne=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return k([q(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},ie=t=>{if("Market"===t||"Fundamental"===t)return k([q(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},ue=t=>{if("Reflector"in t){const e=t.Reflector;return k([q("Reflector"),B({asset:re(e.asset),contract:w(e.contract),read_mode:oe(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return k([q("MultiFeed"),B({contract:w(e.contract),feed_id:A(e.feedId),kind:ne(e.kind),nature:ie(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},se=t=>{const e=t;return B({decimals:v(e.decimals),max_stale_seconds:x(e.maxStaleSeconds),provider:ue(e.provider)})},ae=t=>{if("RequireDisjoint"===t)return k([q("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return k([q("AllowShared"),k(e.map((t=>B({contract:w(t.contract),kind:ne(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},pe=t=>{const e=t,r=e.sources??[];let o,n;if("number"==typeof e.toleranceBps)o=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const t=e.tolerance??{};o=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return B({asset_decimals:v(Number(e.assetDecimals)),independence:ae(e.independence),max_price_stale_seconds:x(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:S(String(e.maxSanityPriceWad)),min_sanity_price_wad:S(String(e.minSanityPriceWad)),sources:k(r.map((t=>(t=>{if("Feed"in t)return k([q("Feed"),se(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return k([q("Scaled"),B({factor:se(e.factor),max_factor_wad:S(e.maxFactorWad),min_factor_wad:S(e.minFactorWad),quote:ee(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return k([q("LpShare"),B({key_a:ee(e.keyA),key_b:ee(e.keyB),kind:k([q(e.kind||"ConstantProduct")]),pool:w(e.pool),reserve_a_decimals:v(e.reserveADecimals),reserve_b_decimals:v(e.reserveBDecimals),share_decimals:v(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:B({lower_ratio_bps:v(n),upper_ratio_bps:v(o)})})},le=pe;function ce(t,e){return F(t,"upgrade",[I(e.wasmHash)])}function de(t,e){return F(t,"migrate",[v(e.newVersion)])}function fe(t){return F(t,"pause",[])}function he(t){return F(t,"unpause",[])}function ye(t,e){return F(t,"grant_role",[w(e.account),q(e.role)])}function ge(t,e){return F(t,"revoke_role",[w(e.account),q(e.role)])}function me(t,e){return F(t,"transfer_ownership",[w(e.newOwner),v(e.liveUntilLedger)])}function be(t){return F(t,"accept_ownership",[])}function we(t,e){return F(t,"set_swap_aggregator",[w(e.aggregator)])}function Se(t,e){return F(t,"set_price_aggregator",[w(e.aggregator)])}const ve=we;function xe(t,e){return F(t,"set_accumulator",[w(e.accumulator)])}function Te(t,e){return F(t,"set_position_limits",[te(e)])}function Ae(t,e){return F(t,"approve_blend_pool",[w(e.pool)])}function qe(t,e){return F(t,"revoke_blend_pool",[w(e.pool)])}const _e=Ae,ke=qe;function Ie(t,e){return F(t,"set_oracle",[ee(e.key),pe(e.oracle)])}const Ee=Ie;function Pe(t,e){const r=e.toleranceBps,o=e.upperRatioBps??1e4+r,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return F(t,"set_tolerance",[ee(e.key),B({lower_ratio_bps:v(n),upper_ratio_bps:v(o)})])}function Re(t,e){return F(t,"set_spoke_asset_flags",[v(e.spokeId),P(e.hubId,e.asset),T(e.paused),T(e.frozen),T(e.noSeize)])}function Oe(t,e){return F(t,"set_oracle_sanity_bounds",[w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Me(t,e){return F(t,"update_indexes",[w(t.caller),k(e.assets.map((t=>P(t.hubId,t.asset))))])}function Be(t,e){return F(t,"renew_account",[w(t.caller),x(e.accountNonce)])}function Ue(t,e){return F(t,"create_liquidity_pool",[v(e.hubId),w(e.asset),Qt(e.params)])}function Ce(t,e){return F(t,"upgrade_liquidity_pool_params",[P(e.hubId,e.asset),Jt(e.params)])}function $e(t,e){return F(t,"claim_revenue",[w(t.caller),k(e.assets.map((t=>P(t.hubId,t.asset))))])}function Ne(t,e){return F(t,"add_rewards",[w(t.caller),O(e.rewards)])}function Le(t,e){return F(t,"update_account_threshold",[w(t.caller),T(e.hasRisks),k(e.accountNonces.map((t=>x(t))))])}const De="00".repeat(32),We=t=>{if("string"==typeof t)return I(t);const e=y.hp.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},Fe=(t,...e)=>k([q(t),...e]),ze=t=>B({new_owner:w(t.newOwner),live_until_ledger:v(t.liveUntilLedger)}),Ge=t=>B({asset:w(t.asset),bonus:v(t.bonus),borrow_cap:S(t.borrowCap),can_borrow:T(t.canBorrow),can_collateral:T(t.canCollateral),frozen:T(t.frozen),hub_id:v(t.hubId),paused:T(t.paused),liquidation_fees:v(t.liquidationFees),ltv:v(t.ltv),no_seize:T(t.noSeize),spoke_id:v(t.spokeId),supply_cap:S(t.supplyCap),threshold:v(t.threshold)}),Ve=t=>B({account:w(t.account),role:q(t.role)});function je(e,n,u){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const s=new o(e.governanceAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new i(a,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.call(n,...u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const He=(t,e,r)=>je(t,"propose",[w(t.caller),e,We(r)]),Xe=(t,e,r)=>je(t,"execute_self",[_(),e,We(r)]);function Ye(t,e,r){return He(t,Fe("SetSwapAggregator",w(e.aggregator)),r)}function Ze(t,e,r){return He(t,Fe("SetPriceAggregator",w(e.aggregator)),r)}const Ke=Ye;function Je(t,e,r){return He(t,Fe("SetAccumulator",w(e.accumulator)),r)}function Qe(t,e,r){return He(t,Fe("SetPositionLimits",te(e)),r)}function tr(t,e){return He(t,Fe("CreateHub"),e)}function er(t,e){return He(t,Fe("AddSpoke"),e)}function rr(t,e,r){return He(t,Fe("RemoveSpoke",v(e.spokeId)),r)}function or(t,e,r){return He(t,Fe("AddAssetToSpoke",Ge(e)),r)}function nr(t,e,r){return He(t,Fe("EditAssetInSpoke",Ge(e)),r)}function ir(t,e,r){return He(t,Fe("RemoveAssetFromSpoke",B({hub_asset:P((o=e).hubId,o.asset),spoke_id:v(o.spokeId)})),r);var o}function ur(t,e,r){return He(t,Fe("SetSpokeLiquidationCurve",B({hf_for_max_bonus_wad:S((o=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:v(o.liquidationBonusFactorBps),spoke_id:v(o.spokeId),target_hf_wad:S(o.targetHfWad)})),r);var o}function sr(t,e,r){return He(t,Fe("SetPositionManager",w(e.manager),T(e.isActive)),r)}function ar(t,e,r){return He(t,Fe("SetMinBorrowCollateralUsd",S(e.floorWad)),r)}function pr(t,e,r){return He(t,Fe("ApproveToken",w(e.token)),r)}function lr(t,e,r){return He(t,Fe("RevokeToken",w(e.token)),r)}function cr(t,e,r){return He(t,Fe("ApproveBlendPool",w(e.pool)),r)}function dr(t,e,r){return He(t,Fe("RevokeBlendPool",w(e.pool)),r)}function fr(t,e,r){return He(t,Fe("CreateLiquidityPool",B({asset:w((o=e).asset),hub_id:v(o.hubId),params:Qt(o.params)})),r);var o}function hr(t,e,r){return He(t,Fe("UpgradeLiquidityPoolParams",B({hub_asset:P((o=e).hubId,o.asset),params:Jt(o.params)})),r);var o}function yr(t,e,r){return He(t,Fe("DeployPool",I(e.wasmHash)),r)}function gr(t,e,r){return He(t,Fe("UpgradePool",I(e.wasmHash)),r)}function mr(t,e,r){return He(t,Fe("UpgradeController",I(e.wasmHash)),r)}function br(t,e,r){return He(t,Fe("MigrateController",v(e.newVersion)),r)}function wr(t,e,r){return He(t,Fe("TransferCtrlOwnership",ze(e)),r)}function Sr(t,e,r){return He(t,Fe("ConfigureAssetOracle",B({key:ee((o=e).key),oracle:pe(o.oracle)})),r);var o}const vr=Sr;function xr(t,e,r){return He(t,Fe("EditOracleTolerance",B({key:ee((o=e).key),tolerance:v(o.tolerance)})),r);var o}function Tr(t,e,r){return He(t,Fe("UpgradeGov",I(e.wasmHash)),r)}function Ar(t,e,r){return He(t,Fe("UpdateGovDelay",v(e.newDelay)),r)}function qr(t,e,r){return He(t,Fe("GrantGovRole",Ve(e)),r)}function _r(t,e,r){return He(t,Fe("RevokeGovRole",Ve(e)),r)}function kr(t,e,r){return He(t,Fe("TransferGovOwnership",ze(e)),r)}function Ir(t,e){const r=k(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),o=We(e.predecessor??De);return je(t,"execute",[_(),w(e.target),q(e.functionName),r,o,We(e.salt)])}function Er(t,e,r){return Xe(t,Fe("UpgradeGov",I(e.wasmHash)),r)}function Pr(t,e,r){return Xe(t,Fe("UpdateGovDelay",v(e.newDelay)),r)}function Rr(t,e,r){return Xe(t,Fe("GrantGovRole",Ve(e)),r)}function Or(t,e,r){return Xe(t,Fe("RevokeGovRole",Ve(e)),r)}function Mr(t,e,r){return Xe(t,Fe("TransferGovOwnership",ze(e)),r)}const Br=t=>k(t.map(w));function Ur(t,e,r){return je(t,"propose_canceller_reset",[Br(e.newCancellers),We(r)])}function Cr(t,e,r){return je(t,"execute_canceller_reset",[E(e.executor,w),Br(e.newCancellers),We(r)])}function $r(t,e){return je(t,"set_spoke_asset_flags",[w(t.caller),v(e.spokeId),P(e.hubId,e.asset),T(e.paused),T(e.frozen),T(e.noSeize)])}function Nr(t,e){return je(t,"set_oracle_sanity_bounds",[w(t.caller),w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Lr(t){return je(t,"create_hub",[w(t.caller)])}function Dr(t){return je(t,"add_spoke",[w(t.caller)])}function Wr(t,e){return je(t,"revoke_role_immediate",[w(e.account),q(e.role)])}function Fr(t){return je(t,"pause",[w(t.caller)])}function zr(t,e){return He(t,Fe("Unpause"),e)}const Gr=t=>t.toXDR("base64"),Vr=t=>s.ScVal.fromXDR(t,"base64"),jr=t=>t.map((t=>String(u(Vr(t))))).join(":"),Hr=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Xr=t=>Number(t),Yr=t=>String(t),Zr=t=>t instanceof Uint8Array?y.hp.from(t).toString("hex"):y.hp.isBuffer(t)?t.toString("hex"):String(t),Kr=["None","Multiply","Long","Short"],Jr=["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"],Qr=t=>Array.isArray(t)?t:[],to=(t,e)=>{const r="Borrow"===e;return{action:(o=t[0],Jr[Xr(o)]??Hr(o)),positionType:e,hubId:Xr(t[1]),asset:Yr(t[2]),scaledAmountRay:Hr(t[3]),indexRay:Hr(t[4]),amount:Hr(t[5]),liquidationThresholdBps:r?void 0:Xr(t[6]),liquidationBonusBps:r?void 0:Xr(t[7]),loanToValueBps:r?void 0:Xr(t[8]),liquidationFeesBps:r?void 0:Xr(t[9])};var o},eo=t=>{return{owner:Yr(t[0]),spokeId:Xr(t[1]),mode:(e=t[2],Kr[Xr(e)]??"None")};var e},ro=t=>Array.isArray(t)?t[1]:void 0,oo=t=>{const e=(r=t,Array.isArray(r)?Yr(r[0]):Yr(r));var r;if("Token"===e)return{Token:Yr(ro(t))};if("Ref"===e)return{Ref:Yr(ro(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Yr(e.Token)};if(void 0!==e.Ref)return{Ref:Yr(e.Ref)}}return{Token:Yr(t)}},no=t=>{const e=t.tolerance??{};return{assetDecimals:Xr(t.asset_decimals),maxPriceStaleSeconds:Xr(t.max_price_stale_seconds),sources:Qr(t.sources).map((t=>t)),tolerance:{upperRatio:Xr(e.upper_ratio_bps),lowerRatio:Xr(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Hr(t.min_sanity_price_wad),maxSanityPriceWad:Hr(t.max_sanity_price_wad)}},io={"market:create":t=>({topic:"market:create",data:{hubId:Xr(t.hub_id),baseAsset:Yr(t.base_asset),maxBorrowRate:Hr(t.max_borrow_rate),baseBorrowRate:Hr(t.base_borrow_rate),slope1:Hr(t.slope1),slope2:Hr(t.slope2),slope3:Hr(t.slope3),midUtilization:Hr(t.mid_utilization),optimalUtilization:Hr(t.optimal_utilization),maxUtilization:Hr(t.max_utilization),reserveFactor:Xr(t.reserve_factor),marketAddress:Yr(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Yr(t.asset),maxBorrowRateRay:Hr(t.max_borrow_rate),baseBorrowRateRay:Hr(t.base_borrow_rate),slope1Ray:Hr(t.slope1),slope2Ray:Hr(t.slope2),slope3Ray:Hr(t.slope3),midUtilizationRay:Hr(t.mid_utilization),optimalUtilizationRay:Hr(t.optimal_utilization),maxUtilizationRay:Hr(t.max_utilization),reserveFactorBps:Xr(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Qr(t).map((t=>{return e=Qr(t),{hubId:Xr(e[0]),asset:Yr(e[1]),timestamp:Xr(e[2]),supplyIndexRay:Hr(e[3]),borrowIndexRay:Hr(e[4]),cash:Hr(e[5]),suppliedRay:Hr(e[6]),borrowedRay:Hr(e[7]),revenueRay:Hr(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Qr(t).map((t=>{const e=t;return{hubId:Xr(e.hub_id),asset:Yr(e.asset),params:(r=e.params,{maxBorrowRateRay:Hr(r.max_borrow_rate),baseBorrowRateRay:Hr(r.base_borrow_rate),slope1Ray:Hr(r.slope1),slope2Ray:Hr(r.slope2),slope3Ray:Hr(r.slope3),midUtilizationRay:Hr(r.mid_utilization),optimalUtilizationRay:Hr(r.optimal_utilization),maxUtilizationRay:Hr(r.max_utilization),reserveFactorBps:Xr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Xr(r.flashloan_fee),assetId:Yr(r.asset_id),assetDecimals:Xr(r.asset_decimals)})};var r}))}}),"position:batch_update":t=>{const e=Qr(t);return{topic:"position:batch_update",data:{accountId:Hr(e[0]),accountAttributes:eo(Qr(e[1])),updates:[...Qr(e[2]).map((t=>to(Qr(t),"Deposit"))),...Qr(e[3]).map((t=>to(Qr(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),receiver:Yr(t.receiver),caller:Yr(t.caller),amount:Hr(t.amount),fee:Hr(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:oo(t.key),oracle:no(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Yr(t.asset),oracle:no(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Yr(t.liquidator),accountId:Hr(t.account_id),repaidUsdWad:Hr(t.repaid_usd_wad),bonusBps:Hr(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Hr(t.account_id),totalBorrowUsdWad:Hr(t.total_borrow_usd_wad),totalCollateralUsdWad:Hr(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Yr(t.token),amount:Hr(t.amount),usdValueWad:Hr(t.usd_value_wad),accountId:Hr(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),amount:Hr(t.amount),fee:Hr(t.fee),amountSent:Hr(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Yr(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Zr(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Yr(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Yr(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Yr(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Yr(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Zr(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Xr(t.max_supply_positions),maxBorrowPositions:Xr(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Hr(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Yr(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Xr(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Hr(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Hr(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Xr(e.liquidation_bonus_factor_bps)}}}},uo=Object.freeze(Object.keys(io));function so(t,e){const r=jr(t),o=io[r];return o?o(u(Vr(e))):null}const ao=1e4;function po(t,e){return`${t}-${BigInt(e).toString(10)}`}function lo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function co(t,e=0){return t*ao+e}function fo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const ho=(t,e,r)=>{const o=new URL(e,t.endsWith("/")?t:`${t}/`);if(r)for(const[t,e]of Object.entries(r))void 0!==e&&o.searchParams.set(t,String(e));return o.toString()};async function yo(t,e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=ho(e.baseUrl,"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,referralId:t.referralId,platform:t.platform,fresh:t.fresh}),o=await fetch(r,e.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${t}`)}return await o.json()}async function go(t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");const e=ho(t.baseUrl,"api/v1/tokens"),r=await fetch(e,t.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${e} — ${t}`)}return await r.json()}const mo=t=>C(t).toXDR("base64");function bo(e,n){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const u=new o(e.routerAddress),s=new t(e.caller,e.sourceSequence),a=D(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new i(s,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(u.call("execute_strategy",w(e.caller),S(e.totalIn),a)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function wo(t,e){return bo(t,e)}function So(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(To),splitPpm:t.splitPpm}))):[{hops:t.hops.map(To),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function vo(t,e={}){const r=t;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:So(t,e)}const xo=So,To=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function Ao(t,e){const r=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${r}`)}async function qo(t,e,r){const o=i.fromXDR(e,r?.network?h[r.network]:"");try{return(await t.prepareTransaction(o)).toXDR()}catch(t){if(r?.invokedContractId)throw Ao(r.invokedContractId,t);throw t}}async function _o(t,e,r){return qo(t,e.xdr,r)}function ko(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Io(t,e){return new Uint8Array(0)}const Eo=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return y.hp.from(e,"hex")};function Po(e){const r=new t(e.caller,e.sourceSequence),n=new o(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(Eo(e.message)),s.ScVal.scvBytes(Eo(e.attestation)));return{xdr:new i(r,{fee:e.fee??"10000000",networkPassphrase:h[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ro={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Oo(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const r=Number(e[1]),o=Ro[r];return o?{code:r,...o}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var r=p[t]={exports:{}};return a[t](r,r.exports,l),r.exports}l.d=(t,e)=>{for(var r in e)l.o(e,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",d="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",f="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",h=3e4;var y;!function(t){t.MAINNET="1",t.DEVNET="D"}(y||(y={}));class g{apiUrl;chain;init;config;constructor(t){if(!t?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:e=y.MAINNET,apiUrl:r,...o}=t;this.apiUrl=r.trim().replace(/\/$/,""),this.chain=e,this.init=o,this.config=e==y.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:c,DR_SC:d,KG_SC:f,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:c,DR_SC:d,KG_SC:f,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...r}={})=>{const{next:o,cache:n,debug:i,timeout:u,...s}=this.init,{next:a,cache:p,debug:l,timeout:c,headers:d,method:f="GET",...h}=r,y=d?.Authorization,g="Bearer undefined"===y?void 0:y,m="GET"!==f&&"HEAD"!==f&&"PUT"!==f,b={...d,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...m?{"Content-Type":"application/json"}:{},...g?{Authorization:g}:{}},w=Object.entries(e??{}).filter((([,t])=>void 0!==t)).flatMap((([t,e])=>Array.isArray(e)?e.filter((t=>void 0!==t)).map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),S=`${this.apiUrl}${t}${w.length?`?${w}`:""}`,{revalidate:v,...x}=o??{},{revalidate:T,...A}=a??{},q="GET"!==f||g?void 0:T??v,_="GET"!==f||g||q?void 0:p??n,k=h.body,I=c??u??(null==k?3e4:0),E=I>0?AbortSignal.timeout(I):void 0,P=h.signal??s.signal,R=E&&P?AbortSignal.any([P,E]):E??P,O={...s,...h,method:f,...Object.keys(b).length?{headers:b}:{},...R?{signal:R}:{},cache:_,next:{...x,...A,revalidate:q}};(l??i)&&console.debug("SDK fetch: ",S,O);const M=await fetch(S,O).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${S}: ${t.message}`),{cause:t});throw t})),B=await M.text();if(!M.ok){let t;try{t=JSON.parse(B)}catch{t={message:B}}const e=[S,M.status,M.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(B)}catch{return B}}}const m=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),o=/^C[A-Z2-7]{55}$/.test(t);return e||r||o},b=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t),o=/^C[A-Z2-7]{55}-\d+$/.test(t);return e||r||o};class w extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class S extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^[GC][A-Z2-7]{55}$/.test(t)),x={"/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:{}}},T=["PATCH","POST","DELETE","PUT"];var A=l(34);const q=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function _(t,e,r,o){const{input:n,output:i,...u}=e,s=async(e={})=>{const n={...r,...e},i=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),u=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!u.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new S(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!m(t))):!m(t))throw new w(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:f,headers:h,cache:y,next:g,debug:b,signal:x,credentials:T,mode:A,redirect:q,referrer:_,referrerPolicy:k,integrity:I,keepalive:E,priority:P,window:R,continuationToken:O,...M}=l,B=d?`Bearer ${d}`:void 0;t.startsWith("/stellar-lending/")&&void 0!==O&&(M.continuationToken=O);const U={...h,...B?{Authorization:B}:{},...O&&!t.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(O)}:{}},C={...g,tags:[...g?.tags??[],i]};return o.fetchWithTimeout(i,{method:f,params:M,body:c,headers:U,cache:y,debug:b,...Object.fromEntries(Object.entries({signal:x,credentials:T,mode:A,redirect:q,referrer:_,referrerPolicy:k,integrity:I,keepalive:E,priority:P,window:R}).filter((([,t])=>void 0!==t))),...C?{next:C}:{}})},a=(t={})=>s(t);for(const t of Object.keys(u))T.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,r]of Object.entries(x)){const o=e.split("/").filter(Boolean);let n=t;for(const t of o)if(t.startsWith(":")){const e=q(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=q(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:r})}return t}(),r=(e,o)=>{const n=e.leaves.length,i=Object.keys(e.static).length,u=Object.keys(e.params).length;let s;if(1===n&&i+u>0){const{rawPath:r,def:n}=e.leaves[0];s=_(r,n,o,t)}else{s={};for(const{rawPath:r,def:n}of e.leaves)s[q(r.split("/").pop().replace(/^:/,""))]=_(r,n,o,t)}for(const[t,n]of Object.entries(e.static)){const e=r(n,o);let i=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const r=e[t],o=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===r.length||(Object.assign(r,o),i=r)}void 0===s[t]?s[t]=i:"function"==typeof s[t]?Object.assign(s[t],i):"function"==typeof i?(Object.assign(i,s[t]),s[t]=i):Object.assign(s[t],i)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const i=r(n,{...o,[t]:e});if(i&&"object"==typeof i&&1===Object.keys(i).length&&t in i&&"function"==typeof i[t]){const e=i[t],r=(...t)=>e(...t);return Object.assign(r,e)}return i};if(s[t]){const r=s[t];s[t]=t=>({...r(t),...e(t)})}else s[t]=e}return s};return r(e,{})}export{y as Chain,h as DEFAULT_REQUEST_TIMEOUT_MS,g as XOXNOClient,k as buildSdk,m as isValidCollectionTicker,b as isValidNftIdentifier};export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=A.G_M;export const STELLAR_LENDING_TOPICS=A.fAY;export const STELLAR_NETWORKS=A.a_O;export const STELLAR_NETWORK_PASSPHRASE=A.A$9;export const SYNTHETIC_EVENT_ORDER_STRIDE=A.gRW;export const buildSameTokenRepaySwapSteps=A.VZJ;export const buildStellarAcceptOwnershipTx=A.N0v;export const buildStellarAddRewardsTx=A.B_D;export const buildStellarApproveBlendPoolTx=A.qLM;export const buildStellarApproveTokenTx=A.eX8;export const buildStellarBatchSwapTx=A.zaA;export const buildStellarBorrowBatchTx=A.xDR;export const buildStellarBorrowTx=A.jR0;export const buildStellarCctpForwardTx=A.P2l;export const buildStellarClaimRevenueTx=A.W68;export const buildStellarCreateLiquidityPoolTx=A.sec;export const buildStellarExecuteCancellerResetTx=A.ZPB;export const buildStellarExecuteStrategyTx=A.yrp;export const buildStellarFlashLoanTx=A.spi;export const buildStellarGovernanceAddSpokeImmediateTx=A.Iu1;export const buildStellarGovernanceCreateHubImmediateTx=A.yuB;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=A.$96;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=A.zwJ;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=A.h_A;export const buildStellarGovernanceExecuteTransferGovOwnTx=A.e_X;export const buildStellarGovernanceExecuteTx=A.TkG;export const buildStellarGovernanceExecuteUpdateDelayTx=A.BAg;export const buildStellarGovernancePauseTx=A.u9S;export const buildStellarGovernanceRevokeRoleImmediateTx=A.biU;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=A.gc5;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=A.ayx;export const buildStellarGrantRoleTx=A.SXg;export const buildStellarLendingIdentifier=A.UFY;export const buildStellarLiquidateTx=A.Y5o;export const buildStellarMigrateFromBlendTx=A.mEH;export const buildStellarMigrateTx=A.xGW;export const buildStellarMultiplyTx=A.s9Q;export const buildStellarPauseTx=A.OL0;export const buildStellarProposeAddAssetToSpokeTx=A.k6p;export const buildStellarProposeAddSpokeTx=A.djE;export const buildStellarProposeApproveBlendPoolTx=A.kDJ;export const buildStellarProposeApproveTokenTx=A.Yfw;export const buildStellarProposeCancellerResetTx=A.AI1;export const buildStellarProposeConfigureAssetOracleTx=A.O2U;export const buildStellarProposeConfigureMarketOracleTx=A.c5J;export const buildStellarProposeCreateHubTx=A.N8y;export const buildStellarProposeCreateLiquidityPoolTx=A.qUh;export const buildStellarProposeDeployPoolTx=A.RZj;export const buildStellarProposeEditAssetInSpokeTx=A.nio;export const buildStellarProposeEditOracleToleranceTx=A.hFg;export const buildStellarProposeGovernanceUpgradeTx=A.Qkp;export const buildStellarProposeGrantGovernanceRoleTx=A.GwL;export const buildStellarProposeMigrateControllerTx=A.$Kr;export const buildStellarProposeRemoveAssetFromSpokeTx=A.ujH;export const buildStellarProposeRemoveSpokeTx=A.Odj;export const buildStellarProposeRevokeBlendPoolTx=A.X7c;export const buildStellarProposeRevokeGovernanceRoleTx=A.Ubz;export const buildStellarProposeRevokeTokenTx=A.Dx4;export const buildStellarProposeSetAccumulatorTx=A.OAr;export const buildStellarProposeSetAggregatorTx=A.$Uh;export const buildStellarProposeSetMinBorrowCollatTx=A.obN;export const buildStellarProposeSetPositionLimitsTx=A.$lZ;export const buildStellarProposeSetPositionManagerTx=A.Kaw;export const buildStellarProposeSetPriceAggregatorTx=A.Wbk;export const buildStellarProposeSetSpokeLiquidationCurveTx=A.kwV;export const buildStellarProposeSetSwapAggregatorTx=A.qAI;export const buildStellarProposeTransferCtrlOwnershipTx=A.VSx;export const buildStellarProposeTransferGovOwnTx=A.HPG;export const buildStellarProposeUnpauseTx=A.xQk;export const buildStellarProposeUpdateDelayTx=A.YQw;export const buildStellarProposeUpgradeControllerTx=A.QY;export const buildStellarProposeUpgradePoolParamsTx=A.osR;export const buildStellarProposeUpgradePoolTx=A.Kob;export const buildStellarRenewAccountTx=A.IJt;export const buildStellarRepayBatchTx=A.nw5;export const buildStellarRepayDebtWithCollateralTx=A.PrA;export const buildStellarRepayTx=A.ZEf;export const buildStellarRevokeBlendPoolTx=A.X0W;export const buildStellarRevokeRoleTx=A.evz;export const buildStellarRevokeTokenTx=A.P8C;export const buildStellarSetAccumulatorTx=A.aVn;export const buildStellarSetAggregatorTx=A.p2b;export const buildStellarSetMarketOracleConfigTx=A.sVY;export const buildStellarSetOracleSanityBoundsTx=A.XDq;export const buildStellarSetOracleToleranceTx=A.Jsu;export const buildStellarSetOracleTx=A.W5;export const buildStellarSetPositionLimitsTx=A.Dyw;export const buildStellarSetPriceAggregatorTx=A._i2;export const buildStellarSetSpokeAssetFlagsTx=A.FZg;export const buildStellarSetSwapAggregatorTx=A.wGh;export const buildStellarSupplyBatchTx=A.Nix;export const buildStellarSupplyTx=A.v_o;export const buildStellarSwapCollateralTx=A.qDU;export const buildStellarSwapDebtTx=A.qRb;export const buildStellarTransferOwnershipTx=A.QJY;export const buildStellarUnpauseTx=A.bmW;export const buildStellarUpdateAccountThresholdTx=A.n_N;export const buildStellarUpdateIndexesTx=A.v87;export const buildStellarUpgradeControllerTx=A.qMI;export const buildStellarUpgradeLiquidityPoolParamsTx=A.gHX;export const buildStellarWithdrawBatchTx=A.O3p;export const buildStellarWithdrawTx=A.Gzh;export const buildTx=A.prJ;export const decodeStellarLendingEvent=A.Fmy;export const decodeStellarLiquidateReturn=A.OBV;export const encodeAssetOracle=A.Ft;export const encodeInterestRateModel=A.MB4;export const encodeMarketOracleConfigInput=A.Dnk;export const encodeMarketParamsRaw=A.pqp;export const encodePositionLimits=A.Q3w;export const encodePriceKey=A.Jh3;export const encodeStrategyPayloadToRouteXdr=A.wfs;export const extractEventOrder=A.UmN;export const getStellarAccountPositions=A.xO7;export const getStellarActiveUsersSeries=A.R11;export const getStellarAggregatorQuote=A.LwT;export const getStellarAsset=A.mMz;export const getStellarAssetGraph=A.iES;export const getStellarAssetMarkets=A.zpK;export const getStellarAssetPage=A.N3x;export const getStellarAssets=A.bNp;export const getStellarCampaignLeaderboard=A.T3v;export const getStellarCampaignMe=A.KQV;export const getStellarDefiLlamaDimensions=A.S9l;export const getStellarDeployment=A.rER;export const getStellarDetailedMarkets=A.XNg;export const getStellarFeeRevenueSeries=A.VeU;export const getStellarGovernanceProposals=A.T_r;export const getStellarHolderDistribution=A.m4Y;export const getStellarHub=A.XIn;export const getStellarHubGraph=A.Lt0;export const getStellarHubHolders=A.wsx;export const getStellarHubs=A.KKL;export const getStellarLendingContext=A.yl$;export const getStellarLendingLiveState=A.kqD;export const getStellarLiquidationsLeaderboard=A.dEm;export const getStellarLiquidationsSeries=A.bu4;export const getStellarParticipantCounts=A.ftY;export const getStellarPnlByScope=A.Ht0;export const getStellarPositionsLeaderboard=A.$uf;export const getStellarPositionsPnl=A.wqt;export const getStellarQuoteTokens=A.CHU;export const getStellarRateSpreadSeries=A.Wc$;export const getStellarReserve=A.Y5D;export const getStellarReserveGraph=A.KGs;export const getStellarReserveHolders=A.nWw;export const getStellarReserves=A.jFb;export const getStellarRevenueSeries=A.Pvd;export const getStellarSpoke=A.S2b;export const getStellarSpokeGraph=A.uSb;export const getStellarSpokeHolders=A.N9t;export const getStellarSpokes=A.bNM;export const getStellarStatsHistory=A.PvK;export const getStellarUserActivity=A.O5u;export const getStellarUserActivityPage=A.NYX;export const getStellarUserHistory=A.FCB;export const getStellarUserPositions=A.h_O;export const getStellarVolumeSeries=A.zu2;export const getStellarWalletBalance=A.Xix;export const mapQuoteResponseToAggregatorSwap=A.LAw;export const mapQuoteResponseToStrategyPayload=A.E6J;export const mapQuoteResponseToStrategySwap=A.Dsj;export const mapSorobanError=A.XVZ;export const mapStellarPositionActivityType=A.CUR;export const prepareStellarBuiltTx=A.VxL;export const prepareStellarTxXdr=A.DLQ;export const stellarLendingDispatchKey=A.ONb;export const stellarLendingRead=A.HhT;export const stellarNetworks=A.PF2;export const syntheticEventOrder=A.oVm;export const tagStellarInvokedContractError=A.g57;export const toBase64Xdr=A.LaM;export const toStellarPositionMode=A.Vuj;
2
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,Asset as o,BASE_FEE as r,Contract as n,ScInt as i,StrKey as s,TransactionBuilder as u,scValToBigInt as a,scValToNative as l,xdr as p}from"@stellar/stellar-sdk";var c={526(t,e){e.byteLength=function(t){var e=u(t),o=e[0],r=e[1];return 3*(o+r)/4-r},e.toByteArray=function(t){var e,o,i=u(t),s=i[0],a=i[1],l=new n(function(t,e,o){return 3*(e+o)/4-o}(0,s,a)),p=0,c=a>0?s-4:s;for(o=0;o<c;o+=4)e=r[t.charCodeAt(o)]<<18|r[t.charCodeAt(o+1)]<<12|r[t.charCodeAt(o+2)]<<6|r[t.charCodeAt(o+3)],l[p++]=e>>16&255,l[p++]=e>>8&255,l[p++]=255&e;return 2===a&&(e=r[t.charCodeAt(o)]<<2|r[t.charCodeAt(o+1)]>>4,l[p++]=255&e),1===a&&(e=r[t.charCodeAt(o)]<<10|r[t.charCodeAt(o+1)]<<4|r[t.charCodeAt(o+2)]>>2,l[p++]=e>>8&255,l[p++]=255&e),l},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i=[],s=16383,u=0,l=r-n;u<l;u+=s)i.push(a(t,u,u+s>l?l:u+s));return 1===n?(e=t[r-1],i.push(o[e>>2]+o[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(o[e>>10]+o[e>>4&63]+o[e<<2&63]+"=")),i.join("")};for(var o=[],r=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)o[s]=i[s],r[i.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var o=t.indexOf("=");return-1===o&&(o=e),[o,o===e?0:4-o%4]}function a(t,e,r){for(var n,i,s=[],u=e;u<r;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(o[(i=n)>>18&63]+o[i>>12&63]+o[i>>6&63]+o[63&i]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},287(t,e,o){const r=o(526),n=o(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=a,e.IS=50;const s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,o){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return l(t,e,o)}function l(t,e,o){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const o=0|y(t,e);let r=u(o);const n=r.write(t,e);return n!==o&&(r=r.slice(0,n)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(K(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(K(t,ArrayBuffer)||t&&K(t.buffer,ArrayBuffer))return f(t,e,o);if("undefined"!=typeof SharedArrayBuffer&&(K(t,SharedArrayBuffer)||t&&K(t.buffer,SharedArrayBuffer)))return f(t,e,o);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return a.from(r,e,o);const n=function(t){if(a.isBuffer(t)){const e=0|h(t.length),o=u(e);return 0===o.length||t.copy(o,0,0,e),o}return void 0!==t.length?"number"!=typeof t.length||Y(t.length)?u(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function p(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return p(t),u(t<0?0:0|h(t))}function d(t){const e=t.length<0?0:0|h(t.length),o=u(e);for(let r=0;r<e;r+=1)o[r]=255&t[r];return o}function f(t,e,o){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(o||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===o?new Uint8Array(t):void 0===o?new Uint8Array(t,e):new Uint8Array(t,e,o),Object.setPrototypeOf(r,a.prototype),r}function h(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||K(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const o=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===o)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return H(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*o;case"hex":return o>>>1;case"base64":return G(t).length;default:if(n)return r?-1:H(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,o){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===o||o>this.length)&&(o=this.length),o<=0)return"";if((o>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,o);case"utf8":case"utf-8":return q(this,e,o);case"ascii":return k(this,e,o);case"latin1":case"binary":return _(this,e,o);case"base64":return I(this,e,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,o);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,o){const r=t[e];t[e]=t[o],t[o]=r}function b(t,e,o,r,n){if(0===t.length)return-1;if("string"==typeof o?(r=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),Y(o=+o)&&(o=n?0:t.length-1),o<0&&(o=t.length+o),o>=t.length){if(n)return-1;o=t.length-1}else if(o<0){if(!n)return-1;o=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:w(t,e,o,r,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,o):Uint8Array.prototype.lastIndexOf.call(t,e,o):w(t,[e],o,r,n);throw new TypeError("val must be string, number or Buffer")}function w(t,e,o,r,n){let i,s=1,u=t.length,a=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,o/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){let r=-1;for(i=o;i<u;i++)if(l(t,i)===l(e,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===a)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(o+a>u&&(o=u-a),i=o;i>=0;i--){let o=!0;for(let r=0;r<a;r++)if(l(t,i+r)!==l(e,r)){o=!1;break}if(o)return i}return-1}function S(t,e,o,r){o=Number(o)||0;const n=t.length-o;r?(r=Number(r))>n&&(r=n):r=n;const i=e.length;let s;for(r>i/2&&(r=i/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(Y(r))return s;t[o+s]=r}return s}function v(t,e,o,r){return j(H(e,t.length-o),t,o,r)}function x(t,e,o,r){return j(function(t){const e=[];for(let o=0;o<t.length;++o)e.push(255&t.charCodeAt(o));return e}(e),t,o,r)}function A(t,e,o,r){return j(G(e),t,o,r)}function T(t,e,o,r){return j(function(t,e){let o,r,n;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)o=t.charCodeAt(s),r=o>>8,n=o%256,i.push(n),i.push(r);return i}(e,t.length-o),t,o,r)}function I(t,e,o){return 0===e&&o===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,o))}function q(t,e,o){o=Math.min(t.length,o);const r=[];let n=e;for(;n<o;){const e=t[n];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(n+s<=o){let o,r,u,a;switch(s){case 1:e<128&&(i=e);break;case 2:o=t[n+1],128==(192&o)&&(a=(31&e)<<6|63&o,a>127&&(i=a));break;case 3:o=t[n+1],r=t[n+2],128==(192&o)&&128==(192&r)&&(a=(15&e)<<12|(63&o)<<6|63&r,a>2047&&(a<55296||a>57343)&&(i=a));break;case 4:o=t[n+1],r=t[n+2],u=t[n+3],128==(192&o)&&128==(192&r)&&128==(192&u)&&(a=(15&e)<<18|(63&o)<<12|(63&r)<<6|63&u,a>65535&&a<1114112&&(i=a))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),n+=s}return function(t){const e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);let o="",r=0;for(;r<e;)o+=String.fromCharCode.apply(String,t.slice(r,r+=E));return o}(r)}a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,o){return l(t,e,o)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,o){return function(t,e,o){return p(t),t<=0?u(t):void 0!==e?"string"==typeof o?u(t).fill(e,o):u(t).fill(e):u(t)}(t,e,o)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(K(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),K(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let o=t.length,r=e.length;for(let n=0,i=Math.min(o,r);n<i;++n)if(t[n]!==e[n]){o=t[n],r=e[n];break}return o<r?-1:r<o?1:0},a.isEncoding=function(t){switch(String(t).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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let o;if(void 0===e)for(e=0,o=0;o<t.length;++o)e+=t[o].length;const r=a.allocUnsafe(e);let n=0;for(o=0;o<t.length;++o){let e=t[o];if(K(e,Uint8Array))n+e.length>r.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(r,n)):Uint8Array.prototype.set.call(r,e,n);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,n)}n+=e.length}return r},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?q(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="";const o=e.IS;return t=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(t+=" ... "),"<Buffer "+t+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(t,e,o,r,n){if(K(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===o&&(o=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||o>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=o)return 0;if(r>=n)return-1;if(e>=o)return 1;if(this===t)return 0;let i=(n>>>=0)-(r>>>=0),s=(o>>>=0)-(e>>>=0);const u=Math.min(i,s),l=this.slice(r,n),p=t.slice(e,o);for(let t=0;t<u;++t)if(l[t]!==p[t]){i=l[t],s=p[t];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,o){return-1!==this.indexOf(t,e,o)},a.prototype.indexOf=function(t,e,o){return b(this,t,e,o,!0)},a.prototype.lastIndexOf=function(t,e,o){return b(this,t,e,o,!1)},a.prototype.write=function(t,e,o,r){if(void 0===e)r="utf8",o=this.length,e=0;else if(void 0===o&&"string"==typeof e)r=e,o=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(o)?(o>>>=0,void 0===r&&(r="utf8")):(r=o,o=void 0)}const n=this.length-e;if((void 0===o||o>n)&&(o=n),t.length>0&&(o<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return S(this,t,e,o);case"utf8":case"utf-8":return v(this,t,e,o);case"ascii":case"latin1":case"binary":return x(this,t,e,o);case"base64":return A(this,t,e,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,o);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function k(t,e,o){let r="";o=Math.min(t.length,o);for(let n=e;n<o;++n)r+=String.fromCharCode(127&t[n]);return r}function _(t,e,o){let r="";o=Math.min(t.length,o);for(let n=e;n<o;++n)r+=String.fromCharCode(t[n]);return r}function R(t,e,o){const r=t.length;(!e||e<0)&&(e=0),(!o||o<0||o>r)&&(o=r);let n="";for(let r=e;r<o;++r)n+=J[t[r]];return n}function B(t,e,o){const r=t.slice(e,o);let n="";for(let t=0;t<r.length-1;t+=2)n+=String.fromCharCode(r[t]+256*r[t+1]);return n}function P(t,e,o){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>o)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,o,r,n,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<i)throw new RangeError('"value" argument is out of bounds');if(o+r>t.length)throw new RangeError("Index out of range")}function M(t,e,o,r,n){F(e,r,n,t,o,7);let i=Number(e&BigInt(4294967295));t[o++]=i,i>>=8,t[o++]=i,i>>=8,t[o++]=i,i>>=8,t[o++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[o++]=s,s>>=8,t[o++]=s,s>>=8,t[o++]=s,s>>=8,t[o++]=s,o}function U(t,e,o,r,n){F(e,r,n,t,o,7);let i=Number(e&BigInt(4294967295));t[o+7]=i,i>>=8,t[o+6]=i,i>>=8,t[o+5]=i,i>>=8,t[o+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[o+3]=s,s>>=8,t[o+2]=s,s>>=8,t[o+1]=s,s>>=8,t[o]=s,o+8}function C(t,e,o,r,n,i){if(o+r>t.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function $(t,e,o,r,i){return e=+e,o>>>=0,i||C(t,0,o,4),n.write(t,e,o,r,23,4),o+4}function L(t,e,o,r,i){return e=+e,o>>>=0,i||C(t,0,o,8),n.write(t,e,o,r,52,8),o+8}a.prototype.slice=function(t,e){const o=this.length;(t=~~t)<0?(t+=o)<0&&(t=0):t>o&&(t=o),(e=void 0===e?o:~~e)<0?(e+=o)<0&&(e=0):e>o&&(e=o),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,a.prototype),r},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,o){t>>>=0,e>>>=0,o||P(t,e,this.length);let r=this[t],n=1,i=0;for(;++i<e&&(n*=256);)r+=this[t+i]*n;return r},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,o){t>>>=0,e>>>=0,o||P(t,e,this.length);let r=this[t+--e],n=1;for(;e>0&&(n*=256);)r+=this[t+--e]*n;return r},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=Z((function(t){z(t>>>=0,"offset");const e=this[t],o=this[t+7];void 0!==e&&void 0!==o||V(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+o*2**24;return BigInt(r)+(BigInt(n)<<BigInt(32))})),a.prototype.readBigUInt64BE=Z((function(t){z(t>>>=0,"offset");const e=this[t],o=this[t+7];void 0!==e&&void 0!==o||V(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+o;return(BigInt(r)<<BigInt(32))+BigInt(n)})),a.prototype.readIntLE=function(t,e,o){t>>>=0,e>>>=0,o||P(t,e,this.length);let r=this[t],n=1,i=0;for(;++i<e&&(n*=256);)r+=this[t+i]*n;return n*=128,r>=n&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,o){t>>>=0,e>>>=0,o||P(t,e,this.length);let r=e,n=1,i=this[t+--r];for(;r>0&&(n*=256);)i+=this[t+--r]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const o=this[t]|this[t+1]<<8;return 32768&o?4294901760|o:o},a.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const o=this[t+1]|this[t]<<8;return 32768&o?4294901760|o:o},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=Z((function(t){z(t>>>=0,"offset");const e=this[t],o=this[t+7];void 0!==e&&void 0!==o||V(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(o<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),a.prototype.readBigInt64BE=Z((function(t){z(t>>>=0,"offset");const e=this[t],o=this[t+7];void 0!==e&&void 0!==o||V(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+o)})),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,o,r){t=+t,e>>>=0,o>>>=0,r||O(this,t,e,o,Math.pow(2,8*o)-1,0);let n=1,i=0;for(this[e]=255&t;++i<o&&(n*=256);)this[e+i]=t/n&255;return e+o},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,o,r){t=+t,e>>>=0,o>>>=0,r||O(this,t,e,o,Math.pow(2,8*o)-1,0);let n=o-1,i=1;for(this[e+n]=255&t;--n>=0&&(i*=256);)this[e+n]=t/i&255;return e+o},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=Z((function(t,e=0){return M(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=Z((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(t,e,o,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*o-1);O(this,t,e,o,r-1,-r)}let n=0,i=1,s=0;for(this[e]=255&t;++n<o&&(i*=256);)t<0&&0===s&&0!==this[e+n-1]&&(s=1),this[e+n]=(t/i|0)-s&255;return e+o},a.prototype.writeIntBE=function(t,e,o,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*o-1);O(this,t,e,o,r-1,-r)}let n=o-1,i=1,s=0;for(this[e+n]=255&t;--n>=0&&(i*=256);)t<0&&0===s&&0!==this[e+n+1]&&(s=1),this[e+n]=(t/i|0)-s&255;return e+o},a.prototype.writeInt8=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,o){return t=+t,e>>>=0,o||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=Z((function(t,e=0){return M(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=Z((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(t,e,o){return $(this,t,e,!0,o)},a.prototype.writeFloatBE=function(t,e,o){return $(this,t,e,!1,o)},a.prototype.writeDoubleLE=function(t,e,o){return L(this,t,e,!0,o)},a.prototype.writeDoubleBE=function(t,e,o){return L(this,t,e,!1,o)},a.prototype.copy=function(t,e,o,r){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(o||(o=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<o&&(r=o),r===o)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-o&&(r=t.length-e+o);const n=r-o;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,o,r):Uint8Array.prototype.set.call(t,this.subarray(o,r),e),n},a.prototype.fill=function(t,e,o,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,o=this.length):"string"==typeof o&&(r=o,o=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<o)throw new RangeError("Out of range index");if(o<=e)return this;let n;if(e>>>=0,o=void 0===o?this.length:o>>>0,t||(t=0),"number"==typeof t)for(n=e;n<o;++n)this[n]=t;else{const i=a.isBuffer(t)?t:a.from(t,r),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<o-e;++n)this[n+e]=i[n%s]}return this};const D={};function N(t,e,o){D[t]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function W(t){let e="",o=t.length;const r="-"===t[0]?1:0;for(;o>=r+4;o-=3)e=`_${t.slice(o-3,o)}${e}`;return`${t.slice(0,o)}${e}`}function F(t,e,o,r,n,i){if(t>o||t<e){const r="bigint"==typeof e?"n":"";let n;throw n=i>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${e}${r} and <= ${o}${r}`,new D.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,o){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+o]||V(e,t.length-(o+1))}(r,n,i)}function z(t,e){if("number"!=typeof t)throw new D.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,o){if(Math.floor(t)!==t)throw z(t,o),new D.ERR_OUT_OF_RANGE(o||"offset","an integer",t);if(e<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${e}`,t)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),N("ERR_OUT_OF_RANGE",(function(t,e,o){let r=`The value of "${t}" is out of range.`,n=o;return Number.isInteger(o)&&Math.abs(o)>2**32?n=W(String(o)):"bigint"==typeof o&&(n=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(n=W(n)),n+="n"),r+=` It must be ${e}. Received ${n}`,r}),RangeError);const X=/[^+/0-9A-Za-z-_]/g;function H(t,e){let o;e=e||1/0;const r=t.length;let n=null;const i=[];for(let s=0;s<r;++s){if(o=t.charCodeAt(s),o>55295&&o<57344){if(!n){if(o>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}n=o;continue}if(o<56320){(e-=3)>-1&&i.push(239,191,189),n=o;continue}o=65536+(n-55296<<10|o-56320)}else n&&(e-=3)>-1&&i.push(239,191,189);if(n=null,o<128){if((e-=1)<0)break;i.push(o)}else if(o<2048){if((e-=2)<0)break;i.push(o>>6|192,63&o|128)}else if(o<65536){if((e-=3)<0)break;i.push(o>>12|224,o>>6&63|128,63&o|128)}else{if(!(o<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}}return i}function G(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,o,r){let n;for(n=0;n<r&&!(n+o>=e.length||n>=t.length);++n)e[n+o]=t[n];return n}function K(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(t){return t!=t}const J=function(){const t="0123456789abcdef",e=new Array(256);for(let o=0;o<16;++o){const r=16*o;for(let n=0;n<16;++n)e[r+n]=t[o]+t[n]}return e}();function Z(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},251(t,e){e.read=function(t,e,o,r,n){var i,s,u=8*n-r-1,a=(1<<u)-1,l=a>>1,p=-7,c=o?n-1:0,d=o?-1:1,f=t[e+c];for(c+=d,i=f&(1<<-p)-1,f>>=-p,p+=u;p>0;i=256*i+t[e+c],c+=d,p-=8);for(s=i&(1<<-p)-1,i>>=-p,p+=r;p>0;s=256*s+t[e+c],c+=d,p-=8);if(0===i)i=1-l;else{if(i===a)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),i-=l}return(f?-1:1)*s*Math.pow(2,i-r)},e.write=function(t,e,o,r,n,i){var s,u,a,l=8*i-n-1,p=(1<<l)-1,c=p>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=p):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+c>=1?d/a:d*Math.pow(2,1-c))*a>=2&&(s++,a/=2),s+c>=p?(u=0,s=p):s+c>=1?(u=(e*a-1)*Math.pow(2,n),s+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;t[o+f]=255&u,f+=h,u/=256,n-=8);for(s=s<<n|u,l+=n;l>0;t[o+f]=255&s,f+=h,s/=256,l-=8);t[o+f-h]|=128*y}},626(c,d,f){f.d(d,{UTY:()=>sn,fFH:()=>Dn,RCv:()=>ri,Z$K:()=>rn,OAi:()=>un,G_M:()=>ze,fAY:()=>pr,a_O:()=>h,A$9:()=>m,XvM:()=>Sr,gRW:()=>dr,cJU:()=>Mr,SVM:()=>vr,DYS:()=>nn,wFd:()=>an,wJe:()=>ei,$wP:()=>Un,eBc:()=>Fr,JtG:()=>Kr,Vhx:()=>Tn,xEs:()=>_n,t$R:()=>qn,pU3:()=>Xn,VZJ:()=>tn,N0v:()=>ve,B_D:()=>We,qLM:()=>Ee,eX8:()=>_e,zaA:()=>_r,xDR:()=>K,jR0:()=>Y,P2l:()=>on,W68:()=>Ne,sec:()=>Le,ZPB:()=>No,yrp:()=>kr,spi:()=>rt,Iu1:()=>Vo,yuB:()=>zo,$96:()=>Oo,zwJ:()=>Uo,h_A:()=>Co,e_X:()=>$o,TkG:()=>Po,BAg:()=>Mo,u9S:()=>Ho,biU:()=>Xo,gc5:()=>Fo,ayx:()=>Wo,SXg:()=>be,UFY:()=>fr,Y5o:()=>et,mEH:()=>nt,xGW:()=>ye,s9Q:()=>it,OL0:()=>ge,k6p:()=>so,djE:()=>no,kDJ:()=>yo,Yfw:()=>fo,AI1:()=>Do,O2U:()=>To,c5J:()=>Io,N8y:()=>ro,qUh:()=>mo,RZj:()=>wo,nio:()=>uo,hFg:()=>qo,Qkp:()=>Eo,GwL:()=>_o,$Kr:()=>xo,ujH:()=>ao,Odj:()=>io,X7c:()=>go,Ubz:()=>Ro,Dx4:()=>ho,OAr:()=>eo,$Uh:()=>to,obN:()=>co,$lZ:()=>oo,Kaw:()=>po,Wbk:()=>Qe,kwV:()=>lo,qAI:()=>Ze,VSx:()=>Ao,HPG:()=>Bo,xQk:()=>Go,YQw:()=>ko,QY:()=>vo,osR:()=>bo,Kob:()=>So,IJt:()=>$e,nw5:()=>Q,PrA:()=>at,ZEf:()=>tt,X0W:()=>ke,evz:()=>we,P8C:()=>Re,aVn:()=>Ie,p2b:()=>Te,sVY:()=>Pe,XDq:()=>Ue,Jsu:()=>Oe,W5:()=>Be,Dyw:()=>qe,_i2:()=>Ae,FZg:()=>Me,wGh:()=>xe,Nix:()=>G,v_o:()=>j,qDU:()=>ut,qRb:()=>st,QJY:()=>Se,bmW:()=>me,n_N:()=>Fe,v87:()=>Ce,qMI:()=>he,gHX:()=>De,O3p:()=>J,Gzh:()=>Z,prJ:()=>X,moD:()=>Yn,y5S:()=>oi,Fmy:()=>cr,OBV:()=>ot,aku:()=>Ar,HFl:()=>Cn,cCk:()=>fn,Ft:()=>de,MB4:()=>ee,Dnk:()=>fe,pqp:()=>oe,Q3w:()=>re,Jh3:()=>ne,wfs:()=>Er,UmN:()=>hr,xO7:()=>At,R11:()=>Gt,LwT:()=>br,mMz:()=>wt,iES:()=>Rt,zpK:()=>qt,N3x:()=>It,bNp:()=>ht,T3v:()=>Wt,KQV:()=>Qt,S9l:()=>Kt,rER:()=>g,XNg:()=>ft,VeU:()=>Vt,T_r:()=>Ct,m4Y:()=>Nt,XIn:()=>St,Lt0:()=>Bt,wsx:()=>kt,KKL:()=>yt,yl$:()=>ct,kqD:()=>dt,dEm:()=>Dt,bu4:()=>Xt,ftY:()=>Lt,Ht0:()=>Zt,$uf:()=>$t,wqt:()=>Jt,CHU:()=>wr,Wc$:()=>jt,Y5D:()=>bt,KGs:()=>Ot,nWw:()=>Et,jFb:()=>mt,Pvd:()=>zt,S2b:()=>vt,uSb:()=>Pt,N9t:()=>_t,bNM:()=>gt,PvK:()=>Ft,O5u:()=>Mt,NYX:()=>Ut,FCB:()=>Yt,h_O:()=>xt,zu2:()=>Ht,Xix:()=>Tt,C88:()=>Vn,LAw:()=>Pr,E6J:()=>Rr,Dsj:()=>Br,XVZ:()=>xi,CUR:()=>gr,Kye:()=>di,Q6F:()=>yi,SFb:()=>hi,tT6:()=>fi,fBQ:()=>Kn,LRi:()=>cn,M0l:()=>pn,sfH:()=>dn,NFG:()=>Rn,DGs:()=>Bn,BqG:()=>In,VxL:()=>Zr,DLQ:()=>Jr,mbb:()=>bi,AuU:()=>Si,vCP:()=>Ln,w74:()=>$n,JRY:()=>kn,BV_:()=>gn,ApP:()=>yn,Ei0:()=>mn,kQ9:()=>Nn,vp8:()=>Wn,$y9:()=>Gr,ONb:()=>Yo,HhT:()=>te,PF2:()=>y,oze:()=>Tr,oVm:()=>yr,g57:()=>Yr,LaM:()=>jo,DgJ:()=>ln,Vuj:()=>Qr,Ou3:()=>Sn,kRY:()=>xn,W_e:()=>An,Let:()=>vn,TXb:()=>Mn,shl:()=>Jn,TqQ:()=>jn,BKn:()=>qr,rWM:()=>En});const h={stellarMainnet:{name:"mainnet",passphrase:"Public Global Stellar Network ; September 2015",horizonUrl:"https://horizon.stellar.org",sorobanRpcUrl:"https://stellar-gateway.xoxno.com",quoteUrl:"https://stellar-swap.xoxno.com",explorerNetwork:"public",aquariusApiUrl:"https://amm-api.aqua.network",aquariusRouter:"CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK",lendingController:"CAUCMIN5KSXEVZ7NMXR3LZATGD5EFIEUI5XWTFLYRO2R5OTXI22WE5JX",lendingPool:"CBXRNDQMAJFG4VUKMKFEMFS75UUXE2SPSNV4LEEFCSNBCN66PYRWBKXO",aggregatorRouter:"CCVENFSVCBYDHVOACFZXMNNYVOZ3LKXPZYU5LUI4N7KTXOKRVYD7F3TR",governance:"CC44PEQW7HSEPKAZ5ZRPH2JS5M5KVJXCUBLJ2ZX4E3WCDKMNFILHC2AD",priceAggregator:"CBGUF2G2Q7HCVCWYISDXBHPVBGMYNXA7PG2VET66YBZX6IKOOV27NSMV",positionNftContract:"CAWCSG77AY2W24QZ6ZXLHZU4UXEFHZBM6EI4A4IF7JB5CTY4XND3TI6C"},stellarTestnet:{name:"testnet",passphrase:"Test SDF Network ; September 2015",horizonUrl:"https://horizon-testnet.stellar.org",sorobanRpcUrl:"https://stellar-testnet-gateway.xoxno.com",quoteUrl:"https://testnet-stellar-swap.xoxno.com",explorerNetwork:"testnet",aquariusApiUrl:"https://amm-api-testnet.aqua.network",aquariusRouter:"CBCFTQSPDBAIZ6R6PJQKSQWKNKWH2QIV3I4J72SHWBIK3ADRRAM5A6GD",lendingController:"CCXRWJ6SIU2WPFEGLFGJVITPL57QAYIMIO6OAM2NBGNDQSSCK2FFV3F3",lendingPool:"CBSGF6QOQAMPFBEVSYPEQHSZRIHJ6RCGUPCRDMUX36DEKRWFAO2PZB5A",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},y=h;function g(t){return h["testnet"===t?"stellarTestnet":"stellarMainnet"]}const m={mainnet:h.stellarMainnet.passphrase,testnet:h.stellarTestnet.passphrase};var b=f(287);const w=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],S={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},v=1e6,x=t=>new e(t).toScVal(),A=t=>new i(t).toI128(),T=t=>p.ScVal.scvU32(t),I=t=>{if("number"==typeof t&&!Number.isSafeInteger(t))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new i("string"==typeof t?t:t.toString()).toU64()},q=t=>p.ScVal.scvBool(t),E=t=>p.ScVal.scvString(t),k=t=>p.ScVal.scvSymbol(t),_=()=>p.ScVal.scvVoid(),R=t=>p.ScVal.scvVec(t),B=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=b.hp.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return p.ScVal.scvBytes(r)},P=(t,e)=>null==t?_():e(t),O=(t,e)=>$({asset:x(e),hub_id:T(t)}),M=(t,e,o)=>p.ScVal.scvVec([O(t,e),A(o)]),U=t=>p.ScVal.scvVec(t.map((t=>M(t.hubId,t.asset,t.amount)))),C=t=>{if("Transfer"===t)return R([k("Transfer")]);if(t&&"object"==typeof t&&"Credit"in t){const e=t.Credit;if("number"==typeof e&&!Number.isInteger(e))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${e}`);return R([k("Credit"),I(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},$=t=>{const e=Object.keys(t).sort().map((e=>new p.ScMapEntry({key:k(e),val:t[e]})));return p.ScVal.scvMap(e)};class L{assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>v)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,o,r,n){this.ops.push([t,e,o,r,n])}emitPath(t,e){t.hops.forEach(((o,r)=>{if(o.tokenIn===o.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.hops[r-1];if(n&&o.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(S[o.venue],0===r?e:1,this.asset(o.pool),this.asset(o.tokenIn),this.asset(o.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),o=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(o[t])continue;const r=e[t].hops[0]?.tokenIn,n=[];for(let o=t;o<e.length;o+=1)e[o].hops[0]?.tokenIn===r&&n.push(o);const i=n.reduce(((t,o)=>t+e[o].splitPpm),0);if(i>v)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const s=i===v;let u=v;n.forEach(((t,r)=>{o[t]=!0;const i=e[t];let a;if(r+1===n.length&&s)a=0;else{if(0===u)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(i.splitPpm*v/u);u-=Math.min(i.splitPpm,u),a=128+this.weight(t)}this.emitPath(i,a)}))}}toBytes(t,e,o){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 r=[1,t,e,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,this.ops.length,this.weights.length];for(const t of this.ops)r.push(...t);for(const t of this.weights)r.push(t>>>16&255,t>>>8&255,255&t);return b.hp.from(r)}get assetList(){return this.assets}get amountList(){return this.amounts}}const D=t=>{const e=new L(t.totalMinOut),o=e.asset(t.tokenIn),r=e.asset(t.tokenOut);if(o===r)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const r=e.asset(t.burnPool),n=e.amountList.length;for(const o of t.burnMinAmounts??[])e.amount(o);e.emit(5,0,r,o,n)}if(e.lowerPaths(t.paths),t.mintPool){const o=t.preSwapAmount;if(o&&BigInt(o)>0n){const r=t.mintPoolTokens;if(!r||2!==r.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,i]=r,[s,u]=t.preSwapFromA?[n,i]:[i,n];e.emit(S.Aquarius,2+e.amount(o),e.asset(t.mintPool),e.asset(s),e.asset(u))}e.emit(6,0,e.asset(t.mintPool),r,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return $({amounts:p.ScVal.scvVec(e.amountList.map((t=>A(t)))),assets:p.ScVal.scvVec(e.assetList.map((t=>x(t)))),ops:p.ScVal.scvBytes(e.toBytes(o,r,n))})},N=t=>{const e=b.hp.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return p.ScVal.scvBytes(e)},W=()=>p.ScVal.scvBytes(b.hp.alloc(0)),F=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return b.hp.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=b.hp.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},z=t=>{if("string"==typeof t)return N(F(t));if(t instanceof Uint8Array)return 0===t.length?W():N(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?N(F(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?N(F(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?N(F(t.bytes)):0===t.bytes.length?W():N(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length&&!e.burnPool&&!e.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const o=new Map;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!w.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=r.hops[0];o.set(e.tokenIn,(o.get(e.tokenIn)??0)+r.splitPpm)}for(const[t,r]of o){if(r>v)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${r}, above 1000000`);if(!e.mintPool&&r!==v)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${r}`)}return e})(t),p.ScVal.scvBytes(b.hp.from(D(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},V=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=b.hp.from(e,"hex");return p.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return p.ScVal.scvBytes(b.hp.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function X(e,o,i){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const s=new n(e.controllerAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new u(a,{fee:e.fee??r,networkPassphrase:m[e.network]}).addOperation(s.call(o,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function H(t){if(!Number.isInteger(t)||t<1||t>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return T(t)}function G(t,e){const o=e.accountNonce??0;return X(t,"supply",[x(t.caller),I(o),H(e.spokeId),U([...e.assets])])}function j(t,e){return G(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function K(t,e){return X(t,"borrow",[x(t.caller),I(e.accountNonce),U([...e.borrows]),P(e.to,x)])}function Y(t,e){return K(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function J(t,e){return X(t,"withdraw",[x(t.caller),I(e.accountNonce),U([...e.withdrawals]),P(e.to,x)])}function Z(t,e){return J(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Q(t,e){return X(t,"repay",[x(t.caller),I(e.accountNonce),U([...e.payments])])}function tt(t,e){return Q(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function et(t,e){return X(t,"liquidate",[x(t.caller),I(e.accountNonce),U([...e.debtPayments]),C(e.seizeMode??"Transfer")])}function ot(t){const e=l(p.ScVal.fromXDR(t,"base64"));if("bigint"==typeof e||"number"==typeof e)return e.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof e)}function rt(t,e){return X(t,"flash_loan",[x(t.caller),O(e.hubId,e.asset),A(e.amount),x(e.receiver),V(e.data)])}function nt(t,e){return X(t,"migrate_from_blend",[x(t.caller),I(e.accountId),H(e.spokeId),T(e.hubId),x(e.blendPool),R(e.collateralTokens.map(x)),R(e.supplyTokens.map(x)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),p.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,p.ScVal.scvVec([x(e),A(o)]);var e,o}))))]);var o}function it(t,e){const o=e.accountNonce??0;return X(t,"multiply",[x(t.caller),I(o),H(e.spokeId),O(e.collateral.hubId,e.collateral.asset),A(e.debtToFlashLoan),O(e.debt.hubId,e.debt.asset),T(e.mode),z(e.steps),P(e.initialPayment,(t=>M(t.hubId,t.asset,t.amount))),P(e.convertSwap,z)])}function st(t,e){return X(t,"swap_debt",[x(t.caller),I(e.accountNonce),O(e.existingDebt.hubId,e.existingDebt.asset),A(e.newDebtAmount),O(e.newDebt.hubId,e.newDebt.asset),z(e.steps)])}function ut(t,e){return X(t,"swap_collateral",[x(t.caller),I(e.accountNonce),O(e.current.hubId,e.current.asset),A(e.fromAmount),O(e.newCollateral.hubId,e.newCollateral.asset),z(e.steps)])}function at(t,e){return X(t,"repay_debt_with_collateral",[x(t.caller),I(e.accountNonce),O(e.collateral.hubId,e.collateral.asset),A(e.collateralAmount),O(e.debt.hubId,e.debt.asset),z(e.steps),q(e.closePosition)])}const lt="/stellar-lending",pt=encodeURIComponent,ct=(t,e)=>t.fetchWithTimeout(`${lt}/context`,e),dt=(t,e)=>t.fetchWithTimeout(`${lt}/live-state`,e),ft=(t,e)=>t.fetchWithTimeout(`${lt}/markets/detailed`,e),ht=(t,e)=>t.fetchWithTimeout(`${lt}/assets`,e),yt=(t,e)=>t.fetchWithTimeout(`${lt}/hubs`,e),gt=(t,e)=>t.fetchWithTimeout(`${lt}/spokes`,e),mt=(t,e={},o)=>t.fetchWithTimeout(`${lt}/reserves`,{...o,params:{...e}}),bt=(t,e,o,r,n)=>t.fetchWithTimeout(`${lt}/reserves/${e}/${o}/${pt(r)}`,n),wt=(t,e,o)=>t.fetchWithTimeout(`${lt}/assets/${pt(e)}`,o),St=(t,e,o)=>t.fetchWithTimeout(`${lt}/hubs/${e}`,o),vt=(t,e,o)=>t.fetchWithTimeout(`${lt}/spokes/${e}`,o),xt=(t,e,o)=>t.fetchWithTimeout(`${lt}/users/${pt(e)}/positions`,o),At=(t,e,o)=>t.fetchWithTimeout(`${lt}/accounts/${pt(e)}/positions`,o),Tt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/users/${pt(e)}/assets/${pt(o)}/balance`,r),It=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/assets/${pt(e)}/page`,{...r,params:{...o}}),qt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/assets/${pt(e)}/markets`,{...r,params:{side:o}}),Et=(t,e,o,r,n,i)=>t.fetchWithTimeout(`${lt}/reserves/${e}/${o}/${pt(r)}/holders`,{...i,params:{side:n}}),kt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/hubs/${e}/holders`,{...r,params:{side:o}}),_t=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/spokes/${e}/holders`,{...r,params:{side:o}}),Rt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/assets/${pt(e)}/graph`,{...r,params:{...o}}),Bt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/hubs/${e}/graph`,{...r,params:{...o}}),Pt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/spokes/${e}/graph`,{...r,params:{...o}}),Ot=(t,e,o,r,n,i)=>t.fetchWithTimeout(`${lt}/reserves/${e}/${o}/${pt(r)}/graph`,{...i,params:{...n}}),Mt=(t,e,o={},r)=>t.fetchWithTimeout(`${lt}/users/${pt(e)}/activity`,{...r,params:{...o}}),Ut=(t,e,o={},r)=>t.fetchWithTimeout(`${lt}/users/${pt(e)}/activity/page`,{...r,params:{...o}}),Ct=(t,e={},o)=>t.fetchWithTimeout(`${lt}/governance/proposals`,{...o,params:{...e}}),$t=(t,e={},o)=>t.fetchWithTimeout(`${lt}/positions`,{...o,params:{...e}}),Lt=(t,e={},o)=>t.fetchWithTimeout(`${lt}/participants`,{...o,params:{...e}}),Dt=(t,e={},o)=>t.fetchWithTimeout(`${lt}/liquidations/leaderboard`,{...o,params:{...e}}),Nt=(t,e={},o)=>t.fetchWithTimeout(`${lt}/distribution`,{...o,params:{...e}}),Wt=(t,e={},o)=>t.fetchWithTimeout(`${lt}/campaign/leaderboard`,{...o,params:{...e}}),Ft=(t,e,o)=>t.fetchWithTimeout(`${lt}/stats/history`,{...o,params:{...e}}),zt=(t,e,o)=>t.fetchWithTimeout(`${lt}/revenue`,{...o,params:{...e}}),Vt=(t,e,o)=>t.fetchWithTimeout(`${lt}/revenue/fees`,{...o,params:{...e}}),Xt=(t,e,o)=>t.fetchWithTimeout(`${lt}/liquidations`,{...o,params:{...e}}),Ht=(t,e,o)=>t.fetchWithTimeout(`${lt}/volume`,{...o,params:{...e}}),Gt=(t,e,o)=>t.fetchWithTimeout(`${lt}/active-users`,{...o,params:{...e}}),jt=(t,e,o)=>t.fetchWithTimeout(`${lt}/rate-spread`,{...o,params:{...e}}),Kt=(t,e,o)=>t.fetchWithTimeout(`${lt}/defillama`,{...o,params:{...e}}),Yt=(t,e,o,r)=>t.fetchWithTimeout(`${lt}/users/${pt(e)}/history`,{...r,params:{...o}}),Jt=(t,e,o)=>t.fetchWithTimeout(`${lt}/pnl`,{...o,params:{accountId:e}}),Zt=(t,e,o)=>t.fetchWithTimeout(`${lt}/pnl/scope`,{...o,params:{scope:e}}),Qt=(t,e,o)=>t.fetchWithTimeout(`${lt}/campaign/me`,{...o,params:{owner:e}}),te=t=>({context:e=>ct(t,e),liveState:e=>dt(t,e),marketsDetailed:e=>ft(t,e),assets:e=>ht(t,e),hubs:e=>yt(t,e),spokes:e=>gt(t,e),reserves:(e={},o)=>void 0!==o||"hubId"in e||"spokeId"in e||"asset"in e?mt(t,e,o):mt(t,{},e),reserve:(e,o,r,n)=>bt(t,e,o,r,n),asset:(e,o)=>wt(t,e,o),hub:(e,o)=>St(t,e,o),spoke:(e,o)=>vt(t,e,o),userPositions:(e,o)=>xt(t,e,o),accountPositions:(e,o)=>At(t,e,o),walletBalance:(e,o,r)=>Tt(t,e,o,r),assetPage:(e,o,r)=>It(t,e,o,r),assetMarkets:(e,o,r)=>qt(t,e,o,r),reserveHolders:(e,o,r,n,i)=>Et(t,e,o,r,n,i),hubHolders:(e,o,r)=>kt(t,e,o,r),spokeHolders:(e,o,r)=>_t(t,e,o,r),assetGraph:(e,o,r)=>Rt(t,e,o,r),hubGraph:(e,o,r)=>Bt(t,e,o,r),spokeGraph:(e,o,r)=>Pt(t,e,o,r),reserveGraph:(e,o,r,n,i)=>Ot(t,e,o,r,n,i),userActivity:(e,o={},r)=>Mt(t,e,o,r),userActivityPage:(e,o={},r)=>Ut(t,e,o,r),governanceProposals:(e={},o)=>Ct(t,e,o),positionsLeaderboard:(e={},o)=>$t(t,e,o),participants:(e={},o)=>Lt(t,e,o),liquidationsLeaderboard:(e={},o)=>Dt(t,e,o),distribution:(e={},o)=>Nt(t,e,o),campaignLeaderboard:(e={},o)=>Wt(t,e,o),statsHistory:(e,o)=>Ft(t,e,o),revenue:(e,o)=>zt(t,e,o),feeRevenue:(e,o)=>Vt(t,e,o),liquidations:(e,o)=>Xt(t,e,o),volume:(e,o)=>Ht(t,e,o),activeUsers:(e,o)=>Gt(t,e,o),rateSpread:(e,o)=>jt(t,e,o),defillama:(e,o)=>Kt(t,e,o),userHistory:(e,o,r)=>Yt(t,e,o,r),positionsPnl:(e,o)=>Jt(t,e,o),pnlByScope:(e,o)=>Zt(t,e,o),campaignMe:(e,o)=>Qt(t,e,o)}),ee=t=>$({base_borrow_rate:A(t.baseBorrowRateRay),max_borrow_rate:A(t.maxBorrowRateRay),max_utilization:A(t.maxUtilizationRay),mid_utilization:A(t.midUtilizationRay),optimal_utilization:A(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:A(t.slope1Ray),slope2:A(t.slope2Ray),slope3:A(t.slope3Ray)}),oe=t=>$({asset_decimals:T(t.assetDecimals),asset_id:x(t.assetId),base_borrow_rate:A(t.baseBorrowRateRay),flashloan_fee:T(t.flashloanFeeBps),is_flashloanable:q(t.isFlashloanable),max_borrow_rate:A(t.maxBorrowRateRay),max_utilization:A(t.maxUtilizationRay),mid_utilization:A(t.midUtilizationRay),optimal_utilization:A(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:A(t.slope1Ray),slope2:A(t.slope2Ray),slope3:A(t.slope3Ray)}),re=t=>$({max_borrow_positions:T(t.maxBorrowPositions),max_supply_positions:T(t.maxSupplyPositions)}),ne=t=>{if("Token"in t&&t.Token)return R([k("Token"),x(t.Token)]);if("Ref"in t&&t.Ref)return R([k("Ref"),k(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},ie=t=>{if("Stellar"in t)return R([k("Stellar"),x(t.Stellar)]);if("Symbol"in t)return R([k("Symbol"),k(t.Symbol)]);if("String"in t)return R([k("String"),E(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},se=t=>{if("Spot"===t)return R([k("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return R([k("Twap"),T(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},ue=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return R([k(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},ae=t=>{if("Market"===t||"Fundamental"===t)return R([k(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},le=t=>{if("Reflector"in t){const e=t.Reflector;return R([k("Reflector"),$({asset:ie(e.asset),contract:x(e.contract),read_mode:se(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return R([k("MultiFeed"),$({contract:x(e.contract),feed_id:E(e.feedId),kind:ue(e.kind),nature:ae(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},pe=t=>{const e=t;return $({decimals:T(e.decimals),max_stale_seconds:I(e.maxStaleSeconds),provider:le(e.provider)})},ce=t=>{if("RequireDisjoint"===t)return R([k("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return R([k("AllowShared"),R(e.map((t=>$({contract:x(t.contract),kind:ue(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},de=t=>{const e=t,o=e.sources??[];let r,n;if("number"==typeof e.toleranceBps)r=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/r));else{const t=e.tolerance??{};r=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return $({asset_decimals:T(Number(e.assetDecimals)),independence:ce(e.independence),max_price_stale_seconds:I(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:A(String(e.maxSanityPriceWad)),min_sanity_price_wad:A(String(e.minSanityPriceWad)),sources:R(o.map((t=>(t=>{if("Feed"in t)return R([k("Feed"),pe(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return R([k("Scaled"),$({factor:pe(e.factor),max_factor_wad:A(e.maxFactorWad),min_factor_wad:A(e.minFactorWad),quote:ne(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return R([k("LpShare"),$({key_a:ne(e.keyA),key_b:ne(e.keyB),kind:R([k(e.kind||"ConstantProduct")]),pool:x(e.pool),reserve_a_decimals:T(e.reserveADecimals),reserve_b_decimals:T(e.reserveBDecimals),share_decimals:T(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:$({lower_ratio_bps:T(n),upper_ratio_bps:T(r)})})},fe=de;function he(t,e){return X(t,"upgrade",[B(e.wasmHash)])}function ye(t,e){return X(t,"migrate",[T(e.newVersion)])}function ge(t){return X(t,"pause",[])}function me(t){return X(t,"unpause",[])}function be(t,e){return X(t,"grant_role",[x(e.account),k(e.role)])}function we(t,e){return X(t,"revoke_role",[x(e.account),k(e.role)])}function Se(t,e){return X(t,"transfer_ownership",[x(e.newOwner),T(e.liveUntilLedger)])}function ve(t){return X(t,"accept_ownership",[])}function xe(t,e){return X(t,"set_swap_aggregator",[x(e.aggregator)])}function Ae(t,e){return X(t,"set_price_aggregator",[x(e.aggregator)])}const Te=xe;function Ie(t,e){return X(t,"set_accumulator",[x(e.accumulator)])}function qe(t,e){return X(t,"set_position_limits",[re(e)])}function Ee(t,e){return X(t,"approve_blend_pool",[x(e.pool)])}function ke(t,e){return X(t,"revoke_blend_pool",[x(e.pool)])}const _e=Ee,Re=ke;function Be(t,e){return X(t,"set_oracle",[ne(e.key),de(e.oracle)])}const Pe=Be;function Oe(t,e){const o=e.toleranceBps,r=e.upperRatioBps??1e4+o,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/r));return X(t,"set_tolerance",[ne(e.key),$({lower_ratio_bps:T(n),upper_ratio_bps:T(r)})])}function Me(t,e){return X(t,"set_spoke_asset_flags",[T(e.spokeId),O(e.hubId,e.asset),q(e.paused),q(e.frozen),q(e.noSeize)])}function Ue(t,e){return X(t,"set_oracle_sanity_bounds",[x(e.asset),A(e.minPriceWad),A(e.maxPriceWad)])}function Ce(t,e){return X(t,"update_indexes",[x(t.caller),R(e.assets.map((t=>O(t.hubId,t.asset))))])}function $e(t,e){return X(t,"renew_account",[x(t.caller),I(e.accountNonce)])}function Le(t,e){return X(t,"create_liquidity_pool",[T(e.hubId),x(e.asset),oe(e.params)])}function De(t,e){return X(t,"upgrade_liquidity_pool_params",[O(e.hubId,e.asset),ee(e.params)])}function Ne(t,e){return X(t,"claim_revenue",[x(t.caller),R(e.assets.map((t=>O(t.hubId,t.asset))))])}function We(t,e){return X(t,"add_rewards",[x(t.caller),U(e.rewards)])}function Fe(t,e){return X(t,"update_account_threshold",[x(t.caller),q(e.hasRisks),R(e.accountNonces.map((t=>I(t))))])}const ze="00".repeat(32),Ve=t=>{if("string"==typeof t)return B(t);const e=b.hp.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return p.ScVal.scvBytes(e)},Xe=(t,...e)=>R([k(t),...e]),He=t=>$({new_owner:x(t.newOwner),live_until_ledger:T(t.liveUntilLedger)}),Ge=t=>$({asset:x(t.asset),bonus:T(t.bonus),borrow_cap:A(t.borrowCap),can_borrow:q(t.canBorrow),can_collateral:q(t.canCollateral),frozen:q(t.frozen),hub_id:T(t.hubId),paused:q(t.paused),liquidation_fees:T(t.liquidationFees),ltv:T(t.ltv),no_seize:q(t.noSeize),spoke_id:T(t.spokeId),supply_cap:A(t.supplyCap),threshold:T(t.threshold)}),je=t=>$({account:x(t.account),role:k(t.role)});function Ke(e,o,i){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const s=new n(e.governanceAddress),a=new t(e.caller,e.sourceSequence);return{xdr:new u(a,{fee:e.fee??r,networkPassphrase:m[e.network]}).addOperation(s.call(o,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Ye=(t,e,o)=>Ke(t,"propose",[x(t.caller),e,Ve(o)]),Je=(t,e,o)=>Ke(t,"execute_self",[_(),e,Ve(o)]);function Ze(t,e,o){return Ye(t,Xe("SetSwapAggregator",x(e.aggregator)),o)}function Qe(t,e,o){return Ye(t,Xe("SetPriceAggregator",x(e.aggregator)),o)}const to=Ze;function eo(t,e,o){return Ye(t,Xe("SetAccumulator",x(e.accumulator)),o)}function oo(t,e,o){return Ye(t,Xe("SetPositionLimits",re(e)),o)}function ro(t,e){return Ye(t,Xe("CreateHub"),e)}function no(t,e){return Ye(t,Xe("AddSpoke"),e)}function io(t,e,o){return Ye(t,Xe("RemoveSpoke",T(e.spokeId)),o)}function so(t,e,o){return Ye(t,Xe("AddAssetToSpoke",Ge(e)),o)}function uo(t,e,o){return Ye(t,Xe("EditAssetInSpoke",Ge(e)),o)}function ao(t,e,o){return Ye(t,Xe("RemoveAssetFromSpoke",$({hub_asset:O((r=e).hubId,r.asset),spoke_id:T(r.spokeId)})),o);var r}function lo(t,e,o){return Ye(t,Xe("SetSpokeLiquidationCurve",$({hf_for_max_bonus_wad:A((r=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:T(r.liquidationBonusFactorBps),spoke_id:T(r.spokeId),target_hf_wad:A(r.targetHfWad)})),o);var r}function po(t,e,o){return Ye(t,Xe("SetPositionManager",x(e.manager),q(e.isActive)),o)}function co(t,e,o){return Ye(t,Xe("SetMinBorrowCollateralUsd",A(e.floorWad)),o)}function fo(t,e,o){return Ye(t,Xe("ApproveToken",x(e.token)),o)}function ho(t,e,o){return Ye(t,Xe("RevokeToken",x(e.token)),o)}function yo(t,e,o){return Ye(t,Xe("ApproveBlendPool",x(e.pool)),o)}function go(t,e,o){return Ye(t,Xe("RevokeBlendPool",x(e.pool)),o)}function mo(t,e,o){return Ye(t,Xe("CreateLiquidityPool",$({asset:x((r=e).asset),hub_id:T(r.hubId),params:oe(r.params)})),o);var r}function bo(t,e,o){return Ye(t,Xe("UpgradeLiquidityPoolParams",$({hub_asset:O((r=e).hubId,r.asset),params:ee(r.params)})),o);var r}function wo(t,e,o){return Ye(t,Xe("DeployPool",B(e.wasmHash)),o)}function So(t,e,o){return Ye(t,Xe("UpgradePool",B(e.wasmHash)),o)}function vo(t,e,o){return Ye(t,Xe("UpgradeController",B(e.wasmHash)),o)}function xo(t,e,o){return Ye(t,Xe("MigrateController",T(e.newVersion)),o)}function Ao(t,e,o){return Ye(t,Xe("TransferCtrlOwnership",He(e)),o)}function To(t,e,o){return Ye(t,Xe("ConfigureAssetOracle",$({key:ne((r=e).key),oracle:de(r.oracle)})),o);var r}const Io=To;function qo(t,e,o){return Ye(t,Xe("EditOracleTolerance",$({key:ne((r=e).key),tolerance:T(r.tolerance)})),o);var r}function Eo(t,e,o){return Ye(t,Xe("UpgradeGov",B(e.wasmHash)),o)}function ko(t,e,o){return Ye(t,Xe("UpdateGovDelay",T(e.newDelay)),o)}function _o(t,e,o){return Ye(t,Xe("GrantGovRole",je(e)),o)}function Ro(t,e,o){return Ye(t,Xe("RevokeGovRole",je(e)),o)}function Bo(t,e,o){return Ye(t,Xe("TransferGovOwnership",He(e)),o)}function Po(t,e){const o=R(e.argsXdr.map((t=>p.ScVal.fromXDR(t,"base64")))),r=Ve(e.predecessor??ze);return Ke(t,"execute",[_(),x(e.target),k(e.functionName),o,r,Ve(e.salt)])}function Oo(t,e,o){return Je(t,Xe("UpgradeGov",B(e.wasmHash)),o)}function Mo(t,e,o){return Je(t,Xe("UpdateGovDelay",T(e.newDelay)),o)}function Uo(t,e,o){return Je(t,Xe("GrantGovRole",je(e)),o)}function Co(t,e,o){return Je(t,Xe("RevokeGovRole",je(e)),o)}function $o(t,e,o){return Je(t,Xe("TransferGovOwnership",He(e)),o)}const Lo=t=>R(t.map(x));function Do(t,e,o){return Ke(t,"propose_canceller_reset",[Lo(e.newCancellers),Ve(o)])}function No(t,e,o){return Ke(t,"execute_canceller_reset",[P(e.executor,x),Lo(e.newCancellers),Ve(o)])}function Wo(t,e){return Ke(t,"set_spoke_asset_flags",[x(t.caller),T(e.spokeId),O(e.hubId,e.asset),q(e.paused),q(e.frozen),q(e.noSeize)])}function Fo(t,e){return Ke(t,"set_oracle_sanity_bounds",[x(t.caller),x(e.asset),A(e.minPriceWad),A(e.maxPriceWad)])}function zo(t){return Ke(t,"create_hub",[x(t.caller)])}function Vo(t){return Ke(t,"add_spoke",[x(t.caller)])}function Xo(t,e){return Ke(t,"revoke_role_immediate",[x(e.account),k(e.role)])}function Ho(t){return Ke(t,"pause",[x(t.caller)])}function Go(t,e){return Ye(t,Xe("Unpause"),e)}const jo=t=>t.toXDR("base64"),Ko=t=>p.ScVal.fromXDR(t,"base64"),Yo=t=>t.map((t=>String(l(Ko(t))))).join(":"),Jo=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Zo=t=>Number(t),Qo=t=>String(t),tr=t=>t instanceof Uint8Array?b.hp.from(t).toString("hex"):b.hp.isBuffer(t)?t.toString("hex"):String(t),er=["None","Multiply","Long","Short"],or=["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"],rr=t=>Array.isArray(t)?t:[],nr=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],or[Zo(r)]??Jo(r)),positionType:e,hubId:Zo(t[1]),asset:Qo(t[2]),scaledAmountRay:Jo(t[3]),indexRay:Jo(t[4]),amount:Jo(t[5]),liquidationThresholdBps:o?void 0:Zo(t[6]),liquidationBonusBps:o?void 0:Zo(t[7]),loanToValueBps:o?void 0:Zo(t[8]),liquidationFeesBps:o?void 0:Zo(t[9])};var r},ir=t=>{return{owner:Qo(t[0]),spokeId:Zo(t[1]),mode:(e=t[2],er[Zo(e)]??"None")};var e},sr=t=>Array.isArray(t)?t[1]:void 0,ur=t=>{const e=(o=t,Array.isArray(o)?Qo(o[0]):Qo(o));var o;if("Token"===e)return{Token:Qo(sr(t))};if("Ref"===e)return{Ref:Qo(sr(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Qo(e.Token)};if(void 0!==e.Ref)return{Ref:Qo(e.Ref)}}return{Token:Qo(t)}},ar=t=>{const e=t.tolerance??{};return{assetDecimals:Zo(t.asset_decimals),maxPriceStaleSeconds:Zo(t.max_price_stale_seconds),sources:rr(t.sources).map((t=>t)),tolerance:{upperRatio:Zo(e.upper_ratio_bps),lowerRatio:Zo(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Jo(t.min_sanity_price_wad),maxSanityPriceWad:Jo(t.max_sanity_price_wad)}},lr={"market:create":t=>({topic:"market:create",data:{hubId:Zo(t.hub_id),baseAsset:Qo(t.base_asset),maxBorrowRate:Jo(t.max_borrow_rate),baseBorrowRate:Jo(t.base_borrow_rate),slope1:Jo(t.slope1),slope2:Jo(t.slope2),slope3:Jo(t.slope3),midUtilization:Jo(t.mid_utilization),optimalUtilization:Jo(t.optimal_utilization),maxUtilization:Jo(t.max_utilization),reserveFactor:Zo(t.reserve_factor),marketAddress:Qo(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Qo(t.asset),maxBorrowRateRay:Jo(t.max_borrow_rate),baseBorrowRateRay:Jo(t.base_borrow_rate),slope1Ray:Jo(t.slope1),slope2Ray:Jo(t.slope2),slope3Ray:Jo(t.slope3),midUtilizationRay:Jo(t.mid_utilization),optimalUtilizationRay:Jo(t.optimal_utilization),maxUtilizationRay:Jo(t.max_utilization),reserveFactorBps:Zo(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:rr(t).map((t=>{return e=rr(t),{hubId:Zo(e[0]),asset:Qo(e[1]),timestamp:Zo(e[2]),supplyIndexRay:Jo(e[3]),borrowIndexRay:Jo(e[4]),cash:Jo(e[5]),suppliedRay:Jo(e[6]),borrowedRay:Jo(e[7]),revenueRay:Jo(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:rr(t).map((t=>{const e=t;return{hubId:Zo(e.hub_id),asset:Qo(e.asset),params:(o=e.params,{maxBorrowRateRay:Jo(o.max_borrow_rate),baseBorrowRateRay:Jo(o.base_borrow_rate),slope1Ray:Jo(o.slope1),slope2Ray:Jo(o.slope2),slope3Ray:Jo(o.slope3),midUtilizationRay:Jo(o.mid_utilization),optimalUtilizationRay:Jo(o.optimal_utilization),maxUtilizationRay:Jo(o.max_utilization),reserveFactorBps:Zo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Zo(o.flashloan_fee),assetId:Qo(o.asset_id),assetDecimals:Zo(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=rr(t);return{topic:"position:batch_update",data:{accountId:Jo(e[0]),accountAttributes:ir(rr(e[1])),updates:[...rr(e[2]).map((t=>nr(rr(t),"Deposit"))),...rr(e[3]).map((t=>nr(rr(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Zo(t.hub_id),asset:Qo(t.asset),receiver:Qo(t.receiver),caller:Qo(t.caller),amount:Jo(t.amount),fee:Jo(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:ur(t.key),oracle:ar(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Qo(t.asset),oracle:ar(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Qo(t.liquidator),accountId:Jo(t.account_id),repaidUsdWad:Jo(t.repaid_usd_wad),bonusBps:Jo(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Jo(t.account_id),totalBorrowUsdWad:Jo(t.total_borrow_usd_wad),totalCollateralUsdWad:Jo(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Qo(t.token),amount:Jo(t.amount),usdValueWad:Jo(t.usd_value_wad),accountId:Jo(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Zo(t.hub_id),asset:Qo(t.asset),amount:Jo(t.amount),fee:Jo(t.fee),amountSent:Jo(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Qo(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:tr(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Qo(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Qo(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Qo(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Qo(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:tr(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Zo(t.max_supply_positions),maxBorrowPositions:Zo(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Jo(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Qo(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Zo(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Jo(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Jo(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Zo(e.liquidation_bonus_factor_bps)}}}},pr=Object.freeze(Object.keys(lr));function cr(t,e){const o=Yo(t),r=lr[o];return r?r(l(Ko(e))):null}const dr=1e4;function fr(t,e){return`${t}-${BigInt(e).toString(10)}`}function hr(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function yr(t,e=0){return t*dr+e}function gr(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const mr=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()};async function br(t,e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=mr(e.baseUrl,"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,referralId:t.referralId,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function wr(t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");const e=mr(t.baseUrl,"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const Sr=16384;class vr extends Error{code;constructor(t,e){super(`Stellar route verification failed [${t}]: ${e}`),this.name="StellarRouteVerificationError",this.code=t}}const xr=(t,e)=>{throw new vr(t,e)};function Ar(t){const o=(t=>{const e="string"==typeof t?t:t&&"object"==typeof t&&"routeXdr"in t?t.routeXdr:void 0;if("string"==typeof e&&e.length>2*Sr)return xr("OVERSIZED",`encoded route has ${e.length} characters`);try{return b.hp.from(z(t).bytes())}catch(t){return xr("MALFORMED",t instanceof Error?t.message:String(t))}})(t);0===o.length&&xr("MALFORMED","route is empty"),o.length>Sr&&xr("OVERSIZED",`route has ${o.length} bytes, above ${Sr}`);const r=(t=>{let e;try{e=p.ScVal.fromXDR(t)}catch(t){return xr("MALFORMED",`payload is not one XDR ScVal: ${t instanceof Error?t.message:String(t)}`)}if("scvMap"!==e.switch().name)return xr("MALFORMED","payload must be a StrategyPayload map");const o=e.map()??[];if("amounts,assets,ops"!==o.map((t=>"scvSymbol"===t.key().switch().name?t.key().sym().toString():"")).join(","))return xr("MALFORMED","payload fields must be exactly amounts, assets, ops");const[r,n,i]=o.map((t=>t.val()));return"scvVec"!==r.switch().name||"scvVec"!==n.switch().name||"scvBytes"!==i.switch().name?xr("MALFORMED","payload field has the wrong type"):{amounts:r.vec()??[],assets:n.vec()??[],ops:b.hp.from(i.bytes())}})(o),n=r.assets.length,i=r.amounts.length;0===n&&xr("MALFORMED","asset registry is empty"),(n>256||i>126)&&xr("OVERSIZED",`registries hold ${n} assets and ${i} amounts`);const s=r.assets.map(((t,o)=>"scvAddress"!==t.switch().name?xr("MALFORMED",`assets[${o}] is not an address`):e.fromScAddress(t.address()).toString())),u=r.amounts.map(((t,e)=>"scvI128"!==t.switch().name?xr("MALFORMED",`amounts[${e}] is not an i128`):a(t))),l=r.ops;l.length<10&&xr("MALFORMED","program header is truncated"),l.length>346&&xr("OVERSIZED",`program has ${l.length} bytes, above 346`);const c=t=>{const e=l[t];return void 0===e?xr("MALFORMED",`program byte ${t} is missing`):e},d=c(0);1!==d&&xr("UNSUPPORTED_VERSION",`program version ${d}, expected 1`);const f=c(8),h=c(9);0===f&&xr("INVALID_STRUCTURE","program has no instructions"),(f>48||h>32)&&xr("OVERSIZED",`program declares ${f} instructions and ${h} weights`);const y=10+5*f;l.length!==y+3*h&&xr("MALFORMED","program length does not match its instruction and weight counts");const g=c(1),m=c(2),S=c(3);(g>=n||m>=n||S>=i)&&xr("MALFORMED","header index is outside its registry"),g===m&&xr("INVALID_STRUCTURE","token_in equals token_out");const x=l.readUInt32BE(4),A=[];for(let t=0;t<h;t+=1){const e=l.readUIntBE(y+3*t,3);(0===e||e>v)&&xr("INVALID_STRUCTURE",`split weight ${e} outside 1..=1000000`),A.push(e)}const T=t=>s[t]??xr("MALFORMED",`asset index ${t} is outside the registry`),I=t=>u[t]??xr("MALFORMED",`amount index ${t} is outside the registry`),q=[];let E;for(let t=0;t<f;t+=1){const e=10+5*t,o=c(e),r=c(e+1),n=c(e+2),s=c(e+3),u=c(e+4);let a;if(o>6&&xr("UNKNOWN_OPCODE",`instruction ${t} has opcode ${o}`),0===r)a={kind:"all"};else if(1===r)void 0!==E&&E===s||xr("INVALID_STRUCTURE",`instruction ${t} does not chain onto its predecessor`),a={kind:"prev"};else if(r>=128){const e=A[r-128];void 0===e&&xr("MALFORMED",`instruction ${t} weight index is out of range`),a={kind:"ppm",ppm:e}}else a={kind:"fixed",amount:I(r-2)};const l=T(n);5!==o&&6!==o?(s===u&&xr("INVALID_STRUCTURE",`instruction ${t} swaps a token for itself`),q.push({kind:"swap",venue:w[o],mode:a,pool:l,tokenIn:T(s),tokenOut:T(u)}),E=u):("all"!==a.kind&&xr("MALFORMED",`liquidity instruction ${t} must use mode All`),u>=i&&xr("MALFORMED",`instruction ${t} amount index is out of range`),q.push({kind:5===o?"burn":"mint",pool:l,shareToken:T(s),amountIndex:u}),E=6===o?s:void 0)}const k=I(S);return k<=0n&&xr("MIN_OUT_TOO_LOW",`encoded total_min_out is ${k}`),{version:d,tokenIn:T(g),tokenOut:T(m),totalMinOut:k,referralId:x,assets:s,amounts:u,ops:q,weights:A}}function Tr(t,e){if(s.isValidContract(t))return t;if(!e)return xr("EXPECTATION_MISSING",`token ${t} is not a contract id; pass \`network\` to derive its asset contract`);try{const r=t.indexOf(":");return("XLM"===t||"native"===t?o.native():new o(t.slice(0,r),t.slice(r+1))).contractId(m[e])}catch{return xr("MALFORMED",`token id ${t} is not a contract id or a classic asset`)}}const Ir=(t,e)=>"bigint"==typeof t?t:/^\d+$/.test(t)?BigInt(t):xr("EXPECTATION_MISSING",`${e} must be a base-unit integer string`);function qr(t,e){const o=Ir(e.minOut,"expected.minOut");o<=0n&&xr("EXPECTATION_MISSING","expected.minOut must be positive");const r=Ar(t);if(r.tokenIn!==e.tokenIn&&xr("TOKEN_IN_MISMATCH",`route spends ${r.tokenIn}, expected ${e.tokenIn}`),r.tokenOut!==e.tokenOut&&xr("TOKEN_OUT_MISMATCH",`route delivers ${r.tokenOut}, expected ${e.tokenOut}`),r.totalMinOut<o&&xr("MIN_OUT_TOO_LOW",`route enforces a minimum of ${r.totalMinOut}, below the expected ${o}`),void 0!==e.amountIn){const t=Ir(e.amountIn,"expected.amountIn");for(const e of r.ops)"swap"===e.kind&&"fixed"===e.mode.kind&&e.tokenIn===r.tokenIn&&e.mode.amount>t&&xr("AMOUNT_IN_EXCEEDED",`a leg spends ${e.mode.amount}, above the input ${t}`)}return r}const Er=t=>D(t).toXDR("base64");function kr(e,o){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const i=new n(e.routerAddress),s=new t(e.caller,e.sourceSequence),a=z(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(o,e.referralId));return{xdr:new u(s,{fee:e.fee??r,networkPassphrase:m[e.network]}).addOperation(i.call("execute_strategy",x(e.caller),A(e.totalIn),a)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function _r(t,e){return kr(t,e)}function Rr(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(Or),splitPpm:t.splitPpm}))):[{hops:t.hops.map(Or),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function Br(t,e={}){const o=e.expected??{},r="string"==typeof t.routeXdr&&t.routeXdr.length>0?{routeXdr:t.routeXdr}:Rr(t,e),n=[t.amountOutMin,o.minOut].filter((t=>void 0!==t)).map((t=>{if("bigint"==typeof t)return t;if("string"!=typeof t||!/^\d+$/.test(t))throw new vr("MALFORMED","minimum output must be a base-unit integer string");return BigInt(t)})).reduce(((t,e)=>void 0===t||e>t?e:t),void 0);if(void 0===n)throw new vr("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return qr(r,{tokenIn:Tr(o.tokenIn??t.from,e.network),tokenOut:Tr(o.tokenOut??t.to,e.network),minOut:n,amountIn:o.amountIn??t.amountIn}),r}const Pr=Rr,Or=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});class Mr extends Error{code;offender;constructor(t,e,o){super(`Stellar authorization check failed [${t}]: ${e}${o?` — ${o.contract}.${o.fn}(${o.args.join(", ")})`:""}`),this.name="StellarAuthPolicyError",this.code=t,this.offender=o}}const Ur=t=>"scvAddress"===t?.switch().name?e.fromScAddress(t.address()).toString():void 0,Cr=t=>"scvI128"===t?.switch().name?a(t):void 0,$r=t=>"scvVec"===t?.switch().name?t.vec()??[]:void 0,Lr=(t,e)=>"scvMap"===t?.switch().name?(t.map()??[]).find((t=>"scvSymbol"===t.key().switch().name&&t.key().sym().toString()===e))?.val():void 0,Dr=t=>Ur(t)??Cr(t)?.toString()??t.toXDR("base64"),Nr=t=>({contract:e.fromScAddress(t.contractAddress()).toString(),fn:t.functionName().toString(),args:t.args().map(Dr)}),Wr=t=>{const e=t.function();return"sorobanAuthorizedFunctionTypeContractFn"===e.switch().name?e.contractFn():void 0};function Fr(t,o,r){const n=t.filter((t=>{const n=t.credentials();return("sorobanCredentialsAddress"===n.switch().name?e.fromScAddress(n.address().address()).toString():r??o.caller)===o.caller}));if(n.length>1)throw new Mr("DUPLICATE_ENTRY",`${n.length} authorization entries for ${o.caller}, expected one`);const i=n[0];if(!i)return;const s=Wr(i.rootInvocation());if(!s)throw new Mr("UNEXPECTED_ROOT","root is not a contract call");const u=Nr(s);if(u.contract!==o.root.contract||u.fn!==o.root.fn)throw new Mr("UNEXPECTED_ROOT",`expected ${o.root.contract}.${o.root.fn}`,u);const a=o.transfers.map((()=>0n)),l=(o.calls??[]).map((()=>0));for(const t of i.rootInvocation().subInvocations()){const e=Wr(t);if(!e)throw new Mr("UNEXPECTED_CALL","sub-invocation is not a contract call");const r=Nr(e);if(t.subInvocations().length>0)throw new Mr("NESTED_INVOCATION","sub-invocation carries its own sub-invocations",r);const n=(o.calls??[]).findIndex((t=>t.contract===r.contract&&t.fn===r.fn));if(-1!==n){const t=(o.calls??[])[n],i=t.reject(e.args());if(i)throw new Mr("UNEXPECTED_CALL",i,r);if(l[n]=(l[n]??0)+1,(l[n]??0)>t.maxCount)throw new Mr("UNEXPECTED_CALL",`more than ${t.maxCount} calls`,r);continue}if("transfer"!==r.fn||3!==e.args().length)throw new Mr("UNEXPECTED_CALL","only `transfer` is allowed",r);if(!o.transfers.some((t=>t.token===r.contract)))throw new Mr("UNEXPECTED_TOKEN","transfer on an unexpected token",r);const[i,s,u]=e.args();if(Ur(i)!==o.caller)throw new Mr("UNEXPECTED_SENDER","transfer is not from the caller",r);const p=Ur(s),c=o.transfers.findIndex((t=>t.token===r.contract&&t.to===p));if(-1===c)throw new Mr("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",r);const d=Cr(u),f=o.transfers[c],h=(a[c]??0n)+(d??0n);if(void 0===d||d<=0n||h>f.maxAmount)throw new Mr("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,r);a[c]=h}}const zr=t=>{throw new Mr("MALFORMED_TRANSACTION",t)},Vr=(t,e)=>{const o=new Map;for(const e of $r(t)??zr("payments argument is not a vector")){const[t,r]=$r(e)??[],n=Ur(Lr(t,"asset")),i=Cr(r);if(void 0===n||void 0===i||i<0n)return zr("payment is not a (HubAssetKey, i128) tuple");o.set(n,(o.get(n)??0n)+i)}return[...o].map((([t,o])=>({token:t,to:e,maxAmount:o})))},Xr=new Set([1,3,5]),Hr=(t,e,o)=>({contract:t,fn:"submit",maxCount:2,reject:t=>{if(4!==t.length)return"submit must have four arguments";if(Ur(t[0])!==e)return"`from` is not the caller";if(Ur(t[1])!==o||Ur(t[2])!==o)return"`spender` and `to` must be the lending controller";const r=$r(t[3]);if(!r)return"requests is not a vector";for(const t of r){const e=Lr(t,"request_type");if("scvU32"!==e?.switch().name||!Xr.has(e.u32()))return"request is not a withdraw, withdraw-collateral, or repay"}}});function Gr(t,e,o){const{contract:r,fn:n}=Nr(e),i=e.args(),s={caller:t,root:{contract:r,fn:n},transfers:[]};if(r===o.governance)return s;if(r===o.aggregatorRouter){if("execute_strategy"!==n)return s;const e=Cr(i[1]);if(Ur(i[0])!==t||void 0===e||"scvBytes"!==i[2]?.switch().name)return zr("execute_strategy arguments must be (caller, total_in, swap_xdr)");const o=Ar(i[2].bytes());return s.transfers=[{token:o.tokenIn,to:r,maxAmount:e}],s}if(r!==o.lendingController)throw new Mr("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${r}; pass an explicit policy`);if(Ur(i[0])!==t)throw new Mr("CALLER_MISMATCH",`${n} is not invoked for ${t}`);switch(n){case"supply":s.transfers=Vr(i[3],o.lendingPool);break;case"repay":case"liquidate":s.transfers=Vr(i[2],o.lendingPool);break;case"multiply":{const t=i[8];t&&"scvVoid"!==t.switch().name&&(s.transfers=Vr(p.ScVal.scvVec([t]),r));break}case"migrate_from_blend":{const e=Ur(i[4])??zr("blend_pool is not an address");s.calls=[Hr(e,t,r)];break}}return s}const jr=t=>{let e;try{e=p.TransactionEnvelope.fromXDR(t,"base64")}catch{return zr("not a transaction envelope")}if("envelopeTypeTx"!==e.switch().name)return zr("expected a regular (v1) transaction");const o=e.v1().tx(),r=o.operations()[0];if(!r||1!==o.operations().length)return zr("expected exactly one operation");const n=r.body();if("invokeHostFunction"!==n.switch().name)return zr("operation is not a contract invocation");const i=n.invokeHostFunctionOp();return"hostFunctionTypeInvokeContract"!==i.hostFunction().switch().name?zr("host function is not a contract call"):{source:(u=r.sourceAccount()??o.sourceAccount(),s.encodeEd25519PublicKey("keyTypeMuxedEd25519"===u.switch().name?u.med25519().ed25519():u.ed25519())),op:i,call:i.hostFunction().invokeContract()};var u};function Kr(t,e){const o=jr(t);if(void 0!==e.builtXdr&&jr(e.builtXdr).op.hostFunction().toXDR("base64")!==o.op.hostFunction().toXDR("base64"))throw new Mr("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Nr(o.call));const r=e.policy??Gr(e.caller,o.call,{...g(e.network),...e.deployment});Fr(o.op.auth(),r,o.source)}function Yr(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Jr(t,e,o){const r=u.fromXDR(e,o?.network?m[o.network]:"");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw Yr(o.invokedContractId,t);throw t}}async function Zr(t,e,o){return Jr(t,e.xdr,o)}function Qr(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function tn(t,e){return new Uint8Array(0)}const en=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return b.hp.from(e,"hex")};function on(e){const o=new t(e.caller,e.sourceSequence),r=new n(e.forwarderAddress).call("mint_and_forward",p.ScVal.scvBytes(en(e.message)),p.ScVal.scvBytes(en(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:m[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const rn=10n**27n,nn=10n**18n,sn=10000n,un=27,an=18;function ln(t,e="value"){let o;if("bigint"==typeof t)o=t;else if("number"==typeof t){if(!Number.isSafeInteger(t))throw new Error(`Stellar math: ${e} must be a safe integer, got ${t}`);o=BigInt(t)}else{const r=t.trim();if(!/^-?\d+$/.test(r))throw new Error(`Stellar math: ${e} must be a decimal integer string, got "${t}"`);o=BigInt(r)}if(o<0n)throw new Error(`Stellar math: ${e} must be non-negative, got ${o}`);return o}function pn(t,e,o){if(0n===o)throw new Error("Stellar math: division by zero");return t*e/o}function cn(t,e,o){if(0n===o)throw new Error("Stellar math: division by zero");const r=t*e,n=r/o;return r%o===0n?n:n+1n}function dn(t,e,o){if(0n===o)throw new Error("Stellar math: division by zero");return(t*e+o/2n)/o}function fn(t,e){if(0n===e)throw new Error("Stellar math: division by zero");const o=t/e;return t%e>=e/2n+e%2n?o+1n:o}const hn=t=>10n**BigInt(t);function yn(t,e,o){return e===o?t:o>e?t*hn(o-e):t/hn(e-o)}function gn(t,e,o){if(e===o)return t;if(o>e)return t*hn(o-e);const r=hn(e-o),n=t/r;return t%r===0n?n:n+1n}function mn(t,e,o){return e===o?t:o>e?t*hn(o-e):fn(t,hn(e-o))}const bn={floor:pn,ceil:cn,halfUp:dn},wn={floor:yn,ceil:gn,halfUp:mn};function Sn(t,e,o,r){return wn[r](bn[r](t,e,rn),un,o)}function vn(t,e,o){return Sn(ln(t,"scaledRay"),ln(e,"indexRay"),o,"floor")}function xn(t,e,o){return Sn(ln(t,"scaledRay"),ln(e,"indexRay"),o,"ceil")}function An(t,e,o){return Sn(ln(t,"scaledRay"),ln(e,"indexRay"),o,"halfUp")}function Tn(t,e){if(e>un)throw new Error(`Stellar math: decimals ${e} exceed RAY scale`);return yn(t,e,un)}function In(t,e,o,r){const n=bn[r](t,e,rn),i=wn[r](n,un,an);return bn[r](i,o,nn)}function qn(t,e,o,r){const n=wn[r](Tn(t,e),un,an);return bn[r](n,o,nn)}const En=t=>Number(t)/1e18,kn=t=>Number(t)/1e27,_n=(t,e)=>Number(t)/10**e;function Rn(t,e){if(!Number.isFinite(t)||t<=0||t>=1e21)return 0n;const o=t.toFixed(e),[r="0",n=""]=o.split(".");return BigInt(r+n.padEnd(e,"0"))}const Bn=t=>Rn(t,an),Pn=(t,e)=>dn(t,e,rn),On=(t,e)=>dn(t,rn,e);function Mn(t,e){return 0n===e?0n:On(t,e)}function Un(t,e){const o=t>rn?rn:t,r=ln(e.baseRateRay,"irm.baseRateRay"),n=ln(e.slope1Ray,"irm.slope1Ray"),i=ln(e.slope2Ray,"irm.slope2Ray"),s=ln(e.slope3Ray,"irm.slope3Ray"),u=ln(e.midUtilizationRay,"irm.midUtilizationRay"),a=ln(e.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=ln(e.maxBorrowRateRay,"irm.maxBorrowRateRay");let p;if(o<u)p=r+On(Pn(o,n),u);else if(o<a){const t=a-u;p=r+n+On(Pn(o-u,i),t)}else{const t=rn-a;p=r+n+i+(0n===t?0n:On(Pn(o-a,s),t))}return p>l?l:p}function Cn(t,e,o){return 0n===t||!Number.isInteger(o)||o<0||o>=1e4?0n:dn(Pn(t,e),sn-BigInt(o),sn)}const $n=t=>kn(t),Ln=t=>Math.expm1(kn(t)),Dn=5n*nn,Nn=(t,e,o)=>`${t}:${e}:${o}`;function Wn(t,e,o,r){const n=Array.isArray(t)?t:void 0,i=n?n.find((t=>t.spokeId===e&&t.hubId===o&&t.asset===r)):t[Nn(e,o,r)]??Object.values(t).find((t=>t.spokeId===e&&t.hubId===o&&t.asset===r));if(!i)throw new Error(`Stellar math: no reserve for ${Nn(e,o,r)}`);return i}const Fn=/^0*[1-9]\d*$/,zn=t=>"string"==typeof t&&Fn.test(t)?BigInt(t).toString():null,Vn=(t,e)=>`${t}:${e}`;function Xn(t){const e=new Map,o=new Map,r=new Set,n=new Set;for(const i of t?.indexes??[]){const t=Vn(i.hubId,i.asset),s=zn(i.supplyIndex),u=zn(i.borrowIndex),a=zn(i.usdPrice),l=e.get(t),p=l&&zn(l.supplyIndex)===s&&zn(l.borrowIndex)===u&&zn(l.usdPrice)===a;null==s||null==u||null==a||l&&!p?r.add(t):l||e.set(t,i);const c=!1===i.valid||!0===i.stale||!0===i.deviation,d=o.get(i.asset);null==a||c||void 0!==d&&d.toString()!==a?n.add(i.asset):void 0===d&&o.set(i.asset,BigInt(a))}for(const t of r)e.delete(t);for(const t of n)o.delete(t);return{indexes:e,prices:o,rejectedIndexKeys:r,rejectedAssets:n}}const Hn=(t,e)=>pn(t,BigInt(e),sn);function Gn(t,e,o,r){const n="supply"===t.side,i=Math.min(t.entryLtvBps,t.entryLiquidationThresholdBps);return{side:t.side,hubId:t.hubId,asset:t.asset,decimals:t.decimals,scaledRay:t.scaledRay.toString(),indexRay:t.indexRay.toString(),usdPriceWad:t.priceWad.toString(),usdPrice:En(t.priceWad),amountBase:e.toString(),amountShort:_n(e,t.decimals),usdWad:o.toString(),usd:En(o),gateUsdWad:r.toString(),entryLtvBps:t.entryLtvBps,entryLiquidationThresholdBps:t.entryLiquidationThresholdBps,entryLiquidationBonusBps:t.entryLiquidationBonusBps,entryLiquidationFeesBps:t.entryLiquidationFeesBps,ltvWeightedUsdWad:n?Hn(r,i).toString():"0",liquidationWeightedUsdWad:n?Hn(r,t.entryLiquidationThresholdBps).toString():"0",liveDataUsed:t.liveDataUsed}}function jn(t){if("supply"===t.side)return Gn(t,Sn(t.scaledRay,t.indexRay,t.decimals,"floor"),In(t.scaledRay,t.indexRay,t.priceWad,"halfUp"),In(t.scaledRay,t.indexRay,t.priceWad,"floor"));const e=Sn(t.scaledRay,t.indexRay,t.decimals,"ceil"),o=In(t.scaledRay,t.indexRay,t.priceWad,"ceil");return Gn(t,e,o,o)}function Kn(t,e,o,r){const n=Tn(e,o);return"supply"===t?pn(n,rn,r):cn(n,rn,r)}function Yn(t,e,o,r){const n=Tn(e,o);return"supply"===t?cn(n,rn,r):pn(n,rn,r)}function Jn(t,e){return jn({...t,scaledRay:Kn(t.side,e,t.decimals,t.indexRay)})}const Zn=(...t)=>{for(const e of t){const t=zn(e);if(null!=t)return BigInt(t)}return rn};function Qn(t,e,o,r){const n=ln("supply"===t?e.supplyScaledRay:e.borrowScaledRay,`${t}ScaledRay`);if(0n===n)return null;const i=r.indexes.get(Vn(e.hubId,e.asset)),s=r.prices.get(e.asset),u="supply"===t?Zn(i?.supplyIndex,e.liveSupplyIndexRay,o.liveSupplyIndexRay,e.supplyIndexRay):Zn(i?.borrowIndex,e.liveBorrowIndexRay,o.liveBorrowIndexRay,e.borrowIndexRay),a=s??Bn(o.usdPrice);return jn({side:t,hubId:e.hubId,asset:e.asset,decimals:o.assetDecimals,scaledRay:n,indexRay:u,priceWad:a,entryLtvBps:e.entryLtvBps,entryLiquidationThresholdBps:e.entryLiquidationThresholdBps,entryLiquidationBonusBps:e.entryLiquidationBonusBps,entryLiquidationFeesBps:e.entryLiquidationFeesBps,liveDataUsed:void 0!==i&&void 0!==s})}const ti=(t,e)=>t.reduce(((t,o)=>t+BigInt(e(o))),0n);function ei(t,e,o,r,n){const i=ti(e,(t=>t.usdWad)),s=ti(e,(t=>t.ltvWeightedUsdWad)),u=ti(e,(t=>t.liquidationWeightedUsdWad)),a=ti(o,(t=>t.usdWad)),l=0n===a?null:pn(u,nn,a),p=0n===u?0:Number(a)/Number(u)*100,c=s<r||s<=a?0n:s-a;return{...t,supplies:e,borrows:o,totalCollateralUsdWad:i.toString(),totalCollateralUsd:En(i),ltvWeightedCollateralUsdWad:s.toString(),ltvWeightedCollateralUsd:En(s),liquidationWeightedCollateralUsdWad:u.toString(),liquidationWeightedCollateralUsd:En(u),totalDebtUsdWad:a.toString(),totalDebtUsd:En(a),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:En(l),healthPercent:p,borrowLimitUsdWad:s.toString(),borrowLimitUsd:En(s),availableBorrowUsdWad:c.toString(),availableBorrowUsd:En(c),minBorrowCollateralUsdWad:r.toString(),minBorrowCollateralUsd:En(r),isLiquidatable:null!==l&&l<nn,liveDataValid:n}}function oi(t){const{positions:e,reserves:o,liveState:r}=t,n=e[0];if(!n)throw new Error("Stellar math: computeAccountRisk needs at least one position row");for(const t of e)if(t.accountId!==n.accountId)throw new Error(`Stellar math: computeAccountRisk received mixed account ids (${n.accountId}, ${t.accountId})`);const i=Xn(r),s=[],u=[];for(const t of e){const e=Wn(o,t.spokeId,t.hubId,t.asset),r=Qn("supply",t,e,i);r&&s.push(r);const n=Qn("borrow",t,e,i);n&&u.push(n)}const a=null!=r?.minBorrowCollateralUsdWad?ln(r.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):Dn,l=void 0!==r&&[...s,...u].every((t=>t.liveDataUsed));return ei({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},s,u,a,l)}const ri=200n,ni=t=>t.reduce(((t,e)=>e.amount<t.amount?e:t)),ii=t=>t<0n?0n:t,si=(t,e,o,r)=>({amountBase:t.amount,amountShort:_n(t.amount,e),isFullClose:o,reason:t.reason,projectedUtilization:r}),ui=t=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:t,projectedUtilization:null});function ai(t){const e=t.assetDecimals,o=ln(t.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:Rn(t.hubPool.suppliedShort,e),borrowedBase:Rn(t.hubPool.borrowedShort,e),cashBase:Rn(t.availableLiquidityShort,e),spokeSuppliedBase:Rn(t.suppliedShort,e),spokeBorrowedBase:Rn(t.borrowedShort,e),maxUtilizationRay:o>=rn?null:o}}const li=(t,e)=>t<=0n?null:Number(e)/Number(t);function pi(t,e){if(t<=0n||!e(0n))return 0n;let o=0n,r=t+1n;for(;r-o>1n;){const t=(o+r)/2n;e(t)?o=t:r=t}return o}const ci=(t,e)=>t.find((t=>t.hubId===e.hubId&&t.asset===e.asset));function di(t,e,o){if(e.paused)return ui("paused");if(e.frozen)return ui("frozen");if(!e.isBorrowable)return ui("cap");const r=e.assetDecimals,n=ai(e),i=ci(t.borrows,e),s=Xn(o).indexes.get(Vn(e.hubId,e.asset)),u=i?BigInt(i.indexRay):ln(s?.borrowIndex??e.liveBorrowIndexRay,"borrowIndex"),a=i?BigInt(i.usdPriceWad):function(t,e){return Xn(e).prices.get(t.asset)??Bn(t.usdPrice)}(e,o),l=i?BigInt(i.scaledRay):0n,p=BigInt(t.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),c=BigInt(t.ltvWeightedCollateralUsdWad),d=BigInt(t.minBorrowCollateralUsdWad),f=[];if(c<d)f.push({amount:0n,reason:"minCollateral"});else{const e=c-BigInt(t.totalDebtUsdWad),o=e<=0n||a<=0n?0n:pn(e,10n**BigInt(r),a),n=t=>p+In(l+Kn("borrow",t,r,u),u,a,"ceil");f.push({amount:0n===o?0n:pi(o+16n,(t=>n(t)<=c)),reason:"ltv"})}f.push({amount:ii(ln(e.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=dn(n.suppliedBase,ri,sn);f.push({amount:ii(n.cashBase-h),reason:"liquidity"});const y=function(t,e){const o=t.maxUtilizationRay;if(null===o)return null;const r=Tn(t.suppliedBase,e);return 0n===r?null:pi(ii(pn(t.suppliedBase,o,rn)-t.borrowedBase)+16n,(n=>Mn(Tn(t.borrowedBase+n,e),r)<=o))}(n,r);null!==y&&f.push({amount:y,reason:"utilizationCap"});const g=ni(f);return si(g,r,!1,li(n.suppliedBase,n.borrowedBase+g.amount))}function fi(t,e,o){if(e.paused)return ui("paused");const r=ci(t.supplies,e);if(!r)return ui(null);const n=r.decimals,i=ai(e),s=BigInt(r.scaledRay),u=BigInt(r.indexRay),a=BigInt(r.usdPriceWad),l=BigInt(r.amountBase),p=Sn(s,u,n,"halfUp"),c=BigInt(t.totalDebtUsdWad),d=BigInt(t.minBorrowCollateralUsdWad),f=BigInt(Math.min(r.entryLtvBps,r.entryLiquidationThresholdBps)),h=[];let y=!0;if(c>0n&&f>0n){const e=c>d?c:d,o=d>c?"minCollateral":"healthFactor",i=BigInt(t.ltvWeightedCollateralUsdWad)-BigInt(r.ltvWeightedUsdWad);if(i<e){y=!1;const t=e-i,l=cn(t,sn,f),c=BigInt(r.gateUsdWad)-l,d=c<=0n?0n:pn(c,10n**BigInt(n),a),g=p>0n?p-1n:0n,m=d+16n>g?g:d+16n,b=t=>{const e=Yn("supply",t,n,u);return pn(In(e>=s?0n:s-e,u,a,"floor"),f,sn)};h.push({amount:pi(m,(e=>b(e)>=t)),reason:o})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const g=function(t,e){const o=t.maxUtilizationRay;if(null===o||0n===t.borrowedBase)return null;if(0n===o)return 0n;const r=cn(t.borrowedBase,rn,o),n=t.suppliedBase<r?0n:t.suppliedBase-r+16n,i=Tn(t.borrowedBase,e);return pi(n>t.suppliedBase?t.suppliedBase:n,(r=>{const n=Tn(t.suppliedBase-r,e);return n>0n&&Mn(i,n)<=o}))}(i,n);null!==g&&h.push({amount:g,reason:"utilizationCap"});const m=ni(h),b=y&&m.amount>=l;return si(m,n,b,li(i.suppliedBase-m.amount,i.borrowedBase))}function hi(t){if(t.paused)return ui("paused");if(t.frozen)return ui("frozen");const e=t.assetDecimals,o=ai(t),r={amount:ii(ln(t.supplyCap,"supplyCap")-o.spokeSuppliedBase),reason:"cap"};return si(r,e,!1,li(o.suppliedBase+r.amount,o.borrowedBase))}function yi(t,e,o){if(e.paused)return ui("paused");const r=ci(t.borrows,e);if(!r)return ui(null);const n=r.decimals,i=ai(e),s=BigInt(r.amountBase),u=void 0===o?null:ln(o,"walletBalance"),a=null!==u&&u<s?{amount:u,reason:"liquidity"}:{amount:s,reason:null};return si(a,n,a.amount>=s,li(i.suppliedBase,ii(i.borrowedBase-a.amount)))}const gi=(t,e)=>t.hubId===e.hubId&&t.asset===e.asset,mi=t=>{if("bigint"==typeof t)return t;const e=t.trim();if(!/^-?\d+$/.test(e))throw new Error(`Stellar math: delta amountBase must be an integer string, got "${t}"`);return BigInt(e)};function bi(t,e){const o=[...t.supplies],r=[...t.borrows];for(const t of e){const e="supply"===t.side?o:r,n=e.findIndex((e=>gi(e,t))),i=-1===n?void 0:e[n],s=mi(t.amountBase);let u;if(i){const t={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},e=BigInt(i.scaledRay);let o;if(s>=0n)o=e+Kn(t.side,s,t.decimals,t.indexRay);else{const r=-s,n=r>=("supply"===t.side?Sn(e,t.indexRay,t.decimals,"halfUp"):BigInt(i.amountBase))?e:Yn(t.side,r,t.decimals,t.indexRay);o=n>=e?0n:e-n}u=0n===o?null:jn({...t,scaledRay:o})}else u=s<=0n?null:Jn(wi(t),s);-1===n?u&&e.push(u):u?e[n]=u:e.splice(n,1)}return ei({accountId:t.accountId,owner:t.owner,spokeId:t.spokeId,mode:t.mode},o,r,BigInt(t.minBorrowCollateralUsdWad),t.liveDataValid)}function wi(t){const e=t.reserve;if(!e)throw new Error(`Stellar math: projectAccountRisk needs \`reserve\` for a new ${t.side} position on ${t.hubId}:${t.asset}`);return{side:t.side,hubId:t.hubId,asset:t.asset,decimals:e.assetDecimals,indexRay:ln("supply"===t.side?e.liveSupplyIndexRay:e.liveBorrowIndexRay,"reserve live index"),priceWad:Bn(e.usdPrice),entryLtvBps:e.collateralFactorBps,entryLiquidationThresholdBps:e.liquidationThresholdBps,entryLiquidationBonusBps:e.liquidationPenaltyBps,entryLiquidationFeesBps:e.liquidationFeesBps,liveDataUsed:!1}}function Si(t,e=0n,o=0n){const r=t.assetDecimals,n=t=>t<0n?0n:t,i=n(Rn(t.hubPool.suppliedShort,r)+mi(e)),s=Mn(Tn(n(Rn(t.hubPool.borrowedShort,r)+mi(o)),r),Tn(i,r)),u=Un(s,t.irm),a=Cn(s,u,t.irm.reserveFactorBps);return{utilization:kn(s),utilizationRay:s.toString(),borrowAprRay:u.toString(),supplyAprRay:a.toString(),borrowApr:$n(u),supplyApr:$n(a),borrowApy:Ln(u),supplyApy:Ln(a)}}const vi={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function xi(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const o=Number(e[1]),r=vi[o];return r?{code:o,...r}:null}}},d={};function f(t){var e=d[t];if(void 0!==e)return e.exports;var o=d[t]={exports:{}};return c[t](o,o.exports,f),o.exports}f.d=(t,e)=>{for(var o in e)f.o(e,o)&&!f.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},f.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const h="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",g="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",m=3e4;var b;!function(t){t.MAINNET="1",t.DEVNET="D"}(b||(b={}));class w{apiUrl;chain;init;config;constructor(t){if(!t?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:e=b.MAINNET,apiUrl:o,...r}=t;this.apiUrl=o.trim().replace(/\/$/,""),this.chain=e,this.init=r,this.config=e==b.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:h,DR_SC:y,KG_SC:g,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:h,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:i,timeout:s,...u}=this.init,{next:a,cache:l,debug:p,timeout:c,headers:d,method:f="GET",...h}=o,y=d?.Authorization,g="Bearer undefined"===y?void 0:y,m="GET"!==f&&"HEAD"!==f&&"PUT"!==f,b={...d,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...m?{"Content-Type":"application/json"}:{},...g?{Authorization:g}:{}},w=Object.entries(e??{}).filter((([,t])=>void 0!==t)).flatMap((([t,e])=>Array.isArray(e)?e.filter((t=>void 0!==t)).map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),S=`${this.apiUrl}${t}${w.length?`?${w}`:""}`,{revalidate:v,...x}=r??{},{revalidate:A,...T}=a??{},I="GET"!==f||g?void 0:A??v,q="GET"!==f||g||I?void 0:l??n,E=h.body,k=c??s??(null==E?3e4:0),_=k>0?AbortSignal.timeout(k):void 0,R=h.signal??u.signal,B=_&&R?AbortSignal.any([R,_]):_??R,P={...u,...h,method:f,...Object.keys(b).length?{headers:b}:{},...B?{signal:B}:{},cache:q,next:{...x,...T,revalidate:I}};(p??i)&&console.debug("SDK fetch: ",S,P);const O=await fetch(S,P).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${S}: ${t.message}`),{cause:t});throw t})),M=await O.text();if(!O.ok){let t;try{t=JSON.parse(M)}catch{t={message:M}}const e=[S,O.status,O.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(M)}catch{return M}}}const S=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),r=/^C[A-Z2-7]{55}$/.test(t);return e||o||r},v=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t),r=/^C[A-Z2-7]{55}-\d+$/.test(t);return e||o||r};class x extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class A extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const T=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^[GC][A-Z2-7]{55}$/.test(t)),I={"/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:{}}},q=["PATCH","POST","DELETE","PUT"];var E=f(626);const k=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function _(t,e,o,r){const{input:n,output:i,...s}=e,u=async(e={})=>{const n={...o,...e},i=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),s=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),u=Object.fromEntries(Object.entries(n).filter((([t])=>!s.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in u,l=/:collection[^A-Z]/.test(t)||"collection"in u;if(a){const t=n.address;if(!T(t))throw new A(t)}if(l){const t=n.collection;if(Array.isArray(t)?t.some((t=>!S(t))):!S(t))throw new x(t)}const p=Object.fromEntries(Object.entries(u).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:f,headers:h,cache:y,next:g,debug:m,signal:b,credentials:w,mode:v,redirect:I,referrer:q,referrerPolicy:E,integrity:k,keepalive:_,priority:R,window:B,continuationToken:P,...O}=p,M=d?`Bearer ${d}`:void 0;t.startsWith("/stellar-lending/")&&void 0!==P&&(O.continuationToken=P);const U={...h,...M?{Authorization:M}:{},...P&&!t.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(P)}:{}},C={...g,tags:[...g?.tags??[],i]};return r.fetchWithTimeout(i,{method:f,params:O,body:c,headers:U,cache:y,debug:m,...Object.fromEntries(Object.entries({signal:b,credentials:w,mode:v,redirect:I,referrer:q,referrerPolicy:E,integrity:k,keepalive:_,priority:R,window:B}).filter((([,t])=>void 0!==t))),...C?{next:C}:{}})},a=(t={})=>u(t);for(const t of Object.keys(s))q.includes(t)&&(a[t]=e=>u({...e,method:e.method??t.toUpperCase()}));return a}function R(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(I)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=k(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=k(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,i=Object.keys(e.static).length,s=Object.keys(e.params).length;let u;if(1===n&&i+s>0){const{rawPath:o,def:n}=e.leaves[0];u=_(o,n,r,t)}else{u={};for(const{rawPath:o,def:n}of e.leaves)u[k(o.split("/").pop().replace(/^:/,""))]=_(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let i=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),i=o)}void 0===u[t]?u[t]=i:"function"==typeof u[t]?Object.assign(u[t],i):"function"==typeof i?(Object.assign(i,u[t]),u[t]=i):Object.assign(u[t],i)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const i=o(n,{...r,[t]:e});if(i&&"object"==typeof i&&1===Object.keys(i).length&&t in i&&"function"==typeof i[t]){const e=i[t],o=(...t)=>e(...t);return Object.assign(o,e)}return i};if(u[t]){const o=u[t];u[t]=t=>({...o(t),...e(t)})}else u[t]=e}return u};return o(e,{})}export{b as Chain,m as DEFAULT_REQUEST_TIMEOUT_MS,w as XOXNOClient,R as buildSdk,S as isValidCollectionTicker,v as isValidNftIdentifier};export const BPS=E.UTY;export const DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD=E.fFH;export const LIQUIDATION_BUFFER_BPS=E.RCv;export const RAY=E.Z$K;export const RAY_DECIMALS=E.OAi;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=E.G_M;export const STELLAR_LENDING_TOPICS=E.fAY;export const STELLAR_NETWORKS=E.a_O;export const STELLAR_NETWORK_PASSPHRASE=E.A$9;export const STELLAR_ROUTE_MAX_BYTES=E.XvM;export const SYNTHETIC_EVENT_ORDER_STRIDE=E.gRW;export const StellarAuthPolicyError=E.cJU;export const StellarRouteVerificationError=E.SVM;export const WAD=E.DYS;export const WAD_DECIMALS=E.wFd;export const aggregateAccountRisk=E.wJe;export const annualBorrowRateRay=E.$wP;export const assertStellarAuthEntries=E.eBc;export const assertStellarPreparedTxAuth=E.JtG;export const baseToRay=E.Vhx;export const baseToShort=E.xEs;export const baseValueWad=E.t$R;export const buildLiveSnapshot=E.pU3;export const buildSameTokenRepaySwapSteps=E.VZJ;export const buildStellarAcceptOwnershipTx=E.N0v;export const buildStellarAddRewardsTx=E.B_D;export const buildStellarApproveBlendPoolTx=E.qLM;export const buildStellarApproveTokenTx=E.eX8;export const buildStellarBatchSwapTx=E.zaA;export const buildStellarBorrowBatchTx=E.xDR;export const buildStellarBorrowTx=E.jR0;export const buildStellarCctpForwardTx=E.P2l;export const buildStellarClaimRevenueTx=E.W68;export const buildStellarCreateLiquidityPoolTx=E.sec;export const buildStellarExecuteCancellerResetTx=E.ZPB;export const buildStellarExecuteStrategyTx=E.yrp;export const buildStellarFlashLoanTx=E.spi;export const buildStellarGovernanceAddSpokeImmediateTx=E.Iu1;export const buildStellarGovernanceCreateHubImmediateTx=E.yuB;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=E.$96;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=E.zwJ;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=E.h_A;export const buildStellarGovernanceExecuteTransferGovOwnTx=E.e_X;export const buildStellarGovernanceExecuteTx=E.TkG;export const buildStellarGovernanceExecuteUpdateDelayTx=E.BAg;export const buildStellarGovernancePauseTx=E.u9S;export const buildStellarGovernanceRevokeRoleImmediateTx=E.biU;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=E.gc5;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=E.ayx;export const buildStellarGrantRoleTx=E.SXg;export const buildStellarLendingIdentifier=E.UFY;export const buildStellarLiquidateTx=E.Y5o;export const buildStellarMigrateFromBlendTx=E.mEH;export const buildStellarMigrateTx=E.xGW;export const buildStellarMultiplyTx=E.s9Q;export const buildStellarPauseTx=E.OL0;export const buildStellarProposeAddAssetToSpokeTx=E.k6p;export const buildStellarProposeAddSpokeTx=E.djE;export const buildStellarProposeApproveBlendPoolTx=E.kDJ;export const buildStellarProposeApproveTokenTx=E.Yfw;export const buildStellarProposeCancellerResetTx=E.AI1;export const buildStellarProposeConfigureAssetOracleTx=E.O2U;export const buildStellarProposeConfigureMarketOracleTx=E.c5J;export const buildStellarProposeCreateHubTx=E.N8y;export const buildStellarProposeCreateLiquidityPoolTx=E.qUh;export const buildStellarProposeDeployPoolTx=E.RZj;export const buildStellarProposeEditAssetInSpokeTx=E.nio;export const buildStellarProposeEditOracleToleranceTx=E.hFg;export const buildStellarProposeGovernanceUpgradeTx=E.Qkp;export const buildStellarProposeGrantGovernanceRoleTx=E.GwL;export const buildStellarProposeMigrateControllerTx=E.$Kr;export const buildStellarProposeRemoveAssetFromSpokeTx=E.ujH;export const buildStellarProposeRemoveSpokeTx=E.Odj;export const buildStellarProposeRevokeBlendPoolTx=E.X7c;export const buildStellarProposeRevokeGovernanceRoleTx=E.Ubz;export const buildStellarProposeRevokeTokenTx=E.Dx4;export const buildStellarProposeSetAccumulatorTx=E.OAr;export const buildStellarProposeSetAggregatorTx=E.$Uh;export const buildStellarProposeSetMinBorrowCollatTx=E.obN;export const buildStellarProposeSetPositionLimitsTx=E.$lZ;export const buildStellarProposeSetPositionManagerTx=E.Kaw;export const buildStellarProposeSetPriceAggregatorTx=E.Wbk;export const buildStellarProposeSetSpokeLiquidationCurveTx=E.kwV;export const buildStellarProposeSetSwapAggregatorTx=E.qAI;export const buildStellarProposeTransferCtrlOwnershipTx=E.VSx;export const buildStellarProposeTransferGovOwnTx=E.HPG;export const buildStellarProposeUnpauseTx=E.xQk;export const buildStellarProposeUpdateDelayTx=E.YQw;export const buildStellarProposeUpgradeControllerTx=E.QY;export const buildStellarProposeUpgradePoolParamsTx=E.osR;export const buildStellarProposeUpgradePoolTx=E.Kob;export const buildStellarRenewAccountTx=E.IJt;export const buildStellarRepayBatchTx=E.nw5;export const buildStellarRepayDebtWithCollateralTx=E.PrA;export const buildStellarRepayTx=E.ZEf;export const buildStellarRevokeBlendPoolTx=E.X0W;export const buildStellarRevokeRoleTx=E.evz;export const buildStellarRevokeTokenTx=E.P8C;export const buildStellarSetAccumulatorTx=E.aVn;export const buildStellarSetAggregatorTx=E.p2b;export const buildStellarSetMarketOracleConfigTx=E.sVY;export const buildStellarSetOracleSanityBoundsTx=E.XDq;export const buildStellarSetOracleToleranceTx=E.Jsu;export const buildStellarSetOracleTx=E.W5;export const buildStellarSetPositionLimitsTx=E.Dyw;export const buildStellarSetPriceAggregatorTx=E._i2;export const buildStellarSetSpokeAssetFlagsTx=E.FZg;export const buildStellarSetSwapAggregatorTx=E.wGh;export const buildStellarSupplyBatchTx=E.Nix;export const buildStellarSupplyTx=E.v_o;export const buildStellarSwapCollateralTx=E.qDU;export const buildStellarSwapDebtTx=E.qRb;export const buildStellarTransferOwnershipTx=E.QJY;export const buildStellarUnpauseTx=E.bmW;export const buildStellarUpdateAccountThresholdTx=E.n_N;export const buildStellarUpdateIndexesTx=E.v87;export const buildStellarUpgradeControllerTx=E.qMI;export const buildStellarUpgradeLiquidityPoolParamsTx=E.gHX;export const buildStellarWithdrawBatchTx=E.O3p;export const buildStellarWithdrawTx=E.Gzh;export const buildTx=E.prJ;export const burnShares=E.moD;export const computeAccountRisk=E.y5S;export const decodeStellarLendingEvent=E.Fmy;export const decodeStellarLiquidateReturn=E.OBV;export const decodeStellarRouteBytes=E.aku;export const depositRateRay=E.HFl;export const divByIntHalfUp=E.cCk;export const encodeAssetOracle=E.Ft;export const encodeInterestRateModel=E.MB4;export const encodeMarketOracleConfigInput=E.Dnk;export const encodeMarketParamsRaw=E.pqp;export const encodePositionLimits=E.Q3w;export const encodePriceKey=E.Jh3;export const encodeStrategyPayloadToRouteXdr=E.wfs;export const extractEventOrder=E.UmN;export const getStellarAccountPositions=E.xO7;export const getStellarActiveUsersSeries=E.R11;export const getStellarAggregatorQuote=E.LwT;export const getStellarAsset=E.mMz;export const getStellarAssetGraph=E.iES;export const getStellarAssetMarkets=E.zpK;export const getStellarAssetPage=E.N3x;export const getStellarAssets=E.bNp;export const getStellarCampaignLeaderboard=E.T3v;export const getStellarCampaignMe=E.KQV;export const getStellarDefiLlamaDimensions=E.S9l;export const getStellarDeployment=E.rER;export const getStellarDetailedMarkets=E.XNg;export const getStellarFeeRevenueSeries=E.VeU;export const getStellarGovernanceProposals=E.T_r;export const getStellarHolderDistribution=E.m4Y;export const getStellarHub=E.XIn;export const getStellarHubGraph=E.Lt0;export const getStellarHubHolders=E.wsx;export const getStellarHubs=E.KKL;export const getStellarLendingContext=E.yl$;export const getStellarLendingLiveState=E.kqD;export const getStellarLiquidationsLeaderboard=E.dEm;export const getStellarLiquidationsSeries=E.bu4;export const getStellarParticipantCounts=E.ftY;export const getStellarPnlByScope=E.Ht0;export const getStellarPositionsLeaderboard=E.$uf;export const getStellarPositionsPnl=E.wqt;export const getStellarQuoteTokens=E.CHU;export const getStellarRateSpreadSeries=E.Wc$;export const getStellarReserve=E.Y5D;export const getStellarReserveGraph=E.KGs;export const getStellarReserveHolders=E.nWw;export const getStellarReserves=E.jFb;export const getStellarRevenueSeries=E.Pvd;export const getStellarSpoke=E.S2b;export const getStellarSpokeGraph=E.uSb;export const getStellarSpokeHolders=E.N9t;export const getStellarSpokes=E.bNM;export const getStellarStatsHistory=E.PvK;export const getStellarUserActivity=E.O5u;export const getStellarUserActivityPage=E.NYX;export const getStellarUserHistory=E.FCB;export const getStellarUserPositions=E.h_O;export const getStellarVolumeSeries=E.zu2;export const getStellarWalletBalance=E.Xix;export const liveIndexKey=E.C88;export const mapQuoteResponseToAggregatorSwap=E.LAw;export const mapQuoteResponseToStrategyPayload=E.E6J;export const mapQuoteResponseToStrategySwap=E.Dsj;export const mapSorobanError=E.XVZ;export const mapStellarPositionActivityType=E.CUR;export const maxBorrow=E.Kye;export const maxRepay=E.Q6F;export const maxSupply=E.SFb;export const maxWithdraw=E.tT6;export const mintShares=E.fBQ;export const mulDivCeil=E.LRi;export const mulDivFloor=E.M0l;export const mulDivHalfUp=E.sfH;export const numberToScaled=E.NFG;export const numberToWad=E.DGs;export const positionValueWad=E.BqG;export const prepareStellarBuiltTx=E.VxL;export const prepareStellarTxXdr=E.DLQ;export const projectAccountRisk=E.mbb;export const projectReserveApy=E.AuU;export const rayAprToApy=E.vCP;export const rayAprToNumber=E.w74;export const rayToNumber=E.JRY;export const rescaleCeil=E.BV_;export const rescaleFloor=E.ApP;export const rescaleHalfUp=E.Ei0;export const reserveKey=E.kQ9;export const resolveReserve=E.vp8;export const stellarAuthPolicyForInvocation=E.$y9;export const stellarLendingDispatchKey=E.ONb;export const stellarLendingRead=E.HhT;export const stellarNetworks=E.PF2;export const stellarTokenContractId=E.oze;export const syntheticEventOrder=E.oVm;export const tagStellarInvokedContractError=E.g57;export const toBase64Xdr=E.LaM;export const toBigInt=E.DgJ;export const toStellarPositionMode=E.Vuj;export const unscale=E.Ou3;export const unscaleBorrowCeil=E.kRY;export const unscaleHalfUp=E.W_e;export const unscaleSupplyFloor=E.Let;export const utilizationRay=E.TXb;export const valueBasePosition=E.shl;export const valueScaledPosition=E.TqQ;export const verifyStellarRouteBytes=E.BKn;export const wadToNumber=E.rWM;