Update Base Minter creation process
This commit is contained in:
parent
eab5a4a36c
commit
2ee9f1e73d
@ -50,7 +50,7 @@ export const CollectionQueries = ({
|
|||||||
const address = addressState.value
|
const address = addressState.value
|
||||||
|
|
||||||
const showTokenIdField = type === 'token_info'
|
const showTokenIdField = type === 'token_info'
|
||||||
const showAddressField = type === 'tokens_minted_to_user'
|
const showAddressField = type === 'tokens_minted_to_user' || type === 'tokens'
|
||||||
|
|
||||||
const { data: response } = useQuery(
|
const { data: response } = useQuery(
|
||||||
[sg721Messages, baseMinterMessages, vendingMinterMessages, type, tokenId, address] as const,
|
[sg721Messages, baseMinterMessages, vendingMinterMessages, type, tokenId, address] as const,
|
||||||
|
@ -9,6 +9,7 @@ export const QUERY_TYPES = [
|
|||||||
'mint_price',
|
'mint_price',
|
||||||
'num_tokens',
|
'num_tokens',
|
||||||
'tokens_minted_to_user',
|
'tokens_minted_to_user',
|
||||||
|
'tokens',
|
||||||
// 'token_owners',
|
// 'token_owners',
|
||||||
'token_info',
|
'token_info',
|
||||||
'config',
|
'config',
|
||||||
@ -70,7 +71,7 @@ export const BASE_QUERY_LIST: QueryListItem[] = [
|
|||||||
description: `Get information about the collection.`,
|
description: `Get information about the collection.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'tokens_minted_to_user',
|
id: 'tokens',
|
||||||
name: 'Tokens Minted to User',
|
name: 'Tokens Minted to User',
|
||||||
description: `Get the number of tokens minted in the collection to a user.`,
|
description: `Get the number of tokens minted in the collection to a user.`,
|
||||||
},
|
},
|
||||||
@ -108,6 +109,7 @@ export type DispatchQueryArgs = {
|
|||||||
| { type: Select<'mint_price'> }
|
| { type: Select<'mint_price'> }
|
||||||
| { type: Select<'num_tokens'> }
|
| { type: Select<'num_tokens'> }
|
||||||
| { type: Select<'tokens_minted_to_user'>; address: string }
|
| { type: Select<'tokens_minted_to_user'>; address: string }
|
||||||
|
| { type: Select<'tokens'>; address: string }
|
||||||
// | { type: Select<'token_owners'> }
|
// | { type: Select<'token_owners'> }
|
||||||
| { type: Select<'token_info'>; tokenId: string }
|
| { type: Select<'token_info'>; tokenId: string }
|
||||||
| { type: Select<'config'> }
|
| { type: Select<'config'> }
|
||||||
@ -132,6 +134,9 @@ export const dispatchQuery = async (args: DispatchQueryArgs) => {
|
|||||||
case 'tokens_minted_to_user': {
|
case 'tokens_minted_to_user': {
|
||||||
return vendingMinterMessages.getMintCount(args.address)
|
return vendingMinterMessages.getMintCount(args.address)
|
||||||
}
|
}
|
||||||
|
case 'tokens': {
|
||||||
|
return sg721Messages.tokens(args.address)
|
||||||
|
}
|
||||||
// case 'token_owners': {
|
// case 'token_owners': {
|
||||||
// return vendingMinterMessages.updateStartTime(txSigner, args.startTime)
|
// return vendingMinterMessages.updateStartTime(txSigner, args.startTime)
|
||||||
// }
|
// }
|
||||||
|
@ -241,7 +241,10 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
setBaseTokenUri(baseUri)
|
setBaseTokenUri(baseUri)
|
||||||
setCoverImageUrl(coverImageUri)
|
setCoverImageUrl(coverImageUri)
|
||||||
|
|
||||||
await instantiateBaseMinter(baseUri, coverImageUri)
|
await instantiateBaseMinter(
|
||||||
|
`ipfs://${baseUri}/${uploadDetails.metadataFiles[0].name.split('.')[0]}`,
|
||||||
|
coverImageUri,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
setBaseTokenUri(uploadDetails?.baseTokenURI as string)
|
setBaseTokenUri(uploadDetails?.baseTokenURI as string)
|
||||||
setCoverImageUrl(uploadDetails?.imageUrl as string)
|
setCoverImageUrl(uploadDetails?.imageUrl as string)
|
||||||
@ -398,6 +401,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
const instantiateBaseMinter = async (baseUri: string, coverImageUri: string) => {
|
const instantiateBaseMinter = async (baseUri: string, coverImageUri: string) => {
|
||||||
if (!wallet.initialized) throw new Error('Wallet not connected')
|
if (!wallet.initialized) throw new Error('Wallet not connected')
|
||||||
if (!baseFactoryContract) throw new Error('Contract not found')
|
if (!baseFactoryContract) throw new Error('Contract not found')
|
||||||
|
if (!baseMinterContract) throw new Error('Contract not found')
|
||||||
|
|
||||||
let royaltyInfo = null
|
let royaltyInfo = null
|
||||||
if (royaltyDetails?.royaltyType === 'new') {
|
if (royaltyDetails?.royaltyType === 'new') {
|
||||||
@ -438,10 +442,37 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
msg,
|
msg,
|
||||||
funds: [coin('1000000000', 'ustars')],
|
funds: [coin('1000000000', 'ustars')],
|
||||||
}
|
}
|
||||||
const data = await baseFactoryDispatchExecute(payload)
|
await baseFactoryDispatchExecute(payload)
|
||||||
setTransactionHash(data.transactionHash)
|
.then(async (data) => {
|
||||||
setVendingMinterContractAddress(data.baseMinterAddress)
|
setTransactionHash(data.transactionHash)
|
||||||
setSg721ContractAddress(data.sg721Address)
|
setVendingMinterContractAddress(data.baseMinterAddress)
|
||||||
|
setSg721ContractAddress(data.sg721Address)
|
||||||
|
await toast
|
||||||
|
.promise(
|
||||||
|
baseMinterContract
|
||||||
|
.use(data.baseMinterAddress)
|
||||||
|
|
||||||
|
?.mint(wallet.address, baseUri) as Promise<string>,
|
||||||
|
{
|
||||||
|
loading: 'Minting token...',
|
||||||
|
success: (result) => `Token minted successfully! Tx Hash: ${result}`,
|
||||||
|
error: (error) => `Failed to mint token: ${error.message}`,
|
||||||
|
},
|
||||||
|
{ style: { maxWidth: 'none' } },
|
||||||
|
)
|
||||||
|
.catch((error) => {
|
||||||
|
toast.error(error.message, { style: { maxWidth: 'none' } })
|
||||||
|
setUploading(false)
|
||||||
|
setCreatingCollection(false)
|
||||||
|
})
|
||||||
|
setUploading(false)
|
||||||
|
setCreatingCollection(false)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
toast.error(error.message, { style: { maxWidth: 'none' } })
|
||||||
|
setUploading(false)
|
||||||
|
setCreatingCollection(false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadFiles = async (): Promise<string> => {
|
const uploadFiles = async (): Promise<string> => {
|
||||||
@ -690,7 +721,11 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
<Anchor
|
<Anchor
|
||||||
className="text-stargaze hover:underline"
|
className="text-stargaze hover:underline"
|
||||||
external
|
external
|
||||||
href={`/contracts/vendingMinter/query/?contractAddress=${vendingMinterContractAddress as string}`}
|
href={
|
||||||
|
minterType === 'vending'
|
||||||
|
? `/contracts/vendingMinter/query/?contractAddress=${vendingMinterContractAddress as string}`
|
||||||
|
: `/contracts/baseMinter/query/?contractAddress=${vendingMinterContractAddress as string}`
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{vendingMinterContractAddress}
|
{vendingMinterContractAddress}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
|
Loading…
Reference in New Issue
Block a user