Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds noves indexer field to networks #2846

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
SupportedStardustNetworkId,
} from './supported-network-id.constant'
import { DEFAULT_BLOCKSCOUT_INDEXER_URLS } from './default-blockscout-indexer-urls.constant'
import { DEFAULT_NOVES_INDEXER_URLS } from './default-noves-indexer-urls.constant'

// Ethereum Mainnet

Expand All @@ -25,6 +26,7 @@ const ETHEREUM_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Ethereum],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Ethereum],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Ethereum],
rpcEndpoint: 'https://ethereum-rpc.publicnode.com',
blocksUntilConfirmed: 6,
}
Expand All @@ -41,6 +43,7 @@ export const ARBITRUM_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Arbitrum],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Arbitrum],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Arbitrum],
rpcEndpoint: 'https://arbitrum-one-rpc.publicnode.com',
blocksUntilConfirmed: 6,
}
Expand All @@ -55,6 +58,7 @@ export const BASE_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Base],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Base],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Base],
rpcEndpoint: 'https://base-rpc.publicnode.com',
blocksUntilConfirmed: 6,
}
Expand All @@ -69,6 +73,7 @@ export const BLAST_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Blast],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Blast],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Blast],
rpcEndpoint: 'https://blast-rpc.publicnode.com',
blocksUntilConfirmed: 6,
}
Expand All @@ -83,6 +88,7 @@ export const OPTIMISM_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Optimism],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Optimism],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Optimism],
rpcEndpoint: 'https://optimism-rpc.publicnode.com',
blocksUntilConfirmed: 6,
}
Expand All @@ -97,6 +103,7 @@ export const IMMUTABLE_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Immutable],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Immutable],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Immutable],
rpcEndpoint: 'https://rpc.immutable.com',
blocksUntilConfirmed: 6,
}
Expand All @@ -112,6 +119,7 @@ export const BNB_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
namespace: NetworkNamespace.Evm,
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Bnb] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Bnb],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Bnb],
rpcEndpoint: 'https://bsc-dataseed1.binance.org/',
blocksUntilConfirmed: 3,
}
Expand All @@ -128,6 +136,7 @@ export const SEPOLIA_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Sepolia] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.Sepolia],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.Sepolia],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.Sepolia],
rpcEndpoint: 'https://ethereum-sepolia-rpc.publicnode.com',
blocksUntilConfirmed: 2,
}
Expand All @@ -144,6 +153,7 @@ export const ARBITRUM_TESTNET_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguratio
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.ArbitrumSepoliaTestnet],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.ArbitrumSepoliaTestnet],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.ArbitrumSepoliaTestnet],
rpcEndpoint: 'https://sepolia-rollup.arbitrum.io/rpc',
blocksUntilConfirmed: 2,
}
Expand All @@ -158,6 +168,7 @@ export const BASE_TESTNET_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration =
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.BaseSepoliaTestnet],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.BaseSepoliaTestnet],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.BaseSepoliaTestnet],
rpcEndpoint: 'https://sepolia.base.org',
blocksUntilConfirmed: 2,
}
Expand All @@ -172,6 +183,7 @@ export const BLAST_TESTNET_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration =
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.BlastSepoliaTestnet],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.BlastSepoliaTestnet],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.BlastSepoliaTestnet],
rpcEndpoint: 'https://sepolia.blast.io',
blocksUntilConfirmed: 2,
}
Expand All @@ -186,6 +198,7 @@ export const OPTIMISM_TESTNET_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguratio
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.OptimismSepoliaTestnet],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.OptimismSepoliaTestnet],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.OptimismSepoliaTestnet],
rpcEndpoint: 'https://sepolia.optimism.io',
blocksUntilConfirmed: 2,
}
Expand All @@ -200,6 +213,7 @@ export const IMMUTABLE_TESTNET_NETWORK_CONFIGURATION: IPureEvmNetworkConfigurati
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.Ethereum] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.ImmutableTestnet],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.ImmutableTestnet],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.ImmutableTestnet],
rpcEndpoint: 'https://rpc.testnet.immutable.com',
blocksUntilConfirmed: 2,
}
Expand All @@ -215,6 +229,7 @@ export const BNB_TESTNET_NETWORK_CONFIGURATION: IPureEvmNetworkConfiguration = {
namespace: NetworkNamespace.Evm,
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.BnbTestnet] ?? 0,
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.BnbTestnet],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.BnbTestnet],
rpcEndpoint: 'https://data-seed-prebsc-1-s1.binance.org:8545',
blocksUntilConfirmed: 1,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DEFAULT_BASE_TOKEN } from './default-base-token.constant'
import { DEFAULT_BLOCKSCOUT_INDEXER_URLS } from './default-blockscout-indexer-urls.constant'
import { DEFAULT_COIN_TYPE } from './default-coin-type.constant'
import { DEFAULT_EXPLORER_CONFIGS } from './default-explorer-configs.constant'
import { DEFAULT_NOVES_INDEXER_URLS } from './default-noves-indexer-urls.constant'
import { SupportedIscNetworkId, SupportedNetworkId, SupportedStardustNetworkId } from './supported-network-id.constant'
import { isFeatureEnabled } from '@lib/features/utils'

