
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
eth-contract-classifier
Advanced tools
This project includes functions to interact with Ethereum contracts. It provides functionality to get ERC standards by ABI and bytecode. Support ERC20, ERC721, ERC1155, PROXY(DELEGATECALL).
npm install eth-contract-classifier
Import the functions from the project and use them in your code: const { getErcByBytecode, getProxyStatus, getErcByAbi, getSigs, isABI,getErcByBytecodePercent,getErcByAbiPercent } = require('eth-contract-classifier');
// Use the functions let ercType = getErcByAbi(abi); let ercTypeByBytecode = getErcByBytecode(bytecode);
getSigs(abi)
This function retrieves the function and event signatures from the given ABI. It takes an ABI (Application Binary Interface) of the contract as an argument and returns an array containing the function and event signatures.
isABI(abi, bytecode)
This function checks if the given ABI is compatible with the provided bytecode. It takes an ABI (Application Binary Interface) and the bytecode of the contract as arguments. It returns true if the ABI is compatible with the bytecode, otherwise returns false.
getErcByAbi(abi)
This function takes an ABI and an object containing various ABIs for different ERC standards. It calculates the percentage of matches for each ERC standard, sorts them, and returns the ERC standard with the highest percentage of matches.
getErcByBytecode(bytecode)
This function works similarly to getErcByAbi, but it takes bytecode instead of an ABI. It uses the web3.js library to encode the ABI functions into bytecode and checks if the input bytecode includes the function bytecode.
getProxyStatus(bytecode)
This function returns prox status. It takes bytecode of the proxy contract.
getErcByAbiPercent(abi, percent)
The getErcByAbiPercent function takes an ABI and an object containing various ABIs for different ERC standards. It calculates the percentage of matches for each ERC standard, sorts them, and returns an object with each ERC standard and its corresponding match percentage. Default is 100.
getErcByBytecodePercent(bytecode, percent)
The getErcByBytecodePercent function works similarly to getErcByAbiPercent, but it takes bytecode instead of an ABI. It uses the web3.js library to encode the ABI functions into bytecode and checks if the input bytecode includes the function bytecode. It returns an object with each ERC standard and its corresponding match percentage. Default is 100.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
FAQs
## Description
We found that eth-contract-classifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.