import type { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client'; import { PhantomReified, Reified, StructClass, ToField, ToJSON, ToTypeStr } from '../../_framework/reified'; import { FieldsWithTypes } from '../../_framework/util'; import { Decimal } from '../decimal/structs'; export declare function isRateLimiter(type: string): boolean; export interface RateLimiterFields { /** Configuration parameters for the rate limiter. */ config: ToField; /** The sum of all outflows from the previous window. */ prevQty: ToField; /** The timestamp (in seconds) when the current window started. */ windowStart: ToField<'u64'>; /** The sum of all outflows in the current window. */ curQty: ToField; } export type RateLimiterReified = Reified; export type RateLimiterJSONField = { config: ToJSON; prevQty: ToJSON; windowStart: string; curQty: ToJSON; }; export type RateLimiterJSON = { $typeName: typeof RateLimiter.$typeName; $typeArgs: []; } & RateLimiterJSONField; /** A structure to manage rate limiting for outflows within a specified time window. */ export declare class RateLimiter implements StructClass { __StructClass: true; static get $typeName(): `${string}::rate_limiter::RateLimiter`; static readonly $numTypeParams = 0; static readonly $isPhantom: readonly []; readonly $typeName: typeof RateLimiter.$typeName; readonly $fullTypeName: `${string}::rate_limiter::RateLimiter`; readonly $typeArgs: []; readonly $isPhantom: typeof RateLimiter.$isPhantom; /** Configuration parameters for the rate limiter. */ readonly config: ToField; /** The sum of all outflows from the previous window. */ readonly prevQty: ToField; /** The timestamp (in seconds) when the current window started. */ readonly windowStart: ToField<'u64'>; /** The sum of all outflows in the current window. */ readonly curQty: ToField; private constructor(); static reified(): RateLimiterReified; static get r(): RateLimiterReified; static phantom(): PhantomReified>; static get p(): PhantomReified>; private static instantiateBcs; private static cachedBcs; static get bcs(): ReturnType; static fromFields(fields: Record): RateLimiter; static fromFieldsWithTypes(item: FieldsWithTypes): RateLimiter; static fromBcs(data: Uint8Array): RateLimiter; toJSONField(): RateLimiterJSONField; toJSON(): RateLimiterJSON; static fromJSONField(field: any): RateLimiter; static fromJSON(json: Record): RateLimiter; static fromCoreObject(obj: SuiClientTypes.Object<{ content: true; }>): RateLimiter; static fetch(client: ClientWithCoreApi, id: string): Promise; } export declare function isRateLimiterConfig(type: string): boolean; export interface RateLimiterConfigFields { /** The duration of the rate limiter window in seconds. */ windowDuration: ToField<'u64'>; /** The maximum allowed outflow in a single window. */ maxOutflow: ToField<'u64'>; } export type RateLimiterConfigReified = Reified; export type RateLimiterConfigJSONField = { windowDuration: string; maxOutflow: string; }; export type RateLimiterConfigJSON = { $typeName: typeof RateLimiterConfig.$typeName; $typeArgs: []; } & RateLimiterConfigJSONField; /** Configuration for the rate limiter, defining the window duration and maximum outflow. */ export declare class RateLimiterConfig implements StructClass { __StructClass: true; static get $typeName(): `${string}::rate_limiter::RateLimiterConfig`; static readonly $numTypeParams = 0; static readonly $isPhantom: readonly []; readonly $typeName: typeof RateLimiterConfig.$typeName; readonly $fullTypeName: `${string}::rate_limiter::RateLimiterConfig`; readonly $typeArgs: []; readonly $isPhantom: typeof RateLimiterConfig.$isPhantom; /** The duration of the rate limiter window in seconds. */ readonly windowDuration: ToField<'u64'>; /** The maximum allowed outflow in a single window. */ readonly maxOutflow: ToField<'u64'>; private constructor(); static reified(): RateLimiterConfigReified; static get r(): RateLimiterConfigReified; static phantom(): PhantomReified>; static get p(): PhantomReified>; private static instantiateBcs; private static cachedBcs; static get bcs(): ReturnType; static fromFields(fields: Record): RateLimiterConfig; static fromFieldsWithTypes(item: FieldsWithTypes): RateLimiterConfig; static fromBcs(data: Uint8Array): RateLimiterConfig; toJSONField(): RateLimiterConfigJSONField; toJSON(): RateLimiterConfigJSON; static fromJSONField(field: any): RateLimiterConfig; static fromJSON(json: Record): RateLimiterConfig; static fromCoreObject(obj: SuiClientTypes.Object<{ content: true; }>): RateLimiterConfig; static fetch(client: ClientWithCoreApi, id: string): Promise; }