Skip to content

Commit

Permalink
Merge branch 'main' into vinaysingh/v2-goerli-to-sepolia-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
vnaysngh-mudrex committed Mar 30, 2024
2 parents 117711c + fc10999 commit de21051
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/components/Badge/RangeBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function RangeBadge({ removed, inRange }: { removed?: boolean; in
<MouseoverTooltip text={<Trans>Your position has 0 liquidity, and is not earning fees.</Trans>}>
<LabelText color={theme.neutral2}>
<BadgeText>
<Trans>Inactive</Trans>
<Trans>Closed</Trans>
</BadgeText>
<Slash width={12} height={12} />
</LabelText>
Expand Down
3 changes: 0 additions & 3 deletions src/components/Polling/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Trans } from '@lingui/macro'
import { useAccountDetails } from 'hooks/starknet-react'
import { RowFixed } from 'components/Row'
import { getChainInfo } from 'constants/chainInfo'
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
import { useIsLandingPage } from 'hooks/useIsLandingPage'
import { useIsNftPage } from 'hooks/useIsNftPage'
import useMachineTimeMs from 'hooks/useMachineTime'
Expand Down Expand Up @@ -105,8 +104,6 @@ export default function Polling() {
const blockNumber = useBlockNumber()
const [isMounting, setIsMounting] = useState(false)
const [isHover, setIsHover] = useState(false)
const machineTime = useMachineTimeMs(NETWORK_HEALTH_CHECK_MS)
const blockTime = useCurrentBlockTimestamp()
const isNftPage = useIsNftPage()
const isLandingPage = useIsLandingPage()

Expand Down
2 changes: 1 addition & 1 deletion src/components/PositionList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function PositionList({
setUserHideClosedPositions(!userHideClosedPositions)
}}
>
{userHideClosedPositions ? <Trans>Show closed positions</Trans> : <Trans>Hide inactive positions</Trans>}
{userHideClosedPositions ? <Trans>Show closed positions</Trans> : <Trans>Hide closed positions</Trans>}
</ToggleLabel>
</HeaderToggleLabelCell>
</Header>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PositionListItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default function PositionListItem({

const positionSummaryLink = `/pools/${tokenId}`

const removed = !parseInt(liquidity.toString())
const removed = liquidity?.eq(0)
return (
<LinkRow to={positionSummaryLink}>
<RowBetween>
Expand Down
27 changes: 11 additions & 16 deletions src/hooks/useBestV3Trade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,20 @@ export function useBestV3TradeExactIn(
const nonce_results = useQuery({
queryKey: [`nonce/${address}`],
queryFn: async () => {
if (!account) return
const results = await account?.getNonce()
if (!address || !chainId) return
const provider = providerInstance(chainId)
const results: any = await provider.getNonceForAddress(address)
return cairo.felt(results.toString())
},
onSuccess: (data) => {
// Handle the successful data fetching here if needed
},
})

const contract_version = useQuery({
queryKey: [`contract_version/${address}`],
queryKey: [`contract_version/${address}/${chainId}`],
queryFn: async () => {
if (!account || !address) return
const results: any = await account?.getClassAt(address)
if (!account || !address || !chainId) return
const provider = providerInstance(chainId)
const results: any = await provider.getClassAt(address)
return results?.sierra_program
// return cairo.felt(results.toString())
},
})

Expand Down Expand Up @@ -497,18 +495,15 @@ export function useBestV3TradeExactOut(
const results = await account?.getNonce()
return cairo.felt(results.toString())
},
onSuccess: (data) => {
// Handle the successful data fetching here if needed
},
})

const contract_version = useQuery({
queryKey: [`contract_version/${address}`],
queryKey: [`contract_version/${address}/${chainId}`],
queryFn: async () => {
if (!account || !address) return
const results: any = await account?.getClassAt(address)
if (!account || !address || !chainId) return
const provider = providerInstance(chainId)
const results: any = await provider.getClassAt(address)
return results?.sierra_program
// return cairo.felt(results.toString())
},
})

Expand Down
8 changes: 3 additions & 5 deletions src/hooks/useV3PositionFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ export const useStaticFeeResults = (
const nonce_results = useQuery({
queryKey: [`nonce/${poolAddress}/${parsedTokenId}/${account?.address}`],
queryFn: async () => {
if (!account) return
const results = await account?.getNonce()
if (!address || !chainId) return
const provider = providerInstance(chainId)
const results: any = await provider.getNonceForAddress(address)
return cairo.felt(results.toString())
},
onSuccess: (data) => {
// Handle the successful data fetching here if needed
},
})

const fee_results = useQuery({
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Pool/PositionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ function PositionPageContent() {
tokenId,
} = positionDetails?.[0] || {}

const removed = !parseInt(liquidity?.toString())
const removed = liquidity?.eq(0)

const metadata = useV3PositionTokenURI(parsedTokenId)

Expand Down
14 changes: 1 addition & 13 deletions src/state/swap/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ export function useDerivedSwapInfo(
outputCurrency?.isToken && fotAdjustmentsEnabled ? outputCurrency.address : undefined
)

const recipientLookup = useENS(recipient ?? undefined)
const to: string | null = (recipient === null ? account : recipientLookup.address) ?? null

const relevantTokenBalances = useCurrencyBalances(
account ?? undefined,
useMemo(() => [inputCurrency ?? undefined, outputCurrency ?? undefined], [inputCurrency, outputCurrency])
Expand Down Expand Up @@ -253,15 +250,6 @@ export function useDerivedSwapInfo(
inputError = inputError ?? <Trans>Enter an amount</Trans>
}

const formattedTo = isAddressValidForStarknet(to)
if (!to || !formattedTo) {
inputError = inputError ?? <Trans>Enter a recipient</Trans>
} else {
if (BAD_RECIPIENT_ADDRESSES[formattedTo]) {
inputError = inputError ?? <Trans>Invalid recipient</Trans>
}
}

// compare input balance to max input based on version
const maxAmountIn = Number(trade?.trade?.maximumAmountIn(allowedSlippage)?.toSignificant())

Expand All @@ -270,7 +258,7 @@ export function useDerivedSwapInfo(
}

return inputError
}, [account, currencies, parsedAmount, to, currencyBalances, trade?.trade, allowedSlippage, connectionReady])
}, [account, currencies, parsedAmount, currencyBalances, trade?.trade, allowedSlippage, connectionReady])

return useMemo(
() => ({
Expand Down

0 comments on commit de21051

Please sign in to comment.