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

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

## BurnNFTParams 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 params for the [useBurnNFT()](./react.useburnnft.md) hook mutation.

<b>Signature:</b>

```typescript
export declare type BurnNFTParams<TContract extends NFTContract> = TContract extends Erc1155 ? {
tokenId: BigNumberish;
amount: Amount;
} : {
tokenId: BigNumberish;
};
```
<b>References:</b> [NFTContract](./react.nftcontract.md)

4 changes: 4 additions & 0 deletions docs/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { useAddress } from "@thirdweb-dev/react"
| [useAuctionWinner(contract, listingId)](./react.useauctionwinner.md) | <b><i>(BETA)</i></b> Use this to get the winner of an auction listing from your marketplace contract. |
| [useBalance(tokenAddress)](./react.usebalance.md) | <b><i>(BETA)</i></b> A hook to get the native or (optional) ERC20 token balance of the connected wallet. |
| [useBidBuffer(contract)](./react.usebidbuffer.md) | <b><i>(BETA)</i></b> Use this to get the buffer in basis points between offers from your marketplace contract. |
| [useBurnNFT(contract)](./react.useburnnft.md) | <b><i>(BETA)</i></b> Use this to burn an NFT on your [NFTContract](./react.nftcontract.md) |
| [useBurnToken(contract)](./react.useburntoken.md) | <b><i>(BETA)</i></b> Use this to burn tokens on your contract |
| [useBuyNow(contract)](./react.usebuynow.md) | <b><i>(BETA)</i></b> Use this to buy out an auction listing from your marketplace contract. |
| [useChainId()](./react.usechainid.md) | <p>Hook for accessing the chain ID of the network the current wallet is connected to</p>
```javascript
Expand Down Expand Up @@ -152,6 +154,7 @@ import { useWalletConnect } from "@thirdweb-dev/react"
| Type Alias | Description |
| --- | --- |
| [AirdropNFTParams](./react.airdropnftparams.md) | <b><i>(BETA)</i></b> The params to pass to <code>useTransferBatchNFT</code>. |
| [BurnNFTParams](./react.burnnftparams.md) | <b><i>(BETA)</i></b> The params for the [useBurnNFT()](./react.useburnnft.md) hook mutation. |
| [BuyNowParams](./react.buynowparams.md) | |
| [ClaimIneligibilityParameters](./react.claimineligibilityparameters.md) | <b><i>(BETA)</i></b> The options to be passed as the second parameter to the <code>useClaimIneligibilityReasons</code> hook. |
| [ClaimNFTParams](./react.claimnftparams.md) | <b><i>(BETA)</i></b> The params for the [useClaimNFT()](./react.useclaimnft.md) hook mutation. |
Expand All @@ -165,6 +168,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. |
| [TokenBurnParams](./react.tokenburnparams.md) | <b><i>(BETA)</i></b> The parameters to pass to the burn function. |
| [TokenParams](./react.tokenparams.md) | <b><i>(BETA)</i></b> The parameters to pass to the mint and transfer functions. |
| [TransferNFTParams](./react.transfernftparams.md) | <b><i>(BETA)</i></b> The params to pass to <code>useTransferNFT</code>. |
| [useNFTBalanceParams](./react.usenftbalanceparams.md) | <b><i>(BETA)</i></b> The params to pass to <code>useNftBalance</code>. |
Expand Down
18 changes: 18 additions & 0 deletions docs/react.tokenburnparams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

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

## TokenBurnParams 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 burn function.

<b>Signature:</b>

```typescript
export declare type TokenBurnParams = {
amount: Amount;
};
```
86 changes: 86 additions & 0 deletions docs/react.useburnnft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

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

## useBurnNFT() 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 burn an NFT on your [NFTContract](./react.nftcontract.md)

<b>Signature:</b>

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

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| contract | [RequiredParam](./react.requiredparam.md)<!-- -->&lt;TContract&gt; | an instance of a [NFTContract](./react.nftcontract.md) |

<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, [BurnNFTParams](./react.burnnftparams.md)<!-- -->&lt;TContract&gt;, unknown&gt;

a mutation object that can be used to burn an NFT token from the connected wallet

## Example 1


```jsx
const Component = () => {
const nftDrop = useNFTDrop(<ContractAddress>);
const {
mutate: burnNft,
isLoading,
error,
} = useBurnNFT(nftDrop);

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

return (
<button
disabled={isLoading}
onClick={() => burnNft({ tokenId: 0 })}
>
Mint!
</button>
);
};
```

## Example 2


```jsx
const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: burnNft,
isLoading,
error,
} = useBurnNFT(contract?.nft);

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

