0.1.0 • Published 2 years ago
@kleros/multicall-relayer v0.1.0
MulticallRelayer
Adds multiple calldatas to a batch and calls Multicall3 contract's aggregate3 function.
Installing
$ yarn add @kleros/multicall-relayerUsing 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.logis 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.
0.1.0
2 years ago