Bridges

Introduction

The Etherspot BUIDLER component comes with a built-in block to facilitate swapping assets across chains or Layer 2 chains.

Users can select a source token and amount, and a destination asset on a different chain.

Etherspot will take care of finding the best route and display it to the user.

Once the user reviews this, they are shown a summary and they can choose whether to execute the transaction.

Implementation

Copy and paste the code below to get started.

import {
  Etherspot,
  TRANSACTION_BLOCK_TYPE,
} from "@etherspot/react-transaction-buidler";

// ...

return (
  <Etherspot
    defaultTransactionBlocks={[{ type: TRANSACTION_BLOCK_TYPE.ASSET_BRIDGE }]}
  />
);

Last updated