Skip to content

Commit

Permalink
Remove eth/oasis1 address toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Oct 14, 2024
1 parent e671fb3 commit 76766e5
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 319 deletions.
1 change: 1 addition & 0 deletions .changelog/1571.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove eth/oasis1 address toggle
4 changes: 0 additions & 4 deletions src/app/components/Account/AccountLinkWithAddressSwitch.tsx

This file was deleted.

32 changes: 0 additions & 32 deletions src/app/components/Account/withAddressSwitch.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/app/components/AddressSwitch/images/eth.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/app/components/AddressSwitch/images/oasis.svg

This file was deleted.

95 changes: 0 additions & 95 deletions src/app/components/AddressSwitch/index.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/app/components/CopyToClipboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const CopyToClipboard: FC<CopyToClipboardProps> = ({ value, label }) => {
const timeout = useRef<number | undefined>(undefined)
const ariaLabel = t('clipboard.label')
const [isCopied, setIsCopied] = useState(false)

const handleCopyToClipboard = useCallback(() => {
if (isCopied) {
return
Expand Down
85 changes: 15 additions & 70 deletions src/app/components/RuntimeEvents/RuntimeEventDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import TableBody from '@mui/material/TableBody'
import { AccountLink } from '../Account/AccountLink'
import { CopyToClipboard } from '../CopyToClipboard'
import { SearchScope } from '../../../types/searchScope'
import { AddressSwitchOption } from '../AddressSwitch'
import { getOasisAddress } from '../../utils/helpers'
import { exhaustedTypeWarning } from '../../../types/errors'
import { LongDataDisplay } from '../LongDataDisplay'
Expand All @@ -24,7 +23,6 @@ import StreamIcon from '@mui/icons-material/Stream'
import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment'
import { getPreciseNumberFormat } from '../../../locales/getPreciseNumberFormat'
import { MaybeEventErrorLine } from './EventError'
import { AccountLinkWithAddressSwitch } from '../Account/AccountLinkWithAddressSwitch'
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward'
import ArrowForwardIcon from '@mui/icons-material/ArrowForward'
import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'
Expand Down Expand Up @@ -130,11 +128,10 @@ const EvmEventParamData: FC<{
const EvmLogRow: FC<{
scope: SearchScope
param: EvmAbiParam
addressSwitchOption: AddressSwitchOption
}> = ({ scope, param, addressSwitchOption }) => {
}> = ({ scope, param }) => {
const evmAddress = param.evm_type === 'address' ? (param.value as string) : undefined
const oasisAddress = evmAddress ? getOasisAddress(evmAddress) : undefined
const address = addressSwitchOption === AddressSwitchOption.Oasis ? oasisAddress : evmAddress
const address = evmAddress || oasisAddress

const getCopyToClipboardValue = () => {
if (address) {
Expand All @@ -161,8 +158,7 @@ const EvmLogRow: FC<{
const RuntimeEventDetailsInner: FC<{
scope: SearchScope
event: RuntimeEvent
addressSwitchOption: AddressSwitchOption
}> = ({ scope, event, addressSwitchOption }) => {
}> = ({ scope, event }) => {
const { isMobile } = useScreenSize()
const { t } = useTranslation()
const eventName = getRuntimeEventMethodLabel(t, event.type)
Expand Down Expand Up @@ -231,12 +227,7 @@ const RuntimeEventDetailsInner: FC<{
</TableHead>
<TableBody>
{event.evm_log_params.map((param, index) => (
<EvmLogRow
scope={scope}
key={`param-${index}`}
param={param}
addressSwitchOption={addressSwitchOption}
/>
<EvmLogRow scope={scope} key={`param-${index}`} param={param} />
))}
</TableBody>
</Table>
Expand All @@ -256,12 +247,7 @@ const RuntimeEventDetailsInner: FC<{
<StyledDescriptionList titleWidth={isMobile ? '100px' : '200px'}>
<dt>{t('runtimeEvent.fields.owner')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.owner_eth}
oasisAddress={event.body.owner}
/>
<AccountLink scope={scope} address={event.body.owner_eth || event.body.owner} />
</dd>
<dt>{t('runtimeEvent.fields.amount')}</dt>
<dd>
Expand All @@ -283,21 +269,11 @@ const RuntimeEventDetailsInner: FC<{
<MaybeEventErrorLine event={event} />
<dt>{t('common.from')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.from_eth}
oasisAddress={event.body.from}
/>
<AccountLink scope={scope} address={event.body.from_eth || event.body.from} />
</dd>
<dt>{t('common.to')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.to_eth}
oasisAddress={event.body.to}
/>
<AccountLink scope={scope} address={event.body.to_eth || event.body.to} />
</dd>
<dt>{t('runtimeEvent.fields.amount')}</dt>
<dd>
Expand All @@ -317,21 +293,11 @@ const RuntimeEventDetailsInner: FC<{
<MaybeEventErrorLine event={event} />
<dt>{t('common.from')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.from_eth}
oasisAddress={event.body.from}
/>
<AccountLink scope={scope} address={event.body.from_eth || event.body.from} />
</dd>
<dt>{t('common.to')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.to_eth}
oasisAddress={event.body.to}
/>
<AccountLink scope={scope} address={event.body.to_eth || event.body.to} />
</dd>
<dt>{t('runtimeEvent.fields.amount')}</dt>
<dd>
Expand All @@ -351,21 +317,11 @@ const RuntimeEventDetailsInner: FC<{
<MaybeEventErrorLine event={event} />
<dt>{t('common.from')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.from_eth}
oasisAddress={event.body.from}
/>
<AccountLink scope={scope} address={event.body.from_eth || event.body.from} />
</dd>
<dt>{t('common.to')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.to_eth}
oasisAddress={event.body.to}
/>
<AccountLink scope={scope} address={event.body.to_eth || event.body.to} />
</dd>
<dt>{t('runtimeEvent.fields.activeShares')}</dt>
<dd>
Expand All @@ -384,21 +340,11 @@ const RuntimeEventDetailsInner: FC<{
<MaybeEventErrorLine event={event} />
<dt>{t('common.from')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.from_eth}
oasisAddress={event.body.from}
/>
<AccountLink scope={scope} address={event.body.from_eth || event.body.from} />
</dd>
<dt>{t('common.to')}</dt>
<dd>
<AccountLinkWithAddressSwitch
scope={scope}
addressSwitchOption={addressSwitchOption}
ethAddress={event.body.to_eth}
oasisAddress={event.body.to}
/>
<AccountLink scope={scope} address={event.body.to_eth || event.body.to} />
</dd>
<dt>{t('runtimeEvent.fields.amount')}</dt>
<dd>
Expand Down Expand Up @@ -431,13 +377,12 @@ const RuntimeEventDetailsInner: FC<{
export const RuntimeEventDetails: FC<{
scope: SearchScope
event: RuntimeEvent
addressSwitchOption: AddressSwitchOption
showTxHash: boolean
}> = ({ scope, event, addressSwitchOption, showTxHash }) => {
}> = ({ scope, event, showTxHash }) => {
const { t } = useTranslation()
return (
<div>
<RuntimeEventDetailsInner scope={scope} event={event} addressSwitchOption={addressSwitchOption} />
<RuntimeEventDetailsInner scope={scope} event={event} />
{showTxHash && event.tx_hash && (
<p>
{t('event.fields.emittingTransaction')}:{' '}
Expand Down
11 changes: 2 additions & 9 deletions src/app/components/RuntimeEvents/RuntimeEventsDetailedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { FC } from 'react'
import { SearchScope } from '../../../types/searchScope'
import { RuntimeEvent } from '../../../oasis-nexus/api'
import { TablePagination, TablePaginationProps } from '../Table/TablePagination'
import { AddressSwitchOption } from '../AddressSwitch'
import { useTranslation } from 'react-i18next'
import { CardEmptyState } from '../CardEmptyState'
import { TextSkeleton } from '../Skeleton'
Expand All @@ -15,10 +14,9 @@ export const RuntimeEventsDetailedList: FC<{
events: RuntimeEvent[] | undefined
isLoading: boolean
isError: boolean
addressSwitchOption: AddressSwitchOption
pagination: false | TablePaginationProps
showTxHash: boolean
}> = ({ scope, events, isLoading, isError, addressSwitchOption, pagination, showTxHash }) => {
}> = ({ scope, events, isLoading, isError, pagination, showTxHash }) => {
const { t } = useTranslation()
return (
<>
Expand All @@ -28,12 +26,7 @@ export const RuntimeEventsDetailedList: FC<{
events.map((event, index) => (
<div key={`event-${index}`}>
{index > 0 && <Divider variant="card" />}
<RuntimeEventDetails
scope={scope}
event={event}
addressSwitchOption={addressSwitchOption}
showTxHash={showTxHash}
/>
<RuntimeEventDetails scope={scope} event={event} showTxHash={showTxHash} />
</div>
))}
{pagination && (
Expand Down
Loading

0 comments on commit 76766e5

Please sign in to comment.