Always pass hex to signRaw (#1945)

This commit is contained in:
Jaco Greeff 2019-11-25 21:24:14 +01:00 committed by GitHub
parent 0caf2071cf
commit 99834b3534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ import styled from 'styled-components';
import { web3FromSource } from '@polkadot/extension-dapp';
import { Button, Input, InputAddress, Output, Static } from '@polkadot/react-components';
import keyring from '@polkadot/ui-keyring';
import { hexToU8a, isFunction, isHex, stringToU8a, u8aToHex } from '@polkadot/util';
import { hexToU8a, isFunction, isHex, stringToHex, stringToU8a, u8aToHex } from '@polkadot/util';
import translate from './translate';
import Unlock from './Unlock';
@ -83,7 +83,13 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
setSignature('');
signer
.signRaw({ address: currentPair.address, data, type: 'bytes' })
.signRaw({
address: currentPair.address,
data: isHexData
? data
: stringToHex(data),
type: 'bytes'
})
.then(({ signature }): void => setSignature(signature));
} else {
setSignature(u8aToHex(