MyCrypto/common/reducers/paritySigner.ts
Maciej Hirsz 307e941684 Parity Signer (#1349)
* Parity Signer Squashed

* ParitySigner to be a container

* Parity Signer: style and polish

* target blank on appstore links

* PR fixes

* Move QrSignerModal to SendTransaction container

* Rework redux, use signing saga

* Cleanup

* Use new logo, change helpLink

* Rework finalize actions and types a bit

* Webcam info + wiki link on unlock screen

* Make the Parity QR Signer its own component, that has error messaging and ismore robust about adding / removing cameras.

* Unneded l10n
2018-04-06 16:32:25 -05:00

40 lines
879 B
TypeScript

import { ParitySignerAction, RequestSignatureAction, TypeKeys } from 'actions/paritySigner';
export interface State {
requested?: QrSignatureState | null;
}
interface QrSignatureState {
from: string;
rlp: string;
}
export const INITIAL_STATE: State = {
requested: null
};
function requestSignature(state: State, action: RequestSignatureAction): State {
return {
...state,
requested: action.payload
};
}
function finalizeSignature(state: State): State {
return {
...state,
requested: null
};
}
export function paritySigner(state: State = INITIAL_STATE, action: ParitySignerAction): State {
switch (action.type) {
case TypeKeys.PARITY_SIGNER_REQUEST_SIGNATURE:
return requestSignature(state, action);
case TypeKeys.PARITY_SIGNER_FINALIZE_SIGNATURE:
return finalizeSignature(state);
default:
return state;
}
}