1.0.7 • Published 1 year ago

@i0san/block-timer v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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.

Demo

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

Reference

The complete guide to publish React hook as NPM package

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago