@rash2x/bridge-widget 0.2.11 → 0.3.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 +2 -0
- package/README.md +103 -138
- package/dist/evaa-bridge.cjs +1378 -853
- package/dist/evaa-bridge.cjs.map +1 -1
- package/dist/evaa-bridge.mjs +1380 -855
- package/dist/evaa-bridge.mjs.map +1 -1
- package/dist/index.d.ts +58 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/assets/fonts/Gilroy-Black.ttf +0 -0
- package/dist/assets/fonts/Gilroy-Bold.ttf +0 -0
- package/dist/assets/fonts/Gilroy-ExtraBold.ttf +0 -0
- package/dist/assets/fonts/Gilroy-Heavy.ttf +0 -0
- package/dist/assets/fonts/Gilroy-Light.ttf +0 -0
- package/dist/assets/fonts/Gilroy-Medium.ttf +0 -0
- package/dist/assets/fonts/Gilroy-Regular.ttf +0 -0
- package/dist/assets/fonts/Gilroy-SemiBold.ttf +0 -0
- package/dist/assets/fonts/Gilroy-Thin.ttf +0 -0
- package/dist/assets/fonts/Gilroy-UltraLight.ttf +0 -0
- package/dist/assets/fonts/fonts.css +0 -81
- package/dist/assets/fonts/hanson-bold.woff +0 -0
- package/dist/assets/fonts/hanson-bold.woff2 +0 -0
package/LICENSE
CHANGED
|
@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Made by https://t.me/rashdeva special for EVAA
|
package/README.md
CHANGED
|
@@ -71,32 +71,113 @@ For detailed setup instructions, see [SHADCN_COMPONENTS.md](./SHADCN_COMPONENTS.
|
|
|
71
71
|
### 1. Basic Setup
|
|
72
72
|
|
|
73
73
|
```tsx
|
|
74
|
-
import {
|
|
75
|
-
import
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
import { animated, useSpring } from '@react-spring/web';
|
|
75
|
+
import { useTranslation } from 'react-i18next';
|
|
76
|
+
import { WalletProvider } from '@tronweb3/tronwallet-adapter-react-hooks';
|
|
77
|
+
import { TronLinkAdapter } from '@tronweb3/tronwallet-adapters';
|
|
78
|
+
import { ConnectKitProvider } from 'connectkit';
|
|
79
|
+
import { EvaaBridge } from '@rash2x/bridge-widget';
|
|
80
|
+
import { TransactionConfirmVector } from '@/components/vectors/TransactionConfirm';
|
|
81
|
+
import { TransactionProgressVector } from '@/components/vectors/TransactionProgress';
|
|
82
|
+
import { TransactionSuccessVector } from '@/components/vectors/TransactionSuccess';
|
|
83
|
+
import Fireworks from 'react-canvas-confetti/dist/presets/fireworks';
|
|
84
|
+
import { TransactionFailedVector } from '@/components/vectors/TransactionFailed';
|
|
85
|
+
import { useMemo } from 'react';
|
|
86
|
+
import { WagmiProvider, createConfig, http } from 'wagmi';
|
|
87
|
+
import { mainnet, arbitrum, polygon, base, bsc } from 'wagmi/chains';
|
|
88
|
+
import { injected, walletConnect, metaMask } from 'wagmi/connectors';
|
|
89
|
+
import { Card } from '@/components/ui/card';
|
|
90
|
+
|
|
91
|
+
const walletConnectProjectId = import.meta.env.VITE_WALLETCONNECT_PROJECT_ID || '5e81fa2f7739ab20482103c77a1b5cbf';
|
|
92
|
+
|
|
93
|
+
const config = createConfig({
|
|
94
|
+
chains: [mainnet, arbitrum, polygon, base, bsc],
|
|
95
|
+
connectors: [injected(), metaMask(), walletConnect({ projectId: walletConnectProjectId })],
|
|
96
|
+
transports: {
|
|
97
|
+
[mainnet.id]: http(),
|
|
98
|
+
[arbitrum.id]: http(),
|
|
99
|
+
[polygon.id]: http(),
|
|
100
|
+
[base.id]: http(),
|
|
101
|
+
[bsc.id]: http()
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const BridgePage = () => {
|
|
106
|
+
const { t, i18n } = useTranslation();
|
|
107
|
+
const [props] = useSpring(() => ({
|
|
108
|
+
from: { opacity: 0 },
|
|
109
|
+
to: { opacity: 1 }
|
|
110
|
+
}));
|
|
111
|
+
|
|
86
112
|
const tronAdapters = useMemo(() => [new TronLinkAdapter()], []);
|
|
87
113
|
|
|
114
|
+
const transactionIcons = useMemo(
|
|
115
|
+
() => ({
|
|
116
|
+
confirm: (
|
|
117
|
+
<>
|
|
118
|
+
<TransactionConfirmVector />
|
|
119
|
+
<div className="on-circle on-circle-confirm-small under-noise"></div>
|
|
120
|
+
<div className="on-circle on-circle-confirm-big under-noise"></div>
|
|
121
|
+
</>
|
|
122
|
+
),
|
|
123
|
+
progress: (
|
|
124
|
+
<>
|
|
125
|
+
<TransactionProgressVector className="progress-rocket" />
|
|
126
|
+
<div className="on-circle on-circle-progress-small under-noise"></div>
|
|
127
|
+
<div className="on-circle on-circle-progress-big under-noise"></div>
|
|
128
|
+
<div className="meteors-container under-noise">
|
|
129
|
+
<span></span>
|
|
130
|
+
<span></span>
|
|
131
|
+
<span></span>
|
|
132
|
+
<span></span>
|
|
133
|
+
<span></span>
|
|
134
|
+
<span></span>
|
|
135
|
+
</div>
|
|
136
|
+
</>
|
|
137
|
+
),
|
|
138
|
+
success: (
|
|
139
|
+
<>
|
|
140
|
+
<TransactionSuccessVector />
|
|
141
|
+
<Fireworks
|
|
142
|
+
autorun={{
|
|
143
|
+
speed: 3,
|
|
144
|
+
duration: 1000,
|
|
145
|
+
delay: 300
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
<div className="on-circle on-circle-success-small under-noise"></div>
|
|
149
|
+
<div className="on-circle on-circle-success-big under-noise"></div>
|
|
150
|
+
</>
|
|
151
|
+
),
|
|
152
|
+
failed: (
|
|
153
|
+
<>
|
|
154
|
+
<TransactionFailedVector />
|
|
155
|
+
<div className="on-circle on-circle-failed-small under-noise"></div>
|
|
156
|
+
<div className="on-circle on-circle-failed-big under-noise"></div>
|
|
157
|
+
</>
|
|
158
|
+
)
|
|
159
|
+
}),
|
|
160
|
+
[]
|
|
161
|
+
);
|
|
162
|
+
|
|
88
163
|
return (
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
164
|
+
<animated.div style={props} className="space-y-4 pb-5 overflow-auto">
|
|
165
|
+
<Card className="bg-master rounded-lg py-6 px-5 md:grid md:grid-cols-2 gap-8 lg:gap-10">
|
|
166
|
+
<header className="px-5 space-y-3 md:px-0">
|
|
167
|
+
<h1 className="font-display font-black shrink-0 text-5xl">{t('bridge')}</h1>
|
|
168
|
+
<p className="text-sm text-muted-foreground">{t('bridgeDescription')}</p>
|
|
169
|
+
</header>
|
|
170
|
+
<WagmiProvider config={config}>
|
|
171
|
+
<ConnectKitProvider>
|
|
172
|
+
<WalletProvider adapters={tronAdapters} disableAutoConnectOnLoad={true}>
|
|
173
|
+
<EvaaBridge defaultLanguage={i18n.language} transactionIcons={transactionIcons} />
|
|
174
|
+
</WalletProvider>
|
|
175
|
+
</ConnectKitProvider>
|
|
176
|
+
</WagmiProvider>
|
|
177
|
+
</Card>
|
|
178
|
+
</animated.div>
|
|
98
179
|
);
|
|
99
|
-
}
|
|
180
|
+
};
|
|
100
181
|
```
|
|
101
182
|
|
|
102
183
|
### 2. With Event Handlers and Language
|
|
@@ -139,74 +220,6 @@ function App() {
|
|
|
139
220
|
| `onAmountChange` | `(amount: string) => void` | Callback when amount changes |
|
|
140
221
|
| `onChainChange` | `(data: ChainChangeData) => void` | Callback when chain changes |
|
|
141
222
|
|
|
142
|
-
## Configuration
|
|
143
|
-
|
|
144
|
-
### Wagmi Config (for EVM chains)
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
import { createConfig } from "wagmi";
|
|
148
|
-
import { getDefaultConfig } from "connectkit";
|
|
149
|
-
import { mainnet, arbitrum, polygon, base, bsc } from "wagmi/chains";
|
|
150
|
-
|
|
151
|
-
const wagmiConfig = createConfig(
|
|
152
|
-
getDefaultConfig({
|
|
153
|
-
appName: "Your App Name",
|
|
154
|
-
walletConnectProjectId: "YOUR_PROJECT_ID",
|
|
155
|
-
chains: [mainnet, arbitrum, polygon, base, bsc],
|
|
156
|
-
})
|
|
157
|
-
);
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### TonConnect Manifest
|
|
161
|
-
|
|
162
|
-
Create a `tonconnect-manifest.json` file:
|
|
163
|
-
|
|
164
|
-
```json
|
|
165
|
-
{
|
|
166
|
-
"url": "https://your-app.com",
|
|
167
|
-
"name": "Your App Name",
|
|
168
|
-
"iconUrl": "https://your-app.com/icon.png"
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Tron Wallet Adapters
|
|
173
|
-
|
|
174
|
-
Configure Tron wallet adapters using the official `@tronweb3/tronwallet-adapter-react-hooks`:
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
import { WalletProvider } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
178
|
-
import { TronLinkAdapter } from "@tronweb3/tronwallet-adapters";
|
|
179
|
-
import { useMemo } from "react";
|
|
180
|
-
|
|
181
|
-
function App() {
|
|
182
|
-
const tronAdapters = useMemo(
|
|
183
|
-
() => [
|
|
184
|
-
new TronLinkAdapter(),
|
|
185
|
-
// You can add other adapters here
|
|
186
|
-
],
|
|
187
|
-
[]
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
return (
|
|
191
|
-
<WalletProvider adapters={tronAdapters}>{/* Your app */}</WalletProvider>
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Styling
|
|
197
|
-
|
|
198
|
-
The widget comes with pre-compiled Tailwind CSS styles. **You don't need to have Tailwind installed** in your project for the widget to work.
|
|
199
|
-
|
|
200
|
-
### Basic Usage
|
|
201
|
-
|
|
202
|
-
Simply import the styles and you're good to go:
|
|
203
|
-
|
|
204
|
-
```tsx
|
|
205
|
-
import "@evaa/bridge-widget/styles.css";
|
|
206
|
-
```
|
|
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.
|
|
209
|
-
|
|
210
223
|
### Theme Customization
|
|
211
224
|
|
|
212
225
|
Customize the widget's appearance by overriding CSS variables in your own stylesheet:
|
|
@@ -230,47 +243,6 @@ Customize the widget's appearance by overriding CSS variables in your own styles
|
|
|
230
243
|
}
|
|
231
244
|
```
|
|
232
245
|
|
|
233
|
-
**Complete list of customizable CSS variables:**
|
|
234
|
-
|
|
235
|
-
- Color tokens: `--background`, `--foreground`, `--primary`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`
|
|
236
|
-
- Semantic colors: `--link`, `--filter`, `--swap`, `--settings-button`, `--modal-x`, `--input-icon`, `--balance-icon`, and many more
|
|
237
|
-
- Border radius: `--radius` (affects all rounded corners)
|
|
238
|
-
- See the `dist/styles.css` file for the complete list
|
|
239
|
-
|
|
240
|
-
**Note:** The widget will work perfectly fine without Tailwind in your consuming project. All necessary styles are pre-compiled and included in `styles.css`.
|
|
241
|
-
|
|
242
|
-
## Advanced Usage
|
|
243
|
-
|
|
244
|
-
### Using Stores Directly
|
|
245
|
-
|
|
246
|
-
```tsx
|
|
247
|
-
import {
|
|
248
|
-
useChainsStore,
|
|
249
|
-
useTokensStore,
|
|
250
|
-
useBridgeQuoteStore,
|
|
251
|
-
} from "@evaa/bridge-widget";
|
|
252
|
-
|
|
253
|
-
function YourComponent() {
|
|
254
|
-
const { chains } = useChainsStore();
|
|
255
|
-
const { tokens } = useTokensStore();
|
|
256
|
-
const { quote } = useBridgeQuoteStore();
|
|
257
|
-
|
|
258
|
-
// Your logic here
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Type Exports
|
|
263
|
-
|
|
264
|
-
```tsx
|
|
265
|
-
import type {
|
|
266
|
-
Chain,
|
|
267
|
-
Token,
|
|
268
|
-
Quote,
|
|
269
|
-
EvaaBridgeProps,
|
|
270
|
-
SwapSuccessData,
|
|
271
|
-
} from "@evaa/bridge-widget";
|
|
272
|
-
```
|
|
273
|
-
|
|
274
246
|
## Supported Chains
|
|
275
247
|
|
|
276
248
|
- Ethereum (Mainnet)
|
|
@@ -298,13 +270,6 @@ The package is written in TypeScript and includes full type definitions.
|
|
|
298
270
|
import type { EvaaBridgeProps, Chain, Token } from "@evaa/bridge-widget";
|
|
299
271
|
```
|
|
300
272
|
|
|
301
|
-
## Browser Support
|
|
302
|
-
|
|
303
|
-
- Chrome (latest)
|
|
304
|
-
- Firefox (latest)
|
|
305
|
-
- Safari (latest)
|
|
306
|
-
- Edge (latest)
|
|
307
|
-
|
|
308
273
|
## Development
|
|
309
274
|
|
|
310
275
|
```bash
|