Client Configuration
The Urblock class is the main entry point. It accepts a bearer credential and optional configuration.
Constructor
import { Urblock } from "@urblock/sdk";
const urblock = new Urblock(apiKey, config?);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Bearer credential used in the Authorization header. Most SDK resources use API keys (sk_live_..., sk_test_..., pk_live_..., or pk_test_...). Some dashboard-scoped flows use JWT bearer tokens. |
config | UrblockConfig | No | Configuration overrides |
UrblockConfig
| Property | Type | Default | Description |
|---|---|---|---|
baseUrl | string | https://api.urblock.io | Base URL of the Urblock API |
timeout | number | 30000 | Request timeout in milliseconds |
fetch | typeof fetch | globalThis.fetch | Custom fetch implementation |
headers | Record<string, string> | {} | Default headers merged into every request |
Examples
Default Configuration
const urblock = new Urblock("sk_test_...");
Dashboard JWT
const urblock = new Urblock("eyJhbGciOi...");
Use a JWT bearer token only for SDK methods backed by dashboard-authenticated endpoints.
Custom Base URL
const urblock = new Urblock("sk_test_...", {
baseUrl: "https://api.staging.urblock.io",
});
Custom Timeout
const urblock = new Urblock("sk_test_...", {
timeout: 60_000, // 60 seconds
});
Custom Fetch (e.g., undici)
import { fetch } from "undici";
const urblock = new Urblock("sk_test_...", {
fetch,
});
Custom Headers
const urblock = new Urblock("sk_test_...", {
headers: {
"X-Custom-Header": "my-value",
},
});
Available Resources
Once initialized, the client exposes these resources as readonly properties:
| Property | Resource | Description |
|---|---|---|
connect | ConnectResource | Smart accounts, passkeys, recovery, analytics |
tokens | TokensResource | Token deployment, reads, pause/unpause |
transactions | TransactionsResource | Mint, transfer, burn, approve operations |
networks | NetworksResource | Supported blockchain networks |
webhooks | WebhooksResource | Webhook endpoint management |
events | EventsResource | Audit log / webhook events |
governance | GovernanceResource | Governor + Timelock governance |
identities | IdentitiesResource | T-REX ONCHAINID identities |
compliance | ComplianceResource | T-REX compliance modules |
trustedIssuers | TrustedIssuersResource | T-REX trusted issuers registry |
claimTopics | ClaimTopicsResource | T-REX claim topics registry |
trex | TrexResource | T-REX token operations |
roles | RolesResource | On-chain access control roles |
vesting | VestingResource | VestingWallet schedules |
vaults | VaultsResource | ERC-4626 tokenized vaults |
gasEstimates | GasEstimatesResource | Gas estimation |
batch | BatchResource | Batch operations |
chainlink | ChainlinkResource | Chainlink Price Feeds + VRF v2.5 |
multisig | MultisigResource | Safe{Wallet} multisig wallets |
tba | TbaResource | Token Bound Accounts (ERC-6551) |
faucet | FaucetResource | Testnet faucet |
billing | BillingResource | Billing plans, subscriptions, usage |
analytics | AnalyticsResource | Tenant analytics and metrics |
Top-Level Methods
The client also exposes two methods directly:
health()
Health check endpoint.
const health = await urblock.health();
// { status: "ok", timestamp: "2025-01-01T00:00:00.000Z", version: "1.0.0" }
GET /health is public, but the SDK still sends the bearer credential configured on the client.
status()
Detailed service status.
const status = await urblock.status();
// { object: "status", status: "operational", services: { ... }, timestamp: "..." }
GET /v1/status requires a valid API key or JWT bearer token.
TypeScript Support
All types are exported from the package:
import type {
TokenResponse,
TransactionResponse,
ListResponse,
UrblockConfig,
UrblockError,
} from "@urblock/sdk";
Resource classes are also exported for advanced usage:
import { TokensResource, HttpClient } from "@urblock/sdk";