@@ -8,6 +8,10 @@ import { useV5DashboardChain } from "lib/v5-adapter";
88import { useMemo } from "react" ;
99import { type ThirdwebContract , ZERO_ADDRESS , getContract } from "thirdweb" ;
1010import { resolveContractAbi } from "thirdweb/contract" ;
11+ import {
12+ getPredictedMintFeeManagerAddress ,
13+ getPredictedMultisigAddress ,
14+ } from "thirdweb/deploys" ;
1115import { isAddress } from "thirdweb/utils" ;
1216import {
1317 type PublishedContractWithVersion ,
@@ -18,7 +22,6 @@ import { fetchDeployMetadata } from "./fetchDeployMetadata";
1822import { fetchPublishedContracts } from "./fetchPublishedContracts" ;
1923import { fetchPublishedContractsFromDeploy } from "./fetchPublishedContractsFromDeploy" ;
2024import type { ContractId } from "./types" ;
21- import { getPredictedMintFeeManagerAddress , getPredictedMultisigAddress } from "thirdweb/deploys" ;
2225
2326export function useFetchDeployMetadata ( contractId : ContractId ) {
2427 return useQuery ( {
@@ -152,63 +155,65 @@ export function usePublishedContractsQuery(address?: string) {
152155}
153156
154157function multisigQuery ( chainId : number | undefined ) {
155- if ( ! chainId ) {
156- chainId = 1 ;
158+ let chainIdFinal = chainId ;
159+ if ( ! chainIdFinal ) {
160+ chainIdFinal = 1 ;
157161 }
158-
162+
159163 return queryOptions ( {
160- queryKey : [ "multisig" , chainId ] ,
161- queryFn : async ( ) => {
162- const chain = useV5DashboardChain ( chainId ) ;
164+ queryKey : [ "multisig" , chainIdFinal ] ,
165+ queryFn : async ( ) => {
166+ const chain = useV5DashboardChain ( chainIdFinal ) ;
163167 const client = useThirdwebClient ( ) ;
164168
165- const multisig = await getPredictedMultisigAddress ( { client, chain} ) ;
169+ const multisig = await getPredictedMultisigAddress ( { client, chain } ) ;
166170
167171 return {
168- multisig
169- }
170-
172+ multisig,
173+ } ;
171174 } ,
172- enabled :
173- ! ! chainId ,
175+ enabled : ! ! chainId ,
174176 // 24h
175177 gcTime : 60 * 60 * 24 * 1000 ,
176178 // 1h
177179 staleTime : 60 * 60 * 1000 ,
178180 // default to zero address
179181 placeholderData : { multisig : ZERO_ADDRESS } ,
180182 retry : false ,
181- } )
183+ } ) ;
182184}
183185
184186function mintfeeManagerQuery ( chainId : number | undefined ) {
185- if ( ! chainId ) {
186- chainId = 1 ;
187+ let chainIdFinal = chainId ;
188+
189+ if ( ! chainIdFinal ) {
190+ chainIdFinal = 1 ;
187191 }
188192
189193 return queryOptions ( {
190- queryKey : [ "mintfee-manager" , chainId ] ,
191- queryFn : async ( ) => {
192- const chain = useV5DashboardChain ( chainId ) ;
194+ queryKey : [ "mintfee-manager" , chainIdFinal ] ,
195+ queryFn : async ( ) => {
196+ const chain = useV5DashboardChain ( chainIdFinal ) ;
193197 const client = useThirdwebClient ( ) ;
194198
195- const mintfeeManager = await getPredictedMintFeeManagerAddress ( { client, chain} ) ;
199+ const mintfeeManager = await getPredictedMintFeeManagerAddress ( {
200+ client,
201+ chain,
202+ } ) ;
196203
197204 return {
198- mintfeeManager
199- }
200-
205+ mintfeeManager,
206+ } ;
201207 } ,
202- enabled :
203- ! ! chainId ,
208+ enabled : ! ! chainId ,
204209 // 24h
205210 gcTime : 60 * 60 * 24 * 1000 ,
206211 // 1h
207212 staleTime : 60 * 60 * 1000 ,
208213 // default to zero address
209214 placeholderData : { mintfeeManager : ZERO_ADDRESS } ,
210215 retry : false ,
211- } )
216+ } ) ;
212217}
213218
214219function ensQuery ( addressOrEnsName ?: string ) {
0 commit comments