Skip to content

Commit 05bcbd0

Browse files
committed
fix: update data files and types for camelCase consistency after rebase
- Convert lanes.json supportedTokens from object to array format - Convert tokens.json poolAddress/poolType to nested pool object - Fix OutputKeyType and LaneInputKeyType to use camelCase values - Update service files for camelCase chain identifier resolution - Sync mainnet/testnet data with latest from origin/main
1 parent f984980 commit 05bcbd0

File tree

12 files changed

+7672
-6733
lines changed

12 files changed

+7672
-6733
lines changed

src/config/data/ccip/v1_2_0/mainnet/lanes.json

Lines changed: 1447 additions & 403 deletions
Large diffs are not rendered by default.

src/config/data/ccip/v1_2_0/mainnet/tokens.json

Lines changed: 4658 additions & 3882 deletions
Large diffs are not rendered by default.

src/config/data/ccip/v1_2_0/testnet/lanes.json

Lines changed: 347 additions & 713 deletions
Large diffs are not rendered by default.

src/config/data/ccip/v1_2_0/testnet/tokens.json

Lines changed: 1194 additions & 1709 deletions
Large diffs are not rendered by default.

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,26 +258,26 @@ export class LaneDataService {
258258
filters: LaneFilterType
259259
): boolean {
260260
// Check source chain filters
261-
if (filters.sourceChainId && !this.matchesChainFilter(sourceChain, filters.sourceChainId, "chain_id")) {
261+
if (filters.sourceChainId && !this.matchesChainFilter(sourceChain, filters.sourceChainId, "chainId")) {
262262
return false
263263
}
264264
if (filters.sourceSelector && !this.matchesChainFilter(sourceChain, filters.sourceSelector, "selector")) {
265265
return false
266266
}
267-
if (filters.sourceInternalId && !this.matchesChainFilter(sourceChain, filters.sourceInternalId, "internal_id")) {
267+
if (filters.sourceInternalId && !this.matchesChainFilter(sourceChain, filters.sourceInternalId, "internalId")) {
268268
return false
269269
}
270270

271271
// Check destination chain filters
272-
if (filters.destinationChainId && !this.matchesChainFilter(destChain, filters.destinationChainId, "chain_id")) {
272+
if (filters.destinationChainId && !this.matchesChainFilter(destChain, filters.destinationChainId, "chainId")) {
273273
return false
274274
}
275275
if (filters.destinationSelector && !this.matchesChainFilter(destChain, filters.destinationSelector, "selector")) {
276276
return false
277277
}
278278
if (
279279
filters.destinationInternalId &&
280-
!this.matchesChainFilter(destChain, filters.destinationInternalId, "internal_id")
280+
!this.matchesChainFilter(destChain, filters.destinationInternalId, "internalId")
281281
) {
282282
return false
283283
}
@@ -291,7 +291,7 @@ export class LaneDataService {
291291
private matchesChainFilter(
292292
chain: ChainInfoInternal,
293293
filterValue: string,
294-
filterType: "chain_id" | "selector" | "internal_id"
294+
filterType: "chainId" | "selector" | "internalId"
295295
): boolean {
296296
const filterValues = filterValue.split(",").map((v) => v.trim())
297297
// Map snake_case filter types to camelCase property names
@@ -304,8 +304,8 @@ export class LaneDataService {
304304
const chainValue = chain[propertyName].toString()
305305

306306
// For chain_id, also check generated chain key format
307-
if (filterType === "chain_id") {
308-
const generatedKey = generateChainKey(chain.chainId, chain.chainType, "chain_id")
307+
if (filterType === "chainId") {
308+
const generatedKey = generateChainKey(chain.chainId, chain.chainType, "chainId")
309309
return filterValues.includes(chainValue) || filterValues.includes(generatedKey)
310310
}
311311

@@ -329,12 +329,12 @@ export class LaneDataService {
329329
const propertyName = propertyMap[outputKey]
330330

331331
const sourceKey =
332-
outputKey === "chain_id"
332+
outputKey === "chainId"
333333
? generateChainKey(sourceChain.chainId, sourceChain.chainType, outputKey)
334334
: sourceChain[propertyName].toString()
335335

336336
const destKey =
337-
outputKey === "chain_id"
337+
outputKey === "chainId"
338338
? generateChainKey(destChain.chainId, destChain.chainType, outputKey)
339339
: destChain[propertyName].toString()
340340

@@ -537,13 +537,13 @@ export class LaneDataService {
537537
chainsReferenceData: Record<string, ChainConfig>
538538
): string | null {
539539
// If already an internal_id, return it directly
540-
if (inputKeyType === "internal_id") {
540+
if (inputKeyType === "internalId") {
541541
return chainsReferenceData[identifier] ? identifier : null
542542
}
543543

544544
// Search through chains to find matching chain_id or selector
545545
for (const [internalId, chainConfig] of Object.entries(chainsReferenceData)) {
546-
if (inputKeyType === "chain_id") {
546+
if (inputKeyType === "chainId") {
547547
// Try to match by numeric chain ID
548548
try {
549549
const supportedChain = directoryToSupportedChain(internalId)

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ export class TokenDataService {
149149

150150
if (!destNumericChainId) return destChainId
151151

152-
if (outputKey === "chain_id") {
152+
if (outputKey === "chainId") {
153153
return generateChainKey(destNumericChainId, destChainType, outputKey)
154154
} else if (outputKey === "selector") {
155155
const selectorEntry = getSelectorEntry(destNumericChainId, destChainType)
156156
return selectorEntry?.selector || destChainId
157-
} else if (outputKey === "internal_id") {
157+
} else if (outputKey === "internalId") {
158158
const selectorEntry = getSelectorEntry(destNumericChainId, destChainType)
159159
return selectorEntry?.name || destChainId
160160
}
@@ -164,14 +164,14 @@ export class TokenDataService {
164164

165165
// Get the appropriate key based on outputKey parameter
166166
let chainKey = chainId
167-
if (outputKey === "chain_id") {
167+
if (outputKey === "chainId") {
168168
chainKey = generateChainKey(numericChainId, chainType, outputKey)
169169
} else if (outputKey === "selector") {
170170
const selectorEntry = getSelectorEntry(numericChainId, chainType)
171171
if (selectorEntry) {
172172
chainKey = selectorEntry.selector
173173
}
174-
} else if (outputKey === "internal_id") {
174+
} else if (outputKey === "internalId") {
175175
const selectorEntry = getSelectorEntry(numericChainId, chainType)
176176
if (selectorEntry) {
177177
chainKey = selectorEntry.name
@@ -276,7 +276,7 @@ export class TokenDataService {
276276
public async getFilteredTokens(
277277
environment: Environment,
278278
filters: TokenFilterType,
279-
outputKey: OutputKeyType = "chain_id"
279+
outputKey: OutputKeyType = "chainId"
280280
): Promise<TokenServiceResponse> {
281281
logger.info({
282282
message: "Starting token filtering process",
@@ -388,7 +388,7 @@ export class TokenDataService {
388388
public async getTokenWithFinality(
389389
environment: Environment,
390390
tokenCanonicalSymbol: string,
391-
outputKey: OutputKeyType = "chain_id"
391+
outputKey: OutputKeyType = "chainId"
392392
): Promise<TokenDetailServiceResponse | null> {
393393
logger.info({
394394
message: "Getting token with finality data",
@@ -523,7 +523,7 @@ export class TokenDataService {
523523
public async getTokenFinality(
524524
environment: Environment,
525525
tokenCanonicalSymbol: string,
526-
outputKey: OutputKeyType = "chain_id"
526+
outputKey: OutputKeyType = "chainId"
527527
): Promise<TokenFinalityServiceResponse | null> {
528528
logger.info({
529529
message: "Getting token finality data",

src/lib/ccip/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export type ChainApiResponse = {
7474
}[]
7575
}
7676

77-
export type OutputKeyType = "chain_id" | "selector" | "internal_id"
77+
export type OutputKeyType = "chainId" | "selector" | "internalId"
7878

7979
export type ChainApiError = {
8080
error: string
@@ -323,7 +323,7 @@ export interface LaneFilterType {
323323
/**
324324
* Input key type for lane path parameters
325325
*/
326-
export type LaneInputKeyType = "chain_id" | "selector" | "internal_id"
326+
export type LaneInputKeyType = "chainId" | "selector" | "internalId"
327327

328328
/**
329329
* Metadata for single lane detail API responses

src/pages/api/ccip/v1/chains.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const GET: APIRoute = async ({ request }) => {
5757

5858
// Validate legacy filters
5959
const filters: FilterType = {
60-
chainId: params.get("chain_id") || undefined,
60+
chainId: params.get("chainId") || undefined,
6161
selector: params.get("selector") || undefined,
6262
internalId: params.get("internalId") || undefined,
6363
}
@@ -200,7 +200,7 @@ export const GET: APIRoute = async ({ request }) => {
200200
acc[familyKey] = chainList.reduce(
201201
(familyAcc, chain) => {
202202
const key =
203-
outputKey === "chain_id"
203+
outputKey === "chainId"
204204
? generateChainKey(chain.chainId, chain.chainType, outputKey)
205205
: outputKey
206206
? chain[outputKey].toString()

src/pages/api/ccip/v1/lanes/by-chain-id/[source]/[destination]/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const GET: APIRoute = async ({ params, request }) => {
4242
})
4343

4444
const laneDataService = new LaneDataService()
45-
const result = await laneDataService.getLaneDetails(environment, source, destination, "chain_id")
45+
const result = await laneDataService.getLaneDetails(environment, source, destination, "chainId")
4646

4747
if (!result.data) {
4848
throw new CCIPError(404, `Lane from chain '${source}' to chain '${destination}' not found`)

src/pages/api/ccip/v1/lanes/by-chain-id/[source]/[destination]/supported-tokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const GET: APIRoute = async ({ params, request }) => {
4242
})
4343

4444
const laneDataService = new LaneDataService()
45-
const result = await laneDataService.getSupportedTokensWithRateLimits(environment, source, destination, "chain_id")
45+
const result = await laneDataService.getSupportedTokensWithRateLimits(environment, source, destination, "chainId")
4646

4747
if (!result.data) {
4848
throw new CCIPError(404, `Lane from chain '${source}' to chain '${destination}' not found`)

0 commit comments

Comments
 (0)