1.0.5 • Published 2 years ago

caver-multicall v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

caver-multicall

Multicall library for caver-js

Installation

npm install caver-multicall
yarn add caver-multicall

Usage

import Multicall from 'caver-multicall'

// baobab
const multicall_baobab = new Multicall({
    network: 'baobab',
    provider: 'https://api.baobab.klaytn.net:8651/'
})

// cypress
const multicall_cypress = new Multicall({
    network: 'cypress',
    provider: 'https://public-node-api.klaytnapi.com/v1/cypress'
})

Aggregate

import Multicall from 'caver-multicall'
import ERC20Abi from 'abi/ERC20Abi.json'

const provider = new Caver.providers.HttpProvider('https://public-node-api.klaytnapi.com/v1/cypress')
const tokenAddress = '0x5fff3a6c16c2208103f318f4713d4d90601a7313'
const multicall = new Multicall({
    network: 'cypress',
    provider
})

const ERC20Contract = caver.contract.create(ERC20Abi, tokenAddress)

const token_info = multicall.aggregate([
    ERC20Contract.methods.name(),
    ERC20Contract.methods.symbol(),
    ERC20Contract.methods.decimals()
]).then(console.log)
// [ 'Kleva Token', 'KLEVA', '18' ]
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3-beta

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago