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
+ } ;
2
7
import scaffoldConfig from "~~/scaffold.config" ;
3
8
4
9
type ChainAttributes = {
@@ -7,7 +12,7 @@ type ChainAttributes = {
7
12
nativeCurrencyTokenAddress ?: string ;
8
13
} ;
9
14
10
- export type ChainWithAttributes = chains . Chain & Partial < ChainAttributes > ;
15
+ export type ChainWithAttributes = Chain & Partial < ChainAttributes > ;
11
16
12
17
export const NETWORKS_EXTRA_DATA : Record < string , ChainAttributes > = {
13
18
[ chains . devnet . network ] : {
@@ -28,7 +33,7 @@ export function getBlockExplorerTxLink(network: string, txnHash: string) {
28
33
29
34
const targetChainArr = chainNames . filter ( ( chainName ) => {
30
35
const wagmiChain = chains [ chainName as keyof typeof chains ] ;
31
- return ( wagmiChain as { network : string } ) . network === network ;
36
+ return wagmiChain . network === network ;
32
37
} ) ;
33
38
34
39
if ( targetChainArr . length === 0 ) {
@@ -50,10 +55,7 @@ export function getBlockExplorerTxLink(network: string, txnHash: string) {
50
55
* Gives the block explorer URL for a given address.
51
56
* Defaults to Etherscan if no (wagmi) block explorer is configured for the network.
52
57
*/
53
- export function getBlockExplorerAddressLink (
54
- network : chains . Chain ,
55
- address : string ,
56
- ) {
58
+ export function getBlockExplorerAddressLink ( network : Chain , address : string ) {
57
59
const blockExplorerBaseURL = network . explorers ?. starkscan [ 0 ] ;
58
60
if ( network . network === chains . devnet . network ) {
59
61
return `/blockexplorer/address/${ address } ` ;
@@ -70,10 +72,7 @@ export function getBlockExplorerAddressLink(
70
72
* Gives the block explorer URL for a given classhash.
71
73
* Defaults to Etherscan if no (wagmi) block explorer is configured for the network.
72
74
*/
73
- export function getBlockExplorerClasshashLink (
74
- network : chains . Chain ,
75
- address : string ,
76
- ) {
75
+ export function getBlockExplorerClasshashLink ( network : Chain , address : string ) {
77
76
const blockExplorerBaseURL = network . explorers ?. starkscan [ 0 ] ;
78
77
if ( network . network === chains . devnet . network ) {
79
78
return `/blockexplorer/class/${ address } ` ;
@@ -86,7 +85,7 @@ export function getBlockExplorerClasshashLink(
86
85
return `${ blockExplorerBaseURL } /class/${ address } ` ;
87
86
}
88
87
89
- export function getBlockExplorerLink ( network : chains . Chain ) {
88
+ export function getBlockExplorerLink ( network : Chain ) {
90
89
switch ( network ) {
91
90
case chains . mainnet :
92
91
return "https://starkscan.co/" ;
0 commit comments