|
|
@ -29,6 +29,10 @@ import { ConfirmPageContainerWarning } from '../../../components/app/confirm-pag |
|
|
|
import GasDetailsItem from '../../../components/app/gas-details-item'; |
|
|
|
import GasDetailsItem from '../../../components/app/gas-details-item'; |
|
|
|
import LedgerInstructionField from '../../../components/app/ledger-instruction-field'; |
|
|
|
import LedgerInstructionField from '../../../components/app/ledger-instruction-field'; |
|
|
|
import { ERC1155, ERC20, ERC721 } from '../../../helpers/constants/common'; |
|
|
|
import { ERC1155, ERC20, ERC721 } from '../../../helpers/constants/common'; |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
MAINNET_CHAIN_ID, |
|
|
|
|
|
|
|
TEST_CHAINS, |
|
|
|
|
|
|
|
} from '../../../../shared/constants/network'; |
|
|
|
|
|
|
|
|
|
|
|
export default class ConfirmApproveContent extends Component { |
|
|
|
export default class ConfirmApproveContent extends Component { |
|
|
|
static contextTypes = { |
|
|
|
static contextTypes = { |
|
|
@ -458,31 +462,12 @@ export default class ConfirmApproveContent extends Component { |
|
|
|
userAddress, |
|
|
|
userAddress, |
|
|
|
} = this.props; |
|
|
|
} = this.props; |
|
|
|
const { t } = this.context; |
|
|
|
const { t } = this.context; |
|
|
|
let titleTokenDescription = t('token'); |
|
|
|
const useBlockExplorer = |
|
|
|
if (rpcPrefs?.blockExplorerUrl || chainId) { |
|
|
|
rpcPrefs?.blockExplorerUrl || |
|
|
|
const unknownTokenBlockExplorerLink = getTokenTrackerLink( |
|
|
|
[...TEST_CHAINS, MAINNET_CHAIN_ID].includes(chainId); |
|
|
|
tokenAddress, |
|
|
|
|
|
|
|
chainId, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
userAddress, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
blockExplorerUrl: rpcPrefs?.blockExplorerUrl ?? null, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const unknownTokenLink = ( |
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href={unknownTokenBlockExplorerLink} |
|
|
|
|
|
|
|
target="_blank" |
|
|
|
|
|
|
|
rel="noopener noreferrer" |
|
|
|
|
|
|
|
className="confirm-approve-content__unknown-asset" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{t('token')} |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
titleTokenDescription = unknownTokenLink; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let titleTokenDescription = t('token'); |
|
|
|
|
|
|
|
const tokenIdWrapped = tokenId ? ` (#${tokenId})` : ''; |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
assetStandard === ERC20 || |
|
|
|
assetStandard === ERC20 || |
|
|
|
(tokenSymbol && !tokenId && !isSetApproveForAll) |
|
|
|
(tokenSymbol && !tokenId && !isSetApproveForAll) |
|
|
@ -495,11 +480,14 @@ export default class ConfirmApproveContent extends Component { |
|
|
|
(assetName && tokenId) || |
|
|
|
(assetName && tokenId) || |
|
|
|
(tokenSymbol && tokenId) |
|
|
|
(tokenSymbol && tokenId) |
|
|
|
) { |
|
|
|
) { |
|
|
|
const tokenIdWrapped = tokenId ? ` (#${tokenId})` : ''; |
|
|
|
|
|
|
|
if (assetName || tokenSymbol) { |
|
|
|
if (assetName || tokenSymbol) { |
|
|
|
titleTokenDescription = `${assetName ?? tokenSymbol}${tokenIdWrapped}`; |
|
|
|
titleTokenDescription = `${assetName ?? tokenSymbol}`; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const unknownNFTBlockExplorerLink = getTokenTrackerLink( |
|
|
|
titleTokenDescription = t('nft'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (useBlockExplorer) { |
|
|
|
|
|
|
|
const blockExplorerLink = getTokenTrackerLink( |
|
|
|
tokenAddress, |
|
|
|
tokenAddress, |
|
|
|
chainId, |
|
|
|
chainId, |
|
|
|
null, |
|
|
|
null, |
|
|
@ -508,24 +496,38 @@ export default class ConfirmApproveContent extends Component { |
|
|
|
blockExplorerUrl: rpcPrefs?.blockExplorerUrl ?? null, |
|
|
|
blockExplorerUrl: rpcPrefs?.blockExplorerUrl ?? null, |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
const unknownNFTLink = ( |
|
|
|
const blockExplorerElement = ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<a |
|
|
|
<a |
|
|
|
href={unknownNFTBlockExplorerLink} |
|
|
|
href={blockExplorerLink} |
|
|
|
target="_blank" |
|
|
|
target="_blank" |
|
|
|
rel="noopener noreferrer" |
|
|
|
rel="noopener noreferrer" |
|
|
|
className="confirm-approve-content__unknown-asset" |
|
|
|
title={tokenAddress} |
|
|
|
|
|
|
|
className="confirm-approve-content__approval-asset-link" |
|
|
|
> |
|
|
|
> |
|
|
|
{t('nft')} |
|
|
|
{titleTokenDescription} |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
{tokenIdWrapped && <span>{tokenIdWrapped}</span>} |
|
|
|
{tokenIdWrapped && <span>{tokenIdWrapped}</span>} |
|
|
|
</> |
|
|
|
</> |
|
|
|
); |
|
|
|
); |
|
|
|
titleTokenDescription = unknownNFTLink; |
|
|
|
return blockExplorerElement; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return titleTokenDescription; |
|
|
|
return ( |
|
|
|
|
|
|
|
<> |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
className="confirm-approve-content__approval-asset-title" |
|
|
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
copyToClipboard(tokenAddress); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
title={tokenAddress} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{titleTokenDescription} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
{tokenIdWrapped && <span>{tokenIdWrapped}</span>} |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderTitle() { |
|
|
|
renderTitle() { |
|
|
@ -627,7 +629,10 @@ export default class ConfirmApproveContent extends Component { |
|
|
|
</Typography> |
|
|
|
</Typography> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<div className="confirm-approve-content__title"> |
|
|
|
<div |
|
|
|
|
|
|
|
className="confirm-approve-content__title" |
|
|
|
|
|
|
|
data-testid="confirm-approve-title" |
|
|
|
|
|
|
|
> |
|
|
|
{this.renderTitle()} |
|
|
|
{this.renderTitle()} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="confirm-approve-content__description"> |
|
|
|
<div className="confirm-approve-content__description"> |
|
|
|