Implemented review

pull/200/head
Vladimir Volek 6 years ago
parent 434c86dc8c
commit 31889270a0

@ -25,7 +25,7 @@
], ],
"env": { "env": {
"test": { "test": {
"presets": ["jest"] "presets": ["jest"]
} }
} }
} }

@ -127,6 +127,7 @@ const getAccountStatus = (state: State, selectedAccount: SelectedAccountState):
shouldRender: true, shouldRender: true,
}; };
} }
if (!device.available) { if (!device.available) {
return { return {
type: 'info', type: 'info',

@ -23,10 +23,13 @@ export const sign = (
hex: boolean = false, hex: boolean = false,
): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => { ): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
const selected = getState().wallet.selectedDevice; const selected = getState().wallet.selectedDevice;
const devicePath = selected.path; if (!selected) return;
const input = {
dispatch({ type: SIGN_VERIFY.SIGN_PROGRESS, isSignProgress: true });
const response = await TrezorConnect.ethereumSignMessage({
device: { device: {
path: devicePath, path: selected.path,
instance: selected.instance, instance: selected.instance,
state: selected.state, state: selected.state,
}, },
@ -34,11 +37,7 @@ export const sign = (
hex, hex,
message, message,
useEmptyPassphrase: selected.useEmptyPassphrase, useEmptyPassphrase: selected.useEmptyPassphrase,
}; });
dispatch({ type: SIGN_VERIFY.SIGN_PROGRESS, isSignProgress: true });
const response = await TrezorConnect.ethereumSignMessage(input);
dispatch({ type: SIGN_VERIFY.SIGN_PROGRESS, isSignProgress: false }); dispatch({ type: SIGN_VERIFY.SIGN_PROGRESS, isSignProgress: false });
@ -74,15 +73,19 @@ export const verify = (
hex: boolean = false, hex: boolean = false,
): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => { ): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
const selected = getState().wallet.selectedDevice; const selected = getState().wallet.selectedDevice;
const input = { if (!selected) return;
const response = await TrezorConnect.ethereumVerifyMessage({
device: {
path: selected.path,
instance: selected.instance,
state: selected.state,
},
address, address,
message, message,
signature, signature,
hex, hex,
useEmptyPassphrase: selected.useEmptyPassphrase, useEmptyPassphrase: selected.useEmptyPassphrase,
}; });
const response = await TrezorConnect.ethereumVerifyMessage(input);
if (response && response.success) { if (response && response.success) {
dispatch({ dispatch({

Loading…
Cancel
Save