Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abi-tool

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abi-tool

Get the contract's abi through the blockchain browser

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Installation

We recommend switching to Node.js version 12.0.1 to make sure common crypto dependencies work. Execute nvm use, if you have Node Version Manager.

npm install --save abi-tool

Install ethers、axios too if you haven't already.

Getting Started

1.getAbiJson

The abi jsonof supporting contract acquisition from some blockchain browsers is that the contract has been open sourced, now support eth、bsc、polygon

for examble:

const {AbiTool, CHAIN_APIS} = require('../abi-tool');

let data = await AbiTool.getContractAbi(
	"0xdac17f958d2ee523a2206206994597c13d831ec7 ", 
	CHAIN_APIS.ETH
)
console.log(data)
2.batchCallContract

If you know the abi of the contract, you can import private keys in batches and execute a certain method of the same contract at the same time, this does not limit the network

const {AbiTool, CHAIN_APIS} = require('../abi-tool');

const pks = [
        "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    ]
const abi = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
const chainRpc = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
const chainId = "xxxxxx"
const contractAddress = "xxxxxxxxxxxxxxxxxxxxx"
let abiTool = new AbiTool(chainRpc , chainId )

//start listen event,this function emit name `batchCallContract`
abiTool.emitter.on("batchCallContract", function (arg) {
	console.log("arg", arg)
})
await abiTool.batchCallContract(
  contractAddress, 
  abi, 
  pks, 
  methodName, 
  args,
  {
    gasPrice:"xxxxxxxxxx",
    gasPrice:"xxxxxxxxxx"
  }
)

Keywords

FAQs

Package last updated on 03 Mar 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc