@rash2x/bridge-widget 0.2.10 → 0.2.11

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/README.md CHANGED
@@ -60,6 +60,7 @@ npx shadcn@latest add accordion button card dialog input skeleton switch tooltip
60
60
  ```
61
61
 
62
62
  **Important:** Your project must have the following path aliases configured:
63
+
63
64
  - `@/components/ui` - for UI components
64
65
  - `@/lib/utils` - for the `cn` utility function
65
66
 
@@ -70,19 +71,18 @@ For detailed setup instructions, see [SHADCN_COMPONENTS.md](./SHADCN_COMPONENTS.
70
71
  ### 1. Basic Setup
71
72
 
72
73
  ```tsx
73
- import { EvaaBridge } from '@evaa/bridge-widget';
74
- import '@evaa/bridge-widget/styles.css';
75
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
76
- import { WagmiProvider } from 'wagmi';
77
- import { TonConnectUIProvider } from '@tonconnect/ui-react';
78
- import { WalletProvider } from '@tronweb3/tronwallet-adapter-react-hooks';
79
- import { TronLinkAdapter } from '@tronweb3/tronwallet-adapters';
80
- import { useMemo } from 'react';
74
+ import { EvaaBridge } from "@evaa/bridge-widget";
75
+ import "@evaa/bridge-widget/styles.css";
76
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
77
+ import { WagmiProvider } from "wagmi";
78
+ import { TonConnectUIProvider } from "@tonconnect/ui-react";
79
+ import { WalletProvider } from "@tronweb3/tronwallet-adapter-react-hooks";
80
+ import { TronLinkAdapter } from "@tronweb3/tronwallet-adapters";
81
+ import { useMemo } from "react";
81
82
 
82
83
  const queryClient = new QueryClient();
83
84
 
