@rash2x/bridge-widget 0.5.8 → 0.6.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.
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;
@@ -653,6 +728,32 @@ export declare type TxStatus = "success" | "failed" | "timeout";
653
728
 
654
729
  declare type TxStatus_2 = "idle" | "pending" | "executing" | "processing" | "completed" | "failed" | "expired";
655
730
 
731
+ /**
732
+ * Hook to access all bridge transaction data
733
+ *
734
+ * This hook provides a unified interface to access all relevant bridge data
735
+ * including tokens, networks, fees, amounts, and routing information.
736
+ *
737
+ * @returns BridgeData object with all bridge information
738
+ *
739
+ * @example
740
+ * ```tsx
741
+ * function MyComponent() {
742
+ * const bridgeData = useBridgeData();
743
+ *
744
+ * if (bridgeData.isReady) {
745
+ * console.log('Token:', bridgeData.token?.symbol);
746
+ * console.log('From:', bridgeData.sourceNetwork?.name);
747
+ * console.log('To:', bridgeData.destinationNetwork?.name);
748
+ * console.log('Gateway:', bridgeData.gateway?.route);
749
+ * console.log('Total fee:', bridgeData.fees?.total.usd);
750
+ * console.log('ETA:', bridgeData.estimatedTime?.formatted);
751
+ * }
752
+ * }
753
+ * ```
754
+ */
755
+ export declare function useBridgeData(): BridgeData;
756
+
656
757
  export declare const useBridgeQuoteStore: UseBoundStore<StoreApi<BridgeQuoteStore>>;
657
758
 
658
759
  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.8",
3
+ "version": "0.6.0",
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",