@xoxno/sdk-js 1.0.221 → 1.0.223

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.
@@ -11,25 +11,78 @@
11
11
  * the wire shape is camelCase, the Soroban contract receives snake_case
12
12
  * after the SDK encoder rewrites field names.
13
13
  */
14
- import type { StellarAggregatorQuoteRequestDto, StellarAggregatorQuoteResponseDto, StellarTokenKind } from '@xoxno/types';
14
+ import type { StellarAggregatorQuoteRequestDto, StellarAggregatorQuoteResponseDto, StellarQuoteTransactionPayloadDto } from '@xoxno/types';
15
15
  import type { StellarNetwork } from './contracts.js';
16
16
  /**
17
- * Resolved token entry returned by the quote server's tokens endpoint.
18
- * Mirrors the indexer's `TokenEntry` JSON exactly.
17
+ * Token entry returned by `GET /api/v1/tokens`. Mirrors the service's
18
+ * `TokenEntry` schema exactly.
19
19
  */
20
20
  export interface StellarQuoteToken {
21
- /** Canonical token id. `C…` for Soroban contracts; `CODE:GISSUER…`
22
- * for Classic; `XLM` for native. */
21
+ /** Canonical Soroban token contract id (`C…`). `XLM` and `CODE:ISSUER`
22
+ * forms are rejected by the service. */
23
23
  id: string;
24
- kind: StellarTokenKind;
24
+ /** Decimal places: divide atomic amounts by 10^decimals for display. */
25
25
  decimals: number;
26
- /** Soroban Asset Contract peer for Classic assets (null otherwise). */
27
- sacPeer: string | null;
28
- /** Classic asset code (for Classic / SAC entries; null for Soroban). */
29
- code: string | null;
30
- /** Number of pools touching this token in the current snapshot. */
31
- degree: number;
26
+ /** `true` for a pool share token; quoting from/to it is a liquidity route. */
27
+ lp: boolean;
28
+ /** Venues the token appears on, sorted. For an LP token, the issuing venue. */
29
+ dexes: string[];
30
+ /** LP only: the pool contract that issued the shares. */
31
+ pool?: string | null;
32
+ /** LP only: constituent token ids in pool order. */
33
+ assets?: string[] | null;
32
34
  }
