Replies: 1 comment 3 replies
-
You installed v6, which no longer had a |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, Ray here. I ran into an issue regarding the "providers" interface- 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
Beta Was this translation helpful? Give feedback.
All reactions