@antigane/wallet-adapters 0.0.5 → 0.0.7
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 +97 -60
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Antigane Inc.
|
|
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
CHANGED
|
@@ -1,73 +1,110 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @antigane/wallet-adapters
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Wallet connect UI and adapters for React. Includes a ready-made `ConnectButton` with a modal for MetaMask and Phantom.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm i @antigane/wallet-adapters
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @antigane/wallet-adapters
|
|
11
|
+
# or
|
|
12
|
+
yarn add @antigane/wallet-adapters
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Peer dependencies
|
|
16
|
+
|
|
17
|
+
Make sure these are installed in your app:
|
|
18
|
+
|
|
19
|
+
- `react` >= 18
|
|
20
|
+
- `react-dom` >= 18
|
|
21
|
+
- `framer-motion` >= 12.24.0 < 13
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { ConnectButton } from "@antigane/wallet-adapters";
|
|
27
|
+
|
|
28
|
+
export default function App() {
|
|
29
|
+
return (
|
|
30
|
+
<div style={{ padding: 24 }}>
|
|
31
|
+
<ConnectButton
|
|
32
|
+
onSigned={(state) => {
|
|
33
|
+
console.log("signed", state);
|
|
34
|
+
}}
|
|
35
|
+
onChange={(state) => {
|
|
36
|
+
console.log("change", state);
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Styles are bundled automatically in the library build, so importing the component is enough.
|
|
45
|
+
This package is browser-only because it uses `window` for wallet detection.
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
### ConnectButton
|
|
9
50
|
|
|
10
|
-
|
|
51
|
+
- `onSigned?: (state: SignState) => void`
|
|
52
|
+
- `onChange?: (state: SignState | null) => void`
|
|
11
53
|
|
|
12
|
-
|
|
54
|
+
`SignState` shape:
|
|
13
55
|
|
|
14
|
-
|
|
56
|
+
```ts
|
|
57
|
+
type SignState = {
|
|
58
|
+
signature?: string;
|
|
59
|
+
message?: string;
|
|
60
|
+
accountId?: string;
|
|
61
|
+
accountType?: "EVM" | "SOLANA";
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Assets
|
|
66
|
+
|
|
67
|
+
The modal uses wallet icons at these paths:
|
|
15
68
|
|
|
16
|
-
|
|
69
|
+
- `/assets/wallets/metamask.svg`
|
|
70
|
+
- `/assets/wallets/phantom.svg`
|
|
71
|
+
- `/assets/wallets/peridotwallet.svg`
|
|
17
72
|
|
|
18
|
-
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
73
|
+
If your app does not already serve them, copy the SVGs from this package's `public/assets/wallets` into your app's public folder with the same paths.
|
|
25
74
|
|
|
26
|
-
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
75
|
+
## Theming
|
|
32
76
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
77
|
+
This library uses CSS variables for colors. You can override them anywhere in your app:
|
|
78
|
+
|
|
79
|
+
```css
|
|
80
|
+
:root {
|
|
81
|
+
--background: #111312;
|
|
82
|
+
--foreground: #ffffff;
|
|
83
|
+
--card: #0d100e;
|
|
84
|
+
--card-foreground: #ffffff;
|
|
85
|
+
--accent: #2ecc71;
|
|
86
|
+
--highlight: #9bffb6;
|
|
87
|
+
--muted: #111312;
|
|
88
|
+
--muted-foreground: #6e6e6e;
|
|
89
|
+
}
|
|
44
90
|
```
|
|
45
91
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
92
|
+
## Troubleshooting
|
|
93
|
+
|
|
94
|
+
If styles do not appear in a consumer app:
|
|
95
|
+
|
|
96
|
+
1) Ensure the app's bundler supports CSS imports from `node_modules`.
|
|
97
|
+
2) Ensure the app is not stripping CSS side effects during tree-shaking.
|
|
98
|
+
3) Ensure your build is using the latest published package version.
|
|
99
|
+
|
|
100
|
+
If you use Next.js, render the button in a client component:
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
"use client";
|
|
104
|
+
|
|
105
|
+
import { ConnectButton } from "@antigane/wallet-adapters";
|
|
73
106
|
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|