Execute Create Badge init

This commit is contained in:
Serkan Reis 2023-02-04 19:18:41 +03:00
parent 5c5ccbe392
commit 5a903f691e
2 changed files with 8 additions and 5 deletions

View File

@ -6,7 +6,6 @@ import type { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import type { Coin } from '@cosmjs/proto-signing' import type { Coin } from '@cosmjs/proto-signing'
import { coin } from '@cosmjs/proto-signing' import { coin } from '@cosmjs/proto-signing'
import type { logs } from '@cosmjs/stargate' import type { logs } from '@cosmjs/stargate'
import type { Timestamp } from '@stargazezone/types/contracts/minter/shared-types'
export interface InstantiateResponse { export interface InstantiateResponse {
readonly contractAddress: string readonly contractAddress: string
@ -48,7 +47,7 @@ export interface Badge {
metadata: Metadata metadata: Metadata
transferrable: boolean transferrable: boolean
rule: Rule rule: Rule
expiry?: Timestamp expiry?: number
max_supply?: number max_supply?: number
} }
@ -95,7 +94,7 @@ export interface CreateBadgeMessage {
metadata: Metadata metadata: Metadata
transferrable: boolean transferrable: boolean
rule: Rule rule: Rule
expiry?: Timestamp expiry?: number
max_supply?: number max_supply?: number
} }
} }
@ -277,7 +276,7 @@ export const badgeHub = (client: SigningCosmWasmClient, txSigner: string): Badge
}, },
'auto', 'auto',
'', '',
[coin(315, 'ustars')], [coin(912, 'ustars')],
) )
return res.transactionHash return res.transactionHash

View File

@ -4,7 +4,7 @@ import { ContractPageHeader } from 'components/ContractPageHeader'
import { ExecuteCombobox } from 'components/contracts/badgeHub/ExecuteCombobox' import { ExecuteCombobox } from 'components/contracts/badgeHub/ExecuteCombobox'
import { useExecuteComboboxState } from 'components/contracts/badgeHub/ExecuteCombobox.hooks' import { useExecuteComboboxState } from 'components/contracts/badgeHub/ExecuteCombobox.hooks'
import { FormControl } from 'components/FormControl' import { FormControl } from 'components/FormControl'
import { AddressInput } from 'components/forms/FormInput' import { AddressInput, NumberInput } from 'components/forms/FormInput'
import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks' import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks'
import { InputDateTime } from 'components/InputDateTime' import { InputDateTime } from 'components/InputDateTime'
import { JsonPreview } from 'components/JsonPreview' import { JsonPreview } from 'components/JsonPreview'
@ -26,6 +26,7 @@ import { useMutation } from 'react-query'
import { withMetadata } from 'utils/layout' import { withMetadata } from 'utils/layout'
import { links } from 'utils/links' import { links } from 'utils/links'
import { TextInput } from '../../../components/forms/FormInput'
import { MetadataAttributes } from '../../../components/forms/MetadataAttributes' import { MetadataAttributes } from '../../../components/forms/MetadataAttributes'
import { useMetadataAttributesState } from '../../../components/forms/MetadataAttributes.hooks' import { useMetadataAttributesState } from '../../../components/forms/MetadataAttributes.hooks'
@ -209,6 +210,7 @@ const BadgeHubExecutePage: NextPage = () => {
rule: { rule: {
by_key: keyState.value, by_key: keyState.value,
}, },
expiry: timestamp ? timestamp.getTime() * 1000000 : undefined,
max_supply: maxSupplyState.value, max_supply: maxSupplyState.value,
}, },
metadata: { metadata: {
@ -316,6 +318,8 @@ const BadgeHubExecutePage: NextPage = () => {
/> />
</div> </div>
)} )}
{showBadgeField && <TextInput {...keyState} />}
{showBadgeField && <NumberInput {...maxSupplyState} />}
{/* TODO: Fix address execute message */} {/* TODO: Fix address execute message */}
<Conditional test={showBadgeField}> <Conditional test={showBadgeField}>
<FormControl htmlId="expiry-date" subtitle="Badge minting expiry date" title="Expiry Date"> <FormControl htmlId="expiry-date" subtitle="Badge minting expiry date" title="Expiry Date">