npm.io
1.0.1 • Published 3 years ago

target-block

Licence
MIT
Version
1.0.1
Deps
1
Size
4 kB
Vulns
0
Weekly
0

target-block

A module to check for a specific block height to reach

Just need to define your RPC node(provider) and number of confirmations you wish to wait for.

Get started

  1. Create your project: mkdir project
  2. Enter your project folder: cd project
  3. Download and install target-block package: npm i target-block
  4. Create new file in your project. for example: index.js 5.Use the target-block package into your codes like this:
const waitForTargetBlock = require('target-block');
const RPC_URL = "https://singapore.rpc.blxrbdn.com";
const howManyConfirmations = 5;

waitForTargetBlock(howManyConfirmations, RPC_URL)
.then((result) => {
    console.log("Target block reached:", result);
})
.catch((error) => {
    console.log("Error:", error);
})

Main motivation behind target-block

I was trying to verify my contract programatically on Sepolia testnet. When I supposed to deploy and verify smart contract on block explorers(such as etherscan.io) I noted that, we can't do both at the same time!

So how to figure it out??
How to wait for a certain block heigth??

Easily with the help of target-block package!!

- Bahador Ghadamkheir (target-block first release, 2023-07)


Helping to getting even better

If you found any issues, or have any recommendation on this package, I would be more than happy to see your comments. Also pull requests are very welcomed.

Keywords