<EtherspotBatch />

Indicates that we are going to add one more blockchain transactions to this batch.

Introduction

The <EtherspotBatch /> component allows you to define one or more <EtherspotTransaction /> components to be sent as part of the <EtherspotBatch />.

Component Properties

PropertyDescription

id

Optional: An ID (which can be a string, number etc) that allows you to define the ID of this batch group. We will use this ID if you provide it internally, but also allows you to use it to keep track elsewhere within your app.

chainId

Optional: The blockchain ID that you would like to execute this batch on. Check out our supported blockchains to check what we support. The default is "1" - Ethereum Mainnet.

gasTokenAddress

Optional: You can choose to pay for for batch of transactions with something else other than the native token for the blockchain you defined in chainId (or Ethereum if none specified).

How to use

Below is an example of how to use the <EtherspotBatch /> component.

// In your functional component or elsehwere
const onEstimateReceiver = (estimationData) => {
  console.log(
    'This is the cost estimate for all the batches',
    estimationData,
  );
}

// In your render or as a component...
<EtherspotBatches onEstimated={onEstimateReceiver}>
  <EtherspotBatch>
    {/*
      Within the <EtherspotBatch /> component,
      you can add 1 or more <EtherspotTransaction />
      tags to be performed together and at the same
      time (i.e. within the same "batch").
    */}
  </EtherspotBatch>
</EtherspotBatches>

🎉 Congratulations!

And that's how to implement the <EtherspotBatch /> component. It's worth remembering that this component expects other components like <EtherspotTransaction /> to live inside it for it to do anything at all.

Last updated