From 72873e129f14a5b3e7b0f8daa1682ddd1a4f9582 Mon Sep 17 00:00:00 2001 From: Yevhen Haievyi Date: Thu, 29 Aug 2024 16:35:07 +0200 Subject: [PATCH] 2.0.17 --- data/chains/V2/index.ts | 2 +- data/index.config.ts | 2 +- types/graph.types.ts | 2 +- types/pinax.types.ts | 2 +- utils/chains.ts | 81 +++++++++++++++++++++++++++++++---------- 5 files changed, 66 insertions(+), 23 deletions(-) diff --git a/data/chains/V2/index.ts b/data/chains/V2/index.ts index 70c6db0..40a79d6 100644 --- a/data/chains/V2/index.ts +++ b/data/chains/V2/index.ts @@ -1,6 +1,6 @@ // This file is auto-generated on pre-commit to avoid maintaining it. // Do not modify manually as it will be overwritten. -// Last generation on 8/29/2024, 4:29:12 PM. +// Last generation on 8/29/2024, 4:34:59 PM. export { default as celo } from './celo/meta'; export { default as alfajores } from './celo/testnets/alfajores/meta'; diff --git a/data/index.config.ts b/data/index.config.ts index 014d278..ce52a97 100644 --- a/data/index.config.ts +++ b/data/index.config.ts @@ -2,7 +2,7 @@ // Chains under ordered were manually placed, to manage the z-index (priority order) of chains. // Chains under missing are generated from available data, make sure to order them. // Include deprecated or future chains. -// Last generation on 8/29/2024, 4:29:12 PM. +// Last generation on 8/29/2024, 4:34:59 PM. export default { ordered: { diff --git a/types/graph.types.ts b/types/graph.types.ts index 4310508..1c0e5da 100644 --- a/types/graph.types.ts +++ b/types/graph.types.ts @@ -1,6 +1,6 @@ // This file is auto-generated on pre-commit to avoid maintaining it. // Do not modify manually as it will be overwritten. -// Last generation on 8/29/2024, 4:29:12 PM. +// Last generation on 8/29/2024, 4:34:59 PM. export type GraphID = | 'arbitrum-nova' | 'arbitrum-one' diff --git a/types/pinax.types.ts b/types/pinax.types.ts index 75f40e8..233f917 100644 --- a/types/pinax.types.ts +++ b/types/pinax.types.ts @@ -1,6 +1,6 @@ // This file is auto-generated on pre-commit to avoid maintaining it / circular dependencies. // Do not modify manually as it will be overwritten. -// Last generation on 8/29/2024, 4:29:13 PM. +// Last generation on 8/29/2024, 4:34:59 PM. export type PinaxID = | 'celo' | 'alfajores' diff --git a/utils/chains.ts b/utils/chains.ts index fde9cdf..4a8f710 100644 --- a/utils/chains.ts +++ b/utils/chains.ts @@ -19,7 +19,7 @@ import { */ const isServiceSupported = ( chain: Chain | Testnet | ConsensusLayer, - service: ConsensusLayerServiceID | ServiceID + service: ConsensusLayerServiceID | ServiceID, ): boolean => { // Check if supported_services is defined if (!chain.supported_services) { @@ -27,14 +27,19 @@ const isServiceSupported = ( } // @ts-ignore - const serviceStatusDates = chain.supported_services[service] as ServiceStatusDates | undefined; + const serviceStatusDates = chain.supported_services[service] as + | ServiceStatusDates + | undefined; // Check if serviceStatusDates is defined if (!serviceStatusDates) { return false; } - return serviceStatusDates.full_released_at !== null && serviceStatusDates.deprecated_at === null; + return ( + serviceStatusDates.full_released_at !== null && + serviceStatusDates.deprecated_at === null + ); }; /** @@ -45,9 +50,14 @@ const isServiceSupported = ( * * @returns boolean */ -const isServiceBeta = (chain: Chain | Testnet | ConsensusLayer, service: ConsensusLayerServiceID | ServiceID) => { +const isServiceBeta = ( + chain: Chain | Testnet | ConsensusLayer, + service: ConsensusLayerServiceID | ServiceID, +) => { // @ts-ignore - const serviceStatusDates = chain.supported_services[service] as ServiceStatusDates | undefined; + const serviceStatusDates = chain.supported_services[service] as + | ServiceStatusDates + | undefined; return ( serviceStatusDates && serviceStatusDates.beta_released_at !== null && @@ -64,12 +74,18 @@ const isServiceBeta = (chain: Chain | Testnet | ConsensusLayer, service: Consens * * @returns boolean */ -const isServiceDeprecated = (chain: Chain | Testnet | ConsensusLayer, service: ConsensusLayerServiceID | ServiceID) => { +const isServiceDeprecated = ( + chain: Chain | Testnet | ConsensusLayer, + service: ConsensusLayerServiceID | ServiceID, +) => { // @ts-ignore - const serviceStatusDates = chain.supported_services[service] as ServiceStatusDates | undefined; + const serviceStatusDates = chain.supported_services[service] as + | ServiceStatusDates + | undefined; return ( serviceStatusDates && - (serviceStatusDates.beta_released_at !== null || serviceStatusDates.full_released_at !== null) && + (serviceStatusDates.beta_released_at !== null || + serviceStatusDates.full_released_at !== null) && serviceStatusDates.deprecated_at !== null ); }; @@ -83,7 +99,9 @@ const isServiceDeprecated = (chain: Chain | Testnet | ConsensusLayer, service: C */ const isChainSupported = (chain: Chain | Testnet | ConsensusLayer) => { return ( - isServiceSupported(chain, 'firehose') || isServiceSupported(chain, 'substreams') || isServiceSupported(chain, 'rpc') + isServiceSupported(chain, 'firehose') || + isServiceSupported(chain, 'substreams') || + isServiceSupported(chain, 'rpc') ); }; @@ -96,7 +114,9 @@ const isChainSupported = (chain: Chain | Testnet | ConsensusLayer) => { */ const isChainBeta = (chain: Chain | Testnet | ConsensusLayer) => { return ( - (isServiceBeta(chain, 'firehose') || isServiceBeta(chain, 'substreams') || isServiceBeta(chain, 'rpc')) && + (isServiceBeta(chain, 'firehose') || + isServiceBeta(chain, 'substreams') || + isServiceBeta(chain, 'rpc')) && !isServiceSupported(chain, 'firehose') && !isServiceSupported(chain, 'substreams') && !isServiceSupported(chain, 'rpc') @@ -127,7 +147,10 @@ const isChainDeprecated = (chain: Chain | Testnet | ConsensusLayer) => { * * @returns Chain, Testnet or ConsensusLayer */ -const findChainById = (db: Array, id: string): Chain | Testnet | ConsensusLayer | EVM | undefined => { +const findChainById = ( + db: Array, + id: string, +): Chain | Testnet | ConsensusLayer | EVM | undefined => { for (const chain of db) { if (chain.id === id) { return chain; @@ -183,7 +206,9 @@ const findSubnetMainnet = (db: Array, id: string) => { * * @returns boolean */ -const isChainConsensusLayer = (chain: Chain | Testnet | ConsensusLayer): boolean => { +const isChainConsensusLayer = ( + chain: Chain | Testnet | ConsensusLayer, +): boolean => { return chain.id.slice(-3).includes('-cl'); }; @@ -194,7 +219,10 @@ const isChainConsensusLayer = (chain: Chain | Testnet | ConsensusLayer): boolean * * @returns boolean */ -const isChainEVM = (db: Array, chain: Chain | Testnet | ConsensusLayer): boolean => { +const isChainEVM = ( + db: Array, + chain: Chain | Testnet | ConsensusLayer, +): boolean => { let isEVM = false; const mainnet = findSubnetMainnet(db, chain.id); if (mainnet) { @@ -214,7 +242,10 @@ const isChainEVM = (db: Array, chain: Chain | Testnet | ConsensusLayer): * * @returns boolean */ -const isChainTestnet = (db: Array, chain: Chain | Testnet | ConsensusLayer): boolean => { +const isChainTestnet = ( + db: Array, + chain: Chain | Testnet | ConsensusLayer, +): boolean => { let isTestnet = false; const mainnet = findSubnetMainnet(db, chain.id); if (mainnet) { @@ -245,7 +276,9 @@ const hasChainFullBlockSupport = (chain: Chain | Testnet | ConsensusLayer) => { * @param {Array} chains - The array of chains to check for support. * @returns {number} The number of supported chains. */ -const getNumberOfSupportedChains = (chains: Array) => { +const getNumberOfSupportedChains = ( + chains: Array, +) => { let supportedChains = 0; chains .filter((c: any) => isChainSupported(c)) @@ -296,18 +329,24 @@ const getChainStatus = (chain: Chain | ConsensusLayer | EVM | Testnet) => { * @param {Chain | Testnet | ConsensusLayer | EVM} chain - The chain object to check for supported services. * @returns {Array<[ServiceID, string | null]>} An array of tuples where each tuple contains a service ID and the release date (beta or full) of the service. */ -const getSupportedServices = (chain: Chain | Testnet | ConsensusLayer | EVM) => { +const getSupportedServices = ( + chain: Chain | Testnet | ConsensusLayer | EVM, +) => { let supServices = [] as Array<[ServiceID, string | null]>; (['rpc', 'firehose', 'substreams'] as Array).forEach((service) => { if (isServiceBeta(chain as any, service as any)) { supServices.push([ service, - chain.supported_services[service as keyof typeof chain.supported_services]?.beta_released_at, + chain.supported_services[ + service as keyof typeof chain.supported_services + ]?.beta_released_at, ]); } else if (isServiceSupported(chain as any, service as any)) { supServices.push([ service, - chain.supported_services[service as keyof typeof chain.supported_services]?.full_released_at, + chain.supported_services[ + service as keyof typeof chain.supported_services + ]?.full_released_at, ]); } }); @@ -326,7 +365,11 @@ const getChainSubnets = (chain: Chain) => { .concat((chain.consensus as Array) || []); }; -const getChainIconUrl = (chainIcon: ChainIcon, theme: 'dark' | 'light', chainId: string) => { +const getChainIconUrl = ( + chainIcon: ChainIcon, + theme: 'dark' | 'light', + chainId: string, +) => { const iconAssetsFolder = '/assets/chains/'; if (chainIcon?.variants && chainIcon.variants?.includes('branded')) {