thirdweb 5.95.0-nightly-64bd603301b3067b6a69a29f66a28dee7ffa38f5-20250416000349 → 5.95.0-nightly-e7b01108037ebef07fba95f888be1905c8fab5df-20250417000348
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/chains/utils.js +2 -4
- package/dist/cjs/chains/utils.js.map +1 -1
- package/dist/cjs/event/actions/get-events.js +4 -10
- package/dist/cjs/event/actions/get-events.js.map +1 -1
- package/dist/cjs/extensions/erc1155/read/getNFT.js +2 -0
- package/dist/cjs/extensions/erc1155/read/getNFT.js.map +1 -1
- package/dist/cjs/extensions/erc20/read/getBalance.js +2 -0
- package/dist/cjs/extensions/erc20/read/getBalance.js.map +1 -1
- package/dist/cjs/extensions/erc721/read/getNFT.js +42 -0
- package/dist/cjs/extensions/erc721/read/getNFT.js.map +1 -1
- package/dist/cjs/extensions/erc721/read/getNFTs.js +44 -17
- package/dist/cjs/extensions/erc721/read/getNFTs.js.map +1 -1
- package/dist/cjs/extensions/erc721/read/getOwnedNFTs.js +46 -0
- package/dist/cjs/extensions/erc721/read/getOwnedNFTs.js.map +1 -1
- package/dist/cjs/extensions/marketplace/direct-listings/utils.js +7 -4
- package/dist/cjs/extensions/marketplace/direct-listings/utils.js.map +1 -1
- package/dist/cjs/extensions/marketplace/english-auctions/utils.js +9 -4
- package/dist/cjs/extensions/marketplace/english-auctions/utils.js.map +1 -1
- package/dist/cjs/extensions/marketplace/offers/utils.js +7 -4
- package/dist/cjs/extensions/marketplace/offers/utils.js.map +1 -1
- package/dist/cjs/insight/common.js +18 -0
- package/dist/cjs/insight/common.js.map +1 -0
- package/dist/cjs/insight/get-events.js +12 -9
- package/dist/cjs/insight/get-events.js.map +1 -1
- package/dist/cjs/insight/get-nfts.js +158 -16
- package/dist/cjs/insight/get-nfts.js.map +1 -1
- package/dist/cjs/insight/get-tokens.js +34 -14
- package/dist/cjs/insight/get-tokens.js.map +1 -1
- package/dist/cjs/insight/get-transactions.js +17 -12
- package/dist/cjs/insight/get-transactions.js.map +1 -1
- package/dist/cjs/insight/index.js +3 -1
- package/dist/cjs/insight/index.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js +6 -43
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js +3 -9
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
- package/dist/cjs/react/web/ui/components/TokenIcon.js +3 -1
- package/dist/cjs/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/utils.js +7 -2
- package/dist/cjs/react/web/ui/prebuilt/NFT/utils.js.map +1 -1
- package/dist/cjs/social/profiles.js +3 -8
- package/dist/cjs/social/profiles.js.map +1 -1
- package/dist/cjs/storage/download.js +2 -2
- package/dist/cjs/storage/download.js.map +1 -1
- package/dist/cjs/storage/unpin.js +2 -2
- package/dist/cjs/storage/unpin.js.map +1 -1
- package/dist/cjs/storage/upload/web-node.js +0 -1
- package/dist/cjs/storage/upload/web-node.js.map +1 -1
- package/dist/cjs/utils/nft/parseNft.js +4 -0
- package/dist/cjs/utils/nft/parseNft.js.map +1 -1
- package/dist/cjs/utils/signatures/resolve-signature.js +0 -2
- package/dist/cjs/utils/signatures/resolve-signature.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/smart/lib/calls.js +2 -2
- package/dist/cjs/wallets/smart/lib/calls.js.map +1 -1
- package/dist/cjs/wallets/utils/getWalletBalance.js +3 -0
- package/dist/cjs/wallets/utils/getWalletBalance.js.map +1 -1
- package/dist/esm/chains/utils.js +2 -4
- package/dist/esm/chains/utils.js.map +1 -1
- package/dist/esm/event/actions/get-events.js +1 -7
- package/dist/esm/event/actions/get-events.js.map +1 -1
- package/dist/esm/extensions/erc1155/read/getNFT.js +2 -0
- package/dist/esm/extensions/erc1155/read/getNFT.js.map +1 -1
- package/dist/esm/extensions/erc20/read/getBalance.js +2 -0
- package/dist/esm/extensions/erc20/read/getBalance.js.map +1 -1
- package/dist/esm/extensions/erc721/read/getNFT.js +42 -0
- package/dist/esm/extensions/erc721/read/getNFT.js.map +1 -1
- package/dist/esm/extensions/erc721/read/getNFTs.js +44 -17
- package/dist/esm/extensions/erc721/read/getNFTs.js.map +1 -1
- package/dist/esm/extensions/erc721/read/getOwnedNFTs.js +46 -0
- package/dist/esm/extensions/erc721/read/getOwnedNFTs.js.map +1 -1
- package/dist/esm/extensions/marketplace/direct-listings/utils.js +7 -4
- package/dist/esm/extensions/marketplace/direct-listings/utils.js.map +1 -1
- package/dist/esm/extensions/marketplace/english-auctions/utils.js +9 -4
- package/dist/esm/extensions/marketplace/english-auctions/utils.js.map +1 -1
- package/dist/esm/extensions/marketplace/offers/utils.js +7 -4
- package/dist/esm/extensions/marketplace/offers/utils.js.map +1 -1
- package/dist/esm/insight/common.js +15 -0
- package/dist/esm/insight/common.js.map +1 -0
- package/dist/esm/insight/get-events.js +8 -5
- package/dist/esm/insight/get-events.js.map +1 -1
- package/dist/esm/insight/get-nfts.js +153 -13
- package/dist/esm/insight/get-nfts.js.map +1 -1
- package/dist/esm/insight/get-tokens.js +30 -10
- package/dist/esm/insight/get-tokens.js.map +1 -1
- package/dist/esm/insight/get-transactions.js +13 -8
- package/dist/esm/insight/get-transactions.js.map +1 -1
- package/dist/esm/insight/index.js +1 -1
- package/dist/esm/insight/index.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js +6 -43
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js +3 -9
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
- package/dist/esm/react/web/ui/components/TokenIcon.js +3 -1
- package/dist/esm/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/utils.js +7 -2
- package/dist/esm/react/web/ui/prebuilt/NFT/utils.js.map +1 -1
- package/dist/esm/social/profiles.js +3 -8
- package/dist/esm/social/profiles.js.map +1 -1
- package/dist/esm/storage/download.js +2 -2
- package/dist/esm/storage/download.js.map +1 -1
- package/dist/esm/storage/unpin.js +2 -2
- package/dist/esm/storage/unpin.js.map +1 -1
- package/dist/esm/storage/upload/web-node.js +0 -1
- package/dist/esm/storage/upload/web-node.js.map +1 -1
- package/dist/esm/utils/nft/parseNft.js +4 -0
- package/dist/esm/utils/nft/parseNft.js.map +1 -1
- package/dist/esm/utils/signatures/resolve-signature.js +0 -2
- package/dist/esm/utils/signatures/resolve-signature.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/smart/lib/calls.js +2 -2
- package/dist/esm/wallets/smart/lib/calls.js.map +1 -1
- package/dist/esm/wallets/utils/getWalletBalance.js +3 -0
- package/dist/esm/wallets/utils/getWalletBalance.js.map +1 -1
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/event/actions/get-events.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/read/getNFT.d.ts.map +1 -1
- package/dist/types/extensions/erc20/read/getBalance.d.ts +2 -0
- package/dist/types/extensions/erc20/read/getBalance.d.ts.map +1 -1
- package/dist/types/extensions/erc721/read/getNFT.d.ts +5 -0
- package/dist/types/extensions/erc721/read/getNFT.d.ts.map +1 -1
- package/dist/types/extensions/erc721/read/getNFTs.d.ts +5 -0
- package/dist/types/extensions/erc721/read/getNFTs.d.ts.map +1 -1
- package/dist/types/extensions/erc721/read/getOwnedNFTs.d.ts +3 -1
- package/dist/types/extensions/erc721/read/getOwnedNFTs.d.ts.map +1 -1
- package/dist/types/extensions/marketplace/direct-listings/utils.d.ts.map +1 -1
- package/dist/types/extensions/marketplace/english-auctions/utils.d.ts.map +1 -1
- package/dist/types/extensions/marketplace/offers/utils.d.ts.map +1 -1
- package/dist/types/insight/common.d.ts +3 -0
- package/dist/types/insight/common.d.ts.map +1 -0
- package/dist/types/insight/get-events.d.ts +2 -2
- package/dist/types/insight/get-events.d.ts.map +1 -1
- package/dist/types/insight/get-nfts.d.ts +52 -4
- package/dist/types/insight/get-nfts.d.ts.map +1 -1
- package/dist/types/insight/get-tokens.d.ts +3 -3
- package/dist/types/insight/get-tokens.d.ts.map +1 -1
- package/dist/types/insight/get-transactions.d.ts +1 -1
- package/dist/types/insight/get-transactions.d.ts.map +1 -1
- package/dist/types/insight/index.d.ts +2 -2
- package/dist/types/insight/index.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewTokens.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/TokenIcon.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/utils.d.ts.map +1 -1
- package/dist/types/social/profiles.d.ts.map +1 -1
- package/dist/types/storage/download.d.ts.map +1 -1
- package/dist/types/storage/unpin.d.ts.map +1 -1
- package/dist/types/storage/upload/web-node.d.ts.map +1 -1
- package/dist/types/utils/nft/parseNft.d.ts +8 -0
- package/dist/types/utils/nft/parseNft.d.ts.map +1 -1
- package/dist/types/utils/signatures/resolve-signature.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/utils/getWalletBalance.d.ts +2 -7
- package/dist/types/wallets/utils/getWalletBalance.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/chains/utils.ts +6 -4
- package/src/event/actions/get-events.ts +1 -13
- package/src/extensions/erc1155/read/getNFT.test.ts +2 -0
- package/src/extensions/erc1155/read/getNFT.ts +2 -0
- package/src/extensions/erc20/drop20.test.ts +48 -132
- package/src/extensions/erc20/read/getBalance.test.ts +5 -9
- package/src/extensions/erc20/read/getBalance.ts +4 -0
- package/src/extensions/erc721/read/getNFT.test.ts +108 -0
- package/src/extensions/erc721/read/getNFT.ts +55 -1
- package/src/extensions/erc721/read/getNFTs.test.ts +219 -13
- package/src/extensions/erc721/read/getNFTs.ts +59 -20
- package/src/extensions/erc721/read/getOwnedNFTs.test.ts +27 -2
- package/src/extensions/erc721/read/getOwnedNFTs.ts +61 -1
- package/src/extensions/erc721/token721.test.ts +2 -0
- package/src/extensions/marketplace/direct-listings/direct-listings.test.ts +2 -18
- package/src/extensions/marketplace/direct-listings/utils.ts +7 -4
- package/src/extensions/marketplace/english-auctions/utils.ts +9 -4
- package/src/extensions/marketplace/offers/utils.ts +7 -4
- package/src/insight/common.ts +24 -0
- package/src/insight/get-events.ts +23 -9
- package/src/insight/get-nfts.ts +251 -20
- package/src/insight/get-tokens.ts +51 -23
- package/src/insight/get-transactions.ts +26 -16
- package/src/insight/index.ts +6 -2
- package/src/react/web/ui/ConnectWallet/screens/ViewNFTs.tsx +43 -68
- package/src/react/web/ui/ConnectWallet/screens/ViewTokens.tsx +4 -14
- package/src/react/web/ui/components/TokenIcon.tsx +12 -3
- package/src/react/web/ui/prebuilt/NFT/utils.test.ts +2 -64
- package/src/react/web/ui/prebuilt/NFT/utils.ts +7 -2
- package/src/social/profiles.ts +5 -9
- package/src/storage/download.ts +4 -2
- package/src/storage/unpin.ts +4 -2
- package/src/storage/upload/web-node.ts +0 -1
- package/src/utils/nft/parseNft.test.ts +8 -0
- package/src/utils/nft/parseNft.ts +12 -0
- package/src/utils/signatures/resolve-signature.ts +0 -2
- package/src/version.ts +1 -1
- package/src/wallets/smart/lib/calls.ts +2 -2
- package/src/wallets/utils/getWalletBalance.ts +5 -7
@@ -6,16 +6,225 @@ import {
|
|
6
6
|
import { getNFTs } from "./getNFTs.js";
|
7
7
|
|
8
8
|
describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
|
9
|
-
it("works for a contract with
|
9
|
+
it("works for a contract with indexer", async () => {
|
10
10
|
const nfts = await getNFTs({
|
11
11
|
contract: DOODLES_CONTRACT,
|
12
12
|
count: 5,
|
13
13
|
});
|
14
14
|
|
15
|
+
expect(nfts.length).toBe(5);
|
16
|
+
// TODO (insight): re-enable once insight fixes the client id caching issue
|
17
|
+
// expect(nfts).toMatchInlineSnapshot(`
|
18
|
+
// [
|
19
|
+
// {
|
20
|
+
// "chainId": 1,
|
21
|
+
// "id": 0n,
|
22
|
+
// "metadata": {
|
23
|
+
// "attributes": [
|
24
|
+
// {
|
25
|
+
// "trait_type": "face",
|
26
|
+
// "value": "mustache",
|
27
|
+
// },
|
28
|
+
// {
|
29
|
+
// "trait_type": "hair",
|
30
|
+
// "value": "purple long",
|
31
|
+
// },
|
32
|
+
// {
|
33
|
+
// "trait_type": "body",
|
34
|
+
// "value": "blue and yellow jacket",
|
35
|
+
// },
|
36
|
+
// {
|
37
|
+
// "trait_type": "background",
|
38
|
+
// "value": "green",
|
39
|
+
// },
|
40
|
+
// {
|
41
|
+
// "trait_type": "head",
|
42
|
+
// "value": "tan",
|
43
|
+
// },
|
44
|
+
// ],
|
45
|
+
// "description": "A community-driven collectibles project featuring art by Burnt Toast. Doodles come in a joyful range of colors, traits and sizes with a collection size of 10,000. Each Doodle allows its owner to vote for experiences and activations paid for by the Doodles Community Treasury. Burnt Toast is the working alias for Scott Martin, a Canadian–based illustrator, designer, animator and muralist.",
|
46
|
+
// "image": "https://${clientId}.ipfscdn.io/ipfs/QmUEfFfwAh4wyB5UfHCVPUxis4j4Q4kJXtm5x5p3g1fVUn",
|
47
|
+
// "image_url": "https://${clientId}.ipfscdn.io/ipfs/QmUEfFfwAh4wyB5UfHCVPUxis4j4Q4kJXtm5x5p3g1fVUn",
|
48
|
+
// "name": "Doodle #0",
|
49
|
+
// "uri": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/0",
|
50
|
+
// },
|
51
|
+
// "owner": null,
|
52
|
+
// "tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
53
|
+
// "tokenURI": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/0",
|
54
|
+
// "type": "ERC721",
|
55
|
+
// },
|
56
|
+
// {
|
57
|
+
// "chainId": 1,
|
58
|
+
// "id": 1n,
|
59
|
+
// "metadata": {
|
60
|
+
// "attributes": [
|
61
|
+
// {
|
62
|
+
// "trait_type": "face",
|
63
|
+
// "value": "holographic beard",
|
64
|
+
// },
|
65
|
+
// {
|
66
|
+
// "trait_type": "hair",
|
67
|
+
// "value": "white bucket cap",
|
68
|
+
// },
|
69
|
+
// {
|
70
|
+
// "trait_type": "body",
|
71
|
+
// "value": "purple sweater with satchel",
|
72
|
+
// },
|
73
|
+
// {
|
74
|
+
// "trait_type": "background",
|
75
|
+
// "value": "grey",
|
76
|
+
// },
|
77
|
+
// {
|
78
|
+
// "trait_type": "head",
|
79
|
+
// "value": "gradient 2",
|
80
|
+
// },
|
81
|
+
// ],
|
82
|
+
// "description": "A community-driven collectibles project featuring art by Burnt Toast. Doodles come in a joyful range of colors, traits and sizes with a collection size of 10,000. Each Doodle allows its owner to vote for experiences and activations paid for by the Doodles Community Treasury. Burnt Toast is the working alias for Scott Martin, a Canadian–based illustrator, designer, animator and muralist.",
|
83
|
+
// "image": "https://${clientId}.ipfscdn.io/ipfs/QmTDxnzcvj2p3xBrKcGv1wxoyhAn2yzCQnZZ9LmFjReuH9",
|
84
|
+
// "image_url": "https://${clientId}.ipfscdn.io/ipfs/QmTDxnzcvj2p3xBrKcGv1wxoyhAn2yzCQnZZ9LmFjReuH9",
|
85
|
+
// "name": "Doodle #1",
|
86
|
+
// "uri": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
|
87
|
+
// },
|
88
|
+
// "owner": null,
|
89
|
+
// "tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
90
|
+
// "tokenURI": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
|
91
|
+
// "type": "ERC721",
|
92
|
+
// },
|
93
|
+
// {
|
94
|
+
// "chainId": 1,
|
95
|
+
// "id": 2n,
|
96
|
+
// "metadata": {
|
97
|
+
// "attributes": [
|
98
|
+
// {
|
99
|
+
// "trait_type": "face",
|
100
|
+
// "value": "designer glasses",
|
101
|
+
// },
|
102
|
+
// {
|
103
|
+
// "trait_type": "hair",
|
104
|
+
// "value": "poopie",
|
105
|
+
// },
|
106
|
+
// {
|
107
|
+
// "trait_type": "body",
|
108
|
+
// "value": "blue fleece",
|
109
|
+
// },
|
110
|
+
// {
|
111
|
+
// "trait_type": "background",
|
112
|
+
// "value": "yellow",
|
113
|
+
// },
|
114
|
+
// {
|
115
|
+
// "trait_type": "head",
|
116
|
+
// "value": "purple",
|
117
|
+
// },
|
118
|
+
// ],
|
119
|
+
// "description": "A community-driven collectibles project featuring art by Burnt Toast. Doodles come in a joyful range of colors, traits and sizes with a collection size of 10,000. Each Doodle allows its owner to vote for experiences and activations paid for by the Doodles Community Treasury. Burnt Toast is the working alias for Scott Martin, a Canadian–based illustrator, designer, animator and muralist.",
|
120
|
+
// "image": "https://${clientId}.ipfscdn.io/ipfs/QmbvZ2hbF3nEq5r3ijMEiSGssAmJvtyFwiejTAGHv74LR5",
|
121
|
+
// "image_url": "https://${clientId}.ipfscdn.io/ipfs/QmbvZ2hbF3nEq5r3ijMEiSGssAmJvtyFwiejTAGHv74LR5",
|
122
|
+
// "name": "Doodle #2",
|
123
|
+
// "uri": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/2",
|
124
|
+
// },
|
125
|
+
// "owner": null,
|
126
|
+
// "tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
127
|
+
// "tokenURI": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/2",
|
128
|
+
// "type": "ERC721",
|
129
|
+
// },
|
130
|
+
// {
|
131
|
+
// "chainId": 1,
|
132
|
+
// "id": 3n,
|
133
|
+
// "metadata": {
|
134
|
+
// "attributes": [
|
135
|
+
// {
|
136
|
+
// "trait_type": "face",
|
137
|
+
// "value": "designer glasses",
|
138
|
+
// },
|
139
|
+
// {
|
140
|
+
// "trait_type": "hair",
|
141
|
+
// "value": "holographic mohawk",
|
142
|
+
// },
|
143
|
+
// {
|
144
|
+
// "trait_type": "body",
|
145
|
+
// "value": "pink fleece",
|
146
|
+
// },
|
147
|
+
// {
|
148
|
+
// "trait_type": "background",
|
149
|
+
// "value": "gradient 1",
|
150
|
+
// },
|
151
|
+
// {
|
152
|
+
// "trait_type": "head",
|
153
|
+
// "value": "pale",
|
154
|
+
// },
|
155
|
+
// ],
|
156
|
+
// "description": "A community-driven collectibles project featuring art by Burnt Toast. Doodles come in a joyful range of colors, traits and sizes with a collection size of 10,000. Each Doodle allows its owner to vote for experiences and activations paid for by the Doodles Community Treasury. Burnt Toast is the working alias for Scott Martin, a Canadian–based illustrator, designer, animator and muralist.",
|
157
|
+
// "image": "https://${clientId}.ipfscdn.io/ipfs/QmVpwaCqLut3wqwB5KSQr2fGnbLuJt5e3LhNvzvcisewZB",
|
158
|
+
// "image_url": "https://${clientId}.ipfscdn.io/ipfs/QmVpwaCqLut3wqwB5KSQr2fGnbLuJt5e3LhNvzvcisewZB",
|
159
|
+
// "name": "Doodle #3",
|
160
|
+
// "uri": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/3",
|
161
|
+
// },
|
162
|
+
// "owner": null,
|
163
|
+
// "tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
164
|
+
// "tokenURI": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/3",
|
165
|
+
// "type": "ERC721",
|
166
|
+
// },
|
167
|
+
// {
|
168
|
+
// "chainId": 1,
|
169
|
+
// "id": 4n,
|
170
|
+
// "metadata": {
|
171
|
+
// "attributes": [
|
172
|
+
// {
|
173
|
+
// "trait_type": "face",
|
174
|
+
// "value": "happy",
|
175
|
+
// },
|
176
|
+
// {
|
177
|
+
// "trait_type": "hair",
|
178
|
+
// "value": "purple long",
|
179
|
+
// },
|
180
|
+
// {
|
181
|
+
// "trait_type": "body",
|
182
|
+
// "value": "spotted hoodie",
|
183
|
+
// },
|
184
|
+
// {
|
185
|
+
// "trait_type": "background",
|
186
|
+
// "value": "gradient 2",
|
187
|
+
// },
|
188
|
+
// {
|
189
|
+
// "trait_type": "head",
|
190
|
+
// "value": "purple",
|
191
|
+
// },
|
192
|
+
// ],
|
193
|
+
// "description": "A community-driven collectibles project featuring art by Burnt Toast. Doodles come in a joyful range of colors, traits and sizes with a collection size of 10,000. Each Doodle allows its owner to vote for experiences and activations paid for by the Doodles Community Treasury. Burnt Toast is the working alias for Scott Martin, a Canadian–based illustrator, designer, animator and muralist.",
|
194
|
+
// "image": "https://${clientId}.ipfscdn.io/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm",
|
195
|
+
// "image_url": "https://${clientId}.ipfscdn.io/ipfs/QmcyuFVLbfBmSeQ9ynu4dk67r97nB1abEekotuVuRGWedm",
|
196
|
+
// "name": "Doodle #4",
|
197
|
+
// "uri": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/4",
|
198
|
+
// },
|
199
|
+
// "owner": null,
|
200
|
+
// "tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
201
|
+
// "tokenURI": "https://${clientId}.ipfscdn.io/ipfs/QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/4",
|
202
|
+
// "type": "ERC721",
|
203
|
+
// },
|
204
|
+
// ]
|
205
|
+
// `);
|
206
|
+
});
|
207
|
+
|
208
|
+
it("should throw error if totalSupply and nextTokenIdToMint are not supported", async () => {
|
209
|
+
await expect(
|
210
|
+
getNFTs({ contract: UNISWAPV3_FACTORY_CONTRACT, useIndexer: false }),
|
211
|
+
).rejects.toThrowError(
|
212
|
+
"Contract requires either `nextTokenIdToMint` or `totalSupply` function available to determine the next token ID to mint",
|
213
|
+
);
|
214
|
+
});
|
215
|
+
|
216
|
+
it("works for a contract with 0 indexed NFTs using RPC", async () => {
|
217
|
+
const nfts = await getNFTs({
|
218
|
+
contract: DOODLES_CONTRACT,
|
219
|
+
count: 5,
|
220
|
+
useIndexer: false,
|
221
|
+
});
|
222
|
+
|
15
223
|
expect(nfts.length).toBe(5);
|
16
224
|
expect(nfts).toMatchInlineSnapshot(`
|
17
225
|
[
|
18
226
|
{
|
227
|
+
"chainId": 1,
|
19
228
|
"id": 0n,
|
20
229
|
"metadata": {
|
21
230
|
"attributes": [
|
@@ -45,10 +254,12 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
|
|
45
254
|
"name": "Doodle #0",
|
46
255
|
},
|
47
256
|
"owner": null,
|
257
|
+
"tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
48
258
|
"tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/0",
|
49
259
|
"type": "ERC721",
|
50
260
|
},
|
51
261
|
{
|
262
|
+
"chainId": 1,
|
52
263
|
"id": 1n,
|
53
264
|
"metadata": {
|
54
265
|
"attributes": [
|
@@ -78,10 +289,12 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
|
|
78
289
|
"name": "Doodle #1",
|
79
290
|
},
|
80
291
|
"owner": null,
|
292
|
+
"tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
81
293
|
"tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
|
82
294
|
"type": "ERC721",
|
83
295
|
},
|
84
296
|
{
|
297
|
+
"chainId": 1,
|
85
298
|
"id": 2n,
|
86
299
|
"metadata": {
|
87
300
|
"attributes": [
|
@@ -111,10 +324,12 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
|
|
111
324
|
"name": "Doodle #2",
|
112
325
|
},
|
113
326
|
"owner": null,
|
327
|
+
"tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
114
328
|
"tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/2",
|
115
329
|
"type": "ERC721",
|
116
330
|
},
|
117
331
|
{
|
332
|
+
"chainId": 1,
|
118
333
|
"id": 3n,
|
119
334
|
"metadata": {
|
120
335
|
"attributes": [
|
@@ -144,10 +359,12 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
|
|
144
359
|
"name": "Doodle #3",
|
145
360
|
},
|
146
361
|
"owner": null,
|
362
|
+
"tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
147
363
|
"tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/3",
|
148
364
|
"type": "ERC721",
|
149
365
|
},
|
150
366
|
{
|
367
|
+
"chainId": 1,
|
151
368
|
"id": 4n,
|
152
369
|
"metadata": {
|
153
370
|
"attributes": [
|
@@ -177,22 +394,11 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
|
|
177
394
|
"name": "Doodle #4",
|
178
395
|
},
|
179
396
|
"owner": null,
|
397
|
+
"tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
|
180
398
|
"tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/4",
|
181
399
|
"type": "ERC721",
|
182
400
|
},
|
183
401
|
]
|
184
402
|
`);
|
185
403
|
});
|
186
|
-
|
187
|
-
it.todo("works for a contract with `1` indexed NFTs", async () => {
|
188
|
-
// TODO find a contract that we can use that has "1 indexed" NFTs, then re-enable this test
|
189
|
-
});
|
190
|
-
|
191
|
-
it("should throw error if totalSupply and nextTokenIdToMint are not supported", async () => {
|
192
|
-
await expect(
|
193
|
-
getNFTs({ contract: UNISWAPV3_FACTORY_CONTRACT }),
|
194
|
-
).rejects.toThrowError(
|
195
|
-
"Contract requires either `nextTokenIdToMint` or `totalSupply` function available to determine the next token ID to mint",
|
196
|
-
);
|
197
|
-
});
|
198
404
|
});
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { getContractNFTs } from "../../../insight/index.js";
|
1
2
|
import type { BaseTransactionOptions } from "../../../transaction/types.js";
|
2
3
|
import { min } from "../../../utils/bigint.js";
|
3
4
|
import type { NFT } from "../../../utils/nft/parseNft.js";
|
@@ -41,6 +42,11 @@ export type GetNFTsParams = {
|
|
41
42
|
* In this case, the provided tokenId will be considered as token-index and actual tokenId will be fetched from the contract.
|
42
43
|
*/
|
43
44
|
tokenByIndex?: boolean;
|
45
|
+
/**
|
46
|
+
* Whether to use the insight API to fetch the NFTs.
|
47
|
+
* @default true
|
48
|
+
*/
|
49
|
+
useIndexer?: boolean;
|
44
50
|
};
|
45
51
|
|
46
52
|
/**
|
@@ -61,6 +67,59 @@ export type GetNFTsParams = {
|
|
61
67
|
*/
|
62
68
|
export async function getNFTs(
|
63
69
|
options: BaseTransactionOptions<GetNFTsParams>,
|
70
|
+
): Promise<NFT[]> {
|
71
|
+
const { useIndexer = true } = options;
|
72
|
+
if (useIndexer) {
|
73
|
+
try {
|
74
|
+
return await getNFTsFromInsight(options);
|
75
|
+
} catch {
|
76
|
+
return await getNFTsFromRPC(options);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return await getNFTsFromRPC(options);
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Checks if the `getNFTs` method is supported by the given contract.
|
84
|
+
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
85
|
+
* @returns A boolean indicating if the `getNFTs` method is supported.
|
86
|
+
* @extension ERC721
|
87
|
+
* @example
|
88
|
+
* ```ts
|
89
|
+
* import { isGetNFTsSupported } from "thirdweb/extensions/erc721";
|
90
|
+
*
|
91
|
+
* const supported = isGetNFTsSupported(["0x..."]);
|
92
|
+
* ```
|
93
|
+
*/
|
94
|
+
export function isGetNFTsSupported(availableSelectors: string[]) {
|
95
|
+
return (
|
96
|
+
isGetNFTSupported(availableSelectors) &&
|
97
|
+
(isTotalSupplySupported(availableSelectors) ||
|
98
|
+
isNextTokenIdToMintSupported(availableSelectors))
|
99
|
+
);
|
100
|
+
}
|
101
|
+
|
102
|
+
async function getNFTsFromInsight(
|
103
|
+
options: BaseTransactionOptions<GetNFTsParams>,
|
104
|
+
): Promise<NFT[]> {
|
105
|
+
const { contract, start, count = Number(DEFAULT_QUERY_ALL_COUNT) } = options;
|
106
|
+
|
107
|
+
const result = await getContractNFTs({
|
108
|
+
client: contract.client,
|
109
|
+
chains: [contract.chain],
|
110
|
+
contractAddress: contract.address,
|
111
|
+
includeOwners: options.includeOwners ?? false,
|
112
|
+
queryOptions: {
|
113
|
+
limit: count,
|
114
|
+
page: start ? Math.floor(start / count) : undefined,
|
115
|
+
},
|
116
|
+
});
|
117
|
+
|
118
|
+
return result;
|
119
|
+
}
|
120
|
+
|
121
|
+
async function getNFTsFromRPC(
|
122
|
+
options: BaseTransactionOptions<GetNFTsParams>,
|
64
123
|
): Promise<NFT[]> {
|
65
124
|
const [startTokenId_, maxSupply] = await Promise.allSettled([
|
66
125
|
startTokenId(options),
|
@@ -105,23 +164,3 @@ export async function getNFTs(
|
|
105
164
|
|
106
165
|
return await Promise.all(promises);
|
107
166
|
}
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Checks if the `getNFTs` method is supported by the given contract.
|
111
|
-
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
112
|
-
* @returns A boolean indicating if the `getNFTs` method is supported.
|
113
|
-
* @extension ERC721
|
114
|
-
* @example
|
115
|
-
* ```ts
|
116
|
-
* import { isGetNFTsSupported } from "thirdweb/extensions/erc721";
|
117
|
-
*
|
118
|
-
* const supported = isGetNFTsSupported(["0x..."]);
|
119
|
-
* ```
|
120
|
-
*/
|
121
|
-
export function isGetNFTsSupported(availableSelectors: string[]) {
|
122
|
-
return (
|
123
|
-
isGetNFTSupported(availableSelectors) &&
|
124
|
-
(isTotalSupplySupported(availableSelectors) ||
|
125
|
-
isNextTokenIdToMintSupported(availableSelectors))
|
126
|
-
);
|
127
|
-
}
|
@@ -6,12 +6,36 @@ import { getContract } from "../../../contract/contract.js";
|
|
6
6
|
import { getOwnedNFTs } from "./getOwnedNFTs.js";
|
7
7
|
|
8
8
|
describe.runIf(process.env.TW_SECRET_KEY)("erc721.getOwnedNFTs", () => {
|
9
|
-
it("should return the correct data", async () => {
|
9
|
+
it("should return the correct data using indexer", async () => {
|
10
10
|
const owner = "0x3010775D16E7B79AF280035c64a1Df5F705CfdDb";
|
11
11
|
const nfts = await getOwnedNFTs({
|
12
12
|
contract: DOODLES_CONTRACT,
|
13
13
|
owner,
|
14
14
|
});
|
15
|
+
expect(nfts.length).greaterThan(0);
|
16
|
+
});
|
17
|
+
|
18
|
+
it("should detect ownership functions using indexer", async () => {
|
19
|
+
const contract = getContract({
|
20
|
+
client: TEST_CLIENT,
|
21
|
+
chain: defineChain(421614),
|
22
|
+
address: "0x90450885977EE8F8F21AC79Fc2Dd51a18B13123E",
|
23
|
+
});
|
24
|
+
|
25
|
+
const ownedNFTs = await getOwnedNFTs({
|
26
|
+
contract,
|
27
|
+
owner: "0x1813D5Ff6f2B229a6Ba8FcDFa14004d91aa58e36",
|
28
|
+
});
|
29
|
+
expect(ownedNFTs.length).greaterThan(0);
|
30
|
+
});
|
31
|
+
|
32
|
+
it("should return the correct data using RPC", async () => {
|
33
|
+
const owner = "0x3010775D16E7B79AF280035c64a1Df5F705CfdDb";
|
34
|
+
const nfts = await getOwnedNFTs({
|
35
|
+
contract: DOODLES_CONTRACT,
|
36
|
+
owner,
|
37
|
+
useIndexer: false,
|
38
|
+
});
|
15
39
|
|
16
40
|
// The following code is based on the state of the forked chain
|
17
41
|
// so the data should not change
|
@@ -21,7 +45,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getOwnedNFTs", () => {
|
|
21
45
|
}
|
22
46
|
});
|
23
47
|
|
24
|
-
it("should detect ownership functions", async () => {
|
48
|
+
it("should detect ownership functions using RPC", async () => {
|
25
49
|
const contract = getContract({
|
26
50
|
client: TEST_CLIENT,
|
27
51
|
chain: defineChain(421614),
|
@@ -31,6 +55,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getOwnedNFTs", () => {
|
|
31
55
|
const ownedNFTs = await getOwnedNFTs({
|
32
56
|
contract,
|
33
57
|
owner: "0x1813D5Ff6f2B229a6Ba8FcDFa14004d91aa58e36",
|
58
|
+
useIndexer: false,
|
34
59
|
});
|
35
60
|
expect(ownedNFTs.length).greaterThan(0);
|
36
61
|
});
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { getOwnedNFTs as getInsightNFTs } from "../../../insight/index.js";
|
1
2
|
import type { BaseTransactionOptions } from "../../../transaction/types.js";
|
2
3
|
import type { NFT } from "../../../utils/nft/parseNft.js";
|
3
4
|
import { getNFT } from "./getNFT.js";
|
@@ -9,7 +10,9 @@ import {
|
|
9
10
|
/**
|
10
11
|
* @extension ERC721
|
11
12
|
*/
|
12
|
-
export type GetOwnedNFTsParams = GetOwnedTokenIdsParams
|
13
|
+
export type GetOwnedNFTsParams = GetOwnedTokenIdsParams & {
|
14
|
+
useIndexer?: boolean;
|
15
|
+
};
|
13
16
|
|
14
17
|
/**
|
15
18
|
* Retrieves the owned NFTs for a given owner.
|
@@ -29,6 +32,20 @@ export type GetOwnedNFTsParams = GetOwnedTokenIdsParams;
|
|
29
32
|
*/
|
30
33
|
export async function getOwnedNFTs(
|
31
34
|
options: BaseTransactionOptions<GetOwnedNFTsParams>,
|
35
|
+
): Promise<NFT[]> {
|
36
|
+
const { useIndexer = true } = options;
|
37
|
+
if (useIndexer) {
|
38
|
+
try {
|
39
|
+
return await getOwnedNFTsFromInsight(options);
|
40
|
+
} catch {
|
41
|
+
return await getOwnedNFTsFromRPC(options);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
return await getOwnedNFTsFromRPC(options);
|
45
|
+
}
|
46
|
+
|
47
|
+
async function getOwnedNFTsFromRPC(
|
48
|
+
options: BaseTransactionOptions<GetOwnedNFTsParams>,
|
32
49
|
): Promise<NFT[]> {
|
33
50
|
const tokenIds = await getOwnedTokenIds(options);
|
34
51
|
|
@@ -45,3 +62,46 @@ export async function getOwnedNFTs(
|
|
45
62
|
),
|
46
63
|
);
|
47
64
|
}
|
65
|
+
|
66
|
+
async function getOwnedNFTsFromInsight(
|
67
|
+
options: BaseTransactionOptions<GetOwnedNFTsParams>,
|
68
|
+
): Promise<NFT[]> {
|
69
|
+
const limit = 50;
|
70
|
+
const nfts: NFT[] = [];
|
71
|
+
let page = 0;
|
72
|
+
let hasMore = true;
|
73
|
+
|
74
|
+
// TODO (insight): add support for contract address filters
|
75
|
+
while (hasMore) {
|
76
|
+
const pageResults = await getInsightNFTs({
|
77
|
+
client: options.contract.client,
|
78
|
+
chains: [options.contract.chain],
|
79
|
+
ownerAddress: options.owner,
|
80
|
+
queryOptions: {
|
81
|
+
limit,
|
82
|
+
page,
|
83
|
+
},
|
84
|
+
});
|
85
|
+
|
86
|
+
nfts.push(...pageResults);
|
87
|
+
|
88
|
+
// If we got fewer results than the limit, we've reached the end
|
89
|
+
if (pageResults.length < limit) {
|
90
|
+
hasMore = false;
|
91
|
+
} else {
|
92
|
+
page++;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
const results = nfts;
|
97
|
+
|
98
|
+
return results
|
99
|
+
.filter(
|
100
|
+
(n) =>
|
101
|
+
n.tokenAddress.toLowerCase() === options.contract.address.toLowerCase(),
|
102
|
+
)
|
103
|
+
.map((result) => ({
|
104
|
+
...result,
|
105
|
+
owner: options.owner,
|
106
|
+
}));
|
107
|
+
}
|
@@ -204,15 +204,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Marketplace Direct Listings", () => {
|
|
204
204
|
expect(firstListing.creatorAddress).toBe(TEST_ACCOUNT_B.address);
|
205
205
|
expect(firstListing.assetContractAddress).toBe(erc721Contract.address);
|
206
206
|
expect(firstListing.tokenId).toBe(0n);
|
207
|
-
expect(firstListing.currencyValuePerToken).
|
208
|
-
{
|
209
|
-
"decimals": 18,
|
210
|
-
"displayValue": "1",
|
211
|
-
"name": "Anvil Ether",
|
212
|
-
"symbol": "ETH",
|
213
|
-
"value": 1000000000000000000n,
|
214
|
-
}
|
215
|
-
`);
|
207
|
+
expect(firstListing.currencyValuePerToken.displayValue).toBe("1");
|
216
208
|
expect(firstListing.asset.metadata.name).toBe("erc721 #0");
|
217
209
|
expect(firstListing.asset.id).toBe(0n);
|
218
210
|
expect(firstListing.asset.owner).toBe(null);
|
@@ -351,15 +343,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Marketplace Direct Listings", () => {
|
|
351
343
|
expect(secondListing.creatorAddress).toBe(TEST_ACCOUNT_C.address);
|
352
344
|
expect(secondListing.assetContractAddress).toBe(erc1155Contract.address);
|
353
345
|
expect(secondListing.tokenId).toBe(0n);
|
354
|
-
expect(secondListing.currencyValuePerToken).
|
355
|
-
{
|
356
|
-
"decimals": 18,
|
357
|
-
"displayValue": "0.05",
|
358
|
-
"name": "Anvil Ether",
|
359
|
-
"symbol": "ETH",
|
360
|
-
"value": 50000000000000000n,
|
361
|
-
}
|
362
|
-
`);
|
346
|
+
expect(secondListing.currencyValuePerToken.displayValue).toBe("0.05");
|
363
347
|
expect(secondListing.asset.metadata.name).toBe("erc1155 #0");
|
364
348
|
expect(secondListing.asset.id).toBe(0n);
|
365
349
|
|
@@ -26,12 +26,13 @@ export async function mapDirectListing(
|
|
26
26
|
endTimestamp: rawListing.endTimestamp,
|
27
27
|
});
|
28
28
|
|
29
|
+
const currencyContract = getContract({
|
30
|
+
...options.contract,
|
31
|
+
address: rawListing.currency,
|
32
|
+
});
|
29
33
|
const [currencyValuePerToken, nftAsset] = await Promise.all([
|
30
34
|
getCurrencyMetadata({
|
31
|
-
contract:
|
32
|
-
...options.contract,
|
33
|
-
address: rawListing.currency,
|
34
|
-
}),
|
35
|
+
contract: currencyContract,
|
35
36
|
}),
|
36
37
|
getNFTAsset({
|
37
38
|
...options,
|
@@ -57,6 +58,8 @@ export async function mapDirectListing(
|
|
57
58
|
rawListing.pricePerToken,
|
58
59
|
currencyValuePerToken.decimals,
|
59
60
|
),
|
61
|
+
tokenAddress: currencyContract.address,
|
62
|
+
chainId: currencyContract.chain.id,
|
60
63
|
},
|
61
64
|
pricePerToken: rawListing.pricePerToken,
|
62
65
|
asset: nftAsset,
|
@@ -24,12 +24,13 @@ export async function mapEnglishAuction(
|
|
24
24
|
endTimestamp: rawAuction.endTimestamp,
|
25
25
|
});
|
26
26
|
|
27
|
+
const currencyContract = getContract({
|
28
|
+
...options.contract,
|
29
|
+
address: rawAuction.currency,
|
30
|
+
});
|
27
31
|
const [auctionCurrencyMetadata, nftAsset] = await Promise.all([
|
28
32
|
getCurrencyMetadata({
|
29
|
-
contract:
|
30
|
-
...options.contract,
|
31
|
-
address: rawAuction.currency,
|
32
|
-
}),
|
33
|
+
contract: currencyContract,
|
33
34
|
}),
|
34
35
|
getNFTAsset({
|
35
36
|
...options,
|
@@ -60,6 +61,8 @@ export async function mapEnglishAuction(
|
|
60
61
|
rawAuction.minimumBidAmount,
|
61
62
|
auctionCurrencyMetadata.decimals,
|
62
63
|
),
|
64
|
+
tokenAddress: currencyContract.address,
|
65
|
+
chainId: currencyContract.chain.id,
|
63
66
|
},
|
64
67
|
buyoutBidAmount: rawAuction.buyoutBidAmount,
|
65
68
|
buyoutCurrencyValue: {
|
@@ -69,6 +72,8 @@ export async function mapEnglishAuction(
|
|
69
72
|
rawAuction.buyoutBidAmount,
|
70
73
|
auctionCurrencyMetadata.decimals,
|
71
74
|
),
|
75
|
+
tokenAddress: currencyContract.address,
|
76
|
+
chainId: currencyContract.chain.id,
|
72
77
|
},
|
73
78
|
timeBufferInSeconds: rawAuction.timeBufferInSeconds,
|
74
79
|
bidBufferBps: rawAuction.bidBufferBps,
|
@@ -25,12 +25,13 @@ export async function mapOffer(
|
|
25
25
|
endTimestamp: rawOffer.expirationTimestamp,
|
26
26
|
});
|
27
27
|
|
28
|
+
const currencyContract = getContract({
|
29
|
+
...options.contract,
|
30
|
+
address: rawOffer.currency,
|
31
|
+
});
|
28
32
|
const [currencyValuePerToken, nftAsset] = await Promise.all([
|
29
33
|
getCurrencyMetadata({
|
30
|
-
contract:
|
31
|
-
...options.contract,
|
32
|
-
address: rawOffer.currency,
|
33
|
-
}),
|
34
|
+
contract: currencyContract,
|
34
35
|
}),
|
35
36
|
getNFTAsset({
|
36
37
|
...options,
|
@@ -56,6 +57,8 @@ export async function mapOffer(
|
|
56
57
|
rawOffer.totalPrice,
|
57
58
|
currencyValuePerToken.decimals,
|
58
59
|
),
|
60
|
+
tokenAddress: currencyContract.address,
|
61
|
+
chainId: currencyContract.chain.id,
|
59
62
|
},
|
60
63
|
totalPrice: rawOffer.totalPrice,
|
61
64
|
asset: nftAsset,
|