@tuwaio/nova-connect 1.0.0-fix-test-alpha.59.8fde9e1 → 1.0.0-fix-test-alpha.61.e356934
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 +177 -41
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6294 -5305
- package/dist/index.d.ts +6294 -5305
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +5 -2
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +5 -2
- package/dist/providers/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nova Connect
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@tuwaio/nova-connect)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://github.com/TuwaIO/nova-uikit/actions)
|
|
6
6
|
|
|
7
|
-
React components
|
|
7
|
+
Feature-rich React components for connecting Web3 wallets with a comprehensive customization system and support for multiple blockchain networks.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
## 🏛️ What is `@tuwaio/
|
|
11
|
+
## 🏛️ What is `@tuwaio/nova-connect`?
|
|
12
12
|
|
|
13
|
-
`@tuwaio/
|
|
13
|
+
`@tuwaio/nova-connect` is a comprehensive solution for integrating Web3 wallets into React applications. The package provides ready-to-use components with deep customization and support for both EVM and Solana blockchains.
|
|
14
14
|
|
|
15
|
-
Built on top of
|
|
15
|
+
Built on top of the Satellite Connect ecosystem, Nova Connect offers a unified interface for working with various wallet types and blockchain networks.
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
## ✨ Key Features
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
21
|
+
- **🎨 Full Customization**: Comprehensive customization system for all components and behaviors.
|
|
22
|
+
- **⚡ TypeScript**: Full TypeScript support with proper type definitions.
|
|
23
|
+
- **🌐 Multi-Blockchain**: Unified support for EVM and Solana wallets.
|
|
24
|
+
- **🔗 Modern React**: Built using React 19+ features and best practices.
|
|
25
|
+
- **🎯 Ready-made Components**: Connection button, modals, network selectors.
|
|
26
|
+
- **♿ Accessibility**: Full ARIA and keyboard navigation support.
|
|
27
|
+
- **🎭 Internationalization**: Support for multiple languages.
|
|
28
|
+
- **🔄 State Management**: Zustand-based store for efficient state management.
|
|
29
|
+
- **📱 Responsiveness**: Mobile-first design.
|
|
26
30
|
|
|
27
31
|
---
|
|
28
32
|
|
|
@@ -35,19 +39,21 @@ Built on top of `@tuwaio/satellite-core`, this package offers a seamless develop
|
|
|
35
39
|
|
|
36
40
|
```bash
|
|
37
41
|
# Using pnpm (recommended)
|
|
38
|
-
pnpm add @tuwaio/
|
|
42
|
+
pnpm add @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/pulsar-core @tuwaio/satellite-evm @tuwaio/satellite-solana @wagmi/core @wallet-standard/react viem zustand
|
|
39
43
|
|
|
40
44
|
# Using npm
|
|
41
|
-
npm install @tuwaio/
|
|
45
|
+
npm install @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/pulsar-core @tuwaio/satellite-evm @tuwaio/satellite-solana @wagmi/core @wallet-standard/react viem zustand
|
|
42
46
|
|
|
43
47
|
# Using yarn
|
|
44
|
-
yarn add @tuwaio/
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
yarn add @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/pulsar-core @tuwaio/satellite-evm @tuwaio/satellite-solana @wagmi/core @wallet-standard/react viem zustand
|
|
49
|
+
````
|
|
50
|
+
|
|
51
|
+
-----
|
|
47
52
|
|
|
48
53
|
## 🚀 Quick Start
|
|
49
54
|
|
|
50
|
-
### Basic Setup
|
|
55
|
+
### Basic Provider Setup
|
|
56
|
+
|
|
51
57
|
```tsx
|
|
52
58
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
53
59
|
import { satelliteEVMAdapter } from '@tuwaio/satellite-evm';
|
|
@@ -56,17 +62,17 @@ import { initializeSolanaMobileConnectors, satelliteSolanaAdapter } from '@tuwai
|
|
|
56
62
|
import { ReactNode } from 'react';
|
|
57
63
|
import { WagmiProvider } from 'wagmi';
|
|
58
64
|
import { createWagmiConfig } from '@tuwaio/satellite-evm';
|
|
59
|
-
import { Chain, mainnet,
|
|
65
|
+
import { Chain, mainnet, polygon, arbitrum } from 'viem/chains';
|
|
60
66
|
|
|
61
67
|
export const appConfig = {
|
|
62
|
-
appName: '
|
|
68
|
+
appName: 'My Nova Connect App',
|
|
63
69
|
};
|
|
64
70
|
|
|
65
71
|
export const solanaRPCUrls = {
|
|
66
|
-
|
|
72
|
+
mainnet: '[https://api.mainnet-beta.solana.com](https://api.mainnet-beta.solana.com)',
|
|
67
73
|
};
|
|
68
74
|
|
|
69
|
-
export const appEVMChains = [mainnet,
|
|
75
|
+
export const appEVMChains = [mainnet, polygon, arbitrum] as readonly [Chain, ...Chain[]];
|
|
70
76
|
|
|
71
77
|
export const wagmiConfig = createWagmiConfig({
|
|
72
78
|
...appConfig,
|
|
@@ -75,7 +81,6 @@ export const wagmiConfig = createWagmiConfig({
|
|
|
75
81
|
syncConnectedChain: true,
|
|
76
82
|
});
|
|
77
83
|
|
|
78
|
-
|
|
79
84
|
const queryClient = new QueryClient();
|
|
80
85
|
|
|
81
86
|
initializeSolanaMobileConnectors({
|
|
@@ -88,10 +93,10 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
88
93
|
<WagmiProvider config={wagmiConfig}>
|
|
89
94
|
<QueryClientProvider client={queryClient}>
|
|
90
95
|
<SatelliteConnectProvider
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
adapters={[satelliteEVMAdapter({ wagmiConfig }), satelliteSolanaAdapter()]}
|
|
97
|
+
appName={appConfig.appName}
|
|
93
98
|
>
|
|
94
|
-
<EVMWalletsWatcher
|
|
99
|
+
<EVMWalletsWatcher />
|
|
95
100
|
<SolanaWalletsWatcher />
|
|
96
101
|
{children}
|
|
97
102
|
</SatelliteConnectProvider>
|
|
@@ -101,29 +106,160 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
101
106
|
}
|
|
102
107
|
```
|
|
103
108
|
|
|
104
|
-
### Using
|
|
109
|
+
### Using NovaConnectButton
|
|
110
|
+
|
|
105
111
|
```tsx
|
|
112
|
+
import { NovaConnectButton } from '@tuwaio/nova-connect';
|
|
106
113
|
import { useSatelliteConnectStore } from '@tuwaio/satellite-react';
|
|
107
114
|
|
|
108
|
-
function
|
|
109
|
-
const
|
|
110
|
-
|
|
115
|
+
function App() {
|
|
116
|
+
const store = useSatelliteConnectStore();
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<div>
|
|
120
|
+
<NovaConnectButton
|
|
121
|
+
store={store}
|
|
122
|
+
appChains={appEVMChains}
|
|
123
|
+
solanaRPCUrls={solanaRPCUrls}
|
|
124
|
+
withBalance
|
|
125
|
+
withChain
|
|
126
|
+
withImpersonated
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
111
130
|
}
|
|
112
131
|
```
|
|
113
|
-
---
|
|
114
132
|
|
|
115
|
-
|
|
133
|
+
-----
|
|
116
134
|
|
|
117
|
-
|
|
118
|
-
- `useSatelliteConnectStore`: Access to satellite connect store with full type safety
|
|
119
|
-
- Provides access to wallet state, connection methods, and chain management
|
|
135
|
+
## 🎨 Customization
|
|
120
136
|
|
|
121
|
-
|
|
122
|
-
- `SatelliteConnectProvider`: Global context provider with all necessary configurations
|
|
123
|
-
- `EVMWalletsWatcher`: EVM wallet connection state management
|
|
124
|
-
- `SolanaWalletsWatcher`: Solana wallet connection state management
|
|
137
|
+
Nova Connect provides three levels of customization:
|
|
125
138
|
|
|
126
|
-
|
|
139
|
+
### Basic Customization
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
<NovaConnectButton
|
|
143
|
+
store={store}
|
|
144
|
+
appChains={appEVMChains}
|
|
145
|
+
solanaRPCUrls={solanaRPCUrls}
|
|
146
|
+
className="custom-button"
|
|
147
|
+
labels={{
|
|
148
|
+
connectWallet: 'Connect Wallet',
|
|
149
|
+
disconnect: 'Disconnect',
|
|
150
|
+
}}
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Advanced Customization
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
<NovaConnectButton
|
|
158
|
+
store={store}
|
|
159
|
+
appChains={appEVMChains}
|
|
160
|
+
solanaRPCUrls={solanaRPCUrls}
|
|
161
|
+
customization={{
|
|
162
|
+
connectButton: {
|
|
163
|
+
classNames: {
|
|
164
|
+
button: ({ buttonData }) => `btn ${buttonData.isConnected ? 'btn-connected' : 'btn-connect'}`,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
provider: {
|
|
168
|
+
errors: {
|
|
169
|
+
position: 'bottom-right',
|
|
170
|
+
autoClose: 5000,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Full Provider Customization
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<NovaConnectButton
|
|
181
|
+
store={store}
|
|
182
|
+
appChains={appEVMChains}
|
|
183
|
+
solanaRPCUrls={solanaRPCUrls}
|
|
184
|
+
customization={{
|
|
185
|
+
provider: {
|
|
186
|
+
// Custom components
|
|
187
|
+
components: {
|
|
188
|
+
ErrorsProvider: CustomErrorsProvider,
|
|
189
|
+
LabelsProvider: CustomLabelsProvider,
|
|
190
|
+
},
|
|
191
|
+
// Label customization
|
|
192
|
+
labels: {
|
|
193
|
+
merge: (defaultLabels, userLabels) => ({ ...defaultLabels, ...userLabels }),
|
|
194
|
+
transform: (mergedLabels, context) => ({
|
|
195
|
+
...mergedLabels,
|
|
196
|
+
connectWallet: context.isConnected ? 'Reconnect' : 'Connect Wallet',
|
|
197
|
+
}),
|
|
198
|
+
},
|
|
199
|
+
// Lifecycle hooks
|
|
200
|
+
initialization: {
|
|
201
|
+
onConnectionStateChange: (isConnected, wallet, context) => {
|
|
202
|
+
console.log('Connection state changed:', isConnected);
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
-----
|
|
211
|
+
|
|
212
|
+
## 🧩 Key Components
|
|
213
|
+
|
|
214
|
+
### 1. **NovaConnectButton**
|
|
215
|
+
|
|
216
|
+
- Main component for wallet connection.
|
|
217
|
+
- Built-in support for balance display and network selector.
|
|
218
|
+
- Full customization system.
|
|
219
|
+
|
|
220
|
+
### 2. **NovaConnectProvider**
|
|
221
|
+
|
|
222
|
+
- Context provider with state management.
|
|
223
|
+
- Customizable error handling.
|
|
224
|
+
- Flexible internationalization system.
|
|
225
|
+
|
|
226
|
+
### 3. **Hooks**
|
|
227
|
+
|
|
228
|
+
- `useWalletBalance`: Get the wallet balance.
|
|
229
|
+
|
|
230
|
+
-----
|
|
231
|
+
|
|
232
|
+
## 🌍 Internationalization
|
|
233
|
+
|
|
234
|
+
Nova Connect supports full label customization:
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
const customLabels = {
|
|
238
|
+
connectWallet: 'Connect Wallet',
|
|
239
|
+
disconnect: 'Disconnect',
|
|
240
|
+
connecting: 'Connecting...',
|
|
241
|
+
connected: 'Connected',
|
|
242
|
+
// ... other labels
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
<NovaConnectButton
|
|
246
|
+
store={store}
|
|
247
|
+
labels={customLabels}
|
|
248
|
+
// ... other props
|
|
249
|
+
/>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
-----
|
|
253
|
+
|
|
254
|
+
## ♿ Accessibility
|
|
255
|
+
|
|
256
|
+
Nova Connect fully supports accessibility standards:
|
|
257
|
+
|
|
258
|
+
- ARIA labels and descriptions
|
|
259
|
+
- Keyboard navigation
|
|
260
|
+
- Screen reader support
|
|
261
|
+
- Semantic HTML elements
|
|
262
|
+
- High contrast
|
|
127
263
|
|
|
128
264
|
## 🤝 Contributing & Support
|
|
129
265
|
|