@tuwaio/nova-connect 1.0.0-fix-ui-alpha.1.bc1cb87 → 1.0.0-fix-docs-alpha.1.dfcdaa7c
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 +70 -107
- package/dist/chunk-7RBXAMVI.cjs +2 -0
- package/dist/chunk-BRC3ASPJ.js +2 -0
- package/dist/chunk-JCUPHUQU.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.cts +9 -5
- package/dist/components/index.d.ts +9 -5
- package/dist/components/index.js +1 -1
- package/dist/hooks/index.d.cts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.css +23 -20
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/{useWalletNativeBalance-DIadeXdW.d.ts → useWalletNativeBalance-B6w7HC-n.d.ts} +1 -1
- package/dist/{useWalletNativeBalance-DYd-fWtH.d.cts → useWalletNativeBalance-DX5MO1-z.d.cts} +1 -1
- package/package.json +31 -31
- package/dist/chunk-OEA5AZZJ.cjs +0 -2
- package/dist/chunk-UCR5PRAG.js +0 -2
package/README.md
CHANGED
|
@@ -1,99 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tuwaio/nova-connect
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@tuwaio/nova-connect)
|
|
4
4
|
[](./LICENSE)
|
|
5
|
-
[](https://github.com/TuwaIO/nova-uikit/actions)
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
`@tuwaio/nova-connect` is the **UI Components (L7)** package of the TUWA Ecosystem wallet connectivity layer. It translates the headless connection status of `@tuwaio/satellite-react` into beautiful, accessible, and highly customizable React user interface elements.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## 🏛️ What is `@tuwaio/nova-connect`?
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
Built on top of the Satellite Connect ecosystem, Nova Connect offers a unified interface for working with various wallet types and blockchain networks.
|
|
8
|
+
Nova Connect natively supports both EVM and Solana wallet standard connectors, providing ready-made buttons, dialog selectors, network switchers, and balance widgets while keeping styling decisions decoupled from the underlying connection state store.
|
|
16
9
|
|
|
17
10
|
---
|
|
18
11
|
|
|
19
|
-
##
|
|
12
|
+
## 🏛️ Core Capabilities
|
|
20
13
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- **♿ Accessibility**: Full ARIA and keyboard navigation support.
|
|
27
|
-
- **🎭 Internationalization**: Support for multiple languages.
|
|
28
|
-
- **🔄 State Management**: Zustand-based store for efficient state management.
|
|
14
|
+
- **🔌 Plug-and-Play Widgets:** Ready-to-use wallet components (`ConnectButton`, `ConnectCard`, `DisconnectButton`, `AccountImpersonationIndicator`).
|
|
15
|
+
- **⛓️ Cohesive Multi-Chain Interface:** Consistently handles EVM wallets (via `@tuwaio/satellite-evm` and `wagmi`) and Solana standard wallets (via `@tuwaio/satellite-solana` and `gill`).
|
|
16
|
+
- **🎨 Deep Customization:** Change typography, borders, and margins using the `customization` prop or override colors via the `@tuwaio/nova-core` token variables.
|
|
17
|
+
- **♿ Built-in Accessibility:** Dialog primitives powered by Radix UI, featuring complete keyboard navigation, viewport trapping, and screen reader announcements.
|
|
18
|
+
- **🌍 Internationalization (i18n):** Overridable labels configuration for localizing connection prompts and wallet state tags.
|
|
29
19
|
|
|
30
20
|
---
|
|
31
21
|
|
|
32
22
|
## 💾 Installation
|
|
33
23
|
|
|
34
|
-
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add @tuwaio/nova-connect @tuwaio/nova-core @tuwaio/satellite-core @tuwaio/satellite-react
|
|
26
|
+
```
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
### Peer Dependencies Check
|
|
29
|
+
|
|
30
|
+
Ensure your React application contains required core packages:
|
|
39
31
|
|
|
40
32
|
```bash
|
|
41
|
-
#
|
|
42
|
-
pnpm add
|
|
33
|
+
# State & Utilities
|
|
34
|
+
pnpm add zustand immer dayjs clsx tailwind-merge framer-motion @emotion/is-prop-valid
|
|
35
|
+
|
|
36
|
+
# Dialog & Icons Primitives
|
|
37
|
+
pnpm add @radix-ui/react-dialog @radix-ui/react-select @heroicons/react @web3icons/react @web3icons/common
|
|
43
38
|
```
|
|
44
39
|
|
|
45
40
|
---
|
|
46
41
|
|
|
47
|
-
## 🚀 Quick Start
|
|
42
|
+
## 🚀 Quick Start Setup
|
|
43
|
+
|
|
44
|
+
### 1. Global Providers Integration
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
Wrap your React tree with the Wagmi configuration, Satellite logic connection provider, and Nova Connect layout provider:
|
|
50
47
|
|
|
51
48
|
```tsx
|
|
49
|
+
import { ReactNode } from 'react';
|
|
52
50
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
53
|
-
import { satelliteEVMAdapter, createDefaultTransports } from '@tuwaio/satellite-evm';
|
|
54
|
-
import { NovaConnectProvider } from '@tuwaio/nova-connect';
|
|
55
|
-
import { SatelliteConnectProvider } from '@tuwaio/nova-connect/satellite';
|
|
56
|
-
import { EVMWalletsWatcher } from '@tuwaio/nova-connect/evm';
|
|
57
|
-
import { SolanaWalletsWatcher } from '@tuwaio/nova-connect/solana';
|
|
58
|
-
import { satelliteSolanaAdapter } from '@tuwaio/satellite-solana';
|
|
59
51
|
import { WagmiProvider } from 'wagmi';
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import
|
|
65
|
-
|
|
66
|
-
export const appEVMChains = [mainnet, sepolia] as readonly [Chain, ...Chain[]];
|
|
67
|
-
|
|
68
|
-
export const wagmiConfig = createConfig({
|
|
69
|
-
connectors: [injected()],
|
|
70
|
-
transports: createDefaultTransports(appEVMChains), // Automatically creates http transports
|
|
71
|
-
chains: appEVMChains,
|
|
72
|
-
ssr: true, // Enable SSR support if needed (e.g., in Next.js)
|
|
73
|
-
});
|
|
52
|
+
import { satelliteEVMAdapter } from '@tuwaio/satellite-evm';
|
|
53
|
+
import { satelliteSolanaAdapter } from '@tuwaio/satellite-solana';
|
|
54
|
+
import { SatelliteConnectProvider } from '@tuwaio/nova-connect/satellite';
|
|
55
|
+
import { EVMConnectorsWatcher } from '@tuwaio/nova-connect/evm';
|
|
56
|
+
import { SolanaConnectorsWatcher } from '@tuwaio/nova-connect/solana';
|
|
57
|
+
import { NovaConnectProvider } from '@tuwaio/nova-connect';
|
|
74
58
|
|
|
75
|
-
|
|
76
|
-
devnet: 'https://api.devnet.solana.com',
|
|
77
|
-
};
|
|
59
|
+
import { wagmiConfig, appEVMChains, solanaRPCUrls } from './config/appConfig';
|
|
78
60
|
|
|
79
61
|
const queryClient = new QueryClient();
|
|
80
62
|
|
|
81
|
-
export function
|
|
63
|
+
export function Web3Providers({ children }: { children: ReactNode }) {
|
|
82
64
|
return (
|
|
83
65
|
<WagmiProvider config={wagmiConfig}>
|
|
84
66
|
<QueryClientProvider client={queryClient}>
|
|
67
|
+
{/* Layer 1: Headless Connection logic */}
|
|
85
68
|
<SatelliteConnectProvider
|
|
86
|
-
adapter={[satelliteEVMAdapter(wagmiConfig), satelliteSolanaAdapter({ rpcUrls: solanaRPCUrls })]}
|
|
69
|
+
adapter={[satelliteEVMAdapter(wagmiConfig, appEVMChains), satelliteSolanaAdapter({ rpcUrls: solanaRPCUrls })]}
|
|
87
70
|
autoConnect={true}
|
|
88
71
|
>
|
|
89
|
-
|
|
90
|
-
<
|
|
72
|
+
{/* Watchers sync native connector states to the store */}
|
|
73
|
+
<EVMConnectorsWatcher wagmiConfig={wagmiConfig} />
|
|
74
|
+
<SolanaConnectorsWatcher />
|
|
75
|
+
|
|
76
|
+
{/* Layer 2: Visual Connection component provider */}
|
|
91
77
|
<NovaConnectProvider
|
|
92
78
|
appChains={appEVMChains}
|
|
93
79
|
solanaRPCUrls={solanaRPCUrls}
|
|
94
|
-
withImpersonated
|
|
95
80
|
withBalance
|
|
96
81
|
withChain
|
|
82
|
+
withImpersonated
|
|
97
83
|
>
|
|
98
84
|
{children}
|
|
99
85
|
</NovaConnectProvider>
|
|
@@ -104,76 +90,53 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
104
90
|
}
|
|
105
91
|
```
|
|
106
92
|
|
|
107
|
-
###
|
|
93
|
+
### 2. Rendering the Connection Button
|
|
94
|
+
|
|
95
|
+
Place the component in your header or navigation bar:
|
|
108
96
|
|
|
109
97
|
```tsx
|
|
110
98
|
import { ConnectButton } from '@tuwaio/nova-connect/components';
|
|
111
99
|
|
|
112
|
-
function
|
|
100
|
+
export function NavigationHeader() {
|
|
113
101
|
return (
|
|
114
|
-
<
|
|
102
|
+
<header className="flex justify-between items-center p-4 border-b border-[var(--tuwa-border-primary)]">
|
|
103
|
+
<span className="font-bold">My dApp</span>
|
|
115
104
|
<ConnectButton />
|
|
116
|
-
</
|
|
105
|
+
</header>
|
|
117
106
|
);
|
|
118
107
|
}
|
|
119
108
|
```
|
|
120
109
|
|
|
121
110
|
---
|
|
122
111
|
|
|
123
|
-
##
|
|
124
|
-
|
|
125
|
-
### 1. **ConnectButton**
|
|
112
|
+
## 🎨 Component Customization
|
|
126
113
|
|
|
127
|
-
|
|
128
|
-
- Full customization system.
|
|
129
|
-
|
|
130
|
-
### 2. **NovaConnectProvider**
|
|
131
|
-
|
|
132
|
-
- Context provider with state management.
|
|
133
|
-
- Customizable error handling.
|
|
134
|
-
- Flexible internationalization system.
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## 🌍 Internationalization
|
|
139
|
-
|
|
140
|
-
Nova Connect supports full label customization:
|
|
114
|
+
Pass class names and layout overrides using the `customization` property to match components with your custom UI:
|
|
141
115
|
|
|
142
116
|
```tsx
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
117
|
+
import { ConnectButton } from '@tuwaio/nova-connect/components';
|
|
118
|
+
import { cn } from '@tuwaio/nova-core';
|
|
119
|
+
|
|
120
|
+
export function CustomHeader() {
|
|
121
|
+
return (
|
|
122
|
+
<ConnectButton
|
|
123
|
+
customization={{
|
|
124
|
+
classNames: {
|
|
125
|
+
connectButton: () =>
|
|
126
|
+
cn(
|
|
127
|
+
'px-6 py-2 rounded-full font-mono text-sm uppercase transition-all duration-300',
|
|
128
|
+
'bg-emerald-500 text-slate-950 hover:bg-emerald-600 focus:ring-2 focus:ring-emerald-500',
|
|
129
|
+
),
|
|
130
|
+
walletName: () => 'text-xs text-slate-300 font-semibold',
|
|
131
|
+
},
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
155
136
|
```
|
|
156
137
|
|
|
157
138
|
---
|
|
158
139
|
|
|
159
|
-
## ♿ Accessibility
|
|
160
|
-
|
|
161
|
-
Nova Connect fully supports accessibility standards:
|
|
162
|
-
|
|
163
|
-
- ARIA labels and descriptions
|
|
164
|
-
- Keyboard navigation
|
|
165
|
-
- Screen reader support
|
|
166
|
-
- Semantic HTML elements
|
|
167
|
-
- High contrast
|
|
168
|
-
|
|
169
|
-
## 🤝 Contributing & Support
|
|
170
|
-
|
|
171
|
-
Contributions are welcome! Please read our main **[Contribution Guidelines](https://github.com/TuwaIO/workflows/blob/main/CONTRIBUTING.md)**.
|
|
172
|
-
|
|
173
|
-
If you find this library useful, please consider supporting its development. Every contribution helps!
|
|
174
|
-
|
|
175
|
-
[**➡️ View Support Options**](https://github.com/TuwaIO/workflows/blob/main/Donation.md)
|
|
176
|
-
|
|
177
140
|
## 📄 License
|
|
178
141
|
|
|
179
|
-
|
|
142
|
+
Licensed under the **Apache-2.0 License**. See the [LICENSE](./LICENSE) file for details.
|