import actionCreatorFactory , { ActionCreator } from 'typescript-fsa' ; import { SharedState } from '../../worker/WorkerState' ; import { Store } from 'redux' ; import { FrameState , TempState , WalletState } from './FrameState' ; import WorkerProxy from "../WorkerProxy" ; const actionCreator = actionCreatorFactory ( "frame" ) ; export const setSharedState = actionCreator < SharedState > ( "shared/setSharedState" ) ; export function setSharedStateHandler ( state , sharedState ) { return sharedState ; } export const setPending = actionCreator < boolean > ( "shared/setPending" ) ; export function setPendingHandler ( state , isTransactionPending ) { let pendingDate = 0 ; if ( isTransactionPending ) { pendingDate = Date . now ( ) ; } return { ... state , isTransactionPending : pendingDate } ; } export const didReceiveMnemonic = actionCreator < string > ( "temp/didReceiveMnemonic" ) ; export function didReceiveMnemonicHandler ( state , mnemonic ) { return { ... state , initPage : { ... state . initPage , mnemonic : mnemonic } } ; } export const didStoreMnemonic = actionCreator < string > ( "temp/didStoreMnemonic" ) ; export function didStoreMnemonicHandler ( state , mnemonic ) { return { ... state , initPage : { ... state . initPage , showInitialDeposit : true } } ; } export const didAcknowledgeDeposit = actionCreator < string > ( "temp/didAcknowledgeDeposit" ) ; export function didAcknowledgeDepositHandler ( state , mnemonic ) { return { ... state , initPage : { ... state . initPage , mnemonic : null , showInitialDeposit : false } } ; } export const setWorkerProxy = actionCreator < WorkerProxy > ( "temp/setWorkerProxy" ) ; export function setWorkerProxyHandler ( state , workerProxy ) { return { ... state , workerProxy : workerProxy } ; } export const updateBalance = actionCreator < string > ( "wallet/updateBalance" ) ; export function updateBalanceHandler ( state , balance ) { return { ... state , main : { ... state . main , balance , } , } ; } export const updateAddress = actionCreator < string > ( "wallet/updateAddress" ) ; export function updateAddressHandler ( state , address ) { return { ... state , main : { ... state . main , address , } , } ; }