Display warning on mismatched genesisHash (#8522)

This commit is contained in:
Jaco 2022-12-12 18:22:31 +02:00 committed by GitHub
parent 556f524f70
commit 863a0d7535
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ interface Address {
address: string;
isAddress: boolean;
scanned: Scanned | null;
warning?: string;
warning?: string | null;
}
function QrModal ({ className = '', onClose, onStatusChange }: Props): React.ReactElement<Props> {
@ -61,14 +61,17 @@ function QrModal ({ className = '', onClose, onStatusChange }: Props): React.Rea
? scanned.content
: keyring.createFromUri(scanned.content, {}, 'sr25519').address,
isAddress: scanned.isAddress,
scanned
scanned,
warning: scanned.genesisHash && !api.genesisHash.eq(scanned.genesisHash)
? 'The genesisHash for the scanned account does not match the genesisHash of the connected chain. The account will not be available on this chain.'
: null
});
if (scanned.name) {
_onNameChange(scanned.name);
}
},
[_onNameChange]
[_onNameChange, api]
);
const _onError = useCallback(