1.1.0 • Published 2 years ago

abi-tool v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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"
  }
)
1.1.0

2 years ago

1.0.9

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago