useEtherspotBalances()

A React hook that returns the native balance for a particular blockchain supported by the Etherspot Platform.

Introduction

The useEtherspotBalances() hook will return an object containing the native balance of the Etherspot Smart Wallet address on the blockchain ID being passed to the hook.

How to use

import {
  useEtherspotBalances,
} from '@etherspot/transaction-kit';

// Later in the main component function...
const etherspotBalanceOnMatic = useEtherspotBalances(137);

// etherspotBalanceOnMatic will look similar to this:
/**
 * [
 *  {
 *   "token": null,
 *    "balance": {
 *      "type": "BigNumber",
 *      "hex": "0x00"
 *    },
 *   "superBalance": null
 *  }
 * ]
/*

🎉 Congratulations!

It's that easy to fetch your Etherspot Smart Wallet balances each chain.

Last updated