-
+
Does the collection contain explicit content?
@@ -240,11 +242,12 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte
ℹ️ When enabled, the metadata for tokens can be updated after the collection is created until the
- metadata is frozen by the creator.
+ collection is frozen by the creator.
}
diff --git a/components/collections/creation/MintingDetails.tsx b/components/collections/creation/MintingDetails.tsx
index 6afc367..8928051 100644
--- a/components/collections/creation/MintingDetails.tsx
+++ b/components/collections/creation/MintingDetails.tsx
@@ -1,10 +1,12 @@
import { FormControl } from 'components/FormControl'
import { FormGroup } from 'components/FormGroup'
-import { useNumberInputState } from 'components/forms/FormInput.hooks'
+import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks'
import { InputDateTime } from 'components/InputDateTime'
import React, { useEffect, useState } from 'react'
+import { resolveAddress } from 'utils/resolveAddress'
-import { NumberInput } from '../../forms/FormInput'
+import { useWallet } from '../../../contexts/wallet'
+import { NumberInput, TextInput } from '../../forms/FormInput'
import type { UploadMethod } from './UploadDetails'
interface MintingDetailsProps {
@@ -18,9 +20,12 @@ export interface MintingDetailsDataProps {
unitPrice: string
perAddressLimit: number
startTime: string
+ paymentAddress?: string
}
export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: MintingDetailsProps) => {
+ const wallet = useWallet()
+
const [timestamp, setTimestamp] = useState
()
const numberOfTokensState = useNumberInputState({
@@ -47,6 +52,24 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti
placeholder: '1',
})
+ const paymentAddressState = useInputState({
+ id: 'payment-address',
+ name: 'paymentAddress',
+ title: 'Payment Address (optional)',
+ subtitle: 'Address to receive minting revenues (defaults to current wallet address)',
+ placeholder: 'stars1234567890abcdefghijklmnopqrstuvwxyz...',
+ })
+
+ const resolvePaymentAddress = async () => {
+ await resolveAddress(paymentAddressState.value.trim(), wallet).then((resolvedAddress) => {
+ paymentAddressState.onChange(resolvedAddress)
+ })
+ }
+
+ useEffect(() => {
+ void resolvePaymentAddress()
+ }, [paymentAddressState.value])
+
useEffect(() => {
if (numberOfTokens) numberOfTokensState.onChange(numberOfTokens)
const data: MintingDetailsDataProps = {
@@ -54,10 +77,18 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti
unitPrice: unitPriceState.value ? (Number(unitPriceState.value) * 1_000_000).toString() : '',
perAddressLimit: perAddressLimitState.value,
startTime: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '',
+ paymentAddress: paymentAddressState.value,
}
onChange(data)
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [numberOfTokens, numberOfTokensState.value, unitPriceState.value, perAddressLimitState.value, timestamp])
+ }, [
+ numberOfTokens,
+ numberOfTokensState.value,
+ unitPriceState.value,
+ perAddressLimitState.value,
+ timestamp,
+ paymentAddressState.value,
+ ])
return (
@@ -74,6 +105,7 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti
setTimestamp(date)} value={timestamp} />
+
)
}
diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx
index a9a7993..7f6ca39 100644
--- a/pages/collections/create.tsx
+++ b/pages/collections/create.tsx
@@ -414,6 +414,7 @@ const CollectionCreationPage: NextPage = () => {
base_token_uri: `${uploadDetails?.uploadMethod === 'new' ? `ipfs://${baseUri}` : `${baseUri}`}`,
start_time: mintingDetails?.startTime,
num_tokens: mintingDetails?.numTokens,
+ payment_address: mintingDetails?.paymentAddress ? mintingDetails.paymentAddress : undefined,
mint_price: {
amount: mintingDetails?.unitPrice,
denom: 'ustars',
@@ -769,6 +770,8 @@ const CollectionCreationPage: NextPage = () => {
)
if (mintingDetails.startTime === '') throw new Error('Start time is required')
if (Number(mintingDetails.startTime) < new Date().getTime() * 1000000) throw new Error('Invalid start time')
+ if (mintingDetails.paymentAddress && !isValidAddress(mintingDetails.paymentAddress))
+ throw new Error('Invalid payment address')
}
const checkWhitelistDetails = async () => {
@@ -861,7 +864,11 @@ const CollectionCreationPage: NextPage = () => {
Math.ceil(Number(whitelistDetails.memberLimit) / 1000) * 100000000 +
(collectionDetails?.updatable ? 5000000000 : 3000000000)
if (amountNeeded >= Number(wallet.balance[0].amount))
- throw new Error('Insufficient wallet balance to instantiate the required contracts.')
+ throw new Error(
+ `Insufficient wallet balance to instantiate the required contracts. Needed amount: ${(
+ amountNeeded / 1000000
+ ).toString()} STARS`,
+ )
} else {
const amountNeeded =
minterType === 'vending'
@@ -872,7 +879,11 @@ const CollectionCreationPage: NextPage = () => {
? 3000000000
: 1000000000
if (amountNeeded >= Number(wallet.balance[0].amount))
- throw new Error('Insufficient wallet balance to instantiate the required contracts.')
+ throw new Error(
+ `Insufficient wallet balance to instantiate the required contracts. Needed amount: ${(
+ amountNeeded / 1000000
+ ).toString()} STARS`,
+ )
}
}
useEffect(() => {