@waaskey/react 0.1.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 +21 -0
- package/README.md +94 -0
- package/dist/index.cjs +733 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +258 -0
- package/dist/index.d.ts +258 -0
- package/dist/index.js +703 -0
- package/dist/index.js.map +1 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Waaskey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# @waaskey/react
|
|
2
|
+
|
|
3
|
+
React hooks + provider for the [Waaskey](https://waaskey.com) SDK — embedded,
|
|
4
|
+
non-custodial **MPC wallets**. A thin layer over [`@waaskey/sdk`](../sdk); the same
|
|
5
|
+
hooks work in React Native.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @waaskey/react @waaskey/sdk react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WaaskeyProvider, useCreateWallet, useBalance } from '@waaskey/react';
|
|
17
|
+
import { WasmMpcCore, EncryptedShareStore } from '@waaskey/sdk';
|
|
18
|
+
|
|
19
|
+
const options = {
|
|
20
|
+
apiKey: import.meta.env.VITE_WAASKEY_KEY,
|
|
21
|
+
mpc: new WasmMpcCore(loadClientWasm),
|
|
22
|
+
shareStore: EncryptedShareStore.browser(sessionSecret),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function App() {
|
|
26
|
+
return (
|
|
27
|
+
<WaaskeyProvider options={options}>
|
|
28
|
+
<Wallet />
|
|
29
|
+
</WaaskeyProvider>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function Wallet() {
|
|
34
|
+
const { create, wallet, isPending } = useCreateWallet();
|
|
35
|
+
const { data: balance } = useBalance('ethereum', wallet?.address);
|
|
36
|
+
return isPending ? <Spinner /> : <button onClick={() => create({ chain: 'ethereum' })}>Create</button>;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Export | Description |
|
|
41
|
+
| ---------------------------- | ------------------------------------------------------- |
|
|
42
|
+
| `WaaskeyProvider` | Provides a configured client (`options` or `client`). |
|
|
43
|
+
| `useWaaskey()` | The `Waaskey` client from context. |
|
|
44
|
+
| `useCreateWallet()` | `{ create, wallet, error, isPending }`. |
|
|
45
|
+
| `useWallet(id)` | `{ data, loading, error, refresh }`. |
|
|
46
|
+
| `useBalance(chain, address)` | `{ data, loading, error, refresh }` — client-side read. |
|
|
47
|
+
|
|
48
|
+
All of `@waaskey/sdk` is re-exported, so a single import covers types and values.
|
|
49
|
+
|
|
50
|
+
## Widget kit (Privy-style, drop-in)
|
|
51
|
+
|
|
52
|
+
Wrap the app once and drop in prebuilt, themeable components instead of building wallet
|
|
53
|
+
UI from scratch. Everything reads the client + theme from the provider:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { WaasProvider, ConnectModal, WalletWidget, FundWidget, useSignPrompt, darkTheme } from '@waaskey/react';
|
|
57
|
+
|
|
58
|
+
function App() {
|
|
59
|
+
return (
|
|
60
|
+
<WaasProvider options={options} theme={darkTheme}>
|
|
61
|
+
<Connect />
|
|
62
|
+
</WaasProvider>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function Connect() {
|
|
67
|
+
const [open, setOpen] = useState(true);
|
|
68
|
+
return <ConnectModal open={open} onClose={() => setOpen(false)} onConnect={(s) => console.log(s.endUser)} />;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Component / hook | What it does |
|
|
73
|
+
| ----------------------------- | ---------------------------------------------------------------------------------------- |
|
|
74
|
+
| `<WaasProvider config/theme>` | Client + theme context (alias of `WaaskeyProvider`). |
|
|
75
|
+
| `useWaas()` | `{ client, theme, auth }` — the unified surface. |
|
|
76
|
+
| `<ConnectModal>` | Email-OTP login modal (`auth`), `onConnect(session)`. |
|
|
77
|
+
| `<WalletWidget>` | Assets / Receive (QR) / Send / Activity panel. |
|
|
78
|
+
| `<FundWidget>` | Fiat on-ramp (provider widget URL) to fund the wallet. |
|
|
79
|
+
| `useSignPrompt()` | `requestSignature(tx)` → resolves on approve, rejects on cancel; renders `<SignPrompt>`. |
|
|
80
|
+
|
|
81
|
+
### Theming / white-label
|
|
82
|
+
|
|
83
|
+
Pass a partial `theme` to the provider (merged onto `lightTheme`); `darkTheme` and
|
|
84
|
+
`lightTheme` are exported, and every component is themed from that single source — no
|
|
85
|
+
hardcoded brand. The same kit ships for React Native from `@waaskey/react-native` (the
|
|
86
|
+
visual components are RN-native; hooks/theme are shared).
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<WaasProvider options={options} theme={{ accent: '#10b981', radius: '20px' }} />
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[MIT](./LICENSE) © WAASKey
|