Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@kleros/multicall-relayer

Package Overview
Dependencies
Maintainers
6
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kleros/multicall-relayer

Multicall3 typescript bindings and transaction relayer logic

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
6
Created
Source

MulticallRelayer

Adds multiple calldatas to a batch and calls Multicall3 contract's aggregate3 function.

Installing

$ yarn add @kleros/multicall-relayer

Using it

Create MultiCaller

import MultiCaller from "@kleros/multicall-relayer"

const multicaller = new MultiCaller({
    rpcUrl,
    privateKey,
    multicall3Address,
    gasPriceCeilingWei, // optional
    logtailSourceToken, // optional
    amqp: { url, exchange } // optional
})

Add call to be batched

multicaller.add({
    allowFailure: false,
    target: poh.address,
    callData: pohI.encodeFunctionData(
                "withdrawFeesAndRewards",
                [beneficiary, humanityId, requestId, challengeId, round]
                )
})

// Or multiple calls...
multicaller.add(...calls)

Send the transaction!

const tx = await multicaller.send()

Constructor arguments

  • rpcUrl - url of the rpc to be used.
  • privateKey - private key of wallet to execute the transaction.
  • multicall3Address - Multicall3 contract address on the chain corresponding to the given rpc.
  • gasPriceCeilingWei (optional) - gas price ceiling in wei.
  • logtailSourceToken (optional) - Logtail token to send logs to. If missing, console.log is used.
  • amqp (optional) - AMQP to be notified once the transaction is sent to the blockchain. Requires 2 parameters:
    • url - url of the provider.
    • exchange - name of the exchange.

Keywords

ethereum

FAQs

Package last updated on 08 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts