From 6b43c792f362e2c4b27546408cbe30e3f90f6f89 Mon Sep 17 00:00:00 2001 From: Nacho Iacovino Date: Wed, 27 Jul 2022 21:58:02 +0200 Subject: [PATCH 1/3] Update useMintNFTs --- src/hooks/async/drop.ts | 2 +- src/hooks/async/nft.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks/async/drop.ts b/src/hooks/async/drop.ts index b555d69..417e555 100644 --- a/src/hooks/async/drop.ts +++ b/src/hooks/async/drop.ts @@ -150,7 +150,7 @@ export function useClaimedNFTSupply(contract: RequiredParam) { * return ( * diff --git a/src/hooks/async/nft.ts b/src/hooks/async/nft.ts index a02c819..24b3a28 100644 --- a/src/hooks/async/nft.ts +++ b/src/hooks/async/nft.ts @@ -14,11 +14,11 @@ import { invalidateContractAndBalances, } from "../../utils/cache-keys"; import { useQueryWithNetwork } from "../query-utils/useQueryWithNetwork"; -import { useMutation, useQueryClient } from "@tanstack/react-query"; import { QueryAllParams } from "@thirdweb-dev/sdk/dist/browser"; // eslint-disable-next-line no-duplicate-imports import { Erc721, Erc1155 } from "@thirdweb-dev/sdk/dist/browser"; import { BigNumber, BigNumberish } from "ethers"; +import { useMutation, useQueryClient } from "react-query"; import invariant from "tiny-invariant"; /** @@ -361,7 +361,7 @@ export function useNFTBalance( * return ( * @@ -371,7 +371,7 @@ export function useNFTBalance( * @example * ```jsx * const Component = () => { - * const { contract } = useContract(); + * const { contract } = useContract(); * const { * mutate: mintNft, * isLoading, @@ -385,7 +385,7 @@ export function useNFTBalance( * return ( * From 2ffa3785d9cc20ee7ba5b52778fcad703fd8421f Mon Sep 17 00:00:00 2001 From: Nacho Iacovino Date: Wed, 27 Jul 2022 21:59:21 +0200 Subject: [PATCH 2/3] Fix import --- src/hooks/async/nft.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/async/nft.ts b/src/hooks/async/nft.ts index 24b3a28..397dd45 100644 --- a/src/hooks/async/nft.ts +++ b/src/hooks/async/nft.ts @@ -14,11 +14,11 @@ import { invalidateContractAndBalances, } from "../../utils/cache-keys"; import { useQueryWithNetwork } from "../query-utils/useQueryWithNetwork"; +import { useMutation, useQueryClient } from "@tanstack/react-query"; import { QueryAllParams } from "@thirdweb-dev/sdk/dist/browser"; // eslint-disable-next-line no-duplicate-imports import { Erc721, Erc1155 } from "@thirdweb-dev/sdk/dist/browser"; import { BigNumber, BigNumberish } from "ethers"; -import { useMutation, useQueryClient } from "react-query"; import invariant from "tiny-invariant"; /** From e5a5aa51aefcff5935b60a5d623b72a5cd18b38f Mon Sep 17 00:00:00 2001 From: Nacho Iacovino Date: Wed, 27 Jul 2022 22:55:56 +0200 Subject: [PATCH 3/3] yarn build --- docs/react.useclaimnft.md | 2 +- docs/react.usemintnft.md | 6 +++--- docs/snippets.json | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/react.useclaimnft.md b/docs/react.useclaimnft.md index b61066f..62f51da 100644 --- a/docs/react.useclaimnft.md +++ b/docs/react.useclaimnft.md @@ -45,7 +45,7 @@ const Component = () => { return ( diff --git a/docs/react.usemintnft.md b/docs/react.usemintnft.md index 56366be..567bda7 100644 --- a/docs/react.usemintnft.md +++ b/docs/react.usemintnft.md @@ -46,7 +46,7 @@ const Component = () => { return ( @@ -59,7 +59,7 @@ const Component = () => { ```jsx const Component = () => { - const { contract } = useContract(); + const { contract } = useContract(); const { mutate: mintNft, isLoading, @@ -73,7 +73,7 @@ const Component = () => { return ( diff --git a/docs/snippets.json b/docs/snippets.json index 19800fc..f317900 100644 --- a/docs/snippets.json +++ b/docs/snippets.json @@ -168,7 +168,7 @@ "subhooks": [ { "name": "useMintNFT", - "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\" })}\n >\n Mint!\n \n );\n};", + "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\", to: \"0x...\" })}\n >\n Mint!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.usemintnft" }, { @@ -233,7 +233,7 @@ }, { "name": "useClaimNFT", - "example": "const Component = () => {\n const {\n mutate: claimNft,\n isLoading,\n error,\n } = useClaimNFT(DropContract);\n\n if (error) {\n console.error(\"failed to claim nft\", error);\n }\n\n return (\n claimNft({to: \"0x...\", quantity: 1})}\n >\n Claim NFT!\n \n );\n};", + "example": "const Component = () => {\n const {\n mutate: claimNft,\n isLoading,\n error,\n } = useClaimNFT(DropContract);\n\n if (error) {\n console.error(\"failed to claim nft\", error);\n }\n\n return (\n claimNft({ to: \"0x...\", quantity: 1 })}\n >\n Claim NFT!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.useclaimnft" }, { @@ -243,7 +243,7 @@ }, { "name": "useMintNFT", - "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\" })}\n >\n Mint!\n \n );\n};", + "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\", to: \"0x...\" })}\n >\n Mint!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.usemintnft" }, { @@ -353,7 +353,7 @@ "subhooks": [ { "name": "useMintNFT", - "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\" })}\n >\n Mint!\n \n );\n};", + "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\", to: \"0x...\" })}\n >\n Mint!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.usemintnft" }, { @@ -418,7 +418,7 @@ }, { "name": "useClaimNFT", - "example": "const Component = () => {\n const {\n mutate: claimNft,\n isLoading,\n error,\n } = useClaimNFT(DropContract);\n\n if (error) {\n console.error(\"failed to claim nft\", error);\n }\n\n return (\n claimNft({to: \"0x...\", quantity: 1})}\n >\n Claim NFT!\n \n );\n};", + "example": "const Component = () => {\n const {\n mutate: claimNft,\n isLoading,\n error,\n } = useClaimNFT(DropContract);\n\n if (error) {\n console.error(\"failed to claim nft\", error);\n }\n\n return (\n claimNft({ to: \"0x...\", quantity: 1 })}\n >\n Claim NFT!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.useclaimnft" }, { @@ -428,7 +428,7 @@ }, { "name": "useMintNFT", - "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\" })}\n >\n Mint!\n \n );\n};", + "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\", to: \"0x...\" })}\n >\n Mint!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.usemintnft" }, { @@ -478,7 +478,7 @@ "subhooks": [ { "name": "useMintNFT", - "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\" })}\n >\n Mint!\n \n );\n};", + "example": "const Component = () => {\n const { contract } = useContract();\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintNFT(contract?.nft);\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n mintNft({ name: \"My awesome NFT!\", to: \"0x...\" })}\n >\n Mint!\n \n );\n};", "reference": "https://portal.thirdweb.com/react/react.usemintnft" }, {