thirdweb 5.41.0 → 5.42.0-nightly-e27ebef85bb61342c3de53f85e134cf4a29f787c-20240730000342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/client.js +19 -1
- package/dist/cjs/client/client.js.map +1 -1
- package/dist/cjs/exports/extensions/common.js +3 -1
- package/dist/cjs/exports/extensions/common.js.map +1 -1
- package/dist/cjs/exports/extensions/erc1155.js +2 -1
- package/dist/cjs/exports/extensions/erc1155.js.map +1 -1
- package/dist/cjs/exports/react.js +7 -2
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/utils.js +3 -1
- package/dist/cjs/exports/utils.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +19 -3
- package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/transaction-button-utils.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +127 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +70 -3
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/cjs/storage/download.js +44 -4
- package/dist/cjs/storage/download.js.map +1 -1
- package/dist/cjs/utils/contract/parse-abi-params.js +87 -0
- package/dist/cjs/utils/contract/parse-abi-params.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/index.js +2 -3
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/client/client.js +19 -1
- package/dist/esm/client/client.js.map +1 -1
- package/dist/esm/exports/extensions/common.js +1 -0
- package/dist/esm/exports/extensions/common.js.map +1 -1
- package/dist/esm/exports/extensions/erc1155.js +1 -1
- package/dist/esm/exports/extensions/erc1155.js.map +1 -1
- package/dist/esm/exports/react.js +3 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/utils.js +1 -0
- package/dist/esm/exports/utils.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js +19 -3
- package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/transaction-button-utils.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +124 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +69 -3
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/esm/storage/download.js +44 -4
- package/dist/esm/storage/download.js.map +1 -1
- package/dist/esm/utils/contract/parse-abi-params.js +84 -0
- package/dist/esm/utils/contract/parse-abi-params.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/index.js +2 -3
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/types/client/client.d.ts +19 -1
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/exports/extensions/common.d.ts +1 -0
- package/dist/types/exports/extensions/common.d.ts.map +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +2 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/utils.d.ts +2 -0
- package/dist/types/exports/utils.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts +21 -4
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/transaction-button-utils.d.ts +1 -0
- package/dist/types/react/core/hooks/transaction/transaction-button-utils.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts +63 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts +21 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
- package/dist/types/storage/download.d.ts +43 -3
- package/dist/types/storage/download.d.ts.map +1 -1
- package/dist/types/utils/contract/parse-abi-params.d.ts +29 -0
- package/dist/types/utils/contract/parse-abi-params.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/client.ts +19 -1
- package/src/exports/extensions/common.ts +5 -0
- package/src/exports/extensions/erc1155.ts +1 -0
- package/src/exports/react.ts +7 -0
- package/src/exports/utils.ts +3 -0
- package/src/react/core/hooks/others/useChainQuery.ts +24 -4
- package/src/react/core/hooks/transaction/transaction-button-utils.ts +1 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +2 -2
- package/src/react/web/ui/PayEmbed.tsx +1 -1
- package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/BuyDirectListingButton.test.tsx +27 -0
- package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.tsx +200 -0
- package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +78 -5
- package/src/storage/download.ts +47 -4
- package/src/utils/contract/parse-abi-params.test.ts +160 -0
- package/src/utils/contract/parse-abi-params.ts +90 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/wallet/index.ts +2 -3
@@ -1,4 +1,5 @@
|
|
1
|
-
import type
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
2
|
+
import type { Chain, ChainMetadata } from "../../../../chains/types.js";
|
2
3
|
export declare function useChainName(chain?: Chain): {
|
3
4
|
name: string | undefined;
|
4
5
|
isLoading: boolean;
|
@@ -24,13 +25,29 @@ export declare function useChainExplorers(chain?: Chain): {
|
|
24
25
|
isLoading: boolean;
|
25
26
|
};
|
26
27
|
/**
|
27
|
-
* @
|
28
|
+
* @description Retrieves metadata for a chain such as name, icon, available faucets, block explorers, etc.
|
29
|
+
*
|
30
|
+
* @param chain - Chain to retrieve metadata for, see [defineChain](https://portal.thirdweb.com/references/typescript/v5/defineChain) for how to create a chain from a chain ID.
|
31
|
+
* @returns A React Query result containing the chain metadata, @see {@link ChainMetadata}.
|
32
|
+
*
|
33
|
+
* @example
|
34
|
+
* ```jsx
|
35
|
+
* import { useChainMetadata } from "thirdweb/react";
|
36
|
+
*
|
37
|
+
* const { data: chainMetadata } = useChainMetadata(defineChain(11155111));
|
38
|
+
*
|
39
|
+
* console.log("Name:", chainMetadata.name); // Sepolia
|
40
|
+
* console.log("Faucets:", chainMetadata.faucets); // ["https://thirdweb.com/sepolia/faucet"]
|
41
|
+
* console.log("Explorers:", chainMetadata.explorers); // ["https://sepolia.etherscan.io/"]
|
42
|
+
* ```
|
43
|
+
*
|
44
|
+
* @chain
|
28
45
|
*/
|
29
|
-
export declare function
|
46
|
+
export declare function useChainMetadata(chain?: Chain): UseQueryResult<ChainMetadata>;
|
30
47
|
/**
|
31
48
|
* @param chains - array of `Chains`
|
32
49
|
* @param maxConcurrency - maximum number of concurrent requests to make
|
33
50
|
* @internal
|
34
51
|
*/
|
35
|
-
export declare function useChainsQuery(chains: Chain[], maxConcurrency: number):
|
52
|
+
export declare function useChainsQuery(chains: Chain[], maxConcurrency: number): UseQueryResult<ChainMetadata, Error>[];
|
36
53
|
//# sourceMappingURL=useChainQuery.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useChainQuery.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/others/useChainQuery.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"useChainQuery.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/others/useChainQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAOxE,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK;;;EAqBzC;AAED,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK;;;EAsB5C;AAED,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK;;;EA0B5C;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK;;;EAuB3C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK;;;;;;;EAsB9C;AAUD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,cAAc,CAAC,aAAa,CAAC,CAU7E;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,0CAcrE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-button-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/transaction/transaction-button-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,WAAW,EAAE,MACT,mBAAmB,CAAC,GAAG,CAAC,GAExB,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;IAEtC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,iBAAiB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvE;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC
|
1
|
+
{"version":3,"file":"transaction-button-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/transaction/transaction-button-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,WAAW,EAAE,MACT,mBAAmB,CAAC,GAAG,CAAC,GAExB,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;IAEtC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,iBAAiB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvE;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE,6BAA6B,CAAC;IAEzC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IAEjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAChC,sBAAsB,qBACV,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,aAAa,CAAC,kFAuC5E,CAAC"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import type { Chain } from "../../../../../../chains/types.js";
|
2
|
+
import type { ThirdwebClient } from "../../../../../../client/client.js";
|
3
|
+
import type { TransactionButtonProps } from "../../../../../core/hooks/transaction/transaction-button-utils.js";
|
4
|
+
export type BuyDirectListingButtonProps = Omit<TransactionButtonProps, "transaction"> & {
|
5
|
+
/**
|
6
|
+
* The contract address of the Marketplace v3 contract.
|
7
|
+
*/
|
8
|
+
contractAddress: string;
|
9
|
+
/**
|
10
|
+
* The chain which the Drop contract is deployed on
|
11
|
+
*/
|
12
|
+
chain: Chain;
|
13
|
+
/**
|
14
|
+
* thirdweb Client
|
15
|
+
*/
|
16
|
+
client: ThirdwebClient;
|
17
|
+
/**
|
18
|
+
* ID of the marketplace's DirectListing
|
19
|
+
*/
|
20
|
+
listingId: bigint;
|
21
|
+
/**
|
22
|
+
* Qty to buy (optional)
|
23
|
+
*
|
24
|
+
* - For ERC721 listing: the `quantity` is always hard-coded to 1n - passing this props doesn't do anything
|
25
|
+
*
|
26
|
+
* - For ERC1155 listing: the `quantity` defaults to the quantity of the listing if not specified.
|
27
|
+
*
|
28
|
+
* The component will also throw an error if you pass a `quantity` and it's greater than the listing's quantity
|
29
|
+
*/
|
30
|
+
quantity?: bigint;
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* This button is used with thirdweb Marketplace v3 contract, for buying NFT(s) from a listing.
|
34
|
+
*
|
35
|
+
* Under the hood, it prepares a transaction using the [`buyFromListing` extension](https://portal.thirdweb.com/references/typescript/v5/marketplace/buyFromListing)
|
36
|
+
* and then pass it to a <TransactionButton />
|
37
|
+
*
|
38
|
+
* Since it uses the TransactionButton, it can take in any props that can be passed
|
39
|
+
* to the [`TransactionButton`](https://portal.thirdweb.com/references/typescript/v5/TransactionButton)
|
40
|
+
*
|
41
|
+
*
|
42
|
+
* @param props
|
43
|
+
* @returns <TransactionButton />
|
44
|
+
*
|
45
|
+
* @example
|
46
|
+
* ```tsx
|
47
|
+
* import { BuyDirectListingButton } from "thirdweb/react";
|
48
|
+
*
|
49
|
+
* <BuyDirectListingButton
|
50
|
+
* contractAddress="0x..." // contract address of the marketplace v3
|
51
|
+
* chain={...} // the chain which the marketplace contract is deployed on
|
52
|
+
* client={...} // thirdweb client
|
53
|
+
* listingId={100n} // the listingId or the item you want to buy
|
54
|
+
* quantity={1n} // optional - see the docs to learn more
|
55
|
+
* >
|
56
|
+
* Buy NFT
|
57
|
+
* </BuyDirectListingButton>
|
58
|
+
* ```
|
59
|
+
*
|
60
|
+
* @component
|
61
|
+
*/
|
62
|
+
export declare function BuyDirectListingButton(props: BuyDirectListingButtonProps): import("react/jsx-runtime.js").JSX.Element;
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAKzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mEAAmE,CAAC;AAKhH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,sBAAsB,EACtB,aAAa,CACd,GAAG;IACF;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,8CAuGxE"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { type ThirdwebContract } from "../../../../../../contract/contract.js";
|
2
2
|
import type { PreparedTransaction } from "../../../../../../transaction/prepare-transaction.js";
|
3
|
+
import type { BaseTransactionOptions } from "../../../../../../transaction/types.js";
|
3
4
|
import type { Account } from "../../../../../../wallets/interfaces/wallet.js";
|
4
5
|
import type { ClaimButtonProps, ClaimParams, Erc20ClaimParams, Erc721ClaimParams, Erc1155ClaimParams } from "./types.js";
|
5
6
|
/**
|
@@ -14,6 +15,7 @@ import type { ClaimButtonProps, ClaimParams, Erc20ClaimParams, Erc721ClaimParams
|
|
14
15
|
* @param props
|
15
16
|
* @returns A wrapper for TransactionButton
|
16
17
|
*
|
18
|
+
* @component
|
17
19
|
* @example
|
18
20
|
*
|
19
21
|
* ```tsx
|
@@ -63,9 +65,28 @@ import type { ClaimButtonProps, ClaimParams, Erc20ClaimParams, Erc721ClaimParams
|
|
63
65
|
* Claim now
|
64
66
|
* </ClaimButton>
|
65
67
|
*
|
68
|
+
* // Attach custom Pay metadata
|
69
|
+
* <ClaimButton
|
70
|
+
* payModal={{
|
71
|
+
* metadata: {
|
72
|
+
* name: "Van Gogh Starry Night",
|
73
|
+
* image: "https://unsplash.com/starry-night.png"
|
74
|
+
* }
|
75
|
+
* }}
|
76
|
+
* >...</ClaimButton>
|
77
|
+
*
|
66
78
|
* ```
|
67
79
|
*/
|
68
80
|
export declare function ClaimButton(props: ClaimButtonProps): import("react/jsx-runtime.js").JSX.Element;
|
81
|
+
/**
|
82
|
+
* @internal
|
83
|
+
*/
|
84
|
+
export declare function getPayMetadata(options: BaseTransactionOptions<{
|
85
|
+
tokenId?: bigint;
|
86
|
+
}>): Promise<{
|
87
|
+
name?: string;
|
88
|
+
image?: string;
|
89
|
+
}>;
|
69
90
|
/**
|
70
91
|
* @internal Export for test
|
71
92
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,wCAAwC,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gDAAgD,CAAC;AAK9E,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,8CAqDlD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,sBAAsB,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB5C;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,QAAQ,EACR,OAAO,EACP,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;CAC1B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAc/B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,OAAO,EACP,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,iBAAiB,CAAC;CAChC,8JAuBA;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,QAAQ,EACR,OAAO,EACP,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,kBAAkB,CAAC;CACjC,8JAwBA;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,OAAO,EACP,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,gBAAgB,CAAC;CAC/B,8JA4BA"}
|
@@ -4,18 +4,58 @@ export type DownloadOptions = Prettify<ResolveSchemeOptions & {
|
|
4
4
|
requestTimeoutMs?: number;
|
5
5
|
}>;
|
6
6
|
/**
|
7
|
-
* Downloads a file from the specified URI.
|
7
|
+
* @description Downloads a file from the specified IPFS, Arweave, or HTTP URI.
|
8
|
+
*
|
9
|
+
* `download` will parse the provided URI based on its scheme (ipfs://, ar://, https://) and convert it to a URL to fetch the file from thirdweb's storage service.
|
10
|
+
*
|
8
11
|
* @param options - The download options.
|
9
|
-
* @
|
10
|
-
* @
|
12
|
+
* @param options.client - The Thirdweb client. See [createThirdwebClient](https://portal.thirdweb.com/references/typescript/v5/createThirdwebClient).
|
13
|
+
* @param options.uri - The URI of the file to download. Can be IPFS, Arweave, or HTTP.
|
14
|
+
* @param [options.requestTimeoutMs] - The maximum time in milliseconds to wait for the request to complete. Defaults to 60 seconds (60,000 milliseconds).
|
15
|
+
*
|
16
|
+
* @returns Asynchronously returns the network response from fetching the file.
|
17
|
+
* @throws An error if the URI scheme is invalid or if the request fails.
|
18
|
+
*
|
11
19
|
* @example
|
20
|
+
* Download a file from IPFS:
|
12
21
|
* ```ts
|
13
22
|
* import { download } from "thirdweb/storage";
|
23
|
+
* import { createThirdwebClient } from "@thirdweb-dev/sdk";
|
24
|
+
*
|
25
|
+
* const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
|
26
|
+
*
|
14
27
|
* const file = await download({
|
15
28
|
* client,
|
16
29
|
* uri: "ipfs://Qm...",
|
17
30
|
* });
|
18
31
|
* ```
|
32
|
+
*
|
33
|
+
* Download a file from Arweave:
|
34
|
+
* ```ts
|
35
|
+
* import { download } from "thirdweb/storage";
|
36
|
+
* import { createThirdwebClient } from "@thirdweb-dev/sdk";
|
37
|
+
*
|
38
|
+
* const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
|
39
|
+
*
|
40
|
+
* const file = await download({
|
41
|
+
* client,
|
42
|
+
* uri: "ar://{arweave-transaction-id}",
|
43
|
+
* });
|
44
|
+
* ```
|
45
|
+
*
|
46
|
+
* Download a file from HTTP:
|
47
|
+
* ```ts
|
48
|
+
* import { download } from "thirdweb/storage";
|
49
|
+
* import { createThirdwebClient } from "@thirdweb-dev/sdk";
|
50
|
+
*
|
51
|
+
* const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
|
52
|
+
*
|
53
|
+
* const file = await download({
|
54
|
+
* client,
|
55
|
+
* uri: "https://example.com/file.txt",
|
56
|
+
* });
|
57
|
+
* ```
|
58
|
+
*
|
19
59
|
* @storage
|
20
60
|
*/
|
21
61
|
export declare function download(options: DownloadOptions): Promise<Response>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/storage/download.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,QAAQ,CACpC,oBAAoB,GAAG;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CACF,CAAC;AAEF
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/storage/download.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,QAAQ,CACpC,oBAAoB,GAAG;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,qBAqBtD"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
* Converts an array of parameter values to their respective types based on the provided type array.
|
3
|
+
*
|
4
|
+
* This utility function is particularly useful for ensuring that parameter values are correctly formatted
|
5
|
+
* according to the expected types before they are used in further processing or passed to a Solidity smart contract.
|
6
|
+
*
|
7
|
+
* @param {string[]} constructorParamTypes - An array of type strings indicating the expected types of the values,
|
8
|
+
* following Solidity type conventions (e.g., "address", "uint256", "bool").
|
9
|
+
* @param {unknown[]} constructorParamValues - An array of values to be converted according to the types.
|
10
|
+
* @returns - An array of values converted to their respective types.
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* ```ts
|
14
|
+
* import { parseAbiParams } from "thirdweb/utils";
|
15
|
+
*
|
16
|
+
* const example1 = parseAbiParams(
|
17
|
+
* ["address", "uint256"],
|
18
|
+
* ["0x.....", "1200000"]
|
19
|
+
* ); // result: ["0x......", 1200000n]
|
20
|
+
*
|
21
|
+
* const example2 = parseAbiParams(
|
22
|
+
* ["address", "bool"],
|
23
|
+
* ["0x.....", "true"]
|
24
|
+
* ); // result: ["0x......", true]
|
25
|
+
* ```
|
26
|
+
* @utils
|
27
|
+
*/
|
28
|
+
export declare function parseAbiParams(constructorParamTypes: string[], constructorParamValues: unknown[]): Array<string | bigint | boolean>;
|
29
|
+
//# sourceMappingURL=parse-abi-params.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parse-abi-params.d.ts","sourceRoot":"","sources":["../../../../src/utils/contract/parse-abi-params.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAC5B,qBAAqB,EAAE,MAAM,EAAE,EAC/B,sBAAsB,EAAE,OAAO,EAAE,GAChC,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAwDlC"}
|
package/dist/types/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "5.
|
1
|
+
export declare const version = "5.42.0-nightly-e27ebef85bb61342c3de53f85e134cf4a29f787c-20240730000342";
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,2EAA2E,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/wallet/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAMzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,GACvB,MAAM,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,CAExC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EACH,sBAAsB,CAAC,OAAO,CAAC,GAC/B,sBAAsB,CAAC,iBAAiB,CAAC,EAC7C,aAAa,EACT,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC5B,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAC1C,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/wallet/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAMzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,GACvB,MAAM,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,CAExC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EACH,sBAAsB,CAAC,OAAO,CAAC,GAC/B,sBAAsB,CAAC,iBAAiB,CAAC,EAC7C,aAAa,EACT,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC5B,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAC1C,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CA+B3B;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EACH,0BAA0B,CAAC,OAAO,CAAC,GACnC,0BAA0B,CAAC,iBAAiB,CAAC,EACjD,aAAa,EACT,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC5B,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAC1C,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CA0B3B"}
|
package/package.json
CHANGED
package/src/client/client.ts
CHANGED
@@ -70,15 +70,33 @@ export type ThirdwebClient = {
|
|
70
70
|
} & Readonly<ClientOptions>;
|
71
71
|
|
72
72
|
/**
|
73
|
-
* Creates a Thirdweb client
|
73
|
+
* Creates a Thirdweb client using the provided client ID (client-side) or secret key (server-side).
|
74
|
+
*
|
75
|
+
* Get your client ID and secret key from the Thirdweb dashboard [here](https://thirdweb.com/dashboard/settings/api-keys).
|
76
|
+
* **Never share your secret key with anyone.
|
77
|
+
*
|
78
|
+
* A client is necessary for most functions in the thirdweb SDK. It provides access to thirdweb APIs including built-in RPC, storage, and more.
|
79
|
+
*
|
74
80
|
* @param options - The options for creating the client.
|
81
|
+
* @param [options.clientId] - The client ID to use for thirdweb services.
|
82
|
+
* @param [options.secretKey] - The secret key to use for thirdweb services.
|
75
83
|
* @returns The created Thirdweb client.
|
76
84
|
* @throws An error if neither `clientId` nor `secretKey` is provided.
|
85
|
+
*
|
77
86
|
* @example
|
87
|
+
* Create a client on the client side (client ID):
|
78
88
|
* ```ts
|
79
89
|
* import { createThirdwebClient } from "thirdweb";
|
90
|
+
*
|
80
91
|
* const client = createThirdwebClient({ clientId: "..." });
|
81
92
|
* ```
|
93
|
+
*
|
94
|
+
* Create a client on the server (secret key):
|
95
|
+
* ```ts
|
96
|
+
* import { createThirdwebClient } from "thirdweb";
|
97
|
+
*
|
98
|
+
* const client = createThirdwebClient({ secretKey: "..." });
|
99
|
+
* ```
|
82
100
|
*/
|
83
101
|
export function createThirdwebClient(
|
84
102
|
options: CreateThirdwebClientOptions,
|
@@ -21,6 +21,11 @@ export {
|
|
21
21
|
type SetContractMetadataParams,
|
22
22
|
} from "../../extensions/common/write/setContractMetadata.js";
|
23
23
|
|
24
|
+
export {
|
25
|
+
multicall,
|
26
|
+
type MulticallParams,
|
27
|
+
} from "../../extensions/common/__generated__/IMulticall/write/multicall.js";
|
28
|
+
|
24
29
|
// events
|
25
30
|
|
26
31
|
export {
|
@@ -54,6 +54,7 @@ export {
|
|
54
54
|
} from "../../extensions/erc1155/__generated__/IERC1155/write/setApprovalForAll.js";
|
55
55
|
export {
|
56
56
|
safeTransferFrom,
|
57
|
+
encodeSafeTransferFrom,
|
57
58
|
type SafeTransferFromParams,
|
58
59
|
} from "../../extensions/erc1155/__generated__/IERC1155/write/safeTransferFrom.js";
|
59
60
|
export {
|
package/src/exports/react.ts
CHANGED
@@ -56,6 +56,9 @@ export { useSwitchActiveWalletChain } from "../react/core/hooks/wallets/useSwitc
|
|
56
56
|
export { useCallsStatus } from "../react/core/hooks/wallets/useCallsStatus.js";
|
57
57
|
export { useWalletBalance } from "../react/core/hooks/others/useWalletBalance.js";
|
58
58
|
|
59
|
+
// chain hooks
|
60
|
+
export { useChainMetadata } from "../react/core/hooks/others/useChainQuery.js";
|
61
|
+
|
59
62
|
export type { ConnectManagerOptions } from "../wallets/manager/index.js";
|
60
63
|
|
61
64
|
// contract
|
@@ -158,5 +161,9 @@ export { useEnsName, useEnsAvatar } from "../react/core/utils/wallet.js";
|
|
158
161
|
*/
|
159
162
|
export { ClaimButton } from "../react/web/ui/prebuilt/thirdweb/ClaimButton/index.js";
|
160
163
|
export type { ClaimButtonProps } from "../react/web/ui/prebuilt/thirdweb/ClaimButton/types.js";
|
164
|
+
export {
|
165
|
+
BuyDirectListingButton,
|
166
|
+
type BuyDirectListingButtonProps,
|
167
|
+
} from "../react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js";
|
161
168
|
|
162
169
|
export { useConnectionManager } from "../react/core/providers/connection-manager.js";
|
package/src/exports/utils.ts
CHANGED
@@ -21,6 +21,7 @@ export { getSaltHash } from "../utils/any-evm/get-salt-hash.js";
|
|
21
21
|
export { isEIP155Enforced } from "../utils/any-evm/is-eip155-enforced.js";
|
22
22
|
export { keccakId } from "../utils/any-evm/keccak-id.js";
|
23
23
|
export { getKeylessTransaction } from "../utils/any-evm/keyless-transaction.js";
|
24
|
+
export type { ExtendedMetadata } from "../utils/any-evm/deploy-metadata.js";
|
24
25
|
|
25
26
|
//signatures
|
26
27
|
export {
|
@@ -171,3 +172,5 @@ export {
|
|
171
172
|
} from "../utils/extensions/drops/get-claim-params.js";
|
172
173
|
|
173
174
|
export type { NFTMetadata, NFTInput } from "../utils/nft/parseNft.js";
|
175
|
+
|
176
|
+
export { parseAbiParams } from "../utils/contract/parse-abi-params.js";
|
@@ -1,6 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
type UseQueryResult,
|
3
|
+
useQueries,
|
4
|
+
useQuery,
|
5
|
+
} from "@tanstack/react-query";
|
2
6
|
import { useMemo } from "react";
|
3
|
-
import type { Chain } from "../../../../chains/types.js";
|
7
|
+
import type { Chain, ChainMetadata } from "../../../../chains/types.js";
|
4
8
|
import {
|
5
9
|
convertApiChainToChain,
|
6
10
|
getChainMetadata,
|
@@ -140,9 +144,25 @@ function getQueryOptions(chain?: Chain) {
|
|
140
144
|
}
|
141
145
|
|
142
146
|
/**
|
143
|
-
* @
|
147
|
+
* @description Retrieves metadata for a chain such as name, icon, available faucets, block explorers, etc.
|
148
|
+
*
|
149
|
+
* @param chain - Chain to retrieve metadata for, see [defineChain](https://portal.thirdweb.com/references/typescript/v5/defineChain) for how to create a chain from a chain ID.
|
150
|
+
* @returns A React Query result containing the chain metadata, @see {@link ChainMetadata}.
|
151
|
+
*
|
152
|
+
* @example
|
153
|
+
* ```jsx
|
154
|
+
* import { useChainMetadata } from "thirdweb/react";
|
155
|
+
*
|
156
|
+
* const { data: chainMetadata } = useChainMetadata(defineChain(11155111));
|
157
|
+
*
|
158
|
+
* console.log("Name:", chainMetadata.name); // Sepolia
|
159
|
+
* console.log("Faucets:", chainMetadata.faucets); // ["https://thirdweb.com/sepolia/faucet"]
|
160
|
+
* console.log("Explorers:", chainMetadata.explorers); // ["https://sepolia.etherscan.io/"]
|
161
|
+
* ```
|
162
|
+
*
|
163
|
+
* @chain
|
144
164
|
*/
|
145
|
-
export function
|
165
|
+
export function useChainMetadata(chain?: Chain): UseQueryResult<ChainMetadata> {
|
146
166
|
return useQuery({
|
147
167
|
...getQueryOptions(chain),
|
148
168
|
queryFn: async () => {
|
@@ -11,7 +11,7 @@ import type { Account } from "../../../../../../wallets/interfaces/wallet.js";
|
|
11
11
|
import { useCustomTheme } from "../../../../../core/design-system/CustomThemeProvider.js";
|
12
12
|
import { iconSize, spacing } from "../../../../../core/design-system/index.js";
|
13
13
|
import type { PayUIOptions } from "../../../../../core/hooks/connection/ConnectButtonProps.js";
|
14
|
-
import {
|
14
|
+
import { useChainMetadata } from "../../../../../core/hooks/others/useChainQuery.js";
|
15
15
|
import { useActiveWallet } from "../../../../../core/hooks/wallets/useActiveWallet.js";
|
16
16
|
import type { TokenInfo } from "../../../../../core/utils/defaultTokens.js";
|
17
17
|
import { useEnsName } from "../../../../../core/utils/wallet.js";
|
@@ -52,7 +52,7 @@ export function DirectPaymentModeScreen(props: {
|
|
52
52
|
const activeWallet = useActiveWallet();
|
53
53
|
const metadata = payUiOptions.metadata;
|
54
54
|
const paymentInfo = payUiOptions.paymentInfo;
|
55
|
-
const { data: chainData } =
|
55
|
+
const { data: chainData } = useChainMetadata(paymentInfo.chain);
|
56
56
|
const { data: sellerEns } = useEnsName({
|
57
57
|
client,
|
58
58
|
address: paymentInfo.sellerAddress,
|
@@ -7,7 +7,7 @@ import type { Account } from "../../../../../../wallets/interfaces/wallet.js";
|
|
7
7
|
import { useCustomTheme } from "../../../../../core/design-system/CustomThemeProvider.js";
|
8
8
|
import { iconSize, spacing } from "../../../../../core/design-system/index.js";
|
9
9
|
import type { PayUIOptions } from "../../../../../core/hooks/connection/ConnectButtonProps.js";
|
10
|
-
import {
|
10
|
+
import { useChainMetadata } from "../../../../../core/hooks/others/useChainQuery.js";
|
11
11
|
import { useActiveWallet } from "../../../../../core/hooks/wallets/useActiveWallet.js";
|
12
12
|
import { hasSponsoredTransactionsEnabled } from "../../../../../core/utils/wallet.js";
|
13
13
|
import { LoadingScreen } from "../../../../wallets/shared/LoadingScreen.js";
|
@@ -44,7 +44,7 @@ export function TransactionModeScreen(props: {
|
|
44
44
|
supportedDestinations,
|
45
45
|
onContinue,
|
46
46
|
} = props;
|
47
|
-
const { data: chainData } =
|
47
|
+
const { data: chainData } = useChainMetadata(payUiOptions.transaction.chain);
|
48
48
|
const metadata = payUiOptions.metadata;
|
49
49
|
const { data: transactionCostAndData } = useTransactionCostAndData({
|
50
50
|
transaction: payUiOptions.transaction,
|
package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/BuyDirectListingButton.test.tsx
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
2
|
+
import { render, screen } from "~test/react-render.js";
|
3
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
+
import { sepolia } from "../../../../../../chains/chain-definitions/sepolia.js";
|
5
|
+
import { BuyDirectListingButton } from "./index.js";
|
6
|
+
|
7
|
+
const client = TEST_CLIENT;
|
8
|
+
|
9
|
+
// marketplace v3 on sepolia
|
10
|
+
const marketplaceAddress = "0xe0eFD6fb388405b67b3E9FaFc02649c70E749f03";
|
11
|
+
|
12
|
+
describe.runIf(process.env.TW_SECRET_KEY)("BuyDirectListingButton", () => {
|
13
|
+
it("should render", () => {
|
14
|
+
render(
|
15
|
+
<BuyDirectListingButton
|
16
|
+
client={client}
|
17
|
+
chain={sepolia}
|
18
|
+
contractAddress={marketplaceAddress}
|
19
|
+
listingId={1n}
|
20
|
+
>
|
21
|
+
Buy NFT
|
22
|
+
</BuyDirectListingButton>,
|
23
|
+
);
|
24
|
+
expect(screen.queryByText("Buy NFT")).toBeInTheDocument();
|
25
|
+
expect(screen.getByRole("button")).toBeInTheDocument();
|
26
|
+
});
|
27
|
+
});
|