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",
"decimals": 18,
"image": "0x.svg",
"unlisted": false
}, },
"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": { {
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", asset: {
"symbol": "AST", 'address': '0xB8c77482e45F1F44dE1745F52C74426C631bDD52',
"decimals": 18, 'symbol': '0X',
"image": "ast.png", 'decimals': 18,
"unlisted": false 'image': '0x.svg',
'unlisted': false
}, },
"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": {
"address": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"symbol": "BAT",
"decimals": 18,
"image": "BAT_icon.svg",
"unlisted": false
}, },
"0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1": { {
"address": "0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1", asset: {
"symbol": "CVL", 'address': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
"decimals": 18, 'symbol': 'AST',
"image": "CVL_token.svg", 'decimals': 18,
"unlisted": false 'image': 'ast.png',
'unlisted': false
}, },
"0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e": {
"address": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e",
"symbol": "GLA",
"decimals": 18,
"image": "gladius.svg",
"unlisted": false
}, },
"0x467Bccd9d29f223BcE8043b84E8C8B282827790F": { {
"address": "0x467Bccd9d29f223BcE8043b84E8C8B282827790F", asset: {
"symbol": "GNO", 'address': '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2',
"decimals": 18, 'symbol': 'BAT',
"image": "gnosis.svg", 'decimals': 18,
"unlisted": false 'image': 'BAT_icon.svg',
'unlisted': false
}, },
"0xff20817765cb7f73d4bde2e66e067e58d11095c2": {
"address": "0xff20817765cb7f73d4bde2e66e067e58d11095c2",
"symbol": "OMG",
"decimals": 18,
"image": "omg.jpg",
"unlisted": false
}, },
"0x8e870d67f660d95d5be530380d0ec0bd388289e1": { {
"address": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", asset: {
"symbol": "WED", 'address': '0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1',
"decimals": 18, 'symbol': 'CVL',
"image": "wed.png", 'decimals': 18,
"unlisted": false 'image': 'CVL_token.svg',
'unlisted': false
}, },
} },
{
asset: {
'address': '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e',
'symbol': 'GLA',
'decimals': 18,
'image': 'gladius.svg',
'unlisted': false
},
},
{
asset: {
'address': '0x467Bccd9d29f223BcE8043b84E8C8B282827790F',
'symbol': 'GNO',
'decimals': 18,
'image': 'gnosis.svg',
'unlisted': false
},
},
{
asset: {
'address': '0xff20817765cb7f73d4bde2e66e067e58d11095c2',
'symbol': 'OMG',
'decimals': 18,
'image': 'omg.jpg',
'unlisted': false
},
},
{
asset: {
'address': '0x8e870d67f660d95d5be530380d0ec0bd388289e1',
'symbol': 'WED',
'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,
}), }),
), ),
); );