@varity-labs/ui-kit 2.0.0-beta.6 → 2.0.0-beta.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/README.md +14 -16
- package/dist/components/PaymentWidget/PaymentWidget.d.ts +7 -19
- package/dist/components/PaymentWidget/PaymentWidget.d.ts.map +1 -1
- package/dist/components/PaymentWidget/PaymentWidget.js +10 -176
- package/dist/components/PaymentWidget/PaymentWidget.js.map +1 -1
- package/dist/components/PaymentWidget/useSeamlessPayment.d.ts +8 -34
- package/dist/components/PaymentWidget/useSeamlessPayment.d.ts.map +1 -1
- package/dist/components/PaymentWidget/useSeamlessPayment.js +12 -158
- package/dist/components/PaymentWidget/useSeamlessPayment.js.map +1 -1
- package/dist/components/PaymentWidget/useVarityPayment.d.ts +5 -6
- package/dist/components/PaymentWidget/useVarityPayment.d.ts.map +1 -1
- package/dist/components/PaymentWidget/useVarityPayment.js +11 -147
- package/dist/components/PaymentWidget/useVarityPayment.js.map +1 -1
- package/dist/providers/PrivyStack.d.ts +14 -9
- package/dist/providers/PrivyStack.d.ts.map +1 -1
- package/dist/providers/PrivyStack.js +2 -4
- package/dist/providers/PrivyStack.js.map +1 -1
- package/dist/providers/VarityDashboardProvider.d.ts +2 -2
- package/dist/providers/VarityDashboardProvider.d.ts.map +1 -1
- package/dist/providers/VarityDashboardProvider.js +3 -26
- package/dist/providers/VarityDashboardProvider.js.map +1 -1
- package/dist/providers/WalletSyncProvider.d.ts +3 -7
- package/dist/providers/WalletSyncProvider.d.ts.map +1 -1
- package/dist/providers/WalletSyncProvider.js +6 -14
- package/dist/providers/WalletSyncProvider.js.map +1 -1
- package/package.json +5 -6
- package/dist/components/Analytics/__tests__/DataTable.test.d.ts +0 -2
- package/dist/components/Analytics/__tests__/DataTable.test.d.ts.map +0 -1
- package/dist/components/Analytics/__tests__/DataTable.test.js +0 -113
- package/dist/components/Analytics/__tests__/DataTable.test.js.map +0 -1
- package/dist/components/Dashboard/__tests__/EmptyState.test.d.ts +0 -2
- package/dist/components/Dashboard/__tests__/EmptyState.test.d.ts.map +0 -1
- package/dist/components/Dashboard/__tests__/EmptyState.test.js +0 -81
- package/dist/components/Dashboard/__tests__/EmptyState.test.js.map +0 -1
- package/dist/components/Dashboard/__tests__/KPICard.test.d.ts +0 -2
- package/dist/components/Dashboard/__tests__/KPICard.test.d.ts.map +0 -1
- package/dist/components/Dashboard/__tests__/KPICard.test.js +0 -78
- package/dist/components/Dashboard/__tests__/KPICard.test.js.map +0 -1
- package/dist/components/InAppWallet/EmailLoginButton.d.ts +0 -27
- package/dist/components/InAppWallet/EmailLoginButton.d.ts.map +0 -1
- package/dist/components/InAppWallet/EmailLoginButton.js +0 -84
- package/dist/components/InAppWallet/EmailLoginButton.js.map +0 -1
- package/dist/components/InAppWallet/InAppWalletProvider.d.ts +0 -54
- package/dist/components/InAppWallet/InAppWalletProvider.d.ts.map +0 -1
- package/dist/components/InAppWallet/InAppWalletProvider.js +0 -225
- package/dist/components/InAppWallet/InAppWalletProvider.js.map +0 -1
- package/dist/components/InAppWallet/OnboardingFlow.d.ts +0 -25
- package/dist/components/InAppWallet/OnboardingFlow.d.ts.map +0 -1
- package/dist/components/InAppWallet/OnboardingFlow.js +0 -159
- package/dist/components/InAppWallet/OnboardingFlow.js.map +0 -1
- package/dist/components/InAppWallet/SocialLoginButtons.d.ts +0 -28
- package/dist/components/InAppWallet/SocialLoginButtons.d.ts.map +0 -1
- package/dist/components/InAppWallet/SocialLoginButtons.js +0 -128
- package/dist/components/InAppWallet/SocialLoginButtons.js.map +0 -1
- package/dist/components/InAppWallet/index.d.ts +0 -15
- package/dist/components/InAppWallet/index.d.ts.map +0 -1
- package/dist/components/InAppWallet/index.js +0 -14
- package/dist/components/InAppWallet/index.js.map +0 -1
- package/dist/components/Payments/CheckoutModal.d.ts +0 -19
- package/dist/components/Payments/CheckoutModal.d.ts.map +0 -1
- package/dist/components/Payments/CheckoutModal.js +0 -194
- package/dist/components/Payments/CheckoutModal.js.map +0 -1
- package/dist/components/Payments/SubscriptionWidget.d.ts +0 -17
- package/dist/components/Payments/SubscriptionWidget.d.ts.map +0 -1
- package/dist/components/Payments/SubscriptionWidget.js +0 -89
- package/dist/components/Payments/SubscriptionWidget.js.map +0 -1
- package/dist/components/Payments/constants.d.ts +0 -59
- package/dist/components/Payments/constants.d.ts.map +0 -1
- package/dist/components/Payments/constants.js +0 -145
- package/dist/components/Payments/constants.js.map +0 -1
- package/dist/components/Payments/index.d.ts +0 -10
- package/dist/components/Payments/index.d.ts.map +0 -1
- package/dist/components/Payments/index.js +0 -12
- package/dist/components/Payments/index.js.map +0 -1
- package/dist/components/Payments/types.d.ts +0 -119
- package/dist/components/Payments/types.d.ts.map +0 -1
- package/dist/components/Payments/types.js +0 -27
- package/dist/components/Payments/types.js.map +0 -1
- package/dist/components/Payments/usePayments.d.ts +0 -33
- package/dist/components/Payments/usePayments.d.ts.map +0 -1
- package/dist/components/Payments/usePayments.js +0 -249
- package/dist/components/Payments/usePayments.js.map +0 -1
- package/dist/components/Privy/__tests__/InitScreens.test.d.ts +0 -2
- package/dist/components/Privy/__tests__/InitScreens.test.d.ts.map +0 -1
- package/dist/components/Privy/__tests__/InitScreens.test.js +0 -74
- package/dist/components/Privy/__tests__/InitScreens.test.js.map +0 -1
- package/dist/components/SIWE/AuthStatus.d.ts +0 -15
- package/dist/components/SIWE/AuthStatus.d.ts.map +0 -1
- package/dist/components/SIWE/AuthStatus.js +0 -47
- package/dist/components/SIWE/AuthStatus.js.map +0 -1
- package/dist/components/SIWE/ProtectedRoute.d.ts +0 -17
- package/dist/components/SIWE/ProtectedRoute.d.ts.map +0 -1
- package/dist/components/SIWE/ProtectedRoute.js +0 -52
- package/dist/components/SIWE/ProtectedRoute.js.map +0 -1
- package/dist/components/SIWE/SIWEButton.d.ts +0 -22
- package/dist/components/SIWE/SIWEButton.d.ts.map +0 -1
- package/dist/components/SIWE/SIWEButton.js +0 -106
- package/dist/components/SIWE/SIWEButton.js.map +0 -1
- package/dist/components/SIWE/SIWEModal.d.ts +0 -19
- package/dist/components/SIWE/SIWEModal.d.ts.map +0 -1
- package/dist/components/SIWE/SIWEModal.js +0 -75
- package/dist/components/SIWE/SIWEModal.js.map +0 -1
- package/dist/components/SIWE/SIWEProvider.d.ts +0 -38
- package/dist/components/SIWE/SIWEProvider.d.ts.map +0 -1
- package/dist/components/SIWE/SIWEProvider.js +0 -227
- package/dist/components/SIWE/SIWEProvider.js.map +0 -1
- package/dist/components/SIWE/index.d.ts +0 -15
- package/dist/components/SIWE/index.d.ts.map +0 -1
- package/dist/components/SIWE/index.js +0 -10
- package/dist/components/SIWE/index.js.map +0 -1
- package/dist/core/VarityClient.d.ts +0 -76
- package/dist/core/VarityClient.d.ts.map +0 -1
- package/dist/core/VarityClient.js +0 -99
- package/dist/core/VarityClient.js.map +0 -1
- package/dist/core/config.d.ts +0 -136
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -156
- package/dist/core/config.js.map +0 -1
- package/dist/hooks/useAnalytics.d.ts +0 -94
- package/dist/hooks/useAnalytics.d.ts.map +0 -1
- package/dist/hooks/useAnalytics.js +0 -116
- package/dist/hooks/useAnalytics.js.map +0 -1
- package/dist/hooks/useAuth.d.ts +0 -71
- package/dist/hooks/useAuth.d.ts.map +0 -1
- package/dist/hooks/useAuth.js +0 -198
- package/dist/hooks/useAuth.js.map +0 -1
- package/dist/hooks/useDashboard.d.ts +0 -110
- package/dist/hooks/useDashboard.d.ts.map +0 -1
- package/dist/hooks/useDashboard.js +0 -201
- package/dist/hooks/useDashboard.js.map +0 -1
- package/dist/hooks/useVarityAPI.d.ts +0 -88
- package/dist/hooks/useVarityAPI.d.ts.map +0 -1
- package/dist/hooks/useVarityAPI.js +0 -138
- package/dist/hooks/useVarityAPI.js.map +0 -1
- package/dist/hooks/useWalletAuth.d.ts +0 -108
- package/dist/hooks/useWalletAuth.d.ts.map +0 -1
- package/dist/hooks/useWalletAuth.js +0 -415
- package/dist/hooks/useWalletAuth.js.map +0 -1
- package/dist/hooks/web3/index.d.ts +0 -5
- package/dist/hooks/web3/index.d.ts.map +0 -1
- package/dist/hooks/web3/index.js +0 -6
- package/dist/hooks/web3/index.js.map +0 -1
- package/dist/hooks/web3/useAddressValidation.d.ts +0 -37
- package/dist/hooks/web3/useAddressValidation.d.ts.map +0 -1
- package/dist/hooks/web3/useAddressValidation.js +0 -59
- package/dist/hooks/web3/useAddressValidation.js.map +0 -1
- package/dist/hooks/web3/useBlockExplorer.d.ts +0 -37
- package/dist/hooks/web3/useBlockExplorer.d.ts.map +0 -1
- package/dist/hooks/web3/useBlockExplorer.js +0 -59
- package/dist/hooks/web3/useBlockExplorer.js.map +0 -1
- package/dist/hooks/web3/useUSDCFormat.d.ts +0 -34
- package/dist/hooks/web3/useUSDCFormat.d.ts.map +0 -1
- package/dist/hooks/web3/useUSDCFormat.js +0 -43
- package/dist/hooks/web3/useUSDCFormat.js.map +0 -1
- package/dist/hooks/web3/useVarityWallet.d.ts +0 -48
- package/dist/hooks/web3/useVarityWallet.d.ts.map +0 -1
- package/dist/hooks/web3/useVarityWallet.js +0 -70
- package/dist/hooks/web3/useVarityWallet.js.map +0 -1
- package/dist/modules/cache/index.d.ts +0 -12
- package/dist/modules/cache/index.d.ts.map +0 -1
- package/dist/modules/cache/index.js +0 -13
- package/dist/modules/cache/index.js.map +0 -1
- package/dist/providers/ChainContext.d.ts +0 -65
- package/dist/providers/ChainContext.d.ts.map +0 -1
- package/dist/providers/ChainContext.js +0 -92
- package/dist/providers/ChainContext.js.map +0 -1
- package/dist/providers/VarityProvider.d.ts +0 -32
- package/dist/providers/VarityProvider.d.ts.map +0 -1
- package/dist/providers/VarityProvider.js +0 -56
- package/dist/providers/VarityProvider.js.map +0 -1
- package/dist/providers/WalletContext.d.ts +0 -68
- package/dist/providers/WalletContext.d.ts.map +0 -1
- package/dist/providers/WalletContext.js +0 -98
- package/dist/providers/WalletContext.js.map +0 -1
- package/dist/providers/index.d.ts +0 -48
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -53
- package/dist/providers/index.js.map +0 -1
- package/dist/types/api-extensions.d.ts +0 -92
- package/dist/types/api-extensions.d.ts.map +0 -1
- package/dist/types/api-extensions.js +0 -7
- package/dist/types/api-extensions.js.map +0 -1
- package/dist/wallets/SimpleSmartWallet.d.ts +0 -68
- package/dist/wallets/SimpleSmartWallet.d.ts.map +0 -1
- package/dist/wallets/SimpleSmartWallet.js +0 -74
- package/dist/wallets/SimpleSmartWallet.js.map +0 -1
- package/dist/wallets/SmartWalletProvider.d.ts +0 -217
- package/dist/wallets/SmartWalletProvider.d.ts.map +0 -1
- package/dist/wallets/SmartWalletProvider.js +0 -366
- package/dist/wallets/SmartWalletProvider.js.map +0 -1
- package/dist/wallets/config.d.ts +0 -222
- package/dist/wallets/config.d.ts.map +0 -1
- package/dist/wallets/config.js +0 -206
- package/dist/wallets/config.js.map +0 -1
- package/dist/wallets/index.d.ts +0 -9
- package/dist/wallets/index.d.ts.map +0 -1
- package/dist/wallets/index.js +0 -9
- package/dist/wallets/index.js.map +0 -1
- package/dist/web3/AddressDisplay/AddressDisplay.d.ts +0 -33
- package/dist/web3/AddressDisplay/AddressDisplay.d.ts.map +0 -1
- package/dist/web3/AddressDisplay/AddressDisplay.js +0 -42
- package/dist/web3/AddressDisplay/AddressDisplay.js.map +0 -1
- package/dist/web3/AddressInput/AddressInput.d.ts +0 -36
- package/dist/web3/AddressInput/AddressInput.d.ts.map +0 -1
- package/dist/web3/AddressInput/AddressInput.js +0 -54
- package/dist/web3/AddressInput/AddressInput.js.map +0 -1
- package/dist/web3/AmountInput/AmountInput.d.ts +0 -41
- package/dist/web3/AmountInput/AmountInput.d.ts.map +0 -1
- package/dist/web3/AmountInput/AmountInput.js +0 -74
- package/dist/web3/AmountInput/AmountInput.js.map +0 -1
- package/dist/web3/BalanceDisplay/BalanceDisplay.d.ts +0 -30
- package/dist/web3/BalanceDisplay/BalanceDisplay.d.ts.map +0 -1
- package/dist/web3/BalanceDisplay/BalanceDisplay.js +0 -35
- package/dist/web3/BalanceDisplay/BalanceDisplay.js.map +0 -1
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.d.ts +0 -41
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.d.ts.map +0 -1
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.js +0 -46
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.js.map +0 -1
- package/dist/web3/ConnectWallet/ConnectWallet.d.ts +0 -35
- package/dist/web3/ConnectWallet/ConnectWallet.d.ts.map +0 -1
- package/dist/web3/ConnectWallet/ConnectWallet.js +0 -58
- package/dist/web3/ConnectWallet/ConnectWallet.js.map +0 -1
- package/dist/web3/DisconnectButton/DisconnectButton.d.ts +0 -30
- package/dist/web3/DisconnectButton/DisconnectButton.d.ts.map +0 -1
- package/dist/web3/DisconnectButton/DisconnectButton.js +0 -48
- package/dist/web3/DisconnectButton/DisconnectButton.js.map +0 -1
- package/dist/web3/WalletBalance/WalletBalance.d.ts +0 -27
- package/dist/web3/WalletBalance/WalletBalance.d.ts.map +0 -1
- package/dist/web3/WalletBalance/WalletBalance.js +0 -49
- package/dist/web3/WalletBalance/WalletBalance.js.map +0 -1
- package/dist/web3/WalletDropdown/WalletDropdown.d.ts +0 -29
- package/dist/web3/WalletDropdown/WalletDropdown.d.ts.map +0 -1
- package/dist/web3/WalletDropdown/WalletDropdown.js +0 -93
- package/dist/web3/WalletDropdown/WalletDropdown.js.map +0 -1
- package/dist/web3/WalletInfo/WalletInfo.d.ts +0 -31
- package/dist/web3/WalletInfo/WalletInfo.d.ts.map +0 -1
- package/dist/web3/WalletInfo/WalletInfo.js +0 -41
- package/dist/web3/WalletInfo/WalletInfo.js.map +0 -1
- package/dist/web3/index.d.ts +0 -11
- package/dist/web3/index.d.ts.map +0 -1
- package/dist/web3/index.js +0 -14
- package/dist/web3/index.js.map +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface UseUSDCFormatReturn {
|
|
2
|
-
format: (amount: bigint | string | number, decimals?: number) => string;
|
|
3
|
-
parse: (amount: string | number) => bigint;
|
|
4
|
-
decimals: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Hook for USDC formatting utilities
|
|
8
|
-
*
|
|
9
|
-
* Provides utilities for formatting and parsing USDC amounts with 6 decimals:
|
|
10
|
-
* - Format bigint to human-readable string
|
|
11
|
-
* - Parse string to bigint
|
|
12
|
-
* - Access USDC decimals constant
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseUSDCFormatReturn} USDC formatting utilities
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* import { useUSDCFormat } from '@varity-labs/ui-kit';
|
|
19
|
-
*
|
|
20
|
-
* function BalanceCard() {
|
|
21
|
-
* const { format, parse, decimals } = useUSDCFormat();
|
|
22
|
-
*
|
|
23
|
-
* const balance = BigInt(1500000000); // 1500 USDC
|
|
24
|
-
* const formatted = format(balance, 2); // "1500.00"
|
|
25
|
-
*
|
|
26
|
-
* const amount = "100.50";
|
|
27
|
-
* const parsed = parse(amount); // BigInt(100500000)
|
|
28
|
-
*
|
|
29
|
-
* return <div>Balance: {formatted} USDC</div>;
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function useUSDCFormat(): UseUSDCFormatReturn;
|
|
34
|
-
//# sourceMappingURL=useUSDCFormat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUSDCFormat.d.ts","sourceRoot":"","sources":["../../../src/hooks/web3/useUSDCFormat.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACxE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,IAAI,mBAAmB,CAiBnD"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useMemo, useCallback } from 'react';
|
|
2
|
-
import { formatUSDC, parseUSDC, USDC_DECIMALS } from '../../config/chains';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for USDC formatting utilities
|
|
5
|
-
*
|
|
6
|
-
* Provides utilities for formatting and parsing USDC amounts with 6 decimals:
|
|
7
|
-
* - Format bigint to human-readable string
|
|
8
|
-
* - Parse string to bigint
|
|
9
|
-
* - Access USDC decimals constant
|
|
10
|
-
*
|
|
11
|
-
* @returns {UseUSDCFormatReturn} USDC formatting utilities
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* import { useUSDCFormat } from '@varity-labs/ui-kit';
|
|
16
|
-
*
|
|
17
|
-
* function BalanceCard() {
|
|
18
|
-
* const { format, parse, decimals } = useUSDCFormat();
|
|
19
|
-
*
|
|
20
|
-
* const balance = BigInt(1500000000); // 1500 USDC
|
|
21
|
-
* const formatted = format(balance, 2); // "1500.00"
|
|
22
|
-
*
|
|
23
|
-
* const amount = "100.50";
|
|
24
|
-
* const parsed = parse(amount); // BigInt(100500000)
|
|
25
|
-
*
|
|
26
|
-
* return <div>Balance: {formatted} USDC</div>;
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export function useUSDCFormat() {
|
|
31
|
-
const format = useCallback((amount, decimals = 2) => {
|
|
32
|
-
return formatUSDC(amount, decimals);
|
|
33
|
-
}, []);
|
|
34
|
-
const parse = useCallback((amount) => {
|
|
35
|
-
return parseUSDC(amount);
|
|
36
|
-
}, []);
|
|
37
|
-
return useMemo(() => ({
|
|
38
|
-
format,
|
|
39
|
-
parse,
|
|
40
|
-
decimals: USDC_DECIMALS,
|
|
41
|
-
}), [format, parse]);
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=useUSDCFormat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUSDCFormat.js","sourceRoot":"","sources":["../../../src/hooks/web3/useUSDCFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQ3E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,MAAgC,EAAE,QAAQ,GAAG,CAAC,EAAE,EAAE;QAC5E,OAAO,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,MAAuB,EAAE,EAAE;QACpD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,KAAK;QACL,QAAQ,EAAE,aAAa;KACxB,CAAC,EACF,CAAC,MAAM,EAAE,KAAK,CAAC,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export interface UseVarityWalletReturn {
|
|
2
|
-
address: string | null;
|
|
3
|
-
formattedAddress: string | null;
|
|
4
|
-
isConnected: boolean;
|
|
5
|
-
disconnect: () => Promise<void>;
|
|
6
|
-
balance: bigint | null;
|
|
7
|
-
isLoadingBalance: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Hook for wallet operations
|
|
11
|
-
*
|
|
12
|
-
* Provides convenient access to wallet state and operations:
|
|
13
|
-
* - Current address and formatted address
|
|
14
|
-
* - Connection status
|
|
15
|
-
* - Disconnect function
|
|
16
|
-
* - Balance queries
|
|
17
|
-
*
|
|
18
|
-
* @returns {UseVarityWalletReturn} Wallet state and operations
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```tsx
|
|
22
|
-
* import { useVarityWallet } from '@varity-labs/ui-kit';
|
|
23
|
-
*
|
|
24
|
-
* function MyComponent() {
|
|
25
|
-
* const {
|
|
26
|
-
* address,
|
|
27
|
-
* formattedAddress,
|
|
28
|
-
* isConnected,
|
|
29
|
-
* disconnect,
|
|
30
|
-
* balance
|
|
31
|
-
* } = useVarityWallet();
|
|
32
|
-
*
|
|
33
|
-
* if (!isConnected) {
|
|
34
|
-
* return <ConnectWallet />;
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* return (
|
|
38
|
-
* <div>
|
|
39
|
-
* <p>Address: {formattedAddress}</p>
|
|
40
|
-
* <p>Balance: {balance?.toString()} USDC</p>
|
|
41
|
-
* <button onClick={disconnect}>Disconnect</button>
|
|
42
|
-
* </div>
|
|
43
|
-
* );
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function useVarityWallet(): UseVarityWalletReturn;
|
|
48
|
-
//# sourceMappingURL=useVarityWallet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useVarityWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/web3/useVarityWallet.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,eAAe,IAAI,qBAAqB,CAkCvD"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useActiveAccount, useDisconnect, useActiveWallet, useWalletBalance } from 'thirdweb/react';
|
|
2
|
-
import { createThirdwebClient } from 'thirdweb';
|
|
3
|
-
import { THIRDWEB_CLIENT_ID, DEFAULT_CHAIN, formatAddress } from '../../config/chains';
|
|
4
|
-
import { useMemo, useCallback } from 'react';
|
|
5
|
-
/**
|
|
6
|
-
* Hook for wallet operations
|
|
7
|
-
*
|
|
8
|
-
* Provides convenient access to wallet state and operations:
|
|
9
|
-
* - Current address and formatted address
|
|
10
|
-
* - Connection status
|
|
11
|
-
* - Disconnect function
|
|
12
|
-
* - Balance queries
|
|
13
|
-
*
|
|
14
|
-
* @returns {UseVarityWalletReturn} Wallet state and operations
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* import { useVarityWallet } from '@varity-labs/ui-kit';
|
|
19
|
-
*
|
|
20
|
-
* function MyComponent() {
|
|
21
|
-
* const {
|
|
22
|
-
* address,
|
|
23
|
-
* formattedAddress,
|
|
24
|
-
* isConnected,
|
|
25
|
-
* disconnect,
|
|
26
|
-
* balance
|
|
27
|
-
* } = useVarityWallet();
|
|
28
|
-
*
|
|
29
|
-
* if (!isConnected) {
|
|
30
|
-
* return <ConnectWallet />;
|
|
31
|
-
* }
|
|
32
|
-
*
|
|
33
|
-
* return (
|
|
34
|
-
* <div>
|
|
35
|
-
* <p>Address: {formattedAddress}</p>
|
|
36
|
-
* <p>Balance: {balance?.toString()} USDC</p>
|
|
37
|
-
* <button onClick={disconnect}>Disconnect</button>
|
|
38
|
-
* </div>
|
|
39
|
-
* );
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export function useVarityWallet() {
|
|
44
|
-
const account = useActiveAccount();
|
|
45
|
-
const wallet = useActiveWallet();
|
|
46
|
-
const { disconnect: thirdwebDisconnect } = useDisconnect();
|
|
47
|
-
const client = useMemo(() => createThirdwebClient({ clientId: THIRDWEB_CLIENT_ID }), []);
|
|
48
|
-
const { data: balanceData, isLoading: isLoadingBalance } = useWalletBalance({
|
|
49
|
-
client,
|
|
50
|
-
chain: DEFAULT_CHAIN,
|
|
51
|
-
address: account?.address,
|
|
52
|
-
});
|
|
53
|
-
const address = account?.address || null;
|
|
54
|
-
const formattedAddress = address ? formatAddress(address) : null;
|
|
55
|
-
const isConnected = !!address;
|
|
56
|
-
const disconnect = useCallback(async () => {
|
|
57
|
-
if (wallet) {
|
|
58
|
-
await thirdwebDisconnect(wallet);
|
|
59
|
-
}
|
|
60
|
-
}, [wallet, thirdwebDisconnect]);
|
|
61
|
-
return {
|
|
62
|
-
address,
|
|
63
|
-
formattedAddress,
|
|
64
|
-
isConnected,
|
|
65
|
-
disconnect,
|
|
66
|
-
balance: balanceData?.value || null,
|
|
67
|
-
isLoadingBalance,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=useVarityWallet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useVarityWallet.js","sourceRoot":"","sources":["../../../src/hooks/web3/useVarityWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAW7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,aAAa,EAAE,CAAC;IAE3D,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,EAC5D,EAAE,CACH,CAAC;IAEF,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,CAAC;QAC1E,MAAM;QACN,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,OAAO,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC;IACzC,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC;IAE9B,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACxC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEjC,OAAO;QACL,OAAO;QACP,gBAAgB;QAChB,WAAW;QACX,UAAU;QACV,OAAO,EAAE,WAAW,EAAE,KAAK,IAAI,IAAI;QACnC,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Module Client (stub)
|
|
3
|
-
*
|
|
4
|
-
* Placeholder for the cache module API client.
|
|
5
|
-
* Used internally by VarityClient but not yet exported from the package.
|
|
6
|
-
*/
|
|
7
|
-
import { HTTPClient } from '../../utils/http';
|
|
8
|
-
export declare class CacheClient {
|
|
9
|
-
private http;
|
|
10
|
-
constructor(http: HTTPClient);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,qBAAa,WAAW;IACV,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;CACrC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Module Client (stub)
|
|
3
|
-
*
|
|
4
|
-
* Placeholder for the cache module API client.
|
|
5
|
-
* Used internally by VarityClient but not yet exported from the package.
|
|
6
|
-
*/
|
|
7
|
-
export class CacheClient {
|
|
8
|
-
http;
|
|
9
|
-
constructor(http) {
|
|
10
|
-
this.http = http;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;CACzC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { Chain } from 'thirdweb/chains';
|
|
3
|
-
export interface ChainContextValue {
|
|
4
|
-
activeChain: Chain | undefined;
|
|
5
|
-
supportedChains: Chain[];
|
|
6
|
-
switchChain: (chainId: number) => Promise<void>;
|
|
7
|
-
isCorrectChain: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface ChainProviderProps {
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
supportedChains?: Chain[];
|
|
12
|
-
defaultChain?: Chain;
|
|
13
|
-
onChainChange?: (chainId: number) => void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Chain state management provider
|
|
17
|
-
*
|
|
18
|
-
* Manages blockchain network state and provides utilities for:
|
|
19
|
-
* - Accessing current chain
|
|
20
|
-
* - Switching between chains
|
|
21
|
-
* - Validating chain compatibility
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* import { ChainProvider } from '@varity-labs/ui-kit';
|
|
26
|
-
*
|
|
27
|
-
* function App() {
|
|
28
|
-
* return (
|
|
29
|
-
* <ChainProvider
|
|
30
|
-
* onChainChange={(chainId) => console.log('Chain changed to:', chainId)}
|
|
31
|
-
* >
|
|
32
|
-
* <YourApp />
|
|
33
|
-
* </ChainProvider>
|
|
34
|
-
* );
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare function ChainProvider({ children, supportedChains, defaultChain, onChainChange, }: ChainProviderProps): JSX.Element;
|
|
39
|
-
/**
|
|
40
|
-
* Hook to access chain context
|
|
41
|
-
*
|
|
42
|
-
* @returns {ChainContextValue} Chain state and utilities
|
|
43
|
-
* @throws {Error} If used outside ChainProvider
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* import { useChain } from '@varity-labs/ui-kit';
|
|
48
|
-
*
|
|
49
|
-
* function MyComponent() {
|
|
50
|
-
* const { activeChain, switchChain, isCorrectChain } = useChain();
|
|
51
|
-
*
|
|
52
|
-
* if (!isCorrectChain) {
|
|
53
|
-
* return (
|
|
54
|
-
* <button onClick={() => switchChain(33529)}>
|
|
55
|
-
* Switch to Varity L3
|
|
56
|
-
* </button>
|
|
57
|
-
* );
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* return <p>Connected to: {activeChain?.name}</p>;
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare function useChain(): ChainContextValue;
|
|
65
|
-
//# sourceMappingURL=ChainContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChainContext.d.ts","sourceRoot":"","sources":["../../src/providers/ChainContext.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,KAAK,GAAG,SAAS,CAAC;IAC/B,eAAe,EAAE,KAAK,EAAE,CAAC;IACzB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,cAAc,EAAE,OAAO,CAAC;CACzB;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,eAAkC,EAClC,YAA4B,EAC5B,aAAa,GACd,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAqClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext } from 'react';
|
|
2
|
-
import { useActiveWalletChain, useSwitchActiveWalletChain } from 'thirdweb/react';
|
|
3
|
-
import { DEFAULT_CHAIN, SUPPORTED_CHAINS } from '../config/chains';
|
|
4
|
-
const ChainContext = createContext(null);
|
|
5
|
-
/**
|
|
6
|
-
* Chain state management provider
|
|
7
|
-
*
|
|
8
|
-
* Manages blockchain network state and provides utilities for:
|
|
9
|
-
* - Accessing current chain
|
|
10
|
-
* - Switching between chains
|
|
11
|
-
* - Validating chain compatibility
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* import { ChainProvider } from '@varity-labs/ui-kit';
|
|
16
|
-
*
|
|
17
|
-
* function App() {
|
|
18
|
-
* return (
|
|
19
|
-
* <ChainProvider
|
|
20
|
-
* onChainChange={(chainId) => console.log('Chain changed to:', chainId)}
|
|
21
|
-
* >
|
|
22
|
-
* <YourApp />
|
|
23
|
-
* </ChainProvider>
|
|
24
|
-
* );
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export function ChainProvider({ children, supportedChains = SUPPORTED_CHAINS, defaultChain = DEFAULT_CHAIN, onChainChange, }) {
|
|
29
|
-
const activeChain = useActiveWalletChain();
|
|
30
|
-
const switchChain = useSwitchActiveWalletChain();
|
|
31
|
-
const isCorrectChain = React.useMemo(() => {
|
|
32
|
-
if (!activeChain)
|
|
33
|
-
return false;
|
|
34
|
-
return supportedChains.some((chain) => chain.id === activeChain.id);
|
|
35
|
-
}, [activeChain, supportedChains]);
|
|
36
|
-
const handleSwitchChain = React.useCallback(async (chainId) => {
|
|
37
|
-
const targetChain = supportedChains.find((c) => c.id === chainId);
|
|
38
|
-
if (!targetChain) {
|
|
39
|
-
throw new Error(`Chain ${chainId} is not supported`);
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
await switchChain(targetChain);
|
|
43
|
-
if (onChainChange) {
|
|
44
|
-
onChainChange(chainId);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error('Error switching chain:', error);
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
}, [supportedChains, switchChain, onChainChange]);
|
|
52
|
-
const value = {
|
|
53
|
-
activeChain,
|
|
54
|
-
supportedChains,
|
|
55
|
-
switchChain: handleSwitchChain,
|
|
56
|
-
isCorrectChain,
|
|
57
|
-
};
|
|
58
|
-
return React.createElement(ChainContext.Provider, { value: value }, children);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Hook to access chain context
|
|
62
|
-
*
|
|
63
|
-
* @returns {ChainContextValue} Chain state and utilities
|
|
64
|
-
* @throws {Error} If used outside ChainProvider
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```tsx
|
|
68
|
-
* import { useChain } from '@varity-labs/ui-kit';
|
|
69
|
-
*
|
|
70
|
-
* function MyComponent() {
|
|
71
|
-
* const { activeChain, switchChain, isCorrectChain } = useChain();
|
|
72
|
-
*
|
|
73
|
-
* if (!isCorrectChain) {
|
|
74
|
-
* return (
|
|
75
|
-
* <button onClick={() => switchChain(33529)}>
|
|
76
|
-
* Switch to Varity L3
|
|
77
|
-
* </button>
|
|
78
|
-
* );
|
|
79
|
-
* }
|
|
80
|
-
*
|
|
81
|
-
* return <p>Connected to: {activeChain?.name}</p>;
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export function useChain() {
|
|
86
|
-
const context = useContext(ChainContext);
|
|
87
|
-
if (!context) {
|
|
88
|
-
throw new Error('useChain must be used within ChainProvider');
|
|
89
|
-
}
|
|
90
|
-
return context;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=ChainContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChainContext.js","sourceRoot":"","sources":["../../src/providers/ChainContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAa,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAUnE,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AASnE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,eAAe,GAAG,gBAAgB,EAClC,YAAY,GAAG,aAAa,EAC5B,aAAa,GACM;IACnB,MAAM,WAAW,GAAG,oBAAoB,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,0BAA0B,EAAE,CAAC;IAEjD,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAC/B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,WAAW,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IAEnC,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,KAAK,EAAE,OAAe,EAAE,EAAE;QACxB,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;QAClE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,mBAAmB,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,CAAC;YACH,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;YAC/B,IAAI,aAAa,EAAE,CAAC;gBAClB,aAAa,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAC/C,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EACD,CAAC,eAAe,EAAE,WAAW,EAAE,aAAa,CAAC,CAC9C,CAAC;IAEF,MAAM,KAAK,GAAsB;QAC/B,WAAW;QACX,eAAe;QACf,WAAW,EAAE,iBAAiB;QAC9B,cAAc;KACf,CAAC;IAEF,OAAO,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAyB,CAAC;AACjF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { DEFAULT_CHAIN, SUPPORTED_CHAINS } from '../config/chains';
|
|
3
|
-
export interface VarityProviderProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
clientId?: string;
|
|
6
|
-
activeChain?: typeof DEFAULT_CHAIN;
|
|
7
|
-
supportedChains?: typeof SUPPORTED_CHAINS;
|
|
8
|
-
theme?: 'light' | 'dark' | 'system';
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Main provider wrapper for Varity applications
|
|
12
|
-
*
|
|
13
|
-
* This component wraps your application with all necessary Web3 providers:
|
|
14
|
-
* - Thirdweb client for wallet connections
|
|
15
|
-
* - Chain configuration for Varity L3
|
|
16
|
-
* - Theme management (light/dark mode)
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* import { VarityProvider } from '@varity-labs/ui-kit';
|
|
21
|
-
*
|
|
22
|
-
* function App() {
|
|
23
|
-
* return (
|
|
24
|
-
* <VarityProvider>
|
|
25
|
-
* <YourApp />
|
|
26
|
-
* </VarityProvider>
|
|
27
|
-
* );
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function VarityProvider({ children, clientId, activeChain, supportedChains, theme, }: VarityProviderProps): JSX.Element;
|
|
32
|
-
//# sourceMappingURL=VarityProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VarityProvider.d.ts","sourceRoot":"","sources":["../../src/providers/VarityProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAsB,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIvF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,aAAa,CAAC;IACnC,eAAe,CAAC,EAAE,OAAO,gBAAgB,CAAC;IAC1C,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAA6B,EAC7B,WAA2B,EAC3B,eAAkC,EAClC,KAAgB,GACjB,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAsCnC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThirdwebProvider } from 'thirdweb/react';
|
|
3
|
-
import { createThirdwebClient } from 'thirdweb';
|
|
4
|
-
import { THIRDWEB_CLIENT_ID, DEFAULT_CHAIN, SUPPORTED_CHAINS } from '../config/chains';
|
|
5
|
-
/**
|
|
6
|
-
* Main provider wrapper for Varity applications
|
|
7
|
-
*
|
|
8
|
-
* This component wraps your application with all necessary Web3 providers:
|
|
9
|
-
* - Thirdweb client for wallet connections
|
|
10
|
-
* - Chain configuration for Varity L3
|
|
11
|
-
* - Theme management (light/dark mode)
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* import { VarityProvider } from '@varity-labs/ui-kit';
|
|
16
|
-
*
|
|
17
|
-
* function App() {
|
|
18
|
-
* return (
|
|
19
|
-
* <VarityProvider>
|
|
20
|
-
* <YourApp />
|
|
21
|
-
* </VarityProvider>
|
|
22
|
-
* );
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export function VarityProvider({ children, clientId = THIRDWEB_CLIENT_ID, activeChain = DEFAULT_CHAIN, supportedChains = SUPPORTED_CHAINS, theme = 'system', }) {
|
|
27
|
-
// Create Thirdweb client
|
|
28
|
-
const client = React.useMemo(() => createThirdwebClient({ clientId }), [clientId]);
|
|
29
|
-
// Apply theme to document
|
|
30
|
-
React.useEffect(() => {
|
|
31
|
-
const root = document.documentElement;
|
|
32
|
-
if (theme === 'dark') {
|
|
33
|
-
root.classList.add('dark');
|
|
34
|
-
}
|
|
35
|
-
else if (theme === 'light') {
|
|
36
|
-
root.classList.remove('dark');
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// System theme
|
|
40
|
-
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
41
|
-
const updateTheme = () => {
|
|
42
|
-
if (mediaQuery.matches) {
|
|
43
|
-
root.classList.add('dark');
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
root.classList.remove('dark');
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
updateTheme();
|
|
50
|
-
mediaQuery.addEventListener('change', updateTheme);
|
|
51
|
-
return () => mediaQuery.removeEventListener('change', updateTheme);
|
|
52
|
-
}
|
|
53
|
-
}, [theme]);
|
|
54
|
-
return (React.createElement(ThirdwebProvider, null, children));
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=VarityProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VarityProvider.js","sourceRoot":"","sources":["../../src/providers/VarityProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAYvF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,GAAG,kBAAkB,EAC7B,WAAW,GAAG,aAAa,EAC3B,eAAe,GAAG,gBAAgB,EAClC,KAAK,GAAG,QAAQ,GACI;IACpB,yBAAyB;IACzB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAC1B,GAAG,EAAE,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,CAAC,EACxC,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,0BAA0B;IAC1B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;QAEtC,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;aAAM,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,eAAe;YACf,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;YACrE,MAAM,WAAW,GAAG,GAAG,EAAE;gBACvB,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAC7B,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC,CAAC;YAEF,WAAW,EAAE,CAAC;YACd,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAEnD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,oBAAC,gBAAgB,QACd,QAAQ,CACQ,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { Account } from 'thirdweb/wallets';
|
|
3
|
-
export interface WalletContextValue {
|
|
4
|
-
address: string | null;
|
|
5
|
-
account: Account | null;
|
|
6
|
-
isConnected: boolean;
|
|
7
|
-
isConnecting: boolean;
|
|
8
|
-
disconnect: () => Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export interface WalletProviderProps {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
onConnect?: (address: string) => void;
|
|
13
|
-
onDisconnect?: () => void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Wallet state management provider
|
|
17
|
-
*
|
|
18
|
-
* Manages wallet connection state and provides utilities for:
|
|
19
|
-
* - Accessing current wallet address
|
|
20
|
-
* - Checking connection status
|
|
21
|
-
* - Disconnecting wallet
|
|
22
|
-
* - Event callbacks for connection changes
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* import { WalletProvider } from '@varity-labs/ui-kit';
|
|
27
|
-
*
|
|
28
|
-
* function App() {
|
|
29
|
-
* return (
|
|
30
|
-
* <WalletProvider
|
|
31
|
-
* onConnect={(address) => console.log('Connected:', address)}
|
|
32
|
-
* onDisconnect={() => console.log('Disconnected')}
|
|
33
|
-
* >
|
|
34
|
-
* <YourApp />
|
|
35
|
-
* </WalletProvider>
|
|
36
|
-
* );
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare function WalletProvider({ children, onConnect, onDisconnect }: WalletProviderProps): JSX.Element;
|
|
41
|
-
/**
|
|
42
|
-
* Hook to access wallet context
|
|
43
|
-
*
|
|
44
|
-
* @returns {WalletContextValue} Wallet state and utilities
|
|
45
|
-
* @throws {Error} If used outside WalletProvider
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* import { useWallet } from '@varity-labs/ui-kit';
|
|
50
|
-
*
|
|
51
|
-
* function MyComponent() {
|
|
52
|
-
* const { address, isConnected, disconnect } = useWallet();
|
|
53
|
-
*
|
|
54
|
-
* if (!isConnected) {
|
|
55
|
-
* return <p>Please connect your wallet</p>;
|
|
56
|
-
* }
|
|
57
|
-
*
|
|
58
|
-
* return (
|
|
59
|
-
* <div>
|
|
60
|
-
* <p>Connected: {address}</p>
|
|
61
|
-
* <button onClick={disconnect}>Disconnect</button>
|
|
62
|
-
* </div>
|
|
63
|
-
* );
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare function useWallet(): WalletContextValue;
|
|
68
|
-
//# sourceMappingURL=WalletContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletContext.d.ts","sourceRoot":"","sources":["../../src/providers/WalletContext.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA0C,SAAS,EAAa,MAAM,OAAO,CAAC;AAE5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAID,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAwCtG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
|