fare-privy-core 1.7.1 โ†’ 1.7.5

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.
Files changed (42) hide show
  1. package/README.md +64 -12
  2. package/dist/PrivyProviderTest.d.ts +13 -0
  3. package/dist/PrivyProviderTest.d.ts.map +1 -1
  4. package/dist/PrivyProviderTest.js +38 -0
  5. package/dist/PrivyProviderTest.js.map +1 -1
  6. package/dist/hooks/index.d.ts +26 -0
  7. package/dist/hooks/index.d.ts.map +1 -0
  8. package/dist/hooks/index.js +29 -0
  9. package/dist/hooks/index.js.map +1 -0
  10. package/dist/hooks/useActiveWallet.d.ts +21 -0
  11. package/dist/hooks/useActiveWallet.d.ts.map +1 -0
  12. package/dist/hooks/useActiveWallet.js +56 -0
  13. package/dist/hooks/useActiveWallet.js.map +1 -0
  14. package/dist/hooks/useAuthActions.d.ts +15 -0
  15. package/dist/hooks/useAuthActions.d.ts.map +1 -0
  16. package/dist/hooks/useAuthActions.js +21 -0
  17. package/dist/hooks/useAuthActions.js.map +1 -0
  18. package/dist/hooks/useConnectedWallets.d.ts +19 -0
  19. package/dist/hooks/useConnectedWallets.d.ts.map +1 -0
  20. package/dist/hooks/useConnectedWallets.js +39 -0
  21. package/dist/hooks/useConnectedWallets.js.map +1 -0
  22. package/dist/hooks/useIsAuthenticated.d.ts +15 -0
  23. package/dist/hooks/useIsAuthenticated.d.ts.map +1 -0
  24. package/dist/hooks/useIsAuthenticated.js +23 -0
  25. package/dist/hooks/useIsAuthenticated.js.map +1 -0
  26. package/dist/hooks/useWalletAddresses.d.ts +15 -0
  27. package/dist/hooks/useWalletAddresses.d.ts.map +1 -0
  28. package/dist/hooks/useWalletAddresses.js +53 -0
  29. package/dist/hooks/useWalletAddresses.js.map +1 -0
  30. package/dist/hooks/useWalletBalance.d.ts +26 -0
  31. package/dist/hooks/useWalletBalance.d.ts.map +1 -0
  32. package/dist/hooks/useWalletBalance.js +117 -0
  33. package/dist/hooks/useWalletBalance.js.map +1 -0
  34. package/dist/index.d.ts +25 -15
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +26 -16
  37. package/dist/index.js.map +1 -1
  38. package/package.json +2 -2
  39. package/dist/hooks/useWallets.d.ts +0 -81
  40. package/dist/hooks/useWallets.d.ts.map +0 -1
  41. package/dist/hooks/useWallets.js +0 -227
  42. package/dist/hooks/useWallets.js.map +0 -1
package/README.md CHANGED
@@ -2,20 +2,22 @@
2
2
 
3
3
  A lightweight React library for Privy authentication and wallet management, designed for casino and gaming applications on **Ethereum and Solana**.
4
4
 
5
- ## ๐Ÿš€ Current Features (v1.7.0)
5
+ ## ๐Ÿš€ Current Features (v1.7.5)
6
6
 
7
7
  - **๐Ÿ” Real Privy Auth**: Full Privy authentication integration with login/logout
8
8
  - **๐ŸŽฐ Casino-Ready**: Pre-configured for casino/gaming use cases
9
9
  - **โ›“๏ธ Multi-Chain**: Support for both Ethereum and Solana networks
10
- - **๏ฟฝ Balance Checking**: Native currency balance fetching (ETH/SOL)
11
- - **๏ฟฝ๐Ÿ’ผ Wallet State**: Valtio-based wallet switching state management
10
+ - **๐Ÿ’ฐ Reliable Balance Checking**: Simplified balance fetching based on proven working patterns (ETH/SOL)
11
+ - **๐ŸŽฏ Active Wallet Management**: useActiveWallet hook based on successful casino implementations
12
+ - **๐Ÿ”— Solana Helper Functions**: Easy Solana connector setup with TypeScript compatibility
13
+ - **๐Ÿ’ผ Wallet State**: Valtio-based wallet switching state management
12
14
  - **๐ŸŽจ Themeable**: Customize colors and branding per casino
