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
0answers
39 views

Error with Truffle React (the contract doesn't have address)

Someone knows something about this error with Truffle React box? Must be my Metamask wallet address but it is already in my truffle-config file. I leave the App.js file here (I didn't make it. It's ...
1
vote
0answers
19 views

[ Web3.js on BSC ]: Returned error: unknown account

Here's the error: index.js:1 Error: Returned error: unknown account I'm getting this error while running this method: nftMintingContract.methods.mint(account, cid).send({from: account}) The ...
0
votes
1answer
14 views

Web3 - handling separation between read-only calls and send requests?

I want to create a simple front-end for my DApp. The DApp fetches values about the smart contract to display on the site. If the reader wants to interact (eg. buy) with the smart contract, I have a '...
0
votes
1answer
50 views

How to create a dapp that verifies NFT ownership?

I'm trying to create a simple react app that will allow the user to enter a token ID and Ethereum address, then it will confirm if that address has it. Do I need Solidity to do this? I'm aware of ...
0
votes
0answers
11 views

Is it possible to open metamask's signature request on a different window?

I'm trying to open metamask on a different window popup not the in the same window, is there a way to do it?
0
votes
0answers
11 views

Is it possible to trigger several times “metamask” connection to different wallets?

I'm trying to trigger metamask popup to connect new wallets even if I already connected one by clicking a "Add another wallet" button. I have days trying to replicate the behavior you see in ...
1
vote
1answer
41 views

Can't get info with web3: web3.eth.getAccounts returns undefined

I'm trying to connect to the blockchain via web3 and metamask and the web3.eth.getAccounts() method is returning undefined, however window.ethereum.request({ method: 'eth_requestAccounts' }) returns ...
1
vote
0answers
27 views

How to keep MetaMask connection to the UI persistent with Web3-react?

I am working with web3-react and I cannot figure out how to keep the connection to the MetaMask wallet persistent upon browser refreshes. This is the code: // define the injectedConnectors const ...
0
votes
0answers
11 views

Error in react js:_this2.props.mint is not a function

I am calling a function from my contract in app.js and then I bind it to my dashboard component in order to access it from the TokenDashboard component. The problem is that when i try to access the ...
0
votes
0answers
24 views

Interaction between my webapp and smart contract

I am experimenting for the first time with smart contracts and NFT stuff. So I am at the point where I have a react webapp with metamask integration. The user can connect his wallet. I want to ...
0
votes
0answers
14 views

NULL value returned when trying to fetch data from solidity smart contract from react js

I'm trying to make a Student Management System using Ethereum blockchain. I've linked my smart contract (solidity) with react frontend. I try to get the setted value from the smart contract, but this ...
0
votes
0answers
8 views

Why my hash value for separate files is not being rendered?(Ethereum Solidity)

I'm trying to store my files in IPFS and get the hash value and store them in the smart contract.I want to render my hash value in the frontend page. But in the below code the hash value of first ...
0
votes
1answer
80 views

How to retrieve contents of mapped struct by passing in an address

I want to retrieve a patients detail by passing in an address to the function. I managed to do this when writing tests using Mocha and I can retrieve the values with no problem. But when I tried it on ...
0
votes
0answers
249 views

MetaMask - RPC Error: execution reverted {code: -32000, message: “execution reverted”}

Facing this error => MetaMask - RPC Error: execution reverted {code: -32000, message: "execution reverted"} after calling the contract method. This is called via the useEffect hook in the ...
0
votes
1answer
8 views

Connecting React App to SmartContract

I have an application with next.js, in which I have integrated Metamask with the web3-react library. Now I want to connect my application with my contract (I have used truffle). But I'm a bit lost, I'...
0
votes
0answers
18 views

What is the reason that stops action below?

I was reading many pending transactions. Suddenly this action was stopped. This is my code. provider.on("pending", (tx) => { console.log("hash: " + tx.hash); ...
0
votes
1answer
49 views

How do I use web3.js to send a transaction in React using MetaMask?

I'm trying to use Web3.js to prompt the user to pay an amount in MetaMask. This is the code I'm using, which is failing with the error message in the payMeta catch section ('payment fail'). async ...
0
votes
0answers
16 views

How to launch metamask mobile app by clicking on a button on the website on mobile phone like on opensea?

I implemented a shortcode that connects to metamask browser extension and shows the user account using web3 and reactjs, this code works well when using the desktop browser, but when I try it on ...
0
votes
1answer
69 views

ALERT: Transaction Error. Exception thrown in contract code(metamask)

Getting this error when I execute my smart contract function "purchase" using nodejs, it's a very simple smart contract so i'm stuck as to why i keep getting this error. Solidity // SPDX-...
0
votes
0answers
48 views

How to handle connection to a wallet in a dapp

I'm a bit confused on how to handle a connection to a wallet such as Metamask in a decentralised web-app. Let's consider this very simple contract: pragma solidity ^0.8.0; contract ToDo { struct ...
0
votes
1answer
16 views

EthersJS: How to get the result of a view function

I really don't get it how to view the result of a simple view function. I have the following function that needs to query the token URI for an ERC-721 contract: export const getTokenURI = async (...
0
votes
0answers
20 views

Drizzle react ContractForm's sendargs and hidden parameter fields

I am using the truffle unbox drizzle boiler plate. Below are the versions in my package.json "@drizzle/react-components": "^1.5.1", "@drizzle/react-plugin": "^1.5.1&...
1
vote
1answer
244 views

How to Calculate APR From A Masterchef Contract Pool

So i'm trying to build most of the stuff from scratch to get a understanding of the inner workings of farms. I am testing out the calculations by using a existing farm. SaltSwap window.chef is = to ...
0
votes
0answers
21 views

How can do use web3.eth.Contract()?

I am using web3 version 1.3.6. But some people said it can use version 0.20.1. If I use 0.20.1, I can not use other functions. Other Method?
0
votes
0answers
108 views

Uncaught Error: Returned values aren't valid, did it run out of gas? (While I try to get data from the smart contract)

Can anyone say what's wrong with my code? I can set the value in the smart contract, but when I try to get the value I'm getting the following error. Uncaught (in promise) Error: Returned values aren'...
0
votes
1answer
44 views

Unhandled Rejection (TypeError): SimpleContract.methods.set is not a function

I'm trying to build a Student Management System Dapp,where data of students are taken from frontend and stored in smart contract. Why I'm getting this error,while I try to set value(name) to the field-...
0
votes
1answer
14 views

Best way to query view functions in solidity from react with ether.js?

This is to interact with my smart contract. My contract has a function like this e.g: function getOfferById(uint256 _tokenId) public view returns (uint256) { require(_tokenId < MAX_B, "...
0
votes
0answers
12 views

Best practice for file storage on React Dapp

I'm currently building out my first Dapp and using React on the front end. An aspect of the Dapp will involve users being able to upload documents such as logos and descriptions. I know storing these ...
0
votes
0answers
23 views

Web3 sign promise won't resolve

I'm trying to build a login system using MetaMask. Everything is working thus far except for sending a signed message. The signed message goes through to MetaMask but then it gets stuck resolving the ...
1
vote
0answers
37 views

Deploying and Using OpenZeppelin PaymentSplitter in Web3

I currently have a contract that is creating an "item" for a customer to purchase. I've managed to follow a well put together tutorial for implementing this contract into my test network ...
0
votes
0answers
23 views

how can i show the value(uint256) in contract

I made a webapp by modifying it from https://github.com/RedSquirrelTech/hoscdev/tree/master/chapter-10%2B11 for newFundraiser.js I have it sent in monetary value, it will be msg.value and saved as ...
0
votes
0answers
44 views

it diesnt take the address as an argiesment and returns an uncaught promise

I keep running it this error. i can't get it to work. i need some help. Unhandled Rejection (Error): invalid address (argument="address", value="", code=INVALID_ARGUMENT, version=...
0
votes
0answers
17 views

How can I pass instance of provider and contract to all of my React components?

I have done the hardhat greeting tutorial found here and it was very helpful. To continue learning, I am building a slightly more advanced project that uses multiple react components. One thing that ...
2
votes
0answers
18 views

Is it conventional to host your dapp on a subdomain (e.g. app.uniswap.org), and why?

I've noticed the design pattern of having an enter app button from the home/landing page which opens the dapp in a new tab is quite common. This is something that I don't see in Web2 design. Is there ...
0
votes
0answers
15 views

Is it possible to change back to previous metamask acct?

I want to craete the following flow with web3 or etherjs 1- I change to wallet B 2- With the ui trigger the change to another wallet 3- It is changed on metamask but FROM the UI is it possible? im not ...
0
votes
0answers
11 views

Getting error on refreshing page react dapp using drizzle?

I am working on a dapp, it is working fine but one problem I am facing and it stuck my development. Please solve this if anyone knows how to do this and may be I am missing something?? PROBLEM when ...
0
votes
0answers
48 views

Uncaught (in promise) Error: Please pass numbers as strings or BigNumber

I want to convert the allocation amount to BN, but I have no success. Here is my code: const amount = web3.utils.toWei("1"); const busdPAir = await panCakeRouter.methods....
0
votes
0answers
10 views

Minting tokens that cover client's Tx fees and can only be used to interact with 1 smart contract [duplicate]

I'm working on a voting application. Is there a way to centrally mint tokens, hand them out to eligible voters/addresses, and only let users with this token vote? If so, can this token cover the ...
2
votes
2answers
546 views

What is the correct way to deploy a React app that uses MetaMask?

I am learning hardhat and ethers, so I made a create-react-app to interact with contracts on rinkeby. The react app works fine locally, but when I deploy it to Surge, I get an error and can't access ...
1
vote
0answers
17 views

How to send multiple function arguments to solidity smart contract from react.js using Drizzle?

I am trying to call a function of solidity contract that takes in multiple arguments(8 arguments). This is my contract function. function generatePet( uint256 _petPrice, ...
0
votes
0answers
12 views

The Graph Compound API

I want to build a small project to simulate app.compound.finance (with just eth token let's say) with The Graph , how can I get supply/borrows balance per users? (my defi app initial setup is done, ...
1
vote
1answer
129 views

Dapp using react-native and truffle

I have a blockchain dapp which is working fine in web browser. Wallet : Metamask OS : Ubuntu 20 Node : 10.19.0 Npm : 6.14.4 But, I would like to run the dapp in mobile view using truffle ...
0
votes
0answers
78 views

Deploying Goose Finance Front end and Connecting it to Smart Contracts

I recently learned the fundamentals of Solidity and had some smart contracts deployed on testnets using truffle. Also, I've done a simple dapp by finishing dapp university tutorials on youtube. ...
0
votes
0answers
29 views

Creating buttons for executing smart contract functions,How to work with smart contract instance in App.js

This is my App.js file which is related to a smart contract. I would like to know how is it possible to get access to the contract and create a button for executing a contract function which needs an ...
0
votes
0answers
9 views

How can I access the methods of an object in a contract using web3?

I am creating a front end, and right now I am trying to appove the token for transfer. I have an object, say token, instantiated in my contract as follows: ERC20 private token = ERC20(...
1
vote
0answers
31 views

Transfer ethers from smart contract to an account in metamask

I want to transfer 10 ether from smart contract to an account in metamask. I used the following script inside my smart contract : function transferBalance(address payable Add) public{ ...
1
vote
1answer
80 views

ALERT: Transaction Error. Exception thrown in contract code.(metamask)

i am working on truffle Pet-shop with react, i am using local blockchain ganache with metamask, The issue I'm encountering with my application is that when i am trying to call deleteAdopter function ...
0
votes
0answers
30 views

web3 loading issues

i am working on expense tracker dapp using redux/toolkit, when i call the addTransaction function, unfortunately transaction is not getting fulfilled but in console it throews error message 'TypeError:...
0
votes
0answers
31 views

How do I manipulate data in multiple contracts and output them

I am trying to manipulate data I retrieve from my contract, and then display it. Currently, I am running into 2 problems: 1- I am unable to manipulate the data correctly. 2- I am unable to display ...
0
votes
0answers
43 views

Drizzle not automatically updating value of balanceOf() of an ERC20 contract

I'm using drizzleReactHooks.DrizzleProvider to get the drizzle provider which is being received properly: <drizzleReactHooks.DrizzleProvider drizzle={drizzle}> <drizzleReactHooks....

1
2 3 4 5 6