mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Update UI for blocked tokens, use the latest dev gas api URL (#20625)
This commit is contained in:
parent
877e184b29
commit
4e14e179c8
@ -4694,6 +4694,9 @@
|
|||||||
"message": "We were unable to retrieve your $1 balance",
|
"message": "We were unable to retrieve your $1 balance",
|
||||||
"description": "This message communicates to the user that their balance of a given token is currently unavailable. $1 will be replaced by a token symbol"
|
"description": "This message communicates to the user that their balance of a given token is currently unavailable. $1 will be replaced by a token symbol"
|
||||||
},
|
},
|
||||||
|
"swapTokenNotAvailable": {
|
||||||
|
"message": "Token is not available to swap in this region"
|
||||||
|
},
|
||||||
"swapTokenToToken": {
|
"swapTokenToToken": {
|
||||||
"message": "Swap $1 to $2",
|
"message": "Swap $1 to $2",
|
||||||
"description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap."
|
"description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap."
|
||||||
|
@ -140,8 +140,7 @@ export const MMI_SWAPS_URL = 'https://metamask-institutional.io/swap';
|
|||||||
export const SWAPS_API_V2_BASE_URL = 'https://swap.metaswap.codefi.network';
|
export const SWAPS_API_V2_BASE_URL = 'https://swap.metaswap.codefi.network';
|
||||||
export const SWAPS_DEV_API_V2_BASE_URL = 'https://swap.dev-api.cx.metamask.io';
|
export const SWAPS_DEV_API_V2_BASE_URL = 'https://swap.dev-api.cx.metamask.io';
|
||||||
export const GAS_API_BASE_URL = 'https://gas-api.metaswap.codefi.network';
|
export const GAS_API_BASE_URL = 'https://gas-api.metaswap.codefi.network';
|
||||||
export const GAS_DEV_API_BASE_URL =
|
export const GAS_DEV_API_BASE_URL = 'https://gas.dev-api.cx.metamask.io';
|
||||||
'https://gas-api.metaswap-dev.codefi.network';
|
|
||||||
|
|
||||||
const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
|
const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
|
||||||
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
|
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
|
||||||
|
@ -155,7 +155,7 @@ export const getBaseApi = function (type, chainId) {
|
|||||||
case 'trade':
|
case 'trade':
|
||||||
return `${baseUrl}/trades?`;
|
return `${baseUrl}/trades?`;
|
||||||
case 'tokens':
|
case 'tokens':
|
||||||
return `${baseUrl}/tokens`;
|
return `${baseUrl}/tokens?includeBlockedTokens=true`;
|
||||||
case 'token':
|
case 'token':
|
||||||
return `${baseUrl}/token`;
|
return `${baseUrl}/token`;
|
||||||
case 'topAssets':
|
case 'topAssets':
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
&--disabled {
|
&--disabled {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
pointer-events: none;
|
cursor: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--add-token {
|
&--add-token {
|
||||||
|
@ -65,8 +65,15 @@ export default function ItemList({
|
|||||||
if (hideItemIf?.(result)) {
|
if (hideItemIf?.(result)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
const hasBalance = result.balance > 0;
|
||||||
|
if (result.blocked && !hasBalance && !searchQuery) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
|
if (result.blocked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (result.notImported) {
|
if (result.notImported) {
|
||||||
onOpenImportTokenModalClick(result);
|
onOpenImportTokenModalClick(result);
|
||||||
} else {
|
} else {
|
||||||
@ -77,7 +84,7 @@ export default function ItemList({
|
|||||||
iconUrl,
|
iconUrl,
|
||||||
identiconAddress,
|
identiconAddress,
|
||||||
selected,
|
selected,
|
||||||
disabled,
|
blocked,
|
||||||
primaryLabel,
|
primaryLabel,
|
||||||
secondaryLabel,
|
secondaryLabel,
|
||||||
rightPrimaryLabel,
|
rightPrimaryLabel,
|
||||||
@ -89,12 +96,13 @@ export default function ItemList({
|
|||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
className={classnames('searchable-item-list__item', {
|
className={classnames('searchable-item-list__item', {
|
||||||
'searchable-item-list__item--selected': selected,
|
'searchable-item-list__item--selected': selected,
|
||||||
'searchable-item-list__item--disabled': disabled,
|
'searchable-item-list__item--disabled': blocked,
|
||||||
})}
|
})}
|
||||||
data-testid="searchable-item-list__item"
|
data-testid="searchable-item-list__item"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onKeyUp={(e) => e.key === 'Enter' && onClick()}
|
onKeyUp={(e) => e.key === 'Enter' && onClick()}
|
||||||
key={`searchable-item-list-item-${i}`}
|
key={`searchable-item-list-item-${i}`}
|
||||||
|
title={blocked && t('swapTokenNotAvailable')}
|
||||||
>
|
>
|
||||||
{iconUrl || primaryLabel ? (
|
{iconUrl || primaryLabel ? (
|
||||||
<UrlIcon url={iconUrl} name={primaryLabel} />
|
<UrlIcon url={iconUrl} name={primaryLabel} />
|
||||||
@ -193,7 +201,7 @@ ItemList.propTypes = {
|
|||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
iconUrl: PropTypes.string,
|
iconUrl: PropTypes.string,
|
||||||
selected: PropTypes.bool,
|
selected: PropTypes.bool,
|
||||||
disabled: PropTypes.bool,
|
blocked: PropTypes.bool,
|
||||||
primaryLabel: PropTypes.string,
|
primaryLabel: PropTypes.string,
|
||||||
secondaryLabel: PropTypes.string,
|
secondaryLabel: PropTypes.string,
|
||||||
rightPrimaryLabel: PropTypes.string,
|
rightPrimaryLabel: PropTypes.string,
|
||||||
|
@ -48,7 +48,7 @@ describe('Swaps Util', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
nock('https://swap.metaswap.codefi.network')
|
nock('https://swap.metaswap.codefi.network')
|
||||||
.persist()
|
.persist()
|
||||||
.get('/networks/1/tokens')
|
.get('/networks/1/tokens?includeBlockedTokens=true')
|
||||||
.reply(200, TOKENS);
|
.reply(200, TOKENS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user