Drop support for QR signing (#1053)
* Drop support for QR signing * Adjust message display
This commit is contained in:
parent
1ee8964311
commit
0b52f56a25
@ -17,11 +17,12 @@ interface Props {
|
||||
error: string | null;
|
||||
isExternal?: boolean;
|
||||
isFirst: boolean;
|
||||
isSignable: boolean;
|
||||
setError: (value: string | null) => void;
|
||||
signId: string;
|
||||
}
|
||||
|
||||
function SignArea ({ buttonText, className, error, isExternal, isFirst, setError, signId }: Props): JSX.Element {
|
||||
function SignArea ({ buttonText, className, error, isExternal, isFirst, isSignable, setError, signId }: Props): JSX.Element {
|
||||
const [savePass, setSavePass] = useState(false);
|
||||
const [isLocked, setIsLocked] = useState<boolean | null>(null);
|
||||
const [password, setPassword] = useState('');
|
||||
@ -96,7 +97,7 @@ function SignArea ({ buttonText, className, error, isExternal, isFirst, setError
|
||||
|
||||
return (
|
||||
<ButtonArea className={className}>
|
||||
{isFirst && !isExternal && (
|
||||
{isSignable && isFirst && !isExternal && (
|
||||
<>
|
||||
{isLocked && (
|
||||
<Unlock
|
||||
|
||||
@ -9,9 +9,8 @@ import type { HexString } from '@polkadot/util/types';
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import { AccountContext, ActionContext, Address, VerticalSpace, Warning } from '../../../components';
|
||||
import { ActionContext, Address, VerticalSpace, Warning } from '../../../components';
|
||||
import { useTranslation } from '../../../components/translate';
|
||||
import { approveSignSignature } from '../../../messaging';
|
||||
import Bytes from '../Bytes';
|
||||
@ -48,7 +47,6 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
const onAction = useContext(ActionContext);
|
||||
const [{ hexBytes, payload }, setData] = useState<Data>({ hexBytes: null, payload: null });
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const { accounts } = useContext(AccountContext);
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect((): void => {
|
||||
@ -128,6 +126,7 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
error={error}
|
||||
isExternal={isExternal}
|
||||
isFirst={isFirst}
|
||||
isSignable
|
||||
setError={setError}
|
||||
signId={signId}
|
||||
/>
|
||||
@ -135,7 +134,6 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
);
|
||||
} else if (hexBytes !== null) {
|
||||
const { address, data } = request.payload as SignerPayloadRaw;
|
||||
const account = accounts.find((account) => decodeAddress(account.address).toString() === decodeAddress(address).toString());
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -145,33 +143,27 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
isExternal={isExternal}
|
||||
/>
|
||||
</div>
|
||||
{isExternal && !isHardware && account?.genesisHash
|
||||
? (
|
||||
<Qr
|
||||
address={address}
|
||||
cmd={CMD_SIGN_MESSAGE}
|
||||
genesisHash={account.genesisHash}
|
||||
onSignature={_onSignature}
|
||||
payload={data}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<Bytes
|
||||
bytes={data}
|
||||
url={url}
|
||||
/>
|
||||
)
|
||||
}
|
||||
<Bytes
|
||||
bytes={data}
|
||||
url={url}
|
||||
/>
|
||||
<VerticalSpace />
|
||||
{isHardware && <>
|
||||
<Warning>{t('Message signing is not supported for hardware wallets.')}</Warning>
|
||||
<VerticalSpace />
|
||||
</>}
|
||||
{(isHardware || isExternal) && (
|
||||
<>
|
||||
<Warning>{
|
||||
isHardware
|
||||
? t('Raw data signing is not supported for hardware wallets.')
|
||||
: t('Raw data signing is not supported for QR wallets.')
|
||||
}</Warning>
|
||||
<VerticalSpace />
|
||||
</>
|
||||
)}
|
||||
<SignArea
|
||||
buttonText={buttonText}
|
||||
error={error}
|
||||
isExternal={isExternal}
|
||||
isFirst={isFirst}
|
||||
isSignable={!isHardware && !isExternal}
|
||||
setError={setError}
|
||||
signId={signId}
|
||||
/>
|
||||
|
||||
@ -161,5 +161,8 @@
|
||||
"I want to export all my accounts": "",
|
||||
"Notifications": "",
|
||||
"Search by name or network...": "",
|
||||
"Message signing is not supported for hardware wallets.": ""
|
||||
"Message signing is not supported for hardware wallets.": "",
|
||||
"Message signing is not supported for QR wallets.": "",
|
||||
"Raw data signing is not supported for hardware wallets.": "",
|
||||
"Raw data signing is not supported for QR wallets.": ""
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user