Skip to content

Commit

Permalink
Hide toggle "Show external call data" when data is not available (#2158)
Browse files Browse the repository at this point in the history
Fixes #2103
  • Loading branch information
tom2drum authored Aug 12, 2024
1 parent cec56f1 commit 05ca4fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions ui/userOp/UserOpCallData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => {
return null;
}

const toggler = data.call_data ? (
const toggler = data.call_data && data.execute_call_data ? (
<UserOpCallDataSwitch
onChange={ handleSwitchChange }
initialValue={ !data.execute_call_data }
isDisabled={ !data.execute_call_data }
initialValue={ false }
ml={{ base: 3, lg: 'auto' }}
/>
) : null;

const labelText = data.call_data && !data.execute_call_data ? 'External call data' : 'Call data';

return (
<>
<DetailsInfoItem.Label
hint="Data that’s passed to the sender for execution"
>
Call data
{ labelText }
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<RawInputData hex={ callData } rightSlot={ toggler }/>
Expand Down
11 changes: 6 additions & 5 deletions ui/userOp/UserOpDecodedCallData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => {
return null;
}

const toggler = data.decoded_call_data ? (
const toggler = data.decoded_call_data && data.decoded_execute_call_data ? (
<UserOpCallDataSwitch
onChange={ handleSwitchChange }
initialValue={ !data.decoded_execute_call_data }
isDisabled={ !data.decoded_execute_call_data }
initialValue={ false }
ml={{ base: 0, lg: 'auto' }}
/>
) : null;

const labelText = data.call_data && !data.execute_call_data ? 'Decoded external call data' : 'Decoded call data';

return (
<>
<DetailsInfoItem.Label
hint="Decoded call data"
hint={ labelText }
>
Decoded call data
{ labelText }
</DetailsInfoItem.Label>
<DetailsInfoItem.Value
flexDir={{ base: 'column', lg: 'row' }}
Expand Down

0 comments on commit 05ca4fb

Please sign in to comment.