Expand All @@ -21,6 +22,7 @@ const IOTA_EVM_CHAIN_CONFIGURATION: IIscChainConfiguration = {
apiEndpoint: 'https://api.evm.iotaledger.net/',
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.IotaEvm],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.IotaEvm],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.IotaEvm],
blocksUntilConfirmed: 0,
}

Expand All @@ -37,6 +39,7 @@ const SHIMMER_EVM_CHAIN_CONFIGURATION: IIscChainConfiguration = {
apiEndpoint: 'https://api.evm.shimmer.network/',
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.ShimmerEvm],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.ShimmerEvm],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.ShimmerEvm],
blocksUntilConfirmed: 0,
}

Expand All @@ -53,6 +56,7 @@ const IOTA_TESTNET_EVM_CHAIN_CONFIGURATION: IIscChainConfiguration = {
apiEndpoint: 'https://api.evm.testnet.iotaledger.net/',
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.IotaTestnetEvm],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.IotaTestnetEvm],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.IotaTestnetEvm],
blocksUntilConfirmed: 0,
}

Expand All @@ -70,6 +74,7 @@ export const TESTNET_EVM_CHAIN_CONFIGURATION: IIscChainConfiguration = {
apiEndpoint: 'https://api.evm.testnet.shimmer.network/',
explorer: DEFAULT_EXPLORER_CONFIGS[SupportedNetworkId.TestnetEvm],
blockscoutIndexerUrl: DEFAULT_BLOCKSCOUT_INDEXER_URLS[SupportedNetworkId.TestnetEvm],
novesIndexerUrl: DEFAULT_NOVES_INDEXER_URLS[SupportedNetworkId.TestnetEvm],
blocksUntilConfirmed: 0,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { NetworkId } from '../types'
import { SupportedNetworkId } from './supported-network-id.constant'
import { NOVES_TRANSLATE_API_URL } from './noves-translate-api-url.constant'

export const DEFAULT_NOVES_INDEXER_URLS: Readonly<{ [key in NetworkId]?: string }> = {
// IOTA
[SupportedNetworkId.IotaEvm]: '',
[SupportedNetworkId.IotaTestnetEvm]: '',

// Shimmer
[SupportedNetworkId.ShimmerEvm]: getEvmIndexerUrl('shimmer-evm'),
[SupportedNetworkId.TestnetEvm]: '',

// Ethereum
[SupportedNetworkId.Ethereum]: getEvmIndexerUrl('eth'),
[SupportedNetworkId.Sepolia]: getEvmIndexerUrl('eth-sepolia'),

// Arbitrum
[SupportedNetworkId.Arbitrum]: getEvmIndexerUrl('arbitrum'),
[SupportedNetworkId.ArbitrumSepoliaTestnet]: '',

// Base
[SupportedNetworkId.Base]: getEvmIndexerUrl('base'),
[SupportedNetworkId.BaseSepoliaTestnet]: '',

// Blast
[SupportedNetworkId.Blast]: getEvmIndexerUrl('blast'),
[SupportedNetworkId.BlastSepoliaTestnet]: '',

// Immutable
[SupportedNetworkId.Immutable]: '',
[SupportedNetworkId.ImmutableTestnet]: '',

// Optimism
[SupportedNetworkId.Optimism]: getEvmIndexerUrl('optimism'),
[SupportedNetworkId.OptimismSepoliaTestnet]: '',

// BNB Smart Chain
[SupportedNetworkId.Bnb]: getEvmIndexerUrl('bsc'),
[SupportedNetworkId.BnbTestnet]: '',
}

function getEvmIndexerUrl(networkName: string): string | undefined {
return new URL(`evm/${networkName}`, NOVES_TRANSLATE_API_URL).toString()
}
2 changes: 2 additions & 0 deletions packages/shared/src/lib/core/network/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export * from './default-explorer-configs.constant'
export * from './default-protocol.constant'
export * from './default-network-metadata.constant'
export * from './default-node-urls.constant'
export * from './default-noves-indexer-urls.constant'
export * from './empty-node.constant'
export * from './faucet-urls.constant'
export * from './max-network-name-length.constant'
export * from './milestone-not-found.constant'
export * from './network-status-poll-interval.constant'
export * from './noves-translate-api-url.constant'
export * from './seconds-per-milestone.constant'
export * from './supported-network-id.constant'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const NOVES_TRANSLATE_API_URL = 'https://translate.noves.fi/'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AppStage } from '@core/app/enums'

