@@ -40,15 +40,15 @@ const alchemyToViemChain: Record<number, string> = {
40
40
type AlchemyProtocol = "https" | "wss" ;
41
41
42
42
// https://github.com/alchemyplatform/alchemy-sdk-js/blob/c4440cb/src/util/const.ts#L16-L18
43
- function alchemyURL ( protocol : AlchemyProtocol , chainId : number ) : string {
43
+ function alchemyURL ( protocol : AlchemyProtocol , chainId : number | string ) : string {
44
44
const network = alchemyToViemChain [ chainId ] ;
45
45
if ( ! network ) {
46
46
throw new Error ( `Unsupported chain ID: ${ chainId } ` ) ;
47
47
}
48
48
return `${ protocol } ://${ network } .g.alchemy.com/v2/${ alchemyApiKey } ` ;
49
49
}
50
50
51
- export const getChainRpcUrl = ( protocol : AlchemyProtocol , chainId : number ) => {
51
+ export const getChainRpcUrl = ( protocol : AlchemyProtocol , chainId : number | string ) => {
52
52
return alchemyURL ( protocol , chainId ) ;
53
53
} ;
54
54
@@ -57,9 +57,9 @@ export const getDefaultChainRpcUrl = (protocol: AlchemyProtocol) => {
57
57
} ;
58
58
59
59
export const getTransports = ( ) => {
60
- const alchemyTransport = ( chain : Chain ) =>
60
+ const alchemyTransport = ( chain : AppKitNetwork ) =>
61
61
fallback ( [ http ( alchemyURL ( "https" , chain . id ) ) , webSocket ( alchemyURL ( "wss" , chain . id ) ) ] ) ;
62
- const defaultTransport = ( chain : Chain ) =>
62
+ const defaultTransport = ( chain : AppKitNetwork ) =>
63
63
fallback ( [ http ( chain . rpcUrls . default ?. http ?. [ 0 ] ) , webSocket ( chain . rpcUrls . default ?. webSocket ?. [ 0 ] ) ] ) ;
64
64
65
65
return {
0 commit comments