@tuwaio/nova-connect 1.0.0-fix-test-alpha.6.2ae3a34 → 1.0.0-fix-test-alpha.8.1eef9e0
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 +21 -96
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -57,11 +57,14 @@ yarn add @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/
|
|
|
57
57
|
```tsx
|
|
58
58
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
59
59
|
import { satelliteEVMAdapter } from '@tuwaio/satellite-evm';
|
|
60
|
-
import {
|
|
60
|
+
import { SatelliteConnectProvider, NovaConnectProvider } from '@tuwaio/nova-connect';
|
|
61
|
+
import { EVMWalletsWatcher } from '@tuwaio/nova-connect/evm';
|
|
62
|
+
import { SolanaWalletsWatcher } from '@tuwaio/nova-connect/solana';
|
|
61
63
|
import { initializeSolanaMobileConnectors, satelliteSolanaAdapter } from '@tuwaio/satellite-solana';
|
|
64
|
+
import { createDefaultTransports, initAllConnectors } from '@tuwaio/satellite-evm';
|
|
65
|
+
import { createConfig } from '@wagmi/core';
|
|
62
66
|
import { ReactNode } from 'react';
|
|
63
67
|
import { WagmiProvider } from 'wagmi';
|
|
64
|
-
import { createWagmiConfig } from '@tuwaio/satellite-evm';
|
|
65
68
|
import { Chain, mainnet, polygon, arbitrum } from 'viem/chains';
|
|
66
69
|
|
|
67
70
|
export const appConfig = {
|
|
@@ -69,13 +72,16 @@ export const appConfig = {
|
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
export const solanaRPCUrls = {
|
|
72
|
-
mainnet: '
|
|
75
|
+
mainnet: 'https://api.mainnet-beta.solana.com',
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
export const appEVMChains = [mainnet, polygon, arbitrum] as readonly [Chain, ...Chain[]];
|
|
76
79
|
|
|
77
|
-
export const wagmiConfig =
|
|
78
|
-
|
|
80
|
+
export const wagmiConfig = createConfig({
|
|
81
|
+
connectors: initAllConnectors({
|
|
82
|
+
...appConfig,
|
|
83
|
+
}),
|
|
84
|
+
transports: createDefaultTransports(appEVMChains),
|
|
79
85
|
chains: appEVMChains,
|
|
80
86
|
ssr: true,
|
|
81
87
|
syncConnectedChain: true,
|
|
@@ -93,12 +99,14 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
93
99
|
<WagmiProvider config={wagmiConfig}>
|
|
94
100
|
<QueryClientProvider client={queryClient}>
|
|
95
101
|
<SatelliteConnectProvider
|
|
96
|
-
adapters={[satelliteEVMAdapter({ wagmiConfig }), satelliteSolanaAdapter()]}
|
|
102
|
+
adapters={[satelliteEVMAdapter({ wagmiConfig }), satelliteSolanaAdapter({ rpcUrls: solanaRPCUrls })]}
|
|
97
103
|
appName={appConfig.appName}
|
|
98
104
|
>
|
|
99
105
|
<EVMWalletsWatcher />
|
|
100
106
|
<SolanaWalletsWatcher />
|
|
101
|
-
|
|
107
|
+
<NovaConnectProvider>
|
|
108
|
+
{children}
|
|
109
|
+
</NovaConnectProvider>
|
|
102
110
|
</SatelliteConnectProvider>
|
|
103
111
|
</QueryClientProvider>
|
|
104
112
|
</WagmiProvider>
|
|
@@ -106,25 +114,20 @@ export function Providers({ children }: { children: ReactNode }) {
|
|
|
106
114
|
}
|
|
107
115
|
```
|
|
108
116
|
|
|
109
|
-
### Using
|
|
117
|
+
### Using ConnectButton
|
|
110
118
|
|
|
111
119
|
```tsx
|
|
112
|
-
import {
|
|
113
|
-
import { SatelliteStoreContext } from '@tuwaio/satellite-react';
|
|
114
|
-
import { useContext } from 'react';
|
|
120
|
+
import { ConnectButton } from '@tuwaio/nova-connect';
|
|
115
121
|
|
|
116
122
|
function App() {
|
|
117
|
-
const store = useContext(SatelliteStoreContext);
|
|
118
|
-
|
|
119
123
|
return (
|
|
120
124
|
<div>
|
|
121
|
-
<
|
|
122
|
-
store={store}
|
|
125
|
+
<ConnectButton
|
|
123
126
|
appChains={appEVMChains}
|
|
124
127
|
solanaRPCUrls={solanaRPCUrls}
|
|
128
|
+
withImpersonated
|
|
125
129
|
withBalance
|
|
126
130
|
withChain
|
|
127
|
-
withImpersonated
|
|
128
131
|
/>
|
|
129
132
|
</div>
|
|
130
133
|
);
|
|
@@ -133,86 +136,9 @@ function App() {
|
|
|
133
136
|
|
|
134
137
|
-----
|
|
135
138
|
|
|
136
|
-
## 🎨 Customization
|
|
137
|
-
|
|
138
|
-
Nova Connect provides three levels of customization:
|
|
139
|
-
|
|
140
|
-
### Basic Customization
|
|
141
|
-
|
|
142
|
-
```tsx
|
|
143
|
-
<NovaConnectButton
|
|
144
|
-
store={store}
|
|
145
|
-
appChains={appEVMChains}
|
|
146
|
-
solanaRPCUrls={solanaRPCUrls}
|
|
147
|
-
className="custom-button"
|
|
148
|
-
labels={{
|
|
149
|
-
connectWallet: 'Connect Wallet',
|
|
150
|
-
disconnect: 'Disconnect',
|
|
151
|
-
}}
|
|
152
|
-
/>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Advanced Customization
|
|
156
|
-
|
|
157
|
-
```tsx
|
|
158
|
-
<NovaConnectButton
|
|
159
|
-
store={store}
|
|
160
|
-
appChains={appEVMChains}
|
|
161
|
-
solanaRPCUrls={solanaRPCUrls}
|
|
162
|
-
customization={{
|
|
163
|
-
connectButton: {
|
|
164
|
-
classNames: {
|
|
165
|
-
button: ({ buttonData }) => `btn ${buttonData.isConnected ? 'btn-connected' : 'btn-connect'}`,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
provider: {
|
|
169
|
-
errors: {
|
|
170
|
-
position: 'bottom-right',
|
|
171
|
-
autoClose: 5000,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
}}
|
|
175
|
-
/>
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Full Provider Customization
|
|
179
|
-
|
|
180
|
-
```tsx
|
|
181
|
-
<NovaConnectButton
|
|
182
|
-
store={store}
|
|
183
|
-
appChains={appEVMChains}
|
|
184
|
-
solanaRPCUrls={solanaRPCUrls}
|
|
185
|
-
customization={{
|
|
186
|
-
provider: {
|
|
187
|
-
// Custom components
|
|
188
|
-
components: {
|
|
189
|
-
ErrorsProvider: CustomErrorsProvider,
|
|
190
|
-
LabelsProvider: CustomLabelsProvider,
|
|
191
|
-
},
|
|
192
|
-
// Label customization
|
|
193
|
-
labels: {
|
|
194
|
-
merge: (defaultLabels, userLabels) => ({ ...defaultLabels, ...userLabels }),
|
|
195
|
-
transform: (mergedLabels, context) => ({
|
|
196
|
-
...mergedLabels,
|
|
197
|
-
connectWallet: context.isConnected ? 'Reconnect' : 'Connect Wallet',
|
|
198
|
-
}),
|
|
199
|
-
},
|
|
200
|
-
// Lifecycle hooks
|
|
201
|
-
initialization: {
|
|
202
|
-
onConnectionStateChange: (isConnected, wallet, context) => {
|
|
203
|
-
console.log('Connection state changed:', isConnected);
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
}}
|
|
208
|
-
/>
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
-----
|
|
212
|
-
|
|
213
139
|
## 🧩 Key Components
|
|
214
140
|
|
|
215
|
-
### 1. **
|
|
141
|
+
### 1. **ConnectButton**
|
|
216
142
|
|
|
217
143
|
- Main component for wallet connection.
|
|
218
144
|
- Built-in support for balance display and network selector.
|
|
@@ -243,8 +169,7 @@ const customLabels = {
|
|
|
243
169
|
// ... other labels
|
|
244
170
|
};
|
|
245
171
|
|
|
246
|
-
<
|
|
247
|
-
store={store}
|
|
172
|
+
<NovaConnectProvider
|
|
248
173
|
labels={customLabels}
|
|
249
174
|
// ... other props
|
|
250
175
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/nova-connect",
|
|
3
|
-
"version": "1.0.0-fix-test-alpha.
|
|
3
|
+
"version": "1.0.0-fix-test-alpha.8.1eef9e0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -212,8 +212,8 @@
|
|
|
212
212
|
"tw-animate-css": "^1.4.0",
|
|
213
213
|
"typescript": "^5.9.3",
|
|
214
214
|
"tsup": "^8.5.0",
|
|
215
|
-
"@tuwaio/nova-
|
|
216
|
-
"@tuwaio/nova-
|
|
215
|
+
"@tuwaio/nova-transactions": "^1.0.0-fix-test-alpha.8.1eef9e0",
|
|
216
|
+
"@tuwaio/nova-core": "^1.0.0-fix-test-alpha.8.1eef9e0"
|
|
217
217
|
},
|
|
218
218
|
"scripts": {
|
|
219
219
|
"start": "tsup src/index.ts --watch",
|