Skip to content

Commit 70ecaec

Browse files
authored
Merge pull request #1901 from oasisprotocol/lw/cleanup
Remove unused code since AddressSwitch was removed
2 parents d1a375f + c5101b6 commit 70ecaec

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

.changelog/1901.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove unused code since AddressSwitch was removed

src/app/components/RuntimeEvents/RuntimeEventDetails.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import TableBody from '@mui/material/TableBody'
1212
import { AccountLink } from '../Account/AccountLink'
1313
import { CopyToClipboard } from '../CopyToClipboard'
1414
import { SearchScope } from '../../../types/searchScope'
15-
import { getOasisAddress } from '../../utils/helpers'
1615
import { exhaustedTypeWarning } from '../../../types/errors'
1716
import { LongDataDisplay } from '../LongDataDisplay'
1817
import { parseEvmEvent } from '../../utils/parseEvmEvent'
@@ -120,9 +119,8 @@ export const EventTypeIcon: FC<{
120119
const EvmEventParamData: FC<{
121120
scope: SearchScope
122121
param: EvmAbiParam
123-
address?: string
124122
alwaysTrimOnTable?: boolean
125-
}> = ({ scope, param, address, alwaysTrimOnTable }) => {
123+
}> = ({ scope, param, alwaysTrimOnTable }) => {
126124
const { t } = useTranslation()
127125
/**
128126
* According to the API docs:
@@ -135,8 +133,8 @@ const EvmEventParamData: FC<{
135133
switch (param.evm_type) {
136134
// TODO: handle more EVM types
137135
case 'address':
138-
return address ? (
139-
<AccountLink address={address} scope={scope} alwaysTrimOnTablet={alwaysTrimOnTable} />
136+
return param.value ? (
137+
<AccountLink address={param.value as string} scope={scope} alwaysTrimOnTablet={alwaysTrimOnTable} />
140138
) : null
141139
case 'uint256': {
142140
if (param.evm_token?.type === 'ERC20') {
@@ -207,27 +205,18 @@ const EvmLogRow: FC<{
207205
scope: SearchScope
208206
param: EvmAbiParam
209207
}> = ({ scope, param }) => {
210-
const evmAddress = param.evm_type === 'address' ? (param.value as string) : undefined
211-
const oasisAddress = evmAddress ? getOasisAddress(evmAddress) : undefined
212-
const address = evmAddress || oasisAddress
213-
214-
const getCopyToClipboardValue = () => {
215-
if (address) {
216-
return address
217-
}
218-
219-
return typeof param.value === 'string' ? (param.value as string) : JSON.stringify(param.value, null, ' ')
220-
}
208+
const clipboardValue =
209+
typeof param.value === 'string' ? param.value : JSON.stringify(param.value, null, ' ')
221210

222211
return (
223212
<TableRow>
224213
<TableCell>{param.name}</TableCell>
225214
<TableCell>{param.evm_type}</TableCell>
226215
<TableCell>
227-
<EvmEventParamData scope={scope} param={param} address={address} alwaysTrimOnTable />{' '}
216+
<EvmEventParamData scope={scope} param={param} alwaysTrimOnTable />{' '}
228217
</TableCell>
229218
<TableCell>
230-
<CopyToClipboard value={getCopyToClipboardValue()} />
219+
<CopyToClipboard value={clipboardValue} />
231220
</TableCell>
232221
</TableRow>
233222
)
@@ -250,7 +239,6 @@ const RuntimeEventDetailsInner: FC<{
250239
case RuntimeEventType.evmlog: {
251240
const { parsedEvmLogName } = parseEvmEvent(event)
252241
const emittingEthAddress = event.body.address
253-
const emittingOasisAddress = getOasisAddress(emittingEthAddress)
254242
if (!event.evm_log_name && !event.evm_log_params) {
255243
return (
256244
<div>
@@ -282,7 +270,7 @@ const RuntimeEventDetailsInner: FC<{
282270
<br />
283271
<Box sx={{ display: 'inline-flex', verticalAlign: 'middle', alignItems: 'center' }}>
284272
{t('runtimeEvent.fields.emittingContract')}:{' '}
285-
<AccountLink scope={scope} alwaysTrim address={emittingEthAddress || emittingOasisAddress} />
273+
<AccountLink scope={scope} alwaysTrim address={emittingEthAddress} />
286274
</Box>
287275
</div>
288276
)
@@ -315,7 +303,7 @@ const RuntimeEventDetailsInner: FC<{
315303
<br />
316304
<Box sx={{ display: 'inline-flex', verticalAlign: 'middle', alignItems: 'center' }}>
317305
{t('runtimeEvent.fields.emittingContract')}:{' '}
318-
<AccountLink scope={scope} alwaysTrim address={emittingEthAddress || emittingOasisAddress} />
306+
<AccountLink scope={scope} alwaysTrim address={emittingEthAddress} />
319307
</Box>
320308
</div>
321309
)

0 commit comments

Comments
 (0)