export const PROFILE_VERSION: Record<AppStage, number> = {
[AppStage.ALPHA]: 27,
[AppStage.ALPHA]: 28,
[AppStage.BETA]: 1,
[AppStage.PROD]: 15,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { DEFAULT_NOVES_INDEXER_URLS } from '@core/network'
import { IPersistedProfile } from '@core/profile/interfaces'

export function alphaProfileMigration27To28(existingProfile: unknown): Promise<void> {
const profile = existingProfile as IPersistedProfile

profile.network.chainConfigurations.forEach((chainConfiguration) => {
chainConfiguration.novesIndexerUrl = DEFAULT_NOVES_INDEXER_URLS[chainConfiguration.id]
})

profile.evmNetworks.forEach((evmNetwork) => {
evmNetwork.novesIndexerUrl = DEFAULT_NOVES_INDEXER_URLS[evmNetwork.id]
})

return Promise.resolve()
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { alphaProfileMigration23To24 } from './alpha-profile-migration-23-to-24'
import { alphaProfileMigration24To25 } from './alpha-profile-migration-24-to-25'
import { alphaProfileMigration25To26 } from './alpha-profile-migration-25-to-26'
import { alphaProfileMigration26To27 } from './alpha-profile-migration-26-to-27'
import { alphaProfileMigration27To28 } from './alpha-profile-migration-27-to-28'
import { alphaProfileMigration3To4 } from './alpha-profile-migration-3-to-4'
import { alphaProfileMigration4To5 } from './alpha-profile-migration-4-to-5'
import { alphaProfileMigration5To6 } from './alpha-profile-migration-5-to-6'
Expand Down Expand Up @@ -61,4 +62,5 @@ export const ALPHA_PROFILE_MIGRATION_MAP: ProfileMigrationMap = {
24: alphaProfileMigration24To25,
25: alphaProfileMigration25To26,
26: alphaProfileMigration26To27,
27: alphaProfileMigration27To28,
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function prodProfileMigration14To15(existingProfile: unknown): Promise<vo
})[]
chainConfigurations.forEach((chainConfiguration) => {
chainConfiguration.blockscoutIndexerUrl = DEFAULT_BLOCKSCOUT_INDEXER_URLS[chainConfiguration.id]
chainConfiguration.novesIndexerUrl = DEFAULT_BLOCKSCOUT_INDEXER_URLS[chainConfiguration.id]
delete chainConfiguration.explorerUrl
chainConfiguration.explorer = DEFAULT_EXPLORER_CONFIGS[chainConfiguration.id]
chainConfiguration.blocksUntilConfirmed =
Expand All @@ -29,6 +30,7 @@ export function prodProfileMigration14To15(existingProfile: unknown): Promise<vo
const evmNetworks = profile.evmNetworks as (IPureEvmNetworkConfiguration & { explorerUrl?: string })[]
evmNetworks.forEach((evmNetwork) => {
evmNetwork.blockscoutIndexerUrl = DEFAULT_BLOCKSCOUT_INDEXER_URLS[evmNetwork.id]
evmNetwork.novesIndexerUrl = DEFAULT_BLOCKSCOUT_INDEXER_URLS[evmNetwork.id]
delete evmNetwork.explorerUrl
evmNetwork.explorer = DEFAULT_EXPLORER_CONFIGS[evmNetwork.id]
evmNetwork.blocksUntilConfirmed = DEFAULT_EVM_NETWORK_CONFIGURATION[evmNetwork.id].blocksUntilConfirmed
Expand Down
Loading