Skip to content

Commit

Permalink
Merge pull request #400 from Concordium/fix-sign-message-rendered
Browse files Browse the repository at this point in the history
Fix sign message rendered message display
  • Loading branch information
shjortConcordium authored Nov 6, 2023
2 parents 1ec7231 + 9488200 commit 23ffe62
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.1.11

### Fixed

- Sign message's rendered view displaying 'a' when deserialization failed.
- Sign message's stringification failing with new `deserializeTypeValue`.

## 1.1.10

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { addToastAtom } from '@popup/state';
import ExternalRequestLayout from '@popup/page-layouts/ExternalRequestLayout';
import TabBar from '@popup/shared/TabBar';
import clsx from 'clsx';
import { stringify } from 'json-bigint';

type Props = {
onSubmit(signature: AccountTransactionSignature): void;
Expand Down Expand Up @@ -47,13 +48,13 @@ function BinaryDisplay({ message, url }: { message: MessageObject; url: string }

const parsedMessage = useMemo(() => {
try {
return JSON.stringify(
return stringify(
deserializeTypeValue(Buffer.from(message.data, 'hex'), Buffer.from(message.schema, 'base64')),
undefined,
2
);
} catch (e) {
return 'a';
return t('unableToDeserialize');
}
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const t: typeof en = {
descriptionWithSchema:
'{{ dApp }} har sendt en rå besked og et schema til at oversætte den. Vi har oversat beskeden, men du burde kun underskrive hvis du stoler på {{ dApp }}',
deserializedDisplay: 'Oversat',
unableToDeserialize: 'Det var ikke muligt at oversætte beskeden',
rawDisplay: 'Rå',
sign: 'Signér',
reject: 'Afvis',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const t = {
descriptionWithSchema:
"{{ dApp }} has provided the raw message and a schema to render it. We've rendered the message but you should only sign it if you trust {{ dApp }}.",
deserializedDisplay: 'Rendered',
unableToDeserialize: 'Unable to render message',
rawDisplay: 'Raw',
sign: 'Sign',
reject: 'Reject',
Expand Down

0 comments on commit 23ffe62

Please sign in to comment.