Skip to content

Commit 773b72f

Browse files
authored
update ccip config api (#3457)
1 parent 02f4753 commit 773b72f

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

src/config/data/ccip/selectors.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,3 +1066,7 @@ selectors:
10661066
selector: "1804312132722180201"
10671067
name: "hemi-mainnet"
10681068
network_type: mainnet
1069+
202601:
1070+
selector: "1091131740251125869"
1071+
name: "ethereum-testnet-sepolia-ronin-1"
1072+
network_type: testnet

src/lib/api/cacheHeaders.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
/**
2-
* Shared cache header configurations for API endpoints
2+
* Shared cache and CORS header configurations for API endpoints
33
*
44
* Cache Strategy:
55
* - 5-minute CDN cache (s-max-age=300)
66
* - Stale-while-revalidate for graceful degradation
77
* - CDN-specific headers for Vercel optimization
88
* - No browser cache (CDN-only caching)
9+
*
10+
* CORS Policy:
11+
* - Open access (Access-Control-Allow-Origin: *)
12+
* - Public, read-only API designed for cross-origin consumption
913
*/
1014

15+
/**
16+
* CORS headers for cross-origin access
17+
* Enables browser-based clients (dApps, scripts) to consume the API
18+
*/
19+
export const corsHeaders = {
20+
"Access-Control-Allow-Origin": "*",
21+
"Access-Control-Allow-Methods": "GET, OPTIONS",
22+
"Access-Control-Allow-Headers": "Content-Type",
23+
}
24+
1125
/**
1226
* Standard cache headers for all API endpoints
1327
* - CDN cache: 5 minutes
@@ -26,6 +40,7 @@ export const standardCacheHeaders = {
2640
*/
2741
export const textPlainHeaders = {
2842
"Content-Type": "text/plain; charset=utf-8",
43+
...corsHeaders,
2944
...standardCacheHeaders,
3045
}
3146

@@ -35,6 +50,7 @@ export const textPlainHeaders = {
3550
*/
3651
export const jsonHeaders = {
3752
"Content-Type": "application/json",
53+
...corsHeaders,
3854
...standardCacheHeaders,
3955
}
4056

@@ -44,4 +60,5 @@ export const jsonHeaders = {
4460
*/
4561
export const commonHeaders = {
4662
"Content-Type": "application/json",
63+
...corsHeaders,
4764
}

src/lib/ccip/services/lane-data.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
getChainTypeAndFamily,
2121
directoryToSupportedChain,
2222
} from "../../../features/utils/index.ts"
23+
import { getSelectorEntry } from "@config/data/ccip/selectors.ts"
2324

2425
export const prerender = false
2526

@@ -214,11 +215,16 @@ export class LaneDataService {
214215
return null
215216
}
216217

218+
// Resolve internalId from the selector YAML name (consistent with chains and tokens endpoints)
219+
// Falls back to the RDD directory key if the selector entry is not found
220+
const selectorEntry = getSelectorEntry(chainId, chainType)
221+
const internalId = selectorEntry?.name ?? chainKey
222+
217223
return {
218224
chainId,
219225
displayName,
220226
selector,
221-
internalId: chainKey,
227+
internalId,
222228
chainType,
223229
chainFamily,
224230
}

0 commit comments

Comments
 (0)