return (
<button
disabled={isLoading}
onClick={() => burnNft({ tokenId: 0 })}
>
Burn!
</button>
);
};
```

58 changes: 58 additions & 0 deletions docs/react.useburntoken.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; [useBurnToken](./react.useburntoken.md)

## useBurnToken() 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 burn tokens on your contract

<b>Signature:</b>

```typescript
export declare function useBurnToken(contract: RequiredParam<Erc20>): import("@tanstack/react-query").UseMutationResult<Omit<{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
}, "data">, unknown, TokenBurnParams, 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, [TokenBurnParams](./react.tokenburnparams.md)<!-- -->, unknown&gt;

a mutation object that can be used to burn tokens from the connected wallet

## Example


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

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

return (
<button
disabled={isLoading}
onClick={() => burnTokens({ amount: 1000 })}
>
Burn!
</button>
);
};
```

2 changes: 1 addition & 1 deletion docs/react.useminttoken.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export declare function useMintToken(contract: RequiredParam<Erc20>): import("@t

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
a mutation object that can be used to mint new tokens to the connected wallet

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs/react.usetransferbatchtoken.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export declare function useTransferBatchToken(contract: RequiredParam<Erc20>): i

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
a mutation object that can be used to transfer batch tokens

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs/react.usetransfertoken.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export declare function useTransferToken(contract: RequiredParam<Erc20>): import

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
a mutation object that can be used to transfer tokens

## Example

Expand Down
29 changes: 27 additions & 2 deletions etc/react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export type AirdropNFTParams = {
addresses: AirdropInput;
};

// @beta
export type BurnNFTParams<TContract extends NFTContract> = TContract extends Erc1155 ? {
tokenId: BigNumberish;
amount: Amount;
} : {
tokenId: BigNumberish;
};

// @public (undocumented)
export type BuyNowParams<TListingType = ListingType> = TListingType extends ListingType.Direct ? {
id: BigNumberish;
Expand Down Expand Up @@ -305,6 +313,11 @@ export interface ThirdwebSDKProviderWagmiWrapper extends Pick<ThirdwebProviderPr
signer?: Signer;
}

// @beta
export type TokenBurnParams = {
amount: Amount;
};

// @beta
export type TokenParams = {
to: WalletAddress;
Expand Down Expand Up @@ -398,6 +411,18 @@ export function useBidBuffer(contract: RequiredParam<Marketplace>): UseQueryResu
// @internal (undocumented)
export function useBuiltinContract<TContractType extends ContractType>(contractType?: TContractType, contractAddress?: string): ContractForContractType<TContractType> | undefined;

// @beta
export function useBurnNFT<TContract extends NFTContract>(contract: RequiredParam<TContract>): UseMutationResult<Omit<{
receipt: TransactionReceipt;
data: () => Promise<unknown>;
}, "data">, unknown, BurnNFTParams<TContract>, unknown>;

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

// @beta
export function useBuyNow(contract: RequiredParam<Marketplace>): UseMutationResult<Omit<{
receipt: TransactionReceipt;
Expand Down Expand Up @@ -1722,8 +1747,8 @@ export type WalletLinkConnectorType = "walletLink" | "coinbase" | {
// dist/hooks/async/roles.d.ts:126:5 - (ae-incompatible-release-tags) The symbol "role" is marked as @beta, but its signature references "RolesForContract" which is marked as @internal
// dist/hooks/async/roles.d.ts:161:5 - (ae-incompatible-release-tags) The symbol "role" is marked as @beta, but its signature references "RolesForContract" which is marked as @internal
// dist/hooks/useNetwork.d.ts:48:5 - (ae-forgotten-export) The symbol "SwitchChainError" needs to be exported by the entry point index.d.ts
// dist/types.d.ts:168:5 - (ae-incompatible-release-tags) The symbol "buyForWallet" is marked as @public, but its signature references "WalletAddress" which is marked as @beta
// dist/types.d.ts:174:5 - (ae-incompatible-release-tags) The symbol "to" is marked as @public, but its signature references "WalletAddress" which is marked as @beta
// dist/types.d.ts:187:5 - (ae-incompatible-release-tags) The symbol "buyForWallet" is marked as @public, but its signature references "WalletAddress" which is marked as @beta
// dist/types.d.ts:193:5 - (ae-incompatible-release-tags) The symbol "to" is marked as @public, but its signature references "WalletAddress" which is marked as @beta

// (No @packageDocumentation comment for this package)

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "2.6.3-0",
"version": "2.6.3-3",
"repository": {
"type": "git",
"url": "git+https://github.com:thirdweb-dev/react.git"
Expand Down Expand Up @@ -34,7 +34,7 @@
"@microsoft/api-extractor": "^7.19.4",
"@microsoft/tsdoc": "^0.14.1",
"@swc/core": "^1.2.177",
"@thirdweb-dev/sdk": "^2.3.35-1",
"@thirdweb-dev/sdk": "^2.3.35",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/mime": "^2.0.3",
"@types/react": "^18.0.5",
Expand Down
Loading