Commit 430356da authored by eddie's avatar eddie Committed by GitHub

fix: update text in ConfirmSwapModal (#6971)

parent 1c504601
import { BigNumber } from '@ethersproject/bignumber'
import { TradeFillType } from 'state/routing/types'
import { useIsTransactionConfirmed } from 'state/transactions/hooks'
import { TEST_TRADE_EXACT_INPUT } from 'test-utils/constants'
import { mocked } from 'test-utils/mocked'
......@@ -69,6 +71,37 @@ describe('PendingModalContent', () => {
expect(screen.getByText('Why is this required?')).toBeInTheDocument()
expect(screen.queryByText('Enable spending ABC on Uniswap')).not.toBeInTheDocument()
})
it('renders the correct label for a submitted classic order', () => {
render(
<PendingModalContent
steps={[
ConfirmModalState.APPROVING_TOKEN,
ConfirmModalState.PERMITTING,
ConfirmModalState.PENDING_CONFIRMATION,
]}
currentStep={ConfirmModalState.PENDING_CONFIRMATION}
trade={TEST_TRADE_EXACT_INPUT}
swapResult={{
type: TradeFillType.Classic,
response: {
hash: '12345',
confirmations: 0,
from: '0x12345',
wait: jest.fn(),
nonce: 0,
gasLimit: BigNumber.from(100000),
data: '0xmockdata',
value: BigNumber.from(100000),
chainId: 1,
},
}}
/>
)
expect(screen.getByText('Swap submitted')).toBeInTheDocument()
expect(screen.getByText('View on Explorer')).toBeInTheDocument()
expect(screen.queryByText('Proceed in your wallet')).not.toBeInTheDocument()
})
})
describe('renders the correct logo', () => {
......
......@@ -186,13 +186,13 @@ function getContent(args: ContentArgs): PendingModalStep {
let labelText: string | null = null
let href: string | null = null
if (chainId && swapConfirmed && swapResult && swapResult.type === TradeFillType.Classic) {
labelText = t`View on Explorer`
href = getExplorerLink(chainId, swapResult.response.hash, ExplorerDataType.TRANSACTION)
} else if (swapPending && trade?.fillType === TradeFillType.UniswapX) {
if (swapPending && trade?.fillType === TradeFillType.UniswapX) {
labelText = t`Learn more about swapping with UniswapX`
href = 'https://support.uniswap.org/hc/en-us/articles/17515415311501'
} else if (swapPending) {
} else if (chainId && (swapConfirmed || swapPending) && swapResult && swapResult.type === TradeFillType.Classic) {
labelText = t`View on Explorer`
href = getExplorerLink(chainId, swapResult.response.hash, ExplorerDataType.TRANSACTION)
} else {
labelText = t`Proceed in your wallet`
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment