@tokenflight/swap 0.1.2 → 0.1.4
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/en-US-BdYNpx0K.js +1 -0
- package/dist/ja-JP-D0jMcX_A.js +1 -0
- package/dist/ko-KR-n0fjdfjr.js +1 -0
- package/dist/register-widget-vJhNZS3M.js +224 -0
- package/dist/swap.css +1 -1
- package/dist/tokenflight-swap.d.ts +36 -30
- package/dist/tokenflight-swap.js +2 -1
- package/dist/tokenflight-swap.umd.cjs +5 -5
- package/dist/widget.d.ts +11 -4
- package/dist/widget.js +1 -1
- package/dist/zh-CN-HIEpOVGH.js +1 -0
- package/dist/zh-TW-hpKr3X5A.js +1 -0
- package/package.json +5 -21
- package/dist/deposit.d.ts +0 -304
- package/dist/deposit.js +0 -1
- package/dist/dist-D4PEwqKq.js +0 -2
- package/dist/en-US-Dg7NZU3M.js +0 -1
- package/dist/fiat.d.ts +0 -360
- package/dist/fiat.js +0 -1
- package/dist/ja-JP-FXTra_NF.js +0 -1
- package/dist/ko-KR-D4gcrXFl.js +0 -1
- package/dist/receive.d.ts +0 -333
- package/dist/receive.js +0 -1
- package/dist/register-deposit-COFuKwk-.js +0 -1
- package/dist/register-swap-a_E08H4c.js +0 -2
- package/dist/register-widget-CTcQPmpL.js +0 -1
- package/dist/swap.d.ts +0 -283
- package/dist/swap.js +0 -1
- package/dist/widget-9I201q7O.js +0 -223
- package/dist/zh-CN-CuSlgEdI.js +0 -1
- package/dist/zh-TW-DkEqrPgE.js +0 -1
package/dist/receive.d.ts
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import { QuoteResponse } from '@tokenflight/api';
|
|
2
|
-
import { SwapStrategy } from '@tokenflight/api';
|
|
3
|
-
|
|
4
|
-
/** Amount change data */
|
|
5
|
-
declare interface AmountChangedData {
|
|
6
|
-
amount: string;
|
|
7
|
-
direction: "from" | "to";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Boolean HTML attribute — accepts both native booleans and the
|
|
12
|
-
* string equivalents that `parseBooleanProp()` understands.
|
|
13
|
-
*/
|
|
14
|
-
declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" | "no" | "";
|
|
15
|
-
|
|
16
|
-
/** Callback interfaces for widget events */
|
|
17
|
-
export declare interface Callbacks {
|
|
18
|
-
onSwapSuccess?(data: SwapSuccessData): void;
|
|
19
|
-
onSwapError?(data: SwapErrorData): void;
|
|
20
|
-
onWalletConnected?(data: WalletConnectedData): void;
|
|
21
|
-
onQuoteReceived?(data: QuoteResponse): void;
|
|
22
|
-
onAmountChanged?(data: AmountChangedData): void;
|
|
23
|
-
/** Called when user clicks Connect Wallet and no walletAdapter is provided */
|
|
24
|
-
onConnectWallet?(): void;
|
|
25
|
-
/** Called when user clicks the connected wallet address (for custom account modal handling) */
|
|
26
|
-
onAccountModal?(): void;
|
|
27
|
-
/** Called when a fiat order is created and the payment widget URL is available */
|
|
28
|
-
onFiatOrderCreated?(data: {
|
|
29
|
-
orderId: string;
|
|
30
|
-
widgetUrl: string;
|
|
31
|
-
}): void;
|
|
32
|
-
/** Called when a fiat order reaches a terminal status */
|
|
33
|
-
onFiatOrderCompleted?(data: {
|
|
34
|
-
orderId: string;
|
|
35
|
-
status: string;
|
|
36
|
-
txHash?: string;
|
|
37
|
-
}): void;
|
|
38
|
-
/** Called when a deposit completes successfully */
|
|
39
|
-
onDepositSuccess?(data: SwapSuccessData): void;
|
|
40
|
-
/** Called when a deposit fails */
|
|
41
|
-
onDepositError?(data: SwapErrorData): void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Chain type for multi-chain support */
|
|
45
|
-
declare type ChainType = "evm" | "solana";
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Custom color overrides — keys are CSS variable names.
|
|
49
|
-
* Typed keys provide autocomplete; arbitrary `--tf-*` strings are also accepted.
|
|
50
|
-
*
|
|
51
|
-
* ```ts
|
|
52
|
-
* customColors: {
|
|
53
|
-
* "--tf-primary": "#FF6B00",
|
|
54
|
-
* "--tf-bg": "#1A1A2E",
|
|
55
|
-
* "--tf-button-radius": "4px",
|
|
56
|
-
* "--tf-widget-max-width": "480px",
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare type CustomColors = Partial<Record<TfCssVar, string>> & Record<string, string>;
|
|
61
|
-
|
|
62
|
-
/** Payment methods available in `<tokenflight-deposit>` */
|
|
63
|
-
declare type DepositMethod = "wallet" | "card";
|
|
64
|
-
|
|
65
|
-
/** EVM wallet action via EIP-1193 */
|
|
66
|
-
declare interface EvmWalletAction {
|
|
67
|
-
type: "eip1193_request";
|
|
68
|
-
chainId: number;
|
|
69
|
-
method: string;
|
|
70
|
-
params: unknown[];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** How the fiat payment provider UI is opened. */
|
|
74
|
-
declare type FiatPaymentMode = "overlay" | "popup";
|
|
75
|
-
|
|
76
|
-
declare interface ImperativeWidgetOptions<TConfig> {
|
|
77
|
-
container: string | HTMLElement;
|
|
78
|
-
config: TConfig;
|
|
79
|
-
walletAdapter?: IWalletAdapter;
|
|
80
|
-
callbacks?: Callbacks;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** Wallet adapter interface that all adapters must implement */
|
|
84
|
-
export declare interface IWalletAdapter {
|
|
85
|
-
/** Human-readable name */
|
|
86
|
-
readonly name: string;
|
|
87
|
-
/** Icon URL */
|
|
88
|
-
readonly icon?: string;
|
|
89
|
-
/** Supported action types */
|
|
90
|
-
readonly supportedActionTypes: WalletActionType[];
|
|
91
|
-
/** Optional: supported chain IDs — when set, the widget only shows tokens on these chains */
|
|
92
|
-
readonly supportedChainIds?: number[];
|
|
93
|
-
/** Connect the wallet */
|
|
94
|
-
connect(chainType?: ChainType): Promise<void>;
|
|
95
|
-
/** Disconnect the wallet */
|
|
96
|
-
disconnect(): Promise<void>;
|
|
97
|
-
/** Check if connected */
|
|
98
|
-
isConnected(chainType?: ChainType): boolean;
|
|
99
|
-
/** Get the current address */
|
|
100
|
-
getAddress(chainType?: ChainType): Promise<string | null>;
|
|
101
|
-
/** Execute a wallet action */
|
|
102
|
-
executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
|
|
103
|
-
/** Optional: sign a message */
|
|
104
|
-
signMessage?(message: string, chainType?: ChainType): Promise<string>;
|
|
105
|
-
/** Optional: open the wallet's native account/connected modal */
|
|
106
|
-
openAccountModal?(): Promise<void>;
|
|
107
|
-
/** Optional: clean up internal subscriptions and watchers */
|
|
108
|
-
destroy?(): void;
|
|
109
|
-
/** Subscribe to wallet events */
|
|
110
|
-
on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
|
|
111
|
-
/** Unsubscribe from wallet events */
|
|
112
|
-
off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** Receive component mode: crypto-only, fiat-only, or both */
|
|
116
|
-
export declare type ReceiveMode = "crypto" | "fiat" | "all";
|
|
117
|
-
|
|
118
|
-
export declare interface RegisterElementsOptions {
|
|
119
|
-
walletAdapter?: IWalletAdapter;
|
|
120
|
-
callbacks?: Callbacks;
|
|
121
|
-
/** Custom CSS variable overrides merged on top of the active theme.
|
|
122
|
-
* Keys are CSS variable names, e.g. `"--tf-primary"`, `"--tf-font-family"`. */
|
|
123
|
-
customColors?: CustomColors;
|
|
124
|
-
/** Default API endpoint for all widget instances. */
|
|
125
|
-
apiEndpoint?: string;
|
|
126
|
-
/** Default theme for all widget instances. */
|
|
127
|
-
theme?: Theme;
|
|
128
|
-
/** Default locale for all widget instances. */
|
|
129
|
-
locale?: SupportedLocale;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export declare function registerReceiveElement(options?: RegisterElementsOptions): void;
|
|
133
|
-
|
|
134
|
-
/** Solana sign and send transaction action */
|
|
135
|
-
declare interface SolanaSignAndSendAction {
|
|
136
|
-
type: "solana_signAndSendTransaction";
|
|
137
|
-
transaction: string;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** Solana sign transaction action */
|
|
141
|
-
declare interface SolanaSignTransactionAction {
|
|
142
|
-
type: "solana_signTransaction";
|
|
143
|
-
transaction: string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
|
|
147
|
-
export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
|
|
148
|
-
|
|
149
|
-
/** Data emitted on swap error */
|
|
150
|
-
declare interface SwapErrorData {
|
|
151
|
-
code: string;
|
|
152
|
-
message: string;
|
|
153
|
-
details?: unknown;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export { SwapStrategy }
|
|
157
|
-
|
|
158
|
-
/** Data emitted on swap success */
|
|
159
|
-
declare interface SwapSuccessData {
|
|
160
|
-
orderId: string;
|
|
161
|
-
fromToken: string;
|
|
162
|
-
toToken: string;
|
|
163
|
-
fromAmount: string;
|
|
164
|
-
toAmount: string;
|
|
165
|
-
txHash: string;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/** All first-party CSS custom properties exposed for theming. */
|
|
169
|
-
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";
|
|
170
|
-
|
|
171
|
-
/** Visual theme mode. */
|
|
172
|
-
export declare type Theme = "light" | "dark" | "auto";
|
|
173
|
-
|
|
174
|
-
/** Shared configuration fields for both widgets */
|
|
175
|
-
declare interface TokenFlightConfigBase {
|
|
176
|
-
/** HyperStream API endpoint */
|
|
177
|
-
apiEndpoint?: string;
|
|
178
|
-
/** Fiat on-ramp API endpoint (default: https://fiat-preview.hyperstream.dev) */
|
|
179
|
-
fiatApiEndpoint?: string;
|
|
180
|
-
/** Visual theme */
|
|
181
|
-
theme?: Theme;
|
|
182
|
-
/** Locale for i18n */
|
|
183
|
-
locale?: SupportedLocale;
|
|
184
|
-
/** Custom CSS color overrides */
|
|
185
|
-
customColors?: CustomColors;
|
|
186
|
-
/** Optional custom widget title text */
|
|
187
|
-
titleText?: string;
|
|
188
|
-
/** Optional custom widget title image URL */
|
|
189
|
-
titleImageUrl?: string;
|
|
190
|
-
/** Hide top title/header area */
|
|
191
|
-
hideTitle?: boolean;
|
|
192
|
-
/** Hide "Powered by TokenFlight" footer */
|
|
193
|
-
hidePoweredBy?: boolean;
|
|
194
|
-
/** Remove container background (transparent) */
|
|
195
|
-
noBackground?: boolean;
|
|
196
|
-
/** Remove container border and shadow */
|
|
197
|
-
noBorder?: boolean;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/** Configuration for `<tokenflight-deposit>` */
|
|
201
|
-
declare interface TokenFlightDepositConfig extends TokenFlightConfigBase {
|
|
202
|
-
/** Target token(s) to deposit into. When omitted, user selects via TokenSelector. */
|
|
203
|
-
target?: TokenIdentifier | TokenIdentifier[];
|
|
204
|
-
/** Optional: fixed amount for the target token */
|
|
205
|
-
amount?: string;
|
|
206
|
-
/** Optional: recipient address */
|
|
207
|
-
recipient?: string;
|
|
208
|
-
/** Payment methods to offer (default: ["wallet"]) */
|
|
209
|
-
methods?: DepositMethod[];
|
|
210
|
-
/** Optional source token to pay with */
|
|
211
|
-
fromToken?: TokenIdentifier;
|
|
212
|
-
/** Optional icon URL for the target token */
|
|
213
|
-
targetIcon?: string;
|
|
214
|
-
/** Fiat currency code for card payments (default: "USD") */
|
|
215
|
-
fiatCurrency?: string;
|
|
216
|
-
/** How to open the fiat payment provider (default: "overlay") */
|
|
217
|
-
fiatPaymentMode?: FiatPaymentMode;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export declare const TokenFlightReceive: {
|
|
221
|
-
new (options: ImperativeWidgetOptions<TokenFlightDepositConfig>): {
|
|
222
|
-
#dispose: (() => void) | null;
|
|
223
|
-
#unwatchTheme: (() => void) | null;
|
|
224
|
-
#container: HTMLElement;
|
|
225
|
-
#shadowRoot: ShadowRoot | null;
|
|
226
|
-
#config: TokenFlightDepositConfig;
|
|
227
|
-
#walletAdapter?: IWalletAdapter;
|
|
228
|
-
#callbacks?: Callbacks;
|
|
229
|
-
initialize(): void;
|
|
230
|
-
destroy(): void;
|
|
231
|
-
setTheme(theme: Theme): void;
|
|
232
|
-
setCustomColors(colors: CustomColors): void;
|
|
233
|
-
#applyThemeStyles(style: HTMLStyleElement, theme: string): void;
|
|
234
|
-
#setupAutoThemeWatch(style: HTMLStyleElement): void;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
/** Attributes accepted by `<tokenflight-receive>`. */
|
|
239
|
-
export declare interface TokenFlightReceiveAttributes {
|
|
240
|
-
"api-endpoint"?: string;
|
|
241
|
-
target?: string;
|
|
242
|
-
amount?: string;
|
|
243
|
-
"from-token"?: string;
|
|
244
|
-
recipient?: string;
|
|
245
|
-
"title-text"?: string;
|
|
246
|
-
"title-image"?: string;
|
|
247
|
-
theme?: Theme;
|
|
248
|
-
locale?: SupportedLocale;
|
|
249
|
-
"csp-nonce"?: string;
|
|
250
|
-
icon?: string;
|
|
251
|
-
"hide-title"?: BooleanAttribute;
|
|
252
|
-
"hide-powered-by"?: BooleanAttribute;
|
|
253
|
-
"no-background"?: BooleanAttribute;
|
|
254
|
-
"no-border"?: BooleanAttribute;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** Configuration for the Receive component (EXACT_OUTPUT UX) */
|
|
258
|
-
export declare interface TokenFlightReceiveConfig extends TokenFlightConfigBase {
|
|
259
|
-
/** Target token to receive (optional — user can select via TokenSelector if omitted) */
|
|
260
|
-
target?: TokenIdentifier;
|
|
261
|
-
/** Amount to receive (optional when amountEditable is true) */
|
|
262
|
-
amount?: string;
|
|
263
|
-
/** Optional source token to pay with */
|
|
264
|
-
fromToken?: TokenIdentifier;
|
|
265
|
-
/** Optional recipient address (for cross-chain swaps to a different address) */
|
|
266
|
-
recipient?: string;
|
|
267
|
-
/** Optional icon URL for the target token */
|
|
268
|
-
icon?: string;
|
|
269
|
-
/** Payment methods to offer (default: ["crypto"]) */
|
|
270
|
-
methods?: ("crypto" | "card")[];
|
|
271
|
-
/** Fiat currency code for card payments (default: "USD") */
|
|
272
|
-
fiatCurrency?: string;
|
|
273
|
-
/** How to open the fiat payment provider (default: "overlay") */
|
|
274
|
-
fiatPaymentMode?: FiatPaymentMode;
|
|
275
|
-
/** Allow user to edit the receive amount */
|
|
276
|
-
amountEditable?: boolean;
|
|
277
|
-
/** Whitelist of allowed source tokens (CAIP-10) */
|
|
278
|
-
fromTokens?: TokenIdentifier[];
|
|
279
|
-
/** Whitelist of allowed destination tokens (CAIP-10) */
|
|
280
|
-
toTokens?: TokenIdentifier[];
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export declare interface TokenFlightReceiveOptions {
|
|
284
|
-
container: string | HTMLElement;
|
|
285
|
-
config: TokenFlightReceiveConfig;
|
|
286
|
-
walletAdapter?: IWalletAdapter;
|
|
287
|
-
callbacks?: Callbacks;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Flexible token identifier supporting:
|
|
292
|
-
* - Direct object: { chainId: 1, address: "0x..." }
|
|
293
|
-
* - CAIP-10 string: "eip155:1:0x..."
|
|
294
|
-
* - JSON string: '{"chainId":1,"address":"0x..."}'
|
|
295
|
-
*/
|
|
296
|
-
declare type TokenIdentifier = string | TokenTarget;
|
|
297
|
-
|
|
298
|
-
/** Token target as chain + address pair */
|
|
299
|
-
declare interface TokenTarget {
|
|
300
|
-
chainId: number;
|
|
301
|
-
address: string;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/** Union of all wallet action types */
|
|
305
|
-
declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
|
|
306
|
-
|
|
307
|
-
/** Result of executing a wallet action */
|
|
308
|
-
declare interface WalletActionResult {
|
|
309
|
-
success: boolean;
|
|
310
|
-
data?: unknown;
|
|
311
|
-
error?: string;
|
|
312
|
-
txHash?: string;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/** Wallet action types */
|
|
316
|
-
declare type WalletActionType = "eip1193_request" | "solana_signTransaction" | "solana_signAndSendTransaction";
|
|
317
|
-
|
|
318
|
-
/** Data emitted when wallet is connected */
|
|
319
|
-
declare interface WalletConnectedData {
|
|
320
|
-
address: string;
|
|
321
|
-
chainType: string;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/** Wallet event payload */
|
|
325
|
-
declare interface WalletEvent {
|
|
326
|
-
type: WalletEventType;
|
|
327
|
-
data?: unknown;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/** Wallet event types */
|
|
331
|
-
declare type WalletEventType = "connect" | "disconnect" | "chainChanged" | "accountsChanged";
|
|
332
|
-
|
|
333
|
-
export { }
|
package/dist/receive.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-D4PEwqKq.js";import"./widget-9I201q7O.js";import{n as e,t}from"./register-deposit-COFuKwk-.js";export{e as TokenFlightReceive,t as registerReceiveElement};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{En as e,On as t,a as n,an as r,c as i,dn as a,gn as o,i as s,in as c,jn as l,l as u,n as d,nn as f,o as p,on as m,pn as h,r as g,rn as _,s as v,sn as y,t as b,tn as x,wn as S}from"./dist-D4PEwqKq.js";import{n as C,t as w}from"./widget-9I201q7O.js";function T(e){if(e)return e.map(e=>e===`wallet`?`crypto`:`card`)}var E=x((e,t,n)=>S(C,{config:{apiEndpoint:e.apiEndpoint,fiatApiEndpoint:e.fiatApiEndpoint,theme:e.theme,locale:e.locale,customColors:e.customColors,titleText:e.titleText,titleImageUrl:e.titleImageUrl,hideTitle:e.hideTitle,hidePoweredBy:e.hidePoweredBy,noBackground:e.noBackground,noBorder:e.noBorder,toToken:e.target,fromToken:e.fromToken,tradeType:e.amount?`EXACT_OUTPUT`:`EXACT_INPUT`,amount:e.amount,recipient:e.recipient,methods:T(e.methods),icon:e.targetIcon,fiatCurrency:e.fiatCurrency,fiatPaymentMode:e.fiatPaymentMode},walletAdapter:t,callbacks:n}),()=>w),D=o(`<style>`);function O(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function k(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function A(e){if(e)return e.map(e=>e===`wallet`?`crypto`:`card`)}function j(o){o&&d(o),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-deposit`)||b(`tokenflight-deposit`,{"api-endpoint":``,target:``,amount:``,"from-token":``,recipient:``,methods:``,"target-icon":``,"fiat-currency":``,"fiat-payment-mode":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"no-background":!1,"no-border":!1},(o,{element:d})=>{let b=k(o.methods),x={apiEndpoint:o[`api-endpoint`]||g()||void 0,toToken:O(o.target),fromToken:o[`from-token`]||void 0,tradeType:o.amount?`EXACT_OUTPUT`:`EXACT_INPUT`,amount:o.amount||void 0,recipient:o.recipient||void 0,methods:A(b),icon:o[`target-icon`]||void 0,fiatCurrency:o[`fiat-currency`]||void 0,fiatPaymentMode:o[`fiat-payment-mode`]||void 0,titleText:o[`title-text`]||void 0,titleImageUrl:o[`title-image`]||void 0,theme:o.theme||v()||`light`,locale:o.locale||p()||`en-US`,hideTitle:u(o[`hide-title`]),hidePoweredBy:u(o[`hide-powered-by`]),noBackground:u(o[`no-background`]),noBorder:u(o[`no-border`])},T=o[`csp-nonce`]||void 0,[E,j]=t(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);l(m(e=>{j(e===c)}));let M=d.__customColors,N=e(()=>{let e=o.theme||v()||`light`,t=(e===`auto`?E():e===`dark`)?c:r,i=n();return`:host { ${_(i||M?{...t,...i,...M}:t)} }\n${w}`}),P=d.__walletAdapter,F=d.__callbacks;return[(()=>{var e=D();return h(e,`nonce`,T),a(e,N),e})(),S(y,{client:f,get children(){return S(C,{config:x,get walletAdapter(){return P??i()},get callbacks(){return F?{...s(),...F}:s()}})}})]}))}export{E as n,j as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$ as e,$t as t,An as n,At as r,Bn as i,Bt as a,C as o,Cn as s,Ct as c,Dn as l,Dt as u,En as d,F as f,Ft as p,G as m,It as h,J as ee,K as te,Lt as ne,M as re,Mn as ie,Mt as ae,N as oe,Nn as se,Nt as ce,On as g,Ot as le,P as ue,Pn as de,Pt as fe,R as pe,Rt as me,S as _,St as he,T as ge,Tn as _e,Tt as ve,U as ye,Ut as be,V as xe,Y as Se,Zt as v,_ as y,a as b,an as Ce,b as x,bt as we,c as S,ct as Te,d as C,dn as w,et as Ee,f as T,fn as E,g as De,gn as D,h as O,ht as Oe,i as k,in as A,it as ke,j as Ae,jn as j,jt as je,l as M,ln as N,lt as Me,m as Ne,mt as Pe,n as Fe,nn as Ie,nt as Le,o as P,on as F,p as I,pn as L,q as Re,r as ze,rn as R,rt as Be,s as z,sn as B,t as Ve,tn as V,u as H,un as U,v as W,w as G,wn as K,wt as q,x as J,xn as Y,y as He,zt as Ue}from"./dist-D4PEwqKq.js";var We=D(`<div>`),Ge=D(`<div part=container><div part=accent-line data-testid=accent-line>`),Ke=D(`<img width=22 height=22>`),qe=D(`<button part=wallet-info><div data-testid=wallet-dot></div><span data-testid=wallet-address>`),Je=D(`<div part=header><div><span data-testid=header-title>`),Ye=D(`<div part=breadcrumb><button type=button></button><span>›</span><span>`),Xe=D(`<div><span part=balance data-testid=panel-balance></span><button data-testid=max-btn>`),X=D(`<span data-testid=caret>`),Ze=D(`<div part=token-display data-testid=token-btn><div data-testid=token-icon-wrap><div data-testid=token-chain-dot></div></div><span data-testid=token-name>`),Qe=D(`<div part=panel-from><div><div><span data-testid=panel-label></span></div><div></div><div><span data-testid=fiat>`),$e=D(`<div part=swap-arrow><button type=button data-testid=swap-arrow-inner>`),et=D(`<button part=recipient-badge data-testid=recipient-badge><span>`),tt=D(`<span part=amount-display data-testid=amount style=cursor:default>`),nt=D(`<div part=panel-to data-testid=panel-wrapper-to><div><div><span data-testid=panel-label></span></div><div></div><div><span data-testid=fiat>`),rt=D(`<div part=price-preview data-testid=quote>`),it=D(`<div part=no-offer><div><svg width=28 height=28 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><circle cx=11 cy=11 r=8></circle><path d="m21 21-4.35-4.35"></path><path d="M8 11h6"></path></svg></div><span>`),at=D(`<div part=cta-wrapper>`),ot=D(`<span>Flight`),st=D(`<button data-testid=token-btn><span data-testid=token-name>`),ct=D(`<div style=width:120px;height:28px>`);function Z(e){return K(f,{get children(){return K(Q,e)}})}function Q(o){let{t:f}=p(),_=ye(),[y,b]=g(null),[Ce,x]=g(!1),{isConnected:S,walletAddress:C,handleConnect:T}=ue({walletAdapter:()=>o.walletAdapter,callbacks:()=>o.callbacks,onAddressChange:e=>_.setWalletAddress(e),onConnectError:(e,t)=>{_.setError(e),_.setErrorCode(t)}}),[De,D,O]=ee(``,300),k=d(()=>new de({baseUrl:o.config.apiEndpoint??`https://api.hyperstream.dev`})),A=Ee(k,C,()=>S()&&!!C(),()=>o.walletAdapter?.supportedChainIds),j=d(()=>{let e=_.fromToken();if(!e||typeof e.decimals!=`number`||!A.data)return null;let t=A.data.find(t=>t.address.toLowerCase()===e.address.toLowerCase()&&t.chainId===e.chainId);return t?.extensions?.balance?le(r(ae(t.extensions.balance,t.decimals),2)):`0`}),M=d(()=>{let e=_.fromToken();return!e||typeof e.decimals!=`number`||!A.data?null:A.data.find(t=>t.address.toLowerCase()===e.address.toLowerCase()&&t.chainId===e.chainId)?.extensions?.balance??`0`}),Ne=d(()=>{let e=_.inputAmount(),t=_.fromToken(),n=M();if(!t||typeof t.decimals!=`number`||!n||!e||e===`0`||e===``)return!1;try{return BigInt(je(e,t.decimals))>BigInt(n)}catch{return!1}}),Fe=d(()=>{let e=_.fromToken();if(!e)return null;if(typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd))return e.priceUsd;let t=A.data?.find(t=>t.address.toLowerCase()===e.address.toLowerCase()&&t.chainId===e.chainId),n=Number(t?.extensions?.price?.usd??``);return Number.isFinite(n)?n:null}),Ie=d(()=>{let e=_.toToken();return e&&typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd)?e.priceUsd:null}),P=e=>!Number.isFinite(e)||e<=0?`0`:e<.01?`<0.01`:le(e.toFixed(2).replace(/\.?0+$/,``)),{needRecipient:F,recipientDisplay:I,handleRecipientChange:ze}=re({fromToken:_.fromToken,toToken:_.toToken,recipient:_.recipient,isConnected:S,walletAddress:C,walletAdapter:()=>o.walletAdapter,setRecipient:_.setRecipient}),R=d(()=>{let e=De(),t=_.fromToken(),n=_.toToken(),r=_.recipient();return!e||parseFloat(e)<=0||!t||typeof t.decimals!=`number`||!n||!k()||F()&&!r?null:{tradeType:`EXACT_INPUT`,fromChainId:t.chainId,fromToken:t.address,toChainId:n.chainId,toToken:n.address,amount:je(e,t.decimals),fromAddress:C()??Oe(t.chainId),...r&&{recipient:r}}}),z=e(k,R,d(()=>!!R()&&!_.execPhase())),B=d(()=>{let e=_.inputAmount();return!e||parseFloat(e)<=0||!_.fromToken()||!_.toToken()?[]:z.data?.routes??[]}),Ve=d(()=>z.data?.quoteId??null),V=d(()=>{let e=B();return e.length>0?pe(e):null}),H=d(()=>{let e=B(),t=V();return e.find(e=>e.routeId===t)??e[0]??null}),W=d(()=>{let e=H(),t=_.toToken();return!e||!t||typeof t.decimals!=`number`?``:r(ae(e.quote.amountOut,t.decimals))}),J=d(()=>m(_.execPhase(),_.error(),z.isFetching,B().length,!!R())),He=d(()=>_.execPhase()||!R()?!1:!z.isFetching&&z.isSuccess&&B().length===0),Z=d(()=>{let e=J();return e===`quoted`||e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`||e===`success`}),Q=d(()=>{let e=J();return e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`}),lt=d(()=>J()===`success`&&_.order()?`success`:Q()?`tracking`:`form`),$=d(()=>!_.fromToken()||!_.toToken()?!1:J()===`quoting`&&parseFloat(_.inputAmount())>0&&B().length===0),ut=d(()=>{let e=Number(_.inputAmount()),t=Fe();return!Number.isFinite(e)||e<=0||t===null?null:f({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:P(e*t)})}),dt=d(()=>{let e=Number(W()||`0`),t=Ie();return!Z()||!Number.isFinite(e)||e<=0||t===null?null:f({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:P(e*t)})}),{trackingOrderId:ft,trackingProviderName:pt,trackingProviderIcon:mt,executionError:ht,handleConfirm:gt,handleRetry:_t,handleNewSwap:vt}=ge({client:k,walletAdapter:()=>o.walletAdapter,callbacks:()=>o.callbacks,apiEndpoint:()=>o.config.apiEndpoint,fromToken:_.fromToken,recipient:_.recipient,needRecipient:F,walletAddress:C,routes:B,quoteId:Ve,selectedRouteId:V,setExecPhase:_.setExecPhase,setError:_.setError,setErrorCode:_.setErrorCode,storeReset:_.reset,onReset:()=>O(``)});Ae({client:k,walletAddress:C,trackingOrderId:ft,phase:J,execPhase:_.execPhase,setOrder:_.setOrder,setExecPhase:_.setExecPhase,onOrderFilled:e=>{o.callbacks?.onSwapSuccess?.({orderId:e.id,fromToken:_.fromToken().symbol??_.fromToken().address,toToken:_.toToken().symbol??_.toToken().address,fromAmount:e.srcAmount,toAmount:e.destAmount,txHash:e.depositTxHash})},onOrderFailed:e=>{o.callbacks?.onSwapError?.({code:i.ORDER_FAILED,message:`Order `+e.status})}}),_e(n(()=>z.data,e=>{e&&o.callbacks?.onQuoteReceived?.(e)})),_e(n(()=>({isError:z.isError,error:z.error,data:z.data}),({isError:e,error:t,data:n})=>{_.execPhase()||(e&&!n?t instanceof se?(_.setError(t.message),_.setErrorCode(t.code)):(_.setError(String(t)),_.setErrorCode(null)):_.error()&&!e&&_.clearError())}));let{countdownSeconds:yt}=oe({phase:J,onExpired:()=>{z.refetch()}}),bt=Se(k,()=>!0),xt=d(()=>{let e=bt.data;return e?Be(e):new Map});ie(async()=>{let e=k();if(o.config.fromToken)try{let t=xe(o.config.fromToken),n=await Le(t.chainId,t.address,o.config.apiEndpoint,e);if(typeof n.decimals!=`number`)throw new se(i.INVALID_TOKEN_IDENTIFIER,`Failed to resolve fromToken metadata`);_.setFromToken(n)}catch(e){o.callbacks?.onSwapError?.({code:i.INVALID_TOKEN_IDENTIFIER,message:`Failed to resolve fromToken: ${e instanceof Error?e.message:String(e)}`})}if(o.config.toToken)try{let t=xe(o.config.toToken),n=await Le(t.chainId,t.address,o.config.apiEndpoint,e);if(typeof n.decimals!=`number`)throw new se(i.INVALID_TOKEN_IDENTIFIER,`Failed to resolve toToken metadata`);_.setToToken(n)}catch(e){o.callbacks?.onSwapError?.({code:i.INVALID_TOKEN_IDENTIFIER,message:`Failed to resolve toToken: ${e instanceof Error?e.message:String(e)}`})}}),ie(()=>{o.config.recipient&&_.setRecipient(o.config.recipient),o.initialAmount&&(_.setInputAmount(o.initialAmount),O(o.initialAmount))});let St=e=>{_.setInputAmount(e),o.callbacks?.onAmountChanged?.({amount:e,direction:`from`}),_.error()&&_.clearError(),D(e)},Ct=e=>{let t={chainId:e.chainId,address:e.address??``,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,priceUsd:e.priceUsd};y()===`from`?_.setFromToken(t):_.setToToken(t),b(null)},wt=()=>{if(Q()||!_.fromToken()||!_.toToken())return;let e=_.fromToken(),t=_.toToken();s(()=>{_.setFromToken(t),_.setToToken(e),_.execPhase()===`success`&&_.setExecPhase(null)})},Tt=()=>{let e=_.fromToken(),t=M();if(!e||typeof e.decimals!=`number`||!t||t===`0`)return;let n=ae(t,e.decimals);n&&n!==`0`&&St(n)},Et=async()=>{o.walletAdapter?.openAccountModal?await o.walletAdapter.openAccountModal():o.callbacks?.onAccountModal?.()},Dt=e=>`${e.slice(0,6)}...${e.slice(-4)}`,Ot=d(()=>{let e=H();return!e||!_.fromToken()||!_.toToken()?null:J()===`quoting`||Z()?e:null}),kt=d(()=>{let e=o.config.titleText?.trim();return e&&e.length>0?e:`TokenFlight`}),At=d(()=>{let e=o.config.titleText?.trim();return!!e&&e.length>0}),jt=d(()=>{let e=o.config.titleImageUrl?.trim();return e&&e.length>0?e:null});return(()=>{var e=Ge(),n=e.firstChild;return w(e,K(Te,{get current(){return lt()},views:{form:()=>[(()=>{var e=Je(),t=e.firstChild,n=t.firstChild;return w(t,K(Y,{get when(){return jt()},get fallback(){return K(h,{size:22})},get children(){var e=Ke();return l(t=>{var n=jt(),r=kt(),i=G.headerLogoImage;return n!==t.e&&L(e,`src`,t.e=n),r!==t.t&&L(e,`alt`,t.t=r),i!==t.a&&U(e,t.a=i),t},{e:void 0,t:void 0,a:void 0}),e}}),n),w(n,K(Y,{get when(){return At()},get fallback(){return[`Token`,(()=>{var e=ot();return l(()=>U(e,G.headerTitleAccent)),e})()]},get children(){return kt()}})),w(e,K(Y,{get when(){return E(()=>!!S())()&&C()},get children(){var e=qe(),t=e.firstChild,n=t.nextSibling;return N(e,`click`,Et),w(n,()=>Dt(C())),l(r=>{var i=G.headerRight,a=f({id:`xphk5n`,message:`Wallet account`}),o=G.walletDot,s=G.walletAddress;return i!==r.e&&U(e,r.e=i),a!==r.t&&L(e,`aria-label`,r.t=a),o!==r.a&&U(t,r.a=o),s!==r.o&&U(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),null),l(r=>{var i=G.header,a=`${G.headerLeft} ${o.config.hideTitle?G[`headerLeft--hidden`]:``}`,s=o.config.hideTitle?`true`:void 0,c=G.headerTitle;return i!==r.e&&U(e,r.e=i),a!==r.t&&U(t,r.t=a),s!==r.a&&L(t,`aria-hidden`,r.a=s),c!==r.o&&U(n,r.o=c),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e})(),K(Y,{get when(){return o.onBack},get children(){var e=Ye(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling;return N(t,`click`,()=>o.onBack?.()),w(t,()=>f({id:`15lz1at`,message:`Deposit`})),w(r,()=>f({id:`1o1b4a8`,message:`Crypto`})),l(i=>{var a=G.breadcrumb,o=G.breadcrumbLink,s=G.breadcrumbSep,c=G.breadcrumbCurrent;return a!==i.e&&U(e,i.e=a),o!==i.t&&U(t,i.t=o),s!==i.a&&U(n,i.a=s),c!==i.o&&U(r,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),(()=>{var e=Qe(),t=e.firstChild,n=t.firstChild,r=n.firstChild,i=n.nextSibling,s=i.nextSibling,c=s.firstChild;return w(r,()=>f({id:`17kq51m`,message:`You pay`})),w(n,K(Y,{get when(){return E(()=>!!S())()&&j()},get children(){var e=Xe(),t=e.firstChild,n=t.nextSibling;return w(t,()=>f({id:`y6jqu9`,message:`Balance: {fromBalance}`},{fromBalance:j()})),N(n,`click`,Tt),w(n,()=>f({id:`7v6g6x`,message:`MAX`})),l(r=>{var i=G.panelHeaderRight,a=G.panelBalance,o=G.maxBtn;return i!==r.e&&U(e,r.e=i),a!==r.t&&U(t,r.t=a),o!==r.a&&U(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),null),w(i,K(ce,{get value(){return _.inputAmount()},onChange:St,get disabled(){return Q()}}),null),w(i,K(Y,{get when(){return _.fromToken()},get fallback(){return(()=>{var e=st(),t=e.firstChild;return N(e,`click`,()=>o.lockFromToken?void 0:S()?b(`from`):T()),w(t,()=>f({id:`zz4mrw`,message:`Select token`})),w(e,K(Y,{get when(){return!o.lockFromToken},get children(){var e=X();return w(e,K(v,{size:14})),l(()=>U(e,G.caret)),e}}),null),l(n=>{var r=`${G.tokenBtn} ${G[`tokenBtn--select`]}`,i=G.tokenNameAccent;return r!==n.e&&U(e,n.e=r),i!==n.t&&U(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=Ze(),t=e.firstChild,n=t.firstChild,r=t.nextSibling;return N(e,`click`,()=>!o.lockFromToken&&b(`from`)),w(t,K(Ue,{get symbol(){return _.fromToken().symbol??`?`},color:`#2775CA`,size:24,get logoURI(){return _.fromToken().logoURI}}),n),w(n,K(ne,{size:10,get iconUrl(){return a(k().baseUrl,_.fromToken().chainId)}})),w(r,()=>_.fromToken().symbol),w(e,K(Y,{get when(){return!o.lockFromToken},get children(){var e=X();return w(e,K(v,{size:14})),l(()=>U(e,G.caret)),e}}),null),l(i=>{var a=`${G.tokenBtn} ${o.lockFromToken?G[`tokenBtn--locked`]:``}`,s=o.lockFromToken?void 0:`button`,c=G.tokenIconWrap,l=G.tokenChainDot,u=G.tokenName;return a!==i.e&&U(e,i.e=a),s!==i.t&&L(e,`role`,i.t=s),c!==i.a&&U(t,i.a=c),l!==i.o&&U(n,i.o=l),u!==i.i&&U(r,i.i=u),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),w(c,()=>ut()??` `),l(a=>{var o=G.panelWrapper,l=G.panel,u=G.panelHeader,d=G.panelLabel,f=G.panelRow,p=G.panelFooter,m=`${G.fiat} ${ut()?``:G[`fiat--hidden`]}`;return o!==a.e&&U(e,a.e=o),l!==a.t&&U(t,a.t=l),u!==a.a&&U(n,a.a=u),d!==a.o&&U(r,a.o=d),f!==a.i&&U(i,a.i=f),p!==a.n&&U(s,a.n=p),m!==a.s&&U(c,a.s=m),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),e})(),K(Y,{get when(){return!o.hideSwapArrow},get children(){var e=$e(),n=e.firstChild;return N(n,`click`,wt),w(n,K(t,{size:14})),l(t=>{var r=G.swapArrow,i=G.swapArrowInner,a=f({id:`2eikro`,message:`Swap tokens`});return r!==t.e&&U(e,t.e=r),i!==t.t&&U(n,t.t=i),a!==t.a&&L(n,`aria-label`,t.a=a),t},{e:void 0,t:void 0,a:void 0}),e}}),(()=>{var e=nt(),t=e.firstChild,n=t.firstChild,r=n.firstChild,i=n.nextSibling,s=i.nextSibling,c=s.firstChild;return w(r,()=>f({id:`va18uh`,message:`You receive`})),w(n,K(Y,{get when(){return E(()=>!!S())()&&_.toToken()},get children(){var e=et(),t=e.firstChild;return N(e,`click`,()=>!Q()&&!o.lockRecipient&&x(!0)),w(t,(()=>{var e=E(()=>!!I());return()=>e()?Dt(I()):f({id:`fpand1`,message:`Enter destination address`})})()),w(e,K(Y,{get when(){return!o.lockRecipient},get children(){return K(be,{size:10})}}),null),l(n=>{var r=`${q.recipientBadge} ${I()?``:q.recipientBadgeEmpty}${o.lockRecipient?` ${q.recipientBadgeLocked}`:``}`,i=o.lockRecipient,a=q.recipientBadgeText;return r!==n.e&&U(e,n.e=r),i!==n.t&&(e.disabled=n.t=i),a!==n.a&&U(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),e}}),null),w(i,K(Y,{get when(){return!$()},get fallback(){return(()=>{var e=ct();return l(()=>U(e,q.skeleton)),e})()},get children(){var e=tt();return w(e,K(u,{get value(){return E(()=>!!(Z()||J()===`quoting`))()&&W()||`0`},digits:8})),l(()=>U(e,`${fe.amount} ${!Z()&&J()!==`quoting`?fe.muted:``}`)),e}}),null),w(i,K(Y,{get when(){return _.toToken()},get fallback(){return(()=>{var e=st(),t=e.firstChild;return N(e,`click`,()=>o.lockToToken?void 0:S()?b(`to`):T()),w(t,()=>f({id:`zz4mrw`,message:`Select token`})),w(e,K(Y,{get when(){return!o.lockToToken},get children(){var e=X();return w(e,K(v,{size:14})),l(()=>U(e,G.caret)),e}}),null),l(n=>{var r=`${G.tokenBtn} ${G[`tokenBtn--select`]}`,i=G.tokenNameAccent;return r!==n.e&&U(e,n.e=r),i!==n.t&&U(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=Ze(),t=e.firstChild,n=t.firstChild,r=t.nextSibling;return N(e,`click`,()=>!o.lockToToken&&b(`to`)),w(t,K(Ue,{get symbol(){return _.toToken().symbol??`?`},color:`#0052FF`,size:24,get logoURI(){return _.toToken().logoURI}}),n),w(n,K(ne,{size:10,get iconUrl(){return a(k().baseUrl,_.toToken().chainId)}})),w(r,()=>_.toToken().symbol),w(e,K(Y,{get when(){return!o.lockToToken},get children(){var e=X();return w(e,K(v,{size:14})),l(()=>U(e,G.caret)),e}}),null),l(i=>{var a=`${G.tokenBtn} ${o.lockToToken?G[`tokenBtn--locked`]:``}`,s=o.lockToToken?void 0:`button`,c=G.tokenIconWrap,l=G.tokenChainDot,u=G.tokenName;return a!==i.e&&U(e,i.e=a),s!==i.t&&L(e,`role`,i.t=s),c!==i.a&&U(t,i.a=c),l!==i.o&&U(n,i.o=l),u!==i.i&&U(r,i.i=u),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),w(c,()=>dt()??` `),l(a=>{var l=`${G[`panelWrapper--to`]}${o.hideSwapArrow?` ${G[`panelWrapper--noArrow`]}`:``}`,u=G.panel,d=G.panelHeader,f=G.panelLabel,p=G.panelRow,m=G.panelFiatRow,h=`${G.fiat} ${dt()?``:G[`fiat--hidden`]}`;return l!==a.e&&U(e,a.e=l),u!==a.t&&U(t,a.t=u),d!==a.a&&U(n,a.a=d),f!==a.o&&U(r,a.o=f),p!==a.i&&U(i,a.i=p),m!==a.n&&U(s,a.n=m),h!==a.s&&U(c,a.s=h),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),e})(),K(Y,{get when(){return $()},get children(){return K(c,{})}}),K(Y,{get when(){return E(()=>!!(Ot()&&_.fromToken()))()&&_.toToken()},get children(){var e=rt();return w(e,K(he,{get route(){return Ot()},get fromToken(){return _.fromToken()},get toToken(){return _.toToken()},inline:!0,countdownSeconds:yt,countdownTotal:30,showCountdown:()=>J()===`quoted`})),l(()=>U(e,ve.quote)),e}}),K(Y,{get when(){return E(()=>!!He())()&&!$()},get children(){var e=it(),t=e.firstChild,n=t.nextSibling;return w(n,()=>f({id:`ln9xiv`,message:`No routes available`})),l(r=>{var i=q.noOffer,a=q.noOfferIcon,o=q.noOfferText;return i!==r.e&&U(e,r.e=i),a!==r.t&&U(t,r.t=a),o!==r.a&&U(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),(()=>{var e=at();return w(e,K(we,{get phase(){return J()},get isConnected(){return S()},get hasQuote(){return Z()},onConnect:T,onConfirm:gt,onRetry:_t,get errorLabel(){return _.error()??void 0},get needsRecipient(){return E(()=>!!F())()&&!_.recipient()},onEnterRecipient:()=>x(!0),get insufficientBalance(){return Ne()}})),l(()=>U(e,q.ctaWrapper)),e})(),K(Y,{get when(){return!o.config.hidePoweredBy},get children(){return K(me,{})}})],tracking:()=>K(Me,{get order(){return _.order()},get fromToken(){return _.fromToken()},get toToken(){return _.toToken()},get providerName(){return pt()},get providerIcon(){return mt()},get apiEndpoint(){return o.config.apiEndpoint??`https://api.hyperstream.dev`},get inputAmount(){return _.inputAmount()},get outputAmount(){return W()},onNewSwap:vt,onRetry:_t,get executionError(){return ht()},mode:`swap`,get phase(){return J()},get chainMap(){return xt()}}),success:()=>K(ke,{get order(){return _.order()},get fromToken(){return _.fromToken()},get toToken(){return _.toToken()},onNewSwap:vt,get apiEndpoint(){return o.config.apiEndpoint??`https://api.hyperstream.dev`},get providerName(){return pt()},mode:`swap`,get chainMap(){return xt()}})}}),null),w(e,K(Y,{get when(){return y()!==null},get children(){return K(Re,{get client(){return k()},get walletAddress(){return C()},get selectingFor(){return y()},onSelect:Ct,onClose:()=>b(null),get supportedChainIds(){return o.walletAdapter?.supportedChainIds},get noBorder(){return o.config.noBorder}})}}),null),w(e,K(Y,{get when(){return E(()=>!!Ce())()&&_.toToken()},get children(){var e=We();return w(e,K(te,{get initialValue(){return _.recipient()??``},get chainType(){return Pe(_.toToken().chainId)},onConfirm:e=>{ze(e),x(!1)},onClose:()=>x(!1)})),l(()=>U(e,q.selectorOverlay)),e}}),null),l(t=>{var r=`${q.container}${o.config.noBackground?` ${q.noBg}`:``}${o.config.noBorder?` ${q.noBorder}`:``}`,i=q.accentLine;return r!==t.e&&U(e,t.e=r),i!==t.t&&U(n,t.t=i),t},{e:void 0,t:void 0}),e})()}var lt=[o,_,J,x,He,W,y,De,O,Ne,I,T,C,H].join(`
|
|
2
|
-
`),$=V((e,t,n)=>K(Z,{config:e,walletAdapter:t,callbacks:n}),()=>lt),ut=D(`<style>`);function dt(e){e&&Fe(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-swap`)||Ve(`tokenflight-swap`,{"api-endpoint":``,"from-token":``,"to-token":``,recipient:``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n={apiEndpoint:e[`api-endpoint`]||ze()||void 0,fromToken:e[`from-token`]||void 0,toToken:e[`to-token`]||void 0,recipient:e.recipient||void 0,titleText:e[`title-text`]||void 0,titleImageUrl:e[`title-image`]||void 0,theme:e.theme||z()||`light`,locale:e.locale||P()||`en-US`,hideTitle:M(e[`hide-title`]),hidePoweredBy:M(e[`hide-powered-by`]),noBackground:M(e[`no-background`]),noBorder:M(e[`no-border`])},r=e[`csp-nonce`]||void 0,[i,a]=g(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);j(F(e=>{a(e===A)}));let o=t.__customColors,s=d(()=>{let t=e.theme||z()||`light`,n=(t===`auto`?i():t===`dark`)?A:Ce,r=b();return`:host { ${R(r||o?{...n,...r,...o}:n)} }\n${lt}`}),c=t.__walletAdapter,l=t.__callbacks;return[(()=>{var e=ut();return L(e,`nonce`,r),w(e,s),e})(),K(B,{client:Ie,get children(){return K(Z,{config:n,get walletAdapter(){return c??S()},get callbacks(){return l?{...k(),...l}:k()}})}})]}))}export{$ as n,dt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{En as e,On as t,a as n,an as r,c as i,dn as a,gn as o,i as s,in as c,jn as l,l as u,n as d,nn as f,o as p,on as m,pn as h,r as g,rn as _,s as v,sn as y,t as b,tn as x,wn as S}from"./dist-D4PEwqKq.js";import{n as C,t as w}from"./widget-9I201q7O.js";var T=x((e,t,n)=>S(C,{config:e,walletAdapter:t,callbacks:n}),()=>w),E=o(`<style>`);function D(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function O(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function k(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function A(o){o&&d(o),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-widget`)||b(`tokenflight-widget`,{"api-endpoint":``,"fiat-api-endpoint":``,"to-token":``,"from-token":``,"trade-type":``,amount:``,recipient:``,icon:``,"lock-from-token":!1,"lock-to-token":!1,"fiat-currency":``,"fiat-payment-mode":``,methods:``,"default-pay-method":``,"from-tokens":``,"to-tokens":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"no-background":!1,"no-border":!1},(o,{element:d})=>{let b={apiEndpoint:o[`api-endpoint`]||g()||void 0,fiatApiEndpoint:o[`fiat-api-endpoint`]||void 0,toToken:D(o[`to-token`]),fromToken:o[`from-token`]||void 0,tradeType:o[`trade-type`]||void 0,amount:o.amount||void 0,recipient:o.recipient||void 0,icon:o.icon||void 0,lockFromToken:u(o[`lock-from-token`]),lockToToken:u(o[`lock-to-token`]),fiatCurrency:o[`fiat-currency`]||void 0,fiatPaymentMode:o[`fiat-payment-mode`]||void 0,methods:k(o.methods),defaultPayMethod:o[`default-pay-method`]||void 0,fromTokens:O(o[`from-tokens`]),toTokens:O(o[`to-tokens`]),titleText:o[`title-text`]||void 0,titleImageUrl:o[`title-image`]||void 0,theme:o.theme||v()||`light`,locale:o.locale||p()||`en-US`,hideTitle:u(o[`hide-title`]),hidePoweredBy:u(o[`hide-powered-by`]),noBackground:u(o[`no-background`]),noBorder:u(o[`no-border`])},x=o[`csp-nonce`]||void 0,[T,A]=t(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);l(m(e=>{A(e===c)}));let j=d.__customColors,M=e(()=>{let e=o.theme||v()||`light`,t=(e===`auto`?T():e===`dark`)?c:r,i=n();return`:host { ${_(i||j?{...t,...i,...j}:t)} }\n${w}`}),N=d.__walletAdapter,P=d.__callbacks;return[(()=>{var e=E();return h(e,`nonce`,x),a(e,M),e})(),S(y,{client:f,get children(){return S(C,{config:b,get walletAdapter(){return N??i()},get callbacks(){return P?{...s(),...P}:s()}})}})]}))}export{T as n,A as t};
|