getL1Balance
Returns the amount of the token held by the account on the L1 network.
Usage
example.ts (token balance)
import { account, publicClient } from './config'
 
const balance = await publicClient.getL1Balance({
  account
  token: '0x5C221E77624690fff6dd741493D735a17716c26B',
})Returns
bigint
Returns the amount of the tokens.
Parameters
account (optional)
- Type: Account | Address
The Account used for check.
Accepts a JSON-RPC Account or Local Account (Private Key, etc).
const balance = await publicClient.getL1Balance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
  blockTag: 'latest',
  token: '0x5C221E77624690fff6dd741493D735a17716c26B',
})blockTag (optional)
- Type: BlockTag | undefined
In which block an balance should be checked on. The latest processed one is the default option.
const balance = await publicClient.getL1Balance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
  blockTag: 'latest', 
  token: '0x5C221E77624690fff6dd741493D735a17716c26B',
})token (optional)
- Type: Address
The address of the token. Defaults to ETH if not provided.
const balance = await publicClient.getL1Balance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
  blockTag: 'latest',
  token: '0x5C221E77624690fff6dd741493D735a17716c26B', 
})