13
- - **๐Ÿช Complete Hooks**: 5 dependency-free hooks including balance checking
15
+ - **๐Ÿช Micro Hooks**: 6 focused hooks with single responsibilities and proven reliability
14
16
  - **๐Ÿšช Login/Logout**: Easy authentication control for casino entry/exit
15
17
  - **โšก TypeScript**: Full TypeScript support with type declarations
16
- - **๐Ÿงช Tested**: Complete test suite with 17 passing tests
17
- - **๐Ÿ“ฆ Optimized**: Streamlined codebase with unused files removed
18
- - **๐Ÿ—‚๏ธ Clean**: Minimal dependencies, focused API
18
+ - **๐Ÿงช Tested**: 3/4 test suites passing with reliable integration tests
19
+ - **๐Ÿ“ฆ Tree Shakable**: Import only what you need for smaller bundle sizes
20
+ - **๐Ÿ—‚๏ธ Clean**: Minimal dependencies, proven patterns
19
21
 
20
22
  ## ๐Ÿ“ฆ Installation
21
23
 
@@ -45,6 +47,7 @@ npm install fare-privy-core @privy-io/react-auth styled-components@^5.3.0 valtio
45
47
  ```tsx
46
48
  import {
47
49
  PrivyProvider,
50
+ useActiveWallet,
48
51
  useConnectedWallets,
49
52
  useIsAuthenticated,
50
53
  useWalletBalance
@@ -196,7 +199,7 @@ function MultiChainCasino() {
196
199
 
197
200
  ## ๐Ÿช Using Wallet Hooks
198
201
 
199
- Four simple, **dependency-free** hooks to access wallet data and control authentication in your casino:
202
+ Six focused **micro hooks** with proven patterns - import only what you need for optimal bundle sizes:
200
203
 
201
204
  ### `useAuthActions()` - Login & Logout Control
202
205
 
@@ -236,6 +239,26 @@ function WalletDisplay() {
236
239
  }
237
240
  ```
238
241
 
242
+ ### `useActiveWallet()` - Get active wallet (proven pattern)
243
+
244
+ ```tsx
245
+ import { useActiveWallet } from 'fare-privy-core';
246
+
247
+ function CasinoGame() {
248
+ const {
249
+ activeWallet, // Current active wallet
250
+ privyWallet, // Embedded Privy wallet
251
+ externalWallet, // MetaMask/Phantom etc.
252
+ walletAddress, // Active wallet address
253
+ isWalletAuthed, // Boolean: has active wallet
254
+ readyAndAuth // Boolean: ready and authenticated
255
+ } = useActiveWallet();
256
+
257
+ if (!isWalletAuthed) return <div>Connect wallet to play</div>;
258
+ return <div>Playing with: {walletAddress}</div>;
259
+ }
260
+ ```
261
+
239
262
  ### `useWalletAddresses()` - Get addresses by chain
240
263
 
