Free mint related changes
This commit is contained in:
parent
a7afc2ca62
commit
eeafda455a
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable eslint-comments/disable-enable-pair */
|
||||||
|
/* eslint-disable no-nested-ternary */
|
||||||
import { FormControl } from 'components/FormControl'
|
import { FormControl } from 'components/FormControl'
|
||||||
import { FormGroup } from 'components/FormGroup'
|
import { FormGroup } from 'components/FormGroup'
|
||||||
import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks'
|
import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks'
|
||||||
@ -75,7 +77,11 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod, minimum
|
|||||||
if (numberOfTokens) numberOfTokensState.onChange(numberOfTokens)
|
if (numberOfTokens) numberOfTokensState.onChange(numberOfTokens)
|
||||||
const data: MintingDetailsDataProps = {
|
const data: MintingDetailsDataProps = {
|
||||||
numTokens: numberOfTokensState.value,
|
numTokens: numberOfTokensState.value,
|
||||||
unitPrice: unitPriceState.value ? (Number(unitPriceState.value) * 1_000_000).toString() : '',
|
unitPrice: unitPriceState.value
|
||||||
|
? (Number(unitPriceState.value) * 1_000_000).toString()
|
||||||
|
: unitPriceState.value === 0
|
||||||
|
? '0'
|
||||||
|
: '',
|
||||||
perAddressLimit: perAddressLimitState.value,
|
perAddressLimit: perAddressLimitState.value,
|
||||||
startTime: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '',
|
startTime: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '',
|
||||||
paymentAddress: paymentAddressState.value.trim(),
|
paymentAddress: paymentAddressState.value.trim(),
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable eslint-comments/disable-enable-pair */
|
||||||
|
/* eslint-disable no-nested-ternary */
|
||||||
import { FormControl } from 'components/FormControl'
|
import { FormControl } from 'components/FormControl'
|
||||||
import { FormGroup } from 'components/FormGroup'
|
import { FormGroup } from 'components/FormGroup'
|
||||||
import { AddressList } from 'components/forms/AddressList'
|
import { AddressList } from 'components/forms/AddressList'
|
||||||
@ -102,7 +104,11 @@ export const WhitelistDetails = ({ onChange }: WhitelistDetailsProps) => {
|
|||||||
.replace(/'/g, '')
|
.replace(/'/g, '')
|
||||||
.replace(/ /g, ''),
|
.replace(/ /g, ''),
|
||||||
members: whitelistType === 'standard' ? whitelistStandardArray : whitelistFlexArray,
|
members: whitelistType === 'standard' ? whitelistStandardArray : whitelistFlexArray,
|
||||||
unitPrice: unitPriceState.value ? (Number(unitPriceState.value) * 1_000_000).toString() : '',
|
unitPrice: unitPriceState.value
|
||||||
|
? (Number(unitPriceState.value) * 1_000_000).toString()
|
||||||
|
: unitPriceState.value === 0
|
||||||
|
? '0'
|
||||||
|
: undefined,
|
||||||
startTime: startDate ? (startDate.getTime() * 1_000_000).toString() : '',
|
startTime: startDate ? (startDate.getTime() * 1_000_000).toString() : '',
|
||||||
endTime: endDate ? (endDate.getTime() * 1_000_000).toString() : '',
|
endTime: endDate ? (endDate.getTime() * 1_000_000).toString() : '',
|
||||||
perAddressLimit: perAddressLimitState.value,
|
perAddressLimit: perAddressLimitState.value,
|
||||||
|
@ -483,18 +483,6 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Whitelist State: ', whitelistDetails?.whitelistState)
|
|
||||||
console.log('Whitelist Type: ', whitelistDetails?.whitelistType)
|
|
||||||
console.log(
|
|
||||||
'Factory Address: ',
|
|
||||||
whitelistDetails?.whitelistState !== 'none' && whitelistDetails?.whitelistType === 'flex'
|
|
||||||
? VENDING_FACTORY_FLEX_ADDRESS
|
|
||||||
: collectionDetails?.updatable
|
|
||||||
? VENDING_FACTORY_UPDATABLE_ADDRESS
|
|
||||||
: VENDING_FACTORY_ADDRESS,
|
|
||||||
)
|
|
||||||
|
|
||||||
console.log('Whitelist: ', whitelist)
|
|
||||||
const payload: VendingFactoryDispatchExecuteArgs = {
|
const payload: VendingFactoryDispatchExecuteArgs = {
|
||||||
contract:
|
contract:
|
||||||
whitelistDetails?.whitelistState !== 'none' && whitelistDetails?.whitelistType === 'flex'
|
whitelistDetails?.whitelistState !== 'none' && whitelistDetails?.whitelistType === 'flex'
|
||||||
@ -820,6 +808,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
const checkMintingDetails = () => {
|
const checkMintingDetails = () => {
|
||||||
if (!mintingDetails) throw new Error('Please fill out the minting details')
|
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 (mintingDetails.numTokens < 1 || mintingDetails.numTokens > 10000) throw new Error('Invalid number of tokens')
|
||||||
|
if (mintingDetails.unitPrice === '') throw new Error('Public mint price is required')
|
||||||
if (whitelistDetails?.whitelistState !== 'none' && whitelistDetails?.whitelistType === 'flex') {
|
if (whitelistDetails?.whitelistState !== 'none' && whitelistDetails?.whitelistType === 'flex') {
|
||||||
if (Number(mintingDetails.unitPrice) < Number(minimumFlexMintPrice))
|
if (Number(mintingDetails.unitPrice) < Number(minimumFlexMintPrice))
|
||||||
throw new Error(`Invalid unit price: The minimum unit price is ${Number(minimumFlexMintPrice) / 1000000} STARS`)
|
throw new Error(`Invalid unit price: The minimum unit price is ${Number(minimumFlexMintPrice) / 1000000} STARS`)
|
||||||
@ -893,7 +882,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
}
|
}
|
||||||
} else if (whitelistDetails.whitelistState === 'new') {
|
} else if (whitelistDetails.whitelistState === 'new') {
|
||||||
if (whitelistDetails.members?.length === 0) throw new Error('Whitelist member list cannot be empty')
|
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')
|
if (whitelistDetails.unitPrice === undefined) throw new Error('Whitelist unit price is required')
|
||||||
if (Number(whitelistDetails.unitPrice) < 0)
|
if (Number(whitelistDetails.unitPrice) < 0)
|
||||||
throw new Error('Invalid unit price: The unit price cannot be negative')
|
throw new Error('Invalid unit price: The unit price cannot be negative')
|
||||||
if (whitelistDetails.startTime === '') throw new Error('Start time is required')
|
if (whitelistDetails.startTime === '') throw new Error('Start time is required')
|
||||||
|
Loading…
Reference in New Issue
Block a user