Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicole-obrien committed May 15, 2024
1 parent 69ec24a commit 8ba4c3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions packages/shared/src/lib/core/network/apis/explorer.api.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { DEFAULT_APPLICATION_JSON_REQUEST_OPTIONS, buildUrl } from '@core/utils'
import {} from '../enums'
import { DEFAULT_APPLICATION_JSON_REQUEST_OPTIONS } from '@core/utils/constants'
import { buildUrl } from '@core/utils/url'
import { SupportedNetworkId } from '../constants'
import { DEFAULT_EXPLORER_API_BASE_URL } from '../constants/default-explorer-api-base-url.constant'
import { ExplorerApiEndpoint } from '../enums'
import { IExplorerApiNetwork, IExplorerApiNetworks } from '../interfaces'
import { NetworkId } from '../types'
import { SupportedStardustNetworkId } from '../constants'

const ExplorerNetworkId = {
[SupportedStardustNetworkId.Iota]: 'mainnet',
[SupportedStardustNetworkId.Shimmer]: 'shimmer',
[SupportedStardustNetworkId.IotaTestnet]: 'iota-testnet',
[SupportedStardustNetworkId.Testnet]: 'shimmer-testnet',
}
import type { NetworkId } from '../types'

export class ExplorerApi {
static async makeRequest<T>(endpoint: ExplorerApiEndpoint): Promise<T> {
Expand All @@ -35,6 +28,12 @@ export class ExplorerApi {
}

static async getNetworkInfo(networkId: NetworkId): Promise<IExplorerApiNetwork | undefined> {
const ExplorerNetworkId = {
[SupportedNetworkId.Iota]: 'mainnet',
[SupportedNetworkId.Shimmer]: 'shimmer',
[SupportedNetworkId.IotaTestnet]: 'iota-testnet',
[SupportedNetworkId.Testnet]: 'shimmer-testnet',
}
const networksInfo = await ExplorerApi.makeRequest<IExplorerApiNetworks>(ExplorerApiEndpoint.Networks)
const networkInfo = networksInfo?.networks.find((network) => network.network === ExplorerNetworkId[networkId])
return networkInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EvmNetworkId, StardustNetworkId } from '../types'
import type { EvmNetworkId, StardustNetworkId } from '../types/network-id.type'
import { ChainId } from '../enums/chain-id.enum'
import { NetworkNamespace } from '../enums/network-namespace.enum'
import { StardustNetworkName } from '../enums/stardust-network-name.enum'
Expand Down

0 comments on commit 8ba4c3c

Please sign in to comment.