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
11 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
8 views

PERSISTING CONTRACT INSTANCE TO BROWSER

I created a multiSignature wallet that is deployed by user upon inputting owners address and required confirmations. But contract instance goes off upon reload, i've tried using localStorage but that ...
0
votes
0answers
21 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
0answers
8 views

Default Javascript syntax with truffle [closed]

I have created a new truffle project with this command in an empty directory: $ truffle unbox react Here is an extract of client/src/App.js: import React, { Component } from "react"; import ...
0
votes
1answer
17 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
26 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
26 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
0answers
15 views

Can't call sellTokens function on a contract using React (Unhandled Rejection (TypeError): Cannot read property 'methods' of undefined) [closed]

I am trying to create a cryptocurrency exchange that allows users to buy and sell tokens for a fixed ETH price. I am using this tutorial: https://www.youtube.com/watch?v=64cMwfn9uek I have finished ...
1
vote
1answer
69 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
24 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
32 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
26 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
68 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
23 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
16 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
21 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
60 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
78 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
23 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
31 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
18 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
24 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
143 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
26 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
61 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
21 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
26 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
111 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
17 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
191 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 ...
1
vote
1answer
176 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
vote
0answers
48 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
15 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
151 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
26 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
14 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
17 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
25 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
36 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
26 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
50 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
69 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
57 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
43 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
202 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
39 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
1k 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
57 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
169 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
2 3 4 5