@xoxno/sdk-js 1.0.154 → 1.0.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk/stellar/governance.d.ts +64 -47
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/governance.d.ts +64 -47
- package/package.json +2 -2
|
@@ -4,18 +4,23 @@
|
|
|
4
4
|
* (`opts.governanceAddress`, or env via `getStellarGovernance(network)`).
|
|
5
5
|
*
|
|
6
6
|
* Flow:
|
|
7
|
-
* - An admin holding the PROPOSER role calls
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the operation id (`BytesN<32>`).
|
|
7
|
+
* - An admin holding the PROPOSER role calls the single `propose(proposer,
|
|
8
|
+
* op: AdminOperation, salt)` entrypoint. `proposer = opts.caller`; `op` is
|
|
9
|
+
* the serialized `AdminOperation` enum identifying the target setter and its
|
|
10
|
+
* args; `salt: BytesN<32>` is trailing. Validation runs at propose time and
|
|
11
|
+
* the call returns the operation id (`BytesN<32>`).
|
|
12
12
|
* - After the timelock delay, ANYONE executes. Controller-targeted ops go
|
|
13
13
|
* through the generic `execute(executor, target, function, args,
|
|
14
|
-
* predecessor, salt)`; governance-self ops go through
|
|
15
|
-
* Open execution passes `executor = None`
|
|
16
|
-
*
|
|
14
|
+
* predecessor, salt)`; governance-self ops go through `execute_self(executor,
|
|
15
|
+
* op: AdminOperation, salt)`. Open execution passes `executor = None`
|
|
16
|
+
* (Soroban `Option::None`, encoded as `scvVoid`).
|
|
17
17
|
* - `predecessor` is ALWAYS the 32-zero-byte `BytesN<32>` in this system.
|
|
18
18
|
*
|
|
19
|
+
* The on-chain scheduled `Operation` (target, function, args) is byte-identical
|
|
20
|
+
* to the pre-enum typed proposers, so the operation id, the generic `execute`
|
|
21
|
+
* path, and event indexing are unchanged. The `AdminOperation` enum only changes
|
|
22
|
+
* the `propose` / `execute_self` call encoding, which these builders own.
|
|
23
|
+
*
|
|
19
24
|
* Builders are RPC-free and deterministic (synthetic `Account(caller,
|
|
20
25
|
* sourceSequence)`), exactly like the lending / admin builders. The returned
|
|
21
26
|
* XDR still needs `rpc.Server.prepareTransaction` before signing.
|
|
@@ -42,84 +47,92 @@ export interface MigrateArgs {
|
|
|
42
47
|
export interface UpdateDelayArgs {
|
|
43
48
|
newDelay: number;
|
|
44
49
|
}
|
|
45
|
-
/**
|
|
50
|
+
/** propose(SetAggregator(addr)) */
|
|
46
51
|
export declare function buildStellarProposeSetAggregatorTx(opts: StellarBuilderOptions, args: {
|
|
47
52
|
aggregator: string;
|
|
48
53
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
49
|
-
/**
|
|
54
|
+
/** propose(SetAccumulator(addr)) */
|
|
50
55
|
export declare function buildStellarProposeSetAccumulatorTx(opts: StellarBuilderOptions, args: {
|
|
51
56
|
accumulator: string;
|
|
52
57
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
53
|
-
/**
|
|
58
|
+
/** propose(SetLiquidityPoolTemplate(hash)) */
|
|
54
59
|
export declare function buildStellarProposeSetPoolTemplateTx(opts: StellarBuilderOptions, args: {
|
|
55
60
|
wasmHash: string;
|
|
56
61
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
57
|
-
/**
|
|
62
|
+
/** propose(EditAssetConfig(asset, cfg)) */
|
|
58
63
|
export declare function buildStellarProposeEditAssetConfigTx(opts: StellarBuilderOptions, args: EditAssetConfigArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
59
|
-
/**
|
|
64
|
+
/** propose(SetPositionLimits(limits)) */
|
|
60
65
|
export declare function buildStellarProposeSetPositionLimitsTx(opts: StellarBuilderOptions, args: PositionLimitsDto, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
61
|
-
/**
|
|
66
|
+
/** propose(SetMinBorrowCollateralUsd(floor_wad)) */
|
|
62
67
|
export declare function buildStellarProposeSetMinBorrowCollatTx(opts: StellarBuilderOptions, args: {
|
|
63
68
|
floorWad: string;
|
|
64
69
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
65
|
-
/**
|
|
70
|
+
/** propose(AddEModeCategory) — risk params are per-asset */
|
|
66
71
|
export declare function buildStellarProposeAddEModeCategoryTx(opts: StellarBuilderOptions, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
67
|
-
/**
|
|
72
|
+
/** propose(RemoveEModeCategory(id)) */
|
|
68
73
|
export declare function buildStellarProposeRemoveEModeCategoryTx(opts: StellarBuilderOptions, args: RemoveEModeCategoryArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
69
|
-
/**
|
|
74
|
+
/** propose(AddAssetToEModeCategory(EModeAssetArgs)) */
|
|
70
75
|
export declare function buildStellarProposeAddAssetToEModeTx(opts: StellarBuilderOptions, args: EModeAssetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
71
|
-
/**
|
|
76
|
+
/** propose(EditAssetInEModeCategory(EModeAssetArgs)) */
|
|
72
77
|
export declare function buildStellarProposeEditAssetInEModeTx(opts: StellarBuilderOptions, args: EModeAssetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
73
|
-
/**
|
|
78
|
+
/** propose(UpdatePoolCaps(PoolCapsArgs)) */
|
|
74
79
|
export declare function buildStellarProposeUpdatePoolCapsTx(opts: StellarBuilderOptions, args: UpdatePoolCapsArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
75
|
-
/**
|
|
80
|
+
/** propose(RemoveAssetFromEMode(RemoveAssetFromEModeArgs)) */
|
|
76
81
|
export declare function buildStellarProposeRemoveAssetFromEModeTx(opts: StellarBuilderOptions, args: RemoveEModeAssetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
77
|
-
/**
|
|
82
|
+
/** propose(ApproveToken(token)) */
|
|
78
83
|
export declare function buildStellarProposeApproveTokenTx(opts: StellarBuilderOptions, args: {
|
|
79
84
|
token: string;
|
|
80
85
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
81
|
-
/**
|
|
86
|
+
/** propose(RevokeToken(token)) */
|
|
82
87
|
export declare function buildStellarProposeRevokeTokenTx(opts: StellarBuilderOptions, args: {
|
|
83
88
|
token: string;
|
|
84
89
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
85
|
-
/**
|
|
90
|
+
/** propose(ApproveBlendPool(pool)) */
|
|
91
|
+
export declare function buildStellarProposeApproveBlendPoolTx(opts: StellarBuilderOptions, args: {
|
|
92
|
+
pool: string;
|
|
93
|
+
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
94
|
+
/** propose(RevokeBlendPool(pool)) */
|
|
95
|
+
export declare function buildStellarProposeRevokeBlendPoolTx(opts: StellarBuilderOptions, args: {
|
|
96
|
+
pool: string;
|
|
97
|
+
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
98
|
+
/** propose(CreateLiquidityPool(CreatePoolArgs)) */
|
|
86
99
|
export declare function buildStellarProposeCreateLiquidityPoolTx(opts: StellarBuilderOptions, args: CreateLiquidityPoolArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
87
|
-
/**
|
|
100
|
+
/** propose(UpgradeLiquidityPoolParams(UpgradePoolParamsArgs)) */
|
|
88
101
|
export declare function buildStellarProposeUpgradePoolParamsTx(opts: StellarBuilderOptions, args: UpgradeLiquidityPoolParamsArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
89
|
-
/**
|
|
102
|
+
/** propose(DeployPool) */
|
|
90
103
|
export declare function buildStellarProposeDeployPoolTx(opts: StellarBuilderOptions, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
91
|
-
/**
|
|
104
|
+
/** propose(UpgradePool(hash)) */
|
|
92
105
|
export declare function buildStellarProposeUpgradePoolTx(opts: StellarBuilderOptions, args: {
|
|
93
106
|
wasmHash: string;
|
|
94
107
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
95
|
-
/**
|
|
96
|
-
export declare function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
108
|
+
/** propose(DisableTokenOracle(asset)) */
|
|
109
|
+
export declare function buildStellarProposeDisableTokenOracleTx(opts: StellarBuilderOptions, args: {
|
|
110
|
+
asset: string;
|
|
111
|
+
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
112
|
+
/** propose(UpgradeController(hash)) */
|
|
100
113
|
export declare function buildStellarProposeUpgradeControllerTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
101
|
-
/**
|
|
114
|
+
/** propose(MigrateController(new_version)) */
|
|
102
115
|
export declare function buildStellarProposeMigrateControllerTx(opts: StellarBuilderOptions, args: MigrateArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
103
|
-
/**
|
|
116
|
+
/** propose(TransferCtrlOwnership(TransferOwnershipArgs)) */
|
|
104
117
|
export declare function buildStellarProposeTransferCtrlOwnershipTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
105
118
|
/**
|
|
106
|
-
*
|
|
119
|
+
* propose(ConfigureMarketOracle(ConfigureOracleArgs))
|
|
107
120
|
*
|
|
108
121
|
* The SDK passes the oracle INPUT args verbatim; the contract resolves the
|
|
109
122
|
* input to a resolved config at propose time (do NOT resolve in the SDK).
|
|
110
123
|
*/
|
|
111
124
|
export declare function buildStellarProposeConfigureMarketOracleTx(opts: StellarBuilderOptions, args: ConfigureMarketOracleArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
112
|
-
/**
|
|
125
|
+
/** propose(EditOracleTolerance(EditToleranceArgs)) */
|
|
113
126
|
export declare function buildStellarProposeEditOracleToleranceTx(opts: StellarBuilderOptions, args: EditOracleToleranceArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
114
|
-
/**
|
|
127
|
+
/** propose(UpgradeGov(hash)) */
|
|
115
128
|
export declare function buildStellarProposeGovernanceUpgradeTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
116
|
-
/**
|
|
129
|
+
/** propose(UpdateGovDelay(new_delay)) */
|
|
117
130
|
export declare function buildStellarProposeUpdateDelayTx(opts: StellarBuilderOptions, args: UpdateDelayArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
118
|
-
/**
|
|
131
|
+
/** propose(GrantGovRole(RoleArgs)) */
|
|
119
132
|
export declare function buildStellarProposeGrantGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
120
|
-
/**
|
|
133
|
+
/** propose(RevokeGovRole(RoleArgs)) */
|
|
121
134
|
export declare function buildStellarProposeRevokeGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
122
|
-
/**
|
|
135
|
+
/** propose(TransferGovOwnership(TransferOwnershipArgs)) */
|
|
123
136
|
export declare function buildStellarProposeTransferGovOwnTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
124
137
|
export interface StellarGovernanceExecuteArgs {
|
|
125
138
|
/** Controller (or other) contract the scheduled op targets. */
|
|
@@ -128,8 +141,8 @@ export interface StellarGovernanceExecuteArgs {
|
|
|
128
141
|
functionName: string;
|
|
129
142
|
/**
|
|
130
143
|
* The controller-call args, each a base64 ScVal XDR string. These must be the
|
|
131
|
-
* SAME ScVals the matching
|
|
132
|
-
*
|
|
144
|
+
* SAME ScVals the matching proposal scheduled (the timelock hashes them into
|
|
145
|
+
* the op id), in the controller method's arg order. Reconstructed via
|
|
133
146
|
* `xdr.ScVal.fromXDR(s, 'base64')`.
|
|
134
147
|
*/
|
|
135
148
|
argsXdr: string[];
|
|
@@ -146,15 +159,19 @@ export interface StellarGovernanceExecuteArgs {
|
|
|
146
159
|
* controller-targeted op. `executor = None` (open execution), `target` is the
|
|
147
160
|
* controller `Address`, `function` is a `Symbol`, `args` is the `Vec<Val>`
|
|
148
161
|
* reconstructed from `argsXdr`, `predecessor` defaults to 32 zero bytes.
|
|
162
|
+
*
|
|
163
|
+
* Unchanged by the AdminOperation refactor: the scheduled `Operation` is
|
|
164
|
+
* byte-identical, so callers reconstruct `(target, function, argsXdr)` from the
|
|
165
|
+
* indexed proposal exactly as before.
|
|
149
166
|
*/
|
|
150
167
|
export declare function buildStellarGovernanceExecuteTx(opts: StellarBuilderOptions, args: StellarGovernanceExecuteArgs): BuiltStellarTx;
|
|
151
|
-
/**
|
|
168
|
+
/** execute_self(executor=None, UpgradeGov(hash), salt) */
|
|
152
169
|
export declare function buildStellarGovernanceExecuteGovernanceUpgradeTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
153
|
-
/**
|
|
170
|
+
/** execute_self(executor=None, UpdateGovDelay(new_delay), salt) */
|
|
154
171
|
export declare function buildStellarGovernanceExecuteUpdateDelayTx(opts: StellarBuilderOptions, args: UpdateDelayArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
155
|
-
/**
|
|
172
|
+
/** execute_self(executor=None, GrantGovRole(RoleArgs), salt) */
|
|
156
173
|
export declare function buildStellarGovernanceExecuteGrantGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
157
|
-
/**
|
|
174
|
+
/** execute_self(executor=None, RevokeGovRole(RoleArgs), salt) */
|
|
158
175
|
export declare function buildStellarGovernanceExecuteRevokeGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
159
|
-
/**
|
|
176
|
+
/** execute_self(executor=None, TransferGovOwnership(TransferOwnershipArgs), salt) */
|
|
160
177
|
export declare function buildStellarGovernanceExecuteTransferGovOwnTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
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:()=>b,STELLAR_GOVERNANCE:()=>m,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ft,STELLAR_LENDING_CONTROLLER:()=>_,STELLAR_LENDING_TOPICS:()=>oo,STELLAR_NETWORK_PASSPHRASE:()=>S,STELLAR_QUOTE_URL:()=>q,STELLAR_SOROBAN_RPC_URL:()=>g,SYNTHETIC_EVENT_ORDER_STRIDE:()=>uo,XOXNOClient:()=>a,XOXNO_LENDING_STELLAR_TICKER:()=>no,buildSameTokenRepaySwapSteps:()=>Eo,buildSdk:()=>Io,buildStellarAcceptOwnershipTx:()=>Tt,buildStellarAddAssetToEModeCategoryTx:()=>Rt,buildStellarAddEModeCategoryTx:()=>Pt,buildStellarAddRewardsTx:()=>Ht,buildStellarApproveTokenTx:()=>Bt,buildStellarBatchSwapTx:()=>go,buildStellarBorrowBatchTx:()=>F,buildStellarBorrowTx:()=>Z,buildStellarCctpForwardTx:()=>Po,buildStellarClaimRevenueTx:()=>Xt,buildStellarConfigureMarketOracleTx:()=>Ut,buildStellarCreateLiquidityPoolTx:()=>jt,buildStellarDisableTokenOracleTx:()=>Dt,buildStellarEditAssetConfigTx:()=>Et,buildStellarEditAssetInEModeCategoryTx:()=>Ot,buildStellarEditOracleToleranceTx:()=>Nt,buildStellarExecuteStrategyTx:()=>mo,buildStellarFlashLoanTx:()=>et,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Me,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Oe,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ie,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Ce,buildStellarGovernanceExecuteTx:()=>Pe,buildStellarGovernanceExecuteUpdateDelayTx:()=>Re,buildStellarGrantRoleTx:()=>St,buildStellarLendingIdentifier:()=>io,buildStellarLiquidateTx:()=>tt,buildStellarMigrateFromBlendTx:()=>ot,buildStellarMigrateTx:()=>mt,buildStellarMultiplyTx:()=>rt,buildStellarPauseTx:()=>gt,buildStellarProposeAddAssetToEModeTx:()=>ae,buildStellarProposeAddEModeCategoryTx:()=>ue,buildStellarProposeApproveTokenTx:()=>de,buildStellarProposeConfigureMarketOracleTx:()=>he,buildStellarProposeCreateLiquidityPoolTx:()=>ye,buildStellarProposeDeployPoolTx:()=>_e,buildStellarProposeEditAssetConfigTx:()=>oe,buildStellarProposeEditAssetInEModeTx:()=>se,buildStellarProposeEditOracleToleranceTx:()=>Te,buildStellarProposeGovernanceUpgradeTx:()=>we,buildStellarProposeGrantControllerRoleTx:()=>me,buildStellarProposeGrantGovernanceRoleTx:()=>Ae,buildStellarProposeMigrateControllerTx:()=>Se,buildStellarProposeRemoveAssetFromEModeTx:()=>le,buildStellarProposeRemoveEModeCategoryTx:()=>ie,buildStellarProposeRevokeControllerRoleTx:()=>ge,buildStellarProposeRevokeGovernanceRoleTx:()=>Ee,buildStellarProposeRevokeTokenTx:()=>ce,buildStellarProposeSetAccumulatorTx:()=>te,buildStellarProposeSetAggregatorTx:()=>Yt,buildStellarProposeSetMinBorrowCollatTx:()=>ne,buildStellarProposeSetPoolTemplateTx:()=>ee,buildStellarProposeSetPositionLimitsTx:()=>re,buildStellarProposeTransferCtrlOwnershipTx:()=>ve,buildStellarProposeTransferGovOwnTx:()=>ke,buildStellarProposeUpdateDelayTx:()=>xe,buildStellarProposeUpdatePoolCapsTx:()=>pe,buildStellarProposeUpgradeControllerTx:()=>qe,buildStellarProposeUpgradePoolParamsTx:()=>fe,buildStellarProposeUpgradePoolTx:()=>be,buildStellarRemoveAssetFromEModeTx:()=>Ct,buildStellarRemoveEModeCategoryTx:()=>Mt,buildStellarRenewAccountTx:()=>zt,buildStellarRepayBatchTx:()=>J,buildStellarRepayDebtWithCollateralTx:()=>it,buildStellarRepayTx:()=>Y,buildStellarRevokeRoleTx:()=>vt,buildStellarRevokeTokenTx:()=>Lt,buildStellarSetAccumulatorTx:()=>xt,buildStellarSetAggregatorTx:()=>wt,buildStellarSetLiquidityPoolTemplateTx:()=>At,buildStellarSetPositionLimitsTx:()=>kt,buildStellarSupplyBatchTx:()=>H,buildStellarSupplyTx:()=>W,buildStellarSwapCollateralTx:()=>ut,buildStellarSwapDebtTx:()=>nt,buildStellarTransferOwnershipTx:()=>ht,buildStellarUnpauseTx:()=>qt,buildStellarUpdateAccountThresholdTx:()=>Wt,buildStellarUpdateIndexesTx:()=>$t,buildStellarUpdatePoolCapsTx:()=>It,buildStellarUpgradeControllerTx:()=>bt,buildStellarUpgradeLiquidityPoolParamsTx:()=>Gt,buildStellarUpgradeLiquidityPoolTx:()=>Vt,buildStellarWithdrawBatchTx:()=>Q,buildStellarWithdrawTx:()=>K,buildTx:()=>X,decodeStellarLendingEvent:()=>ro,encodeAssetConfigRaw:()=>lt,encodeInterestRateModel:()=>st,encodeMarketOracleConfigInput:()=>_t,encodeMarketParamsRaw:()=>pt,encodeOracleSourceConfigInput:()=>ft,encodePositionLimits:()=>dt,encodeStrategyPayloadToRouteXdr:()=>bo,extractEventOrder:()=>ao,getStellarAggregatorQuote:()=>yo,getStellarAggregatorRouter:()=>h,getStellarGovernance:()=>T,getStellarLendingController:()=>v,getStellarQuoteTokens:()=>fo,isValidCollectionTicker:()=>s,isValidNftIdentifier:()=>p,mapQuoteResponseToAggregatorSwap:()=>vo,mapQuoteResponseToStrategyPayload:()=>qo,mapQuoteResponseToStrategySwap:()=>So,mapStellarPositionActivityType:()=>po,prepareStellarBuiltTx:()=>xo,prepareStellarTxXdr:()=>wo,stellarLendingDispatchKey:()=>Ue,syntheticEventOrder:()=>so,tagStellarInvokedContractError:()=>To,toBase64Xdr:()=>Be,toStellarPositionMode:()=>Ao});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,_={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...f?{Authorization:f}:{}},b=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),m=`${this.apiUrl}${t}${b.length?`?${b}`:""}`,{revalidate:g,...q}=r??{},{revalidate:S,...v}=a??{},h="GET"!==d||f?void 0:S??g,T="GET"!==d||f||h?void 0:s??n,w={...i,...c,method:d,...Object.keys(_).length?{headers:_}:{},cache:T,next:{...q,...v,revalidate:h}};(p??u)&&console.debug("SDK fetch: ",m,w);const x=await fetch(m,w).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${m}: ${t.message}`),{cause:t});throw t})),A=await x.text();if(!x.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[m,x.status,x.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}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"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},f=["PATCH","POST","DELETE","PUT"],_={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},b={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},m={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},g={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 v(t){const e=_[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 h(t){const e=b[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=m[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"),x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],A=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),R=t=>w.xdr.ScVal.scvString(t),O=t=>w.xdr.ScVal.scvSymbol(t),I=()=>w.xdr.ScVal.scvVoid(),C=t=>w.xdr.ScVal.scvVec(t),B=(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)},L=(t,e)=>null==t?I():e(t),U=(t,e)=>w.xdr.ScVal.scvVec([A(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:O(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:A(t.pool),token_in:A(t.tokenIn),token_out:A(t.tokenOut),venue:(e=t.venue,w.xdr.ScVal.scvVec([O(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:A(t.tokenIn),token_out:A(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||!x.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??v(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",[A(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",[A(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",[A(t.caller),P(e.accountNonce),o,L(e.to,A)])}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",[A(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",[A(t.caller),P(e.accountNonce),o])}function et(t,e){return X(t,"flash_loan",[A(t.caller),A(e.asset),E(e.amount),A(e.receiver),V(e.data)])}function ot(t,e){return X(t,"migrate_from_blend",[A(t.caller),P(e.accountId),k(e.eModeCategory),A(e.blendPool),C(e.collateralTokens.map(A)),C(e.supplyTokens.map(A)),N(e.debtCaps.map((t=>({token:t.token,amount:t.cap}))))])}function rt(t,e){const o=e.accountNonce??0;return X(t,"multiply",[A(t.caller),P(o),k(e.eModeCategory),A(e.collateralToken),E(e.debtToFlashLoan),A(e.debtToken),k(e.mode),G(e.steps),L(e.initialPayment,(t=>U(t.token,t.amount))),L(e.convertSwap,G)])}function nt(t,e){return X(t,"swap_debt",[A(t.caller),P(e.accountNonce),A(e.existingDebtToken),E(e.newDebtAmount),A(e.newDebtToken),G(e.steps)])}function ut(t,e){return X(t,"swap_collateral",[A(t.caller),P(e.accountNonce),A(e.currentCollateral),E(e.fromAmount),A(e.newCollateral),G(e.steps)])}function it(t,e){return X(t,"repay_debt_with_collateral",[A(t.caller),P(e.accountNonce),A(e.collateralToken),E(e.collateralAmount),A(e.debtToken),G(e.steps),M(e.closePosition)])}const at={Single:0,PrimaryWithAnchor:1},st=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)}),pt=t=>D({asset_decimals:k(t.assetDecimals),asset_id:A(t.assetId),base_borrow_rate_ray:E(t.baseBorrowRateRay),borrow_cap:E(t.borrowCap),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),supply_cap:E(t.supplyCap)}),lt=t=>D({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)}),dt=t=>D({max_borrow_positions:k(t.maxBorrowPositions),max_supply_positions:k(t.maxSupplyPositions)}),ct=t=>{const e=t.kind;switch(e){case"Stellar":return C([O("Stellar"),A(t.value)]);case"Symbol":return C([O("Symbol"),O(t.value)]);case"String":return C([O("String"),R(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},yt=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return C([O("Twap"),k(e)])}return C([O("Spot")])},ft=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return C([O("Reflector"),D({asset:ct(t.asset),contract:A(t.contract),read_mode:yt(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([O("RedStone"),D({contract:A(t.contract),feed_id:R(t.feedId),max_stale_seconds:P(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},_t=t=>{const e=at[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?[O("None")]:[O("Some"),ft(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:ft(t.primary),strategy:k(e)});var o};function bt(t,e){return X(t,"upgrade",[B(e.wasmHash)])}function mt(t,e){return X(t,"migrate",[k(e.newVersion)])}function gt(t){return X(t,"pause",[])}function qt(t){return X(t,"unpause",[])}function St(t,e){return X(t,"grant_role",[A(e.account),O(e.role)])}function vt(t,e){return X(t,"revoke_role",[A(e.account),O(e.role)])}function ht(t,e){return X(t,"transfer_ownership",[A(e.newOwner),k(e.liveUntilLedger)])}function Tt(t){return X(t,"accept_ownership",[])}function wt(t,e){return X(t,"set_aggregator",[A(e.aggregator)])}function xt(t,e){return X(t,"set_accumulator",[A(e.accumulator)])}function At(t,e){return X(t,"set_liquidity_pool_template",[B(e.wasmHash)])}function Et(t,e){return X(t,"edit_asset_config",[A(e.asset),lt(e.config)])}function kt(t,e){return X(t,"set_position_limits",[dt(e)])}function Pt(t){return X(t,"add_e_mode_category",[])}function Mt(t,e){return X(t,"remove_e_mode_category",[k(e.id)])}function Rt(t,e){return X(t,"add_asset_to_e_mode_category",[A(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus),E(e.supplyCap),E(e.borrowCap)])}function Ot(t,e){return X(t,"edit_asset_in_e_mode_category",[A(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus),E(e.supplyCap),E(e.borrowCap)])}function It(t,e){return X(t,"update_pool_caps",[A(e.asset),E(e.supplyCap),E(e.borrowCap)])}function Ct(t,e){return X(t,"remove_asset_from_e_mode",[A(e.asset),k(e.categoryId)])}function Bt(t,e){return X(t,"approve_token",[A(e.token)])}function Lt(t,e){return X(t,"revoke_token",[A(e.token)])}function Ut(t,e){return X(t,"configure_market_oracle",[A(t.caller),A(e.asset),_t(e.config)])}function Nt(t,e){return X(t,"edit_oracle_tolerance",[A(t.caller),A(e.asset),k(e.firstTolerance),k(e.lastTolerance)])}function Dt(t,e){return X(t,"disable_token_oracle",[A(t.caller),A(e.asset)])}function $t(t,e){return X(t,"update_indexes",[A(t.caller),C(e.assets.map((t=>A(t))))])}function zt(t,e){return X(t,"renew_account",[A(t.caller),P(e.accountNonce)])}function jt(t,e){return X(t,"create_liquidity_pool",[A(e.asset),pt(e.params),lt(e.config)])}function Gt(t,e){return X(t,"upgrade_liquidity_pool_params",[A(e.asset),st(e.params)])}function Vt(t,e){return X(t,"upgrade_liquidity_pool",[A(e.asset),B(e.wasmHash)])}function Xt(t,e){return X(t,"claim_revenue",[A(t.caller),C(e.assets.map((t=>A(t))))])}function Ht(t,e){return X(t,"add_rewards",[A(t.caller),C(e.rewards.map((t=>C([A(t.token),E(t.amount)]))))])}function Wt(t,e){return X(t,"update_account_threshold",[A(t.caller),A(e.asset),M(e.hasRisks),C(e.accountNonces.map((t=>P(t))))])}const Ft="00".repeat(32),Zt=t=>{if("string"==typeof t)return B(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 Qt(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 Kt=(t,e,o,r)=>Qt(t,e,[A(t.caller),...o,Zt(r)]),Jt=(t,e,o,r)=>Qt(t,e,[I(),...o,Zt(r)]);function Yt(t,e,o){return Kt(t,"propose_set_aggregator",[A(e.aggregator)],o)}function te(t,e,o){return Kt(t,"propose_set_accumulator",[A(e.accumulator)],o)}function ee(t,e,o){return Kt(t,"propose_set_pool_template",[B(e.wasmHash)],o)}function oe(t,e,o){return Kt(t,"propose_edit_asset_config",[A(e.asset),lt(e.config)],o)}function re(t,e,o){return Kt(t,"propose_set_position_limits",[dt(e)],o)}function ne(t,e,o){return Kt(t,"propose_set_min_borrow_collat",[E(e.floorWad)],o)}function ue(t,e){return Kt(t,"propose_add_e_mode_category",[],e)}function ie(t,e,o){return Kt(t,"propose_remove_e_mode_category",[k(e.id)],o)}function ae(t,e,o){return Kt(t,"propose_add_asset_to_e_mode",[A(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus),E(e.supplyCap),E(e.borrowCap)],o)}function se(t,e,o){return Kt(t,"propose_edit_asset_in_e_mode",[A(e.asset),k(e.categoryId),M(e.canCollateral),M(e.canBorrow),k(e.ltv),k(e.threshold),k(e.bonus),E(e.supplyCap),E(e.borrowCap)],o)}function pe(t,e,o){return Kt(t,"propose_update_pool_caps",[A(e.asset),E(e.supplyCap),E(e.borrowCap)],o)}function le(t,e,o){return Kt(t,"propose_remove_asset_from_e_mode",[A(e.asset),k(e.categoryId)],o)}function de(t,e,o){return Kt(t,"propose_approve_token",[A(e.token)],o)}function ce(t,e,o){return Kt(t,"propose_revoke_token",[A(e.token)],o)}function ye(t,e,o){return Kt(t,"propose_create_liquidity_pool",[A(e.asset),pt(e.params),lt(e.config)],o)}function fe(t,e,o){return Kt(t,"propose_upgrade_pool_params",[A(e.asset),st(e.params)],o)}function _e(t,e){return Kt(t,"propose_deploy_pool",[],e)}function be(t,e,o){return Kt(t,"propose_upgrade_pool",[B(e.wasmHash)],o)}function me(t,e,o){return Kt(t,"propose_grant_controller_role",[A(e.account),O(e.role)],o)}function ge(t,e,o){return Kt(t,"propose_revoke_controller_role",[A(e.account),O(e.role)],o)}function qe(t,e,o){return Kt(t,"propose_upgrade_controller",[B(e.wasmHash)],o)}function Se(t,e,o){return Kt(t,"propose_migrate_controller",[k(e.newVersion)],o)}function ve(t,e,o){return Kt(t,"propose_transfer_ctrl_ownership",[A(e.newOwner),k(e.liveUntilLedger)],o)}function he(t,e,o){return Kt(t,"propose_configure_market_oracle",[A(e.asset),_t(e.config)],o)}function Te(t,e,o){return Kt(t,"propose_edit_oracle_tolerance",[A(e.asset),k(e.firstTolerance),k(e.lastTolerance)],o)}function we(t,e,o){return Kt(t,"propose_governance_upgrade",[B(e.wasmHash)],o)}function xe(t,e,o){return Kt(t,"propose_update_delay",[k(e.newDelay)],o)}function Ae(t,e,o){return Kt(t,"propose_grant_governance_role",[A(e.account),O(e.role)],o)}function Ee(t,e,o){return Kt(t,"propose_revoke_governance_role",[A(e.account),O(e.role)],o)}function ke(t,e,o){return Kt(t,"propose_transfer_gov_own",[A(e.newOwner),k(e.liveUntilLedger)],o)}function Pe(t,e){const o=C(e.argsXdr.map((t=>w.xdr.ScVal.fromXDR(t,"base64")))),r=Zt(e.predecessor??Ft);return Qt(t,"execute",[I(),A(e.target),O(e.functionName),o,r,Zt(e.salt)])}function Me(t,e,o){return Jt(t,"execute_governance_upgrade",[B(e.wasmHash)],o)}function Re(t,e,o){return Jt(t,"execute_update_delay",[k(e.newDelay)],o)}function Oe(t,e,o){return Jt(t,"execute_grant_governance_role",[A(e.account),O(e.role)],o)}function Ie(t,e,o){return Jt(t,"execute_revoke_governance_role",[A(e.account),O(e.role)],o)}function Ce(t,e,o){return Jt(t,"execute_transfer_gov_own",[A(e.newOwner),k(e.liveUntilLedger)],o)}const Be=t=>t.toXDR("base64"),Le=t=>w.xdr.ScVal.fromXDR(t,"base64"),Ue=t=>t.map((t=>String((0,w.scValToNative)(Le(t))))).join(":"),Ne=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),De=t=>Number(t),$e=t=>String(t),ze=t=>null==t?void 0:Ne(t),je=t=>null==t?void 0:$e(t),Ge=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),Ve=["None","Multiply","Long","Short"],Xe=["Single","PrimaryWithAnchor"],He=["ReflectorSep40","RedStonePriceFeed"],We=["Spot","Twap"],Fe=["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"],Ze=t=>Array.isArray(t)?t:[],Qe=t=>({loanToValueBps:De(t.loan_to_value_bps),liquidationThresholdBps:De(t.liquidation_threshold_bps),liquidationBonusBps:De(t.liquidation_bonus_bps),liquidationFeesBps:De(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:De(t.flashloan_fee_bps),eModeCategories:(t.e_mode_categories??[]).map(De)}),Ke=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Fe[De(r)]??Ne(r)),positionType:e,asset:$e(t[1]),scaledAmountRay:Ne(t[2]),indexRay:Ne(t[3]),amount:Ne(t[4]),liquidationThresholdBps:o?void 0:De(t[5]),liquidationBonusBps:o?void 0:De(t[6]),loanToValueBps:o?void 0:De(t[7])};var r},Je=t=>{return{owner:$e(t[0]),eModeCategoryId:De(t[1]),mode:(e=t[2],Ve[De(e)]??"None")};var e},Ye=(t,e)=>{const o=We[De(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:$e(r)}:null!=n?{kind:"Symbol",value:$e(n)}:void 0;return{provider:He[De(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:$e(t[`${e}_contract`]),asset:u,feedId:je(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?De(t[`${e}_twap_records`]):void 0,decimals:De(t[`${e}_decimals`]),resolutionSeconds:De(t[`${e}_resolution_seconds`]),maxStaleSeconds:De(t[`${e}_max_stale_seconds`])}},to=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:$e(t.base_token_id),quoteTokenId:$e(t.quote_token_id),tolerance:{firstUpperRatio:De(t.first_upper_ratio_bps??t.tolerance?.first_upper_ratio_bps),firstLowerRatio:De(t.first_lower_ratio_bps??t.tolerance?.first_lower_ratio_bps),lastUpperRatio:De(t.last_upper_ratio_bps??t.tolerance?.last_upper_ratio_bps),lastLowerRatio:De(t.last_lower_ratio_bps??t.tolerance?.last_lower_ratio_bps)},assetDecimals:De(t.asset_decimals),maxPriceStaleSeconds:De(t.max_price_stale_seconds),strategy:Xe[De(t.strategy)]??"Single",primary:Ye(t,"primary"),anchor:e?Ye(t,"anchor"):void 0,primaryQuoteToken:je(t.primary_quote_token),anchorQuoteToken:je(t.anchor_quote_token),minSanityPriceWad:ze(t.min_sanity_price_wad),maxSanityPriceWad:ze(t.max_sanity_price_wad)}},eo={"market:create":t=>({topic:"market:create",data:{baseAsset:$e(t.base_asset),maxBorrowRate:Ne(t.max_borrow_rate),baseBorrowRate:Ne(t.base_borrow_rate),slope1:Ne(t.slope1),slope2:Ne(t.slope2),slope3:Ne(t.slope3),midUtilization:Ne(t.mid_utilization),optimalUtilization:Ne(t.optimal_utilization),maxUtilization:ze(t.max_utilization),reserveFactor:De(t.reserve_factor),marketAddress:$e(t.market_address),config:Qe(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:$e(t.asset),maxBorrowRateRay:Ne(t.max_borrow_rate_ray),baseBorrowRateRay:Ne(t.base_borrow_rate_ray),slope1Ray:Ne(t.slope1_ray),slope2Ray:Ne(t.slope2_ray),slope3Ray:Ne(t.slope3_ray),midUtilizationRay:Ne(t.mid_utilization_ray),optimalUtilizationRay:Ne(t.optimal_utilization_ray),maxUtilizationRay:ze(t.max_utilization_ray),reserveFactorBps:De(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Ze(t).map((t=>{return e=Ze(t),{asset:$e(e[0]),timestamp:De(e[1]),supplyIndexRay:Ne(e[2]),borrowIndexRay:Ne(e[3]),reservesRay:Ne(e[4]),suppliedRay:Ne(e[5]),borrowedRay:Ne(e[6]),revenueRay:Ne(e[7]),assetPriceWad:ze(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Ze(t).map((t=>{const e=t;return{asset:$e(e.asset),params:(o=e.params,{maxBorrowRateRay:Ne(o.max_borrow_rate_ray),baseBorrowRateRay:Ne(o.base_borrow_rate_ray),slope1Ray:Ne(o.slope1_ray),slope2Ray:Ne(o.slope2_ray),slope3Ray:Ne(o.slope3_ray),midUtilizationRay:Ne(o.mid_utilization_ray),optimalUtilizationRay:Ne(o.optimal_utilization_ray),maxUtilizationRay:ze(o.max_utilization_ray),reserveFactorBps:De(o.reserve_factor_bps),supplyCap:Ne(o.supply_cap),borrowCap:Ne(o.borrow_cap),assetId:je(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:De(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=Ze(t);return{topic:"position:batch_update",data:{accountId:Ne(e[0]),accountAttributes:Je(Ze(e[1])),updates:[...Ze(e[2]).map((t=>Ke(Ze(t),"Deposit"))),...Ze(e[3]).map((t=>Ke(Ze(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:$e(t.asset),receiver:$e(t.receiver),caller:$e(t.caller),amount:Ne(t.amount),fee:Ne(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:$e(t.asset),config:Qe(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:$e(t.asset),oracle:to(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:De(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:$e(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:De(t.config.loan_to_value_bps),liquidationThresholdBps:De(t.config.liquidation_threshold_bps),liquidationBonusBps:De(t.config.liquidation_bonus_bps),supplyCap:Ne(t.config.supply_cap),borrowCap:Ne(t.config.borrow_cap)},categoryId:De(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:$e(t.asset),categoryId:De(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Ne(t.account_id),totalBorrowUsdWad:Ne(t.total_borrow_usd_wad),totalCollateralUsdWad:Ne(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:$e(t.token),amount:Ne(t.amount),usdValueWad:Ne(t.usd_value_wad),accountId:Ne(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{asset:$e(t.asset),amount:Ne(t.amount),fee:Ne(t.fee),amountSent:Ne(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Ge(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:$e(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:$e(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Ge(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:De(t.max_supply_positions),maxBorrowPositions:De(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:$e(t.asset)}}),"oracle:twap_degraded":t=>({topic:"oracle:twap_degraded",data:{oracle:$e(t.oracle),reasonCode:De(t.reason_code)}})},oo=Object.freeze(Object.keys(eo));function ro(t,e){const o=Ue(t),r=eo[o];return r?r((0,w.scValToNative)(Le(e))):null}const no="XLENDXLM-a7c9f3",uo=1e4;function io(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${no}-${o}`}function ao(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function so(t,e=0){return t*uo+e}function po(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const lo=(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()},co=t=>t.baseUrl??q[t.network];async function yo(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=lo(co(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 fo(t){const e=lo(co(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 _o=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,bo=t=>$(t).toXDR("base64");function mo(t,e){const o=t.routerAddress??h(t.network),r=new w.Contract(o),n=new w.Account(t.caller,t.sourceSequence),u=G(_o(e,t.referralId));return{xdr:new w.TransactionBuilder(n,{fee:t.fee??w.BASE_FEE,networkPassphrase:S[t.network]}).addOperation(r.call("execute_strategy",A(t.caller),E(t.totalIn),u)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function go(t,e){return mo(t,e)}function qo(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(ho),splitPpm:t.splitPpm}))):[{hops:t.hops.map(ho),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function So(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:qo(t,e)}const vo=qo,ho=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function To(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function wo(t,e,o){const r=w.TransactionBuilder.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw To(o.invokedContractId,t);throw t}}async function xo(t,e,o){return wo(t,e.xdr,o)}function Ao(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 Eo(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 ko=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function Po(t){const e=new w.Account(t.caller,t.sourceSequence),o=new w.Contract(t.forwarderAddress).call("mint_and_forward",w.xdr.ScVal.scvBytes(ko(t.message)),w.xdr.ScVal.scvBytes(ko(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 Mo=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),Ro=()=>({static:{},params:{},leaves:[]});function Oo(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:_,auth:b,method:m,headers:g,cache:q,next:S,debug:v,continuationToken:h,...T}=f,w=b?`Bearer ${b}`:void 0,x={...g,...w?{Authorization:w}:{},...h?{"X-Continuation-Token":String(h)}:{}},A={...S,tags:[...S?.tags??[],u]};return r.fetchWithTimeout(u,{method:m,params:T,body:_,headers:x,cache:q,debug:v,...A?{next:A}:{}})},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 Io(t){const e=function(){const t=Ro();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=Mo(t.slice(1));n=n.params[e]||=Ro()}else{const e=Mo(t);n=n.static[e]||=Ro()}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=Oo(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[Mo(o.split("/").pop().replace(/^:/,""))]=Oo(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:()=>m,STELLAR_GOVERNANCE:()=>g,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ft,STELLAR_LENDING_CONTROLLER:()=>b,STELLAR_LENDING_TOPICS:()=>fo,STELLAR_NETWORK_PASSPHRASE:()=>S,STELLAR_QUOTE_URL:()=>q,STELLAR_SOROBAN_RPC_URL:()=>_,SYNTHETIC_EVENT_ORDER_STRIDE:()=>go,XOXNOClient:()=>a,XOXNO_LENDING_STELLAR_TICKER:()=>mo,buildSameTokenRepaySwapSteps:()=>No,buildSdk:()=>Vo,buildStellarAcceptOwnershipTx:()=>ht,buildStellarAddAssetToEModeCategoryTx:()=>Rt,buildStellarAddEModeCategoryTx:()=>Pt,buildStellarAddRewardsTx:()=>Ht,buildStellarApproveTokenTx:()=>Ut,buildStellarBatchSwapTx:()=>Po,buildStellarBorrowBatchTx:()=>F,buildStellarBorrowTx:()=>Z,buildStellarCctpForwardTx:()=>$o,buildStellarClaimRevenueTx:()=>Xt,buildStellarConfigureMarketOracleTx:()=>Lt,buildStellarCreateLiquidityPoolTx:()=>Gt,buildStellarDisableTokenOracleTx:()=>Dt,buildStellarEditAssetConfigTx:()=>Et,buildStellarEditAssetInEModeCategoryTx:()=>Ot,buildStellarEditOracleToleranceTx:()=>Nt,buildStellarExecuteStrategyTx:()=>ko,buildStellarFlashLoanTx:()=>et,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>ze,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>je,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ve,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Xe,buildStellarGovernanceExecuteTx:()=>$e,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ge,buildStellarGrantRoleTx:()=>St,buildStellarLendingIdentifier:()=>_o,buildStellarLiquidateTx:()=>tt,buildStellarMigrateFromBlendTx:()=>ot,buildStellarMigrateTx:()=>gt,buildStellarMultiplyTx:()=>rt,buildStellarPauseTx:()=>_t,buildStellarProposeAddAssetToEModeTx:()=>ge,buildStellarProposeAddEModeCategoryTx:()=>be,buildStellarProposeApproveBlendPoolTx:()=>he,buildStellarProposeApproveTokenTx:()=>Te,buildStellarProposeConfigureMarketOracleTx:()=>Ie,buildStellarProposeCreateLiquidityPoolTx:()=>Ae,buildStellarProposeDeployPoolTx:()=>Ee,buildStellarProposeDisableTokenOracleTx:()=>Pe,buildStellarProposeEditAssetConfigTx:()=>ce,buildStellarProposeEditAssetInEModeTx:()=>_e,buildStellarProposeEditOracleToleranceTx:()=>Ce,buildStellarProposeGovernanceUpgradeTx:()=>Ue,buildStellarProposeGrantGovernanceRoleTx:()=>Le,buildStellarProposeMigrateControllerTx:()=>Re,buildStellarProposeRemoveAssetFromEModeTx:()=>Se,buildStellarProposeRemoveEModeCategoryTx:()=>me,buildStellarProposeRevokeBlendPoolTx:()=>we,buildStellarProposeRevokeGovernanceRoleTx:()=>Ne,buildStellarProposeRevokeTokenTx:()=>ve,buildStellarProposeSetAccumulatorTx:()=>le,buildStellarProposeSetAggregatorTx:()=>pe,buildStellarProposeSetMinBorrowCollatTx:()=>fe,buildStellarProposeSetPoolTemplateTx:()=>de,buildStellarProposeSetPositionLimitsTx:()=>ye,buildStellarProposeTransferCtrlOwnershipTx:()=>Oe,buildStellarProposeTransferGovOwnTx:()=>De,buildStellarProposeUpdateDelayTx:()=>Be,buildStellarProposeUpdatePoolCapsTx:()=>qe,buildStellarProposeUpgradeControllerTx:()=>Me,buildStellarProposeUpgradePoolParamsTx:()=>xe,buildStellarProposeUpgradePoolTx:()=>ke,buildStellarRemoveAssetFromEModeTx:()=>Ct,buildStellarRemoveEModeCategoryTx:()=>Mt,buildStellarRenewAccountTx:()=>zt,buildStellarRepayBatchTx:()=>J,buildStellarRepayDebtWithCollateralTx:()=>it,buildStellarRepayTx:()=>Y,buildStellarRevokeRoleTx:()=>Tt,buildStellarRevokeTokenTx:()=>Bt,buildStellarSetAccumulatorTx:()=>At,buildStellarSetAggregatorTx:()=>wt,buildStellarSetLiquidityPoolTemplateTx:()=>xt,buildStellarSetPositionLimitsTx:()=>kt,buildStellarSupplyBatchTx:()=>H,buildStellarSupplyTx:()=>W,buildStellarSwapCollateralTx:()=>ut,buildStellarSwapDebtTx:()=>nt,buildStellarTransferOwnershipTx:()=>vt,buildStellarUnpauseTx:()=>qt,buildStellarUpdateAccountThresholdTx:()=>Wt,buildStellarUpdateIndexesTx:()=>$t,buildStellarUpdatePoolCapsTx:()=>It,buildStellarUpgradeControllerTx:()=>mt,buildStellarUpgradeLiquidityPoolParamsTx:()=>jt,buildStellarUpgradeLiquidityPoolTx:()=>Vt,buildStellarWithdrawBatchTx:()=>Q,buildStellarWithdrawTx:()=>K,buildTx:()=>X,decodeStellarLendingEvent:()=>bo,encodeAssetConfigRaw:()=>lt,encodeInterestRateModel:()=>st,encodeMarketOracleConfigInput:()=>bt,encodeMarketParamsRaw:()=>pt,encodeOracleSourceConfigInput:()=>ft,encodePositionLimits:()=>dt,encodeStrategyPayloadToRouteXdr:()=>Eo,extractEventOrder:()=>qo,getStellarAggregatorQuote:()=>wo,getStellarAggregatorRouter:()=>v,getStellarGovernance:()=>h,getStellarLendingController:()=>T,getStellarQuoteTokens:()=>Ao,isValidCollectionTicker:()=>s,isValidNftIdentifier:()=>p,mapQuoteResponseToAggregatorSwap:()=>Oo,mapQuoteResponseToStrategyPayload:()=>Mo,mapQuoteResponseToStrategySwap:()=>Ro,mapStellarPositionActivityType:()=>To,prepareStellarBuiltTx:()=>Bo,prepareStellarTxXdr:()=>Uo,stellarLendingDispatchKey:()=>Fe,syntheticEventOrder:()=>So,tagStellarInvokedContractError:()=>Co,toBase64Xdr:()=>He,toStellarPositionMode:()=>Lo});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}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:_,...q}=r??{},{revalidate:S,...T}=a??{},v="GET"!==d||f?void 0:S??_,h="GET"!==d||f||v?void 0:s??n,w={...i,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:h,next:{...q,...T,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"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},f=["PATCH","POST","DELETE","PUT"],b={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},m={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??""},_={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 T(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=m[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 h(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),R=t=>w.xdr.ScVal.scvString(t),O=t=>w.xdr.ScVal.scvSymbol(t),I=()=>w.xdr.ScVal.scvVoid(),C=t=>w.xdr.ScVal.scvVec(t),U=(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),L=(t,e)=>w.xdr.ScVal.scvVec([x(t),E(e)]),N=t=>w.xdr.ScVal.scvVec(t.map((t=>L(t.token,t.amount)))),D=t=>{const e=Object.keys(t).sort().map((e=>new w.xdr.ScMapEntry({key:O(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([O(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)},G=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},j=t=>{if("string"==typeof t)return z(G(t));if(t instanceof Uint8Array)return z(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?z(G(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?z(G(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?z(G(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??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()}}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){return X(t,"migrate_from_blend",[x(t.caller),P(e.accountId),k(e.eModeCategory),x(e.blendPool),C(e.collateralTokens.map(x)),C(e.supplyTokens.map(x)),N(e.debtCaps.map((t=>({token:t.token,amount:t.cap}))))])}function rt(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),j(e.steps),B(e.initialPayment,(t=>L(t.token,t.amount))),B(e.convertSwap,j)])}function nt(t,e){return X(t,"swap_debt",[x(t.caller),P(e.accountNonce),x(e.existingDebtToken),E(e.newDebtAmount),x(e.newDebtToken),j(e.steps)])}function ut(t,e){return X(t,"swap_collateral",[x(t.caller),P(e.accountNonce),x(e.currentCollateral),E(e.fromAmount),x(e.newCollateral),j(e.steps)])}function it(t,e){return X(t,"repay_debt_with_collateral",[x(t.caller),P(e.accountNonce),x(e.collateralToken),E(e.collateralAmount),x(e.debtToken),j(e.steps),M(e.closePosition)])}const at={Single:0,PrimaryWithAnchor:1},st=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)}),pt=t=>D({asset_decimals:k(t.assetDecimals),asset_id:x(t.assetId),base_borrow_rate_ray:E(t.baseBorrowRateRay),borrow_cap:E(t.borrowCap),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),supply_cap:E(t.supplyCap)}),lt=t=>D({asset_decimals:k(0),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)}),dt=t=>D({max_borrow_positions:k(t.maxBorrowPositions),max_supply_positions:k(t.maxSupplyPositions)}),ct=t=>{const e=t.kind;switch(e){case"Stellar":return C([O("Stellar"),x(t.value)]);case"Symbol":return C([O("Symbol"),O(t.value)]);case"String":return C([O("String"),R(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},yt=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return C([O("Twap"),k(e)])}return C([O("Spot")])},ft=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return C([O("Reflector"),D({asset:ct(t.asset),contract:x(t.contract),read_mode:yt(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([O("RedStone"),D({contract:x(t.contract),feed_id:R(t.feedId),max_stale_seconds:P(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},bt=t=>{const e=at[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?[O("None")]:[O("Some"),ft(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:ft(t.primary),strategy:k(e)});var o};function mt(t,e){return X(t,"upgrade",[U(e.wasmHash)])}function gt(t,e){return X(t,"migrate",[k(e.newVersion)])}function _t(t){return X(t,"pause",[])}function qt(t){return X(t,"unpause",[])}function St(t,e){return X(t,"grant_role",[x(e.account),O(e.role)])}function Tt(t,e){return X(t,"revoke_role",[x(e.account),O(e.role)])}function vt(t,e){return X(t,"transfer_ownership",[x(e.newOwner),k(e.liveUntilLedger)])}function ht(t){return X(t,"accept_ownership",[])}function wt(t,e){return X(t,"set_aggregator",[x(e.aggregator)])}function At(t,e){return X(t,"set_accumulator",[x(e.accumulator)])}function xt(t,e){return X(t,"set_liquidity_pool_template",[U(e.wasmHash)])}function Et(t,e){return X(t,"edit_asset_config",[x(e.asset),lt(e.config)])}function kt(t,e){return X(t,"set_position_limits",[dt(e)])}function Pt(t){return X(t,"add_e_mode_category",[])}function Mt(t,e){return X(t,"remove_e_mode_category",[k(e.id)])}function Rt(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),E(e.supplyCap),E(e.borrowCap)])}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),E(e.supplyCap),E(e.borrowCap)])}function It(t,e){return X(t,"update_pool_caps",[x(e.asset),E(e.supplyCap),E(e.borrowCap)])}function Ct(t,e){return X(t,"remove_asset_from_e_mode",[x(e.asset),k(e.categoryId)])}function Ut(t,e){return X(t,"approve_token",[x(e.token)])}function Bt(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),bt(e.config)])}function Nt(t,e){return X(t,"edit_oracle_tolerance",[x(t.caller),x(e.asset),k(e.firstTolerance),k(e.lastTolerance)])}function Dt(t,e){return X(t,"disable_token_oracle",[x(t.caller),x(e.asset)])}function $t(t,e){return X(t,"update_indexes",[x(t.caller),C(e.assets.map((t=>x(t))))])}function zt(t,e){return X(t,"renew_account",[x(t.caller),P(e.accountNonce)])}function Gt(t,e){return X(t,"create_liquidity_pool",[x(e.asset),pt(e.params),lt(e.config)])}function jt(t,e){return X(t,"upgrade_liquidity_pool_params",[x(e.asset),st(e.params)])}function Vt(t,e){return X(t,"upgrade_liquidity_pool",[x(e.asset),U(e.wasmHash)])}function Xt(t,e){return X(t,"claim_revenue",[x(t.caller),C(e.assets.map((t=>x(t))))])}function Ht(t,e){return X(t,"add_rewards",[x(t.caller),C(e.rewards.map((t=>C([x(t.token),E(t.amount)]))))])}function Wt(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 Ft="00".repeat(32),Zt=t=>{if("string"==typeof t)return U(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)},Qt=(t,...e)=>C([O(t),...e]),Kt=t=>D({asset:x(t.asset),category_id:k(t.categoryId),can_collateral:M(t.canCollateral),can_borrow:M(t.canBorrow),ltv:k(t.ltv),threshold:k(t.threshold),bonus:k(t.bonus),supply_cap:E(t.supplyCap),borrow_cap:E(t.borrowCap)}),Jt=t=>D({asset:x(t.asset),supply_cap:E(t.supplyCap),borrow_cap:E(t.borrowCap)}),Yt=t=>D({asset:x(t.asset),category_id:k(t.categoryId)}),te=t=>D({asset:x(t.asset),params:pt(t.params),config:lt(t.config)}),ee=t=>D({asset:x(t.asset),params:st(t.params)}),oe=t=>D({new_owner:x(t.newOwner),live_until_ledger:k(t.liveUntilLedger)}),re=t=>D({asset:x(t.asset),cfg:bt(t.config)}),ne=t=>D({asset:x(t.asset),first_tolerance:k(t.firstTolerance),last_tolerance:k(t.lastTolerance)}),ue=t=>D({account:x(t.account),role:O(t.role)});function ie(t,e,o){const r=t.governanceAddress??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()}}const ae=(t,e,o)=>ie(t,"propose",[x(t.caller),e,Zt(o)]),se=(t,e,o)=>ie(t,"execute_self",[I(),e,Zt(o)]);function pe(t,e,o){return ae(t,Qt("SetAggregator",x(e.aggregator)),o)}function le(t,e,o){return ae(t,Qt("SetAccumulator",x(e.accumulator)),o)}function de(t,e,o){return ae(t,Qt("SetLiquidityPoolTemplate",U(e.wasmHash)),o)}function ce(t,e,o){return ae(t,Qt("EditAssetConfig",x(e.asset),lt(e.config)),o)}function ye(t,e,o){return ae(t,Qt("SetPositionLimits",dt(e)),o)}function fe(t,e,o){return ae(t,Qt("SetMinBorrowCollateralUsd",E(e.floorWad)),o)}function be(t,e){return ae(t,Qt("AddEModeCategory"),e)}function me(t,e,o){return ae(t,Qt("RemoveEModeCategory",k(e.id)),o)}function ge(t,e,o){return ae(t,Qt("AddAssetToEModeCategory",Kt(e)),o)}function _e(t,e,o){return ae(t,Qt("EditAssetInEModeCategory",Kt(e)),o)}function qe(t,e,o){return ae(t,Qt("UpdatePoolCaps",Jt(e)),o)}function Se(t,e,o){return ae(t,Qt("RemoveAssetFromEMode",Yt(e)),o)}function Te(t,e,o){return ae(t,Qt("ApproveToken",x(e.token)),o)}function ve(t,e,o){return ae(t,Qt("RevokeToken",x(e.token)),o)}function he(t,e,o){return ae(t,Qt("ApproveBlendPool",x(e.pool)),o)}function we(t,e,o){return ae(t,Qt("RevokeBlendPool",x(e.pool)),o)}function Ae(t,e,o){return ae(t,Qt("CreateLiquidityPool",te(e)),o)}function xe(t,e,o){return ae(t,Qt("UpgradeLiquidityPoolParams",ee(e)),o)}function Ee(t,e){return ae(t,Qt("DeployPool"),e)}function ke(t,e,o){return ae(t,Qt("UpgradePool",U(e.wasmHash)),o)}function Pe(t,e,o){return ae(t,Qt("DisableTokenOracle",x(e.asset)),o)}function Me(t,e,o){return ae(t,Qt("UpgradeController",U(e.wasmHash)),o)}function Re(t,e,o){return ae(t,Qt("MigrateController",k(e.newVersion)),o)}function Oe(t,e,o){return ae(t,Qt("TransferCtrlOwnership",oe(e)),o)}function Ie(t,e,o){return ae(t,Qt("ConfigureMarketOracle",re(e)),o)}function Ce(t,e,o){return ae(t,Qt("EditOracleTolerance",ne(e)),o)}function Ue(t,e,o){return ae(t,Qt("UpgradeGov",U(e.wasmHash)),o)}function Be(t,e,o){return ae(t,Qt("UpdateGovDelay",k(e.newDelay)),o)}function Le(t,e,o){return ae(t,Qt("GrantGovRole",ue(e)),o)}function Ne(t,e,o){return ae(t,Qt("RevokeGovRole",ue(e)),o)}function De(t,e,o){return ae(t,Qt("TransferGovOwnership",oe(e)),o)}function $e(t,e){const o=C(e.argsXdr.map((t=>w.xdr.ScVal.fromXDR(t,"base64")))),r=Zt(e.predecessor??Ft);return ie(t,"execute",[I(),x(e.target),O(e.functionName),o,r,Zt(e.salt)])}function ze(t,e,o){return se(t,Qt("UpgradeGov",U(e.wasmHash)),o)}function Ge(t,e,o){return se(t,Qt("UpdateGovDelay",k(e.newDelay)),o)}function je(t,e,o){return se(t,Qt("GrantGovRole",ue(e)),o)}function Ve(t,e,o){return se(t,Qt("RevokeGovRole",ue(e)),o)}function Xe(t,e,o){return se(t,Qt("TransferGovOwnership",oe(e)),o)}const He=t=>t.toXDR("base64"),We=t=>w.xdr.ScVal.fromXDR(t,"base64"),Fe=t=>t.map((t=>String((0,w.scValToNative)(We(t))))).join(":"),Ze=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Qe=t=>Number(t),Ke=t=>String(t),Je=t=>null==t?void 0:Ze(t),Ye=t=>null==t?void 0:Ke(t),to=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),eo=["None","Multiply","Long","Short"],oo=["Single","PrimaryWithAnchor"],ro=["ReflectorSep40","RedStonePriceFeed"],no=["Spot","Twap"],uo=["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"],io=t=>Array.isArray(t)?t:[],ao=t=>({loanToValueBps:Qe(t.loan_to_value_bps),liquidationThresholdBps:Qe(t.liquidation_threshold_bps),liquidationBonusBps:Qe(t.liquidation_bonus_bps),liquidationFeesBps:Qe(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:Qe(t.flashloan_fee_bps),eModeCategories:(t.e_mode_categories??[]).map(Qe)}),so=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],uo[Qe(r)]??Ze(r)),positionType:e,asset:Ke(t[1]),scaledAmountRay:Ze(t[2]),indexRay:Ze(t[3]),amount:Ze(t[4]),liquidationThresholdBps:o?void 0:Qe(t[5]),liquidationBonusBps:o?void 0:Qe(t[6]),loanToValueBps:o?void 0:Qe(t[7])};var r},po=t=>{return{owner:Ke(t[0]),eModeCategoryId:Qe(t[1]),mode:(e=t[2],eo[Qe(e)]??"None")};var e},lo=(t,e)=>{const o=no[Qe(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:Ke(r)}:null!=n?{kind:"Symbol",value:Ke(n)}:void 0;return{provider:ro[Qe(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:Ke(t[`${e}_contract`]),asset:u,feedId:Ye(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Qe(t[`${e}_twap_records`]):void 0,decimals:Qe(t[`${e}_decimals`]),resolutionSeconds:Qe(t[`${e}_resolution_seconds`]),maxStaleSeconds:Qe(t[`${e}_max_stale_seconds`])}},co=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:Ke(t.base_token_id),quoteTokenId:Ke(t.quote_token_id),tolerance:{firstUpperRatio:Qe(t.first_upper_ratio_bps??t.tolerance?.first_upper_ratio_bps),firstLowerRatio:Qe(t.first_lower_ratio_bps??t.tolerance?.first_lower_ratio_bps),lastUpperRatio:Qe(t.last_upper_ratio_bps??t.tolerance?.last_upper_ratio_bps),lastLowerRatio:Qe(t.last_lower_ratio_bps??t.tolerance?.last_lower_ratio_bps)},assetDecimals:Qe(t.asset_decimals),maxPriceStaleSeconds:Qe(t.max_price_stale_seconds),strategy:oo[Qe(t.strategy)]??"Single",primary:lo(t,"primary"),anchor:e?lo(t,"anchor"):void 0,primaryQuoteToken:Ye(t.primary_quote_token),anchorQuoteToken:Ye(t.anchor_quote_token),minSanityPriceWad:Je(t.min_sanity_price_wad),maxSanityPriceWad:Je(t.max_sanity_price_wad)}},yo={"market:create":t=>({topic:"market:create",data:{baseAsset:Ke(t.base_asset),maxBorrowRate:Ze(t.max_borrow_rate),baseBorrowRate:Ze(t.base_borrow_rate),slope1:Ze(t.slope1),slope2:Ze(t.slope2),slope3:Ze(t.slope3),midUtilization:Ze(t.mid_utilization),optimalUtilization:Ze(t.optimal_utilization),maxUtilization:Je(t.max_utilization),reserveFactor:Qe(t.reserve_factor),marketAddress:Ke(t.market_address),config:ao(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Ke(t.asset),maxBorrowRateRay:Ze(t.max_borrow_rate_ray),baseBorrowRateRay:Ze(t.base_borrow_rate_ray),slope1Ray:Ze(t.slope1_ray),slope2Ray:Ze(t.slope2_ray),slope3Ray:Ze(t.slope3_ray),midUtilizationRay:Ze(t.mid_utilization_ray),optimalUtilizationRay:Ze(t.optimal_utilization_ray),maxUtilizationRay:Je(t.max_utilization_ray),reserveFactorBps:Qe(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:io(t).map((t=>{return e=io(t),{asset:Ke(e[0]),timestamp:Qe(e[1]),supplyIndexRay:Ze(e[2]),borrowIndexRay:Ze(e[3]),reservesRay:Ze(e[4]),suppliedRay:Ze(e[5]),borrowedRay:Ze(e[6]),revenueRay:Ze(e[7]),assetPriceWad:Je(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:io(t).map((t=>{const e=t;return{asset:Ke(e.asset),params:(o=e.params,{maxBorrowRateRay:Ze(o.max_borrow_rate_ray),baseBorrowRateRay:Ze(o.base_borrow_rate_ray),slope1Ray:Ze(o.slope1_ray),slope2Ray:Ze(o.slope2_ray),slope3Ray:Ze(o.slope3_ray),midUtilizationRay:Ze(o.mid_utilization_ray),optimalUtilizationRay:Ze(o.optimal_utilization_ray),maxUtilizationRay:Je(o.max_utilization_ray),reserveFactorBps:Qe(o.reserve_factor_bps),supplyCap:Ze(o.supply_cap),borrowCap:Ze(o.borrow_cap),assetId:Ye(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:Qe(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=io(t);return{topic:"position:batch_update",data:{accountId:Ze(e[0]),accountAttributes:po(io(e[1])),updates:[...io(e[2]).map((t=>so(io(t),"Deposit"))),...io(e[3]).map((t=>so(io(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:Ke(t.asset),receiver:Ke(t.receiver),caller:Ke(t.caller),amount:Ze(t.amount),fee:Ze(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:Ke(t.asset),config:ao(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Ke(t.asset),oracle:co(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:Qe(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:Ke(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:Qe(t.config.loan_to_value_bps),liquidationThresholdBps:Qe(t.config.liquidation_threshold_bps),liquidationBonusBps:Qe(t.config.liquidation_bonus_bps),supplyCap:Ze(t.config.supply_cap),borrowCap:Ze(t.config.borrow_cap)},categoryId:Qe(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:Ke(t.asset),categoryId:Qe(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Ze(t.account_id),totalBorrowUsdWad:Ze(t.total_borrow_usd_wad),totalCollateralUsdWad:Ze(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Ke(t.token),amount:Ze(t.amount),usdValueWad:Ze(t.usd_value_wad),accountId:Ze(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{asset:Ke(t.asset),amount:Ze(t.amount),fee:Ze(t.fee),amountSent:Ze(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:to(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Ke(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Ke(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:to(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Qe(t.max_supply_positions),maxBorrowPositions:Qe(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Ke(t.asset)}}),"oracle:twap_degraded":t=>({topic:"oracle:twap_degraded",data:{oracle:Ke(t.oracle),reasonCode:Qe(t.reason_code)}})},fo=Object.freeze(Object.keys(yo));function bo(t,e){const o=Fe(t),r=yo[o];return r?r((0,w.scValToNative)(We(e))):null}const mo="XLENDXLM-a7c9f3",go=1e4;function _o(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${mo}-${o}`}function qo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function So(t,e=0){return t*go+e}function To(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const vo=(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()},ho=t=>t.baseUrl??q[t.network];async function wo(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=vo(ho(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 Ao(t){const e=vo(ho(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 xo=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,Eo=t=>$(t).toXDR("base64");function ko(t,e){const o=t.routerAddress??v(t.network),r=new w.Contract(o),n=new w.Account(t.caller,t.sourceSequence),u=j(xo(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 Po(t,e){return ko(t,e)}function Mo(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(Io),splitPpm:t.splitPpm}))):[{hops:t.hops.map(Io),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function Ro(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Mo(t,e)}const Oo=Mo,Io=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function Co(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Uo(t,e,o){const r=w.TransactionBuilder.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw Co(o.invokedContractId,t);throw t}}async function Bo(t,e,o){return Uo(t,e.xdr,o)}function Lo(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 No(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 Do=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 $o(t){const e=new w.Account(t.caller,t.sourceSequence),o=new w.Contract(t.forwarderAddress).call("mint_and_forward",w.xdr.ScVal.scvBytes(Do(t.message)),w.xdr.ScVal.scvBytes(Do(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 zo=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),Go=()=>({static:{},params:{},leaves:[]});function jo(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:m,method:g,headers:_,cache:q,next:S,debug:T,continuationToken:v,...h}=f,w=m?`Bearer ${m}`:void 0,A={..._,...w?{Authorization:w}:{},...v?{"X-Continuation-Token":String(v)}:{}},x={...S,tags:[...S?.tags??[],u]};return r.fetchWithTimeout(u,{method:g,params:h,body:b,headers:A,cache:q,debug:T,...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 Vo(t){const e=function(){const t=Go();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=zo(t.slice(1));n=n.params[e]||=Go()}else{const e=zo(t);n=n.static[e]||=Go()}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=jo(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[zo(o.split("/").pop().replace(/^:/,""))]=jo(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})();
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as a}from"@stellar/stellar-sdk";const s="https://api.xoxno.com",p="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",c="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",d="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(t){t.MAINNET="1",t.DEVNET="D"}(l||(l={}));class y{apiUrl;chain;init;config;constructor({chain:t=l.MAINNET,apiUrl:e=s,...o}={}){this.apiUrl=e??{[l.MAINNET]:s,[l.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:p,DR_SC:c,KG_SC:d,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:p,DR_SC:c,KG_SC:d,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:c,method:d="GET",...l}=o,y=c?.Authorization,f="Bearer undefined"===y?void 0:y,_={...c,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...f?{Authorization:f}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:b,...q}=r??{},{revalidate:h,...v}=a??{},w="GET"!==d||f?void 0:h??b,A="GET"!==d||f||w?void 0:s??n,S={...i,...l,method:d,...Object.keys(_).length?{headers:_}:{},cache:A,next:{...q,...v,revalidate:w}};(p??u)&&console.debug("SDK fetch: ",g,S);const T=await fetch(g,S).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${t.message}`),{cause:t});throw t})),k=await T.text();if(!T.ok){let t;try{t=JSON.parse(k)}catch{t={message:k}}const e=[g,T.status,T.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(k)}catch{return k}}}const f=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},_=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 m extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class g extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const b=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)),q={"/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"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},h=["PATCH","POST","DELETE","PUT"],v={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},w={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},A={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},S={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},T={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"},k={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function M(t){const e=v[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 x(t){const e=w[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 E(t){const e=A[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const P=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],O=t=>new e(t).toScVal(),I=t=>new n(t).toI128(),R=t=>a.ScVal.scvU32(t),C=t=>new n("string"==typeof t?t:t.toString()).toU64(),B=t=>a.ScVal.scvBool(t),U=t=>a.ScVal.scvString(t),N=t=>a.ScVal.scvSymbol(t),L=()=>a.ScVal.scvVoid(),$=t=>a.ScVal.scvVec(t),z=(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 a.ScVal.scvBytes(r)},D=(t,e)=>null==t?L():e(t),j=(t,e)=>a.ScVal.scvVec([O(t),I(e)]),V=t=>a.ScVal.scvVec(t.map((t=>j(t.token,t.amount)))),H=t=>{const e=Object.keys(t).sort().map((e=>new a.ScMapEntry({key:N(e),val:t[e]})));return a.ScVal.scvMap(e)},X=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return H({amount_out:I(t.amountOut),pool:O(t.pool),token_in:O(t.tokenIn),token_out:O(t.tokenOut),venue:(e=t.venue,a.ScVal.scvVec([N(e)]))});var e}));return H({hops:a.ScVal.scvVec(e),split_ppm:R(t.splitPpm)})}));return H({paths:a.ScVal.scvVec(e),referral_id:C(t.referralId??0),token_in:O(t.tokenIn),token_out:O(t.tokenOut),total_min_out:I(t.totalMinOut)})},W=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 a.ScVal.scvBytes(e)},F=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return 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 W(F(t));if(t instanceof Uint8Array)return W(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?W(F(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?W(F(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?W(F(t.bytes)):W(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||!P.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),a.ScVal.scvBytes(Buffer.from(X(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},Z=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return a.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return a.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function Q(e,n,i){const a=e.controllerAddress??M(e.network),s=new r(a),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:k[e.network]}).addOperation(s.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function J(t,e){const o=e.accountNonce??0,r=e.eModeCategory??0,n=V([...e.assets]);return Q(t,"supply",[O(t.caller),C(o),R(r),n])}function K(t,e){return J(t,{accountNonce:e.accountNonce,eModeCategory:e.eModeCategory,assets:[{token:e.token,amount:e.amount}]})}function Y(t,e){const o=V([...e.borrows]);return Q(t,"borrow",[O(t.caller),C(e.accountNonce),o])}function tt(t,e){return Y(t,{accountNonce:e.accountNonce,borrows:[{token:e.token,amount:e.amount}]})}function et(t,e){const o=V([...e.withdrawals]);return Q(t,"withdraw",[O(t.caller),C(e.accountNonce),o,D(e.to,O)])}function ot(t,e){return et(t,{accountNonce:e.accountNonce,withdrawals:[{token:e.token,amount:e.amount}]})}function rt(t,e){const o=V([...e.payments]);return Q(t,"repay",[O(t.caller),C(e.accountNonce),o])}function nt(t,e){return rt(t,{accountNonce:e.accountNonce,payments:[{token:e.token,amount:e.amount}]})}function ut(t,e){const o=V(e.debtPayments.map((t=>({token:t.token,amount:t.amount}))));return Q(t,"liquidate",[O(t.caller),C(e.accountNonce),o])}function it(t,e){return Q(t,"flash_loan",[O(t.caller),O(e.asset),I(e.amount),O(e.receiver),Z(e.data)])}function at(t,e){return Q(t,"migrate_from_blend",[O(t.caller),C(e.accountId),R(e.eModeCategory),O(e.blendPool),$(e.collateralTokens.map(O)),$(e.supplyTokens.map(O)),V(e.debtCaps.map((t=>({token:t.token,amount:t.cap}))))])}function st(t,e){const o=e.accountNonce??0;return Q(t,"multiply",[O(t.caller),C(o),R(e.eModeCategory),O(e.collateralToken),I(e.debtToFlashLoan),O(e.debtToken),R(e.mode),G(e.steps),D(e.initialPayment,(t=>j(t.token,t.amount))),D(e.convertSwap,G)])}function pt(t,e){return Q(t,"swap_debt",[O(t.caller),C(e.accountNonce),O(e.existingDebtToken),I(e.newDebtAmount),O(e.newDebtToken),G(e.steps)])}function ct(t,e){return Q(t,"swap_collateral",[O(t.caller),C(e.accountNonce),O(e.currentCollateral),I(e.fromAmount),O(e.newCollateral),G(e.steps)])}function dt(t,e){return Q(t,"repay_debt_with_collateral",[O(t.caller),C(e.accountNonce),O(e.collateralToken),I(e.collateralAmount),O(e.debtToken),G(e.steps),B(e.closePosition)])}const lt={Single:0,PrimaryWithAnchor:1},yt=t=>H({base_borrow_rate_ray:I(t.baseBorrowRateRay),max_borrow_rate_ray:I(t.maxBorrowRateRay),max_utilization_ray:I(t.maxUtilizationRay),mid_utilization_ray:I(t.midUtilizationRay),optimal_utilization_ray:I(t.optimalUtilizationRay),reserve_factor_bps:R(t.reserveFactorBps),slope1_ray:I(t.slope1Ray),slope2_ray:I(t.slope2Ray),slope3_ray:I(t.slope3Ray)}),ft=t=>H({asset_decimals:R(t.assetDecimals),asset_id:O(t.assetId),base_borrow_rate_ray:I(t.baseBorrowRateRay),borrow_cap:I(t.borrowCap),max_borrow_rate_ray:I(t.maxBorrowRateRay),max_utilization_ray:I(t.maxUtilizationRay),mid_utilization_ray:I(t.midUtilizationRay),optimal_utilization_ray:I(t.optimalUtilizationRay),reserve_factor_bps:R(t.reserveFactorBps),slope1_ray:I(t.slope1Ray),slope2_ray:I(t.slope2Ray),slope3_ray:I(t.slope3Ray),supply_cap:I(t.supplyCap)}),_t=t=>H({e_mode_categories:$(t.eModeCategories.map((t=>R(t)))),flashloan_fee_bps:R(t.flashloanFeeBps),is_borrowable:B(t.isBorrowable),is_collateralizable:B(t.isCollateralizable),is_flashloanable:B(t.isFlashloanable),liquidation_bonus_bps:R(t.liquidationBonusBps),liquidation_fees_bps:R(t.liquidationFeesBps),liquidation_threshold_bps:R(t.liquidationThresholdBps),loan_to_value_bps:R(t.loanToValueBps)}),mt=t=>H({max_borrow_positions:R(t.maxBorrowPositions),max_supply_positions:R(t.maxSupplyPositions)}),gt=t=>{const e=t.kind;switch(e){case"Stellar":return $([N("Stellar"),O(t.value)]);case"Symbol":return $([N("Symbol"),N(t.value)]);case"String":return $([N("String"),U(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},bt=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return $([N("Twap"),R(e)])}return $([N("Spot")])},qt=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return $([N("Reflector"),H({asset:gt(t.asset),contract:O(t.contract),read_mode:bt(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 $([N("RedStone"),H({contract:O(t.contract),feed_id:U(t.feedId),max_stale_seconds:C(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},ht=t=>{const e=lt[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return H({anchor:(o=t.anchor,$(null==o?[N("None")]:[N("Some"),qt(o)])),first_tolerance_bps:R(t.firstToleranceBps),last_tolerance_bps:R(t.lastToleranceBps),max_price_stale_seconds:C(t.maxPriceStaleSeconds),max_sanity_price_wad:I(t.maxSanityPriceWad),min_sanity_price_wad:I(t.minSanityPriceWad),primary:qt(t.primary),strategy:R(e)});var o};function vt(t,e){return Q(t,"upgrade",[z(e.wasmHash)])}function wt(t,e){return Q(t,"migrate",[R(e.newVersion)])}function At(t){return Q(t,"pause",[])}function St(t){return Q(t,"unpause",[])}function Tt(t,e){return Q(t,"grant_role",[O(e.account),N(e.role)])}function kt(t,e){return Q(t,"revoke_role",[O(e.account),N(e.role)])}function Mt(t,e){return Q(t,"transfer_ownership",[O(e.newOwner),R(e.liveUntilLedger)])}function xt(t){return Q(t,"accept_ownership",[])}function Et(t,e){return Q(t,"set_aggregator",[O(e.aggregator)])}function Pt(t,e){return Q(t,"set_accumulator",[O(e.accumulator)])}function Ot(t,e){return Q(t,"set_liquidity_pool_template",[z(e.wasmHash)])}function It(t,e){return Q(t,"edit_asset_config",[O(e.asset),_t(e.config)])}function Rt(t,e){return Q(t,"set_position_limits",[mt(e)])}function Ct(t){return Q(t,"add_e_mode_category",[])}function Bt(t,e){return Q(t,"remove_e_mode_category",[R(e.id)])}function Ut(t,e){return Q(t,"add_asset_to_e_mode_category",[O(e.asset),R(e.categoryId),B(e.canCollateral),B(e.canBorrow),R(e.ltv),R(e.threshold),R(e.bonus),I(e.supplyCap),I(e.borrowCap)])}function Nt(t,e){return Q(t,"edit_asset_in_e_mode_category",[O(e.asset),R(e.categoryId),B(e.canCollateral),B(e.canBorrow),R(e.ltv),R(e.threshold),R(e.bonus),I(e.supplyCap),I(e.borrowCap)])}function Lt(t,e){return Q(t,"update_pool_caps",[O(e.asset),I(e.supplyCap),I(e.borrowCap)])}function $t(t,e){return Q(t,"remove_asset_from_e_mode",[O(e.asset),R(e.categoryId)])}function zt(t,e){return Q(t,"approve_token",[O(e.token)])}function Dt(t,e){return Q(t,"revoke_token",[O(e.token)])}function jt(t,e){return Q(t,"configure_market_oracle",[O(t.caller),O(e.asset),ht(e.config)])}function Vt(t,e){return Q(t,"edit_oracle_tolerance",[O(t.caller),O(e.asset),R(e.firstTolerance),R(e.lastTolerance)])}function Ht(t,e){return Q(t,"disable_token_oracle",[O(t.caller),O(e.asset)])}function Xt(t,e){return Q(t,"update_indexes",[O(t.caller),$(e.assets.map((t=>O(t))))])}function Wt(t,e){return Q(t,"renew_account",[O(t.caller),C(e.accountNonce)])}function Ft(t,e){return Q(t,"create_liquidity_pool",[O(e.asset),ft(e.params),_t(e.config)])}function Gt(t,e){return Q(t,"upgrade_liquidity_pool_params",[O(e.asset),yt(e.params)])}function Zt(t,e){return Q(t,"upgrade_liquidity_pool",[O(e.asset),z(e.wasmHash)])}function Qt(t,e){return Q(t,"claim_revenue",[O(t.caller),$(e.assets.map((t=>O(t))))])}function Jt(t,e){return Q(t,"add_rewards",[O(t.caller),$(e.rewards.map((t=>$([O(t.token),I(t.amount)]))))])}function Kt(t,e){return Q(t,"update_account_threshold",[O(t.caller),O(e.asset),B(e.hasRisks),$(e.accountNonces.map((t=>C(t))))])}const Yt="00".repeat(32),te=t=>{if("string"==typeof t)return z(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 a.ScVal.scvBytes(e)};function ee(e,n,i){const a=e.governanceAddress??E(e.network),s=new r(a),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:k[e.network]}).addOperation(s.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const oe=(t,e,o,r)=>ee(t,e,[O(t.caller),...o,te(r)]),re=(t,e,o,r)=>ee(t,e,[L(),...o,te(r)]);function ne(t,e,o){return oe(t,"propose_set_aggregator",[O(e.aggregator)],o)}function ue(t,e,o){return oe(t,"propose_set_accumulator",[O(e.accumulator)],o)}function ie(t,e,o){return oe(t,"propose_set_pool_template",[z(e.wasmHash)],o)}function ae(t,e,o){return oe(t,"propose_edit_asset_config",[O(e.asset),_t(e.config)],o)}function se(t,e,o){return oe(t,"propose_set_position_limits",[mt(e)],o)}function pe(t,e,o){return oe(t,"propose_set_min_borrow_collat",[I(e.floorWad)],o)}function ce(t,e){return oe(t,"propose_add_e_mode_category",[],e)}function de(t,e,o){return oe(t,"propose_remove_e_mode_category",[R(e.id)],o)}function le(t,e,o){return oe(t,"propose_add_asset_to_e_mode",[O(e.asset),R(e.categoryId),B(e.canCollateral),B(e.canBorrow),R(e.ltv),R(e.threshold),R(e.bonus),I(e.supplyCap),I(e.borrowCap)],o)}function ye(t,e,o){return oe(t,"propose_edit_asset_in_e_mode",[O(e.asset),R(e.categoryId),B(e.canCollateral),B(e.canBorrow),R(e.ltv),R(e.threshold),R(e.bonus),I(e.supplyCap),I(e.borrowCap)],o)}function fe(t,e,o){return oe(t,"propose_update_pool_caps",[O(e.asset),I(e.supplyCap),I(e.borrowCap)],o)}function _e(t,e,o){return oe(t,"propose_remove_asset_from_e_mode",[O(e.asset),R(e.categoryId)],o)}function me(t,e,o){return oe(t,"propose_approve_token",[O(e.token)],o)}function ge(t,e,o){return oe(t,"propose_revoke_token",[O(e.token)],o)}function be(t,e,o){return oe(t,"propose_create_liquidity_pool",[O(e.asset),ft(e.params),_t(e.config)],o)}function qe(t,e,o){return oe(t,"propose_upgrade_pool_params",[O(e.asset),yt(e.params)],o)}function he(t,e){return oe(t,"propose_deploy_pool",[],e)}function ve(t,e,o){return oe(t,"propose_upgrade_pool",[z(e.wasmHash)],o)}function we(t,e,o){return oe(t,"propose_grant_controller_role",[O(e.account),N(e.role)],o)}function Ae(t,e,o){return oe(t,"propose_revoke_controller_role",[O(e.account),N(e.role)],o)}function Se(t,e,o){return oe(t,"propose_upgrade_controller",[z(e.wasmHash)],o)}function Te(t,e,o){return oe(t,"propose_migrate_controller",[R(e.newVersion)],o)}function ke(t,e,o){return oe(t,"propose_transfer_ctrl_ownership",[O(e.newOwner),R(e.liveUntilLedger)],o)}function Me(t,e,o){return oe(t,"propose_configure_market_oracle",[O(e.asset),ht(e.config)],o)}function xe(t,e,o){return oe(t,"propose_edit_oracle_tolerance",[O(e.asset),R(e.firstTolerance),R(e.lastTolerance)],o)}function Ee(t,e,o){return oe(t,"propose_governance_upgrade",[z(e.wasmHash)],o)}function Pe(t,e,o){return oe(t,"propose_update_delay",[R(e.newDelay)],o)}function Oe(t,e,o){return oe(t,"propose_grant_governance_role",[O(e.account),N(e.role)],o)}function Ie(t,e,o){return oe(t,"propose_revoke_governance_role",[O(e.account),N(e.role)],o)}function Re(t,e,o){return oe(t,"propose_transfer_gov_own",[O(e.newOwner),R(e.liveUntilLedger)],o)}function Ce(t,e){const o=$(e.argsXdr.map((t=>a.ScVal.fromXDR(t,"base64")))),r=te(e.predecessor??Yt);return ee(t,"execute",[L(),O(e.target),N(e.functionName),o,r,te(e.salt)])}function Be(t,e,o){return re(t,"execute_governance_upgrade",[z(e.wasmHash)],o)}function Ue(t,e,o){return re(t,"execute_update_delay",[R(e.newDelay)],o)}function Ne(t,e,o){return re(t,"execute_grant_governance_role",[O(e.account),N(e.role)],o)}function Le(t,e,o){return re(t,"execute_revoke_governance_role",[O(e.account),N(e.role)],o)}function $e(t,e,o){return re(t,"execute_transfer_gov_own",[O(e.newOwner),R(e.liveUntilLedger)],o)}const ze=t=>t.toXDR("base64"),De=t=>a.ScVal.fromXDR(t,"base64"),je=t=>t.map((t=>String(i(De(t))))).join(":"),Ve=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),He=t=>Number(t),Xe=t=>String(t),We=t=>null==t?void 0:Ve(t),Fe=t=>null==t?void 0:Xe(t),Ge=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),Ze=["None","Multiply","Long","Short"],Qe=["Single","PrimaryWithAnchor"],Je=["ReflectorSep40","RedStonePriceFeed"],Ke=["Spot","Twap"],Ye=["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"],to=t=>Array.isArray(t)?t:[],eo=t=>({loanToValueBps:He(t.loan_to_value_bps),liquidationThresholdBps:He(t.liquidation_threshold_bps),liquidationBonusBps:He(t.liquidation_bonus_bps),liquidationFeesBps:He(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:He(t.flashloan_fee_bps),eModeCategories:(t.e_mode_categories??[]).map(He)}),oo=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Ye[He(r)]??Ve(r)),positionType:e,asset:Xe(t[1]),scaledAmountRay:Ve(t[2]),indexRay:Ve(t[3]),amount:Ve(t[4]),liquidationThresholdBps:o?void 0:He(t[5]),liquidationBonusBps:o?void 0:He(t[6]),loanToValueBps:o?void 0:He(t[7])};var r},ro=t=>{return{owner:Xe(t[0]),eModeCategoryId:He(t[1]),mode:(e=t[2],Ze[He(e)]??"None")};var e},no=(t,e)=>{const o=Ke[He(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:Xe(r)}:null!=n?{kind:"Symbol",value:Xe(n)}:void 0;return{provider:Je[He(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:Xe(t[`${e}_contract`]),asset:u,feedId:Fe(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?He(t[`${e}_twap_records`]):void 0,decimals:He(t[`${e}_decimals`]),resolutionSeconds:He(t[`${e}_resolution_seconds`]),maxStaleSeconds:He(t[`${e}_max_stale_seconds`])}},uo=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:Xe(t.base_token_id),quoteTokenId:Xe(t.quote_token_id),tolerance:{firstUpperRatio:He(t.first_upper_ratio_bps??t.tolerance?.first_upper_ratio_bps),firstLowerRatio:He(t.first_lower_ratio_bps??t.tolerance?.first_lower_ratio_bps),lastUpperRatio:He(t.last_upper_ratio_bps??t.tolerance?.last_upper_ratio_bps),lastLowerRatio:He(t.last_lower_ratio_bps??t.tolerance?.last_lower_ratio_bps)},assetDecimals:He(t.asset_decimals),maxPriceStaleSeconds:He(t.max_price_stale_seconds),strategy:Qe[He(t.strategy)]??"Single",primary:no(t,"primary"),anchor:e?no(t,"anchor"):void 0,primaryQuoteToken:Fe(t.primary_quote_token),anchorQuoteToken:Fe(t.anchor_quote_token),minSanityPriceWad:We(t.min_sanity_price_wad),maxSanityPriceWad:We(t.max_sanity_price_wad)}},io={"market:create":t=>({topic:"market:create",data:{baseAsset:Xe(t.base_asset),maxBorrowRate:Ve(t.max_borrow_rate),baseBorrowRate:Ve(t.base_borrow_rate),slope1:Ve(t.slope1),slope2:Ve(t.slope2),slope3:Ve(t.slope3),midUtilization:Ve(t.mid_utilization),optimalUtilization:Ve(t.optimal_utilization),maxUtilization:We(t.max_utilization),reserveFactor:He(t.reserve_factor),marketAddress:Xe(t.market_address),config:eo(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Xe(t.asset),maxBorrowRateRay:Ve(t.max_borrow_rate_ray),baseBorrowRateRay:Ve(t.base_borrow_rate_ray),slope1Ray:Ve(t.slope1_ray),slope2Ray:Ve(t.slope2_ray),slope3Ray:Ve(t.slope3_ray),midUtilizationRay:Ve(t.mid_utilization_ray),optimalUtilizationRay:Ve(t.optimal_utilization_ray),maxUtilizationRay:We(t.max_utilization_ray),reserveFactorBps:He(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:to(t).map((t=>{return e=to(t),{asset:Xe(e[0]),timestamp:He(e[1]),supplyIndexRay:Ve(e[2]),borrowIndexRay:Ve(e[3]),reservesRay:Ve(e[4]),suppliedRay:Ve(e[5]),borrowedRay:Ve(e[6]),revenueRay:Ve(e[7]),assetPriceWad:We(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:to(t).map((t=>{const e=t;return{asset:Xe(e.asset),params:(o=e.params,{maxBorrowRateRay:Ve(o.max_borrow_rate_ray),baseBorrowRateRay:Ve(o.base_borrow_rate_ray),slope1Ray:Ve(o.slope1_ray),slope2Ray:Ve(o.slope2_ray),slope3Ray:Ve(o.slope3_ray),midUtilizationRay:Ve(o.mid_utilization_ray),optimalUtilizationRay:Ve(o.optimal_utilization_ray),maxUtilizationRay:We(o.max_utilization_ray),reserveFactorBps:He(o.reserve_factor_bps),supplyCap:Ve(o.supply_cap),borrowCap:Ve(o.borrow_cap),assetId:Fe(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:He(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=to(t);return{topic:"position:batch_update",data:{accountId:Ve(e[0]),accountAttributes:ro(to(e[1])),updates:[...to(e[2]).map((t=>oo(to(t),"Deposit"))),...to(e[3]).map((t=>oo(to(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:Xe(t.asset),receiver:Xe(t.receiver),caller:Xe(t.caller),amount:Ve(t.amount),fee:Ve(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:Xe(t.asset),config:eo(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Xe(t.asset),oracle:uo(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:He(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:Xe(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:He(t.config.loan_to_value_bps),liquidationThresholdBps:He(t.config.liquidation_threshold_bps),liquidationBonusBps:He(t.config.liquidation_bonus_bps),supplyCap:Ve(t.config.supply_cap),borrowCap:Ve(t.config.borrow_cap)},categoryId:He(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:Xe(t.asset),categoryId:He(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Ve(t.account_id),totalBorrowUsdWad:Ve(t.total_borrow_usd_wad),totalCollateralUsdWad:Ve(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Xe(t.token),amount:Ve(t.amount),usdValueWad:Ve(t.usd_value_wad),accountId:Ve(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{asset:Xe(t.asset),amount:Ve(t.amount),fee:Ve(t.fee),amountSent:Ve(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Ge(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Xe(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Xe(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Ge(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:He(t.max_supply_positions),maxBorrowPositions:He(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Xe(t.asset)}}),"oracle:twap_degraded":t=>({topic:"oracle:twap_degraded",data:{oracle:Xe(t.oracle),reasonCode:He(t.reason_code)}})},ao=Object.freeze(Object.keys(io));function so(t,e){const o=je(t),r=io[o];return r?r(i(De(e))):null}const po="XLENDXLM-a7c9f3",co=1e4;function lo(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${po}-${o}`}function yo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function fo(t,e=0){return 1e4*t+e}function _o(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const mo=(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()},go=t=>t.baseUrl??T[t.network];async function bo(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=mo(go(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 qo(t){const e=mo(go(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 ho=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,vo=t=>X(t).toXDR("base64");function wo(e,n){const i=e.routerAddress??x(e.network),a=new r(i),s=new t(e.caller,e.sourceSequence),p=G(ho(n,e.referralId));return{xdr:new u(s,{fee:e.fee??o,networkPassphrase:k[e.network]}).addOperation(a.call("execute_strategy",O(e.caller),I(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ao(t,e){return wo(t,e)}function So(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(Mo),splitPpm:t.splitPpm}))):[{hops:t.hops.map(Mo),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function To(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:So(t,e)}const ko=So,Mo=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function xo(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Eo(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw xo(o.invokedContractId,t);throw t}}async function Po(t,e,o){return Eo(t,e.xdr,o)}function Oo(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Io(t,e){return{paths:[{hops:[{amountOut:"0",pool:t,tokenIn:t,tokenOut:t,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:t,tokenOut:t,totalMinOut:e}}const Ro=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 Co(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",a.ScVal.scvBytes(Ro(e.message)),a.ScVal.scvBytes(Ro(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:k[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Bo=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function Uo(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)))),s=/:address[^A-Z]/.test(t)||"address"in a,p=/:collection[^A-Z]/.test(t)||"collection"in a;if(s){const t=n.address;if(!b(t))throw new g(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!f(t))):!f(t))throw new m(t)}const c=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:d,auth:l,method:y,headers:_,cache:q,next:h,debug:v,continuationToken:w,...A}=c,S=l?`Bearer ${l}`:void 0,T={..._,...S?{Authorization:S}:{},...w?{"X-Continuation-Token":String(w)}:{}},k={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:A,body:d,headers:T,cache:q,debug:v,...k?{next:k}:{}})},s=(t={})=>a(t);for(const t of Object.keys(i))h.includes(t)&&(s[t]=e=>a({...e,method:e.method??t.toUpperCase()}));return s}function No(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(q)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=Bo(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=Bo(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,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=Uo(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[Bo(o.split("/").pop().replace(/^:/,""))]=Uo(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,{})}export{l as Chain,w as STELLAR_AGGREGATOR_ROUTER,A as STELLAR_GOVERNANCE,Yt as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,v as STELLAR_LENDING_CONTROLLER,ao as STELLAR_LENDING_TOPICS,k as STELLAR_NETWORK_PASSPHRASE,T as STELLAR_QUOTE_URL,S as STELLAR_SOROBAN_RPC_URL,co as SYNTHETIC_EVENT_ORDER_STRIDE,y as XOXNOClient,po as XOXNO_LENDING_STELLAR_TICKER,Io as buildSameTokenRepaySwapSteps,No as buildSdk,xt as buildStellarAcceptOwnershipTx,Ut as buildStellarAddAssetToEModeCategoryTx,Ct as buildStellarAddEModeCategoryTx,Jt as buildStellarAddRewardsTx,zt as buildStellarApproveTokenTx,Ao as buildStellarBatchSwapTx,Y as buildStellarBorrowBatchTx,tt as buildStellarBorrowTx,Co as buildStellarCctpForwardTx,Qt as buildStellarClaimRevenueTx,jt as buildStellarConfigureMarketOracleTx,Ft as buildStellarCreateLiquidityPoolTx,Ht as buildStellarDisableTokenOracleTx,It as buildStellarEditAssetConfigTx,Nt as buildStellarEditAssetInEModeCategoryTx,Vt as buildStellarEditOracleToleranceTx,wo as buildStellarExecuteStrategyTx,it as buildStellarFlashLoanTx,Be as buildStellarGovernanceExecuteGovernanceUpgradeTx,Ne as buildStellarGovernanceExecuteGrantGovernanceRoleTx,Le as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,$e as buildStellarGovernanceExecuteTransferGovOwnTx,Ce as buildStellarGovernanceExecuteTx,Ue as buildStellarGovernanceExecuteUpdateDelayTx,Tt as buildStellarGrantRoleTx,lo as buildStellarLendingIdentifier,ut as buildStellarLiquidateTx,at as buildStellarMigrateFromBlendTx,wt as buildStellarMigrateTx,st as buildStellarMultiplyTx,At as buildStellarPauseTx,le as buildStellarProposeAddAssetToEModeTx,ce as buildStellarProposeAddEModeCategoryTx,me as buildStellarProposeApproveTokenTx,Me as buildStellarProposeConfigureMarketOracleTx,be as buildStellarProposeCreateLiquidityPoolTx,he as buildStellarProposeDeployPoolTx,ae as buildStellarProposeEditAssetConfigTx,ye as buildStellarProposeEditAssetInEModeTx,xe as buildStellarProposeEditOracleToleranceTx,Ee as buildStellarProposeGovernanceUpgradeTx,we as buildStellarProposeGrantControllerRoleTx,Oe as buildStellarProposeGrantGovernanceRoleTx,Te as buildStellarProposeMigrateControllerTx,_e as buildStellarProposeRemoveAssetFromEModeTx,de as buildStellarProposeRemoveEModeCategoryTx,Ae as buildStellarProposeRevokeControllerRoleTx,Ie as buildStellarProposeRevokeGovernanceRoleTx,ge as buildStellarProposeRevokeTokenTx,ue as buildStellarProposeSetAccumulatorTx,ne as buildStellarProposeSetAggregatorTx,pe as buildStellarProposeSetMinBorrowCollatTx,ie as buildStellarProposeSetPoolTemplateTx,se as buildStellarProposeSetPositionLimitsTx,ke as buildStellarProposeTransferCtrlOwnershipTx,Re as buildStellarProposeTransferGovOwnTx,Pe as buildStellarProposeUpdateDelayTx,fe as buildStellarProposeUpdatePoolCapsTx,Se as buildStellarProposeUpgradeControllerTx,qe as buildStellarProposeUpgradePoolParamsTx,ve as buildStellarProposeUpgradePoolTx,$t as buildStellarRemoveAssetFromEModeTx,Bt as buildStellarRemoveEModeCategoryTx,Wt as buildStellarRenewAccountTx,rt as buildStellarRepayBatchTx,dt as buildStellarRepayDebtWithCollateralTx,nt as buildStellarRepayTx,kt as buildStellarRevokeRoleTx,Dt as buildStellarRevokeTokenTx,Pt as buildStellarSetAccumulatorTx,Et as buildStellarSetAggregatorTx,Ot as buildStellarSetLiquidityPoolTemplateTx,Rt as buildStellarSetPositionLimitsTx,J as buildStellarSupplyBatchTx,K as buildStellarSupplyTx,ct as buildStellarSwapCollateralTx,pt as buildStellarSwapDebtTx,Mt as buildStellarTransferOwnershipTx,St as buildStellarUnpauseTx,Kt as buildStellarUpdateAccountThresholdTx,Xt as buildStellarUpdateIndexesTx,Lt as buildStellarUpdatePoolCapsTx,vt as buildStellarUpgradeControllerTx,Gt as buildStellarUpgradeLiquidityPoolParamsTx,Zt as buildStellarUpgradeLiquidityPoolTx,et as buildStellarWithdrawBatchTx,ot as buildStellarWithdrawTx,Q as buildTx,so as decodeStellarLendingEvent,_t as encodeAssetConfigRaw,yt as encodeInterestRateModel,ht as encodeMarketOracleConfigInput,ft as encodeMarketParamsRaw,qt as encodeOracleSourceConfigInput,mt as encodePositionLimits,vo as encodeStrategyPayloadToRouteXdr,yo as extractEventOrder,bo as getStellarAggregatorQuote,x as getStellarAggregatorRouter,E as getStellarGovernance,M as getStellarLendingController,qo as getStellarQuoteTokens,f as isValidCollectionTicker,_ as isValidNftIdentifier,ko as mapQuoteResponseToAggregatorSwap,So as mapQuoteResponseToStrategyPayload,To as mapQuoteResponseToStrategySwap,_o as mapStellarPositionActivityType,Po as prepareStellarBuiltTx,Eo as prepareStellarTxXdr,je as stellarLendingDispatchKey,fo as syntheticEventOrder,xo as tagStellarInvokedContractError,ze as toBase64Xdr,Oo as toStellarPositionMode};
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as a}from"@stellar/stellar-sdk";const s="https://api.xoxno.com",p="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",c="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",d="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(t){t.MAINNET="1",t.DEVNET="D"}(l||(l={}));class y{apiUrl;chain;init;config;constructor({chain:t=l.MAINNET,apiUrl:e=s,...o}={}){this.apiUrl=e??{[l.MAINNET]:s,[l.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:p,DR_SC:c,KG_SC:d,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:p,DR_SC:c,KG_SC:d,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:c,method:d="GET",...l}=o,y=c?.Authorization,f="Bearer undefined"===y?void 0:y,m={...c,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...f?{Authorization:f}:{}},b=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${b.length?`?${b}`:""}`,{revalidate:_,...q}=r??{},{revalidate:h,...v}=a??{},w="GET"!==d||f?void 0:h??_,A="GET"!==d||f||w?void 0:s??n,S={...i,...l,method:d,...Object.keys(m).length?{headers:m}:{},cache:A,next:{...q,...v,revalidate:w}};(p??u)&&console.debug("SDK fetch: ",g,S);const T=await fetch(g,S).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${t.message}`),{cause:t});throw t})),k=await T.text();if(!T.ok){let t;try{t=JSON.parse(k)}catch{t={message:k}}const e=[g,T.status,T.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(k)}catch{return k}}}const f=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},m=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 b extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class g extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const _=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)),q={"/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"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},h=["PATCH","POST","DELETE","PUT"],v={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},w={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},A={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},S={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},T={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"},k={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function M(t){const e=v[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 x(t){const e=w[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 E(t){const e=A[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const P=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],O=t=>new e(t).toScVal(),I=t=>new n(t).toI128(),R=t=>a.ScVal.scvU32(t),C=t=>new n("string"==typeof t?t:t.toString()).toU64(),U=t=>a.ScVal.scvBool(t),B=t=>a.ScVal.scvString(t),N=t=>a.ScVal.scvSymbol(t),L=()=>a.ScVal.scvVoid(),$=t=>a.ScVal.scvVec(t),z=(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 a.ScVal.scvBytes(r)},D=(t,e)=>null==t?L():e(t),j=(t,e)=>a.ScVal.scvVec([O(t),I(e)]),V=t=>a.ScVal.scvVec(t.map((t=>j(t.token,t.amount)))),G=t=>{const e=Object.keys(t).sort().map((e=>new a.ScMapEntry({key:N(e),val:t[e]})));return a.ScVal.scvMap(e)},H=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return G({amount_out:I(t.amountOut),pool:O(t.pool),token_in:O(t.tokenIn),token_out:O(t.tokenOut),venue:(e=t.venue,a.ScVal.scvVec([N(e)]))});var e}));return G({hops:a.ScVal.scvVec(e),split_ppm:R(t.splitPpm)})}));return G({paths:a.ScVal.scvVec(e),referral_id:C(t.referralId??0),token_in:O(t.tokenIn),token_out:O(t.tokenOut),total_min_out:I(t.totalMinOut)})},X=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 a.ScVal.scvBytes(e)},W=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},F=t=>{if("string"==typeof t)return X(W(t));if(t instanceof Uint8Array)return X(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?X(W(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?X(W(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?X(W(t.bytes)):X(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||!P.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),a.ScVal.scvBytes(Buffer.from(H(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},Z=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return a.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return a.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function Q(e,n,i){const a=e.controllerAddress??M(e.network),s=new r(a),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:k[e.network]}).addOperation(s.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function J(t,e){const o=e.accountNonce??0,r=e.eModeCategory??0,n=V([...e.assets]);return Q(t,"supply",[O(t.caller),C(o),R(r),n])}function K(t,e){return J(t,{accountNonce:e.accountNonce,eModeCategory:e.eModeCategory,assets:[{token:e.token,amount:e.amount}]})}function Y(t,e){const o=V([...e.borrows]);return Q(t,"borrow",[O(t.caller),C(e.accountNonce),o])}function tt(t,e){return Y(t,{accountNonce:e.accountNonce,borrows:[{token:e.token,amount:e.amount}]})}function et(t,e){const o=V([...e.withdrawals]);return Q(t,"withdraw",[O(t.caller),C(e.accountNonce),o,D(e.to,O)])}function ot(t,e){return et(t,{accountNonce:e.accountNonce,withdrawals:[{token:e.token,amount:e.amount}]})}function rt(t,e){const o=V([...e.payments]);return Q(t,"repay",[O(t.caller),C(e.accountNonce),o])}function nt(t,e){return rt(t,{accountNonce:e.accountNonce,payments:[{token:e.token,amount:e.amount}]})}function ut(t,e){const o=V(e.debtPayments.map((t=>({token:t.token,amount:t.amount}))));return Q(t,"liquidate",[O(t.caller),C(e.accountNonce),o])}function it(t,e){return Q(t,"flash_loan",[O(t.caller),O(e.asset),I(e.amount),O(e.receiver),Z(e.data)])}function at(t,e){return Q(t,"migrate_from_blend",[O(t.caller),C(e.accountId),R(e.eModeCategory),O(e.blendPool),$(e.collateralTokens.map(O)),$(e.supplyTokens.map(O)),V(e.debtCaps.map((t=>({token:t.token,amount:t.cap}))))])}function st(t,e){const o=e.accountNonce??0;return Q(t,"multiply",[O(t.caller),C(o),R(e.eModeCategory),O(e.collateralToken),I(e.debtToFlashLoan),O(e.debtToken),R(e.mode),F(e.steps),D(e.initialPayment,(t=>j(t.token,t.amount))),D(e.convertSwap,F)])}function pt(t,e){return Q(t,"swap_debt",[O(t.caller),C(e.accountNonce),O(e.existingDebtToken),I(e.newDebtAmount),O(e.newDebtToken),F(e.steps)])}function ct(t,e){return Q(t,"swap_collateral",[O(t.caller),C(e.accountNonce),O(e.currentCollateral),I(e.fromAmount),O(e.newCollateral),F(e.steps)])}function dt(t,e){return Q(t,"repay_debt_with_collateral",[O(t.caller),C(e.accountNonce),O(e.collateralToken),I(e.collateralAmount),O(e.debtToken),F(e.steps),U(e.closePosition)])}const lt={Single:0,PrimaryWithAnchor:1},yt=t=>G({base_borrow_rate_ray:I(t.baseBorrowRateRay),max_borrow_rate_ray:I(t.maxBorrowRateRay),max_utilization_ray:I(t.maxUtilizationRay),mid_utilization_ray:I(t.midUtilizationRay),optimal_utilization_ray:I(t.optimalUtilizationRay),reserve_factor_bps:R(t.reserveFactorBps),slope1_ray:I(t.slope1Ray),slope2_ray:I(t.slope2Ray),slope3_ray:I(t.slope3Ray)}),ft=t=>G({asset_decimals:R(t.assetDecimals),asset_id:O(t.assetId),base_borrow_rate_ray:I(t.baseBorrowRateRay),borrow_cap:I(t.borrowCap),max_borrow_rate_ray:I(t.maxBorrowRateRay),max_utilization_ray:I(t.maxUtilizationRay),mid_utilization_ray:I(t.midUtilizationRay),optimal_utilization_ray:I(t.optimalUtilizationRay),reserve_factor_bps:R(t.reserveFactorBps),slope1_ray:I(t.slope1Ray),slope2_ray:I(t.slope2Ray),slope3_ray:I(t.slope3Ray),supply_cap:I(t.supplyCap)}),mt=t=>G({asset_decimals:R(0),e_mode_categories:$(t.eModeCategories.map((t=>R(t)))),flashloan_fee_bps:R(t.flashloanFeeBps),is_borrowable:U(t.isBorrowable),is_collateralizable:U(t.isCollateralizable),is_flashloanable:U(t.isFlashloanable),liquidation_bonus_bps:R(t.liquidationBonusBps),liquidation_fees_bps:R(t.liquidationFeesBps),liquidation_threshold_bps:R(t.liquidationThresholdBps),loan_to_value_bps:R(t.loanToValueBps)}),bt=t=>G({max_borrow_positions:R(t.maxBorrowPositions),max_supply_positions:R(t.maxSupplyPositions)}),gt=t=>{const e=t.kind;switch(e){case"Stellar":return $([N("Stellar"),O(t.value)]);case"Symbol":return $([N("Symbol"),N(t.value)]);case"String":return $([N("String"),B(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},_t=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return $([N("Twap"),R(e)])}return $([N("Spot")])},qt=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return $([N("Reflector"),G({asset:gt(t.asset),contract:O(t.contract),read_mode:_t(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 $([N("RedStone"),G({contract:O(t.contract),feed_id:B(t.feedId),max_stale_seconds:C(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},ht=t=>{const e=lt[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return G({anchor:(o=t.anchor,$(null==o?[N("None")]:[N("Some"),qt(o)])),first_tolerance_bps:R(t.firstToleranceBps),last_tolerance_bps:R(t.lastToleranceBps),max_price_stale_seconds:C(t.maxPriceStaleSeconds),max_sanity_price_wad:I(t.maxSanityPriceWad),min_sanity_price_wad:I(t.minSanityPriceWad),primary:qt(t.primary),strategy:R(e)});var o};function vt(t,e){return Q(t,"upgrade",[z(e.wasmHash)])}function wt(t,e){return Q(t,"migrate",[R(e.newVersion)])}function At(t){return Q(t,"pause",[])}function St(t){return Q(t,"unpause",[])}function Tt(t,e){return Q(t,"grant_role",[O(e.account),N(e.role)])}function kt(t,e){return Q(t,"revoke_role",[O(e.account),N(e.role)])}function Mt(t,e){return Q(t,"transfer_ownership",[O(e.newOwner),R(e.liveUntilLedger)])}function xt(t){return Q(t,"accept_ownership",[])}function Et(t,e){return Q(t,"set_aggregator",[O(e.aggregator)])}function Pt(t,e){return Q(t,"set_accumulator",[O(e.accumulator)])}function Ot(t,e){return Q(t,"set_liquidity_pool_template",[z(e.wasmHash)])}function It(t,e){return Q(t,"edit_asset_config",[O(e.asset),mt(e.config)])}function Rt(t,e){return Q(t,"set_position_limits",[bt(e)])}function Ct(t){return Q(t,"add_e_mode_category",[])}function Ut(t,e){return Q(t,"remove_e_mode_category",[R(e.id)])}function Bt(t,e){return Q(t,"add_asset_to_e_mode_category",[O(e.asset),R(e.categoryId),U(e.canCollateral),U(e.canBorrow),R(e.ltv),R(e.threshold),R(e.bonus),I(e.supplyCap),I(e.borrowCap)])}function Nt(t,e){return Q(t,"edit_asset_in_e_mode_category",[O(e.asset),R(e.categoryId),U(e.canCollateral),U(e.canBorrow),R(e.ltv),R(e.threshold),R(e.bonus),I(e.supplyCap),I(e.borrowCap)])}function Lt(t,e){return Q(t,"update_pool_caps",[O(e.asset),I(e.supplyCap),I(e.borrowCap)])}function $t(t,e){return Q(t,"remove_asset_from_e_mode",[O(e.asset),R(e.categoryId)])}function zt(t,e){return Q(t,"approve_token",[O(e.token)])}function Dt(t,e){return Q(t,"revoke_token",[O(e.token)])}function jt(t,e){return Q(t,"configure_market_oracle",[O(t.caller),O(e.asset),ht(e.config)])}function Vt(t,e){return Q(t,"edit_oracle_tolerance",[O(t.caller),O(e.asset),R(e.firstTolerance),R(e.lastTolerance)])}function Gt(t,e){return Q(t,"disable_token_oracle",[O(t.caller),O(e.asset)])}function Ht(t,e){return Q(t,"update_indexes",[O(t.caller),$(e.assets.map((t=>O(t))))])}function Xt(t,e){return Q(t,"renew_account",[O(t.caller),C(e.accountNonce)])}function Wt(t,e){return Q(t,"create_liquidity_pool",[O(e.asset),ft(e.params),mt(e.config)])}function Ft(t,e){return Q(t,"upgrade_liquidity_pool_params",[O(e.asset),yt(e.params)])}function Zt(t,e){return Q(t,"upgrade_liquidity_pool",[O(e.asset),z(e.wasmHash)])}function Qt(t,e){return Q(t,"claim_revenue",[O(t.caller),$(e.assets.map((t=>O(t))))])}function Jt(t,e){return Q(t,"add_rewards",[O(t.caller),$(e.rewards.map((t=>$([O(t.token),I(t.amount)]))))])}function Kt(t,e){return Q(t,"update_account_threshold",[O(t.caller),O(e.asset),U(e.hasRisks),$(e.accountNonces.map((t=>C(t))))])}const Yt="00".repeat(32),te=t=>{if("string"==typeof t)return z(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 a.ScVal.scvBytes(e)},ee=(t,...e)=>$([N(t),...e]),oe=t=>G({asset:O(t.asset),category_id:R(t.categoryId),can_collateral:U(t.canCollateral),can_borrow:U(t.canBorrow),ltv:R(t.ltv),threshold:R(t.threshold),bonus:R(t.bonus),supply_cap:I(t.supplyCap),borrow_cap:I(t.borrowCap)}),re=t=>G({new_owner:O(t.newOwner),live_until_ledger:R(t.liveUntilLedger)}),ne=t=>G({account:O(t.account),role:N(t.role)});function ue(e,n,i){const a=e.governanceAddress??E(e.network),s=new r(a),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:k[e.network]}).addOperation(s.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ie=(t,e,o)=>ue(t,"propose",[O(t.caller),e,te(o)]),ae=(t,e,o)=>ue(t,"execute_self",[L(),e,te(o)]);function se(t,e,o){return ie(t,ee("SetAggregator",O(e.aggregator)),o)}function pe(t,e,o){return ie(t,ee("SetAccumulator",O(e.accumulator)),o)}function ce(t,e,o){return ie(t,ee("SetLiquidityPoolTemplate",z(e.wasmHash)),o)}function de(t,e,o){return ie(t,ee("EditAssetConfig",O(e.asset),mt(e.config)),o)}function le(t,e,o){return ie(t,ee("SetPositionLimits",bt(e)),o)}function ye(t,e,o){return ie(t,ee("SetMinBorrowCollateralUsd",I(e.floorWad)),o)}function fe(t,e){return ie(t,ee("AddEModeCategory"),e)}function me(t,e,o){return ie(t,ee("RemoveEModeCategory",R(e.id)),o)}function be(t,e,o){return ie(t,ee("AddAssetToEModeCategory",oe(e)),o)}function ge(t,e,o){return ie(t,ee("EditAssetInEModeCategory",oe(e)),o)}function _e(t,e,o){return ie(t,ee("UpdatePoolCaps",G({asset:O((r=e).asset),supply_cap:I(r.supplyCap),borrow_cap:I(r.borrowCap)})),o);var r}function qe(t,e,o){return ie(t,ee("RemoveAssetFromEMode",G({asset:O((r=e).asset),category_id:R(r.categoryId)})),o);var r}function he(t,e,o){return ie(t,ee("ApproveToken",O(e.token)),o)}function ve(t,e,o){return ie(t,ee("RevokeToken",O(e.token)),o)}function we(t,e,o){return ie(t,ee("ApproveBlendPool",O(e.pool)),o)}function Ae(t,e,o){return ie(t,ee("RevokeBlendPool",O(e.pool)),o)}function Se(t,e,o){return ie(t,ee("CreateLiquidityPool",G({asset:O((r=e).asset),params:ft(r.params),config:mt(r.config)})),o);var r}function Te(t,e,o){return ie(t,ee("UpgradeLiquidityPoolParams",G({asset:O((r=e).asset),params:yt(r.params)})),o);var r}function ke(t,e){return ie(t,ee("DeployPool"),e)}function Me(t,e,o){return ie(t,ee("UpgradePool",z(e.wasmHash)),o)}function xe(t,e,o){return ie(t,ee("DisableTokenOracle",O(e.asset)),o)}function Ee(t,e,o){return ie(t,ee("UpgradeController",z(e.wasmHash)),o)}function Pe(t,e,o){return ie(t,ee("MigrateController",R(e.newVersion)),o)}function Oe(t,e,o){return ie(t,ee("TransferCtrlOwnership",re(e)),o)}function Ie(t,e,o){return ie(t,ee("ConfigureMarketOracle",G({asset:O((r=e).asset),cfg:ht(r.config)})),o);var r}function Re(t,e,o){return ie(t,ee("EditOracleTolerance",G({asset:O((r=e).asset),first_tolerance:R(r.firstTolerance),last_tolerance:R(r.lastTolerance)})),o);var r}function Ce(t,e,o){return ie(t,ee("UpgradeGov",z(e.wasmHash)),o)}function Ue(t,e,o){return ie(t,ee("UpdateGovDelay",R(e.newDelay)),o)}function Be(t,e,o){return ie(t,ee("GrantGovRole",ne(e)),o)}function Ne(t,e,o){return ie(t,ee("RevokeGovRole",ne(e)),o)}function Le(t,e,o){return ie(t,ee("TransferGovOwnership",re(e)),o)}function $e(t,e){const o=$(e.argsXdr.map((t=>a.ScVal.fromXDR(t,"base64")))),r=te(e.predecessor??Yt);return ue(t,"execute",[L(),O(e.target),N(e.functionName),o,r,te(e.salt)])}function ze(t,e,o){return ae(t,ee("UpgradeGov",z(e.wasmHash)),o)}function De(t,e,o){return ae(t,ee("UpdateGovDelay",R(e.newDelay)),o)}function je(t,e,o){return ae(t,ee("GrantGovRole",ne(e)),o)}function Ve(t,e,o){return ae(t,ee("RevokeGovRole",ne(e)),o)}function Ge(t,e,o){return ae(t,ee("TransferGovOwnership",re(e)),o)}const He=t=>t.toXDR("base64"),Xe=t=>a.ScVal.fromXDR(t,"base64"),We=t=>t.map((t=>String(i(Xe(t))))).join(":"),Fe=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Ze=t=>Number(t),Qe=t=>String(t),Je=t=>null==t?void 0:Fe(t),Ke=t=>null==t?void 0:Qe(t),Ye=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),to=["None","Multiply","Long","Short"],eo=["Single","PrimaryWithAnchor"],oo=["ReflectorSep40","RedStonePriceFeed"],ro=["Spot","Twap"],no=["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"],uo=t=>Array.isArray(t)?t:[],io=t=>({loanToValueBps:Ze(t.loan_to_value_bps),liquidationThresholdBps:Ze(t.liquidation_threshold_bps),liquidationBonusBps:Ze(t.liquidation_bonus_bps),liquidationFeesBps:Ze(t.liquidation_fees_bps),isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),isFlashloanable:Boolean(t.is_flashloanable),flashloanFeeBps:Ze(t.flashloan_fee_bps),eModeCategories:(t.e_mode_categories??[]).map(Ze)}),ao=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],no[Ze(r)]??Fe(r)),positionType:e,asset:Qe(t[1]),scaledAmountRay:Fe(t[2]),indexRay:Fe(t[3]),amount:Fe(t[4]),liquidationThresholdBps:o?void 0:Ze(t[5]),liquidationBonusBps:o?void 0:Ze(t[6]),loanToValueBps:o?void 0:Ze(t[7])};var r},so=t=>{return{owner:Qe(t[0]),eModeCategoryId:Ze(t[1]),mode:(e=t[2],to[Ze(e)]??"None")};var e},po=(t,e)=>{const o=ro[Ze(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:Qe(r)}:null!=n?{kind:"Symbol",value:Qe(n)}:void 0;return{provider:oo[Ze(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:Qe(t[`${e}_contract`]),asset:u,feedId:Ke(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Ze(t[`${e}_twap_records`]):void 0,decimals:Ze(t[`${e}_decimals`]),resolutionSeconds:Ze(t[`${e}_resolution_seconds`]),maxStaleSeconds:Ze(t[`${e}_max_stale_seconds`])}},co=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:Qe(t.base_token_id),quoteTokenId:Qe(t.quote_token_id),tolerance:{firstUpperRatio:Ze(t.first_upper_ratio_bps??t.tolerance?.first_upper_ratio_bps),firstLowerRatio:Ze(t.first_lower_ratio_bps??t.tolerance?.first_lower_ratio_bps),lastUpperRatio:Ze(t.last_upper_ratio_bps??t.tolerance?.last_upper_ratio_bps),lastLowerRatio:Ze(t.last_lower_ratio_bps??t.tolerance?.last_lower_ratio_bps)},assetDecimals:Ze(t.asset_decimals),maxPriceStaleSeconds:Ze(t.max_price_stale_seconds),strategy:eo[Ze(t.strategy)]??"Single",primary:po(t,"primary"),anchor:e?po(t,"anchor"):void 0,primaryQuoteToken:Ke(t.primary_quote_token),anchorQuoteToken:Ke(t.anchor_quote_token),minSanityPriceWad:Je(t.min_sanity_price_wad),maxSanityPriceWad:Je(t.max_sanity_price_wad)}},lo={"market:create":t=>({topic:"market:create",data:{baseAsset:Qe(t.base_asset),maxBorrowRate:Fe(t.max_borrow_rate),baseBorrowRate:Fe(t.base_borrow_rate),slope1:Fe(t.slope1),slope2:Fe(t.slope2),slope3:Fe(t.slope3),midUtilization:Fe(t.mid_utilization),optimalUtilization:Fe(t.optimal_utilization),maxUtilization:Je(t.max_utilization),reserveFactor:Ze(t.reserve_factor),marketAddress:Qe(t.market_address),config:io(t.config)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Qe(t.asset),maxBorrowRateRay:Fe(t.max_borrow_rate_ray),baseBorrowRateRay:Fe(t.base_borrow_rate_ray),slope1Ray:Fe(t.slope1_ray),slope2Ray:Fe(t.slope2_ray),slope3Ray:Fe(t.slope3_ray),midUtilizationRay:Fe(t.mid_utilization_ray),optimalUtilizationRay:Fe(t.optimal_utilization_ray),maxUtilizationRay:Je(t.max_utilization_ray),reserveFactorBps:Ze(t.reserve_factor_bps)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:uo(t).map((t=>{return e=uo(t),{asset:Qe(e[0]),timestamp:Ze(e[1]),supplyIndexRay:Fe(e[2]),borrowIndexRay:Fe(e[3]),reservesRay:Fe(e[4]),suppliedRay:Fe(e[5]),borrowedRay:Fe(e[6]),revenueRay:Fe(e[7]),assetPriceWad:Je(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:uo(t).map((t=>{const e=t;return{asset:Qe(e.asset),params:(o=e.params,{maxBorrowRateRay:Fe(o.max_borrow_rate_ray),baseBorrowRateRay:Fe(o.base_borrow_rate_ray),slope1Ray:Fe(o.slope1_ray),slope2Ray:Fe(o.slope2_ray),slope3Ray:Fe(o.slope3_ray),midUtilizationRay:Fe(o.mid_utilization_ray),optimalUtilizationRay:Fe(o.optimal_utilization_ray),maxUtilizationRay:Je(o.max_utilization_ray),reserveFactorBps:Ze(o.reserve_factor_bps),supplyCap:Fe(o.supply_cap),borrowCap:Fe(o.borrow_cap),assetId:Ke(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:Ze(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=uo(t);return{topic:"position:batch_update",data:{accountId:Fe(e[0]),accountAttributes:so(uo(e[1])),updates:[...uo(e[2]).map((t=>ao(uo(t),"Deposit"))),...uo(e[3]).map((t=>ao(uo(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{asset:Qe(t.asset),receiver:Qe(t.receiver),caller:Qe(t.caller),amount:Fe(t.amount),fee:Fe(t.fee)}}),"config:asset":t=>({topic:"config:asset",data:{asset:Qe(t.asset),config:io(t.config)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Qe(t.asset),oracle:co(t.oracle)}}),"config:emode_category":t=>({topic:"config:emode_category",data:{category:{categoryId:Ze(t.category.category_id),isDeprecated:Boolean(t.category.is_deprecated)}}}),"config:emode_asset":t=>({topic:"config:emode_asset",data:{asset:Qe(t.asset),config:{isCollateralizable:Boolean(t.config.is_collateralizable),isBorrowable:Boolean(t.config.is_borrowable),loanToValueBps:Ze(t.config.loan_to_value_bps),liquidationThresholdBps:Ze(t.config.liquidation_threshold_bps),liquidationBonusBps:Ze(t.config.liquidation_bonus_bps),supplyCap:Fe(t.config.supply_cap),borrowCap:Fe(t.config.borrow_cap)},categoryId:Ze(t.category_id)}}),"config:remove_emode_asset":t=>({topic:"config:remove_emode_asset",data:{asset:Qe(t.asset),categoryId:Ze(t.category_id)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Fe(t.account_id),totalBorrowUsdWad:Fe(t.total_borrow_usd_wad),totalCollateralUsdWad:Fe(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Qe(t.token),amount:Fe(t.amount),usdValueWad:Fe(t.usd_value_wad),accountId:Fe(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{asset:Qe(t.asset),amount:Fe(t.amount),fee:Fe(t.fee),amountSent:Fe(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Ye(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Qe(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Qe(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Ye(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Ze(t.max_supply_positions),maxBorrowPositions:Ze(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Qe(t.asset)}}),"oracle:twap_degraded":t=>({topic:"oracle:twap_degraded",data:{oracle:Qe(t.oracle),reasonCode:Ze(t.reason_code)}})},yo=Object.freeze(Object.keys(lo));function fo(t,e){const o=We(t),r=lo[o];return r?r(i(Xe(e))):null}const mo="XLENDXLM-a7c9f3",bo=1e4;function go(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${mo}-${o}`}function _o(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function qo(t,e=0){return 1e4*t+e}function ho(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const vo=(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()},wo=t=>t.baseUrl??T[t.network];async function Ao(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=vo(wo(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 So(t){const e=vo(wo(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 To=(t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t,ko=t=>H(t).toXDR("base64");function Mo(e,n){const i=e.routerAddress??x(e.network),a=new r(i),s=new t(e.caller,e.sourceSequence),p=F(To(n,e.referralId));return{xdr:new u(s,{fee:e.fee??o,networkPassphrase:k[e.network]}).addOperation(a.call("execute_strategy",O(e.caller),I(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function xo(t,e){return Mo(t,e)}function Eo(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(Io),splitPpm:t.splitPpm}))):[{hops:t.hops.map(Io),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function Po(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Eo(t,e)}const Oo=Eo,Io=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function Ro(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Co(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw Ro(o.invokedContractId,t);throw t}}async function Uo(t,e,o){return Co(t,e.xdr,o)}function Bo(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function No(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 Lo=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 $o(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",a.ScVal.scvBytes(Lo(e.message)),a.ScVal.scvBytes(Lo(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:k[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const zo=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function Do(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)))),s=/:address[^A-Z]/.test(t)||"address"in a,p=/:collection[^A-Z]/.test(t)||"collection"in a;if(s){const t=n.address;if(!_(t))throw new g(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!f(t))):!f(t))throw new b(t)}const c=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:d,auth:l,method:y,headers:m,cache:q,next:h,debug:v,continuationToken:w,...A}=c,S=l?`Bearer ${l}`:void 0,T={...m,...S?{Authorization:S}:{},...w?{"X-Continuation-Token":String(w)}:{}},k={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:A,body:d,headers:T,cache:q,debug:v,...k?{next:k}:{}})},s=(t={})=>a(t);for(const t of Object.keys(i))h.includes(t)&&(s[t]=e=>a({...e,method:e.method??t.toUpperCase()}));return s}function jo(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(q)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=zo(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=zo(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,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=Do(o,n,r,t)}else{a={};for(const{rawPath:o,def:n}of e.leaves)a[zo(o.split("/").pop().replace(/^:/,""))]=Do(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,{})}export{l as Chain,w as STELLAR_AGGREGATOR_ROUTER,A as STELLAR_GOVERNANCE,Yt as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,v as STELLAR_LENDING_CONTROLLER,yo as STELLAR_LENDING_TOPICS,k as STELLAR_NETWORK_PASSPHRASE,T as STELLAR_QUOTE_URL,S as STELLAR_SOROBAN_RPC_URL,bo as SYNTHETIC_EVENT_ORDER_STRIDE,y as XOXNOClient,mo as XOXNO_LENDING_STELLAR_TICKER,No as buildSameTokenRepaySwapSteps,jo as buildSdk,xt as buildStellarAcceptOwnershipTx,Bt as buildStellarAddAssetToEModeCategoryTx,Ct as buildStellarAddEModeCategoryTx,Jt as buildStellarAddRewardsTx,zt as buildStellarApproveTokenTx,xo as buildStellarBatchSwapTx,Y as buildStellarBorrowBatchTx,tt as buildStellarBorrowTx,$o as buildStellarCctpForwardTx,Qt as buildStellarClaimRevenueTx,jt as buildStellarConfigureMarketOracleTx,Wt as buildStellarCreateLiquidityPoolTx,Gt as buildStellarDisableTokenOracleTx,It as buildStellarEditAssetConfigTx,Nt as buildStellarEditAssetInEModeCategoryTx,Vt as buildStellarEditOracleToleranceTx,Mo as buildStellarExecuteStrategyTx,it as buildStellarFlashLoanTx,ze as buildStellarGovernanceExecuteGovernanceUpgradeTx,je as buildStellarGovernanceExecuteGrantGovernanceRoleTx,Ve as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,Ge as buildStellarGovernanceExecuteTransferGovOwnTx,$e as buildStellarGovernanceExecuteTx,De as buildStellarGovernanceExecuteUpdateDelayTx,Tt as buildStellarGrantRoleTx,go as buildStellarLendingIdentifier,ut as buildStellarLiquidateTx,at as buildStellarMigrateFromBlendTx,wt as buildStellarMigrateTx,st as buildStellarMultiplyTx,At as buildStellarPauseTx,be as buildStellarProposeAddAssetToEModeTx,fe as buildStellarProposeAddEModeCategoryTx,we as buildStellarProposeApproveBlendPoolTx,he as buildStellarProposeApproveTokenTx,Ie as buildStellarProposeConfigureMarketOracleTx,Se as buildStellarProposeCreateLiquidityPoolTx,ke as buildStellarProposeDeployPoolTx,xe as buildStellarProposeDisableTokenOracleTx,de as buildStellarProposeEditAssetConfigTx,ge as buildStellarProposeEditAssetInEModeTx,Re as buildStellarProposeEditOracleToleranceTx,Ce as buildStellarProposeGovernanceUpgradeTx,Be as buildStellarProposeGrantGovernanceRoleTx,Pe as buildStellarProposeMigrateControllerTx,qe as buildStellarProposeRemoveAssetFromEModeTx,me as buildStellarProposeRemoveEModeCategoryTx,Ae as buildStellarProposeRevokeBlendPoolTx,Ne as buildStellarProposeRevokeGovernanceRoleTx,ve as buildStellarProposeRevokeTokenTx,pe as buildStellarProposeSetAccumulatorTx,se as buildStellarProposeSetAggregatorTx,ye as buildStellarProposeSetMinBorrowCollatTx,ce as buildStellarProposeSetPoolTemplateTx,le as buildStellarProposeSetPositionLimitsTx,Oe as buildStellarProposeTransferCtrlOwnershipTx,Le as buildStellarProposeTransferGovOwnTx,Ue as buildStellarProposeUpdateDelayTx,_e as buildStellarProposeUpdatePoolCapsTx,Ee as buildStellarProposeUpgradeControllerTx,Te as buildStellarProposeUpgradePoolParamsTx,Me as buildStellarProposeUpgradePoolTx,$t as buildStellarRemoveAssetFromEModeTx,Ut as buildStellarRemoveEModeCategoryTx,Xt as buildStellarRenewAccountTx,rt as buildStellarRepayBatchTx,dt as buildStellarRepayDebtWithCollateralTx,nt as buildStellarRepayTx,kt as buildStellarRevokeRoleTx,Dt as buildStellarRevokeTokenTx,Pt as buildStellarSetAccumulatorTx,Et as buildStellarSetAggregatorTx,Ot as buildStellarSetLiquidityPoolTemplateTx,Rt as buildStellarSetPositionLimitsTx,J as buildStellarSupplyBatchTx,K as buildStellarSupplyTx,ct as buildStellarSwapCollateralTx,pt as buildStellarSwapDebtTx,Mt as buildStellarTransferOwnershipTx,St as buildStellarUnpauseTx,Kt as buildStellarUpdateAccountThresholdTx,Ht as buildStellarUpdateIndexesTx,Lt as buildStellarUpdatePoolCapsTx,vt as buildStellarUpgradeControllerTx,Ft as buildStellarUpgradeLiquidityPoolParamsTx,Zt as buildStellarUpgradeLiquidityPoolTx,et as buildStellarWithdrawBatchTx,ot as buildStellarWithdrawTx,Q as buildTx,fo as decodeStellarLendingEvent,mt as encodeAssetConfigRaw,yt as encodeInterestRateModel,ht as encodeMarketOracleConfigInput,ft as encodeMarketParamsRaw,qt as encodeOracleSourceConfigInput,bt as encodePositionLimits,ko as encodeStrategyPayloadToRouteXdr,_o as extractEventOrder,Ao as getStellarAggregatorQuote,x as getStellarAggregatorRouter,E as getStellarGovernance,M as getStellarLendingController,So as getStellarQuoteTokens,f as isValidCollectionTicker,m as isValidNftIdentifier,Oo as mapQuoteResponseToAggregatorSwap,Eo as mapQuoteResponseToStrategyPayload,Po as mapQuoteResponseToStrategySwap,ho as mapStellarPositionActivityType,Uo as prepareStellarBuiltTx,Co as prepareStellarTxXdr,We as stellarLendingDispatchKey,qo as syntheticEventOrder,Ro as tagStellarInvokedContractError,He as toBase64Xdr,Bo as toStellarPositionMode};
|
|
@@ -4,18 +4,23 @@
|
|
|
4
4
|
* (`opts.governanceAddress`, or env via `getStellarGovernance(network)`).
|
|
5
5
|
*
|
|
6
6
|
* Flow:
|
|
7
|
-
* - An admin holding the PROPOSER role calls
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the operation id (`BytesN<32>`).
|
|
7
|
+
* - An admin holding the PROPOSER role calls the single `propose(proposer,
|
|
8
|
+
* op: AdminOperation, salt)` entrypoint. `proposer = opts.caller`; `op` is
|
|
9
|
+
* the serialized `AdminOperation` enum identifying the target setter and its
|
|
10
|
+
* args; `salt: BytesN<32>` is trailing. Validation runs at propose time and
|
|
11
|
+
* the call returns the operation id (`BytesN<32>`).
|
|
12
12
|
* - After the timelock delay, ANYONE executes. Controller-targeted ops go
|
|
13
13
|
* through the generic `execute(executor, target, function, args,
|
|
14
|
-
* predecessor, salt)`; governance-self ops go through
|
|
15
|
-
* Open execution passes `executor = None`
|
|
16
|
-
*
|
|
14
|
+
* predecessor, salt)`; governance-self ops go through `execute_self(executor,
|
|
15
|
+
* op: AdminOperation, salt)`. Open execution passes `executor = None`
|
|
16
|
+
* (Soroban `Option::None`, encoded as `scvVoid`).
|
|
17
17
|
* - `predecessor` is ALWAYS the 32-zero-byte `BytesN<32>` in this system.
|
|
18
18
|
*
|
|
19
|
+
* The on-chain scheduled `Operation` (target, function, args) is byte-identical
|
|
20
|
+
* to the pre-enum typed proposers, so the operation id, the generic `execute`
|
|
21
|
+
* path, and event indexing are unchanged. The `AdminOperation` enum only changes
|
|
22
|
+
* the `propose` / `execute_self` call encoding, which these builders own.
|
|
23
|
+
*
|
|
19
24
|
* Builders are RPC-free and deterministic (synthetic `Account(caller,
|
|
20
25
|
* sourceSequence)`), exactly like the lending / admin builders. The returned
|
|
21
26
|
* XDR still needs `rpc.Server.prepareTransaction` before signing.
|
|
@@ -42,84 +47,92 @@ export interface MigrateArgs {
|
|
|
42
47
|
export interface UpdateDelayArgs {
|
|
43
48
|
newDelay: number;
|
|
44
49
|
}
|
|
45
|
-
/**
|
|
50
|
+
/** propose(SetAggregator(addr)) */
|
|
46
51
|
export declare function buildStellarProposeSetAggregatorTx(opts: StellarBuilderOptions, args: {
|
|
47
52
|
aggregator: string;
|
|
48
53
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
49
|
-
/**
|
|
54
|
+
/** propose(SetAccumulator(addr)) */
|
|
50
55
|
export declare function buildStellarProposeSetAccumulatorTx(opts: StellarBuilderOptions, args: {
|
|
51
56
|
accumulator: string;
|
|
52
57
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
53
|
-
/**
|
|
58
|
+
/** propose(SetLiquidityPoolTemplate(hash)) */
|
|
54
59
|
export declare function buildStellarProposeSetPoolTemplateTx(opts: StellarBuilderOptions, args: {
|
|
55
60
|
wasmHash: string;
|
|
56
61
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
57
|
-
/**
|
|
62
|
+
/** propose(EditAssetConfig(asset, cfg)) */
|
|
58
63
|
export declare function buildStellarProposeEditAssetConfigTx(opts: StellarBuilderOptions, args: EditAssetConfigArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
59
|
-
/**
|
|
64
|
+
/** propose(SetPositionLimits(limits)) */
|
|
60
65
|
export declare function buildStellarProposeSetPositionLimitsTx(opts: StellarBuilderOptions, args: PositionLimitsDto, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
61
|
-
/**
|
|
66
|
+
/** propose(SetMinBorrowCollateralUsd(floor_wad)) */
|
|
62
67
|
export declare function buildStellarProposeSetMinBorrowCollatTx(opts: StellarBuilderOptions, args: {
|
|
63
68
|
floorWad: string;
|
|
64
69
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
65
|
-
/**
|
|
70
|
+
/** propose(AddEModeCategory) — risk params are per-asset */
|
|
66
71
|
export declare function buildStellarProposeAddEModeCategoryTx(opts: StellarBuilderOptions, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
67
|
-
/**
|
|
72
|
+
/** propose(RemoveEModeCategory(id)) */
|
|
68
73
|
export declare function buildStellarProposeRemoveEModeCategoryTx(opts: StellarBuilderOptions, args: RemoveEModeCategoryArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
69
|
-
/**
|
|
74
|
+
/** propose(AddAssetToEModeCategory(EModeAssetArgs)) */
|
|
70
75
|
export declare function buildStellarProposeAddAssetToEModeTx(opts: StellarBuilderOptions, args: EModeAssetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
71
|
-
/**
|
|
76
|
+
/** propose(EditAssetInEModeCategory(EModeAssetArgs)) */
|
|
72
77
|
export declare function buildStellarProposeEditAssetInEModeTx(opts: StellarBuilderOptions, args: EModeAssetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
73
|
-
/**
|
|
78
|
+
/** propose(UpdatePoolCaps(PoolCapsArgs)) */
|
|
74
79
|
export declare function buildStellarProposeUpdatePoolCapsTx(opts: StellarBuilderOptions, args: UpdatePoolCapsArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
75
|
-
/**
|
|
80
|
+
/** propose(RemoveAssetFromEMode(RemoveAssetFromEModeArgs)) */
|
|
76
81
|
export declare function buildStellarProposeRemoveAssetFromEModeTx(opts: StellarBuilderOptions, args: RemoveEModeAssetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
77
|
-
/**
|
|
82
|
+
/** propose(ApproveToken(token)) */
|
|
78
83
|
export declare function buildStellarProposeApproveTokenTx(opts: StellarBuilderOptions, args: {
|
|
79
84
|
token: string;
|
|
80
85
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
81
|
-
/**
|
|
86
|
+
/** propose(RevokeToken(token)) */
|
|
82
87
|
export declare function buildStellarProposeRevokeTokenTx(opts: StellarBuilderOptions, args: {
|
|
83
88
|
token: string;
|
|
84
89
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
85
|
-
/**
|
|
90
|
+
/** propose(ApproveBlendPool(pool)) */
|
|
91
|
+
export declare function buildStellarProposeApproveBlendPoolTx(opts: StellarBuilderOptions, args: {
|
|
92
|
+
pool: string;
|
|
93
|
+
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
94
|
+
/** propose(RevokeBlendPool(pool)) */
|
|
95
|
+
export declare function buildStellarProposeRevokeBlendPoolTx(opts: StellarBuilderOptions, args: {
|
|
96
|
+
pool: string;
|
|
97
|
+
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
98
|
+
/** propose(CreateLiquidityPool(CreatePoolArgs)) */
|
|
86
99
|
export declare function buildStellarProposeCreateLiquidityPoolTx(opts: StellarBuilderOptions, args: CreateLiquidityPoolArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
87
|
-
/**
|
|
100
|
+
/** propose(UpgradeLiquidityPoolParams(UpgradePoolParamsArgs)) */
|
|
88
101
|
export declare function buildStellarProposeUpgradePoolParamsTx(opts: StellarBuilderOptions, args: UpgradeLiquidityPoolParamsArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
89
|
-
/**
|
|
102
|
+
/** propose(DeployPool) */
|
|
90
103
|
export declare function buildStellarProposeDeployPoolTx(opts: StellarBuilderOptions, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
91
|
-
/**
|
|
104
|
+
/** propose(UpgradePool(hash)) */
|
|
92
105
|
export declare function buildStellarProposeUpgradePoolTx(opts: StellarBuilderOptions, args: {
|
|
93
106
|
wasmHash: string;
|
|
94
107
|
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
95
|
-
/**
|
|
96
|
-
export declare function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
108
|
+
/** propose(DisableTokenOracle(asset)) */
|
|
109
|
+
export declare function buildStellarProposeDisableTokenOracleTx(opts: StellarBuilderOptions, args: {
|
|
110
|
+
asset: string;
|
|
111
|
+
}, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
112
|
+
/** propose(UpgradeController(hash)) */
|
|
100
113
|
export declare function buildStellarProposeUpgradeControllerTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
101
|
-
/**
|
|
114
|
+
/** propose(MigrateController(new_version)) */
|
|
102
115
|
export declare function buildStellarProposeMigrateControllerTx(opts: StellarBuilderOptions, args: MigrateArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
103
|
-
/**
|
|
116
|
+
/** propose(TransferCtrlOwnership(TransferOwnershipArgs)) */
|
|
104
117
|
export declare function buildStellarProposeTransferCtrlOwnershipTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
105
118
|
/**
|
|
106
|
-
*
|
|
119
|
+
* propose(ConfigureMarketOracle(ConfigureOracleArgs))
|
|
107
120
|
*
|
|
108
121
|
* The SDK passes the oracle INPUT args verbatim; the contract resolves the
|
|
109
122
|
* input to a resolved config at propose time (do NOT resolve in the SDK).
|
|
110
123
|
*/
|
|
111
124
|
export declare function buildStellarProposeConfigureMarketOracleTx(opts: StellarBuilderOptions, args: ConfigureMarketOracleArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
112
|
-
/**
|
|
125
|
+
/** propose(EditOracleTolerance(EditToleranceArgs)) */
|
|
113
126
|
export declare function buildStellarProposeEditOracleToleranceTx(opts: StellarBuilderOptions, args: EditOracleToleranceArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
114
|
-
/**
|
|
127
|
+
/** propose(UpgradeGov(hash)) */
|
|
115
128
|
export declare function buildStellarProposeGovernanceUpgradeTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
116
|
-
/**
|
|
129
|
+
/** propose(UpdateGovDelay(new_delay)) */
|
|
117
130
|
export declare function buildStellarProposeUpdateDelayTx(opts: StellarBuilderOptions, args: UpdateDelayArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
118
|
-
/**
|
|
131
|
+
/** propose(GrantGovRole(RoleArgs)) */
|
|
119
132
|
export declare function buildStellarProposeGrantGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
120
|
-
/**
|
|
133
|
+
/** propose(RevokeGovRole(RoleArgs)) */
|
|
121
134
|
export declare function buildStellarProposeRevokeGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
122
|
-
/**
|
|
135
|
+
/** propose(TransferGovOwnership(TransferOwnershipArgs)) */
|
|
123
136
|
export declare function buildStellarProposeTransferGovOwnTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
124
137
|
export interface StellarGovernanceExecuteArgs {
|
|
125
138
|
/** Controller (or other) contract the scheduled op targets. */
|
|
@@ -128,8 +141,8 @@ export interface StellarGovernanceExecuteArgs {
|
|
|
128
141
|
functionName: string;
|
|
129
142
|
/**
|
|
130
143
|
* The controller-call args, each a base64 ScVal XDR string. These must be the
|
|
131
|
-
* SAME ScVals the matching
|
|
132
|
-
*
|
|
144
|
+
* SAME ScVals the matching proposal scheduled (the timelock hashes them into
|
|
145
|
+
* the op id), in the controller method's arg order. Reconstructed via
|
|
133
146
|
* `xdr.ScVal.fromXDR(s, 'base64')`.
|
|
134
147
|
*/
|
|
135
148
|
argsXdr: string[];
|
|
@@ -146,15 +159,19 @@ export interface StellarGovernanceExecuteArgs {
|
|
|
146
159
|
* controller-targeted op. `executor = None` (open execution), `target` is the
|
|
147
160
|
* controller `Address`, `function` is a `Symbol`, `args` is the `Vec<Val>`
|
|
148
161
|
* reconstructed from `argsXdr`, `predecessor` defaults to 32 zero bytes.
|
|
162
|
+
*
|
|
163
|
+
* Unchanged by the AdminOperation refactor: the scheduled `Operation` is
|
|
164
|
+
* byte-identical, so callers reconstruct `(target, function, argsXdr)` from the
|
|
165
|
+
* indexed proposal exactly as before.
|
|
149
166
|
*/
|
|
150
167
|
export declare function buildStellarGovernanceExecuteTx(opts: StellarBuilderOptions, args: StellarGovernanceExecuteArgs): BuiltStellarTx;
|
|
151
|
-
/**
|
|
168
|
+
/** execute_self(executor=None, UpgradeGov(hash), salt) */
|
|
152
169
|
export declare function buildStellarGovernanceExecuteGovernanceUpgradeTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
153
|
-
/**
|
|
170
|
+
/** execute_self(executor=None, UpdateGovDelay(new_delay), salt) */
|
|
154
171
|
export declare function buildStellarGovernanceExecuteUpdateDelayTx(opts: StellarBuilderOptions, args: UpdateDelayArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
155
|
-
/**
|
|
172
|
+
/** execute_self(executor=None, GrantGovRole(RoleArgs), salt) */
|
|
156
173
|
export declare function buildStellarGovernanceExecuteGrantGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
157
|
-
/**
|
|
174
|
+
/** execute_self(executor=None, RevokeGovRole(RoleArgs), salt) */
|
|
158
175
|
export declare function buildStellarGovernanceExecuteRevokeGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
159
|
-
/**
|
|
176
|
+
/** execute_self(executor=None, TransferGovOwnership(TransferOwnershipArgs), salt) */
|
|
160
177
|
export declare function buildStellarGovernanceExecuteTransferGovOwnTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.156",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@multiversx/sdk-core": "^15.3.2",
|
|
106
106
|
"@multiversx/sdk-network-providers": "^2.9.3",
|
|
107
|
-
"@xoxno/types": "^1.0.
|
|
107
|
+
"@xoxno/types": "^1.0.425"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"@stellar/stellar-sdk": ">=15.0.0 <17.0.0"
|