1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-13 20:08:56 +00:00
trezor-wallet/src/js/actions/AddressActions.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-04-16 21:19:50 +00:00
/* @flow */
'use strict';
import * as ADDRESS from './constants/address';
2018-04-23 10:20:15 +00:00
import type { Action, TrezorDevice } from '../flowtype';
import type { State } from '../reducers/AccountsReducer';
2018-04-16 21:19:50 +00:00
2018-04-23 10:20:15 +00:00
export type AddressAction =
AddressFromStorageAction
| AddressCreateAction
| AddressSetBalanceAction
| AddressSetNonceAction;
export type AddressFromStorageAction = {
type: typeof ADDRESS.FROM_STORAGE,
payload: State
}
export type AddressCreateAction = {
2018-04-16 21:19:50 +00:00
type: typeof ADDRESS.CREATE,
2018-04-23 10:20:15 +00:00
device: TrezorDevice,
network: string,
index: number,
path: Array<number>,
address: string
}
export type AddressSetBalanceAction = {
2018-04-16 21:19:50 +00:00
type: typeof ADDRESS.SET_BALANCE,
2018-04-23 10:20:15 +00:00
address: string,
network: string,
balance: string
}
export type AddressSetNonceAction = {
2018-04-16 21:19:50 +00:00
type: typeof ADDRESS.SET_NONCE,
2018-04-23 10:20:15 +00:00
address: string,
network: string,
nonce: number
}
export const setBalance = (address: string, network: string, balance: string): Action => {
return {
type: ADDRESS.SET_BALANCE,
address,
network,
balance
}
2018-04-16 21:19:50 +00:00
}