Merge branch 'main' of https://github.com/Uniswap/uniswap-interface into main
This commit is contained in:
commit
00a1dee073
@ -338,9 +338,9 @@ export default function WalletModal({
|
|||||||
<LightCard style={{ marginBottom: '16px' }}>
|
<LightCard style={{ marginBottom: '16px' }}>
|
||||||
<AutoRow style={{ flexWrap: 'nowrap' }}>
|
<AutoRow style={{ flexWrap: 'nowrap' }}>
|
||||||
<TYPE.main fontSize={14}>
|
<TYPE.main fontSize={14}>
|
||||||
By connecting a wallet, you agree to Uniswap Labs’ <ExternalLink href="https://uniswap.org/terms-of-service">Terms of Service</ExternalLink>{' '}
|
By connecting a wallet, you agree to Uniswap Labs’ <ExternalLink href="https://uniswap.org/terms-of-service/">Terms of Service</ExternalLink>{' '}
|
||||||
and acknowledge that you have read and understand the{' '}
|
and acknowledge that you have read and understand the{' '}
|
||||||
<ExternalLink href="https://uniswap.org/disclaimer">Uniswap protocol disclaimer</ExternalLink>.
|
<ExternalLink href="https://uniswap.org/disclaimer/">Uniswap protocol disclaimer</ExternalLink>.
|
||||||
</TYPE.main>
|
</TYPE.main>
|
||||||
</AutoRow>
|
</AutoRow>
|
||||||
</LightCard>
|
</LightCard>
|
||||||
|
@ -128,7 +128,18 @@ export default function StakingModal({ isOpen, onDismiss, stakingInfo, userLiqui
|
|||||||
if (!pairContract || !library || !deadline) throw new Error('missing dependencies')
|
if (!pairContract || !library || !deadline) throw new Error('missing dependencies')
|
||||||
if (!parsedAmount) throw new Error('missing liquidity amount')
|
if (!parsedAmount) throw new Error('missing liquidity amount')
|
||||||
|
|
||||||
return gatherPermitSignature ? gatherPermitSignature() : approveCallback()
|
if (gatherPermitSignature) {
|
||||||
|
try {
|
||||||
|
await gatherPermitSignature()
|
||||||
|
} catch (error) {
|
||||||
|
// try to approve if gatherPermitSignature failed for any reason other than the user rejecting it
|
||||||
|
if (error?.code !== 4001) {
|
||||||
|
await approveCallback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await approveCallback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -219,7 +219,7 @@ export function useERC20Permit(
|
|||||||
message,
|
message,
|
||||||
})
|
})
|
||||||
|
|
||||||
library
|
return library
|
||||||
.send('eth_signTypedData_v4', [account, data])
|
.send('eth_signTypedData_v4', [account, data])
|
||||||
.then(splitSignature)
|
.then(splitSignature)
|
||||||
.then((signature) => {
|
.then((signature) => {
|
||||||
|
@ -239,7 +239,21 @@ function V2PairMigration({
|
|||||||
const { signatureData, gatherPermitSignature } = useV2LiquidityTokenPermit(pairBalance, migratorAddress)
|
const { signatureData, gatherPermitSignature } = useV2LiquidityTokenPermit(pairBalance, migratorAddress)
|
||||||
|
|
||||||
const approve = useCallback(async () => {
|
const approve = useCallback(async () => {
|
||||||
isNotUniswap ? approveManually() : gatherPermitSignature ? gatherPermitSignature() : approveManually()
|
if (isNotUniswap) {
|
||||||
|
// sushi has to be manually approved
|
||||||
|
await approveManually()
|
||||||
|
} else if (gatherPermitSignature) {
|
||||||
|
try {
|
||||||
|
await gatherPermitSignature()
|
||||||
|
} catch (error) {
|
||||||
|
// try to approve if gatherPermitSignature failed for any reason other than the user rejecting it
|
||||||
|
if (error?.code !== 4001) {
|
||||||
|
await approveManually()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await approveManually()
|
||||||
|
}
|
||||||
}, [isNotUniswap, gatherPermitSignature, approveManually])
|
}, [isNotUniswap, gatherPermitSignature, approveManually])
|
||||||
|
|
||||||
const addTransaction = useTransactionAdder()
|
const addTransaction = useTransactionAdder()
|
||||||
|
@ -109,7 +109,18 @@ export default function RemoveLiquidity({
|
|||||||
const liquidityAmount = parsedAmounts[Field.LIQUIDITY]
|
const liquidityAmount = parsedAmounts[Field.LIQUIDITY]
|
||||||
if (!liquidityAmount) throw new Error('missing liquidity amount')
|
if (!liquidityAmount) throw new Error('missing liquidity amount')
|
||||||
|
|
||||||
return gatherPermitSignature ? gatherPermitSignature() : approveCallback()
|
if (gatherPermitSignature) {
|
||||||
|
try {
|
||||||
|
await gatherPermitSignature()
|
||||||
|
} catch (error) {
|
||||||
|
// try to approve if gatherPermitSignature failed for any reason other than the user rejecting it
|
||||||
|
if (error?.code !== 4001) {
|
||||||
|
await approveCallback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await approveCallback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrapped onUserInput to clear signatures
|
// wrapped onUserInput to clear signatures
|
||||||
|
@ -205,9 +205,19 @@ export default function Swap({ history }: RouteComponentProps) {
|
|||||||
allowedSlippage
|
allowedSlippage
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleApprove = useCallback(() => {
|
const handleApprove = useCallback(async () => {
|
||||||
if (signatureState === UseERC20PermitState.NOT_SIGNED && gatherPermitSignature) gatherPermitSignature()
|
if (signatureState === UseERC20PermitState.NOT_SIGNED && gatherPermitSignature) {
|
||||||
else approveCallback()
|
try {
|
||||||
|
await gatherPermitSignature()
|
||||||
|
} catch (error) {
|
||||||
|
// try to approve if gatherPermitSignature failed for any reason other than the user rejecting it
|
||||||
|
if (error?.code !== 4001) {
|
||||||
|
await approveCallback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await approveCallback()
|
||||||
|
}
|
||||||
}, [approveCallback, gatherPermitSignature, signatureState])
|
}, [approveCallback, gatherPermitSignature, signatureState])
|
||||||
|
|
||||||
// check if user has gone through approval process, used to show two step buttons, reset on token change
|
// check if user has gone through approval process, used to show two step buttons, reset on token change
|
||||||
|
Loading…
Reference in New Issue
Block a user