@abstraxn/signer-react 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +114 -0
  2. package/dist/src/AbstraxnProvider.d.ts +9 -0
  3. package/dist/src/AbstraxnProvider.js +21 -0
  4. package/dist/src/AbstraxnProvider.js.map +1 -0
  5. package/dist/src/ConnectButton.css +217 -0
  6. package/dist/src/ConnectButton.d.ts +71 -0
  7. package/dist/src/ConnectButton.js +102 -0
  8. package/dist/src/ConnectButton.js.map +1 -0
  9. package/dist/src/ExternalWalletButtons.css +319 -0
  10. package/dist/src/ExternalWalletButtons.d.ts +56 -0
  11. package/dist/src/ExternalWalletButtons.js +272 -0
  12. package/dist/src/ExternalWalletButtons.js.map +1 -0
  13. package/dist/src/OnboardingUI.d.ts +63 -0
  14. package/dist/src/OnboardingUI.js +66 -0
  15. package/dist/src/OnboardingUI.js.map +1 -0
  16. package/dist/src/WalletModal.css +2319 -0
  17. package/dist/src/WalletModal.d.ts +7 -0
  18. package/dist/src/WalletModal.js +322 -0
  19. package/dist/src/WalletModal.js.map +1 -0
  20. package/dist/src/chains.d.ts +56 -0
  21. package/dist/src/chains.js +291 -0
  22. package/dist/src/chains.js.map +1 -0
  23. package/dist/src/components/AbstraxnProvider/AbstraxnProvider.d.ts +12 -0
  24. package/dist/src/components/AbstraxnProvider/AbstraxnProvider.js +146 -0
  25. package/dist/src/components/AbstraxnProvider/AbstraxnProvider.js.map +1 -0
  26. package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.d.ts +25 -0
  27. package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js +3086 -0
  28. package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js.map +1 -0
  29. package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithWagmi.d.ts +8 -0
  30. package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithWagmi.js +46 -0
  31. package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithWagmi.js.map +1 -0
  32. package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithoutWagmi.d.ts +8 -0
  33. package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithoutWagmi.js +12 -0
  34. package/dist/src/components/AbstraxnProvider/AbstraxnProviderWithoutWagmi.js.map +1 -0
  35. package/dist/src/components/AbstraxnProvider/context.d.ts +2 -0
  36. package/dist/src/components/AbstraxnProvider/context.js +6 -0
  37. package/dist/src/components/AbstraxnProvider/context.js.map +1 -0
  38. package/dist/src/components/AbstraxnProvider/index.d.ts +6 -0
  39. package/dist/src/components/AbstraxnProvider/index.js +7 -0
  40. package/dist/src/components/AbstraxnProvider/index.js.map +1 -0
  41. package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.d.ts +30 -0
  42. package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.js +49 -0
  43. package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.js.map +1 -0
  44. package/dist/src/components/AbstraxnProvider/useAbstraxnWallet.d.ts +2 -0
  45. package/dist/src/components/AbstraxnProvider/useAbstraxnWallet.js +13 -0
  46. package/dist/src/components/AbstraxnProvider/useAbstraxnWallet.js.map +1 -0
  47. package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.d.ts +22 -0
  48. package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.js +242 -0
  49. package/dist/src/components/AbstraxnProvider/useOAuthCallbacks.js.map +1 -0
  50. package/dist/src/components/AbstraxnProvider/useWalletInitialization.d.ts +25 -0
  51. package/dist/src/components/AbstraxnProvider/useWalletInitialization.js +539 -0
  52. package/dist/src/components/AbstraxnProvider/useWalletInitialization.js.map +1 -0
  53. package/dist/src/components/AbstraxnProvider/utils.d.ts +41 -0
  54. package/dist/src/components/AbstraxnProvider/utils.js +139 -0
  55. package/dist/src/components/AbstraxnProvider/utils.js.map +1 -0
  56. package/dist/src/components/OnboardingUI/OnboardingUI.css +1062 -0
  57. package/dist/src/components/OnboardingUI/OnboardingUIReact.d.ts +15 -0
  58. package/dist/src/components/OnboardingUI/OnboardingUIReact.js +318 -0
  59. package/dist/src/components/OnboardingUI/OnboardingUIReact.js.map +1 -0
  60. package/dist/src/components/OnboardingUI/OnboardingUIWeb.d.ts +265 -0
  61. package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +3782 -0
  62. package/dist/src/components/OnboardingUI/OnboardingUIWeb.js.map +1 -0
  63. package/dist/src/components/OnboardingUI/components/EmailForm.d.ts +16 -0
  64. package/dist/src/components/OnboardingUI/components/EmailForm.js +27 -0
  65. package/dist/src/components/OnboardingUI/components/EmailForm.js.map +1 -0
  66. package/dist/src/components/OnboardingUI/components/Modal.d.ts +14 -0
  67. package/dist/src/components/OnboardingUI/components/Modal.js +61 -0
  68. package/dist/src/components/OnboardingUI/components/Modal.js.map +1 -0
  69. package/dist/src/components/OnboardingUI/components/OtpForm.d.ts +20 -0
  70. package/dist/src/components/OnboardingUI/components/OtpForm.js +72 -0
  71. package/dist/src/components/OnboardingUI/components/OtpForm.js.map +1 -0
  72. package/dist/src/components/OnboardingUI/components/PasskeyButton.d.ts +14 -0
  73. package/dist/src/components/OnboardingUI/components/PasskeyButton.js +22 -0
  74. package/dist/src/components/OnboardingUI/components/PasskeyButton.js.map +1 -0
  75. package/dist/src/components/OnboardingUI/components/SocialButtons.d.ts +15 -0
  76. package/dist/src/components/OnboardingUI/components/SocialButtons.js +20 -0
  77. package/dist/src/components/OnboardingUI/components/SocialButtons.js.map +1 -0
  78. package/dist/src/components/OnboardingUI/components/index.d.ts +13 -0
  79. package/dist/src/components/OnboardingUI/components/index.js +9 -0
  80. package/dist/src/components/OnboardingUI/components/index.js.map +1 -0
  81. package/dist/src/components/OnboardingUI/hooks/index.d.ts +7 -0
  82. package/dist/src/components/OnboardingUI/hooks/index.js +6 -0
  83. package/dist/src/components/OnboardingUI/hooks/index.js.map +1 -0
  84. package/dist/src/components/OnboardingUI/hooks/useAuthMethods.d.ts +11 -0
  85. package/dist/src/components/OnboardingUI/hooks/useAuthMethods.js +243 -0
  86. package/dist/src/components/OnboardingUI/hooks/useAuthMethods.js.map +1 -0
  87. package/dist/src/components/OnboardingUI/hooks/useOnboarding.d.ts +21 -0
  88. package/dist/src/components/OnboardingUI/hooks/useOnboarding.js +153 -0
  89. package/dist/src/components/OnboardingUI/hooks/useOnboarding.js.map +1 -0
  90. package/dist/src/components/OnboardingUI/index.d.ts +12 -0
  91. package/dist/src/components/OnboardingUI/index.js +15 -0
  92. package/dist/src/components/OnboardingUI/index.js.map +1 -0
  93. package/dist/src/components/QRCode.d.ts +13 -0
  94. package/dist/src/components/QRCode.js +6 -0
  95. package/dist/src/components/QRCode.js.map +1 -0
  96. package/dist/src/components/WalletModal/components/ChainSelector.css +327 -0
  97. package/dist/src/components/WalletModal/components/ChainSelector.d.ts +11 -0
  98. package/dist/src/components/WalletModal/components/ChainSelector.js +75 -0
  99. package/dist/src/components/WalletModal/components/ChainSelector.js.map +1 -0
  100. package/dist/src/components/WalletModal/components/ExportKeyModal.css +134 -0
  101. package/dist/src/components/WalletModal/components/ExportKeyModal.d.ts +14 -0
  102. package/dist/src/components/WalletModal/components/ExportKeyModal.js +26 -0
  103. package/dist/src/components/WalletModal/components/ExportKeyModal.js.map +1 -0
  104. package/dist/src/components/WalletModal/components/ExportWarningModal.css +107 -0
  105. package/dist/src/components/WalletModal/components/ExportWarningModal.d.ts +17 -0
  106. package/dist/src/components/WalletModal/components/ExportWarningModal.js +20 -0
  107. package/dist/src/components/WalletModal/components/ExportWarningModal.js.map +1 -0
  108. package/dist/src/components/WalletModal/components/ManageWalletModal.css +246 -0
  109. package/dist/src/components/WalletModal/components/ManageWalletModal.d.ts +12 -0
  110. package/dist/src/components/WalletModal/components/ManageWalletModal.js +36 -0
  111. package/dist/src/components/WalletModal/components/ManageWalletModal.js.map +1 -0
  112. package/dist/src/components/WalletModal/components/PreviewTransactionModal.css +127 -0
  113. package/dist/src/components/WalletModal/components/PreviewTransactionModal.d.ts +17 -0
  114. package/dist/src/components/WalletModal/components/PreviewTransactionModal.js +10 -0
  115. package/dist/src/components/WalletModal/components/PreviewTransactionModal.js.map +1 -0
  116. package/dist/src/components/WalletModal/components/ReceiveModal.css +136 -0
  117. package/dist/src/components/WalletModal/components/ReceiveModal.d.ts +8 -0
  118. package/dist/src/components/WalletModal/components/ReceiveModal.js +22 -0
  119. package/dist/src/components/WalletModal/components/ReceiveModal.js.map +1 -0
  120. package/dist/src/components/WalletModal/components/SendModal.css +277 -0
  121. package/dist/src/components/WalletModal/components/SendModal.d.ts +16 -0
  122. package/dist/src/components/WalletModal/components/SendModal.js +219 -0
  123. package/dist/src/components/WalletModal/components/SendModal.js.map +1 -0
  124. package/dist/src/components/WalletModal/components/SuccessModal.css +85 -0
  125. package/dist/src/components/WalletModal/components/SuccessModal.d.ts +13 -0
  126. package/dist/src/components/WalletModal/components/SuccessModal.js +8 -0
  127. package/dist/src/components/WalletModal/components/SuccessModal.js.map +1 -0
  128. package/dist/src/components/WalletModal/components/TokenSelectorModal.css +240 -0
  129. package/dist/src/components/WalletModal/components/TokenSelectorModal.d.ts +21 -0
  130. package/dist/src/components/WalletModal/components/TokenSelectorModal.js +44 -0
  131. package/dist/src/components/WalletModal/components/TokenSelectorModal.js.map +1 -0
  132. package/dist/src/components/WalletModal/components/UserAvatar.d.ts +9 -0
  133. package/dist/src/components/WalletModal/components/UserAvatar.js +31 -0
  134. package/dist/src/components/WalletModal/components/UserAvatar.js.map +1 -0
  135. package/dist/src/components/WalletModal/components/index.d.ts +23 -0
  136. package/dist/src/components/WalletModal/components/index.js +14 -0
  137. package/dist/src/components/WalletModal/components/index.js.map +1 -0
  138. package/dist/src/components/WalletModal/hooks/index.d.ts +6 -0
  139. package/dist/src/components/WalletModal/hooks/index.js +7 -0
  140. package/dist/src/components/WalletModal/hooks/index.js.map +1 -0
  141. package/dist/src/components/WalletModal/hooks/useAddressValidation.d.ts +4 -0
  142. package/dist/src/components/WalletModal/hooks/useAddressValidation.js +17 -0
  143. package/dist/src/components/WalletModal/hooks/useAddressValidation.js.map +1 -0
  144. package/dist/src/components/WalletModal/hooks/useAmountValidation.d.ts +4 -0
  145. package/dist/src/components/WalletModal/hooks/useAmountValidation.js +29 -0
  146. package/dist/src/components/WalletModal/hooks/useAmountValidation.js.map +1 -0
  147. package/dist/src/components/WalletModal/hooks/useSendTransaction.d.ts +20 -0
  148. package/dist/src/components/WalletModal/hooks/useSendTransaction.js +55 -0
  149. package/dist/src/components/WalletModal/hooks/useSendTransaction.js.map +1 -0
  150. package/dist/src/components/WalletModal/index.d.ts +5 -0
  151. package/dist/src/components/WalletModal/index.js +7 -0
  152. package/dist/src/components/WalletModal/index.js.map +1 -0
  153. package/dist/src/components/WalletModal/utils/addressUtils.d.ts +19 -0
  154. package/dist/src/components/WalletModal/utils/addressUtils.js +62 -0
  155. package/dist/src/components/WalletModal/utils/addressUtils.js.map +1 -0
  156. package/dist/src/components/WalletModal/utils/formatUtils.d.ts +20 -0
  157. package/dist/src/components/WalletModal/utils/formatUtils.js +47 -0
  158. package/dist/src/components/WalletModal/utils/formatUtils.js.map +1 -0
  159. package/dist/src/components/WalletModal/utils/index.d.ts +5 -0
  160. package/dist/src/components/WalletModal/utils/index.js +6 -0
  161. package/dist/src/components/WalletModal/utils/index.js.map +1 -0
  162. package/dist/src/connectors.d.ts +27 -0
  163. package/dist/src/connectors.js +70 -0
  164. package/dist/src/connectors.js.map +1 -0
  165. package/dist/src/hooks.d.ts +13136 -0
  166. package/dist/src/hooks.js +1358 -0
  167. package/dist/src/hooks.js.map +1 -0
  168. package/dist/src/index.d.ts +17 -0
  169. package/dist/src/index.js +14 -0
  170. package/dist/src/index.js.map +1 -0
  171. package/dist/src/types.d.ts +224 -0
  172. package/dist/src/types.js +2 -0
  173. package/dist/src/types.js.map +1 -0
  174. package/dist/src/wagmiConfig.d.ts +16 -0
  175. package/dist/src/wagmiConfig.js +103 -0
  176. package/dist/src/wagmiConfig.js.map +1 -0
  177. package/dist/tsconfig.tsbuildinfo +1 -0
  178. package/package.json +70 -0
