Merge pull request #87 from public-awesome/develop

Sync development > main
This commit is contained in:
Serkan Reis 2023-01-09 10:18:18 +03:00 committed by GitHub
commit 813d0e27f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 12 deletions

View File

@ -1,4 +1,4 @@
APP_VERSION=0.3.5 APP_VERSION=0.3.7
NEXT_PUBLIC_PINATA_ENDPOINT_URL=https://api.pinata.cloud/pinning/pinFileToIPFS NEXT_PUBLIC_PINATA_ENDPOINT_URL=https://api.pinata.cloud/pinning/pinFileToIPFS
NEXT_PUBLIC_SG721_CODE_ID=274 NEXT_PUBLIC_SG721_CODE_ID=274

View File

@ -318,11 +318,11 @@ export const UploadDetails = ({ onChange, minterType, baseMinterAcquisitionMetho
and upload your assets & metadata manually to get a base URI for your collection. and upload your assets & metadata manually to get a base URI for your collection.
</p> </p>
<div> <div>
<TextInput {...baseTokenUriState} className="w-1/2" /> <TextInput {...baseTokenUriState} className="ml-4 w-1/2" />
</div> </div>
<Conditional test={minterType !== 'base'}> <Conditional test={minterType !== 'base'}>
<div> <div>
<TextInput {...coverImageUrlState} className="mt-2 w-1/2" /> <TextInput {...coverImageUrlState} className="mt-2 ml-4 w-1/2" />
</div> </div>
</Conditional> </Conditional>
</div> </div>
@ -342,13 +342,13 @@ export const UploadDetails = ({ onChange, minterType, baseMinterAcquisitionMetho
and upload your asset & metadata manually to get a URI for your token before minting. and upload your asset & metadata manually to get a URI for your token before minting.
</p> </p>
<div> <div>
<TextInput {...baseTokenUriState} className="w-1/2" /> <TextInput {...baseTokenUriState} className="ml-4 w-1/2" />
</div> </div>
<Conditional <Conditional
test={minterType !== 'base' || (minterType === 'base' && baseMinterAcquisitionMethod === 'new')} test={minterType !== 'base' || (minterType === 'base' && baseMinterAcquisitionMethod === 'new')}
> >
<div> <div>
<TextInput {...coverImageUrlState} className="mt-2 w-1/2" /> <TextInput {...coverImageUrlState} className="mt-2 ml-4 w-1/2" />
</div> </div>
</Conditional> </Conditional>
</div> </div>

View File

@ -1,6 +1,6 @@
{ {
"name": "stargaze-studio", "name": "stargaze-studio",
"version": "0.3.6", "version": "0.3.7",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],

View File

@ -311,7 +311,10 @@ const CollectionCreationPage: NextPage = () => {
return result return result
}) })
.then((result) => { .then((result) => {
toast.success(`Minted successfully! Tx Hash: ${result}`, { style: { maxWidth: 'none' }, duration: 5000 }) toast.success(`Token minted & appended to the collection successfully! Tx Hash: ${result}`, {
style: { maxWidth: 'none' },
duration: 5000,
})
setIsMintingComplete(true) setIsMintingComplete(true)
}) })
.catch((error) => { .catch((error) => {
@ -327,7 +330,10 @@ const CollectionCreationPage: NextPage = () => {
.use(baseMinterDetails?.existingBaseMinter as string) .use(baseMinterDetails?.existingBaseMinter as string)
?.mint(wallet.address, `${uploadDetails?.baseTokenURI?.trim()}`) ?.mint(wallet.address, `${uploadDetails?.baseTokenURI?.trim()}`)
.then((result) => { .then((result) => {
toast.success(`Minted successfully! Tx Hash: ${result}`, { style: { maxWidth: 'none' }, duration: 5000 }) toast.success(`Token minted & appended to the collection successfully! Tx Hash: ${result}`, {
style: { maxWidth: 'none' },
duration: 5000,
})
}) })
.catch((error) => { .catch((error) => {
toast.error(error.message, { style: { maxWidth: 'none' } }) toast.error(error.message, { style: { maxWidth: 'none' } })
@ -661,6 +667,8 @@ const CollectionCreationPage: NextPage = () => {
if (!collectionDetails) throw new Error('Please fill out the collection details') if (!collectionDetails) throw new Error('Please fill out the collection details')
if (collectionDetails.name === '') throw new Error('Collection name is required') if (collectionDetails.name === '') throw new Error('Collection name is required')
if (collectionDetails.description === '') throw new Error('Collection description is required') if (collectionDetails.description === '') throw new Error('Collection description is required')
if (collectionDetails.description.length > 512)
throw new Error('Collection description cannot exceed 512 characters')
if (uploadDetails?.uploadMethod === 'new' && collectionDetails.imageFile.length === 0) if (uploadDetails?.uploadMethod === 'new' && collectionDetails.imageFile.length === 0)
throw new Error('Collection cover image is required') throw new Error('Collection cover image is required')
if ( if (
@ -673,6 +681,13 @@ const CollectionCreationPage: NextPage = () => {
Number(collectionDetails.startTradingTime) < Number(mintingDetails?.startTime) Number(collectionDetails.startTradingTime) < Number(mintingDetails?.startTime)
) )
throw new Error('Trading start time must be after minting start time') throw new Error('Trading start time must be after minting start time')
if (collectionDetails.externalLink) {
try {
const url = new URL(collectionDetails.externalLink)
} catch (e: any) {
throw new Error(`Invalid external link: Make sure to include the protocol (e.g. https://)`)
}
}
} }
const checkMintingDetails = () => { const checkMintingDetails = () => {
@ -787,7 +802,7 @@ const CollectionCreationPage: NextPage = () => {
<NextSeo <NextSeo
title={ title={
minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing' minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing'
? 'Mint Token' ? 'Append Token'
: 'Create Collection' : 'Create Collection'
} }
/> />
@ -795,7 +810,7 @@ const CollectionCreationPage: NextPage = () => {
<div className="mt-5 space-y-5 text-center"> <div className="mt-5 space-y-5 text-center">
<h1 className="font-heading text-4xl font-bold"> <h1 className="font-heading text-4xl font-bold">
{minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing' {minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing'
? 'Mint Token' ? 'Append Token'
: 'Create Collection'} : 'Create Collection'}
</h1> </h1>
@ -1069,7 +1084,7 @@ const CollectionCreationPage: NextPage = () => {
onClick={performUploadAndMintChecks} onClick={performUploadAndMintChecks}
variant="solid" variant="solid"
> >
Upload & Mint Token Mint & Append Token
</Button> </Button>
</Conditional> </Conditional>
</div> </div>

View File

@ -1,3 +1,4 @@
import { Alert } from 'components/Alert'
import { Button } from 'components/Button' import { Button } from 'components/Button'
import { Conditional } from 'components/Conditional' import { Conditional } from 'components/Conditional'
import { ContractPageHeader } from 'components/ContractPageHeader' import { ContractPageHeader } from 'components/ContractPageHeader'
@ -13,6 +14,7 @@ import { JsonPreview } from 'components/JsonPreview'
import { LinkTabs } from 'components/LinkTabs' import { LinkTabs } from 'components/LinkTabs'
import { whitelistLinkTabs } from 'components/LinkTabs.data' import { whitelistLinkTabs } from 'components/LinkTabs.data'
import { TransactionHash } from 'components/TransactionHash' import { TransactionHash } from 'components/TransactionHash'
import { WhitelistUpload } from 'components/WhitelistUpload'
import { useContracts } from 'contexts/contracts' import { useContracts } from 'contexts/contracts'
import { useWallet } from 'contexts/wallet' import { useWallet } from 'contexts/wallet'
import type { DispatchExecuteArgs } from 'contracts/whitelist/messages/execute' import type { DispatchExecuteArgs } from 'contracts/whitelist/messages/execute'
@ -25,6 +27,7 @@ import { useEffect, useMemo, useState } from 'react'
import { toast } from 'react-hot-toast' import { toast } from 'react-hot-toast'
import { FaArrowRight } from 'react-icons/fa' import { FaArrowRight } from 'react-icons/fa'
import { useMutation } from 'react-query' import { useMutation } from 'react-query'
import { isValidAddress } from 'utils/isValidAddress'
import { withMetadata } from 'utils/layout' import { withMetadata } from 'utils/layout'
import { links } from 'utils/links' import { links } from 'utils/links'
@ -33,6 +36,7 @@ const WhitelistExecutePage: NextPage = () => {
const wallet = useWallet() const wallet = useWallet()
const [lastTx, setLastTx] = useState('') const [lastTx, setLastTx] = useState('')
const [memberList, setMemberList] = useState<string[]>([])
const comboboxState = useExecuteComboboxState() const comboboxState = useExecuteComboboxState()
const type = comboboxState.value?.id const type = comboboxState.value?.id
@ -68,7 +72,14 @@ const WhitelistExecutePage: NextPage = () => {
type, type,
limit: limitState.value, limit: limitState.value,
timestamp: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '', timestamp: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '',
members: addressListState.values.map((a) => a.address), members: [
...new Set(
addressListState.values
.map((a) => a.address.trim())
.filter((address) => address !== '' && isValidAddress(address.trim()) && address.startsWith('stars'))
.concat(memberList),
),
],
} }
const { isLoading, mutate } = useMutation( const { isLoading, mutate } = useMutation(
async (event: FormEvent) => { async (event: FormEvent) => {
@ -145,6 +156,10 @@ const WhitelistExecutePage: NextPage = () => {
subtitle="Enter the member addresses" subtitle="Enter the member addresses"
title="Addresses" title="Addresses"
/> />
<Alert className="mt-8" type="info">
You may optionally choose a text file of additional member addresses.
</Alert>
<WhitelistUpload onChange={setMemberList} />
</Conditional> </Conditional>
</div> </div>
<div className="space-y-8"> <div className="space-y-8">