Get Chain Id

The getChainId method allows you to retrieve the Chain ID associated with the current ParabolAccount instance. This Chain ID represents the blockchain network on which the account is operating.

Usage

import { ParabolAccount, SupportedChainIds } from "@parabolfi/core";
 
async function getParabolAccountChainId() {
  const privateKey = "0x..."; // Your private key
  const chainId = SupportedChainIds.ZKSYNC;
 
  const account = await ParabolAccount.fromPrivateKey({
    privateKey,
    chainId,
  });
 
  const currentChainId = account.getChainId();
  console.log("ParabolAccount Chain ID:", currentChainId);
}

Returns

  • SupportedChainId - The Chain ID associated with the ParabolAccount instance.

Note

  • The Chain ID is set when the ParabolAccount is initialized and can be changed using the setChainId method.
ℹ️

The chainId should be one of the supported chainIds by Parabol.