Comments (6)
code as follows:
const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();
async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
// const encryptedJson = fs.readFileSync("./.encryptedKey.json", "utf8");
// let wallet = new ethers.Wallet.fromEncryptedJsonSync(
// encryptedJson,
// process.env.PRIVATE_KEY_PASSWORD
// );
// wallet = wallet.connect(provider);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying,please wait...");
const contract = await contractFactory.deploy();
await contract.deployTransaction.wait(1);
console.log(Contract Adress:${contract.address}
);
//get number
const currentFavoriteNumber = await contract.retrieve();
console.log(Current Favorite Number:${currentFavoriteNumber.toString()}
);
const transactionResponse = await contract.store("900");
const transactionReceipt = await transactionResponse.wait(1);
const updatedFavoriteNumber = await contract.retrieve();
console.log(Undated Favorite Number is:${updatedFavoriteNumber}
);
}
//http://127.0.0.1:7545
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
RPC_URL=https://eth-sepolia.g.alchemy.com/v2/q2laUTdKYTZ2Q0im0ang8B8bBPbwbDOS
from full-blockchain-solidity-course-js.
please share the termianl output you are getting while running your code
from full-blockchain-solidity-course-js.
here is the output in terminal
Deploying,please wait...
Contract Adress:0x7c77C237E343c54398Fa4DfF5edC52D3BcDE4Acf
Error: timeout (requestBody="{"method":"eth_getTransactionReceipt","params":["0x6d6346fc22a83fe0d485fc883d79cfe546bfda196b97babdbe884658e3581099"],"id":66,"jsonrpc":"2.0"}", requestMethod="POST", timeout=120000, url="https://eth-sepolia.g.alchemy.com/v2/1sz9_3ooLQRKAltrKOU2XnYcUjvWNPBv", code=TIMEOUT, version=web/5.7.1)
at Logger.makeError (/home/sirhumphrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:238:21)
at Timeout._onTimeout (/home/sirhumphrey/hh-fcc/ethers-simple-storage/node_modules/@ethersproject/web/lib/index.js:187:35)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
reason: 'timeout',
code: 'TIMEOUT',
requestBody: '{"method":"eth_getTransactionReceipt","params":["0x6d6346fc22a83fe0d485fc883d79cfe546bfda196b97babdbe884658e3581099"],"id":66,"jsonrpc":"2.0"}',
requestMethod: 'POST',
timeout: 120000,
url: 'https://eth-sepolia.g.alchemy.com/v2/1sz9_3ooLQRKAltrKOU2XnYcUjvWNPBv'
}
from full-blockchain-solidity-course-js.
please this line to wait for the block confirmation :
await contract.deploymentTransaction().wait(1);
from full-blockchain-solidity-course-js.
Related Issues (20)
- Factory runner does not support sending transactions
- Gas estimation fAILED
- Lesson 4: Kovan RPC is down HOT 1
- TypeError: Cannot read properties of undefined (reading 'waitForTransaction')
- Lending Pool Error: Pool is Paused HOT 1
- TypeError: Cannot read properties of undefined (reading 'wait') HOT 1
- Error: failed to get chainId, falling back on net_version... ConnectTimeoutError: Connect Timeout Error HOT 1
- Help me in deploy.js HOT 4
- Error: could not coalesce error (error={ "code": -32000, "data": { "hash": HOT 4
- Lesson 10: TypeError: can't access property "toString", _ctx.sent is undefined
- Problem while running code HOT 3
- SPDX license identifier error HOT 4
- Error: cannot estimate gas; transaction may fail or may require manual gas limit HOT 2
- Moralis Self hosted server url and App id is necessary in the graph way? HOT 3
- Lesson07: Failed to get chainId, falling back to net_version HOT 4
- PLEASE HELP ME WITH THIS ISSUE
- transaction is revert inspite provinding the required eth HOT 1
- About the problem in Lesson 9, "Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. " HOT 1
- Lesson 7 error : "before each" hook for "should set the aggregator address correctly": TypeError: ethers.getContract is not a function HOT 1
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.
from full-blockchain-solidity-course-js.