@tokenflight/swap 0.0.3 → 0.1.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/README.md +3 -1
- package/dist/custom-elements.d.ts +24 -12
- package/dist/deposit.d.ts +304 -0
- package/dist/deposit.js +1 -0
- package/dist/dist-QzDwShnx.js +2 -0
- package/dist/en-US-Dg7NZU3M.js +1 -0
- package/dist/fiat.d.ts +360 -0
- package/dist/fiat.js +1 -0
- package/dist/ja-JP-FXTra_NF.js +1 -0
- package/dist/ko-KR-D4gcrXFl.js +1 -0
- package/dist/receive.d.ts +333 -0
- package/dist/receive.js +1 -0
- package/dist/register-deposit-TIxgJ8p6.js +1 -0
- package/dist/register-swap-t4Uli1Zx.js +2 -0
- package/dist/register-widget-B49bMwiA.js +1 -0
- package/dist/swap.css +2 -0
- package/dist/swap.d.ts +283 -0
- package/dist/swap.js +1 -0
- package/dist/tokenflight-swap.d.ts +829 -0
- package/dist/tokenflight-swap.js +1 -12689
- package/dist/tokenflight-swap.umd.cjs +225 -8
- package/dist/widget-Bf9MCT78.js +223 -0
- package/dist/widget.d.ts +319 -0
- package/dist/widget.js +1 -0
- package/dist/zh-CN-CuSlgEdI.js +1 -0
- package/dist/zh-TW-DkEqrPgE.js +1 -0
- package/package.json +35 -6
- package/dist/index.d.ts +0 -791
- package/dist/ja-JP-CCPQw3wd.js +0 -113
- package/dist/ko-KR-C28W7gug.js +0 -113
- package/dist/tokenflight-swap.css +0 -1
- package/dist/zh-CN-DVc1QrCz.js +0 -113
- package/dist/zh-TW-t3fL4aXT.js +0 -113
package/README.md
CHANGED
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
* elements in `HTMLElementTagNameMap` for `document.querySelector()` etc.
|
|
24
24
|
*/
|
|
25
25
|
import type {
|
|
26
|
-
TokenFlightSwapAttributes,
|
|
27
26
|
TokenFlightReceiveAttributes,
|
|
27
|
+
TokenFlightDepositAttributes,
|
|
28
|
+
TokenFlightWidgetAttributes,
|
|
28
29
|
} from "./index";
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -85,12 +86,14 @@ interface ReactHTMLAttributes {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/** Widget attributes + standard HTML attributes */
|
|
88
|
-
type SwapElementAttributes = TokenFlightSwapAttributes & BaseHTMLAttributes;
|
|
89
89
|
type ReceiveElementAttributes = TokenFlightReceiveAttributes & BaseHTMLAttributes;
|
|
90
|
+
type DepositElementAttributes = TokenFlightDepositAttributes & BaseHTMLAttributes;
|
|
91
|
+
type WidgetElementAttributes = TokenFlightWidgetAttributes & BaseHTMLAttributes;
|
|
90
92
|
|
|
91
93
|
/** With React/Preact camelCase aliases */
|
|
92
|
-
type SwapReactAttributes = SwapElementAttributes & ReactHTMLAttributes;
|
|
93
94
|
type ReceiveReactAttributes = ReceiveElementAttributes & ReactHTMLAttributes;
|
|
95
|
+
type DepositReactAttributes = DepositElementAttributes & ReactHTMLAttributes;
|
|
96
|
+
type WidgetReactAttributes = WidgetElementAttributes & ReactHTMLAttributes;
|
|
94
97
|
|
|
95
98
|
// ---------------------------------------------------------------------------
|
|
96
99
|
// Native DOM (document.createElement, querySelector, etc.)
|
|
@@ -98,15 +101,17 @@ type ReceiveReactAttributes = ReceiveElementAttributes & ReactHTMLAttributes;
|
|
|
98
101
|
// ---------------------------------------------------------------------------
|
|
99
102
|
declare global {
|
|
100
103
|
interface HTMLElementTagNameMap {
|
|
101
|
-
"tokenflight-swap": HTMLElement;
|
|
102
104
|
"tokenflight-receive": HTMLElement;
|
|
105
|
+
"tokenflight-deposit": HTMLElement;
|
|
106
|
+
"tokenflight-widget": HTMLElement;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
106
110
|
namespace svelteHTML {
|
|
107
111
|
interface IntrinsicElements {
|
|
108
|
-
"tokenflight-swap": SwapElementAttributes;
|
|
109
112
|
"tokenflight-receive": ReceiveElementAttributes;
|
|
113
|
+
"tokenflight-deposit": DepositElementAttributes;
|
|
114
|
+
"tokenflight-widget": WidgetElementAttributes;
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
}
|
|
@@ -118,8 +123,9 @@ declare module "react/jsx-runtime" {
|
|
|
118
123
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
119
124
|
namespace JSX {
|
|
120
125
|
interface IntrinsicElements {
|
|
121
|
-
"tokenflight-swap": SwapReactAttributes;
|
|
122
126
|
"tokenflight-receive": ReceiveReactAttributes;
|
|
127
|
+
"tokenflight-deposit": DepositReactAttributes;
|
|
128
|
+
"tokenflight-widget": WidgetReactAttributes;
|
|
123
129
|
}
|
|
124
130
|
}
|
|
125
131
|
}
|
|
@@ -131,8 +137,9 @@ declare module "react" {
|
|
|
131
137
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
132
138
|
namespace JSX {
|
|
133
139
|
interface IntrinsicElements {
|
|
134
|
-
"tokenflight-swap": SwapReactAttributes;
|
|
135
140
|
"tokenflight-receive": ReceiveReactAttributes;
|
|
141
|
+
"tokenflight-deposit": DepositReactAttributes;
|
|
142
|
+
"tokenflight-widget": WidgetReactAttributes;
|
|
136
143
|
}
|
|
137
144
|
}
|
|
138
145
|
}
|
|
@@ -144,8 +151,9 @@ declare module "preact" {
|
|
|
144
151
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
145
152
|
namespace JSX {
|
|
146
153
|
interface IntrinsicElements {
|
|
147
|
-
"tokenflight-swap": SwapReactAttributes;
|
|
148
154
|
"tokenflight-receive": ReceiveReactAttributes;
|
|
155
|
+
"tokenflight-deposit": DepositReactAttributes;
|
|
156
|
+
"tokenflight-widget": WidgetReactAttributes;
|
|
149
157
|
}
|
|
150
158
|
}
|
|
151
159
|
}
|
|
@@ -155,8 +163,9 @@ declare module "preact" {
|
|
|
155
163
|
// ---------------------------------------------------------------------------
|
|
156
164
|
declare module "vue" {
|
|
157
165
|
interface GlobalComponents {
|
|
158
|
-
"tokenflight-swap": SwapElementAttributes;
|
|
159
166
|
"tokenflight-receive": ReceiveElementAttributes;
|
|
167
|
+
"tokenflight-deposit": DepositElementAttributes;
|
|
168
|
+
"tokenflight-widget": WidgetElementAttributes;
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
171
|
|
|
@@ -167,8 +176,9 @@ declare module "solid-js" {
|
|
|
167
176
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
168
177
|
namespace JSX {
|
|
169
178
|
interface IntrinsicElements {
|
|
170
|
-
"tokenflight-swap": SwapElementAttributes;
|
|
171
179
|
"tokenflight-receive": ReceiveElementAttributes;
|
|
180
|
+
"tokenflight-deposit": DepositElementAttributes;
|
|
181
|
+
"tokenflight-widget": WidgetElementAttributes;
|
|
172
182
|
}
|
|
173
183
|
}
|
|
174
184
|
}
|
|
@@ -178,8 +188,9 @@ declare module "solid-js" {
|
|
|
178
188
|
// ---------------------------------------------------------------------------
|
|
179
189
|
declare module "svelte/elements" {
|
|
180
190
|
interface SvelteHTMLElements {
|
|
181
|
-
"tokenflight-swap": SwapElementAttributes;
|
|
182
191
|
"tokenflight-receive": ReceiveElementAttributes;
|
|
192
|
+
"tokenflight-deposit": DepositElementAttributes;
|
|
193
|
+
"tokenflight-widget": WidgetElementAttributes;
|
|
183
194
|
}
|
|
184
195
|
}
|
|
185
196
|
|
|
@@ -188,7 +199,8 @@ declare module "svelte/elements" {
|
|
|
188
199
|
// ---------------------------------------------------------------------------
|
|
189
200
|
declare namespace astroHTML.JSX {
|
|
190
201
|
interface IntrinsicElements {
|
|
191
|
-
"tokenflight-swap": SwapElementAttributes;
|
|
192
202
|
"tokenflight-receive": ReceiveElementAttributes;
|
|
203
|
+
"tokenflight-deposit": DepositElementAttributes;
|
|
204
|
+
"tokenflight-widget": WidgetElementAttributes;
|
|
193
205
|
}
|
|
194
206
|
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { QuoteResponse } from '@tokenflight/api';
|
|
2
|
+
|
|
3
|
+
/** Amount change data */
|
|
4
|
+
declare interface AmountChangedData {
|
|
5
|
+
amount: string;
|
|
6
|
+
direction: "from" | "to";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Boolean HTML attribute — accepts both native booleans and the
|
|
11
|
+
* string equivalents that `parseBooleanProp()` understands.
|
|
12
|
+
*/
|
|
13
|
+
declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" | "no" | "";
|
|
14
|
+
|
|
15
|
+
/** Callback interfaces for widget events */
|
|
16
|
+
export declare interface Callbacks {
|
|
17
|
+
onSwapSuccess?(data: SwapSuccessData): void;
|
|
18
|
+
onSwapError?(data: SwapErrorData): void;
|
|
19
|
+
onWalletConnected?(data: WalletConnectedData): void;
|
|
20
|
+
onQuoteReceived?(data: QuoteResponse): void;
|
|
21
|
+
onAmountChanged?(data: AmountChangedData): void;
|
|
22
|
+
/** Called when user clicks Connect Wallet and no walletAdapter is provided */
|
|
23
|
+
onConnectWallet?(): void;
|
|
24
|
+
/** Called when user clicks the connected wallet address (for custom account modal handling) */
|
|
25
|
+
onAccountModal?(): void;
|
|
26
|
+
/** Called when a fiat order is created and the payment widget URL is available */
|
|
27
|
+
onFiatOrderCreated?(data: {
|
|
28
|
+
orderId: string;
|
|
29
|
+
widgetUrl: string;
|
|
30
|
+
}): void;
|
|
31
|
+
/** Called when a fiat order reaches a terminal status */
|
|
32
|
+
onFiatOrderCompleted?(data: {
|
|
33
|
+
orderId: string;
|
|
34
|
+
status: string;
|
|
35
|
+
txHash?: string;
|
|
36
|
+
}): void;
|
|
37
|
+
/** Called when a deposit completes successfully */
|
|
38
|
+
onDepositSuccess?(data: SwapSuccessData): void;
|
|
39
|
+
/** Called when a deposit fails */
|
|
40
|
+
onDepositError?(data: SwapErrorData): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Chain type for multi-chain support */
|
|
44
|
+
declare type ChainType = "evm" | "solana";
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Custom color overrides — keys are CSS variable names.
|
|
48
|
+
* Typed keys provide autocomplete; arbitrary `--tf-*` strings are also accepted.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* customColors: {
|
|
52
|
+
* "--tf-primary": "#FF6B00",
|
|
53
|
+
* "--tf-bg": "#1A1A2E",
|
|
54
|
+
* "--tf-button-radius": "4px",
|
|
55
|
+
* "--tf-widget-max-width": "480px",
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare type CustomColors = Partial<Record<TfCssVar, string>> & Record<string, string>;
|
|
60
|
+
|
|
61
|
+
/** Payment methods available in `<tokenflight-deposit>` */
|
|
62
|
+
export declare type DepositMethod = "wallet" | "card";
|
|
63
|
+
|
|
64
|
+
/** EVM wallet action via EIP-1193 */
|
|
65
|
+
declare interface EvmWalletAction {
|
|
66
|
+
type: "eip1193_request";
|
|
67
|
+
chainId: number;
|
|
68
|
+
method: string;
|
|
69
|
+
params: unknown[];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** How the fiat payment provider UI is opened. */
|
|
73
|
+
export declare type FiatPaymentMode = "overlay" | "popup";
|
|
74
|
+
|
|
75
|
+
declare interface ImperativeWidgetOptions<TConfig> {
|
|
76
|
+
container: string | HTMLElement;
|
|
77
|
+
config: TConfig;
|
|
78
|
+
walletAdapter?: IWalletAdapter;
|
|
79
|
+
callbacks?: Callbacks;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Wallet adapter interface that all adapters must implement */
|
|
83
|
+
export declare interface IWalletAdapter {
|
|
84
|
+
/** Human-readable name */
|
|
85
|
+
readonly name: string;
|
|
86
|
+
/** Icon URL */
|
|
87
|
+
readonly icon?: string;
|
|
88
|
+
/** Supported action types */
|
|
89
|
+
readonly supportedActionTypes: WalletActionType[];
|
|
90
|
+
/** Optional: supported chain IDs — when set, the widget only shows tokens on these chains */
|
|
91
|
+
readonly supportedChainIds?: number[];
|
|
92
|
+
/** Connect the wallet */
|
|
93
|
+
connect(chainType?: ChainType): Promise<void>;
|
|
94
|
+
/** Disconnect the wallet */
|
|
95
|
+
disconnect(): Promise<void>;
|
|
96
|
+
/** Check if connected */
|
|
97
|
+
isConnected(chainType?: ChainType): boolean;
|
|
98
|
+
/** Get the current address */
|
|
99
|
+
getAddress(chainType?: ChainType): Promise<string | null>;
|
|
100
|
+
/** Execute a wallet action */
|
|
101
|
+
executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
|
|
102
|
+
/** Optional: sign a message */
|
|
103
|
+
signMessage?(message: string, chainType?: ChainType): Promise<string>;
|
|
104
|
+
/** Optional: open the wallet's native account/connected modal */
|
|
105
|
+
openAccountModal?(): Promise<void>;
|
|
106
|
+
/** Optional: clean up internal subscriptions and watchers */
|
|
107
|
+
destroy?(): void;
|
|
108
|
+
/** Subscribe to wallet events */
|
|
109
|
+
on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
|
|
110
|
+
/** Unsubscribe from wallet events */
|
|
111
|
+
off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export declare function registerDepositElement(options?: RegisterElementsOptions): void;
|
|
115
|
+
|
|
116
|
+
export declare interface RegisterElementsOptions {
|
|
117
|
+
walletAdapter?: IWalletAdapter;
|
|
118
|
+
callbacks?: Callbacks;
|
|
119
|
+
/** Custom CSS variable overrides merged on top of the active theme.
|
|
120
|
+
* Keys are CSS variable names, e.g. `"--tf-primary"`, `"--tf-font-family"`. */
|
|
121
|
+
customColors?: CustomColors;
|
|
122
|
+
/** Default API endpoint for all widget instances. */
|
|
123
|
+
apiEndpoint?: string;
|
|
124
|
+
/** Default theme for all widget instances. */
|
|
125
|
+
theme?: Theme;
|
|
126
|
+
/** Default locale for all widget instances. */
|
|
127
|
+
locale?: SupportedLocale;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Solana sign and send transaction action */
|
|
131
|
+
declare interface SolanaSignAndSendAction {
|
|
132
|
+
type: "solana_signAndSendTransaction";
|
|
133
|
+
transaction: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Solana sign transaction action */
|
|
137
|
+
declare interface SolanaSignTransactionAction {
|
|
138
|
+
type: "solana_signTransaction";
|
|
139
|
+
transaction: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
|
|
143
|
+
export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
|
|
144
|
+
|
|
145
|
+
/** Data emitted on swap error */
|
|
146
|
+
declare interface SwapErrorData {
|
|
147
|
+
code: string;
|
|
148
|
+
message: string;
|
|
149
|
+
details?: unknown;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Data emitted on swap success */
|
|
153
|
+
declare interface SwapSuccessData {
|
|
154
|
+
orderId: string;
|
|
155
|
+
fromToken: string;
|
|
156
|
+
toToken: string;
|
|
157
|
+
fromAmount: string;
|
|
158
|
+
toAmount: string;
|
|
159
|
+
txHash: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** All first-party CSS custom properties exposed for theming. */
|
|
163
|
+
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";
|
|
164
|
+
|
|
165
|
+
/** Visual theme mode. */
|
|
166
|
+
export declare type Theme = "light" | "dark" | "auto";
|
|
167
|
+
|
|
168
|
+
/** Shared configuration fields for both widgets */
|
|
169
|
+
declare interface TokenFlightConfigBase {
|
|
170
|
+
/** HyperStream API endpoint */
|
|
171
|
+
apiEndpoint?: string;
|
|
172
|
+
/** Fiat on-ramp API endpoint (default: https://fiat-preview.hyperstream.dev) */
|
|
173
|
+
fiatApiEndpoint?: string;
|
|
174
|
+
/** Visual theme */
|
|
175
|
+
theme?: Theme;
|
|
176
|
+
/** Locale for i18n */
|
|
177
|
+
locale?: SupportedLocale;
|
|
178
|
+
/** Custom CSS color overrides */
|
|
179
|
+
customColors?: CustomColors;
|
|
180
|
+
/** Optional custom widget title text */
|
|
181
|
+
titleText?: string;
|
|
182
|
+
/** Optional custom widget title image URL */
|
|
183
|
+
titleImageUrl?: string;
|
|
184
|
+
/** Hide top title/header area */
|
|
185
|
+
hideTitle?: boolean;
|
|
186
|
+
/** Hide "Powered by TokenFlight" footer */
|
|
187
|
+
hidePoweredBy?: boolean;
|
|
188
|
+
/** Remove container background (transparent) */
|
|
189
|
+
noBackground?: boolean;
|
|
190
|
+
/** Remove container border and shadow */
|
|
191
|
+
noBorder?: boolean;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export declare const TokenFlightDeposit: {
|
|
195
|
+
new (options: ImperativeWidgetOptions<TokenFlightDepositConfig>): {
|
|
196
|
+
#dispose: (() => void) | null;
|
|
197
|
+
#unwatchTheme: (() => void) | null;
|
|
198
|
+
#container: HTMLElement;
|
|
199
|
+
#shadowRoot: ShadowRoot | null;
|
|
200
|
+
#config: TokenFlightDepositConfig;
|
|
201
|
+
#walletAdapter?: IWalletAdapter;
|
|
202
|
+
#callbacks?: Callbacks;
|
|
203
|
+
initialize(): void;
|
|
204
|
+
destroy(): void;
|
|
205
|
+
setTheme(theme: Theme): void;
|
|
206
|
+
setCustomColors(colors: CustomColors): void;
|
|
207
|
+
#applyThemeStyles(style: HTMLStyleElement, theme: string): void;
|
|
208
|
+
#setupAutoThemeWatch(style: HTMLStyleElement): void;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/** Attributes accepted by `<tokenflight-deposit>`. */
|
|
213
|
+
export declare interface TokenFlightDepositAttributes {
|
|
214
|
+
"api-endpoint"?: string;
|
|
215
|
+
target?: string;
|
|
216
|
+
amount?: string;
|
|
217
|
+
"from-token"?: string;
|
|
218
|
+
recipient?: string;
|
|
219
|
+
methods?: string;
|
|
220
|
+
"target-icon"?: string;
|
|
221
|
+
"fiat-currency"?: string;
|
|
222
|
+
"fiat-payment-mode"?: string;
|
|
223
|
+
"title-text"?: string;
|
|
224
|
+
"title-image"?: string;
|
|
225
|
+
theme?: Theme;
|
|
226
|
+
locale?: SupportedLocale;
|
|
227
|
+
"csp-nonce"?: string;
|
|
228
|
+
"hide-title"?: BooleanAttribute;
|
|
229
|
+
"hide-powered-by"?: BooleanAttribute;
|
|
230
|
+
"no-background"?: BooleanAttribute;
|
|
231
|
+
"no-border"?: BooleanAttribute;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Configuration for `<tokenflight-deposit>` */
|
|
235
|
+
export declare interface TokenFlightDepositConfig extends TokenFlightConfigBase {
|
|
236
|
+
/** Target token(s) to deposit into. When omitted, user selects via TokenSelector. */
|
|
237
|
+
target?: TokenIdentifier | TokenIdentifier[];
|
|
238
|
+
/** Optional: fixed amount for the target token */
|
|
239
|
+
amount?: string;
|
|
240
|
+
/** Optional: recipient address */
|
|
241
|
+
recipient?: string;
|
|
242
|
+
/** Payment methods to offer (default: ["wallet"]) */
|
|
243
|
+
methods?: DepositMethod[];
|
|
244
|
+
/** Optional source token to pay with */
|
|
245
|
+
fromToken?: TokenIdentifier;
|
|
246
|
+
/** Optional icon URL for the target token */
|
|
247
|
+
targetIcon?: string;
|
|
248
|
+
/** Fiat currency code for card payments (default: "USD") */
|
|
249
|
+
fiatCurrency?: string;
|
|
250
|
+
/** How to open the fiat payment provider (default: "overlay") */
|
|
251
|
+
fiatPaymentMode?: FiatPaymentMode;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export declare interface TokenFlightDepositOptions {
|
|
255
|
+
container: string | HTMLElement;
|
|
256
|
+
config: TokenFlightDepositConfig;
|
|
257
|
+
walletAdapter?: IWalletAdapter;
|
|
258
|
+
callbacks?: Callbacks;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Flexible token identifier supporting:
|
|
263
|
+
* - Direct object: { chainId: 1, address: "0x..." }
|
|
264
|
+
* - CAIP-10 string: "eip155:1:0x..."
|
|
265
|
+
* - JSON string: '{"chainId":1,"address":"0x..."}'
|
|
266
|
+
*/
|
|
267
|
+
declare type TokenIdentifier = string | TokenTarget;
|
|
268
|
+
|
|
269
|
+
/** Token target as chain + address pair */
|
|
270
|
+
declare interface TokenTarget {
|
|
271
|
+
chainId: number;
|
|
272
|
+
address: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** Union of all wallet action types */
|
|
276
|
+
declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
|
|
277
|
+
|
|
278
|
+
/** Result of executing a wallet action */
|
|
279
|
+
declare interface WalletActionResult {
|
|
280
|
+
success: boolean;
|
|
281
|
+
data?: unknown;
|
|
282
|
+
error?: string;
|
|
283
|
+
txHash?: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Wallet action types */
|
|
287
|
+
declare type WalletActionType = "eip1193_request" | "solana_signTransaction" | "solana_signAndSendTransaction";
|
|
288
|
+
|
|
289
|
+
/** Data emitted when wallet is connected */
|
|
290
|
+
declare interface WalletConnectedData {
|
|
291
|
+
address: string;
|
|
292
|
+
chainType: string;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** Wallet event payload */
|
|
296
|
+
declare interface WalletEvent {
|
|
297
|
+
type: WalletEventType;
|
|
298
|
+
data?: unknown;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Wallet event types */
|
|
302
|
+
declare type WalletEventType = "connect" | "disconnect" | "chainChanged" | "accountsChanged";
|
|
303
|
+
|
|
304
|
+
export { }
|
package/dist/deposit.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./dist-QzDwShnx.js";import"./widget-Bf9MCT78.js";import{n as e,t}from"./register-deposit-TIxgJ8p6.js";export{e as TokenFlightDeposit,t as registerDepositElement};
|