New answers tagged


This is probably because you are establishing the web3 connection only in your index.js; therefore, it is not accessible when you navigate into other pages. You can either use Redux to have global variables accessible from any page, or share data between components through properties.


The contracts_build_directory goes outside the networks section. module.exports = { contract_build_directory: "./client/src/contracts", networks: { development: {


You probably don't need to create a contract for every new product, as this would be expensive in terms of gas consumption. You can try something like this: // SPDX-License-Identifier: MIT pragma solidity 0.8.1; contract ManageProduct { struct Product { string name; uint256 price; } Product[] public products; ...


I updated your code with examples of creating array of contracts, passing data and reading that: pragma solidity ^0.6.0; contract Item { uint public blabla1; uint public blabla2; constructor(uint _blabla1, uint _blabla2) public { blabla1 = _blabla1; blabla2 = _blabla2; } function returnData() view ...


I still dont know what is causing the problem, but I found a work around. I made a bash script that tests each file individually, so that the truffle environment hard resets each time. Here it is. #!/bin/bash for filename in ./test/*.test.js; do echo "$filename" truffle test "$filename" --compile-none done

Top 50 recent answers are included