Merge pull request #42 from public-awesome/fix-update-trading-start-time

This commit is contained in:
Jorge Hernandez 2022-10-22 03:10:51 -06:00 committed by GitHub
commit 7e42100567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View File

@ -149,7 +149,7 @@ export type DispatchExecuteArgs = {
| { type: Select<'batch_mint'>; recipient: string; batchNumber: number } | { type: Select<'batch_mint'>; recipient: string; batchNumber: number }
| { type: Select<'set_whitelist'>; whitelist: string } | { type: Select<'set_whitelist'>; whitelist: string }
| { type: Select<'update_start_time'>; startTime: string } | { type: Select<'update_start_time'>; startTime: string }
| { type: Select<'update_start_trading_time'>; startTime: string } | { type: Select<'update_start_trading_time'>; startTime?: string }
| { type: Select<'update_per_address_limit'>; limit: number } | { type: Select<'update_per_address_limit'>; limit: number }
| { type: Select<'shuffle'> } | { type: Select<'shuffle'> }
| { type: Select<'withdraw'> } | { type: Select<'withdraw'> }
@ -259,7 +259,7 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
return minterMessages(minterContract)?.updateStartTime(args.startTime) return minterMessages(minterContract)?.updateStartTime(args.startTime)
} }
case 'update_start_trading_time': { case 'update_start_trading_time': {
return minterMessages(minterContract)?.updateStartTradingTime(args.startTime) return minterMessages(minterContract)?.updateStartTradingTime(args.startTime as string)
} }
case 'update_per_address_limit': { case 'update_per_address_limit': {
return minterMessages(minterContract)?.updatePerAddressLimit(args.limit) return minterMessages(minterContract)?.updatePerAddressLimit(args.limit)

View File

@ -33,7 +33,7 @@ export interface MinterInstance {
updateMintPrice: (senderAddress: string, price: string) => Promise<string> updateMintPrice: (senderAddress: string, price: string) => Promise<string>
setWhitelist: (senderAddress: string, whitelist: string) => Promise<string> setWhitelist: (senderAddress: string, whitelist: string) => Promise<string>
updateStartTime: (senderAddress: string, time: Timestamp) => Promise<string> updateStartTime: (senderAddress: string, time: Timestamp) => Promise<string>
updateStartTradingTime: (senderAddress: string, time: Timestamp) => Promise<string> updateStartTradingTime: (senderAddress: string, time?: Timestamp) => Promise<string>
updatePerAddressLimit: (senderAddress: string, perAddressLimit: number) => Promise<string> updatePerAddressLimit: (senderAddress: string, perAddressLimit: number) => Promise<string>
mintTo: (senderAddress: string, recipient: string) => Promise<string> mintTo: (senderAddress: string, recipient: string) => Promise<string>
mintFor: (senderAddress: string, recipient: string, tokenId: number) => Promise<string> mintFor: (senderAddress: string, recipient: string, tokenId: number) => Promise<string>
@ -325,7 +325,7 @@ export const minter = (client: SigningCosmWasmClient, txSigner: string): MinterC
senderAddress, senderAddress,
contractAddress, contractAddress,
{ {
update_start_time: { time }, update_start_time: time,
}, },
'auto', 'auto',
'', '',
@ -334,12 +334,12 @@ export const minter = (client: SigningCosmWasmClient, txSigner: string): MinterC
return res.transactionHash return res.transactionHash
} }
const updateStartTradingTime = async (senderAddress: string, time: Timestamp): Promise<string> => { const updateStartTradingTime = async (senderAddress: string, time?: Timestamp): Promise<string> => {
const res = await client.execute( const res = await client.execute(
senderAddress, senderAddress,
contractAddress, contractAddress,
{ {
update_start_trading_time: { time }, update_start_trading_time: time || null,
}, },
'auto', 'auto',
'', '',

View File

@ -101,7 +101,7 @@ export type DispatchExecuteArgs = {
| { type: Select<'update_mint_price'>; price: string } | { type: Select<'update_mint_price'>; price: string }
| { type: Select<'set_whitelist'>; whitelist: string } | { type: Select<'set_whitelist'>; whitelist: string }
| { type: Select<'update_start_time'>; startTime: string } | { type: Select<'update_start_time'>; startTime: string }
| { type: Select<'update_start_trading_time'>; startTime: string } | { type: Select<'update_start_trading_time'>; startTime?: string }
| { type: Select<'update_per_address_limit'>; limit: number } | { type: Select<'update_per_address_limit'>; limit: number }
| { type: Select<'mint_to'>; recipient: string } | { type: Select<'mint_to'>; recipient: string }
| { type: Select<'mint_for'>; recipient: string; tokenId: number } | { type: Select<'mint_for'>; recipient: string; tokenId: number }
@ -179,7 +179,7 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
return messages(contract)?.updateStartTime(args.startTime) return messages(contract)?.updateStartTime(args.startTime)
} }
case 'update_start_trading_time': { case 'update_start_trading_time': {
return messages(contract)?.updateStartTradingTime(args.startTime) return messages(contract)?.updateStartTradingTime(args.startTime as string)
} }
case 'update_per_address_limit': { case 'update_per_address_limit': {
return messages(contract)?.updatePerAddressLimit(args.limit) return messages(contract)?.updatePerAddressLimit(args.limit)

View File

@ -80,11 +80,11 @@ const MinterExecutePage: NextPage = () => {
}) })
const showWhitelistField = type === 'set_whitelist' const showWhitelistField = type === 'set_whitelist'
const showDateField = type === 'update_start_time' const showDateField = isEitherType(type, ['update_start_time', 'update_start_trading_time'])
const showLimitField = type === 'update_per_address_limit' const showLimitField = type === 'update_per_address_limit'
const showTokenIdField = type === 'mint_for' const showTokenIdField = type === 'mint_for'
const showRecipientField = isEitherType(type, ['mint_to', 'mint_for']) const showRecipientField = isEitherType(type, ['mint_to', 'mint_for'])
const showPriceField = type === 'mint' const showPriceField = type === 'update_mint_price'
const messages = useMemo(() => contract?.use(contractState.value), [contract, wallet.address, contractState.value]) const messages = useMemo(() => contract?.use(contractState.value), [contract, wallet.address, contractState.value])
const payload: DispatchExecuteArgs = { const payload: DispatchExecuteArgs = {
@ -96,7 +96,7 @@ const MinterExecutePage: NextPage = () => {
messages, messages,
recipient: recipientState.value, recipient: recipientState.value,
txSigner: wallet.address, txSigner: wallet.address,
price: priceState.value ? (Number(priceState.value) * 1_000_000).toString() : '0', price: priceState.value ? priceState.value.toString() : '0',
type, type,
} }
const { isLoading, mutate } = useMutation( const { isLoading, mutate } = useMutation(