@@ -0,0 +1,20 @@
1
+ import type { TransactionRequest } from '@abstraxn/signer-core';
2
+ import type { ChainData } from '../../../chains';
3
+ interface UseSendTransactionProps {
4
+ sendTransaction?: (tx: TransactionRequest) => Promise<{
5
+ hash: string;
6
+ }>;
7
+ currentChain: ChainData | null | undefined;
8
+ fromAddress?: string | null;
9
+ onSuccess?: (txHash: string) => void;
10
+ onError?: (error: Error) => void;
11
+ }
12
+ export declare function useSendTransaction({ sendTransaction, currentChain, fromAddress, onSuccess, onError, }: UseSendTransactionProps): {
13
+ send: (recipientAddress: string, amount: string) => Promise<{
14
+ hash: string;
15
+ }>;
16
+ isSending: boolean;
17
+ txHash: string | null;
18
+ reset: () => void;
19
+ };
20
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Hook for managing send transaction state and logic
3
+ */
4
+ import { useState, useCallback } from 'react';
5
+ import { amountToSmallestUnit } from '../utils/formatUtils';
6
+ export function useSendTransaction({ sendTransaction, currentChain, fromAddress, onSuccess, onError, }) {
7
+ const [isSending, setIsSending] = useState(false);
8
+ const [txHash, setTxHash] = useState(null);
9
+ const send = useCallback(async (recipientAddress, amount) => {
10
+ if (!sendTransaction || !currentChain) {
11
+ throw new Error('Transaction not available');
12
+ }
13
+ if (!fromAddress) {
14
+ throw new Error('Sender address is required');
15
+ }
16
+ // For Solana, we might need different handling
17
+ if (currentChain.type === 'solana') {
18
+ throw new Error('Solana transactions are not yet supported. Please use EVM chains.');
19
+ }
20
+ setIsSending(true);
21
+ try {
22
+ const decimals = currentChain.nativeCurrency.decimals;
23
+ const amountInSmallestUnit = amountToSmallestUnit(amount, decimals);
24
+ const tx = {
25
+ from: fromAddress,
26
+ to: recipientAddress,
27
+ value: amountInSmallestUnit.toString(),
28
+ chainId: currentChain.id,
29
+ };
30
+ const result = await sendTransaction(tx);
31
+ setTxHash(result.hash);
32
+ onSuccess?.(result.hash);
33
+ return result;
34
+ }
35
+ catch (error) {
36
+ const err = error instanceof Error ? error : new Error('Failed to send transaction');
37
+ onError?.(err);
38
+ throw err;
39
+ }
40
+ finally {
41
+ setIsSending(false);
42
+ }
43
+ }, [sendTransaction, currentChain, fromAddress, onSuccess, onError]);
44
+ const reset = useCallback(() => {
45
+ setTxHash(null);
46
+ setIsSending(false);
47
+ }, []);
48
+ return {
49
+ send,
50
+ isSending,
51
+ txHash,
52
+ reset,
53
+ };
54
+ }
55
+ //# sourceMappingURL=useSendTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSendTransaction.js","sourceRoot":"","sources":["../../../../../src/components/WalletModal/hooks/useSendTransaction.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAU5D,MAAM,UAAU,kBAAkB,CAAC,EACjC,eAAe,EACf,YAAY,EACZ,WAAW,EACX,SAAS,EACT,OAAO,GACiB;IACxB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAE1D,MAAM,IAAI,GAAG,WAAW,CACtB,KAAK,EAAE,gBAAwB,EAAE,MAAc,EAAE,EAAE;QACjD,IAAI,CAAC,eAAe,IAAI,CAAC,YAAY,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QAED,+CAA+C;QAC/C,IAAI,YAAY,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACvF,CAAC;QAED,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Note: The actual WalletModal.tsx is in the parent directory (src/WalletModal.tsx)
4
+ * This index file is for future organization
5
+ */
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * WalletModal - Main Export
4
+ * Note: The actual WalletModal.tsx is in the parent directory (src/WalletModal.tsx)
5
+ * This index file is for future organization
6
+ */
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/WalletModal/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Validates an EVM address
3
+ */
4
+ export declare function validateEvmAddress(address: string): boolean;
5
+ /**
6
+ * Validates a Solana address
7
+ */
8
+ export declare function validateSolanaAddress(address: string): boolean;
9
+ /**
10
+ * Validates an address based on chain type
11
+ */
12
+ export declare function validateAddress(address: string, chainType: 'evm' | 'solana'): boolean;
13
+ /**
14
+ * Validates address and checks if it's not the sender's address
15
+ */
16
+ export declare function validateRecipientAddress(address: string, senderAddress: string | null | undefined, chainType: 'evm' | 'solana'): {
17
+ isValid: boolean;
18
+ error: string;
19
+ };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Address validation utilities
3
+ */
4
+ import { isAddress as isEvmAddress } from 'viem';
5
+ /**
6
+ * Validates an EVM address
7
+ */
8
+ export function validateEvmAddress(address) {
9
+ if (!address)
10
+ return false;
11
+ try {
12
+ return isEvmAddress(address);
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ /**
19
+ * Validates a Solana address
20
+ */
21
+ export function validateSolanaAddress(address) {
22
+ if (!address)
23
+ return false;
24
+ // Solana addresses are base58 encoded, typically 32-44 characters
25
+ // Basic validation: check length and base58 pattern
26
+ const base58Regex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
27
+ return base58Regex.test(address);
28
+ }
29
+ /**
30
+ * Validates an address based on chain type
31
+ */
32
+ export function validateAddress(address, chainType) {
33
+ if (!address || address.trim() === '') {
34
+ return false;
35
+ }
36
+ if (chainType === 'solana') {
37
+ return validateSolanaAddress(address);
38
+ }
39
+ else {
40
+ return validateEvmAddress(address);
41
+ }
42
+ }
43
+ /**
44
+ * Validates address and checks if it's not the sender's address
45
+ */
46
+ export function validateRecipientAddress(address, senderAddress, chainType) {
47
+ if (!address || address.trim() === '') {
48
+ return { isValid: false, error: 'Recipient address is required' };
49
+ }
50
+ if (!validateAddress(address, chainType)) {
51
+ return {
52
+ isValid: false,
53
+ error: chainType === 'solana' ? 'Invalid Solana address' : 'Invalid EVM address',
54
+ };
55
+ }
56
+ // Check if sending to self
57
+ if (senderAddress && address.toLowerCase() === senderAddress.toLowerCase()) {
58
+ return { isValid: false, error: 'Cannot send to your own address' };
59
+ }
60
+ return { isValid: true, error: '' };
61
+ }
62
+ //# sourceMappingURL=addressUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressUtils.js","sourceRoot":"","sources":["../../../../../src/components/WalletModal/utils/addressUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,kEAAkE;IAClE,oDAAoD;IACpD,MAAM,WAAW,GAAG,+BAA+B,CAAC;IACpD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,SAA2B;IAE3B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,aAAwC,EACxC,SAA2B;IAE3B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,+BAA+B,EAAE,CAAC;IACpE,CAAC;IAED,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;QACzC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,qBAAqB;SACjF,CAAC;IACJ,CAAC;IAED,2BAA2B;IAC3B,IAAI,aAAa,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC;IACtE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Formatting utilities
3
+ */
4
+ /**
5
+ * Formats an address to show first 6 and last 4 characters
6
+ */
7
+ export declare function formatAddress(addr: string | null | undefined): string;
8
+ /**
9
+ * Formats a balance with proper decimals and symbol
10
+ * Removes trailing zeros and unnecessary decimals
11
+ */
12
+ export declare function formatBalance(balance: bigint | null | undefined, decimals: number, symbol: string): string;
13
+ /**
14
+ * Formats a balance value (number) with proper decimals
15
+ */
16
+ export declare function formatBalanceValue(balance: bigint | null | undefined, decimals: number): string;
17
+ /**
18
+ * Converts amount string to smallest unit (wei, lamports, etc.)
19
+ */
20
+ export declare function amountToSmallestUnit(amount: string, decimals: number): bigint;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Formatting utilities
3
+ */
4
+ /**
5
+ * Formats an address to show first 6 and last 4 characters
6
+ */
7
+ export function formatAddress(addr) {
8
+ if (!addr)
9
+ return '';
10
+ if (addr.length <= 10)
11
+ return addr;
12
+ return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
13
+ }
14
+ /**
15
+ * Formats a balance with proper decimals and symbol
16
+ * Removes trailing zeros and unnecessary decimals
17
+ */
18
+ export function formatBalance(balance, decimals, symbol) {
19
+ if (!balance || balance === 0n)
20
+ return `0 ${symbol}`;
21
+ const balanceValue = Number(balance) / Math.pow(10, decimals);
22
+ // Remove trailing zeros and unnecessary decimals
23
+ // Use toFixed with max decimals, then remove trailing zeros
24
+ const formatted = balanceValue.toFixed(decimals);
25
+ // Remove trailing zeros and decimal point if not needed
26
+ const trimmed = formatted.replace(/\.?0+$/, '');
27
+ return `${trimmed} ${symbol}`;
28
+ }
29
+ /**
30
+ * Formats a balance value (number) with proper decimals
31
+ */
32
+ export function formatBalanceValue(balance, decimals) {
33
+ if (!balance || balance === 0n)
34
+ return '0';
35
+ return (Number(balance) / Math.pow(10, decimals)).toFixed(6);
36
+ }
37
+ /**
38
+ * Converts amount string to smallest unit (wei, lamports, etc.)
39
+ */
40
+ export function amountToSmallestUnit(amount, decimals) {
41
+ const numAmount = parseFloat(amount);
42
+ if (isNaN(numAmount) || numAmount <= 0) {
43
+ return 0n;
44
+ }
45
+ return BigInt(Math.floor(numAmount * Math.pow(10, decimals)));
46
+ }
47
+ //# sourceMappingURL=formatUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatU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AoB,CAClC,MAAc,EACd,QAAgB;IAEhB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * WalletModal Utilities
3
+ */
4
+ export * from './addressUtils';
5
+ export * from './formatUtils';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * WalletModal Utilities
3
+ */
4
+ export * from './addressUtils';
5
+ export * from './formatUtils';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/WalletModal/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Connector types and metadata
3
+ */
4
+ export type ConnectorType = "google" | "x" | "discord" | "metamask" | "walletconnect" | "email" | "passkey";
5
+ export interface ConnectorMeta {
6
+ id: ConnectorType;
7
+ name: string;
8
+ category: "oauth" | "wallet" | "auth";
9
+ icon?: string;
10
+ }
11
+ export declare const CONNECTORS: Record<ConnectorType, ConnectorMeta>;
12
+ /**
13
+ * Get connector metadata by type
14
+ */
15
+ export declare function getConnectorMeta(type: ConnectorType | string | null): ConnectorMeta | null;
16
+ /**
17
+ * Check if a connection type is an OAuth connector
18
+ */
19
+ export declare function isOAuthConnector(type: ConnectorType | string | null): boolean;
20
+ /**
21
+ * Check if a connection type is a wallet connector
22
+ */
23
+ export declare function isWalletConnector(type: ConnectorType | string | null): boolean;
24
+ /**
25
+ * Check if a connection type is an auth connector
26
+ */
27
+ export declare function isAuthConnector(type: ConnectorType | string | null): boolean;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Connector types and metadata
3
+ */
4
+ export const CONNECTORS = {
5
+ google: {
6
+ id: "google",
7
+ name: "Google",
8
+ category: "oauth",
9
+ },
10
+ x: {
11
+ id: "x",
12
+ name: "X (Twitter)",
13
+ category: "oauth",
14
+ },
15
+ discord: {
16
+ id: "discord",
17
+ name: "Discord",
18
+ category: "oauth",
19
+ },
20
+ metamask: {
21
+ id: "metamask",
22
+ name: "MetaMask",
23
+ category: "wallet",
24
+ },
25
+ walletconnect: {
26
+ id: "walletconnect",
27
+ name: "WalletConnect",
28
+ category: "wallet",
29
+ },
30
+ email: {
31
+ id: "email",
32
+ name: "Email",
33
+ category: "auth",
34
+ },
35
+ passkey: {
36
+ id: "passkey",
37
+ name: "Passkey",
38
+ category: "auth",
39
+ },
40
+ };
41
+ /**
42
+ * Get connector metadata by type
43
+ */
44
+ export function getConnectorMeta(type) {
45
+ if (!type)
46
+ return null;
47
+ return CONNECTORS[type] || null;
48
+ }
49
+ /**
50
+ * Check if a connection type is an OAuth connector
51
+ */
52
+ export function isOAuthConnector(type) {
53
+ const meta = getConnectorMeta(type);
54
+ return meta?.category === "oauth" || false;
55
+ }
56
+ /**
57
+ * Check if a connection type is a wallet connector
58
+ */
59
+ export function isWalletConnector(type) {
60
+ const meta = getConnectorMeta(type);
61
+ return meta?.category === "wallet" || false;
62
+ }
63
+ /**
64
+ * Check if a connection type is an auth connector
65
+ */
66
+ export function isAuthConnector(type) {
67
+ const meta = getConnectorMeta(type);
68
+ return meta?.category === "auth" || false;
69
+ }
70
+ //# sourceMappingURL=connectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectors.js","sourceRoot":"","sources":["../../src/connectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,MAAM,CAAC,MAAM,UAAU,GAAyC;IAC9D,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,IA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