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.

78 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
598 views

Truffle unbox drizzle not working properly

truffle version = 4.1.4 truffle unbox drizzle truffle compile truffle migrate npm run build npm run start this gets me this error: Truffle Drizzle-box fails with TypeError: (0 , _drizzle....
3
votes
1answer
948 views

Drizzle cacheCall is not updating data correctly

I have a react component which is interacting with a solidity contract via drizzle. I store a cacheCall index in the constructor: this.opcTokenCacheCallIndex = context.drizzle.contracts.OPCToken....
3
votes
2answers
20k views

TypeError: Cannot read property 'then' of undefined

I am having an error with Web3. After going through all possibilities I decided to post a question hoping for someone with a solution. The error I keep getting is: TypeError: Cannot read property '...
2
votes
1answer
152 views

Uncaught (in promise) Error while opening and doing transaction on private ethereum blockchain using web3 and go-ethereum

I am trying to integrate a react app with go-ethereum using web3js. an event Onsubmit will do the following: 1. Create an account. 2. Open the account. 3. Approve a smart contract with the created ...
2
votes
0answers
204 views

Solidity get return variable from a send method in React

I'm trying to call a method that pushes data to my Blockchain and then returns back the ID of the new struct I created. This is how I'm calling the method in my React code: const documentId = await ...
2
votes
0answers
79 views

Use React Dev Tool in developing MetaMask

I am new to MetaMask, and learning how MetaMask works. I found MetaMask UI was implemented with React, so I tried to use React Dev Tool, but I am not able get it working. Please help. I started stand ...
2
votes
0answers
330 views

Truffle constant functions run out of gas, how to simulate a local node

I am new to solidity and web3. I am getting familiar with Truffle, testrpc and web3 1.x. I am also using React as a front end. I know that functions that don't change the smart contract state can ...
2
votes
3answers
2k views

Accessing web3 object in Chrome terminal using React

I am receiving a "not defined" error when trying to access the web3 object in Chrome terminal. My current setup: running testrpc web3 object successfully instantiated in App.js built app using React ...
1
vote
0answers
27 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.
1
vote
1answer
35 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/...
1
vote
0answers
32 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
0answers
31 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
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
32 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 ...
1
vote
0answers
141 views

Help me fix Error: No “from” address specified in neither the given options, nor the default options. I'm use MetaMask

file web3.js import Web3 from 'web3'; const web3 = new Web3(window.web3.currentProvider); export default web3; file image.js import web3 from './web3'; const address = '...
1
vote
0answers
15 views

Any idea how to add new contracts into drizzle react app using the address?

I have a react app which creates new contracts. lets say A creates B. I have the addresses of the newly created contracts of B. How do i add the newly created contracts of B using its address to ...
1
vote
1answer
31 views

How can I add new contracts generated from a factory to my drizzle-react app?

I have a Factory contract which creates new contracts. How do I get the new contract into my drizzle-react web app? I am using to send the transaction to create a new contract but I don't know how ...
1
vote
0answers
20 views

How can I specify a date picker in one of the fields in my ContractForm React component?

I'm using the ContractForm React component available in the drizzle-react-component library. It's super nice and easy to setup and use, but I am dealing with a date in one of the fields (which is ...
1
vote
1answer
2k views

gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1

I used the command truffle unbox react to build a dapp. It is just the initial step of my dapp development. However, it sucks. It continually pops up gyp ERR! build error gyp ERR! stack Error: `C:\...
1
vote
1answer
169 views

Both web3.eth.accounts.create() and web3.eth.personal.newAccount() not working

I'm making a dApp on reactjs. I wanted to create a new account and have done it trying 2 methods this.web3.eth.personal.newAccount() this.web3.eth.accounts.create() I have attached the code below(...
1
vote
0answers
213 views

How to use web3-react with truffle Dapp? any sample code / tutorial?

I am new to react and finding issues with the front-end of the Dapp application. Especially in web3 version > web3 1.0.0 I just heard about the web3-react and I think it will be a lot easier. I ...
1
vote
0answers
21 views

Adding additional info for initial state of Drizzle

How do I add extra content to the initial state of drizzle? I want to keep some local information that is not dependant on the blockchain. Should I keep a seperate redux store for that or is there a ...
1
vote
0answers
246 views

metamask and infura - Managing and signing with private keys

I am using Infura as a node for my DApp so I need to send raw transactions by signing them. These transactions can come from multiple users of an application so each user must sign and send a raw ...
1
vote
1answer
498 views

How to get the returned value of a smart contract function when it called by using cacheSend() in drizzle

I just tried to build a simple DApp using truffle, react and drizzle. My question is how to get the returned value of a smart contract function when it called by using cacheSend() in drizzle? As ...
1
vote
1answer
152 views

Unable to deploy smart contract to rinkeby using ledger wallet?

I am trying to deploy smart contract using ledger wallet. But i keep getting the error cant subscribe to new header. However i get the transaction hash but cant receive the contract instance and ...
1
vote
0answers
158 views

How to update react component state with Drizzle

I'm using react and drizzle and want to update the classes state based on data returned from a call to a contract. I'm using the standard pattern from the drizzle box and here (https://itnext.io/how-...
1
vote
0answers
190 views

set default amout to transaction

I have a ticket system where you can buy some tickets to an given price. I want to set the amount to the method and send it back to the contract. For this I'm using metamask but I don't really get, ...
1
vote
0answers
163 views

There is any open source for mnemonic (recovery) phrase can be used in react project?

I want to know how to implement 12 words or 24 words mnemonic(recovery) phrase screen as "Create Wallet" part in the ethereum, ERC20 token wallet project built with React Native like as coinomi wallet....
1
vote
0answers
191 views

cannot get return variable(s) in javascript when using require in solidity

I have a function in solidity that returns a few bytes32 variables. I cannot for the life of me access those variables. Can someone please help? function getData() public returns (bytes32, bytes32, ...
1
vote
2answers
3k views

Create an Ethereum wallet with React Native for single token

Many of you might think that this question has already been answered but I don't think that there is a clear answer on the internet for the current Ethereum, Web3.js and React Native versions (for ...
1
vote
0answers
305 views

Drizzle React Component ContractData for array returns empty

<ContractData contract="TheContract" method="getData" methodArgs={[accounts[0], "0", { from: accounts[0] }]} /> and a contract view function function getData() public view returns (...
1
vote
0answers
288 views

Web3 Eth Filter does not seem to work

I am using Ganache as my test network and I am running React as my front end. My ComponentWillMount() is as follows: componentWillMount() { getWeb3 .then(results => { this.setState({ ...
1
vote
0answers
510 views

“Truffle unbox react” Not Working Properly

I am facing problems running the basic official setup of react and truffle. Here's what I did: truffle init truffle unbox react truffle develop truffle(develop)> compile truffle(develop)> ...
1
vote
0answers
76 views

Is the following model correct for a DAPP?

I am trying to make a DAPP using React Native. I have made a flowchart of all the pieces i need to build in order for it to work. I was hoping if someone could verify it so that I can start working ...
1
vote
0answers
811 views

How to fix 'Waiting for roots to load…' in react-devtools for a dApp?

I am building a Parity UI dApp from the Skeleton dApp at https://github.com/paritytech/skeleton and I want to debug it with Facebook's react-devtools Since Parity renders the dApp in an iframe, I ...
0
votes
0answers
8 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
11 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
10 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
25 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
20 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
48 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
36 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 ...
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
0answers
13 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
2answers
31 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
0answers
21 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
0answers
24 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
48 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
37 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 ...