Skip to main content
Version: 1.14.0

Type Alias: RateLimiterState

RateLimiterState = { capacity: bigint; rate: bigint; tokens: bigint; } | null

Defined in: chain.ts:627

Rate limiter state for token pool configurations.

Union Members​

Type Literal​

{ capacity: bigint; rate: bigint; tokens: bigint; }

capacity​

capacity: bigint

Maximum capacity of the rate limiter bucket.

rate​

rate: bigint

Rate at which tokens are replenished (tokens per second).

tokens​

tokens: bigint

Current token balance in the rate limiter bucket.


null

Remarks​

  • Returns the rate limiter bucket state when rate limiting is enabled
  • Returns null when rate limiting is disabled (unlimited throughput)

Example​

Handling nullable state

TypeScript
const remote = await chain.getTokenPoolRemotes(poolAddress)
const state = remote['ethereum-mainnet'].inboundRateLimiterState

if (state === null) {
console.log('Rate limiting disabled - unlimited throughput')
} else {
console.log(`Capacity: ${state.capacity}, Available: ${state.tokens}`)
}