fare-privy-core 1.7.7 → 1.7.9
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/README.md +101 -22
- package/dist/index.d.ts +11 -61
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -61
- package/dist/index.js.map +1 -1
- package/dist/src/components/WalletOverview.d.ts +14 -0
- package/dist/src/components/WalletOverview.d.ts.map +1 -0
- package/dist/src/components/WalletOverview.js +46 -0
- package/dist/src/components/WalletOverview.js.map +1 -0
- package/dist/src/components/shared/Button/index.d.ts +22 -0
- package/dist/src/components/shared/Button/index.d.ts.map +1 -0
- package/dist/src/components/shared/Button/index.js +16 -0
- package/dist/src/components/shared/Button/index.js.map +1 -0
- package/dist/src/components/shared/Button/style.d.ts +560 -0
- package/dist/src/components/shared/Button/style.d.ts.map +1 -0
- package/dist/src/components/shared/Button/style.js +249 -0
- package/dist/src/components/shared/Button/style.js.map +1 -0
- package/dist/src/components/shared/Modal/Card.d.ts +4 -0
- package/dist/src/components/shared/Modal/Card.d.ts.map +1 -0
- package/dist/src/components/shared/Modal/Card.js +30 -0
- package/dist/src/components/shared/Modal/Card.js.map +1 -0
- package/dist/src/components/shared/Modal/ModalFooter.d.ts +7 -0
- package/dist/src/components/shared/Modal/ModalFooter.d.ts.map +1 -0
- package/dist/src/components/shared/Modal/ModalFooter.js +10 -0
- package/dist/src/components/shared/Modal/ModalFooter.js.map +1 -0
- package/dist/src/components/shared/Modal/ModalHeader.d.ts +8 -0
- package/dist/src/components/shared/Modal/ModalHeader.d.ts.map +1 -0
- package/dist/src/components/shared/Modal/ModalHeader.js +30 -0
- package/dist/src/components/shared/Modal/ModalHeader.js.map +1 -0
- package/dist/src/components/shared/Modal/animations.d.ts +4 -0
- package/dist/src/components/shared/Modal/animations.d.ts.map +1 -0
- package/dist/src/components/shared/Modal/animations.js +26 -0
- package/dist/src/components/shared/Modal/animations.js.map +1 -0
- package/dist/src/components/shared/Modal/styles.d.ts +1625 -0
- package/dist/src/components/shared/Modal/styles.d.ts.map +1 -0
- package/dist/src/components/shared/Modal/styles.js +210 -0
- package/dist/src/components/shared/Modal/styles.js.map +1 -0
- package/dist/src/components/shared/Modal/types.d.ts +18 -0
- package/dist/src/components/shared/Modal/types.d.ts.map +1 -0
- package/dist/src/components/shared/Modal/types.js +2 -0
- package/dist/src/components/shared/Modal/types.js.map +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/{hooks → src/hooks}/useActiveWallet.d.ts +1 -1
- package/dist/src/hooks/useActiveWallet.d.ts.map +1 -0
- package/dist/{hooks → src/hooks}/useActiveWallet.js +11 -1
- package/dist/src/hooks/useActiveWallet.js.map +1 -0
- package/dist/src/hooks/useAuthActions.d.ts.map +1 -0
- package/dist/src/hooks/useAuthActions.js.map +1 -0
- package/dist/src/hooks/useConnectedWallets.d.ts.map +1 -0
- package/dist/src/hooks/useConnectedWallets.js.map +1 -0
- package/dist/src/hooks/useIsAuthenticated.d.ts.map +1 -0
- package/dist/src/hooks/useIsAuthenticated.js.map +1 -0
- package/dist/src/hooks/useWalletAddresses.d.ts.map +1 -0
- package/dist/{hooks → src/hooks}/useWalletAddresses.js +3 -14
- package/dist/src/hooks/useWalletAddresses.js.map +1 -0
- package/dist/src/hooks/useWalletBalance.d.ts.map +1 -0
- package/dist/{hooks → src/hooks}/useWalletBalance.js +73 -6
- package/dist/src/hooks/useWalletBalance.js.map +1 -0
- package/dist/src/modals/SelectWalletModal/index.d.ts +30 -0
- package/dist/src/modals/SelectWalletModal/index.d.ts.map +1 -0
- package/dist/src/modals/SelectWalletModal/index.js +68 -0
- package/dist/src/modals/SelectWalletModal/index.js.map +1 -0
- package/dist/src/modals/SelectWalletModal/styles.d.ts +3001 -0
- package/dist/src/modals/SelectWalletModal/styles.d.ts.map +1 -0
- package/dist/src/modals/SelectWalletModal/styles.js +137 -0
- package/dist/src/modals/SelectWalletModal/styles.js.map +1 -0
- package/dist/src/modals/SelectWalletModal/variants.d.ts +6 -0
- package/dist/src/modals/SelectWalletModal/variants.d.ts.map +1 -0
- package/dist/src/modals/SelectWalletModal/variants.js +59 -0
- package/dist/src/modals/SelectWalletModal/variants.js.map +1 -0
- package/dist/src/store/switchWallet.d.ts.map +1 -0
- package/dist/src/store/switchWallet.js.map +1 -0
- package/package.json +114 -97
- package/dist/farePrivy/store/switchWallet.d.ts.map +0 -1
- package/dist/farePrivy/store/switchWallet.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useActiveWallet.d.ts.map +0 -1
- package/dist/hooks/useActiveWallet.js.map +0 -1
- package/dist/hooks/useAuthActions.d.ts.map +0 -1
- package/dist/hooks/useAuthActions.js.map +0 -1
- package/dist/hooks/useConnectedWallets.d.ts.map +0 -1
- package/dist/hooks/useConnectedWallets.js.map +0 -1
- package/dist/hooks/useIsAuthenticated.d.ts.map +0 -1
- package/dist/hooks/useIsAuthenticated.js.map +0 -1
- package/dist/hooks/useWalletAddresses.d.ts.map +0 -1
- package/dist/hooks/useWalletAddresses.js.map +0 -1
- package/dist/hooks/useWalletBalance.d.ts.map +0 -1
- package/dist/hooks/useWalletBalance.js.map +0 -1
- /package/dist/{hooks → src/hooks}/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/index.js +0 -0
- /package/dist/{hooks → src/hooks}/useAuthActions.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useAuthActions.js +0 -0
- /package/dist/{hooks → src/hooks}/useConnectedWallets.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useConnectedWallets.js +0 -0
- /package/dist/{hooks → src/hooks}/useIsAuthenticated.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useIsAuthenticated.js +0 -0
- /package/dist/{hooks → src/hooks}/useWalletAddresses.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useWalletBalance.d.ts +0 -0
- /package/dist/{farePrivy → src}/store/switchWallet.d.ts +0 -0
- /package/dist/{farePrivy → src}/store/switchWallet.js +0 -0
package/README.md
CHANGED
|
@@ -1,27 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
A lightweight React library for
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
14
|
-
- **🎨 Themeable**: Customize colors and branding per casino
|
|
15
|
-
- **🪝 Micro Hooks**: 6 focused hooks with single responsibilities and proven reliability
|
|
16
|
-
- **🚪 Login/Logout**: Easy authentication control for casino entry/exit
|
|
17
|
-
- **⚡ TypeScript**: Full TypeScript support with type declarations
|
|
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
|
|
1
|
+
@zynkah/privy-lib
|
|
2
|
+
|
|
3
|
+
A lightweight React library for wallet selection and wallet overview UI components. Designed for easy integration, full portability, and consumer-provided icons and styles. Includes:
|
|
4
|
+
|
|
5
|
+
- **SelectWalletModal**: Animated, responsive modal for selecting and linking wallets.
|
|
6
|
+
- **WalletOverview**: Displays the active wallet’s name and icon.
|
|
7
|
+
- **No asset or config imports**: Consumers provide their own icons and wallet data.
|
|
8
|
+
- **Styled with [styled-components](https://styled-components.com/)**
|
|
9
|
+
|
|
10
|
+
---
|
|
21
11
|
|
|
22
|
-
##
|
|
12
|
+
## 🚀 Installation
|
|
23
13
|
|
|
24
14
|
```bash
|
|
15
|
+
|
|
16
|
+
### SelectWalletModal
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { SelectWalletModal } from "@zynkah/privy-lib";
|
|
20
|
+
|
|
21
|
+
<SelectWalletModal
|
|
22
|
+
isOpen={isWalletModalOpen}
|
|
23
|
+
onClose={() => setWalletModalOpen(false)}
|
|
24
|
+
wallets={wallets} // Array of wallet objects
|
|
25
|
+
appWalletClientType={appWalletClientType}
|
|
26
|
+
setAppWalletClientType={setAppWalletClientType}
|
|
27
|
+
linkWalletToUser={linkWalletToUser}
|
|
28
|
+
embeddedWalletLinks={embeddedWalletLinks}
|
|
29
|
+
icons={{
|
|
30
|
+
dragBar: "/icons/drag-bar.svg",
|
|
31
|
+
privyIcon: "/icons/privy.svg",
|
|
32
|
+
caretDown: "/icons/caret-down.svg",
|
|
33
|
+
linkWallet: "/icons/link-wallet.svg",
|
|
34
|
+
}}
|
|
35
|
+
isMobileScreen={isMobileScreen}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### WalletOverview
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { WalletOverview } from "@zynkah/privy-lib";
|
|
43
|
+
|
|
44
|
+
<WalletOverview
|
|
45
|
+
activeWallet={{
|
|
46
|
+
meta: { name: "Privy Wallet", icon: "/icons/privy.svg" }
|
|
47
|
+
}}
|
|
48
|
+
onClick={() => setWalletModalOpen(true)}
|
|
49
|
+
fallbackIcon="/icons/default-wallet.svg"
|
|
50
|
+
isTabletScreen={false}
|
|
51
|
+
isMobileScreen={true}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 📝 Props
|
|
58
|
+
|
|
59
|
+
### SelectWalletModal
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Description |
|
|
62
|
+
|-----------------------|----------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
|
|
63
|
+
| `isOpen` | `boolean` | Controls modal visibility. |
|
|
64
|
+
| `onClose` | `() => void` | Function to close the modal. |
|
|
65
|
+
| `wallets` | `Array<{ address, meta, walletClientType, linked }>` | List of wallet objects to display. |
|
|
66
|
+
| `appWalletClientType` | `string` | The currently selected wallet client type. |
|
|
67
|
+
| `setAppWalletClientType` | `(type: string) => void` | Function to set the selected wallet client type. |
|
|
68
|
+
| `linkWalletToUser` | `() => Promise<void>` | Function to link a new wallet to the user. |
|
|
69
|
+
| `embeddedWalletLinks` | `Array<{ type, address?, number? }>` | (Optional) List of embedded wallet links for the privy wallet. |
|
|
70
|
+
| `icons` | `{ dragBar, privyIcon, caretDown, linkWallet: string }` | Object containing icon URLs or paths for modal UI. |
|
|
71
|
+
| `isMobileScreen` | `boolean` | (Optional) If true, enables mobile-specific modal behavior and layout. |
|
|
72
|
+
|
|
73
|
+
### WalletOverview
|
|
74
|
+
|
|
75
|
+
| Prop | Type | Description |
|
|
76
|
+
|-----------------|---------------------------------------|------------------------------------------------------------------|
|
|
77
|
+
| `activeWallet` | `{ meta: { name: string, icon?: string } }` | The wallet object with metadata including name and optional icon URL. |
|
|
78
|
+
| `onClick` | `() => void` | Optional click handler for the component. |
|
|
79
|
+
| `fallbackIcon` | `string` | Optional fallback icon URL if `activeWallet.meta.icon` is not provided. |
|
|
80
|
+
| `isTabletScreen`| `boolean` | Optional. If true, hides the wallet name on tablet screens. |
|
|
81
|
+
| `isMobileScreen`| `boolean` | Optional. If true, shows the wallet name on mobile screens. |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🎨 Styling & Customization
|
|
86
|
+
|
|
87
|
+
- Uses `styled-components` for all styles.
|
|
88
|
+
- Consumers can override styles via a theme or by extending the styled components.
|
|
89
|
+
- No direct asset imports; all icons are provided by the consumer.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 📋 License
|
|
94
|
+
|
|
95
|
+
MIT
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🤝 Contributing
|
|
100
|
+
|
|
101
|
+
Pull requests and issues are welcome!
|
|
102
|
+
=======
|
|
25
103
|
npm install fare-privy-core
|
|
26
104
|
# or
|
|
27
105
|
pnpm add fare-privy-core
|
|
@@ -485,4 +563,5 @@ Want more features? Open an issue or PR on [GitHub](https://github.com/farePrivy
|
|
|
485
563
|
|
|
486
564
|
## 📄 License
|
|
487
565
|
|
|
488
|
-
ISC License - see LICENSE file for details.
|
|
566
|
+
ISC License - see LICENSE file for details.
|
|
567
|
+
>>>>>>> fb7640de89ab4d90f33248c3264f6a50a43b4008
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
* fare-privy-core - v1.7.6 - Reliable Micro Hooks
|
|
3
3
|
* Proven wallet patterns with simplified balance fetching and focused micro-hooks architecture.
|
|
4
4
|
*/
|
|
5
|
-
export { PrivyProvider, type PrivyProviderProps
|
|
6
|
-
export * from "./
|
|
7
|
-
export {
|
|
5
|
+
export { PrivyProvider, type PrivyProviderProps } from "./PrivyProviderTest";
|
|
6
|
+
export * from "./src/store/switchWallet";
|
|
7
|
+
export { WalletOverview } from "./src/components/WalletOverview";
|
|
8
|
+
export { Button, ButtonEnum } from "./src/components/shared/Button";
|
|
9
|
+
export { SelectWalletModal } from "./src/modals/SelectWalletModal/index.js";
|
|
10
|
+
export { default as ModalCard } from "./src/components/shared/Modal/Card";
|
|
11
|
+
export { ModalHeader } from "./src/components/shared/Modal/ModalHeader";
|
|
12
|
+
export { ModalFooter } from "./src/components/shared/Modal/ModalFooter";
|
|
13
|
+
export { useConnectedWallets, useActiveWallet, useWalletAddresses, useIsAuthenticated, useAuthActions, useWalletBalance, } from "./src/hooks/index";
|
|
8
14
|
/**
|
|
9
15
|
* ✅ PRODUCTION READY - v1.7.6:
|
|
10
16
|
*
|
|
@@ -37,61 +43,5 @@ export { useConnectedWallets, useActiveWallet, useWalletAddresses, useIsAuthenti
|
|
|
37
43
|
*/
|
|
38
44
|
/**
|
|
39
45
|
* 💡 Usage:
|
|
40
|
-
|
|
41
|
-
* import {
|
|
42
|
-
* PrivyProvider,
|
|
43
|
-
* useConnectedWallets,
|
|
44
|
-
* useWalletAddresses,
|
|
45
|
-
* useIsAuthenticated,
|
|
46
|
-
* useAuthActions,
|
|
47
|
-
* useWalletBalance,
|
|
48
|
-
* disableSolanaConnectors // Helper to fix Solana connector errors
|
|
49
|
-
* } from 'fare-privy-core';
|
|
50
|
-
*
|
|
51
|
-
* // 1. Wrap your app (Ethereum only - recommended)
|
|
52
|
-
* function App() {
|
|
53
|
-
* return (
|
|
54
|
-
* <PrivyProvider
|
|
55
|
-
* appId="your-privy-app-id"
|
|
56
|
-
* config={{
|
|
57
|
-
* walletChainType: 'ethereum-only',
|
|
58
|
-
* externalWallets: {
|
|
59
|
-
* solana: disableSolanaConnectors() // Prevents Solana errors
|
|
60
|
-
* }
|
|
61
|
-
* }}
|
|
62
|
-
* >
|
|
63
|
-
* <YourCasino />
|
|
64
|
-
* </PrivyProvider>
|
|
65
|
-
* );
|
|
66
|
-
* }
|
|
67
|
-
*
|
|
68
|
-
* // 2. Use hooks in your casino components
|
|
69
|
-
* function YourCasino() {
|
|
70
|
-
* const { primaryWallet } = useConnectedWallets();
|
|
71
|
-
* const { primarySolanaAddress } = useWalletAddresses();
|
|
72
|
-
* const { isAuthenticated } = useIsAuthenticated();
|
|
73
|
-
* const { login, logout } = useAuthActions();
|
|
74
|
-
* const { ethereumBalance, solanaBalance, loading } = useWalletBalance();
|
|
75
|
-
*
|
|
76
|
-
* if (!isAuthenticated) {
|
|
77
|
-
* return <button onClick={login}>🎰 Enter Casino</button>;
|
|
78
|
-
* }
|
|
79
|
-
*
|
|
80
|
-
* return (
|
|
81
|
-
* <div>
|
|
82
|
-
* <span>Welcome {primaryWallet?.address}</span>
|
|
83
|
-
* {loading ? (
|
|
84
|
-
* <span>Loading balance...</span>
|
|
85
|
-
* ) : (
|
|
86
|
-
* <div>
|
|
87
|
-
* {solanaBalance && <span>SOL: {solanaBalance}</span>}
|
|
88
|
-
* {ethereumBalance && <span>ETH: {ethereumBalance}</span>}
|
|
89
|
-
* </div>
|
|
90
|
-
* )}
|
|
91
|
-
* <button onClick={logout}>Exit</button>
|
|
92
|
-
* </div>
|
|
93
|
-
* );
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
46
|
+
*/
|
|
97
47
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG7E,cAAc,0BAA0B,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAQH;;GAEG"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
* fare-privy-core - v1.7.6 - Reliable Micro Hooks
|
|
3
3
|
* Proven wallet patterns with simplified balance fetching and focused micro-hooks architecture.
|
|
4
4
|
*/
|
|
5
5
|
// ✅ CURRENT EXPORTS - Available Now
|
|
6
|
-
export { PrivyProvider
|
|
6
|
+
export { PrivyProvider } from "./PrivyProviderTest";
|
|
7
7
|
// ✅ CORE FUNCTIONALITY - Working exports
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./src/store/switchWallet";
|
|
9
|
+
// Export updated UI components and modals
|
|
10
|
+
export { WalletOverview } from "./src/components/WalletOverview";
|
|
11
|
+
export { Button, ButtonEnum } from "./src/components/shared/Button";
|
|
12
|
+
export { SelectWalletModal } from "./src/modals/SelectWalletModal/index.js";
|
|
13
|
+
// Export shared modal components
|
|
14
|
+
export { default as ModalCard } from "./src/components/shared/Modal/Card";
|
|
15
|
+
export { ModalHeader } from "./src/components/shared/Modal/ModalHeader";
|
|
16
|
+
export { ModalFooter } from "./src/components/shared/Modal/ModalFooter";
|
|
9
17
|
// ✅ SIMPLIFIED WALLET HOOKS - Micro hooks architecture!
|
|
10
|
-
export { useConnectedWallets, useActiveWallet, useWalletAddresses, useIsAuthenticated, useAuthActions, useWalletBalance, } from "./hooks/index";
|
|
18
|
+
export { useConnectedWallets, useActiveWallet, useWalletAddresses, useIsAuthenticated, useAuthActions, useWalletBalance, } from "./src/hooks/index";
|
|
11
19
|
// ❌ REMOVED - Had too many external dependencies
|
|
12
20
|
// export * from "./farePrivy/modals/index.js";
|
|
13
21
|
/**
|
|
@@ -40,63 +48,11 @@ export { useConnectedWallets, useActiveWallet, useWalletAddresses, useIsAuthenti
|
|
|
40
48
|
* Users should provide their own Privy configuration.
|
|
41
49
|
* This package focuses on functionality, not opinionated configs.
|
|
42
50
|
*/
|
|
51
|
+
// Export casino auth module
|
|
52
|
+
// export * from './farePrivy/lib/casino-auth'
|
|
53
|
+
// Export utilities
|
|
54
|
+
// export * from './farePrivy/utility'
|
|
43
55
|
/**
|
|
44
56
|
* 💡 Usage:
|
|
45
|
-
|
|
46
|
-
* import {
|
|
47
|
-
* PrivyProvider,
|
|
48
|
-
* useConnectedWallets,
|
|
49
|
-
* useWalletAddresses,
|
|
50
|
-
* useIsAuthenticated,
|
|
51
|
-
* useAuthActions,
|
|
52
|
-
* useWalletBalance,
|
|
53
|
-
* disableSolanaConnectors // Helper to fix Solana connector errors
|
|
54
|
-
* } from 'fare-privy-core';
|
|
55
|
-
*
|
|
56
|
-
* // 1. Wrap your app (Ethereum only - recommended)
|
|
57
|
-
* function App() {
|
|
58
|
-
* return (
|
|
59
|
-
* <PrivyProvider
|
|
60
|
-
* appId="your-privy-app-id"
|
|
61
|
-
* config={{
|
|
62
|
-
* walletChainType: 'ethereum-only',
|
|
63
|
-
* externalWallets: {
|
|
64
|
-
* solana: disableSolanaConnectors() // Prevents Solana errors
|
|
65
|
-
* }
|
|
66
|
-
* }}
|
|
67
|
-
* >
|
|
68
|
-
* <YourCasino />
|
|
69
|
-
* </PrivyProvider>
|
|
70
|
-
* );
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* // 2. Use hooks in your casino components
|
|
74
|
-
* function YourCasino() {
|
|
75
|
-
* const { primaryWallet } = useConnectedWallets();
|
|
76
|
-
* const { primarySolanaAddress } = useWalletAddresses();
|
|
77
|
-
* const { isAuthenticated } = useIsAuthenticated();
|
|
78
|
-
* const { login, logout } = useAuthActions();
|
|
79
|
-
* const { ethereumBalance, solanaBalance, loading } = useWalletBalance();
|
|
80
|
-
*
|
|
81
|
-
* if (!isAuthenticated) {
|
|
82
|
-
* return <button onClick={login}>🎰 Enter Casino</button>;
|
|
83
|
-
* }
|
|
84
|
-
*
|
|
85
|
-
* return (
|
|
86
|
-
* <div>
|
|
87
|
-
* <span>Welcome {primaryWallet?.address}</span>
|
|
88
|
-
* {loading ? (
|
|
89
|
-
* <span>Loading balance...</span>
|
|
90
|
-
* ) : (
|
|
91
|
-
* <div>
|
|
92
|
-
* {solanaBalance && <span>SOL: {solanaBalance}</span>}
|
|
93
|
-
* {ethereumBalance && <span>ETH: {ethereumBalance}</span>}
|
|
94
|
-
* </div>
|
|
95
|
-
* )}
|
|
96
|
-
* <button onClick={logout}>Exit</button>
|
|
97
|
-
* </div>
|
|
98
|
-
* );
|
|
99
|
-
* }
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
57
|
+
*/
|
|
102
58
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oCAAoC;AACpC,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAE7E,yCAAyC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,iCAAiC;AACjC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,wDAAwD;AACxD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,iDAAiD;AACjD,+CAA+C;AAE/C;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH,4BAA4B;AAC5B,8CAA8C;AAE9C,mBAAmB;AACnB,sCAAsC;AAEtC;;GAEG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface WalletOverviewProps {
|
|
2
|
+
activeWallet: {
|
|
3
|
+
meta: {
|
|
4
|
+
name: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
fallbackIcon?: string;
|
|
10
|
+
isTabletScreen?: boolean;
|
|
11
|
+
isMobileScreen?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const WalletOverview: ({ activeWallet, onClick, fallbackIcon, isTabletScreen, isMobileScreen, }: WalletOverviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=WalletOverview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletOverview.d.ts","sourceRoot":"","sources":["../../../src/components/WalletOverview.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE;QACZ,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAuCD,eAAO,MAAM,cAAc,GAAI,0EAM5B,mBAAmB,4CAcrB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { styled } from "styled-components";
|
|
4
|
+
const SWalletOverview = styled.div `
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
margin-right: 12px;
|
|
10
|
+
height: 42px;
|
|
11
|
+
border: 1px solid #222a3f;
|
|
12
|
+
color: #aaaaaa;
|
|
13
|
+
border-radius: 6px;
|
|
14
|
+
user-select: none;
|
|
15
|
+
transition: all ease-in-out 0.08s;
|
|
16
|
+
&:hover {
|
|
17
|
+
span {
|
|
18
|
+
color: white;
|
|
19
|
+
}
|
|
20
|
+
border-color: #6366f1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
img {
|
|
24
|
+
height: 16px;
|
|
25
|
+
margin-right: 8px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
span {
|
|
29
|
+
text-transform: uppercase;
|
|
30
|
+
color: #aaaaaa;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (max-width: 760px) {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
margin: 0 16px 4px;
|
|
37
|
+
text-wrap: nowrap;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
export const WalletOverview = ({ activeWallet, onClick, fallbackIcon, isTabletScreen = false, isMobileScreen = false, }) => {
|
|
41
|
+
const walletIcon = useMemo(() => {
|
|
42
|
+
return activeWallet?.meta.icon || fallbackIcon;
|
|
43
|
+
}, [activeWallet, fallbackIcon]);
|
|
44
|
+
return (_jsxs(SWalletOverview, { onClick: onClick, children: [walletIcon && (_jsx("img", { alt: activeWallet?.meta.name || "wallet", src: walletIcon })), isMobileScreen && _jsx("span", { children: activeWallet?.meta.name }), !isTabletScreen && _jsx("span", { children: activeWallet?.meta.name })] }));
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=WalletOverview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletOverview.js","sourceRoot":"","sources":["../../../src/components/WalletOverview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAgB3C,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCjC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,cAAc,GAAG,KAAK,EACtB,cAAc,GAAG,KAAK,GACF,EAAE,EAAE;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;QAC9B,OAAO,YAAY,EAAE,IAAI,CAAC,IAAI,IAAI,YAAY,CAAC;IACjD,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IAEjC,OAAO,CACL,MAAC,eAAe,IAAC,OAAO,EAAE,OAAO,aAC9B,UAAU,IAAI,CACb,cAAK,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,IAAI,QAAQ,EAAE,GAAG,EAAE,UAAU,GAAI,CACnE,EACA,cAAc,IAAI,yBAAO,YAAY,EAAE,IAAI,CAAC,IAAI,GAAQ,EACxD,CAAC,cAAc,IAAI,yBAAO,YAAY,EAAE,IAAI,CAAC,IAAI,GAAQ,IAC1C,CACnB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type HTMLMotionProps } from "framer-motion";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export declare enum ButtonEnum {
|
|
4
|
+
BASE = 0,
|
|
5
|
+
PRIMARY_1 = 1,
|
|
6
|
+
CONNECT_WALLET = 2,
|
|
7
|
+
WARNING = 3,
|
|
8
|
+
ERROR = 4,
|
|
9
|
+
ERROR_2 = 5
|
|
10
|
+
}
|
|
11
|
+
export interface ButtonProps extends HTMLMotionProps<"button"> {
|
|
12
|
+
buttonType: ButtonEnum;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
isLoading?: boolean;
|
|
16
|
+
loadingText?: string | JSX.Element;
|
|
17
|
+
isMinified?: boolean;
|
|
18
|
+
theme?: any;
|
|
19
|
+
}
|
|
20
|
+
import React from "react";
|
|
21
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,oBAAY,UAAU;IACpB,IAAI,IAAA;IACJ,SAAS,IAAA;IACT,cAAc,IAAA;IACd,OAAO,IAAA;IACP,KAAK,IAAA;IACL,OAAO,IAAA;CACR;AAGD,MAAM,WAAW,WAAY,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC5D,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,MAAM,uFAqClB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseButton, ButtonContentWrapper, LoadingBar } from "./style";
|
|
3
|
+
export var ButtonEnum;
|
|
4
|
+
(function (ButtonEnum) {
|
|
5
|
+
ButtonEnum[ButtonEnum["BASE"] = 0] = "BASE";
|
|
6
|
+
ButtonEnum[ButtonEnum["PRIMARY_1"] = 1] = "PRIMARY_1";
|
|
7
|
+
ButtonEnum[ButtonEnum["CONNECT_WALLET"] = 2] = "CONNECT_WALLET";
|
|
8
|
+
ButtonEnum[ButtonEnum["WARNING"] = 3] = "WARNING";
|
|
9
|
+
ButtonEnum[ButtonEnum["ERROR"] = 4] = "ERROR";
|
|
10
|
+
ButtonEnum[ButtonEnum["ERROR_2"] = 5] = "ERROR_2";
|
|
11
|
+
})(ButtonEnum || (ButtonEnum = {}));
|
|
12
|
+
import React from "react";
|
|
13
|
+
export const Button = React.forwardRef(({ buttonType, disabled, isLoading = false, loadingText = "Loading", children, isMinified = false, theme, ...props }, ref) => {
|
|
14
|
+
return (_jsx(BaseButton, { ...props, ref: ref, transition: { duration: 0.25 }, buttonType: buttonType, disabled: disabled, isLoading: isLoading, "$isMinified": isMinified, theme: theme, children: _jsxs(ButtonContentWrapper, { children: [isLoading && (_jsx(LoadingBar, { "$side": "left", "$buttonType": buttonType, theme: theme })), _jsx("div", { children: isLoading ? loadingText : children }), isLoading && (_jsx(LoadingBar, { "$side": "right", "$buttonType": buttonType, theme: theme }))] }) }));
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/shared/Button/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,CAAN,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,2CAAI,CAAA;IACJ,qDAAS,CAAA;IACT,+DAAc,CAAA;IACd,iDAAO,CAAA;IACP,6CAAK,CAAA;IACL,iDAAO,CAAA;AACT,CAAC,EAPW,UAAU,KAAV,UAAU,QAOrB;AAaD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EACE,UAAU,EACV,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,SAAS,EACvB,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,OAAO,CACL,KAAC,UAAU,OACL,KAAK,EACT,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAC9B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,iBACP,UAAU,EACvB,KAAK,EAAE,KAAK,YAEZ,MAAC,oBAAoB,eAClB,SAAS,IAAI,CACZ,KAAC,UAAU,aAAO,MAAM,iBAAc,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,CACnE,EACD,wBAAM,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAO,EAC9C,SAAS,IAAI,CACZ,KAAC,UAAU,aAAO,OAAO,iBAAc,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,CACpE,IACoB,GACZ,CACd,CAAC;AACJ,CAAC,CACF,CAAC"}
|