84
85
  function App() {
85
- // Configure Tron wallet adapters
86
86
  const tronAdapters = useMemo(() => [new TronLinkAdapter()], []);
87
87
 
88
88
  return (
@@ -105,19 +105,19 @@ function App() {
105
105
  <EvaaBridge
106
106
  defaultLanguage="ru" // Set default language (en, ru)
107
107
  onSwapSuccess={(data) => {
108
- console.log('Swap completed:', data);
108
+ console.log("Swap completed:", data);
109
109
  }}
110
110
  onSwapError={(error) => {
111
- console.error('Swap failed:', error);
111
+ console.error("Swap failed:", error);
112
112
  }}
113
113
  onInitialized={() => {
114
- console.log('Bridge initialized');
114
+ console.log("Bridge initialized");
115
115
  }}
116
116
  onAmountChange={(amount) => {
117
- console.log('Amount changed:', amount);
117
+ console.log("Amount changed:", amount);
118
118
  }}
119
119
  onChainChange={(data) => {
120
- console.log('Chain changed:', data);
120
+ console.log("Chain changed:", data);
121
121
  }}
122
122
  />
123
123
  ```
@@ -126,32 +126,32 @@ function App() {
126
126
 
127
127
  ### EvaaBridgeProps
128
128
 
129
- | Prop | Type | Description |
130
- |------|------|-------------|
131
- | `className` | `string` | Optional CSS class for custom styling |
132
- | `defaultLanguage` | `string` | Language for the widget UI (default: `'en'`). Supported: `'en'`, `'ru'` |
133
- | `tonClient` | `TonClient` | Optional TON client instance |
134
- | `tonApiKey` | `string` | Optional TON API key |
135
- | `onInitialized` | `() => void` | Callback when bridge is initialized |
136
- | `onSwapStart` | `(data: SwapStartData) => void` | Callback when swap starts |
137
- | `onSwapSuccess` | `(data: SwapSuccessData) => void` | Callback when swap succeeds |
138
- | `onSwapError` | `(error: SwapErrorData) => void` | Callback when swap fails |
139
- | `onAmountChange` | `(amount: string) => void` | Callback when amount changes |
140
- | `onChainChange` | `(data: ChainChangeData) => void` | Callback when chain changes |
129
+ | Prop | Type | Description |
130
+ | ----------------- | --------------------------------- | ----------------------------------------------------------------------- |
131
+ | `className` | `string` | Optional CSS class for custom styling |
132
+ | `defaultLanguage` | `string` | Language for the widget UI (default: `'en'`). Supported: `'en'`, `'ru'` |
133
+ | `tonClient` | `TonClient` | Optional TON client instance |
134
+ | `tonApiKey` | `string` | Optional TON API key |
135
+ | `onInitialized` | `() => void` | Callback when bridge is initialized |
136
+ | `onSwapStart` | `(data: SwapStartData) => void` | Callback when swap starts |
137
+ | `onSwapSuccess` | `(data: SwapSuccessData) => void` | Callback when swap succeeds |
138
+ | `onSwapError` | `(error: SwapErrorData) => void` | Callback when swap fails |
139
+ | `onAmountChange` | `(amount: string) => void` | Callback when amount changes |
140
+ | `onChainChange` | `(data: ChainChangeData) => void` | Callback when chain changes |
141
141
 
142
142
  ## Configuration
143
143
 
144
144
  ### Wagmi Config (for EVM chains)
145
145
 
146
146
  ```tsx
147
- import { createConfig } from 'wagmi';
148
- import { getDefaultConfig } from 'connectkit';
149
- import { mainnet, arbitrum, polygon, base, bsc } from 'wagmi/chains';
147
+ import { createConfig } from "wagmi";
148
+ import { getDefaultConfig } from "connectkit";
149
+ import { mainnet, arbitrum, polygon, base, bsc } from "wagmi/chains";
150
150
 
151
151
  const wagmiConfig = createConfig(
152
152
  getDefaultConfig({
153
- appName: 'Your App Name',
154
- walletConnectProjectId: 'YOUR_PROJECT_ID',
153
+ appName: "Your App Name",
154
+ walletConnectProjectId: "YOUR_PROJECT_ID",
155
155
  chains: [mainnet, arbitrum, polygon, base, bsc],
156
156
  })
157
157
  );
@@ -174,20 +174,21 @@ Create a `tonconnect-manifest.json` file:
174
174
  Configure Tron wallet adapters using the official `@tronweb3/tronwallet-adapter-react-hooks`:
175
175
 
176
176
  ```tsx
177
- import { WalletProvider } from '@tronweb3/tronwallet-adapter-react-hooks';
178
- import { TronLinkAdapter } from '@tronweb3/tronwallet-adapters';
179
- import { useMemo } from 'react';
177
+ import { WalletProvider } from "@tronweb3/tronwallet-adapter-react-hooks";
178
+ import { TronLinkAdapter } from "@tronweb3/tronwallet-adapters";
179
+ import { useMemo } from "react";
180
180
 
181
181
  function App() {
182
- const tronAdapters = useMemo(() => [
183
- new TronLinkAdapter(),
184
- // You can add other adapters here
185
- ], []);
182
+ const tronAdapters = useMemo(
183
+ () => [
184
+ new TronLinkAdapter(),
185
+ // You can add other adapters here
186
+ ],
187
+ []
188
+ );
186
189
 
187
190
  return (
188
- <WalletProvider adapters={tronAdapters}>
189
- {/* Your app */}
190
- </WalletProvider>
191
+ <WalletProvider adapters={tronAdapters}>{/* Your app */}</WalletProvider>
191
192
  );
192
193
  }
193
194
  ```
@@ -201,7 +202,7 @@ The widget comes with pre-compiled Tailwind CSS styles. **You don't need to have
201
202
  Simply import the styles and you're good to go:
202
203
 
203
204
  ```tsx
204
- import '@evaa/bridge-widget/styles.css';
205
+ import "@evaa/bridge-widget/styles.css";
205
206
  ```
206
207
 
207
208
  All Tailwind utility classes used by the widget are already included in the compiled CSS. The widget has its own Tailwind configuration that ensures all necessary classes are bundled during the library build process.
@@ -212,12 +213,12 @@ Customize the widget's appearance by overriding CSS variables in your own styles
212
213
 
213
214
  ```css
214
215
  :root {
215
- --primary: #0095f9; /* Primary brand color */
216
- --background: #ffffff; /* Background color */
217
- --foreground: #171717; /* Text color */
218
- --card: #f2f2f2; /* Card background */
219
- --border: #00000029; /* Border color */
220
- --radius: 0.625rem; /* Border radius */
216
+ --primary: #0095f9; /* Primary brand color */
217
+ --background: #ffffff; /* Background color */
218
+ --foreground: #171717; /* Text color */
219
+ --card: #f2f2f2; /* Card background */
220
+ --border: #00000029; /* Border color */
221
+ --radius: 0.625rem; /* Border radius */
221
222
  /* ... see dist/styles.css for all available variables */
222
223
  }
223
224
 
@@ -230,6 +231,7 @@ Customize the widget's appearance by overriding CSS variables in your own styles
230
231
  ```
231
232
 
232
233
  **Complete list of customizable CSS variables:**
234
+
233
235
  - Color tokens: `--background`, `--foreground`, `--primary`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`
234
236
  - Semantic colors: `--link`, `--filter`, `--swap`, `--settings-button`, `--modal-x`, `--input-icon`, `--balance-icon`, and many more
235
237
  - Border radius: `--radius` (affects all rounded corners)
@@ -245,8 +247,8 @@ Customize the widget's appearance by overriding CSS variables in your own styles
245
247
  import {
246
248
  useChainsStore,
247
249
  useTokensStore,
248
- useBridgeQuoteStore
249
- } from '@evaa/bridge-widget';
250
+ useBridgeQuoteStore,
251
+ } from "@evaa/bridge-widget";
250
252
 
251
253
  function YourComponent() {
252
254
  const { chains } = useChainsStore();
@@ -265,8 +267,8 @@ import type {
265
267
  Token,
266
268
  Quote,
267
269
  EvaaBridgeProps,
268
- SwapSuccessData
269
- } from '@evaa/bridge-widget';
270
+ SwapSuccessData,
271
+ } from "@evaa/bridge-widget";
270
272
  ```
271
273
 
272
274
  ## Supported Chains
@@ -282,6 +284,7 @@ import type {
282
284
  ## API Integration
283
285
 
284
286
  The widget integrates with Stargate Protocol API for:
287
+
285
288
  - Cross-chain token swaps
286
289
  - Real-time quotes
287
290
  - Transaction routing
@@ -292,7 +295,7 @@ The widget integrates with Stargate Protocol API for:
292
295
  The package is written in TypeScript and includes full type definitions.
293
296
 
294
297
  ```tsx
295
- import type { EvaaBridgeProps, Chain, Token } from '@evaa/bridge-widget';
298
+ import type { EvaaBridgeProps, Chain, Token } from "@evaa/bridge-widget";
296
299
  ```
297
300
 
298
301
  ## Browser Support
@@ -335,5 +338,6 @@ MIT © EVAA Finance
335
338
  ## Support
336
339
 
337
340
  For issues and questions:
341
+
338
342
  - GitHub Issues: https://github.com/evaa-finance/bridge-widget/issues
339
343
  - Email: support@evaa.finance