0.0.49 • Published 3 years ago

kasumah-multicall v0.0.49

Weekly downloads
104
License
MIT
Repository
-
Last release
3 years ago

Kasumah Multicall

Kasumah Multicall makes it easier to work with Multicall ( https://github.com/makerdao/multicall ).

Kasumah Multicall wraps https://www.npmjs.com/package/ethers-multicall to make it transparent when using contracts, drastically simplifying use (making it transparent).

Behind the scenes it uses https://github.com/graphql/dataloader (without cacheing) inorder to queue up view calls and batch them up into a single RPC call.

Usage

Create a singleton instance of MulticallWrapper:

const wrapper = new MulticallWrapper(ethers.provider, chainId);

After that you can wrap your ethers contracts with that wrapper.

const wrappedEcho = await wrapper.wrap<Echo>(echo);

From there you can just call your contracts as normal:

await wrappedEcho.echo("hi"); // will return 'hi'

A full example. Extracted from the tests.

const infuraKey = "INSERT_YOUR_KEY_HERE";
const provider = new ethers.providers.InfuraProvider("mainnet", infuraKey);

// create the wrapper:
const wrapper = new MulticallWrapper(ethers.provider, 1); // chainId of 1 for 'mainnet'

const EchoFactory = await ethers.getContractFactory("Echo");
echo = (await EchoFactory.deploy()) as Echo;
await echo.deployed();

const wrappedEcho = await wrapper.wrap<Echo>(echo);
console.log(await wrappedEcho.echo("hi"));
0.0.49

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.0.48

3 years ago

0.0.45

3 years ago

0.0.44

3 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.33

4 years ago

0.0.34

4 years ago

0.0.35

4 years ago

0.0.36

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.10

5 years ago

0.0.11

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.4

5 years ago

0.0.7

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago