Commit 1b27ff06 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Merge pull request #1678 from blockscout/fe-1677

Support raw format of v0.7 user ops
parents 6775ba20 7a1bb12f
......@@ -55,6 +55,7 @@ NEXT_PUBLIC_ADMIN_SERVICE_API_HOST=https://admin-rs.services.blockscout.com
NEXT_PUBLIC_WEB3_WALLETS=['token_pocket','metamask']
NEXT_PUBLIC_VIEWS_CONTRACT_SOLIDITYSCAN_ENABLED=true
NEXT_PUBLIC_HAS_BEACON_CHAIN=true
NEXT_PUBLIC_HAS_USER_OPS=true
#meta
NEXT_PUBLIC_OG_IMAGE_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/og-images/sepolia-testnet.png
......@@ -49,8 +49,10 @@ export type UserOp = {
user_logs_start_index: number;
user_logs_count: number;
raw: {
account_gas_limits?: string;
call_data: string;
call_gas_limit: string;
gas_fees?: string;
init_code: string;
max_fee_per_gas: string;
max_priority_fee_per_gas: string;
......
......@@ -7,7 +7,7 @@ import RawDataSnippet from 'ui/shared/RawDataSnippet';
// order is taken from the ERC-4337 standard
// eslint-disable-next-line max-len
const KEYS_ORDER: Array<keyof UserOp['raw']> = [ '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 KEYS_ORDER: Array<keyof UserOp['raw']> = [ 'sender', 'nonce', 'init_code', 'call_data', 'account_gas_limits', 'call_gas_limit', 'verification_gas_limit', 'pre_verification_gas', 'gas_fees', 'max_fee_per_gas', 'max_priority_fee_per_gas', 'paymaster_and_data', 'signature' ];
interface Props {
rawData?: UserOp['raw'];
......@@ -20,7 +20,10 @@ const UserOpRaw = ({ rawData, isLoading }: Props) => {
}
const text = JSON.stringify(KEYS_ORDER.reduce((res: UserOp['raw'], key: keyof UserOp['raw']) => {
res[key] = rawData[key];
const value = rawData[key];
if (value !== undefined) {
res[key] = value;
}
return res;
}, {} as UserOp['raw']), undefined, 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment