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
1
vote
0answers
31 views

Execution erorr: Invalid opcode on estimateGas | Possible unhandled promise rejection

pragma solidity ^0.5.0; I get invalid opcode error when trying to estimate gas needed for my transaction from react-native using the following line of code: const gasAmount = await contract.methods ...
0
votes
0answers
13 views

Why am I receiving the error when running “npm run start” for the client folder inside the truffle react box? [closed]

I am getting the following error when I run npm run start for the clients folder inside the truffle react box. Here's the error:- There might be a problem with the project dependency tree. It is ...
0
votes
0answers
14 views

Performance of Dapps when millions of records to be fetched

I am thinking of Dapp with react js and ethereum. Using IPFS for data storage. Let's assume that blockchain holds millions of hash addresses from IPFS. I need to show those millions of records and ...
0
votes
1answer
28 views

ipfs.add is not working

I am trying to upload my file to IPFS and save its hash to my Ethereum contract but neither ipfs.add nor ipfs.files.add is working for me... I have tried usin for loop i.e. for await (const result of ...
0
votes
0answers
7 views

Adding a web2 Landing Page (homepage) to a drizzle-react based web3 app (dapp)

I'm trying to create an ethereum dapp using create-react-app & drizzle Hooks. My dapp requires the landing page (homepage) to not ask for metamask linking or drizzleProvider injection, and to keep ...
0
votes
0answers
11 views

Exucution of a payable function does not transfer any value between accounts when executing event on Ganache

I have created an smart contract that sends value from one account to another when calling the following function: function buyEnergy(uint _sellOrderId, address _sellerAddress ) public payable /*...
0
votes
0answers
8 views

web3.eth.accounts.wallet.create() works on desktop Chrome but not on mobile

The following lines of code work (a generator function of redux-saga in my React app) on desktop Chrome. However, it does not work on desktop Safari, iOS, and mobile Chrome (on Android). Did not works ...
0
votes
1answer
23 views

Error when retrieving the instance of a deployed contract

I have developed a EnergyExchange DApp in the Ganache local network with React that consist of one main contract "EnergyExchange". This main contract has a function to deploy new Agent ...
0
votes
1answer
13 views

Error when calling a get function from a deployed contract instance

I have developed a EnergyExchange DApp in the Ganache local network with React that consist of one main contract "EnergyExchange". This main contract has a function to deploy new Agent ...
0
votes
0answers
18 views

How to connect local private geth nodes to the web page without using metamask or mist?

I'm developing a web wallet similar to meta mask that can make transactions or can create accounts from UI. Frontend is developed using React. Blockchain is implemented in geth.I'm using truffle react ...
0
votes
1answer
29 views

How to save the contract instance on a mapping in solidity?

I have created an EnergyExchange contract in my React app.js that it is deployed in the network. Inside the EnergyExchange contract there is a function to create Agent contracts. What I am trying to ...
0
votes
0answers
27 views

My Crowdsale contract wont transfer ERC20 tokens and all transactions fail

I have a crowdsale contract that recieves tokens directly from a mint function in my token contract.the function mints the tokens and sends its to the Crowdsale account address. when I run let token = ...
0
votes
1answer
49 views

where to host my react fornt end and express endpoint that interact with smart contract to be fully decentralised?

where to host my react fornt end and express endpoint that interact with smart contract to be fully decentralised. Are there any option to host it decentralised any cloud provider other than ...
0
votes
1answer
26 views

Array lenght and data miss match while storing data of events

Can someone help me in finding what is wrong here a why the length of task info is 0 even the taskInfo has some data. I'm using events to fill the taskinfo array. I'm stuck at this place for almost 2 ...
1
vote
0answers
28 views

how to display a struct inside mapping inside struct in solidity on react js frontend

I have a mapping of struct (mapping (address => struct)) inside another struct. I'm having issue in how to display the struct in the front end while using Reactjs.
0
votes
2answers
43 views

Trying to connect front-end application with smart contract

I am creating a simple registration and login forms in React.js and connecting it with smart contract in order to use it to store the data from the front and to the blockchain is there any method or ...
0
votes
2answers
32 views

Call and Save Returned Value from Method in React

I am trying to call a method from my smart contract (myMethod) and save the result (result) as a state (this.state.result) in react. However, my state is not being updated to the result. My code is ...
1
vote
1answer
105 views

How to disconnect MetaMask wallet using Web3modal

I am using metamask with kovan to connect to the wallet import React, { useState, useEffect} from 'react'; import Web3 from "web3"; import Web3Modal from "web3modal"; import Navbar from './components/...
0
votes
1answer
34 views

Accessing array within struct in a mapping using web3.js

I have created a struct patient as follows, and a mapping of uint->patient. struct patient { uint pId; string name; string phone; address payable owner; uint numRecords; uint[]...
1
vote
1answer
64 views

DApp examples containing complete source code

can someone provide me some high quality ethereum dapp codebase examples? This should comprise of not only the smart contract codebase but also the app codebase , complete with the front end UI (...
1
vote
0answers
33 views

Contract not returning error to React Interface

I have a contract which I've tested with Mocha and Remix and is working just fine. The problem is when I'm running it with my React Interface. When I call a function in my solidity contract that ...
1
vote
1answer
90 views

Drizzle cacheSend outputs “cacheSend is not a function” error, but the tx works when using send

I'm using Drizzle and react-hooks in my new open source project, but cacheSend outputs always "cacheSend is not a function" This line of code with send works as expected const stackId = contract....
0
votes
1answer
19 views

Smart contract function not returning expected output

I'm quite new at this and I'm learning both Solidity, Javascript and React to play around with smart contracts. My contract ran well in Remix and in a local test net. I ran a bunch of tests using ...
0
votes
0answers
14 views

How do I get a structure of a mapping inside a structure?

So. I started using too many mappings. Now I'm not sure how to get the information on the front: struct Demand{ uint remuneration; uint delay; uint deadline; string description; ...
0
votes
1answer
20 views

solidity function works perfectly in remix but in react application it is not executing in the same way

in Remix i execute it and it works as i expecting and when i check the value from other function it returns the expecting value function makeadmin(string memory cityN, address adminAdress, string ...
2
votes
0answers
43 views

No “from” address specified in neither the given options, nor the default options [closed]

Uncaught (in promise) Error: No "from" address specified in neither the given options, nor the default options. at Object._executeMethod (index.js?2fac3b5:942) at CampaignNew._callee$ (new.js?...
0
votes
0answers
14 views

Error while unboxing trufle react

gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess....
0
votes
1answer
19 views

Web3 call should return different result based on time passed

I am experiencing a weird issue. I am building a DApp where I want the new season of the game to start every 5 minutes (for testing purposes). However, web3 call returns old data, seems that it cached ...
2
votes
1answer
161 views

Refresh page upon MetaMask Confirmation. Web3js & React()

I would like to reload the React Web3 wallet's page upon MetaMask Confirmation. Meaning when the ERC-20 token send transaction is confirmed, the page should reload or state should update to display ...
0
votes
2answers
14 views

Calling Contract Function

I am trying to call a function from my back-end to my front-end. I know that my contract is deploying, however, I don't think my function is not being called correctly. My code is provided below. Does ...
0
votes
2answers
34 views

Deploying a Contract vs. Instantiating a Contract

I apologize for the very basic question but I am a little confused. What is the difference between deploying a contract and instantiating a contract?
0
votes
1answer
21 views

Deploying Contract with React

I am trying to deploy a contract on react. But I can't seem to pull it off :( This is my code: this.myContract.deploy({ data:[big boi bytecode here], arguments: ['name', '...
0
votes
1answer
58 views

Unhandled Rejection (TypeError): this.provider[(intermediate value)(intermediate value)(intermediate value)] is not a function

I am receiving the error: "Unhandled Rejection (TypeError): this.provider[(intermediate value)(intermediate value)(intermediate value)] is not a function". However, I have not used "this.provider" in ...
0
votes
0answers
23 views

Truffle Object Keeps Changing to Undefined When I Try To Play With Data With React

The question is in the title. I have a React Component that displays the appropriate data when I do it in a very specific way, but breaks when I try to play with the data. state = { dataKey: "1",...
0
votes
2answers
27 views

mapp values do not upadte when calling other functions after populating the map

I am using react as my front end to call functions from smart contract . this is the front end where i call the functions. However, after calling the first function which populates the map I then ...
1
vote
1answer
40 views

TypeError: tests is not a function Error in Truffle

I am following an online tutorial, doing almost exactly like the instructor. I have the following error every time I try to run 'truffle test' my truffle-config file: module.exports = { // See &...
1
vote
0answers
20 views

How to use Web3Js to sign a message in a react native mobile app [closed]

I am very new to Ethereum. I have requirement to sign the app using Web3JS in my React native mobile App. I used this link to get web3js working properly. But I am not sure how to connect to wallet ...
1
vote
1answer
52 views

Unable to get metamask account with web3

I have been following a tutorial on creating solidity contracts. I am unable to get the list of account numbers on my metamask wallet when I use my script below. async componentWillMount(){ ...
0
votes
0answers
28 views

Interacting with client side metamask in serverside rendered react

i'm new to using web3 and am building a react app served from the server that will connect to an infura node. I've read that metamask injects web3 by default but have seen some mentions that it won't ...
0
votes
0answers
54 views

Handling custom render of inputs, Drizzle ContractForm - react

I'm trying to make work drizzle's ContractForm with custom render of inputs, sadly, I can't trigger submit, code looks as follows: EDIT: Figured it out, given code should work. <ContractForm ...
0
votes
0answers
39 views

How to pass a selected radio button value in reactjs to ethereum blockchain

I am new to react and ethereum. I am working on voting dApp where I want to pass the selected candidate with a radio button in react to the blockchain. How do i go about it? here is my code. I have ...
1
vote
1answer
37 views

Transaction working in remix but not errored from dapp

I have a master contract which deploys instances of other contracts. pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; contract DataEntityContract { DataEntity DE; constructor(...
0
votes
0answers
27 views

Unable to render inside (callback function) using react for web3.eth.subscribe

import React from 'react'; import ReactDOM from 'react-dom'; import Web3 from 'web3'; class App extends React.Component { componentWillMount() { this.loadBlockchainData() } ...
1
vote
0answers
34 views

What are the differences between Drizzle and the Truffle React box?

Truffle has many "boxes", two of which are: truffle unbox react And: truffle unbox drizzle They both seem to be focused on frontend development. Other than Drizzle being based on a Redux store, ...
1
vote
1answer
89 views

How to mock an ethers provider while testing with jest?

In the real app, I'm using the web3-react hook to inject the provider, etc. How do I best mock that/replicate that in a Jest Typescript environment?
0
votes
1answer
167 views

How to create account using mnemonic words or private key in web3js and call contracts using that account

I have a simple React Project with web3@1.2.4 installed and I want to call a contract's method like this: await maincontract.methods.CurrentMethod("arguments").send({ from: accounts[0]/*my account ...
1
vote
0answers
16 views

Event listener doesn't trigger setState in web3js

I have the following function that does something with a smart contract, and then should manipulate the dapp state when the event has been received. However, it doesn't set the state of the dapp, and ...
1
vote
1answer
83 views

Error: Invalid number of parameters for “Method”. Got 3 expected 2!

I have React app that executes a Smart Contract payable function at some point. The call is below: try { await contract.methods .post( this.state.param1, `${this.state.param2}`, ...
1
vote
1answer
34 views

Watching for events

How come sometimes events show up on block explorers in hex and sometimes to you can see the actual string name of the event in the logs. I ask because my event watchers on my front end only pick up ...
0
votes
1answer
619 views

npm ERR! code ENOENT npm ERR! syscall spawn git

I use the command npx truffle unbox react to develop a dapp but I get these errors below in my console. Can anybody help me? I really don't know how can I solve them.

1
2 3 4 5