decentralized-voting's People
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.
'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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.