-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 167-show-usd-value-for-tokens-in-swap-page-a…
…nd-lp-page
- Loading branch information
Showing
14 changed files
with
163 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { t, Trans } from '@lingui/macro' | ||
import { useOpenModal } from 'state/application/hooks' | ||
import { ApplicationModal } from 'state/application/reducer' | ||
import styled from 'styled-components' | ||
import { ButtonText, ThemedText } from 'theme/components' | ||
import { Z_INDEX } from 'theme/zIndex' | ||
|
||
export const UK_BANNER_HEIGHT = 65 | ||
export const UK_BANNER_HEIGHT_MD = 113 | ||
export const UK_BANNER_HEIGHT_SM = 137 | ||
|
||
const BannerWrapper = styled.div` | ||
position: relative; | ||
display: flex; | ||
background-color: #ff3257; | ||
padding: 20px; | ||
border-bottom: 1px solid ${({ theme }) => theme.surface3}; | ||
z-index: ${Z_INDEX.fixed}; | ||
box-sizing: border-box; | ||
-webkit-box-sizing: border-box; | ||
-moz-box-sizing: border-box; | ||
@media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.md}px`}) { | ||
flex-direction: column; | ||
} | ||
` | ||
|
||
const BannerTextWrapper = styled(ThemedText.BodySecondary)` | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
color: white; | ||
width: 100%; | ||
text-align: center; | ||
@media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.md}px`}) { | ||
@supports (-webkit-line-clamp: 2) { | ||
white-space: initial; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
} | ||
} | ||
@media only screen and (max-width: ${({ theme }) => `${theme.breakpoint.sm}px`}) { | ||
@supports (-webkit-line-clamp: 3) { | ||
white-space: initial; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 3; | ||
-webkit-box-orient: vertical; | ||
} | ||
} | ||
` | ||
|
||
export const bannerText = | ||
'Warning: Deposit liquidity is currently paused in v2. No swap will route through v2 pools. We recommend you remove the liquidity from Jediswap v2.' | ||
|
||
export function WarningBanner() { | ||
return ( | ||
<BannerWrapper> | ||
<BannerTextWrapper lineHeight="24px">{bannerText}</BannerTextWrapper> | ||
</BannerWrapper> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,15 @@ | ||
import { BigNumber } from '@ethersproject/bignumber' | ||
import { useAccountDetails } from 'hooks/starknet-react' | ||
import { L2_DEADLINE_FROM_NOW } from 'constants/misc' | ||
import { useMemo } from 'react' | ||
import { useAppSelector } from 'state/hooks' | ||
import { useBlock, useContractRead } from '@starknet-react/core' | ||
import MultiContractABI from 'contracts/multicall/abi.json' | ||
import { MULTICALL_NETWORKS } from 'contracts/multicall' | ||
import { DEFAULT_CHAIN_ID } from 'constants/tokens' | ||
|
||
// combines the block timestamp with the user setting to give the deadline that should be used for any submitted transaction | ||
export default function useTransactionDeadline(): BigNumber | undefined { | ||
const { chainId } = useAccountDetails() | ||
const ttl = useAppSelector((state) => state.user.userDeadline) | ||
const blockTimestamp = useCurrentBlockTimestamp() | ||
const currentTimestamp = BigNumber.from(Math.round(Number(new Date()) / 1000).toString()) | ||
return useMemo(() => { | ||
if (blockTimestamp && ttl) return BigNumber.from(blockTimestamp).add(ttl) | ||
if (currentTimestamp && ttl) return BigNumber.from(currentTimestamp).add(ttl) | ||
return undefined | ||
}, [blockTimestamp, chainId, ttl]) | ||
} | ||
|
||
const useCurrentBlockTimestamp = () => { | ||
const { chainId } = useAccountDetails() | ||
const { data: blockTimeStamp } = useContractRead({ | ||
functionName: 'get_current_block_timestamp', | ||
args: [], | ||
abi: MultiContractABI, | ||
address: MULTICALL_NETWORKS[chainId ?? DEFAULT_CHAIN_ID], | ||
watch: true, | ||
}) | ||
|
||
if (!blockTimeStamp) return undefined | ||
const { block_timestamp } = blockTimeStamp as any | ||
|
||
return BigNumber.from(block_timestamp.toString()) | ||
}, [currentTimestamp, chainId, ttl]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.