@rash2x/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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 EVAA Finance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,307 @@
1
+ # EVAA Bridge Widget
2
+
3
+ A production-ready cross-chain bridge widget powered by Stargate Protocol with comprehensive multi-chain wallet support (Ethereum, TON, Tron).
4
+
5
+ ![npm version](https://img.shields.io/npm/v/@evaa/bridge-widget)
6
+ ![license](https://img.shields.io/npm/l/@evaa/bridge-widget)
7
+
8
+ ## Features
9
+
10
+ - 🔗 **Multi-Chain Support**: Ethereum, TON, Tron, and other EVM chains
11
+ - 🦊 **Wallet Integration**: MetaMask, TonConnect, TronLink, WalletConnect
12
+ - 💱 **Real-time Quotes**: Get instant cross-chain swap quotes via Stargate Protocol
13
+ - ⚡ **Transaction Management**: Built-in transaction monitoring and status tracking
14
+ - 📊 **Balance Tracking**: Real-time wallet balance updates
15
+ - 🎨 **Themeable**: Light/dark mode with customizable styling
16
+ - 🌐 **i18n**: Built-in internationalization (EN/RU, easily extensible)
17
+ - 📱 **Responsive**: Mobile-friendly design
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @evaa/bridge-widget
23
+ # or
24
+ yarn add @evaa/bridge-widget
25
+ # or
26
+ pnpm add @evaa/bridge-widget
27
+ ```
28
+
29
+ ### Peer Dependencies
30
+
31
+ Install required peer dependencies:
32
+
33
+ ```bash
34
+ npm install react react-dom @tanstack/react-query
35
+ ```
36
+
37
+ For specific chain support, install additional peer dependencies:
38
+
39
+ ```bash
40
+ # For Ethereum/EVM chains
41
+ npm install wagmi ethers connectkit
42
+
43
+ # For TON
44
+ npm install @tonconnect/ui-react @ton/core @ton/crypto @ton/ton
45
+
46
+ # For Tron
47
+ npm install @tronweb3/tronwallet-adapter-react-hooks @tronweb3/tronwallet-adapters tronweb
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ### 1. Basic Setup
53
+
54
+ ```tsx
55
+ import { EvaaBridge } from '@evaa/bridge-widget';
56
+ import '@evaa/bridge-widget/styles.css';
57
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
58
+ import { WagmiProvider } from 'wagmi';
59
+ import { TonConnectUIProvider } from '@tonconnect/ui-react';
60
+ import { WalletProvider } from '@tronweb3/tronwallet-adapter-react-hooks';
61
+ import { TronLinkAdapter } from '@tronweb3/tronwallet-adapters';
62
+ import { useMemo } from 'react';
63
+
64
+ const queryClient = new QueryClient();
65
+
66
+ function App() {
67
+ // Configure Tron wallet adapters
68
+ const tronAdapters = useMemo(() => [new TronLinkAdapter()], []);
69
+
70
+ return (
71
+ <QueryClientProvider client={queryClient}>
72
+ <WagmiProvider config={wagmiConfig}>
73
+ <TonConnectUIProvider manifestUrl="https://your-app.com/tonconnect-manifest.json">
74
+ <WalletProvider adapters={tronAdapters}>
75
+ <EvaaBridge />
76
+ </WalletProvider>
77
+ </TonConnectUIProvider>
78
+ </WagmiProvider>
79
+ </QueryClientProvider>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ### 2. With Event Handlers
85
+
86
+ ```tsx
87
+ <EvaaBridge
88
+ onSwapSuccess={(data) => {
89
+ console.log('Swap completed:', data);
90
+ }}
91
+ onSwapError={(error) => {
92
+ console.error('Swap failed:', error);
93
+ }}
94
+ onInitialized={() => {
95
+ console.log('Bridge initialized');
96
+ }}
97
+ onAmountChange={(amount) => {
98
+ console.log('Amount changed:', amount);
99
+ }}
100
+ onChainChange={(data) => {
101
+ console.log('Chain changed:', data);
102
+ }}
103
+ />
104
+ ```
105
+
106
+ ## Props
107
+
108
+ ### EvaaBridgeProps
109
+
110
+ | Prop | Type | Description |
111
+ |------|------|-------------|
112
+ | `className` | `string` | Optional CSS class for custom styling |
113
+ | `theme` | `'light' \| 'dark'` | Theme mode |
114
+ | `onInitialized` | `() => void` | Callback when bridge is initialized |
115
+ | `onSwapStart` | `(data: SwapStartData) => void` | Callback when swap starts |
116
+ | `onSwapSuccess` | `(data: SwapSuccessData) => void` | Callback when swap succeeds |
117
+ | `onSwapError` | `(error: SwapErrorData) => void` | Callback when swap fails |
118
+ | `onAmountChange` | `(amount: string) => void` | Callback when amount changes |
119
+ | `onChainChange` | `(data: ChainChangeData) => void` | Callback when chain changes |
120
+
121
+ ## Configuration
122
+
123
+ ### Wagmi Config (for EVM chains)
124
+
125
+ ```tsx
126
+ import { createConfig } from 'wagmi';
127
+ import { getDefaultConfig } from 'connectkit';
128
+ import { mainnet, arbitrum, polygon, base, bsc } from 'wagmi/chains';
129
+
130
+ const wagmiConfig = createConfig(
131
+ getDefaultConfig({
132
+ appName: 'Your App Name',
133
+ walletConnectProjectId: 'YOUR_PROJECT_ID',
134
+ chains: [mainnet, arbitrum, polygon, base, bsc],
135
+ })
136
+ );
137
+ ```
138
+
139
+ ### TonConnect Manifest
140
+
141
+ Create a `tonconnect-manifest.json` file:
142
+
143
+ ```json
144
+ {
145
+ "url": "https://your-app.com",
146
+ "name": "Your App Name",
147
+ "iconUrl": "https://your-app.com/icon.png"
148
+ }
149
+ ```
150
+
151
+ ### Tron Wallet Adapters
152
+
153
+ Configure Tron wallet adapters using the official `@tronweb3/tronwallet-adapter-react-hooks`:
154
+
155
+ ```tsx
156
+ import { WalletProvider } from '@tronweb3/tronwallet-adapter-react-hooks';
157
+ import { TronLinkAdapter } from '@tronweb3/tronwallet-adapters';
158
+ import { useMemo } from 'react';
159
+
160
+ function App() {
161
+ const tronAdapters = useMemo(() => [
162
+ new TronLinkAdapter(),
163
+ // You can add other adapters here
164
+ ], []);
165
+
166
+ return (
167
+ <WalletProvider adapters={tronAdapters}>
168
+ {/* Your app */}
169
+ </WalletProvider>
170
+ );
171
+ }
172
+ ```
173
+
174
+ ## Styling
175
+
176
+ The widget uses Tailwind CSS. Make sure your project has Tailwind configured, or the styles will not work correctly.
177
+
178
+ ### Tailwind Configuration
179
+
180
+ ```js
181
+ // tailwind.config.js
182
+ module.exports = {
183
+ content: [
184
+ './src/**/*.{js,ts,jsx,tsx}',
185
+ './node_modules/@evaa/bridge-widget/**/*.{js,mjs}',
186
+ ],
187
+ // ... rest of your config
188
+ };
189
+ ```
190
+
191
+ ### Custom Theme
192
+
193
+ You can customize the theme by overriding CSS variables:
194
+
195
+ ```css
196
+ :root {
197
+ --primary: #your-color;
198
+ --background: #your-color;
199
+ /* ... other variables */
200
+ }
201
+
202
+ [data-theme="dark"] {
203
+ --primary: #your-dark-color;
204
+ /* ... other variables */
205
+ }
206
+ ```
207
+
208
+ ## Advanced Usage
209
+
210
+ ### Using Stores Directly
211
+
212
+ ```tsx
213
+ import {
214
+ useChainsStore,
215
+ useTokensStore,
216
+ useBridgeQuoteStore
217
+ } from '@evaa/bridge-widget';
218
+
219
+ function YourComponent() {
220
+ const { chains } = useChainsStore();
221
+ const { tokens } = useTokensStore();
222
+ const { quote } = useBridgeQuoteStore();
223
+
224
+ // Your logic here
225
+ }
226
+ ```
227
+
228
+ ### Type Exports
229
+
230
+ ```tsx
231
+ import type {
232
+ Chain,
233
+ Token,
234
+ Quote,
235
+ EvaaBridgeProps,
236
+ SwapSuccessData
237
+ } from '@evaa/bridge-widget';
238
+ ```
239
+
240
+ ## Supported Chains
241
+
242
+ - Ethereum (Mainnet)
243
+ - Arbitrum
244
+ - Polygon
245
+ - Base
246
+ - BNB Chain
247
+ - TON (The Open Network)
248
+ - Tron
249
+
250
+ ## API Integration
251
+
252
+ The widget integrates with Stargate Protocol API for:
253
+ - Cross-chain token swaps
254
+ - Real-time quotes
255
+ - Transaction routing
256
+ - Fee estimation
257
+
258
+ ## TypeScript
259
+
260
+ The package is written in TypeScript and includes full type definitions.
261
+
262
+ ```tsx
263
+ import type { EvaaBridgeProps, Chain, Token } from '@evaa/bridge-widget';
264
+ ```
265
+
266
+ ## Browser Support
267
+
268
+ - Chrome (latest)
269
+ - Firefox (latest)
270
+ - Safari (latest)
271
+ - Edge (latest)
272
+
273
+ ## Development
274
+
275
+ ```bash
276
+ # Install dependencies
277
+ npm install
278
+
279
+ # Run development server
280
+ npm run dev
281
+
282
+ # Build library
283
+ npm run build:lib
284
+
285
+ # Lint
286
+ npm run lint
287
+ ```
288
+
289
+ ## Contributing
290
+
291
+ Contributions are welcome! Please open an issue or submit a pull request.
292
+
293
+ ## License
294
+
295
+ MIT © EVAA Finance
296
+
297
+ ## Links
298
+
299
+ - [GitHub Repository](https://github.com/evaa-finance/bridge-widget)
300
+ - [Stargate Protocol](https://stargate.finance)
301
+ - [EVAA Finance](https://evaa.finance)
302
+
303
+ ## Support
304
+
305
+ For issues and questions:
306
+ - GitHub Issues: https://github.com/evaa-finance/bridge-widget/issues
307
+ - Email: support@evaa.finance
@@ -0,0 +1,81 @@
1
+ /* fonts.css */
2
+ @font-face {
3
+ font-family: 'Gilroy';
4
+ src: url('/assets/fonts/Gilroy-Thin.ttf') format('truetype');
5
+ font-style: normal;
6
+ font-weight: 100;
7
+ font-display: swap;
8
+ }
9
+ @font-face {
10
+ font-family: 'Gilroy';
11
+ src: url('/assets/fonts/Gilroy-UltraLight.ttf') format('truetype');
12
+ font-style: normal;
13
+ font-weight: 200;
14
+ font-display: swap;
15
+ }
16
+ @font-face {
17
+ font-family: 'Gilroy';
18
+ src: url('/assets/fonts/Gilroy-Light.ttf') format('truetype');
19
+ font-style: normal;
20
+ font-weight: 300;
21
+ font-display: swap;
22
+ }
23
+ @font-face {
24
+ font-family: 'Gilroy';
25
+ src: url('/assets/fonts/Gilroy-Regular.ttf') format('truetype');
26
+ font-style: normal;
27
+ font-weight: 400;
28
+ font-display: swap;
29
+ }
30
+ @font-face {
31
+ font-family: 'Gilroy';
32
+ src: url('/assets/fonts/Gilroy-Medium.ttf') format('truetype');
33
+ font-style: normal;
34
+ font-weight: 500;
35
+ font-display: swap;
36
+ }
37
+ @font-face {
38
+ font-family: 'Gilroy';
39
+ src: url('/assets/fonts/Gilroy-SemiBold.ttf') format('truetype');
40
+ font-style: normal;
41
+ font-weight: 600;
42
+ font-display: swap;
43
+ }
44
+ @font-face {
45
+ font-family: 'Gilroy';
46
+ src: url('/assets/fonts/Gilroy-Bold.ttf') format('truetype');
47
+ font-style: normal;
48
+ font-weight: 700;
49
+ font-display: swap;
50
+ }
51
+ @font-face {
52
+ font-family: 'Gilroy';
53
+ src: url('/assets/fonts/Gilroy-ExtraBold.ttf') format('truetype');
54
+ font-style: normal;
55
+ font-weight: 800;
56
+ font-display: swap;
57
+ }
58
+ @font-face {
59
+ font-family: 'Gilroy';
60
+ src: url('/assets/fonts/Gilroy-Black.ttf') format('truetype');
61
+ font-style: normal;
62
+ font-weight: 900;
63
+ font-display: swap;
64
+ }
65
+ @font-face {
66
+ font-family: 'Gilroy';
67
+ src: url('/assets/fonts/Gilroy-Heavy.ttf') format('truetype');
68
+ font-style: normal;
69
+ font-weight: 900;
70
+ font-display: swap;
71
+ }
72
+
73
+
74
+ @font-face {
75
+ font-family: 'Hanson';
76
+ src:
77
+ url(/assets/fonts/hanson-bold.woff2) format('woff2'),
78
+ url(/assets/fonts/hanson-bold.woff) format('woff');
79
+ font-style: normal;
80
+ font-weight: 700;
81
+ }