241
264
  ```tsx
@@ -298,11 +321,40 @@ function WalletBalanceDisplay() {
298
321
 
299
322
  ๐Ÿ“– **[See complete hook documentation โ†’](./HOOKS.md)**
300
323
 
301
- ## ๏ฟฝ Changelog
302
-
303
- ### v1.7.0 (Latest)
324
+ ## ๐Ÿ“ Changelog
325
+
326
+ ### v1.7.5 (Latest) - Reliable Patterns & Simplified Balance
327
+ - **๐ŸŽฏ Added**: useActiveWallet hook based on proven working casino patterns
328
+ - **๐Ÿ’ฐ Simplified**: useWalletBalance rewritten with reliable single-wallet approach
329
+ - **๐Ÿ”ง Fixed**: Removed complex wallet filtering in favor of simple active wallet selection
330
+ - **โšก Improved**: Balance fetching now uses sequential approach instead of complex promises
331
+ - **๐Ÿงช Tested**: 3/4 test suites passing with reliable integration tests
332
+ - **๐Ÿ“– Enhanced**: Updated documentation with new useActiveWallet examples
333
+
334
+ ### v1.7.4 - Micro Hooks Architecture
335
+ - **๐Ÿช Refactored**: Split monolithic useWallets hook into 5 focused micro hooks
336
+ - **๐ŸŒณ Tree Shaking**: Import only the hooks you need for smaller bundle sizes
337
+ - **๐Ÿงน Maintainable**: Each hook has single responsibility and clear purpose
338
+ - **๐Ÿ“ Organized**: Proper hooks/index.ts structure for clean imports
339
+ - **โšก Performance**: Reduced coupling between hook functionalities
340
+ - **๐Ÿ”ง Developer Experience**: Easier testing and debugging of individual hooks
341
+
342
+ ### v1.7.3 - Enhanced Balance with Privy Providers
343
+ - **๐Ÿ”— Enhanced**: useWalletBalance now uses Privy's native wallet providers instead of manual RPC calls
344
+ - **โšก Improved**: More reliable balance fetching with proper provider integration
345
+ - **๐Ÿ”ง Added**: createSolanaConnectors() and disableSolanaConnectors() helper functions
346
+ - **๐Ÿ› ๏ธ Fixed**: Solana connector TypeScript compatibility issues
347
+ - **๐Ÿงช Tested**: All functionality verified with improved architecture
348
+ - **๐Ÿ“– Documentation**: Updated with balance improvements and new helper functions
349
+
350
+ ### v1.7.2
351
+ - **๐Ÿ› Fixed**: Solana connector configuration with proper TypeScript types
352
+ - **๐Ÿ”„ Added**: Helper functions for dynamic Solana connector management
353
+ - **โšก Improved**: Error handling for missing Solana wallet adapter packages
354
+
355
+ ### v1.7.1
304
356
  - **๐Ÿ’ฐ Added**: useWalletBalance hook for native currency balance checking
305
- - **โ›“๏ธ Enhanced**: Support for ETH and SOL balance fetching via RPC calls
357
+ - **โ›“๏ธ Enhanced**: Support for ETH and SOL balance fetching
306
358
  - **โšก Improved**: Real-time balance updates with loading states and error handling
307
359
  - **๐Ÿ”„ Added**: Manual balance refresh functionality
308
360
  - **๐Ÿงช Tested**: All 17 tests passing including new balance functionality
@@ -1,5 +1,18 @@
1
1
  import React from "react";
2
2
  import { type PrivyClientConfig } from "@privy-io/react-auth";
3
+ /**
4
+ * Helper function to create proper Solana wallet configuration
5
+ * Use this to avoid TypeScript errors with Solana connectors
6
+ */
7
+ export declare const createSolanaConnectors: () => {
8
+ connectors: () => Promise<any[]>;
9
+ };
10
+ /**
11
+ * Helper to disable Solana without errors
12
+ */
13
+ export declare const disableSolanaConnectors: () => {
14
+ connectors: any[];
15
+ };
3
16
  export interface PrivyProviderProps {
4
17
  children: React.ReactNode;
5
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PrivyProviderTest.d.ts","sourceRoot":"","sources":["../PrivyProviderTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;IACvD;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8DtD,CAAC"}
1
+ {"version":3,"file":"PrivyProviderTest.d.ts","sourceRoot":"","sources":["../PrivyProviderTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;CA2BjC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;CAElC,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;IACvD;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8DtD,CAAC"}
@@ -2,6 +2,44 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { PrivyProvider as _PrivyProvider, } from "@privy-io/react-auth";
4
4
  import { SmartWalletsProvider } from "@privy-io/react-auth/smart-wallets";
5
+ /**
6
+ * Helper function to create proper Solana wallet configuration
7
+ * Use this to avoid TypeScript errors with Solana connectors
8
+ */
9
+ export const createSolanaConnectors = () => ({
10
+ connectors: async () => {
11
+ try {
12
+ // Dynamically import wallet adapters to avoid bundle size issues
13
+ // Users need to install these packages: @solana/wallet-adapter-phantom @solana/wallet-adapter-solflare
14
+ const adapters = [];
15
+ try {
16
+ const { PhantomWalletAdapter } = await import('@solana/wallet-adapter-phantom');
17
+ adapters.push(new PhantomWalletAdapter());
18
+ }
19
+ catch (e) {
20
+ console.warn('PhantomWalletAdapter not available');
21
+ }
22
+ try {
23
+ const { SolflareWalletAdapter } = await import('@solana/wallet-adapter-solflare');
24
+ adapters.push(new SolflareWalletAdapter());
25
+ }
26
+ catch (e) {
27
+ console.warn('SolflareWalletAdapter not available');
28
+ }
29
+ return adapters;
30
+ }
31
+ catch (error) {
32
+ console.warn('Failed to load Solana wallet adapters:', error);
33
+ return [];
34
+ }
35
+ }
36
+ });
37
+ /**
38
+ * Helper to disable Solana without errors
39
+ */
40
+ export const disableSolanaConnectors = () => ({
41
+ connectors: []
42
+ });
5
43
  /**
6
44
  * Lightweight Privy authentication wrapper for casino applications
7
45
  * Compatible with the original farePrivy architecture
@@ -1 +1 @@
1
- {"version":3,"file":"PrivyProviderTest.js","sourceRoot":"","sources":["../PrivyProviderTest.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EACL,aAAa,IAAI,cAAc,GAEhC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAwC1E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,M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C;QAED,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;IAEjC,8DAA8D;IAC9D,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,YAClE,QAAQ,GACM,CAClB,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,YACnE,KAAC,oBAAoB,IAAC,MAAM,EAAE,iBAAiB,YAC5C,QAAQ,GACY,GACR,CAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Hooks Index - fare-privy-core
3
+ * Micro hooks for clean wallet management
4
+ */
5
+ export { useConnectedWallets } from "./useConnectedWallets";
6
+ export { useIsAuthenticated } from "./useIsAuthenticated";
7
+ export { useAuthActions } from "./useAuthActions";
8
+ export { useActiveWallet } from "./useActiveWallet";
9
+ export { useWalletAddresses } from "./useWalletAddresses";
10
+ export { useWalletBalance } from "./useWalletBalance";
11
+ /**
12
+ * ๐Ÿช MICRO HOOKS ARCHITECTURE:
13
+ *
14
+ * Each hook has a single responsibility:
15
+ *
16
+ * โœ… useConnectedWallets - Wallet connection management (embedded vs external)
17
+ * โœ… useActiveWallet - Simple active wallet selection (based on working pattern)
18
+ * โœ… useWalletAddresses - Address extraction by chain type (ETH/SOL)
19
+ * โœ… useIsAuthenticated - Simple authentication status checking
20
+ * โœ… useAuthActions - Login/logout control for casino entry
21
+ * โœ… useWalletBalance - Simplified balance fetching with reliable pattern
22
+ *
23
+ * This modular approach makes testing easier, reduces bundle size for
24
+ * users who only need specific functionality, and improves maintainability.
25
+ */
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Hooks Index - fare-privy-core
3
+ * Micro hooks for clean wallet management
4
+ */
5
+ // Authentication and connection management
6
+ export { useConnectedWallets } from "./useConnectedWallets";
7
+ export { useIsAuthenticated } from "./useIsAuthenticated";
8
+ export { useAuthActions } from "./useAuthActions";
9
+ // Active wallet management (simplified pattern)
10
+ export { useActiveWallet } from "./useActiveWallet";
11
+ // Address and balance management
12
+ export { useWalletAddresses } from "./useWalletAddresses";
13
+ export { useWalletBalance } from "./useWalletBalance";
14
+ /**
15
+ * ๐Ÿช MICRO HOOKS ARCHITECTURE:
16
+ *
17
+ * Each hook has a single responsibility:
18
+ *
19
+ * โœ… useConnectedWallets - Wallet connection management (embedded vs external)
20
+ * โœ… useActiveWallet - Simple active wallet selection (based on working pattern)
21
+ * โœ… useWalletAddresses - Address extraction by chain type (ETH/SOL)
22
+ * โœ… useIsAuthenticated - Simple authentication status checking
23
+ * โœ… useAuthActions - Login/logout control for casino entry
24
+ * โœ… useWalletBalance - Simplified balance fetching with reliable pattern
25
+ *
26
+ * This modular approach makes testing easier, reduces bundle size for
27
+ * users who only need specific functionality, and improves maintainability.
28
+ */
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,gDAAgD;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,iCAAiC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * useActiveWallet - Active wallet management
3
+ * Based on the working pattern from your casino app
4
+ */
5
+ import { type ConnectedWallet } from "@privy-io/react-auth";
6
+ export interface IActiveWallet extends ConnectedWallet {
7
+ getEthereumProvider: () => Promise<any>;
8
+ getSolanaProvider?: () => Promise<any>;
9
+ }
10
+ export declare const useActiveWallet: () => {
11
+ privyWallet: ConnectedWallet;
12
+ externalWallet: ConnectedWallet;
13
+ activeWallet: IActiveWallet;
14
+ isWalletAuthed: boolean;
15
+ walletAddress: string;
16
+ ready: boolean;
17
+ authenticated: boolean;
18
+ readyAndAuth: boolean;
19
+ linkedWallets: ConnectedWallet[];
20
+ };
21
+ //# sourceMappingURL=useActiveWallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActiveWallet.d.ts","sourceRoot":"","sources":["../../hooks/useActiveWallet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,eAAe;;;;;;;;;;CAsE3B,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * useActiveWallet - Active wallet management
3
+ * Based on the working pattern from your casino app
4
+ */
5
+ import { useMemo } from "react";
6
+ import { usePrivy, useWallets, } from "@privy-io/react-auth";
7
+ export const useActiveWallet = () => {
8
+ const { ready, authenticated } = usePrivy();
9
+ const { wallets: unlinkedWallets } = useWallets();
10
+ const wallets = useMemo(() => unlinkedWallets.filter((wallet) => wallet.linked), [unlinkedWallets]);
11
+ const linkedWallets = useMemo(() => wallets.filter((wallet) => wallet.linked), [wallets]);
12
+ const privyWallet = useMemo(() => {
13
+ if (!ready || !authenticated)
14
+ return null;
15
+ const wallet = linkedWallets.find((wallet) => wallet.connectorType === "embedded");
16
+ return wallet || null;
17
+ }, [linkedWallets, ready, authenticated]);
18
+ const externalWallet = useMemo(() => {
19
+ if (!ready || !authenticated)
20
+ return null;
21
+ const wallet = linkedWallets.find((wallet) => wallet.connectorType !== "embedded");
22
+ return wallet || null;
23
+ }, [linkedWallets, ready, authenticated]);
24
+ const activeWallet = useMemo(() => {
25
+ if (!ready || !authenticated)
26
+ return null;
27
+ // Prefer external wallet, fallback to embedded
28
+ const selectedWallet = externalWallet || privyWallet;
29
+ return selectedWallet;
30
+ }, [linkedWallets, ready, authenticated, externalWallet, privyWallet]);
31
+ const walletAddress = useMemo(() => activeWallet?.address || "", [activeWallet]);
32
+ const isWalletAuthed = useMemo(() => Boolean(activeWallet), [activeWallet]);
33
+ const readyAndAuth = useMemo(() => ready && authenticated, [ready, authenticated]);
34
+ return useMemo(() => ({
35
+ privyWallet,
36
+ externalWallet,
37
+ activeWallet,
38
+ isWalletAuthed,
39
+ walletAddress,
40
+ ready,
41
+ authenticated,
42
+ readyAndAuth,
43
+ linkedWallets,
44
+ }), [
45
+ privyWallet,
46
+ externalWallet,
47
+ activeWallet,
48
+ isWalletAuthed,
49
+ walletAddress,
50
+ ready,
51
+ authenticated,
52
+ readyAndAuth,
53
+ linkedWallets,
54
+ ]);
55
+ };
56
+ //# sourceMappingURL=useActiveWallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActiveWallet.js","sourceRoot":"","sources":["../../hooks/useActiveWallet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,QAAQ,EACR,UAAU,GAEX,MAAM,sBAAsB,CAAC;AAO9B,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC5C,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,UAAU,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EACvD,CAAC,eAAe,CAAC,CAClB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CAC3B,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,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;QAC/B,IAAI,CAAC,KAAK,IAAI,CAAC,aAAa;YAAE,OAAO,IAAI,CAAC;QAC1C,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAC/B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,KAAK,UAAU,CAChD,CAAC;QACF,OAAO,MAAM,IAAI,IAAI,CAAC;IACxB,CAAC,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAE1C,MAAM,cAAc,GAAG,OAAO,CAAC,GAA2B,EAAE;QAC1D,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J,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * useAuthActions - Login and logout control
3
+ * Handle user authentication - perfect for casino entry buttons
4
+ */
5
+ export declare const useAuthActions: () => {
6
+ /** Login function - opens Privy modal */
7
+ login: (options?: import("@privy-io/react-auth").LoginModalOptions | import("react").MouseEvent<any, any>) => void;
8
+ /** Logout function - disconnects user */
9
+ logout: () => Promise<void>;
10
+ /** Whether actions are ready to use */
11
+ isReady: boolean;
12
+ /** Whether user is currently authenticated */
13
+ isAuthenticated: boolean;
14
+ };
15
+ //# sourceMappingURL=useAuthActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuthActions.d.ts","sourceRoot":"","sources":["../../hooks/useAuthActions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,eAAO,MAAM,cAAc;IAMvB,yCAAyC;;IAEzC,yCAAyC;;IAEzC,uCAAuC;;IAEvC,8CAA8C;;CAGjD,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * useAuthActions - Login and logout control
3
+ * Handle user authentication - perfect for casino entry buttons
4
+ */
5
+ import { usePrivy, useLogin, useLogout } from "@privy-io/react-auth";
6
+ export const useAuthActions = () => {
7
+ const { login } = useLogin();
8
+ const { logout } = useLogout();
9
+ const { ready, authenticated } = usePrivy();
10
+ return {
11
+ /** Login function - opens Privy modal */
12
+ login,
13
+ /** Logout function - disconnects user */
14
+ logout,
15
+ /** Whether actions are ready to use */
16
+ isReady: ready,
17
+ /** Whether user is currently authenticated */
18
+ isAuthenticated: authenticated,
19
+ };
20
+ };
21
+ //# sourceMappingURL=useAuthActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuthActions.js","sourceRoot":"","sources":["../../hooks/useAuthActions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE5C,OAAO;QACL,yCAAyC;QACzC,KAAK;QACL,yCAAyC;QACzC,MAAM;QACN,uCAAuC;QACvC,OAAO,EAAE,KAAK;QACd,8CAA8C;QAC9C,eAAe,EAAE,aAAa;KAC/B,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * useConnectedWallets - Wallet connection management
3
+ * Get active/connected wallets for both Ethereum and Solana
4
+ */
5
+ export declare const useConnectedWallets: () => {
6
+ /** All connected/linked wallets */
7
+ connectedWallets: import("@privy-io/react-auth").ConnectedWallet[];
8
+ /** Primary wallet (first connected) */
9
+ primaryWallet: import("@privy-io/react-auth").ConnectedWallet;
10
+ /** Embedded Privy wallet if exists */
11
+ embeddedWallet: import("@privy-io/react-auth").ConnectedWallet;
12
+ /** External wallet (MetaMask, Phantom, etc.) if exists */
13
+ externalWallet: import("@privy-io/react-auth").ConnectedWallet;
14
+ /** Whether user is authenticated */
15
+ isAuthenticated: boolean;
16
+ /** Whether Privy is ready */
17
+ isReady: boolean;
18
+ };
19
+ //# sourceMappingURL=useConnectedWallets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConnectedWallets.d.ts","sourceRoot":"","sources":["../../hooks/useConnectedWallets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,mBAAmB;IA6B5B,mCAAmC;;IAEnC,uCAAuC;;IAEvC,sCAAsC;;IAEtC,0DAA0D;;IAE1D,oCAAoC;;IAEpC,6BAA6B;;CAGhC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * useConnectedWallets - Wallet connection management
3
+ * Get active/connected wallets for both Ethereum and Solana
4
+ */
5
+ import { useMemo } from "react";
6
+ import { usePrivy, useWallets as usePrivyWallets } from "@privy-io/react-auth";
7
+ export const useConnectedWallets = () => {
8
+ const { ready, authenticated } = usePrivy();
9
+ const { wallets } = usePrivyWallets();
10
+ const connectedWallets = useMemo(() => wallets.filter((wallet) => wallet.linked), [wallets]);
11
+ const primaryWallet = useMemo(() => {
12
+ if (!ready || !authenticated || connectedWallets.length === 0)
13
+ return null;
14
+ return connectedWallets[0];
15
+ }, [ready, authenticated, connectedWallets]);
16
+ const embeddedWallet = useMemo(() => {
17
+ return (connectedWallets.find((wallet) => wallet.connectorType === "embedded") ||
18
+ null);
19
+ }, [connectedWallets]);
20
+ const externalWallet = useMemo(() => {
21
+ return (connectedWallets.find((wallet) => wallet.connectorType !== "embedded") ||
22
+ null);
23
+ }, [connectedWallets]);
24
+ return {
25
+ /** All connected/linked wallets */
26
+ connectedWallets,
27
+ /** Primary wallet (first connected) */
28
+ primaryWallet,
29
+ /** Embedded Privy wallet if exists */
30
+ embeddedWallet,
31
+ /** External wallet (MetaMask, Phantom, etc.) if exists */
32
+ externalWallet,
33
+ /** Whether user is authenticated */
34
+ isAuthenticated: authenticated && ready,
35
+ /** Whether Privy is ready */
36
+ isReady: ready,
37
+ };
38
+ };
39
+ //# sourceMappingURL=useConnectedWallets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConnectedWallets.js","sourceRoot":"","sources":["../../hooks/useConnectedWallets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE/E,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,g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export declare const useIsAuthenticated: () => {
6
+ /** User is authenticated and has wallet connected */
7
+ isAuthenticated: boolean;
8
+ /** User object from Privy */
9
+ user: import("@privy-io/react-auth").User;
10
+ /** Number of connected wallets */
11
+ walletCount: number;
12
+ /** Privy ready state */
13
+ isReady: boolean;
14
+ };
15
+ //# sourceMappingURL=useIsAuthenticated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsAuthenticated.d.ts","sourceRoot":"","sources":["../../hooks/useIsAuthenticated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,kBAAkB;IAQ3B,qDAAqD;;IAErD,6BAA6B;;IAE7B,kCAAkC;;IAElC,wBAAwB;;CAG3B,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * useIsAuthenticated - Simple authentication status checker
3
+ * Check if user is authenticated with wallet connected
4
+ */
5
+ import { usePrivy } from "@privy-io/react-auth";
6
+ import { useConnectedWallets } from "./useConnectedWallets";
7
+ export const useIsAuthenticated = () => {
8
+ const { user, ready, authenticated } = usePrivy();
9
+ const { connectedWallets } = useConnectedWallets();
10
+ const hasWallet = connectedWallets.length > 0;
11
+ const isFullyAuthenticated = authenticated && ready && hasWallet;
12
+ return {
13
+ /** User is authenticated and has wallet connected */
14
+ isAuthenticated: isFullyAuthenticated,
15
+ /** User object from Privy */
16
+ user,
17
+ /** Number of connected wallets */
18
+ walletCount: connectedWallets.length,
19
+ /** Privy ready state */
20
+ isReady: ready,
21
+ };
22
+ };
23
+ //# sourceMappingURL=useIsAuthenticated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsAuthenticated.js","sourceRoot":"","sources":["../../hooks/useIsAuthenticated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAAC;IAClD,MAAM,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAEnD,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9C,MAAM,oBAAoB,GAAG,aAAa,IAAI,KAAK,IAAI,SAAS,CAAC;IAEjE,OAAO;QACL,qDAAqD;QACrD,eAAe,EAAE,oBAAoB;QACrC,6BAA6B;QAC7B,IAAI;QACJ,kCAAkC;QAClC,WAAW,EAAE,gBAAgB,CAAC,MAAM;QACpC,wBAAwB;QACxB,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * useWalletAddresses - Address extraction by chain type
3
+ * Get wallet addresses organized by blockchain
4
+ */
5
+ export declare const useWalletAddresses: () => {
6
+ /** All Ethereum wallet addresses */
7
+ ethereumAddresses: string[];
8
+ /** All Solana wallet addresses */
9
+ solanaAddresses: string[];
10
+ /** Primary Ethereum address */
11
+ primaryEthereumAddress: string;
12
+ /** Primary Solana address */
13
+ primarySolanaAddress: string;
14
+ };
15
+ //# sourceMappingURL=useWalletAddresses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWalletAddresses.d.ts","sourceRoot":"","sources":["../../hooks/useWalletAddresses.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,kBAAkB;IA2C3B,oCAAoC;;IAEpC,kCAAkC;;IAElC,+BAA+B;;IAE/B,6BAA6B;;CAGhC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * useWalletAddresses - Address extraction by chain type
3
+ * Get wallet addresses organized by blockchain
4
+ */
5
+ import { useMemo, useEffect } from "react";
6
+ import { useConnectedWallets } from "./useConnectedWallets";
7
+ export const useWalletAddresses = () => {
8
+ const { connectedWallets } = useConnectedWallets();
9
+ const ethereumAddresses = useMemo(() => {
10
+ return connectedWallets
11
+ .filter((w) => {
12
+ // Multiple ways to check for Ethereum wallets
13
+ const chainType = w.chainType;
14
+ const walletClientType = w.walletClientType;
15
+ const connectorType = w.connectorType;
16
+ return (chainType === "ethereum" ||
17
+ walletClientType === "ethereum" ||
18
+ connectorType === "embedded" || // Embedded wallets are usually Ethereum
19
+ connectorType === "injected" || // MetaMask, etc.
20
+ !chainType // Default to Ethereum if no chain type specified
21
+ );
22
+ })
23
+ .map((w) => w.address);
24
+ }, [connectedWallets]);
25
+ const solanaAddresses = useMemo(() => {
26
+ return connectedWallets
27
+ .filter((w) => {
28
+ const chainType = w.chainType;
29
+ const walletClientType = w.walletClientType;
30
+ return chainType === "solana" || walletClientType === "solana";
31
+ })
32
+ .map((w) => w.address);
33
+ }, [connectedWallets]);
34
+ // Debug logging
35
+ useEffect(() => {
36
+ if (process.env.NODE_ENV === "development") {
37
+ console.log("[fare-privy-core] Connected wallets:", connectedWallets);
38
+ console.log("[fare-privy-core] Ethereum addresses:", ethereumAddresses);
39
+ console.log("[fare-privy-core] Solana addresses:", solanaAddresses);
40
+ }
41
+ }, [connectedWallets, ethereumAddresses, solanaAddresses]);
42
+ return {
43
+ /** All Ethereum wallet addresses */
44
+ ethereumAddresses,
45
+ /** All Solana wallet addresses */
46
+ solanaAddresses,
47
+ /** Primary Ethereum address */
48
+ primaryEthereumAddress: ethereumAddresses[0] || null,
49
+ /** Primary Solana address */
50
+ primarySolanaAddress: solanaAddresses[0] || null,
51
+ };
52
+ };
53
+ //# sourceMappingURL=useWalletAddresses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWalletAddresses.js","sourceRoot":"","sources":["../../hooks/useWalletAddresses.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,M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EAAE,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,gBAAgB,CAAC,CAAC;YACtE,OAAO,CAAC,GAAG,CAAC,uCAAuC,EAAE,iBAAiB,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC;IACH,CAAC,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAC,CAAC;IAE3D,OAAO;QACL,oCAAoC;QACpC,iBAAiB;QACjB,kCAAkC;QAClC,eAAe;QACf,+BAA+B;QAC/B,sBAAsB,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,IAAI;QACpD,6BAA6B;QAC7B,oBAAoB,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,IAAI;KACjD,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * useWalletBalance - Simple balance fetching based on working pattern
3
+ * Uses similar approach to useActiveWallet for reliable wallet handling
4
+ */
5
+ import { type ConnectedWallet } from "@privy-io/react-auth";
6
+ export interface IWalletWithProvider extends ConnectedWallet {
7
+ getEthereumProvider: () => Promise<any>;
8
+ getSolanaProvider?: () => Promise<any>;
9
+ }
10
+ export declare const useWalletBalance: () => {
11
+ /** Ethereum balance in ETH (formatted to 6 decimals) */
12
+ ethereumBalance: string;
13
+ /** Solana balance in SOL (formatted to 6 decimals) */
14
+ solanaBalance: string;
15
+ /** Whether balance fetch is in progress */
16
+ loading: boolean;
17
+ /** Error message if balance fetch failed */
18
+ error: string;
19
+ /** Manually refresh balances */
20
+ refreshBalances: () => Promise<void>;
21
+ /** Whether any balances are available */
22
+ hasBalances: boolean;
23
+ /** Active wallet being used for balance fetching */
24
+ activeWallet: IWalletWithProvider;
25
+ };
26
+ //# sourceMappingURL=useWalletBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWalletBalance.d.ts","sourceRoot":"","sources":["../../hooks/useWalletBalance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,gBAAgB;IA2GzB,wDAAwD;;IAExD,sDAAsD;;IAEtD,2CAA2C;;IAE3C,4CAA4C;;IAE5C,gCAAgC;;IAEhC,yCAAyC;;IAEzC,oDAAoD;;CAGvD,CAAC"}