Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide toggle "Show external call data" when data is not available #2158

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading