@tokenflight/swap 0.2.3 → 0.3.0-rc.1
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/ReceiveComponent-Cyn4ECRG.js +1 -0
- package/dist/ReceiveComponent.module-BGpemTAX.js +1 -0
- package/dist/SwapComponent-BwfaI3D9.js +1 -0
- package/dist/active-bridge-V8lTJ2Js.js +1 -0
- package/dist/bridge-Bq0QUltI.js +1 -0
- package/dist/bridge.d.ts +613 -0
- package/dist/bridge.js +1 -0
- package/dist/custom-elements.d.ts +1 -27
- package/dist/defaults-loader-DfcaO9j5.js +1 -0
- package/dist/en-US-CU2aSy93.js +1 -0
- package/dist/errors-Nd9setTj.js +3 -0
- package/dist/iframe-entry.d.ts +21 -0
- package/dist/iframe-entry.js +29 -0
- package/dist/iframe-receiver-PfhKUIZW.js +1 -0
- package/dist/iframe.d.ts +422 -0
- package/dist/iframe.js +45 -0
- package/dist/ja-JP-BoipV6-j.js +1 -0
- package/dist/ko-KR-DyFXZJsF.js +1 -0
- package/dist/protocol-CDxgudrl.js +1 -0
- package/dist/rank-offers-CR-1NeiW.js +1 -0
- package/dist/register-defaults-C_q7CG7x.js +1 -0
- package/dist/register-widget-DOzDJD94.js +1 -0
- package/dist/shared.module-C-kWMzqW.js +1 -0
- package/dist/solid-iWr5Czxc.js +1 -0
- package/dist/swap.css +1 -1
- package/dist/theme-C9tsVWlo.js +2 -0
- package/dist/tokenflight-swap.d.ts +106 -308
- package/dist/tokenflight-swap.js +1 -2
- package/dist/tokenflight-swap.umd.cjs +5 -4
- package/dist/widget-BadYytj9.js +2 -0
- package/dist/widget.d.ts +267 -27
- package/dist/widget.js +1 -1
- package/dist/zh-CN-epCUm9Io.js +1 -0
- package/dist/zh-TW-DSEboEJV.js +1 -0
- package/package.json +14 -2
- package/dist/en-US-DJW-hZLc.js +0 -1
- package/dist/ja-JP-BU7auPz-.js +0 -1
- package/dist/ko-KR-BIXVqnQ_.js +0 -1
- package/dist/register-widget-CXGm8Ih3.js +0 -3
- package/dist/zh-CN-RuuHh9p5.js +0 -1
- package/dist/zh-TW-Ddf7Ck1N.js +0 -1
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { ChainInfo } from '@tokenflight/api';
|
|
2
|
-
import { ContractCallDeposit } from '@tokenflight/api';
|
|
3
1
|
import { DEFAULT_API_ENDPOINT } from '@tokenflight/api';
|
|
4
|
-
import { DepositApproval } from '@tokenflight/api';
|
|
5
|
-
import { DepositBuildResponse } from '@tokenflight/api';
|
|
6
|
-
import { EIP1193RequestApproval } from '@tokenflight/api';
|
|
7
|
-
import { ErrorCode } from '@tokenflight/api';
|
|
8
|
-
import { ExactOutMethod } from '@tokenflight/api';
|
|
9
2
|
import { FiatJumpRoute } from '@tokenflight/api';
|
|
10
3
|
import { FiatOrderRequest } from '@tokenflight/api';
|
|
11
4
|
import { FiatOrderResponse } from '@tokenflight/api';
|
|
@@ -18,30 +11,11 @@ import { FiatQuoteRequest } from '@tokenflight/api';
|
|
|
18
11
|
import { FiatQuoteResponse } from '@tokenflight/api';
|
|
19
12
|
import { FiatQuotesResponse } from '@tokenflight/api';
|
|
20
13
|
import { FiatStatusResponse } from '@tokenflight/api';
|
|
21
|
-
import {
|
|
22
|
-
import { OrderListResponse } from '@tokenflight/api';
|
|
23
|
-
import { OrderResponse } from '@tokenflight/api';
|
|
24
|
-
import { OrderStatus } from '@tokenflight/api';
|
|
25
|
-
import { OrderTimestamps } from '@tokenflight/api';
|
|
26
|
-
import { OrderTransactions } from '@tokenflight/api';
|
|
27
|
-
import { QuoteRequest } from '@tokenflight/api';
|
|
28
|
-
import { QuoteResponse } from '@tokenflight/api';
|
|
29
|
-
import { QuoteRoute } from '@tokenflight/api';
|
|
30
|
-
import { ResolvedToken } from '@tokenflight/api';
|
|
31
|
-
import { RouteQuote } from '@tokenflight/api';
|
|
32
|
-
import { RouteTag } from '@tokenflight/api';
|
|
33
|
-
import { SolanaApproval } from '@tokenflight/api';
|
|
34
|
-
import { SubmitDepositResponse } from '@tokenflight/api';
|
|
14
|
+
import { HyperstreamApi } from '@tokenflight/api';
|
|
35
15
|
import { SwapStrategy } from '@tokenflight/api';
|
|
36
16
|
import { TERMINAL_FIAT_STATUSES } from '@tokenflight/api';
|
|
37
17
|
import { TERMINAL_ORDER_STATUSES } from '@tokenflight/api';
|
|
38
|
-
import { TokenExtensions } from '@tokenflight/api';
|
|
39
18
|
import { TokenFlightError } from '@tokenflight/api';
|
|
40
|
-
import { TokenInfo } from '@tokenflight/api';
|
|
41
|
-
import { TokenListResponse } from '@tokenflight/api';
|
|
42
|
-
import { TokenMeta } from '@tokenflight/api';
|
|
43
|
-
import { TokenSearchResponse } from '@tokenflight/api';
|
|
44
|
-
import { TradeType } from '@tokenflight/api';
|
|
45
19
|
import * as v from 'valibot';
|
|
46
20
|
|
|
47
21
|
/**
|
|
@@ -68,9 +42,24 @@ declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" |
|
|
|
68
42
|
*/
|
|
69
43
|
export declare function buildOffersForRanking(routes: readonly QuoteRoute[], tradeType: TradeType | null): OfferForRanking[];
|
|
70
44
|
|
|
71
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Callback interfaces for widget events.
|
|
47
|
+
*
|
|
48
|
+
* **Crypto outcome routing** (mutually exclusive — pick the channel that matches
|
|
49
|
+
* the active flow):
|
|
50
|
+
* - `EXACT_INPUT` (`<tokenflight-widget trade-type="EXACT_INPUT">` / default,
|
|
51
|
+
* "spend exactly N of X") → fires `onSwapSuccess` / `onSwapError`
|
|
52
|
+
* - `EXACT_OUTPUT` (`<tokenflight-widget trade-type="EXACT_OUTPUT">`,
|
|
53
|
+
* "receive exactly N of Y") → fires `onDepositSuccess` / `onDepositError`
|
|
54
|
+
*
|
|
55
|
+
* **Fiat (card) outcomes** route through the same `onSwap*` / `onDeposit*`
|
|
56
|
+
* channels for errors (matched to the host flow) and through
|
|
57
|
+
* `onFiatOrderCreated` / `onFiatOrderCompleted` for fiat-specific lifecycle.
|
|
58
|
+
*/
|
|
72
59
|
export declare interface Callbacks {
|
|
60
|
+
/** EXACT_INPUT crypto success. */
|
|
73
61
|
onSwapSuccess?(data: SwapSuccessData): void;
|
|
62
|
+
/** EXACT_INPUT errors (crypto execution + card flow when in EXACT_INPUT mode). */
|
|
74
63
|
onSwapError?(data: SwapErrorData): void;
|
|
75
64
|
onWalletConnected?(data: WalletConnectedData): void;
|
|
76
65
|
onQuoteReceived?(data: QuoteResponse): void;
|
|
@@ -90,13 +79,13 @@ export declare interface Callbacks {
|
|
|
90
79
|
status: string;
|
|
91
80
|
txHash?: string;
|
|
92
81
|
}): void;
|
|
93
|
-
/**
|
|
82
|
+
/** EXACT_OUTPUT crypto success. */
|
|
94
83
|
onDepositSuccess?(data: SwapSuccessData): void;
|
|
95
|
-
/**
|
|
84
|
+
/** EXACT_OUTPUT errors (crypto execution + card flow when in EXACT_OUTPUT mode). */
|
|
96
85
|
onDepositError?(data: SwapErrorData): void;
|
|
97
86
|
}
|
|
98
87
|
|
|
99
|
-
export
|
|
88
|
+
export declare type ChainInfo = HyperstreamApi.Chain;
|
|
100
89
|
|
|
101
90
|
/** Chain type for multi-chain support */
|
|
102
91
|
export declare type ChainType = "evm" | "solana";
|
|
@@ -110,7 +99,7 @@ export declare function clearTokenCache(): void;
|
|
|
110
99
|
*/
|
|
111
100
|
export declare function computeExchangeRate(amountIn: string, decimalsIn: number, amountOut: string, decimalsOut: number): string;
|
|
112
101
|
|
|
113
|
-
export
|
|
102
|
+
export declare type ContractCallDeposit = HyperstreamApi.ContractCallDeposit;
|
|
114
103
|
|
|
115
104
|
/**
|
|
116
105
|
* Custom color overrides — keys are CSS variable names.
|
|
@@ -129,32 +118,45 @@ export declare type CustomColors = Partial<Record<TfCssVar, string>> & Record<st
|
|
|
129
118
|
|
|
130
119
|
export { DEFAULT_API_ENDPOINT }
|
|
131
120
|
|
|
132
|
-
export
|
|
133
|
-
|
|
134
|
-
export { DepositBuildResponse }
|
|
135
|
-
|
|
136
|
-
/** Payment methods available in `<tokenflight-deposit>` */
|
|
137
|
-
export declare type DepositMethod = "wallet" | "card";
|
|
121
|
+
export declare type DepositApproval = HyperstreamApi.Approval;
|
|
138
122
|
|
|
139
|
-
|
|
140
|
-
export declare interface DepositState {
|
|
141
|
-
targetToken: ResolvedToken | null;
|
|
142
|
-
targetAmount: string;
|
|
143
|
-
fromToken: ResolvedToken | null;
|
|
144
|
-
recipient: string | null;
|
|
145
|
-
walletAddress: string | null;
|
|
146
|
-
execPhase: ExecPhase | null;
|
|
147
|
-
order: OrderResponse | null;
|
|
148
|
-
error: string | null;
|
|
149
|
-
errorCode: string | null;
|
|
150
|
-
}
|
|
123
|
+
export declare type DepositBuildResponse = HyperstreamApi.Deposit;
|
|
151
124
|
|
|
152
|
-
|
|
153
|
-
export declare type DepositView = "entry" | "fixed" | "select-target" | "wallet-pay-with";
|
|
125
|
+
export declare type EIP1193RequestApproval = HyperstreamApi.EIP1193RequestApproval;
|
|
154
126
|
|
|
155
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Swap-side error codes for failures that originate inside the widget
|
|
129
|
+
* itself (config validation, wallet interaction, transaction signing).
|
|
130
|
+
* Merged with the API codes from `@tokenflight/api` into a unified
|
|
131
|
+
* `ErrorCode` constant so callers only see one enum.
|
|
132
|
+
*/
|
|
133
|
+
export declare const ErrorCode: {
|
|
134
|
+
readonly INVALID_CONFIG: "TF1001";
|
|
135
|
+
readonly INVALID_TOKEN_IDENTIFIER: "TF1002";
|
|
136
|
+
readonly INVALID_AMOUNT: "TF1003";
|
|
137
|
+
readonly WALLET_CONNECTION_FAILED: "TF2002";
|
|
138
|
+
readonly WALLET_ACTION_FAILED: "TF2003";
|
|
139
|
+
readonly TRANSACTION_FAILED: "TF4001";
|
|
140
|
+
readonly ELEMENT_NOT_FOUND: "TF5001";
|
|
141
|
+
readonly API_REQUEST_FAILED: "TF3001";
|
|
142
|
+
readonly API_TIMEOUT: "TF3002";
|
|
143
|
+
readonly API_INVALID_RESPONSE: "TF3003";
|
|
144
|
+
readonly QUOTE_FAILED: "TF3004";
|
|
145
|
+
readonly QUOTE_EXPIRED: "TF3005";
|
|
146
|
+
readonly DEPOSIT_BUILD_FAILED: "TF3006";
|
|
147
|
+
readonly DEPOSIT_SUBMIT_FAILED: "TF3007";
|
|
148
|
+
readonly ORDER_FAILED: "TF3008";
|
|
149
|
+
readonly API_ABORTED: "TF3009";
|
|
150
|
+
readonly FIAT_QUOTE_FAILED: "TF6001";
|
|
151
|
+
readonly FIAT_ORDER_FAILED: "TF6002";
|
|
152
|
+
readonly FIAT_STATUS_FAILED: "TF6003";
|
|
153
|
+
readonly FIAT_PROVIDER_ERROR: "TF6004";
|
|
154
|
+
readonly FIAT_AMOUNT_OUT_OF_RANGE: "TF6005";
|
|
155
|
+
readonly FIAT_POPUP_BLOCKED: "TF6006";
|
|
156
|
+
readonly FIAT_CHECKOUT_UNAVAILABLE: "TF6007";
|
|
157
|
+
};
|
|
156
158
|
|
|
157
|
-
export
|
|
159
|
+
export declare type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
|
|
158
160
|
|
|
159
161
|
/** EVM wallet action via EIP-1193 */
|
|
160
162
|
export declare interface EvmWalletAction {
|
|
@@ -164,7 +166,7 @@ export declare interface EvmWalletAction {
|
|
|
164
166
|
params: unknown[];
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
export
|
|
169
|
+
export declare type ExactOutMethod = HyperstreamApi.ExactOutMethod;
|
|
168
170
|
|
|
169
171
|
/** Execution-only phases for the async build→wallet→submit→track→success flow */
|
|
170
172
|
export declare type ExecPhase = "building" | "awaiting-wallet" | "submitting" | "tracking" | "success";
|
|
@@ -214,16 +216,6 @@ export declare function getBestOverallRouteId(routes: readonly QuoteRoute[], tra
|
|
|
214
216
|
/** Get chain type from chainId */
|
|
215
217
|
export declare function getChainType(chainId: number): "evm" | "solana";
|
|
216
218
|
|
|
217
|
-
/**
|
|
218
|
-
* Fetch and parse the shared `defaults.json` payload. Memoized — subsequent
|
|
219
|
-
* calls return the same in-flight or resolved promise.
|
|
220
|
-
*
|
|
221
|
-
* Silently resolves to `null` on any failure (network error, non-2xx status,
|
|
222
|
-
* parse error, schema mismatch, timeout). Host code is expected to fall back
|
|
223
|
-
* to hardcoded defaults when `null` is returned.
|
|
224
|
-
*/
|
|
225
|
-
export declare function getDefaults(): Promise<WidgetDefaults | null>;
|
|
226
|
-
|
|
227
219
|
declare interface ImperativeWidgetOptions<TConfig> {
|
|
228
220
|
container: string | HTMLElement;
|
|
229
221
|
config: TConfig;
|
|
@@ -303,23 +295,26 @@ declare interface OfferForRanking {
|
|
|
303
295
|
isOneClick: boolean;
|
|
304
296
|
}
|
|
305
297
|
|
|
306
|
-
export
|
|
298
|
+
export declare type OnChainTx = HyperstreamApi.OnChainTx;
|
|
299
|
+
|
|
300
|
+
export declare type OrderListResponse = HyperstreamApi.GetOrderResponse;
|
|
307
301
|
|
|
308
|
-
export
|
|
302
|
+
export declare type OrderResponse = HyperstreamApi.Order;
|
|
309
303
|
|
|
310
|
-
export
|
|
304
|
+
export declare type OrderStatus = HyperstreamApi.OrderStatus;
|
|
311
305
|
|
|
312
|
-
export
|
|
306
|
+
export declare type OrderTimestamps = HyperstreamApi.OrderTimestamps;
|
|
313
307
|
|
|
314
|
-
export
|
|
308
|
+
export declare type OrderTransactions = HyperstreamApi.OrderTransactions;
|
|
315
309
|
|
|
316
|
-
|
|
310
|
+
/** Quote detail card display mode. */
|
|
311
|
+
export declare type QuoteCardVisibility = "hidden" | "visible";
|
|
317
312
|
|
|
318
|
-
export
|
|
313
|
+
export declare type QuoteRequest = HyperstreamApi.QuoteRequest;
|
|
319
314
|
|
|
320
|
-
export
|
|
315
|
+
export declare type QuoteResponse = HyperstreamApi.GetQuotesResponse;
|
|
321
316
|
|
|
322
|
-
export
|
|
317
|
+
export declare type QuoteRoute = HyperstreamApi.Route;
|
|
323
318
|
|
|
324
319
|
/**
|
|
325
320
|
* Rank offers where lower input amount is better (EXACT_OUTPUT).
|
|
@@ -333,7 +328,8 @@ export declare function rankOffers(offers: readonly OfferForRanking[]): string[]
|
|
|
333
328
|
export declare type ReceiveMode = "crypto" | "fiat" | "all";
|
|
334
329
|
|
|
335
330
|
/**
|
|
336
|
-
* Non-derivable state for
|
|
331
|
+
* Non-derivable state for the Receive (EXACT_OUTPUT) flow inside
|
|
332
|
+
* `<tokenflight-widget>`.
|
|
337
333
|
*
|
|
338
334
|
* Derivable values (phase, selectedQuote, paymentTokens) are computed in
|
|
339
335
|
* ReceiveComponent from payTokenQuotes + loadingQuotes + these signals.
|
|
@@ -353,8 +349,6 @@ export declare interface ReceiveState {
|
|
|
353
349
|
errorCode: string | null;
|
|
354
350
|
}
|
|
355
351
|
|
|
356
|
-
export declare function registerDepositElement(options?: RegisterElementsOptions): void;
|
|
357
|
-
|
|
358
352
|
export declare function registerElements(options?: RegisterElementsOptions): void;
|
|
359
353
|
|
|
360
354
|
export declare interface RegisterElementsOptions {
|
|
@@ -395,15 +389,22 @@ export declare interface RegisterElementsOptions {
|
|
|
395
389
|
referrerFeeBps?: number;
|
|
396
390
|
}
|
|
397
391
|
|
|
398
|
-
export declare function registerSwapElement(options?: RegisterElementsOptions): void;
|
|
399
|
-
|
|
400
392
|
export declare function registerWidgetElement(options?: RegisterElementsOptions): void;
|
|
401
393
|
|
|
402
|
-
|
|
394
|
+
/** Resolved token with full metadata for local display state */
|
|
395
|
+
export declare interface ResolvedToken {
|
|
396
|
+
chainId: number;
|
|
397
|
+
address: string;
|
|
398
|
+
symbol?: string;
|
|
399
|
+
name?: string;
|
|
400
|
+
decimals?: number;
|
|
401
|
+
logoURI?: string;
|
|
402
|
+
priceUsd?: number;
|
|
403
|
+
}
|
|
403
404
|
|
|
404
|
-
export
|
|
405
|
+
export declare type RouteQuote = HyperstreamApi.Quote;
|
|
405
406
|
|
|
406
|
-
export
|
|
407
|
+
export declare type RouteTag = HyperstreamApi.RouteTag;
|
|
407
408
|
|
|
408
409
|
/**
|
|
409
410
|
* Imperatively set UI text overrides. Equivalent to
|
|
@@ -415,7 +416,7 @@ export declare function setTextOverrides(overrides: TextOverrides | undefined):
|
|
|
415
416
|
/** Chain ID for Solana mainnet in the API */
|
|
416
417
|
export declare const SOLANA_CHAIN_ID = 20011000000;
|
|
417
418
|
|
|
418
|
-
export
|
|
419
|
+
export declare type SolanaApproval = HyperstreamApi.SolanaApproval;
|
|
419
420
|
|
|
420
421
|
/** Solana sign and send transaction action */
|
|
421
422
|
export declare interface SolanaSignAndSendAction {
|
|
@@ -429,7 +430,7 @@ export declare interface SolanaSignTransactionAction {
|
|
|
429
430
|
transaction: string;
|
|
430
431
|
}
|
|
431
432
|
|
|
432
|
-
export
|
|
433
|
+
export declare type SubmitDepositResponse = HyperstreamApi.SubmitDepositResponse;
|
|
433
434
|
|
|
434
435
|
/** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
|
|
435
436
|
export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
|
|
@@ -459,9 +460,6 @@ export declare interface SwapSuccessData {
|
|
|
459
460
|
txHash: string;
|
|
460
461
|
}
|
|
461
462
|
|
|
462
|
-
/** @deprecated Use `SwapPayMethod` instead. */
|
|
463
|
-
declare type SwapV2PayMethod = SwapPayMethod;
|
|
464
|
-
|
|
465
463
|
export { TERMINAL_FIAT_STATUSES }
|
|
466
464
|
|
|
467
465
|
export { TERMINAL_ORDER_STATUSES }
|
|
@@ -516,7 +514,7 @@ export declare interface TextOverrides {
|
|
|
516
514
|
}
|
|
517
515
|
|
|
518
516
|
/** All first-party CSS custom properties exposed for theming. */
|
|
519
|
-
declare type TfCssVar = "--tf-bg" | "--tf-bg-secondary" | "--tf-bg-elevated" | "--tf-surface" | "--tf-surface-hover" | "--tf-input-bg" | "--tf-glass" | "--tf-text" | "--tf-text-secondary" | "--tf-text-tertiary" | "--tf-text-on-primary" | "--tf-border" | "--tf-border-light" | "--tf-primary" | "--tf-primary-alpha" | "--tf-primary-light" | "--tf-primary-glow" | "--tf-success" | "--tf-success-bg" | "--tf-error" | "--tf-error-bg" | "--tf-error-alpha" | "--tf-warning" | "--tf-warning-bg" | "--tf-shadow" | "--tf-shadow-lg" | "--tf-skeleton" | "--tf-radius-xs" | "--tf-radius-sm" | "--tf-radius" | "--tf-radius-lg" | "--tf-radius-xl" | "--tf-button-radius" | "--tf-widget-max-width" | "--tf-font-family" | "--tf-font-family-mono" | "--tf-font-size" | "--tf-line-height";
|
|
517
|
+
declare type TfCssVar = "--tf-bg" | "--tf-bg-secondary" | "--tf-bg-elevated" | "--tf-surface" | "--tf-surface-hover" | "--tf-input-bg" | "--tf-glass" | "--tf-text" | "--tf-text-secondary" | "--tf-text-tertiary" | "--tf-text-on-primary" | "--tf-border" | "--tf-border-light" | "--tf-primary" | "--tf-primary-alpha" | "--tf-primary-light" | "--tf-primary-glow" | "--tf-success" | "--tf-success-bg" | "--tf-error" | "--tf-error-bg" | "--tf-error-alpha" | "--tf-warning" | "--tf-warning-bg" | "--tf-shadow" | "--tf-shadow-lg" | "--tf-skeleton" | "--tf-radius-xs" | "--tf-radius-sm" | "--tf-radius" | "--tf-radius-lg" | "--tf-radius-xl" | "--tf-button-radius" | "--tf-widget-max-width" | "--tf-font-family" | "--tf-font-family-mono" | "--tf-font-size" | "--tf-line-height" | "--tf-font-sm" | "--tf-font-base" | "--tf-font-md" | "--tf-font-lg" | "--tf-font-xl" | "--tf-font-heading" | "--tf-font-amount" | "--tf-font-amount-lg" | "--tf-font-amount-sm";
|
|
520
518
|
|
|
521
519
|
/** Visual theme mode. */
|
|
522
520
|
export declare type Theme = "light" | "dark" | "auto";
|
|
@@ -535,13 +533,13 @@ export declare function toBaseUnits(displayAmount: string, decimals: number): st
|
|
|
535
533
|
*/
|
|
536
534
|
export declare function toDisplayAmount(baseUnits: string, decimals: number): string;
|
|
537
535
|
|
|
538
|
-
export
|
|
536
|
+
export declare type TokenExtensions = HyperstreamApi.TokenExtensions;
|
|
539
537
|
|
|
540
538
|
/** Shared configuration fields for both widgets */
|
|
541
539
|
export declare interface TokenFlightConfigBase {
|
|
542
540
|
/** HyperStream API endpoint */
|
|
543
541
|
apiEndpoint?: string;
|
|
544
|
-
/** Fiat on-ramp API endpoint (default: https://fiat
|
|
542
|
+
/** Fiat on-ramp API endpoint (default: https://fiat.hyperstream.dev) */
|
|
545
543
|
fiatApiEndpoint?: string;
|
|
546
544
|
/** Visual theme */
|
|
547
545
|
theme?: Theme;
|
|
@@ -559,6 +557,8 @@ export declare interface TokenFlightConfigBase {
|
|
|
559
557
|
hidePoweredBy?: boolean;
|
|
560
558
|
/** Hide the "via {provider}" badge on the order tracking page */
|
|
561
559
|
hideProvider?: boolean;
|
|
560
|
+
/** Quote card display mode. EXACT_INPUT Swap defaults to "hidden". */
|
|
561
|
+
quoteCard?: QuoteCardVisibility;
|
|
562
562
|
/** Remove container background (transparent) */
|
|
563
563
|
noBackground?: boolean;
|
|
564
564
|
/** Remove container border and shadow */
|
|
@@ -575,53 +575,6 @@ export declare interface TokenFlightConfigBase {
|
|
|
575
575
|
referrerFeeBps?: number;
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
/** Attributes accepted by `<tokenflight-deposit>`. */
|
|
579
|
-
export declare interface TokenFlightDepositAttributes {
|
|
580
|
-
"api-endpoint"?: string;
|
|
581
|
-
target?: string;
|
|
582
|
-
amount?: string;
|
|
583
|
-
"from-token"?: string;
|
|
584
|
-
recipient?: string;
|
|
585
|
-
methods?: string;
|
|
586
|
-
"target-icon"?: string;
|
|
587
|
-
"fiat-currency"?: string;
|
|
588
|
-
"title-text"?: string;
|
|
589
|
-
"title-image"?: string;
|
|
590
|
-
theme?: Theme;
|
|
591
|
-
locale?: SupportedLocale;
|
|
592
|
-
"csp-nonce"?: string;
|
|
593
|
-
"hide-title"?: BooleanAttribute;
|
|
594
|
-
"hide-powered-by"?: BooleanAttribute;
|
|
595
|
-
"hide-provider"?: BooleanAttribute;
|
|
596
|
-
"no-background"?: BooleanAttribute;
|
|
597
|
-
"no-border"?: BooleanAttribute;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
/** Configuration for `<tokenflight-deposit>` */
|
|
601
|
-
export declare interface TokenFlightDepositConfig extends TokenFlightConfigBase {
|
|
602
|
-
/** Target token(s) to deposit into. When omitted, user selects via TokenSelector. */
|
|
603
|
-
target?: TokenIdentifier | TokenIdentifier[];
|
|
604
|
-
/** Optional: fixed amount for the target token */
|
|
605
|
-
amount?: string;
|
|
606
|
-
/** Optional: recipient address */
|
|
607
|
-
recipient?: string;
|
|
608
|
-
/** Payment methods to offer (default: ["wallet"]) */
|
|
609
|
-
methods?: DepositMethod[];
|
|
610
|
-
/** Optional source token to pay with */
|
|
611
|
-
fromToken?: TokenIdentifier;
|
|
612
|
-
/** Optional icon URL for the target token */
|
|
613
|
-
targetIcon?: string;
|
|
614
|
-
/** Fiat currency code for card payments (default: "USD") */
|
|
615
|
-
fiatCurrency?: string;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
export declare interface TokenFlightDepositOptions {
|
|
619
|
-
container: string | HTMLElement;
|
|
620
|
-
config: TokenFlightDepositConfig;
|
|
621
|
-
walletAdapter?: IWalletAdapter;
|
|
622
|
-
callbacks?: Callbacks;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
578
|
export { TokenFlightError }
|
|
626
579
|
|
|
627
580
|
/** Attributes accepted by `<tokenflight-fiat>`. */
|
|
@@ -643,165 +596,6 @@ export declare interface TokenFlightFiatAttributes {
|
|
|
643
596
|
"no-border"?: BooleanAttribute;
|
|
644
597
|
}
|
|
645
598
|
|
|
646
|
-
/**
|
|
647
|
-
* @deprecated Use `TokenFlightDepositConfig` instead.
|
|
648
|
-
*
|
|
649
|
-
* Configuration for `<tokenflight-fiat>`
|
|
650
|
-
*/
|
|
651
|
-
export declare interface TokenFlightFiatConfig extends TokenFlightConfigBase {
|
|
652
|
-
/** Optional: target token to purchase (user can select via TokenSelector if omitted) */
|
|
653
|
-
target?: TokenIdentifier;
|
|
654
|
-
/** Optional recipient address (if not using connected wallet) */
|
|
655
|
-
recipient?: string;
|
|
656
|
-
/** Fiat currency code (default: "USD") */
|
|
657
|
-
fiatCurrency?: string;
|
|
658
|
-
/** Optional icon URL for the target token */
|
|
659
|
-
icon?: string;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
export declare interface TokenFlightFiatOptions {
|
|
663
|
-
container: string | HTMLElement;
|
|
664
|
-
config: TokenFlightFiatConfig;
|
|
665
|
-
walletAdapter?: IWalletAdapter;
|
|
666
|
-
callbacks?: Callbacks;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
/** Attributes accepted by `<tokenflight-receive>`. */
|
|
670
|
-
export declare interface TokenFlightReceiveAttributes {
|
|
671
|
-
"api-endpoint"?: string;
|
|
672
|
-
target?: string;
|
|
673
|
-
amount?: string;
|
|
674
|
-
"from-token"?: string;
|
|
675
|
-
recipient?: string;
|
|
676
|
-
"title-text"?: string;
|
|
677
|
-
"title-image"?: string;
|
|
678
|
-
theme?: Theme;
|
|
679
|
-
locale?: SupportedLocale;
|
|
680
|
-
"csp-nonce"?: string;
|
|
681
|
-
icon?: string;
|
|
682
|
-
"hide-title"?: BooleanAttribute;
|
|
683
|
-
"hide-powered-by"?: BooleanAttribute;
|
|
684
|
-
"hide-provider"?: BooleanAttribute;
|
|
685
|
-
"no-background"?: BooleanAttribute;
|
|
686
|
-
"no-border"?: BooleanAttribute;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/** Configuration for the Receive component (EXACT_OUTPUT UX) */
|
|
690
|
-
export declare interface TokenFlightReceiveConfig extends TokenFlightConfigBase {
|
|
691
|
-
/** Target token to receive (optional — user can select via TokenSelector if omitted) */
|
|
692
|
-
target?: TokenIdentifier;
|
|
693
|
-
/** Amount to receive (optional when amountEditable is true) */
|
|
694
|
-
amount?: string;
|
|
695
|
-
/** Optional source token to pay with */
|
|
696
|
-
fromToken?: TokenIdentifier;
|
|
697
|
-
/** Optional recipient address (for cross-chain swaps to a different address) */
|
|
698
|
-
recipient?: string;
|
|
699
|
-
/**
|
|
700
|
-
* When true, the recipient badge stays editable even if `recipient` is preset.
|
|
701
|
-
* Default: false — presetting `recipient` locks the badge.
|
|
702
|
-
*/
|
|
703
|
-
recipientEditable?: boolean;
|
|
704
|
-
/** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
|
|
705
|
-
refundTo?: string;
|
|
706
|
-
/** Optional icon URL for the target token */
|
|
707
|
-
icon?: string;
|
|
708
|
-
/** Payment methods to offer (default: ["crypto"]) */
|
|
709
|
-
methods?: ("crypto" | "card")[];
|
|
710
|
-
/** Fiat currency code for card payments (default: "USD") */
|
|
711
|
-
fiatCurrency?: string;
|
|
712
|
-
/** Allow user to edit the receive amount */
|
|
713
|
-
amountEditable?: boolean;
|
|
714
|
-
/** Whitelist of allowed source tokens (CAIP-10) */
|
|
715
|
-
fromTokens?: TokenIdentifier[];
|
|
716
|
-
/** Whitelist of allowed destination tokens (CAIP-10) */
|
|
717
|
-
toTokens?: TokenIdentifier[];
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
export declare interface TokenFlightReceiveOptions {
|
|
721
|
-
container: string | HTMLElement;
|
|
722
|
-
config: TokenFlightReceiveConfig;
|
|
723
|
-
walletAdapter?: IWalletAdapter;
|
|
724
|
-
callbacks?: Callbacks;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
export declare const TokenFlightSwap: {
|
|
728
|
-
new (options: ImperativeWidgetOptions<TokenFlightSwapConfig>): {
|
|
729
|
-
#dispose: (() => void) | null;
|
|
730
|
-
#unwatchTheme: (() => void) | null;
|
|
731
|
-
#container: HTMLElement;
|
|
732
|
-
#shadowRoot: ShadowRoot | null;
|
|
733
|
-
#config: TokenFlightSwapConfig;
|
|
734
|
-
#walletAdapter?: IWalletAdapter;
|
|
735
|
-
#callbacks?: Callbacks;
|
|
736
|
-
initialize(): void;
|
|
737
|
-
destroy(): void;
|
|
738
|
-
setTheme(theme: Theme): void;
|
|
739
|
-
setCustomColors(colors: CustomColors): void;
|
|
740
|
-
#applyThemeStyles(style: HTMLStyleElement, theme: string): void;
|
|
741
|
-
#setupAutoThemeWatch(style: HTMLStyleElement): void;
|
|
742
|
-
};
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
/** Attributes accepted by `<tokenflight-swap>`. */
|
|
746
|
-
export declare interface TokenFlightSwapAttributes {
|
|
747
|
-
"api-endpoint"?: string;
|
|
748
|
-
"from-token"?: string;
|
|
749
|
-
"to-token"?: string;
|
|
750
|
-
recipient?: string;
|
|
751
|
-
"title-text"?: string;
|
|
752
|
-
"title-image"?: string;
|
|
753
|
-
theme?: Theme;
|
|
754
|
-
locale?: SupportedLocale;
|
|
755
|
-
"csp-nonce"?: string;
|
|
756
|
-
"hide-title"?: BooleanAttribute;
|
|
757
|
-
"hide-powered-by"?: BooleanAttribute;
|
|
758
|
-
"hide-provider"?: BooleanAttribute;
|
|
759
|
-
"no-background"?: BooleanAttribute;
|
|
760
|
-
"no-border"?: BooleanAttribute;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
/** Configuration for `<tokenflight-swap>` and `<tokenflight-widget>` swap mode */
|
|
764
|
-
export declare interface TokenFlightSwapConfig extends TokenFlightConfigBase {
|
|
765
|
-
/** Optional source token (crypto tab) */
|
|
766
|
-
fromToken?: TokenIdentifier;
|
|
767
|
-
/** Optional destination token */
|
|
768
|
-
toToken?: TokenIdentifier;
|
|
769
|
-
/** Optional recipient address */
|
|
770
|
-
recipient?: string;
|
|
771
|
-
/**
|
|
772
|
-
* When true, the recipient badge stays editable even if `recipient` is preset.
|
|
773
|
-
* Default: false — presetting `recipient` locks the badge.
|
|
774
|
-
*/
|
|
775
|
-
recipientEditable?: boolean;
|
|
776
|
-
/** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
|
|
777
|
-
refundTo?: string;
|
|
778
|
-
/** Trade direction: "EXACT_INPUT" (default) = amount is input, "EXACT_OUTPUT" = amount is output */
|
|
779
|
-
tradeType?: "EXACT_INPUT" | "EXACT_OUTPUT";
|
|
780
|
-
/** Amount value — interpreted as input or output based on tradeType */
|
|
781
|
-
amount?: string;
|
|
782
|
-
/** Payment methods to offer (default: ["crypto"]) */
|
|
783
|
-
methods?: SwapPayMethod[];
|
|
784
|
-
/** Default active pay method tab (default: "crypto") */
|
|
785
|
-
defaultPayMethod?: SwapPayMethod;
|
|
786
|
-
/** Fiat currency code for card payments (default: "USD") */
|
|
787
|
-
fiatCurrency?: string;
|
|
788
|
-
/** Whitelist of allowed source tokens (CAIP-10) */
|
|
789
|
-
fromTokens?: TokenIdentifier[];
|
|
790
|
-
/** Whitelist of allowed destination tokens (CAIP-10) */
|
|
791
|
-
toTokens?: TokenIdentifier[];
|
|
792
|
-
/** Lock the from-token selector (disable changing) */
|
|
793
|
-
lockFromToken?: boolean;
|
|
794
|
-
/** Lock the to-token selector (disable changing) */
|
|
795
|
-
lockToToken?: boolean;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
export declare interface TokenFlightSwapOptions {
|
|
799
|
-
container: string | HTMLElement;
|
|
800
|
-
config: TokenFlightSwapConfig;
|
|
801
|
-
walletAdapter?: IWalletAdapter;
|
|
802
|
-
callbacks?: Callbacks;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
599
|
export declare const TokenFlightWidget: {
|
|
806
600
|
new (options: ImperativeWidgetOptions<TokenFlightWidgetConfig>): {
|
|
807
601
|
#dispose: (() => void) | null;
|
|
@@ -829,6 +623,8 @@ export declare interface TokenFlightWidgetAttributes {
|
|
|
829
623
|
"trade-type"?: string;
|
|
830
624
|
amount?: string;
|
|
831
625
|
recipient?: string;
|
|
626
|
+
"recipient-editable"?: BooleanAttribute;
|
|
627
|
+
"refund-to"?: string;
|
|
832
628
|
icon?: string;
|
|
833
629
|
"lock-from-token"?: BooleanAttribute;
|
|
834
630
|
"lock-to-token"?: BooleanAttribute;
|
|
@@ -837,6 +633,7 @@ export declare interface TokenFlightWidgetAttributes {
|
|
|
837
633
|
"default-pay-method"?: "crypto" | "card";
|
|
838
634
|
"from-tokens"?: string;
|
|
839
635
|
"to-tokens"?: string;
|
|
636
|
+
"rpc-overrides"?: string;
|
|
840
637
|
"title-text"?: string;
|
|
841
638
|
"title-image"?: string;
|
|
842
639
|
theme?: Theme;
|
|
@@ -845,6 +642,7 @@ export declare interface TokenFlightWidgetAttributes {
|
|
|
845
642
|
"hide-title"?: BooleanAttribute;
|
|
846
643
|
"hide-powered-by"?: BooleanAttribute;
|
|
847
644
|
"hide-provider"?: BooleanAttribute;
|
|
645
|
+
"quote-card"?: "hidden" | "visible";
|
|
848
646
|
"no-background"?: BooleanAttribute;
|
|
849
647
|
"no-border"?: BooleanAttribute;
|
|
850
648
|
"referrer"?: string;
|
|
@@ -871,9 +669,9 @@ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
|
|
|
871
669
|
/** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
|
|
872
670
|
refundTo?: string;
|
|
873
671
|
/** Payment methods to offer (default: ["crypto"]) */
|
|
874
|
-
methods?:
|
|
672
|
+
methods?: SwapPayMethod[];
|
|
875
673
|
/** Default active pay method tab (default: "crypto") */
|
|
876
|
-
defaultPayMethod?:
|
|
674
|
+
defaultPayMethod?: SwapPayMethod;
|
|
877
675
|
/** Fiat currency code for card payments (default: "USD") */
|
|
878
676
|
fiatCurrency?: string;
|
|
879
677
|
/** Whitelist of allowed source tokens (CAIP-10) */
|
|
@@ -903,13 +701,13 @@ export declare interface TokenFlightWidgetOptions {
|
|
|
903
701
|
*/
|
|
904
702
|
export declare type TokenIdentifier = string | TokenTarget;
|
|
905
703
|
|
|
906
|
-
export
|
|
704
|
+
export declare type TokenInfo = HyperstreamApi.Token;
|
|
907
705
|
|
|
908
|
-
export
|
|
706
|
+
export declare type TokenListResponse = HyperstreamApi.GetTokensResponse;
|
|
909
707
|
|
|
910
|
-
export
|
|
708
|
+
export declare type TokenMeta = HyperstreamApi.TokenMeta;
|
|
911
709
|
|
|
912
|
-
export
|
|
710
|
+
export declare type TokenSearchResponse = HyperstreamApi.TokenSearchResponse;
|
|
913
711
|
|
|
914
712
|
/** Token target as chain + address pair */
|
|
915
713
|
export declare interface TokenTarget {
|
|
@@ -917,7 +715,7 @@ export declare interface TokenTarget {
|
|
|
917
715
|
address: string;
|
|
918
716
|
}
|
|
919
717
|
|
|
920
|
-
export
|
|
718
|
+
export declare type TradeType = HyperstreamApi.TradeType;
|
|
921
719
|
|
|
922
720
|
/** Union of all wallet action types */
|
|
923
721
|
export declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
|
|
@@ -1004,7 +802,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1004
802
|
hideProvider?: boolean | undefined;
|
|
1005
803
|
noBackground?: boolean | undefined;
|
|
1006
804
|
noBorder?: boolean | undefined;
|
|
1007
|
-
methods?: ("
|
|
805
|
+
methods?: ("crypto" | "card")[] | undefined;
|
|
1008
806
|
supportedChainIds?: number[] | undefined;
|
|
1009
807
|
rpcOverrides?: {
|
|
1010
808
|
[x: string]: string;
|
|
@@ -1023,7 +821,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1023
821
|
hideProvider?: boolean | undefined;
|
|
1024
822
|
noBackground?: boolean | undefined;
|
|
1025
823
|
noBorder?: boolean | undefined;
|
|
1026
|
-
methods?: ("
|
|
824
|
+
methods?: ("crypto" | "card")[] | undefined;
|
|
1027
825
|
supportedChainIds?: number[] | undefined;
|
|
1028
826
|
rpcOverrides?: {
|
|
1029
827
|
[x: string]: string;
|
|
@@ -1043,7 +841,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1043
841
|
hideProvider?: boolean | undefined;
|
|
1044
842
|
noBackground?: boolean | undefined;
|
|
1045
843
|
noBorder?: boolean | undefined;
|
|
1046
|
-
methods?: ("
|
|
844
|
+
methods?: ("crypto" | "card")[] | undefined;
|
|
1047
845
|
supportedChainIds?: number[] | undefined;
|
|
1048
846
|
rpcOverrides?: {
|
|
1049
847
|
[x: string]: string;
|
|
@@ -1064,7 +862,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1064
862
|
hideProvider?: boolean | undefined;
|
|
1065
863
|
noBackground?: boolean | undefined;
|
|
1066
864
|
noBorder?: boolean | undefined;
|
|
1067
|
-
methods?: ("
|
|
865
|
+
methods?: ("crypto" | "card")[] | undefined;
|
|
1068
866
|
supportedChainIds?: number[] | undefined;
|
|
1069
867
|
rpcOverrides?: {
|
|
1070
868
|
[x: string]: string;
|
|
@@ -1084,7 +882,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1084
882
|
hideProvider?: boolean | undefined;
|
|
1085
883
|
noBackground?: boolean | undefined;
|
|
1086
884
|
noBorder?: boolean | undefined;
|
|
1087
|
-
methods?: ("
|
|
885
|
+
methods?: ("crypto" | "card")[] | undefined;
|
|
1088
886
|
supportedChainIds?: number[] | undefined;
|
|
1089
887
|
rpcOverrides?: {
|
|
1090
888
|
[x: string]: string;
|