diff --git a/contracts/badgeHub/messages/execute.ts b/contracts/badgeHub/messages/execute.ts index 9c6ed0a..d94796e 100644 --- a/contracts/badgeHub/messages/execute.ts +++ b/contracts/badgeHub/messages/execute.ts @@ -22,11 +22,11 @@ export interface ExecuteListItem { } export const EXECUTE_LIST: ExecuteListItem[] = [ - // { - // id: 'create_badge', - // name: 'Create Badge', - // description: `Create a new badge with the specified mint rule and metadata`, - // }, + { + id: 'create_badge', + name: 'Create Badge', + description: `Create a new badge with the specified mint rule and metadata`, + }, { id: 'edit_badge', name: 'Edit Badge', diff --git a/pages/badges/create.tsx b/pages/badges/create.tsx index de42ac9..8fecbc4 100644 --- a/pages/badges/create.tsx +++ b/pages/badges/create.tsx @@ -1,4 +1,5 @@ /* eslint-disable eslint-comments/disable-enable-pair */ + /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ diff --git a/pages/contracts/badgeHub/execute.tsx b/pages/contracts/badgeHub/execute.tsx index 00aaac2..58bb1f9 100644 --- a/pages/contracts/badgeHub/execute.tsx +++ b/pages/contracts/badgeHub/execute.tsx @@ -1,4 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ + +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ + +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { toUtf8 } from '@cosmjs/encoding' +import { Alert } from 'components/Alert' import { Button } from 'components/Button' import { Conditional } from 'components/Conditional' import { ContractPageHeader } from 'components/ContractPageHeader' @@ -11,6 +18,7 @@ import { InputDateTime } from 'components/InputDateTime' import { JsonPreview } from 'components/JsonPreview' import { LinkTabs } from 'components/LinkTabs' import { badgeHubLinkTabs } from 'components/LinkTabs.data' +import { Tooltip } from 'components/Tooltip' import { TransactionHash } from 'components/TransactionHash' import { useContracts } from 'contexts/contracts' import { useWallet } from 'contexts/wallet' @@ -30,10 +38,12 @@ import { toast } from 'react-hot-toast' import { FaArrowRight, FaCopy, FaSave } from 'react-icons/fa' import { useMutation } from 'react-query' import * as secp256k1 from 'secp256k1' +import { copy } from 'utils/clipboard' import { NETWORK } from 'utils/constants' import { withMetadata } from 'utils/layout' import { links } from 'utils/links' import { resolveAddress } from 'utils/resolveAddress' +import { truncateMiddle } from 'utils/text' import { TextInput } from '../../../components/forms/FormInput' import { MetadataAttributes } from '../../../components/forms/MetadataAttributes' @@ -48,7 +58,7 @@ const BadgeHubExecutePage: NextPage = () => { const [timestamp, setTimestamp] = useState(undefined) const [transferrable, setTransferrable] = useState(false) - const [createdBadgeId, setCreatedBadgeId] = useState(undefined) + const [createdBadgeId, setCreatedBadgeId] = useState(null) const [createdBadgeKey, setCreatedBadgeKey] = useState(undefined) const [resolvedOwnerAddress, setResolvedOwnerAddress] = useState('') const [editFee, setEditFee] = useState(undefined) @@ -318,10 +328,11 @@ const BadgeHubExecutePage: NextPage = () => { const txHash = await toast.promise(dispatchExecute(payload), { error: `${type.charAt(0).toUpperCase() + type.slice(1)} execute failed!`, loading: 'Executing message...', - success: (tx) => `Transaction ${tx} success!`, + success: (tx) => `Transaction ${tx.split(':')[0]} success!`, }) if (txHash) { - setLastTx(txHash) + setLastTx(txHash.split(':')[0]) + setCreatedBadgeId(txHash.split(':')[1]) } } }, @@ -345,6 +356,7 @@ const BadgeHubExecutePage: NextPage = () => { const publicKey = Buffer.from(secp256k1.publicKeyCreate(privKey)).toString('hex') keyState.onChange(publicKey) + setCreatedBadgeId(null) } const handleDownloadQr = async () => { @@ -505,33 +517,59 @@ const BadgeHubExecutePage: NextPage = () => { {showBadgeField && createdBadgeId && createdBadgeKey && ( -
-
- +
+
+
+ +
+ {/*
*/} +
+ + +
- {/*
*/} -
- - +
+ +
+ Badge ID: + {createdBadgeId} +
+ + Private Key: + + + +
+
+ + Please make sure to save the Badge ID and the Private Key. +
)}