Skip to content

Commit 258158a

Browse files
Merge branch 'main' into fix/packages-dedupe-resolution
2 parents 2bc3eac + dc475c9 commit 258158a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

examples/next/src/hooks/useNetwork.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networks } from '@autonomys/auto-utils'
1+
import { NetworkId, networks } from '@autonomys/auto-utils'
22
import { useParams } from 'next/navigation'
33
import { useCallback, useEffect, useMemo, useState } from 'react'
44

@@ -17,7 +17,7 @@ export const useNetwork = () => {
1717
const listOfNetworks = useMemo(() => networks.map((network) => network.id), [])
1818

1919
const handleNetworkChange = useCallback(
20-
(networkId: string) => {
20+
(networkId: NetworkId) => {
2121
if (!listOfNetworks.includes(networkId)) {
2222
throw new Error(`Network ${networkId} not found`)
2323
}
@@ -29,7 +29,7 @@ export const useNetwork = () => {
2929

3030
useEffect(() => {
3131
if (networkName && config.networkId !== networkName && Array.isArray(networkName) === false)
32-
handleNetworkChange(networkName)
32+
handleNetworkChange(networkName as NetworkId)
3333
}, [networkName])
3434

3535
return { config, handleNetworkChange }

packages/auto-utils/src/types/network.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// file: src/types/network.ts
22
import type { ApiOptions } from '@polkadot/api/types'
3+
import { NetworkId, NetworkName } from '../constants/network'
34
import type { NetworkDomains } from './domain'
45
import { Token } from './token'
56

@@ -9,8 +10,8 @@ export type Explorer = {
910
}
1011

1112
export type Network = {
12-
id: string
13-
name: string
13+
id: NetworkId
14+
name: NetworkName
1415
rpcUrls: string[]
1516
explorer: Explorer[]
1617
domains: NetworkDomains[]

0 commit comments

Comments
 (0)