0.0.49 • Published 2 years ago

kasumah-multicall v0.0.49

Weekly downloads
104
License
MIT
Repository
-
Last release
2 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

2 years ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.48

2 years ago

0.0.45

2 years ago

0.0.44

2 years ago

0.0.40

3 years ago

0.0.39

3 years ago

0.0.38

3 years ago

0.0.37

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago