A Metamask fork with Infura removed and default networks editable
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.
ciphermask/ui/pages/confirm-encryption-public-key/confirm-encryption-public-k...

48 lines
1.2 KiB

import React, { useEffect } from 'react';
import { select } from '@storybook/addon-knobs';
import { store, getNewState } from '../../../.storybook/preview';
import { updateMetamaskState } from '../../store/actions';
import ConfirmEncryptionPublicKey from '.';
export default {
title: 'Confirmation Screens',
id: __filename,
};
const PageSet = ({ children }) => {
const state = store.getState();
const options = [];
const { identities, unapprovedEncryptionPublicKeyMsgs } = state.metamask;
Object.keys(identities).forEach(function (key) {
options.push({
label: identities[key].name,
name: identities[key].name,
address: key,
});
});
const account = select('Account', options, options[0]);
useEffect(() => {
unapprovedEncryptionPublicKeyMsgs['7786962153682822'].msgParams =
account.address;
store.dispatch(
updateMetamaskState(
getNewState(state.metamask, {
unapprovedEncryptionPublicKeyMsgs,
}),
),
);
}, [account, unapprovedEncryptionPublicKeyMsgs, state.metamask]);
return children;
};
export const ConfirmEncryption = () => {
return (
<PageSet>
<ConfirmEncryptionPublicKey />
</PageSet>
);
};