Skip to content

Commit

Permalink
remoev prev checks for uniswap and permit
Browse files Browse the repository at this point in the history
  • Loading branch information
JIOjosBG committed Jun 25, 2024
1 parent b063920 commit be8d4ed
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions src/hooks/walletConnect/walletConnectV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ export default function useWalletConnectV2({
const connection = getConnectionFromSessionTopic(topic)

if (connection) {
const dappName = connection.peer?.metadata.name || ''

if (method === 'personal_sign' || wcRequest.method === 'eth_sign') {
txn = wcRequest.params[wcRequest.method === 'personal_sign' ? 0 : 1]
requestAccount = wcRequest.params[wcRequest.method === 'personal_sign' ? 1 : 0]
Expand All @@ -367,50 +365,6 @@ export default function useWalletConnectV2({
} else if (method === 'eth_signTypedData_v4') {
requestAccount = wcRequest.params[0]
txn = JSON.parse(wcRequest.params[1])

// Dealing with Erc20 Permits
if (txn.primaryType === 'Permit') {
// If Uniswap, reject the permit and expect a graceful fallback (receiving approve eth_sendTransaction afterwards)
if (
UNISWAP_PERMIT_EXCEPTIONS.some((ex) =>
dappName.toLowerCase().includes(ex.toLowerCase())
)
) {
const response = formatJsonRpcError(id, {
message: `Method not found: ${method}`,
code: -32601
})
web3wallet
.respondSessionRequest({
topic,
response
})
.catch((err) => {
addToast(err.message, { error: true })
})

return
}
// Regular Permit (EIP-2612) is not supported by SCWs, because it requires a signature from the wallet
// and ERC-20 token contracts don't implement EIP-1271.
addToast(
'Please, change the approval type to "Transaction" from the dApp, as the currently selected method doesn\'t support Smart Wallets.',
{
error: true
}
)
// return err to the dapp so it doesnt infinitely load
web3wallet.respondSessionRequest({
topic,
response: formatJsonRpcError(id, {
message:
'Please, change the approval type to "Transaction" from the dApp, as the currently selected method doesn\'t support Smart Wallets.',
// Internal JSON-RPC error
code: -32603
})
})
return
}
} else if (
method === 'wallet_switchEthereumChain' ||
method === 'wallet_addEthereumChain'
Expand Down

0 comments on commit be8d4ed

Please sign in to comment.