Email login USDC approval not working #3335
Replies: 3 comments 1 reply
-
ACK |
Beta Was this translation helpful? Give feedback.
0 replies
-
@arein import {WagmiProvider, useWriteContract} from 'wagmi'
import {QueryClient, QueryClientProvider} from '@tanstack/react-query'
import {polygon} from '@reown/appkit/networks';
import {createAppKit} from '@reown/appkit/react'
import {WagmiAdapter} from '@reown/appkit-adapter-wagmi'
import './App.css'
const SMART_CONTRACT_ADDRESS_USDC = '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359';
const SMART_CONTRACT_ADDRESS = '0x1B17510...;
const USDC_ABI = [
{
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
const walletConnectProjectId = "2393..."
const walletConnectMetadata = {
name: 'Test',
description: 'This is a test',
url: 'https://app.test.io',
icons: ['https://aoo.test.io/favicon.ico'],
}
const wagmiAdapter = new WagmiAdapter({
networks: [polygon],
projectId: walletConnectProjectId,
});
createAppKit({
adapters: [wagmiAdapter],
networks: [polygon],
projectId: walletConnectProjectId,
metadata: walletConnectMetadata,
});
const queryClient = new QueryClient();
function Buttons() {
const {writeContractAsync} = useWriteContract();
const btnApproveUSDCClicked = async () => {
let approveResponse = await writeContractAsync({
abi: USDC_ABI,
address: SMART_CONTRACT_ADDRESS_USDC,
functionName: 'approve',
args: [SMART_CONTRACT_ADDRESS, 1000000n],
});
console.log(approveResponse);
}
return (<>
<w3m-button/>
<br/>
<button onClick={btnApproveUSDCClicked}>
Approve USDC
</button>
</>)
}
function App() {
return (
<WagmiProvider config={wagmiAdapter.wagmiConfig} reconnectOnMount={true}>
<QueryClientProvider client={queryClient}>
<Buttons/>
</QueryClientProvider>
</WagmiProvider>
)
}
export default App Edit: make it more minimal and using standart Wagmi react hooks. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@wallneradam Could you check this again pls? This should be resolved |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It worked until yesterday. Now when I start a transaction with Wagmi I see this window without doing anything.

Please help me!
Beta Was this translation helpful? Give feedback.
All reactions