@xoxno/sdk-js 1.0.141 → 1.0.143
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/index.d.ts +3 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/sdk/index.d.ts +4 -0
- package/dist/cjs/sdk/parseSwagger.d.ts +1 -0
- package/dist/cjs/sdk/stellar/__tests__/admin.test.d.ts +13 -0
- package/dist/cjs/sdk/stellar/__tests__/decode.test.d.ts +10 -0
- package/dist/cjs/sdk/stellar/__tests__/id.test.d.ts +4 -0
- package/dist/cjs/sdk/stellar/__tests__/lending.test.d.ts +21 -0
- package/dist/cjs/sdk/stellar/__tests__/swap.test.d.ts +1 -0
- package/dist/cjs/sdk/stellar/admin.d.ts +170 -0
- package/dist/cjs/sdk/stellar/cctp.d.ts +16 -0
- package/dist/cjs/sdk/stellar/contracts.d.ts +70 -0
- package/dist/cjs/sdk/stellar/events/decode.d.ts +45 -0
- package/dist/cjs/sdk/stellar/events/id.d.ts +40 -0
- package/dist/cjs/sdk/stellar/events/index.d.ts +2 -0
- package/dist/cjs/sdk/stellar/governance.d.ts +158 -0
- package/dist/cjs/sdk/stellar/index.d.ts +11 -0
- package/dist/cjs/sdk/stellar/lending.d.ts +171 -0
- package/dist/cjs/sdk/stellar/position-mode.d.ts +7 -0
- package/dist/cjs/sdk/stellar/prepare.d.ts +25 -0
- package/dist/cjs/sdk/stellar/quote.d.ts +58 -0
- package/dist/cjs/sdk/stellar/repay-swap.d.ts +7 -0
- package/dist/cjs/sdk/stellar/scval-encode.d.ts +115 -0
- package/dist/cjs/sdk/stellar/swap.d.ts +70 -0
- package/dist/cjs/sdk/swagger.d.ts +1967 -0
- package/dist/cjs/sdk/types.d.ts +83 -0
- package/dist/cjs/sdk/utils.d.ts +9 -0
- package/dist/cjs/utils/api.d.ts +36 -0
- package/dist/cjs/utils/const.d.ts +13 -0
- package/dist/cjs/utils/errors.d.ts +12 -0
- package/dist/cjs/utils/guards.d.ts +7 -0
- package/dist/cjs/utils/helpers.d.ts +3 -0
- package/dist/cjs/utils/regex.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { OurRequestInit } from '../utils/api';
|
|
2
|
+
import type { endpoints, endpoints as routes } from './swagger';
|
|
3
|
+
type RemoveColon<S extends string> = S extends `:${infer R}` ? R : S;
|
|
4
|
+
type CamelCase<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Head}${CamelCase<Capitalize<Tail>>}` : S;
|
|
5
|
+
type IsEmptyObj<T> = keyof T extends never ? true : false;
|
|
6
|
+
type NeedsDefault<I, O, _Full> = IsEmptyObj<I> extends true ? IsEmptyObj<O> extends true ? false : true : true;
|
|
7
|
+
type CollectParams<S extends string> = S extends `${string}:${infer P}/${infer R}` ? {
|
|
8
|
+
[K in P]: string;
|
|
9
|
+
} & CollectParams<`/${R}`> : S extends `${string}:${infer P}` ? {
|
|
10
|
+
[K in P]: string;
|
|
11
|
+
} : {};
|
|
12
|
+
type RequireAtLeastOne<T> = {
|
|
13
|
+
[K in keyof T]-?: {
|
|
14
|
+
[P in K]-?: T[P];
|
|
15
|
+
} & Omit<T, K>;
|
|
16
|
+
}[keyof T] & T;
|
|
17
|
+
type BodyBag<VB, Defined extends boolean> = Defined extends true ? IsEmptyObj<VB> extends true ? {
|
|
18
|
+
body?: never;
|
|
19
|
+
} : {
|
|
20
|
+
body: RequireAtLeastOne<VB>;
|
|
21
|
+
} : {
|
|
22
|
+
body?: RequireAtLeastOne<VB>;
|
|
23
|
+
};
|
|
24
|
+
type SecurityModeOf<T> = T extends {
|
|
25
|
+
securityMode: infer S;
|
|
26
|
+
} ? S : undefined;
|
|
27
|
+
type AuthBag<M> = M extends 'optionalAny' ? {
|
|
28
|
+
auth?: string;
|
|
29
|
+
} : M extends 'requiredAny' | 'requiredWeb2' | 'requiredJwt' ? {
|
|
30
|
+
auth: string;
|
|
31
|
+
} : {
|
|
32
|
+
auth?: never;
|
|
33
|
+
};
|
|
34
|
+
type VerbExtras<Full, PBag> = {
|
|
35
|
+
[Verb in keyof Full as Verb extends 'input' | 'body' | 'output' | 'securityMode' ? never : Verb]: Full[Verb] extends {
|
|
36
|
+
input: infer VI;
|
|
37
|
+
output: infer VO;
|
|
38
|
+
} ? (args: VI & PBag & BodyBag<Full[Verb] extends {
|
|
39
|
+
body: infer VB;
|
|
40
|
+
} ? VB : never, 'body' extends keyof Full[Verb] ? true : false> & AuthBag<SecurityModeOf<Full[Verb]>> & OurRequestInit) => Promise<VO> : never;
|
|
41
|
+
};
|
|
42
|
+
type DropKey<T, K extends PropertyKey> = {
|
|
43
|
+
[P in Exclude<keyof T, K>]: T[P];
|
|
44
|
+
};
|
|
45
|
+
type RequiredKeys<T> = {
|
|
46
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
47
|
+
}[keyof T];
|
|
48
|
+
type HasRequiredKeys<T> = [RequiredKeys<T>] extends [never] ? false : true;
|
|
49
|
+
type PathToTree<P extends string, I, O, Full = {
|
|
50
|
+
input: I;
|
|
51
|
+
output: O;
|
|
52
|
+
}, Root extends string = P, Bag extends object = CollectParams<Root>> = P extends `/${infer Head}/${infer Rest}` ? Head extends `:${infer Param}` ? {
|
|
53
|
+
[K in CamelCase<Param>]: (value: string) => PathToTree<`/${Rest}`, I, O, Full, Root, DropKey<Bag, Param>>;
|
|
54
|
+
} : {
|
|
55
|
+
[K in CamelCase<Head>]: PathToTree<`/${Rest}`, I, O, Full, Root, Bag>;
|
|
56
|
+
} : P extends `/:${infer Param}` ? {
|
|
57
|
+
[K in CamelCase<Param>]: (value: string) => (NeedsDefault<I, O, Full> extends true ? HasRequiredKeys<DropKey<Bag, Param> & I & AuthBag<SecurityModeOf<Full>>> extends true ? (args: I & DropKey<Bag, Param> & AuthBag<SecurityModeOf<Full>> & OurRequestInit) => Promise<O> : (args?: I & DropKey<Bag, Param> & AuthBag<SecurityModeOf<Full>> & OurRequestInit) => Promise<O> : {}) & VerbExtras<Full, DropKey<Bag, Param>>;
|
|
58
|
+
} : P extends `/${infer Leaf}` ? {
|
|
59
|
+
[K in CamelCase<RemoveColon<Leaf>>]: (NeedsDefault<I, O, Full> extends true ? HasRequiredKeys<I & Bag & AuthBag<SecurityModeOf<Full>>> extends true ? (args: I & Bag & AuthBag<SecurityModeOf<Full>> & OurRequestInit) => Promise<O> : (args?: I & Bag & AuthBag<SecurityModeOf<Full>> & OurRequestInit) => Promise<O> : {}) & VerbExtras<Full, Bag>;
|
|
60
|
+
} : never;
|
|
61
|
+
type AnyFn = (...a: any[]) => any;
|
|
62
|
+
type IsFn<T> = T extends AnyFn ? true : false;
|
|
63
|
+
type U2I<U> = (U extends any ? (k: U) => 0 : never) extends (k: infer I) => 0 ? I : never;
|
|
64
|
+
type UnionKeys<U> = U extends any ? keyof U : never;
|
|
65
|
+
type CollapseFnUnion<F> = (...a: Parameters<Extract<F, AnyFn>>) => U2I<F extends AnyFn ? ReturnType<F> : never>;
|
|
66
|
+
type ValuesForKey<U, K extends PropertyKey> = Exclude<U extends any ? (K extends keyof U ? U[K] : never) : never, never>;
|
|
67
|
+
type FnUnion<U> = Extract<U, AnyFn>;
|
|
68
|
+
type ObjUnion<U> = Exclude<U, AnyFn>;
|
|
69
|
+
type CollapseFnUnionOrNever<U> = [FnUnion<U>] extends [never] ? {} : CollapseFnUnion<FnUnion<U>>;
|
|
70
|
+
type MergeRec<U> = [U] extends [object] ? {
|
|
71
|
+
[K in UnionKeys<ObjUnion<U>>]: MergeRec<ValuesForKey<ObjUnion<U>, K>>;
|
|
72
|
+
} & CollapseFnUnionOrNever<U> : U;
|
|
73
|
+
type SimplifyDeep<T> = IsFn<T> extends true ? T : T extends object ? {
|
|
74
|
+
[K in keyof T]: SimplifyDeep<T[K]>;
|
|
75
|
+
} : T;
|
|
76
|
+
type SDKUnion = {
|
|
77
|
+
[R in keyof typeof routes]: PathToTree<R, (typeof routes)[R]['input'], (typeof routes)[R]['output'], (typeof routes)[R]>;
|
|
78
|
+
}[keyof typeof routes];
|
|
79
|
+
export type SDK = SimplifyDeep<MergeRec<SDKUnion>>;
|
|
80
|
+
export type SDKTags = {
|
|
81
|
+
[K in keyof typeof endpoints]: IsEmptyObj<(typeof endpoints)[K]['input']> extends true ? IsEmptyObj<(typeof endpoints)[K]['output']> extends true ? never : K : K;
|
|
82
|
+
}[keyof typeof endpoints];
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const coveredMethods: readonly ["PATCH", "POST", "DELETE", "PUT"];
|
|
2
|
+
declare const _nestTypes: readonly ["string", "number", "boolean"];
|
|
3
|
+
declare const _returnTypes: readonly ["application/json", "multipart/form-data"];
|
|
4
|
+
declare const _securityModes: readonly ["requiredAny", "requiredWeb2", "requiredJwt", "optionalAny"];
|
|
5
|
+
export type ICoveredMethods = (typeof coveredMethods)[number];
|
|
6
|
+
export type INestType = (typeof _nestTypes)[number];
|
|
7
|
+
export type IReturnTypes = (typeof _returnTypes)[number];
|
|
8
|
+
export type ISecurityMode = (typeof _securityModes)[number];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type SafeHeaders = Record<string, string> & {
|
|
2
|
+
authorization?: never;
|
|
3
|
+
Authorization?: never;
|
|
4
|
+
};
|
|
5
|
+
export type OurRequestInit = Omit<RequestInit, 'body' | 'headers'> & {
|
|
6
|
+
headers?: SafeHeaders;
|
|
7
|
+
debug?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare enum Chain {
|
|
10
|
+
MAINNET = "1",
|
|
11
|
+
DEVNET = "D"
|
|
12
|
+
}
|
|
13
|
+
export declare class XOXNOClient {
|
|
14
|
+
apiUrl: string;
|
|
15
|
+
chain: Chain;
|
|
16
|
+
init: OurRequestInit;
|
|
17
|
+
config: {
|
|
18
|
+
mediaUrl: string;
|
|
19
|
+
gatewayUrl: string;
|
|
20
|
+
XO_SC: string;
|
|
21
|
+
FM_SC: string;
|
|
22
|
+
DR_SC: string;
|
|
23
|
+
KG_SC: string;
|
|
24
|
+
Staking_SC: string;
|
|
25
|
+
Manager_SC: string;
|
|
26
|
+
P2P_SC: string;
|
|
27
|
+
};
|
|
28
|
+
constructor({ chain, apiUrl, ...init }?: {
|
|
29
|
+
chain?: Chain;
|
|
30
|
+
apiUrl?: string;
|
|
31
|
+
} & OurRequestInit);
|
|
32
|
+
fetchWithTimeout: <T>(path: string, { params, ...options }?: RequestInit & {
|
|
33
|
+
debug?: boolean;
|
|
34
|
+
params?: Record<string, any>;
|
|
35
|
+
}) => Promise<T>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const API_URL = "https://api.xoxno.com";
|
|
2
|
+
export declare const API_URL_DEV = "https://devnet-api.xoxno.com";
|
|
3
|
+
export declare const XOXNO_SC = "erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8";
|
|
4
|
+
export declare const FM_SC = "erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s";
|
|
5
|
+
export declare const DR_SC = "erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0";
|
|
6
|
+
export declare const KG_SC = "erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";
|
|
7
|
+
export declare const Staking_SC = "erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z";
|
|
8
|
+
export declare const Manager_SC = "erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7";
|
|
9
|
+
export declare const P2P_SC = "erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6";
|
|
10
|
+
export declare const XOXNO_SC_DEV = "erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4";
|
|
11
|
+
export declare const Staking_SC_DEV = "erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres";
|
|
12
|
+
export declare const Manager_SC_DEV = "erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr";
|
|
13
|
+
export declare const P2P_SC_DEV = "erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class CollectionNotFoundError extends Error {
|
|
2
|
+
constructor(item: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class AddressNotFoundError extends Error {
|
|
5
|
+
constructor(item: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class NFTNotFoundError extends Error {
|
|
8
|
+
constructor(item: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class PaginatedTopError extends Error {
|
|
11
|
+
constructor(top: number);
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function collectionGuard<T>(collection: string, callback: Promise<T>): Promise<T>;
|
|
2
|
+
export declare function addressGuard<T>(address: string, callback: Promise<T>): Promise<T>;
|
|
3
|
+
export declare function nftGuard<T>(identifier: string, callback: Promise<T>): Promise<T>;
|
|
4
|
+
export declare function collectionGuardOnly(collection: string): Promise<void>;
|
|
5
|
+
export declare function paginatedGuard<T extends {
|
|
6
|
+
top?: number;
|
|
7
|
+
}, R>(filter: T, callback: (filter: string) => Promise<R>): Promise<R>;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var t={d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Chain:()=>i,STELLAR_AGGREGATOR_ROUTER:()=>_,STELLAR_GOVERNANCE:()=>g,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ht,STELLAR_LENDING_CONTROLLER:()=>b,STELLAR_LENDING_TOPICS:()=>Ye,STELLAR_NETWORK_PASSPHRASE:()=>S,STELLAR_QUOTE_URL:()=>q,STELLAR_SOROBAN_RPC_URL:()=>m,SYNTHETIC_EVENT_ORDER_STRIDE:()=>oo,XOXNOClient:()=>a,XOXNO_LENDING_STELLAR_TICKER:()=>eo,buildSameTokenRepaySwapSteps:()=>wo,buildSdk:()=>Mo,buildStellarAcceptOwnershipTx:()=>vt,buildStellarAddAssetToEModeCategoryTx:()=>Mt,buildStellarAddEModeCategoryTx:()=>kt,buildStellarAddRewardsTx:()=>Vt,buildStellarApproveTokenTx:()=>It,buildStellarBatchSwapTx:()=>bo,buildStellarBorrowBatchTx:()=>F,buildStellarBorrowTx:()=>Z,buildStellarCctpForwardTx:()=>xo,buildStellarClaimRevenueTx:()=>Gt,buildStellarConfigureMarketOracleTx:()=>Lt,buildStellarCreateLiquidityPoolTx:()=>$t,buildStellarDisableTokenOracleTx:()=>Ut,buildStellarEditAssetConfigTx:()=>xt,buildStellarEditAssetInEModeCategoryTx:()=>Ot,buildStellarEditOracleToleranceTx:()=>Bt,buildStellarExecuteStrategyTx:()=>fo,buildStellarFlashLoanTx:()=>et,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Ee,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Pe,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Me,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Oe,buildStellarGovernanceExecuteTx:()=>xe,buildStellarGovernanceExecuteUpdateDelayTx:()=>ke,buildStellarGrantRoleTx:()=>qt,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>tt,buildStellarMigrateTx:()=>_t,buildStellarMultiplyTx:()=>ot,buildStellarPauseTx:()=>gt,buildStellarProposeAddAssetToEModeTx:()=>ue,buildStellarProposeAddEModeCategoryTx:()=>re,buildStellarProposeApproveTokenTx:()=>se,buildStellarProposeConfigureMarketOracleTx:()=>qe,buildStellarProposeCreateLiquidityPoolTx:()=>le,buildStellarProposeDeployPoolTx:()=>ce,buildStellarProposeEditAssetConfigTx:()=>te,buildStellarProposeEditAssetInEModeTx:()=>ie,buildStellarProposeEditOracleToleranceTx:()=>Se,buildStellarProposeGovernanceUpgradeTx:()=>he,buildStellarProposeGrantControllerRoleTx:()=>fe,buildStellarProposeGrantGovernanceRoleTx:()=>Te,buildStellarProposeMigrateControllerTx:()=>ge,buildStellarProposeRemoveAssetFromEModeTx:()=>ae,buildStellarProposeRemoveEModeCategoryTx:()=>ne,buildStellarProposeRevokeControllerRoleTx:()=>be,buildStellarProposeRevokeGovernanceRoleTx:()=>we,buildStellarProposeRevokeTokenTx:()=>pe,buildStellarProposeSetAccumulatorTx:()=>Jt,buildStellarProposeSetAggregatorTx:()=>Kt,buildStellarProposeSetMinBorrowCollatTx:()=>oe,buildStellarProposeSetPoolTemplateTx:()=>Yt,buildStellarProposeSetPositionLimitsTx:()=>ee,buildStellarProposeTransferCtrlOwnershipTx:()=>me,buildStellarProposeTransferGovOwnTx:()=>Ae,buildStellarProposeUpdateDelayTx:()=>ve,buildStellarProposeUpgradeControllerTx:()=>_e,buildStellarProposeUpgradePoolParamsTx:()=>de,buildStellarProposeUpgradePoolTx:()=>ye,buildStellarRemoveAssetFromEModeTx:()=>Rt,buildStellarRemoveEModeCategoryTx:()=>Pt,buildStellarRenewAccountTx:()=>Dt,buildStellarRepayBatchTx:()=>J,buildStellarRepayDebtWithCollateralTx:()=>ut,buildStellarRepayTx:()=>Y,buildStellarRevokeRoleTx:()=>St,buildStellarRevokeTokenTx:()=>Ct,buildStellarSetAccumulatorTx:()=>wt,buildStellarSetAggregatorTx:()=>Tt,buildStellarSetLiquidityPoolTemplateTx:()=>At,buildStellarSetPositionLimitsTx:()=>Et,buildStellarSupplyBatchTx:()=>H,buildStellarSupplyTx:()=>W,buildStellarSwapCollateralTx:()=>nt,buildStellarSwapDebtTx:()=>rt,buildStellarTransferOwnershipTx:()=>ht,buildStellarUnpauseTx:()=>mt,buildStellarUpdateAccountThresholdTx:()=>Xt,buildStellarUpdateIndexesTx:()=>Nt,buildStellarUpgradeControllerTx:()=>bt,buildStellarUpgradeLiquidityPoolParamsTx:()=>zt,buildStellarUpgradeLiquidityPoolTx:()=>jt,buildStellarWithdrawBatchTx:()=>Q,buildStellarWithdrawTx:()=>K,buildTx:()=>X,decodeStellarLendingEvent:()=>to,encodeAssetConfigRaw:()=>pt,encodeInterestRateModel:()=>at,encodeMarketOracleConfigInput:()=>ft,encodeMarketParamsRaw:()=>st,encodeOracleSourceConfigInput:()=>yt,encodePositionLimits:()=>lt,encodeStrategyPayloadToRouteXdr:()=>yo,extractEventOrder:()=>no,getStellarAggregatorQuote:()=>po,getStellarAggregatorRouter:()=>v,getStellarGovernance:()=>T,getStellarLendingController:()=>h,getStellarQuoteTokens:()=>lo,isValidCollectionTicker:()=>s,isValidNftIdentifier:()=>p,mapQuoteResponseToAggregatorSwap:()=>mo,mapQuoteResponseToStrategyPayload:()=>_o,mapQuoteResponseToStrategySwap:()=>go,mapStellarPositionActivityType:()=>io,prepareStellarBuiltTx:()=>vo,prepareStellarTxXdr:()=>ho,stellarLendingDispatchKey:()=>Ce,syntheticEventOrder:()=>uo,tagStellarInvokedContractError:()=>So,toBase64Xdr:()=>Re,toStellarPositionMode:()=>To});const o="https://api.xoxno.com",r="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",n="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",u="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var i;!function(t){t.MAINNET="1",t.DEVNET="D"}(i||(i={}));class a{apiUrl;chain;init;config;constructor({chain:t=i.MAINNET,apiUrl:e=o,...a}={}){this.apiUrl=e??{[i.MAINNET]:o,[i.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=a,this.config=t==i.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:r,DR_SC:n,KG_SC:u,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:r,DR_SC:n,KG_SC:u,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:a,cache:s,debug:p,headers:l,method:d="GET",...c}=o,y=l?.Authorization,f="Bearer undefined"===y?void 0:y,b={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...f?{Authorization:f}:{}},_=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${_.length?`?${_}`:""}`,{revalidate:m,...q}=r??{},{revalidate:S,...h}=a??{},v="GET"!==d||f?void 0:S??m,T="GET"!==d||f||v?void 0:s??n,w={...i,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:T,next:{...q,...h,revalidate:v}};(p??u)&&console.debug("SDK fetch: ",g,w);const A=await fetch(g,w).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw new Error(`${g}: ${t.message}`);throw t})),x=await A.text();if(!A.ok){let t;try{t=JSON.parse(x)}catch{t={message:x}}const e=[g,A.status,A.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(x)}catch{return x}}}const s=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},p=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class l extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class d extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const c=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)||/^G[A-Z2-7]{55}$/.test(t)),y={"/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:{}},"/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/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/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:{}},"/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"}},"/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"}},"/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:{}}}},f=["PATCH","POST","DELETE","PUT"],b={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},_={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},g={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},m={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},q={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},S={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function h(t){const e=b[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function v(t){const e=_[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function T(t){const e=g[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const w=require("@stellar/stellar-sdk"),A=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],x=t=>new w.Address(t).toScVal(),E=t=>new w.ScInt(t).toI128(),k=t=>w.xdr.ScVal.scvU32(t),P=t=>new w.ScInt("string"==typeof t?t:t.toString()).toU64(),M=t=>w.xdr.ScVal.scvBool(t),O=t=>w.xdr.ScVal.scvString(t),R=t=>w.xdr.ScVal.scvSymbol(t),I=()=>w.xdr.ScVal.scvVoid(),C=t=>w.xdr.ScVal.scvVec(t),L=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return w.xdr.ScVal.scvBytes(r)},B=(t,e)=>null==t?I():e(t),U=(t,e)=>w.xdr.ScVal.scvVec([x(t),E(e)]),N=t=>w.xdr.ScVal.scvVec(t.map((t=>U(t.token,t.amount)))),D=t=>{const e=Object.keys(t).sort().map((e=>new w.xdr.ScMapEntry({key:R(e),val:t[e]})));return w.xdr.ScVal.scvMap(e)},$=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return D({amount_out:E(t.amountOut),pool:x(t.pool),token_in:x(t.tokenIn),token_out:x(t.tokenOut),venue:(e=t.venue,w.xdr.ScVal.scvVec([R(e)]))});var e}));return D({hops:w.xdr.ScVal.scvVec(e),split_ppm:k(t.splitPpm)})}));return D({paths:w.xdr.ScVal.scvVec(e),referral_id:P(t.referralId??0),token_in:x(t.tokenIn),token_out:x(t.tokenOut),total_min_out:E(t.totalMinOut)})},z=t=>{const e=Buffer.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 w.xdr.ScVal.scvBytes(e)},j=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},G=t=>{if("string"==typeof t)return z(j(t));if(t instanceof Uint8Array)return z(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?z(j(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?z(j(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?z(j(t.bytes)):z(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)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");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");let o=0;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!A.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return e})(t),w.xdr.ScVal.scvBytes(Buffer.from($(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},V=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return w.xdr.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return w.xdr.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function X(t,e,o){const r=t.controllerAddress??h(t.network),n=new w.Contract(r),u=new w.Account(t.caller,t.sourceSequence);return{xdr:new w.TransactionBuilder(u,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(n.call(e,...o)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function H(t,e){const o=e.accountNonce??0,r=e.eModeCategory??0,n=N([...e.assets]);return X(t,"supply",[x(t.caller),P(o),k(r),n])}function W(t,e){return H(t,{accountNonce:e.accountNonce,eModeCategory:e.eModeCategory,assets:[{token:e.token,amount:e.amount}]})}function F(t,e){const o=N([...e.borrows]);return X(t,"borrow",[x(t.caller),P(e.accountNonce),o])}function Z(t,e){return F(t,{accountNonce:e.accountNonce,borrows:[{token:e.token,amount:e.amount}]})}function Q(t,e){const o=N([...e.withdrawals]);return X(t,"withdraw",[x(t.caller),P(e.accountNonce),o,B(e.to,x)])}function K(t,e){return Q(t,{accountNonce:e.accountNonce,withdrawals:[{token:e.token,amount:e.amount}]})}function J(t,e){const o=N([...e.payments]);return X(t,"repay",[x(t.caller),P(e.accountNonce),o])}function Y(t,e){return J(t,{accountNonce:e.accountNonce,payments:[{token:e.token,amount:e.amount}]})}function tt(t,e){const o=N(e.debtPayments.map((t=>({token:t.token,amount:t.amount}))));return X(t,"liquidate",[x(t.caller),P(e.accountNonce),o])}function et(t,e){return X(t,"flash_loan",[x(t.caller),x(e.asset),E(e.amount),x(e.receiver),V(e.data)])}function ot(t,e){const o=e.accountNonce??0;return X(t,"multiply",[x(t.caller),P(o),k(e.eModeCategory),x(e.collateralToken),E(e.debtToFlashLoan),x(e.debtToken),k(e.mode),G(e.steps),B(e.initialPayment,(t=>U(t.token,t.amount))),B(e.convertSwap,G)])}function rt(t,e){return X(t,"swap_debt",[x(t.caller),P(e.accountNonce),x(e.existingDebtToken),E(e.newDebtAmount),x(e.newDebtToken),G(e.steps)])}function nt(t,e){return X(t,"swap_collateral",[x(t.caller),P(e.accountNonce),x(e.currentCollateral),E(e.fromAmount),x(e.newCollateral),G(e.steps)])}function ut(t,e){return X(t,"repay_debt_with_collateral",[x(t.caller),P(e.accountNonce),x(e.collateralToken),E(e.collateralAmount),x(e.debtToken),G(e.steps),M(e.closePosition)])}const it={Single:0,PrimaryWithAnchor:1},at=t=>D({base_borrow_rate_ray:E(t.baseBorrowRateRay),max_borrow_rate_ray:E(t.maxBorrowRateRay),max_utilization_ray:E(t.maxUtilizationRay),mid_utilization_ray:E(t.midUtilizationRay),optimal_utilization_ray:E(t.optimalUtilizationRay),reserve_factor_bps:k(t.reserveFactorBps),slope1_ray:E(t.slope1Ray),slope2_ray:E(t.slope2Ray),slope3_ray:E(t.slope3Ray)}),st=t=>D({asset_decimals:k(t.assetDecimals),asset_id:x(t.assetId),base_borrow_rate_ray:E(t.baseBorrowRateRay),max_borrow_rate_ray:E(t.maxBorrowRateRay),max_utilization_ray:E(t.maxUtilizationRay),mid_utilization_ray:E(t.midUtilizationRay),optimal_utilization_ray:E(t.optimalUtilizationRay),reserve_factor_bps:k(t.reserveFactorBps),slope1_ray:E(t.slope1Ray),slope2_ray:E(t.slope2Ray),slope3_ray:E(t.slope3Ray)}),pt=t=>D({borrow_cap:E(t.borrowCap),e_mode_categories:C(t.eModeCategories.map((t=>k(t)))),flashloan_fee_bps:k(t.flashloanFeeBps),is_borrowable:M(t.isBorrowable),is_collateralizable:M(t.isCollateralizable),is_flashloanable:M(t.isFlashloanable),liquidation_bonus_bps:k(t.liquidationBonusBps),liquidation_fees_bps:k(t.liquidationFeesBps),liquidation_threshold_bps:k(t.liquidationThresholdBps),loan_to_value_bps:k(t.loanToValueBps),supply_cap:E(t.supplyCap)}),lt=t=>D({max_borrow_positions:k(t.maxBorrowPositions),max_supply_positions:k(t.maxSupplyPositions)}),dt=t=>{const e=t.kind;switch(e){case"Stellar":return C([R("Stellar"),x(t.value)]);case"Symbol":return C([R("Symbol"),R(t.value)]);case"String":return C([R("String"),O(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},ct=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return C([R("Twap"),k(e)])}return C([R("Spot")])},yt=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return C([R("Reflector"),D({asset:dt(t.asset),contract:x(t.contract),read_mode:ct(t.readMode,t.twapRecords)})])}if("RedStonePriceFeed"===e){if("string"!=typeof t.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof t.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return C([R("RedStone"),D({contract:x(t.contract),feed_id:O(t.feedId),max_stale_seconds:P(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},ft=t=>{const e=it[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return D({anchor:(o=t.anchor,C(null==o?[R("None")]:[R("Some"),yt(o)])),first_tolerance_bps:k(t.firstToleranceBps),last_tolerance_bps:k(t.lastToleranceBps),max_price_stale_seconds:P(t.maxPriceStaleSeconds),max_sanity_price_wad:E(t.maxSanityPriceWad),min_sanity_price_wad:E(t.minSanityPriceWad),primary:yt(t.primary),strategy:k(e)});var o};function bt(t,e){return X(t,"upgrade",[L(e.wasmHash)])}function _t(t,e){return X(t,"migrate",[k(e.newVersion)])}function gt(t){return X(t,"pause",[])}function mt(t){return X(t,"unpause",[])}function qt(t,e){return X(t,"grant_role",[x(e.account),R(e.role)])}function St(t,e){return X(t,"revoke_role",[x(e.account),R(e.role)])}function ht(t,e){return X(t,"transfer_ownership",[x(e.newOwner),k(e.liveUntilLedger)])}function vt(t){return X(t,"accept_ownership",[])}function Tt(t,e){return X(t,"set_aggregator",[x(e.aggregator)])}function wt(t,e){return X(t,"set_accumulator",[x(e.accumulator)])}function At(t,e){return X(t,"set_liquidity_pool_template",[L(e.wasmHash)])}function xt(t,e){return X(t,"edit_asset_config",[x(e.asset),pt(e.config)])}function Et(t,e){return X(t,"set_position_limits",[lt(e)])}function kt(t){return X(t,"add_e_mode_category",[])}function Pt(t,e){return X(t,"remove_e_mode_category",[k(e.id)])}function Mt(t,e){return X(t,"add_asset_to_e_mode_category",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)])}function Ot(t,e){return X(t,"edit_asset_in_e_mode_category",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)])}function Rt(t,e){return X(t,"remove_asset_from_e_mode",[x(e.asset),k(e.categoryId)])}function It(t,e){return X(t,"approve_token",[x(e.token)])}function Ct(t,e){return X(t,"revoke_token",[x(e.token)])}function Lt(t,e){return X(t,"configure_market_oracle",[x(t.caller),x(e.asset),ft(e.config)])}function Bt(t,e){return X(t,"edit_oracle_tolerance",[x(t.caller),x(e.asset),k(e.firstTolerance),k(e.lastTolerance)])}function Ut(t,e){return X(t,"disable_token_oracle",[x(t.caller),x(e.asset)])}function Nt(t,e){return X(t,"update_indexes",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Dt(t,e){return X(t,"renew_account",[x(t.caller),P(e.accountNonce)])}function $t(t,e){return X(t,"create_liquidity_pool",[x(e.asset),st(e.params),pt(e.config)])}function zt(t,e){return X(t,"upgrade_liquidity_pool_params",[x(e.asset),at(e.params)])}function jt(t,e){return X(t,"upgrade_liquidity_pool",[x(e.asset),L(e.wasmHash)])}function Gt(t,e){return X(t,"claim_revenue",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Vt(t,e){return X(t,"add_rewards",[x(t.caller),C(e.rewards.map((t=>C([x(t.token),E(t.amount)]))))])}function Xt(t,e){return X(t,"update_account_threshold",[x(t.caller),x(e.asset),M(e.hasRisks),C(e.accountNonces.map((t=>P(t))))])}const Ht="00".repeat(32),Wt=t=>{if("string"==typeof t)return L(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return w.xdr.ScVal.scvBytes(e)};function Ft(t,e,o){const r=t.governanceAddress??T(t.network),n=new w.Contract(r),u=new w.Account(t.caller,t.sourceSequence);return{xdr:new w.TransactionBuilder(u,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(n.call(e,...o)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const Zt=(t,e,o,r)=>Ft(t,e,[x(t.caller),...o,Wt(r)]),Qt=(t,e,o,r)=>Ft(t,e,[I(),...o,Wt(r)]);function Kt(t,e,o){return Zt(t,"propose_set_aggregator",[x(e.aggregator)],o)}function Jt(t,e,o){return Zt(t,"propose_set_accumulator",[x(e.accumulator)],o)}function Yt(t,e,o){return Zt(t,"propose_set_pool_template",[L(e.wasmHash)],o)}function te(t,e,o){return Zt(t,"propose_edit_asset_config",[x(e.asset),pt(e.config)],o)}function ee(t,e,o){return Zt(t,"propose_set_position_limits",[lt(e)],o)}function oe(t,e,o){return Zt(t,"propose_set_min_borrow_collat",[E(e.floorWad)],o)}function re(t,e){return Zt(t,"propose_add_e_mode_category",[],e)}function ne(t,e,o){return Zt(t,"propose_remove_e_mode_category",[k(e.id)],o)}function ue(t,e,o){return Zt(t,"propose_add_asset_to_e_mode",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)],o)}function ie(t,e,o){return Zt(t,"propose_edit_asset_in_e_mode",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)],o)}function ae(t,e,o){return Zt(t,"propose_remove_asset_from_e_mode",[x(e.asset),k(e.categoryId)],o)}function se(t,e,o){return Zt(t,"propose_approve_token",[x(e.token)],o)}function pe(t,e,o){return Zt(t,"propose_revoke_token",[x(e.token)],o)}function le(t,e,o){return Zt(t,"propose_create_liquidity_pool",[x(e.asset),st(e.params),pt(e.config)],o)}function de(t,e,o){return Zt(t,"propose_upgrade_pool_params",[x(e.asset),at(e.params)],o)}function ce(t,e){return Zt(t,"propose_deploy_pool",[],e)}function ye(t,e,o){return Zt(t,"propose_upgrade_pool",[L(e.wasmHash)],o)}function fe(t,e,o){return Zt(t,"propose_grant_controller_role",[x(e.account),R(e.role)],o)}function be(t,e,o){return Zt(t,"propose_revoke_controller_role",[x(e.account),R(e.role)],o)}function _e(t,e,o){return Zt(t,"propose_upgrade_controller",[L(e.wasmHash)],o)}function ge(t,e,o){return Zt(t,"propose_migrate_controller",[k(e.newVersion)],o)}function me(t,e,o){return Zt(t,"propose_transfer_ctrl_ownership",[x(e.newOwner),k(e.liveUntilLedger)],o)}function qe(t,e,o){return Zt(t,"propose_configure_market_oracle",[x(e.asset),ft(e.config)],o)}function Se(t,e,o){return Zt(t,"propose_edit_oracle_tolerance",[x(e.asset),k(e.firstTolerance),k(e.lastTolerance)],o)}function he(t,e,o){return Zt(t,"propose_governance_upgrade",[L(e.wasmHash)],o)}function ve(t,e,o){return Zt(t,"propose_update_delay",[k(e.newDelay)],o)}function Te(t,e,o){return Zt(t,"propose_grant_governance_role",[x(e.account),R(e.role)],o)}function we(t,e,o){return Zt(t,"propose_revoke_governance_role",[x(e.account),R(e.role)],o)}function Ae(t,e,o){return Zt(t,"propose_transfer_gov_own",[x(e.newOwner),k(e.liveUntilLedger)],o)}function xe(t,e){const o=C(e.argsXdr.map((t=>w.xdr.ScVal.fromXDR(t,"base64")))),r=Wt(e.predecessor??Ht);return Ft(t,"execute",[I(),x(e.target),R(e.functionName),o,r,Wt(e.salt)])}function Ee(t,e,o){return Qt(t,"execute_governance_upgrade",[L(e.wasmHash)],o)}function ke(t,e,o){return Qt(t,"execute_update_delay",[k(e.newDelay)],o)}function Pe(t,e,o){return Qt(t,"execute_grant_governance_role",[x(e.account),R(e.role)],o)}function Me(t,e,o){return Qt(t,"execute_revoke_governance_role",[x(e.account),R(e.role)],o)}function Oe(t,e,o){return Qt(t,"execute_transfer_gov_own",[x(e.newOwner),k(e.liveUntilLedger)],o)}const Re=t=>t.toXDR("base64"),Ie=t=>w.xdr.ScVal.fromXDR(t,"base64"),Ce=t=>t.map((t=>String((0,w.scValToNative)(Ie(t))))).join(":"),Le=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Be=t=>Number(t),Ue=t=>String(t),Ne=t=>null==t?void 0:Le(t),De=t=>null==t?void 0:Ue(t),$e=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),ze=["None","Multiply","Long","Short"],je=["Single","PrimaryWithAnchor"],Ge=["ReflectorSep40","RedStonePriceFeed"],Ve=["Spot","Twap"],Xe=["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"],He=t=>Array.isArray(t)?t:[],We=t=>({loanToValueBps:Be(t.loan_to_value_bps),liquidationThresholdBps:Be(t.liquidation_threshold_bps),liquidationBonusBps:Be(t.liquidation_bonus_bps),liquidationFeesBps:Be(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:Be(t.flashloan_fee_bps),borrowCap:Le(t.borrow_cap),supplyCap:Le(t.supply_cap),eModeCategories:(t.e_mode_categories??[]).map(Be)}),Fe=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Xe[Be(r)]??Le(r)),positionType:e,asset:Ue(t[1]),scaledAmountRay:Le(t[2]),indexRay:Le(t[3]),amount:Le(t[4]),liquidationThresholdBps:o?void 0:Be(t[5]),liquidationBonusBps:o?void 0:Be(t[6]),loanToValueBps:o?void 0:Be(t[7])};var r},Ze=t=>{return{owner:Ue(t[0]),eModeCategoryId:Be(t[1]),mode:(e=t[2],ze[Be(e)]??"None")};var e},Qe=(t,e)=>{const o=Ve[Be(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:Ue(r)}:null!=n?{kind:"Symbol",value:Ue(n)}:void 0;return{provider:Ge[Be(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:Ue(t[`${e}_contract`]),asset:u,feedId:De(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Be(t[`${e}_twap_records`]):void 0,decimals:Be(t[`${e}_decimals`]),resolutionSeconds:Be(t[`${e}_resolution_seconds`]),maxStaleSeconds:Be(t[`${e}_max_stale_seconds`])}},Ke=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:Ue(t.base_token_id),quoteTokenId:Ue(t.quote_token_id),tolerance:{firstUpperRatio:Be(t.first_upper_ratio_bps??t.tolerance?.first_upper_ratio_bps),firstLowerRatio:Be(t.first_lower_ratio_bps??t.tolerance?.first_lower_ratio_bps),lastUpperRatio:Be(t.last_upper_ratio_bps??t.tolerance?.last_upper_ratio_bps),lastLowerRatio:Be(t.last_lower_ratio_bps??t.tolerance?.last_lower_ratio_bps)},assetDecimals:Be(t.asset_decimals),maxPriceStaleSeconds:Be(t.max_price_stale_seconds),strategy:je[Be(t.strategy)]??"Single",primary:Qe(t,"primary"),anchor:e?Qe(t,"anchor"):void 0,primaryQuoteToken:De(t.primary_quote_token),anchorQuoteToken:De(t.anchor_quote_token),minSanityPriceWad:Ne(t.min_sanity_price_wad),maxSanityPriceWad:Ne(t.max_sanity_price_wad)}},Je={"market:create":t=>({topic:"market:create",data:{baseAsset:Ue(t.base_asset),maxBorrowRate:Le(t.max_borrow_rate),baseBorrowRate:Le(t.base_borrow_rate),slope1:Le(t.slope1),slope2:Le(t.slope2),slope3:Le(t.slope3),midUtilization:Le(t.mid_utilization),optimalUtilization:Le(t.optimal_utilization),maxUtilization:Ne(t.max_utilization),reserveFactor:Be(t.reserve_factor),marketAddress:Ue(t.market_address),config:We(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Ue(t.asset),maxBorrowRateRay:Le(t.max_borrow_rate_ray),baseBorrowRateRay:Le(t.base_borrow_rate_ray),slope1Ray:Le(t.slope1_ray),slope2Ray:Le(t.slope2_ray),slope3Ray:Le(t.slope3_ray),midUtilizationRay:Le(t.mid_utilization_ray),optimalUtilizationRay:Le(t.optimal_utilization_ray),maxUtilizationRay:Ne(t.max_utilization_ray),reserveFactorBps:Be(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:He(t).map((t=>{return e=He(t),{asset:Ue(e[0]),timestamp:Be(e[1]),supplyIndexRay:Le(e[2]),borrowIndexRay:Le(e[3]),reservesRay:Le(e[4]),suppliedRay:Le(e[5]),borrowedRay:Le(e[6]),revenueRay:Le(e[7]),assetPriceWad:Ne(e[8])};var e}))}}),"position:batch_update":t=>{const e=He(t);return{topic:"position:batch_update",data:{accountId:Le(e[0]),accountAttributes:Ze(He(e[1])),updates:[...He(e[2]).map((t=>Fe(He(t),"Deposit"))),...He(e[3]).map((t=>Fe(He(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:Ue(t.asset),receiver:Ue(t.receiver),caller:Ue(t.caller),amount:Le(t.amount),fee:Le(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:Ue(t.asset),config:We(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Ue(t.asset),oracle:Ke(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:Be(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:Ue(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:Be(t.config.loan_to_value_bps),liquidationThresholdBps:Be(t.config.liquidation_threshold_bps),liquidationBonusBps:Be(t.config.liquidation_bonus_bps)},categoryId:Be(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:Ue(t.asset),categoryId:Be(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Le(t.account_id),totalBorrowUsdWad:Le(t.total_borrow_usd_wad),totalCollateralUsdWad:Le(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Ue(t.token),amount:Le(t.amount),usdValueWad:Le(t.usd_value_wad),accountId:Le(t.account_id)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:$e(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Ue(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Ue(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:$e(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Be(t.max_supply_positions),maxBorrowPositions:Be(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Ue(t.asset)}}),"oracle:twap_degraded":t=>({topic:"oracle:twap_degraded",data:{oracle:Ue(t.oracle),reasonCode:Be(t.reason_code)}})},Ye=Object.freeze(Object.keys(Je));function to(t,e){const o=Ce(t),r=Je[o];return r?r((0,w.scValToNative)(Ie(e))):null}const eo="XLENDXLM-a7c9f3",oo=1e4;function ro(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${eo}-${o}`}function no(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function uo(t,e=0){return t*oo+e}function io(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const ao=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},so=t=>t.baseUrl??q[t.network];async function po(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=ao(so(e),"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,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function lo(t){const e=ao(so(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const co=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,yo=t=>$(t).toXDR("base64");function fo(t,e){const o=t.routerAddress??v(t.network),r=new w.Contract(o),n=new w.Account(t.caller,t.sourceSequence),u=G(co(e,t.referralId));return{xdr:new w.TransactionBuilder(n,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(r.call("execute_strategy",x(t.caller),E(t.totalIn),u)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function bo(t,e){return fo(t,e)}function _o(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(qo),splitPpm:t.splitPpm}))):[{hops:t.hops.map(qo),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function go(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:_o(t,e)}const mo=_o,qo=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function So(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function ho(t,e,o){const r=w.TransactionBuilder.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw So(o.invokedContractId,t);throw t}}async function vo(t,e,o){return ho(t,e.xdr,o)}function To(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 wo(t,e){return{paths:[{hops:[{amountOut:"0",pool:t,tokenIn:t,tokenOut:t,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:t,tokenOut:t,totalMinOut:e}}const Ao=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 Buffer.from(e,"hex")};function xo(t){const e=new w.Account(t.caller,t.sourceSequence),o=new w.Contract(t.forwarderAddress).call("mint_and_forward",w.xdr.ScVal.scvBytes(Ao(t.message)),w.xdr.ScVal.scvBytes(Ao(t.attestation)));return{xdr:new w.TransactionBuilder(e,{fee:t.fee??"10000000",networkPassphrase:S[t.network]}).addOperation(o).setTimeout(t.timeoutSeconds??120).build().toXDR()}}const Eo=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),ko=()=>({static:{},params:{},leaves:[]});function Po(t,e,o,r){const{input:n,output:u,...i}=e,a=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),a=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),p=/:address[^A-Z]/.test(t)||"address"in a,y=/:collection[^A-Z]/.test(t)||"collection"in a;if(p){const t=n.address;if(!c(t))throw new d(t)}if(y){const t=n.collection;if(Array.isArray(t)?t.some((t=>!s(t))):!s(t))throw new l(t)}const f=Object.fromEntries(Object.entries(a).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:b,auth:_,method:g,headers:m,cache:q,next:S,debug:h,continuationToken:v,...T}=f,w=_?`Bearer ${_}`:void 0,A={...m,...w?{Authorization:w}:{},...v?{"X-Continuation-Token":String(v)}:{}},x={...S,tags:[...S?.tags??[],u]};return r.fetchWithTimeout(u,{method:g,params:T,body:b,headers:A,cache:q,debug:h,...x?{next:x}:{}})},p=(t={})=>a(t);for(const t of Object.keys(i))f.includes(t)&&(p[t]=e=>a({...e,method:e.method??t.toUpperCase()}));return p}function Mo(t){const e=function(){const t=ko();for(const[e,o]of Object.entries(y)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=Eo(t.slice(1));n=n.params[e]||=ko()}else{const e=Eo(t);n=n.static[e]||=ko()}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let a;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];a=Po(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[Eo(o.split("/").pop().replace(/^:/,""))]=Po(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===a[t]?a[t]=u:"function"==typeof a[t]?Object.assign(a[t],u):"function"==typeof u?(Object.assign(u,a[t]),a[t]=u):Object.assign(a[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(a[t]){const o=a[t];a[t]=t=>({...o(t),...e(t)})}else a[t]=e}return a};return o(e,{})}module.exports=e})();
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var t={d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Chain:()=>i,STELLAR_AGGREGATOR_ROUTER:()=>_,STELLAR_GOVERNANCE:()=>g,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ht,STELLAR_LENDING_CONTROLLER:()=>b,STELLAR_LENDING_TOPICS:()=>Ye,STELLAR_NETWORK_PASSPHRASE:()=>S,STELLAR_QUOTE_URL:()=>q,STELLAR_SOROBAN_RPC_URL:()=>m,SYNTHETIC_EVENT_ORDER_STRIDE:()=>oo,XOXNOClient:()=>a,XOXNO_LENDING_STELLAR_TICKER:()=>eo,buildSameTokenRepaySwapSteps:()=>wo,buildSdk:()=>Mo,buildStellarAcceptOwnershipTx:()=>vt,buildStellarAddAssetToEModeCategoryTx:()=>Mt,buildStellarAddEModeCategoryTx:()=>kt,buildStellarAddRewardsTx:()=>Vt,buildStellarApproveTokenTx:()=>It,buildStellarBatchSwapTx:()=>bo,buildStellarBorrowBatchTx:()=>F,buildStellarBorrowTx:()=>Z,buildStellarCctpForwardTx:()=>xo,buildStellarClaimRevenueTx:()=>Gt,buildStellarConfigureMarketOracleTx:()=>Lt,buildStellarCreateLiquidityPoolTx:()=>$t,buildStellarDisableTokenOracleTx:()=>Ut,buildStellarEditAssetConfigTx:()=>xt,buildStellarEditAssetInEModeCategoryTx:()=>Ot,buildStellarEditOracleToleranceTx:()=>Bt,buildStellarExecuteStrategyTx:()=>fo,buildStellarFlashLoanTx:()=>et,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Ee,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Pe,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Me,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Oe,buildStellarGovernanceExecuteTx:()=>xe,buildStellarGovernanceExecuteUpdateDelayTx:()=>ke,buildStellarGrantRoleTx:()=>qt,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>tt,buildStellarMigrateTx:()=>_t,buildStellarMultiplyTx:()=>ot,buildStellarPauseTx:()=>gt,buildStellarProposeAddAssetToEModeTx:()=>ue,buildStellarProposeAddEModeCategoryTx:()=>re,buildStellarProposeApproveTokenTx:()=>se,buildStellarProposeConfigureMarketOracleTx:()=>qe,buildStellarProposeCreateLiquidityPoolTx:()=>le,buildStellarProposeDeployPoolTx:()=>ce,buildStellarProposeEditAssetConfigTx:()=>te,buildStellarProposeEditAssetInEModeTx:()=>ie,buildStellarProposeEditOracleToleranceTx:()=>Se,buildStellarProposeGovernanceUpgradeTx:()=>he,buildStellarProposeGrantControllerRoleTx:()=>fe,buildStellarProposeGrantGovernanceRoleTx:()=>Te,buildStellarProposeMigrateControllerTx:()=>ge,buildStellarProposeRemoveAssetFromEModeTx:()=>ae,buildStellarProposeRemoveEModeCategoryTx:()=>ne,buildStellarProposeRevokeControllerRoleTx:()=>be,buildStellarProposeRevokeGovernanceRoleTx:()=>we,buildStellarProposeRevokeTokenTx:()=>pe,buildStellarProposeSetAccumulatorTx:()=>Jt,buildStellarProposeSetAggregatorTx:()=>Kt,buildStellarProposeSetMinBorrowCollatTx:()=>oe,buildStellarProposeSetPoolTemplateTx:()=>Yt,buildStellarProposeSetPositionLimitsTx:()=>ee,buildStellarProposeTransferCtrlOwnershipTx:()=>me,buildStellarProposeTransferGovOwnTx:()=>Ae,buildStellarProposeUpdateDelayTx:()=>ve,buildStellarProposeUpgradeControllerTx:()=>_e,buildStellarProposeUpgradePoolParamsTx:()=>de,buildStellarProposeUpgradePoolTx:()=>ye,buildStellarRemoveAssetFromEModeTx:()=>Rt,buildStellarRemoveEModeCategoryTx:()=>Pt,buildStellarRenewAccountTx:()=>Dt,buildStellarRepayBatchTx:()=>J,buildStellarRepayDebtWithCollateralTx:()=>ut,buildStellarRepayTx:()=>Y,buildStellarRevokeRoleTx:()=>St,buildStellarRevokeTokenTx:()=>Ct,buildStellarSetAccumulatorTx:()=>wt,buildStellarSetAggregatorTx:()=>Tt,buildStellarSetLiquidityPoolTemplateTx:()=>At,buildStellarSetPositionLimitsTx:()=>Et,buildStellarSupplyBatchTx:()=>H,buildStellarSupplyTx:()=>W,buildStellarSwapCollateralTx:()=>nt,buildStellarSwapDebtTx:()=>rt,buildStellarTransferOwnershipTx:()=>ht,buildStellarUnpauseTx:()=>mt,buildStellarUpdateAccountThresholdTx:()=>Xt,buildStellarUpdateIndexesTx:()=>Nt,buildStellarUpgradeControllerTx:()=>bt,buildStellarUpgradeLiquidityPoolParamsTx:()=>zt,buildStellarUpgradeLiquidityPoolTx:()=>jt,buildStellarWithdrawBatchTx:()=>Q,buildStellarWithdrawTx:()=>K,buildTx:()=>X,decodeStellarLendingEvent:()=>to,encodeAssetConfigRaw:()=>pt,encodeInterestRateModel:()=>at,encodeMarketOracleConfigInput:()=>ft,encodeMarketParamsRaw:()=>st,encodeOracleSourceConfigInput:()=>yt,encodePositionLimits:()=>lt,encodeStrategyPayloadToRouteXdr:()=>yo,extractEventOrder:()=>no,getStellarAggregatorQuote:()=>po,getStellarAggregatorRouter:()=>v,getStellarGovernance:()=>T,getStellarLendingController:()=>h,getStellarQuoteTokens:()=>lo,isValidCollectionTicker:()=>s,isValidNftIdentifier:()=>p,mapQuoteResponseToAggregatorSwap:()=>mo,mapQuoteResponseToStrategyPayload:()=>_o,mapQuoteResponseToStrategySwap:()=>go,mapStellarPositionActivityType:()=>io,prepareStellarBuiltTx:()=>vo,prepareStellarTxXdr:()=>ho,stellarLendingDispatchKey:()=>Ce,syntheticEventOrder:()=>uo,tagStellarInvokedContractError:()=>So,toBase64Xdr:()=>Re,toStellarPositionMode:()=>To});const o="https://api.xoxno.com",r="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",n="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",u="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var i;!function(t){t.MAINNET="1",t.DEVNET="D"}(i||(i={}));class a{apiUrl;chain;init;config;constructor({chain:t=i.MAINNET,apiUrl:e=o,...a}={}){this.apiUrl=e??{[i.MAINNET]:o,[i.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=a,this.config=t==i.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:r,DR_SC:n,KG_SC:u,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:r,DR_SC:n,KG_SC:u,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:a,cache:s,debug:p,headers:l,method:d="GET",...c}=o,y=l?.Authorization,f="Bearer undefined"===y?void 0:y,b={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...f?{Authorization:f}:{}},_=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${_.length?`?${_}`:""}`,{revalidate:m,...q}=r??{},{revalidate:S,...h}=a??{},v="GET"!==d||f?void 0:S??m,T="GET"!==d||f||v?void 0:s??n,w={...i,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:T,next:{...q,...h,revalidate:v}};(p??u)&&console.debug("SDK fetch: ",g,w);const A=await fetch(g,w).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${t.message}`),{cause:t});throw t})),x=await A.text();if(!A.ok){let t;try{t=JSON.parse(x)}catch{t={message:x}}const e=[g,A.status,A.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(x)}catch{return x}}}const s=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},p=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class l extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class d extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const c=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)||/^G[A-Z2-7]{55}$/.test(t)),y={"/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:{}},"/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/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/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:{}},"/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"}},"/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"}},"/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:{}}}},f=["PATCH","POST","DELETE","PUT"],b={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},_={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},g={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},m={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},q={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},S={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function h(t){const e=b[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function v(t){const e=_[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function T(t){const e=g[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const w=require("@stellar/stellar-sdk"),A=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],x=t=>new w.Address(t).toScVal(),E=t=>new w.ScInt(t).toI128(),k=t=>w.xdr.ScVal.scvU32(t),P=t=>new w.ScInt("string"==typeof t?t:t.toString()).toU64(),M=t=>w.xdr.ScVal.scvBool(t),O=t=>w.xdr.ScVal.scvString(t),R=t=>w.xdr.ScVal.scvSymbol(t),I=()=>w.xdr.ScVal.scvVoid(),C=t=>w.xdr.ScVal.scvVec(t),L=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return w.xdr.ScVal.scvBytes(r)},B=(t,e)=>null==t?I():e(t),U=(t,e)=>w.xdr.ScVal.scvVec([x(t),E(e)]),N=t=>w.xdr.ScVal.scvVec(t.map((t=>U(t.token,t.amount)))),D=t=>{const e=Object.keys(t).sort().map((e=>new w.xdr.ScMapEntry({key:R(e),val:t[e]})));return w.xdr.ScVal.scvMap(e)},$=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return D({amount_out:E(t.amountOut),pool:x(t.pool),token_in:x(t.tokenIn),token_out:x(t.tokenOut),venue:(e=t.venue,w.xdr.ScVal.scvVec([R(e)]))});var e}));return D({hops:w.xdr.ScVal.scvVec(e),split_ppm:k(t.splitPpm)})}));return D({paths:w.xdr.ScVal.scvVec(e),referral_id:P(t.referralId??0),token_in:x(t.tokenIn),token_out:x(t.tokenOut),total_min_out:E(t.totalMinOut)})},z=t=>{const e=Buffer.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 w.xdr.ScVal.scvBytes(e)},j=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},G=t=>{if("string"==typeof t)return z(j(t));if(t instanceof Uint8Array)return z(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?z(j(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?z(j(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?z(j(t.bytes)):z(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)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");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");let o=0;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!A.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return e})(t),w.xdr.ScVal.scvBytes(Buffer.from($(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},V=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return w.xdr.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return w.xdr.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function X(t,e,o){const r=t.controllerAddress??h(t.network),n=new w.Contract(r),u=new w.Account(t.caller,t.sourceSequence);return{xdr:new w.TransactionBuilder(u,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(n.call(e,...o)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function H(t,e){const o=e.accountNonce??0,r=e.eModeCategory??0,n=N([...e.assets]);return X(t,"supply",[x(t.caller),P(o),k(r),n])}function W(t,e){return H(t,{accountNonce:e.accountNonce,eModeCategory:e.eModeCategory,assets:[{token:e.token,amount:e.amount}]})}function F(t,e){const o=N([...e.borrows]);return X(t,"borrow",[x(t.caller),P(e.accountNonce),o])}function Z(t,e){return F(t,{accountNonce:e.accountNonce,borrows:[{token:e.token,amount:e.amount}]})}function Q(t,e){const o=N([...e.withdrawals]);return X(t,"withdraw",[x(t.caller),P(e.accountNonce),o,B(e.to,x)])}function K(t,e){return Q(t,{accountNonce:e.accountNonce,withdrawals:[{token:e.token,amount:e.amount}]})}function J(t,e){const o=N([...e.payments]);return X(t,"repay",[x(t.caller),P(e.accountNonce),o])}function Y(t,e){return J(t,{accountNonce:e.accountNonce,payments:[{token:e.token,amount:e.amount}]})}function tt(t,e){const o=N(e.debtPayments.map((t=>({token:t.token,amount:t.amount}))));return X(t,"liquidate",[x(t.caller),P(e.accountNonce),o])}function et(t,e){return X(t,"flash_loan",[x(t.caller),x(e.asset),E(e.amount),x(e.receiver),V(e.data)])}function ot(t,e){const o=e.accountNonce??0;return X(t,"multiply",[x(t.caller),P(o),k(e.eModeCategory),x(e.collateralToken),E(e.debtToFlashLoan),x(e.debtToken),k(e.mode),G(e.steps),B(e.initialPayment,(t=>U(t.token,t.amount))),B(e.convertSwap,G)])}function rt(t,e){return X(t,"swap_debt",[x(t.caller),P(e.accountNonce),x(e.existingDebtToken),E(e.newDebtAmount),x(e.newDebtToken),G(e.steps)])}function nt(t,e){return X(t,"swap_collateral",[x(t.caller),P(e.accountNonce),x(e.currentCollateral),E(e.fromAmount),x(e.newCollateral),G(e.steps)])}function ut(t,e){return X(t,"repay_debt_with_collateral",[x(t.caller),P(e.accountNonce),x(e.collateralToken),E(e.collateralAmount),x(e.debtToken),G(e.steps),M(e.closePosition)])}const it={Single:0,PrimaryWithAnchor:1},at=t=>D({base_borrow_rate_ray:E(t.baseBorrowRateRay),max_borrow_rate_ray:E(t.maxBorrowRateRay),max_utilization_ray:E(t.maxUtilizationRay),mid_utilization_ray:E(t.midUtilizationRay),optimal_utilization_ray:E(t.optimalUtilizationRay),reserve_factor_bps:k(t.reserveFactorBps),slope1_ray:E(t.slope1Ray),slope2_ray:E(t.slope2Ray),slope3_ray:E(t.slope3Ray)}),st=t=>D({asset_decimals:k(t.assetDecimals),asset_id:x(t.assetId),base_borrow_rate_ray:E(t.baseBorrowRateRay),max_borrow_rate_ray:E(t.maxBorrowRateRay),max_utilization_ray:E(t.maxUtilizationRay),mid_utilization_ray:E(t.midUtilizationRay),optimal_utilization_ray:E(t.optimalUtilizationRay),reserve_factor_bps:k(t.reserveFactorBps),slope1_ray:E(t.slope1Ray),slope2_ray:E(t.slope2Ray),slope3_ray:E(t.slope3Ray)}),pt=t=>D({borrow_cap:E(t.borrowCap),e_mode_categories:C(t.eModeCategories.map((t=>k(t)))),flashloan_fee_bps:k(t.flashloanFeeBps),is_borrowable:M(t.isBorrowable),is_collateralizable:M(t.isCollateralizable),is_flashloanable:M(t.isFlashloanable),liquidation_bonus_bps:k(t.liquidationBonusBps),liquidation_fees_bps:k(t.liquidationFeesBps),liquidation_threshold_bps:k(t.liquidationThresholdBps),loan_to_value_bps:k(t.loanToValueBps),supply_cap:E(t.supplyCap)}),lt=t=>D({max_borrow_positions:k(t.maxBorrowPositions),max_supply_positions:k(t.maxSupplyPositions)}),dt=t=>{const e=t.kind;switch(e){case"Stellar":return C([R("Stellar"),x(t.value)]);case"Symbol":return C([R("Symbol"),R(t.value)]);case"String":return C([R("String"),O(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},ct=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return C([R("Twap"),k(e)])}return C([R("Spot")])},yt=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return C([R("Reflector"),D({asset:dt(t.asset),contract:x(t.contract),read_mode:ct(t.readMode,t.twapRecords)})])}if("RedStonePriceFeed"===e){if("string"!=typeof t.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof t.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return C([R("RedStone"),D({contract:x(t.contract),feed_id:O(t.feedId),max_stale_seconds:P(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},ft=t=>{const e=it[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return D({anchor:(o=t.anchor,C(null==o?[R("None")]:[R("Some"),yt(o)])),first_tolerance_bps:k(t.firstToleranceBps),last_tolerance_bps:k(t.lastToleranceBps),max_price_stale_seconds:P(t.maxPriceStaleSeconds),max_sanity_price_wad:E(t.maxSanityPriceWad),min_sanity_price_wad:E(t.minSanityPriceWad),primary:yt(t.primary),strategy:k(e)});var o};function bt(t,e){return X(t,"upgrade",[L(e.wasmHash)])}function _t(t,e){return X(t,"migrate",[k(e.newVersion)])}function gt(t){return X(t,"pause",[])}function mt(t){return X(t,"unpause",[])}function qt(t,e){return X(t,"grant_role",[x(e.account),R(e.role)])}function St(t,e){return X(t,"revoke_role",[x(e.account),R(e.role)])}function ht(t,e){return X(t,"transfer_ownership",[x(e.newOwner),k(e.liveUntilLedger)])}function vt(t){return X(t,"accept_ownership",[])}function Tt(t,e){return X(t,"set_aggregator",[x(e.aggregator)])}function wt(t,e){return X(t,"set_accumulator",[x(e.accumulator)])}function At(t,e){return X(t,"set_liquidity_pool_template",[L(e.wasmHash)])}function xt(t,e){return X(t,"edit_asset_config",[x(e.asset),pt(e.config)])}function Et(t,e){return X(t,"set_position_limits",[lt(e)])}function kt(t){return X(t,"add_e_mode_category",[])}function Pt(t,e){return X(t,"remove_e_mode_category",[k(e.id)])}function Mt(t,e){return X(t,"add_asset_to_e_mode_category",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)])}function Ot(t,e){return X(t,"edit_asset_in_e_mode_category",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)])}function Rt(t,e){return X(t,"remove_asset_from_e_mode",[x(e.asset),k(e.categoryId)])}function It(t,e){return X(t,"approve_token",[x(e.token)])}function Ct(t,e){return X(t,"revoke_token",[x(e.token)])}function Lt(t,e){return X(t,"configure_market_oracle",[x(t.caller),x(e.asset),ft(e.config)])}function Bt(t,e){return X(t,"edit_oracle_tolerance",[x(t.caller),x(e.asset),k(e.firstTolerance),k(e.lastTolerance)])}function Ut(t,e){return X(t,"disable_token_oracle",[x(t.caller),x(e.asset)])}function Nt(t,e){return X(t,"update_indexes",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Dt(t,e){return X(t,"renew_account",[x(t.caller),P(e.accountNonce)])}function $t(t,e){return X(t,"create_liquidity_pool",[x(e.asset),st(e.params),pt(e.config)])}function zt(t,e){return X(t,"upgrade_liquidity_pool_params",[x(e.asset),at(e.params)])}function jt(t,e){return X(t,"upgrade_liquidity_pool",[x(e.asset),L(e.wasmHash)])}function Gt(t,e){return X(t,"claim_revenue",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Vt(t,e){return X(t,"add_rewards",[x(t.caller),C(e.rewards.map((t=>C([x(t.token),E(t.amount)]))))])}function Xt(t,e){return X(t,"update_account_threshold",[x(t.caller),x(e.asset),M(e.hasRisks),C(e.accountNonces.map((t=>P(t))))])}const Ht="00".repeat(32),Wt=t=>{if("string"==typeof t)return L(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return w.xdr.ScVal.scvBytes(e)};function Ft(t,e,o){const r=t.governanceAddress??T(t.network),n=new w.Contract(r),u=new w.Account(t.caller,t.sourceSequence);return{xdr:new w.TransactionBuilder(u,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(n.call(e,...o)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const Zt=(t,e,o,r)=>Ft(t,e,[x(t.caller),...o,Wt(r)]),Qt=(t,e,o,r)=>Ft(t,e,[I(),...o,Wt(r)]);function Kt(t,e,o){return Zt(t,"propose_set_aggregator",[x(e.aggregator)],o)}function Jt(t,e,o){return Zt(t,"propose_set_accumulator",[x(e.accumulator)],o)}function Yt(t,e,o){return Zt(t,"propose_set_pool_template",[L(e.wasmHash)],o)}function te(t,e,o){return Zt(t,"propose_edit_asset_config",[x(e.asset),pt(e.config)],o)}function ee(t,e,o){return Zt(t,"propose_set_position_limits",[lt(e)],o)}function oe(t,e,o){return Zt(t,"propose_set_min_borrow_collat",[E(e.floorWad)],o)}function re(t,e){return Zt(t,"propose_add_e_mode_category",[],e)}function ne(t,e,o){return Zt(t,"propose_remove_e_mode_category",[k(e.id)],o)}function ue(t,e,o){return Zt(t,"propose_add_asset_to_e_mode",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)],o)}function ie(t,e,o){return Zt(t,"propose_edit_asset_in_e_mode",[x(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus)],o)}function ae(t,e,o){return Zt(t,"propose_remove_asset_from_e_mode",[x(e.asset),k(e.categoryId)],o)}function se(t,e,o){return Zt(t,"propose_approve_token",[x(e.token)],o)}function pe(t,e,o){return Zt(t,"propose_revoke_token",[x(e.token)],o)}function le(t,e,o){return Zt(t,"propose_create_liquidity_pool",[x(e.asset),st(e.params),pt(e.config)],o)}function de(t,e,o){return Zt(t,"propose_upgrade_pool_params",[x(e.asset),at(e.params)],o)}function ce(t,e){return Zt(t,"propose_deploy_pool",[],e)}function ye(t,e,o){return Zt(t,"propose_upgrade_pool",[L(e.wasmHash)],o)}function fe(t,e,o){return Zt(t,"propose_grant_controller_role",[x(e.account),R(e.role)],o)}function be(t,e,o){return Zt(t,"propose_revoke_controller_role",[x(e.account),R(e.role)],o)}function _e(t,e,o){return Zt(t,"propose_upgrade_controller",[L(e.wasmHash)],o)}function ge(t,e,o){return Zt(t,"propose_migrate_controller",[k(e.newVersion)],o)}function me(t,e,o){return Zt(t,"propose_transfer_ctrl_ownership",[x(e.newOwner),k(e.liveUntilLedger)],o)}function qe(t,e,o){return Zt(t,"propose_configure_market_oracle",[x(e.asset),ft(e.config)],o)}function Se(t,e,o){return Zt(t,"propose_edit_oracle_tolerance",[x(e.asset),k(e.firstTolerance),k(e.lastTolerance)],o)}function he(t,e,o){return Zt(t,"propose_governance_upgrade",[L(e.wasmHash)],o)}function ve(t,e,o){return Zt(t,"propose_update_delay",[k(e.newDelay)],o)}function Te(t,e,o){return Zt(t,"propose_grant_governance_role",[x(e.account),R(e.role)],o)}function we(t,e,o){return Zt(t,"propose_revoke_governance_role",[x(e.account),R(e.role)],o)}function Ae(t,e,o){return Zt(t,"propose_transfer_gov_own",[x(e.newOwner),k(e.liveUntilLedger)],o)}function xe(t,e){const o=C(e.argsXdr.map((t=>w.xdr.ScVal.fromXDR(t,"base64")))),r=Wt(e.predecessor??Ht);return Ft(t,"execute",[I(),x(e.target),R(e.functionName),o,r,Wt(e.salt)])}function Ee(t,e,o){return Qt(t,"execute_governance_upgrade",[L(e.wasmHash)],o)}function ke(t,e,o){return Qt(t,"execute_update_delay",[k(e.newDelay)],o)}function Pe(t,e,o){return Qt(t,"execute_grant_governance_role",[x(e.account),R(e.role)],o)}function Me(t,e,o){return Qt(t,"execute_revoke_governance_role",[x(e.account),R(e.role)],o)}function Oe(t,e,o){return Qt(t,"execute_transfer_gov_own",[x(e.newOwner),k(e.liveUntilLedger)],o)}const Re=t=>t.toXDR("base64"),Ie=t=>w.xdr.ScVal.fromXDR(t,"base64"),Ce=t=>t.map((t=>String((0,w.scValToNative)(Ie(t))))).join(":"),Le=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Be=t=>Number(t),Ue=t=>String(t),Ne=t=>null==t?void 0:Le(t),De=t=>null==t?void 0:Ue(t),$e=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),ze=["None","Multiply","Long","Short"],je=["Single","PrimaryWithAnchor"],Ge=["ReflectorSep40","RedStonePriceFeed"],Ve=["Spot","Twap"],Xe=["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"],He=t=>Array.isArray(t)?t:[],We=t=>({loanToValueBps:Be(t.loan_to_value_bps),liquidationThresholdBps:Be(t.liquidation_threshold_bps),liquidationBonusBps:Be(t.liquidation_bonus_bps),liquidationFeesBps:Be(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:Be(t.flashloan_fee_bps),borrowCap:Le(t.borrow_cap),supplyCap:Le(t.supply_cap),eModeCategories:(t.e_mode_categories??[]).map(Be)}),Fe=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Xe[Be(r)]??Le(r)),positionType:e,asset:Ue(t[1]),scaledAmountRay:Le(t[2]),indexRay:Le(t[3]),amount:Le(t[4]),liquidationThresholdBps:o?void 0:Be(t[5]),liquidationBonusBps:o?void 0:Be(t[6]),loanToValueBps:o?void 0:Be(t[7])};var r},Ze=t=>{return{owner:Ue(t[0]),eModeCategoryId:Be(t[1]),mode:(e=t[2],ze[Be(e)]??"None")};var e},Qe=(t,e)=>{const o=Ve[Be(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:Ue(r)}:null!=n?{kind:"Symbol",value:Ue(n)}:void 0;return{provider:Ge[Be(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:Ue(t[`${e}_contract`]),asset:u,feedId:De(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Be(t[`${e}_twap_records`]):void 0,decimals:Be(t[`${e}_decimals`]),resolutionSeconds:Be(t[`${e}_resolution_seconds`]),maxStaleSeconds:Be(t[`${e}_max_stale_seconds`])}},Ke=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:Ue(t.base_token_id),quoteTokenId:Ue(t.quote_token_id),tolerance:{firstUpperRatio:Be(t.first_upper_ratio_bps??t.tolerance?.first_upper_ratio_bps),firstLowerRatio:Be(t.first_lower_ratio_bps??t.tolerance?.first_lower_ratio_bps),lastUpperRatio:Be(t.last_upper_ratio_bps??t.tolerance?.last_upper_ratio_bps),lastLowerRatio:Be(t.last_lower_ratio_bps??t.tolerance?.last_lower_ratio_bps)},assetDecimals:Be(t.asset_decimals),maxPriceStaleSeconds:Be(t.max_price_stale_seconds),strategy:je[Be(t.strategy)]??"Single",primary:Qe(t,"primary"),anchor:e?Qe(t,"anchor"):void 0,primaryQuoteToken:De(t.primary_quote_token),anchorQuoteToken:De(t.anchor_quote_token),minSanityPriceWad:Ne(t.min_sanity_price_wad),maxSanityPriceWad:Ne(t.max_sanity_price_wad)}},Je={"market:create":t=>({topic:"market:create",data:{baseAsset:Ue(t.base_asset),maxBorrowRate:Le(t.max_borrow_rate),baseBorrowRate:Le(t.base_borrow_rate),slope1:Le(t.slope1),slope2:Le(t.slope2),slope3:Le(t.slope3),midUtilization:Le(t.mid_utilization),optimalUtilization:Le(t.optimal_utilization),maxUtilization:Ne(t.max_utilization),reserveFactor:Be(t.reserve_factor),marketAddress:Ue(t.market_address),config:We(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Ue(t.asset),maxBorrowRateRay:Le(t.max_borrow_rate_ray),baseBorrowRateRay:Le(t.base_borrow_rate_ray),slope1Ray:Le(t.slope1_ray),slope2Ray:Le(t.slope2_ray),slope3Ray:Le(t.slope3_ray),midUtilizationRay:Le(t.mid_utilization_ray),optimalUtilizationRay:Le(t.optimal_utilization_ray),maxUtilizationRay:Ne(t.max_utilization_ray),reserveFactorBps:Be(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:He(t).map((t=>{return e=He(t),{asset:Ue(e[0]),timestamp:Be(e[1]),supplyIndexRay:Le(e[2]),borrowIndexRay:Le(e[3]),reservesRay:Le(e[4]),suppliedRay:Le(e[5]),borrowedRay:Le(e[6]),revenueRay:Le(e[7]),assetPriceWad:Ne(e[8])};var e}))}}),"position:batch_update":t=>{const e=He(t);return{topic:"position:batch_update",data:{accountId:Le(e[0]),accountAttributes:Ze(He(e[1])),updates:[...He(e[2]).map((t=>Fe(He(t),"Deposit"))),...He(e[3]).map((t=>Fe(He(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:Ue(t.asset),receiver:Ue(t.receiver),caller:Ue(t.caller),amount:Le(t.amount),fee:Le(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:Ue(t.asset),config:We(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Ue(t.asset),oracle:Ke(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:Be(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:Ue(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:Be(t.config.loan_to_value_bps),liquidationThresholdBps:Be(t.config.liquidation_threshold_bps),liquidationBonusBps:Be(t.config.liquidation_bonus_bps)},categoryId:Be(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:Ue(t.asset),categoryId:Be(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Le(t.account_id),totalBorrowUsdWad:Le(t.total_borrow_usd_wad),totalCollateralUsdWad:Le(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Ue(t.token),amount:Le(t.amount),usdValueWad:Le(t.usd_value_wad),accountId:Le(t.account_id)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:$e(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Ue(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Ue(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:$e(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Be(t.max_supply_positions),maxBorrowPositions:Be(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Ue(t.asset)}}),"oracle:twap_degraded":t=>({topic:"oracle:twap_degraded",data:{oracle:Ue(t.oracle),reasonCode:Be(t.reason_code)}})},Ye=Object.freeze(Object.keys(Je));function to(t,e){const o=Ce(t),r=Je[o];return r?r((0,w.scValToNative)(Ie(e))):null}const eo="XLENDXLM-a7c9f3",oo=1e4;function ro(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${eo}-${o}`}function no(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function uo(t,e=0){return t*oo+e}function io(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const ao=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},so=t=>t.baseUrl??q[t.network];async function po(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=ao(so(e),"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,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function lo(t){const e=ao(so(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const co=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,yo=t=>$(t).toXDR("base64");function fo(t,e){const o=t.routerAddress??v(t.network),r=new w.Contract(o),n=new w.Account(t.caller,t.sourceSequence),u=G(co(e,t.referralId));return{xdr:new w.TransactionBuilder(n,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(r.call("execute_strategy",x(t.caller),E(t.totalIn),u)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function bo(t,e){return fo(t,e)}function _o(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(qo),splitPpm:t.splitPpm}))):[{hops:t.hops.map(qo),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function go(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:_o(t,e)}const mo=_o,qo=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function So(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function ho(t,e,o){const r=w.TransactionBuilder.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw So(o.invokedContractId,t);throw t}}async function vo(t,e,o){return ho(t,e.xdr,o)}function To(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 wo(t,e){return{paths:[{hops:[{amountOut:"0",pool:t,tokenIn:t,tokenOut:t,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:t,tokenOut:t,totalMinOut:e}}const Ao=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 Buffer.from(e,"hex")};function xo(t){const e=new w.Account(t.caller,t.sourceSequence),o=new w.Contract(t.forwarderAddress).call("mint_and_forward",w.xdr.ScVal.scvBytes(Ao(t.message)),w.xdr.ScVal.scvBytes(Ao(t.attestation)));return{xdr:new w.TransactionBuilder(e,{fee:t.fee??"10000000",networkPassphrase:S[t.network]}).addOperation(o).setTimeout(t.timeoutSeconds??120).build().toXDR()}}const Eo=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),ko=()=>({static:{},params:{},leaves:[]});function Po(t,e,o,r){const{input:n,output:u,...i}=e,a=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),a=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),p=/:address[^A-Z]/.test(t)||"address"in a,y=/:collection[^A-Z]/.test(t)||"collection"in a;if(p){const t=n.address;if(!c(t))throw new d(t)}if(y){const t=n.collection;if(Array.isArray(t)?t.some((t=>!s(t))):!s(t))throw new l(t)}const f=Object.fromEntries(Object.entries(a).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:b,auth:_,method:g,headers:m,cache:q,next:S,debug:h,continuationToken:v,...T}=f,w=_?`Bearer ${_}`:void 0,A={...m,...w?{Authorization:w}:{},...v?{"X-Continuation-Token":String(v)}:{}},x={...S,tags:[...S?.tags??[],u]};return r.fetchWithTimeout(u,{method:g,params:T,body:b,headers:A,cache:q,debug:h,...x?{next:x}:{}})},p=(t={})=>a(t);for(const t of Object.keys(i))f.includes(t)&&(p[t]=e=>a({...e,method:e.method??t.toUpperCase()}));return p}function Mo(t){const e=function(){const t=ko();for(const[e,o]of Object.entries(y)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=Eo(t.slice(1));n=n.params[e]||=ko()}else{const e=Eo(t);n=n.static[e]||=ko()}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let a;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];a=Po(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[Eo(o.split("/").pop().replace(/^:/,""))]=Po(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===a[t]?a[t]=u:"function"==typeof a[t]?Object.assign(a[t],u):"function"==typeof u?(Object.assign(u,a[t]),a[t]=u):Object.assign(a[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(a[t]){const o=a[t];a[t]=t=>({...o(t),...e(t)})}else a[t]=e}return a};return o(e,{})}module.exports=e})();
|