Skip to content

Commit bceccc5

Browse files
committed
lint
1 parent fe08563 commit bceccc5

File tree

3 files changed

+46
-30
lines changed

3 files changed

+46
-30
lines changed

apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ import {
3737
import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
3838
import { upload } from "thirdweb/storage";
3939
import { FormHelperText, FormLabel, Heading, Text } from "tw-components";
40-
import { useCustomFactoryAbi, useFunctionParamsFromABI, useMintfeeManager, useMultisig } from "../hooks";
40+
import {
41+
useCustomFactoryAbi,
42+
useFunctionParamsFromABI,
43+
useMintfeeManager,
44+
useMultisig,
45+
} from "../hooks";
4146
import { addContractToMultiChainRegistry } from "../utils";
4247
import { Fieldset } from "./common";
4348
import { ContractMetadataFieldset } from "./contract-metadata-fieldset";
@@ -197,7 +202,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
197202
connectedWallet: activeAccount?.address,
198203
chainId: walletChain?.id,
199204
multisig: multisig.data?.multisig,
200-
mintFeeManager: mintfeeManager.data?.mintfeeManager
205+
mintFeeManager: mintfeeManager.data?.mintfeeManager,
201206
},
202207
);
203208

@@ -217,7 +222,14 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
217222
{} as Record<string, string>,
218223
),
219224
}),
220-
[deployParams, metadata?.constructorParams, activeAccount, walletChain?.id],
225+
[
226+
deployParams,
227+
metadata?.constructorParams,
228+
activeAccount,
229+
walletChain?.id,
230+
mintfeeManager,
231+
multisig,
232+
],
221233
);
222234

223235
const transformedQueryData = useMemo(

apps/dashboard/src/components/contract-components/hooks.ts

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import { useV5DashboardChain } from "lib/v5-adapter";
88
import { useMemo } from "react";
99
import { type ThirdwebContract, ZERO_ADDRESS, getContract } from "thirdweb";
1010
import { resolveContractAbi } from "thirdweb/contract";
11+
import {
12+
getPredictedMintFeeManagerAddress,
13+
getPredictedMultisigAddress,
14+
} from "thirdweb/deploys";
1115
import { isAddress } from "thirdweb/utils";
1216
import {
1317
type PublishedContractWithVersion,
@@ -18,7 +22,6 @@ import { fetchDeployMetadata } from "./fetchDeployMetadata";
1822
import { fetchPublishedContracts } from "./fetchPublishedContracts";
1923
import { fetchPublishedContractsFromDeploy } from "./fetchPublishedContractsFromDeploy";
2024
import type { ContractId } from "./types";
21-
import { getPredictedMintFeeManagerAddress, getPredictedMultisigAddress } from "thirdweb/deploys";
2225

2326
export function useFetchDeployMetadata(contractId: ContractId) {
2427
return useQuery({
@@ -152,63 +155,65 @@ export function usePublishedContractsQuery(address?: string) {
152155
}
153156

154157
function 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

184186
function 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

214219
function ensQuery(addressOrEnsName?: string) {

packages/thirdweb/src/exports/deploys.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export {
5555
deployPackContract,
5656
} from "../extensions/prebuilts/deploy-pack.js";
5757
export {
58-
getDeployedMintFeeManagerContract,
5958
getPredictedMintFeeManagerAddress,
6059
getPredictedMultisigAddress
6160
} from "../contract/deployment/utils/mintfee-manager.js";

0 commit comments

Comments
 (0)