Add batch mint_for() functionality to Collection Actions

This commit is contained in:
Serkan Reis
2022-10-28 13:05:02 +03:00
parent 60de59a5ad
commit f86be40cc3
4 changed files with 107 additions and 10 deletions
+10 -3
View File
@@ -143,8 +143,15 @@ export const CollectionActions = ({
const showLimitField = type === 'update_per_address_limit'
const showTokenIdField = isEitherType(type, ['transfer', 'mint_for', 'burn'])
const showNumberOfTokensField = type === 'batch_mint'
const showTokenIdListField = isEitherType(type, ['batch_burn', 'batch_transfer'])
const showRecipientField = isEitherType(type, ['transfer', 'mint_to', 'mint_for', 'batch_mint', 'batch_transfer'])
const showTokenIdListField = isEitherType(type, ['batch_burn', 'batch_transfer', 'batch_mint_for'])
const showRecipientField = isEitherType(type, [
'transfer',
'mint_to',
'mint_for',
'batch_mint',
'batch_transfer',
'batch_mint_for',
])
const showAirdropFileField = type === 'airdrop'
const showPriceField = type === 'update_mint_price'
const showDescriptionField = type === 'update_collection_info'
@@ -259,7 +266,7 @@ export const CollectionActions = ({
{showWhitelistField && <AddressInput {...whitelistState} />}
{showLimitField && <NumberInput {...limitState} />}
{showTokenIdField && <NumberInput {...tokenIdState} />}
{showTokenIdListField && <TextInput {...tokenIdListState} />}
{showTokenIdListField && <TextInput className="mt-2" {...tokenIdListState} />}
{showNumberOfTokensField && <NumberInput {...batchNumberState} />}
{showPriceField && <NumberInput {...priceState} />}
{showDescriptionField && <TextInput className="mb-2" {...descriptionState} />}
+19 -6
View File
@@ -23,6 +23,7 @@ export const ACTION_TYPES = [
'batch_transfer',
'burn',
'batch_burn',
'batch_mint_for',
'shuffle',
'airdrop',
'burn_remaining',
@@ -55,15 +56,20 @@ export const ACTION_LIST: ActionListItem[] = [
name: 'Mint To',
description: `Mint a token to a user`,
},
{
id: 'mint_for',
name: 'Mint For',
description: `Mint a token for a user with given token ID`,
},
{
id: 'batch_mint',
name: 'Batch Mint',
description: `Mint multiple tokens to a user with given token amount`,
description: `Mint multiple tokens to a user`,
},
{
id: 'mint_for',
name: 'Mint For',
description: `Mint a token for a user with the given token ID`,
},
{
id: 'batch_mint_for',
name: 'Batch Mint For',
description: `Mint a specific range of tokens from the collection to a specific address`,
},
{
id: 'set_whitelist',
@@ -169,6 +175,7 @@ export type DispatchExecuteArgs = {
| { type: Select<'batch_transfer'>; recipient: string; tokenIds: string }
| { type: Select<'burn'>; tokenId: number }
| { type: Select<'batch_burn'>; tokenIds: string }
| { type: Select<'batch_mint_for'>; recipient: string; tokenIds: string }
| { type: Select<'airdrop'>; recipients: string[] }
| { type: Select<'burn_remaining'> }
| { type: Select<'update_collection_info'>; collectionInfo: CollectionInfo | undefined }
@@ -235,6 +242,9 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => {
case 'batch_burn': {
return sg721Messages.batchBurn(args.tokenIds)
}
case 'batch_mint_for': {
return minterMessages.batchMintFor(txSigner, args.recipient, args.tokenIds)
}
case 'airdrop': {
return minterMessages.airdrop(txSigner, args.recipients)
}
@@ -308,6 +318,9 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
case 'batch_burn': {
return sg721Messages(sg721Contract)?.batchBurn(args.tokenIds)
}
case 'batch_mint_for': {
return minterMessages(minterContract)?.batchMintFor(args.recipient, args.tokenIds)
}
case 'airdrop': {
return minterMessages(minterContract)?.airdrop(args.recipients)
}