fare-privy-core 1.3.0 → 1.4.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/dist/hooks/useWallets.d.ts +13 -0
- package/dist/hooks/useWallets.d.ts.map +1 -1
- package/dist/hooks/useWallets.js +19 -1
- package/dist/hooks/useWallets.js.map +1 -1
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -47,4 +47,17 @@ export declare const useIsAuthenticated: () => {
|
|
|
47
47
|
/** Privy ready state */
|
|
48
48
|
isReady: boolean;
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Handle user login - perfect for casino entry buttons
|
|
52
|
+
*/
|
|
53
|
+
export declare const useAuthActions: () => {
|
|
54
|
+
/** Login function - opens Privy modal */
|
|
55
|
+
login: (options?: import("@privy-io/react-auth").LoginModalOptions | import("react").MouseEvent<any, any>) => void;
|
|
56
|
+
/** Logout function - disconnects user */
|
|
57
|
+
logout: () => Promise<void>;
|
|
58
|
+
/** Whether actions are ready to use */
|
|
59
|
+
isReady: boolean;
|
|
60
|
+
/** Whether user is currently authenticated */
|
|
61
|
+
isAuthenticated: boolean;
|
|
62
|
+
};
|
|
50
63
|
//# sourceMappingURL=useWallets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWallets.d.ts","sourceRoot":"","sources":["../../hooks/useWallets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"useWallets.d.ts","sourceRoot":"","sources":["../../hooks/useWallets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IA6B5B,mCAAmC;;IAEnC,uCAAuC;;IAEvC,sCAAsC;;IAEtC,0DAA0D;;IAE1D,oCAAoC;;IAEpC,6BAA6B;;CAGhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;IAoB3B,oCAAoC;;IAEpC,kCAAkC;;IAElC,+BAA+B;;IAE/B,6BAA6B;;CAGhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;IAQ3B,qDAAqD;;IAErD,6BAA6B;;IAE7B,kCAAkC;;IAElC,wBAAwB;;CAG3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;IAMvB,yCAAyC;;IAEzC,yCAAyC;;IAEzC,uCAAuC;;IAEvC,8CAA8C;;CAGjD,CAAC"}
|
package/dist/hooks/useWallets.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* No external dependencies - ready to use!
|
|
4
4
|
*/
|
|
5
5
|
import { useMemo } from "react";
|
|
6
|
-
import { usePrivy, useWallets as usePrivyWallets, } from "@privy-io/react-auth";
|
|
6
|
+
import { usePrivy, useWallets as usePrivyWallets, useLogin, useLogout, } from "@privy-io/react-auth";
|
|
7
7
|
/**
|
|
8
8
|
* Get active/connected wallets
|
|
9
9
|
* Works with both Ethereum and Solana wallets
|
|
@@ -81,4 +81,22 @@ export const useIsAuthenticated = () => {
|
|
|
81
81
|
isReady: ready,
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Handle user login - perfect for casino entry buttons
|
|
86
|
+
*/
|
|
87
|
+
export const useAuthActions = () => {
|
|
88
|
+
const { login } = useLogin();
|
|
89
|
+
const { logout } = useLogout();
|
|
90
|
+
const { ready, authenticated } = usePrivy();
|
|
91
|
+
return {
|
|
92
|
+
/** Login function - opens Privy modal */
|
|
93
|
+
login,
|
|
94
|
+
/** Logout function - disconnects user */
|
|
95
|
+
logout,
|
|
96
|
+
/** Whether actions are ready to use */
|
|
97
|
+
isReady: ready,
|
|
98
|
+
/** Whether user is currently authenticated */
|
|
99
|
+
isAuthenticated: authenticated,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
84
102
|
//# sourceMappingURL=useWallets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWallets.js","sourceRoot":"","sources":["../../hooks/useWallets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,QAAQ,EACR,UAAU,IAAI,eAAe,
|
|
1
|
+
{"version":3,"file":"useWallets.js","sourceRoot":"","sources":["../../hooks/useWallets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,QAAQ,EACR,UAAU,IAAI,eAAe,EAC7B,QAAQ,EACR,SAAS,GAEV,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC5C,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;IAEtC,MAAM,gBAAgB,GAAG,OAAO,CAC9B,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAC/C,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,IAAI,CAAC,KAAK,IAAI,CAAC,aAAa,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3E,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE7C,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,OAAO,CACL,gBAAgB,CAAC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CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { PrivyProvider, type PrivyProviderProps } from "./PrivyProviderTest.js";
|
|
6
6
|
export * from "./farePrivy/store/switchWallet.js";
|
|
7
|
-
export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./hooks/useWallets.js";
|
|
7
|
+
export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, useAuthActions, } from "./hooks/useWallets.js";
|
|
8
8
|
/**
|
|
9
9
|
* ✅ PRODUCTION READY - v1.3.0:
|
|
10
10
|
*
|
|
@@ -22,6 +22,7 @@ export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./
|
|
|
22
22
|
* - useConnectedWallets: Get connected wallets (embedded/external)
|
|
23
23
|
* - useWalletAddresses: Get Ethereum & Solana addresses
|
|
24
24
|
* - useIsAuthenticated: Check authentication status
|
|
25
|
+
* - useAuthActions: Login/logout functions for casino entry
|
|
25
26
|
*
|
|
26
27
|
* 💡 Configuration:
|
|
27
28
|
* Users should provide their own Privy configuration.
|
|
@@ -34,7 +35,8 @@ export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./
|
|
|
34
35
|
* PrivyProvider,
|
|
35
36
|
* useConnectedWallets,
|
|
36
37
|
* useWalletAddresses,
|
|
37
|
-
* useIsAuthenticated
|
|
38
|
+
* useIsAuthenticated,
|
|
39
|
+
* useAuthActions
|
|
38
40
|
* } from 'fare-privy-core';
|
|
39
41
|
*
|
|
40
42
|
* // 1. Wrap your app
|
|
@@ -51,13 +53,21 @@ export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./
|
|
|
51
53
|
*
|
|
52
54
|
* // 2. Use hooks in your casino components
|
|
53
55
|
* function YourCasino() {
|
|
54
|
-
* const { primaryWallet
|
|
55
|
-
* const { primarySolanaAddress
|
|
56
|
-
* const { isAuthenticated
|
|
56
|
+
* const { primaryWallet } = useConnectedWallets();
|
|
57
|
+
* const { primarySolanaAddress } = useWalletAddresses();
|
|
58
|
+
* const { isAuthenticated } = useIsAuthenticated();
|
|
59
|
+
* const { login, logout } = useAuthActions();
|
|
57
60
|
*
|
|
58
|
-
* if (!isAuthenticated)
|
|
61
|
+
* if (!isAuthenticated) {
|
|
62
|
+
* return <button onClick={login}>🎰 Enter Casino</button>;
|
|
63
|
+
* }
|
|
59
64
|
*
|
|
60
|
-
* return
|
|
65
|
+
* return (
|
|
66
|
+
* <div>
|
|
67
|
+
* <span>Welcome {primaryWallet?.address}</span>
|
|
68
|
+
* <button onClick={logout}>Exit</button>
|
|
69
|
+
* </div>
|
|
70
|
+
* );
|
|
61
71
|
* }
|
|
62
72
|
* ```
|
|
63
73
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGhF,cAAc,mCAAmC,CAAC;AAGlD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGhF,cAAc,mCAAmC,CAAC;AAGlD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAK/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { PrivyProvider } from "./PrivyProviderTest.js";
|
|
|
7
7
|
// ✅ CORE FUNCTIONALITY - Working exports
|
|
8
8
|
export * from "./farePrivy/store/switchWallet.js";
|
|
9
9
|
// ✅ SIMPLIFIED WALLET HOOKS - No external dependencies!
|
|
10
|
-
export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./hooks/useWallets.js";
|
|
10
|
+
export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, useAuthActions, } from "./hooks/useWallets.js";
|
|
11
11
|
// ❌ REMOVED - Had too many external dependencies
|
|
12
12
|
// export * from "./farePrivy/modals/index.js";
|
|
13
13
|
/**
|
|
@@ -27,6 +27,7 @@ export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./
|
|
|
27
27
|
* - useConnectedWallets: Get connected wallets (embedded/external)
|
|
28
28
|
* - useWalletAddresses: Get Ethereum & Solana addresses
|
|
29
29
|
* - useIsAuthenticated: Check authentication status
|
|
30
|
+
* - useAuthActions: Login/logout functions for casino entry
|
|
30
31
|
*
|
|
31
32
|
* 💡 Configuration:
|
|
32
33
|
* Users should provide their own Privy configuration.
|
|
@@ -39,7 +40,8 @@ export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./
|
|
|
39
40
|
* PrivyProvider,
|
|
40
41
|
* useConnectedWallets,
|
|
41
42
|
* useWalletAddresses,
|
|
42
|
-
* useIsAuthenticated
|
|
43
|
+
* useIsAuthenticated,
|
|
44
|
+
* useAuthActions
|
|
43
45
|
* } from 'fare-privy-core';
|
|
44
46
|
*
|
|
45
47
|
* // 1. Wrap your app
|
|
@@ -56,13 +58,21 @@ export { useConnectedWallets, useWalletAddresses, useIsAuthenticated, } from "./
|
|
|
56
58
|
*
|
|
57
59
|
* // 2. Use hooks in your casino components
|
|
58
60
|
* function YourCasino() {
|
|
59
|
-
* const { primaryWallet
|
|
60
|
-
* const { primarySolanaAddress
|
|
61
|
-
* const { isAuthenticated
|
|
61
|
+
* const { primaryWallet } = useConnectedWallets();
|
|
62
|
+
* const { primarySolanaAddress } = useWalletAddresses();
|
|
63
|
+
* const { isAuthenticated } = useIsAuthenticated();
|
|
64
|
+
* const { login, logout } = useAuthActions();
|
|
62
65
|
*
|
|
63
|
-
* if (!isAuthenticated)
|
|
66
|
+
* if (!isAuthenticated) {
|
|
67
|
+
* return <button onClick={login}>🎰 Enter Casino</button>;
|
|
68
|
+
* }
|
|
64
69
|
*
|
|
65
|
-
* return
|
|
70
|
+
* return (
|
|
71
|
+
* <div>
|
|
72
|
+
* <span>Welcome {primaryWallet?.address}</span>
|
|
73
|
+
* <button onClick={logout}>Exit</button>
|
|
74
|
+
* </div>
|
|
75
|
+
* );
|
|
66
76
|
* }
|
|
67
77
|
* ```
|
|
68
78
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oCAAoC;AACpC,OAAO,EAAE,aAAa,EAA2B,MAAM,wBAAwB,CAAC;AAEhF,yCAAyC;AACzC,cAAc,mCAAmC,CAAC;AAElD,wDAAwD;AACxD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oCAAoC;AACpC,OAAO,EAAE,aAAa,EAA2B,MAAM,wBAAwB,CAAC;AAEhF,yCAAyC;AACzC,cAAc,mCAAmC,CAAC;AAElD,wDAAwD;AACxD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAE/B,iDAAiD;AACjD,+CAA+C;AAE/C;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG"}
|