Client options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | Required | Bearer token included with every request. |
baseUrl | string | https://api.pbjspace.dev | HTTP(S) API endpoint; base paths are preserved. |
timeout | number | 10000 | Total deadline across attempts, body reading, and retry waits. |
maxRetries | number | 2 | Additional GET attempts after retryable responses. |
retryDelay | number | 250 | Initial exponential backoff delay in milliseconds. |
maxRetryDelay | number | 30000 | Maximum delay for one retry. |
network | devnet | mainnet | devnet | Default Solana network. |
rpcUrl | string | — | Custom RPC endpoint forwarded to PBJ. |
fetch | typeof fetch | globalThis.fetch | Injected Fetch-compatible transport. |
Configuration validation
The constructor rejects an empty API key, non-HTTP URLs, URLs containing credentials, query parameters or fragments, and invalid numeric limits. Numeric settings must be safe integers no larger than 2147483647.
timeoutmust be positive.- Retry settings may be zero.
maxRetries: 0disables automatic retries.signalbelongs to request options, not client configuration.
Base URL behavior
ts
const pbj = new PBJClient({
apiKey,
baseUrl: "https://api.pbjspace.dev/v1",
});
// projects.list() requests:
// https://api.pbjspace.dev/v1/projectsTrailing slashes are normalized, and path identifiers are URL-encoded before requests are sent.
Per-request overrides
Program tracking, wallet activity, and treasury balance requests can override network and rpcUrl. Every request accepts an AbortSignal.
ts
await pbj.wallets.getActivity(address, {
network: "mainnet",
rpcUrl: process.env.SOLANA_RPC_URL,
signal: controller.signal,
});