-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69f63c2
commit 0539cba
Showing
7 changed files
with
36 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,22 @@ | ||
import { Skeleton } from '@chakra-ui/react'; | ||
import type { UseQueryResult } from '@tanstack/react-query'; | ||
import { pick } from 'lodash'; | ||
import React from 'react'; | ||
|
||
import type { UserOp } from 'types/api/userOps'; | ||
|
||
import type { ResourceError } from 'lib/api/resources'; | ||
import RawDataSnippet from 'ui/shared/RawDataSnippet'; | ||
|
||
interface Props { | ||
query: UseQueryResult<UserOp, ResourceError>; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
rawData?: Record<string, any>; | ||
isLoading?: boolean; | ||
} | ||
|
||
const RAW_FIELDS: Array<keyof UserOp> = [ | ||
'sender', | ||
'nonce', | ||
'init_code', | ||
'call_data', | ||
'call_gas_limit', | ||
'verification_gas_limit', | ||
'pre_verification_gas', | ||
'max_fee_per_gas', | ||
'max_priority_fee_per_gas', | ||
'paymaster_and_data', | ||
'signature', | ||
]; | ||
|
||
const UserOpRaw = ({ query }: Props) => { | ||
if (!query.data) { | ||
const UserOpRaw = ({ rawData, isLoading }: Props) => { | ||
if (!rawData) { | ||
return null; | ||
} | ||
const dataToDisplay = pick(query.data, RAW_FIELDS); | ||
|
||
const text = JSON.stringify(dataToDisplay, undefined, 4); | ||
const text = JSON.stringify(rawData, undefined, 4); | ||
|
||
return <Skeleton isLoaded={ !query.isPlaceholderData }><RawDataSnippet data={ text }/></Skeleton>; | ||
return <Skeleton isLoaded={ !isLoading }><RawDataSnippet data={ text }/></Skeleton>; | ||
}; | ||
|
||
export default UserOpRaw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters