From 4f93d5023b6221128618a9ecfba20e50b2f51c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B4=CF=85=CF=82?= Date: Sun, 18 Aug 2024 02:20:07 -0400 Subject: [PATCH] =?UTF-8?q?testing=20the=20Quest=20Chains=20minting=20proc?= =?UTF-8?q?ess=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/components/QuestChain/MintNFTTile.tsx | 2 +- .../QuestChain/QuestChainDisplay.tsx | 2 +- .../web/components/QuestChain/UploadProof.tsx | 32 +++++++++++++------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/web/components/QuestChain/MintNFTTile.tsx b/packages/web/components/QuestChain/MintNFTTile.tsx index 4aecec23f..84e6bd414 100644 --- a/packages/web/components/QuestChain/MintNFTTile.tsx +++ b/packages/web/components/QuestChain/MintNFTTile.tsx @@ -72,7 +72,7 @@ export const MintNFTTile: React.FC = ({ duration: null, }); - const txHash = await contract.write.mintToken(); + const txHash = await contract.write.mintToken([], { account: address }); addToast({ description: 'Transaction submitted. Waiting for 1 block confirmation.', duration: null, diff --git a/packages/web/components/QuestChain/QuestChainDisplay.tsx b/packages/web/components/QuestChain/QuestChainDisplay.tsx index b879b5ad9..991b19bc9 100644 --- a/packages/web/components/QuestChain/QuestChainDisplay.tsx +++ b/packages/web/components/QuestChain/QuestChainDisplay.tsx @@ -254,7 +254,7 @@ const QuestChainDisplay: React.FC = ({ rel="noreferrer" color="purple.200" > - {`${creatorAddress?.slice(0, 5)}…${creatorAddress?.slice(-3)}`} + {creatorName ? creatorName : `${creatorAddress?.slice(0, 5)}…${creatorAddress?.slice(-3)}`} diff --git a/packages/web/components/QuestChain/UploadProof.tsx b/packages/web/components/QuestChain/UploadProof.tsx index 1c843af0a..b188d50ab 100644 --- a/packages/web/components/QuestChain/UploadProof.tsx +++ b/packages/web/components/QuestChain/UploadProof.tsx @@ -26,6 +26,7 @@ import { useViemClients } from '#lib/hooks/useEthersProvider'; import { useInputText } from '#lib/hooks/useInputText'; import { errorHandler } from '#utils/errorHandler'; import { getHexChainId, NETWORK_INFO } from '#utils/networks'; +import { a } from '@react-spring/web'; export type ToastInfo = { close: boolean; @@ -119,14 +120,17 @@ export const UploadProof: React.FC<{ addToast({ description: ( - - Wrote metadata to{' '} - - {details} - - .{'\n\n'} - Waiting for Confirmation: Confirm the transaction in your wallet.' - + + + Wrote metadata to{' '} + + {details} + . + + + Simulating Mint: Confirm the transaction in your wallet. + + ), duration: 3_000, }); @@ -134,10 +138,18 @@ export const UploadProof: React.FC<{ // eslint-disable-next-line no-console if (debug) console.debug({ quest }); - const txHash = await contract.write.submitProofs( + if(!address) throw new Error('Missing address.') + + const { request } = await contract.simulate.submitProofs( [[BigInt(quest.questId)], [details]], { account: address }, ); + + // eslint-disable-next-line no-console + if(debug) console.debug({ request }) + + const txHash = await viemClients.wallet.writeContract(request); + addToast({ description: `Transaction ${txHash} submitted. Waiting for 1 block confirmation.`, duration: null, @@ -149,7 +161,7 @@ export const UploadProof: React.FC<{ ), duration: null, }); - await helpers.waitUntilSubgraphIndexed(`${chainId}`, Number(receipt.blockNumber)); + await helpers.waitUntilSubgraphIndexed(`0x${chainId.toString(16)}`, Number(receipt.blockNumber)); addToast({ description: `Successfully submitted proof.`, duration: 5_000,