@xyo-network/react-connected-accounts 3.0.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/classes/EnabledWallets.d.ts +30 -0
- package/dist/browser/classes/EnabledWallets.d.ts.map +1 -0
- package/dist/browser/classes/index.d.ts +2 -0
- package/dist/browser/classes/index.d.ts.map +1 -0
- package/dist/browser/components/ConnectedAccountsFlexbox.d.ts +8 -0
- package/dist/browser/components/ConnectedAccountsFlexbox.d.ts.map +1 -0
- package/dist/browser/components/index.d.ts +3 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/connect/CheckboxFormControl.d.ts +7 -0
- package/dist/browser/components/wallet/dialogs/connect/CheckboxFormControl.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/connect/Dialog.d.ts +9 -0
- package/dist/browser/components/wallet/dialogs/connect/Dialog.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.ts +8 -0
- package/dist/browser/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/connect/Permissions.d.ts +6 -0
- package/dist/browser/components/wallet/dialogs/connect/Permissions.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/connect/index.d.ts +3 -0
- package/dist/browser/components/wallet/dialogs/connect/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/index.d.ts +3 -0
- package/dist/browser/components/wallet/dialogs/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/revoke/Dialog.d.ts +8 -0
- package/dist/browser/components/wallet/dialogs/revoke/Dialog.d.ts.map +1 -0
- package/dist/browser/components/wallet/dialogs/revoke/index.d.ts +2 -0
- package/dist/browser/components/wallet/dialogs/revoke/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/index.d.ts +3 -0
- package/dist/browser/components/wallet/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/lib/ActiveProvider.d.ts +7 -0
- package/dist/browser/components/wallet/lib/ActiveProvider.d.ts.map +1 -0
- package/dist/browser/components/wallet/lib/TableHeadData.d.ts +3 -0
- package/dist/browser/components/wallet/lib/TableHeadData.d.ts.map +1 -0
- package/dist/browser/components/wallet/lib/index.d.ts +3 -0
- package/dist/browser/components/wallet/lib/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/ConnectedWalletsTable.d.ts +10 -0
- package/dist/browser/components/wallet/table/ConnectedWalletsTable.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/ConnectedWalletsTableRow.d.ts +12 -0
- package/dist/browser/components/wallet/table/ConnectedWalletsTableRow.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/Accounts.d.ts +4 -0
- package/dist/browser/components/wallet/table/cells/Accounts.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/Actions.d.ts +4 -0
- package/dist/browser/components/wallet/table/cells/Actions.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/Cells.d.ts +4 -0
- package/dist/browser/components/wallet/table/cells/Cells.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/ChainName.d.ts +4 -0
- package/dist/browser/components/wallet/table/cells/ChainName.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/State.d.ts +4 -0
- package/dist/browser/components/wallet/table/cells/State.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/Wallet.d.ts +4 -0
- package/dist/browser/components/wallet/table/cells/Wallet.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/index.d.ts +7 -0
- package/dist/browser/components/wallet/table/cells/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.ts +15 -0
- package/dist/browser/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/cells/lib/index.d.ts +2 -0
- package/dist/browser/components/wallet/table/cells/lib/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/hooks/index.d.ts +2 -0
- package/dist/browser/components/wallet/table/hooks/index.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/hooks/useActiveProviderDialogState.d.ts +4 -0
- package/dist/browser/components/wallet/table/hooks/useActiveProviderDialogState.d.ts.map +1 -0
- package/dist/browser/components/wallet/table/index.d.ts +5 -0
- package/dist/browser/components/wallet/table/index.d.ts.map +1 -0
- package/dist/browser/hooks/index.d.ts +3 -0
- package/dist/browser/hooks/index.d.ts.map +1 -0
- package/dist/browser/hooks/useDetectWallets.d.ts +6 -0
- package/dist/browser/hooks/useDetectWallets.d.ts.map +1 -0
- package/dist/browser/hooks/useEnabledWallets.d.ts +9 -0
- package/dist/browser/hooks/useEnabledWallets.d.ts.map +1 -0
- package/dist/browser/img/index.d.ts +3 -0
- package/dist/browser/img/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -119
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +49 -43
- package/src/classes/EnabledWallets.ts +1 -1
- package/src/components/ConnectedAccountsFlexbox.stories.tsx +2 -4
- package/src/components/ConnectedAccountsFlexbox.tsx +5 -2
- package/src/components/wallet/dialogs/connect/CheckboxFormControl.tsx +4 -1
- package/src/components/wallet/dialogs/connect/Dialog.tsx +16 -5
- package/src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx +11 -3
- package/src/components/wallet/dialogs/connect/Permissions.tsx +2 -1
- package/src/components/wallet/dialogs/revoke/Dialog.tsx +5 -2
- package/src/components/wallet/lib/ActiveProvider.ts +1 -1
- package/src/components/wallet/lib/TableHeadData.ts +1 -1
- package/src/components/wallet/table/ConnectedWalletsTable.tsx +13 -5
- package/src/components/wallet/table/ConnectedWalletsTableRow.tsx +13 -5
- package/src/components/wallet/table/cells/Accounts.tsx +4 -2
- package/src/components/wallet/table/cells/Actions.tsx +7 -3
- package/src/components/wallet/table/cells/Cells.tsx +2 -2
- package/src/components/wallet/table/cells/ChainName.tsx +1 -1
- package/src/components/wallet/table/cells/State.tsx +9 -4
- package/src/components/wallet/table/cells/Wallet.tsx +4 -2
- package/src/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.tsx +1 -1
- package/src/components/wallet/table/hooks/useActiveProviderDialogState.tsx +3 -2
- package/src/hooks/useDetectWallets.tsx +6 -2
- package/src/hooks/useEnabledWallets.tsx +2 -1
- package/xy.config.ts +2 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/classes/EnabledWallets.ts","../../src/components/ConnectedAccountsFlexbox.tsx","../../src/hooks/useDetectWallets.tsx","../../src/hooks/useEnabledWallets.tsx","../../src/components/wallet/dialogs/connect/CheckboxFormControl.tsx","../../src/components/wallet/dialogs/connect/Dialog.tsx","../../src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx","../../src/img/index.ts","../../src/components/wallet/dialogs/connect/Permissions.tsx","../../src/components/wallet/dialogs/revoke/Dialog.tsx","../../src/components/wallet/table/cells/Accounts.tsx","../../src/components/wallet/table/cells/Actions.tsx","../../src/components/wallet/table/cells/ChainName.tsx","../../src/components/wallet/table/cells/State.tsx","../../src/components/wallet/table/cells/Wallet.tsx","../../src/components/wallet/table/cells/Cells.tsx","../../src/components/wallet/table/ConnectedWalletsTable.tsx","../../src/components/wallet/lib/TableHeadData.ts","../../src/components/wallet/table/ConnectedWalletsTableRow.tsx","../../src/components/wallet/table/hooks/useActiveProviderDialogState.tsx"],"sourcesContent":["import { DiscoveredWallets, EIP6963Connector } from '@xylabs/react-crypto'\n\nconst DEFAULT_LOCAL_STORAGE_KEY = 'XYO|EnabledWallets'\n\n/**\n * State for storing wallets and their enabled/disabled status by name\n */\nexport interface EnabledEthWalletsState {\n [rdns: string]: {\n enabled: boolean\n wallet: EIP6963Connector\n }\n}\n\n/**\n * State for storing only enabled/disabled status of a wallet by name\n */\nexport interface EnabledWalletsSavedState {\n [rdns: string]: boolean\n}\n\nexport type WalletListener = () => void\n\nexport class EnabledEthWalletConnections {\n // control whether or not enabled/disabled preferences are persisted (i.e. in localStorage)\n persistPreferences = true\n\n // Map of wallet names and their enabled/disabled state\n private enabledWallets: EnabledWalletsSavedState = {}\n\n // Map of wallet names, their enabled/disabled state, and their wallet class\n private ethWalletsState: EnabledEthWalletsState = {}\n\n // list of listeners that want to be notified on wallet changes\n private listeners: WalletListener[] = []\n\n // key to use in localStorage when persisting preferences\n private localStorageKey = DEFAULT_LOCAL_STORAGE_KEY\n\n constructor(localStorageKey = DEFAULT_LOCAL_STORAGE_KEY) {\n this.localStorageKey = localStorageKey\n this.reviveSettings()\n }\n\n get wallets() {\n return this.ethWalletsState\n }\n\n disableWallet(rdns: string) {\n this.toggleEnabledWallet(rdns, false)\n }\n\n enableWallet(rdns: string) {\n this.toggleEnabledWallet(rdns, true)\n }\n\n /**\n * Given a new set of wallets, set their enabled state based off previous preferences\n */\n resetWallets(wallets: DiscoveredWallets) {\n const newWallets: EnabledEthWalletsState = {}\n\n const addWallet = ([walletName, wallet]: [string, EIP6963Connector]) => {\n newWallets[walletName] = {\n // preserve the existing enabled state\n enabled: walletName in this.enabledWallets ? this.enabledWallets[walletName] : true,\n wallet,\n }\n }\n\n // eslint-disable-next-line unicorn/no-array-for-each\n Object.entries(wallets).forEach(addWallet.bind(this))\n this.ethWalletsState = newWallets\n this.emitChange()\n }\n\n subscribe(listener: WalletListener) {\n this.listeners = [...this.listeners, listener]\n return () => {\n this.listeners = this.listeners.filter(existingListener => existingListener !== listener)\n }\n }\n\n toggleEnabledWallet(rdns: string, enabled: boolean) {\n if (rdns && this.ethWalletsState[rdns]) {\n this.ethWalletsState[rdns].enabled = enabled\n this.ethWalletsState = { ...this.ethWalletsState }\n this.emitChange()\n }\n }\n\n private emitChange() {\n for (const listener of this.listeners) {\n listener()\n }\n\n this.persistSettings()\n }\n\n private isPersistance(method: () => void) {\n if (this.persistPreferences) {\n method()\n }\n }\n\n private persistSettings() {\n this.isPersistance(() => {\n // convert wallet enabled selections into serializable state\n // eslint-disable-next-line unicorn/no-array-reduce\n const enabledWallets = Object.entries(this.ethWalletsState).reduce((acc, [rdns, { enabled }]) => {\n acc[rdns] = enabled\n return acc\n }, {} as EnabledWalletsSavedState)\n\n localStorage.setItem(this.localStorageKey, JSON.stringify(enabledWallets))\n })\n }\n\n private reviveSettings() {\n this.isPersistance(() => {\n const existingEntries = localStorage.getItem(this.localStorageKey)\n try {\n const entries = existingEntries ? JSON.parse(existingEntries) : {}\n this.enabledWallets = entries\n } catch (e) {\n console.warn(`Error parsing saved enabled wallet entries: ${(e as Error).message}`)\n }\n })\n }\n}\n","import { Typography, useTheme } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport React, { forwardRef } from 'react'\n\nimport { useDetectedWallets } from '../hooks/index.ts'\nimport { ConnectedWalletsTable } from './wallet/index.ts'\n\nexport interface ConnectedAccountsFlexboxProps extends FlexBoxProps {\n ignoreConnectDialog?: boolean\n // A callback that is invoked when the option to ignore the dialog is checked\n onIgnoreConnectDialog?: (checked: boolean) => void\n}\n\nexport const ConnectedAccountsFlexbox = forwardRef<HTMLDivElement, ConnectedAccountsFlexboxProps>(\n ({ ignoreConnectDialog, onIgnoreConnectDialog, ...props }, ref) => {\n const theme = useTheme()\n\n const { totalConnectedAccounts, sortedWallets } = useDetectedWallets()\n\n return (\n <FlexCol alignItems=\"stretch\" justifyContent=\"start\" gap={2} ref={ref} {...props}>\n <FlexCol alignItems=\"start\">\n <Typography variant=\"h2\" sx={{ mb: 0.5 }}>\n Detected Web3 Wallets\n </Typography>\n {totalConnectedAccounts\n ? (\n <Typography variant=\"subtitle1\" color={theme.palette.secondary.main} sx={{ opacity: 0.5 }}>\n Total Connected Accounts:\n {' '}\n {totalConnectedAccounts}\n </Typography>\n )\n : null}\n </FlexCol>\n <ConnectedWalletsTable wallets={sortedWallets} ignoreConnectDialog={ignoreConnectDialog} onIgnoreConnectDialog={onIgnoreConnectDialog} />\n </FlexCol>\n )\n },\n)\n\nConnectedAccountsFlexbox.displayName = 'ConnectedAccountsFlexbox'\n","import { AccountsChangedEventName, DiscoveredWallets, EIP6963Connector, useWalletDiscovery } from '@xylabs/react-crypto'\nimport { useEffect, useMemo, useState } from 'react'\n\nconst sortWallets = (wallets: DiscoveredWallets) =>\n // eslint-disable-next-line unicorn/no-array-reduce\n Object.values(wallets).reduce((acc, wallet) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n wallet.allowedAccounts.length > 0 ? acc.unshift(wallet) : acc.push(wallet)\n return acc\n }, [] as EIP6963Connector[])\n\nexport const useDetectedWallets = () => {\n const wallets = useWalletDiscovery()\n const [refresh, setRefresh] = useState(0)\n const [sortedWallets, setSortedWallets] = useState<EIP6963Connector[]>([])\n\n useEffect(() => {\n setSortedWallets(sortWallets(wallets))\n }, [wallets, refresh])\n\n /**\n * Rely on custom events from the wallet base class to know when accounts are changed.\n * This approach prevents the need to loop through all wallets and set up individual listeners.\n */\n useEffect(() => {\n const listener: (event: CustomEventInit) => void = () => {\n setRefresh(refresh => refresh + 1)\n }\n window.addEventListener(AccountsChangedEventName, listener)\n\n return () => {\n window.removeEventListener(AccountsChangedEventName, listener)\n }\n }, [wallets])\n\n const totalConnectedAccounts = useMemo(\n () => Object.values(sortedWallets).reduce((acc, wallet) => acc + wallet.allowedAccounts.length, 0),\n [sortedWallets],\n )\n\n return { sortedWallets, totalConnectedAccounts }\n}\n","import { useWalletDiscovery } from '@xylabs/react-crypto'\nimport { useMemo, useSyncExternalStore } from 'react'\n\nimport { EnabledEthWalletConnections, EnabledEthWalletsState, EnabledWalletsSavedState } from '../classes/index.ts'\n\nlet enabledEthWallets: EnabledEthWalletConnections | undefined\n\n/**\n * Takes the discovered wallets and tracks their enabled state globally\n */\nexport const useEnabledWalletsInner = (enabledWalletsRdns?: EnabledWalletsSavedState) => {\n const discoveredWallets = useWalletDiscovery()\n\n // when we discover new wallets, build their enabled state\n const wallets = useMemo(() => {\n if (enabledEthWallets === undefined) enabledEthWallets = new EnabledEthWalletConnections()\n enabledEthWallets.resetWallets(discoveredWallets)\n for (const [rdns, enabled] of Object.entries(enabledWalletsRdns ?? {})) enabledEthWallets?.toggleEnabledWallet(rdns, enabled)\n return enabledEthWallets\n }, [discoveredWallets, enabledWalletsRdns])\n\n return useSyncExternalStore(wallets.subscribe.bind(wallets), () => wallets.wallets)\n}\n\n/**\n * Expose an interface for enabling and disabling wallets\n */\nexport const useEnabledWallets = (enabledWalletsRdns?: EnabledWalletsSavedState) => {\n const wallets = useEnabledWalletsInner(enabledWalletsRdns)\n const enabledWallets = useMemo(\n () =>\n // eslint-disable-next-line unicorn/no-array-reduce\n Object.entries(wallets).reduce((acc, [walletName, wallet]) => {\n if (wallet.enabled) acc[walletName] = wallet\n return acc\n }, {} as EnabledEthWalletsState),\n [wallets],\n )\n\n return {\n disableWallet: enabledEthWallets?.disableWallet.bind(enabledEthWallets),\n enableWallet: enabledEthWallets?.enableWallet.bind(enabledEthWallets),\n enabledWallets,\n wallets,\n }\n}\n","import { Checkbox, FormControl, FormControlProps, FormLabel } from '@mui/material'\nimport React from 'react'\n\nexport interface CheckboxFormControlProps extends FormControlProps {\n onCheckChanged?: (checked: boolean) => void\n}\n\nexport const CheckboxFormControl: React.FC<CheckboxFormControlProps> = ({ onCheckChanged, ...props }) => {\n return (\n <FormControl {...props}>\n <FormLabel>\n <Checkbox onChange={(_, checked) => onCheckChanged?.(checked)} />\n Do not show this again.\n </FormLabel>\n </FormControl>\n )\n}\n","import { Button, Dialog, DialogActions, DialogContent, DialogProps, DialogTitle } from '@mui/material'\nimport React from 'react'\n\nimport { ActiveProvider } from '../../lib/index.ts'\nimport { CheckboxFormControl } from './CheckboxFormControl.tsx'\nimport { LinkedProvidersFlexbox } from './LinkedProvidersFlexbox.tsx'\nimport { WalletPermissionsFlexbox } from './Permissions.tsx'\n\nexport interface ConnectWalletDialogProps extends DialogProps {\n activeProvider?: ActiveProvider\n onIgnoreConnectDialog?: (checked: boolean) => void\n}\n\nexport const ConnectWalletDialog: React.FC<ConnectWalletDialogProps> = ({ activeProvider, onIgnoreConnectDialog, ...props }) => {\n const { icon, providerName } = activeProvider ?? {}\n\n const onConnect = async () => {\n try {\n await activeProvider?.connectWallet?.()\n props.onClose?.({}, 'escapeKeyDown')\n } catch (e) {\n console.warn(`Error connecting to wallet: ${(e as Error).message}`)\n }\n }\n\n return (\n <Dialog PaperProps={{ sx: { display: 'flex', gap: 4 } }} {...props}>\n <DialogTitle sx={{ textAlign: 'center' }}>XYO Wants To Access The Blockchain on Your Behalf</DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', gap: 4 }}>\n <LinkedProvidersFlexbox icon={icon} providerName={providerName} />\n <WalletPermissionsFlexbox />\n <CheckboxFormControl onCheckChanged={onIgnoreConnectDialog} />\n </DialogContent>\n <DialogActions>\n <Button variant=\"outlined\" onClick={() => props.onClose?.({}, 'escapeKeyDown')}>\n Close\n </Button>\n <Button variant=\"contained\" onClick={onConnect}>\n Connect\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n","import { SyncAlt } from '@mui/icons-material'\nimport { Typography } from '@mui/material'\nimport { ConstrainedImage } from '@xylabs/react-crypto'\nimport { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { xyoColorLogo } from '../../../../img/index.ts'\n\nexport interface LinkedProvidersFlexboxProps extends FlexBoxProps {\n icon?: string\n providerName?: string\n}\n\nexport const LinkedProvidersFlexbox: React.FC<LinkedProvidersFlexboxProps> = ({ icon, providerName, ...props }) => {\n return (\n <FlexRow gap={4} justifyContent=\"space-evenly\" {...props}>\n <FlexCol gap={0.5}>\n <img alt=\"XYO Logo\" src={xyoColorLogo} style={{ height: '48px' }} />\n <Typography variant=\"subtitle1\">XYO App</Typography>\n </FlexCol>\n <SyncAlt fontSize=\"large\" />\n <FlexCol gap={0.5}>\n <ConstrainedImage constrainedValue=\"48px\" src={icon} alt={providerName} style={{ height: '48px', maxWidth: '48px' }} />\n <Typography variant=\"subtitle1\">{providerName}</Typography>\n </FlexCol>\n </FlexRow>\n )\n}\n","export { default as xyoColorLogo } from './xyo-color-logo.svg'\nexport { default as xyoColorLogoText } from './xyo-color-logo-text-only.svg'\n","import { Link, Typography } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nexport interface WalletPermissionsFlexBoxProps extends FlexBoxProps {}\n\nexport const WalletPermissionsFlexbox: React.FC<WalletPermissionsFlexBoxProps> = (props) => {\n return (\n <FlexCol gap={4} {...props}>\n <Typography fontWeight=\"bold\" sx={{ textAlign: 'center' }}>\n This will allow XYO to:\n </Typography>\n <ul>\n <li>View your wallet account(s) and address(es)</li>\n <li>Read-only access to browse the public blockchain(s) you select</li>\n </ul>\n <Typography variant=\"subtitle1\" sx={{ textAlign: 'center' }}>\n You control what accounts to share and what blockchains to view. You can see or revoke access via your wallet's settings at anytime. View\n more on XYO's sovereign data philosophy\n {' '}\n <Link\n href=\"https://cointelegraph.com/innovation-circle/decentralization-and-sovereignty-debunking-our-approach-to-digital-sovereignty\"\n sx={{ fontWeight: 'bold' }}\n target=\"_blank\"\n >\n here\n </Link>\n .\n </Typography>\n </FlexCol>\n )\n}\n","import { Button, Dialog, DialogActions, DialogContent, DialogProps, DialogTitle, Typography } from '@mui/material'\nimport { ConstrainedImage } from '@xylabs/react-crypto'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { ActiveProvider } from '../../lib/index.ts'\n\nexport interface RevokeWalletConnectionDialogProps extends DialogProps {\n activeProvider?: ActiveProvider\n}\n\nexport const RevokeWalletConnectionDialog: React.FC<RevokeWalletConnectionDialogProps> = ({ activeProvider, ...props }) => {\n return (\n <Dialog {...props}>\n <FlexRow gap={2} justifyContent=\"start\" pl={2}>\n <ConstrainedImage src={activeProvider?.icon} constrainedValue=\"24px\" />\n <DialogTitle sx={{ pl: 0 }}>\n Revoke\n {activeProvider?.providerName}\n {' '}\n Access\n </DialogTitle>\n </FlexRow>\n <DialogContent>\n <Typography>\n Revoking access to your wallet must be done from the wallet's browser extension. Wallets grant access to specific domains please\n consult\n {' '}\n {activeProvider?.providerName}\n 's documentation on how to revoke access to this website:\n </Typography>\n <Typography>{window.location.origin}</Typography>\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => props.onClose?.({}, 'escapeKeyDown')}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n","import { TableCell, Tooltip, Typography } from '@mui/material'\nimport React from 'react'\n\nimport { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsAccountsTableCell: React.FC<ConnectedWalletTableCellProps> = ({\n additionalAccounts,\n currentAccount,\n totalAccounts,\n tableCellProps,\n}) => {\n return (\n <TableCell {...tableCellProps}>\n <Tooltip\n sx={{ cursor: totalAccounts > 0 ? 'pointer' : 'auto' }}\n title={[...(currentAccount ?? []), ...(additionalAccounts ?? [])].map((address, index) => (\n <p key={index}>{address}</p>\n ))}\n >\n <Typography>{totalAccounts}</Typography>\n </Tooltip>\n </TableCell>\n )\n}\n","import { Check, InfoOutlined } from '@mui/icons-material'\nimport { Button, IconButton, TableCell, Typography } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsActionsTableCell: React.FC<ConnectedWalletTableCellProps> = ({ connected, onConnect, onRevoke, tableCellProps }) => {\n return (\n <TableCell {...tableCellProps}>\n <FlexRow gap={2} justifyContent=\"start\">\n {connected\n ? (\n <Typography sx={{ display: 'inline-flex', gap: 0.5 }}>\n <Check />\n Connected\n </Typography>\n )\n : (\n <Button variant=\"contained\" onClick={onConnect}>\n Connect\n </Button>\n )}\n {connected\n ? (\n <IconButton onClick={onRevoke}>\n <InfoOutlined />\n </IconButton>\n )\n : null}\n </FlexRow>\n </TableCell>\n )\n}\n","import { TableCell } from '@mui/material'\nimport React from 'react'\n\nimport { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsChainNameTableCell: React.FC<ConnectedWalletTableCellProps> = ({ chainName, tableCellProps }) => {\n return <TableCell {...tableCellProps}>{chainName}</TableCell>\n}\n","import { Switch, TableCell } from '@mui/material'\nimport React, { ChangeEvent, useMemo } from 'react'\n\nimport { useEnabledWallets } from '../../../../hooks/index.ts'\nimport { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({ connected, walletRdns, tableCellProps }) => {\n const { disableWallet, enableWallet, wallets } = useEnabledWallets()\n\n const enabled = useMemo(() => (walletRdns ? wallets[walletRdns].enabled : false), [wallets, walletRdns])\n\n const handleClick = (event: ChangeEvent<HTMLInputElement>) => {\n const checked = event.target?.checked\n if (walletRdns) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n checked ? enableWallet?.(walletRdns) : disableWallet?.(walletRdns)\n }\n }\n return (\n <TableCell {...tableCellProps}>\n <Switch disabled={!connected} checked={connected && enabled} onChange={handleClick} />\n </TableCell>\n )\n}\n","import { TableCell, useTheme } from '@mui/material'\nimport { ConstrainedImage } from '@xylabs/react-crypto'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsWalletTableCell: React.FC<ConnectedWalletTableCellProps> = ({ icon, walletName, tableCellProps }) => {\n const theme = useTheme()\n\n return (\n <TableCell {...tableCellProps}>\n <FlexRow gap={2} justifyContent=\"start\">\n <ConstrainedImage constrainedValue={theme.spacing(4)} src={icon} />\n {walletName}\n </FlexRow>\n </TableCell>\n )\n}\n","import { ComponentType } from 'react'\n\nimport { ConnectedWalletsAccountsTableCell } from './Accounts.tsx'\nimport { ConnectedWalletsActionsTableCell } from './Actions.tsx'\nimport { ConnectedWalletsChainNameTableCell } from './ChainName.tsx'\nimport { ConnectedWalletTableCellProps } from './lib/index.ts'\nimport { ConnectedWalletState } from './State.tsx'\nimport { ConnectedWalletsWalletTableCell } from './Wallet.tsx'\n\nexport const ConnectedWalletTableCells: ComponentType<ConnectedWalletTableCellProps>[] = [\n ConnectedWalletsWalletTableCell,\n ConnectedWalletsChainNameTableCell,\n ConnectedWalletsAccountsTableCell,\n ConnectedWalletsActionsTableCell,\n ConnectedWalletState,\n]\n","import { Table, TableBody, TableCell, TableHead, TableProps, TableRow } from '@mui/material'\nimport { EIP6963Connector } from '@xylabs/react-crypto'\nimport React, { useState } from 'react'\n\nimport { ConnectWalletDialog, RevokeWalletConnectionDialog } from '../dialogs/index.ts'\nimport { ActiveProvider, WalletsTableHeadCells } from '../lib/index.ts'\nimport { WalletConnectionsTableRow } from './ConnectedWalletsTableRow.tsx'\nimport { useActiveProviderDialogState } from './hooks/index.ts'\n\nexport interface ConnectedWalletsTableProps extends TableProps {\n ignoreConnectDialog?: boolean\n onIgnoreConnectDialog?: (checked: boolean) => void\n wallets?: EIP6963Connector[]\n}\n\nexport const ConnectedWalletsTable: React.FC<ConnectedWalletsTableProps> = ({ ignoreConnectDialog, onIgnoreConnectDialog, wallets, ...props }) => {\n const [activeProvider, setActiveProvider] = useState<ActiveProvider>()\n const [showConnect, onSetActiveProviderConnect, onConnectClose] = useActiveProviderDialogState(setActiveProvider)\n const [showRevoke, onSetActiveProviderRevoke, onRevokeClose] = useActiveProviderDialogState(setActiveProvider)\n\n return (\n <>\n <Table {...props}>\n <TableHead>\n <TableRow>\n {WalletsTableHeadCells.map(({ disablePadding, id, label, align, width }) => (\n <TableCell align={align} key={id} padding={disablePadding ? 'none' : 'normal'} width={width ?? 'auto'}>\n {label}\n </TableCell>\n ))}\n </TableRow>\n </TableHead>\n <TableBody>\n {(wallets ?? []).map(wallet => (\n <WalletConnectionsTableRow\n ignoreConnectDialog={ignoreConnectDialog}\n key={wallet.providerInfo?.rdns}\n onConnectClick={onSetActiveProviderConnect}\n onRevoke={onSetActiveProviderRevoke}\n wallet={wallet}\n />\n ))}\n </TableBody>\n </Table>\n <RevokeWalletConnectionDialog open={showRevoke} onClose={onRevokeClose} activeProvider={activeProvider} />\n <ConnectWalletDialog\n activeProvider={activeProvider}\n onClose={onConnectClose}\n open={showConnect}\n onIgnoreConnectDialog={onIgnoreConnectDialog}\n />\n </>\n )\n}\n","import { TableHeadCell } from '@xyo-network/react-table'\n\nexport const WalletsTableHeadCells: TableHeadCell[] = [\n {\n disablePadding: false,\n id: 'wallet',\n label: 'Wallet',\n numeric: false,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'chain',\n label: 'Chain',\n numeric: false,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'accounts',\n label: 'Accounts',\n numeric: true,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'actions',\n label: 'Actions',\n numeric: false,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'enabled',\n label: 'Enabled',\n numeric: false,\n showOnMobile: true,\n },\n]\n","import { TableRow, TableRowProps } from '@mui/material'\nimport { EthWalletConnectorBase, useEthWallet } from '@xylabs/react-crypto'\nimport React, { useCallback, useMemo } from 'react'\n\nimport { ActiveProvider } from '../lib/index.ts'\nimport { ConnectedWalletTableCells } from './cells/index.ts'\n\nexport interface WalletConnectionsTableRowProps extends TableRowProps {\n ignoreConnectDialog?: boolean\n onConnectClick?: (activeProvider: ActiveProvider) => void\n onRevoke?: (activeProvider: ActiveProvider) => void\n wallet: EthWalletConnectorBase\n}\n\nexport const WalletConnectionsTableRow: React.FC<WalletConnectionsTableRowProps> = ({\n ignoreConnectDialog,\n onConnectClick,\n onRevoke,\n wallet,\n ...props\n}) => {\n const { currentAccount: currentAccountFromWallet, additionalAccounts, chainName, connectWallet, providerInfo } = useEthWallet(wallet)\n\n const currentAccount = currentAccountFromWallet?.toString() ? [currentAccountFromWallet.toString()] : []\n const totalAccounts = (additionalAccounts?.length ?? 0) + (currentAccount?.length ?? 0)\n const connected = !!(currentAccount?.length ?? 0 > 0)\n const { icon, name, rdns } = useMemo(() => providerInfo ?? { icon: undefined, name: undefined, rdns: undefined }, [providerInfo])\n\n const activeProvider = useMemo<ActiveProvider>(\n () => ({\n connectWallet,\n icon,\n providerName: name,\n }),\n [connectWallet, icon, name],\n )\n\n const onRevokeLocal = useCallback(() => {\n onRevoke?.(activeProvider)\n }, [activeProvider, onRevoke])\n\n const onConnectLocal = useCallback(async () => {\n if (ignoreConnectDialog) {\n await connectWallet?.()\n } else {\n onConnectClick?.(activeProvider)\n }\n }, [activeProvider, connectWallet, ignoreConnectDialog, onConnectClick])\n\n return (\n <TableRow {...props}>\n {Object.values(ConnectedWalletTableCells).map((Cell, index) => (\n <Cell\n key={index}\n additionalAccounts={additionalAccounts}\n chainName={chainName}\n connected={connected}\n currentAccount={currentAccount}\n icon={icon}\n onConnect={onConnectLocal}\n onRevoke={onRevokeLocal}\n totalAccounts={totalAccounts}\n walletName={name}\n walletRdns={rdns}\n />\n ))}\n </TableRow>\n )\n}\n","import { Dispatch, SetStateAction, useState } from 'react'\n\nimport { ActiveProvider } from '../../lib/index.ts'\n\nexport const useActiveProviderDialogState = (\n setActiveProvider: Dispatch<SetStateAction<ActiveProvider | undefined>>,\n): [boolean, (activeProvider: ActiveProvider) => void, () => void] => {\n const [show, setShow] = useState(false)\n const onSetActiveProvider = (activeProvider: ActiveProvider) => {\n setShow(true)\n setActiveProvider(activeProvider)\n }\n\n const onClose = () => {\n setShow(false)\n setActiveProvider({})\n }\n\n return [show, onSetActiveProvider, onClose]\n}\n"],"mappings":";;;;AAEA,IAAMA,4BAA4B;AAqB3B,IAAMC,8BAAN,MAAMA;EArBb,OAqBaA;;;;EAEXC,qBAAqB;;EAGbC,iBAA2C,CAAC;;EAG5CC,kBAA0C,CAAC;;EAG3CC,YAA8B,CAAA;;EAG9BC,kBAAkBN;EAE1BO,YAAYD,kBAAkBN,2BAA2B;AACvD,SAAKM,kBAAkBA;AACvB,SAAKE,eAAc;EACrB;EAEA,IAAIC,UAAU;AACZ,WAAO,KAAKL;EACd;EAEAM,cAAcC,MAAc;AAC1B,SAAKC,oBA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,GAEN,gBAAAG,QAAA,cAACc,uBAAAA;IAAsBC,SAASjB;IAAeP;IAA0CC;;AAG/F,CAAA;AAGFH,yBAAyB2B,cAAc;","names":["DEFAULT_LOCAL_STORAGE_KEY","EnabledEthWalletConnections","persistPreferences","enabledWallets","ethWalletsState","listeners","localStorageKey","constructor","reviveSettings","wallets","disableWallet","rdns","toggleEnabledWallet","enableWallet","resetWallets","newWallets","addWallet","walletName","wallet","enabled","Object","entries","forEach","bind","emitChange","subscribe","listener","filter","existingListener","persistSettings","isPersistance","method","reduce","acc","localStorage","setItem","JSON","stringify","existingEntries","getItem","parse","e","console","warn","message","Typography","useTheme","FlexCol","React","forwardRef","AccountsChangedEventName","useWalletDiscovery","useEffect","useMemo","useState","sortWallets","wallets","Object","values","reduce","acc","wallet","allowedAccounts","length","unshift","push","useDetectedWallets","useWalletDiscovery","refresh","setRefresh","useState","sortedWallets","setSortedWallets","useEffect","listener","window","addEventListener","AccountsChangedEventName","removeEventListener","totalConnectedAccounts","useMemo","useWalletDiscovery","useMemo","useSyncExternalStore","enabledEthWallets","useEnabledWalletsInner","enabledWalletsRdns","discoveredWallets","useWalletDiscovery","wallets","useMemo","undefined","EnabledEthWalletConnections","resetWallets","rdns","enabled","Object","entries","toggleEnabledWallet","useSyncExternalStore","subscribe","bind","useEnabledWallets","enabledWallets","reduce","acc","walletName","wallet","disableWallet","enableWallet","Checkbox","FormControl","FormLabel","React","CheckboxFormControl","onCheckChanged","props","FormControl","FormLabel","Checkbox","onChange","_","checked","Button","Dialog","DialogActions","DialogContent","DialogTitle","React","SyncAlt","Typography","ConstrainedImage","FlexCol","FlexRow","React","xyoColorLogo","default","xyoColorLogoText","LinkedProvidersFlexbox","icon","providerName","props","React","FlexRow","gap","justifyContent","FlexCol","img","alt","src","xyoColorLogo","style","height","Typography","variant","SyncAlt","fontSize","ConstrainedImage","constrainedValue","maxWidth","Link","Typography","FlexCol","React","WalletPermissionsFlexbox","props","React","FlexCol","gap","Typography","fontWeight","sx","textAlign","ul","li","variant","Link","href","target","ConnectWalletDialog","activeProvider","onIgnoreConnectDialog","props","icon","providerName","onConnect","connectWallet","onClose","e","console","warn","message","React","Dialog","PaperProps","sx","display","gap","DialogTitle","textAlign","DialogContent","flexDirection","LinkedProvidersFlexbox","WalletPermissionsFlexbox","CheckboxFormControl","onCheckChanged","DialogActions","Button","variant","onClick","Button","Dialog","DialogActions","DialogContent","DialogTitle","Typography","ConstrainedImage","FlexRow","React","RevokeWalletConnectionDialog","activeProvider","props","React","Dialog","FlexRow","gap","justifyContent","pl","ConstrainedImage","src","icon","constrainedValue","DialogTitle","sx","providerName","DialogContent","Typography","window","location","origin","DialogActions","Button","variant","onClick","onClose","TableCell","Tooltip","Typography","React","ConnectedWalletsAccountsTableCell","additionalAccounts","currentAccount","totalAccounts","tableCellProps","React","TableCell","Tooltip","sx","cursor","title","map","address","index","p","key","Typography","Check","InfoOutlined","Button","IconButton","TableCell","Typography","FlexRow","React","ConnectedWalletsActionsTableCell","connected","onConnect","onRevoke","tableCellProps","React","TableCell","FlexRow","gap","justifyContent","Typography","sx","display","Check","Button","variant","onClick","IconButton","InfoOutlined","TableCell","React","ConnectedWalletsChainNameTableCell","chainName","tableCellProps","React","TableCell","Switch","TableCell","React","useMemo","ConnectedWalletState","connected","walletRdns","tableCellProps","disableWallet","enableWallet","wallets","useEnabledWallets","enabled","useMemo","handleClick","event","checked","target","React","TableCell","Switch","disabled","onChange","TableCell","useTheme","ConstrainedImage","FlexRow","React","ConnectedWalletsWalletTableCell","icon","walletName","tableCellProps","theme","useTheme","React","TableCell","FlexRow","gap","justifyContent","ConstrainedImage","constrainedValue","spacing","src","ConnectedWalletTableCells","ConnectedWalletsWalletTableCell","ConnectedWalletsChainNameTableCell","ConnectedWalletsAccountsTableCell","ConnectedWalletsActionsTableCell","ConnectedWalletState","Table","TableBody","TableCell","TableHead","TableRow","React","useState","WalletsTableHeadCells","disablePadding","id","label","numeric","showOnMobile","TableRow","useEthWallet","React","useCallback","useMemo","WalletConnectionsTableRow","ignoreConnectDialog","onConnectClick","onRevoke","wallet","props","currentAccount","currentAccountFromWallet","additionalAccounts","chainName","connectWallet","providerInfo","useEthWallet","toString","totalAccounts","length","connected","icon","name","rdns","useMemo","undefined","activeProvider","providerName","onRevokeLocal","useCallback","onConnectLocal","React","TableRow","Object","values","ConnectedWalletTableCells","map","Cell","index","key","onConnect","walletName","walletRdns","useState","useActiveProviderDialogState","setActiveProvider","show","setShow","useState","onSetActiveProvider","activeProvider","onClose","ConnectedWalletsTable","ignoreConnectDialog","onIgnoreConnectDialog","wallets","props","activeProvider","setActiveProvider","useState","showConnect","onSetActiveProviderConnect","onConnectClose","useActiveProviderDialogState","showRevoke","onSetActiveProviderRevoke","onRevokeClose","React","Table","TableHead","TableRow","WalletsTableHeadCells","map","disablePadding","id","label","align","width","TableCell","key","padding","TableBody","wallet","WalletConnectionsTableRow","providerInfo","rdns","onConnectClick","onRevoke","RevokeWalletConnectionDialog","open","onClose","ConnectWalletDialog","ConnectedAccountsFlexbox","forwardRef","ignoreConnectDialog","onIgnoreConnectDialog","props","ref","theme","useTheme","totalConnectedAccounts","sortedWallets","useDetectedWallets","React","FlexCol","alignItems","justifyContent","gap","Typography","variant","sx","mb","color","palette","secondary","main","opacity","ConnectedWalletsTable","wallets","displayName"]}
|
1
|
+
{"version":3,"sources":["../../src/classes/EnabledWallets.ts","../../src/components/ConnectedAccountsFlexbox.tsx","../../src/hooks/useDetectWallets.tsx","../../src/hooks/useEnabledWallets.tsx","../../src/components/wallet/dialogs/connect/CheckboxFormControl.tsx","../../src/components/wallet/dialogs/connect/Dialog.tsx","../../src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx","../../src/img/index.ts","../../src/components/wallet/dialogs/connect/Permissions.tsx","../../src/components/wallet/dialogs/revoke/Dialog.tsx","../../src/components/wallet/table/cells/Accounts.tsx","../../src/components/wallet/table/cells/Actions.tsx","../../src/components/wallet/table/cells/ChainName.tsx","../../src/components/wallet/table/cells/State.tsx","../../src/components/wallet/table/cells/Wallet.tsx","../../src/components/wallet/table/cells/Cells.tsx","../../src/components/wallet/table/ConnectedWalletsTable.tsx","../../src/components/wallet/lib/TableHeadData.ts","../../src/components/wallet/table/ConnectedWalletsTableRow.tsx","../../src/components/wallet/table/hooks/useActiveProviderDialogState.tsx"],"sourcesContent":["import type { DiscoveredWallets, EIP6963Connector } from '@xylabs/react-crypto'\n\nconst DEFAULT_LOCAL_STORAGE_KEY = 'XYO|EnabledWallets'\n\n/**\n * State for storing wallets and their enabled/disabled status by name\n */\nexport interface EnabledEthWalletsState {\n [rdns: string]: {\n enabled: boolean\n wallet: EIP6963Connector\n }\n}\n\n/**\n * State for storing only enabled/disabled status of a wallet by name\n */\nexport interface EnabledWalletsSavedState {\n [rdns: string]: boolean\n}\n\nexport type WalletListener = () => void\n\nexport class EnabledEthWalletConnections {\n // control whether or not enabled/disabled preferences are persisted (i.e. in localStorage)\n persistPreferences = true\n\n // Map of wallet names and their enabled/disabled state\n private enabledWallets: EnabledWalletsSavedState = {}\n\n // Map of wallet names, their enabled/disabled state, and their wallet class\n private ethWalletsState: EnabledEthWalletsState = {}\n\n // list of listeners that want to be notified on wallet changes\n private listeners: WalletListener[] = []\n\n // key to use in localStorage when persisting preferences\n private localStorageKey = DEFAULT_LOCAL_STORAGE_KEY\n\n constructor(localStorageKey = DEFAULT_LOCAL_STORAGE_KEY) {\n this.localStorageKey = localStorageKey\n this.reviveSettings()\n }\n\n get wallets() {\n return this.ethWalletsState\n }\n\n disableWallet(rdns: string) {\n this.toggleEnabledWallet(rdns, false)\n }\n\n enableWallet(rdns: string) {\n this.toggleEnabledWallet(rdns, true)\n }\n\n /**\n * Given a new set of wallets, set their enabled state based off previous preferences\n */\n resetWallets(wallets: DiscoveredWallets) {\n const newWallets: EnabledEthWalletsState = {}\n\n const addWallet = ([walletName, wallet]: [string, EIP6963Connector]) => {\n newWallets[walletName] = {\n // preserve the existing enabled state\n enabled: walletName in this.enabledWallets ? this.enabledWallets[walletName] : true,\n wallet,\n }\n }\n\n // eslint-disable-next-line unicorn/no-array-for-each\n Object.entries(wallets).forEach(addWallet.bind(this))\n this.ethWalletsState = newWallets\n this.emitChange()\n }\n\n subscribe(listener: WalletListener) {\n this.listeners = [...this.listeners, listener]\n return () => {\n this.listeners = this.listeners.filter(existingListener => existingListener !== listener)\n }\n }\n\n toggleEnabledWallet(rdns: string, enabled: boolean) {\n if (rdns && this.ethWalletsState[rdns]) {\n this.ethWalletsState[rdns].enabled = enabled\n this.ethWalletsState = { ...this.ethWalletsState }\n this.emitChange()\n }\n }\n\n private emitChange() {\n for (const listener of this.listeners) {\n listener()\n }\n\n this.persistSettings()\n }\n\n private isPersistance(method: () => void) {\n if (this.persistPreferences) {\n method()\n }\n }\n\n private persistSettings() {\n this.isPersistance(() => {\n // convert wallet enabled selections into serializable state\n // eslint-disable-next-line unicorn/no-array-reduce\n const enabledWallets = Object.entries(this.ethWalletsState).reduce((acc, [rdns, { enabled }]) => {\n acc[rdns] = enabled\n return acc\n }, {} as EnabledWalletsSavedState)\n\n localStorage.setItem(this.localStorageKey, JSON.stringify(enabledWallets))\n })\n }\n\n private reviveSettings() {\n this.isPersistance(() => {\n const existingEntries = localStorage.getItem(this.localStorageKey)\n try {\n const entries = existingEntries ? JSON.parse(existingEntries) : {}\n this.enabledWallets = entries\n } catch (e) {\n console.warn(`Error parsing saved enabled wallet entries: ${(e as Error).message}`)\n }\n })\n }\n}\n","import { Typography, useTheme } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React, { forwardRef } from 'react'\n\nimport { useDetectedWallets } from '../hooks/index.ts'\nimport { ConnectedWalletsTable } from './wallet/index.ts'\n\nexport interface ConnectedAccountsFlexboxProps extends FlexBoxProps {\n ignoreConnectDialog?: boolean\n // A callback that is invoked when the option to ignore the dialog is checked\n onIgnoreConnectDialog?: (checked: boolean) => void\n}\n\nexport const ConnectedAccountsFlexbox = forwardRef<HTMLDivElement, ConnectedAccountsFlexboxProps>(\n ({\n ignoreConnectDialog, onIgnoreConnectDialog, ...props\n }, ref) => {\n const theme = useTheme()\n\n const { totalConnectedAccounts, sortedWallets } = useDetectedWallets()\n\n return (\n <FlexCol alignItems=\"stretch\" justifyContent=\"start\" gap={2} ref={ref} {...props}>\n <FlexCol alignItems=\"start\">\n <Typography variant=\"h2\" sx={{ mb: 0.5 }}>\n Detected Web3 Wallets\n </Typography>\n {totalConnectedAccounts\n ? (\n <Typography variant=\"subtitle1\" color={theme.palette.secondary.main} sx={{ opacity: 0.5 }}>\n Total Connected Accounts:\n {' '}\n {totalConnectedAccounts}\n </Typography>\n )\n : null}\n </FlexCol>\n <ConnectedWalletsTable wallets={sortedWallets} ignoreConnectDialog={ignoreConnectDialog} onIgnoreConnectDialog={onIgnoreConnectDialog} />\n </FlexCol>\n )\n },\n)\n\nConnectedAccountsFlexbox.displayName = 'ConnectedAccountsFlexbox'\n","import type { DiscoveredWallets, EIP6963Connector } from '@xylabs/react-crypto'\nimport { AccountsChangedEventName, useWalletDiscovery } from '@xylabs/react-crypto'\nimport {\n useEffect, useMemo, useState,\n} from 'react'\n\nconst sortWallets = (wallets: DiscoveredWallets) =>\n // eslint-disable-next-line unicorn/no-array-reduce\n Object.values(wallets).reduce((acc, wallet) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n wallet.allowedAccounts.length > 0 ? acc.unshift(wallet) : acc.push(wallet)\n return acc\n }, [] as EIP6963Connector[])\n\nexport const useDetectedWallets = () => {\n const wallets = useWalletDiscovery()\n const [refresh, setRefresh] = useState(0)\n const [sortedWallets, setSortedWallets] = useState<EIP6963Connector[]>([])\n\n useEffect(() => {\n setSortedWallets(sortWallets(wallets))\n }, [wallets, refresh])\n\n /**\n * Rely on custom events from the wallet base class to know when accounts are changed.\n * This approach prevents the need to loop through all wallets and set up individual listeners.\n */\n useEffect(() => {\n const listener: (event: CustomEventInit) => void = () => {\n setRefresh(refresh => refresh + 1)\n }\n // eslint-disable-next-line @eslint-react/web-api/no-leaked-event-listener\n window.addEventListener(AccountsChangedEventName, listener)\n\n return () => {\n window.removeEventListener(AccountsChangedEventName, listener)\n }\n }, [wallets])\n\n const totalConnectedAccounts = useMemo(\n () => Object.values(sortedWallets).reduce((acc, wallet) => acc + wallet.allowedAccounts.length, 0),\n [sortedWallets],\n )\n\n return { sortedWallets, totalConnectedAccounts }\n}\n","import { useWalletDiscovery } from '@xylabs/react-crypto'\nimport { useMemo, useSyncExternalStore } from 'react'\n\nimport type { EnabledEthWalletsState, EnabledWalletsSavedState } from '../classes/index.ts'\nimport { EnabledEthWalletConnections } from '../classes/index.ts'\n\nlet enabledEthWallets: EnabledEthWalletConnections | undefined\n\n/**\n * Takes the discovered wallets and tracks their enabled state globally\n */\nexport const useEnabledWalletsInner = (enabledWalletsRdns?: EnabledWalletsSavedState) => {\n const discoveredWallets = useWalletDiscovery()\n\n // when we discover new wallets, build their enabled state\n const wallets = useMemo(() => {\n if (enabledEthWallets === undefined) enabledEthWallets = new EnabledEthWalletConnections()\n enabledEthWallets.resetWallets(discoveredWallets)\n for (const [rdns, enabled] of Object.entries(enabledWalletsRdns ?? {})) enabledEthWallets?.toggleEnabledWallet(rdns, enabled)\n return enabledEthWallets\n }, [discoveredWallets, enabledWalletsRdns])\n\n return useSyncExternalStore(wallets.subscribe.bind(wallets), () => wallets.wallets)\n}\n\n/**\n * Expose an interface for enabling and disabling wallets\n */\nexport const useEnabledWallets = (enabledWalletsRdns?: EnabledWalletsSavedState) => {\n const wallets = useEnabledWalletsInner(enabledWalletsRdns)\n const enabledWallets = useMemo(\n () =>\n // eslint-disable-next-line unicorn/no-array-reduce\n Object.entries(wallets).reduce((acc, [walletName, wallet]) => {\n if (wallet.enabled) acc[walletName] = wallet\n return acc\n }, {} as EnabledEthWalletsState),\n [wallets],\n )\n\n return {\n disableWallet: enabledEthWallets?.disableWallet.bind(enabledEthWallets),\n enableWallet: enabledEthWallets?.enableWallet.bind(enabledEthWallets),\n enabledWallets,\n wallets,\n }\n}\n","import type { FormControlProps } from '@mui/material'\nimport {\n Checkbox, FormControl, FormLabel,\n} from '@mui/material'\nimport React from 'react'\n\nexport interface CheckboxFormControlProps extends FormControlProps {\n onCheckChanged?: (checked: boolean) => void\n}\n\nexport const CheckboxFormControl: React.FC<CheckboxFormControlProps> = ({ onCheckChanged, ...props }) => {\n return (\n <FormControl {...props}>\n <FormLabel>\n <Checkbox onChange={(_, checked) => onCheckChanged?.(checked)} />\n Do not show this again.\n </FormLabel>\n </FormControl>\n )\n}\n","import type { DialogProps } from '@mui/material'\nimport {\n Button, Dialog, DialogActions, DialogContent, DialogTitle,\n} from '@mui/material'\nimport React from 'react'\n\nimport type { ActiveProvider } from '../../lib/index.ts'\nimport { CheckboxFormControl } from './CheckboxFormControl.tsx'\nimport { LinkedProvidersFlexbox } from './LinkedProvidersFlexbox.tsx'\nimport { WalletPermissionsFlexbox } from './Permissions.tsx'\n\nexport interface ConnectWalletDialogProps extends DialogProps {\n activeProvider?: ActiveProvider\n onIgnoreConnectDialog?: (checked: boolean) => void\n}\n\nexport const ConnectWalletDialog: React.FC<ConnectWalletDialogProps> = ({\n activeProvider, onIgnoreConnectDialog, ...props\n}) => {\n const { icon, providerName } = activeProvider ?? {}\n\n const onConnect = async () => {\n try {\n await activeProvider?.connectWallet?.()\n props.onClose?.({}, 'escapeKeyDown')\n } catch (e) {\n console.warn(`Error connecting to wallet: ${(e as Error).message}`)\n }\n }\n\n return (\n <Dialog\n PaperProps={{ sx: { display: 'flex', gap: 4 } }}\n {...props}\n >\n <DialogTitle sx={{ textAlign: 'center' }}>XYO Wants To Access The Blockchain on Your Behalf</DialogTitle>\n <DialogContent sx={{\n display: 'flex', flexDirection: 'column', gap: 4,\n }}\n >\n <LinkedProvidersFlexbox icon={icon} providerName={providerName} />\n <WalletPermissionsFlexbox />\n <CheckboxFormControl onCheckChanged={onIgnoreConnectDialog} />\n </DialogContent>\n <DialogActions>\n <Button variant=\"outlined\" onClick={() => props.onClose?.({}, 'escapeKeyDown')}>\n Close\n </Button>\n <Button variant=\"contained\" onClick={onConnect}>\n Connect\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n","import { SyncAlt } from '@mui/icons-material'\nimport { Typography } from '@mui/material'\nimport { ConstrainedImage } from '@xylabs/react-crypto'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { xyoColorLogo } from '../../../../img/index.ts'\n\nexport interface LinkedProvidersFlexboxProps extends FlexBoxProps {\n icon?: string\n providerName?: string\n}\n\nexport const LinkedProvidersFlexbox: React.FC<LinkedProvidersFlexboxProps> = ({\n icon, providerName, ...props\n}) => {\n return (\n <FlexRow gap={4} justifyContent=\"space-evenly\" {...props}>\n <FlexCol gap={0.5}>\n <img alt=\"XYO Logo\" src={xyoColorLogo} style={{ height: '48px' }} />\n <Typography variant=\"subtitle1\">XYO App</Typography>\n </FlexCol>\n <SyncAlt fontSize=\"large\" />\n <FlexCol gap={0.5}>\n <ConstrainedImage\n constrainedValue=\"48px\"\n src={icon}\n alt={providerName}\n style={{ height: '48px', maxWidth: '48px' }}\n />\n <Typography variant=\"subtitle1\">{providerName}</Typography>\n </FlexCol>\n </FlexRow>\n )\n}\n","export { default as xyoColorLogo } from './xyo-color-logo.svg'\nexport { default as xyoColorLogoText } from './xyo-color-logo-text-only.svg'\n","import { Link, Typography } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nexport interface WalletPermissionsFlexBoxProps extends FlexBoxProps {}\n\nexport const WalletPermissionsFlexbox: React.FC<WalletPermissionsFlexBoxProps> = (props) => {\n return (\n <FlexCol gap={4} {...props}>\n <Typography fontWeight=\"bold\" sx={{ textAlign: 'center' }}>\n This will allow XYO to:\n </Typography>\n <ul>\n <li>View your wallet account(s) and address(es)</li>\n <li>Read-only access to browse the public blockchain(s) you select</li>\n </ul>\n <Typography variant=\"subtitle1\" sx={{ textAlign: 'center' }}>\n You control what accounts to share and what blockchains to view. You can see or revoke access via your wallet's settings at anytime. View\n more on XYO's sovereign data philosophy\n {' '}\n <Link\n href=\"https://cointelegraph.com/innovation-circle/decentralization-and-sovereignty-debunking-our-approach-to-digital-sovereignty\"\n sx={{ fontWeight: 'bold' }}\n target=\"_blank\"\n >\n here\n </Link>\n .\n </Typography>\n </FlexCol>\n )\n}\n","import type { DialogProps } from '@mui/material'\nimport {\n Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography,\n} from '@mui/material'\nimport { ConstrainedImage } from '@xylabs/react-crypto'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport type { ActiveProvider } from '../../lib/index.ts'\n\nexport interface RevokeWalletConnectionDialogProps extends DialogProps {\n activeProvider?: ActiveProvider\n}\n\nexport const RevokeWalletConnectionDialog: React.FC<RevokeWalletConnectionDialogProps> = ({ activeProvider, ...props }) => {\n return (\n <Dialog {...props}>\n <FlexRow gap={2} justifyContent=\"start\" pl={2}>\n <ConstrainedImage src={activeProvider?.icon} constrainedValue=\"24px\" />\n <DialogTitle sx={{ pl: 0 }}>\n Revoke\n {activeProvider?.providerName}\n {' '}\n Access\n </DialogTitle>\n </FlexRow>\n <DialogContent>\n <Typography>\n Revoking access to your wallet must be done from the wallet's browser extension. Wallets grant access to specific domains please\n consult\n {' '}\n {activeProvider?.providerName}\n 's documentation on how to revoke access to this website:\n </Typography>\n <Typography>{window.location.origin}</Typography>\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => props.onClose?.({}, 'escapeKeyDown')}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n","import {\n TableCell, Tooltip, Typography,\n} from '@mui/material'\nimport React from 'react'\n\nimport type { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsAccountsTableCell: React.FC<ConnectedWalletTableCellProps> = ({\n additionalAccounts,\n currentAccount,\n totalAccounts,\n tableCellProps,\n}) => {\n return (\n <TableCell {...tableCellProps}>\n <Tooltip\n sx={{ cursor: totalAccounts > 0 ? 'pointer' : 'auto' }}\n title={[...(currentAccount ?? []), ...(additionalAccounts ?? [])].map((address, index) => (\n <p key={index}>{address}</p>\n ))}\n >\n <Typography>{totalAccounts}</Typography>\n </Tooltip>\n </TableCell>\n )\n}\n","import { Check, InfoOutlined } from '@mui/icons-material'\nimport {\n Button, IconButton, TableCell, Typography,\n} from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport type { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsActionsTableCell: React.FC<ConnectedWalletTableCellProps> = ({\n connected, onConnect, onRevoke, tableCellProps,\n}) => {\n return (\n <TableCell {...tableCellProps}>\n <FlexRow gap={2} justifyContent=\"start\">\n {connected\n ? (\n <Typography sx={{ display: 'inline-flex', gap: 0.5 }}>\n <Check />\n Connected\n </Typography>\n )\n : (\n <Button variant=\"contained\" onClick={onConnect}>\n Connect\n </Button>\n )}\n {connected\n ? (\n <IconButton onClick={onRevoke}>\n <InfoOutlined />\n </IconButton>\n )\n : null}\n </FlexRow>\n </TableCell>\n )\n}\n","import { TableCell } from '@mui/material'\nimport React from 'react'\n\nimport type { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsChainNameTableCell: React.FC<ConnectedWalletTableCellProps> = ({ chainName, tableCellProps }) => {\n return <TableCell {...tableCellProps}>{chainName}</TableCell>\n}\n","import { Switch, TableCell } from '@mui/material'\nimport type { ChangeEvent } from 'react'\nimport React, { useMemo } from 'react'\n\nimport { useEnabledWallets } from '../../../../hooks/index.ts'\nimport type { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({\n connected, walletRdns, tableCellProps,\n}) => {\n const {\n disableWallet, enableWallet, wallets,\n } = useEnabledWallets()\n\n const enabled = useMemo(() => (walletRdns ? wallets[walletRdns].enabled : false), [wallets, walletRdns])\n\n const handleClick = (event: ChangeEvent<HTMLInputElement>) => {\n const checked = event.target?.checked\n if (walletRdns) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n checked ? enableWallet?.(walletRdns) : disableWallet?.(walletRdns)\n }\n }\n return (\n <TableCell {...tableCellProps}>\n <Switch disabled={!connected} checked={connected && enabled} onChange={handleClick} />\n </TableCell>\n )\n}\n","import { TableCell, useTheme } from '@mui/material'\nimport { ConstrainedImage } from '@xylabs/react-crypto'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport type { ConnectedWalletTableCellProps } from './lib/index.ts'\n\nexport const ConnectedWalletsWalletTableCell: React.FC<ConnectedWalletTableCellProps> = ({\n icon, walletName, tableCellProps,\n}) => {\n const theme = useTheme()\n\n return (\n <TableCell {...tableCellProps}>\n <FlexRow gap={2} justifyContent=\"start\">\n <ConstrainedImage constrainedValue={theme.spacing(4)} src={icon} />\n {walletName}\n </FlexRow>\n </TableCell>\n )\n}\n","import type { ComponentType } from 'react'\n\nimport { ConnectedWalletsAccountsTableCell } from './Accounts.tsx'\nimport { ConnectedWalletsActionsTableCell } from './Actions.tsx'\nimport { ConnectedWalletsChainNameTableCell } from './ChainName.tsx'\nimport type { ConnectedWalletTableCellProps } from './lib/index.ts'\nimport { ConnectedWalletState } from './State.tsx'\nimport { ConnectedWalletsWalletTableCell } from './Wallet.tsx'\n\nexport const ConnectedWalletTableCells: ComponentType<ConnectedWalletTableCellProps>[] = [\n ConnectedWalletsWalletTableCell,\n ConnectedWalletsChainNameTableCell,\n ConnectedWalletsAccountsTableCell,\n ConnectedWalletsActionsTableCell,\n ConnectedWalletState,\n]\n","import type { TableProps } from '@mui/material'\nimport {\n Table, TableBody, TableCell, TableHead, TableRow,\n} from '@mui/material'\nimport type { EIP6963Connector } from '@xylabs/react-crypto'\nimport React, { useState } from 'react'\n\nimport { ConnectWalletDialog, RevokeWalletConnectionDialog } from '../dialogs/index.ts'\nimport type { ActiveProvider } from '../lib/index.ts'\nimport { WalletsTableHeadCells } from '../lib/index.ts'\nimport { WalletConnectionsTableRow } from './ConnectedWalletsTableRow.tsx'\nimport { useActiveProviderDialogState } from './hooks/index.ts'\n\nexport interface ConnectedWalletsTableProps extends TableProps {\n ignoreConnectDialog?: boolean\n onIgnoreConnectDialog?: (checked: boolean) => void\n wallets?: EIP6963Connector[]\n}\n\nexport const ConnectedWalletsTable: React.FC<ConnectedWalletsTableProps> = ({\n ignoreConnectDialog, onIgnoreConnectDialog, wallets, ...props\n}) => {\n const [activeProvider, setActiveProvider] = useState<ActiveProvider>()\n const [showConnect, onSetActiveProviderConnect, onConnectClose] = useActiveProviderDialogState(setActiveProvider)\n const [showRevoke, onSetActiveProviderRevoke, onRevokeClose] = useActiveProviderDialogState(setActiveProvider)\n\n return (\n <>\n <Table {...props}>\n <TableHead>\n <TableRow>\n {WalletsTableHeadCells.map(({\n disablePadding, id, label, align, width,\n }) => (\n <TableCell align={align} key={id} padding={disablePadding ? 'none' : 'normal'} width={width ?? 'auto'}>\n {label}\n </TableCell>\n ))}\n </TableRow>\n </TableHead>\n <TableBody>\n {(wallets ?? []).map(wallet => (\n <WalletConnectionsTableRow\n ignoreConnectDialog={ignoreConnectDialog}\n key={wallet.providerInfo?.rdns}\n onConnectClick={onSetActiveProviderConnect}\n onRevoke={onSetActiveProviderRevoke}\n wallet={wallet}\n />\n ))}\n </TableBody>\n </Table>\n <RevokeWalletConnectionDialog open={showRevoke} onClose={onRevokeClose} activeProvider={activeProvider} />\n <ConnectWalletDialog\n activeProvider={activeProvider}\n onClose={onConnectClose}\n open={showConnect}\n onIgnoreConnectDialog={onIgnoreConnectDialog}\n />\n </>\n )\n}\n","import type { TableHeadCell } from '@xyo-network/react-table'\n\nexport const WalletsTableHeadCells: TableHeadCell[] = [\n {\n disablePadding: false,\n id: 'wallet',\n label: 'Wallet',\n numeric: false,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'chain',\n label: 'Chain',\n numeric: false,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'accounts',\n label: 'Accounts',\n numeric: true,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'actions',\n label: 'Actions',\n numeric: false,\n showOnMobile: true,\n },\n {\n disablePadding: false,\n id: 'enabled',\n label: 'Enabled',\n numeric: false,\n showOnMobile: true,\n },\n]\n","import type { TableRowProps } from '@mui/material'\nimport { TableRow } from '@mui/material'\nimport type { EthWalletConnectorBase } from '@xylabs/react-crypto'\nimport { useEthWallet } from '@xylabs/react-crypto'\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { ActiveProvider } from '../lib/index.ts'\nimport { ConnectedWalletTableCells } from './cells/index.ts'\n\nexport interface WalletConnectionsTableRowProps extends TableRowProps {\n ignoreConnectDialog?: boolean\n onConnectClick?: (activeProvider: ActiveProvider) => void\n onRevoke?: (activeProvider: ActiveProvider) => void\n wallet: EthWalletConnectorBase\n}\n\nexport const WalletConnectionsTableRow: React.FC<WalletConnectionsTableRowProps> = ({\n ignoreConnectDialog,\n onConnectClick,\n onRevoke,\n wallet,\n ...props\n}) => {\n const {\n currentAccount: currentAccountFromWallet, additionalAccounts, chainName, connectWallet, providerInfo,\n } = useEthWallet(wallet)\n\n const currentAccount = currentAccountFromWallet?.toString() ? [currentAccountFromWallet.toString()] : []\n const totalAccounts = (additionalAccounts?.length ?? 0) + (currentAccount?.length ?? 0)\n const connected = !!(currentAccount?.length ?? 0 > 0)\n const {\n icon, name, rdns,\n } = useMemo(() => providerInfo ?? {\n icon: undefined, name: undefined, rdns: undefined,\n }, [providerInfo])\n\n const activeProvider = useMemo<ActiveProvider>(\n () => ({\n connectWallet,\n icon,\n providerName: name,\n }),\n [connectWallet, icon, name],\n )\n\n const onRevokeLocal = useCallback(() => {\n onRevoke?.(activeProvider)\n }, [activeProvider, onRevoke])\n\n const onConnectLocal = useCallback(async () => {\n if (ignoreConnectDialog) {\n await connectWallet?.()\n } else {\n onConnectClick?.(activeProvider)\n }\n }, [activeProvider, connectWallet, ignoreConnectDialog, onConnectClick])\n\n return (\n <TableRow {...props}>\n {Object.values(ConnectedWalletTableCells).map((Cell, index) => (\n <Cell\n key={index}\n additionalAccounts={additionalAccounts}\n chainName={chainName}\n connected={connected}\n currentAccount={currentAccount}\n icon={icon}\n onConnect={onConnectLocal}\n onRevoke={onRevokeLocal}\n totalAccounts={totalAccounts}\n walletName={name}\n walletRdns={rdns}\n />\n ))}\n </TableRow>\n )\n}\n","import type { Dispatch, SetStateAction } from 'react'\nimport { useState } from 'react'\n\nimport type { ActiveProvider } from '../../lib/index.ts'\n\nexport const useActiveProviderDialogState = (\n setActiveProvider: Dispatch<SetStateAction<ActiveProvider | undefined>>,\n): [boolean, (activeProvider: ActiveProvider) => void, () => void] => {\n const [show, setShow] = useState(false)\n const onSetActiveProvider = (activeProvider: ActiveProvider) => {\n setShow(true)\n setActiveProvider(activeProvider)\n }\n\n const onClose = () => {\n setShow(false)\n setActiveProvider({})\n }\n\n return [show, onSetActiveProvider, onClose]\n}\n"],"mappings":";;;;AAEA,IAAMA,4BAA4B;AAqB3B,IAAMC,8BAAN,MAAMA;EArBb,OAqBaA;;;;EAEXC,qBAAqB;;EAGbC,iBAA2C,CAAC;;EAG5CC,kBAA0C,CAAC;;EAG3CC,YAA8B,CAAA;;EAG9BC,kBAAkBN;EAE1BO,YAAYD,kBAAkBN,2BAA2B;AACvD,SAAKM,kBAAkBA;AACvB,SAAKE,eAAc;EACrB;EAEA,IAAIC,UAAU;AACZ,WAAO,KAAKL;EACd;EAEAM,cAAcC,MAAc;AAC1B,SAAKC,oBAAoBD,MAAM,KAAA;EACjC;EAEAE,aAAaF,MAAc;AACzB,SAAKC,oBAAoBD,MAAM,IAAA;EACjC;;;;EAKAG,aAAaL,SAA4B;AACvC,UAAMM,aAAqC,CAAC;AAE5C,UAAMC,YAAY,wBAAC,CAACC,YAAYC,MAAAA,MAAmC;AACjE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OA,SAAS;KAC5FF,KAAAA,CAAAA,CAAAA,CAAAA,GAKT,gBAAAR,QAAA,cAACc,WAAAA,OACG1B,WAAW,CAAA,GAAIiB,IAAIU,CAAAA,WACnB,gBAAAf,QAAA,cAACgB,2BAAAA;IACC9B;IACA0B,KAAKG,OAAOE,cAAcC;IAC1BC,gBAAgBzB;IAChB0B,UAAUtB;IACViB;SAKR,gBAAAf,QAAA,cAACqB,8BAAAA;IAA6BC,MAAMzB;IAAY0B,SAASxB;IAAeT;MACxE,gBAAAU,QAAA,cAACwB,qBAAAA;IACClC;IACAiC,SAAS5B;IACT2B,MAAM7B;IACNN;;AAIR,GA1C2E;;;AfLpE,IAAMsC,2BAA2BC,2BACtC,CAAC,EACCC,qBAAqBC,uBAAuB,GAAGC,MAAAA,GAC9CC,QAAAA;AACD,QAAMC,QAAQC,UAAAA;AAEd,QAAM,EAAEC,wBAAwBC,cAAa,IAAKC,mBAAAA;AAElD,SACE,gBAAAC,QAAA,cAACC,UAAAA;IAAQC,YAAW;IAAUC,gBAAe;IAAQC,KAAK;IAAGV;IAAW,GAAGD;KACzE,gBAAAO,QAAA,cAACC,UAAAA;IAAQC,YAAW;KAClB,gBAAAF,QAAA,cAACK,aAAAA;IAAWC,SAAQ;IAAKC,IAAI;MAAEC,IAAI;IAAI;KAAG,uBAAA,GAGzCX,yBAEK,gBAAAG,QAAA,cAACK,aAAAA;IAAWC,SAAQ;IAAYG,OAAOd,MAAMe,QAAQC,UAAUC;IAAML,IAAI;MAAEM,SAAS;IAAI;KAAG,6BAExF,KACAhB,sBAAAA,IAGL,IAAA,GAEN,gBAAAG,QAAA,cAACc,uBAAAA;IAAsBC,SAASjB;IAAeP;IAA0CC;;AAG/F,CAAA;AAGFH,yBAAyB2B,cAAc;","names":["DEFAULT_LOCAL_STORAGE_KEY","EnabledEthWalletConnections","persistPreferences","enabledWallets","ethWalletsState","listeners","localStorageKey","constructor","reviveSettings","wallets","disableWallet","rdns","toggleEnabledWallet","enableWallet","resetWallets","newWallets","addWallet","walletName","wallet","enabled","Object","entries","forEach","bind","emitChange","subscribe","listener","filter","existingListener","persistSettings","isPersistance","method","reduce","acc","localStorage","setItem","JSON","stringify","existingEntries","getItem","parse","e","console","warn","message","Typography","useTheme","FlexCol","React","forwardRef","AccountsChangedEventName","useWalletDiscovery","useEffect","useMemo","useState","sortWallets","wallets","Object","values","reduce","acc","wallet","allowedAccounts","length","unshift","push","useDetectedWallets","useWalletDiscovery","refresh","setRefresh","useState","sortedWallets","setSortedWallets","useEffect","listener","window","addEventListener","AccountsChangedEventName","removeEventListener","totalConnectedAccounts","useMemo","useWalletDiscovery","useMemo","useSyncExternalStore","enabledEthWallets","useEnabledWalletsInner","enabledWalletsRdns","discoveredWallets","useWalletDiscovery","wallets","useMemo","undefined","EnabledEthWalletConnections","resetWallets","rdns","enabled","Object","entries","toggleEnabledWallet","useSyncExternalStore","subscribe","bind","useEnabledWallets","enabledWallets","reduce","acc","walletName","wallet","disableWallet","enableWallet","Checkbox","FormControl","FormLabel","React","CheckboxFormControl","onCheckChanged","props","FormControl","FormLabel","Checkbox","onChange","_","checked","Button","Dialog","DialogActions","DialogContent","DialogTitle","React","SyncAlt","Typography","ConstrainedImage","FlexCol","FlexRow","React","xyoColorLogo","default","xyoColorLogoText","LinkedProvidersFlexbox","icon","providerName","props","React","FlexRow","gap","justifyContent","FlexCol","img","alt","src","xyoColorLogo","style","height","Typography","variant","SyncAlt","fontSize","ConstrainedImage","constrainedValue","maxWidth","Link","Typography","FlexCol","React","WalletPermissionsFlexbox","props","React","FlexCol","gap","Typography","fontWeight","sx","textAlign","ul","li","variant","Link","href","target","ConnectWalletDialog","activeProvider","onIgnoreConnectDialog","props","icon","providerName","onConnect","connectWallet","onClose","e","console","warn","message","React","Dialog","PaperProps","sx","display","gap","DialogTitle","textAlign","DialogContent","flexDirection","LinkedProvidersFlexbox","WalletPermissionsFlexbox","CheckboxFormControl","onCheckChanged","DialogActions","Button","variant","onClick","Button","Dialog","DialogActions","DialogContent","DialogTitle","Typography","ConstrainedImage","FlexRow","React","RevokeWalletConnectionDialog","activeProvider","props","React","Dialog","FlexRow","gap","justifyContent","pl","ConstrainedImage","src","icon","constrainedValue","DialogTitle","sx","providerName","DialogContent","Typography","window","location","origin","DialogActions","Button","variant","onClick","onClose","TableCell","Tooltip","Typography","React","ConnectedWalletsAccountsTableCell","additionalAccounts","currentAccount","totalAccounts","tableCellProps","React","TableCell","Tooltip","sx","cursor","title","map","address","index","p","key","Typography","Check","InfoOutlined","Button","IconButton","TableCell","Typography","FlexRow","React","ConnectedWalletsActionsTableCell","connected","onConnect","onRevoke","tableCellProps","React","TableCell","FlexRow","gap","justifyContent","Typography","sx","display","Check","Button","variant","onClick","IconButton","InfoOutlined","TableCell","React","ConnectedWalletsChainNameTableCell","chainName","tableCellProps","React","TableCell","Switch","TableCell","React","useMemo","ConnectedWalletState","connected","walletRdns","tableCellProps","disableWallet","enableWallet","wallets","useEnabledWallets","enabled","useMemo","handleClick","event","checked","target","React","TableCell","Switch","disabled","onChange","TableCell","useTheme","ConstrainedImage","FlexRow","React","ConnectedWalletsWalletTableCell","icon","walletName","tableCellProps","theme","useTheme","React","TableCell","FlexRow","gap","justifyContent","ConstrainedImage","constrainedValue","spacing","src","ConnectedWalletTableCells","ConnectedWalletsWalletTableCell","ConnectedWalletsChainNameTableCell","ConnectedWalletsAccountsTableCell","ConnectedWalletsActionsTableCell","ConnectedWalletState","Table","TableBody","TableCell","TableHead","TableRow","React","useState","WalletsTableHeadCells","disablePadding","id","label","numeric","showOnMobile","TableRow","useEthWallet","React","useCallback","useMemo","WalletConnectionsTableRow","ignoreConnectDialog","onConnectClick","onRevoke","wallet","props","currentAccount","currentAccountFromWallet","additionalAccounts","chainName","connectWallet","providerInfo","useEthWallet","toString","totalAccounts","length","connected","icon","name","rdns","useMemo","undefined","activeProvider","providerName","onRevokeLocal","useCallback","onConnectLocal","React","TableRow","Object","values","ConnectedWalletTableCells","map","Cell","index","key","onConnect","walletName","walletRdns","useState","useActiveProviderDialogState","setActiveProvider","show","setShow","useState","onSetActiveProvider","activeProvider","onClose","ConnectedWalletsTable","ignoreConnectDialog","onIgnoreConnectDialog","wallets","props","activeProvider","setActiveProvider","useState","showConnect","onSetActiveProviderConnect","onConnectClose","useActiveProviderDialogState","showRevoke","onSetActiveProviderRevoke","onRevokeClose","React","Table","TableHead","TableRow","WalletsTableHeadCells","map","disablePadding","id","label","align","width","TableCell","key","padding","TableBody","wallet","WalletConnectionsTableRow","providerInfo","rdns","onConnectClick","onRevoke","RevokeWalletConnectionDialog","open","onClose","ConnectWalletDialog","ConnectedAccountsFlexbox","forwardRef","ignoreConnectDialog","onIgnoreConnectDialog","props","ref","theme","useTheme","totalConnectedAccounts","sortedWallets","useDetectedWallets","React","FlexCol","alignItems","justifyContent","gap","Typography","variant","sx","mb","color","palette","secondary","main","opacity","ConnectedWalletsTable","wallets","displayName"]}
|
package/package.json
CHANGED
@@ -1,23 +1,62 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xyo-network/react-connected-accounts",
|
3
|
+
"version": "3.0.3",
|
4
|
+
"description": "Common React library for all XYO projects that use React",
|
5
|
+
"keywords": [
|
6
|
+
"xyo",
|
7
|
+
"utility",
|
8
|
+
"typescript",
|
9
|
+
"react"
|
10
|
+
],
|
11
|
+
"homepage": "https://xyo.network",
|
12
|
+
"bugs": {
|
13
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
|
14
|
+
"email": "support@xyo.network"
|
15
|
+
},
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
19
|
+
},
|
20
|
+
"license": "LGPL-3.0-only",
|
3
21
|
"author": {
|
4
|
-
"email": "support@xyo.network",
|
5
22
|
"name": "XYO Development Team",
|
23
|
+
"email": "support@xyo.network",
|
6
24
|
"url": "https://xyo.network"
|
7
25
|
},
|
8
|
-
"
|
9
|
-
|
10
|
-
|
26
|
+
"sideEffects": false,
|
27
|
+
"type": "module",
|
28
|
+
"exports": {
|
29
|
+
".": {
|
30
|
+
"import": {
|
31
|
+
"types": "./dist/browser/index.d.ts",
|
32
|
+
"default": "./dist/browser/index.mjs"
|
33
|
+
},
|
34
|
+
"types": "./dist/browser/index.d.ts",
|
35
|
+
"default": "./dist/browser/index.mjs"
|
36
|
+
},
|
37
|
+
"./package.json": "./package.json"
|
38
|
+
},
|
39
|
+
"module": "dist/browser/index.mjs",
|
40
|
+
"types": "dist/browser/index.d.ts",
|
41
|
+
"scripts": {
|
42
|
+
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\"",
|
43
|
+
"lint-pkg": "npmPkgJsonLint ."
|
11
44
|
},
|
12
45
|
"dependencies": {
|
13
|
-
"@xylabs/react-crypto": "^4.0.
|
14
|
-
"@xylabs/react-flexbox": "^4.0.
|
15
|
-
"@xyo-network/react-table": "^3.0.
|
46
|
+
"@xylabs/react-crypto": "^4.0.3",
|
47
|
+
"@xylabs/react-flexbox": "^4.0.3",
|
48
|
+
"@xyo-network/react-table": "^3.0.3"
|
16
49
|
},
|
17
50
|
"devDependencies": {
|
51
|
+
"@mui/icons-material": "^5.16.7",
|
52
|
+
"@mui/material": "^5.16.7",
|
53
|
+
"@mui/styles": "^5.16.7",
|
18
54
|
"@storybook/react": "^8.2.9",
|
19
|
-
"@xylabs/ts-scripts-yarn3": "^4.0.
|
20
|
-
"@xylabs/tsconfig-react": "^4.0.
|
55
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.7",
|
56
|
+
"@xylabs/tsconfig-react": "^4.0.7",
|
57
|
+
"react": "^18.3.1",
|
58
|
+
"react-dom": "^18.3.1",
|
59
|
+
"storybook": "^8.2.9",
|
21
60
|
"typescript": "^5.5.4"
|
22
61
|
},
|
23
62
|
"peerDependencies": {
|
@@ -27,41 +66,8 @@
|
|
27
66
|
"react": "^18.2.0",
|
28
67
|
"react-dom": "^18.2.0"
|
29
68
|
},
|
30
|
-
"description": "Common React library for all XYO projects that use React",
|
31
|
-
"docs": "dist/docs.json",
|
32
|
-
"exports": {
|
33
|
-
".": {
|
34
|
-
"import": {
|
35
|
-
"types": "./dist/browser/index.d.ts",
|
36
|
-
"default": "./dist/browser/index.mjs"
|
37
|
-
},
|
38
|
-
"types": "./dist/browser/index.d.ts",
|
39
|
-
"default": "./dist/browser/index.mjs"
|
40
|
-
},
|
41
|
-
"./package.json": "./package.json"
|
42
|
-
},
|
43
|
-
"module": "dist/browser/index.mjs",
|
44
|
-
"homepage": "https://xyo.network",
|
45
|
-
"keywords": [
|
46
|
-
"xyo",
|
47
|
-
"utility",
|
48
|
-
"typescript",
|
49
|
-
"react"
|
50
|
-
],
|
51
|
-
"license": "LGPL-3.0-only",
|
52
69
|
"publishConfig": {
|
53
70
|
"access": "public"
|
54
71
|
},
|
55
|
-
"
|
56
|
-
"type": "git",
|
57
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
58
|
-
},
|
59
|
-
"scripts": {
|
60
|
-
"lint-pkg": "npmPkgJsonLint .",
|
61
|
-
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
|
62
|
-
},
|
63
|
-
"sideEffects": false,
|
64
|
-
"types": "dist/browser/index.d.ts",
|
65
|
-
"version": "3.0.1",
|
66
|
-
"type": "module"
|
72
|
+
"docs": "dist/docs.json"
|
67
73
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
2
2
|
import React, { useState } from 'react'
|
3
3
|
|
4
4
|
import { ConnectedAccountsFlexbox } from './ConnectedAccountsFlexbox.tsx'
|
@@ -8,9 +8,7 @@ const StorybookEntry: Meta = {
|
|
8
8
|
component: ConnectedAccountsFlexbox,
|
9
9
|
parameters: {
|
10
10
|
actions: { argTypesRegex: '!(^on.*)' },
|
11
|
-
docs: {
|
12
|
-
page: null,
|
13
|
-
},
|
11
|
+
docs: { page: null },
|
14
12
|
},
|
15
13
|
title: 'connectedAccounts/Flexbox',
|
16
14
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Typography, useTheme } from '@mui/material'
|
2
|
-
import { FlexBoxProps
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
3
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
3
4
|
import React, { forwardRef } from 'react'
|
4
5
|
|
5
6
|
import { useDetectedWallets } from '../hooks/index.ts'
|
@@ -12,7 +13,9 @@ export interface ConnectedAccountsFlexboxProps extends FlexBoxProps {
|
|
12
13
|
}
|
13
14
|
|
14
15
|
export const ConnectedAccountsFlexbox = forwardRef<HTMLDivElement, ConnectedAccountsFlexboxProps>(
|
15
|
-
({
|
16
|
+
({
|
17
|
+
ignoreConnectDialog, onIgnoreConnectDialog, ...props
|
18
|
+
}, ref) => {
|
16
19
|
const theme = useTheme()
|
17
20
|
|
18
21
|
const { totalConnectedAccounts, sortedWallets } = useDetectedWallets()
|
@@ -1,4 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import type { FormControlProps } from '@mui/material'
|
2
|
+
import {
|
3
|
+
Checkbox, FormControl, FormLabel,
|
4
|
+
} from '@mui/material'
|
2
5
|
import React from 'react'
|
3
6
|
|
4
7
|
export interface CheckboxFormControlProps extends FormControlProps {
|
@@ -1,7 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import type { DialogProps } from '@mui/material'
|
2
|
+
import {
|
3
|
+
Button, Dialog, DialogActions, DialogContent, DialogTitle,
|
4
|
+
} from '@mui/material'
|
2
5
|
import React from 'react'
|
3
6
|
|
4
|
-
import { ActiveProvider } from '../../lib/index.ts'
|
7
|
+
import type { ActiveProvider } from '../../lib/index.ts'
|
5
8
|
import { CheckboxFormControl } from './CheckboxFormControl.tsx'
|
6
9
|
import { LinkedProvidersFlexbox } from './LinkedProvidersFlexbox.tsx'
|
7
10
|
import { WalletPermissionsFlexbox } from './Permissions.tsx'
|
@@ -11,7 +14,9 @@ export interface ConnectWalletDialogProps extends DialogProps {
|
|
11
14
|
onIgnoreConnectDialog?: (checked: boolean) => void
|
12
15
|
}
|
13
16
|
|
14
|
-
export const ConnectWalletDialog: React.FC<ConnectWalletDialogProps> = ({
|
17
|
+
export const ConnectWalletDialog: React.FC<ConnectWalletDialogProps> = ({
|
18
|
+
activeProvider, onIgnoreConnectDialog, ...props
|
19
|
+
}) => {
|
15
20
|
const { icon, providerName } = activeProvider ?? {}
|
16
21
|
|
17
22
|
const onConnect = async () => {
|
@@ -24,9 +29,15 @@ export const ConnectWalletDialog: React.FC<ConnectWalletDialogProps> = ({ active
|
|
24
29
|
}
|
25
30
|
|
26
31
|
return (
|
27
|
-
<Dialog
|
32
|
+
<Dialog
|
33
|
+
PaperProps={{ sx: { display: 'flex', gap: 4 } }}
|
34
|
+
{...props}
|
35
|
+
>
|
28
36
|
<DialogTitle sx={{ textAlign: 'center' }}>XYO Wants To Access The Blockchain on Your Behalf</DialogTitle>
|
29
|
-
<DialogContent sx={{
|
37
|
+
<DialogContent sx={{
|
38
|
+
display: 'flex', flexDirection: 'column', gap: 4,
|
39
|
+
}}
|
40
|
+
>
|
30
41
|
<LinkedProvidersFlexbox icon={icon} providerName={providerName} />
|
31
42
|
<WalletPermissionsFlexbox />
|
32
43
|
<CheckboxFormControl onCheckChanged={onIgnoreConnectDialog} />
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { SyncAlt } from '@mui/icons-material'
|
2
2
|
import { Typography } from '@mui/material'
|
3
3
|
import { ConstrainedImage } from '@xylabs/react-crypto'
|
4
|
-
import { FlexBoxProps
|
4
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
5
|
+
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
5
6
|
import React from 'react'
|
6
7
|
|
7
8
|
import { xyoColorLogo } from '../../../../img/index.ts'
|
@@ -11,7 +12,9 @@ export interface LinkedProvidersFlexboxProps extends FlexBoxProps {
|
|
11
12
|
providerName?: string
|
12
13
|
}
|
13
14
|
|
14
|
-
export const LinkedProvidersFlexbox: React.FC<LinkedProvidersFlexboxProps> = ({
|
15
|
+
export const LinkedProvidersFlexbox: React.FC<LinkedProvidersFlexboxProps> = ({
|
16
|
+
icon, providerName, ...props
|
17
|
+
}) => {
|
15
18
|
return (
|
16
19
|
<FlexRow gap={4} justifyContent="space-evenly" {...props}>
|
17
20
|
<FlexCol gap={0.5}>
|
@@ -20,7 +23,12 @@ export const LinkedProvidersFlexbox: React.FC<LinkedProvidersFlexboxProps> = ({
|
|
20
23
|
</FlexCol>
|
21
24
|
<SyncAlt fontSize="large" />
|
22
25
|
<FlexCol gap={0.5}>
|
23
|
-
<ConstrainedImage
|
26
|
+
<ConstrainedImage
|
27
|
+
constrainedValue="48px"
|
28
|
+
src={icon}
|
29
|
+
alt={providerName}
|
30
|
+
style={{ height: '48px', maxWidth: '48px' }}
|
31
|
+
/>
|
24
32
|
<Typography variant="subtitle1">{providerName}</Typography>
|
25
33
|
</FlexCol>
|
26
34
|
</FlexRow>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Link, Typography } from '@mui/material'
|
2
|
-
import { FlexBoxProps
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
3
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
3
4
|
import React from 'react'
|
4
5
|
|
5
6
|
export interface WalletPermissionsFlexBoxProps extends FlexBoxProps {}
|
@@ -1,9 +1,12 @@
|
|
1
|
-
import {
|
1
|
+
import type { DialogProps } from '@mui/material'
|
2
|
+
import {
|
3
|
+
Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography,
|
4
|
+
} from '@mui/material'
|
2
5
|
import { ConstrainedImage } from '@xylabs/react-crypto'
|
3
6
|
import { FlexRow } from '@xylabs/react-flexbox'
|
4
7
|
import React from 'react'
|
5
8
|
|
6
|
-
import { ActiveProvider } from '../../lib/index.ts'
|
9
|
+
import type { ActiveProvider } from '../../lib/index.ts'
|
7
10
|
|
8
11
|
export interface RevokeWalletConnectionDialogProps extends DialogProps {
|
9
12
|
activeProvider?: ActiveProvider
|
@@ -1,9 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { TableProps } from '@mui/material'
|
2
|
+
import {
|
3
|
+
Table, TableBody, TableCell, TableHead, TableRow,
|
4
|
+
} from '@mui/material'
|
5
|
+
import type { EIP6963Connector } from '@xylabs/react-crypto'
|
3
6
|
import React, { useState } from 'react'
|
4
7
|
|
5
8
|
import { ConnectWalletDialog, RevokeWalletConnectionDialog } from '../dialogs/index.ts'
|
6
|
-
import { ActiveProvider
|
9
|
+
import type { ActiveProvider } from '../lib/index.ts'
|
10
|
+
import { WalletsTableHeadCells } from '../lib/index.ts'
|
7
11
|
import { WalletConnectionsTableRow } from './ConnectedWalletsTableRow.tsx'
|
8
12
|
import { useActiveProviderDialogState } from './hooks/index.ts'
|
9
13
|
|
@@ -13,7 +17,9 @@ export interface ConnectedWalletsTableProps extends TableProps {
|
|
13
17
|
wallets?: EIP6963Connector[]
|
14
18
|
}
|
15
19
|
|
16
|
-
export const ConnectedWalletsTable: React.FC<ConnectedWalletsTableProps> = ({
|
20
|
+
export const ConnectedWalletsTable: React.FC<ConnectedWalletsTableProps> = ({
|
21
|
+
ignoreConnectDialog, onIgnoreConnectDialog, wallets, ...props
|
22
|
+
}) => {
|
17
23
|
const [activeProvider, setActiveProvider] = useState<ActiveProvider>()
|
18
24
|
const [showConnect, onSetActiveProviderConnect, onConnectClose] = useActiveProviderDialogState(setActiveProvider)
|
19
25
|
const [showRevoke, onSetActiveProviderRevoke, onRevokeClose] = useActiveProviderDialogState(setActiveProvider)
|
@@ -23,7 +29,9 @@ export const ConnectedWalletsTable: React.FC<ConnectedWalletsTableProps> = ({ ig
|
|
23
29
|
<Table {...props}>
|
24
30
|
<TableHead>
|
25
31
|
<TableRow>
|
26
|
-
{WalletsTableHeadCells.map(({
|
32
|
+
{WalletsTableHeadCells.map(({
|
33
|
+
disablePadding, id, label, align, width,
|
34
|
+
}) => (
|
27
35
|
<TableCell align={align} key={id} padding={disablePadding ? 'none' : 'normal'} width={width ?? 'auto'}>
|
28
36
|
{label}
|
29
37
|
</TableCell>
|
@@ -1,8 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { TableRowProps } from '@mui/material'
|
2
|
+
import { TableRow } from '@mui/material'
|
3
|
+
import type { EthWalletConnectorBase } from '@xylabs/react-crypto'
|
4
|
+
import { useEthWallet } from '@xylabs/react-crypto'
|
3
5
|
import React, { useCallback, useMemo } from 'react'
|
4
6
|
|
5
|
-
import { ActiveProvider } from '../lib/index.ts'
|
7
|
+
import type { ActiveProvider } from '../lib/index.ts'
|
6
8
|
import { ConnectedWalletTableCells } from './cells/index.ts'
|
7
9
|
|
8
10
|
export interface WalletConnectionsTableRowProps extends TableRowProps {
|
@@ -19,12 +21,18 @@ export const WalletConnectionsTableRow: React.FC<WalletConnectionsTableRowProps>
|
|
19
21
|
wallet,
|
20
22
|
...props
|
21
23
|
}) => {
|
22
|
-
const {
|
24
|
+
const {
|
25
|
+
currentAccount: currentAccountFromWallet, additionalAccounts, chainName, connectWallet, providerInfo,
|
26
|
+
} = useEthWallet(wallet)
|
23
27
|
|
24
28
|
const currentAccount = currentAccountFromWallet?.toString() ? [currentAccountFromWallet.toString()] : []
|
25
29
|
const totalAccounts = (additionalAccounts?.length ?? 0) + (currentAccount?.length ?? 0)
|
26
30
|
const connected = !!(currentAccount?.length ?? 0 > 0)
|
27
|
-
const {
|
31
|
+
const {
|
32
|
+
icon, name, rdns,
|
33
|
+
} = useMemo(() => providerInfo ?? {
|
34
|
+
icon: undefined, name: undefined, rdns: undefined,
|
35
|
+
}, [providerInfo])
|
28
36
|
|
29
37
|
const activeProvider = useMemo<ActiveProvider>(
|
30
38
|
() => ({
|