@i0san/block-timer
v1.0.7
Published
A multichain counter. A React component library.
Downloads
2
Maintainers
Readme
block-timer
A multichain counter. A React component library.
V1 - Counts down to a future time defined in number of blocks on a specific Blockchain network.
Install
npm install @i0san/block-timer
Usage
import { useBlockCountdown } from "@i0san/block-timer";
function MyApp() {
// Set target date 100 blocks ahead from now (Bitcoin network)
const { days, hours, minutes, seconds } = useBlockCountdown(100, "bitcoin");
return (
<>
{days}days {hours}hours {minutes}minutes {seconds}seconds
</>
);
}
Supported networks
"bitcoin"
"ethereum"
"goerli"
"polygon"
"mumbai"
"bsc"
"bsc-testnet"
"cardano"
"cardano-testnet"
"solana"
"dogecoin"
"fantom"
"harmony"
"avalanche"
"avalanche-testnet"
"arbitrum"
"arbitrum-testnet"
"optimism"
"optimism-testnet"
// add more blockchain networks and their average block times as needed
Planned features
- find a free API to fetch current average block time for a specific network
- add "startBlock" param
- add "endBlock" param
- add "startTimestamp" param
- add "endTimestamp" param