Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f1155239d | ||
|
|
c295a47144 | ||
|
|
0dade96d0d | ||
|
|
666ff5f694 | ||
|
|
8bc41cdc60 | ||
|
|
37a707f98c | ||
|
|
3c8f6205e9 | ||
|
|
1eaedc262f | ||
|
|
e187d21e12 | ||
|
|
b030a86608 | ||
|
|
acbabc8999 | ||
|
|
196195e2f9 | ||
|
|
7c86babb86 |
@@ -9,7 +9,8 @@
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": [],
|
||||
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
|
||||
"updateInternalDependents": "always"
|
||||
"updateInternalDependents": "always",
|
||||
"onlyUpdatePeerDependentsWhenOutOfRange": true
|
||||
},
|
||||
"snapshot": {
|
||||
"useCalculatedVersion": true,
|
||||
|
||||
+3
-5
@@ -12,7 +12,7 @@
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "turbo run test",
|
||||
"test": "turbo run test && turbo run test:evm && turbo run test:solana",
|
||||
"e2e": "turbo run e2e",
|
||||
"build": "turbo run build",
|
||||
"build:release": "turbo run build --force",
|
||||
@@ -44,12 +44,10 @@
|
||||
"eslint": "^8.21.0",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^2.7.1",
|
||||
"turbo": "^1.4.6"
|
||||
"turbo": "^1.4.6",
|
||||
"yalc": "^1.0.0-pre.53"
|
||||
},
|
||||
"manypkg": {
|
||||
"defaultBranch": "main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"yalc": "^1.0.0-pre.53"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 2.0.10
|
||||
|
||||
## 2.0.9
|
||||
|
||||
## 2.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "2.0.8",
|
||||
"version": "2.0.10",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./express": {
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.7.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`666ff5f`](https://github.com/thirdweb-dev/js/commit/666ff5f694f1e146150ddb9fa3233f00533b6d60), [`0dade96`](https://github.com/thirdweb-dev/js/commit/0dade96d0d2553d25b386d822e534eb7ed0aefa9), [`c295a47`](https://github.com/thirdweb-dev/js/commit/c295a47144cd722c6f8861c1ec567b53a05ea0bf)]:
|
||||
- @thirdweb-dev/sdk@3.1.1
|
||||
|
||||
## 0.7.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`3c8f620`](https://github.com/thirdweb-dev/js/commit/3c8f6205e9b49ae9fea1f9629678210c6c9c36e6), [`e187d21`](https://github.com/thirdweb-dev/js/commit/e187d21e123a506fac0459da18f2d4fc94abae29), [`acbabc8`](https://github.com/thirdweb-dev/js/commit/acbabc8999b2b7b6e0eb89cae97e2f1ef7143501), [`b030a86`](https://github.com/thirdweb-dev/js/commit/b030a866080953bbf4e504ddc41d7050b250d2d7)]:
|
||||
- @thirdweb-dev/sdk@3.1.0
|
||||
|
||||
## 0.7.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.7.19",
|
||||
"version": "0.7.21",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Detector } from "./detector";
|
||||
import FoundryDetector from "./foundry";
|
||||
import HardhatDetector from "./hardhat";
|
||||
import TruffleDetector from "./truffle";
|
||||
import fs, { exists, existsSync } from "fs";
|
||||
import fs, { existsSync } from "fs";
|
||||
import inquirer from "inquirer";
|
||||
import { parse } from "path";
|
||||
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#221](https://github.com/thirdweb-dev/js/pull/221) [`c295a47`](https://github.com/thirdweb-dev/js/commit/c295a47144cd722c6f8861c1ec567b53a05ea0bf) Thanks [@jnsdls](https://github.com/jnsdls)! - fix esm exports
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#213](https://github.com/thirdweb-dev/js/pull/213) [`e187d21`](https://github.com/thirdweb-dev/js/commit/e187d21e123a506fac0459da18f2d4fc94abae29) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - New @thirdweb-dev/react/solana entrypoint
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#208](https://github.com/thirdweb-dev/js/pull/208) [`7c86bab`](https://github.com/thirdweb-dev/js/commit/7c86babb86e02f08a630ed7578036202eb3dbe66) Thanks [@jnsdls](https://github.com/jnsdls)! - add a bunch of initial solana hooks
|
||||
|
||||
- [#218](https://github.com/thirdweb-dev/js/pull/218) [`1eaedc2`](https://github.com/thirdweb-dev/js/commit/1eaedc262f0665de2a6a0446402b570371136e05) Thanks [@jnsdls](https://github.com/jnsdls)! - allow both `null` and `undefined` to be passed as a `RequiredParam`
|
||||
|
||||
- [#220](https://github.com/thirdweb-dev/js/pull/220) [`37a707f`](https://github.com/thirdweb-dev/js/commit/37a707f98c00140ddedb1d876a4b2f99fe25556a) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix chakra zag-menu breaking update
|
||||
|
||||
## 3.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "dist/thirdweb-dev-react-evm.cjs.js",
|
||||
"module": "dist/thirdweb-dev-react-evm.esm.js"
|
||||
}
|
||||
@@ -1,20 +1,37 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.0.8",
|
||||
"version": "3.1.1",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/thirdweb-dev-react.cjs.js",
|
||||
"types": "dist/thirdweb-dev-react.cjs.d.ts",
|
||||
"module": "dist/thirdweb-dev-react.esm.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"module": "./dist/thirdweb-dev-react.esm.js",
|
||||
"default": "./dist/thirdweb-dev-react.cjs.js"
|
||||
},
|
||||
"./solana": {
|
||||
"module": "./solana/dist/thirdweb-dev-react-solana.esm.js",
|
||||
"default": "./solana/dist/thirdweb-dev-react-solana.cjs.js"
|
||||
},
|
||||
"./evm": {
|
||||
"module": "./evm/dist/thirdweb-dev-react-evm.esm.js",
|
||||
"default": "./evm/dist/thirdweb-dev-react-evm.cjs.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"evm/",
|
||||
"solana/"
|
||||
],
|
||||
"preconstruct": {
|
||||
"entrypoints": [
|
||||
"index.ts",
|
||||
"solana/index.ts"
|
||||
"solana/index.ts",
|
||||
"evm/index.ts"
|
||||
]
|
||||
},
|
||||
"private": false,
|
||||
@@ -48,6 +65,7 @@
|
||||
"@solana/wallet-adapter-wallets": "^0.19.0",
|
||||
"@solana/web3.js": "^1.63.0",
|
||||
"@thirdweb-dev/sdk": "*",
|
||||
"@thirdweb-dev/solana": "*",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/mime": "^3.0.1",
|
||||
"@types/react": "^18.0.5",
|
||||
@@ -74,7 +92,7 @@
|
||||
"@gnosis.pm/safe-ethers-lib": "1.1.0",
|
||||
"@react-icons/all-files": "^4.1.0",
|
||||
"@tanstack/react-query": "^4.0.10",
|
||||
"@zag-js/menu": "^0.1.11",
|
||||
"@zag-js/menu": "0.1.14",
|
||||
"@zag-js/react": "0.1.16",
|
||||
"color": "^4.2.3",
|
||||
"copy-to-clipboard": "^3.3.2",
|
||||
@@ -91,7 +109,6 @@
|
||||
"@solana/wallet-adapter-wallets": "^0.19.0",
|
||||
"@solana/web3.js": "^1.63.0",
|
||||
"@thirdweb-dev/sdk": "*",
|
||||
"@thirdweb-dev/solana": "*",
|
||||
"ethers": ">=5.5.1",
|
||||
"react": ">=18.0.0",
|
||||
"react-dom": ">=18.0.0"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { ComponentWithChildren } from "../types/component";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { useMemo } from "react";
|
||||
|
||||
export interface QueryClientProviderProps {
|
||||
queryClient?: QueryClient;
|
||||
}
|
||||
|
||||
export const QueryClientProviderWithDefault: ComponentWithChildren<
|
||||
QueryClientProviderProps
|
||||
> = ({ queryClient, children }) => {
|
||||
const queryClientWithDefault: QueryClient = useMemo(() => {
|
||||
return queryClient ? queryClient : new QueryClient();
|
||||
}, [queryClient]);
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClientWithDefault}>
|
||||
{children}
|
||||
</QueryClientProvider>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
import { RequiredParam } from "../types/shared";
|
||||
import { QueryKey } from "@tanstack/react-query";
|
||||
import type { ChainId } from "@thirdweb-dev/sdk";
|
||||
import type {
|
||||
Network,
|
||||
NFTCollection,
|
||||
NFTDrop,
|
||||
Token,
|
||||
} from "@thirdweb-dev/sdk/solana";
|
||||
|
||||
// we prefix all our query keys with this to avoid possible collisions with user-defined queries that share the same query client
|
||||
const TW_QUERY_KEY_PREFIX = "__tw__";
|
||||
// marker to make sure the query will not get stored in local storage by a query persister
|
||||
const NEVER_PERSIST_QUERY_POSTFIX = { persist: false } as const;
|
||||
|
||||
function ensureTWPrefix<TKey extends QueryKey>(key: TKey) {
|
||||
if (key[0] === TW_QUERY_KEY_PREFIX) {
|
||||
return key as unknown as Readonly<[typeof TW_QUERY_KEY_PREFIX, ...TKey]>;
|
||||
}
|
||||
return [TW_QUERY_KEY_PREFIX, ...key] as const;
|
||||
}
|
||||
|
||||
export function neverPersist<TKey extends QueryKey>(key: TKey) {
|
||||
return [...key, NEVER_PERSIST_QUERY_POSTFIX] as const;
|
||||
}
|
||||
|
||||
export function shouldNeverPersistQuery<TKey extends QueryKey>(
|
||||
key: TKey,
|
||||
): boolean {
|
||||
return key[key.length] === NEVER_PERSIST_QUERY_POSTFIX;
|
||||
}
|
||||
|
||||
// EVM
|
||||
|
||||
export function createEVMQueryKey<TKey extends QueryKey>(key: TKey) {
|
||||
return ensureTWPrefix(["evm", ...key] as const);
|
||||
}
|
||||
export function createEVMQueryKeyWithChain<TKey extends QueryKey>(
|
||||
key: TKey,
|
||||
chainId: RequiredParam<ChainId>,
|
||||
) {
|
||||
return ensureTWPrefix([chainId, ...key] as const);
|
||||
}
|
||||
|
||||
// SOL
|
||||
|
||||
export function createSOLQueryKey<TKey extends QueryKey>(key: TKey) {
|
||||
return ensureTWPrefix(["sol", ...key] as const);
|
||||
}
|
||||
|
||||
export function createSOLQueryKeyWithNetwork<TKey extends QueryKey>(
|
||||
key: TKey,
|
||||
network: RequiredParam<Network>,
|
||||
) {
|
||||
return createSOLQueryKey([network, ...key] as const);
|
||||
}
|
||||
|
||||
export function createSOLProgramQueryKey<TKey extends QueryKey>(
|
||||
program: RequiredParam<NFTCollection | NFTDrop | Token>,
|
||||
key: TKey = [] as unknown as TKey,
|
||||
) {
|
||||
const network = program?.network;
|
||||
const address = program?.publicKey.toBase58();
|
||||
return createSOLQueryKeyWithNetwork(
|
||||
["program", address, ...key] as const,
|
||||
network || null,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import React from "react";
|
||||
|
||||
export type ComponentWithChildren<P = unknown> = React.FC<
|
||||
React.PropsWithChildren<P>
|
||||
>;
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Makes a parameter required to be passed, but still allowes it to be null or undefined.
|
||||
*
|
||||
* @beta
|
||||
*/
|
||||
export type RequiredParam<T> = T | null | undefined;
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { Button } from "../shared/Button";
|
||||
import { ThemeProvider, ThemeProviderProps } from "../shared/ThemeProvider";
|
||||
import { FiWifi } from "@react-icons/all-files/fi/FiWifi";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/smart-contract";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/smart-contract";
|
||||
import type { CallOverrides } from "ethers";
|
||||
import { PropsWithChildren, useMemo } from "react";
|
||||
import invariant from "tiny-invariant";
|
||||
+2
-6
@@ -1,10 +1,6 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import {
|
||||
getErcs,
|
||||
DropContract,
|
||||
RequiredParam,
|
||||
WalletAddress,
|
||||
} from "../../types";
|
||||
import { getErcs, DropContract, WalletAddress } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import { RequiredParam, WalletAddress } from "../../types";
|
||||
import { WalletAddress } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
+6
-4
@@ -1,5 +1,7 @@
|
||||
import { neverPersist } from "../../../core/query-utils/query-key";
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDK, useSDKChainId } from "../../providers/base";
|
||||
import { ContractAddress, RequiredParam } from "../../types";
|
||||
import { ContractAddress } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
createCacheKeyWithNetwork,
|
||||
@@ -21,7 +23,7 @@ import {
|
||||
ThirdwebSDK,
|
||||
ValidContractInstance,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/smart-contract";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/smart-contract";
|
||||
import { CallOverrides } from "ethers";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import invariant from "tiny-invariant";
|
||||
@@ -159,11 +161,11 @@ export function useContract<
|
||||
|
||||
const contractQuery = useQueryWithNetwork(
|
||||
// need to add the wallet and walletChainId into the query key so this gets refreshed when the wallet / chain changes!
|
||||
[
|
||||
neverPersist([
|
||||
"contract-instance",
|
||||
contractAddress,
|
||||
{ wallet, walletChainId, sdkTimestamp },
|
||||
],
|
||||
]),
|
||||
async () => {
|
||||
invariant(contractAddress, "contract address is required");
|
||||
invariant(sdk, "SDK not initialized");
|
||||
@@ -1,10 +1,10 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import {
|
||||
ClaimNFTParams,
|
||||
ClaimNFTReturnType,
|
||||
DelayedRevealLazyMintInput,
|
||||
DropContract,
|
||||
RequiredParam,
|
||||
RevealLazyMintInput,
|
||||
getErcs,
|
||||
NFTContract,
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
QueryAllParams,
|
||||
UploadProgressEvent,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import { NFTDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/nft-drop";
|
||||
import { NFTDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/nft-drop";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
/** **********************/
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import { BuyNowParams, MakeBidParams, RequiredParam } from "../../types";
|
||||
import { BuyNowParams, MakeBidParams } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
@@ -15,7 +16,7 @@ import type {
|
||||
NewDirectListing,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import { ListingType } from "@thirdweb-dev/sdk";
|
||||
import { Marketplace } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/marketplace";
|
||||
import { Marketplace } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/marketplace";
|
||||
import { BigNumber, BigNumberish } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import {
|
||||
AirdropNFTParams,
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
MintNFTReturnType,
|
||||
MintNFTSupplyParams,
|
||||
NFT,
|
||||
RequiredParam,
|
||||
TransferNFTParams,
|
||||
WalletAddress,
|
||||
Erc721OrErc1155,
|
||||
@@ -282,6 +282,7 @@ export function useOwnedNFTs<TContract extends NFTContract>(
|
||||
cacheKeys.contract.nft.query.owned.all(contractAddress, ownerWalletAddress),
|
||||
async () => {
|
||||
invariant(contract, "No Contract instance provided");
|
||||
invariant(ownerWalletAddress, "No wallet address provided");
|
||||
if (erc721) {
|
||||
return convertResponseToNFTTypeArray(
|
||||
erc721,
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import { RequiredParam, WalletAddress } from "../../types";
|
||||
import { WalletAddress } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
@@ -7,8 +8,8 @@ import {
|
||||
import { useQueryWithNetwork } from "../query-utils/useQueryWithNetwork";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import type { Role, ValidContractInstance } from "@thirdweb-dev/sdk";
|
||||
import type { Vote } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/vote";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/smart-contract";
|
||||
import type { Vote } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/vote";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/smart-contract";
|
||||
import { constants } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { RequiredParam } from "../../../core/types/shared";
|
||||
import { useSDKChainId } from "../../providers/base";
|
||||
import {
|
||||
ClaimTokenParams,
|
||||
RequiredParam,
|
||||
TokenBurnParams,
|
||||
TokenParams,
|
||||
WalletAddress,
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Edition } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/edition";
|
||||
import { Edition } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/edition";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `Edition` contract. This contract is used to interface with ERC1155 compliant NFTs.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { EditionDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/edition-drop";
|
||||
import { EditionDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/edition-drop";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `EditionDrop` contract. This conract is used to interface with ERC1155 compliant NFTs that can be lazily minted.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Marketplace } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/marketplace";
|
||||
import { Marketplace } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/marketplace";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of a `Marketplace` contract. This contract is used to support marketplace for purchase and sale of on-chain assets.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Multiwrap } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/multiwrap";
|
||||
import { Multiwrap } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/multiwrap";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `Multiwrap` contract. This contract is an ERC721 in which you can wrap ERC721, ERC1155 and ERC20 tokens.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { NFTCollection } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/nft-collection";
|
||||
import { NFTCollection } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/nft-collection";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `NFTCollection` contract. This contract is meant to interface with ERC721 compliant NFTs.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { NFTDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/nft-drop";
|
||||
import { NFTDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/nft-drop";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `NFTDrop` contract. This contract is meant to interface with ERC721 compliant NFTs that can be lazily minted.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Pack } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/pack";
|
||||
import { Pack } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/pack";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of a `Pack` contract. This contract supports the creation of on-chain luck-based lootboxes.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { SignatureDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/signature-drop";
|
||||
import { SignatureDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/signature-drop";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `SignatureDrop` contract. This contract is meant to interface with ERC721 compliant NFTs that can be lazily minted.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Split } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/split";
|
||||
import { Split } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/split";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of a `Split` contract. This contract supports fund distribution to multiple parties.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Token } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/token";
|
||||
import { Token } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/token";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of a `Token` contract. This contract supports ERC20 compliant tokens.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { TokenDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/token-drop";
|
||||
import { TokenDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/token-drop";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of a `Token Drop` contract.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { showDeprecationWarning } from "../../utils/deprecation-warning";
|
||||
import { useContract } from "../async/contracts";
|
||||
import { Vote } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/vote";
|
||||
import { Vote } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/vote";
|
||||
|
||||
/**
|
||||
* Hook for getting an instance of an `Vote` contract. This contract enables fully featured voting-based decentralized governance systems.
|
||||
@@ -0,0 +1,47 @@
|
||||
// providers
|
||||
export * from "./providers/base";
|
||||
export * from "./providers/full";
|
||||
|
||||
// contract hooks
|
||||
export * from "./hooks/contracts";
|
||||
// async contract hooks
|
||||
export * from "./hooks/async/contracts";
|
||||
export * from "./hooks/async/nft";
|
||||
export * from "./hooks/async/drop";
|
||||
export * from "./hooks/async/marketplace";
|
||||
export * from "./hooks/async/token";
|
||||
export * from "./hooks/async/claim-conditions";
|
||||
|
||||
export * from "./hooks/async/contract-settings";
|
||||
export * from "./hooks/async/roles";
|
||||
|
||||
// thirdweb hooks (work as long as at least `<ThirdwebSDkProvider>` is used)
|
||||
export * from "./hooks/auth";
|
||||
export * from "./hooks/useSigner";
|
||||
export * from "./hooks/useReadonlySDK";
|
||||
export * from "./hooks/useNetworkMismatch";
|
||||
export * from "./hooks/wallet";
|
||||
|
||||
// require to be inside `<ThirdwebProvider />`
|
||||
export * from "./hooks/wagmi-required/useAccount";
|
||||
export * from "./hooks/wagmi-required/useNetwork";
|
||||
export * from "./hooks/wagmi-required/useDisconnect";
|
||||
export * from "./hooks/wagmi-required/useConnect";
|
||||
export * from "./hooks/connectors/useMetamask";
|
||||
export * from "./hooks/connectors/useWalletConnect";
|
||||
export * from "./hooks/connectors/useWalletLink";
|
||||
export * from "./hooks/connectors/useGnosis";
|
||||
export * from "./hooks/connectors/useMagic";
|
||||
|
||||
// re-exports
|
||||
export { ChainId } from "@thirdweb-dev/sdk";
|
||||
|
||||
// types
|
||||
export * from "./types";
|
||||
export type { ThirdwebAuthConfig } from "./contexts/thirdweb-auth";
|
||||
|
||||
// ui components
|
||||
export * from "./components/MediaRenderer";
|
||||
export * from "./components/NftMedia";
|
||||
export * from "./components/ConnectWallet";
|
||||
export * from "./components/Web3Button";
|
||||
@@ -1,3 +1,9 @@
|
||||
import {
|
||||
QueryClientProviderProps,
|
||||
QueryClientProviderWithDefault,
|
||||
} from "../../core/providers/query-client";
|
||||
import { ComponentWithChildren } from "../../core/types/component";
|
||||
import { RequiredParam } from "../../core/types/shared";
|
||||
import {
|
||||
ThirdwebAuthConfig,
|
||||
ThirdwebAuthConfigProvider,
|
||||
@@ -6,8 +12,6 @@ import {
|
||||
ThirdwebConnectedWalletProvider,
|
||||
useThirdwebConnectedWalletContext,
|
||||
} from "../contexts/thirdweb-wallet";
|
||||
import { RequiredParam } from "../types";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import {
|
||||
ChainOrRpc,
|
||||
SDKOptions,
|
||||
@@ -28,7 +32,7 @@ interface TWSDKContext {
|
||||
|
||||
const ThirdwebSDKContext = createContext<TWSDKContext>({ desiredChainId: -1 });
|
||||
|
||||
export interface ThirdwebSDKProviderProps {
|
||||
export interface ThirdwebSDKProviderProps extends QueryClientProviderProps {
|
||||
desiredChainId: RequiredParam<SUPPORTED_CHAIN_ID>;
|
||||
provider: ChainOrRpc | SignerOrProvider;
|
||||
|
||||
@@ -37,30 +41,23 @@ export interface ThirdwebSDKProviderProps {
|
||||
sdkOptions?: SDKOptions;
|
||||
storageInterface?: ThirdwebStorage;
|
||||
authConfig?: ThirdwebAuthConfig;
|
||||
|
||||
queryClient?: QueryClient;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const WrappedThirdwebSDKProvider: React.FC<
|
||||
React.PropsWithChildren<Omit<ThirdwebSDKProviderProps, "signer">>
|
||||
export const WrappedThirdwebSDKProvider: ComponentWithChildren<
|
||||
Omit<ThirdwebSDKProviderProps, "signer">
|
||||
> = ({
|
||||
sdkOptions,
|
||||
desiredChainId,
|
||||
storageInterface,
|
||||
provider,
|
||||
|
||||
queryClient,
|
||||
authConfig,
|
||||
children,
|
||||
}) => {
|
||||
const queryClientWithDefault: QueryClient = useMemo(() => {
|
||||
return queryClient ? queryClient : new QueryClient();
|
||||
}, [queryClient]);
|
||||
|
||||
const { signer } = useThirdwebConnectedWalletContext();
|
||||
|
||||
const sdk = useMemo(() => {
|
||||
@@ -89,13 +86,13 @@ export const WrappedThirdwebSDKProvider: React.FC<
|
||||
);
|
||||
|
||||
return (
|
||||
<ThirdwebAuthConfigProvider value={authConfig}>
|
||||
<QueryClientProvider client={queryClientWithDefault}>
|
||||
<QueryClientProviderWithDefault queryClient={queryClient}>
|
||||
<ThirdwebAuthConfigProvider value={authConfig}>
|
||||
<ThirdwebSDKContext.Provider value={ctxValue}>
|
||||
{children}
|
||||
</ThirdwebSDKContext.Provider>
|
||||
</QueryClientProvider>
|
||||
</ThirdwebAuthConfigProvider>
|
||||
</ThirdwebAuthConfigProvider>
|
||||
</QueryClientProviderWithDefault>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -108,8 +105,8 @@ export const WrappedThirdwebSDKProvider: React.FC<
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const ThirdwebSDKProvider: React.FC<
|
||||
React.PropsWithChildren<ThirdwebSDKProviderProps>
|
||||
export const ThirdwebSDKProvider: ComponentWithChildren<
|
||||
ThirdwebSDKProviderProps
|
||||
> = ({ signer, children, ...restProps }) => {
|
||||
return (
|
||||
<ThirdwebConnectedWalletProvider signer={signer}>
|
||||
@@ -1,3 +1,4 @@
|
||||
import { RequiredParam } from "../core/types/shared";
|
||||
import type {
|
||||
AirdropInput,
|
||||
Amount,
|
||||
@@ -14,22 +15,15 @@ import type {
|
||||
Erc20,
|
||||
ClaimOptions,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import type { Edition } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/edition";
|
||||
import type { EditionDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/edition-drop";
|
||||
import type { NFTCollection } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/nft-collection";
|
||||
import type { NFTDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/nft-drop";
|
||||
import type { SignatureDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/signature-drop";
|
||||
import type { TokenDrop } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/prebuilt-implementations/token-drop";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/contracts/smart-contract";
|
||||
import type { Edition } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/edition";
|
||||
import type { EditionDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/edition-drop";
|
||||
import type { NFTCollection } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/nft-collection";
|
||||
import type { NFTDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/nft-drop";
|
||||
import type { SignatureDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/signature-drop";
|
||||
import type { TokenDrop } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/prebuilt-implementations/token-drop";
|
||||
import type { SmartContract } from "@thirdweb-dev/sdk/dist/declarations/src/evm/contracts/smart-contract";
|
||||
import type { BigNumberish } from "ethers";
|
||||
|
||||
/**
|
||||
* Makes a parameter required to be passed, but still allowes it to be undefined.
|
||||
*
|
||||
* @beta
|
||||
*/
|
||||
export type RequiredParam<T> = T | undefined;
|
||||
|
||||
/**
|
||||
* A wallet address.
|
||||
* @beta
|
||||
@@ -1,5 +1,6 @@
|
||||
import { RequiredParam } from "../../core/types/shared";
|
||||
import { SupportedChainId } from "../constants/chain";
|
||||
import { ContractAddress, RequiredParam, WalletAddress } from "../types";
|
||||
import { ContractAddress, WalletAddress } from "../types";
|
||||
import { QueryClient, QueryKey } from "@tanstack/react-query";
|
||||
import type {
|
||||
MarketplaceFilter,
|
||||
@@ -24,7 +25,7 @@ function enforceCachePrefix(input: QueryKey): QueryKey {
|
||||
* @internal
|
||||
*/
|
||||
export function createContractCacheKey(
|
||||
contractAddress: string = constants.AddressZero,
|
||||
contractAddress: string | null = constants.AddressZero,
|
||||
input: QueryKey = [],
|
||||
): QueryKey {
|
||||
return enforceCachePrefix(["contract", contractAddress, ...input]);
|
||||
@@ -1,47 +1,6 @@
|
||||
// providers
|
||||
export * from "./providers/base";
|
||||
export * from "./providers/full";
|
||||
// at the moment we'll re-export everything from the ethereum package (only!)
|
||||
export * from "./evm";
|
||||
|
||||
// contract hooks
|
||||
export * from "./hooks/contracts";
|
||||
// async contract hooks
|
||||
export * from "./hooks/async/contracts";
|
||||
export * from "./hooks/async/nft";
|
||||
export * from "./hooks/async/drop";
|
||||
export * from "./hooks/async/marketplace";
|
||||
export * from "./hooks/async/token";
|
||||
export * from "./hooks/async/claim-conditions";
|
||||
|
||||
export * from "./hooks/async/contract-settings";
|
||||
export * from "./hooks/async/roles";
|
||||
|
||||
// thirdweb hooks (work as long as at least `<ThirdwebSDkProvider>` is used)
|
||||
export * from "./hooks/auth";
|
||||
export * from "./hooks/useSigner";
|
||||
export * from "./hooks/useReadonlySDK";
|
||||
export * from "./hooks/useNetworkMismatch";
|
||||
export * from "./hooks/wallet";
|
||||
|
||||
// require to be inside `<ThirdwebProvider />`
|
||||
export * from "./hooks/wagmi-required/useAccount";
|
||||
export * from "./hooks/wagmi-required/useNetwork";
|
||||
export * from "./hooks/wagmi-required/useDisconnect";
|
||||
export * from "./hooks/wagmi-required/useConnect";
|
||||
export * from "./hooks/connectors/useMetamask";
|
||||
export * from "./hooks/connectors/useWalletConnect";
|
||||
export * from "./hooks/connectors/useWalletLink";
|
||||
export * from "./hooks/connectors/useGnosis";
|
||||
export * from "./hooks/connectors/useMagic";
|
||||
|
||||
// re-exports
|
||||
export { ChainId } from "@thirdweb-dev/sdk";
|
||||
|
||||
// types
|
||||
export * from "./types";
|
||||
export type { ThirdwebAuthConfig } from "./contexts/thirdweb-auth";
|
||||
|
||||
// ui components
|
||||
export * from "./components/MediaRenderer";
|
||||
export * from "./components/NftMedia";
|
||||
export * from "./components/ConnectWallet";
|
||||
export * from "./components/Web3Button";
|
||||
// core exports
|
||||
export { shouldNeverPersistQuery } from "./core/query-utils/query-key";
|
||||
export type { RequiredParam } from "./core/types/shared";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { createSOLProgramQueryKey } from "../../../../core/query-utils/query-key";
|
||||
import { RequiredParam } from "../../../../core/types/shared";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import type { NFTDrop } from "@thirdweb-dev/sdk/solana";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
export function dropTotalClaimedSupplyQuery(program: RequiredParam<NFTDrop>) {
|
||||
return {
|
||||
queryKey: createSOLProgramQueryKey(program, [
|
||||
"totalClaimedSupply",
|
||||
] as const),
|
||||
|
||||
queryFn: async () => {
|
||||
invariant(program, "program is required");
|
||||
|
||||
return await program.totalClaimedSupply();
|
||||
},
|
||||
enabled: !!program,
|
||||
};
|
||||
}
|
||||
|
||||
export function useDropTotalClaimedSupply(program: RequiredParam<NFTDrop>) {
|
||||
return useQuery(dropTotalClaimedSupplyQuery(program));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { createSOLProgramQueryKey } from "../../../../core/query-utils/query-key";
|
||||
import { RequiredParam } from "../../../../core/types/shared";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import type { NFTDrop, NFTMetadataInput } from "@thirdweb-dev/sdk/solana";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
export function useLazyMintNFT(program: RequiredParam<NFTDrop>) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(
|
||||
async (metadata: NFTMetadataInput[]) => {
|
||||
invariant(program, "program is required");
|
||||
return await program.lazyMint(metadata);
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
queryClient.invalidateQueries(createSOLProgramQueryKey(program)),
|
||||
},
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user