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 there any example of a drizzle-react dapp implementation that uses render props?

Render props were added after React 16.3 and the github readme for drizzle-react suggests to use them. The problem for is that there is no updated documentation (other then the small example in the ...
0
votes
0answers
24 views

getPastEvents undefined(please help)

I had asked this question before. I looked carefully at the exchange section, which I advised, and I think there is no problem with the exchange section. At least in my opinion there is no problem and ...
1
vote
1answer
21 views

Creating a contract instance

Is it generally better to define a contract instance once, then pass it through your components like... class Parent extends React.Component{ constructor(props){ super(props); ...
0
votes
1answer
29 views

TypeError: market.FileViewed is not a function while trying to watch event

I want to watch for fileViewed event and it throws TypeError: market.FileViewed is not a function in marketplace.FileViewed{ ^ My solidity contract: pragma solidity ^0.5.0; contract ...
0
votes
0answers
16 views

“drizzle-react-components” import Error for “LoadingContainer”

I am trying to import import { LoadingContainer } from 'drizzle-react-components' Which I succfully installed with npm install drizzle-react-components@1.3.0 It was installed inside the directory ...
0
votes
0answers
14 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
3answers
107 views

Why web3.eth.getAccounts().then(console.log) return empty array?

It's really weird that I got empty array after I tried to web3.eth.getAccounts().then(console.log);and I also got a warning which is ./node_modules/web3-eth-accounts/src/scrypt.js Critical dependency: ...
0
votes
1answer
32 views

Contract with multiple signing keys

How things work I have a Factory contract, FContract. FContract can be called by a user as many times as they want, creating instances of, let's call it, contractA. Thus, they're able to own as many ...
0
votes
1answer
63 views

Web3-core-helpers error: Uncaught (in promise) Error: Provided address “undefined” is invalid,

When I launch the app with with react.. this error occur when my exchange contract is loaded.. Here is the code i wrote to talk to the blockchain: export const loadBalances = async (dispatch, web3, ...
0
votes
1answer
131 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:\...
0
votes
0answers
23 views

Error: IPFSInbox has not been deployed to detected network

It's my first time writing smart contract in solidity and using IPFS to develop my dapp. I don't know how to solve it and why it pops up this errorNo web3 instance injected, using Local web3. Error: ...
0
votes
0answers
30 views

Payable function not working properly

Hi everyone hope I will be clear enough with the explanation because I couldn't find a proper solution. I am just trying to checkout an item with my buy function but it seems like I am stuck.Here is ...
1
vote
1answer
59 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(...
0
votes
1answer
68 views

getAccounts in web3 js undefined

I am working on dapp with web3js 1.0.0.37-beta with reactjs. I got blank in web3.eth.getAccounts. Following is my code App.js import React, {Component} from 'react'; import '../node_modules/...
0
votes
1answer
31 views

Code:const web3 = new Web3(window.web3.currentProvider) Error: window.web3 is undefined

I am going to connect my contract with the website.However,there was something wrong with the web3? I'm not sure. import Web3 from "web3"; const web3 = new Web3(window.web3.currentProvider); const ...
0
votes
1answer
78 views

Event emits multiple times on a solidity function call

I need have a problem, when I execute a solidity function, event emits multiple times, but when I refresh page then it works normally and only past events get called. Here is my code: ...
0
votes
0answers
24 views

How to use the ipfs.add() function?

Here is a function that I have written to add a file on clicking a button, which calls the function 'onSubmit' onSubmit = async (event) => { event.preventDefault() await ipfs.add(this.state....
0
votes
1answer
78 views

Why Web3 event callback fires multiple times same as the number of the solidity smart contract emitted that event in past?

I am just learning, solidity with react and web3 and I am facing the issue on page load the callback event of web3 called multiple time the number is same as I called a solidity function and that emit ...
2
votes
1answer
58 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 ...
0
votes
0answers
32 views

Error using drizzle and react

My contract Storage.sol - pragma solidity ^0.5.0; contract Storage { string public data; function getData() view external returns(string memory) { return data; } function setData(...
0
votes
0answers
12 views

Getting error when importing, no error when using code in single file: Failed to execute 'postMessage' on 'Window'

I am trying to access the web3 object injected into my browser by Metamask. I am using custom rpc (). I can see my accounts and correct balances in Metamask. I have the following code: //web3.js ...
0
votes
0answers
37 views

uncaught error:invalid address

Uncaught (in promise) Error: invalid address at inputAddressFormatter (formatters.js:271) at inputTransactionFormatter (formatters.js:97) at method.js:89 at Array.map (<anonymous>...
0
votes
1answer
47 views

How to deploy a smart contract to actual ethereum network instead of Truffle or Ganache?

I am building a react application using web3 to interface with Ethereum. At a bare minimum, it needs to create a contract, deploy said contract, store a value (i.e. a string: "test"), then later ...
0
votes
1answer
28 views

How to print “string” from Solidity in React?

My smart contract function is : function sNName(uint z)public view returns(string memory) { return abc[xyz[z].name]; } Where abc represents a mapping (bytes32 => string) In my .js file, I ...
0
votes
3answers
93 views

How to call a smart contract function in a DAPP?

I am trying to make a DAPP. I followed this link - https://medium.com/@takleakshar/how-to-build-a-decentralized-full-stack-app-in-ethereum-and-react-42e63d45a208 This is how my 'Setup.js' looks. ...
0
votes
0answers
41 views

How to Access Value of Drizzle ContractData Method

I would like to access the value of a Drizzle ContractData method: this outputs: 1000000000: <ContractData contract={name} method="getValue" /> Now, ...
1
vote
0answers
102 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
26 views

How to do loop all the metamask Accounts loop and display data from that address in React frontend + Dapp App JS [duplicate]

I want to Display data stored on the Ropsten Network in more then 2 metamask accounts. I want to display the result on the Home page in the table form. For that I need to loop through each ...
0
votes
0answers
48 views

How to get the value from the frontend form and save value to the blockchain using +web3 1.0.0-beta.37 + reactjs

I am writing my first Dapp and want to save the value of the form to the blockchain. I am Using React and web3 js 1.0.0-beta.37 on the frontend. Also I am new to react. Following is my App.js ...
0
votes
0answers
186 views

Can't resolve 'react' after installing additional dependencies to truffle react box

I am using a truffle box react - after truffle unbox react everything works fine Later however, after yarn add @material-ui/core I get an error: Can't resolve 'react' The same happens after ...
0
votes
0answers
12 views

How to console.log the value in the React js for the Dapp + truffle project

I am beginner with the ReactJS and Dapp. In my js page I want to get the value after doing some operation on the input value and want to dispay that result. I got the Nan in the front-end screen. ...
1
vote
1answer
80 views

No web3 instance injected following the dApp University Tutorials

I've been following Dapp University's videos on how to make IPFS uploads with Euthereum Smart contracts, and after I manage to 'npm run start' in the command line it opens up the HTML, but it always ...
1
vote
1answer
94 views

truffle unbox react - front end is unable to read / set state of the contract

I am experiencing problems with the Truffle React boilerplate code that the front end is unable to read / set state of the contract. Here are the details: I unboxed the React boilerplate using ...
2
votes
2answers
100 views

Metamask injects one account in web3, but calls contracts using another account

Building a React app, MetaMask injects web3, I get accounts[0] from getAccounts(), then pass it to my contract functions together with other parameters. I want my modifiers to lock incoming function ...
0
votes
1answer
34 views

Async getAccounts doesn't see my account

first time using MetaMask web3 Async getAccounts does not return my Eth account which I see in MetaMask. My fiddle https://jsfiddle.net/ysz11/qcv78h9z/1/ <!DOCTYPE html> <html> <...
0
votes
0answers
20 views

Web3NotFound Page rendering every time the drizzle-react DApp is refreshed

I'm trying to build a drizzle-react DApp. I want to implement a page called Web3NotFound.js which gets rendered when drizzle fails to find any web3 injected from MetaMask or Trust wallet browser. ...
0
votes
1answer
28 views

How to show the time when the blockchain contract called? [duplicate]

I want to show the time when blockchain contract called. I am currently saving the time in the blockchain using a method like this function userCheckIn(uint placeid) public { userCount++; ...
0
votes
1answer
45 views

How long does a smart contract typically take to complete?

I have been developing an application using a smart contract, the application is similar to this one: https://www.ethereum.org/crowdsale I went ahead and initiated a request, below is the codebase ...
1
vote
2answers
900 views

This contract object doesn't have address set yet, please set an address first

I am in the final stages of developing an application that is similar to https://www.ethereum.org/crowdsale, however, when I click on the create button, my Metamask modal is not popping up to ask me ...
0
votes
0answers
44 views

Smart contract hanging in react

I'm trying to make a call to my smart contract and write data to my blockchain, which is successful. However, after that completes I want to make an entry in a firebase database. The code appears to ...
0
votes
0answers
30 views

web3 provider is set to null when try to access for second time

Hello i have issue with my app. I'm using truffle unbox react envoirment. I have simple component which render form and on submit i want to redirect. After i go back to form web3 is null. Here are ...
0
votes
0answers
8 views

Web3 lose state when url is chaging in react

I have a strange issue with my web3. Once when app is load my web3 is configured correct. I have a form on which I can submit some data to my contract and everything works great, but when I try to ...
0
votes
2answers
91 views

No “from” address specified in neither the specified in neither the given options nor the default options

So I already went through this query, but I still couldn't get my doubt solved. Be it any Blockchain Dapp, the same error is coming for me. I used the marriage certificate and kickstart examples. Can ...
0
votes
1answer
98 views

Request user to sign state changing transaction with metamask using Infura and web3js

Can't seem to find the right function to ask the user to sign a transaction via metamask, this is my code so far: const bet = '102500000000000010' const account = '...
0
votes
1answer
77 views

web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

Keep getting this error and really not sure what's causing it. Smart contract: contract BasaltStore { // struct of how a document will be stored struct documentStore { // unique id of the ...
2
votes
1answer
70 views

Calling payable state changing function on client side with metamask in ethereum infura testnet

I can't seem to find an answer for my problem, or it's either impossible and I'm missing something, or it's trivial and I'm missing something. I have this function on client side: const bet = web3....
1
vote
1answer
24 views

Blockchain Dapp

I am trying to develop a website for verification of certificates using React and Solidity. I have reached a stage where a student can request for a certificate but I want a notification to go to the ...
1
vote
1answer
123 views

How to prompt and create Smart Contract using React

Weird question, so I have created a smart contract, verified that it works, even deployed it using Web3, Metamask and HTML/Javascript. I understand that worked. Now I am trying to integrate it into ...
0
votes
0answers
56 views

Store data on ethereum block chain using react js

I'm trying to store data on ethereum blockchain by doing this import storemetadata from "./storemetadata"; where i have the smart contract ABI in storemetadata I now add name like so storemetadata....
0
votes
0answers
17 views

Error when calling Ethereum Contract

I am using a JS library which calls Solidity functions and I been getting the following error: 0x0c444aa3066f98d5f7ee576401e7729cb1113fe288d38711a78e48836313e88c App.js:112 TypeError: createLog is ...