35
+ /** Liquidity snapshot the route was searched against. */
36
+ export interface StellarQuoteSnapshot {
37
+ ledger: number;
38
+ ageSeconds: number;
39
+ /** Live ledger compared against; present only when `fresh=true`. */
40
+ checkedLiveLedger?: number | null;
41
+ }
42
+ /** Set when the route was reduced to fit the simulation budget. */
43
+ export interface StellarQuoteDegraded {
44
+ requestedMaxSplits: number;
45
+ effectiveMaxSplits: number;
46
+ requestedMaxHops: number;
47
+ effectiveMaxHops: number;
48
+ fallbackAttempts: number;
49
+ reason: string;
50
+ }
51
+ export interface StellarQuoteLpConstituent {
52
+ token: string;
53
+ tokenKind: string;
54
+ /** Raw u128 amount as a string. */
55
+ amount: string;
56
+ amountShort: number;
57
+ }
58
+ /** Liquidity breakdown for add/remove/convert-liquidity quotes. Informational. */
59
+ export interface StellarQuoteLp {
60
+ pool: string;
61
+ dex: string;
62
+ kind: string;
63
+ feeBps: number;
64
+ shareToken: string;
65
+ amounts: StellarQuoteLpConstituent[];
66
+ refunded?: StellarQuoteLpConstituent[];
67
+ preSwap?: unknown;
68
+ }
69
+ /**
70
+ * Quote response as the service returns it. Extends the `@xoxno/types` DTO with
71
+ * fields the DTO does not yet declare. `alternatives` is still on the DTO but
72
+ * the service no longer returns it.
73
+ */
74
+ export type StellarQuoteResponse = StellarAggregatorQuoteResponseDto & {
75
+ snapshot?: StellarQuoteSnapshot | null;
76
+ degraded?: StellarQuoteDegraded | null;
77
+ lp?: StellarQuoteLp | null;
78
+ /** Ordered LP-conversion steps; mutually exclusive with `transaction`. */
79
+ transactions?: StellarQuoteTransactionPayloadDto[] | null;
80
+ };
81
+ /** Quote request; adds `simulate`, which the DTO does not yet declare. */
82
+ export type StellarQuoteRequest = StellarAggregatorQuoteRequestDto & {
83
+ /** With `sender`: simulate and prepare resource data (service default `true`). */
84
+ simulate?: boolean;
85
+ };
33
86
  export interface StellarQuoteFetchOptions {
34
87
  /** Quote-server base URL selected by the host application. */
35
88
  baseUrl: string;
@@ -49,14 +102,17 @@ export interface StellarQuoteFetchOptions {
49
102
  * `steps`. Amounts are token base-unit decimal strings. Requote after changes
50
103
  * to amount, direction or slippage; preparation is the execution check.
51
104
  *
52
- * Passing both `sender` (G...) and `router` (C...) may return a direct-swap
53
- * envelope under `transaction.envelopeXdr`. Prepare it before wallet signing.
105
+ * Passing `sender` (G...) together with `slippage` returns a direct-swap
106
+ * envelope under `transaction.envelopeXdr`. The router comes from the service's
107
+ * `/api/v1/config`; the `router` request field is ignored by the service and is
108
+ * no longer sent. Prepare the envelope before wallet signing unless
109
+ * `transaction.simulated` is true.
54
110
  * @param request - Exactly one of amountIn or amountOut; optional referralId is forwarded unchanged.
55
111
  * @param opts - Quote-server URL and optional fetch options supplied by the host.
56
112
  * @returns Quote estimates and opaque route bytes; does not execute a swap.
57
113
  * @category Strategy quotes
58
114
  */
59
- export declare function getStellarAggregatorQuote(request: StellarAggregatorQuoteRequestDto, opts: StellarQuoteFetchOptions): Promise<StellarAggregatorQuoteResponseDto>;
115
+ export declare function getStellarAggregatorQuote(request: StellarQuoteRequest, opts: StellarQuoteFetchOptions): Promise<StellarQuoteResponse>;
60
116
  /**
61
117
  * List tokens currently indexed by the quote server. Useful to populate
62
118
  * pickers or validate that a user-supplied token has on-chain liquidity.
@@ -161,8 +161,6 @@ export declare const scStruct: (fields: Record<string, xdr.ScVal>) => xdr.ScVal;
161
161
  * callers that construct routes locally.
162
162
  */
163
163
  export declare const encodeStrategyPayload: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
164
- /** @deprecated Use `encodeStrategyPayload`. */
165
- export declare const encodeAggregatorSwap: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
166
164
  export declare const encodeStrategyPayloadToBytes: (payload: StellarStrategyPayloadInput) => xdr.ScVal;
167
165
  /**
168
166
  * Validate the untyped `steps` field and narrow it to `StrategyPayload`.
@@ -185,8 +183,6 @@ export declare const emptyStrategySwapBytes: () => xdr.ScVal;
185
183
  * - decoded `StrategyPayload` object
186
184
  */
187
185
  export declare const asStellarStrategySwapBytes: (steps: unknown) => xdr.ScVal;
188
- /** @deprecated Use `asStellarStrategyPayload` or `asStellarStrategySwapBytes`. */
189
- export declare const asStellarSwapSteps: (steps: unknown) => StellarStrategyPayloadInput;
190
186
  /**
191
187
  * Validate the untyped `data` field on FlashLoanArgs and narrow it to
192
188
  * Buffer / hex string for Soroban `Bytes` encoding.
@@ -53,9 +53,6 @@ export interface StellarExecuteStrategyBuilderOptions extends StellarBuilderOpti
53
53
  */
54
54
  referralId?: number | string;
55
55
  }
56
- /** @deprecated Use `StellarExecuteStrategyBuilderOptions`. */
57
- export interface StellarBatchSwapBuilderOptions extends StellarExecuteStrategyBuilderOptions {
58
- }
59
56
  export declare const encodeStrategyPayloadToRouteXdr: (payload: StellarStrategyPayloadInput) => string;
60
57
  /**
61
58
  * Build an unsigned XDR for a direct user -> aggregator router swap.
@@ -65,11 +62,6 @@ export declare const encodeStrategyPayloadToRouteXdr: (payload: StellarStrategyP
65
62
  * custom route builders.
66
63
  */
67
64
  export declare function buildStellarExecuteStrategyTx(opts: StellarExecuteStrategyBuilderOptions, swap: StellarStrategySwapInput): BuiltStellarTx;
68
- /**
69
- * @deprecated The router no longer exposes `batch_execute`; this wrapper now
70
- * builds `execute_strategy(sender, total_in, swap_xdr)`.
71
- */
72
- export declare function buildStellarBatchSwapTx(opts: StellarBatchSwapBuilderOptions, swap: StellarStrategySwapInput): BuiltStellarTx;
73
65
  /**
74
66
  * Translate a quote-server response into the decoded `StrategyPayload` shape.
75
67
  * Prefer `mapQuoteResponseToStrategySwap` when the quote includes `routeXdr`.
@@ -85,5 +77,3 @@ export declare function mapQuoteResponseToStrategyPayload(quote: StellarAggregat
85
77
  * @throws StellarRouteVerificationError — never sign a quote that throws here.
86
78
  */
87
79
  export declare function mapQuoteResponseToStrategySwap(quote: StellarAggregatorQuoteResponseDto, opts?: StellarQuoteMapOptions): StellarStrategySwapInput;
88
- /** @deprecated Use `mapQuoteResponseToStrategyPayload`. */
89
- export declare const mapQuoteResponseToAggregatorSwap: typeof mapQuoteResponseToStrategyPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "1.0.221",
3
+ "version": "1.0.223",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {