Questions tagged [react]

React (also known as React.js or ReactJS) is a JavaScript library for building user interfaces. It uses a declarative paradigm and aims to be both efficient and flexible.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

How to Query Contract using ABI and Ether.js in React

I have a contract deployed to mainnet. I have a javascript file which exports the functions so they could be called by other files. I have a button that calls getOwnerOfToken from my react. When I ...
  • 111
0 votes
0 answers
9 views

Why the network request of web3 interaction through react or any other frontend framework or library is not showing in the network tab of browser?

All network request we make from browser is shows in the network tab , but the web3 request is not showing in the web browser. Web3 library uses network RPC to interact with the blockchain. The RPC is ...
0 votes
0 answers
4 views

Grab browser variable for local handling for token gated redirect

I cannot seem to understand why the browser returns the correct wallet address but in terminal it is undefined and I cannot handle it for other things. I want to take the current address from either ...
0 votes
0 answers
4 views

I'm working with the Lens protocol API, but I'm not sure how to pass a dynamic array to the query

So, as the title says, I'm looking to pass a dynamic array from state in react to the Lens API query. Problem is... I have no idea how to do this, and so far the only way I've been able to get it to ...
0 votes
1 answer
14 views

smart contract exclusive for an app

I created a Smart Contract and a Dapp that Mint some NFTs, however I would like to be able to create: interact with my contract, only through my application. Does anyone know if it's possible? I didn'...
1 vote
1 answer
19 views

Specifying msg.value in Ethers js in Front-End

I'm trying to call a smart contract function that gets three parameters, I also want to specify the msg.value in my front end to call this function using ethers js. I wanted to ask how I can achieve ...
  • 121
0 votes
0 answers
16 views

How to delay calling a function until a smart contract transaction is completely done? [duplicate]

I’m calling a function that creates an instance of a smart contract. I have another function that uses the address of that smart contract as an argument. I’m trying to capture the address returned by ...
0 votes
2 answers
33 views

How can I detect metamask accounts changed and locked?

I use react ! useEffect(() => { window.ethereum.on('accountsChanged', function (accounts) { console.log(accounts[0]); }); }, []); It did not work. there is no console.log. I think ...
  • 5
1 vote
1 answer
16 views

How to reload only one component rather then whole page when active chain is changed?

I have this react hook which reloads the whole page when the user changes network or account: useEffect(() => { if (window.ethereum) { window.ethereum.on("chainChanged&...
2 votes
1 answer
88 views

What is a good way to learn Solidity? [duplicate]

I’ve been watching YouTube videos and learning from Udemy on solidity for a year. I have basic understanding of blockchain. My problem is that although the instructors show the what to do and how to ...
0 votes
0 answers
24 views

web3 staking function in reactjs not displaying staked history

I created a simple dapp with react/truffle/web3 that allows users to enter a number of tokens and submit it to stake it, the problem that I got is that when clicked on submit button, Metamask popup to ...
0 votes
0 answers
17 views

Transaction reverted despite approval (RPC Error: execution reverted: ERC20: transfer amount exceeds allowance)

I'm trying to call deposit() from my frontend, but I keep getting the error mentioned above. This is what the relevant parts of my js looks like: async function depositToJuniorPool(amount) { if (...
0 votes
0 answers
13 views

RPC Error: excution reverted" when calling a function from next.js

I've looked at similar answers regarding this error, and it seems like the majority of them have to do with using the wrong contract address or the abi. In my case, I do not think this is likely ...
0 votes
1 answer
26 views

Deploying a Smart Contract from the Frontend

I'm trying to make a simple web app where a user can deploy an instance of a Smart Contract and define certain parameters to make their instance unique. Is there a best practice on doing this? I know ...
0 votes
1 answer
34 views

Can't return address from JsonRpcSigner from wagmi to pass into parameter view function

Trying to pass the connected wallet address into one of my view functions, but cannot get the address from the JSON object is there something I am missing here? Using wagmi to get signer from the ...
1 vote
1 answer
110 views

Populating the write args with wagmi usePrepareContractWrite

I am using wagmi usePrepareContractWriteand write to write to my contract. I am allowing the user to upload fields and create an NFT. Is there a way to set the args in the write function? For example ...
1 vote
1 answer
8 views

How to deploy React Next (with Tailwind) app using Vercel?

I have created an app via React Next using Tailwind. Now I want to use Vercel to deploy it. What I tried > npm run build > now This, however does not work. Perhaps because the default build/ ...
1 vote
1 answer
26 views

Getting Invalid hook call for uniswap widget

I want to include Uniswap widget in my DApp (in React) but somehow I am getting this error in console due to which other components are also not rendering: Uncaught Error: Invalid hook call. Hooks can ...
0 votes
0 answers
18 views

Sometime solidity event is not working in react js

useEffect(() => { if (props.blockchain.smartContract != null && props.blockchain.smartContract != undefined && props.users.length != 0) { props.blockchain.smartContract....
1 vote
1 answer
38 views

Wallet Connect: The requested account and/or method has not been authorized by the user

I am using the exactly same wallet on both Wallet Connect (Chrome) + MetaMask (mobile) and MetaMask (Chrome) in calling a mint function of my smart contract. With MetaMask (Chrome), the process goes ...
2 votes
2 answers
41 views

calling smart contract function from React

I am calling smart contract function in Solidity from React, which should count the votes for the specific choices. The function works perfectly when I call it from my truffle console. However, when I ...
0 votes
0 answers
11 views

Problem using drizzle/store

I'm new to drizzle and truffle. I'm trying to run a project and facing a strange problem. When trying to start the site, the html is empty, even if I try to show simple react components. I discovered ...
1 vote
0 answers
15 views

Unable to perform transaction: Transaction has been reverted by the EVM: Not showing any clear message

Error display on Etherscan Fail with error 'ERC721: transfer from incorrect owner' I used the transaction hash and found the above error Error while trying to sell nft Data of the NFT, this function ...
1 vote
1 answer
278 views

How to pass arguments in useContractWrite wagmi

this is the mint function of my contract and I want to pass the quantity argument, please help me with that. my current code :- const { writeAsync: mint, error: mintError } = useContractWrite({ ......
2 votes
2 answers
55 views

window.ethereum.isConnected() always returns true

I'm currently working on "How to build an NFT Marketplace from Scratch" and, Implementing wallet connection. The wallet connect Button is always shows as "connected" even if I ...
1 vote
2 answers
38 views

Calling a state-changing function with ethers.js does not go through (no error message, not asking for approval)

I have a contract function that I cannot call from the front-end using ethers.js for some reason. I cannot even debug this call because it doesnt produce any errors. I tried to break the call by ...
0 votes
0 answers
15 views

Curve Finance Frontend?

What frontend library do you think was used for the curve finance website? Hoping there is something similar that I can create with React.js - any suggestions on how to get this retro 90s look? Thanks
0 votes
0 answers
10 views

Rarible Collection creation error

hope you are doing well. I have an issue with collection creating process. I'm using Rarible SDK on ReactJs to create new collections and NFT inside them. const ethereumRequest: ...
0 votes
1 answer
41 views

how to insert data updatable by both sender and receiver?

---------Solidity--------- struct Requests { string status; // accepted | pending | rejected string amount; // 1,000,000 PINE string description; // } mapping (address => Requests[]) ...
  • 203
0 votes
0 answers
11 views

How to solve this error, for counter smart contract in reactjs

How to solve this error got in call the function inc // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; contract Counter { uint public count; // Function to get the current count ...
  • 3
3 votes
2 answers
448 views

Error: Hydration failed because the initial UI does not match what was rendered on the server, Wagmi and Nextjs

I was trying to implement wagmi in my dapp, after I copied the example in the documentation https://wagmi.sh/examples/connect-wallet, I got this error: Error: Hydration failed because the initial UI ...
0 votes
1 answer
20 views

contract.methods.payFund is not a function. Unable to call any of my contract function

I am unable to call any function of my contact.............. when I am printing my contract object it shows that all the functions are in the object but unable to call. It is the output when i print ...
0 votes
1 answer
50 views

How do pass arguments to a mint function for the ERC155 smart contract?

I am trying to write a handleMint() function in my React app using Ethers.js. My smart contract uses the ERC1155 standard. I'm having trouble writing the handleMint() function so that it passes the ...
  • 1
2 votes
1 answer
99 views

Using WalletConnect via Gnosis Safe iOS throws an error when signing a message

I'm working on an authentication feature for my app and using wagmi for the ethersjs interactions. I have two-step authentication flow: connect wallet and SIWE. This entire process works fine with ...
  • 23
0 votes
1 answer
56 views

Calling a function with multiple arguments in ethers returns Error: missing argument

I'm changing a part of front-end for my dApp from using Moralis to using ethers.js. For some reason I cannot get my head around on how to provide multiple arguments for the function call in a correct ...
0 votes
0 answers
23 views

Setting an array useState([]) variable in React.js returns undefined

I have been trying to create a Web3 dApp using React.js. My first step was to connect the browser to a MetaMask wallet. So I first started by initializing a useState array variable named "wallets&...
1 vote
0 answers
60 views

How to add logo to a web3 personal signature message?

I have generated a signature message from my react js app for the users. But in mobile metamask the message displays a letter D, the first letter of my url, at the top of the message. But I want to ...
1 vote
0 answers
137 views

Metamask does not open on opera using web3modal

I am using web3modal to connect with different wallets. On Mozilla I am able to connect with metamask but when I open my website on Opera GX browser (version: LVL4 (core: 89.0.4447.64)) it says that ...
  • 55
0 votes
1 answer
21 views

get nft activity

Does anyone know how I could get the transaction logs of an nft? having the address of the collection and the token ID. thanks guys!
0 votes
1 answer
54 views

How to access an array from a solidity function in reactjs

I'm able to return the array to console but I want to be able to use the data in different functions. When I run this code: const ownedTokens = () => { blockchain.smartContract.methods ....
  • 3
0 votes
1 answer
27 views

Get event call from solidity contract from react

I am looking for doing something, if an event is emmited from solidity contract. Here's my solidity contract:: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract QuoteV2{ string ...
0 votes
0 answers
34 views

Contract not passing to front end

I am building a chat DApp. I have a smart contract and a mostly complete nextjs front end. My contract is deploying properly however, whenever I call my contract from the front end it doesn't work. My ...
2 votes
3 answers
1k views

Warning: Contract code size exceeds 24576 bytes

I'm using hardhat and when trying to compile the code it shows me a warning containing @uniswap/v2-periphery/contracts/UniswapV2Router02.sol:12:1: Warning: Contract code size exceeds 24576 bytes (a ...
0 votes
1 answer
108 views

Error HH700: Artifact for contract "@uniswap/lib/contracts/Babyl............." not found

I'm using Hardhat to compile solidity contracts. In the contracts I'm importing Uniswap's contracts SDK to use them. But when I run yarn hardhat compile in terminal it says Error HH700: Artifact for ...
0 votes
1 answer
87 views

How to return an array when calling a solidity function?

Yo I'm pretty new to coding so bear with me. I'm using ReactJS with web3 to call functions from a smart contract but the function I'm trying to call returns an array and I can't figure out how to ...
  • 3
0 votes
0 answers
12 views

Invoking smart contract function inside Async Thunk

I'm trying to get both token object and token symbol from my ERC20 contract in redux-tlk Async Thunk as shown below. const setToken = createAsyncThunk( "payload/setToken", async (...
0 votes
0 answers
22 views

How do I display a users NFTs in reactjs?

Currently on my website I have a minting page that works perfectly but I want to be able to display a users NFTs from the project and be able to stake them. I have a staking contract that works but I ...
  • 3
0 votes
0 answers
14 views

Ethers.js Error code B510: Not able to decode the data in rawTransaction using ethereum-tx-decoder. Please check the data sent

I have written this code to make a transaction. But I got an error when run it. Please help me. I stuck at this 2 days. Thank you very very much. const biconomy = new Biconomy(new ethers.providers....
  • 1
0 votes
0 answers
45 views

Why isn't copyto clipboard function working in metamask mobile browser?

navigator.clipboard.writeText(walletAddress); I used this piece of code to copy to clipboard. It is working properly in desktop browser but not in metamask mobile browser? Is there any alternative ...
0 votes
0 answers
37 views

Call a function from solidity contract Typescript

I have to call a function from the contract i've made from react typescript. Can anyone help me to do this ?? This is my contract: pragma solidity ^0.5.10; contract HelloWorld { string public ...

1
2 3 4 5
11