@xoxno/sdk-js 1.0.201 → 1.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk/stellar/__tests__/strategy-program.test.d.ts +9 -0
- package/dist/cjs/sdk/stellar/lending-read-types.d.ts +63 -0
- package/dist/cjs/sdk/stellar/lending-read.d.ts +26 -1
- package/dist/cjs/sdk/stellar/scval-encode.d.ts +29 -9
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk/stellar/__tests__/strategy-program.test.d.ts +9 -0
- package/dist/sdk/stellar/index.cjs +1 -1
- package/dist/sdk/stellar/index.esm.js +1 -1
- package/dist/sdk/stellar/lending-read-types.d.ts +63 -0
- package/dist/sdk/stellar/lending-read.d.ts +26 -1
- package/dist/sdk/stellar/scval-encode.d.ts +29 -9
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-language wire-format check for the aggregator's packed strategy program.
|
|
3
|
+
*
|
|
4
|
+
* The same fixtures are asserted byte-for-byte in
|
|
5
|
+
* `contracts/swap-aggregator/tests/unit/payload_wire_format.rs` and
|
|
6
|
+
* `arb-algo/stellar-indexer/src/transaction/abi.rs`. If this file and those
|
|
7
|
+
* diverge, routes built by this SDK will be rejected on-chain.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -211,3 +211,66 @@ export interface StellarMarketGraphQuery {
|
|
|
211
211
|
/** Bin width as a timespan string (e.g. `1h`, `1d`). */
|
|
212
212
|
bin: string;
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Config and admin state for one deployed contract, event-sourced by the
|
|
216
|
+
* indexer from that contract's own config, pause, ownership and admin events.
|
|
217
|
+
*
|
|
218
|
+
* Every field is optional-by-absence: a contract only populates what its own
|
|
219
|
+
* events carry, so a governance row leaves the controller fields null and vice
|
|
220
|
+
* versa. `paused` is null until a pause or unpause has actually been observed,
|
|
221
|
+
* which is materially different from a confirmed `false`.
|
|
222
|
+
*/
|
|
223
|
+
export interface StellarContractConfig {
|
|
224
|
+
contractAddress: string;
|
|
225
|
+
wasmHash: string | null;
|
|
226
|
+
accumulator: string | null;
|
|
227
|
+
swapAggregator: string | null;
|
|
228
|
+
priceAggregator: string | null;
|
|
229
|
+
maxSupplyPositions: number | null;
|
|
230
|
+
maxBorrowPositions: number | null;
|
|
231
|
+
/** Raw 18-decimal WAD. */
|
|
232
|
+
minBorrowCollateralUsdWad: string | null;
|
|
233
|
+
paused: boolean | null;
|
|
234
|
+
/** Governance timelock delay, in ledgers. */
|
|
235
|
+
minDelayLedgers: number | null;
|
|
236
|
+
owner: string | null;
|
|
237
|
+
pendingOwner: string | null;
|
|
238
|
+
admin: string | null;
|
|
239
|
+
pendingAdmin: string | null;
|
|
240
|
+
pendingAdminLiveUntilLedger: number | null;
|
|
241
|
+
ledger: number;
|
|
242
|
+
updatedAt: number;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* One access-control grant. Revocation flips `granted` rather than removing the
|
|
246
|
+
* row, so a revoked grant stays queryable.
|
|
247
|
+
*/
|
|
248
|
+
export interface StellarContractRole {
|
|
249
|
+
contractAddress: string;
|
|
250
|
+
/** On-chain role symbol, e.g. `ORACLE`, `PROPOSER`. */
|
|
251
|
+
role: string;
|
|
252
|
+
account: string;
|
|
253
|
+
granted: boolean;
|
|
254
|
+
caller: string | null;
|
|
255
|
+
ledger: number;
|
|
256
|
+
updatedAt: number;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* One position-authorization grant. A delegate may act on the owner's position,
|
|
260
|
+
* so this is security-relevant state rather than display metadata.
|
|
261
|
+
*/
|
|
262
|
+
export interface StellarAccountDelegate {
|
|
263
|
+
accountId: number;
|
|
264
|
+
owner: string;
|
|
265
|
+
delegate: string;
|
|
266
|
+
granted: boolean;
|
|
267
|
+
ledger: number;
|
|
268
|
+
updatedAt: number;
|
|
269
|
+
}
|
|
270
|
+
/** Approval state for one Blend pool, kept after revocation as `approved: false`. */
|
|
271
|
+
export interface StellarBlendPool {
|
|
272
|
+
pool: string;
|
|
273
|
+
approved: boolean;
|
|
274
|
+
ledger: number;
|
|
275
|
+
updatedAt: number;
|
|
276
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { StellarAssetListItem, StellarAssetPage, StellarHubListItem, StellarLendingLiveStateDto, StellarReserveListItem, StellarSpokeListItem, StellarUserActivityItem } from '@xoxno/types/stellar-lending';
|
|
15
15
|
import type { OurRequestInit, XOXNOClient } from '../../utils/api';
|
|
16
|
-
import type { StellarAccountPositions, StellarAsset, StellarAssetMarket, StellarGovernanceProposalsPage, StellarHub, StellarLendingHoldersSide, StellarLendingContext, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
|
|
16
|
+
import type { StellarAccountDelegate, StellarAccountPositions, StellarAsset, StellarAssetMarket, StellarBlendPool, StellarContractConfig, StellarContractRole, StellarGovernanceProposalsPage, StellarHub, StellarLendingHoldersSide, StellarLendingContext, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
|
|
17
17
|
type StellarReservesParams = {
|
|
18
18
|
hubId?: number;
|
|
19
19
|
spokeId?: number;
|
|
@@ -82,9 +82,34 @@ export declare const getStellarReserveGraph: (client: XOXNOClient, spokeId: numb
|
|
|
82
82
|
* sites read `read.reserve(spokeId, hubId, asset)` instead of threading the
|
|
83
83
|
* client through every call.
|
|
84
84
|
*/
|
|
85
|
+
/**
|
|
86
|
+
* Config and admin state for every watched contract, or for one address.
|
|
87
|
+
*
|
|
88
|
+
* Event-sourced by the indexer rather than read live from the chain, so this is
|
|
89
|
+
* also where `minBorrowCollateralUsdWad`, position limits and the aggregator
|
|
90
|
+
* addresses come from — `liveState` no longer needs an RPC round-trip for them.
|
|
91
|
+
*/
|
|
92
|
+
export declare const getStellarProtocolConfig: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarContractConfig[]>;
|
|
93
|
+
/** Config and admin state for a single contract address. */
|
|
94
|
+
export declare const getStellarContractConfig: (client: XOXNOClient, contractAddress: string, init?: OurRequestInit) => Promise<StellarContractConfig>;
|
|
95
|
+
/**
|
|
96
|
+
* Access-control grants, optionally narrowed to one contract. Revoked grants
|
|
97
|
+
* are included with `granted: false` — filter client-side when only current
|
|
98
|
+
* holders matter.
|
|
99
|
+
*/
|
|
100
|
+
export declare const getStellarContractRoles: (client: XOXNOClient, contractAddress?: string, init?: OurRequestInit) => Promise<StellarContractRole[]>;
|
|
101
|
+
/** Position-authorization grants for one account, including revoked ones. */
|
|
102
|
+
export declare const getStellarAccountDelegates: (client: XOXNOClient, accountId: number, init?: OurRequestInit) => Promise<StellarAccountDelegate[]>;
|
|
103
|
+
/** Blend pool approval state, including pools whose approval was revoked. */
|
|
104
|
+
export declare const getStellarBlendPools: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarBlendPool[]>;
|
|
85
105
|
export declare const stellarLendingRead: (client: XOXNOClient) => {
|
|
86
106
|
context: (init?: OurRequestInit) => Promise<StellarLendingContext>;
|
|
87
107
|
liveState: (init?: OurRequestInit) => Promise<StellarLendingLiveStateDto>;
|
|
108
|
+
protocolConfig: (init?: OurRequestInit) => Promise<StellarContractConfig[]>;
|
|
109
|
+
contractConfig: (contractAddress: string, init?: OurRequestInit) => Promise<StellarContractConfig>;
|
|
110
|
+
contractRoles: (contractAddress?: string, init?: OurRequestInit) => Promise<StellarContractRole[]>;
|
|
111
|
+
accountDelegates: (accountId: number, init?: OurRequestInit) => Promise<StellarAccountDelegate[]>;
|
|
112
|
+
blendPools: (init?: OurRequestInit) => Promise<StellarBlendPool[]>;
|
|
88
113
|
assets: (init?: OurRequestInit) => Promise<StellarAssetListItem[]>;
|
|
89
114
|
hubs: (init?: OurRequestInit) => Promise<StellarHubListItem[]>;
|
|
90
115
|
spokes: (init?: OurRequestInit) => Promise<StellarSpokeListItem[]>;
|
|
@@ -8,12 +8,22 @@
|
|
|
8
8
|
import { xdr } from '@stellar/stellar-sdk';
|
|
9
9
|
/**
|
|
10
10
|
* On-chain swap venues, validated at runtime for a caller-supplied venue.
|
|
11
|
-
* Mirrors the Soroban-only aggregator router's
|
|
11
|
+
* Mirrors the Soroban-only aggregator router's opcode table.
|
|
12
12
|
*/
|
|
13
13
|
export declare const STELLAR_SWAP_VENUES: readonly ["Soroswap", "Aquarius", "Phoenix", "Sushi", "CometDex"];
|
|
14
14
|
export type StellarSwapVenue = (typeof STELLAR_SWAP_VENUES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Instruction opcode per venue. Part of the on-chain ABI — see
|
|
17
|
+
* `contracts/swap-aggregator/src/program.rs`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const STELLAR_SWAP_VENUE_OPCODE: Record<StellarSwapVenue, number>;
|
|
20
|
+
/** Wire version of the packed program. Must match the contract's `VERSION`. */
|
|
21
|
+
export declare const STELLAR_PROGRAM_VERSION = 1;
|
|
22
|
+
/** Split weights are parts per million. */
|
|
23
|
+
export declare const PPM_DENOMINATOR = 1000000;
|
|
15
24
|
export interface StellarStrategySwapHopInput {
|
|
16
|
-
|
|
25
|
+
/** Quote-side estimate; not carried on the wire. */
|
|
26
|
+
amountOut?: string;
|
|
17
27
|
pool: string;
|
|
18
28
|
tokenIn: string;
|
|
19
29
|
tokenOut: string;
|
|
@@ -21,10 +31,25 @@ export interface StellarStrategySwapHopInput {
|
|
|
21
31
|
}
|
|
22
32
|
export interface StellarStrategySwapPathInput {
|
|
23
33
|
hops: StellarStrategySwapHopInput[];
|
|
34
|
+
/** Absolute share of this path's starting-token balance, in ppm. */
|
|
24
35
|
splitPpm: number;
|
|
25
36
|
}
|
|
26
37
|
export interface StellarStrategyPayloadInput {
|
|
38
|
+
/** Aquarius pool whose LP shares (`tokenIn`) are burned before routing. */
|
|
39
|
+
burnPool?: string;
|
|
40
|
+
/** Per-constituent floors for the burn, in the pool's own token order. */
|
|
41
|
+
burnMinAmounts?: string[];
|
|
42
|
+
/** Aquarius pool that mints `tokenOut` from the routed constituents. */
|
|
43
|
+
mintPool?: string;
|
|
44
|
+
/** Minimum LP shares the mint must deliver. */
|
|
45
|
+
mintMinShares?: string;
|
|
46
|
+
/** Constituents of `mintPool`, in pool order. Required with `preSwapAmount`. */
|
|
47
|
+
mintPoolTokens?: string[];
|
|
27
48
|
paths: StellarStrategySwapPathInput[];
|
|
49
|
+
/** Caller-solved amount that balances a lopsided mint before the deposit. */
|
|
50
|
+
preSwapAmount?: string;
|
|
51
|
+
/** Pre-swap direction: pool token A into B when true, B into A when false. */
|
|
52
|
+
preSwapFromA?: boolean;
|
|
28
53
|
referralId?: number | string;
|
|
29
54
|
tokenIn: string;
|
|
30
55
|
tokenOut: string;
|
|
@@ -99,13 +124,8 @@ export declare const tupleHubAssetAmountVec: (entries: Array<{
|
|
|
99
124
|
*/
|
|
100
125
|
export declare const scStruct: (fields: Record<string, xdr.ScVal>) => xdr.ScVal;
|
|
101
126
|
/**
|
|
102
|
-
* Encode
|
|
103
|
-
*
|
|
104
|
-
*/
|
|
105
|
-
export declare const encodeSwapVenue: (venue: StellarSwapVenue) => xdr.ScVal;
|
|
106
|
-
/**
|
|
107
|
-
* Encode the aggregator router's decoded `StrategyPayload` struct. The caller
|
|
108
|
-
* usually receives this as quote `routeXdr`; this helper is for tests and for
|
|
127
|
+
* Encode the aggregator router's `StrategyPayload`. The caller usually receives
|
|
128
|
+
* this already encoded as quote `routeXdr`; this helper is for tests and for
|
|
109
129
|
* callers that construct routes locally.
|
|
110
130
|
*/
|
|
111
131
|
export declare const encodeStrategyPayload: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
|