Skip to content

getCollateralForStorage

Get the size of the collateral storage of a given address, in bytes.

example.ts
import { publicClient } from "./client";

const balance = await publicClient.getCollateralForStorage({
  address: "cfx:...",
});

Returns

bigint

The size of the collateral storage in bytes.

Parameters

address

  • Type: Address

The address to check for collateral storage

const balance = await publicClient.getCollateralForStorage({
  address: "cfx:...", 
});

epochTag (optional)

  • Type: latest_state| latest_confirmed| latest_checkpoint | earliest
  • Defaut: latest_state
const balance = await publicClient.getCollateralForStorage({
  address: "cfx:...",
  epochTag: "latest_state", 
});

epochNumber (optional)

  • Type: bigint
const balance = await publicClient.getCollateralForStorage({
  address: "cfx:...",
  epochNumber: 1n, 
});

JSON-RPC Method

cfx_getCollateralForStorage