diff --git a/packages/nextjs/utils/scaffold-stark/networks.ts b/packages/nextjs/utils/scaffold-stark/networks.ts index 420dd0169..bec8fc34a 100644 --- a/packages/nextjs/utils/scaffold-stark/networks.ts +++ b/packages/nextjs/utils/scaffold-stark/networks.ts @@ -1,4 +1,9 @@ -import * as chains from "@starknet-react/chains"; +import { devnet, sepolia, mainnet, Chain } from "@starknet-react/chains"; +export const chains = { + devnet, + sepolia, + mainnet, +}; import scaffoldConfig from "~~/scaffold.config"; type ChainAttributes = { @@ -7,7 +12,7 @@ type ChainAttributes = { nativeCurrencyTokenAddress?: string; }; -export type ChainWithAttributes = chains.Chain & Partial; +export type ChainWithAttributes = Chain & Partial; export const NETWORKS_EXTRA_DATA: Record = { [chains.devnet.network]: { @@ -28,7 +33,7 @@ export function getBlockExplorerTxLink(network: string, txnHash: string) { const targetChainArr = chainNames.filter((chainName) => { const wagmiChain = chains[chainName as keyof typeof chains]; - return (wagmiChain as { network: string }).network === network; + return wagmiChain.network === network; }); if (targetChainArr.length === 0) { @@ -50,10 +55,7 @@ export function getBlockExplorerTxLink(network: string, txnHash: string) { * Gives the block explorer URL for a given address. * Defaults to Etherscan if no (wagmi) block explorer is configured for the network. */ -export function getBlockExplorerAddressLink( - network: chains.Chain, - address: string, -) { +export function getBlockExplorerAddressLink(network: Chain, address: string) { const blockExplorerBaseURL = network.explorers?.starkscan[0]; if (network.network === chains.devnet.network) { return `/blockexplorer/address/${address}`; @@ -70,10 +72,7 @@ export function getBlockExplorerAddressLink( * Gives the block explorer URL for a given classhash. * Defaults to Etherscan if no (wagmi) block explorer is configured for the network. */ -export function getBlockExplorerClasshashLink( - network: chains.Chain, - address: string, -) { +export function getBlockExplorerClasshashLink(network: Chain, address: string) { const blockExplorerBaseURL = network.explorers?.starkscan[0]; if (network.network === chains.devnet.network) { return `/blockexplorer/class/${address}`; @@ -86,7 +85,7 @@ export function getBlockExplorerClasshashLink( return `${blockExplorerBaseURL}/class/${address}`; } -export function getBlockExplorerLink(network: chains.Chain) { +export function getBlockExplorerLink(network: Chain) { switch (network) { case chains.mainnet: return "https://starkscan.co/";