diff --git a/components/collections/creation/MintingDetails.tsx b/components/collections/creation/MintingDetails.tsx index e7042ff..7f6d806 100644 --- a/components/collections/creation/MintingDetails.tsx +++ b/components/collections/creation/MintingDetails.tsx @@ -13,6 +13,7 @@ interface MintingDetailsProps { onChange: (data: MintingDetailsDataProps) => void numberOfTokens: number | undefined uploadMethod: UploadMethod + minimumMintPrice: number } export interface MintingDetailsDataProps { @@ -23,7 +24,7 @@ export interface MintingDetailsDataProps { paymentAddress?: string } -export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: MintingDetailsProps) => { +export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod, minimumMintPrice }: MintingDetailsProps) => { const wallet = useWallet() const [timestamp, setTimestamp] = useState() @@ -40,7 +41,7 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti id: 'unitPrice', name: 'unitPrice', title: 'Unit Price', - subtitle: 'Price of each token (min. 50 STARS)', + subtitle: `Price of each token (min. ${minimumMintPrice} STARS)`, placeholder: '50', }) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 17e4db7..fe8e4ea 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -94,6 +94,8 @@ const CollectionCreationPage: NextPage = () => { const [baseMinterCreationFee, setBaseMinterCreationFee] = useState(null) const [vendingMinterUpdatableCreationFee, setVendingMinterUpdatableCreationFee] = useState(null) const [baseMinterUpdatableCreationFee, setBaseMinterUpdatableCreationFee] = useState(null) + const [minimumMintPrice, setMinimumMintPrice] = useState('0') + const [minimumUpdatableMintPrice, setMinimumUpdatableMintPrice] = useState('0') const [uploading, setUploading] = useState(false) const [isMintingComplete, setIsMintingComplete] = useState(false) @@ -784,8 +786,13 @@ const CollectionCreationPage: NextPage = () => { const checkMintingDetails = () => { if (!mintingDetails) throw new Error('Please fill out the minting details') if (mintingDetails.numTokens < 1 || mintingDetails.numTokens > 10000) throw new Error('Invalid number of tokens') - if (Number(mintingDetails.unitPrice) < 50000000) - throw new Error('Invalid unit price: The minimum unit price is 50 STARS') + if (collectionDetails?.updatable) { + if (Number(mintingDetails.unitPrice) < Number(minimumUpdatableMintPrice)) + throw new Error( + `Invalid unit price: The minimum unit price is ${Number(minimumUpdatableMintPrice) / 1000000} STARS`, + ) + } else if (Number(mintingDetails.unitPrice) < Number(minimumMintPrice)) + throw new Error(`Invalid unit price: The minimum unit price is ${Number(minimumMintPrice) / 1000000} STARS`) if ( !mintingDetails.perAddressLimit || mintingDetails.perAddressLimit < 1 || @@ -929,12 +936,14 @@ const CollectionCreationPage: NextPage = () => { if (VENDING_FACTORY_ADDRESS) { const vendingFactoryParameters = await client.queryContractSmart(VENDING_FACTORY_ADDRESS, { params: {} }) setVendingMinterCreationFee(vendingFactoryParameters?.params?.creation_fee?.amount) + setMinimumMintPrice(vendingFactoryParameters?.params?.min_mint_price?.amount) } if (VENDING_FACTORY_UPDATABLE_ADDRESS) { const vendingFactoryUpdatableParameters = await client.queryContractSmart(VENDING_FACTORY_UPDATABLE_ADDRESS, { params: {}, }) setVendingMinterUpdatableCreationFee(vendingFactoryUpdatableParameters?.params?.creation_fee?.amount) + setMinimumUpdatableMintPrice(vendingFactoryUpdatableParameters?.params?.min_mint_price?.amount) } } @@ -1285,6 +1294,11 @@ const CollectionCreationPage: NextPage = () => {