Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@GrandSchtroumpf
Created April 12, 2018 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrandSchtroumpf/8ccd416aa35b8809b8063e1be9bde6f6 to your computer and use it in GitHub Desktop.
Save GrandSchtroumpf/8ccd416aa35b8809b8063e1be9bde6f6 to your computer and use it in GitHub Desktop.
The NGRX actions to work with Ethereum accounts
import { Action } from '@ngrx/store';
/**
* TYPES
*/
export const GET_ACCOUNTS = '[Eth] Get Accounts';
export const GET_ACCOUNTS_SUCCESS = '[Eth] Get Accounts Success';
export const SELECT_ACCOUNT = '[Eth] Select Account';
export const ETH_ERROR = '[Eth] Error';
/**
* ACTIONS
*/
export class GetAccounts implements Action {
readonly type = GET_ACCOUNTS;
}
export class GetAccountsSuccess implements Action {
readonly type = GET_ACCOUNTS_SUCCESS;
constructor(public payload: string[]){}
}
export class SelectAccount implements Action {
readonly type = SELECT_ACCOUNT;
constructor(public payload: string) {}
}
export class EthError implements Action {
readonly type = ETH_ERROR;
constructor(public payload: any) {}
}
export type AccountsActions =
| GetAccounts
| GetAccountsSuccess
| SelectAccount
| EthError;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment