Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { useMetamask } from "@thirdweb-dev/react"
```
|
| [useMintNFT(contract)](./react.usemintnft.md) | <b><i>(BETA)</i></b> Use this to mint a new NFT on your [NFTContract](./react.nftcontract.md) |
| [useMintToken(contract)](./react.useminttoken.md) | <b><i>(BETA)</i></b> Use this to mint a new NFT on your ERC20 contract |
| [useMintToken(contract)](./react.useminttoken.md) | <b><i>(BETA)</i></b> Use this to mint new tokens on your contract |
| [useMultiwrap(contractAddress)](./react.usemultiwrap.md) | Hook for getting an instance of an <code>Multiwrap</code> contract. This contract is an ERC721 in which you can wrap ERC721, ERC1155 and ERC20 tokens. |
| [useNetwork()](./react.usenetwork.md) | Hook for getting metadata about the network the current wallet is connected to and switching networks |
| [useNetworkMismatch()](./react.usenetworkmismatch.md) | <p>Hook for checking whether the connected wallet is on the correct network specified by the <code>desiredChainId</code> passed to the <code>&lt;ThirdwebProvider /&gt;</code>.</p>
Expand All @@ -103,10 +103,12 @@ import { useNetworkMistmatch } from "@thirdweb-dev/react"
| [useSignatureDrop(contractAddress)](./react.usesignaturedrop.md) | Hook for getting an instance of an <code>SignatureDrop</code> contract. This contract is meant to interface with ERC721 compliant NFTs that can be lazily minted. |
| [useSplit(contractAddress)](./react.usesplit.md) | Hook for getting an instance of a <code>Split</code> contract. This contract supports fund distribution to multiple parties. |
| [useToken(contractAddress)](./react.usetoken.md) | Hook for getting an instance of an <code>Token</code> contract. This contract supports ERC20 compliant tokens. |
| [useTokenBalance(contract, walletAddress)](./react.usetokenbalance.md) | <b><i>(BETA)</i></b> Use this to get the balance of your Token contract for a given address. |
| [useTokenSupply(contract)](./react.usetokensupply.md) | <b><i>(BETA)</i></b> Use this to get a the total supply of your Token contract. |
| [useTokenBalance(contract, walletAddress)](./react.usetokenbalance.md) | <b><i>(BETA)</i></b> Use this to get the balance of your contract for a given address. |
| [useTokenSupply(contract)](./react.usetokensupply.md) | <b><i>(BETA)</i></b> Use this to get a the total supply of your contract. |
| [useTotalCirculatingSupply(\[contract, tokenId\])](./react.usetotalcirculatingsupply.md) | <p><b><i>(BETA)</i></b> Use this to get a the total (minted) supply of your [NFTContract](./react.nftcontract.md)<!-- -->.</p><p>\*</p> |
| [useTotalCount(contract)](./react.usetotalcount.md) | <b><i>(BETA)</i></b> Use this to get a the number of tokens in your [NFTContract](./react.nftcontract.md)<!-- -->. |
| [useTransferBatchToken(contract)](./react.usetransferbatchtoken.md) | <b><i>(BETA)</i></b> Use this to transfer batch tokens on your contract |
| [useTransferToken(contract)](./react.usetransfertoken.md) | <b><i>(BETA)</i></b> Use this to transfer tokens on your contract |
| [useUnclaimedNFTs(contract, queryParams)](./react.useunclaimednfts.md) | <b><i>(BETA)</i></b> Use this to get a list of \*unclaimed\* NFT tokens of your ERC721 Drop contract. |
| [useUnclaimedNFTSupply(contract)](./react.useunclaimednftsupply.md) | |
| [useUpdateMetadata(contract)](./react.useupdatemetadata.md) | <b><i>(BETA)</i></b> Use this to update the metadata of your |
Expand Down Expand Up @@ -159,7 +161,7 @@ import { useWalletConnect } from "@thirdweb-dev/react"
| [NFT](./react.nft.md) | <b><i>(BETA)</i></b> A single NFT token |
| [NFTContract](./react.nftcontract.md) | <b><i>(BETA)</i></b> The possible NFT contract types. |
| [RequiredParam](./react.requiredparam.md) | <b><i>(BETA)</i></b> Makes a parameter required to be passed, but still allowes it to be undefined. |
| [TokenMintParams](./react.tokenmintparams.md) | <b><i>(BETA)</i></b> The parameters to pass to the nft mint function. |
| [TokenParams](./react.tokenparams.md) | <b><i>(BETA)</i></b> The parameters to pass to the mint and transfer functions. |
| [useNFTBalanceParams](./react.usenftbalanceparams.md) | <b><i>(BETA)</i></b> The params to pass to <code>useNftBalance</code>. |
| [useTotalCirculatingSupplyParams](./react.usetotalcirculatingsupplyparams.md) | <b><i>(BETA)</i></b> The params to pass to <code>useTotalCirculatingSupply</code>. |
| [WalletAddress](./react.walletaddress.md) | <b><i>(BETA)</i></b> A wallet address. |
Expand Down
8 changes: 4 additions & 4 deletions docs/react.tokenmintparams.md → docs/react.tokenparams.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@thirdweb-dev/react](./react.md) &gt; [TokenMintParams](./react.tokenmintparams.md)
[Home](./index.md) &gt; [@thirdweb-dev/react](./react.md) &gt; [TokenParams](./react.tokenparams.md)

## TokenMintParams type
## TokenParams type

> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>

The parameters to pass to the nft mint function.
The parameters to pass to the mint and transfer functions.

<b>Signature:</b>

```typescript
export declare type TokenMintParams = {
export declare type TokenParams = {
to: WalletAddress;
amount: string | number;
};
Expand Down
2 changes: 1 addition & 1 deletion docs/react.useclaimtoken.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Component = () => {
return (
<button
disabled={isLoading}
onClick={() => claimTokens({to: "0x...", amount: 100})}
onClick={() => claimTokens({ to: "0x...", amount: 100 })}
>
Claim Tokens!
</button>
Expand Down
12 changes: 6 additions & 6 deletions docs/react.useminttoken.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>

Use this to mint a new NFT on your ERC20 contract
Use this to mint new tokens on your contract

<b>Signature:</b>

```typescript
export declare function useMintToken(contract: RequiredParam<Erc20>): import("@tanstack/react-query").UseMutationResult<Omit<{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
}, "data">, unknown, TokenMintParams, unknown>;
}, "data">, unknown, TokenParams, unknown>;
```

## Parameters
Expand All @@ -26,7 +26,7 @@ export declare function useMintToken(contract: RequiredParam<Erc20>): import("@t

<b>Returns:</b>

import("@tanstack/react-query").UseMutationResult&lt;Omit&lt;{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;unknown&gt;; }, "data"&gt;, unknown, [TokenMintParams](./react.tokenmintparams.md)<!-- -->, unknown&gt;
import("@tanstack/react-query").UseMutationResult&lt;Omit&lt;{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;unknown&gt;; }, "data"&gt;, unknown, [TokenParams](./react.tokenparams.md)<!-- -->, unknown&gt;

a mutation object that can be used to mint a new NFT token to the connected wallet

Expand All @@ -36,19 +36,19 @@ a mutation object that can be used to mint a new NFT token to the connected wall
```jsx
const Component = () => {
const {
mutate: mintNft,
mutate: mintTokens,
isLoading,
error,
} = useMintToken(">>YourERC20ContractInstance<<");

if (error) {
console.error("failed to mint nft", error);
console.error("failed to mint tokens", error);
}

return (
<button
disabled={isLoading}
onClick={() => mintNft({ name: "My awesome NFT!" })}
onClick={() => mintTokens({ to: "0x...", amount: 1000 })}
>
Mint!
</button>
Expand Down
2 changes: 1 addition & 1 deletion docs/react.usetokenbalance.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>

Use this to get the balance of your Token contract for a given address.
Use this to get the balance of your contract for a given address.

<b>Signature:</b>

Expand Down
2 changes: 1 addition & 1 deletion docs/react.usetokensupply.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>

Use this to get a the total supply of your Token contract.
Use this to get a the total supply of your contract.

<b>Signature:</b>

Expand Down
55 changes: 55 additions & 0 deletions docs/react.usetransferbatchtoken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@thirdweb-dev/react](./react.md) &gt; [useTransferBatchToken](./react.usetransferbatchtoken.md)

## useTransferBatchToken() function

> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>

Use this to transfer batch tokens on your contract

<b>Signature:</b>

```typescript
export declare function useTransferBatchToken(contract: RequiredParam<Erc20>): import("@tanstack/react-query").UseMutationResult<void, unknown, TokenParams[], unknown>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| contract | [RequiredParam](./react.requiredparam.md)<!-- -->&lt;Erc20&gt; | an instance of a contract that extends the ERC20 spec (token, token drop, custom contract that follows the ERC20 spec) |

<b>Returns:</b>

import("@tanstack/react-query").UseMutationResult&lt;void, unknown, [TokenParams](./react.tokenparams.md)<!-- -->\[\], unknown&gt;

a mutation object that can be used to mint a new NFT token to the connected wallet

## Example


```jsx
const Component = () => {
const {
mutate: transferBatchTokens,
isLoading,
error,
} = useTransferToken(">>YourERC20ContractInstance<<");

if (error) {
console.error("failed to transfer batch tokens", error);
}

return (
<button
disabled={isLoading}
onClick={() => transferBatchTokens([{ to: "0x...", amount: 1000 }, { to: "0x...", amount: 2000 }])}
>
Transfer Batch
</button>
);
};
```

58 changes: 58 additions & 0 deletions docs/react.usetransfertoken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@thirdweb-dev/react](./react.md) &gt; [useTransferToken](./react.usetransfertoken.md)

## useTransferToken() function

> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>

Use this to transfer tokens on your contract

<b>Signature:</b>

```typescript
export declare function useTransferToken(contract: RequiredParam<Erc20>): import("@tanstack/react-query").UseMutationResult<Omit<{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
}, "data">, unknown, TokenParams, unknown>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| contract | [RequiredParam](./react.requiredparam.md)<!-- -->&lt;Erc20&gt; | an instance of a contract that extends the ERC20 spec (token, token drop, custom contract that follows the ERC20 spec) |

<b>Returns:</b>

import("@tanstack/react-query").UseMutationResult&lt;Omit&lt;{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;unknown&gt;; }, "data"&gt;, unknown, [TokenParams](./react.tokenparams.md)<!-- -->, unknown&gt;

a mutation object that can be used to mint a new NFT token to the connected wallet

## Example


```jsx
const Component = () => {
const {
mutate: transferTokens,
isLoading,
error,
} = useTransferToken(">>YourERC20ContractInstance<<");

if (error) {
console.error("failed to transfer tokens", error);
}

return (
<button
disabled={isLoading}
onClick={() => transferTokens({ to: "0x...", amount: 1000 })}
>
Transfer
</button>
);
};
```

6 changes: 3 additions & 3 deletions docs/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
},
{
"name": "useClaimToken",
"example": "const Component = () => {\n const {\n mutate: claimTokens,\n isLoading,\n error,\n } = useClaimToken(TokenDropContract);\n\n if (error) {\n console.error(\"failed to claim tokens\", error);\n }\n\n return (\n <button\n disabled={isLoading}\n onClick={() => claimTokens({to: \"0x...\", amount: 100})}\n >\n Claim Tokens!\n </button>\n );\n};",
"example": "const Component = () => {\n const {\n mutate: claimTokens,\n isLoading,\n error,\n } = useClaimToken(TokenDropContract);\n\n if (error) {\n console.error(\"failed to claim tokens\", error);\n }\n\n return (\n <button\n disabled={isLoading}\n onClick={() => claimTokens({ to: \"0x...\", amount: 100 })}\n >\n Claim Tokens!\n </button>\n );\n};",
"reference": "https://portal.thirdweb.com/react/react.useclaimtoken"
},
{
Expand Down Expand Up @@ -423,7 +423,7 @@
},
{
"name": "useClaimToken",
"example": "const Component = () => {\n const {\n mutate: claimTokens,\n isLoading,\n error,\n } = useClaimToken(TokenDropContract);\n\n if (error) {\n console.error(\"failed to claim tokens\", error);\n }\n\n return (\n <button\n disabled={isLoading}\n onClick={() => claimTokens({to: \"0x...\", amount: 100})}\n >\n Claim Tokens!\n </button>\n );\n};",
"example": "const Component = () => {\n const {\n mutate: claimTokens,\n isLoading,\n error,\n } = useClaimToken(TokenDropContract);\n\n if (error) {\n console.error(\"failed to claim tokens\", error);\n }\n\n return (\n <button\n disabled={isLoading}\n onClick={() => claimTokens({ to: \"0x...\", amount: 100 })}\n >\n Claim Tokens!\n </button>\n );\n};",
"reference": "https://portal.thirdweb.com/react/react.useclaimtoken"
},
{
Expand Down Expand Up @@ -527,7 +527,7 @@
"subhooks": [
{
"name": "useMintToken",
"example": "const Component = () => {\n const {\n mutate: mintNft,\n isLoading,\n error,\n } = useMintToken(\">>YourERC20ContractInstance<<\");\n\n if (error) {\n console.error(\"failed to mint nft\", error);\n }\n\n return (\n <button\n disabled={isLoading}\n onClick={() => mintNft({ name: \"My awesome NFT!\" })}\n >\n Mint!\n </button>\n );\n};",
"example": "const Component = () => {\n const {\n mutate: mintTokens,\n isLoading,\n error,\n } = useMintToken(\">>YourERC20ContractInstance<<\");\n\n if (error) {\n console.error(\"failed to mint tokens\", error);\n }\n\n return (\n <button\n disabled={isLoading}\n onClick={() => mintTokens({ to: \"0x...\", amount: 1000 })}\n >\n Mint!\n </button>\n );\n};",
"reference": "https://portal.thirdweb.com/react/react.useminttoken"
},
{
Expand Down
13 changes: 11 additions & 2 deletions etc/react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export interface ThirdwebSDKProviderProps extends Pick<ThirdwebProviderProps, "d
}

// @beta
export type TokenMintParams = {
export type TokenParams = {
to: WalletAddress;
amount: string | number;
};
Expand Down Expand Up @@ -1404,7 +1404,7 @@ export function useMintNFT<TContract extends NFTContract>(contract: RequiredPara
export function useMintToken(contract: RequiredParam<Erc20>): UseMutationResult<Omit<{
receipt: TransactionReceipt;
data: () => Promise<unknown>;
}, "data">, unknown, TokenMintParams, unknown>;
}, "data">, unknown, TokenParams, unknown>;

// @public
export function useMultiwrap(contractAddress?: string): Multiwrap | undefined;
Expand Down Expand Up @@ -1571,6 +1571,15 @@ export type useTotalCirculatingSupplyParams<TContract> = TContract extends Erc11
// @beta
export function useTotalCount(contract: RequiredParam<NFTContract>): UseQueryResult<BigNumber, unknown>;

// @beta
export function useTransferBatchToken(contract: RequiredParam<Erc20>): UseMutationResult<void, unknown, TokenParams[], unknown>;

// @beta
export function useTransferToken(contract: RequiredParam<Erc20>): UseMutationResult<Omit<{
receipt: TransactionReceipt;
data: () => Promise<unknown>;
}, "data">, unknown, TokenParams, unknown>;

// @beta
export function useUnclaimedNFTs(contract: RequiredParam<NFTDrop>, queryParams?: QueryAllParams): UseQueryResult< {
[x: string]: Json;
Expand Down
Loading