Error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.10.0) #6446
-
Issue: Trouble with FundMe ContractI'm currently facing an issue with the FundMe contract in the fundMe.test.js file. I suspect there might be an error in the fund and withdraw process. The error seems to be related to the fundTxResponse block. Any assistance would be highly appreciated. File: fundMe.test.jsconst { getNamedAccounts, ethers, network } = require("hardhat");
const { developmentChains } = require("../../helper-hardhat-config");
const { assert } = require("chai");
const { log } = require("console");
developmentChains.includes(network.name)
? describe.skip
: describe("FundMe", async function () {
let fundMe;
let deployer;
const sendValue = "10000000000000000000";
let MockV3Aggregator;
beforeEach(async function () {
deployer = ethers.provider.getSigner();
fundMe = await ethers.getContractAt(
"FundMe",
(await deployments.get("FundMe")).address,
deployer
);
/* fundMe = await ethers.getContract("FundMe", deployer);*/
});
it("allows people to fund and withdraw", async function () {
// Issue: Believing the error is here
const fundTxResponse = await fundMe.fund({ value: sendValue });
await fundTxResponse.wait(1);
const withdrawTxResponse = await fundMe.withdraw();
await withdrawTxResponse.wait(1);
const endingFundMeBalance = await fundMe.provider.getBalance(
fundMe.address
);
console.log(
endingFundMeBalance.toString() +
" should equal 0, running assert equal..."
);
assert.equal(endingBalance.toString(), "0");
});
});
### Issue: Error during FundMe Contract Test
#### Error:
```bash
Error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.10.0)
at makeError (node_modules/ethers/src.ts/utils/errors.ts:694:21)
at assert (node_modules/ethers/src.ts/utils/errors.ts:715:25)
at send (node_modules/ethers/src.ts/contract/contract.ts:310:15)
at Proxy.fund (node_modules/ethers/src.ts/contract/contract.ts:352:22)
at Context.<anonymous> (test/staging/FundMe.staging.test.js:24:45)
#### Relevant package.json depdnecies:
{
"name": "hardhat-fund-me",
"version": "1.0.0",
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"ethers": "^6.4.0",
"hardhat": "^2.19.4"
// Add other relevant dependencies
}
}
#### Goerli Etherscan Information:
- FundMe Contract Address on Goerli: 0xa7a75C37cd60900fC315df0a449a528779Bf0f94
- Price Feed Address on Goerli: 0xd4a33860578de61dbabdc8bfdb98fd742fa7028e
THank you for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
One thing to note is that ethers was on version 5 in the tutorial... Version 6 has seen quite a few syntax changes, so if you are working with ethers V6, which it looks like you are using ethers 6.10.0. You should check the page below. If you want the code to run the same as in the tutorial run: yarn remove ethers then yarn add --dev ethers@^5.5.3 If the problem still persists, you can send me a link to your repo and I can have a closer look. |
Beta Was this translation helpful? Give feedback.
-
@SimSimButDifferent, why should we downgrade the dependency from 6.x to 5.x. |
Beta Was this translation helpful? Give feedback.
-
@MTD26, for version 6.x try to add |
Beta Was this translation helpful? Give feedback.
-
if your ethers.js version is 6.x and you got this error: UNSUPPORTED_OPERATION |
Beta Was this translation helpful? Give feedback.
One thing to note is that ethers was on version 5 in the tutorial... Version 6 has seen quite a few syntax changes, so if you are working with ethers V6, which it looks like you are using ethers 6.10.0. You should check the page below.
https://docs.ethers.org/v6/migrating/
I have found this guide very useful.
If you want the code to run the same as in the tutorial run:
then
If the problem still persists, you can send me a link to your repo and I can have a closer look.