diff --git a/extension/src/panel/routes/Edit/AvatarInput.tsx b/extension/src/panel/routes/Edit/AvatarInput.tsx index ffa475e8..66714800 100644 --- a/extension/src/panel/routes/Edit/AvatarInput.tsx +++ b/extension/src/panel/routes/Edit/AvatarInput.tsx @@ -3,7 +3,7 @@ import { validateAddress } from '@/utils' import { getAddress } from 'ethers' import React, { useEffect, useState } from 'react' import CreatableSelect from 'react-select/creatable' -import { Option } from '../ModSelect' +import { Option } from './ModSelect' interface Props { value: string @@ -64,10 +64,12 @@ export const AvatarInput = ({ placeholder="Paste in Safe address or select from owned Safes" styles={createSelectStyles as any} value={ - checksumAvatarAddress && { - value: checksumAvatarAddress, - label: checksumAvatarAddress, - } + checksumAvatarAddress !== '' + ? { + value: checksumAvatarAddress, + label: checksumAvatarAddress, + } + : undefined } options={availableSafes.map((address) => { return { value: address, label: address } @@ -106,10 +108,9 @@ export const AvatarInput = ({ ) } -const SafeOptionLabel: React.FC = (opt) => { - const option = opt as Option - +const SafeOptionLabel = (option: Option) => { const checksumAddress = getAddress(option.value) + return (
diff --git a/extension/src/panel/routes/Edit/EditConnection.tsx b/extension/src/panel/routes/Edit/EditConnection.tsx index 0d2b85da..34730a83 100644 --- a/extension/src/panel/routes/Edit/EditConnection.tsx +++ b/extension/src/panel/routes/Edit/EditConnection.tsx @@ -29,11 +29,11 @@ import { fromLegacyConnection, } from '../legacyConnectionMigrations' import { useRoute, useRoutes, useSelectedRouteId } from '../routeHooks' -import useConnectionDryRun from '../useConnectionDryRun' import { AvatarInput } from './AvatarInput' import { ChainSelect } from './ChainSelect' import { ModSelect, NO_MODULE_OPTION } from './ModSelect' import classes from './style.module.css' +import { useConnectionDryRun } from './useConnectionDryRun' import { ConnectWallet } from './wallet' type ConnectionPatch = { diff --git a/extension/src/panel/routes/Edit/ModSelect.tsx b/extension/src/panel/routes/Edit/ModSelect.tsx index 0dc61a7e..dee717c6 100644 --- a/extension/src/panel/routes/Edit/ModSelect.tsx +++ b/extension/src/panel/routes/Edit/ModSelect.tsx @@ -4,6 +4,7 @@ import { PropsWithChildren } from 'react' import { Props as SelectProps } from 'react-select' export const NO_MODULE_OPTION = { value: '', label: '' } + export interface Option { value: string label: string diff --git a/extension/src/panel/routes/useConnectionDryRun.tsx b/extension/src/panel/routes/Edit/useConnectionDryRun.tsx similarity index 94% rename from extension/src/panel/routes/useConnectionDryRun.tsx rename to extension/src/panel/routes/Edit/useConnectionDryRun.tsx index ea42e34f..3b21091a 100644 --- a/extension/src/panel/routes/useConnectionDryRun.tsx +++ b/extension/src/panel/routes/Edit/useConnectionDryRun.tsx @@ -1,18 +1,18 @@ +import { getReadOnlyProvider } from '@/providers' +import { JsonRpcError, LegacyConnection } from '@/types' import { isSmartContractAddress, validateAddress } from '@/utils' import { KnownContracts } from '@gnosis.pm/zodiac' import { useEffect, useState } from 'react' -import { JsonRpcError, LegacyConnection } from '../../types' -import { getReadOnlyProvider } from '../providers/readOnlyProvider' import { decodeGenericError, decodeRoleKey, decodeRolesV1Error, decodeRolesV2Error, -} from '../utils' -import { useRoute } from './routeHooks' +} from '../../utils' +import { useRoute } from '../routeHooks' import { wrapRequest } from './wrapRequest' -const useConnectionDryRun = (connection: LegacyConnection) => { +export const useConnectionDryRun = (connection: LegacyConnection) => { const [error, setError] = useState(null) const { connected } = useRoute(connection.id) @@ -148,5 +148,3 @@ async function dryRun(connection: LegacyConnection) { await provider.estimateGas(request) } - -export default useConnectionDryRun diff --git a/extension/src/panel/routes/wrapRequest.ts b/extension/src/panel/routes/Edit/wrapRequest.ts similarity index 96% rename from extension/src/panel/routes/wrapRequest.ts rename to extension/src/panel/routes/Edit/wrapRequest.ts index 5f7d9b65..5a0234c5 100644 --- a/extension/src/panel/routes/wrapRequest.ts +++ b/extension/src/panel/routes/Edit/wrapRequest.ts @@ -1,7 +1,6 @@ +import { LegacyConnection, TransactionData } from '@/types' import { ContractFactories, KnownContracts } from '@gnosis.pm/zodiac' - import { MetaTransactionData } from '@safe-global/safe-core-sdk-types' -import { LegacyConnection, TransactionData } from '../../types' const RolesV1Interface = ContractFactories[KnownContracts.ROLES_V1].createInterface()