[Parity Signer] Add future support for ERC-681 (#1945)
* Add future support for ERC-681 * Use `addHexPrefix`
This commit is contained in:
parent
fbe792a58f
commit
4aa74a4087
|
@ -17,6 +17,13 @@ interface Props {
|
||||||
onUnlock(param: any): void;
|
onUnlock(param: any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface SignerAddress {
|
||||||
|
address: string;
|
||||||
|
chainId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
type SignerQrContent = SignerAddress | string;
|
||||||
|
|
||||||
class ParitySignerDecryptClass extends PureComponent<Props> {
|
class ParitySignerDecryptClass extends PureComponent<Props> {
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
|
@ -36,13 +43,13 @@ class ParitySignerDecryptClass extends PureComponent<Props> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private unlockAddress = (address: string) => {
|
private unlockAddress = (content: SignerQrContent) => {
|
||||||
if (!isValidETHAddress(address)) {
|
if (typeof content === 'string' || !isValidETHAddress(content.address)) {
|
||||||
this.props.showNotification('danger', 'Not a valid address!');
|
this.props.showNotification('danger', 'Not a valid address!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.onUnlock(new ParitySignerWallet(address));
|
this.props.onUnlock(new ParitySignerWallet(content.address));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { addHexPrefix } from 'ethereumjs-util';
|
||||||
import translate, { translateRaw } from 'translations';
|
import translate, { translateRaw } from 'translations';
|
||||||
import { AppState } from 'features/reducers';
|
import { AppState } from 'features/reducers';
|
||||||
import { paritySignerActions } from 'features/paritySigner';
|
import { paritySignerActions } from 'features/paritySigner';
|
||||||
|
@ -95,7 +95,7 @@ class QrSignerModal extends React.Component<Props, State> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.finalizeSignature(signature);
|
this.props.finalizeSignature(addHexPrefix(signature));
|
||||||
this.setState({ scan: false });
|
this.setState({ scan: false });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
"npm": ">= 5.0.0"
|
"npm": ">= 5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@parity/qr-signer": "0.3.1",
|
||||||
"@ledgerhq/hw-app-eth": "4.7.3",
|
"@ledgerhq/hw-app-eth": "4.7.3",
|
||||||
"@ledgerhq/hw-transport-node-hid": "4.7.6",
|
"@ledgerhq/hw-transport-node-hid": "4.7.6",
|
||||||
"@ledgerhq/hw-transport-u2f": "4.12.0",
|
"@ledgerhq/hw-transport-u2f": "4.12.0",
|
||||||
"@parity/qr-signer": "0.2.1",
|
|
||||||
"babel-polyfill": "6.26.0",
|
"babel-polyfill": "6.26.0",
|
||||||
"bip39": "2.5.0",
|
"bip39": "2.5.0",
|
||||||
"bn.js": "4.11.8",
|
"bn.js": "4.11.8",
|
||||||
|
|
Loading…
Reference in New Issue