@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,7 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
TableCell, Tooltip, Typography,
|
3
|
+
} from '@mui/material'
|
2
4
|
import React from 'react'
|
3
5
|
|
4
|
-
import { ConnectedWalletTableCellProps } from './lib/index.ts'
|
6
|
+
import type { ConnectedWalletTableCellProps } from './lib/index.ts'
|
5
7
|
|
6
8
|
export const ConnectedWalletsAccountsTableCell: React.FC<ConnectedWalletTableCellProps> = ({
|
7
9
|
additionalAccounts,
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import { Check, InfoOutlined } from '@mui/icons-material'
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
Button, IconButton, TableCell, Typography,
|
4
|
+
} from '@mui/material'
|
3
5
|
import { FlexRow } from '@xylabs/react-flexbox'
|
4
6
|
import React from 'react'
|
5
7
|
|
6
|
-
import { ConnectedWalletTableCellProps } from './lib/index.ts'
|
8
|
+
import type { ConnectedWalletTableCellProps } from './lib/index.ts'
|
7
9
|
|
8
|
-
export const ConnectedWalletsActionsTableCell: React.FC<ConnectedWalletTableCellProps> = ({
|
10
|
+
export const ConnectedWalletsActionsTableCell: React.FC<ConnectedWalletTableCellProps> = ({
|
11
|
+
connected, onConnect, onRevoke, tableCellProps,
|
12
|
+
}) => {
|
9
13
|
return (
|
10
14
|
<TableCell {...tableCellProps}>
|
11
15
|
<FlexRow gap={2} justifyContent="start">
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { ComponentType } from 'react'
|
1
|
+
import type { ComponentType } from 'react'
|
2
2
|
|
3
3
|
import { ConnectedWalletsAccountsTableCell } from './Accounts.tsx'
|
4
4
|
import { ConnectedWalletsActionsTableCell } from './Actions.tsx'
|
5
5
|
import { ConnectedWalletsChainNameTableCell } from './ChainName.tsx'
|
6
|
-
import { ConnectedWalletTableCellProps } from './lib/index.ts'
|
6
|
+
import type { ConnectedWalletTableCellProps } from './lib/index.ts'
|
7
7
|
import { ConnectedWalletState } from './State.tsx'
|
8
8
|
import { ConnectedWalletsWalletTableCell } from './Wallet.tsx'
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { TableCell } from '@mui/material'
|
2
2
|
import React from 'react'
|
3
3
|
|
4
|
-
import { ConnectedWalletTableCellProps } from './lib/index.ts'
|
4
|
+
import type { ConnectedWalletTableCellProps } from './lib/index.ts'
|
5
5
|
|
6
6
|
export const ConnectedWalletsChainNameTableCell: React.FC<ConnectedWalletTableCellProps> = ({ chainName, tableCellProps }) => {
|
7
7
|
return <TableCell {...tableCellProps}>{chainName}</TableCell>
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import { Switch, TableCell } from '@mui/material'
|
2
|
-
import
|
2
|
+
import type { ChangeEvent } from 'react'
|
3
|
+
import React, { useMemo } from 'react'
|
3
4
|
|
4
5
|
import { useEnabledWallets } from '../../../../hooks/index.ts'
|
5
|
-
import { ConnectedWalletTableCellProps } from './lib/index.ts'
|
6
|
+
import type { ConnectedWalletTableCellProps } from './lib/index.ts'
|
6
7
|
|
7
|
-
export const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({
|
8
|
-
|
8
|
+
export const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({
|
9
|
+
connected, walletRdns, tableCellProps,
|
10
|
+
}) => {
|
11
|
+
const {
|
12
|
+
disableWallet, enableWallet, wallets,
|
13
|
+
} = useEnabledWallets()
|
9
14
|
|
10
15
|
const enabled = useMemo(() => (walletRdns ? wallets[walletRdns].enabled : false), [wallets, walletRdns])
|
11
16
|
|
@@ -3,9 +3,11 @@ import { ConstrainedImage } from '@xylabs/react-crypto'
|
|
3
3
|
import { FlexRow } from '@xylabs/react-flexbox'
|
4
4
|
import React from 'react'
|
5
5
|
|
6
|
-
import { ConnectedWalletTableCellProps } from './lib/index.ts'
|
6
|
+
import type { ConnectedWalletTableCellProps } from './lib/index.ts'
|
7
7
|
|
8
|
-
export const ConnectedWalletsWalletTableCell: React.FC<ConnectedWalletTableCellProps> = ({
|
8
|
+
export const ConnectedWalletsWalletTableCell: React.FC<ConnectedWalletTableCellProps> = ({
|
9
|
+
icon, walletName, tableCellProps,
|
10
|
+
}) => {
|
9
11
|
const theme = useTheme()
|
10
12
|
|
11
13
|
return (
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { Dispatch, SetStateAction
|
1
|
+
import type { Dispatch, SetStateAction } from 'react'
|
2
|
+
import { useState } from 'react'
|
2
3
|
|
3
|
-
import { ActiveProvider } from '../../lib/index.ts'
|
4
|
+
import type { ActiveProvider } from '../../lib/index.ts'
|
4
5
|
|
5
6
|
export const useActiveProviderDialogState = (
|
6
7
|
setActiveProvider: Dispatch<SetStateAction<ActiveProvider | undefined>>,
|
@@ -1,5 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { DiscoveredWallets, EIP6963Connector } from '@xylabs/react-crypto'
|
2
|
+
import { AccountsChangedEventName, useWalletDiscovery } from '@xylabs/react-crypto'
|
3
|
+
import {
|
4
|
+
useEffect, useMemo, useState,
|
5
|
+
} from 'react'
|
3
6
|
|
4
7
|
const sortWallets = (wallets: DiscoveredWallets) =>
|
5
8
|
// eslint-disable-next-line unicorn/no-array-reduce
|
@@ -26,6 +29,7 @@ export const useDetectedWallets = () => {
|
|
26
29
|
const listener: (event: CustomEventInit) => void = () => {
|
27
30
|
setRefresh(refresh => refresh + 1)
|
28
31
|
}
|
32
|
+
// eslint-disable-next-line @eslint-react/web-api/no-leaked-event-listener
|
29
33
|
window.addEventListener(AccountsChangedEventName, listener)
|
30
34
|
|
31
35
|
return () => {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { useWalletDiscovery } from '@xylabs/react-crypto'
|
2
2
|
import { useMemo, useSyncExternalStore } from 'react'
|
3
3
|
|
4
|
-
import {
|
4
|
+
import type { EnabledEthWalletsState, EnabledWalletsSavedState } from '../classes/index.ts'
|
5
|
+
import { EnabledEthWalletConnections } from '../classes/index.ts'
|
5
6
|
|
6
7
|
let enabledEthWallets: EnabledEthWalletConnections | undefined
|
7
8
|
|
package/xy.config.ts
CHANGED