Socket
Socket
Sign inDemoInstall

eth-block-timestamp

Package Overview
Dependencies
370
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eth-block-timestamp

> Get a block number by its date


Version published
Weekly downloads
24
increased by140%
Maintainers
1
Install size
106 MB
Created
Weekly downloads
 

Readme

Source

Block by time

Get a block number by its date

NPM version Install Size

Demo -> https://blockbytime.com

Install

npm i eth-block-timestamp

Usage

import Blocks from 'eth-block-timestamp'

const blocks = new Blocks(
  (window as any).ethereum || 'https://mainnet.infura.io/v3/{API_KEY}'
)

// Get first block info
const { block, timestamp } = await blocks.getDate('first')

// Get latest block info
const { block, timestamp } = await blocks.getDate('latest')

// Get block info at 03/20/2020
const { block, timestamp } = await blocks.getDate('03/20/2020')

// Get block info at 03/20/2020 03:10:00 AM
const { block, timestamp } = await blocks.getDate('03/20/2020 03:10:00 AM')

// Get block info at 1586618608 (Unix Timestamp)
const { block, timestamp } = await blocks.getDate('1586618608')

Keywords

FAQs

Last updated on 12 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc