11import { connect , createConfig , type CreateConnectorFn , disconnect , getAccount , http , reconnect , watchAccount } from "@wagmi/core" ;
2- import { zksyncInMemoryNode , zksyncLocalNode , zksyncSepoliaTestnet } from "@wagmi/core/chains" ;
3- import { type Address , type Hash , parseEther } from "viem" ;
2+ import { zksyncInMemoryNode , zksyncSepoliaTestnet } from "@wagmi/core/chains" ;
3+ import { type Address , parseEther } from "viem" ;
44import { callPolicy , zksyncSsoConnector } from "zksync-sso/connector" ;
55
6- import { ZeekNftQuestAbi } from "@/abi/ZeekNFTQuest" ;
6+ import { Nft } from "~/abi" ;
7+
8+ export type SupportedChainId = ( typeof supportedChains ) [ number ] [ "id" ] ;
9+
10+ const supportedChains = [
11+ zksyncSepoliaTestnet ,
12+ zksyncInMemoryNode ,
13+ ] as const ;
714
815export const useConnectorStore = defineStore ( "connector" , ( ) => {
916 const runtimeConfig = useRuntimeConfig ( ) ;
10- const supportedChains = [
11- zksyncSepoliaTestnet ,
12- zksyncInMemoryNode ,
13- zksyncLocalNode ,
14- ] as const ;
15- const chain = supportedChains . filter ( ( x ) => x . id == runtimeConfig . public . chain . id ) [ 0 ] ;
17+
18+ const chainId = runtimeConfig . public . defaultChainId ;
19+ const chain = supportedChains . filter ( ( x ) => x . id == chainId ) [ 0 ] ;
1620 type SupportedChainId = ( typeof supportedChains ) [ number ] [ "id" ] ;
17- if ( ! chain ) throw new Error ( `Chain with id ${ runtimeConfig . public . chain . id } was not found in supported chains list` ) ;
21+ if ( ! chain ) throw new Error ( `Chain with id ${ chainId } was not found in supported chains list` ) ;
1822
1923 const connector = zksyncSsoConnector ( {
2024 metadata : {
@@ -25,8 +29,8 @@ export const useConnectorStore = defineStore("connector", () => {
2529 feeLimit : parseEther ( "0.001" ) ,
2630 contractCalls : [
2731 callPolicy ( {
28- address : runtimeConfig . public . contracts . nft as Hash ,
29- abi : ZeekNftQuestAbi ,
32+ address : Nft . addressByChain [ chainId ] ,
33+ abi : Nft . Abi ,
3034 functionName : "mint" ,
3135 } ) ,
3236 ] ,
0 commit comments