Questions tagged [web3-react]

85 questions
0
votes
1 answer

How to run the function when the specified url is entered reactjs

I have two urls in my project. the first one: http://localhost:3000/?/#chain=Matic, and the other one: http://localhost:3000/?/#chain=Bsc. I want the function I created to run when entered with this url. How can I do that? For example, when this…
soner
  • 1
  • 2
0
votes
1 answer

Got Error: Uncaught TypeError: handleChange is not a function

I want to use the handle function within the input tag. But it's showing an error when I call this function on the main page. main code: const Input = ({ placeholder, name, type, value, handleChange }) => (
0
votes
1 answer

How can I prevent metamask from popping up?

I followed a tutorial on youtube on how to create a button to connect metamask with my Dapp, I got a problem is when I've launched the Dapp metamask pop up even before I click on the button to connect to it, I've tried to remove the web3.js code…
David Jay
  • 345
  • 1
  • 2
  • 15
0
votes
0 answers

React JS with Web3 issue

After created a ReactJS project. I installed Web3 to that project and just import Web3 But after imported, I got these error messages: Failed to compile. Module not found: Error: Can't resolve 'stream'…
Tuan
  • 9
  • 1
0
votes
2 answers

React Hooks - How to useState or useEffect without affecting subscription?

I am trying to receive data from a websocket url by using the web3 library. However, React Hooks frustrates me, because it re-renders the whole App function when updating my array by using the useState set function. How can I separate my render…
Logan
  • 93
  • 9
0
votes
1 answer

web3 subscribed event fires twice

I have a simple event subscription using web3: contract.events.EventName().on('data', async event => {console.log(event)}) For some reason though, the event fires twice using web3 (in other words, the event is logged twice in this example), even…
0
votes
2 answers

React page won't load mapped elements until calling them again

I have a React dApp for a smart contract that I have made. In one of the routes of the application which I go by clicking a button named "All Cryptonauts" as seen in the screenshow below, I try to call all of the minted NFT's of my smart contract. I…
0
votes
1 answer

Specific React model doesn't load sometimes and needs rerendering

I am a beginner both in Solidity and React, right now I am trying to create a front end application with React to interact with my smart contract. I have made a connect button in the first page of my application which takes the user to the next page…
0
votes
1 answer

contract.set is not a function

I am learning Ethereum development, I downloaded the react truffle suit and then tried to change some code to insert a string into the blockchain and then echo it. But I have an error which says: Unhandled Rejection (TypeError): contract.set is not…
Abdullah Akçam
  • 87
  • 1
  • 11
0
votes
1 answer

web3-react causes my app to hang with no errors

I am building an app that uses the Etherium wallet called metamask or infura. The app compiles and runs without any errors, all the components load but I get a blank screen. This app uses the web3-react package on…
0
votes
1 answer

How to use web3 in React?

In order to use web3 in react, I imported web3 like this, import Web3 from 'web3'; However, I got this error. Module not found: Can't resolve 'web3' in '/Users/___/Desktop/MyApps/eth_todo_react/frontend/src' I used to use web3, but the error come…
gnxvw
  • 404
  • 1
  • 9
  • 23
0
votes
1 answer

truffle unbox react have Type error default.then is not a function

Recently, I used truffle unbox example: (https://github.com/truffle-box/react-box) But, I have facing big problem. When I run my App.js with npm run start, It hasn't compile error. However, when I connect my application on web browser, It appear…
DONG-JIN LEE
  • 113
  • 12
-1
votes
1 answer

How to display balance of different supported chains using Wagmi Library in React as done in Opensea

I need to display the different balances of supported chains when I am connected to my wallet using wagmi. Say, I connect using Metamask connector and in the supported chains array, and I have [polygon, base, optimism] as the array, I can only get…
-1
votes
0 answers

why does ERC20 Token locking function giving errors

I have this contract that lets a organisation register themselves and their erc20 token and lock some token to create a vesting schedule for different users, The Registering and whitelisting part it working perfectly but the locktokens function does…
-1
votes
2 answers

In v8 how do we extract "library" from useWeb3React()

This is the code in v6 of "@web3-react/core" package const { chainId, library } = useWeb3ReactCore() In v8 library doesn't exist, how can I get it? I need to use following methods: await library.getBlockNumber() const result = await…
realplay
  • 2,078
  • 20
  • 32