# target-block

> A module to help waiting for specific block number(block confirmations)

Latest version **1.0.1** (published 2023-07-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install target-block
pnpm add target-block
yarn add target-block
bun add target-block
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-07-19 |
| First published | 2023-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bahador Gh |
| Maintainers | bahadorgh |
| Keywords | hardhat, blockchain, web3, ethereum, defi, dapp |

## Links

- npm: https://www.npmjs.com/package/target-block
- Homepage: https://github.com/BahadorGh/target-block#readme
- Issues: https://github.com/BahadorGh/target-block/issues
- npm.io page: https://npm.io/package/target-block

## Dependencies (1)

- [ethers](https://npm.io/package/ethers.md) ^5.7.2

## Recent versions

- 1.0.1 (latest) — 2023-07-19

## README

# 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. :smirk:


## 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:

```javascript
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);
})
```

<div class="warning" style='padding:0.1em; background-color:#E9D8FD; color:#69337A'>
<span>
<p style='margin-top:1em; text-align:center'>
<b>Main motivation behind target-block</b></p>
<p style='margin-left:1em;'>
I was trying to verify my contract programatically on Sepolia testnet. When I supposed to <span style='color:green'>deploy and verify smart contract</span> on block explorers(such as etherscan.io) I noted that, <span style='color:red'>we can't do both  at the same time!</span><br/><br/>
<b>So how to figure it out??<br/>
How to wait for a certain block heigth??</b><br/><br/>
Easily with the help of <i style='color: red;'>target-block package!!</i>

</p>
<p style='margin-bottom:1em; margin-right:1em; text-align:right; font-family:Georgia'> <b>- Bahador Ghadamkheir</b> <i>(target-block first release, 2023-07)</i>
</p></span>
</div>

---

🕊️ **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.*

---
_Source: https://npm.io/package/target-block · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
