Skip to content

swimmiee/caver-multicall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caver-multicall

Multicall library for caver-js
View at NPM

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' ]

About

Multicall library for caver-js

Resources

Stars

Watchers

Forks

Packages

No packages published