1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Fixing confirm-add-suggested-token storybook entry (#12261)

This commit is contained in:
ryanml 2021-10-01 09:07:29 -07:00 committed by GitHub
parent 9355fb21c7
commit c14f46eb92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 70 deletions

View File

@ -1,65 +1,83 @@
export const suggestedTokens = { export const suggestedAssets = [
"0x6b175474e89094c44da98b954eedeac495271d0f": { {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f", asset: {
"symbol": "META", address: '0x6b175474e89094c44da98b954eedeac495271d0f',
"decimals": 18, symbol: 'META',
"image": "metamark.svg", decimals: 18,
"unlisted": false image: 'metamark.svg',
unlisted: false
}, },
"0xB8c77482e45F1F44dE1745F52C74426C631bDD52": { },
"address": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", {
"symbol": "0X", asset: {
"decimals": 18, 'address': '0xB8c77482e45F1F44dE1745F52C74426C631bDD52',
"image": "0x.svg", 'symbol': '0X',
"unlisted": false 'decimals': 18,
'image': '0x.svg',
'unlisted': false
}, },
"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": { },
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", {
"symbol": "AST", asset: {
"decimals": 18, 'address': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
"image": "ast.png", 'symbol': 'AST',
"unlisted": false 'decimals': 18,
'image': 'ast.png',
'unlisted': false
}, },
"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": { },
"address": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2", {
"symbol": "BAT", asset: {
"decimals": 18, 'address': '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2',
"image": "BAT_icon.svg", 'symbol': 'BAT',
"unlisted": false 'decimals': 18,
'image': 'BAT_icon.svg',
'unlisted': false
}, },
"0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1": { },
"address": "0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1", {
"symbol": "CVL", asset: {
"decimals": 18, 'address': '0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1',
"image": "CVL_token.svg", 'symbol': 'CVL',
"unlisted": false 'decimals': 18,
'image': 'CVL_token.svg',
'unlisted': false
}, },
"0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e": { },
"address": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", {
"symbol": "GLA", asset: {
"decimals": 18, 'address': '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e',
"image": "gladius.svg", 'symbol': 'GLA',
"unlisted": false 'decimals': 18,
'image': 'gladius.svg',
'unlisted': false
}, },
"0x467Bccd9d29f223BcE8043b84E8C8B282827790F": { },
"address": "0x467Bccd9d29f223BcE8043b84E8C8B282827790F", {
"symbol": "GNO", asset: {
"decimals": 18, 'address': '0x467Bccd9d29f223BcE8043b84E8C8B282827790F',
"image": "gnosis.svg", 'symbol': 'GNO',
"unlisted": false 'decimals': 18,
'image': 'gnosis.svg',
'unlisted': false
}, },
"0xff20817765cb7f73d4bde2e66e067e58d11095c2": { },
"address": "0xff20817765cb7f73d4bde2e66e067e58d11095c2", {
"symbol": "OMG", asset: {
"decimals": 18, 'address': '0xff20817765cb7f73d4bde2e66e067e58d11095c2',
"image": "omg.jpg", 'symbol': 'OMG',
"unlisted": false 'decimals': 18,
'image': 'omg.jpg',
'unlisted': false
}, },
"0x8e870d67f660d95d5be530380d0ec0bd388289e1": { },
"address": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", {
"symbol": "WED", asset: {
"decimals": 18, 'address': '0x8e870d67f660d95d5be530380d0ec0bd388289e1',
"image": "wed.png", 'symbol': 'WED',
"unlisted": false 'decimals': 18,
'image': 'wed.png',
'unlisted': false
}, },
} },
]

View File

@ -816,7 +816,7 @@ const state = {
'0xaD6D458402F60fD3Bd25163575031ACDce07538D': './sai.svg', '0xaD6D458402F60fD3Bd25163575031ACDce07538D': './sai.svg',
}, },
hiddenTokens: [], hiddenTokens: [],
suggestedTokens: {}, suggestedAssets: {},
useNonceField: false, useNonceField: false,
usePhishDetect: true, usePhishDetect: true,
lostIdentities: {}, lostIdentities: {},

View File

@ -2,7 +2,7 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { text } from '@storybook/addon-knobs'; import { text } from '@storybook/addon-knobs';
import { store, getNewState } from '../../../.storybook/preview'; import { store, getNewState } from '../../../.storybook/preview';
import { suggestedTokens } from '../../../.storybook/initial-states/approval-screens/add-suggested-token'; import { suggestedAssets } from '../../../.storybook/initial-states/approval-screens/add-suggested-token';
import { updateMetamaskState } from '../../store/actions'; import { updateMetamaskState } from '../../store/actions';
import ConfirmAddSuggestedToken from '.'; import ConfirmAddSuggestedToken from '.';
@ -16,32 +16,28 @@ const PageSet = ({ children }) => {
const image = text('Icon URL', 'metamark.svg'); const image = text('Icon URL', 'metamark.svg');
const state = store.getState(); const state = store.getState();
const suggestedTokensState = state.metamask.suggestedTokens; const suggestedAssetsState = state.metamask.suggestedAssets;
useEffect(() => { useEffect(() => {
suggestedTokensState[ suggestedAssetsState[0].symbol = symbol;
'0x6b175474e89094c44da98b954eedeac495271d0f'
].symbol = symbol;
store.dispatch( store.dispatch(
updateMetamaskState( updateMetamaskState(
getNewState(state.metamask, { getNewState(state.metamask, {
suggestedTokens: suggestedTokensState, suggestedAssets: suggestedAssetsState,
}), }),
), ),
); );
}, [symbol, suggestedTokensState, state.metamask]); }, [symbol, suggestedAssetsState, state.metamask]);
useEffect(() => { useEffect(() => {
suggestedTokensState[ suggestedAssetsState[0].image = image;
'0x6b175474e89094c44da98b954eedeac495271d0f'
].image = image;
store.dispatch( store.dispatch(
updateMetamaskState( updateMetamaskState(
getNewState(state.metamask, { getNewState(state.metamask, {
suggestedTokens: suggestedTokensState, suggestedAssets: suggestedAssetsState,
}), }),
), ),
); );
}, [image, suggestedTokensState, state.metamask]); }, [image, suggestedAssetsState, state.metamask]);
return children; return children;
}; };
@ -51,7 +47,7 @@ export const AddSuggestedToken = () => {
store.dispatch( store.dispatch(
updateMetamaskState( updateMetamaskState(
getNewState(state.metamask, { getNewState(state.metamask, {
suggestedTokens, suggestedAssets,
}), }),
), ),
); );