Coder Social home page Coder Social logo

decentralized-voting's People

Contributors

techwithtim avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

decentralized-voting's Issues

Been unable to run the application as this error pops up.

Uncaught (in promise) Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="members(address)", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
at Logger.makeError (index.ts:269:1)
at Logger.throwError (index.ts:281:1)
at Interface.decodeFunctionResult (interface.ts:427:1)
at Contract. (index.ts:400:1)
at Generator.next ()
at fulfilled (index.ts:1:1)

I have set up hardhat in metamask and also deployed the contract. This error shows up while running react in the console.
Screenshot 2022-12-06 at 4 04 37 AM

'providers' is not exported from 'ethers'

Hello, Ray here. I ran into an issue regarding the "providers" interface while following your decentralised voting tutorial- with the error message 'providers' is not exported from 'ethers'

I have tried running npm install --save ethers , but it resulted in the same error message.

This is a code snippet from contract.js :

import { ethers } from "ethers";

const address = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
const abi = [
"event MemberJoined(address indexed member, uint256 joinedAt)",
"event VoteCreated(address indexed owner, uint256 indexed voteId, uint256 indexed createdAt, uint256 endTime)",
"event Voted(address indexed voter, uint256 indexed voteId, uint256 indexed option, uint256 createdAt)",
"function createVote(string uri, uint256 endTime, uint256 options)",
"function didVote(address member, uint256 voteId) view returns (bool)",
"function getVote(uint256 voteId) view returns (string, address, uint256[], uint256)",
"function join()",
"function vote(uint256 voteId, uint256 option)",
"function members(address) view returns (bool)",
];

const provider = new ethers.providers.Web3Provider(window.ethereum);

export const connect = async () => {
await provider.send("eth_requestAccounts", []);
return getContract();
};

export const getContract = async () => {
const signer = provider.getSigner();
const contract = new ethers.Contract(address, abi, signer);
return { signer: signer, contract: contract };
};

I am using pragma solidity ^0.8.9;

I've tried asking ChatGPT about it, but it gave no favorable answers. It seems that "providers" is not installed as part of the "ethers" library/package.

Would love to hear your opinions on how I could solve this, thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.