@trustware/sdk-staging 0.0.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,705 @@
1
+ import React from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID } from './constants.js';
4
+
5
+ declare enum TrustwareErrorCode {
6
+ INVALID_CONFIG = "INVALID_CONFIG",
7
+ WALLET_NOT_CONNECTED = "WALLET_NOT_CONNECTED",
8
+ BRIDGE_FAILED = "BRIDGE_FAILED",
9
+ NETWORK_ERROR = "NETWORK_ERROR",
10
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
11
+ INPUT_ERROR = "INPUT_ERROR"
12
+ }
13
+
14
+ declare class TrustwareError extends Error {
15
+ code: TrustwareErrorCode;
16
+ userMessage?: string;
17
+ cause?: unknown;
18
+ constructor(params: {
19
+ code: TrustwareErrorCode;
20
+ message: string;
21
+ userMessage?: string;
22
+ cause?: unknown;
23
+ });
24
+ toJSON(): {
25
+ name: string;
26
+ code: TrustwareErrorCode;
27
+ message: string;
28
+ userMessage: string | undefined;
29
+ };
30
+ }
31
+
32
+ type TrustwareWidgetTheme = {
33
+ primaryColor: string;
34
+ secondaryColor: string;
35
+ backgroundColor: string;
36
+ textColor: string;
37
+ borderColor: string;
38
+ radius: number;
39
+ };
40
+ type TrustwareWidgetMessages = {
41
+ title: string;
42
+ description: string;
43
+ };
44
+ declare const DEFAULT_THEME: TrustwareWidgetTheme;
45
+ declare const DEFAULT_MESSAGES: TrustwareWidgetMessages;
46
+
47
+ type BuildRouteBody = {
48
+ fromChain: string;
49
+ toChain: string;
50
+ fromToken: string;
51
+ toToken: string;
52
+ fromAmount: string;
53
+ fromAddress: string;
54
+ toAddress: string;
55
+ fromAmountUsd?: string;
56
+ refundAddress?: string;
57
+ slippage?: number;
58
+ linkId?: string;
59
+ memo?: string;
60
+ };
61
+ type TxRequest = {
62
+ to?: string;
63
+ target?: string;
64
+ data: string;
65
+ value?: string;
66
+ gasLimit?: string;
67
+ maxFeePerGas?: string;
68
+ maxPriorityFeePerGas?: string;
69
+ chainId?: number | string;
70
+ gasPrice?: string;
71
+ };
72
+ declare function buildRoute(body: BuildRouteBody, signal?: AbortSignal): Promise<{
73
+ intentId: string;
74
+ txReq: TxRequest;
75
+ actions: unknown[];
76
+ finalExchangeRate: {
77
+ fromAmountUSD?: string;
78
+ toAmountMinUSD?: string;
79
+ };
80
+ route: RoutePlan | undefined;
81
+ }>;
82
+ declare function submitReceipt(intentId: string, txHash: string): Promise<any>;
83
+ declare function getStatus(intentId: string): Promise<Transaction>;
84
+ declare function pollStatus(intentId: string, { intervalMs, timeoutMs }?: {
85
+ intervalMs?: number | undefined;
86
+ timeoutMs?: number | undefined;
87
+ }): Promise<Transaction>;
88
+
89
+ type RouteParams = {
90
+ fromChain: string;
91
+ toChain: string;
92
+ fromToken: string;
93
+ toToken: string;
94
+ fromAmount: string | number;
95
+ fromAddress: string;
96
+ toAddress: string;
97
+ slippage?: number;
98
+ };
99
+ type RouteIntent = {
100
+ id: string;
101
+ fromChainId: string | number;
102
+ toChainId: string | number;
103
+ fromToken: string;
104
+ toToken: string;
105
+ fromAddress: string;
106
+ toAddress: string;
107
+ fromAmountWei: string | number;
108
+ quoteToAmountWei: string | number;
109
+ minToAmountWei: string | number;
110
+ requestId?: string;
111
+ routeRaw?: unknown;
112
+ status: "created" | "submitted" | "bridging" | "success" | "failed";
113
+ createdDate: Date | string;
114
+ updatedDate: Date | string;
115
+ };
116
+ type Transaction = {
117
+ id: string;
118
+ intentId: string;
119
+ fromAddress: string;
120
+ toAddress: string;
121
+ fromChainId: string | number;
122
+ toChainId: string | number;
123
+ sourceTxHash: string;
124
+ destTxHash: string;
125
+ requestId: string;
126
+ transactionRequest: unknown;
127
+ status: "submitted" | "bridging" | "success" | "failed";
128
+ statusRaw?: unknown;
129
+ routePath?: unknown;
130
+ routeStatus?: unknown;
131
+ toAmountWei?: string | number;
132
+ fromChainBlock: number;
133
+ toChainBlock: number;
134
+ fromChainTxUrl?: string;
135
+ toChainTxUrl?: string;
136
+ gasStatus?: string;
137
+ isGMPTransaction?: boolean;
138
+ axelarTransactionUrl?: string;
139
+ createdDate: Date | string;
140
+ updatedDate: Date | string;
141
+ timeSpentMs?: number;
142
+ };
143
+ type RouteEstimate = {
144
+ fromAmount?: string;
145
+ toAmount?: string;
146
+ toAmountMin?: string;
147
+ fromAmountUsd?: string;
148
+ toAmountUsd?: string;
149
+ totalFeesUsd?: string;
150
+ toAmountMinUsd?: string;
151
+ fees?: unknown[];
152
+ };
153
+ type RoutePlan = {
154
+ estimate?: RouteEstimate;
155
+ execution?: {
156
+ transaction?: TxRequest;
157
+ };
158
+ steps?: unknown[];
159
+ provider?: string;
160
+ requestId?: string;
161
+ reliabilityScore?: number;
162
+ diagnostics?: {
163
+ rawPayload?: unknown;
164
+ };
165
+ };
166
+ type BuildRouteResult = {
167
+ intentId: string;
168
+ txReq: TxRequest;
169
+ actions: unknown[];
170
+ finalExchangeRate: {
171
+ fromAmountUSD?: string;
172
+ toAmountMinUSD?: string;
173
+ };
174
+ route: RoutePlan | undefined;
175
+ };
176
+
177
+ type TrustwareEvent = {
178
+ type: "error";
179
+ error: TrustwareError;
180
+ } | {
181
+ type: "transaction_started";
182
+ } | {
183
+ type: "transaction_success";
184
+ txHash: string;
185
+ transaction?: Transaction;
186
+ } | {
187
+ type: "wallet_connected";
188
+ address: string;
189
+ };
190
+
191
+ /** WalletConnect configuration options (all optional - SDK has built-in defaults) */
192
+ type WalletConnectConfig = {
193
+ /** Override the built-in WalletConnect project ID (optional - SDK includes one) */
194
+ projectId?: string;
195
+ /** Chain IDs to support (defaults to [1] for Ethereum mainnet) */
196
+ chains?: number[];
197
+ /** Optional chain IDs (chains that can be switched to) */
198
+ optionalChains?: number[];
199
+ /** dApp metadata shown in wallet */
200
+ metadata?: {
201
+ name: string;
202
+ description?: string;
203
+ url: string;
204
+ icons?: string[];
205
+ };
206
+ /** Custom relay URL (defaults to WalletConnect's relay) */
207
+ relayUrl?: string;
208
+ /** Whether to show our custom QR modal (default: true) */
209
+ showQrModal?: boolean;
210
+ /** Disable WalletConnect entirely (default: false) */
211
+ disabled?: boolean;
212
+ };
213
+ /** Resolved WalletConnect config with defaults applied */
214
+ type ResolvedWalletConnectConfig = {
215
+ projectId: string;
216
+ chains: number[];
217
+ optionalChains: number[];
218
+ metadata: {
219
+ name: string;
220
+ description: string;
221
+ url: string;
222
+ icons: string[];
223
+ };
224
+ relayUrl?: string;
225
+ showQrModal: boolean;
226
+ };
227
+ type TrustwareConfigOptions = {
228
+ apiKey: string;
229
+ routes: {
230
+ toChain: string;
231
+ toToken: string;
232
+ fromToken?: string;
233
+ fromAddress?: string;
234
+ toAddress?: string;
235
+ defaultSlippage?: number;
236
+ routeType?: string;
237
+ options?: {
238
+ routeRefreshMs?: number;
239
+ fixedFromAmount?: string | number;
240
+ minAmountOut?: string | number;
241
+ maxAmountOut?: string | number;
242
+ };
243
+ };
244
+ autoDetectProvider?: boolean;
245
+ theme?: TrustwareWidgetTheme;
246
+ messages?: Partial<TrustwareWidgetMessages>;
247
+ retry?: RetryConfig;
248
+ walletConnect?: WalletConnectConfig;
249
+ onError?: (error: TrustwareError) => void;
250
+ onSuccess?: (transaction: Transaction) => void;
251
+ onEvent?: (event: TrustwareEvent) => void;
252
+ };
253
+ type ResolvedTrustwareConfig = {
254
+ apiKey: string;
255
+ routes: {
256
+ toChain: string;
257
+ toToken: string;
258
+ fromToken?: string;
259
+ fromAddress?: string;
260
+ toAddress?: string;
261
+ defaultSlippage: number;
262
+ routeType: string;
263
+ options: {
264
+ routeRefreshMs?: number;
265
+ fixedFromAmount?: string | number;
266
+ minAmountOut?: string | number;
267
+ maxAmountOut?: string | number;
268
+ };
269
+ };
270
+ autoDetectProvider: boolean;
271
+ theme: TrustwareWidgetTheme;
272
+ messages: TrustwareWidgetMessages;
273
+ retry: ResolvedRetryConfig;
274
+ walletConnect?: ResolvedWalletConnectConfig;
275
+ };
276
+ declare const DEFAULT_SLIPPAGE = 1;
277
+ declare const DEFAULT_AUTO_DETECT_PROVIDER = false;
278
+ type RateLimitInfo = {
279
+ /** Maximum requests allowed in the current window */
280
+ limit: number;
281
+ /** Requests remaining in the current window */
282
+ remaining: number;
283
+ /** Unix timestamp when the rate limit window resets */
284
+ reset: number;
285
+ /** Seconds until rate limit resets (only present on 429 responses) */
286
+ retryAfter?: number;
287
+ };
288
+ type RetryConfig = {
289
+ /** Enable automatic retry on 429 responses (default: true). Note: This does NOT disable backend rate limits, only client-side retry behavior. */
290
+ autoRetry?: boolean;
291
+ /** Maximum number of retries on 429 (default: 3) */
292
+ maxRetries?: number;
293
+ /** Base delay in ms for exponential backoff (default: 1000) */
294
+ baseDelayMs?: number;
295
+ /** Callback when rate limit info is received from server */
296
+ onRateLimitInfo?: (info: RateLimitInfo) => void;
297
+ /** Callback when rate limit is hit (429 received) */
298
+ onRateLimited?: (info: RateLimitInfo, retryCount: number) => void;
299
+ /** Callback when remaining requests fall below threshold */
300
+ onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;
301
+ /** Threshold for onRateLimitApproaching callback (default: 5) */
302
+ approachingThreshold?: number;
303
+ };
304
+ type ResolvedRetryConfig = {
305
+ autoRetry: boolean;
306
+ maxRetries: number;
307
+ baseDelayMs: number;
308
+ approachingThreshold: number;
309
+ onRateLimitInfo?: (info: RateLimitInfo) => void;
310
+ onRateLimited?: (info: RateLimitInfo, retryCount: number) => void;
311
+ onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;
312
+ };
313
+ declare const DEFAULT_RETRY_CONFIG: ResolvedRetryConfig;
314
+
315
+ type WalletId = "metamask" | "coinbase" | "walletconnect" | "rainbow" | "phantom-evm" | "rabby" | "brave" | "okx" | "zerion" | "taho" | "safe" | "imtoken" | "trust" | "bitget" | "kucoin";
316
+ type WalletCategory = "injected" | "walletconnect" | "app";
317
+ type WalletMeta = {
318
+ id: WalletId;
319
+ name: string;
320
+ category: WalletCategory;
321
+ logo: string;
322
+ emoji?: string;
323
+ homepage?: string;
324
+ chromeWebStore?: string;
325
+ android?: string;
326
+ ios?: string;
327
+ deepLink?: (currentUrl: string) => string;
328
+ detectFlags?: string[];
329
+ };
330
+ type EIP1193 = {
331
+ request(args: {
332
+ method: string;
333
+ params?: unknown[] | object;
334
+ }): Promise<unknown>;
335
+ };
336
+ type EIP6963ProviderDetail = {
337
+ info: {
338
+ uuid: string;
339
+ name: string;
340
+ icon: string;
341
+ rdns?: string;
342
+ version?: string;
343
+ wallets?: {
344
+ name: string;
345
+ version?: string;
346
+ }[];
347
+ features?: string[];
348
+ };
349
+ provider: any;
350
+ methods: string[];
351
+ events: string[];
352
+ };
353
+ type DetectedWallet = {
354
+ meta: WalletMeta;
355
+ via: "eip6963" | "injected-flag" | "walletconnect";
356
+ detail?: EIP6963ProviderDetail;
357
+ provider?: any;
358
+ };
359
+ type WalletInterFaceAPI = {
360
+ getAddress(): Promise<string>;
361
+ getChainId(): Promise<number>;
362
+ switchChain(chainId: number): Promise<void>;
363
+ } & ({
364
+ type: "eip1193";
365
+ request(args: {
366
+ method: string;
367
+ params?: unknown[] | object;
368
+ }): Promise<unknown>;
369
+ } | {
370
+ type: "wagmi";
371
+ sendTransaction(tx: {
372
+ to: `0x${string}`;
373
+ data: `0x${string}`;
374
+ value?: bigint;
375
+ chainId?: number;
376
+ }): Promise<{
377
+ hash: `0x${string}`;
378
+ }>;
379
+ });
380
+ type SimpleWalletInterface = {
381
+ getAddress(): Promise<string>;
382
+ getChainId(): Promise<number>;
383
+ switchChain(chainId: number): Promise<void>;
384
+ };
385
+
386
+ type ChainMeta = {
387
+ id: string;
388
+ networkIdentifier: string;
389
+ nativeCurrency: {
390
+ symbol: string;
391
+ decimals: number;
392
+ name: string;
393
+ };
394
+ };
395
+ type TokenMeta = {
396
+ chainId: string;
397
+ address: `0x${string}`;
398
+ symbol: string;
399
+ decimals: number;
400
+ visible?: boolean;
401
+ active?: boolean;
402
+ };
403
+ type BalanceRow = {
404
+ chain_key: string;
405
+ category: "native" | "erc20" | "spl" | "btc";
406
+ contract?: `0x${string}`;
407
+ symbol?: string;
408
+ decimals: number;
409
+ balance: string;
410
+ name?: string;
411
+ };
412
+ type WalletAddressBalanceWrapper = {
413
+ chain_id: string;
414
+ balances: BalanceRow[];
415
+ count: number;
416
+ error: string | null;
417
+ source: string;
418
+ };
419
+ type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
420
+ interface NativeCurrency {
421
+ symbol: string;
422
+ name?: string;
423
+ decimals?: number;
424
+ icon?: string;
425
+ }
426
+ interface ChainDef {
427
+ /** API commonly sends both. We canonicalize on chainId as string. */
428
+ chainId: string | number;
429
+ id?: string | number;
430
+ /** Keys we use to resolve chains from presets / user input */
431
+ networkIdentifier?: string;
432
+ axelarChainName?: string;
433
+ networkName?: string;
434
+ /** UI/availability flags */
435
+ enabled?: boolean;
436
+ visible?: boolean;
437
+ isTestnet?: boolean;
438
+ /** Display */
439
+ chainIconURI?: string;
440
+ nativeCurrency?: NativeCurrency;
441
+ /** Kinds (some payloads use both) */
442
+ type?: ChainType;
443
+ chainType?: ChainType;
444
+ /** Nice-to-have extras we won't rely on but keep for completeness */
445
+ blockExplorerUrls?: string[];
446
+ rpc?: string;
447
+ rpcList?: string[];
448
+ }
449
+ type TokenType = "evm" | "solana" | "btc" | string;
450
+ interface TokenDef {
451
+ /** Core identity */
452
+ address: string;
453
+ chainId: string | number;
454
+ /** Display */
455
+ logoURI?: string;
456
+ name: string;
457
+ symbol: string;
458
+ /** Behavior / filtering */
459
+ decimals: number;
460
+ active?: boolean;
461
+ visible?: boolean;
462
+ type: TokenType;
463
+ /** Optional metadata */
464
+ usdPrice?: number;
465
+ coingeckoId?: string;
466
+ createdBy?: string;
467
+ subGraphIds?: string[];
468
+ subGraphOnly?: boolean;
469
+ }
470
+ type TokenWithBalance = TokenDef & {
471
+ balance?: bigint;
472
+ };
473
+
474
+ /** Map chainId -> backend chain_key and return balances */
475
+ declare function getBalances(chainId: string | number, address: string): Promise<BalanceRow[]>;
476
+ declare function getBalancesByAddress(address: string): Promise<WalletAddressBalanceWrapper[]>;
477
+
478
+ declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number): Promise<`0x${string}`>;
479
+ /** One-shot flow that mirrors your old runTopUp */
480
+ declare function runTopUp(params: {
481
+ fromChain?: string;
482
+ toChain?: string;
483
+ fromToken?: string;
484
+ toToken?: string;
485
+ toAddress?: string;
486
+ fromAmount: string | number;
487
+ }): Promise<Transaction>;
488
+
489
+ interface UseChainsResult {
490
+ /** All available chains */
491
+ chains: ChainDef[];
492
+ /** Popular/featured chains (Ethereum, Polygon, Base) */
493
+ popularChains: ChainDef[];
494
+ /** Other chains (not in popular list) */
495
+ otherChains: ChainDef[];
496
+ /** Whether chains are currently loading */
497
+ isLoading: boolean;
498
+ /** Error message if loading failed */
499
+ error: string | null;
500
+ chainMap: Map<string, ChainDef>;
501
+ }
502
+ /**
503
+ * Hook to load available chains from the registry.
504
+ * Returns chains split into popular and other categories.
505
+ */
506
+ declare function useChains(): UseChainsResult;
507
+
508
+ /**
509
+ * Navigation states for the deposit widget flow
510
+ */
511
+ type NavigationStep = "home" | "select-token" | "crypto-pay" | "processing" | "success" | "error";
512
+ /**
513
+ * Token information for deposit selection
514
+ */
515
+ interface Token {
516
+ /** Token contract address (or 'native' for native tokens) */
517
+ address: string;
518
+ /** Token symbol (e.g., 'USDC', 'ETH') */
519
+ symbol: string;
520
+ /** Token display name (e.g., 'USD Coin', 'Ethereum') */
521
+ name: string;
522
+ /** Number of decimals for the token */
523
+ decimals: number;
524
+ /** URL to token icon/logo */
525
+ iconUrl?: string;
526
+ logoURI?: string;
527
+ /** Raw smallest-unit balance string (e.g. wei/lamports) when wallet connected */
528
+ balance?: string;
529
+ chainId: string | number;
530
+ usdPrice: number | undefined;
531
+ }
532
+
533
+ interface UseTokensResult {
534
+ /** All available tokens for the selected chain */
535
+ tokens: Token[];
536
+ /** Filtered tokens based on search query */
537
+ filteredTokens: Token[];
538
+ /** Whether tokens are currently loading */
539
+ isLoading: boolean;
540
+ /** Error message if loading failed */
541
+ error: string | null;
542
+ /** Current search query */
543
+ searchQuery: string;
544
+ /** Set the search query to filter tokens */
545
+ setSearchQuery: (query: string) => void;
546
+ }
547
+ /**
548
+ * Hook to load available tokens for a selected chain from the registry.
549
+ * Supports filtering tokens by name or symbol.
550
+ */
551
+ declare function useTokens(chainId: number | null | undefined): UseTokensResult;
552
+
553
+ declare const Trustware: {
554
+ /** Initialize config */
555
+ init(cfg: TrustwareConfigOptions): Promise</*elided*/ any>;
556
+ /** Attach a wallet interface directly (skips detection) */
557
+ useWallet(w: WalletInterFaceAPI): /*elided*/ any;
558
+ /** Best-effort background attach to detected wallet(s) (detection hook should be running in the app) */
559
+ autoDetect(_timeoutMs?: number): Promise<boolean>;
560
+ /** Read resolved config */
561
+ getConfig(): ResolvedTrustwareConfig;
562
+ setDestinationAddress(address?: string | null): /*elided*/ any;
563
+ /** Read active wallet */
564
+ getWallet(): WalletInterFaceAPI | null;
565
+ /** Simple helpers */
566
+ getAddress(): Promise<string>;
567
+ buildRoute: typeof buildRoute;
568
+ submitReceipt: typeof submitReceipt;
569
+ getStatus: typeof getStatus;
570
+ pollStatus: typeof pollStatus;
571
+ getBalances: typeof getBalances;
572
+ getBalancesByAddress: typeof getBalancesByAddress;
573
+ useChains: typeof useChains;
574
+ useTokens: typeof useTokens;
575
+ sendRouteTransaction: typeof sendRouteTransaction;
576
+ runTopUp: typeof runTopUp;
577
+ };
578
+ type TrustwareCore = typeof Trustware;
579
+
580
+ declare class RateLimitError extends Error {
581
+ readonly rateLimitInfo: RateLimitInfo;
582
+ readonly retriesExhausted: boolean;
583
+ constructor(info: RateLimitInfo, retriesExhausted: boolean);
584
+ }
585
+
586
+ type WagmiConnector = {
587
+ /** Human label like "MetaMask", "WalletConnect" */
588
+ name: string;
589
+ /** Free-form type hint: "injected" | "walletConnect" | ... */
590
+ type?: string;
591
+ };
592
+ type WagmiBridge = {
593
+ /** Host app believes it’s connected (Wagmi state) */
594
+ isConnected(): boolean;
595
+ /** List of available connectors */
596
+ connectors(): WagmiConnector[];
597
+ /** Try connecting via a specific connector */
598
+ connect(connector: WagmiConnector): Promise<void>;
599
+ /** Disconnect current session */
600
+ disconnect(): Promise<void>;
601
+ };
602
+
603
+ /** Try wagmi bridge first (if provided), otherwise return EIP-1193 adapter. */
604
+ declare function connectDetectedWallet(dw: DetectedWallet, opts?: {
605
+ wagmi?: WagmiBridge;
606
+ touchAddress?: boolean;
607
+ }): Promise<{
608
+ via: "wagmi" | "eip1193" | "walletconnect";
609
+ api: WalletInterFaceAPI | null;
610
+ }>;
611
+
612
+ /** If you’re in React, call this once near your widget to push detection results into the manager. */
613
+ declare function useWireDetectionIntoManager(): void;
614
+
615
+ declare function useEIP1193(eth: EIP1193): WalletInterFaceAPI;
616
+ declare function useWagmi(client: any): WalletInterFaceAPI;
617
+
618
+ declare function toWalletInterfaceFromDetected(dw: DetectedWallet): WalletInterFaceAPI;
619
+
620
+ declare function useWalletDetection(timeoutMs?: number): {
621
+ detected: DetectedWallet[];
622
+ detectedIds: Set<WalletId>;
623
+ };
624
+
625
+ type Theme = "light" | "dark" | "system";
626
+
627
+ /**
628
+ * Ref methods exposed by TrustwareWidgetV2
629
+ */
630
+ interface TrustwareWidgetV2Ref {
631
+ /** Open the widget */
632
+ open: () => void;
633
+ /** Close the widget (shows confirmation if transaction active) */
634
+ close: () => void;
635
+ /** Check if widget is currently open */
636
+ isOpen: () => boolean;
637
+ }
638
+ interface TrustwareWidgetV2Props {
639
+ /** Widget theme - light, dark, or system preference (used as initial theme) */
640
+ theme?: Theme;
641
+ /** Additional inline styles */
642
+ style?: React.CSSProperties;
643
+ /** Initial navigation step (defaults to 'home') */
644
+ initialStep?: NavigationStep;
645
+ /** Whether the widget is initially open (defaults to true for inline usage) */
646
+ defaultOpen?: boolean;
647
+ /** Callback when the widget is closed */
648
+ onClose?: () => void;
649
+ /** Callback when the widget is opened */
650
+ onOpen?: () => void;
651
+ /** Whether to show the theme toggle button (defaults to true) */
652
+ showThemeToggle?: boolean;
653
+ }
654
+ /**
655
+ * TrustwareWidgetV2 - Main widget component for deposit flow.
656
+ *
657
+ * Provides a complete deposit experience with:
658
+ * - Page navigation based on state machine
659
+ * - Animated transitions between pages
660
+ * - Theme support (light/dark/system)
661
+ * - Context-based state management
662
+ * - Programmatic open/close API via ref
663
+ * - State persistence in sessionStorage
664
+ *
665
+ * @example
666
+ * ```tsx
667
+ * // Basic inline usage
668
+ * <TrustwareWidgetV2 theme="dark" />
669
+ *
670
+ * // With ref for programmatic control
671
+ * const widgetRef = useRef<TrustwareWidgetV2Ref>(null);
672
+ *
673
+ * <TrustwareWidgetV2
674
+ * ref={widgetRef}
675
+ * defaultOpen={false}
676
+ * onClose={() => console.log('Widget closed')}
677
+ * onOpen={() => console.log('Widget opened')}
678
+ * />
679
+ *
680
+ * // Open/close programmatically
681
+ * widgetRef.current?.open();
682
+ * widgetRef.current?.close();
683
+ * ```
684
+ */
685
+ declare const TrustwareWidgetV2: React.ForwardRefExoticComponent<TrustwareWidgetV2Props & React.RefAttributes<TrustwareWidgetV2Ref>>;
686
+
687
+ type Status = "idle" | "initializing" | "ready" | "error";
688
+ type Ctx = {
689
+ status: Status;
690
+ errors?: string;
691
+ core: typeof Trustware;
692
+ emitError?: (error: TrustwareError) => void;
693
+ emitSuccess?: (transaction: Transaction) => void;
694
+ emitEvent?: (event: TrustwareEvent) => void;
695
+ };
696
+ declare const Ctx: React.Context<Ctx>;
697
+ declare function TrustwareProvider({ config, wallet, autoDetect, children, }: {
698
+ config: TrustwareConfigOptions;
699
+ wallet?: WalletInterFaceAPI;
700
+ autoDetect?: boolean;
701
+ children: React.ReactNode;
702
+ }): react_jsx_runtime.JSX.Element;
703
+ declare function useTrustware(): Ctx;
704
+
705
+ export { type BalanceRow, type BuildRouteResult, type ChainDef, type ChainMeta, type ChainType, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_MESSAGES, DEFAULT_RETRY_CONFIG, DEFAULT_SLIPPAGE, DEFAULT_THEME, type DetectedWallet, type EIP1193, type EIP6963ProviderDetail, type NativeCurrency, RateLimitError, type RateLimitInfo, type ResolvedRetryConfig, type ResolvedTrustwareConfig, type ResolvedWalletConnectConfig, type RetryConfig, type RouteEstimate, type RouteIntent, type RouteParams, type RoutePlan, type SimpleWalletInterface, type TokenDef, type TokenMeta, type TokenType, type TokenWithBalance, type Transaction, Trustware, type TrustwareConfigOptions, type TrustwareCore, TrustwareError, TrustwareProvider, TrustwareWidgetV2 as TrustwareWidget, type TrustwareWidgetMessages, type TrustwareWidgetTheme, type WagmiBridge, type WagmiConnector, type WalletAddressBalanceWrapper, type WalletCategory, type WalletConnectConfig, type WalletId, type WalletInterFaceAPI, type WalletMeta, connectDetectedWallet, toWalletInterfaceFromDetected, useEIP1193, useTrustware, useWagmi, useWalletDetection, useWireDetectionIntoManager };