Skip to content

Commit 2329a22

Browse files
committed
Dashboard: Poll for active claim condition before continuing with minting in coin launch (#7273)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces a polling mechanism to ensure that claim conditions are set before proceeding with token minting in the `CreateTokenAssetPage` component. ### Detailed summary - Added import for `pollWithTimeout` utility. - Implemented polling logic to check for active claim conditions before minting. - Set a timeout of 30 seconds for the polling process. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved the token creation process by ensuring minting only begins after claim conditions are confirmed, providing a more reliable experience for users. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b25d2af commit 2329a22

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/create-token-page-impl.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ import { deployERC20Contract } from "thirdweb/deploys";
2121
import type { ClaimConditionsInput } from "thirdweb/dist/types/utils/extensions/drops/types";
2222
import {
2323
claimTo,
24+
getActiveClaimCondition,
2425
setClaimConditions as setClaimConditionsExtension,
2526
transferBatch,
2627
} from "thirdweb/extensions/erc20";
2728
import { useActiveAccount } from "thirdweb/react";
29+
import { pollWithTimeout } from "../../../../../../../../utils/pollWithTimeout";
2830
import { useAddContractToProject } from "../../hooks/project-contracts";
2931
import { CreateTokenAssetPageUI } from "./create-token-page.client";
3032
import type { CreateAssetFormValues } from "./form";
@@ -241,6 +243,17 @@ export function CreateTokenAssetPage(props: {
241243
chain,
242244
});
243245

246+
// poll until claim conditions are set before moving on to minting
247+
await pollWithTimeout({
248+
shouldStop: async () => {
249+
const claimConditions = await getActiveClaimCondition({
250+
contract,
251+
});
252+
return !!claimConditions;
253+
},
254+
timeoutMs: 30000,
255+
});
256+
244257
const totalSupply = Number(formValues.supply);
245258
const salePercent = formValues.saleEnabled
246259
? Number(formValues.saleAllocationPercentage)

0 commit comments

Comments
 (0)