Allow QR signing and add error when the account has no genesis (#1155)
* revert to QR signing and add error when account has no genesis * use genesis from account props * remove unused imports
This commit is contained in:
@@ -17,12 +17,11 @@ 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, isSignable, setError, signId }: Props): JSX.Element {
|
||||
function SignArea ({ buttonText, className, error, isExternal, isFirst, setError, signId }: Props): JSX.Element {
|
||||
const [savePass, setSavePass] = useState(false);
|
||||
const [isLocked, setIsLocked] = useState<boolean | null>(null);
|
||||
const [password, setPassword] = useState('');
|
||||
@@ -97,7 +96,7 @@ function SignArea ({ buttonText, className, error, isExternal, isFirst, isSignab
|
||||
|
||||
return (
|
||||
<ButtonArea className={className}>
|
||||
{isSignable && isFirst && !isExternal && (
|
||||
{isFirst && !isExternal && (
|
||||
<>
|
||||
{isLocked && (
|
||||
<Unlock
|
||||
|
||||
@@ -43,7 +43,7 @@ function isRawPayload (payload: SignerPayloadJSON | SignerPayloadRaw): payload i
|
||||
return !!(payload as SignerPayloadRaw).data;
|
||||
}
|
||||
|
||||
export default function Request ({ account: { accountIndex, addressOffset, isExternal, isHardware }, buttonText, isFirst, request, signId, url }: Props): React.ReactElement<Props> | null {
|
||||
export default function Request ({ account: { accountIndex, addressOffset, genesisHash, isExternal, isHardware }, buttonText, isFirst, request, signId, url }: Props): React.ReactElement<Props> | null {
|
||||
const onAction = useContext(ActionContext);
|
||||
const [{ hexBytes, payload }, setData] = useState<Data>({ hexBytes: null, payload: null });
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -126,7 +126,6 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
error={error}
|
||||
isExternal={isExternal}
|
||||
isFirst={isFirst}
|
||||
isSignable
|
||||
setError={setError}
|
||||
signId={signId}
|
||||
/>
|
||||
@@ -143,27 +142,39 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
|
||||
isExternal={isExternal}
|
||||
/>
|
||||
</div>
|
||||
<Bytes
|
||||
bytes={data}
|
||||
url={url}
|
||||
/>
|
||||
{isExternal && !isHardware && genesisHash
|
||||
? (
|
||||
<Qr
|
||||
address={address}
|
||||
cmd={CMD_SIGN_MESSAGE}
|
||||
genesisHash={genesisHash}
|
||||
onSignature={_onSignature}
|
||||
payload={data}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<Bytes
|
||||
bytes={data}
|
||||
url={url}
|
||||
/>
|
||||
)
|
||||
}
|
||||
<VerticalSpace />
|
||||
{(isHardware || isExternal) && (
|
||||
{isExternal && !isHardware && !genesisHash && (
|
||||
<>
|
||||
<Warning>{
|
||||
isHardware
|
||||
? t('Raw data signing is not supported for hardware wallets.')
|
||||
: t('Raw data signing is not supported for QR wallets.')
|
||||
}</Warning>
|
||||
<Warning isDanger>{t('"Allow use on any network" is not supported to show a QR code. You must associate this account with a network.')}</Warning>
|
||||
<VerticalSpace />
|
||||
</>
|
||||
)}
|
||||
{isHardware && <>
|
||||
<Warning>{t('Message signing is not supported for hardware wallets.')}</Warning>
|
||||
<VerticalSpace />
|
||||
</>}
|
||||
<SignArea
|
||||
buttonText={buttonText}
|
||||
error={error}
|
||||
isExternal={isExternal}
|
||||
isFirst={isFirst}
|
||||
isSignable={!isHardware && !isExternal}
|
||||
setError={setError}
|
||||
signId={signId}
|
||||
/>
|
||||
|
||||
@@ -161,10 +161,6 @@
|
||||
"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 QR wallets.": "",
|
||||
"Raw data signing is not supported for hardware wallets.": "",
|
||||
"Raw data signing is not supported for QR wallets.": "",
|
||||
"Select all": "",
|
||||
"Accounts connected to {{url}}": "",
|
||||
"Connect {{total}} account(s)": "",
|
||||
@@ -173,5 +169,6 @@
|
||||
"Understood": "",
|
||||
"Ask again later": "",
|
||||
"no accounts": "",
|
||||
"all accounts": ""
|
||||
"all accounts": "",
|
||||
"Message signing is not supported for hardware wallets.": ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user