|
|
@ -3,7 +3,7 @@ import React, { useEffect } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
import { createBrowserHistory } from 'history'; |
|
|
|
import { createBrowserHistory } from 'history'; |
|
|
|
import { text } from '@storybook/addon-knobs'; |
|
|
|
import { text } from '@storybook/addon-knobs'; |
|
|
|
import { store } from '../../../.storybook/preview'; |
|
|
|
import { store, getNewState } from '../../../.storybook/preview'; |
|
|
|
import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token'; |
|
|
|
import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token'; |
|
|
|
import { updateMetamaskState } from '../../store/actions'; |
|
|
|
import { updateMetamaskState } from '../../store/actions'; |
|
|
|
import ConfirmAddToken from '.'; |
|
|
|
import ConfirmAddToken from '.'; |
|
|
@ -23,14 +23,28 @@ const PageSet = ({ children }) => { |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
const pendingTokens = { ...pendingTokensState }; |
|
|
|
const pendingTokens = { ...pendingTokensState }; |
|
|
|
pendingTokens['0x33f90dee07c6e8b9682dd20f73e6c358b2ed0f03'].symbol = symbol; |
|
|
|
pendingTokens['0x33f90dee07c6e8b9682dd20f73e6c358b2ed0f03'].symbol = symbol; |
|
|
|
store.dispatch(updateMetamaskState({ pendingTokens })); |
|
|
|
store.dispatch( |
|
|
|
}, [symbol, pendingTokensState]); |
|
|
|
updateMetamaskState( |
|
|
|
|
|
|
|
getNewState(state.metamask, { |
|
|
|
|
|
|
|
pendingTokens, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, [symbol, pendingTokensState, state.metamask]); |
|
|
|
|
|
|
|
|
|
|
|
return children; |
|
|
|
return children; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const AddToken = () => { |
|
|
|
export const AddToken = () => { |
|
|
|
store.dispatch(updateMetamaskState({ pendingTokens: tokens })); |
|
|
|
const { metamask: state } = store.getState(); |
|
|
|
|
|
|
|
store.dispatch( |
|
|
|
|
|
|
|
updateMetamaskState( |
|
|
|
|
|
|
|
getNewState(state, { |
|
|
|
|
|
|
|
pendingTokens: tokens, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<PageSet> |
|
|
|
<PageSet> |
|
|
|
<ConfirmAddToken history={history} /> |
|
|
|
<ConfirmAddToken history={history} /> |
|
|
|