You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/src/js/actions/ModalActions.js

77 lines
1.6 KiB

/* @flow */
'use strict';
import TrezorConnect, { UI, UI_EVENT } from 'trezor-connect';
import * as ACTIONS from './index';
import * as MODAL from './constants/Modal';
import * as CONNECT from './constants/TrezorConnect';
export function onPinSubmit(value: string): any {
TrezorConnect.uiMessage({ type: UI.RECEIVE_PIN, data: value });
return {
type: ACTIONS.CLOSE_MODAL
}
}
export function onPassphraseSubmit(passphrase: string): any {
return async (dispatch, getState): Promise<void> => {
const resp = await TrezorConnect.uiMessage({
type: UI.RECEIVE_PASSPHRASE,
data: {
value: passphrase,
save: true
}
});
dispatch({
type: ACTIONS.CLOSE_MODAL
});
}
}
export const askForRemember = (device: any) => {
return {
type: MODAL.REMEMBER,
device
}
}
export const onRememberDevice = (device: any) => {
return {
type: CONNECT.REMEMBER,
device
}
}
export const onForgetDevice = (device: any) => {
return {
type: CONNECT.FORGET,
device,
}
}
export const onForgetSingleDevice = (device: any) => {
return {
type: CONNECT.FORGET_SINGLE,
device,
}
}
export const onCancel = () => {
return {
type: ACTIONS.CLOSE_MODAL
}
}
export const onDuplicateDevice = (device: any): any => {
return (dispatch: any, getState: any): void => {
dispatch( onCancel() );
dispatch({
type: CONNECT.DUPLICATE,
device
});
}
}