Open Edition collection creation summary

This commit is contained in:
Serkan Reis 2023-06-17 16:23:55 +03:00
parent 9292e6218a
commit b300a37384
2 changed files with 88 additions and 10 deletions

View File

@ -8,6 +8,7 @@ import { toUtf8 } from '@cosmjs/encoding'
import { coin } from '@cosmjs/proto-signing'
import clsx from 'clsx'
import { Button } from 'components/Button'
import type { MinterType } from 'components/collections/actions/Combobox'
import { Conditional } from 'components/Conditional'
import { ConfirmationModal } from 'components/ConfirmationModal'
import { LoadingModal } from 'components/LoadingModal'
@ -45,22 +46,20 @@ import { type RoyaltyDetailsDataProps, RoyaltyDetails } from './RoyaltyDetails'
export type MetadataStorageMethod = 'off-chain' | 'on-chain'
export interface OpenEditionMinterInfo {
name: string
minter: string
contractAddress: string
}
interface OpenEditionMinterCreatorProps {
onChange: (data: OpenEditionMinterCreatorDataProps) => void
openEditionMinterUpdatableCreationFee?: string
openEditionMinterCreationFee?: string
minimumMintPrice?: string
minimumUpdatableMintPrice?: string
minterType?: MinterType
}
export interface OpenEditionMinterCreatorDataProps {
metadataStorageMethod: MetadataStorageMethod
openEditionMinterContractAddress: string | null
sg721ContractAddress: string | null
transactionHash: string | null
}
export const OpenEditionMinterCreator = ({
@ -69,6 +68,7 @@ export const OpenEditionMinterCreator = ({
openEditionMinterUpdatableCreationFee,
minimumMintPrice,
minimumUpdatableMintPrice,
minterType,
}: OpenEditionMinterCreatorProps) => {
const wallet = useWallet()
const { openEditionMinter: openEditionMinterContract, openEditionFactory: openEditionFactoryContract } =
@ -544,6 +544,7 @@ export const OpenEditionMinterCreator = ({
}
await openEditionFactoryDispatchExecute(payload)
.then((data) => {
console.log('Data: ', data)
setTransactionHash(data.transactionHash)
setOpenEditionMinterContractAddress(data.openEditionMinterAddress)
setSg721ContractAddress(data.sg721Address)
@ -555,15 +556,26 @@ export const OpenEditionMinterCreator = ({
setCreationInProgress(false)
})
}
useEffect(() => {
if (minterType !== 'openEdition') {
setTransactionHash(null)
setOpenEditionMinterContractAddress(null)
setSg721ContractAddress(null)
setCreationInProgress(false)
setUploading(false)
}
}, [minterType])
useEffect(() => {
const data: OpenEditionMinterCreatorDataProps = {
metadataStorageMethod,
openEditionMinterContractAddress,
sg721ContractAddress,
transactionHash,
}
onChange(data)
toast.success('Metadata storage method updated')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [metadataStorageMethod])
}, [metadataStorageMethod, openEditionMinterContractAddress, sg721ContractAddress, transactionHash])
return (
<div>

View File

@ -1102,9 +1102,13 @@ const CollectionCreationPage: NextPage = () => {
}
}
useEffect(() => {
if (vendingMinterContractAddress !== null || isMintingComplete)
if (
vendingMinterContractAddress !== null ||
openEditionMinterDetails?.openEditionMinterContractAddress ||
isMintingComplete
)
scrollRef.current?.scrollIntoView({ behavior: 'smooth' })
}, [vendingMinterContractAddress, isMintingComplete])
}, [vendingMinterContractAddress, openEditionMinterDetails?.openEditionMinterContractAddress, isMintingComplete])
useEffect(() => {
setBaseTokenUri(uploadDetails?.baseTokenURI as string)
@ -1151,6 +1155,67 @@ const CollectionCreationPage: NextPage = () => {
</p>
</div>
<div className="mx-10" ref={scrollRef}>
<Conditional
test={minterType === 'openEdition' && openEditionMinterDetails?.openEditionMinterContractAddress !== null}
>
<Alert className="mt-5" type="info">
<div>
Open Edition Minter Contract Address:{' '}
<Anchor
className="text-stargaze hover:underline"
external
href={`/contracts/openEditionMinter/query/?contractAddress=${
openEditionMinterDetails?.openEditionMinterContractAddress as string
}`}
>
{openEditionMinterDetails?.openEditionMinterContractAddress as string}
</Anchor>
<br />
SG721 Contract Address:{' '}
<Anchor
className="text-stargaze hover:underline"
external
href={`/contracts/sg721/query/?contractAddress=${
openEditionMinterDetails?.sg721ContractAddress as string
}`}
>
{openEditionMinterDetails?.sg721ContractAddress as string}
</Anchor>
<br />
Transaction Hash: {' '}
<Conditional test={NETWORK === 'testnet'}>
<Anchor
className="text-stargaze hover:underline"
external
href={`${BLOCK_EXPLORER_URL}/tx/${openEditionMinterDetails?.transactionHash as string}`}
>
{openEditionMinterDetails?.transactionHash}
</Anchor>
</Conditional>
<Conditional test={NETWORK === 'mainnet'}>
<Anchor
className="text-stargaze hover:underline"
external
href={`${BLOCK_EXPLORER_URL}/txs/${openEditionMinterDetails?.transactionHash as string}`}
>
{openEditionMinterDetails?.transactionHash}
</Anchor>
</Conditional>
<br />
<Button className="mt-2">
<Anchor
className="text-white"
external
href={`${STARGAZE_URL}/launchpad/${
openEditionMinterDetails?.openEditionMinterContractAddress as string
}`}
>
View on Launchpad
</Anchor>
</Button>
</div>
</Alert>
</Conditional>
<Conditional test={vendingMinterContractAddress !== null || isMintingComplete}>
<Alert className="mt-5" type="info">
<div>
@ -1410,6 +1475,7 @@ const CollectionCreationPage: NextPage = () => {
<OpenEditionMinterCreator
minimumMintPrice={minimumOpenEditionMintPrice as string}
minimumUpdatableMintPrice={minimumOpenEditionUpdatableMintPrice as string}
minterType={minterType}
onChange={setOpenEditionMinterDetails}
openEditionMinterCreationFee={openEditionMinterCreationFee as string}
openEditionMinterUpdatableCreationFee={openEditionMinterUpdatableCreationFee as string}