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

ethereum-read-functions

v0.0.1

Published

Read smart contract functions from evm-blockchains.

Downloads

2

Readme

Read smart contract functions from the ethereum and every other evm blockchain.

Fetch tokenURI and Name


require( 'dotenv' ).config( { path: '.env' } )
const { readFunction } = require( 'ethereum-read-functions' )

const config = {
    'cmds': [ 'tokenURI(1)', 'name()' ],
    'network': 'homestead',
    'address': '0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7',
    'etherscan_api_key': process.env.ETHERSCAN_API_KEY,
    'infura_project_id': process.env.INFURA_PROJECT_ID,
    'infura_project_secret': process.env.INFURA_PROJECT_SECRET,
}

readFunction( config )
.then( ( result ) => console.log( result ) )
.catch( ( e ) => console.log( e ) )

Unverified source code on Etherscan
Set try blind to true

require( 'dotenv' ).config( { path: '.env' } )
const { readFunction } = require( 'ethereum-read-functions' )

const config = {
    'cmds': [ 'tokenURI(19)' ],
    'network': 'homestead',
    'address': '0x4ef107a154cb7580c686c239ed9f92597a42b961',
    'etherscan_api_key': process.env.ETHERSCAN_API_KEY,
    'infura_project_id': process.env.INFURA_PROJECT_ID,
    'infura_project_secret': process.env.INFURA_PROJECT_SECRET,
    'try_blind': true,
}

readFunction( config )
.then( ( result ) => console.log( result ) )
.catch( ( e ) => console.log( e ) )

Fetch all viewable Functions

require( 'dotenv' ).config( { path: '.env' } )
const { readFunction } = require( 'ethereum-read-functions' )

const config = {
    'cmds': [],
    'network': 'homestead',
    'address': '0x4ef107a154cb7580c686c239ed9f92597a42b961',
    'etherscan_api_key': process.env.ETHERSCAN_API_KEY,
    'infura_project_id': process.env.INFURA_PROJECT_ID,
    'infura_project_secret': process.env.INFURA_PROJECT_SECRET,
    'try_all': true
}

readFunction( config )
.then( ( result ) => console.log( result ) )
.catch( ( e ) => console.log( e ) )
  1. Examples
  2. Quickstart
  3. Setup
  4. Options
  5. Contributing
  6. License
  7. Code of Conduct
  8. Support my Work
require( 'dotenv' ).config( { path: '.env' } )
const { readFunction } = require( 'ethereum-read-functions' )

readFunction( {
    'cmds': [ 'tokenURI(19)' ],
    'network': 'homestead',
    'address': '0x4ef107a154cb7580c686c239ed9f92597a42b961',
    'etherscan_api_key': process.env.ETHERSCAN_API_KEY,
    'infura_project_id': process.env.INFURA_PROJECT_ID,
    'infura_project_secret': process.env.INFURA_PROJECT_SECRET,
} )
.then( ( result ) => console.log( result ) )
.catch( ( e ) => console.log( e ) )
npm i ethereum-read-functions
{
    'cmds': null,
    'address': null,
    'network': 'homestead',
    'etherscan_api_key': process.env.ETHERSCAN_API_KEY,
    'infura_project_id': process.env.INFURA_PROJECT_ID,
    'infura_project_secret': process.env.INFURA_PROJECT_SECRET,
    'silent': false,
    'shrink': true,
    'try_blind': true,
    'try_all': true
}

Validation | Name | Type | Required | Default | Description | |------:|:------|:------|:------|:------| | cmds | Array of numbers or strings | No | [] | Set here your function names. If you set 1 it will interpreted as tokenURI(1). Please cast long int to string. | | address | String | Yes | | Set smart contract address here | | network | String | Yes | "Homestead" | Choose network. Homestead === Ethereum Mainnet, visit etherjs documentation for more Informations | | etherscan_api_key | String | Yes | "" | Some request will work without api key. More Informations to Etherscan Api you can find here | | infura_project_id | String | Yes | "" | More Informations to Infura´s Api you can find here | | infura_secret_id | String | Yes | "" | More Informations to Infura´s Api you can find here | | silent | Boolean | no | false | By default console output will print helpful status messages. | | shrink | Boolean | no | true | Reduces to size of the result. | | try_blind | Boolean | no | false | Experimental! If no ABIs was found (means Etherscan source code is verified) the algorithm uses a default ABIs to guess the ABI and fetch only a tokenURI call. | | try_all | Boolean | no | false | Experimental! Search inside of ABIs for viewable function without parameters and fetch them all automatically. |

Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/ethereum-read-functions. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

  • Not tested for production
  • Works only with Infura and Etherscan.
  • Build for NFT request only.
  • Function are executed with ether.js
  • ABIs are fetched from Etherscan once for every address.

The module is available as open source under the terms of the MIT License.

Everyone interacting in the Statosio project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Please ⭐️ star this Project, every ⭐️ star makes us very happy!