diff --git a/app/css/interceptor.css b/app/css/interceptor.css index 3423ae03..723bca5e 100644 --- a/app/css/interceptor.css +++ b/app/css/interceptor.css @@ -561,33 +561,28 @@ svg.spinner > circle { grid-auto-columns: auto; grid-auto-flow: column; width: 100%; - margin: 0 0.2em; } .log-table { display: grid; grid-template-columns: max-content auto auto auto auto; width: 100%; - margin: 0 0.2em; } .log-table-4 { display: grid; grid-template-columns: max-content auto auto auto; width: 100%; - margin: 0 0.2em; } .log-table-3 { display: grid; grid-template-columns: max-content auto auto; width: 100%; - margin: 0 0.2em; } .log-table-1 { display: grid; grid-template-columns: auto; width: 100%; - margin: 0 0.2em; } .log-cell { diff --git a/app/ts/background/windows/personalSign.ts b/app/ts/background/windows/personalSign.ts index e30d55ac..3d054677 100644 --- a/app/ts/background/windows/personalSign.ts +++ b/app/ts/background/windows/personalSign.ts @@ -43,7 +43,8 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether account: await identifyAddress(ethereumClientService, requestAbortController, originalParams.originalRequestParameters.params[1]), quarantine: false, quarantineReasons: [], - rawMessage: stringifyJSONWithBigInts(originalParams.originalRequestParameters.params[0], 4), + stringifiedMessage: stringifyJSONWithBigInts(originalParams.originalRequestParameters.params[0], 4), + rawMessage: stringifyJSONWithBigInts(originalParams.originalRequestParameters.params[0]), } } @@ -57,6 +58,7 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether account: await identifyAddress(ethereumClientService, requestAbortController, originalParams.originalRequestParameters.params[1]), quarantine: false, quarantineReasons: [], + stringifiedMessage: stringifyJSONWithBigInts(originalParams.originalRequestParameters.params[0], 4), rawMessage: originalParams.originalRequestParameters.params[0], } } @@ -78,7 +80,8 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether message, account, ...chainid === undefined ? { quarantine: false, quarantineReasons: [] } : await getQuarrantineCodes(chainid, account, activeAddressWithMetadata, undefined), - rawMessage: stringifyJSONWithBigInts(namedParams.param, 4), + stringifiedMessage: stringifyJSONWithBigInts(namedParams.param, 4), + rawMessage: stringifyJSONWithBigInts(namedParams.param), } } catch(e: unknown) { console.error(e) @@ -104,6 +107,7 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether verifyingContract: token, ...await getQuarrantineCodes(BigInt(parsed.domain.chainId), account, activeAddressWithMetadata, owner), rawMessage: stringifyJSONWithBigInts(parsed, 4), + stringifiedMessage: stringifyJSONWithBigInts(parsed, 4), } } case 'PermitSingle': { @@ -121,7 +125,8 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether spender: await identifyAddress(ethereumClientService, requestAbortController, parsed.message.spender), verifyingContract: await identifyAddress(ethereumClientService, requestAbortController, parsed.domain.verifyingContract), ...await getQuarrantineCodes(parsed.domain.chainId, account, activeAddressWithMetadata, undefined), - rawMessage: stringifyJSONWithBigInts(parsed, 4), + stringifiedMessage: stringifyJSONWithBigInts(parsed, 4), + rawMessage: stringifyJSONWithBigInts(parsed), } } case 'SafeTx': { @@ -143,7 +148,8 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether ...addresses, quarantine: false, quarantineReasons: [], - rawMessage: stringifyJSONWithBigInts(parsed, 4), + stringifiedMessage: stringifyJSONWithBigInts(parsed, 4), + rawMessage: stringifyJSONWithBigInts(parsed), parsedMessageData, parsedMessageDataAddressBookEntries: await Promise.all(addressesInEventsAndInputData.map((address) => identifyAddress(ethereumClientService, requestAbortController, address))) } @@ -156,7 +162,8 @@ export async function craftPersonalSignPopupMessage(ethereumClientService: Ether message: await addMetadataToOpenSeaOrder(ethereumClientService, requestAbortController, parsed.message), account, ...await getQuarrantineCodes(parsed.domain.chainId, account, activeAddressWithMetadata, undefined), - rawMessage: stringifyJSONWithBigInts(parsed, 4), + stringifiedMessage: stringifyJSONWithBigInts(parsed, 4), + rawMessage: stringifyJSONWithBigInts(parsed), } default: assertNever(parsed) } diff --git a/app/ts/components/pages/PersonalSign.tsx b/app/ts/components/pages/PersonalSign.tsx index 6c176d76..281e4588 100644 --- a/app/ts/components/pages/PersonalSign.tsx +++ b/app/ts/components/pages/PersonalSign.tsx @@ -1,5 +1,5 @@ import { useState } from 'preact/hooks' -import { dataStringWith0xStart, isHexEncodedNumber, stringToUint8Array } from '../../utils/bigint.js' +import { isHexEncodedNumber, stringToUint8Array } from '../../utils/bigint.js' import { RenameAddressCallBack } from '../../types/user-interface-types.js' import { MOCK_PRIVATE_KEYS_ADDRESS, getChainName } from '../../utils/constants.js' import { TransactionOrMessageIdentifier } from '../../types/interceptor-messages.js' @@ -15,11 +15,12 @@ import { AddressBookEntry } from '../../types/addressBookTypes.js' import { EnrichedEIP712, EnrichedEIP712Message, TypeEnrichedEIP712MessageRecord } from '../../types/eip721.js' import { TransactionCreated } from '../simulationExplaining/SimulationSummary.js' import { EnrichedSolidityTypeComponent } from '../subcomponents/solidityType.js' -import { ParsedInputData, QuarantineReasons } from '../simulationExplaining/Transactions.js' +import { QuarantineReasons } from '../simulationExplaining/Transactions.js' import { GnosisSafeVisualizer } from '../simulationExplaining/customExplainers/GnosisSafeVisualizer.js' import { EditEnsNamedHashCallBack } from '../subcomponents/ens.js' -import { ViewSelector as Viewer } from '../subcomponents/ViewSelector.js' +import { ViewSelector, ViewSelector as Viewer } from '../subcomponents/ViewSelector.js' import { XMarkIcon } from '../subcomponents/icons.js' +import { TransactionInput } from '../subcomponents/ParsedInputData.js' type SignatureCardParams = { visualizedPersonalSignRequest: VisualizedPersonalSignRequest @@ -287,7 +288,6 @@ type ExtraDetailsCardParams = { renameAddressCallBack: RenameAddressCallBack } - type GnosisSafeExtraDetailsParams = { visualizedPersonalSignRequestSafeTx: VisualizedPersonalSignRequestSafeTx renameAddressCallBack: RenameAddressCallBack @@ -333,11 +333,7 @@ function GnosisSafeExtraDetails({ visualizedPersonalSignRequestSafeTx, renameAdd }/>

Gnosis Safe meta transaction input:

-
-

{ dataStringWith0xStart(visualizedPersonalSignRequestSafeTx.message.message.data) }

-
-

Parsed Gnosis Safe meta transaction:

- { visualizedPersonalSignRequestSafeTx.parsedMessageData?.type !== 'Parsed' ?

No ABI available

: } + } @@ -390,15 +386,17 @@ function RawMessage({ visualizedPersonalSignRequest }: ExtraDetailsCardParams) { { !showSummary ? <> - : <> -
-
-
-

{ visualizedPersonalSignRequest.rawMessage }

-
-
-
- + : + + +
 { decodeMessage(visualizedPersonalSignRequest.stringifiedMessage) }
+
+ +
{ visualizedPersonalSignRequest.rawMessage }
+
+
+ +
} } @@ -429,7 +427,7 @@ export function SignatureCard(params: SignatureCardParams) { - + { params.visualizedPersonalSignRequest.type === 'NotParsed' ? <> : }

Transaction Input

- - { parsedInputData?.type === 'Parsed' ? ( - <> - - - - - -
{ dataStringWith0xStart(transaction.input) }
-
-
- - - ) :

No ABI available

} -
+ diff --git a/app/ts/components/subcomponents/ParsedInputData.tsx b/app/ts/components/subcomponents/ParsedInputData.tsx new file mode 100644 index 00000000..962397e1 --- /dev/null +++ b/app/ts/components/subcomponents/ParsedInputData.tsx @@ -0,0 +1,47 @@ +import { EnrichedEthereumInputData } from '../../types/EnrichedEthereumData.js' +import { AddressBookEntry } from '../../types/addressBookTypes.js' +import { RenameAddressCallBack } from '../../types/user-interface-types.js' +import { dataStringWith0xStart } from '../../utils/bigint.js' +import { ParsedInputData } from '../simulationExplaining/Transactions.js' +import { ViewSelector } from './ViewSelector.js' +import { SmallAddress } from './address.js' + +type TransactionInputParams = { + addressMetaData: readonly AddressBookEntry[] + parsedInputData: EnrichedEthereumInputData + input: Uint8Array + to: AddressBookEntry | undefined + renameAddressCallBack: RenameAddressCallBack +} +export function TransactionInput({ parsedInputData, input, to, addressMetaData, renameAddressCallBack }: TransactionInputParams) { + return + { parsedInputData?.type === 'Parsed' ? ( <> + + + + + +
{ dataStringWith0xStart(input) }
+
+
+ + ) : <> + + +
+ { to !== undefined ? <> +

No ABI available for 

+ + : <> +

No ABI available

+ } +
+
+ +
{ dataStringWith0xStart(input) }
+
+
+ + } +
+} diff --git a/app/ts/components/subcomponents/ViewSelector.tsx b/app/ts/components/subcomponents/ViewSelector.tsx index b3dd4dfe..b9c18fc8 100644 --- a/app/ts/components/subcomponents/ViewSelector.tsx +++ b/app/ts/components/subcomponents/ViewSelector.tsx @@ -28,7 +28,6 @@ export const ViewSelector = ({ children, id }: { children: ComponentChildren, id ) } - const useViewSwitcher = () => { const context = useContext(ViewSelectorContext) if (context === undefined) throw new Error('useViewSwitcher can only be used within children of DisplayRoot') diff --git a/app/ts/types/personal-message-definitions.ts b/app/ts/types/personal-message-definitions.ts index aecb1381..bf990a04 100644 --- a/app/ts/types/personal-message-definitions.ts +++ b/app/ts/types/personal-message-definitions.ts @@ -364,6 +364,7 @@ const PersonalSignRequestBase = funtypes.ReadonlyObject({ website: Website, created: EthereumTimestamp, rawMessage: funtypes.String, + stringifiedMessage: funtypes.String, messageIdentifier: EthereumQuantity, })