@antigane/wallet-adapters 0.0.6 → 0.0.8

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 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
- # React + TypeScript + Vite
1
+ # @antigane/wallet-adapters
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ Wallet connect UI and adapters for React. Includes a ready-made `ConnectButton` with a modal for MetaMask and Phantom.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## Install
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
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
- ## React Compiler
51
+ - `onSigned?: (state: SignState) => void`
52
+ - `onChange?: (state: SignState | null) => void`
11
53
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
54
+ `SignState` shape:
13
55
 
14
- ## Expanding the ESLint configuration
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
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
69
+ - `/assets/wallets/metamask.svg`
70
+ - `/assets/wallets/phantom.svg`
71
+ - `/assets/wallets/peridotwallet.svg`
17
72
 
18
- ```js
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
- // Remove tseslint.configs.recommended and replace with this
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
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
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
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
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
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xe=require("react");function OT(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Rf=OT(Xe);var su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Bm(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var i=!1;try{i=this instanceof r}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var ou={exports:{}},Nc={};var Vy;function NT(){if(Vy)return Nc;Vy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Nc.Fragment=e,Nc.jsx=n,Nc.jsxs=n,Nc}var Pc={};var jy;function PT(){return jy||(jy=1,process.env.NODE_ENV!=="production"&&(function(){function t(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===H?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case b:return"Fragment";case M:return"Profiler";case E:return"StrictMode";case z:return"Suspense";case X:return"SuspenseList";case B:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case w:return"Portal";case F:return x.displayName||"Context";case S:return(x._context.displayName||"Context")+".Consumer";case D:var h=x.render;return x=x.displayName,x||(x=h.displayName||h.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case Y:return h=x.displayName||null,h!==null?h:t(x.type)||"Memo";case U:h=x._payload,x=x._init;try{return t(x(h))}catch{}}return null}function e(x){return""+x}function n(x){try{e(x);var h=!1}catch{h=!0}if(h){h=console;var m=h.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return m.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),e(x)}}function r(x){if(x===b)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===U)return"<...>";try{var h=t(x);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function i(){var x=V.A;return x===null?null:x.getOwner()}function s(){return Error("react-stack-top-frame")}function o(x){if(T.call(x,"key")){var h=Object.getOwnPropertyDescriptor(x,"key").get;if(h&&h.isReactWarning)return!1}return x.key!==void 0}function a(x,h){function m(){R||(R=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}m.isReactWarning=!0,Object.defineProperty(x,"key",{get:m,configurable:!0})}function c(){var x=t(this.type);return P[x]||(P[x]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),x=this.props.ref,x!==void 0?x:null}function l(x,h,m,A,C,$){var j=m.ref;return x={$$typeof:v,type:x,key:h,props:m,_owner:A},(j!==void 0?j:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:c}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function u(x,h,m,A,C,$){var j=h.children;if(j!==void 0)if(A)if(p(j)){for(A=0;A<j.length;A++)d(j[A]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(j);if(T.call(h,"key")){j=t(x);var Z=Object.keys(h).filter(function(se){return se!=="key"});A=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",N[j+A]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const Xe=require("react");function OT(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Rf=OT(Xe);var su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Bm(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var i=!1;try{i=this instanceof r}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var ou={exports:{}},Nc={};var Vy;function NT(){if(Vy)return Nc;Vy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Nc.Fragment=e,Nc.jsx=n,Nc.jsxs=n,Nc}var Pc={};var jy;function PT(){return jy||(jy=1,process.env.NODE_ENV!=="production"&&(function(){function t(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===H?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case b:return"Fragment";case M:return"Profiler";case E:return"StrictMode";case z:return"Suspense";case X:return"SuspenseList";case B:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case w:return"Portal";case F:return x.displayName||"Context";case S:return(x._context.displayName||"Context")+".Consumer";case D:var h=x.render;return x=x.displayName,x||(x=h.displayName||h.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case Y:return h=x.displayName||null,h!==null?h:t(x.type)||"Memo";case U:h=x._payload,x=x._init;try{return t(x(h))}catch{}}return null}function e(x){return""+x}function n(x){try{e(x);var h=!1}catch{h=!0}if(h){h=console;var m=h.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return m.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),e(x)}}function r(x){if(x===b)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===U)return"<...>";try{var h=t(x);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function i(){var x=V.A;return x===null?null:x.getOwner()}function s(){return Error("react-stack-top-frame")}function o(x){if(T.call(x,"key")){var h=Object.getOwnPropertyDescriptor(x,"key").get;if(h&&h.isReactWarning)return!1}return x.key!==void 0}function a(x,h){function m(){R||(R=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}m.isReactWarning=!0,Object.defineProperty(x,"key",{get:m,configurable:!0})}function c(){var x=t(this.type);return P[x]||(P[x]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),x=this.props.ref,x!==void 0?x:null}function l(x,h,m,A,C,$){var j=m.ref;return x={$$typeof:v,type:x,key:h,props:m,_owner:A},(j!==void 0?j:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:c}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function u(x,h,m,A,C,$){var j=h.children;if(j!==void 0)if(A)if(p(j)){for(A=0;A<j.length;A++)d(j[A]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(j);if(T.call(h,"key")){j=t(x);var Z=Object.keys(h).filter(function(se){return se!=="key"});A=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",N[j+A]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as Of from "react";
2
2
  import BT, { createContext as gc, useRef as xi, useLayoutEffect as UT, useEffect as Km, useId as Vm, useContext as gr, useInsertionEffect as jm, useMemo as Rs, useCallback as m_, Children as $T, isValidElement as FT, useState as Xa, Fragment as g_, createElement as KT, forwardRef as VT, Component as jT } from "react";
3
- var lu = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3
+ import './index.css';var lu = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
4
4
  function yc(t) {
5
5
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antigane/wallet-adapters",
3
3
  "private": false,
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/antiganehq",
7
7
  "repository": {
@@ -51,7 +51,8 @@
51
51
  "typescript": "~5.9.3",
52
52
  "typescript-eslint": "^8.46.4",
53
53
  "vite": "^7.2.4",
54
- "vite-plugin-dts": "^4.5.4"
54
+ "vite-plugin-dts": "^4.5.4",
55
+ "vite-plugin-lib-inject-css": "^2.2.2"
55
56
  },
56
57
  "scripts": {
57
58
  "dev": "vite",
File without changes