src/transport/index.ts
v0.3.0 · 2.2 KB
// Public API of the transport module: throttled /info client, per-IP weight limiter,
// retry policy, error classes, request weights, address budget and weight-saving cache.
export type { InfoCallOptions, InfoRequest, InfoRequester, Network } from './types.js';
export { API_URL, WS_URL } from './types.js';
export {
DEFAULT_INFO_WEIGHT,
EXCHANGE_RESERVE_WEIGHT,
INFO_WEIGHTS,
MAX_INFO_WEIGHT,
RESPONSE_WEIGHT_RULES,
exchangeAddressRequests,
exchangeIpWeight,
responseWeightSurcharge,
weightOf,
} from './weights.js';
export {
DEFAULT_EGRESS_KEY,
MIN_SAFE_BURST_CAPACITY,
createWeightLimiter,
getSharedWeightLimiter,
resetSharedWeightLimiters,
} from './limiter.js';
export type { AcquireOptions, Priority, WeightLimiter, WeightLimiterOptions, WeightLimiterStats } from './limiter.js';
export {
HlHttpError,
HlNetworkError,
HlResponseParseError,
HlTimeoutError,
MAX_ERROR_BODY_CHARS,
isRateLimitError,
isTransientError,
statusOf,
} from './errors.js';
export { DEFAULT_RETRY, backoffDelayMs, sleep, withRetry } from './retry.js';
export type { BackoffOptions, RetryOptions, WithRetryOptions } from './retry.js';
export { DEFAULT_INFO_TIMEOUT_MS, createInfoClient, normalizeInfoBody, resolveInfoUrl } from './info-client.js';
export type { FetchLike, InfoAttemptEvent, InfoClient, InfoClientCallOptions, InfoClientOptions } from './info-client.js';
export { limitExchange } from './exchange.js';
export type { LimitExchangeOptions } from './exchange.js';
export {
ADDRESS_BASE_REQUESTS,
ADDRESS_BUDGET_MIN_POLL_MS,
ADDRESS_BUDGET_POLL_MS,
ADDRESS_EXHAUSTED_INTERVAL_MS,
REQUEST_PRICE_USD,
addressCancelCap,
baseAddressRequestCap,
budgetMode,
computeAddressBudget,
getAddressBudget,
hoursToExhaustion,
parseUserRateLimit,
reserveRequestCostUsd,
surplusAlreadyInCap,
} from './address-budget.js';
export type { AddressBudget, AddressBudgetMode, AddressBudgetOptions, UserRateLimitResponse } from './address-budget.js';
export { createCachedLoader } from './cache.js';
export type { CachedLoader, CachedLoaderOptions, CachedValue } from './cache.js';
export { createRequestCounter } from './telemetry.js';
export type { LabelCount, RequestCounter } from './telemetry.js';