mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix PropType error on Awaiting Swap page (#9688)
A PropType error was shown in the console when on the Awaiting Swap page in certain error scenarios. The `symbol` property was sometimes not set if `destinationTokenInfo` was missing. The `symbol` prop has been removed, as the `AwaitingSwap` component already selected the `fetchParams`, and the `destinationTokenInfo` object within. The prop was effectively a duplicate.
This commit is contained in:
parent
1ad87d36c3
commit
209f2afd3d
@ -41,7 +41,6 @@ import ViewOnEtherScanLink from './view-on-ether-scan-link'
|
|||||||
export default function AwaitingSwap ({
|
export default function AwaitingSwap ({
|
||||||
swapComplete,
|
swapComplete,
|
||||||
errorKey,
|
errorKey,
|
||||||
symbol,
|
|
||||||
txHash,
|
txHash,
|
||||||
networkId,
|
networkId,
|
||||||
tokensReceived,
|
tokensReceived,
|
||||||
@ -189,7 +188,7 @@ export default function AwaitingSwap ({
|
|||||||
headerText = t('swapProcessing')
|
headerText = t('swapProcessing')
|
||||||
statusImage = <PulseLoader />
|
statusImage = <PulseLoader />
|
||||||
submitText = t('swapsViewInActivity')
|
submitText = t('swapsViewInActivity')
|
||||||
descriptionText = t('swapOnceTransactionHasProcess', [<span key="swapOnceTransactionHasProcess-1" className="awaiting-swap__amount-and-symbol">{symbol}</span>])
|
descriptionText = t('swapOnceTransactionHasProcess', [<span key="swapOnceTransactionHasProcess-1" className="awaiting-swap__amount-and-symbol">{destinationTokenInfo.symbol}</span>])
|
||||||
content = (
|
content = (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
@ -214,8 +213,8 @@ export default function AwaitingSwap ({
|
|||||||
} else if (!errorKey && swapComplete) {
|
} else if (!errorKey && swapComplete) {
|
||||||
headerText = t('swapTransactionComplete')
|
headerText = t('swapTransactionComplete')
|
||||||
statusImage = <SwapSuccessIcon />
|
statusImage = <SwapSuccessIcon />
|
||||||
submitText = t('swapViewToken', [symbol])
|
submitText = t('swapViewToken', [destinationTokenInfo.symbol])
|
||||||
descriptionText = t('swapTokenAvailable', [<span key="swapTokenAvailable-2" className="awaiting-swap__amount-and-symbol">{`${tokensReceived || ''} ${symbol}`}</span>])
|
descriptionText = t('swapTokenAvailable', [<span key="swapTokenAvailable-2" className="awaiting-swap__amount-and-symbol">{`${tokensReceived || ''} ${destinationTokenInfo.symbol}`}</span>])
|
||||||
content = blockExplorerUrl && (
|
content = blockExplorerUrl && (
|
||||||
<ViewOnEtherScanLink
|
<ViewOnEtherScanLink
|
||||||
txHash={txHash}
|
txHash={txHash}
|
||||||
@ -273,7 +272,6 @@ export default function AwaitingSwap ({
|
|||||||
|
|
||||||
AwaitingSwap.propTypes = {
|
AwaitingSwap.propTypes = {
|
||||||
swapComplete: PropTypes.bool,
|
swapComplete: PropTypes.bool,
|
||||||
symbol: PropTypes.string.isRequired,
|
|
||||||
networkId: PropTypes.string.isRequired,
|
networkId: PropTypes.string.isRequired,
|
||||||
txHash: PropTypes.string,
|
txHash: PropTypes.string,
|
||||||
tokensReceived: PropTypes.string,
|
tokensReceived: PropTypes.string,
|
||||||
|
@ -23,7 +23,6 @@ export const swapNotComplete = () => (
|
|||||||
ERROR_FETCHING_QUOTES,
|
ERROR_FETCHING_QUOTES,
|
||||||
QUOTES_NOT_AVAILABLE_ERROR,
|
QUOTES_NOT_AVAILABLE_ERROR,
|
||||||
], '')}
|
], '')}
|
||||||
symbol="ABC"
|
|
||||||
estimatedTime="2 minutes"
|
estimatedTime="2 minutes"
|
||||||
networkId="1"
|
networkId="1"
|
||||||
txHash="0xnotATx"
|
txHash="0xnotATx"
|
||||||
@ -45,7 +44,6 @@ export const swapComplete = () => (
|
|||||||
ERROR_FETCHING_QUOTES,
|
ERROR_FETCHING_QUOTES,
|
||||||
QUOTES_NOT_AVAILABLE_ERROR,
|
QUOTES_NOT_AVAILABLE_ERROR,
|
||||||
], '')}
|
], '')}
|
||||||
symbol="ABC"
|
|
||||||
estimatedTime={null}
|
estimatedTime={null}
|
||||||
tokensReceived={320.68}
|
tokensReceived={320.68}
|
||||||
networkId="1"
|
networkId="1"
|
||||||
@ -66,7 +64,6 @@ export const swapError = () => (
|
|||||||
ERROR_FETCHING_QUOTES,
|
ERROR_FETCHING_QUOTES,
|
||||||
QUOTES_NOT_AVAILABLE_ERROR,
|
QUOTES_NOT_AVAILABLE_ERROR,
|
||||||
], '')}
|
], '')}
|
||||||
symbol="ABC"
|
|
||||||
estimatedTime={null}
|
estimatedTime={null}
|
||||||
networkId="1"
|
networkId="1"
|
||||||
txHash="0xnotATx"
|
txHash="0xnotATx"
|
||||||
|
@ -298,7 +298,6 @@ export default function Swap () {
|
|||||||
<AwaitingSwap
|
<AwaitingSwap
|
||||||
swapComplete={false}
|
swapComplete={false}
|
||||||
errorKey={swapsErrorKey}
|
errorKey={swapsErrorKey}
|
||||||
symbol={destinationTokenInfo?.symbol}
|
|
||||||
txHash={tradeTxData?.hash}
|
txHash={tradeTxData?.hash}
|
||||||
networkId={networkId}
|
networkId={networkId}
|
||||||
rpcPrefs={rpcPrefs}
|
rpcPrefs={rpcPrefs}
|
||||||
@ -345,7 +344,6 @@ export default function Swap () {
|
|||||||
return swapsEnabled === false ? (
|
return swapsEnabled === false ? (
|
||||||
<AwaitingSwap
|
<AwaitingSwap
|
||||||
errorKey={OFFLINE_FOR_MAINTENANCE}
|
errorKey={OFFLINE_FOR_MAINTENANCE}
|
||||||
symbol=""
|
|
||||||
networkId={networkId}
|
networkId={networkId}
|
||||||
rpcPrefs={rpcPrefs}
|
rpcPrefs={rpcPrefs}
|
||||||
/>
|
/>
|
||||||
@ -360,7 +358,6 @@ export default function Swap () {
|
|||||||
? (
|
? (
|
||||||
<AwaitingSwap
|
<AwaitingSwap
|
||||||
swapComplete={tradeConfirmed}
|
swapComplete={tradeConfirmed}
|
||||||
symbol={destinationTokenInfo?.symbol}
|
|
||||||
networkId={networkId}
|
networkId={networkId}
|
||||||
txHash={tradeTxData?.hash}
|
txHash={tradeTxData?.hash}
|
||||||
tokensReceived={tokensReceived}
|
tokensReceived={tokensReceived}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user