@xyo-network/react-connected-accounts 3.0.15 → 3.0.16
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDetectWallets.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDetectWallets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;
|
1
|
+
{"version":3,"file":"useDetectWallets.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDetectWallets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAgB/E,eAAO,MAAM,kBAAkB;;;CAU9B,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
@@ -103,34 +103,19 @@ import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
103
103
|
import React13, { forwardRef } from "react";
|
104
104
|
|
105
105
|
// src/hooks/useDetectWallets.tsx
|
106
|
-
import {
|
107
|
-
import {
|
108
|
-
var sortWallets = /* @__PURE__ */ __name((wallets) =>
|
109
|
-
|
110
|
-
Object.values(wallets)
|
111
|
-
wallet.allowedAccounts.length > 0
|
112
|
-
|
113
|
-
}
|
114
|
-
|
106
|
+
import { useWalletDiscovery } from "@xylabs/react-crypto";
|
107
|
+
import { useMemo } from "react";
|
108
|
+
var sortWallets = /* @__PURE__ */ __name((wallets) => {
|
109
|
+
const result = [];
|
110
|
+
for (const wallet of Object.values(wallets)) {
|
111
|
+
if (wallet.allowedAccounts.length > 0) result.unshift(wallet);
|
112
|
+
else result.push(wallet);
|
113
|
+
}
|
114
|
+
return result;
|
115
|
+
}, "sortWallets");
|
115
116
|
var useDetectedWallets = /* @__PURE__ */ __name(() => {
|
116
117
|
const wallets = useWalletDiscovery();
|
117
|
-
const
|
118
|
-
const [sortedWallets, setSortedWallets] = useState([]);
|
119
|
-
useEffect(() => {
|
120
|
-
setSortedWallets(sortWallets(wallets));
|
121
|
-
}, [
|
122
|
-
wallets,
|
123
|
-
refresh
|
124
|
-
]);
|
125
|
-
useEffect(() => {
|
126
|
-
const listener = /* @__PURE__ */ __name(() => {
|
127
|
-
setRefresh((refresh2) => refresh2 + 1);
|
128
|
-
}, "listener");
|
129
|
-
window.addEventListener(AccountsChangedEventName, listener);
|
130
|
-
return () => {
|
131
|
-
window.removeEventListener(AccountsChangedEventName, listener);
|
132
|
-
};
|
133
|
-
}, [
|
118
|
+
const sortedWallets = useMemo(() => sortWallets(wallets), [
|
134
119
|
wallets
|
135
120
|
]);
|
136
121
|
const totalConnectedAccounts = useMemo(() => Object.values(sortedWallets).reduce((acc, wallet) => acc + wallet.allowedAccounts.length, 0), [
|
@@ -423,7 +408,7 @@ var ConnectedWalletTableCells = [
|
|
423
408
|
|
424
409
|
// src/components/wallet/table/ConnectedWalletsTable.tsx
|
425
410
|
import { Table, TableBody, TableCell as TableCell6, TableHead, TableRow as TableRow2 } from "@mui/material";
|
426
|
-
import React12, { useState as
|
411
|
+
import React12, { useState as useState2 } from "react";
|
427
412
|
|
428
413
|
// src/components/wallet/lib/TableHeadData.ts
|
429
414
|
var WalletsTableHeadCells = [
|
@@ -525,9 +510,9 @@ var WalletConnectionsTableRow = /* @__PURE__ */ __name(({ ignoreConnectDialog, o
|
|
525
510
|
}, "WalletConnectionsTableRow");
|
526
511
|
|
527
512
|
// src/components/wallet/table/hooks/useActiveProviderDialogState.tsx
|
528
|
-
import { useState
|
513
|
+
import { useState } from "react";
|
529
514
|
var useActiveProviderDialogState = /* @__PURE__ */ __name((setActiveProvider) => {
|
530
|
-
const [show, setShow] =
|
515
|
+
const [show, setShow] = useState(false);
|
531
516
|
const onSetActiveProvider = /* @__PURE__ */ __name((activeProvider) => {
|
532
517
|
setShow(true);
|
533
518
|
setActiveProvider(activeProvider);
|
@@ -545,7 +530,7 @@ var useActiveProviderDialogState = /* @__PURE__ */ __name((setActiveProvider) =>
|
|
545
530
|
|
546
531
|
// src/components/wallet/table/ConnectedWalletsTable.tsx
|
547
532
|
var ConnectedWalletsTable = /* @__PURE__ */ __name(({ ignoreConnectDialog, onIgnoreConnectDialog, wallets, ...props }) => {
|
548
|
-
const [activeProvider, setActiveProvider] =
|
533
|
+
const [activeProvider, setActiveProvider] = useState2();
|
549
534
|
const [showConnect, onSetActiveProviderConnect, onConnectClose] = useActiveProviderDialogState(setActiveProvider);
|
550
535
|
const [showRevoke, onSetActiveProviderRevoke, onRevokeClose] = useActiveProviderDialogState(setActiveProvider);
|
551
536
|
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Table, props, /* @__PURE__ */ React12.createElement(TableHead, null, /* @__PURE__ */ React12.createElement(TableRow2, null, WalletsTableHeadCells.map(({ disablePadding, id, label, align, width }) => /* @__PURE__ */ React12.createElement(TableCell6, {
|
@@ -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 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;AACjEH,iBAAWE,UAAAA,IAAc;;QAEvBE,SAASF,cAAc,KAAKd,iBAAiB,KAAKA,eAAec,UAAAA,IAAc;QAC/EC;MACF;IACF,GANkB;AASlBE,WAAOC,QAAQZ,OAAAA,EAASa,QAAQN,UAAUO,KAAK,IAAI,CAAA;AACnD,SAAKnB,kBAAkBW;AACvB,SAAKS,WAAU;EACjB;EAEAC,UAAUC,UAA0B;AAClC,SAAKrB,YAAY;SAAI,KAAKA;MAAWqB;;AACr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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"]}
|
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 { useWalletDiscovery } from '@xylabs/react-crypto'\nimport { useMemo } from 'react'\n\nconst sortWallets = (wallets: DiscoveredWallets) => {\n const result: EIP6963Connector[] = []\n\n for (const wallet of Object.values(wallets)) {\n if (wallet.allowedAccounts.length > 0)\n result.unshift(wallet)\n else\n result.push(wallet)\n }\n return result\n}\n\nexport const useDetectedWallets = () => {\n const wallets = useWalletDiscovery()\n const sortedWallets = useMemo(() => sortWallets(wallets), [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,WAA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f,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","useWalletDiscovery","useMemo","sortWallets","wallets","result","wallet","Object","values","allowedAccounts","length","unshift","push","useDetectedWallets","useWalletDiscovery","sortedWallets","useMemo","totalConnectedAccounts","reduce","acc","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,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xyo-network/react-connected-accounts",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.16",
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
5
5
|
"keywords": [
|
6
6
|
"xyo",
|
@@ -43,9 +43,9 @@
|
|
43
43
|
"lint-pkg": "npmPkgJsonLint ."
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@xylabs/react-crypto": "^4.2.
|
47
|
-
"@xylabs/react-flexbox": "^4.2.
|
48
|
-
"@xyo-network/react-table": "^3.0.
|
46
|
+
"@xylabs/react-crypto": "^4.2.10",
|
47
|
+
"@xylabs/react-flexbox": "^4.2.10",
|
48
|
+
"@xyo-network/react-table": "^3.0.16"
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
51
|
"@mui/icons-material": "^5.16.7",
|
@@ -1,41 +1,22 @@
|
|
1
1
|
import type { DiscoveredWallets, EIP6963Connector } from '@xylabs/react-crypto'
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
useEffect, useMemo, useState,
|
5
|
-
} from 'react'
|
2
|
+
import { useWalletDiscovery } from '@xylabs/react-crypto'
|
3
|
+
import { useMemo } from 'react'
|
6
4
|
|
7
|
-
const sortWallets = (wallets: DiscoveredWallets) =>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
wallet.allowedAccounts.length > 0
|
12
|
-
|
13
|
-
|
5
|
+
const sortWallets = (wallets: DiscoveredWallets) => {
|
6
|
+
const result: EIP6963Connector[] = []
|
7
|
+
|
8
|
+
for (const wallet of Object.values(wallets)) {
|
9
|
+
if (wallet.allowedAccounts.length > 0)
|
10
|
+
result.unshift(wallet)
|
11
|
+
else
|
12
|
+
result.push(wallet)
|
13
|
+
}
|
14
|
+
return result
|
15
|
+
}
|
14
16
|
|
15
17
|
export const useDetectedWallets = () => {
|
16
18
|
const wallets = useWalletDiscovery()
|
17
|
-
const
|
18
|
-
const [sortedWallets, setSortedWallets] = useState<EIP6963Connector[]>([])
|
19
|
-
|
20
|
-
useEffect(() => {
|
21
|
-
setSortedWallets(sortWallets(wallets))
|
22
|
-
}, [wallets, refresh])
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Rely on custom events from the wallet base class to know when accounts are changed.
|
26
|
-
* This approach prevents the need to loop through all wallets and set up individual listeners.
|
27
|
-
*/
|
28
|
-
useEffect(() => {
|
29
|
-
const listener: (event: CustomEventInit) => void = () => {
|
30
|
-
setRefresh(refresh => refresh + 1)
|
31
|
-
}
|
32
|
-
// eslint-disable-next-line @eslint-react/web-api/no-leaked-event-listener
|
33
|
-
window.addEventListener(AccountsChangedEventName, listener)
|
34
|
-
|
35
|
-
return () => {
|
36
|
-
window.removeEventListener(AccountsChangedEventName, listener)
|
37
|
-
}
|
38
|
-
}, [wallets])
|
19
|
+
const sortedWallets = useMemo(() => sortWallets(wallets), [wallets])
|
39
20
|
|
40
21
|
const totalConnectedAccounts = useMemo(
|
41
22
|
() => Object.values(sortedWallets).reduce((acc, wallet) => acc + wallet.allowedAccounts.length, 0),
|