Skip to content

getL1Allowance

Determines the amount of approved tokens for a specific L1 bridge.

Usage

example.ts
import { account, publicClient } from './config'
 
const allowance = await publicClient.getL1Allowance({
  account
  token: '0x5C221E77624690fff6dd741493D735a17716c26B',
  bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D',
})

Returns

bigint

Returns the amount of approved tokens.

Parameters

account

  • Type: Account | Address

The Account used for check.

Accepts a JSON-RPC Account or Local Account (Private Key, etc).

const allowance = await publicClient.getL1Allowance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
  blockTag: 'latest',
  bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D',
  token: '0x5C221E77624690fff6dd741493D735a17716c26B',
})

blockTag (optional)

  • Type: BlockTag | undefined

In which block an allowance should be checked on. The latest processed one is the default option.

const allowance = await publicClient.getL1Allowance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
  blockTag: 'latest', 
  bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D',
  token: '0x5C221E77624690fff6dd741493D735a17716c26B',
})

bridgeAddress

  • Type: Address

The address of the bridge contract to be used.

const allowance = await publicClient.getL1Allowance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
  blockTag: 'latest', 
  bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D', 
  token: '0x5C221E77624690fff6dd741493D735a17716c26B', 
})

token

  • Type: Address

The Ethereum address of the token.

const allowance = await publicClient.getL1Allowance({
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
  blockTag: 'latest',
  bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D',
  token: '0x5C221E77624690fff6dd741493D735a17716c26B', 
})