@hongming-wang/usdc-bridge-widget 0.1.0

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.
@@ -0,0 +1,765 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as viem from 'viem';
3
+ import { Chain } from 'viem';
4
+ import * as _tanstack_react_query from '@tanstack/react-query';
5
+ import React$1 from 'react';
6
+ export { arbitrum, arbitrumSepolia, avalanche, avalancheFuji, base, baseSepolia, ink, linea, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sei, sepolia, sonic, worldchain, xdc } from 'viem/chains';
7
+
8
+ /**
9
+ * Theme configuration for the Bridge Widget.
10
+ * All color values should be valid CSS color strings (hex, rgb, rgba, etc.).
11
+ *
12
+ * @example
13
+ * const customTheme: BridgeWidgetTheme = {
14
+ * primaryColor: "#3b82f6",
15
+ * backgroundColor: "rgba(0, 0, 0, 0.9)",
16
+ * borderRadius: 16,
17
+ * };
18
+ */
19
+ interface BridgeWidgetTheme {
20
+ /** Primary accent color used for buttons and highlights (hex) */
21
+ primaryColor?: string;
22
+ /** Secondary accent color used for gradients (hex) */
23
+ secondaryColor?: string;
24
+ /** Main background color of the widget (hex or rgba) */
25
+ backgroundColor?: string;
26
+ /** Background color for cards and nested elements (hex or rgba) */
27
+ cardBackgroundColor?: string;
28
+ /** Primary text color (hex) */
29
+ textColor?: string;
30
+ /** Secondary/muted text color for labels (hex or rgba) */
31
+ mutedTextColor?: string;
32
+ /** Border color for inputs and containers (hex or rgba) */
33
+ borderColor?: string;
34
+ /** Color for success states and messages (hex) */
35
+ successColor?: string;
36
+ /** Color for error states and messages (hex) */
37
+ errorColor?: string;
38
+ /** Color for hover states (hex or rgba) */
39
+ hoverColor?: string;
40
+ /** Border radius in pixels for rounded corners */
41
+ borderRadius?: number;
42
+ /** Font family for all text in the widget */
43
+ fontFamily?: string;
44
+ }
45
+ /**
46
+ * Configuration for a supported blockchain in the bridge.
47
+ * Contains chain metadata, USDC contract address, and CCTP TokenMessenger address.
48
+ *
49
+ * @example
50
+ * const ethereumConfig: BridgeChainConfig = {
51
+ * chain: mainnet,
52
+ * usdcAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
53
+ * tokenMessengerAddress: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
54
+ * iconUrl: "https://icons.llamao.fi/icons/chains/rsz_ethereum.jpg",
55
+ * };
56
+ */
57
+ interface BridgeChainConfig {
58
+ /** Chain definition from viem containing id, name, and network details */
59
+ chain: Chain;
60
+ /** USDC token contract address on this chain (checksummed) */
61
+ usdcAddress: `0x${string}`;
62
+ /** Circle TokenMessenger contract address for CCTP transfers */
63
+ tokenMessengerAddress?: `0x${string}`;
64
+ /** URL for the chain's icon/logo image (optional, falls back to initial) */
65
+ iconUrl?: string;
66
+ }
67
+ /**
68
+ * Props for the BridgeWidget component.
69
+ *
70
+ * @example
71
+ * <BridgeWidget
72
+ * defaultSourceChainId={1}
73
+ * defaultDestinationChainId={8453}
74
+ * onBridgeSuccess={({ txHash }) => console.log('Success:', txHash)}
75
+ * onBridgeError={(error) => console.error('Error:', error)}
76
+ * theme={{ primaryColor: "#3b82f6" }}
77
+ * />
78
+ */
79
+ interface BridgeWidgetProps {
80
+ /**
81
+ * Array of supported chains with their USDC addresses.
82
+ * Defaults to all CCTP-supported chains from DEFAULT_CHAIN_CONFIGS.
83
+ */
84
+ chains?: BridgeChainConfig[];
85
+ /** Chain ID to pre-select as the source chain */
86
+ defaultSourceChainId?: number;
87
+ /** Chain ID to pre-select as the destination chain */
88
+ defaultDestinationChainId?: number;
89
+ /**
90
+ * Callback fired when a bridge transaction is initiated.
91
+ * Called before approval (if needed) or bridge execution begins.
92
+ */
93
+ onBridgeStart?: (params: {
94
+ /** Source chain ID */
95
+ sourceChainId: number;
96
+ /** Destination chain ID */
97
+ destChainId: number;
98
+ /** Amount being bridged (as string) */
99
+ amount: string;
100
+ /** Transaction hash (only present if tx already submitted) */
101
+ txHash?: `0x${string}`;
102
+ }) => void;
103
+ /**
104
+ * Callback fired when a bridge transaction completes successfully.
105
+ * The txHash can be used to link to a block explorer.
106
+ */
107
+ onBridgeSuccess?: (params: {
108
+ /** Source chain ID */
109
+ sourceChainId: number;
110
+ /** Destination chain ID */
111
+ destChainId: number;
112
+ /** Amount bridged (as string) */
113
+ amount: string;
114
+ /** Transaction hash of the successful bridge */
115
+ txHash: `0x${string}`;
116
+ }) => void;
117
+ /**
118
+ * Callback fired when a bridge transaction fails.
119
+ * The error object contains details about what went wrong.
120
+ */
121
+ onBridgeError?: (error: Error) => void;
122
+ /**
123
+ * Callback fired when the user clicks "Connect Wallet".
124
+ * If not provided, the widget will attempt to use wagmi's connectors.
125
+ */
126
+ onConnectWallet?: () => void;
127
+ /** Custom theme overrides to customize the widget appearance */
128
+ theme?: BridgeWidgetTheme;
129
+ /** Custom CSS class name to apply to the widget container */
130
+ className?: string;
131
+ /** Custom inline styles to apply to the widget container */
132
+ style?: React.CSSProperties;
133
+ }
134
+ /**
135
+ * Estimated costs and timing for a bridge transfer.
136
+ * Used by the deprecated useBridgeEstimate hook.
137
+ *
138
+ * @deprecated Use BridgeQuote from useBridge.ts instead
139
+ */
140
+ interface BridgeEstimate {
141
+ /** Estimated gas fee (as formatted string) */
142
+ gasFee: string;
143
+ /** Protocol bridge fee (as formatted string) */
144
+ bridgeFee: string;
145
+ /** Total estimated fee including gas and protocol (as formatted string) */
146
+ totalFee: string;
147
+ /** Estimated time for the bridge to complete (e.g., "~15-20 minutes") */
148
+ estimatedTime: string;
149
+ }
150
+ /**
151
+ * Result state for a bridge operation.
152
+ * Tracks the current state and any associated transaction hash or error.
153
+ */
154
+ interface BridgeResult {
155
+ /** Current state of the bridge operation */
156
+ state: "idle" | "pending" | "success" | "error";
157
+ /** Transaction hash if a transaction has been submitted */
158
+ txHash?: `0x${string}`;
159
+ /** Error message if the operation failed */
160
+ error?: string;
161
+ }
162
+
163
+ declare function BridgeWidget({ chains, defaultSourceChainId, defaultDestinationChainId, onBridgeStart, onBridgeSuccess, onBridgeError, onConnectWallet, theme: themeOverrides, className, style, }: BridgeWidgetProps): react_jsx_runtime.JSX.Element;
164
+
165
+ /**
166
+ * Hook to get USDC balance for a specific chain
167
+ */
168
+ declare function useUSDCBalance(chainConfig: BridgeChainConfig | undefined): {
169
+ balance: bigint;
170
+ balanceFormatted: string;
171
+ isLoading: boolean;
172
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, viem.ReadContractErrorType>>;
173
+ };
174
+ /**
175
+ * Hook to get USDC balances for all configured chains at once.
176
+ * Uses multicall for efficient batch fetching.
177
+ *
178
+ * @param chainConfigs - Array of chain configurations to fetch balances for
179
+ * @returns Object with balances mapped by chain ID, loading state, and refetch function
180
+ *
181
+ * @example
182
+ * const { balances, isLoading, refetch } = useAllUSDCBalances(chains);
183
+ * // balances[1] -> { balance: 1000000n, formatted: "1.00" }
184
+ */
185
+ declare function useAllUSDCBalances(chainConfigs: BridgeChainConfig[]): {
186
+ balances: Record<number, {
187
+ balance: bigint;
188
+ formatted: string;
189
+ }>;
190
+ isLoading: boolean;
191
+ refetch: () => void;
192
+ };
193
+ /**
194
+ * Hook to check and handle USDC allowance
195
+ */
196
+ declare function useUSDCAllowance(chainConfig: BridgeChainConfig | undefined, spenderAddress?: `0x${string}`): {
197
+ allowance: bigint;
198
+ allowanceFormatted: string;
199
+ isLoading: boolean;
200
+ isApproving: boolean;
201
+ approve: (amount: string) => Promise<`0x${string}`>;
202
+ needsApproval: (amount: string) => boolean;
203
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, viem.ReadContractErrorType>>;
204
+ approvalError: Error | null;
205
+ };
206
+ /**
207
+ * Hook to estimate bridge costs using Circle Bridge Kit SDK
208
+ *
209
+ * @deprecated This hook is deprecated and will be removed in a future version.
210
+ * Use `useBridgeQuote` from `useBridge.ts` instead for SDK-based estimates.
211
+ *
212
+ * Note: kit.estimate() requires an adapter with wallet connection.
213
+ * For pre-bridge quotes without wallet, we return CCTP standard estimates.
214
+ *
215
+ * @example
216
+ * // Before (deprecated):
217
+ * const { estimate } = useBridgeEstimate(sourceChainId, destChainId, amount);
218
+ *
219
+ * // After (recommended):
220
+ * import { useBridgeQuote } from './useBridge';
221
+ * const { quote } = useBridgeQuote(sourceChainId, destChainId, amount);
222
+ */
223
+ declare function useBridgeEstimate(sourceChainId: number | undefined, destChainId: number | undefined, amount: string): {
224
+ estimate: BridgeEstimate | null;
225
+ isLoading: boolean;
226
+ error: Error | null;
227
+ };
228
+ /**
229
+ * Hook to format numbers for display
230
+ *
231
+ * @deprecated This hook is deprecated and will be removed in a future version.
232
+ * Use the `formatNumber` utility function directly from `utils.ts` instead.
233
+ * The hook adds unnecessary overhead with useCallback for a pure function.
234
+ *
235
+ * @example
236
+ * // Before (deprecated):
237
+ * const format = useFormatNumber();
238
+ * const formatted = format(1234.56, 2);
239
+ *
240
+ * // After (recommended):
241
+ * import { formatNumber } from './utils';
242
+ * const formatted = formatNumber(1234.56, 2);
243
+ */
244
+ declare function useFormatNumber(): (value: string | number, decimals?: number) => string;
245
+
246
+ declare function getChainName(chainId: number): string;
247
+ interface BridgeParams {
248
+ sourceChainConfig: BridgeChainConfig;
249
+ destChainConfig: BridgeChainConfig;
250
+ amount: string;
251
+ recipientAddress?: `0x${string}`;
252
+ }
253
+ interface BridgeState {
254
+ status: "idle" | "loading" | "approving" | "burning" | "fetching-attestation" | "minting" | "success" | "error";
255
+ txHash?: `0x${string}`;
256
+ error?: Error;
257
+ events: BridgeEvent[];
258
+ }
259
+ interface BridgeEvent {
260
+ type: string;
261
+ timestamp: number;
262
+ data?: unknown;
263
+ }
264
+ interface UseBridgeResult {
265
+ bridge: (params: BridgeParams) => Promise<void>;
266
+ state: BridgeState;
267
+ reset: () => void;
268
+ }
269
+ /**
270
+ * Hook to execute USDC bridge transfers using Circle's Bridge Kit
271
+ */
272
+ declare function useBridge(): UseBridgeResult;
273
+ interface BridgeQuote {
274
+ estimatedGasFee: string;
275
+ bridgeFee: string;
276
+ totalFee: string;
277
+ estimatedTime: string;
278
+ expiresAt?: number;
279
+ }
280
+ /**
281
+ * Hook to get a quote for a bridge transfer.
282
+ *
283
+ * **Note:** This hook currently returns static CCTP standard estimates because
284
+ * Circle's `kit.estimate()` requires an adapter with an active wallet connection.
285
+ * For accurate gas estimates, the wallet will provide them during transaction signing.
286
+ *
287
+ * @param sourceChainId - Source chain ID
288
+ * @param destChainId - Destination chain ID
289
+ * @param amount - Amount to bridge (as string)
290
+ * @returns Quote with estimated fees and timing (static values)
291
+ *
292
+ * @example
293
+ * const { quote, isLoading, error } = useBridgeQuote(1, 8453, "100");
294
+ * // quote.estimatedTime -> "~15-20 minutes"
295
+ * // quote.bridgeFee -> "0-14 bps (FAST) / 0 (SLOW)"
296
+ */
297
+ declare function useBridgeQuote(sourceChainId: number | undefined, destChainId: number | undefined, amount: string): {
298
+ quote: BridgeQuote | null;
299
+ isLoading: boolean;
300
+ error: Error | null;
301
+ };
302
+
303
+ declare const USDC_DECIMALS = 6;
304
+ declare const USDC_BRAND_COLOR = "#2775ca";
305
+ declare const MAX_USDC_AMOUNT = "100000000000";
306
+ declare const MIN_USDC_AMOUNT = "0.000001";
307
+ declare const DEFAULT_LOCALE = "en-US";
308
+ declare const USDC_ADDRESSES: Record<number, `0x${string}`>;
309
+ declare const TOKEN_MESSENGER_V1_ADDRESSES: Record<number, `0x${string}`>;
310
+ declare const TOKEN_MESSENGER_V2_ADDRESS: `0x${string}`;
311
+ declare const TOKEN_MESSENGER_ADDRESSES: Record<number, `0x${string}`>;
312
+ declare const CHAIN_ICONS: Record<number, string>;
313
+
314
+ /**
315
+ * Format a number for display with locale-aware formatting
316
+ *
317
+ * @param value - The number or string to format
318
+ * @param decimals - Number of decimal places (default: 2)
319
+ * @param locale - Optional locale string (e.g., 'en-US', 'de-DE'). Defaults to 'en-US' for consistent financial display.
320
+ * @returns Formatted number string
321
+ *
322
+ * @example
323
+ * formatNumber(1234.567) // "1,234.57"
324
+ * formatNumber(1234.567, 4) // "1,234.5670"
325
+ * formatNumber(1234.567, 2, 'de-DE') // "1.234,57"
326
+ */
327
+ declare function formatNumber(value: string | number, decimals?: number, locale?: string): string;
328
+ /**
329
+ * Validate and sanitize an amount input string.
330
+ * Ensures the value is a valid positive decimal with max 6 decimal places.
331
+ *
332
+ * @param value - The input string to validate
333
+ * @returns Object with isValid flag and sanitized value
334
+ */
335
+ declare function validateAmountInput(value: string): {
336
+ isValid: boolean;
337
+ sanitized: string;
338
+ error?: string;
339
+ };
340
+ /**
341
+ * Safely parse a USDC amount string to bigint
342
+ * Returns null if parsing fails
343
+ */
344
+ declare function parseUSDCAmount(amount: string): bigint | null;
345
+ /**
346
+ * Check if a string is a valid positive number
347
+ */
348
+ declare function isValidPositiveAmount(amount: string): boolean;
349
+ /**
350
+ * Extract error message from unknown error type
351
+ */
352
+ declare function getErrorMessage(error: unknown): string;
353
+ /**
354
+ * Validation result for chain config
355
+ */
356
+ interface ChainConfigValidationResult {
357
+ isValid: boolean;
358
+ errors: string[];
359
+ }
360
+ /**
361
+ * Validate a single chain configuration.
362
+ * Checks that required fields are present and addresses are valid.
363
+ *
364
+ * @param config - The chain configuration to validate
365
+ * @returns Validation result with errors if any
366
+ */
367
+ declare function validateChainConfig(config: BridgeChainConfig): ChainConfigValidationResult;
368
+ /**
369
+ * Validate an array of chain configurations.
370
+ * Returns the first error found or success if all configs are valid.
371
+ *
372
+ * @param configs - Array of chain configurations to validate
373
+ * @returns Validation result with all errors
374
+ */
375
+ declare function validateChainConfigs(configs: BridgeChainConfig[]): ChainConfigValidationResult;
376
+
377
+ declare const unichain: {
378
+ blockExplorers: {
379
+ readonly default: {
380
+ readonly name: "Uniscan";
381
+ readonly url: "https://uniscan.xyz";
382
+ };
383
+ };
384
+ blockTime?: number | undefined | undefined;
385
+ contracts?: {
386
+ [x: string]: viem.ChainContract | {
387
+ [sourceId: number]: viem.ChainContract | undefined;
388
+ } | undefined;
389
+ ensRegistry?: viem.ChainContract | undefined;
390
+ ensUniversalResolver?: viem.ChainContract | undefined;
391
+ multicall3?: viem.ChainContract | undefined;
392
+ erc6492Verifier?: viem.ChainContract | undefined;
393
+ } | undefined;
394
+ ensTlds?: readonly string[] | undefined;
395
+ id: 130;
396
+ name: "Unichain";
397
+ nativeCurrency: {
398
+ readonly name: "Ether";
399
+ readonly symbol: "ETH";
400
+ readonly decimals: 18;
401
+ };
402
+ experimental_preconfirmationTime?: number | undefined | undefined;
403
+ rpcUrls: {
404
+ readonly default: {
405
+ readonly http: readonly ["https://mainnet.unichain.org"];
406
+ };
407
+ };
408
+ sourceId?: number | undefined | undefined;
409
+ testnet?: boolean | undefined | undefined;
410
+ custom?: Record<string, unknown> | undefined;
411
+ extendSchema?: Record<string, unknown> | undefined;
412
+ fees?: viem.ChainFees<undefined> | undefined;
413
+ formatters?: undefined;
414
+ prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
415
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
416
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
417
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
418
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
419
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
420
+ }] | undefined;
421
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
422
+ verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
423
+ };
424
+ declare const hyperEvm: {
425
+ blockExplorers: {
426
+ readonly default: {
427
+ readonly name: "Hyperscan";
428
+ readonly url: "https://hyperscan.xyz";
429
+ };
430
+ };
431
+ blockTime?: number | undefined | undefined;
432
+ contracts?: {
433
+ [x: string]: viem.ChainContract | {
434
+ [sourceId: number]: viem.ChainContract | undefined;
435
+ } | undefined;
436
+ ensRegistry?: viem.ChainContract | undefined;
437
+ ensUniversalResolver?: viem.ChainContract | undefined;
438
+ multicall3?: viem.ChainContract | undefined;
439
+ erc6492Verifier?: viem.ChainContract | undefined;
440
+ } | undefined;
441
+ ensTlds?: readonly string[] | undefined;
442
+ id: 999;
443
+ name: "HyperEVM";
444
+ nativeCurrency: {
445
+ readonly name: "HYPE";
446
+ readonly symbol: "HYPE";
447
+ readonly decimals: 18;
448
+ };
449
+ experimental_preconfirmationTime?: number | undefined | undefined;
450
+ rpcUrls: {
451
+ readonly default: {
452
+ readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
453
+ };
454
+ };
455
+ sourceId?: number | undefined | undefined;
456
+ testnet?: boolean | undefined | undefined;
457
+ custom?: Record<string, unknown> | undefined;
458
+ extendSchema?: Record<string, unknown> | undefined;
459
+ fees?: viem.ChainFees<undefined> | undefined;
460
+ formatters?: undefined;
461
+ prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
462
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
463
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
464
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
465
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
466
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
467
+ }] | undefined;
468
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
469
+ verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
470
+ };
471
+ declare const plume: {
472
+ blockExplorers: {
473
+ readonly default: {
474
+ readonly name: "Plume Explorer";
475
+ readonly url: "https://explorer.plume.org";
476
+ };
477
+ };
478
+ blockTime?: number | undefined | undefined;
479
+ contracts?: {
480
+ [x: string]: viem.ChainContract | {
481
+ [sourceId: number]: viem.ChainContract | undefined;
482
+ } | undefined;
483
+ ensRegistry?: viem.ChainContract | undefined;
484
+ ensUniversalResolver?: viem.ChainContract | undefined;
485
+ multicall3?: viem.ChainContract | undefined;
486
+ erc6492Verifier?: viem.ChainContract | undefined;
487
+ } | undefined;
488
+ ensTlds?: readonly string[] | undefined;
489
+ id: 98866;
490
+ name: "Plume";
491
+ nativeCurrency: {
492
+ readonly name: "Ether";
493
+ readonly symbol: "ETH";
494
+ readonly decimals: 18;
495
+ };
496
+ experimental_preconfirmationTime?: number | undefined | undefined;
497
+ rpcUrls: {
498
+ readonly default: {
499
+ readonly http: readonly ["https://rpc.plume.org"];
500
+ };
501
+ };
502
+ sourceId?: number | undefined | undefined;
503
+ testnet?: boolean | undefined | undefined;
504
+ custom?: Record<string, unknown> | undefined;
505
+ extendSchema?: Record<string, unknown> | undefined;
506
+ fees?: viem.ChainFees<undefined> | undefined;
507
+ formatters?: undefined;
508
+ prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
509
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
510
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
511
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
512
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
513
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
514
+ }] | undefined;
515
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
516
+ verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
517
+ };
518
+ declare const monad: {
519
+ blockExplorers: {
520
+ readonly default: {
521
+ readonly name: "Monad Explorer";
522
+ readonly url: "https://explorer.monad.xyz";
523
+ };
524
+ };
525
+ blockTime?: number | undefined | undefined;
526
+ contracts?: {
527
+ [x: string]: viem.ChainContract | {
528
+ [sourceId: number]: viem.ChainContract | undefined;
529
+ } | undefined;
530
+ ensRegistry?: viem.ChainContract | undefined;
531
+ ensUniversalResolver?: viem.ChainContract | undefined;
532
+ multicall3?: viem.ChainContract | undefined;
533
+ erc6492Verifier?: viem.ChainContract | undefined;
534
+ } | undefined;
535
+ ensTlds?: readonly string[] | undefined;
536
+ id: 10200;
537
+ name: "Monad";
538
+ nativeCurrency: {
539
+ readonly name: "MON";
540
+ readonly symbol: "MON";
541
+ readonly decimals: 18;
542
+ };
543
+ experimental_preconfirmationTime?: number | undefined | undefined;
544
+ rpcUrls: {
545
+ readonly default: {
546
+ readonly http: readonly ["https://rpc.monad.xyz"];
547
+ };
548
+ };
549
+ sourceId?: number | undefined | undefined;
550
+ testnet?: boolean | undefined | undefined;
551
+ custom?: Record<string, unknown> | undefined;
552
+ extendSchema?: Record<string, unknown> | undefined;
553
+ fees?: viem.ChainFees<undefined> | undefined;
554
+ formatters?: undefined;
555
+ prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
556
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
557
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
558
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
559
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
560
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
561
+ }] | undefined;
562
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
563
+ verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
564
+ };
565
+ declare const codex: {
566
+ blockExplorers: {
567
+ readonly default: {
568
+ readonly name: "Codex Explorer";
569
+ readonly url: "https://explorer.codex.storage";
570
+ };
571
+ };
572
+ blockTime?: number | undefined | undefined;
573
+ contracts?: {
574
+ [x: string]: viem.ChainContract | {
575
+ [sourceId: number]: viem.ChainContract | undefined;
576
+ } | undefined;
577
+ ensRegistry?: viem.ChainContract | undefined;
578
+ ensUniversalResolver?: viem.ChainContract | undefined;
579
+ multicall3?: viem.ChainContract | undefined;
580
+ erc6492Verifier?: viem.ChainContract | undefined;
581
+ } | undefined;
582
+ ensTlds?: readonly string[] | undefined;
583
+ id: 81224;
584
+ name: "Codex";
585
+ nativeCurrency: {
586
+ readonly name: "Ether";
587
+ readonly symbol: "ETH";
588
+ readonly decimals: 18;
589
+ };
590
+ experimental_preconfirmationTime?: number | undefined | undefined;
591
+ rpcUrls: {
592
+ readonly default: {
593
+ readonly http: readonly ["https://rpc.codex.storage"];
594
+ };
595
+ };
596
+ sourceId?: number | undefined | undefined;
597
+ testnet?: boolean | undefined | undefined;
598
+ custom?: Record<string, unknown> | undefined;
599
+ extendSchema?: Record<string, unknown> | undefined;
600
+ fees?: viem.ChainFees<undefined> | undefined;
601
+ formatters?: undefined;
602
+ prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
603
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
604
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
605
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
606
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
607
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
608
+ }] | undefined;
609
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
610
+ verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
611
+ };
612
+ declare function createChainConfig(chain: viem.Chain, options?: {
613
+ usdcAddress?: `0x${string}`;
614
+ tokenMessengerAddress?: `0x${string}`;
615
+ iconUrl?: string;
616
+ }): BridgeChainConfig;
617
+ declare const DEFAULT_CHAIN_CONFIGS: BridgeChainConfig[];
618
+
619
+ /**
620
+ * Create a testnet chain configuration
621
+ */
622
+ declare function createTestnetChainConfig(chain: viem.Chain, options?: {
623
+ usdcAddress?: `0x${string}`;
624
+ tokenMessengerAddress?: `0x${string}`;
625
+ iconUrl?: string;
626
+ }): BridgeChainConfig;
627
+ /**
628
+ * Testnet chain configurations for development and testing.
629
+ * These use Circle's testnet USDC and TokenMessenger contracts.
630
+ *
631
+ * @example
632
+ * import { TESTNET_CHAIN_CONFIGS } from './chains';
633
+ * <BridgeWidget chains={TESTNET_CHAIN_CONFIGS} />
634
+ */
635
+ declare const TESTNET_CHAIN_CONFIGS: BridgeChainConfig[];
636
+
637
+ /**
638
+ * Default theme color palette
639
+ */
640
+ declare const THEME_COLORS: {
641
+ /** Primary accent - Indigo */
642
+ readonly primary: "#6366f1";
643
+ /** Secondary accent - Purple */
644
+ readonly secondary: "#a855f7";
645
+ /** Success state - Green */
646
+ readonly success: "#22c55e";
647
+ /** Error state - Red */
648
+ readonly error: "#ef4444";
649
+ /** Text color - White */
650
+ readonly text: "#ffffff";
651
+ /** Muted text - Semi-transparent white */
652
+ readonly mutedText: "rgba(255, 255, 255, 0.54)";
653
+ /** Border color - Semi-transparent white */
654
+ readonly border: "rgba(255, 255, 255, 0.06)";
655
+ /** Background - Dark with transparency */
656
+ readonly background: "rgba(15, 15, 25, 0.8)";
657
+ /** Card background - Darker with transparency */
658
+ readonly cardBackground: "rgba(15, 15, 25, 0.6)";
659
+ /** Dropdown background - Near opaque dark */
660
+ readonly dropdownBackground: "rgba(20, 20, 35, 0.98)";
661
+ /** Input background - Transparent black */
662
+ readonly inputBackground: "rgba(0, 0, 0, 0.3)";
663
+ /** Hover state - Semi-transparent white */
664
+ readonly hover: "rgba(255, 255, 255, 0.05)";
665
+ };
666
+ /**
667
+ * Default theme spacing and sizing
668
+ */
669
+ declare const THEME_SIZING: {
670
+ /** Default border radius in pixels */
671
+ readonly borderRadius: 12;
672
+ /** Widget max width */
673
+ readonly maxWidth: "480px";
674
+ /** Standard padding */
675
+ readonly padding: "16px";
676
+ /** Gap between elements */
677
+ readonly gap: "12px";
678
+ /** Small gap */
679
+ readonly smallGap: "8px";
680
+ /** Dropdown max height */
681
+ readonly dropdownMaxHeight: "300px";
682
+ };
683
+ /**
684
+ * Default font settings
685
+ */
686
+ declare const THEME_FONTS: {
687
+ /** Primary font family */
688
+ readonly family: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif";
689
+ /** Font sizes */
690
+ readonly sizes: {
691
+ readonly xs: "10px";
692
+ readonly sm: "12px";
693
+ readonly base: "14px";
694
+ readonly lg: "18px";
695
+ };
696
+ /** Font weights */
697
+ readonly weights: {
698
+ readonly normal: 400;
699
+ readonly medium: 500;
700
+ readonly semibold: 600;
701
+ readonly bold: 700;
702
+ };
703
+ };
704
+ /**
705
+ * Default complete theme configuration
706
+ */
707
+ declare const defaultTheme: Required<BridgeWidgetTheme>;
708
+ /**
709
+ * Merge user theme overrides with defaults
710
+ */
711
+ declare function mergeTheme(theme?: BridgeWidgetTheme): Required<BridgeWidgetTheme>;
712
+ /**
713
+ * Pre-built theme presets
714
+ */
715
+ declare const themePresets: {
716
+ /** Default dark theme */
717
+ readonly dark: Required<BridgeWidgetTheme>;
718
+ /** Light theme variant */
719
+ readonly light: Required<BridgeWidgetTheme>;
720
+ /** Blue accent theme */
721
+ readonly blue: Required<BridgeWidgetTheme>;
722
+ /** Green accent theme */
723
+ readonly green: Required<BridgeWidgetTheme>;
724
+ };
725
+
726
+ interface IconProps {
727
+ /** Icon size in pixels */
728
+ size?: number;
729
+ /** Stroke/fill color */
730
+ color?: string;
731
+ /** Additional CSS class */
732
+ className?: string;
733
+ /** Additional inline styles */
734
+ style?: React$1.CSSProperties;
735
+ }
736
+ /**
737
+ * Chevron down icon for dropdowns
738
+ */
739
+ declare function ChevronDownIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
740
+ /**
741
+ * Swap/exchange icon for chain swap button
742
+ */
743
+ declare function SwapIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
744
+ /**
745
+ * Loading spinner icon
746
+ */
747
+ declare function SpinnerIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
748
+ /**
749
+ * Check/success icon
750
+ */
751
+ declare function CheckIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
752
+ /**
753
+ * Error/X icon
754
+ */
755
+ declare function ErrorIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
756
+ /**
757
+ * External link icon
758
+ */
759
+ declare function ExternalLinkIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
760
+ /**
761
+ * Wallet icon
762
+ */
763
+ declare function WalletIcon({ size, color, className, style, }: IconProps): react_jsx_runtime.JSX.Element;
764
+
765
+ export { type BridgeChainConfig, type BridgeEstimate, type BridgeEvent, type BridgeParams, type BridgeQuote, type BridgeResult, type BridgeState, BridgeWidget, type BridgeWidgetProps, type BridgeWidgetTheme, CHAIN_ICONS, type ChainConfigValidationResult, CheckIcon, ChevronDownIcon, DEFAULT_CHAIN_CONFIGS, DEFAULT_LOCALE, ErrorIcon, ExternalLinkIcon, MAX_USDC_AMOUNT, MIN_USDC_AMOUNT, SpinnerIcon, SwapIcon, TESTNET_CHAIN_CONFIGS, THEME_COLORS, THEME_FONTS, THEME_SIZING, TOKEN_MESSENGER_ADDRESSES, TOKEN_MESSENGER_V1_ADDRESSES, TOKEN_MESSENGER_V2_ADDRESS, USDC_ADDRESSES, USDC_BRAND_COLOR, USDC_DECIMALS, type UseBridgeResult, WalletIcon, codex, createChainConfig, createTestnetChainConfig, defaultTheme, formatNumber, getChainName, getErrorMessage, hyperEvm, isValidPositiveAmount, mergeTheme, monad, parseUSDCAmount, plume, themePresets, unichain, useAllUSDCBalances, useBridge, useBridgeEstimate, useBridgeQuote, useFormatNumber, useUSDCAllowance, useUSDCBalance, validateAmountInput, validateChainConfig, validateChainConfigs };