feat(shielded): add shielded transactions service
This commit is contained in:
parent
ceda64291b
commit
e3a35d0c4a
|
@ -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 || '',
|
||||
}),
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue