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
13 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
4 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
7 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
108 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
12 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
9 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
41 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
23 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
11 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
24 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
40 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
23 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
29 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
29 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
vote
1answer
409 views

connecting to Metamask using React.js and Next.js without having to refresh the page each time

StackShare question Hello, I am having a problem with connecting to Metamask dynamically. I created a voting website using React.js and Next.js, and was using UseEffect() to connect to Metamask. ...
0
votes
1answer
37 views

Calling view functions when user does not have a web3 provider

I am building a React App. I built it using a truffle box. The first thing the app does is try and get Web3, I understand that this allows the app to communicate with the blockchain. This works well ...
1
vote
1answer
258 views

Metamask API: can't detect events “connect” and “disconnect” in React.js

Hello I'm very new to developing. I'm testing communication with Metamask via React.js I managed to succesfully listen to Network and Account changes, but when I try to detect if someone "...
0
votes
0answers
66 views

Detect Lock/Unlock actions in MetaMask

I want my dApp to detect Lock/Unlock actions in MetaMask, just like in: Remix=>"Deploy & Run transactions"=>"Injected Web3" ethereum.on('accountsChanged'... - is not ...
1
vote
2answers
25 views

Is there a websocket URL in Ethereum classic like in Ethereum?

Can anyone tell me whether or not there is a WebSocket URL to deal with smart contract events in Ethereum Classic especially? I know ethereum supports WebSockets and we can easily listen to events ...
0
votes
1answer
29 views

Function calls in React to deployed contracts return nothing

I have a simple lottery contract. When I call functions to it from Remix IDE I get the expected result. However, when I make calls to it from React, I get nothing back (such as from manager() or ...
0
votes
1answer
41 views

ipfs.add TypeError: AbortController constructor: 'new' is required

I am using latest version "ipfs-http-client": "^48.2.2" <form onSubmit={ async (event) => { event.preventDefault() try{ ...
0
votes
0answers
42 views

transaction receipt not working

I use react and web3 to interact with metamask. Until yesterday every thing was fine. but, today some of the transaction results are not returning. I use this code to load web3 let web3 if (window....
0
votes
1answer
60 views

The “from” field has been defined when sending a transaction, but the error still occurs

Problem I am following this tutorial on how to make a donate button on my React app. The tutorial is in HTML, however, so below is my attempt at converting it to ReactJS. Code App.jsx donate = () =>...
0
votes
1answer
27 views

Old contracts data not visible if pushed new contracts?

I created a contract campaign and deployed this contract in infura , then I called some functions of the contract which created the subsequent data(as in list of ongoing campaigns) in blockchain. In ...
0
votes
0answers
432 views

Cannot find module 'fs-promise' Error when importing a smart contract instance

I get this error when I try to open a page in the DApp I'm developing. Error: Cannot find module 'fs-promise' Require stack: - /Users/eimanalwahhabi/Desktop/RecycleChain/node_modules/swarm-js/lib/api-...
1
vote
1answer
510 views

Provider does not have a request or send method to use

I am doing the Ethereum and Solidity: The Complete Developer's Guide and I am unable to resolve this error. The code is expected to do a transaction via await factory.methods .createCampaign(this....
1
vote
1answer
37 views

Publish a File and Other Values

Background I'm working on this app that allows users to upload PDF files to IPFS. A Document consists of the title, address (the uploader), price, description, and the file itself. I've looked at ...
0
votes
1answer
120 views

Storing hash on blockchain (hash of image stored on ipfs)

I am creating a dapp using react to store image on ipfs and the corresponding hash on blockchain. The purpose of storing hash on blockchain is timestamping, proof of ownership wtc and i wish to ...
0
votes
1answer
55 views

How to extract signature from web3.eth.sign or web3.personal.sign

In React Typescript (.tsx file), I'm trying to use web3.eth.sign to validate an account. The signature is being generated properly, but I can't seem to get the signature out of the callback function. ...
1
vote
1answer
561 views

Best way to go about connecting multiple wallets to Dapp

What I want: A user to connect a wallet to my dapp (1 of 4 choices, say: Metamask, WalletConnect, Formatic and Portis). The flexibility to create a custom "wallet connect modal" (I've tried ...
0
votes
1answer
27 views

Giving me error while trying to pass the string in constructor of a smartcontract

This is my Election smart contract. pragma solidity ^0.4.17; contract Election{ struct candidate{ string name; uint votecount; } struct voter{ bool authorized; ...
0
votes
0answers
19 views

How can I access data of transaction topic?

I need to access the data from topic 2 below (see image): With this code I can render the topic hash, but not the topic data: contract .getPastEvents('allEvents', { fromBlock: START_BLOCK, ...
0
votes
0answers
37 views

Frontend for OpenZeppelin ERC20 token and Crowdsale

does anyone know if there are any resources online for a front-end app.js for a simple ERC20 token for a crowdsale? I am looking to build out a front end that will allow log-in with Metamask and buy ...
0
votes
1answer
182 views

Web3/JS: Unable to read a “public view” function using “.call()” while the call to the other functions (eg payable, etc…) work fine

I am posting a question here that I already posted on stackoverflow before I was aware of this ethereum forum. Not sure about the etiquette when doing this so please tell me if I should delete the ...
0
votes
0answers
408 views

web3-react does not appear to be exposing Ethers.js instance

I've configured the web3-react package in my project (set up with the React Truffle box) but I don't seem to be getting an ethers.js instance in the context. According to the package page, the web3-...
0
votes
0answers
30 views

Localhost3000 not recognizing Metamask walllet

I have run npm start and have connected my metamask wallet via a custom RPC ganache host: 127.0.0.1: 8545 with chainID 0x539 on metamask. The ChainID i am not sure about as when I entered the NewRPC ...
0
votes
1answer
144 views

Why calling to methods from Web3 using call() give errors although set functions with send() work

I'm new to solidity and I'm just testing some examples from tutorials. The problem is that I can't call get functions although I can call set function. I'm using Remix IDE for smart contract, Geth for ...
0
votes
0answers
23 views

How to create a web3 connection in react interface?

I have created a simple login and register interface using react js and want to connected through web3 or any other method with a smart contract to stored the registered user's data on the blockchain ...
0
votes
0answers
80 views

Generating a React UI given a contract ABI

Is there a way to automatically generate a React input form as per a contract address and ABI input by a user? The user inputs a contract address and an ABI. Now, an input form is generated for him as ...
0
votes
0answers
492 views

How to deposit ETH into my contract from React front-end with web3.js, truffle, ganache?

currently, I'm struggling to solve an error that occurs when a user deposits funds into a contract from the react.js interface. ●Environment Solidity Compiler 0.6.0 Blockchain: Ganache 2.4.0 Web3: ...
0
votes
1answer
43 views

Get enum value from smart contract with javascript

This is my contract: enum State { Active, Refunding, Pending, Releasing} function state(uint orderid) public view returns (State) { return State.Releasing; } In one Javascript to ...
0
votes
2answers
214 views

Unhandled Rejection (TypeError): this.web3.eth is undefined

My getWeb3.js file: import Web3 from 'web3' export default async () => { var web3Provider = null; if (typeof window.ethereum !== "undefined") { web3 = new Web3(window....
0
votes
1answer
29 views

What are the required platform to make mobile app that has dapp features?

I recently went over dapp with ethereum block chain but most of the coureses and documentation follows example in webApps. I want to know what are the possible frameworks/library, technology/ ...
0
votes
0answers
74 views

Drizzle react app , how to display functions return values?

I have written an asset transfer contract wherein a function createAsset returns a uint256 assetNo and emit an event (event NewAssetNo(string _message, uint256 _assetno); I am not able to display the ...
0
votes
1answer
312 views

Can we decrypt a message by using private key through Metamask

Say I have a hash of a file which is stored on IPFS.I want to encrypt the hash with public keys of few people. How can I do the encryption of the hash (encrypted hash should be stored on smart ...
0
votes
0answers
25 views

Send from Drizzle useCacheSend hook sends trasactions twice

I'm following the old documentation about hooks and I'm getting a problem at sending transactions: every transaction is sent twice, why? The next is the current core: <form onSubmit={...
0
votes
1answer
594 views

Web3 error handling in React

This is really a two part question. First, the only way I can get the error message thrown by a Smart Contract require statement is to call the function first with a call rather than a send. send does ...
2
votes
2answers
362 views

Error: Unhandled Rejection (Error): This contract object doesn't have address set yet, please set an address first?

I was learning Solidity through Remix and I decided to make a simple front-end application with pure HTML and CSS, it worked using Rinkeby. Then I discovered Truffle and since then I try to make the ...

1
2 3 4 5 6