Questions tagged [wagmi]
The wagmi tag has no usage guidance.
82
questions
1
vote
0
answers
24
views
How to I solve fetch has been blocked by CORS policy when fetch data from contract
I'm trying to fetch campaign data and display it to the user. I'm using Nextjs in the front-end and solidity & hardhat in the back-end. The contract data seems to be fetched but when being ...
0
votes
0
answers
76
views
Error : Cannot read properties of null (reading 'useContext') in frontend
import contracts from '../RPSLS.sol/RPSLSFinal.json'
import { ChangeEvent, useContext, useEffect, useRef, useState } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { ...
0
votes
1
answer
64
views
How to use useReadContract in callback wagmi?
Hello I doing project web3 and i use wagmi. When i get listTokenUrl, after i want call each item to read tokenUri, but have error "Error: React Hook "useContractRead" may be executed ...
1
vote
0
answers
75
views
ContractFunctionExecutionError: The contract function "createCommitment" returned no data ("0x")
I am using WalletConnect's Web3Modal together with Wagmi.
I am trying to use the hook provided by Wagmi -- usePrepareContractWrite and useContractWrite. Here is their documentation
I applied the code ...
0
votes
0
answers
11
views
Swap Box and Token modal stopped rendering on the browser
Originally, it was a swap built on Ethereum fetching token quotes & prices via api.
That version functions as intended
Now, I am working implementing conditional logic to fect the token list and ...
0
votes
0
answers
17
views
Getting error during setup when doing "npm i wagmi viem"
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR! typescript@"^4....
0
votes
0
answers
20
views
useWagmi and Nuxt3 mint function not working
I have provided here (https://stackblitz.com/edit/github-cgbkrw?file=pages%2Fhello.vue) a stackblitz recreation of the issue (although stackblitz seems to have trouble with the useWagmi module). This ...
2
votes
1
answer
291
views
How to get receipt in wagmi / viem for a transaction issued with Safe on walletconnect?
Our dapp is using wagmi 1.4 / viem 1.15 and a plain httpProvider. I'm connecting it to a Safe (1/1) using WalletConnect v2. When I dispatch a contract transaction, viem yields a transaction response ...
0
votes
1
answer
25
views
Deployed a contract using Remix need to access the abi and function whie developing frontend
I have deployed one of my contracts using remix, I have also used the oppenzeplin imports, and while trying to verify I could not cause it could not detect the imports. So I went with making a front ...
0
votes
0
answers
104
views
How do I get Wagmi useWaitForTransaction to wait for Metamask (running on Hardhat)?
I am using Wagmi's useWaitForTransaction together with Metamask, running on local Hardhat node.
When I sign a transaction it almost immediately returns successful on the front end, but on Metamask it ...
0
votes
0
answers
152
views
Wagmi write contract
I have this code here
import React from 'react';
import { usePrepareContractWrite, useContractWrite } from 'wagmi';
import lottoABI from './lottoABI.json';
import { parseEther } from 'viem';
// Your ...
0
votes
0
answers
95
views
ABI encoding params/values length mismatch usePrepareContractWrite
I am using wagmi-react hooks to write contract data. Everything works fine with the useContractWrite() but having this issue when using usePrepareContractWrite()
ABI encoding params/values length ...
0
votes
1
answer
101
views
write is not a function from useContractWrite
I am getting this error in runtime when using usePrepareContractWrite my code is as follows from the wagmi documentation:
const { config } = usePrepareContractWrite({
address: "...
1
vote
0
answers
196
views
WebSocket connection failed for host: wss://relay.walletconnect.com
My project is using wagmi and walletconnect. But I got this error: WebSocket connection failed for host: wss://relay.walletconnect.com. How can I reproduce this and how to fix it? Thank you
1
vote
0
answers
102
views
Walletconnect v2 don't work in ios trustwallet, but work in andriod. Why is this happening?
sing Wagmi and walletconnect v2 sdk to implement sending USDC tokens from a wallet to a specific wallet. Everything works on Android on trustwallet and metamask wallets But on ios metamask sending ...
1
vote
0
answers
110
views
#Wagmi: TypeError: x.replace is not a function after migration from 0.X to 1.X.X
Same code I didn't change a thing. Only a few things in wagconfig to make the migration but the rest should work.
I have this error using:
const { config, error } = usePrepareContractWrite({...data})
...
1
vote
1
answer
278
views
wagmi - Error handling for writeContract action using Vanilla JS?
I am using wagmi to interact with my contract ABI using Vanilla JS and having a hard time finding documentation specifically for Vanilla. I've got everything working, but have been unable to figure ...
1
vote
1
answer
228
views
Event triggered multiple times - wagmi - watchAccount
I've created a Dapp that uses react, web3modal and some functions from wagmi. What I'm trying to achieve is the following:
User clicks button for connecting wallet -> web3modal is displayed -> ...
0
votes
0
answers
59
views
Safe Wallet with WalletConnect get me an error with waitForTransaction()
When I call a writing function with my multisig Safe Wallet, I got an error when I call waitForTransaction() function:
"TransactionNotFoundError: Transaction with hash "0x396...5add475ab&...
0
votes
1
answer
120
views
Problem on wagmi safe connector SDK
I am getting an error while confirming the transaction by gnosis wallet ... it works perfectly fine while confirming transactions with another wallet like metamask...
I am using Wagmi, and currently, ...
1
vote
0
answers
478
views
Wallet connect doesnt sign message with signTypedData
Hello i have a simple next js project. When i click the button i want to sign the message with my wallet. I use wallet connect which is my main problem. The code works perfectly with injected provider ...
2
votes
2
answers
632
views
Wagmi "useAccount" connector is undefined after refreshing page using next.js
I am using WAGMI and the Rainbowkit connector for my Dapp. After deploying it on production, I have encountered a strange problem. Sometimes, after refreshing the page or opening it in a new tab, the &...
1
vote
2
answers
2k
views
what is the right way to read from the contract? using wagmi.sh
So I am using the package wagmi.sh and via that I am writing to a very simple contract called the counter program that increments the value by 1 each time I call the function. Now I am able to ...
0
votes
0
answers
204
views
Unable to get the Read data or write data using Wagmi sh
So here is the react code and its a simple Counter program. Deployed on the below address.
I have put both the solidity part as well as React code
// SPDX-License-Identifier: MIT
contract ...
0
votes
1
answer
226
views
Ethers.js solidityPackedKeccak256 to bytes32
I have a commit-reveal pattern implemented in my Solidity smart contract. I use the keccak256 encryption function to secure the player's commitment.
How can I convert the return value of ...
0
votes
0
answers
344
views
Wagmi throws "Cannot Decode Zero Data" Error when using useContractRead
I am using wagmi with next 13, and trying to call "view" function in my contract.
The function in my contract:
function getAllGrids() public view returns (address[] memory) {
return ...
0
votes
2
answers
505
views
How to call useContractRead of wagmi in diferents places of React Component
I have created a handler to try to use the wagmi getter function call.
const handleContractReadCurrentDuel = () => {
const { data: duel } = useContractRead({
address: ...
0
votes
0
answers
978
views
Websocket connection fails for safe app after wagmi and walletconnect upgrade
We have upgraded our application to wagmi 0.12.0 and walletconnect 2.7.8 with it.
Now the websocket connections are failing when using it as a safe app:
"Uncaught (in promise) Error: ...
0
votes
0
answers
21
views
I am trying to reproduce the exception caused by metamask
The purpose of obtaining this image is to aid in my attempts to reproduce the issue. Additionally, I am curious to know if anyone within the community has encountered a similar situation before.
0
votes
1
answer
305
views
Type error in wagmi's usePrepareContractWrite for value
I have next app with typescript and using wagmi (https://www.npmjs.com/package/wagmi) package to work with smart contracts. I am trying to prepare contract write using usePrepareContractWrite and need ...
3
votes
0
answers
519
views
Randomly getting errors on Wagmi useWaitForTransaction and useContractWrite hooks
I'm using a Wagmi library in my ReactJS application and one specific hook(s) are randomly throwing errors.
Sometimes it's not an error and the task executes fine, or it's throwing one of 2 errors ...
0
votes
0
answers
19
views
How am I supposed to store user account details data in a decentralized manner?
I'm building an NFT marketplace app where creators can mint NFTs based on some external images, and users can buy those to support the creators. I need to support user account details storage. I'll ...
0
votes
0
answers
33
views
Is it possible for sendTransaction to return an empty hash from MetaMask while isSuccess is true
Our app is using React + Wagmi + prepare hooks.
One MetaMask user had an issue where their transaction completed successfully, but DoThisThing was never called. Code is simplified, but wondering if ...
0
votes
0
answers
107
views
React dApp - MetaMask - RPC Error: Internal JSON-RPC error
I use wagmi hooks
const { config } = usePrepareContractWrite({
address: CONTRACT_ADDRESS,
abi: ABI,
chainId: 80001,
functionName: FUNCTION_CALLED,
args: [id, user, indexes, ...
0
votes
1
answer
238
views
Smart Contract's ABI has uint256, but I get error `Type 'number' is not assignable to type 'BigNumber'
This is the first time I work with web3 api, so I am totally lost.
I use wagmi hook with react, trying to call a function from smart contract:
const id = 1;
const index = 1;
const { data, error, ...
0
votes
0
answers
840
views
wagmi useContractRead is giving error and data together
I am trying to simply read smart contract data by calling an external view function getOwner which returns an ethereum address using wagmi hook useContractRead. I found that I am getting both the ...
1
vote
0
answers
346
views
How to interact with proxy contract with ethers and wagmi
I have an upgradable proxy contract that points to a specific contract. This is the contract in mumbai polygonscan => https://mumbai.polygonscan.com/address/...
0
votes
1
answer
845
views
Wagmi useContractWrite, add Arguments to pass to function
Hey im trying to use wagmi to write this function to a smart contract inside my application, it’s for purchasing tickets and is a payable Function: buyEntry(uint256 _raffleId,uint256 _id,address ...
0
votes
1
answer
70
views
How to use the connected wallet in getNftsForOwner for Alchemy SDK function?
I'm using a combination of Thirdweb and Alchemy SDK to fetch all nfts in a connected wallet. Every example I've come across for Alchemy's getNftsForOwner function has the wallet address placed in the ...
0
votes
1
answer
152
views
why i cannot access Mumbai polygon
I want to access Mumbai polygon.
I'm using wagmi with this config
const { chains } = configureChains(
[polygonMumbai],
[publicProvider()],
)
but in provider i see only mainnet
How should i config it ...
1
vote
1
answer
384
views
wagmi usePrepareContractWrite pass an struct argument in args: []
I have an error when trying to write to a contract by using usePrepareContractWrite by passing a struct, heres my struct
class Job {
id: BigNumber = BigNumber.from("-1");
...
3
votes
1
answer
485
views
How to fetch data using wagmi without user wallet?
Is it possible to use the useContractRead hooks to get contract data without the user connecting their wallet? I see no option to do a read without a user connecting first in wagmi.
0
votes
0
answers
24
views
Trying to use Utils from "@0x/protocol-utils" but it gives undefined
I'm trying to use utils for signing a transaction for sellOrder of ERC721<->ERC20 as instructed here -
https://protocol.0x.org/en/latest/basics/orders.html#how-to-sign
import utils from '@0x/...
0
votes
0
answers
440
views
WAGMI onClick event not pulling up metamask
I have a react app that I built, using rainbowkit, and wagmi. I can connect wallet and get everything to call on rainbowkit. For some reason my onclick event will not call my mint function and open ...
1
vote
1
answer
1k
views
wagmi useSendTransaction doesnt work with wallet connect(trust wallet)
I'm trying to send eth from one wallet to another using wagmi + ether js, everything works in the browser through the metamask, but the transaction confirmation does not appear through wallet connect, ...
0
votes
1
answer
523
views
How to auto redirect user to metamask for confirm the transaction in mobile with wallet connect(rainbowkit & wagmi)
in my dapp i'm using rainbowkit for connection, dapp working perfectly in desktop but in mobile when i connect my dapp with wallet-connect option, i have to go manually in metamask to confirm the ...
3
votes
2
answers
949
views
How to pass dynamic arguments to usePrepareContractWrite in Wagmi?
I have to pass token amount as argument on a function call. The amount is dynamic and coming from a text box when a user click button (for partial amount submission). There is another button that ...
1
vote
2
answers
2k
views
Using Wagmi Core and Wagmi React together
I am using React Wagmi Hooks in my dapp to manage wallet connection. However, when it comes to reading or writing some contract functions it is not really practical to use the hooks. The reason I don'...
3
votes
2
answers
761
views
Two wagmi's usePrepareContractWrite( ) in a single React functional component
There are two different functions in my smart contract which I want to connect to two separate buttons on my user interface. The component is function-based. So according to wagmi's documentation, I ...
1
vote
1
answer
527
views
Wagmi React hooks - caching
I wonder if someone use Wagmi hooks for Ethereum and it's caching mechanism. Since docs doesn't say much about it (Wagmi docs) can somebody explain me how it acutualy works?
If i use useContractRead ...