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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chainstarter/multicall-client.js

v1.4.2

Published

multicall-client.js

Downloads

41

Readme

multicall-client.js

config [v1.0.0]

import {config, ChainId} from "@chainstarter/multicall-client.js";
ChainId.rinkeby = 4
const multicallConfig = config(
  {
    defaultChainId: 1,
    delay: 100,//debounce
    timeout: 20000,//ms
    maxCalls: 500,//Single request contains call
    allowFailure: true,//The result structure is different
    rpc: {
      [ChainId.ETH]: {
        url: '',// rpc url (https|wss)
        address: '',//multicall2 address
      },
      [ChainId.rinkeby]: {
        url: 'https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
        address: '0x5ba1e12693dc8f9c48aad8770482f4739beed696'
      }
    }
  }
)

query calls [v1.0.0]

import {Contract, multicallClient} from "@chainstarter/multicall-client.js";

const contractBSC = new Contract(abi, address, ChainId.BSC);
// typescript:
// const contractBSC: any = new Contract(abi, address, ChainId.BSC);
// const contractBSC = newContract(abi, address, ChainId.BSC);
const contractHECO = new Contract(abi, address, ChainId.HECO);
const contractETH = new Contract(abi, address, ChainId.ETH);

const calls = [
        contractBSC.balanceOf(account),
        contractHECO.balanceOf(account),
        contractETH.balanceOf(account)
      ]
multicallClient(calls).then(result => {
	// allowFailure = true
	// result type = [[success, call1result], [success, call2result], [success, call3result]]
	// allowFailure = false
	// result type = [call1result, call2result, call3result]
})

getBlockInfo [v1.0.0]

import {multicallClient} from "@chainstarter/multicall-client.js";

multicallClient.getBlockInfo(ChainId.ETH).then(blockInfo =>{
  // blockInfo: {number, coinbase, difficulty, gasLimit, Timestamp, hash}
})

getEthBalance [v1.0.0]

import {multicallClient} from "@chainstarter/multicall-client.js";

multicallClient.getEthBalance(account, ChainId.ETH).then(ethBalance =>{
  
})

getBlockHash [v1.0.0]

import {multicallClient} from "@chainstarter/multicall-client.js";

multicallClient.getBlockHash(135484, ChainId.ETH).then(blockHash =>{
  
})

send transaction [v1.3.1]

import {Contract, multicallClientSend} from "@chainstarter/multicall-client.js";

/**
 import {useWeb3React} from "@web3-react/core";
 const {library} = useWeb3React()
 const provider = library.provider
 */
const provider = window.ethereum

const contractETH = new Contract(abi, address, ChainId.ETH);
multicallClientSend([
  contract.getRewardA(account),
  contract.getRewardB(account),
  contract.getRewardA(account2),
  contract.getRewardB(account3)
], provider).send({
  from: '',
  //...
}).on('transactionHash', (hash) => {
 
}).on('receipt', (rec) => {
    
}).on('error', (err) => {
    
  })

getTransactionReceipt [v1.3.2]

import {multicallClient} from "@chainstarter/multicall-client.js";

    multicallClient.getTransactionReceipt(transactionHash, ChainId.BSC).then(res => {
      
    }).catch(()=>{
      
    })

getWeb3 [v1.3.2]

import {getWeb3} from "@chainstarter/multicall-client.js";
const web3 = getWeb3(ChainId.BSC)
var contract = new web3.eth.Contract(contractABI, adderss);
//get event
contract.getPastEvents('EventA', {filter: {}, fromBlock: 10000, toBlock: 'latest'}).then((res) => {
  console.log(res)
})

support overloaded [v1.4.0]

Contract

contract A {
    function f() public pure returns (uint8 out) {
        out = 1;
    }

    function f(uint256 n) public pure returns (uint256 out) {
        out = n;
    }
    function f(uint256 n, address addr) public pure returns (uint256 out) {
        if(addr == address(0)){
            out = 0;
        } else{
            out =  n;
        }

    }
}

ABI

[
	{
		"inputs": [],
		"name": "f",
		"outputs": [
			{
				"internalType": "uint8",
				"name": "out",
				"type": "uint8"
			}
		],
		"stateMutability": "pure",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "n",
				"type": "uint256"
			},
			{
				"internalType": "address",
				"name": "addr",
				"type": "address"
			}
		],
		"name": "f",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "out",
				"type": "uint256"
			}
		],
		"stateMutability": "pure",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "n",
				"type": "uint256"
			}
		],
		"name": "f",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "out",
				"type": "uint256"
			}
		],
		"stateMutability": "pure",
		"type": "function"
	}
]
import {Contract, multicallClient} from "@chainstarter/multicall-client.js";

const contractETH = new Contract(abi, address, ChainId.ETH);

const calls = [
  contractETH.f(),// default overloaded last = f(uint256,address)
  contractETH["f()"](),
  contractETH["f(uint256)"](1),
  contractETH["f(uint256,address)"](1,0x0000000000000000000000000000000000000000),
      ]
multicallClient(calls).then(result => {
	//...
})