IPcl.globalPeriodicList
globalPeriodicList(
address user,
string asset,
bool resolveAgentOwners,
PageRequest pageRequest
) external view returns (PeriodicVolume[] statuses, PageResponse pageResponse) Lists every PERIODIC_VOLUME_POLICY running counter for user under the global policy config, one entry per distinct reset-period bucket. Use this when the user is subject to multiple global periodic caps at different window lengths (for example a 24-hour cap and a 30-day cap on the same asset) and you want to render or check all of them at once.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user | address | ✓ | The address to enumerate periodic counters for. |
asset | string | ✓ | The denom string to filter by (for OKRW, "atokrw"). |
resolveAgentOwners | bool | ✓ | If true, user is read as an agent wallet: each entry carries the largest of its agents' owners' counters (user's own when it has none). The owners' counters hold an agent wallet's transfers only when the cap is wrapped in FOR_EACH_POLICY over agent owners, as maroo-testnet-1's global daily cap is. |
pageRequest | PageRequest | ✓ | Standard pagination request { key, offset, limit, countTotal, reverse }. Pass { key: 0x, offset: 0, limit: 100, countTotal: false, reverse: false } for the first page. |
Returns
(PeriodicVolume[] statuses, PageResponse pageResponse) statuses is an array of { amount, maxAmount, resetPeriodSeconds, resetAt } — one per matching global periodic policy. pageResponse carries the next-page cursor and optional total count.
Examples
List all global OKRW periodic counters for a user
Enumerates every global periodic counter that applies to user for OKRW — one row per configured reset period. Handy for a dashboard that surfaces every cap at once (daily + monthly, etc.).
import { createPublicClient, http, parseAbi } from "viem";
const PCL = "0x1000000000000000000000000000000000000005";
const pclAbi = parseAbi([
"function globalPeriodicList(address user, string asset, bool resolveAgentOwners, (bytes key, uint64 offset, uint64 limit, bool countTotal, bool reverse) pageRequest) view returns ((uint256 amount, uint256 maxAmount, uint64 resetPeriodSeconds, uint64 resetAt)[] statuses, (bytes nextKey, uint64 total) pageResponse)",
]);
const client = createPublicClient({ transport: http("https://rpc-testnet.maroo.io") });
const user = "0x5555555555555555555555555555555555555555"; // replace before production
const [statuses, pageResponse] = await client.readContract({
address: PCL,
abi: pclAbi,
functionName: "globalPeriodicList",
args: [
user,
"atokrw",
false,
{ key: "0x", offset: 0n, limit: 100n, countTotal: false, reverse: false },
],
});
for (const s of statuses) {
// e.g. daily (86400) and monthly (2592000) caps side by side
console.log(`period=${s.resetPeriodSeconds}s used=${s.amount}/${s.maxAmount} resetAt=${s.resetAt}`);
} Follow the pagination cursor
Standard PageRequest / PageResponse loop — advance key with the returned nextKey until it is empty.
let key: `0x${string}` = "0x";
do {
const [statuses, pageResponse] = await client.readContract({
address: PCL,
abi: pclAbi,
functionName: "globalPeriodicList",
args: [user, "atokrw", false, { key, offset: 0n, limit: 50n, countTotal: false, reverse: false }],
});
for (const s of statuses) { /* consume */ }
key = pageResponse.nextKey as `0x${string}`;
} while (key && key !== "0x");