Skip to content

Conversation

@samholmes
Copy link
Collaborator

@samholmes samholmes commented Dec 2, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Adds centralized serviceKeys for API keys and updates Ethereum tools/adapters/fees to use them with deprecation fallbacks.

  • Common:
    • Service Keys: Add ServiceKeys type and cleaner in src/common/types.ts and new helpers getRandomServiceKey/getServiceKeyIndex in src/common/serviceKeys.ts.
  • Ethereum:
    • Init Options: Extend EthereumInitOptions with serviceKeys (and infuraProjectId), mark legacy keys (e.g., etherscanApiKey, evmScanApiKey, amberdataApiKey, etc.) as deprecated via asEthereumInitOptions.
    • Tools: Validate init options with asEthereumInitOptions in EthereumTools.
    • Fees: Update getEvmScanApiKey to prefer serviceKeys (by host via getServiceKeyIndex), fallback to deprecated keys with warnings.
    • Network Adapters: Migrate API key resolution to serviceKeys with fallbacks in AmberdataAdapter, BlockchairAdapter, BlockcypherAdapter, BlockbookWsAdapter, and RpcAdapter (including RPC URL template key replacement and error messaging).
  • Tests:
    • Update feeProvider.test.ts to supply serviceKeys for EvmScan test.

Written by Cursor Bugbot for commit 80e245e. This will update automatically on new commits. Configure here.


if (apiKey == null) {
const cleanKey = asEthereumInitKeys(key)
const cleanApiKey = this.ethEngine.initOptions[cleanKey]
if (cleanApiKey === 'string') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Type check uses value comparison instead of typeof

The addRpcApiKey function's fallback for deprecated API keys incorrectly checks cleanApiKey === 'string' instead of typeof cleanApiKey === 'string'. This prevents the fallback from working, leading to "Missing serviceKeys" errors for users relying on deprecated initOptions like infuraProjectId.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants