Files
2026-01-01 08:04:06 -08:00
..
2026-01-01 08:04:06 -08:00
2026-01-01 08:04:06 -08:00
2026-01-01 08:04:06 -08:00
2026-01-01 08:04:06 -08:00

@dbis-thirdweb/http-api

HTTP API client wrapper for Chain 138 with retries, timeouts, and type-safe endpoints.

Usage

Basic Client

import { createAPIClient } from '@dbis-thirdweb/http-api';

const client = createAPIClient({
  apiKey: 'your-api-key',
  timeout: 30000,
  retries: 3,
});

// GET request
const data = await client.get('/endpoint');

// POST request
const result = await client.post('/endpoint', { data: 'value' });

Chain 138 API Endpoints

import { createChain138API } from '@dbis-thirdweb/http-api';

const api = createChain138API({
  apiKey: 'your-api-key',
});

// Get chain metadata
const metadata = await api.getChainMetadata();

// Get transaction receipt
const receipt = await api.getTransactionReceipt('0x...');

// Get transaction logs
const logs = await api.getTransactionLogs('0x...');

// Get block
const block = await api.getBlock(12345);

// Get latest block
const latestBlock = await api.getLatestBlock();

// Send transaction (if supported)
const txResult = await api.sendTransaction({
  to: '0x...',
  value: '1000000000000000000',
});

Features

  • Standardized client wrapper with retry logic
  • Exponential backoff for retries
  • Configurable timeouts
  • Chain 138 base URL configuration
  • Type-safe request/response interfaces
  • Automatic chain ID header injection