@tuwaio/nova-connect 0.5.7 → 0.5.9
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 +63 -2
- package/dist/{chunk-L7GDJJ7W.cjs → chunk-7HBYKNSL.cjs} +1 -1
- package/dist/chunk-BVVQR6Y7.cjs +1 -0
- package/dist/chunk-SOJLLC7T.js +1 -0
- package/dist/{chunk-3BQNG7PE.js → chunk-UOYHTY7H.js} +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +14 -14
- package/dist/chunk-NSVTTYJR.js +0 -1
- package/dist/chunk-Z7U4VY6E.cjs +0 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Nova Connect natively supports both EVM and Solana wallet standard connectors, p
|
|
|
19
19
|
- **🌍 Internationalization (i18n):** Overridable labels configuration for localizing connection prompts and wallet state tags.
|
|
20
20
|
|
|
21
21
|
> [!WARNING]
|
|
22
|
-
> **
|
|
22
|
+
> **SIWX Migration Notice**: Legacy `siwe` options inside `EVMConnectorsWatcher` and `NovaConnectProvider` are **deprecated**. Migrate to the `siwx` prop or `<NovaSiwxWatcher />` component powered by `@tuwaio/siwx-react` and `@tuwaio/siwx-server` for multi-chain CAIP-122 authentication.
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
@@ -141,6 +141,67 @@ export function CustomHeader() {
|
|
|
141
141
|
|
|
142
142
|
---
|
|
143
143
|
|
|
144
|
-
##
|
|
144
|
+
## 🔐 SIWX Auto-Authentication (`NovaSiwxWatcher` & `useNovaSiwx`)
|
|
145
|
+
|
|
146
|
+
Nova Connect includes native integration with `@tuwaio/siwx-react` for CAIP-122 multi-chain authentication:
|
|
147
|
+
|
|
148
|
+
### 1. Auto-Authentication via `NovaSiwxWatcher`
|
|
149
|
+
|
|
150
|
+
Pass `siwx` configuration into `NovaConnectProvider` or render `<NovaSiwxWatcher />` directly inside your provider tree:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { NovaConnectProvider } from '@tuwaio/nova-connect';
|
|
154
|
+
import { NovaSiwxWatcher } from '@tuwaio/nova-connect/watchers';
|
|
155
|
+
|
|
156
|
+
export function Web3Providers({ children }: { children: ReactNode }) {
|
|
157
|
+
return (
|
|
158
|
+
<NovaConnectProvider
|
|
159
|
+
appChains={appEVMChains}
|
|
160
|
+
siwx={{
|
|
161
|
+
enabled: true,
|
|
162
|
+
statement: 'Sign in to TUWA Ecosystem.',
|
|
163
|
+
verifier: async (payload) => {
|
|
164
|
+
const res = await fetch('/api/siwx/verify', {
|
|
165
|
+
method: 'POST',
|
|
166
|
+
headers: { 'Content-Type': 'application/json' },
|
|
167
|
+
body: JSON.stringify(payload),
|
|
168
|
+
});
|
|
169
|
+
return res.ok ? res.json() : null;
|
|
170
|
+
},
|
|
171
|
+
destroyer: async () => {
|
|
172
|
+
await fetch('/api/siwx/logout', { method: 'POST' });
|
|
173
|
+
},
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
{children}
|
|
177
|
+
</NovaConnectProvider>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 2. Manual Sign-In Controls via `useNovaSiwx`
|
|
183
|
+
|
|
184
|
+
For custom login buttons or gated actions:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { useNovaSiwx } from '@tuwaio/nova-connect/hooks';
|
|
188
|
+
|
|
189
|
+
export function CustomLoginButton() {
|
|
190
|
+
const { signIn, signOut } = useNovaSiwx({
|
|
191
|
+
verifier: async (payload) => {
|
|
192
|
+
const res = await fetch('/api/siwx/verify', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
headers: { 'Content-Type': 'application/json' },
|
|
195
|
+
body: JSON.stringify(payload),
|
|
196
|
+
});
|
|
197
|
+
return res.ok ? res.json() : null;
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return <button onClick={() => signIn()}>Sign In with Wallet</button>;
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
145
206
|
|
|
146
207
|
Licensed under the **Apache-2.0 License**. See the [LICENSE](./LICENSE) file for details.
|