diff --git a/src/config/data/ccip/selectors.yml b/src/config/data/ccip/selectors.yml index 943a855c5d5..e08c8f51610 100644 --- a/src/config/data/ccip/selectors.yml +++ b/src/config/data/ccip/selectors.yml @@ -1066,3 +1066,7 @@ selectors: selector: "1804312132722180201" name: "hemi-mainnet" network_type: mainnet + 202601: + selector: "1091131740251125869" + name: "ethereum-testnet-sepolia-ronin-1" + network_type: testnet diff --git a/src/lib/api/cacheHeaders.ts b/src/lib/api/cacheHeaders.ts index 92312d1448a..9b7b6be9c52 100644 --- a/src/lib/api/cacheHeaders.ts +++ b/src/lib/api/cacheHeaders.ts @@ -1,13 +1,27 @@ /** - * Shared cache header configurations for API endpoints + * Shared cache and CORS header configurations for API endpoints * * Cache Strategy: * - 5-minute CDN cache (s-max-age=300) * - Stale-while-revalidate for graceful degradation * - CDN-specific headers for Vercel optimization * - No browser cache (CDN-only caching) + * + * CORS Policy: + * - Open access (Access-Control-Allow-Origin: *) + * - Public, read-only API designed for cross-origin consumption */ +/** + * CORS headers for cross-origin access + * Enables browser-based clients (dApps, scripts) to consume the API + */ +export const corsHeaders = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Headers": "Content-Type", +} + /** * Standard cache headers for all API endpoints * - CDN cache: 5 minutes @@ -26,6 +40,7 @@ export const standardCacheHeaders = { */ export const textPlainHeaders = { "Content-Type": "text/plain; charset=utf-8", + ...corsHeaders, ...standardCacheHeaders, } @@ -35,6 +50,7 @@ export const textPlainHeaders = { */ export const jsonHeaders = { "Content-Type": "application/json", + ...corsHeaders, ...standardCacheHeaders, } @@ -44,4 +60,5 @@ export const jsonHeaders = { */ export const commonHeaders = { "Content-Type": "application/json", + ...corsHeaders, } diff --git a/src/lib/ccip/services/lane-data.ts b/src/lib/ccip/services/lane-data.ts index a61316bc506..360173bb6b4 100644 --- a/src/lib/ccip/services/lane-data.ts +++ b/src/lib/ccip/services/lane-data.ts @@ -20,6 +20,7 @@ import { getChainTypeAndFamily, directoryToSupportedChain, } from "../../../features/utils/index.ts" +import { getSelectorEntry } from "@config/data/ccip/selectors.ts" export const prerender = false @@ -214,11 +215,16 @@ export class LaneDataService { return null } + // Resolve internalId from the selector YAML name (consistent with chains and tokens endpoints) + // Falls back to the RDD directory key if the selector entry is not found + const selectorEntry = getSelectorEntry(chainId, chainType) + const internalId = selectorEntry?.name ?? chainKey + return { chainId, displayName, selector, - internalId: chainKey, + internalId, chainType, chainFamily, }