feat(shielded): add shielded transactions service

This commit is contained in:
George Lima 2019-02-11 10:39:57 -03:00
parent ceda64291b
commit e3a35d0c4a
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
// @flow
import electronStore from '../config/electron-store';
const STORE_KEY = 'SHIELDED_TRANSACTIONS';
type ShieldedTransaction = {|
category: 'send' | 'receive',
time: number,
address: string,
amount: number,
memo: ?string,
|};
// eslint-disable-next-line
export const listShieldedTransactions = (): Array<ShieldedTransaction> => electronStore.has(STORE_KEY) ? electronStore.get(STORE_KEY) : [];
export const saveShieldedTransaction = ({
category,
time,
address,
amount,
memo,
}: ShieldedTransaction): void => {
electronStore.set(
STORE_KEY,
listShieldedTransactions().concat({
category,
time,
address,
amount,
memo: memo || '',
}),
);
};