npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easyscan

v1.0.32

Published

Easy to use the etherscan and tronscan.

Downloads

43

Readme

Easyscan

Easy to use the etherscan and tronscan.

easyscan includes the etherscan api and tronscan api .For the paging data (such as transaction and logs), it automatically implement the requests , and allows the request to be interrupted and continued during paging requests.It also provide a json rpc provider.

etherscan api

import { etherscanPageData } from 'easyscan'

async function etherscanAPIDemo() {
    const etherscan = etherscanPageData('1', 'API_KEY')
    // page = 1 will scan from page1 to page end.
    const { resume, stop } = etherscan.logs.getLogs({ address: '0xdac17f958d2ee523a2206206994597c13d831ec7', page: 1, offset: 5000, startblock: 1, endblock: 'latest', topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' }, (pageData, pageIndex, accData, isFinish) => {
        // pageData : current page data
        // pageIndex : current page index (index from 0)
        // accData : accumulated data ,it is [...page1,...page2,...page3,...]
	// isFinish : request is finished or not.
    })
    setTimeout(()=>{
        // stop paging request
        stop()
        setTimeout(()=>{
            // resume paging request
            resume()
        },10000)
    },10000)
    // It provides a jsonrpc provider.
    const tx = await etherscan.provider.getTransaction('0xb84d6525eedce0e0dab1f94830db53e2b078d2e6c510affffe700113a7c68578')
}

tronscan api

async function tronscanAPIDemo() {
    const tronscan = tronscanPageData('TronGrid')
    // page = 1 will scan from page1 to page end.
    const { resume, stop } = tronscan.account.txList({ address: 'TDqMwZVTSPLTCZQC55Db3J69eXY7HLCmfs' }, (pageData, pageIndex, accData, isFinish) => {
        console.log(pageIndex, accData.length,isFinish)
    })
    // It provides a jsonrpc provider.
    const tx = await tronscan.provider.getTransaction('5e28141b3a2f94551ea3fecd363aadd85db3515b2a35388f0aefac7518bf3898')
    // {
    //     "blockHash": "00000000030573da9eb9d46a70e3475ceb1be96f2afa52fcc51cdfb76dcbd8e2",
    //     "blockNumber": 50688986,
    //     "contractAddress": null,
    //     "cumulativeGasUsed": 2009468,
    //     "effectiveGasPrice": 420,
    //     "from": "TAN4JXnGSYwZwmShVy5yaVAedn8YTeARVd",
    //     "gasUsed": 14309,
    //     "logs": [
    //         {
    //             "address": "TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq",
    //             "blockHash": "00000000030573da9eb9d46a70e3475ceb1be96f2afa52fcc51cdfb76dcbd8e2",
    //             "blockNumber": 50688986,
    //             "data": "0x00000000000000000000000000000000000000000000000000d639f91e7a5ee8",
    //             "logIndex": 57,
    //             "removed": false,
    //             "topics": [
    //                 "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    //                 "0x00000000000000000000000004524e46fa766a1dd3a2c7d88b123d102f905588",
    //                 "0x0000000000000000000000008a4a39b0e62a091608e9631ffd19427d2d338dbd"
    //             ],
    //             "transactionHash": "5e28141b3a2f94551ea3fecd363aadd85db3515b2a35388f0aefac7518bf3898",
    //             "transactionIndex": 229
    //         }
    //     ],
    //     "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    //     "status": 1,
    //     "to": "TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq",
    //     "transactionHash": "5e28141b3a2f94551ea3fecd363aadd85db3515b2a35388f0aefac7518bf3898",
    //     "transactionIndex": 229,
    //     "type": 0
    // }

etherscan cli

etherscan getlogs --address=0x..... --startblock=0 --endblock=latest --topic0=0x.... --apikey=xxxx