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

@vondas/loupe

v1.0.0

Published

One tool for Smart Contract extraction

Downloads

2

Readme

loupe

One tool for Smart Contract extraction

What does it do?

loupe excels at one thing, Smart Contract extraction. It can extract master Solidity files which contain multiple contracts in one file as well as Solidity files that are aggregated into a nested JSON file. The type of Solidity file returned by loupe is blockchain dependent.

Ethereum/Binance

On Ethereum/Binance, we found most Smart Contracts are either an individual Smart contract with multiple functions or a Smart Contract that containes multiple Solidity files.

Avalanche

On Avalanche, we found most responses to be JSON files containing multiple Solidity files nested within an object.

0x053502bf08b7d3a54891bb66fb966ea4c4ba7d02

Preparing files for compiling

Requirements

Support Blockchains

An API key is required for each Etherscan clone, free tiers are available.

Testnet

| Testnet | Blockchain | Endpoint | | ------- | ---------- | -------------------------------- | | Ropsten | Ethereum | https://api-ropsten.etherscan.io | | Kovan | Ethereum | https://api-kovan.etherscan.io | | Rinkeby | Ethereum | https://api-rinkeby.etherscan.io |

Mainnet

| Mainnet | Endpoint | Docs | | --------- | ----------------------------------- | -------------------------------------------- | | Ethereum | https://api.etherscan.io | https://docs.etherscan.io/ | | Avalanche | https://api.snowtrace.io | https://snowtrace.io/apis | | Binance | https://api.bscscan.com | https://docs.bscscan.com/ | | Heco | https://api.hecoinfo.com | https://hecoinfo.com/apis | | Cronos | https://api.cronoscan.com | https://cronoscan.com/apis | | Moonriver | https://api-moonriver.moonscan.io | https://moonriver.moonscan.io/apis | | Moonbeam | https://blockscout.moonbeam.network | https://blockscout.moonbeam.network/api-docs | | Arbitrum | https://api.arbiscan.io | https://arbiscan.io/apis | | Fantom | https://api.ftmscan.com | https://ftmscan.com/apis | | Hooscan | https://api.hooscan.com | https://hooscan.com/apis | | Optimism | https://api-optimistic.etherscan.io | https://optimistic.etherscan.io/apis |

Usage

Create .env file for Environmental Variables

  • In the root folder, create a new file for the environmental variables called .env
  • Copy/paste the text below into the .env file
  • Remove XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX and add the associated API Key
  • Save .env
# ADD API KEYS HERE
ETHEREUM_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AVALANCHE_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
BINANCE_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
HECO_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CRONOS_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MOONRIVER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MOONBEAM_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ARBITRUM_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
FANTOM_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
HOOSCAN_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
OPTIMISM_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • The API keys above are associated with an array located in init.js
var chainKey = {
    "keyEthereum": process.env.ETHEREUM_API_KEY,
    "keyAvalanche": process.env.AVALANCHE_API_KEY,
    "keyBinance": process.env.BINANCE_API_KEY,
    "keyHeco": process.env.HECO_API_KEY,
    "keyCronos": process.env.CRONOS_API_KEY,
    "keyMoonriver": process.env.MOONRIVER_API_KEY,
    "keyMoonbeam": process.env.MOONBEAM_API_KEY,
    "keyArbitrum": process.env.ARBITRUM_API_KEY,
    "keyFantom": process.env.FANTOM_API_KEY,
    "keyHooscan": process.env.HOOSCAN_API_KEY,
    "keyOptimism": process.env.OPTIMISM_API_KEY
}

Installation

npm

npm i @vondas/loupe

Usage

//Load express module with `require` directive
let dotenv_module;
dotenv_module = require("dotenv");
dotenv_module.config();

const loupe = require('./lib/loupe');

const blockchains = ['ethereum', 'avalanche', 'binance', 'heco', 'cronos', 'moonriver', 'moonbeam', 'arbitrum', 'fantom', 'hooscan', 'optimism'];
const blockchain = blockchains[1];
const contract_address = '0x6cddb55d0ac3204a0bc4f3e3eb03407b1ad59e5c';
console.log(blockchain, contract_address);
loupe.getSmartContracts(blockchain, contract_address);