mirror of https://github.com/trezor/trezor-wallet
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.
62 lines
1.4 KiB
62 lines
1.4 KiB
/* @flow */
|
|
'use strict';
|
|
|
|
import * as ACCOUNT from './constants/account';
|
|
import type { Action, TrezorDevice } from '~/flowtype';
|
|
import type { State } from '../reducers/AccountsReducer';
|
|
|
|
export type AccountAction =
|
|
AccountFromStorageAction
|
|
| AccountCreateAction
|
|
| AccountSetBalanceAction
|
|
| AccountSetNonceAction;
|
|
|
|
export type AccountFromStorageAction = {
|
|
type: typeof ACCOUNT.FROM_STORAGE,
|
|
payload: State
|
|
}
|
|
|
|
export type AccountCreateAction = {
|
|
type: typeof ACCOUNT.CREATE,
|
|
device: TrezorDevice,
|
|
network: string,
|
|
index: number,
|
|
path: Array<number>,
|
|
address: string
|
|
}
|
|
|
|
export type AccountSetBalanceAction = {
|
|
type: typeof ACCOUNT.SET_BALANCE,
|
|
address: string,
|
|
network: string,
|
|
deviceState: string,
|
|
balance: string
|
|
}
|
|
|
|
export type AccountSetNonceAction = {
|
|
type: typeof ACCOUNT.SET_NONCE,
|
|
address: string,
|
|
network: string,
|
|
deviceState: string,
|
|
nonce: number
|
|
}
|
|
|
|
export const setBalance = (address: string, network: string, deviceState: string, balance: string): Action => {
|
|
return {
|
|
type: ACCOUNT.SET_BALANCE,
|
|
address,
|
|
network,
|
|
deviceState,
|
|
balance
|
|
}
|
|
}
|
|
|
|
export const setNonce = (address: string, network: string, deviceState: string, nonce: number): Action => {
|
|
return {
|
|
type: ACCOUNT.SET_NONCE,
|
|
address,
|
|
network,
|
|
deviceState,
|
|
nonce
|
|
}
|
|
} |