Skip to content

Commit be5e6d7

Browse files
committed
Update new import the Chain
1 parent 0693218 commit be5e6d7

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

packages/nextjs/utils/scaffold-stark/networks.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import * as chains from "@starknet-react/chains";
1+
import { devnet, sepolia, mainnet, Chain } from "@starknet-react/chains";
2+
export const chains = {
3+
devnet,
4+
sepolia,
5+
mainnet,
6+
};
27
import scaffoldConfig from "~~/scaffold.config";
38

49
type ChainAttributes = {
@@ -7,7 +12,7 @@ type ChainAttributes = {
712
nativeCurrencyTokenAddress?: string;
813
};
914

10-
export type ChainWithAttributes = chains.Chain & Partial<ChainAttributes>;
15+
export type ChainWithAttributes = Chain & Partial<ChainAttributes>;
1116

1217
export const NETWORKS_EXTRA_DATA: Record<string, ChainAttributes> = {
1318
[chains.devnet.network]: {
@@ -28,7 +33,7 @@ export function getBlockExplorerTxLink(network: string, txnHash: string) {
2833

2934
const targetChainArr = chainNames.filter((chainName) => {
3035
const wagmiChain = chains[chainName as keyof typeof chains];
31-
return (wagmiChain as { network: string }).network === network;
36+
return wagmiChain.network === network;
3237
});
3338

3439
if (targetChainArr.length === 0) {
@@ -50,10 +55,7 @@ export function getBlockExplorerTxLink(network: string, txnHash: string) {
5055
* Gives the block explorer URL for a given address.
5156
* Defaults to Etherscan if no (wagmi) block explorer is configured for the network.
5257
*/
53-
export function getBlockExplorerAddressLink(
54-
network: chains.Chain,
55-
address: string,
56-
) {
58+
export function getBlockExplorerAddressLink(network: Chain, address: string) {
5759
const blockExplorerBaseURL = network.explorers?.starkscan[0];
5860
if (network.network === chains.devnet.network) {
5961
return `/blockexplorer/address/${address}`;
@@ -70,10 +72,7 @@ export function getBlockExplorerAddressLink(
7072
* Gives the block explorer URL for a given classhash.
7173
* Defaults to Etherscan if no (wagmi) block explorer is configured for the network.
7274
*/
73-
export function getBlockExplorerClasshashLink(
74-
network: chains.Chain,
75-
address: string,
76-
) {
75+
export function getBlockExplorerClasshashLink(network: Chain, address: string) {
7776
const blockExplorerBaseURL = network.explorers?.starkscan[0];
7877
if (network.network === chains.devnet.network) {
7978
return `/blockexplorer/class/${address}`;
@@ -86,7 +85,7 @@ export function getBlockExplorerClasshashLink(
8685
return `${blockExplorerBaseURL}/class/${address}`;
8786
}
8887

89-
export function getBlockExplorerLink(network: chains.Chain) {
88+
export function getBlockExplorerLink(network: Chain) {
9089
switch (network) {
9190
case chains.mainnet:
9291
return "https://starkscan.co/";

0 commit comments

Comments
 (0)