@xoxno/sdk-js 1.0.216 → 1.0.218
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk/stellar/__tests__/math/account.test.d.ts +10 -0
- package/dist/cjs/sdk/stellar/__tests__/math/parity.test.d.ts +14 -0
- package/dist/cjs/sdk/stellar/__tests__/math/scaled-rates.test.d.ts +6 -0
- package/dist/cjs/sdk/stellar/index.d.ts +1 -0
- package/dist/cjs/sdk/stellar/math/account.d.ts +183 -0
- package/dist/cjs/sdk/stellar/math/index.d.ts +12 -0
- package/dist/cjs/sdk/stellar/math/limits.d.ts +80 -0
- package/dist/cjs/sdk/stellar/math/projection.d.ts +53 -0
- package/dist/cjs/sdk/stellar/math/rates.d.ts +34 -0
- package/dist/cjs/sdk/stellar/math/scaled.d.ts +99 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/__tests__/math/account.test.d.ts +10 -0
- package/dist/sdk/stellar/__tests__/math/parity.test.d.ts +14 -0
- package/dist/sdk/stellar/__tests__/math/scaled-rates.test.d.ts +6 -0
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.d.ts +1 -0
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/math/account.d.ts +183 -0
- package/dist/sdk/stellar/math/index.d.ts +12 -0
- package/dist/sdk/stellar/math/limits.d.ts +80 -0
- package/dist/sdk/stellar/math/projection.d.ts +53 -0
- package/dist/sdk/stellar/math/rates.d.ts +34 -0
- package/dist/sdk/stellar/math/scaled.d.ts +99 -0
- 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,BASE_FEE as r,Contract as o,ScInt as n,TransactionBuilder as i,scValToNative as s,xdr as u}from"@stellar/stellar-sdk";var a={526(t,e){e.byteLength=function(t){var e=u(t),r=e[0],o=e[1];return 3*(r+o)/4-o},e.toByteArray=function(t){var e,r,i=u(t),s=i[0],a=i[1],l=new n(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),p=0,c=a>0?s-4:s;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)],l[p++]=e>>16&255,l[p++]=e>>8&255,l[p++]=255&e;return 2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,l[p++]=255&e),1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,l[p++]=e>>8&255,l[p++]=255&e),l},e.fromByteArray=function(t){for(var e,o=t.length,n=o%3,i=[],s=16383,u=0,l=o-n;u<l;u+=s)i.push(a(t,u,u+s>l?l:u+s));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+/",s=0;s<64;++s)r[s]=i[s],o[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 r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t,e,o){for(var n,i,s=[],u=e;u<o;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.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 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,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 l(t,e,r)}function l(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=u(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=u(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||K(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,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 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),r=u(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>=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)||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 G(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 R(this,e,r);case"utf8":case"utf-8":return I(this,e,r);case"ascii":return _(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(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),K(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,s=1,u=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;s=2,u/=2,a/=2,r/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){let o=-1;for(i=r;i<u;i++)if(l(t,i)===l(e,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===a)return o*s}else-1!==o&&(i-=i-o),o=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){let r=!0;for(let o=0;o<a;o++)if(l(t,i+o)!==l(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 s;for(o>i/2&&(o=i/2),s=0;s<o;++s){const o=parseInt(e.substr(2*s,2),16);if(K(o))return s;t[r+s]=o}return s}function x(t,e,r,o){return X(j(e,t.length-r),t,r,o)}function v(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 A(t,e,r,o){return X(G(e),t,r,o)}function q(t,e,r,o){return X(function(t,e){let r,o,n;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(e,t.length-r),t,r,o)}function T(t,e,r){return 0===e&&r===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(e,r))}function I(t,e,r){r=Math.min(t.length,r);const o=[];let n=e;for(;n<r;){const e=t[n];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(n+s<=r){let r,o,u,a;switch(s){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],u=t[n+3],128==(192&r)&&128==(192&o)&&128==(192&u)&&(a=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&u,a>65535&&a<1114112&&(i=a))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=s}return function(t){const e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);let r="",o=0;for(;o<e;)r+=String.fromCharCode.apply(String,t.slice(o,o+=B));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 l(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 p(t),t<=0?u(t):void 0!==e?"string"==typeof r?u(t).fill(e,r):u(t).fill(e):u(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?I(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),s=(r>>>=0)-(e>>>=0);const u=Math.min(i,s),l=this.slice(o,n),p=t.slice(e,r);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,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 x(this,t,e,r);case"ascii":case"latin1":case"binary":return v(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(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 B=4096;function _(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 k(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 R(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+=J[t[o]];return n}function E(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 P(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 U(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 M(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 s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function O(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 s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,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 L(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||P(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||P(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||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],r=this[t+7];void 0!==e&&void 0!==r||H(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=Z((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(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||P(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||P(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||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 r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||P(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||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],r=this[t+7];void 0!==e&&void 0!==r||H(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=Z((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||H(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||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,r,o){t=+t,e>>>=0,r>>>=0,o||U(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||U(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||U(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||U(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||U(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||U(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||U(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 O(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);U(this,t,e,r,o-1,-o)}let n=0,i=1,s=0;for(this[e]=255&t;++n<r&&(i*=256);)t<0&&0===s&&0!==this[e+n-1]&&(s=1),this[e+n]=(t/i|0)-s&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);U(this,t,e,r,o-1,-o)}let n=r-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+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||U(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||U(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||U(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||U(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||U(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 O(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 L(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return L(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),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=i[n%s]}return this};const W={};function D(t,e,r){W[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 N(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 W.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||H(e,t.length-(r+1))}(o,n,i)}function z(t,e){if("number"!=typeof t)throw new W.ERR_INVALID_ARG_TYPE(e,"number",t)}function H(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new W.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.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=N(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=N(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 s=0;s<o;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+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 G(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 K(t){return t!=t}const J=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 Z(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,s,u=8*n-o-1,a=(1<<u)-1,l=a>>1,p=-7,c=r?n-1:0,d=r?-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+=o;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,o),i-=l}return(f?-1:1)*s*Math.pow(2,i-o)},e.write=function(t,e,r,o,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=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?(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[r+f]=255&u,f+=h,u/=256,n-=8);for(s=s<<n|u,l+=n;l>0;t[r+f]=255&s,f+=h,s/=256,l-=8);t[r+f-h]|=128*y}},428(a,l,p){p.d(l,{UTY:()=>Uo,fFH:()=>fn,RCv:()=>En,Z$K:()=>Eo,OAi:()=>Mo,G_M:()=>De,fAY:()=>so,a_O:()=>c,A$9:()=>h,gRW:()=>ao,DYS:()=>Po,wFd:()=>Oo,wJe:()=>kn,$wP:()=>ln,Vhx:()=>Jo,xEs:()=>rn,t$R:()=>Qo,pU3:()=>wn,VZJ:()=>_o,N0v:()=>be,B_D:()=>Le,qLM:()=>qe,eX8:()=>Ie,zaA:()=>wo,xDR:()=>j,jR0:()=>G,P2l:()=>Ro,W68:()=>$e,sec:()=>Oe,ZPB:()=>Cr,yrp:()=>bo,spi:()=>tt,Iu1:()=>Dr,yuB:()=>Wr,$96:()=>kr,zwJ:()=>Er,h_A:()=>Pr,e_X:()=>Ur,TkG:()=>_r,BAg:()=>Rr,u9S:()=>Fr,biU:()=>Nr,gc5:()=>Lr,ayx:()=>$r,SXg:()=>ye,UFY:()=>lo,Y5o:()=>Z,mEH:()=>et,xGW:()=>de,s9Q:()=>rt,OL0:()=>fe,k6p:()=>or,djE:()=>er,kDJ:()=>cr,Yfw:()=>lr,AI1:()=>Or,O2U:()=>Sr,c5J:()=>xr,N8y:()=>tr,qUh:()=>fr,RZj:()=>yr,nio:()=>nr,hFg:()=>vr,Qkp:()=>Ar,GwL:()=>Tr,$Kr:()=>br,ujH:()=>ir,Odj:()=>rr,X7c:()=>dr,Ubz:()=>Ir,Dx4:()=>pr,OAr:()=>Ze,$Uh:()=>Je,obN:()=>ar,$lZ:()=>Qe,Kaw:()=>ur,Wbk:()=>Ke,kwV:()=>sr,qAI:()=>Ye,VSx:()=>wr,HPG:()=>Br,xQk:()=>zr,YQw:()=>qr,QY:()=>mr,osR:()=>hr,Kob:()=>gr,IJt:()=>Me,nw5:()=>K,PrA:()=>it,ZEf:()=>J,X0W:()=>Te,evz:()=>ge,P8C:()=>Be,aVn:()=>ve,p2b:()=>xe,sVY:()=>ke,XDq:()=>Pe,Jsu:()=>Re,W5:()=>_e,Dyw:()=>Ae,_i2:()=>Se,FZg:()=>Ee,wGh:()=>we,Nix:()=>H,v_o:()=>V,qDU:()=>nt,qRb:()=>ot,QJY:()=>me,bmW:()=>he,n_N:()=>We,v87:()=>Ue,qMI:()=>ce,gHX:()=>Ce,O3p:()=>X,Gzh:()=>Y,prJ:()=>F,moD:()=>qn,y5S:()=>Rn,Fmy:()=>uo,OBV:()=>Q,HFl:()=>pn,cCk:()=>Do,Ft:()=>le,MB4:()=>Zt,Dnk:()=>pe,pqp:()=>Qt,Q3w:()=>te,Jh3:()=>ee,wfs:()=>mo,UmN:()=>po,xO7:()=>St,R11:()=>Ht,LwT:()=>yo,mMz:()=>gt,iES:()=>Bt,zpK:()=>At,N3x:()=>vt,bNp:()=>ct,T3v:()=>Lt,KQV:()=>Kt,S9l:()=>jt,rER:()=>f,XNg:()=>pt,VeU:()=>Nt,T_r:()=>Ut,m4Y:()=>$t,XIn:()=>mt,Lt0:()=>_t,wsx:()=>Tt,KKL:()=>dt,yl$:()=>at,kqD:()=>lt,dEm:()=>Ct,bu4:()=>Ft,ftY:()=>Ot,Ht0:()=>Yt,$uf:()=>Mt,wqt:()=>Xt,CHU:()=>go,Wc$:()=>Vt,Y5D:()=>yt,KGs:()=>Rt,nWw:()=>qt,jFb:()=>ht,Pvd:()=>Dt,S2b:()=>bt,uSb:()=>kt,N9t:()=>It,bNM:()=>ft,PvK:()=>Wt,O5u:()=>Et,NYX:()=>Pt,FCB:()=>Gt,h_O:()=>wt,zu2:()=>zt,Xix:()=>xt,C88:()=>bn,LAw:()=>vo,E6J:()=>So,Dsj:()=>xo,XVZ:()=>Kn,CUR:()=>fo,Kye:()=>Dn,Q6F:()=>zn,SFb:()=>Fn,tT6:()=>Nn,fBQ:()=>An,LRi:()=>Lo,M0l:()=>$o,sfH:()=>Wo,NFG:()=>on,DGs:()=>nn,BqG:()=>Zo,VxL:()=>Io,DLQ:()=>To,mbb:()=>jn,AuU:()=>Xn,vCP:()=>dn,w74:()=>cn,JRY:()=>en,BV_:()=>zo,ApP:()=>Fo,Ei0:()=>Ho,kQ9:()=>hn,vp8:()=>yn,ONb:()=>jr,HhT:()=>Jt,PF2:()=>d,oVm:()=>co,g57:()=>qo,LaM:()=>Hr,DgJ:()=>Co,Vuj:()=>Bo,Ou3:()=>Go,kRY:()=>Yo,W_e:()=>Ko,Let:()=>Xo,TXb:()=>an,shl:()=>Tn,TqQ:()=>vn,rWM:()=>tn});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=p(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(),x=t=>u.ScVal.scvU32(t),v=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()},A=t=>u.ScVal.scvBool(t),q=t=>u.ScVal.scvString(t),T=t=>u.ScVal.scvSymbol(t),I=()=>u.ScVal.scvVoid(),B=t=>u.ScVal.scvVec(t),_=(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 u.ScVal.scvBytes(o)},k=(t,e)=>null==t?I():e(t),R=(t,e)=>M({asset:w(e),hub_id:x(t)}),E=(t,e,r)=>u.ScVal.scvVec([R(t,e),S(r)]),P=t=>u.ScVal.scvVec(t.map((t=>E(t.hubId,t.asset,t.amount)))),U=t=>{if("Transfer"===t)return B([T("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 B([T("Credit"),v(e)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(t)}`)},M=t=>{const e=Object.keys(t).sort().map((e=>new u.ScMapEntry({key:T(e),val:t[e]})));return u.ScVal.scvMap(e)};class O{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 s=i===b;let u=b;n.forEach(((t,o)=>{r[t]=!0;const i=e[t];let a;if(o+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*b/u);u-=Math.min(i.splitPpm,u),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 O(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,[s,u]=t.preSwapFromA?[n,i]:[i,n];e.emit(m.Aquarius,2+e.amount(r),e.asset(t.mintPool),e.asset(s),e.asset(u))}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 M({amounts:u.ScVal.scvVec(e.amountList.map((t=>S(t)))),assets:u.ScVal.scvVec(e.assetList.map((t=>w(t)))),ops:u.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 u.ScVal.scvBytes(e)},L=()=>u.ScVal.scvBytes(y.hp.alloc(0)),W=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 $(W(t));if(t instanceof Uint8Array)return 0===t.length?L():$(t);if(t&&"object"==typeof t)return"routeXdr"in(r=t)&&"string"==typeof r.routeXdr?$(W(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?$(W(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?$(W(t.bytes)):0===t.bytes.length?L():$(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),u.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)")},N=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,r=y.hp.from(e,"hex");return u.ScVal.scvBytes(r)})(t);if(t instanceof Uint8Array)return u.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,s){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const u=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(u.call(n,...s)).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 x(t)}function H(t,e){const r=e.accountNonce??0;return F(t,"supply",[w(t.caller),v(r),z(e.spokeId),P([...e.assets])])}function V(t,e){return H(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),v(e.accountNonce),P([...e.borrows]),k(e.to,w)])}function G(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),v(e.accountNonce),P([...e.withdrawals]),k(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 K(t,e){return F(t,"repay",[w(t.caller),v(e.accountNonce),P([...e.payments])])}function J(t,e){return K(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function Z(t,e){return F(t,"liquidate",[w(t.caller),v(e.accountNonce),P([...e.debtPayments]),U(e.seizeMode??"Transfer")])}function Q(t){const e=s(u.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),R(e.hubId,e.asset),S(e.amount),w(e.receiver),N(e.data)])}function et(t,e){return F(t,"migrate_from_blend",[w(t.caller),v(e.accountId),z(e.spokeId),x(e.hubId),w(e.blendPool),B(e.collateralTokens.map(w)),B(e.supplyTokens.map(w)),(r=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),u.ScVal.scvVec(r.map((t=>{return e=t.token,r=t.amount,u.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),v(r),z(e.spokeId),R(e.collateral.hubId,e.collateral.asset),S(e.debtToFlashLoan),R(e.debt.hubId,e.debt.asset),x(e.mode),D(e.steps),k(e.initialPayment,(t=>E(t.hubId,t.asset,t.amount))),k(e.convertSwap,D)])}function ot(t,e){return F(t,"swap_debt",[w(t.caller),v(e.accountNonce),R(e.existingDebt.hubId,e.existingDebt.asset),S(e.newDebtAmount),R(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function nt(t,e){return F(t,"swap_collateral",[w(t.caller),v(e.accountNonce),R(e.current.hubId,e.current.asset),S(e.fromAmount),R(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function it(t,e){return F(t,"repay_debt_with_collateral",[w(t.caller),v(e.accountNonce),R(e.collateral.hubId,e.collateral.asset),S(e.collateralAmount),R(e.debt.hubId,e.debt.asset),D(e.steps),A(e.closePosition)])}const st="/stellar-lending",ut=encodeURIComponent,at=(t,e)=>t.fetchWithTimeout(`${st}/context`,e),lt=(t,e)=>t.fetchWithTimeout(`${st}/live-state`,e),pt=(t,e)=>t.fetchWithTimeout(`${st}/markets/detailed`,e),ct=(t,e)=>t.fetchWithTimeout(`${st}/assets`,e),dt=(t,e)=>t.fetchWithTimeout(`${st}/hubs`,e),ft=(t,e)=>t.fetchWithTimeout(`${st}/spokes`,e),ht=(t,e={},r)=>t.fetchWithTimeout(`${st}/reserves`,{...r,params:{...e}}),yt=(t,e,r,o,n)=>t.fetchWithTimeout(`${st}/reserves/${e}/${r}/${ut(o)}`,n),gt=(t,e,r)=>t.fetchWithTimeout(`${st}/assets/${ut(e)}`,r),mt=(t,e,r)=>t.fetchWithTimeout(`${st}/hubs/${e}`,r),bt=(t,e,r)=>t.fetchWithTimeout(`${st}/spokes/${e}`,r),wt=(t,e,r)=>t.fetchWithTimeout(`${st}/users/${ut(e)}/positions`,r),St=(t,e,r)=>t.fetchWithTimeout(`${st}/accounts/${ut(e)}/positions`,r),xt=(t,e,r,o)=>t.fetchWithTimeout(`${st}/users/${ut(e)}/assets/${ut(r)}/balance`,o),vt=(t,e,r,o)=>t.fetchWithTimeout(`${st}/assets/${ut(e)}/page`,{...o,params:{...r}}),At=(t,e,r,o)=>t.fetchWithTimeout(`${st}/assets/${ut(e)}/markets`,{...o,params:{side:r}}),qt=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${st}/reserves/${e}/${r}/${ut(o)}/holders`,{...i,params:{side:n}}),Tt=(t,e,r,o)=>t.fetchWithTimeout(`${st}/hubs/${e}/holders`,{...o,params:{side:r}}),It=(t,e,r,o)=>t.fetchWithTimeout(`${st}/spokes/${e}/holders`,{...o,params:{side:r}}),Bt=(t,e,r,o)=>t.fetchWithTimeout(`${st}/assets/${ut(e)}/graph`,{...o,params:{...r}}),_t=(t,e,r,o)=>t.fetchWithTimeout(`${st}/hubs/${e}/graph`,{...o,params:{...r}}),kt=(t,e,r,o)=>t.fetchWithTimeout(`${st}/spokes/${e}/graph`,{...o,params:{...r}}),Rt=(t,e,r,o,n,i)=>t.fetchWithTimeout(`${st}/reserves/${e}/${r}/${ut(o)}/graph`,{...i,params:{...n}}),Et=(t,e,r={},o)=>t.fetchWithTimeout(`${st}/users/${ut(e)}/activity`,{...o,params:{...r}}),Pt=(t,e,r={},o)=>t.fetchWithTimeout(`${st}/users/${ut(e)}/activity/page`,{...o,params:{...r}}),Ut=(t,e={},r)=>t.fetchWithTimeout(`${st}/governance/proposals`,{...r,params:{...e}}),Mt=(t,e={},r)=>t.fetchWithTimeout(`${st}/positions`,{...r,params:{...e}}),Ot=(t,e={},r)=>t.fetchWithTimeout(`${st}/participants`,{...r,params:{...e}}),Ct=(t,e={},r)=>t.fetchWithTimeout(`${st}/liquidations/leaderboard`,{...r,params:{...e}}),$t=(t,e={},r)=>t.fetchWithTimeout(`${st}/distribution`,{...r,params:{...e}}),Lt=(t,e={},r)=>t.fetchWithTimeout(`${st}/campaign/leaderboard`,{...r,params:{...e}}),Wt=(t,e,r)=>t.fetchWithTimeout(`${st}/stats/history`,{...r,params:{...e}}),Dt=(t,e,r)=>t.fetchWithTimeout(`${st}/revenue`,{...r,params:{...e}}),Nt=(t,e,r)=>t.fetchWithTimeout(`${st}/revenue/fees`,{...r,params:{...e}}),Ft=(t,e,r)=>t.fetchWithTimeout(`${st}/liquidations`,{...r,params:{...e}}),zt=(t,e,r)=>t.fetchWithTimeout(`${st}/volume`,{...r,params:{...e}}),Ht=(t,e,r)=>t.fetchWithTimeout(`${st}/active-users`,{...r,params:{...e}}),Vt=(t,e,r)=>t.fetchWithTimeout(`${st}/rate-spread`,{...r,params:{...e}}),jt=(t,e,r)=>t.fetchWithTimeout(`${st}/defillama`,{...r,params:{...e}}),Gt=(t,e,r,o)=>t.fetchWithTimeout(`${st}/users/${ut(e)}/history`,{...o,params:{...r}}),Xt=(t,e,r)=>t.fetchWithTimeout(`${st}/pnl`,{...r,params:{accountId:e}}),Yt=(t,e,r)=>t.fetchWithTimeout(`${st}/pnl/scope`,{...r,params:{scope:e}}),Kt=(t,e,r)=>t.fetchWithTimeout(`${st}/campaign/me`,{...r,params:{owner:e}}),Jt=t=>({context:e=>at(t,e),liveState:e=>lt(t,e),marketsDetailed:e=>pt(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)=>xt(t,e,r,o),assetPage:(e,r,o)=>vt(t,e,r,o),assetMarkets:(e,r,o)=>At(t,e,r,o),reserveHolders:(e,r,o,n,i)=>qt(t,e,r,o,n,i),hubHolders:(e,r,o)=>Tt(t,e,r,o),spokeHolders:(e,r,o)=>It(t,e,r,o),assetGraph:(e,r,o)=>Bt(t,e,r,o),hubGraph:(e,r,o)=>_t(t,e,r,o),spokeGraph:(e,r,o)=>kt(t,e,r,o),reserveGraph:(e,r,o,n,i)=>Rt(t,e,r,o,n,i),userActivity:(e,r={},o)=>Et(t,e,r,o),userActivityPage:(e,r={},o)=>Pt(t,e,r,o),governanceProposals:(e={},r)=>Ut(t,e,r),positionsLeaderboard:(e={},r)=>Mt(t,e,r),participants:(e={},r)=>Ot(t,e,r),liquidationsLeaderboard:(e={},r)=>Ct(t,e,r),distribution:(e={},r)=>$t(t,e,r),campaignLeaderboard:(e={},r)=>Lt(t,e,r),statsHistory:(e,r)=>Wt(t,e,r),revenue:(e,r)=>Dt(t,e,r),feeRevenue:(e,r)=>Nt(t,e,r),liquidations:(e,r)=>Ft(t,e,r),volume:(e,r)=>zt(t,e,r),activeUsers:(e,r)=>Ht(t,e,r),rateSpread:(e,r)=>Vt(t,e,r),defillama:(e,r)=>jt(t,e,r),userHistory:(e,r,o)=>Gt(t,e,r,o),positionsPnl:(e,r)=>Xt(t,e,r),pnlByScope:(e,r)=>Yt(t,e,r),campaignMe:(e,r)=>Kt(t,e,r)}),Zt=t=>M({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:x(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),Qt=t=>M({asset_decimals:x(t.assetDecimals),asset_id:w(t.assetId),base_borrow_rate:S(t.baseBorrowRateRay),flashloan_fee:x(t.flashloanFeeBps),is_flashloanable:A(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:x(t.reserveFactorBps),slope1:S(t.slope1Ray),slope2:S(t.slope2Ray),slope3:S(t.slope3Ray)}),te=t=>M({max_borrow_positions:x(t.maxBorrowPositions),max_supply_positions:x(t.maxSupplyPositions)}),ee=t=>{if("Token"in t&&t.Token)return B([T("Token"),w(t.Token)]);if("Ref"in t&&t.Ref)return B([T("Ref"),T(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},re=t=>{if("Stellar"in t)return B([T("Stellar"),w(t.Stellar)]);if("Symbol"in t)return B([T("Symbol"),T(t.Symbol)]);if("String"in t)return B([T("String"),q(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},oe=t=>{if("Spot"===t)return B([T("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return B([T("Twap"),x(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},ne=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return B([T(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},ie=t=>{if("Market"===t||"Fundamental"===t)return B([T(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},se=t=>{if("Reflector"in t){const e=t.Reflector;return B([T("Reflector"),M({asset:re(e.asset),contract:w(e.contract),read_mode:oe(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return B([T("MultiFeed"),M({contract:w(e.contract),feed_id:q(e.feedId),kind:ne(e.kind),nature:ie(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},ue=t=>{const e=t;return M({decimals:x(e.decimals),max_stale_seconds:v(e.maxStaleSeconds),provider:se(e.provider)})},ae=t=>{if("RequireDisjoint"===t)return B([T("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return B([T("AllowShared"),B(e.map((t=>M({contract:w(t.contract),kind:ne(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},le=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 M({asset_decimals:x(Number(e.assetDecimals)),independence:ae(e.independence),max_price_stale_seconds:v(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:S(String(e.maxSanityPriceWad)),min_sanity_price_wad:S(String(e.minSanityPriceWad)),sources:B(r.map((t=>(t=>{if("Feed"in t)return B([T("Feed"),ue(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return B([T("Scaled"),M({factor:ue(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 B([T("LpShare"),M({key_a:ee(e.keyA),key_b:ee(e.keyB),kind:B([T(e.kind||"ConstantProduct")]),pool:w(e.pool),reserve_a_decimals:x(e.reserveADecimals),reserve_b_decimals:x(e.reserveBDecimals),share_decimals:x(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:M({lower_ratio_bps:x(n),upper_ratio_bps:x(o)})})},pe=le;function ce(t,e){return F(t,"upgrade",[_(e.wasmHash)])}function de(t,e){return F(t,"migrate",[x(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),T(e.role)])}function ge(t,e){return F(t,"revoke_role",[w(e.account),T(e.role)])}function me(t,e){return F(t,"transfer_ownership",[w(e.newOwner),x(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 xe=we;function ve(t,e){return F(t,"set_accumulator",[w(e.accumulator)])}function Ae(t,e){return F(t,"set_position_limits",[te(e)])}function qe(t,e){return F(t,"approve_blend_pool",[w(e.pool)])}function Te(t,e){return F(t,"revoke_blend_pool",[w(e.pool)])}const Ie=qe,Be=Te;function _e(t,e){return F(t,"set_oracle",[ee(e.key),le(e.oracle)])}const ke=_e;function Re(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),M({lower_ratio_bps:x(n),upper_ratio_bps:x(o)})])}function Ee(t,e){return F(t,"set_spoke_asset_flags",[x(e.spokeId),R(e.hubId,e.asset),A(e.paused),A(e.frozen),A(e.noSeize)])}function Pe(t,e){return F(t,"set_oracle_sanity_bounds",[w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Ue(t,e){return F(t,"update_indexes",[w(t.caller),B(e.assets.map((t=>R(t.hubId,t.asset))))])}function Me(t,e){return F(t,"renew_account",[w(t.caller),v(e.accountNonce)])}function Oe(t,e){return F(t,"create_liquidity_pool",[x(e.hubId),w(e.asset),Qt(e.params)])}function Ce(t,e){return F(t,"upgrade_liquidity_pool_params",[R(e.hubId,e.asset),Zt(e.params)])}function $e(t,e){return F(t,"claim_revenue",[w(t.caller),B(e.assets.map((t=>R(t.hubId,t.asset))))])}function Le(t,e){return F(t,"add_rewards",[w(t.caller),P(e.rewards)])}function We(t,e){return F(t,"update_account_threshold",[w(t.caller),A(e.hasRisks),B(e.accountNonces.map((t=>v(t))))])}const De="00".repeat(32),Ne=t=>{if("string"==typeof t)return _(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 u.ScVal.scvBytes(e)},Fe=(t,...e)=>B([T(t),...e]),ze=t=>M({new_owner:w(t.newOwner),live_until_ledger:x(t.liveUntilLedger)}),He=t=>M({asset:w(t.asset),bonus:x(t.bonus),borrow_cap:S(t.borrowCap),can_borrow:A(t.canBorrow),can_collateral:A(t.canCollateral),frozen:A(t.frozen),hub_id:x(t.hubId),paused:A(t.paused),liquidation_fees:x(t.liquidationFees),ltv:x(t.ltv),no_seize:A(t.noSeize),spoke_id:x(t.spokeId),supply_cap:S(t.supplyCap),threshold:x(t.threshold)}),Ve=t=>M({account:w(t.account),role:T(t.role)});function je(e,n,s){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const u=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(u.call(n,...s)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Ge=(t,e,r)=>je(t,"propose",[w(t.caller),e,Ne(r)]),Xe=(t,e,r)=>je(t,"execute_self",[I(),e,Ne(r)]);function Ye(t,e,r){return Ge(t,Fe("SetSwapAggregator",w(e.aggregator)),r)}function Ke(t,e,r){return Ge(t,Fe("SetPriceAggregator",w(e.aggregator)),r)}const Je=Ye;function Ze(t,e,r){return Ge(t,Fe("SetAccumulator",w(e.accumulator)),r)}function Qe(t,e,r){return Ge(t,Fe("SetPositionLimits",te(e)),r)}function tr(t,e){return Ge(t,Fe("CreateHub"),e)}function er(t,e){return Ge(t,Fe("AddSpoke"),e)}function rr(t,e,r){return Ge(t,Fe("RemoveSpoke",x(e.spokeId)),r)}function or(t,e,r){return Ge(t,Fe("AddAssetToSpoke",He(e)),r)}function nr(t,e,r){return Ge(t,Fe("EditAssetInSpoke",He(e)),r)}function ir(t,e,r){return Ge(t,Fe("RemoveAssetFromSpoke",M({hub_asset:R((o=e).hubId,o.asset),spoke_id:x(o.spokeId)})),r);var o}function sr(t,e,r){return Ge(t,Fe("SetSpokeLiquidationCurve",M({hf_for_max_bonus_wad:S((o=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:x(o.liquidationBonusFactorBps),spoke_id:x(o.spokeId),target_hf_wad:S(o.targetHfWad)})),r);var o}function ur(t,e,r){return Ge(t,Fe("SetPositionManager",w(e.manager),A(e.isActive)),r)}function ar(t,e,r){return Ge(t,Fe("SetMinBorrowCollateralUsd",S(e.floorWad)),r)}function lr(t,e,r){return Ge(t,Fe("ApproveToken",w(e.token)),r)}function pr(t,e,r){return Ge(t,Fe("RevokeToken",w(e.token)),r)}function cr(t,e,r){return Ge(t,Fe("ApproveBlendPool",w(e.pool)),r)}function dr(t,e,r){return Ge(t,Fe("RevokeBlendPool",w(e.pool)),r)}function fr(t,e,r){return Ge(t,Fe("CreateLiquidityPool",M({asset:w((o=e).asset),hub_id:x(o.hubId),params:Qt(o.params)})),r);var o}function hr(t,e,r){return Ge(t,Fe("UpgradeLiquidityPoolParams",M({hub_asset:R((o=e).hubId,o.asset),params:Zt(o.params)})),r);var o}function yr(t,e,r){return Ge(t,Fe("DeployPool",_(e.wasmHash)),r)}function gr(t,e,r){return Ge(t,Fe("UpgradePool",_(e.wasmHash)),r)}function mr(t,e,r){return Ge(t,Fe("UpgradeController",_(e.wasmHash)),r)}function br(t,e,r){return Ge(t,Fe("MigrateController",x(e.newVersion)),r)}function wr(t,e,r){return Ge(t,Fe("TransferCtrlOwnership",ze(e)),r)}function Sr(t,e,r){return Ge(t,Fe("ConfigureAssetOracle",M({key:ee((o=e).key),oracle:le(o.oracle)})),r);var o}const xr=Sr;function vr(t,e,r){return Ge(t,Fe("EditOracleTolerance",M({key:ee((o=e).key),tolerance:x(o.tolerance)})),r);var o}function Ar(t,e,r){return Ge(t,Fe("UpgradeGov",_(e.wasmHash)),r)}function qr(t,e,r){return Ge(t,Fe("UpdateGovDelay",x(e.newDelay)),r)}function Tr(t,e,r){return Ge(t,Fe("GrantGovRole",Ve(e)),r)}function Ir(t,e,r){return Ge(t,Fe("RevokeGovRole",Ve(e)),r)}function Br(t,e,r){return Ge(t,Fe("TransferGovOwnership",ze(e)),r)}function _r(t,e){const r=B(e.argsXdr.map((t=>u.ScVal.fromXDR(t,"base64")))),o=Ne(e.predecessor??De);return je(t,"execute",[I(),w(e.target),T(e.functionName),r,o,Ne(e.salt)])}function kr(t,e,r){return Xe(t,Fe("UpgradeGov",_(e.wasmHash)),r)}function Rr(t,e,r){return Xe(t,Fe("UpdateGovDelay",x(e.newDelay)),r)}function Er(t,e,r){return Xe(t,Fe("GrantGovRole",Ve(e)),r)}function Pr(t,e,r){return Xe(t,Fe("RevokeGovRole",Ve(e)),r)}function Ur(t,e,r){return Xe(t,Fe("TransferGovOwnership",ze(e)),r)}const Mr=t=>B(t.map(w));function Or(t,e,r){return je(t,"propose_canceller_reset",[Mr(e.newCancellers),Ne(r)])}function Cr(t,e,r){return je(t,"execute_canceller_reset",[k(e.executor,w),Mr(e.newCancellers),Ne(r)])}function $r(t,e){return je(t,"set_spoke_asset_flags",[w(t.caller),x(e.spokeId),R(e.hubId,e.asset),A(e.paused),A(e.frozen),A(e.noSeize)])}function Lr(t,e){return je(t,"set_oracle_sanity_bounds",[w(t.caller),w(e.asset),S(e.minPriceWad),S(e.maxPriceWad)])}function Wr(t){return je(t,"create_hub",[w(t.caller)])}function Dr(t){return je(t,"add_spoke",[w(t.caller)])}function Nr(t,e){return je(t,"revoke_role_immediate",[w(e.account),T(e.role)])}function Fr(t){return je(t,"pause",[w(t.caller)])}function zr(t,e){return Ge(t,Fe("Unpause"),e)}const Hr=t=>t.toXDR("base64"),Vr=t=>u.ScVal.fromXDR(t,"base64"),jr=t=>t.map((t=>String(s(Vr(t))))).join(":"),Gr=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Xr=t=>Number(t),Yr=t=>String(t),Kr=t=>t instanceof Uint8Array?y.hp.from(t).toString("hex"):y.hp.isBuffer(t)?t.toString("hex"):String(t),Jr=["None","Multiply","Long","Short"],Zr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net","liq_credit"],Qr=t=>Array.isArray(t)?t:[],to=(t,e)=>{const r="Borrow"===e;return{action:(o=t[0],Zr[Xr(o)]??Gr(o)),positionType:e,hubId:Xr(t[1]),asset:Yr(t[2]),scaledAmountRay:Gr(t[3]),indexRay:Gr(t[4]),amount:Gr(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],Jr[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:Gr(t.min_sanity_price_wad),maxSanityPriceWad:Gr(t.max_sanity_price_wad)}},io={"market:create":t=>({topic:"market:create",data:{hubId:Xr(t.hub_id),baseAsset:Yr(t.base_asset),maxBorrowRate:Gr(t.max_borrow_rate),baseBorrowRate:Gr(t.base_borrow_rate),slope1:Gr(t.slope1),slope2:Gr(t.slope2),slope3:Gr(t.slope3),midUtilization:Gr(t.mid_utilization),optimalUtilization:Gr(t.optimal_utilization),maxUtilization:Gr(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:Gr(t.max_borrow_rate),baseBorrowRateRay:Gr(t.base_borrow_rate),slope1Ray:Gr(t.slope1),slope2Ray:Gr(t.slope2),slope3Ray:Gr(t.slope3),midUtilizationRay:Gr(t.mid_utilization),optimalUtilizationRay:Gr(t.optimal_utilization),maxUtilizationRay:Gr(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:Gr(e[3]),borrowIndexRay:Gr(e[4]),cash:Gr(e[5]),suppliedRay:Gr(e[6]),borrowedRay:Gr(e[7]),revenueRay:Gr(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:Gr(r.max_borrow_rate),baseBorrowRateRay:Gr(r.base_borrow_rate),slope1Ray:Gr(r.slope1),slope2Ray:Gr(r.slope2),slope3Ray:Gr(r.slope3),midUtilizationRay:Gr(r.mid_utilization),optimalUtilizationRay:Gr(r.optimal_utilization),maxUtilizationRay:Gr(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:Gr(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:Gr(t.amount),fee:Gr(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:Gr(t.account_id),repaidUsdWad:Gr(t.repaid_usd_wad),bonusBps:Gr(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Gr(t.account_id),totalBorrowUsdWad:Gr(t.total_borrow_usd_wad),totalCollateralUsdWad:Gr(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Yr(t.token),amount:Gr(t.amount),usdValueWad:Gr(t.usd_value_wad),accountId:Gr(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Xr(t.hub_id),asset:Yr(t.asset),amount:Gr(t.amount),fee:Gr(t.fee),amountSent:Gr(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:Kr(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:Kr(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:Gr(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:Gr(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Gr(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Xr(e.liquidation_bonus_factor_bps)}}}},so=Object.freeze(Object.keys(io));function uo(t,e){const r=jr(t),o=io[r];return o?o(s(Vr(e))):null}const ao=1e4;function lo(t,e){return`${t}-${BigInt(e).toString(10)}`}function po(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 s=new o(e.routerAddress),u=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(u,{fee:e.fee??r,networkPassphrase:h[e.network]}).addOperation(s.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(Ao),splitPpm:t.splitPpm}))):[{hops:t.hops.map(Ao),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function xo(t,e={}){const r=t;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:So(t,e)}const vo=So,Ao=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function qo(t,e){const r=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${r}`)}async function To(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 qo(r.invokedContractId,t);throw t}}async function Io(t,e,r){return To(t,e.xdr,r)}function Bo(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 _o(t,e){return new Uint8Array(0)}const ko=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 Ro(e){const r=new t(e.caller,e.sourceSequence),n=new o(e.forwarderAddress).call("mint_and_forward",u.ScVal.scvBytes(ko(e.message)),u.ScVal.scvBytes(ko(e.attestation)));return{xdr:new i(r,{fee:e.fee??"10000000",networkPassphrase:h[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Eo=10n**27n,Po=10n**18n,Uo=10000n,Mo=27,Oo=18;function Co(t,e="value"){let r;if("bigint"==typeof t)r=t;else if("number"==typeof t){if(!Number.isSafeInteger(t))throw new Error(`Stellar math: ${e} must be a safe integer, got ${t}`);r=BigInt(t)}else{const o=t.trim();if(!/^-?\d+$/.test(o))throw new Error(`Stellar math: ${e} must be a decimal integer string, got "${t}"`);r=BigInt(o)}if(r<0n)throw new Error(`Stellar math: ${e} must be non-negative, got ${r}`);return r}function $o(t,e,r){if(0n===r)throw new Error("Stellar math: division by zero");return t*e/r}function Lo(t,e,r){if(0n===r)throw new Error("Stellar math: division by zero");const o=t*e,n=o/r;return o%r===0n?n:n+1n}function Wo(t,e,r){if(0n===r)throw new Error("Stellar math: division by zero");return(t*e+r/2n)/r}function Do(t,e){if(0n===e)throw new Error("Stellar math: division by zero");const r=t/e;return t%e>=e/2n+e%2n?r+1n:r}const No=t=>10n**BigInt(t);function Fo(t,e,r){return e===r?t:r>e?t*No(r-e):t/No(e-r)}function zo(t,e,r){if(e===r)return t;if(r>e)return t*No(r-e);const o=No(e-r),n=t/o;return t%o===0n?n:n+1n}function Ho(t,e,r){return e===r?t:r>e?t*No(r-e):Do(t,No(e-r))}const Vo={floor:$o,ceil:Lo,halfUp:Wo},jo={floor:Fo,ceil:zo,halfUp:Ho};function Go(t,e,r,o){return jo[o](Vo[o](t,e,Eo),Mo,r)}function Xo(t,e,r){return Go(Co(t,"scaledRay"),Co(e,"indexRay"),r,"floor")}function Yo(t,e,r){return Go(Co(t,"scaledRay"),Co(e,"indexRay"),r,"ceil")}function Ko(t,e,r){return Go(Co(t,"scaledRay"),Co(e,"indexRay"),r,"halfUp")}function Jo(t,e){if(e>Mo)throw new Error(`Stellar math: decimals ${e} exceed RAY scale`);return Fo(t,e,Mo)}function Zo(t,e,r,o){const n=Vo[o](t,e,Eo),i=jo[o](n,Mo,Oo);return Vo[o](i,r,Po)}function Qo(t,e,r,o){const n=jo[o](Jo(t,e),Mo,Oo);return Vo[o](n,r,Po)}const tn=t=>Number(t)/1e18,en=t=>Number(t)/1e27,rn=(t,e)=>Number(t)/10**e;function on(t,e){if(!Number.isFinite(t)||t<=0||t>=1e21)return 0n;const r=t.toFixed(e),[o="0",n=""]=r.split(".");return BigInt(o+n.padEnd(e,"0"))}const nn=t=>on(t,Oo),sn=(t,e)=>Wo(t,e,Eo),un=(t,e)=>Wo(t,Eo,e);function an(t,e){return 0n===e?0n:un(t,e)}function ln(t,e){const r=t>Eo?Eo:t,o=Co(e.baseRateRay,"irm.baseRateRay"),n=Co(e.slope1Ray,"irm.slope1Ray"),i=Co(e.slope2Ray,"irm.slope2Ray"),s=Co(e.slope3Ray,"irm.slope3Ray"),u=Co(e.midUtilizationRay,"irm.midUtilizationRay"),a=Co(e.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=Co(e.maxBorrowRateRay,"irm.maxBorrowRateRay");let p;if(r<u)p=o+un(sn(r,n),u);else if(r<a){const t=a-u;p=o+n+un(sn(r-u,i),t)}else{const t=Eo-a;p=o+n+i+(0n===t?0n:un(sn(r-a,s),t))}return p>l?l:p}function pn(t,e,r){return 0n===t||!Number.isInteger(r)||r<0||r>=1e4?0n:Wo(sn(t,e),Uo-BigInt(r),Uo)}const cn=t=>en(t),dn=t=>Math.expm1(en(t)),fn=5n*Po,hn=(t,e,r)=>`${t}:${e}:${r}`;function yn(t,e,r,o){const n=Array.isArray(t)?t:void 0,i=n?n.find((t=>t.spokeId===e&&t.hubId===r&&t.asset===o)):t[hn(e,r,o)]??Object.values(t).find((t=>t.spokeId===e&&t.hubId===r&&t.asset===o));if(!i)throw new Error(`Stellar math: no reserve for ${hn(e,r,o)}`);return i}const gn=/^0*[1-9]\d*$/,mn=t=>"string"==typeof t&&gn.test(t)?BigInt(t).toString():null,bn=(t,e)=>`${t}:${e}`;function wn(t){const e=new Map,r=new Map,o=new Set,n=new Set;for(const i of t?.indexes??[]){const t=bn(i.hubId,i.asset),s=mn(i.supplyIndex),u=mn(i.borrowIndex),a=mn(i.usdPrice),l=e.get(t),p=l&&mn(l.supplyIndex)===s&&mn(l.borrowIndex)===u&&mn(l.usdPrice)===a;null==s||null==u||null==a||l&&!p?o.add(t):l||e.set(t,i);const c=!1===i.valid||!0===i.stale||!0===i.deviation,d=r.get(i.asset);null==a||c||void 0!==d&&d.toString()!==a?n.add(i.asset):void 0===d&&r.set(i.asset,BigInt(a))}for(const t of o)e.delete(t);for(const t of n)r.delete(t);return{indexes:e,prices:r,rejectedIndexKeys:o,rejectedAssets:n}}const Sn=(t,e)=>$o(t,BigInt(e),Uo);function xn(t,e,r,o){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:tn(t.priceWad),amountBase:e.toString(),amountShort:rn(e,t.decimals),usdWad:r.toString(),usd:tn(r),gateUsdWad:o.toString(),entryLtvBps:t.entryLtvBps,entryLiquidationThresholdBps:t.entryLiquidationThresholdBps,entryLiquidationBonusBps:t.entryLiquidationBonusBps,entryLiquidationFeesBps:t.entryLiquidationFeesBps,ltvWeightedUsdWad:n?Sn(o,i).toString():"0",liquidationWeightedUsdWad:n?Sn(o,t.entryLiquidationThresholdBps).toString():"0",liveDataUsed:t.liveDataUsed}}function vn(t){if("supply"===t.side)return xn(t,Go(t.scaledRay,t.indexRay,t.decimals,"floor"),Zo(t.scaledRay,t.indexRay,t.priceWad,"halfUp"),Zo(t.scaledRay,t.indexRay,t.priceWad,"floor"));const e=Go(t.scaledRay,t.indexRay,t.decimals,"ceil"),r=Zo(t.scaledRay,t.indexRay,t.priceWad,"ceil");return xn(t,e,r,r)}function An(t,e,r,o){const n=Jo(e,r);return"supply"===t?$o(n,Eo,o):Lo(n,Eo,o)}function qn(t,e,r,o){const n=Jo(e,r);return"supply"===t?Lo(n,Eo,o):$o(n,Eo,o)}function Tn(t,e){return vn({...t,scaledRay:An(t.side,e,t.decimals,t.indexRay)})}const In=(...t)=>{for(const e of t){const t=mn(e);if(null!=t)return BigInt(t)}return Eo};function Bn(t,e,r,o){const n=Co("supply"===t?e.supplyScaledRay:e.borrowScaledRay,`${t}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(bn(e.hubId,e.asset)),s=o.prices.get(e.asset),u="supply"===t?In(i?.supplyIndex,e.liveSupplyIndexRay,r.liveSupplyIndexRay,e.supplyIndexRay):In(i?.borrowIndex,e.liveBorrowIndexRay,r.liveBorrowIndexRay,e.borrowIndexRay),a=s??nn(r.usdPrice);return vn({side:t,hubId:e.hubId,asset:e.asset,decimals:r.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 _n=(t,e)=>t.reduce(((t,r)=>t+BigInt(e(r))),0n);function kn(t,e,r,o,n){const i=_n(e,(t=>t.usdWad)),s=_n(e,(t=>t.ltvWeightedUsdWad)),u=_n(e,(t=>t.liquidationWeightedUsdWad)),a=_n(r,(t=>t.usdWad)),l=0n===a?null:$o(u,Po,a),p=0n===u?0:Number(a)/Number(u)*100,c=s<o||s<=a?0n:s-a;return{...t,supplies:e,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:tn(i),ltvWeightedCollateralUsdWad:s.toString(),ltvWeightedCollateralUsd:tn(s),liquidationWeightedCollateralUsdWad:u.toString(),liquidationWeightedCollateralUsd:tn(u),totalDebtUsdWad:a.toString(),totalDebtUsd:tn(a),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:tn(l),healthPercent:p,borrowLimitUsdWad:s.toString(),borrowLimitUsd:tn(s),availableBorrowUsdWad:c.toString(),availableBorrowUsd:tn(c),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:tn(o),isLiquidatable:null!==l&&l<Po,liveDataValid:n}}function Rn(t){const{positions:e,reserves:r,liveState:o}=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=wn(o),s=[],u=[];for(const t of e){const e=yn(r,t.spokeId,t.hubId,t.asset),o=Bn("supply",t,e,i);o&&s.push(o);const n=Bn("borrow",t,e,i);n&&u.push(n)}const a=null!=o?.minBorrowCollateralUsdWad?Co(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):fn,l=void 0!==o&&[...s,...u].every((t=>t.liveDataUsed));return kn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},s,u,a,l)}const En=200n,Pn=t=>t.reduce(((t,e)=>e.amount<t.amount?e:t)),Un=t=>t<0n?0n:t,Mn=(t,e,r,o)=>({amountBase:t.amount,amountShort:rn(t.amount,e),isFullClose:r,reason:t.reason,projectedUtilization:o}),On=t=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:t,projectedUtilization:null});function Cn(t){const e=t.assetDecimals,r=Co(t.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:on(t.hubPool.suppliedShort,e),borrowedBase:on(t.hubPool.borrowedShort,e),cashBase:on(t.availableLiquidityShort,e),spokeSuppliedBase:on(t.suppliedShort,e),spokeBorrowedBase:on(t.borrowedShort,e),maxUtilizationRay:r>=Eo?null:r}}const $n=(t,e)=>t<=0n?null:Number(e)/Number(t);function Ln(t,e){if(t<=0n||!e(0n))return 0n;let r=0n,o=t+1n;for(;o-r>1n;){const t=(r+o)/2n;e(t)?r=t:o=t}return r}const Wn=(t,e)=>t.find((t=>t.hubId===e.hubId&&t.asset===e.asset));function Dn(t,e,r){if(e.paused)return On("paused");if(e.frozen)return On("frozen");if(!e.isBorrowable)return On("cap");const o=e.assetDecimals,n=Cn(e),i=Wn(t.borrows,e),s=wn(r).indexes.get(bn(e.hubId,e.asset)),u=i?BigInt(i.indexRay):Co(s?.borrowIndex??e.liveBorrowIndexRay,"borrowIndex"),a=i?BigInt(i.usdPriceWad):function(t,e){return wn(e).prices.get(t.asset)??nn(t.usdPrice)}(e,r),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),r=e<=0n||a<=0n?0n:$o(e,10n**BigInt(o),a),n=t=>p+Zo(l+An("borrow",t,o,u),u,a,"ceil");f.push({amount:0n===r?0n:Ln(r+16n,(t=>n(t)<=c)),reason:"ltv"})}f.push({amount:Un(Co(e.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=Wo(n.suppliedBase,En,Uo);f.push({amount:Un(n.cashBase-h),reason:"liquidity"});const y=function(t,e){const r=t.maxUtilizationRay;if(null===r)return null;const o=Jo(t.suppliedBase,e);return 0n===o?null:Ln(Un($o(t.suppliedBase,r,Eo)-t.borrowedBase)+16n,(n=>an(Jo(t.borrowedBase+n,e),o)<=r))}(n,o);null!==y&&f.push({amount:y,reason:"utilizationCap"});const g=Pn(f);return Mn(g,o,!1,$n(n.suppliedBase,n.borrowedBase+g.amount))}function Nn(t,e,r){if(e.paused)return On("paused");const o=Wn(t.supplies,e);if(!o)return On(null);const n=o.decimals,i=Cn(e),s=BigInt(o.scaledRay),u=BigInt(o.indexRay),a=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),p=Go(s,u,n,"halfUp"),c=BigInt(t.totalDebtUsdWad),d=BigInt(t.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let y=!0;if(c>0n&&f>0n){const e=c>d?c:d,r=d>c?"minCollateral":"healthFactor",i=BigInt(t.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<e){y=!1;const t=e-i,l=Lo(t,Uo,f),c=BigInt(o.gateUsdWad)-l,d=c<=0n?0n:$o(c,10n**BigInt(n),a),g=p>0n?p-1n:0n,m=d+16n>g?g:d+16n,b=t=>{const e=qn("supply",t,n,u);return $o(Zo(e>=s?0n:s-e,u,a,"floor"),f,Uo)};h.push({amount:Ln(m,(e=>b(e)>=t)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const g=function(t,e){const r=t.maxUtilizationRay;if(null===r||0n===t.borrowedBase)return null;if(0n===r)return 0n;const o=Lo(t.borrowedBase,Eo,r),n=t.suppliedBase<o?0n:t.suppliedBase-o+16n,i=Jo(t.borrowedBase,e);return Ln(n>t.suppliedBase?t.suppliedBase:n,(o=>{const n=Jo(t.suppliedBase-o,e);return n>0n&&an(i,n)<=r}))}(i,n);null!==g&&h.push({amount:g,reason:"utilizationCap"});const m=Pn(h),b=y&&m.amount>=l;return Mn(m,n,b,$n(i.suppliedBase-m.amount,i.borrowedBase))}function Fn(t){if(t.paused)return On("paused");if(t.frozen)return On("frozen");const e=t.assetDecimals,r=Cn(t),o={amount:Un(Co(t.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return Mn(o,e,!1,$n(r.suppliedBase+o.amount,r.borrowedBase))}function zn(t,e,r){if(e.paused)return On("paused");const o=Wn(t.borrows,e);if(!o)return On(null);const n=o.decimals,i=Cn(e),s=BigInt(o.amountBase),u=void 0===r?null:Co(r,"walletBalance"),a=null!==u&&u<s?{amount:u,reason:"liquidity"}:{amount:s,reason:null};return Mn(a,n,a.amount>=s,$n(i.suppliedBase,Un(i.borrowedBase-a.amount)))}const Hn=(t,e)=>t.hubId===e.hubId&&t.asset===e.asset,Vn=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 jn(t,e){const r=[...t.supplies],o=[...t.borrows];for(const t of e){const e="supply"===t.side?r:o,n=e.findIndex((e=>Hn(e,t))),i=-1===n?void 0:e[n],s=Vn(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 r;if(s>=0n)r=e+An(t.side,s,t.decimals,t.indexRay);else{const o=-s,n=o>=("supply"===t.side?Go(e,t.indexRay,t.decimals,"halfUp"):BigInt(i.amountBase))?e:qn(t.side,o,t.decimals,t.indexRay);r=n>=e?0n:e-n}u=0n===r?null:vn({...t,scaledRay:r})}else u=s<=0n?null:Tn(Gn(t),s);-1===n?u&&e.push(u):u?e[n]=u:e.splice(n,1)}return kn({accountId:t.accountId,owner:t.owner,spokeId:t.spokeId,mode:t.mode},r,o,BigInt(t.minBorrowCollateralUsdWad),t.liveDataValid)}function Gn(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:Co("supply"===t.side?e.liveSupplyIndexRay:e.liveBorrowIndexRay,"reserve live index"),priceWad:nn(e.usdPrice),entryLtvBps:e.collateralFactorBps,entryLiquidationThresholdBps:e.liquidationThresholdBps,entryLiquidationBonusBps:e.liquidationPenaltyBps,entryLiquidationFeesBps:e.liquidationFeesBps,liveDataUsed:!1}}function Xn(t,e=0n,r=0n){const o=t.assetDecimals,n=t=>t<0n?0n:t,i=n(on(t.hubPool.suppliedShort,o)+Vn(e)),s=an(Jo(n(on(t.hubPool.borrowedShort,o)+Vn(r)),o),Jo(i,o)),u=ln(s,t.irm),a=pn(s,u,t.irm.reserveFactorBps);return{utilization:en(s),utilizationRay:s.toString(),borrowAprRay:u.toString(),supplyAprRay:a.toString(),borrowApr:cn(u),supplyApr:cn(a),borrowApy:dn(u),supplyApy:dn(a)}}const Yn={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 Kn(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const r=Number(e[1]),o=Yn[r];return o?{code:r,...o}:null}}},l={};function p(t){var e=l[t];if(void 0!==e)return e.exports;var r=l[t]={exports:{}};return a[t](r,r.exports,p),r.exports}p.d=(t,e)=>{for(var r in e)p.o(e,r)&&!p.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},p.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:s,...u}=this.init,{next:a,cache:l,debug:p,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:x,...v}=o??{},{revalidate:A,...q}=a??{},T="GET"!==f||g?void 0:A??x,I="GET"!==f||g||T?void 0:l??n,B=h.body,_=c??s??(null==B?3e4:0),k=_>0?AbortSignal.timeout(_):void 0,R=h.signal??u.signal,E=k&&R?AbortSignal.any([R,k]):k??R,P={...u,...h,method:f,...Object.keys(b).length?{headers:b}:{},...E?{signal:E}:{},cache:I,next:{...v,...q,revalidate:T}};(p??i)&&console.debug("SDK fetch: ",S,P);const U=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 U.text();if(!U.ok){let t;try{t=JSON.parse(M)}catch{t={message:M}}const e=[S,U.status,U.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(M)}catch{return M}}}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 x=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)),v={"/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:{}}},A=["PATCH","POST","DELETE","PUT"];var q=p(428);const T=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function I(t,e,r,o){const{input:n,output:i,...s}=e,u=async(e={})=>{const n={...r,...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(!x(t))throw new S(t)}if(l){const t=n.collection;if(Array.isArray(t)?t.some((t=>!m(t))):!m(t))throw new w(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:b,signal:v,credentials:A,mode:q,redirect:T,referrer:I,referrerPolicy:B,integrity:_,keepalive:k,priority:R,window:E,continuationToken:P,...U}=p,M=d?`Bearer ${d}`:void 0;t.startsWith("/stellar-lending/")&&void 0!==P&&(U.continuationToken=P);const O={...h,...M?{Authorization:M}:{},...P&&!t.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(P)}:{}},C={...g,tags:[...g?.tags??[],i]};return o.fetchWithTimeout(i,{method:f,params:U,body:c,headers:O,cache:y,debug:b,...Object.fromEntries(Object.entries({signal:v,credentials:A,mode:q,redirect:T,referrer:I,referrerPolicy:B,integrity:_,keepalive:k,priority:R,window:E}).filter((([,t])=>void 0!==t))),...C?{next:C}:{}})},a=(t={})=>u(t);for(const t of Object.keys(s))A.includes(t)&&(a[t]=e=>u({...e,method:e.method??t.toUpperCase()}));return a}function B(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,r]of Object.entries(v)){const o=e.split("/").filter(Boolean);let n=t;for(const t of o)if(t.startsWith(":")){const e=T(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=T(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,s=Object.keys(e.params).length;let u;if(1===n&&i+s>0){const{rawPath:r,def:n}=e.leaves[0];u=I(r,n,o,t)}else{u={};for(const{rawPath:r,def:n}of e.leaves)u[T(r.split("/").pop().replace(/^:/,""))]=I(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===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=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(u[t]){const r=u[t];u[t]=t=>({...r(t),...e(t)})}else u[t]=e}return u};return r(e,{})}export{y as Chain,h as DEFAULT_REQUEST_TIMEOUT_MS,g as XOXNOClient,B as buildSdk,m as isValidCollectionTicker,b as isValidNftIdentifier};export const BPS=q.UTY;export const DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD=q.fFH;export const LIQUIDATION_BUFFER_BPS=q.RCv;export const RAY=q.Z$K;export const RAY_DECIMALS=q.OAi;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=q.G_M;export const STELLAR_LENDING_TOPICS=q.fAY;export const STELLAR_NETWORKS=q.a_O;export const STELLAR_NETWORK_PASSPHRASE=q.A$9;export const SYNTHETIC_EVENT_ORDER_STRIDE=q.gRW;export const WAD=q.DYS;export const WAD_DECIMALS=q.wFd;export const aggregateAccountRisk=q.wJe;export const annualBorrowRateRay=q.$wP;export const baseToRay=q.Vhx;export const baseToShort=q.xEs;export const baseValueWad=q.t$R;export const buildLiveSnapshot=q.pU3;export const buildSameTokenRepaySwapSteps=q.VZJ;export const buildStellarAcceptOwnershipTx=q.N0v;export const buildStellarAddRewardsTx=q.B_D;export const buildStellarApproveBlendPoolTx=q.qLM;export const buildStellarApproveTokenTx=q.eX8;export const buildStellarBatchSwapTx=q.zaA;export const buildStellarBorrowBatchTx=q.xDR;export const buildStellarBorrowTx=q.jR0;export const buildStellarCctpForwardTx=q.P2l;export const buildStellarClaimRevenueTx=q.W68;export const buildStellarCreateLiquidityPoolTx=q.sec;export const buildStellarExecuteCancellerResetTx=q.ZPB;export const buildStellarExecuteStrategyTx=q.yrp;export const buildStellarFlashLoanTx=q.spi;export const buildStellarGovernanceAddSpokeImmediateTx=q.Iu1;export const buildStellarGovernanceCreateHubImmediateTx=q.yuB;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=q.$96;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=q.zwJ;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=q.h_A;export const buildStellarGovernanceExecuteTransferGovOwnTx=q.e_X;export const buildStellarGovernanceExecuteTx=q.TkG;export const buildStellarGovernanceExecuteUpdateDelayTx=q.BAg;export const buildStellarGovernancePauseTx=q.u9S;export const buildStellarGovernanceRevokeRoleImmediateTx=q.biU;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=q.gc5;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=q.ayx;export const buildStellarGrantRoleTx=q.SXg;export const buildStellarLendingIdentifier=q.UFY;export const buildStellarLiquidateTx=q.Y5o;export const buildStellarMigrateFromBlendTx=q.mEH;export const buildStellarMigrateTx=q.xGW;export const buildStellarMultiplyTx=q.s9Q;export const buildStellarPauseTx=q.OL0;export const buildStellarProposeAddAssetToSpokeTx=q.k6p;export const buildStellarProposeAddSpokeTx=q.djE;export const buildStellarProposeApproveBlendPoolTx=q.kDJ;export const buildStellarProposeApproveTokenTx=q.Yfw;export const buildStellarProposeCancellerResetTx=q.AI1;export const buildStellarProposeConfigureAssetOracleTx=q.O2U;export const buildStellarProposeConfigureMarketOracleTx=q.c5J;export const buildStellarProposeCreateHubTx=q.N8y;export const buildStellarProposeCreateLiquidityPoolTx=q.qUh;export const buildStellarProposeDeployPoolTx=q.RZj;export const buildStellarProposeEditAssetInSpokeTx=q.nio;export const buildStellarProposeEditOracleToleranceTx=q.hFg;export const buildStellarProposeGovernanceUpgradeTx=q.Qkp;export const buildStellarProposeGrantGovernanceRoleTx=q.GwL;export const buildStellarProposeMigrateControllerTx=q.$Kr;export const buildStellarProposeRemoveAssetFromSpokeTx=q.ujH;export const buildStellarProposeRemoveSpokeTx=q.Odj;export const buildStellarProposeRevokeBlendPoolTx=q.X7c;export const buildStellarProposeRevokeGovernanceRoleTx=q.Ubz;export const buildStellarProposeRevokeTokenTx=q.Dx4;export const buildStellarProposeSetAccumulatorTx=q.OAr;export const buildStellarProposeSetAggregatorTx=q.$Uh;export const buildStellarProposeSetMinBorrowCollatTx=q.obN;export const buildStellarProposeSetPositionLimitsTx=q.$lZ;export const buildStellarProposeSetPositionManagerTx=q.Kaw;export const buildStellarProposeSetPriceAggregatorTx=q.Wbk;export const buildStellarProposeSetSpokeLiquidationCurveTx=q.kwV;export const buildStellarProposeSetSwapAggregatorTx=q.qAI;export const buildStellarProposeTransferCtrlOwnershipTx=q.VSx;export const buildStellarProposeTransferGovOwnTx=q.HPG;export const buildStellarProposeUnpauseTx=q.xQk;export const buildStellarProposeUpdateDelayTx=q.YQw;export const buildStellarProposeUpgradeControllerTx=q.QY;export const buildStellarProposeUpgradePoolParamsTx=q.osR;export const buildStellarProposeUpgradePoolTx=q.Kob;export const buildStellarRenewAccountTx=q.IJt;export const buildStellarRepayBatchTx=q.nw5;export const buildStellarRepayDebtWithCollateralTx=q.PrA;export const buildStellarRepayTx=q.ZEf;export const buildStellarRevokeBlendPoolTx=q.X0W;export const buildStellarRevokeRoleTx=q.evz;export const buildStellarRevokeTokenTx=q.P8C;export const buildStellarSetAccumulatorTx=q.aVn;export const buildStellarSetAggregatorTx=q.p2b;export const buildStellarSetMarketOracleConfigTx=q.sVY;export const buildStellarSetOracleSanityBoundsTx=q.XDq;export const buildStellarSetOracleToleranceTx=q.Jsu;export const buildStellarSetOracleTx=q.W5;export const buildStellarSetPositionLimitsTx=q.Dyw;export const buildStellarSetPriceAggregatorTx=q._i2;export const buildStellarSetSpokeAssetFlagsTx=q.FZg;export const buildStellarSetSwapAggregatorTx=q.wGh;export const buildStellarSupplyBatchTx=q.Nix;export const buildStellarSupplyTx=q.v_o;export const buildStellarSwapCollateralTx=q.qDU;export const buildStellarSwapDebtTx=q.qRb;export const buildStellarTransferOwnershipTx=q.QJY;export const buildStellarUnpauseTx=q.bmW;export const buildStellarUpdateAccountThresholdTx=q.n_N;export const buildStellarUpdateIndexesTx=q.v87;export const buildStellarUpgradeControllerTx=q.qMI;export const buildStellarUpgradeLiquidityPoolParamsTx=q.gHX;export const buildStellarWithdrawBatchTx=q.O3p;export const buildStellarWithdrawTx=q.Gzh;export const buildTx=q.prJ;export const burnShares=q.moD;export const computeAccountRisk=q.y5S;export const decodeStellarLendingEvent=q.Fmy;export const decodeStellarLiquidateReturn=q.OBV;export const depositRateRay=q.HFl;export const divByIntHalfUp=q.cCk;export const encodeAssetOracle=q.Ft;export const encodeInterestRateModel=q.MB4;export const encodeMarketOracleConfigInput=q.Dnk;export const encodeMarketParamsRaw=q.pqp;export const encodePositionLimits=q.Q3w;export const encodePriceKey=q.Jh3;export const encodeStrategyPayloadToRouteXdr=q.wfs;export const extractEventOrder=q.UmN;export const getStellarAccountPositions=q.xO7;export const getStellarActiveUsersSeries=q.R11;export const getStellarAggregatorQuote=q.LwT;export const getStellarAsset=q.mMz;export const getStellarAssetGraph=q.iES;export const getStellarAssetMarkets=q.zpK;export const getStellarAssetPage=q.N3x;export const getStellarAssets=q.bNp;export const getStellarCampaignLeaderboard=q.T3v;export const getStellarCampaignMe=q.KQV;export const getStellarDefiLlamaDimensions=q.S9l;export const getStellarDeployment=q.rER;export const getStellarDetailedMarkets=q.XNg;export const getStellarFeeRevenueSeries=q.VeU;export const getStellarGovernanceProposals=q.T_r;export const getStellarHolderDistribution=q.m4Y;export const getStellarHub=q.XIn;export const getStellarHubGraph=q.Lt0;export const getStellarHubHolders=q.wsx;export const getStellarHubs=q.KKL;export const getStellarLendingContext=q.yl$;export const getStellarLendingLiveState=q.kqD;export const getStellarLiquidationsLeaderboard=q.dEm;export const getStellarLiquidationsSeries=q.bu4;export const getStellarParticipantCounts=q.ftY;export const getStellarPnlByScope=q.Ht0;export const getStellarPositionsLeaderboard=q.$uf;export const getStellarPositionsPnl=q.wqt;export const getStellarQuoteTokens=q.CHU;export const getStellarRateSpreadSeries=q.Wc$;export const getStellarReserve=q.Y5D;export const getStellarReserveGraph=q.KGs;export const getStellarReserveHolders=q.nWw;export const getStellarReserves=q.jFb;export const getStellarRevenueSeries=q.Pvd;export const getStellarSpoke=q.S2b;export const getStellarSpokeGraph=q.uSb;export const getStellarSpokeHolders=q.N9t;export const getStellarSpokes=q.bNM;export const getStellarStatsHistory=q.PvK;export const getStellarUserActivity=q.O5u;export const getStellarUserActivityPage=q.NYX;export const getStellarUserHistory=q.FCB;export const getStellarUserPositions=q.h_O;export const getStellarVolumeSeries=q.zu2;export const getStellarWalletBalance=q.Xix;export const liveIndexKey=q.C88;export const mapQuoteResponseToAggregatorSwap=q.LAw;export const mapQuoteResponseToStrategyPayload=q.E6J;export const mapQuoteResponseToStrategySwap=q.Dsj;export const mapSorobanError=q.XVZ;export const mapStellarPositionActivityType=q.CUR;export const maxBorrow=q.Kye;export const maxRepay=q.Q6F;export const maxSupply=q.SFb;export const maxWithdraw=q.tT6;export const mintShares=q.fBQ;export const mulDivCeil=q.LRi;export const mulDivFloor=q.M0l;export const mulDivHalfUp=q.sfH;export const numberToScaled=q.NFG;export const numberToWad=q.DGs;export const positionValueWad=q.BqG;export const prepareStellarBuiltTx=q.VxL;export const prepareStellarTxXdr=q.DLQ;export const projectAccountRisk=q.mbb;export const projectReserveApy=q.AuU;export const rayAprToApy=q.vCP;export const rayAprToNumber=q.w74;export const rayToNumber=q.JRY;export const rescaleCeil=q.BV_;export const rescaleFloor=q.ApP;export const rescaleHalfUp=q.Ei0;export const reserveKey=q.kQ9;export const resolveReserve=q.vp8;export const stellarLendingDispatchKey=q.ONb;export const stellarLendingRead=q.HhT;export const stellarNetworks=q.PF2;export const syntheticEventOrder=q.oVm;export const tagStellarInvokedContractError=q.g57;export const toBase64Xdr=q.LaM;export const toBigInt=q.DgJ;export const toStellarPositionMode=q.Vuj;export const unscale=q.Ou3;export const unscaleBorrowCeil=q.kRY;export const unscaleHalfUp=q.W_e;export const unscaleSupplyFloor=q.Let;export const utilizationRay=q.TXb;export const valueBasePosition=q.shl;export const valueScaledPosition=q.TqQ;export const wadToNumber=q.rWM;
|