web3-multicall3
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Multicall3 is a library for batching contract calls. Web3-multicall3 is a type-safe multicall3 contract wrapper

Usage example with types output

Installation

yarn add web3-multicall3

Usage

const multicall = new Web3Multicall3({
  web3: web3Instance, // Web3 v4.*
  address: '0xcA11bde05977b3631167028862bE2a173976CA11', // constant address
});

const [someFunctionResponse] = await multicall.aggregate3([
  createContractlCall(
    contract, // some contract
    'someFunctionName', // function name, types are automatically obtained from contract
    [arg1, arg2] // someFunction parameters, types validated by web3
  )
]);

createContractCall

A utility that provides type support for proper use of web3 contract

Demo

Parameters

  • contract - web3.eth.contract
  • fnName - function name (obtained from provided contract)
  • args - arguments of selected function (types are validated)

Examples

Tests

  • Only very base tests are implemented

Package Sidebar

Install

npm i web3-multicall3

Weekly Downloads

8

Version

0.2.1

License

MIT

Unpacked Size

161 kB

Total Files

64

Last publish

Collaborators

  • demid.mosko