fix(sdk): remove RPC apiKey config from Data Service (#75)

This commit is contained in:
nigiri
2025-04-25 13:13:31 -03:00
committed by GitHub
parent 8c5d42755b
commit 22251acf8e
3 changed files with 2 additions and 10 deletions

View File

@@ -45,13 +45,12 @@ export class DataService {
try {
for (const config of chainConfigs) {
if (!config.rpcUrl || !config.apiKey) {
throw new Error(`Missing RPC URL or API key for chain ${config.chainId}`);
if (!config.rpcUrl) {
throw new Error(`Missing RPC URL for chain ${config.chainId}`);
}
const client = createPublicClient({
transport: http(config.rpcUrl),
key: config.apiKey,
});
this.clients.set(config.chainId, client);
}

View File

@@ -45,7 +45,6 @@ export interface ChainConfig {
privacyPoolAddress: Address;
startBlock: bigint;
rpcUrl: string;
apiKey: string; // API key for RPC provider authentication
}
/**

View File

@@ -28,17 +28,11 @@ describe('DataService with Sepolia', () => {
};
beforeAll(() => {
const apiKey = process.env.RPC_API_KEY;
if (!apiKey) {
throw new Error('RPC_API_KEY environment variable is required');
}
const config: ChainConfig = {
chainId: SEPOLIA_CHAIN_ID,
privacyPoolAddress: POOL_ADDRESS,
startBlock: START_BLOCK,
rpcUrl: 'https://sepolia.rpc.hypersync.xyz',
apiKey,
};
dataService = new DataService([config]);