Unverified Commit f3499fb2 authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub

chore: improve parsing message error (#688)

* chore: add warnings when there is a false raw data

* Update decoders.ts
parent fe5f03f9
Pipeline #105717 failed with stages
in 3 minutes and 10 seconds
......@@ -7,6 +7,8 @@ const strings = {
ERROR_NO_SENDER_FOUND: 'There is no related account in the app',
ERROR_NO_SENDER_IDENTITY: 'There is no related identity in the app',
ERROR_TITLE: 'Unable to parse QR data',
'Frames number is too big, the QR seems not to be a recognized extrinsic raw data',
INFO_ETH_TX: 'You are about to send the following amount',
'You are about to send the following extrinsic. We will sign the hash of the payload as it is oversized.',
......@@ -110,6 +110,7 @@ export async function constructDataFromBytes(
const frameInfo = hexStripPrefix(u8aToHex(bytes.slice(0, 5)));
const frameCount = parseInt(frameInfo.substr(2, 4), 16);
const isMultipart = frameCount > 1; // for simplicity, even single frame payloads are marked as multipart.
if (frameCount > 50) throw new Error(strings.ERROR_WRONG_RAW);
const currentFrame = parseInt(frameInfo.substr(6, 4), 16);
const uosAfterFrames = hexStripPrefix(u8aToHex(bytes.slice(5)));
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