mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Add token standard to custom token details (#14506)
* use getTokenStandardAndDetails to get token standard * remove console.log and fix test * remove console.log
This commit is contained in:
parent
223124a561
commit
7a9662b88e
@ -13,7 +13,6 @@ import { MetaMetricsContext } from '../../contexts/metametrics';
|
||||
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
||||
import { getPendingTokens } from '../../ducks/metamask/metamask';
|
||||
import { addTokens, clearPendingTokens } from '../../store/actions';
|
||||
import { TOKEN_STANDARDS } from '../../helpers/constants/common';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { ASSET_TYPES } from '../../../shared/constants/transaction';
|
||||
|
||||
@ -46,7 +45,7 @@ const ConfirmImportToken = () => {
|
||||
token_decimal_precision: pendingToken.decimals,
|
||||
unlisted: pendingToken.unlisted,
|
||||
source: pendingToken.isCustom ? 'custom' : 'list',
|
||||
token_standard: TOKEN_STANDARDS.ERC20,
|
||||
token_standard: pendingToken.standard,
|
||||
asset_type: ASSET_TYPES.TOKEN,
|
||||
},
|
||||
});
|
||||
|
@ -23,6 +23,7 @@ import ActionableMessage from '../../components/ui/actionable-message/actionable
|
||||
import Typography from '../../components/ui/typography';
|
||||
import { TYPOGRAPHY, FONT_WEIGHT } from '../../helpers/constants/design-system';
|
||||
import Button from '../../components/ui/button';
|
||||
import { TOKEN_STANDARDS } from '../../helpers/constants/common';
|
||||
import TokenSearch from './token-search';
|
||||
import TokenList from './token-list';
|
||||
|
||||
@ -126,6 +127,7 @@ class ImportToken extends Component {
|
||||
customDecimals: 0,
|
||||
searchResults: [],
|
||||
selectedTokens: {},
|
||||
standard: TOKEN_STANDARDS.NONE,
|
||||
tokenSelectorError: null,
|
||||
customAddressError: null,
|
||||
customSymbolError: null,
|
||||
@ -231,12 +233,14 @@ class ImportToken extends Component {
|
||||
customSymbol: symbol,
|
||||
customDecimals: decimals,
|
||||
selectedTokens,
|
||||
standard,
|
||||
} = this.state;
|
||||
|
||||
const customToken = {
|
||||
address,
|
||||
symbol,
|
||||
decimals,
|
||||
standard,
|
||||
};
|
||||
|
||||
setPendingTokens({ customToken, selectedTokens, tokenAddressList });
|
||||
@ -281,7 +285,7 @@ class ImportToken extends Component {
|
||||
const isMainnetNetwork = this.props.chainId === '0x1';
|
||||
|
||||
let standard;
|
||||
if (addressIsValid && process.env.COLLECTIBLES_V1) {
|
||||
if (addressIsValid) {
|
||||
try {
|
||||
({ standard } = await this.props.getTokenStandardAndDetails(
|
||||
standardAddress,
|
||||
@ -353,6 +357,9 @@ class ImportToken extends Component {
|
||||
default:
|
||||
if (!addressIsEmpty) {
|
||||
this.attemptToAutoFillTokenParams(customAddress);
|
||||
if (standard) {
|
||||
this.setState({ standard });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +132,7 @@ describe('Import Token', () => {
|
||||
customToken: {
|
||||
address: tokenAddress,
|
||||
decimals: Number(tokenPrecision),
|
||||
standard: 'ERC20',
|
||||
symbol: tokenSymbol,
|
||||
},
|
||||
selectedTokens: {},
|
||||
|
Loading…
Reference in New Issue
Block a user