Skip to content

djomaa/web3-multicall3

Repository files navigation

Web3 Multicall3

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published