IPcl.addressListMembers

addressListMembers(
  uint64 listId,
  PageRequest calldata pageRequest
) external view returns (address[] memory members, PageResponse memory pageResponse)

Pages through the member addresses of a single shared address list. Members are returned in canonical byte order and are the exact set a referencing ALLOW_LIST_POLICY or DENY_LIST_POLICY evaluates against. The read succeeds whether the list is Active or Disabled — only policy evaluation gates on status, not reads. A missing list reverts with AddressListNotFound(listId).

Parameters

Name Type Required Description
listId uint64 ✓ The non-zero registry ID of the list whose members to read. Passing 0 reverts with InvalidAddressListConfig(listId).
pageRequest PageRequest ✓ Standard pagination input (key, offset, limit, countTotal, reverse). Carry pageResponse.nextKey forward in pageRequest.key between calls.

Returns

Type: (address[] members, PageResponse pageResponse)

members is the page of member addresses in canonical byte order. pageResponse.nextKey is empty once the last page has been returned.

Errors

Code Name Description
AddressListNotFound AddressListNotFound Reverts with AddressListNotFound(uint64 listId) when no list is registered under listId.
InvalidAddressListConfig InvalidAddressListConfig Reverts with InvalidAddressListConfig(uint64 listId) when listId is 0 or when a stored member entry is internally inconsistent during iteration.
InvalidPageRequest InvalidPageRequest Inherited from IPrecompile; raised only when the PageRequest tuple cannot be converted. Setting both key and offset is rejected by the pagination layer instead and arrives as QueryFailed("addressListMembers", reason). Encoded as InvalidPageRequest(string method, uint256 index, string value).
AddressListStorageError AddressListStorageError Reverts with AddressListStorageError(uint64 listId) when the chain-layer iterator fails.
ABISetupFailed ABISetupFailed Inherited from IPrecompile. Reverts with ABISetupFailed(string reason) when calldata cannot be decoded against the precompile ABI.

Examples

Export every member of a list with viem

Walks the list's members in 200-row pages until nextKey comes back empty. The resulting array mirrors what ALLOW_LIST_POLICY / DENY_LIST_POLICY evaluate against.

import { createPublicClient, http, type Hex } from "viem";
import { iPclAbi, iPclAddress } from "@maroo-chain/contracts/abi/precompiles/pcl/IPcl";

const publicClient = createPublicClient({
  transport: http("https://rpc-testnet.maroo.io"),
});

async function exportMembers(listId: bigint): Promise<string[]> {
  const out: string[] = [];
  let nextKey: Hex = "0x";
  do {
    const [members, page] = await publicClient.readContract({
      address: iPclAddress,
      abi: iPclAbi,
      functionName: "addressListMembers",
      args: [listId, {
        key: nextKey,
        offset: 0n,
        limit: 200n,
        countTotal: false,
        reverse: false,
      }],
    });
    out.push(...members);
    nextKey = page.nextKey;
  } while (nextKey !== "0x" && nextKey.length > 2);
  return out;
}

const snapshot = await exportMembers(1n);
console.log(`list 1 has ${snapshot.length} members`);

Read the first page from Solidity

Returns the first page of members and the cursor needed to continue. An empty nextKey means the full membership fit in one page.

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;

import {IPcl, PCL_CONTRACT} from "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";
import {PageRequest, PageResponse} from "cosmos-evm-contracts/precompiles/common/Types.sol";

contract AddressListAudit {
    function firstPage(uint64 listId, uint64 limit)
        external
        view
        returns (address[] memory members, bytes memory nextKey)
    {
        PageRequest memory req = PageRequest({
            key: "",
            offset: 0,
            limit: limit,
            countTotal: false,
            reverse: false
        });
        PageResponse memory page;
        (members, page) = PCL_CONTRACT.addressListMembers(listId, req);
        nextKey = page.nextKey;
    }
}
ESC
Type to search