@tokenflight/swap 0.0.4 → 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/dist/index.d.ts DELETED
@@ -1,688 +0,0 @@
1
- /**
2
- * Add thousands separators (commas) to the integer part of a numeric string.
3
- * e.g., "3200" → "3,200", "1234567.89" → "1,234,567.89", "0.5" → "0.5"
4
- */
5
- export declare function addThousandsSeparator(value: string): string;
6
-
7
- /** Amount change data */
8
- export declare interface AmountChangedData {
9
- amount: string;
10
- direction: "from" | "to";
11
- }
12
-
13
- /**
14
- * Boolean HTML attribute — accepts both native booleans and the
15
- * string equivalents that `parseBooleanProp()` understands.
16
- */
17
- declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" | "no" | "";
18
-
19
- /**
20
- * Build offers for ranking from API routes (EXACT_OUTPUT mode).
21
- * Routes with unparseable amountIn are excluded from ranking.
22
- */
23
- export declare function buildOffersForRanking(routes: readonly QuoteRoute[], tradeType: TradeType | null): OfferForRanking[];
24
-
25
- /** Callback interfaces for widget events */
26
- export declare interface Callbacks {
27
- onSwapSuccess?(data: SwapSuccessData): void;
28
- onSwapError?(data: SwapErrorData): void;
29
- onWalletConnected?(data: WalletConnectedData): void;
30
- onQuoteReceived?(data: QuoteResponse): void;
31
- onAmountChanged?(data: AmountChangedData): void;
32
- /** Called when user clicks Connect Wallet and no walletAdapter is provided */
33
- onConnectWallet?(): void;
34
- /** Called when user clicks the connected wallet address (for custom account modal handling) */
35
- onAccountModal?(): void;
36
- }
37
-
38
- export declare type ChainInfo = HyperstreamApi.Chain;
39
-
40
- /** Chain type for multi-chain support */
41
- export declare type ChainType = "evm" | "solana";
42
-
43
- /** Clear all TokenFlight token cache entries */
44
- export declare function clearTokenCache(): void;
45
-
46
- /**
47
- * Compute exchange rate as a display string.
48
- * Returns how many toToken units you get per 1 fromToken.
49
- */
50
- export declare function computeExchangeRate(amountIn: string, decimalsIn: number, amountOut: string, decimalsOut: number): string;
51
-
52
- export declare type ContractCallDeposit = HyperstreamApi.ContractCallDeposit;
53
-
54
- /**
55
- * Custom color overrides — keys are CSS variable names.
56
- *
57
- * ```ts
58
- * customColors: {
59
- * "--tf-primary": "#FF6B00",
60
- * "--tf-bg": "#1A1A2E",
61
- * "--tf-text": "#FFFFFF",
62
- * }
63
- * ```
64
- */
65
- export declare type CustomColors = Record<string, string>;
66
-
67
- export declare const DEFAULT_API_ENDPOINT = "https://api.hyperstream.dev";
68
-
69
- export declare type DepositApproval = HyperstreamApi.Approval;
70
-
71
- export declare type DepositBuildResponse = HyperstreamApi.Deposit;
72
-
73
- export declare type EIP1193RequestApproval = HyperstreamApi.EIP1193RequestApproval;
74
-
75
- /** Error codes for TokenFlight SDK */
76
- export declare const ErrorCode: {
77
- readonly INVALID_CONFIG: "TF1001";
78
- readonly INVALID_TOKEN_IDENTIFIER: "TF1002";
79
- readonly INVALID_AMOUNT: "TF1003";
80
- readonly MISSING_REQUIRED_CONFIG: "TF1004";
81
- readonly WALLET_NOT_CONNECTED: "TF2001";
82
- readonly WALLET_CONNECTION_FAILED: "TF2002";
83
- readonly WALLET_ACTION_FAILED: "TF2003";
84
- readonly WALLET_ACTION_REJECTED: "TF2004";
85
- readonly UNSUPPORTED_ACTION_TYPE: "TF2005";
86
- readonly API_REQUEST_FAILED: "TF3001";
87
- readonly API_TIMEOUT: "TF3002";
88
- readonly API_INVALID_RESPONSE: "TF3003";
89
- readonly QUOTE_FAILED: "TF3004";
90
- readonly QUOTE_EXPIRED: "TF3005";
91
- readonly DEPOSIT_BUILD_FAILED: "TF3006";
92
- readonly DEPOSIT_SUBMIT_FAILED: "TF3007";
93
- readonly ORDER_FAILED: "TF3008";
94
- readonly TRANSACTION_FAILED: "TF4001";
95
- readonly TRANSACTION_REJECTED: "TF4002";
96
- readonly INSUFFICIENT_BALANCE: "TF4003";
97
- readonly ELEMENT_NOT_FOUND: "TF5001";
98
- readonly INITIALIZATION_FAILED: "TF5002";
99
- };
100
-
101
- export declare type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
102
-
103
- /** EVM wallet action via EIP-1193 */
104
- export declare interface EvmWalletAction {
105
- type: "eip1193_request";
106
- chainId: number;
107
- method: string;
108
- params: unknown[];
109
- }
110
-
111
- export declare type ExactOutMethod = HyperstreamApi.ExactOutMethod;
112
-
113
- /** Execution-only phases for the async build→wallet→submit→track→success flow */
114
- export declare type ExecPhase = "building" | "awaiting-wallet" | "submitting" | "tracking" | "success";
115
-
116
- /**
117
- * Format a display amount to a fixed number of significant decimals.
118
- * Avoids showing excessive precision in the UI.
119
- *
120
- * When the integer part is "0", ensures at least `maxDecimals` significant
121
- * digits are shown (e.g., "0.00472" → "0.0047" with maxDecimals=2).
122
- */
123
- export declare function formatDisplayAmount(amount: string, maxDecimals?: number): string;
124
-
125
- /** Get the best overall route ID for exact output. */
126
- export declare function getBestOverallRouteId(routes: readonly QuoteRoute[], tradeType: TradeType | null): string | null;
127
-
128
- /** Get chain type from chainId */
129
- export declare function getChainType(chainId: number): "evm" | "solana";
130
-
131
- declare class HyperstreamApi {
132
- readonly baseUrl: string;
133
- private readonly ky;
134
- constructor(options: {
135
- baseUrl: string;
136
- });
137
- private request;
138
- getQuotes(request: HyperstreamApi.QuoteRequest, signal?: AbortSignal): Promise<HyperstreamApi.GetQuotesResponse>;
139
- buildDeposit(params: {
140
- from: string;
141
- quoteId: string;
142
- routeId: string;
143
- }, signal?: AbortSignal): Promise<HyperstreamApi.Deposit>;
144
- submitDeposit(params: {
145
- quoteId: string;
146
- routeId: string;
147
- } & ({
148
- txHash: string;
149
- } | {
150
- signedTransaction: string;
151
- }), signal?: AbortSignal): Promise<HyperstreamApi.SubmitDepositResponse>;
152
- getOrdersByAddress(address: string, options?: {
153
- orderIds?: string[];
154
- limit?: number;
155
- cursor?: number;
156
- }): Promise<HyperstreamApi.GetOrderResponse>;
157
- getOrderById(address: string, orderId: string): Promise<HyperstreamApi.Order | null>;
158
- getTokens(params?: {
159
- q?: string;
160
- chainIds?: number[];
161
- limit?: number;
162
- cursor?: number;
163
- }): Promise<HyperstreamApi.GetTokensResponse>;
164
- searchTokens(query: string, options?: {
165
- chainIds?: number[];
166
- }): Promise<HyperstreamApi.TokenSearchResponse>;
167
- getTopTokens(params?: {
168
- chainIds?: number[];
169
- }): Promise<HyperstreamApi.Token[]>;
170
- getTokenBalances(address: string, options?: {
171
- chainIds?: number[];
172
- }): Promise<HyperstreamApi.Token[]>;
173
- getChains(): Promise<HyperstreamApi.Chain[]>;
174
- }
175
-
176
- declare namespace HyperstreamApi {
177
- interface TokenExtensions {
178
- balance?: string;
179
- isRiskToken?: boolean;
180
- price?: {
181
- usd: string;
182
- };
183
- change?: string;
184
- volume?: string;
185
- marketCap?: string;
186
- liquidity?: string;
187
- spokeToken?: Token;
188
- }
189
- interface Token {
190
- address: string;
191
- chainId: number;
192
- name: string;
193
- symbol: string;
194
- decimals: number;
195
- logoURI?: string;
196
- platform?: string;
197
- id?: string;
198
- extensions?: TokenExtensions;
199
- }
200
- interface TokenSearchResponse {
201
- data: Token[];
202
- }
203
- interface GetTokensResponse {
204
- data: Token[];
205
- cursor?: number;
206
- }
207
- interface BlockExplorer {
208
- name: string;
209
- url: string;
210
- }
211
- interface Chain {
212
- id: number;
213
- name: string;
214
- type?: string;
215
- blockExplorers?: {
216
- [key: string]: BlockExplorer;
217
- default: BlockExplorer;
218
- };
219
- [key: string]: unknown;
220
- }
221
- type TradeType = "EXACT_INPUT" | "EXACT_OUTPUT";
222
- type ExactOutMethod = "native" | "adaptive";
223
- type RouteTag = "1-click" | "needs-approval";
224
- interface QuoteRequest {
225
- tradeType: TradeType;
226
- fromChainId: number;
227
- fromToken: string;
228
- toChainId: number;
229
- toToken: string;
230
- amount: string;
231
- fromAddress: string;
232
- recipient?: string;
233
- slippageTolerance?: number;
234
- }
235
- interface Quote {
236
- amountIn: string;
237
- amountOut: string;
238
- minAmountOut?: string;
239
- slippageTolerance?: number;
240
- expectedDurationSeconds: number;
241
- validBefore: number;
242
- estimatedGas?: string;
243
- tags?: RouteTag[];
244
- }
245
- interface Route {
246
- routeId: string;
247
- type: string;
248
- icon?: string;
249
- exactOutMethod?: ExactOutMethod;
250
- tags?: RouteTag[];
251
- quote: Quote;
252
- }
253
- interface GetQuotesResponse {
254
- quoteId: string;
255
- routes: Route[];
256
- }
257
- interface EIP1193RequestApproval {
258
- type: "eip1193_request";
259
- request: {
260
- method: string;
261
- params: unknown[];
262
- };
263
- waitForReceipt?: boolean;
264
- deposit?: boolean;
265
- }
266
- interface SolanaApproval {
267
- type: "solana_sendTransaction";
268
- transaction: string;
269
- deposit?: boolean;
270
- }
271
- type Approval = EIP1193RequestApproval | SolanaApproval;
272
- interface ContractCallDeposit {
273
- kind: "CONTRACT_CALL";
274
- approvals?: Approval[];
275
- }
276
- type Deposit = ContractCallDeposit;
277
- interface SubmitDepositResponse {
278
- orderId: string;
279
- txHash: string;
280
- }
281
- type OrderStatus = "created" | "deposited" | "published" | "filled" | "refund_pending" | "refunded" | "failed";
282
- interface OnChainTx {
283
- timestamp: string;
284
- txHash: string;
285
- chainId: number;
286
- amount?: string;
287
- }
288
- interface OrderTransactions {
289
- deposit?: OnChainTx;
290
- fill?: OnChainTx;
291
- refund?: OnChainTx;
292
- }
293
- interface OrderTimestamps {
294
- createdAt: string;
295
- publishedAt?: string;
296
- failedAt?: string;
297
- }
298
- interface TokenMeta {
299
- symbol: string;
300
- decimals: number;
301
- logoURI: string | null;
302
- }
303
- interface Order {
304
- id: string;
305
- type: string;
306
- quoteId: string;
307
- routeId: string;
308
- fromChainId: number;
309
- fromToken: string;
310
- toChainId: number;
311
- toToken: string;
312
- srcAmount: string;
313
- destAmount: string;
314
- status: OrderStatus;
315
- author: string;
316
- recipient: string | null;
317
- depositTxHash: string;
318
- tradeType: string;
319
- createdAt: string;
320
- updatedAt: string;
321
- transactions?: OrderTransactions;
322
- timestamps?: OrderTimestamps;
323
- stepsCompleted?: OrderStatus[];
324
- fromTokenMeta?: TokenMeta | null;
325
- toTokenMeta?: TokenMeta | null;
326
- }
327
- interface GetOrderResponse {
328
- data: Order[];
329
- cursor?: number;
330
- }
331
- }
332
-
333
- /** Check if two chains are of different types (cross-chain swap) */
334
- export declare function isCrossChainSwap(fromChainId: number, toChainId: number): boolean;
335
-
336
- /** Check if a chainId is EVM */
337
- export declare function isEvmChain(chainId: number): boolean;
338
-
339
- /** Check if a chainId is Solana */
340
- export declare function isSolanaChain(chainId: number): boolean;
341
-
342
- /** Wallet adapter interface that all adapters must implement */
343
- export declare interface IWalletAdapter {
344
- /** Human-readable name */
345
- readonly name: string;
346
- /** Icon URL */
347
- readonly icon?: string;
348
- /** Supported action types */
349
- readonly supportedActionTypes: WalletActionType[];
350
- /** Optional: supported chain IDs — when set, the widget only shows tokens on these chains */
351
- readonly supportedChainIds?: number[];
352
- /** Connect the wallet */
353
- connect(chainType?: ChainType): Promise<void>;
354
- /** Disconnect the wallet */
355
- disconnect(): Promise<void>;
356
- /** Check if connected */
357
- isConnected(chainType?: ChainType): boolean;
358
- /** Get the current address */
359
- getAddress(chainType?: ChainType): Promise<string | null>;
360
- /** Execute a wallet action */
361
- executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
362
- /** Optional: sign a message */
363
- signMessage?(message: string, chainType?: ChainType): Promise<string>;
364
- /** Optional: open the wallet's native account/connected modal */
365
- openAccountModal?(): Promise<void>;
366
- /** Optional: clean up internal subscriptions and watchers */
367
- destroy?(): void;
368
- /** Subscribe to wallet events */
369
- on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
370
- /** Unsubscribe from wallet events */
371
- off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
372
- }
373
-
374
- export declare class MockWalletAdapter implements IWalletAdapter {
375
- readonly name = "Mock Wallet";
376
- readonly icon: undefined;
377
- readonly supportedActionTypes: WalletActionType[];
378
- private connected;
379
- private address;
380
- private listeners;
381
- connect(_chainType?: ChainType): Promise<void>;
382
- disconnect(): Promise<void>;
383
- isConnected(_chainType?: ChainType): boolean;
384
- getAddress(_chainType?: ChainType): Promise<string | null>;
385
- executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
386
- signMessage(message: string): Promise<string>;
387
- openAccountModal(): Promise<void>;
388
- on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
389
- off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
390
- private emit;
391
- }
392
-
393
- /**
394
- * Minimal offer data needed for ranking offers.
395
- * For offers (EXACT_OUTPUT): lower amountIn is better.
396
- */
397
- declare interface OfferForRanking {
398
- routeId: string;
399
- amountIn: bigint;
400
- etaSeconds: number;
401
- isGuaranteedOutput: boolean;
402
- isOneClick: boolean;
403
- }
404
-
405
- export declare type OnChainTx = HyperstreamApi.OnChainTx;
406
-
407
- export declare type OrderListResponse = HyperstreamApi.GetOrderResponse;
408
-
409
- export declare type OrderResponse = HyperstreamApi.Order;
410
-
411
- export declare type OrderStatus = HyperstreamApi.OrderStatus;
412
-
413
- export declare type OrderTimestamps = HyperstreamApi.OrderTimestamps;
414
-
415
- export declare type OrderTransactions = HyperstreamApi.OrderTransactions;
416
-
417
- export declare type QuoteRequest = HyperstreamApi.QuoteRequest;
418
-
419
- export declare type QuoteResponse = HyperstreamApi.GetQuotesResponse;
420
-
421
- export declare type QuoteRoute = HyperstreamApi.Route;
422
-
423
- /**
424
- * Rank offers where lower input amount is better (EXACT_OUTPUT).
425
- *
426
- * Same algorithm as rankSwapOffers but inverted:
427
- * best price = lowest amountIn, threshold = lowestAmountIn * 1.001
428
- */
429
- export declare function rankOffers(offers: readonly OfferForRanking[]): string[];
430
-
431
- /**
432
- * Non-derivable state for `<tokenflight-receive>`.
433
- *
434
- * Derivable values (phase, selectedQuote, paymentTokens) are computed in
435
- * ReceiveComponent from payTokenQuotes + loadingQuotes + these signals.
436
- */
437
- export declare interface ReceiveState {
438
- targetToken: ResolvedToken | null;
439
- targetAmount: string;
440
- /** Set before execution starts for TransactionComplete display */
441
- fromToken: ResolvedToken | null;
442
- /** Recipient address for cross-chain swaps */
443
- recipient: string | null;
444
- walletAddress: string | null;
445
- /** Current execution phase, or null when idle/quoting/quoted */
446
- execPhase: ExecPhase | null;
447
- order: OrderResponse | null;
448
- error: string | null;
449
- errorCode: string | null;
450
- }
451
-
452
- export declare function registerElements(options?: RegisterElementsOptions): void;
453
-
454
- export declare interface RegisterElementsOptions {
455
- walletAdapter?: IWalletAdapter;
456
- callbacks?: Callbacks;
457
- /** Custom CSS variable overrides merged on top of the active theme.
458
- * Keys are CSS variable names, e.g. `"--tf-primary"`, `"--tf-font-family"`. */
459
- customColors?: CustomColors;
460
- /** Default API endpoint for all widget instances. */
461
- apiEndpoint?: string;
462
- /** Default theme for all widget instances. */
463
- theme?: Theme;
464
- /** Default locale for all widget instances. */
465
- locale?: SupportedLocale;
466
- }
467
-
468
- /** Resolved token with full metadata for local display state */
469
- export declare interface ResolvedToken {
470
- chainId: number;
471
- address: string;
472
- symbol?: string;
473
- name?: string;
474
- decimals?: number;
475
- logoURI?: string;
476
- priceUsd?: number;
477
- }
478
-
479
- export declare type RouteQuote = HyperstreamApi.Quote;
480
-
481
- export declare type RouteTag = HyperstreamApi.RouteTag;
482
-
483
- /** Chain ID for Solana mainnet in the API */
484
- export declare const SOLANA_CHAIN_ID = 20011000000;
485
-
486
- export declare type SolanaApproval = HyperstreamApi.SolanaApproval;
487
-
488
- /** Solana sign and send transaction action */
489
- export declare interface SolanaSignAndSendAction {
490
- type: "solana_signAndSendTransaction";
491
- transaction: string;
492
- }
493
-
494
- /** Solana sign transaction action */
495
- export declare interface SolanaSignTransactionAction {
496
- type: "solana_signTransaction";
497
- transaction: string;
498
- }
499
-
500
- export declare type SubmitDepositResponse = HyperstreamApi.SubmitDepositResponse;
501
-
502
- /** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
503
- export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
504
-
505
- /** Data emitted on swap error */
506
- export declare interface SwapErrorData {
507
- code: string;
508
- message: string;
509
- details?: unknown;
510
- }
511
-
512
- /** Swap flow phases */
513
- export declare type SwapPhase = "idle" | "quoting" | "quoted" | "building" | "awaiting-wallet" | "submitting" | "tracking" | "success" | "error";
514
-
515
- /** Data emitted on swap success */
516
- export declare interface SwapSuccessData {
517
- orderId: string;
518
- fromToken: string;
519
- toToken: string;
520
- fromAmount: string;
521
- toAmount: string;
522
- txHash: string;
523
- }
524
-
525
- /** Terminal order statuses */
526
- export declare const TERMINAL_ORDER_STATUSES: HyperstreamApi.OrderStatus[];
527
-
528
- /** Visual theme mode. */
529
- export declare type Theme = "light" | "dark" | "auto";
530
-
531
- /**
532
- * Convert display amount to base units (bigint string) using token decimals.
533
- * e.g., toBaseUnits("1", 6) → "1000000"
534
- * toBaseUnits("1.5", 6) → "1500000"
535
- */
536
- export declare function toBaseUnits(displayAmount: string, decimals: number): string;
537
-
538
- /**
539
- * Convert base units (bigint string) to display amount using token decimals.
540
- * e.g., toDisplayAmount("1000000", 6) → "1"
541
- * toDisplayAmount("1500000", 6) → "1.5"
542
- */
543
- export declare function toDisplayAmount(baseUnits: string, decimals: number): string;
544
-
545
- export declare type TokenExtensions = HyperstreamApi.TokenExtensions;
546
-
547
- /** Shared configuration fields for both widgets */
548
- export declare interface TokenFlightConfigBase {
549
- /** HyperStream API endpoint */
550
- apiEndpoint?: string;
551
- /** Visual theme */
552
- theme?: Theme;
553
- /** Locale for i18n */
554
- locale?: SupportedLocale;
555
- /** Custom CSS color overrides */
556
- customColors?: CustomColors;
557
- /** Optional custom widget title text */
558
- titleText?: string;
559
- /** Optional custom widget title image URL */
560
- titleImageUrl?: string;
561
- /** Hide top title/header area */
562
- hideTitle?: boolean;
563
- /** Hide "Powered by TokenFlight" footer */
564
- hidePoweredBy?: boolean;
565
- /** Remove container background (transparent) */
566
- noBackground?: boolean;
567
- /** Remove container border and shadow */
568
- noBorder?: boolean;
569
- }
570
-
571
- /** Custom error class for TokenFlight SDK */
572
- export declare class TokenFlightError extends Error {
573
- readonly code: ErrorCode;
574
- readonly details?: unknown;
575
- constructor(code: ErrorCode, message: string | unknown, details?: unknown);
576
- }
577
-
578
- export declare class TokenFlightReceive {
579
- private dispose;
580
- private unwatchTheme;
581
- private container;
582
- private shadowRoot;
583
- private config;
584
- private walletAdapter?;
585
- private callbacks?;
586
- constructor(options: TokenFlightReceiveOptions);
587
- initialize(): void;
588
- destroy(): void;
589
- setTheme(theme: Theme): void;
590
- setCustomColors(colors: CustomColors): void;
591
- private applyThemeStyles;
592
- private setupAutoThemeWatch;
593
- }
594
-
595
- /** Attributes accepted by `<tokenflight-receive>`. */
596
- export declare interface TokenFlightReceiveAttributes {
597
- "api-endpoint"?: string;
598
- target?: string;
599
- amount?: string;
600
- "from-token"?: string;
601
- recipient?: string;
602
- "title-text"?: string;
603
- "title-image"?: string;
604
- theme?: Theme;
605
- locale?: SupportedLocale;
606
- "csp-nonce"?: string;
607
- icon?: string;
608
- "hide-title"?: BooleanAttribute;
609
- "hide-powered-by"?: BooleanAttribute;
610
- "no-background"?: BooleanAttribute;
611
- "no-border"?: BooleanAttribute;
612
- }
613
-
614
- /** Configuration for `<tokenflight-receive>` */
615
- export declare interface TokenFlightReceiveConfig extends TokenFlightConfigBase {
616
- /** Required: target token to receive */
617
- target: TokenIdentifier;
618
- /** Required: amount to receive */
619
- amount: string;
620
- /** Optional source token to pay with */
621
- fromToken?: TokenIdentifier;
622
- /** Optional recipient address (for cross-chain swaps to a different address) */
623
- recipient?: string;
624
- /** Optional icon URL for the target token */
625
- icon?: string;
626
- }
627
-
628
- export declare interface TokenFlightReceiveOptions {
629
- container: string | HTMLElement;
630
- config: TokenFlightReceiveConfig;
631
- walletAdapter?: IWalletAdapter;
632
- callbacks?: Callbacks;
633
- }
634
-
635
- /**
636
- * Flexible token identifier supporting:
637
- * - Direct object: { chainId: 1, address: "0x..." }
638
- * - CAIP-10 string: "eip155:1:0x..."
639
- * - JSON string: '{"chainId":1,"address":"0x..."}'
640
- */
641
- export declare type TokenIdentifier = string | TokenTarget;
642
-
643
- export declare type TokenInfo = HyperstreamApi.Token;
644
-
645
- export declare type TokenListResponse = HyperstreamApi.GetTokensResponse;
646
-
647
- export declare type TokenMeta = HyperstreamApi.TokenMeta;
648
-
649
- export declare type TokenSearchResponse = HyperstreamApi.TokenSearchResponse;
650
-
651
- /** Token target as chain + address pair */
652
- export declare interface TokenTarget {
653
- chainId: number;
654
- address: string;
655
- }
656
-
657
- export declare type TradeType = HyperstreamApi.TradeType;
658
-
659
- /** Union of all wallet action types */
660
- export declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
661
-
662
- /** Result of executing a wallet action */
663
- export declare interface WalletActionResult {
664
- success: boolean;
665
- data?: unknown;
666
- error?: string;
667
- txHash?: string;
668
- }
669
-
670
- /** Wallet action types */
671
- export declare type WalletActionType = "eip1193_request" | "solana_signTransaction" | "solana_signAndSendTransaction";
672
-
673
- /** Data emitted when wallet is connected */
674
- export declare interface WalletConnectedData {
675
- address: string;
676
- chainType: string;
677
- }
678
-
679
- /** Wallet event payload */
680
- export declare interface WalletEvent {
681
- type: WalletEventType;
682
- data?: unknown;
683
- }
684
-
685
- /** Wallet event types */
686
- export declare type WalletEventType = "connect" | "disconnect" | "chainChanged" | "accountsChanged";
687
-
688
- export { }