Skip to content

Commit

Permalink
testing the Quest Chains minting process 🙀
Browse files Browse the repository at this point in the history
  • Loading branch information
dysbulic committed Aug 18, 2024
1 parent 2e104bf commit 44aa9cc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/web/components/QuestChain/MintNFTTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const MintNFTTile: React.FC<MintNFTTileProps> = ({
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,
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/QuestChain/QuestChainDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const QuestChainDisplay: React.FC<Props> = ({
rel="noreferrer"
color="purple.200"
>
{`${creatorAddress?.slice(0, 5)}${creatorAddress?.slice(-3)}`}
{creatorName ? creatorName : `${creatorAddress?.slice(0, 5)}${creatorAddress?.slice(-3)}`}
</chakra.a>
</Tooltip>
</Box>
Expand Down
32 changes: 22 additions & 10 deletions packages/web/components/QuestChain/UploadProof.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -119,25 +120,36 @@ export const UploadProof: React.FC<{

addToast({
description: (
<Text>
Wrote metadata to{' '}
<chakra.a href={details} color="purple.600" target="_blank">
{details}
</chakra.a>
.{'\n\n'}
Waiting for Confirmation: Confirm the transaction in your wallet.'
</Text>
<Stack>
<Text>
Wrote metadata to{' '}
<chakra.a href={details} color="purple.600" target="_blank">
{details}
</chakra.a>.
</Text>
<Text>
Simulating Mint: Confirm the transaction in your wallet.
</Text>
</Stack>
),
duration: 3_000,
});

// 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,
Expand All @@ -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,
Expand Down

0 comments on commit 44aa9cc

Please sign in to comment.