Add token URI validation for open edition collection creation
This commit is contained in:
parent
aba25199ea
commit
2b5c5f3c32
@ -28,6 +28,7 @@ import {
|
|||||||
} from 'utils/constants'
|
} from 'utils/constants'
|
||||||
import { getAssetType } from 'utils/getAssetType'
|
import { getAssetType } from 'utils/getAssetType'
|
||||||
import { isValidAddress } from 'utils/isValidAddress'
|
import { isValidAddress } from 'utils/isValidAddress'
|
||||||
|
import { checkTokenUri } from 'utils/isValidTokenUri'
|
||||||
import { uid } from 'utils/random'
|
import { uid } from 'utils/random'
|
||||||
|
|
||||||
import { type CollectionDetailsDataProps, CollectionDetails } from './CollectionDetails'
|
import { type CollectionDetailsDataProps, CollectionDetails } from './CollectionDetails'
|
||||||
@ -101,23 +102,30 @@ export const OpenEditionMinterCreator = ({
|
|||||||
const performOpenEditionMinterChecks = () => {
|
const performOpenEditionMinterChecks = () => {
|
||||||
try {
|
try {
|
||||||
setReadyToCreate(false)
|
setReadyToCreate(false)
|
||||||
checkUploadDetails()
|
|
||||||
checkCollectionDetails()
|
checkCollectionDetails()
|
||||||
checkMintingDetails()
|
checkMintingDetails()
|
||||||
void checkRoyaltyDetails()
|
void checkUploadDetails()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
void checkwalletBalance()
|
void checkRoyaltyDetails()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setReadyToCreate(true)
|
void checkwalletBalance()
|
||||||
|
.then(() => {
|
||||||
|
setReadyToCreate(true)
|
||||||
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
toast.error(`Error in Wallet Balance: ${error.message}`, { style: { maxWidth: 'none' } })
|
||||||
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
|
setReadyToCreate(false)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
toast.error(`Error in Wallet Balance: ${error.message}`, { style: { maxWidth: 'none' } })
|
toast.error(`Error in Royalty Details: ${error.message}`, { style: { maxWidth: 'none' } })
|
||||||
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
setReadyToCreate(false)
|
setReadyToCreate(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
toast.error(`Error in Royalty Details: ${error.message}`, { style: { maxWidth: 'none' } })
|
toast.error(`Error in Upload Details: ${error.message}`, { style: { maxWidth: 'none' } })
|
||||||
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
setReadyToCreate(false)
|
setReadyToCreate(false)
|
||||||
})
|
})
|
||||||
@ -129,7 +137,7 @@ export const OpenEditionMinterCreator = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkUploadDetails = () => {
|
const checkUploadDetails = async () => {
|
||||||
if (!wallet.initialized) throw new Error('Wallet not connected.')
|
if (!wallet.initialized) throw new Error('Wallet not connected.')
|
||||||
if (
|
if (
|
||||||
(metadataStorageMethod === 'off-chain' && !offChainMetadataUploadDetails) ||
|
(metadataStorageMethod === 'off-chain' && !offChainMetadataUploadDetails) ||
|
||||||
@ -200,6 +208,9 @@ export const OpenEditionMinterCreator = ({
|
|||||||
throw new Error('Please enter a valid cover image URL')
|
throw new Error('Please enter a valid cover image URL')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (offChainMetadataUploadDetails?.uploadMethod === 'existing') {
|
||||||
|
await checkTokenUri(offChainMetadataUploadDetails.tokenURI as string)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkCollectionDetails = () => {
|
const checkCollectionDetails = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user