Check whitelist contract validity prior to collection creation
This commit is contained in:
parent
ee6c39a767
commit
bb017412f7
@ -6,7 +6,7 @@ export interface ConfirmationModalProps {
|
||||
export const ConfirmationModal = (props: ConfirmationModalProps) => {
|
||||
return (
|
||||
<div>
|
||||
<input className="modal-toggle" id="my-modal-2" type="checkbox" />
|
||||
<input className="modal-toggle" defaultChecked id="my-modal-2" type="checkbox" />
|
||||
<label className="cursor-pointer modal" htmlFor="my-modal-2">
|
||||
<label
|
||||
className="absolute top-[40%] bottom-5 left-1/3 max-w-xl max-h-40 border-2 no-scrollbar modal-box"
|
||||
|
@ -70,7 +70,7 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti
|
||||
/>
|
||||
<NumberInput {...unitPriceState} isRequired />
|
||||
<NumberInput {...perAddressLimitState} isRequired />
|
||||
<FormControl htmlId="timestamp" isRequired subtitle="Start time for the minting" title="Start Time">
|
||||
<FormControl htmlId="timestamp" isRequired subtitle="Minting start time (local)" title="Start Time">
|
||||
<InputDateTime minDate={new Date()} onChange={(date) => setTimestamp(date)} value={timestamp} />
|
||||
</FormControl>
|
||||
</FormGroup>
|
||||
|
@ -71,10 +71,15 @@ const CollectionCreationPage: NextPage = () => {
|
||||
checkUploadDetails()
|
||||
checkCollectionDetails()
|
||||
checkMintingDetails()
|
||||
checkWhitelistDetails()
|
||||
checkRoyaltyDetails()
|
||||
setReadyToCreate(true)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
checkWhitelistDetails()
|
||||
.then(() => {
|
||||
setReadyToCreate(true)
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.error(`Invalid whitelist contract address: ${err.message}`)
|
||||
setReadyToCreate(false)
|
||||
})
|
||||
} catch (error: any) {
|
||||
toast.error(error.message)
|
||||
setUploading(false)
|
||||
@ -324,10 +329,15 @@ const CollectionCreationPage: NextPage = () => {
|
||||
if (Number(mintingDetails.startTime) < new Date().getTime() * 1000000) throw new Error('Invalid start time')
|
||||
}
|
||||
|
||||
const checkWhitelistDetails = () => {
|
||||
const checkWhitelistDetails = async () => {
|
||||
if (!whitelistDetails) throw new Error('Please fill out the whitelist details')
|
||||
if (whitelistDetails.whitelistType === 'existing') {
|
||||
if (whitelistDetails.contractAddress === '') throw new Error('Whitelist contract address is required')
|
||||
else {
|
||||
const contract = whitelistContract?.use(whitelistDetails.contractAddress)
|
||||
//check if the address belongs to a whitelist contract (see performChecks())
|
||||
const config = await contract?.config()
|
||||
}
|
||||
} else if (whitelistDetails.whitelistType === 'new') {
|
||||
if (whitelistDetails.members?.length === 0) throw new Error('Whitelist member list cannot be empty')
|
||||
if (whitelistDetails.unitPrice === '') throw new Error('Whitelist unit price is required')
|
||||
@ -492,7 +502,7 @@ const CollectionCreationPage: NextPage = () => {
|
||||
<Button className="px-0 mb-6 max-h-12" isLoading={creatingCollection} onClick={performChecks} variant="solid">
|
||||
<label
|
||||
className="relative justify-end w-full h-full text-white bg-plumbus hover:bg-plumbus-light border-0 btn modal-button"
|
||||
htmlFor="my-modal-2"
|
||||
htmlFor="temp"
|
||||
>
|
||||
Create Collection
|
||||
</label>
|
||||
|
Loading…
Reference in New Issue
Block a user