@sodax/types 2.0.0-rc.14 → 2.0.0-rc.16
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/backend/backendApiV2.d.ts +54 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,36 @@ export type PartnerFeeV2 = {
|
|
|
18
18
|
address: string;
|
|
19
19
|
percentage: number;
|
|
20
20
|
};
|
|
21
|
+
/** JSON-safe mirror of the SDK `BitcoinBoundExtras` — Bound Exchange (Radfi) inputs for raw Bitcoin TRADING-mode intents. */
|
|
22
|
+
export interface BitcoinBoundExtrasV2 {
|
|
23
|
+
/**
|
|
24
|
+
* Bound Exchange (Radfi) access token; threads through the typed DTO instead of an
|
|
25
|
+
* `x-bound-access-token` header. Only consumed for raw Bitcoin TRADING-mode intents.
|
|
26
|
+
*/
|
|
27
|
+
accessToken?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* JSON-safe mirror of the SDK `SwapExtras<K>` — per-request swap extras flattened onto a request body.
|
|
31
|
+
* All fields are optional; chain applicability is documented per field (the wire DTO can't `K`-gate the
|
|
32
|
+
* way the SDK type does). Shared by {@link CreateIntentParamsV2} and {@link QuoteRequestV2}.
|
|
33
|
+
*/
|
|
34
|
+
export interface SwapExtrasV2 {
|
|
35
|
+
/**
|
|
36
|
+
* Per-request partner-fee override; defaults to the backend's configured fee. Keeps the fee-adjusted
|
|
37
|
+
* quote and the built intent consistent with `createIntent`.
|
|
38
|
+
*/
|
|
39
|
+
partnerFee?: PartnerFeeV2;
|
|
40
|
+
/**
|
|
41
|
+
* Source-chain signer public key (compressed hex), for chains whose address can't yield it (e.g.
|
|
42
|
+
* Stacks). Only used when building a raw intent.
|
|
43
|
+
*/
|
|
44
|
+
srcPublicKey?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Bitcoin Bound (Radfi) inputs, grouped so future Bound fields extend one slot instead of adding a
|
|
47
|
+
* top-level field per item. Only used for raw Bitcoin TRADING-mode intents.
|
|
48
|
+
*/
|
|
49
|
+
bound?: BitcoinBoundExtrasV2;
|
|
50
|
+
}
|
|
21
51
|
/**
|
|
22
52
|
* Solver intent status code:
|
|
23
53
|
* -1 NOT_FOUND, 1 NOT_STARTED_YET, 2 STARTED_NOT_FINISHED, 3 SOLVED (terminal), 4 FAILED (terminal).
|
|
@@ -141,8 +171,12 @@ export interface RelayExtraDataResponseV2 {
|
|
|
141
171
|
export type GetSwapTokensResponseV2 = Record<string, readonly SwapTokenV2[]>;
|
|
142
172
|
/** GET /swaps/tokens/:chainKey — supported swap tokens for a single chain. */
|
|
143
173
|
export type GetSwapTokensByChainResponseV2 = readonly SwapTokenV2[];
|
|
144
|
-
/**
|
|
145
|
-
|
|
174
|
+
/**
|
|
175
|
+
* POST /swaps/quote — request body. Inherits the swap extras (`partnerFee`, `srcPublicKey`, `bound`) from
|
|
176
|
+
* {@link SwapExtrasV2}; the inherited `srcPublicKey`/`bound` are consumed only by the `includeTxData=true`
|
|
177
|
+
* intent-building path (Stacks/Bitcoin sources), mirroring `srcAddress`/`dstAddress` below.
|
|
178
|
+
*/
|
|
179
|
+
export interface QuoteRequestV2 extends SwapExtrasV2 {
|
|
146
180
|
/** Source token address on the source spoke chain. */
|
|
147
181
|
tokenSrc: string;
|
|
148
182
|
/** Source spoke chain key (SODAX SpokeChainKey). */
|
|
@@ -155,12 +189,10 @@ export interface QuoteRequestV2 {
|
|
|
155
189
|
amount: string;
|
|
156
190
|
/** Quote type (only `exact_input` is supported). */
|
|
157
191
|
quoteType: QuoteTypeV2;
|
|
158
|
-
/** Source address — required only when `includeTxData=true
|
|
192
|
+
/** Source address — required only when `includeTxData=true` (with the inherited `srcPublicKey`/`bound` for Stacks/Bitcoin sources); ignored otherwise. */
|
|
159
193
|
srcAddress?: string;
|
|
160
194
|
/** Destination address — required only when `includeTxData=true`; ignored otherwise. */
|
|
161
195
|
dstAddress?: string;
|
|
162
|
-
/** Optional per-request partner-fee override; defaults to the backend's configured fee. Keeps the fee-adjusted quote (and the `includeTxData` intent) consistent with `createIntent`. */
|
|
163
|
-
partnerFee?: PartnerFeeV2;
|
|
164
196
|
}
|
|
165
197
|
/** POST /swaps/quote — query params. */
|
|
166
198
|
export interface QuoteQueryV2 {
|
|
@@ -184,8 +216,12 @@ export interface DeadlineResponseV2 {
|
|
|
184
216
|
/** Unix timestamp (seconds) at which the swap intent will expire (decimal string). */
|
|
185
217
|
deadline: string;
|
|
186
218
|
}
|
|
187
|
-
/**
|
|
188
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Shared request body for `/swaps/allowance/check`, `/swaps/approve`, and `/swaps/intents`. Inherits the
|
|
221
|
+
* swap extras (`partnerFee`, `srcPublicKey`, `bound`) from {@link SwapExtrasV2}; the Bitcoin Bound token
|
|
222
|
+
* is carried as `bound.accessToken` (not a flat `accessToken`), mirroring the SDK's grouped `extras.bound`.
|
|
223
|
+
*/
|
|
224
|
+
export interface CreateIntentParamsV2 extends SwapExtrasV2 {
|
|
189
225
|
/** Source spoke chain key (SODAX SpokeChainKey). */
|
|
190
226
|
srcChainKey: string;
|
|
191
227
|
/** Destination spoke chain key (SODAX SpokeChainKey). */
|
|
@@ -204,16 +240,12 @@ export interface CreateIntentParamsV2 {
|
|
|
204
240
|
allowPartialFill: boolean;
|
|
205
241
|
/** User address on the source spoke chain (chain-specific format). */
|
|
206
242
|
srcAddress: string;
|
|
207
|
-
/** Source-chain signer public key (compressed hex), for chains whose address can't yield it (e.g. Stacks). */
|
|
208
|
-
srcPublicKey?: string;
|
|
209
243
|
/** Recipient address on the destination spoke chain (chain-specific format). */
|
|
210
244
|
dstAddress: string;
|
|
211
245
|
/** Solver address (EVM hub address). Defaults to the zero address for "any solver". */
|
|
212
246
|
solver?: string;
|
|
213
247
|
/** Arbitrary calldata hex string. Defaults to `0x`. */
|
|
214
248
|
data?: string;
|
|
215
|
-
/** Optional per-request partner-fee override embedded into the built intent. When omitted the backend applies its configured default. */
|
|
216
|
-
partnerFee?: PartnerFeeV2;
|
|
217
249
|
}
|
|
218
250
|
/** POST /swaps/allowance/check — response body. */
|
|
219
251
|
export interface AllowanceCheckResponseV2 {
|
|
@@ -339,11 +371,20 @@ export interface IntentStateV2 {
|
|
|
339
371
|
* event. Bigint fields are serialized as decimal strings.
|
|
340
372
|
*/
|
|
341
373
|
export type GetIntentResponseV2 = IntentResponseV2;
|
|
342
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* POST /swaps/limit-orders — request body. Same as create-intent but `deadline` is optional.
|
|
376
|
+
*
|
|
377
|
+
* The trailing `& _AssertJsonSafe<…>` wires the compile-time JSON-safety guard (see the Config API v2
|
|
378
|
+
* section) into the swap request surface: if a `bigint` ever leaks into `SwapExtrasV2` — or the
|
|
379
|
+
* `PartnerFeeV2` / `BitcoinBoundExtrasV2` it composes — the constraint fails and `pnpm checkTs` /
|
|
380
|
+
* `pnpm build` go red. It is `& unknown` in the happy path, so it does not change the type. This is the
|
|
381
|
+
* swaps-section analog of the guard on `GetAllConfigResponseV2`; `CreateLimitOrderParamsV2` is the one
|
|
382
|
+
* exported swaps request `type` (the others are interfaces, which cannot carry an intersection).
|
|
383
|
+
*/
|
|
343
384
|
export type CreateLimitOrderParamsV2 = Omit<CreateIntentParamsV2, 'deadline'> & {
|
|
344
385
|
/** Unix timestamp (seconds) at which the limit order expires. Omit (or pass `"0"`) for no expiry. */
|
|
345
386
|
deadline?: string;
|
|
346
|
-
}
|
|
387
|
+
} & _AssertJsonSafe<[_ContainsBigint<SwapExtrasV2>] extends [false] ? true : false>;
|
|
347
388
|
/** POST /swaps/limit-orders — response body (same shape as create-intent). */
|
|
348
389
|
export type CreateLimitOrderResponseV2 = CreateIntentResponseV2;
|
|
349
390
|
/** POST /swaps/gas/estimate — request body. */
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,4 +18,4 @@ export * from './sui/index.js';
|
|
|
18
18
|
export * from './swap/index.js';
|
|
19
19
|
export * from './utils/index.js';
|
|
20
20
|
export * from './wallet/index.js';
|
|
21
|
-
export const CONFIG_VERSION =
|
|
21
|
+
export const CONFIG_VERSION = 214; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
|
package/package.json
CHANGED