Update open edition minter messages

This commit is contained in:
Serkan Reis 2023-06-16 18:40:59 +03:00
parent b7139df038
commit 52632ff42d
2 changed files with 60 additions and 1 deletions

View File

@ -5,6 +5,9 @@ export type ExecuteType = typeof EXECUTE_TYPES[number]
export const EXECUTE_TYPES = [
'mint',
'update_start_time',
'update_end_time',
'update_mint_price',
'update_start_trading_time',
'update_per_address_limit',
'mint_to',
@ -23,6 +26,21 @@ export const EXECUTE_LIST: ExecuteListItem[] = [
name: 'Mint',
description: `Mint a new token`,
},
{
id: 'update_mint_price',
name: 'Update Mint Price',
description: `Update the mint price per token`,
},
{
id: 'update_start_time',
name: 'Update Start Time',
description: `Update the start time for minting`,
},
{
id: 'update_end_time',
name: 'Update End Time',
description: `Update the end time for minting`,
},
{
id: 'update_start_trading_time',
name: 'Update Start Trading Time',
@ -61,6 +79,9 @@ export type DispatchExecuteArgs = {
| { type: undefined }
| { type: Select<'mint'> }
| { type: Select<'purge'> }
| { type: Select<'update_start_time'>; startTime: string }
| { type: Select<'update_end_time'>; endTime: string }
| { type: Select<'update_mint_price'>; price: string }
| { type: Select<'update_start_trading_time'>; startTime?: string }
| { type: Select<'update_per_address_limit'>; limit: number }
| { type: Select<'mint_to'>; recipient: string }
@ -78,6 +99,15 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => {
case 'purge': {
return messages.purge(txSigner)
}
case 'update_start_time': {
return messages.updateStartTime(txSigner, args.startTime)
}
case 'update_end_time': {
return messages.updateEndTime(txSigner, args.endTime)
}
case 'update_mint_price': {
return messages.updateMintPrice(txSigner, args.price)
}
case 'update_start_trading_time': {
return messages.updateStartTradingTime(txSigner, args.startTime)
}
@ -104,6 +134,15 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
case 'purge': {
return messages(contract)?.purge()
}
case 'update_start_time': {
return messages(contract)?.updateStartTime(args.startTime)
}
case 'update_end_time': {
return messages(contract)?.updateEndTime(args.endTime)
}
case 'update_mint_price': {
return messages(contract)?.updateMintPrice(args.price)
}
case 'update_start_trading_time': {
return messages(contract)?.updateStartTradingTime(args.startTime as string)
}

View File

@ -2,7 +2,15 @@ import type { OpenEditionMinterInstance } from '../contract'
export type QueryType = typeof QUERY_TYPES[number]
export const QUERY_TYPES = ['config', 'start_time', 'mint_price', 'mint_count', 'status'] as const
export const QUERY_TYPES = [
'config',
'start_time',
'end_time',
'mint_price',
'mint_count',
'total_mint_count',
'status',
] as const
export interface QueryListItem {
id: QueryType
@ -13,12 +21,18 @@ export interface QueryListItem {
export const QUERY_LIST: QueryListItem[] = [
{ id: 'config', name: 'Config', description: 'View current config' },
{ id: 'start_time', name: 'Start Time', description: 'View the start time for minting' },
{ id: 'end_time', name: 'End Time', description: 'View the end time for minting' },
{ id: 'mint_price', name: 'Mint Price', description: 'View the mint price' },
{
id: 'mint_count',
name: 'Total Minted Count',
description: 'View the total amount of minted tokens for an address',
},
{
id: 'total_mint_count',
name: 'Total Mint Count',
description: 'View the total amount of minted tokens',
},
{ id: 'status', name: 'Status', description: 'View contract status' },
]
@ -40,12 +54,18 @@ export const dispatchQuery = (props: DispatchQueryProps) => {
case 'start_time': {
return messages?.getStartTime()
}
case 'end_time': {
return messages?.getEndTime()
}
case 'mint_price': {
return messages?.getMintPrice()
}
case 'mint_count': {
return messages?.getMintCount(address)
}
case 'total_mint_count': {
return messages?.getTotalMintCount()
}
default: {
throw new Error('unknown query type')
}