Skip to content

Commit

Permalink
fix: testnet explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
nicole-obrien committed May 14, 2024
1 parent 36af4c0 commit 438f6be
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SupportedNetworkId } from './supported-network-id.constant'
export const DEFAULT_EXPLORER_URLS: Readonly<{ [key in NetworkId]?: string }> = {
[SupportedNetworkId.Iota]: 'https://explorer.iota.org',
[SupportedNetworkId.Shimmer]: 'https://explorer.shimmer.network',
[SupportedNetworkId.IotaTestnet]: 'https://explorer.iota.org/iota-testnet',
[SupportedNetworkId.IotaTestnet]: 'https://explorer.iota.org',
[SupportedNetworkId.Testnet]: 'https://explorer.shimmer.network',
[SupportedNetworkId.IotaEvm]: 'https://explorer.evm.iota.org',
[SupportedNetworkId.ShimmerEvm]: 'https://explorer.evm.shimmer.network',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const DEFAULT_NETWORK_METADATA: Readonly<{ [key in StardustNetworkId]?: N
coinType: DEFAULT_COIN_TYPE[SupportedNetworkId.IotaTestnet],
protocol: DEFAULT_PROTOCOL[SupportedNetworkId.IotaTestnet],
baseToken: DEFAULT_BASE_TOKEN[SupportedNetworkId.IotaTestnet],
explorerUrl: DEFAULT_EXPLORER_URLS[SupportedNetworkId.IotaTestnet],
},
[SupportedNetworkId.Testnet]: <IStardustNetworkMetadata>{
id: SupportedNetworkId.Testnet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export function getExplorerApiNetworkName(networkId: NetworkId): string {
case SupportedStardustNetworkId.Testnet:
return 'testnet'
default:
return ''
return 'iota-testnet'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export function getExplorerUrl(
const baseUrl = getNetwork(networkId)?.explorerUrl ?? ''
const endpoint = getExplorerEndpoint(networkId, requestedEndpoint) ?? ''

const url = buildUrl({ origin: baseUrl, pathname: `${endpoint}${pathParameter ? '/' + pathParameter : ''}` })
const url = buildUrl({ base: baseUrl, pathname: `${endpoint}${pathParameter ? '/' + pathParameter : ''}` })
return url?.href
}
4 changes: 2 additions & 2 deletions packages/shared/src/lib/core/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export function cleanUrl(
}

type UrlParams = {
origin: string
base: string
pathname?: string
query?: QueryParameters
}

export function buildUrl(urlParams: UrlParams): URL | undefined {
try {
const url = new URL(urlParams.pathname ?? '', urlParams.origin)
const url = new URL(urlParams.pathname ?? '', urlParams.base)
for (const key of Object.keys(urlParams.query ?? {})) {
const value = urlParams.query?.[key]
if (!value) continue
Expand Down

0 comments on commit 438f6be

Please sign in to comment.