@rash2x/bridge-widget 0.5.9 → 0.6.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 CHANGED
@@ -37,6 +37,81 @@ export declare type BalancesMap = Record<string, {
37
37
  address: string;
38
38
  }>;
39
39
 
40
+ /**
41
+ * Bridge data interface exposing all relevant transaction information
42
+ * for external consumption
43
+ */
44
+ export declare interface BridgeData {
45
+ token: {
46
+ symbol: string;
47
+ address: string;
48
+ decimals: number;
49
+ name: string;
50
+ iconUrl: string;
51
+ } | null;
52
+ sourceNetwork: {
53
+ chainKey: string;
54
+ name: string;
55
+ chainId: number;
56
+ chainType: string;
57
+ iconUrl: string;
58
+ } | null;
59
+ destinationNetwork: {
60
+ chainKey: string;
61
+ name: string;
62
+ chainId: number;
63
+ chainType: string;
64
+ iconUrl: string;
65
+ } | null;
66
+ gateway: {
67
+ route: string;
68
+ routeType: RouteType;
69
+ } | null;
70
+ amounts: {
71
+ input: string;
72
+ inputHuman: number;
73
+ output: string;
74
+ outputHuman: number;
75
+ outputRounded: string;
76
+ minimumReceived: number;
77
+ } | null;
78
+ fees: {
79
+ source: {
80
+ amount: number;
81
+ symbol: string;
82
+ usd: number;
83
+ } | null;
84
+ destination: {
85
+ amount: number;
86
+ symbol: string;
87
+ usd: number;
88
+ } | null;
89
+ protocol: {
90
+ usd: number;
91
+ } | null;
92
+ message: {
93
+ usd: number;
94
+ } | null;
95
+ service: {
96
+ usd: number;
97
+ } | null;
98
+ blockchain: {
99
+ usd: number;
100
+ } | null;
101
+ total: {
102
+ usd: number;
103
+ };
104
+ } | null;
105
+ estimatedTime: {
106
+ seconds: number;
107
+ formatted: string;
108
+ } | null;
109
+ status: "idle" | "loading" | "success" | "error";
110
+ isReady: boolean;
111
+ error?: string;
112
+ noRoute: boolean;
113
+ }
114
+
40
115
  declare interface BridgeQuoteActions {
41
116
  setInputAmount: (v: string) => void;
42
117
  setLoading: () => void;
@@ -226,6 +301,7 @@ export declare interface EvaaBridgeProps {
226
301
  onSwapError?: (error: SwapErrorData) => void;
227
302
  onAmountChange?: (amount: string) => void;
228
303
  onChainChange?: (data: ChainChangeData) => void;
304
+ onBridgeDataUpdate?: (data: BridgeData) => void;
229
305
  }
230
306
 
231
307
  declare interface EvmMonitorReceipt {
@@ -653,6 +729,32 @@ export declare type TxStatus = "success" | "failed" | "timeout";
653
729
 
654
730
  declare type TxStatus_2 = "idle" | "pending" | "executing" | "processing" | "completed" | "failed" | "expired";
655
731
 
732
+ /**
733
+ * Hook to access all bridge transaction data
734
+ *
735
+ * This hook provides a unified interface to access all relevant bridge data
736
+ * including tokens, networks, fees, amounts, and routing information.
737
+ *
738
+ * @returns BridgeData object with all bridge information
739
+ *
740
+ * @example
741
+ * ```tsx
742
+ * function MyComponent() {
743
+ * const bridgeData = useBridgeData();
744
+ *
745
+ * if (bridgeData.isReady) {
746
+ * console.log('Token:', bridgeData.token?.symbol);
747
+ * console.log('From:', bridgeData.sourceNetwork?.name);
748
+ * console.log('To:', bridgeData.destinationNetwork?.name);
749
+ * console.log('Gateway:', bridgeData.gateway?.route);
750
+ * console.log('Total fee:', bridgeData.fees?.total.usd);
751
+ * console.log('ETA:', bridgeData.estimatedTime?.formatted);
752
+ * }
753
+ * }
754
+ * ```
755
+ */
756
+ export declare function useBridgeData(): BridgeData;
757
+
656
758
  export declare const useBridgeQuoteStore: UseBoundStore<StoreApi<BridgeQuoteStore>>;
657
759
 
658
760
  export declare const useChainsStore: UseBoundStore<Omit<StoreApi<ChainStoreType>, "setState" | "persist"> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rash2x/bridge-widget",
3
- "version": "0.5.9",
3
+ "version": "0.6.1",
4
4
  "description": "Cross-chain bridge widget powered by Stargate Protocol with multi-chain wallet support",
5
5
  "type": "module",
6
6
  "main": "./dist/evaa-bridge.cjs",