-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds noves indexer field to networks (#2846)
* feat: adds noves indexer field to networks * fix: circular dependency and increment alpha version --------- Co-authored-by: Nicole O'Brien <[email protected]>
- Loading branch information
1 parent
56327ef
commit 900f2b4
Showing
9 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/shared/src/lib/core/network/constants/default-noves-indexer-urls.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/shared/src/lib/core/network/constants/noves-translate-api-url.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const NOVES_TRANSLATE_API_URL = 'https://translate.noves.fi/' |
2 changes: 1 addition & 1 deletion
2
packages/shared/src/lib/core/profile/constants/profile-version.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/shared/src/lib/core/profile/migrations/alpha/alpha-profile-migration-27-to-28.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters