Skip to content

getAlchemyRpcUrl

Generates the base Alchemy RPC URL for a given chain Id.

Usage

import { getAlchemyRpcUrl } from '@ethereum-tag-service/contracts/utils'
 
const url = getAlchemyRpcUrl('84532')
// @log: Output: "https://base-sepolia.g.alchemy.com/v2/"
## Errors were thrown in the sample, but not included in an error tag These errors were not marked as being expected: 2307. Expected: // @errors: 2307 Compiler Errors: index.ts [2307] 33 - Cannot find module '@ethereum-tag-service/contracts/utils' or its corresponding type declarations.

Returns

string

A string representing the Alchemy RPC URL for the specified chain.

Parameters

chainId

  • Type: string
  • Description: The chain ID (e.g., "84532" for Arbitrum Sepolia)

Supported Chain IDs

  • "84532": base-sepolia
  • "84532": base-sepolia

Examples

import { getAlchemyRpcUrl } from '@ethereum-tag-service/contracts/utils'
 
// Get Arbitrum Sepolia RPC URL
const baseUrl = getAlchemyRpcUrl('84532')
// @log: Output: https://base-sepolia.g.alchemy.com/v2/
 
// Get Base Sepolia RPC URL
const baseUrl = getAlchemyRpcUrl('84532')
// @log: Output: https://base-sepolia.g.alchemy.com/v2/
## Errors were thrown in the sample, but not included in an error tag These errors were not marked as being expected: 2307 2451. Expected: // @errors: 2307 2451 Compiler Errors: index.ts [2307] 33 - Cannot find module '@ethereum-tag-service/contracts/utils' or its corresponding type declarations. [2451] 112 - Cannot redeclare block-scoped variable 'baseUrl'. [2451] 239 - Cannot redeclare block-scoped variable 'baseUrl'.