@0xsequence/marketplace-sdk 0.7.0 → 0.8.1
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.changeset/seven-doors-taste.md +5 -0
- package/CHANGELOG.md +13 -0
- package/dist/{chunk-MPBN3E54.js → chunk-2VHHJNXY.js} +3 -3
- package/dist/{chunk-FBUMNJQ4.js → chunk-3II5GLHE.js} +2 -2
- package/dist/chunk-3JU7SQVE.js +182 -0
- package/dist/chunk-3JU7SQVE.js.map +1 -0
- package/dist/{chunk-XTGMMNV5.js → chunk-A5ACY5YV.js} +2 -2
- package/dist/chunk-ABSYNRT5.js +128 -0
- package/dist/chunk-ABSYNRT5.js.map +1 -0
- package/dist/{chunk-XNA64MZQ.js → chunk-BCO4CYE4.js} +2 -2
- package/dist/{chunk-HTFORA4Q.js → chunk-BN36GABQ.js} +1883 -1010
- package/dist/chunk-BN36GABQ.js.map +1 -0
- package/dist/{chunk-4XK7XNJ7.js → chunk-BNAUZXPV.js} +73 -2
- package/dist/chunk-BNAUZXPV.js.map +1 -0
- package/dist/{chunk-Q5URKSC4.js → chunk-FMEEJFAF.js} +1 -1
- package/dist/{chunk-BBASZVT3.js → chunk-GBQVYNCD.js} +5 -6
- package/dist/chunk-GBQVYNCD.js.map +1 -0
- package/dist/{chunk-3AKOPSON.js → chunk-IZ44XPBH.js} +2 -9
- package/dist/chunk-IZ44XPBH.js.map +1 -0
- package/dist/{chunk-EAJ5K7QV.js → chunk-Q5RKAMYF.js} +3 -4
- package/dist/chunk-Q5RKAMYF.js.map +1 -0
- package/dist/{chunk-RBEPPVLT.js → chunk-X3QNSQER.js} +145 -355
- package/dist/chunk-X3QNSQER.js.map +1 -0
- package/dist/{index-CzTANLaA.d.ts → index-CnaFSNE9.d.ts} +6 -7
- package/dist/index.css +113 -31
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +4 -4
- package/dist/listCollectibles-B0tbqnRd.d.ts +155 -0
- package/dist/react/_internal/api/index.d.ts +28 -2
- package/dist/react/_internal/api/index.js +3 -1
- package/dist/react/_internal/databeat/index.js +10 -9
- package/dist/react/_internal/index.d.ts +2 -3
- package/dist/react/_internal/index.js +4 -4
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +259 -674
- package/dist/react/hooks/index.js +11 -20
- package/dist/react/hooks/options/index.d.ts +1 -2
- package/dist/react/hooks/options/index.js +4 -4
- package/dist/react/index.d.ts +7 -7
- package/dist/react/index.js +15 -24
- package/dist/react/queries/index.d.ts +25 -0
- package/dist/react/queries/index.js +48 -0
- package/dist/react/queries/index.js.map +1 -0
- package/dist/react/ssr/index.js +3 -3
- package/dist/react/ui/components/collectible-card/index.d.ts +1 -6
- package/dist/react/ui/components/collectible-card/index.js +13 -12
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/icons/index.js +6 -6
- package/dist/react/ui/index.d.ts +18 -22
- package/dist/react/ui/index.js +13 -12
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +6 -11
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +10 -9
- package/dist/types/index.js +2 -2
- package/dist/{types-Ct1uCT3M.d.ts → types-o_pKUpQG.d.ts} +2 -5
- package/dist/utils/index.d.ts +1 -5
- package/dist/utils/index.js +4 -4
- package/package.json +22 -16
- package/src/react/_internal/api/__mocks__/indexer.msw.ts +3 -1
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +1 -1
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +14 -12
- package/src/react/_internal/api/index.ts +1 -0
- package/src/react/_internal/api/laos-api.ts +103 -0
- package/src/react/_internal/api/zod-schema.ts +3 -3
- package/src/react/_internal/types.ts +1 -10
- package/src/react/_internal/wallet/__tests__/wallet.test.ts +43 -0
- package/src/react/_internal/wallet/useWallet.ts +6 -3
- package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCancelOrder.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCollectible.test.tsx +2 -2
- package/src/react/hooks/__tests__/useCollection.test.tsx +2 -2
- package/src/react/hooks/__tests__/useComparePrices.test.tsx +1 -1
- package/src/react/hooks/__tests__/useConvertPriceToUSD.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +2 -2
- package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCurrencies.test.tsx +2 -2
- package/src/react/hooks/__tests__/useCurrency.test.tsx +2 -2
- package/src/react/hooks/__tests__/useFilters.test.tsx +2 -2
- package/src/react/hooks/__tests__/useFloorOrder.test.tsx +2 -2
- package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +2 -2
- package/src/react/hooks/__tests__/useListCollectibles.test.tsx +3 -2
- package/src/react/hooks/__tests__/useListCollectiblesPaginated.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useLowestListing.test.tsx +1 -1
- package/src/react/hooks/__tests__/useRoyalty.test.tsx +1 -2
- package/src/react/hooks/index.ts +0 -1
- package/src/react/hooks/options/collectionOptions.ts +2 -3
- package/src/react/hooks/useAutoSelectFeeOption.tsx +1 -1
- package/src/react/hooks/useCancelOrder.tsx +3 -3
- package/src/react/hooks/useCancelTransactionSteps.tsx +1 -1
- package/src/react/hooks/useCheckoutOptions.tsx +1 -2
- package/src/react/hooks/useCollectible.tsx +2 -3
- package/src/react/hooks/useCollectionBalanceDetails.tsx +1 -2
- package/src/react/hooks/useComparePrices.tsx +2 -9
- package/src/react/hooks/useConvertPriceToUSD.tsx +1 -4
- package/src/react/hooks/useCountListingsForCollectible.tsx +1 -2
- package/src/react/hooks/useCountOfCollectables.tsx +1 -2
- package/src/react/hooks/useCountOffersForCollectible.tsx +1 -2
- package/src/react/hooks/useCurrencies.tsx +1 -4
- package/src/react/hooks/useCurrency.tsx +3 -8
- package/src/react/hooks/useFilters.tsx +5 -4
- package/src/react/hooks/useFloorOrder.tsx +1 -2
- package/src/react/hooks/useGenerateCancelTransaction.tsx +3 -6
- package/src/react/hooks/useGenerateListingTransaction.tsx +2 -3
- package/src/react/hooks/useGenerateOfferTransaction.tsx +2 -3
- package/src/react/hooks/useGenerateSellTransaction.tsx +3 -6
- package/src/react/hooks/useHighestOffer.tsx +1 -1
- package/src/react/hooks/useListCollectibles.tsx +33 -61
- package/src/react/hooks/useListCollectiblesPaginated.tsx +2 -6
- package/src/react/hooks/useListListingsForCollectible.tsx +1 -2
- package/src/react/hooks/useListOffersForCollectible.tsx +1 -2
- package/src/react/hooks/useLowestListing.tsx +1 -2
- package/src/react/hooks/useRoyalty.tsx +3 -8
- package/src/react/hooks/useTransferTokens.tsx +2 -2
- package/src/react/queries/balanceOfCollectible.ts +9 -32
- package/src/react/queries/getTokenSupplies.ts +38 -0
- package/src/react/queries/index.ts +5 -0
- package/src/react/queries/listCollectibles.ts +96 -0
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
- package/src/react/ui/components/_internals/action-button/__tests__/ActionButton.test.tsx +1 -1
- package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -3
- package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +1 -1
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -3
- package/src/react/ui/components/collectible-card/__tests__/CollectibleCard.test.tsx +1 -1
- package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +127 -0
- package/src/react/ui/modals/BuyModal/Modal.tsx +70 -85
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +85 -226
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +140 -0
- package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +67 -76
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +1 -60
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +1 -1
- package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +29 -13
- package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +26 -21
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +200 -0
- package/src/react/ui/modals/BuyModal/index.tsx +4 -14
- package/src/react/ui/modals/BuyModal/store.ts +71 -76
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +71 -7
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +2 -2
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +1 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +9 -5
- package/src/react/ui/modals/CreateListingModal/store.ts +7 -2
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +103 -6
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +8 -4
- package/src/react/ui/modals/MakeOfferModal/store.ts +5 -3
- package/src/react/ui/modals/SellModal/Modal.tsx +76 -4
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +16 -8
- package/src/react/ui/modals/SellModal/store.ts +5 -3
- package/src/react/ui/modals/TransferModal/_store.ts +15 -3
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +58 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TransferButton.tsx +56 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +50 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +94 -66
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +22 -14
- package/src/react/ui/modals/TransferModal/index.tsx +72 -38
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +43 -42
- package/src/react/ui/modals/_internal/components/actionModal/store.ts +1 -2
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +9 -1
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +27 -12
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -1
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +19 -3
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +3 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/ActionButtons.tsx +60 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/BalanceIndicator.tsx +30 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +126 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts +25 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +74 -0
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +1 -2
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +1 -2
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +4 -7
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +6 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +2 -2
- package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +10 -31
- package/src/react/ui/modals/_internal/hooks/useSelectWaasFeeOptions.ts +53 -0
- package/src/react/ui/modals/_internal/types.ts +2 -1
- package/src/types/waas-types.ts +38 -0
- package/src/utils/network.ts +2 -4
- package/test/const.ts +1 -1
- package/test/setup.ts +10 -0
- package/test/test-utils.tsx +31 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-3AKOPSON.js.map +0 -1
- package/dist/chunk-4XK7XNJ7.js.map +0 -1
- package/dist/chunk-BBASZVT3.js.map +0 -1
- package/dist/chunk-EAJ5K7QV.js.map +0 -1
- package/dist/chunk-HTFORA4Q.js.map +0 -1
- package/dist/chunk-OFY7OFTL.js +0 -458
- package/dist/chunk-OFY7OFTL.js.map +0 -1
- package/dist/chunk-RBEPPVLT.js.map +0 -1
- package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +0 -172
- package/src/react/hooks/useGenerateBuyTransaction.tsx +0 -80
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +0 -349
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +0 -185
- package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +0 -170
- package/src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx +0 -47
- package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +0 -140
- package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +0 -162
- package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +0 -327
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/index.tsx +0 -124
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/store.ts +0 -12
- /package/dist/{chunk-MPBN3E54.js.map → chunk-2VHHJNXY.js.map} +0 -0
- /package/dist/{chunk-FBUMNJQ4.js.map → chunk-3II5GLHE.js.map} +0 -0
- /package/dist/{chunk-XTGMMNV5.js.map → chunk-A5ACY5YV.js.map} +0 -0
- /package/dist/{chunk-XNA64MZQ.js.map → chunk-BCO4CYE4.js.map} +0 -0
- /package/dist/{chunk-Q5URKSC4.js.map → chunk-FMEEJFAF.js.map} +0 -0
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
collectionOptions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GBQVYNCD.js";
|
|
6
|
+
import {
|
|
7
|
+
marketplaceConfigOptions
|
|
8
|
+
} from "./chunk-3II5GLHE.js";
|
|
6
9
|
import {
|
|
7
10
|
InfoIcon_default
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BCO4CYE4.js";
|
|
9
12
|
import {
|
|
10
13
|
SEQUENCE_MARKET_V1_ADDRESS,
|
|
11
14
|
SEQUENCE_MARKET_V2_ADDRESS
|
|
@@ -13,7 +16,7 @@ import {
|
|
|
13
16
|
import {
|
|
14
17
|
compareAddress,
|
|
15
18
|
getPresentableChainName
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Q5RKAMYF.js";
|
|
17
20
|
import {
|
|
18
21
|
EIP2981_ABI
|
|
19
22
|
} from "./chunk-XX4EVWBF.js";
|
|
@@ -21,15 +24,17 @@ import {
|
|
|
21
24
|
ERC1155_ABI
|
|
22
25
|
} from "./chunk-FUM4OGOQ.js";
|
|
23
26
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
balanceOfCollectibleOptions,
|
|
28
|
+
highestOfferOptions,
|
|
29
|
+
listBalancesOptions,
|
|
30
|
+
listCollectiblesOptions
|
|
31
|
+
} from "./chunk-3JU7SQVE.js";
|
|
26
32
|
import {
|
|
27
33
|
AddressSchema,
|
|
28
|
-
ChainIdSchema,
|
|
29
34
|
CollectableIdSchema,
|
|
30
35
|
PROVIDER_ID,
|
|
31
36
|
QueryArgSchema
|
|
32
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-IZ44XPBH.js";
|
|
33
38
|
import {
|
|
34
39
|
BaseError,
|
|
35
40
|
ChainSwitchError,
|
|
@@ -66,7 +71,7 @@ import {
|
|
|
66
71
|
getMarketplaceClient,
|
|
67
72
|
getMetadataClient,
|
|
68
73
|
getQueryClient
|
|
69
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-BNAUZXPV.js";
|
|
70
75
|
|
|
71
76
|
// src/react/hooks/useAutoSelectFeeOption.tsx
|
|
72
77
|
import { zeroAddress } from "viem";
|
|
@@ -139,7 +144,7 @@ var filterSchema = z.object({
|
|
|
139
144
|
omitNativeBalances: z.boolean()
|
|
140
145
|
});
|
|
141
146
|
var useCollectionBalanceDetailsArgsSchema = z.object({
|
|
142
|
-
chainId:
|
|
147
|
+
chainId: z.number(),
|
|
143
148
|
filter: filterSchema,
|
|
144
149
|
query: QueryArgSchema.optional()
|
|
145
150
|
});
|
|
@@ -278,65 +283,6 @@ function useAutoSelectFeeOption({
|
|
|
278
283
|
// src/react/hooks/useBalanceOfCollectible.tsx
|
|
279
284
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
280
285
|
|
|
281
|
-
// src/react/queries/balanceOfCollectible.ts
|
|
282
|
-
import { queryOptions as queryOptions2, skipToken } from "@tanstack/react-query";
|
|
283
|
-
async function fetchBalanceOfCollectible(args, config) {
|
|
284
|
-
if (args.isLaos721) {
|
|
285
|
-
const response = await fetch(
|
|
286
|
-
"https://extensions.api.laosnetwork.io/token/GetTokenBalances",
|
|
287
|
-
{
|
|
288
|
-
method: "POST",
|
|
289
|
-
headers: {
|
|
290
|
-
"Content-Type": "application/json"
|
|
291
|
-
},
|
|
292
|
-
body: JSON.stringify({
|
|
293
|
-
chainId: args.chainId.toString(),
|
|
294
|
-
accountAddress: args.userAddress,
|
|
295
|
-
includeMetadata: true,
|
|
296
|
-
page: {
|
|
297
|
-
sort: [
|
|
298
|
-
{
|
|
299
|
-
column: "CREATED_AT",
|
|
300
|
-
order: "DESC"
|
|
301
|
-
}
|
|
302
|
-
]
|
|
303
|
-
}
|
|
304
|
-
})
|
|
305
|
-
}
|
|
306
|
-
);
|
|
307
|
-
if (!response.ok) {
|
|
308
|
-
throw new Error(`Laos API request failed with status ${response.status}`);
|
|
309
|
-
}
|
|
310
|
-
const data = await response.json();
|
|
311
|
-
return data.balances[0] || null;
|
|
312
|
-
}
|
|
313
|
-
const indexerClient = getIndexerClient(args.chainId, config);
|
|
314
|
-
return indexerClient.getTokenBalances({
|
|
315
|
-
accountAddress: args.userAddress,
|
|
316
|
-
contractAddress: args.collectionAddress,
|
|
317
|
-
tokenID: args.collectableId,
|
|
318
|
-
includeMetadata: false,
|
|
319
|
-
metadataOptions: {
|
|
320
|
-
verifiedOnly: true,
|
|
321
|
-
includeContracts: [args.collectionAddress]
|
|
322
|
-
}
|
|
323
|
-
}).then((res) => res.balances[0] || null);
|
|
324
|
-
}
|
|
325
|
-
function balanceOfCollectibleOptions(args, config) {
|
|
326
|
-
const enabled = !!args.userAddress && (args.query?.enabled ?? true);
|
|
327
|
-
return queryOptions2({
|
|
328
|
-
queryKey: [...collectableKeys.userBalances, args],
|
|
329
|
-
queryFn: enabled ? () => fetchBalanceOfCollectible(
|
|
330
|
-
{
|
|
331
|
-
...args,
|
|
332
|
-
// biome-ignore lint/style/noNonNullAssertion: this is guaranteed by the userAddress check above
|
|
333
|
-
userAddress: args.userAddress
|
|
334
|
-
},
|
|
335
|
-
config
|
|
336
|
-
) : skipToken
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
286
|
// src/react/hooks/useMarketplaceConfig.tsx
|
|
341
287
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
342
288
|
var useMarketplaceConfig = () => {
|
|
@@ -358,7 +304,7 @@ function useBalanceOfCollectible(args) {
|
|
|
358
304
|
}
|
|
359
305
|
|
|
360
306
|
// src/react/hooks/useCountOfCollectables.tsx
|
|
361
|
-
import { queryOptions as
|
|
307
|
+
import { queryOptions as queryOptions2, useQuery as useQuery4 } from "@tanstack/react-query";
|
|
362
308
|
import { z as z3 } from "zod";
|
|
363
309
|
|
|
364
310
|
// src/react/_internal/api/zod-schema.ts
|
|
@@ -776,7 +722,7 @@ var listOffersForCollectibleReturnSchema = z2.object({
|
|
|
776
722
|
page: pageSchema.optional()
|
|
777
723
|
});
|
|
778
724
|
var getListCollectibleActivitiesArgsSchema = z2.object({
|
|
779
|
-
chainId:
|
|
725
|
+
chainId: z2.number(),
|
|
780
726
|
collectionAddress: AddressSchema,
|
|
781
727
|
tokenId: CollectableIdSchema.pipe(z2.coerce.string()),
|
|
782
728
|
query: pageSchema.extend({
|
|
@@ -788,7 +734,7 @@ var getListCollectibleActivitiesReturnSchema = z2.object({
|
|
|
788
734
|
page: pageSchema.optional()
|
|
789
735
|
});
|
|
790
736
|
var getListCollectionActivitiesArgsSchema = z2.object({
|
|
791
|
-
chainId:
|
|
737
|
+
chainId: z2.number(),
|
|
792
738
|
collectionAddress: AddressSchema,
|
|
793
739
|
query: pageSchema.extend({
|
|
794
740
|
enabled: z2.boolean().optional()
|
|
@@ -910,7 +856,7 @@ var generateOfferTransactionReturnSchema = z2.object({
|
|
|
910
856
|
|
|
911
857
|
// src/react/hooks/useCountOfCollectables.tsx
|
|
912
858
|
var BaseSchema = z3.object({
|
|
913
|
-
chainId:
|
|
859
|
+
chainId: z3.number(),
|
|
914
860
|
collectionAddress: AddressSchema,
|
|
915
861
|
query: QueryArgSchema
|
|
916
862
|
});
|
|
@@ -940,7 +886,7 @@ var fetchCountOfCollectables = async (args, config) => {
|
|
|
940
886
|
}).then((resp) => resp.count);
|
|
941
887
|
};
|
|
942
888
|
var countOfCollectablesOptions = (args, config) => {
|
|
943
|
-
return
|
|
889
|
+
return queryOptions2({
|
|
944
890
|
...args.query,
|
|
945
891
|
queryKey: [...collectableKeys.counts, args],
|
|
946
892
|
queryFn: () => fetchCountOfCollectables(args, config)
|
|
@@ -952,10 +898,10 @@ var useCountOfCollectables = (args) => {
|
|
|
952
898
|
};
|
|
953
899
|
|
|
954
900
|
// src/react/hooks/useCollectible.tsx
|
|
955
|
-
import { queryOptions as
|
|
901
|
+
import { queryOptions as queryOptions3, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
956
902
|
import { z as z4 } from "zod";
|
|
957
903
|
var UseCollectibleSchema = z4.object({
|
|
958
|
-
chainId:
|
|
904
|
+
chainId: z4.number(),
|
|
959
905
|
collectionAddress: AddressSchema,
|
|
960
906
|
collectibleId: z4.string().optional(),
|
|
961
907
|
query: QueryArgSchema
|
|
@@ -965,13 +911,13 @@ var fetchCollectible = async (args, config) => {
|
|
|
965
911
|
const metadataClient = getMetadataClient(config);
|
|
966
912
|
const tokenIds = parsedArgs.collectibleId ? [parsedArgs.collectibleId] : [];
|
|
967
913
|
return metadataClient.getTokenMetadata({
|
|
968
|
-
chainID: parsedArgs.chainId,
|
|
914
|
+
chainID: parsedArgs.chainId.toString(),
|
|
969
915
|
contractAddress: parsedArgs.collectionAddress,
|
|
970
916
|
tokenIDs: tokenIds
|
|
971
917
|
}).then((resp) => resp.tokenMetadata[0]);
|
|
972
918
|
};
|
|
973
919
|
var collectibleOptions = (args, config) => {
|
|
974
|
-
return
|
|
920
|
+
return queryOptions3({
|
|
975
921
|
...args.query,
|
|
976
922
|
queryKey: [...collectableKeys.details, args, config],
|
|
977
923
|
queryFn: () => fetchCollectible(args, config)
|
|
@@ -990,21 +936,20 @@ var useCollection = (args) => {
|
|
|
990
936
|
};
|
|
991
937
|
|
|
992
938
|
// src/react/hooks/useComparePrices.tsx
|
|
993
|
-
import { queryOptions as
|
|
939
|
+
import { queryOptions as queryOptions6, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
994
940
|
import { z as z7 } from "zod";
|
|
995
941
|
|
|
996
942
|
// src/react/hooks/useConvertPriceToUSD.tsx
|
|
997
|
-
import { queryOptions as
|
|
943
|
+
import { queryOptions as queryOptions5, useQuery as useQuery8 } from "@tanstack/react-query";
|
|
998
944
|
import { formatUnits } from "viem";
|
|
999
945
|
import { z as z6 } from "zod";
|
|
1000
946
|
|
|
1001
947
|
// src/react/hooks/useCurrencies.tsx
|
|
1002
|
-
import { queryOptions as
|
|
948
|
+
import { queryOptions as queryOptions4, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
1003
949
|
import { zeroAddress as zeroAddress2 } from "viem";
|
|
1004
950
|
import { z as z5 } from "zod";
|
|
1005
|
-
var ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
|
|
1006
951
|
var UseCurrenciesArgsSchema = z5.object({
|
|
1007
|
-
chainId:
|
|
952
|
+
chainId: z5.number(),
|
|
1008
953
|
includeNativeCurrency: z5.boolean().optional().default(true),
|
|
1009
954
|
collectionAddress: AddressSchema.optional(),
|
|
1010
955
|
query: QueryArgSchema
|
|
@@ -1038,7 +983,7 @@ var fetchCurrencies = async (args, config) => {
|
|
|
1038
983
|
return currencies;
|
|
1039
984
|
};
|
|
1040
985
|
var currenciesOptions = (args, config) => {
|
|
1041
|
-
return
|
|
986
|
+
return queryOptions4({
|
|
1042
987
|
...args.query,
|
|
1043
988
|
queryKey: [...currencyKeys.lists, args],
|
|
1044
989
|
queryFn: () => fetchCurrencies(args, config),
|
|
@@ -1051,9 +996,8 @@ var useCurrencies = (args) => {
|
|
|
1051
996
|
};
|
|
1052
997
|
|
|
1053
998
|
// src/react/hooks/useConvertPriceToUSD.tsx
|
|
1054
|
-
var ChainIdCoerce2 = ChainIdSchema.transform((val) => val.toString());
|
|
1055
999
|
var UseConvertPriceToUSDArgsSchema = z6.object({
|
|
1056
|
-
chainId:
|
|
1000
|
+
chainId: z6.number(),
|
|
1057
1001
|
currencyAddress: AddressSchema,
|
|
1058
1002
|
amountRaw: z6.string(),
|
|
1059
1003
|
query: QueryArgSchema
|
|
@@ -1085,7 +1029,7 @@ var convertPriceToUSD = async (args, config) => {
|
|
|
1085
1029
|
};
|
|
1086
1030
|
};
|
|
1087
1031
|
var convertPriceToUSDOptions = (args, config) => {
|
|
1088
|
-
return
|
|
1032
|
+
return queryOptions5({
|
|
1089
1033
|
...args.query,
|
|
1090
1034
|
queryKey: [
|
|
1091
1035
|
...currencyKeys.conversion,
|
|
@@ -1102,9 +1046,8 @@ var useConvertPriceToUSD = (args) => {
|
|
|
1102
1046
|
};
|
|
1103
1047
|
|
|
1104
1048
|
// src/react/hooks/useComparePrices.tsx
|
|
1105
|
-
var ChainIdCoerce3 = ChainIdSchema.transform((val) => val.toString());
|
|
1106
1049
|
var UseComparePricesArgsSchema = z7.object({
|
|
1107
|
-
chainId:
|
|
1050
|
+
chainId: z7.number(),
|
|
1108
1051
|
// First price details
|
|
1109
1052
|
priceAmountRaw: z7.string(),
|
|
1110
1053
|
priceCurrencyAddress: AddressSchema,
|
|
@@ -1149,7 +1092,7 @@ var comparePrices = async (args, config) => {
|
|
|
1149
1092
|
};
|
|
1150
1093
|
};
|
|
1151
1094
|
var comparePricesOptions = (args, config) => {
|
|
1152
|
-
return
|
|
1095
|
+
return queryOptions6({
|
|
1153
1096
|
...args.query,
|
|
1154
1097
|
queryKey: [...currencyKeys.conversion, "compare", args],
|
|
1155
1098
|
queryFn: () => comparePrices(args, config)
|
|
@@ -1161,20 +1104,18 @@ var useComparePrices = (args) => {
|
|
|
1161
1104
|
};
|
|
1162
1105
|
|
|
1163
1106
|
// src/react/hooks/useCurrency.tsx
|
|
1164
|
-
import { queryOptions as
|
|
1107
|
+
import { queryOptions as queryOptions7, skipToken, useQuery as useQuery10 } from "@tanstack/react-query";
|
|
1165
1108
|
import { z as z8 } from "zod";
|
|
1166
|
-
var ChainIdCoerce4 = ChainIdSchema.transform((val) => val.toString());
|
|
1167
1109
|
var UseCurrencyArgsSchema = z8.object({
|
|
1168
|
-
chainId:
|
|
1110
|
+
chainId: z8.number(),
|
|
1169
1111
|
currencyAddress: AddressSchema.optional(),
|
|
1170
1112
|
query: QueryArgSchema
|
|
1171
1113
|
});
|
|
1172
1114
|
var fetchCurrency = async (chainId, currencyAddress, config) => {
|
|
1173
|
-
const parsedChainId = ChainIdCoerce4.parse(chainId);
|
|
1174
1115
|
const queryClient = getQueryClient();
|
|
1175
1116
|
let currencies = queryClient.getQueryData([...currencyKeys.lists, chainId]);
|
|
1176
1117
|
if (!currencies) {
|
|
1177
|
-
const marketplaceClient = getMarketplaceClient(
|
|
1118
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1178
1119
|
currencies = await marketplaceClient.listCurrencies().then((resp) => resp.currencies);
|
|
1179
1120
|
}
|
|
1180
1121
|
if (!currencies?.length) {
|
|
@@ -1190,10 +1131,10 @@ var fetchCurrency = async (chainId, currencyAddress, config) => {
|
|
|
1190
1131
|
};
|
|
1191
1132
|
var currencyOptions = (args, config) => {
|
|
1192
1133
|
const { chainId, currencyAddress } = args;
|
|
1193
|
-
return
|
|
1134
|
+
return queryOptions7({
|
|
1194
1135
|
...args.query,
|
|
1195
1136
|
queryKey: [...currencyKeys.details, args.chainId, args.currencyAddress],
|
|
1196
|
-
queryFn: chainId && currencyAddress ? () => fetchCurrency(chainId, currencyAddress, config) :
|
|
1137
|
+
queryFn: chainId && currencyAddress ? () => fetchCurrency(chainId, currencyAddress, config) : skipToken
|
|
1197
1138
|
});
|
|
1198
1139
|
};
|
|
1199
1140
|
var useCurrency = (args) => {
|
|
@@ -1202,10 +1143,10 @@ var useCurrency = (args) => {
|
|
|
1202
1143
|
};
|
|
1203
1144
|
|
|
1204
1145
|
// src/react/hooks/useFilters.tsx
|
|
1205
|
-
import { queryOptions as
|
|
1146
|
+
import { queryOptions as queryOptions8, useQuery as useQuery11 } from "@tanstack/react-query";
|
|
1206
1147
|
import { z as z9 } from "zod";
|
|
1207
1148
|
var UseFiltersSchema = z9.object({
|
|
1208
|
-
chainId:
|
|
1149
|
+
chainId: z9.number(),
|
|
1209
1150
|
collectionAddress: AddressSchema,
|
|
1210
1151
|
showAllFilters: z9.boolean().default(false).optional(),
|
|
1211
1152
|
query: QueryArgSchema
|
|
@@ -1213,9 +1154,11 @@ var UseFiltersSchema = z9.object({
|
|
|
1213
1154
|
var fetchFilters = async (args, config) => {
|
|
1214
1155
|
const parsedArgs = UseFiltersSchema.parse(args);
|
|
1215
1156
|
const metadataClient = getMetadataClient(config);
|
|
1216
|
-
const filters = await metadataClient.
|
|
1217
|
-
chainID: parsedArgs.chainId,
|
|
1218
|
-
contractAddress: parsedArgs.collectionAddress
|
|
1157
|
+
const filters = await metadataClient.getTokenMetadataPropertyFilters({
|
|
1158
|
+
chainID: parsedArgs.chainId.toString(),
|
|
1159
|
+
contractAddress: parsedArgs.collectionAddress,
|
|
1160
|
+
excludeProperties: []
|
|
1161
|
+
// TODO: We can leverage this for some of the exclusion logic
|
|
1219
1162
|
}).then((resp) => resp.filters);
|
|
1220
1163
|
if (args.showAllFilters) return filters;
|
|
1221
1164
|
const queryClient = getQueryClient();
|
|
@@ -1256,7 +1199,7 @@ var fetchFilters = async (args, config) => {
|
|
|
1256
1199
|
return filteredResults;
|
|
1257
1200
|
};
|
|
1258
1201
|
var filtersOptions = (args, config) => {
|
|
1259
|
-
return
|
|
1202
|
+
return queryOptions8({
|
|
1260
1203
|
...args.query,
|
|
1261
1204
|
queryKey: [...collectableKeys.filter, args, config],
|
|
1262
1205
|
queryFn: () => fetchFilters(args, config)
|
|
@@ -1268,10 +1211,10 @@ var useFilters = (args) => {
|
|
|
1268
1211
|
};
|
|
1269
1212
|
|
|
1270
1213
|
// src/react/hooks/useFloorOrder.tsx
|
|
1271
|
-
import { queryOptions as
|
|
1214
|
+
import { queryOptions as queryOptions9, useQuery as useQuery12 } from "@tanstack/react-query";
|
|
1272
1215
|
import { z as z10 } from "zod";
|
|
1273
1216
|
var UseFloorOrderSchema = z10.object({
|
|
1274
|
-
chainId:
|
|
1217
|
+
chainId: z10.number(),
|
|
1275
1218
|
collectionAddress: AddressSchema,
|
|
1276
1219
|
query: QueryArgSchema
|
|
1277
1220
|
});
|
|
@@ -1280,7 +1223,7 @@ var fetchFloorOrder = async (args, config) => {
|
|
|
1280
1223
|
return marketplaceClient.getFloorOrder({ contractAddress: args.collectionAddress }).then((data) => data.collectible);
|
|
1281
1224
|
};
|
|
1282
1225
|
var floorOrderOptions = (args, config) => {
|
|
1283
|
-
return
|
|
1226
|
+
return queryOptions9({
|
|
1284
1227
|
queryKey: [...collectableKeys.floorOrders, args, config],
|
|
1285
1228
|
queryFn: () => fetchFloorOrder(args, config)
|
|
1286
1229
|
});
|
|
@@ -1292,33 +1235,6 @@ var useFloorOrder = (args) => {
|
|
|
1292
1235
|
|
|
1293
1236
|
// src/react/hooks/useHighestOffer.tsx
|
|
1294
1237
|
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
1295
|
-
|
|
1296
|
-
// src/react/queries/highestOffer.ts
|
|
1297
|
-
import { queryOptions as queryOptions11 } from "@tanstack/react-query";
|
|
1298
|
-
async function fetchHighestOffer(args, config) {
|
|
1299
|
-
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1300
|
-
const data = await marketplaceClient.getCollectibleHighestOffer({
|
|
1301
|
-
contractAddress: args.collectionAddress,
|
|
1302
|
-
tokenId: args.tokenId
|
|
1303
|
-
});
|
|
1304
|
-
let order;
|
|
1305
|
-
if (data.order) {
|
|
1306
|
-
order = {
|
|
1307
|
-
...data.order,
|
|
1308
|
-
priceAmount: BigInt(data.order.priceAmount),
|
|
1309
|
-
priceAmountNet: BigInt(data.order.priceAmountNet)
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
return order ?? null;
|
|
1313
|
-
}
|
|
1314
|
-
function highestOfferOptions(args, config) {
|
|
1315
|
-
return queryOptions11({
|
|
1316
|
-
queryKey: [...collectableKeys.highestOffers, args],
|
|
1317
|
-
queryFn: () => fetchHighestOffer(args, config)
|
|
1318
|
-
});
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
// src/react/hooks/useHighestOffer.tsx
|
|
1322
1238
|
function useHighestOffer(args) {
|
|
1323
1239
|
const config = useConfig();
|
|
1324
1240
|
return useQuery13(highestOfferOptions(args, config));
|
|
@@ -1326,56 +1242,6 @@ function useHighestOffer(args) {
|
|
|
1326
1242
|
|
|
1327
1243
|
// src/react/hooks/useListBalances.tsx
|
|
1328
1244
|
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
1329
|
-
|
|
1330
|
-
// src/react/queries/listBalances.ts
|
|
1331
|
-
import { infiniteQueryOptions } from "@tanstack/react-query";
|
|
1332
|
-
async function fetchBalances(args, config, page) {
|
|
1333
|
-
if (args.isLaos721) {
|
|
1334
|
-
const response = await fetch(
|
|
1335
|
-
"https://extensions.api.laosnetwork.io/token/GetTokenBalances",
|
|
1336
|
-
{
|
|
1337
|
-
method: "POST",
|
|
1338
|
-
headers: {
|
|
1339
|
-
"Content-Type": "application/json"
|
|
1340
|
-
},
|
|
1341
|
-
body: JSON.stringify({
|
|
1342
|
-
chainId: args.chainId.toString(),
|
|
1343
|
-
accountAddress: args.accountAddress,
|
|
1344
|
-
includeMetadata: args.includeMetadata ?? true,
|
|
1345
|
-
page: {
|
|
1346
|
-
sort: [
|
|
1347
|
-
{
|
|
1348
|
-
column: "CREATED_AT",
|
|
1349
|
-
order: "DESC"
|
|
1350
|
-
}
|
|
1351
|
-
]
|
|
1352
|
-
}
|
|
1353
|
-
})
|
|
1354
|
-
}
|
|
1355
|
-
);
|
|
1356
|
-
if (!response.ok) {
|
|
1357
|
-
throw new Error(`Laos API request failed with status ${response.status}`);
|
|
1358
|
-
}
|
|
1359
|
-
return response.json();
|
|
1360
|
-
}
|
|
1361
|
-
const indexerClient = getIndexerClient(args.chainId, config);
|
|
1362
|
-
return indexerClient.getTokenBalances({
|
|
1363
|
-
...args,
|
|
1364
|
-
tokenID: args.tokenId,
|
|
1365
|
-
page
|
|
1366
|
-
});
|
|
1367
|
-
}
|
|
1368
|
-
function listBalancesOptions(args, config) {
|
|
1369
|
-
return infiniteQueryOptions({
|
|
1370
|
-
...args.query,
|
|
1371
|
-
queryKey: [...balanceQueries.lists, args, config],
|
|
1372
|
-
queryFn: ({ pageParam }) => fetchBalances(args, config, pageParam),
|
|
1373
|
-
initialPageParam: { page: 1, pageSize: 30 },
|
|
1374
|
-
getNextPageParam: (lastPage) => lastPage.page.after
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
// src/react/hooks/useListBalances.tsx
|
|
1379
1245
|
function useListBalances(args) {
|
|
1380
1246
|
const config = useConfig();
|
|
1381
1247
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
@@ -1389,7 +1255,7 @@ function useListBalances(args) {
|
|
|
1389
1255
|
}
|
|
1390
1256
|
|
|
1391
1257
|
// src/react/hooks/useListCollectibleActivities.tsx
|
|
1392
|
-
import { queryOptions as
|
|
1258
|
+
import { queryOptions as queryOptions10, useQuery as useQuery14 } from "@tanstack/react-query";
|
|
1393
1259
|
var fetchCollectibleActivities = async (args, config) => {
|
|
1394
1260
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1395
1261
|
return marketplaceClient.listCollectibleActivities({
|
|
@@ -1406,7 +1272,7 @@ var fetchCollectibleActivities = async (args, config) => {
|
|
|
1406
1272
|
}));
|
|
1407
1273
|
};
|
|
1408
1274
|
var listCollectibleActivitiesOptions = (args, config) => {
|
|
1409
|
-
return
|
|
1275
|
+
return queryOptions10({
|
|
1410
1276
|
queryKey: [...collectableKeys.collectibleActivities, args, config],
|
|
1411
1277
|
queryFn: () => fetchCollectibleActivities(args, config),
|
|
1412
1278
|
enabled: args.query?.enabled ?? true
|
|
@@ -1418,51 +1284,31 @@ var useListCollectibleActivities = (args) => {
|
|
|
1418
1284
|
};
|
|
1419
1285
|
|
|
1420
1286
|
// src/react/hooks/useListCollectibles.tsx
|
|
1421
|
-
import {
|
|
1422
|
-
|
|
1423
|
-
var UseListCollectiblesArgsSchema = listCollectiblesArgsSchema.omit({
|
|
1424
|
-
contractAddress: true
|
|
1425
|
-
}).extend({
|
|
1426
|
-
collectionAddress: AddressSchema,
|
|
1427
|
-
chainId: ChainIdSchema.pipe(z11.coerce.string()),
|
|
1428
|
-
query: QueryArgSchema
|
|
1429
|
-
});
|
|
1430
|
-
var fetchCollectibles = async (args, marketplaceClient, page) => {
|
|
1431
|
-
const parsedArgs = UseListCollectiblesArgsSchema.parse(args);
|
|
1432
|
-
const arg = {
|
|
1433
|
-
...parsedArgs,
|
|
1434
|
-
contractAddress: parsedArgs.collectionAddress,
|
|
1435
|
-
page
|
|
1436
|
-
};
|
|
1437
|
-
return marketplaceClient.listCollectibles(arg);
|
|
1438
|
-
};
|
|
1439
|
-
var listCollectiblesOptions = (args, config) => {
|
|
1440
|
-
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1441
|
-
return infiniteQueryOptions2({
|
|
1442
|
-
queryKey: [...collectableKeys.lists, args],
|
|
1443
|
-
queryFn: ({ pageParam }) => fetchCollectibles(args, marketplaceClient, pageParam),
|
|
1444
|
-
initialPageParam: { page: 1, pageSize: 30 },
|
|
1445
|
-
getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0,
|
|
1446
|
-
enabled: args.query?.enabled ?? true
|
|
1447
|
-
});
|
|
1448
|
-
};
|
|
1449
|
-
var useListCollectibles = (args) => {
|
|
1287
|
+
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
1288
|
+
function useListCollectibles(args) {
|
|
1450
1289
|
const config = useConfig();
|
|
1290
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
1291
|
+
const isLaos721 = marketplaceConfig?.collections.find(
|
|
1292
|
+
(collection) => collection.address === args.collectionAddress
|
|
1293
|
+
)?.isLAOSERC721;
|
|
1294
|
+
if (isLaos721) {
|
|
1295
|
+
args.isLaos721 = true;
|
|
1296
|
+
}
|
|
1451
1297
|
return useInfiniteQuery2(listCollectiblesOptions(args, config));
|
|
1452
|
-
}
|
|
1298
|
+
}
|
|
1453
1299
|
|
|
1454
1300
|
// src/react/hooks/useListCollectiblesPaginated.tsx
|
|
1455
|
-
import { queryOptions as
|
|
1456
|
-
import { z as
|
|
1301
|
+
import { queryOptions as queryOptions11, useQuery as useQuery15 } from "@tanstack/react-query";
|
|
1302
|
+
import { z as z11 } from "zod";
|
|
1457
1303
|
var UseListCollectiblesPaginatedArgsSchema = listCollectiblesArgsSchema.omit({
|
|
1458
1304
|
contractAddress: true
|
|
1459
1305
|
}).extend({
|
|
1460
1306
|
collectionAddress: AddressSchema,
|
|
1461
|
-
chainId:
|
|
1462
|
-
query:
|
|
1463
|
-
enabled:
|
|
1464
|
-
page:
|
|
1465
|
-
pageSize:
|
|
1307
|
+
chainId: z11.number(),
|
|
1308
|
+
query: z11.object({
|
|
1309
|
+
enabled: z11.boolean().optional(),
|
|
1310
|
+
page: z11.number().optional().default(1),
|
|
1311
|
+
pageSize: z11.number().optional().default(30)
|
|
1466
1312
|
}).optional().default({})
|
|
1467
1313
|
});
|
|
1468
1314
|
var fetchCollectiblesPaginated = async (args, marketplaceClient) => {
|
|
@@ -1479,11 +1325,8 @@ var fetchCollectiblesPaginated = async (args, marketplaceClient) => {
|
|
|
1479
1325
|
return marketplaceClient.listCollectibles(arg);
|
|
1480
1326
|
};
|
|
1481
1327
|
var listCollectiblesPaginatedOptions = (args, config) => {
|
|
1482
|
-
const marketplaceClient = getMarketplaceClient(
|
|
1483
|
-
|
|
1484
|
-
config
|
|
1485
|
-
);
|
|
1486
|
-
return queryOptions13({
|
|
1328
|
+
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1329
|
+
return queryOptions11({
|
|
1487
1330
|
queryKey: [...collectableKeys.lists, "paginated", args],
|
|
1488
1331
|
queryFn: () => fetchCollectiblesPaginated(args, marketplaceClient),
|
|
1489
1332
|
enabled: args.query?.enabled ?? true
|
|
@@ -1495,7 +1338,7 @@ var useListCollectiblesPaginated = (args) => {
|
|
|
1495
1338
|
};
|
|
1496
1339
|
|
|
1497
1340
|
// src/react/hooks/useListCollectionActivities.tsx
|
|
1498
|
-
import { queryOptions as
|
|
1341
|
+
import { queryOptions as queryOptions12, useQuery as useQuery16 } from "@tanstack/react-query";
|
|
1499
1342
|
var fetchListCollectionActivities = async (args, config) => {
|
|
1500
1343
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1501
1344
|
return marketplaceClient.listCollectionActivities({
|
|
@@ -1511,7 +1354,7 @@ var fetchListCollectionActivities = async (args, config) => {
|
|
|
1511
1354
|
}));
|
|
1512
1355
|
};
|
|
1513
1356
|
var listCollectionActivitiesOptions = (args, config) => {
|
|
1514
|
-
return
|
|
1357
|
+
return queryOptions12({
|
|
1515
1358
|
queryKey: [...collectionKeys.collectionActivities, args, config],
|
|
1516
1359
|
queryFn: () => fetchListCollectionActivities(args, config),
|
|
1517
1360
|
enabled: args.query?.enabled ?? true
|
|
@@ -1523,12 +1366,12 @@ var useListCollectionActivities = (args) => {
|
|
|
1523
1366
|
};
|
|
1524
1367
|
|
|
1525
1368
|
// src/react/hooks/useListOffersForCollectible.tsx
|
|
1526
|
-
import { queryOptions as
|
|
1527
|
-
import { z as
|
|
1369
|
+
import { queryOptions as queryOptions13, useQuery as useQuery17 } from "@tanstack/react-query";
|
|
1370
|
+
import { z as z12 } from "zod";
|
|
1528
1371
|
var UseListOffersForCollectibleArgsSchema = listOffersForCollectibleArgsSchema.extend({
|
|
1529
|
-
chainId:
|
|
1530
|
-
collectionAddress:
|
|
1531
|
-
collectibleId:
|
|
1372
|
+
chainId: z12.number(),
|
|
1373
|
+
collectionAddress: z12.string(),
|
|
1374
|
+
collectibleId: z12.string()
|
|
1532
1375
|
}).omit({ contractAddress: true, tokenId: true });
|
|
1533
1376
|
var fetchListOffersForCollectible = async (config, args) => {
|
|
1534
1377
|
const arg = {
|
|
@@ -1541,7 +1384,7 @@ var fetchListOffersForCollectible = async (config, args) => {
|
|
|
1541
1384
|
return marketplaceClient.listCollectibleOffers(arg);
|
|
1542
1385
|
};
|
|
1543
1386
|
var listOffersForCollectibleOptions = (args, config) => {
|
|
1544
|
-
return
|
|
1387
|
+
return queryOptions13({
|
|
1545
1388
|
queryKey: [...collectableKeys.offers, args, config],
|
|
1546
1389
|
queryFn: () => fetchListOffersForCollectible(config, args)
|
|
1547
1390
|
});
|
|
@@ -1552,15 +1395,15 @@ var useListOffersForCollectible = (args) => {
|
|
|
1552
1395
|
};
|
|
1553
1396
|
|
|
1554
1397
|
// src/react/hooks/useCountOffersForCollectible.tsx
|
|
1555
|
-
import { queryOptions as
|
|
1556
|
-
import { z as
|
|
1398
|
+
import { queryOptions as queryOptions14, useQuery as useQuery18 } from "@tanstack/react-query";
|
|
1399
|
+
import { z as z13 } from "zod";
|
|
1557
1400
|
var UseCountOffersForCollectibleArgsSchema = countOffersForCollectibleArgsSchema.omit({
|
|
1558
1401
|
contractAddress: true,
|
|
1559
1402
|
tokenId: true
|
|
1560
1403
|
}).extend({
|
|
1561
1404
|
collectionAddress: AddressSchema,
|
|
1562
|
-
collectibleId:
|
|
1563
|
-
chainId:
|
|
1405
|
+
collectibleId: z13.string(),
|
|
1406
|
+
chainId: z13.number(),
|
|
1564
1407
|
query: QueryArgSchema
|
|
1565
1408
|
});
|
|
1566
1409
|
var fetchCountOffersForCollectible = async (args, config) => {
|
|
@@ -1573,7 +1416,7 @@ var fetchCountOffersForCollectible = async (args, config) => {
|
|
|
1573
1416
|
});
|
|
1574
1417
|
};
|
|
1575
1418
|
var countOffersForCollectibleOptions = (args, config) => {
|
|
1576
|
-
return
|
|
1419
|
+
return queryOptions14({
|
|
1577
1420
|
...args.query,
|
|
1578
1421
|
queryKey: [...collectableKeys.offersCount, args, config],
|
|
1579
1422
|
queryFn: () => fetchCountOffersForCollectible(args, config)
|
|
@@ -1585,12 +1428,12 @@ var useCountOffersForCollectible = (args) => {
|
|
|
1585
1428
|
};
|
|
1586
1429
|
|
|
1587
1430
|
// src/react/hooks/useListListingsForCollectible.tsx
|
|
1588
|
-
import { queryOptions as
|
|
1589
|
-
import { z as
|
|
1431
|
+
import { queryOptions as queryOptions15, useQuery as useQuery19 } from "@tanstack/react-query";
|
|
1432
|
+
import { z as z14 } from "zod";
|
|
1590
1433
|
var UseListListingsForCollectibleArgsSchema = listListingsForCollectibleArgsSchema.extend({
|
|
1591
|
-
chainId:
|
|
1592
|
-
collectionAddress:
|
|
1593
|
-
collectibleId:
|
|
1434
|
+
chainId: z14.number(),
|
|
1435
|
+
collectionAddress: z14.string(),
|
|
1436
|
+
collectibleId: z14.string()
|
|
1594
1437
|
}).omit({ contractAddress: true, tokenId: true });
|
|
1595
1438
|
var fetchListListingsForCollectible = async (config, args) => {
|
|
1596
1439
|
const arg = {
|
|
@@ -1603,7 +1446,7 @@ var fetchListListingsForCollectible = async (config, args) => {
|
|
|
1603
1446
|
return marketplaceClient.listCollectibleListings(arg);
|
|
1604
1447
|
};
|
|
1605
1448
|
var listListingsForCollectibleOptions = (args, config) => {
|
|
1606
|
-
return
|
|
1449
|
+
return queryOptions15({
|
|
1607
1450
|
queryKey: [...collectableKeys.listings, args, config],
|
|
1608
1451
|
queryFn: () => fetchListListingsForCollectible(config, args)
|
|
1609
1452
|
});
|
|
@@ -1614,15 +1457,15 @@ var useListListingsForCollectible = (args) => {
|
|
|
1614
1457
|
};
|
|
1615
1458
|
|
|
1616
1459
|
// src/react/hooks/useCountListingsForCollectible.tsx
|
|
1617
|
-
import { queryOptions as
|
|
1618
|
-
import { z as
|
|
1460
|
+
import { queryOptions as queryOptions16, useQuery as useQuery20 } from "@tanstack/react-query";
|
|
1461
|
+
import { z as z15 } from "zod";
|
|
1619
1462
|
var UseCountListingsForCollectibleArgsSchema = countListingsForCollectibleArgsSchema.omit({
|
|
1620
1463
|
contractAddress: true,
|
|
1621
1464
|
tokenId: true
|
|
1622
1465
|
}).extend({
|
|
1623
1466
|
collectionAddress: AddressSchema,
|
|
1624
|
-
collectibleId:
|
|
1625
|
-
chainId:
|
|
1467
|
+
collectibleId: z15.string(),
|
|
1468
|
+
chainId: z15.number(),
|
|
1626
1469
|
query: QueryArgSchema
|
|
1627
1470
|
});
|
|
1628
1471
|
var fetchCountListingsForCollectible = async (args, config) => {
|
|
@@ -1635,7 +1478,7 @@ var fetchCountListingsForCollectible = async (args, config) => {
|
|
|
1635
1478
|
});
|
|
1636
1479
|
};
|
|
1637
1480
|
var countListingsForCollectibleOptions = (args, config) => {
|
|
1638
|
-
return
|
|
1481
|
+
return queryOptions16({
|
|
1639
1482
|
...args.query,
|
|
1640
1483
|
queryKey: [...collectableKeys.listingsCount, args, config],
|
|
1641
1484
|
queryFn: () => fetchCountListingsForCollectible(args, config)
|
|
@@ -1647,13 +1490,13 @@ var useCountListingsForCollectible = (args) => {
|
|
|
1647
1490
|
};
|
|
1648
1491
|
|
|
1649
1492
|
// src/react/hooks/useLowestListing.tsx
|
|
1650
|
-
import { queryOptions as
|
|
1651
|
-
import { z as
|
|
1493
|
+
import { queryOptions as queryOptions17, useQuery as useQuery21 } from "@tanstack/react-query";
|
|
1494
|
+
import { z as z16 } from "zod";
|
|
1652
1495
|
var UseLowestListingSchema = getCollectibleLowestListingArgsSchema.omit({
|
|
1653
1496
|
contractAddress: true
|
|
1654
1497
|
}).extend({
|
|
1655
1498
|
collectionAddress: AddressSchema,
|
|
1656
|
-
chainId:
|
|
1499
|
+
chainId: z16.number(),
|
|
1657
1500
|
query: QueryArgSchema
|
|
1658
1501
|
});
|
|
1659
1502
|
var fetchLowestListing = async (args, config) => {
|
|
@@ -1665,7 +1508,7 @@ var fetchLowestListing = async (args, config) => {
|
|
|
1665
1508
|
});
|
|
1666
1509
|
};
|
|
1667
1510
|
var lowestListingOptions = (args, config) => {
|
|
1668
|
-
return
|
|
1511
|
+
return queryOptions17({
|
|
1669
1512
|
...args.query,
|
|
1670
1513
|
queryKey: [...collectableKeys.lowestListings, args, config],
|
|
1671
1514
|
queryFn: () => fetchLowestListing(args, config)
|
|
@@ -1678,11 +1521,11 @@ var useLowestListing = (args) => {
|
|
|
1678
1521
|
|
|
1679
1522
|
// src/react/hooks/useRoyalty.tsx
|
|
1680
1523
|
import { useReadContract } from "wagmi";
|
|
1681
|
-
import { z as
|
|
1682
|
-
var UseRoyaltySchema =
|
|
1683
|
-
chainId:
|
|
1524
|
+
import { z as z17 } from "zod";
|
|
1525
|
+
var UseRoyaltySchema = z17.object({
|
|
1526
|
+
chainId: z17.number(),
|
|
1684
1527
|
collectionAddress: AddressSchema,
|
|
1685
|
-
collectibleId:
|
|
1528
|
+
collectibleId: z17.string(),
|
|
1686
1529
|
query: QueryArgSchema.optional()
|
|
1687
1530
|
});
|
|
1688
1531
|
var useRoyalty = (args) => {
|
|
@@ -1694,7 +1537,7 @@ var useRoyalty = (args) => {
|
|
|
1694
1537
|
address: collectionAddress,
|
|
1695
1538
|
functionName: "royaltyInfo",
|
|
1696
1539
|
args: [BigInt(collectibleId), BigInt(100)],
|
|
1697
|
-
chainId
|
|
1540
|
+
chainId,
|
|
1698
1541
|
query
|
|
1699
1542
|
});
|
|
1700
1543
|
const [recipient, percentage] = contractResult.data ?? [];
|
|
@@ -1764,14 +1607,13 @@ var useGenerateOfferTransaction = (params) => {
|
|
|
1764
1607
|
|
|
1765
1608
|
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1766
1609
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1767
|
-
import { z as
|
|
1768
|
-
var UserGeneratSellTransactionArgsSchema =
|
|
1769
|
-
chainId:
|
|
1770
|
-
onSuccess:
|
|
1610
|
+
import { z as z18 } from "zod";
|
|
1611
|
+
var UserGeneratSellTransactionArgsSchema = z18.object({
|
|
1612
|
+
chainId: z18.number(),
|
|
1613
|
+
onSuccess: z18.function().args(stepSchema.array().optional()).optional()
|
|
1771
1614
|
});
|
|
1772
1615
|
var generateSellTransaction = async (args, config, chainId) => {
|
|
1773
|
-
const
|
|
1774
|
-
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
1616
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1775
1617
|
return marketplaceClient.generateSellTransaction(args).then((data) => data.steps);
|
|
1776
1618
|
};
|
|
1777
1619
|
var useGenerateSellTransaction = (params) => {
|
|
@@ -1789,14 +1631,13 @@ var useGenerateSellTransaction = (params) => {
|
|
|
1789
1631
|
|
|
1790
1632
|
// src/react/hooks/useGenerateCancelTransaction.tsx
|
|
1791
1633
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
1792
|
-
import { z as
|
|
1793
|
-
var UserGenerateCancelTransactionArgsSchema =
|
|
1794
|
-
chainId:
|
|
1795
|
-
onSuccess:
|
|
1634
|
+
import { z as z19 } from "zod";
|
|
1635
|
+
var UserGenerateCancelTransactionArgsSchema = z19.object({
|
|
1636
|
+
chainId: z19.number(),
|
|
1637
|
+
onSuccess: z19.function().args(stepSchema.array().optional()).optional()
|
|
1796
1638
|
});
|
|
1797
1639
|
var generateCancelTransaction = async (args, config, chainId) => {
|
|
1798
|
-
const
|
|
1799
|
-
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
1640
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1800
1641
|
return marketplaceClient.generateCancelTransaction(args).then((data) => data.steps);
|
|
1801
1642
|
};
|
|
1802
1643
|
var useGenerateCancelTransaction = (params) => {
|
|
@@ -1868,16 +1709,16 @@ var useTransferTokens = () => {
|
|
|
1868
1709
|
};
|
|
1869
1710
|
|
|
1870
1711
|
// src/react/hooks/useCheckoutOptions.tsx
|
|
1871
|
-
import { queryOptions as
|
|
1712
|
+
import { queryOptions as queryOptions18, useQuery as useQuery22 } from "@tanstack/react-query";
|
|
1872
1713
|
import { useAccount as useAccount3 } from "wagmi";
|
|
1873
|
-
import { z as
|
|
1874
|
-
var UseCheckoutOptionsSchema =
|
|
1875
|
-
chainId:
|
|
1876
|
-
orders:
|
|
1877
|
-
|
|
1714
|
+
import { z as z20 } from "zod";
|
|
1715
|
+
var UseCheckoutOptionsSchema = z20.object({
|
|
1716
|
+
chainId: z20.number(),
|
|
1717
|
+
orders: z20.array(
|
|
1718
|
+
z20.object({
|
|
1878
1719
|
collectionAddress: AddressSchema,
|
|
1879
|
-
orderId:
|
|
1880
|
-
marketplace:
|
|
1720
|
+
orderId: z20.string(),
|
|
1721
|
+
marketplace: z20.nativeEnum(MarketplaceKind)
|
|
1881
1722
|
})
|
|
1882
1723
|
),
|
|
1883
1724
|
query: QueryArgSchema
|
|
@@ -1896,7 +1737,7 @@ var fetchCheckoutOptions = async (args, config) => {
|
|
|
1896
1737
|
});
|
|
1897
1738
|
};
|
|
1898
1739
|
var checkoutOptionsOptions = (args, config) => {
|
|
1899
|
-
return
|
|
1740
|
+
return queryOptions18({
|
|
1900
1741
|
queryKey: ["checkoutOptions", args],
|
|
1901
1742
|
queryFn: () => fetchCheckoutOptions(args, config)
|
|
1902
1743
|
});
|
|
@@ -1911,9 +1752,9 @@ var useCheckoutOptions = (args) => {
|
|
|
1911
1752
|
};
|
|
1912
1753
|
|
|
1913
1754
|
// src/react/hooks/useListCollections.tsx
|
|
1914
|
-
import { queryOptions as
|
|
1915
|
-
import { z as
|
|
1916
|
-
var UseListCollectionsSchema =
|
|
1755
|
+
import { queryOptions as queryOptions19, useQuery as useQuery23 } from "@tanstack/react-query";
|
|
1756
|
+
import { z as z21 } from "zod";
|
|
1757
|
+
var UseListCollectionsSchema = z21.object({
|
|
1917
1758
|
query: QueryArgSchema.optional().default({})
|
|
1918
1759
|
});
|
|
1919
1760
|
var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
@@ -1939,7 +1780,7 @@ var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
|
1939
1780
|
return results.flat();
|
|
1940
1781
|
};
|
|
1941
1782
|
var listCollectionsOptions = (args, config) => {
|
|
1942
|
-
return
|
|
1783
|
+
return queryOptions19({
|
|
1943
1784
|
...args.query,
|
|
1944
1785
|
queryKey: [...collectionKeys.list],
|
|
1945
1786
|
queryFn: () => fetchListCollections(args, config)
|
|
@@ -1958,64 +1799,14 @@ var useListCollections = (args = {}) => {
|
|
|
1958
1799
|
});
|
|
1959
1800
|
};
|
|
1960
1801
|
|
|
1961
|
-
// src/react/hooks/useGenerateBuyTransaction.tsx
|
|
1962
|
-
import { queryOptions as queryOptions22, skipToken as skipToken3, useQuery as useQuery24 } from "@tanstack/react-query";
|
|
1963
|
-
import { useAccount as useAccount4 } from "wagmi";
|
|
1964
|
-
import { z as z23 } from "zod";
|
|
1965
|
-
var UseGenerateBuyTransactionArgsSchema = z23.object({
|
|
1966
|
-
chainId: ChainIdSchema.pipe(z23.coerce.string()),
|
|
1967
|
-
collectionAddress: AddressSchema,
|
|
1968
|
-
marketplace: z23.nativeEnum(MarketplaceKind),
|
|
1969
|
-
ordersData: z23.array(
|
|
1970
|
-
z23.object({
|
|
1971
|
-
orderId: z23.string(),
|
|
1972
|
-
quantity: z23.string(),
|
|
1973
|
-
marketplace: z23.string(),
|
|
1974
|
-
tokenId: z23.string().optional()
|
|
1975
|
-
})
|
|
1976
|
-
),
|
|
1977
|
-
walletType: z23.nativeEnum(WalletKind).optional(),
|
|
1978
|
-
query: QueryArgSchema
|
|
1979
|
-
});
|
|
1980
|
-
var fetchGenerateBuyTransaction = async (args, config) => {
|
|
1981
|
-
const parsedArgs = UseGenerateBuyTransactionArgsSchema.parse(args);
|
|
1982
|
-
const marketplaceClient = getMarketplaceClient(parsedArgs.chainId, config);
|
|
1983
|
-
return marketplaceClient.generateBuyTransaction({
|
|
1984
|
-
...parsedArgs,
|
|
1985
|
-
buyer: args.buyer,
|
|
1986
|
-
additionalFees: []
|
|
1987
|
-
// TODO: Add additional fees
|
|
1988
|
-
}).then((data) => data.steps);
|
|
1989
|
-
};
|
|
1990
|
-
var generateBuyTransactionOptions = (args, config) => {
|
|
1991
|
-
return queryOptions22({
|
|
1992
|
-
queryKey: ["generateBuyTransaction", args],
|
|
1993
|
-
queryFn: () => fetchGenerateBuyTransaction(args, config),
|
|
1994
|
-
...args.query
|
|
1995
|
-
});
|
|
1996
|
-
};
|
|
1997
|
-
var useGenerateBuyTransaction = (args) => {
|
|
1998
|
-
const { address } = useAccount4();
|
|
1999
|
-
const config = useConfig();
|
|
2000
|
-
return useQuery24({
|
|
2001
|
-
queryKey: ["generateBuyTransaction", args],
|
|
2002
|
-
queryFn: address ? () => {
|
|
2003
|
-
return fetchGenerateBuyTransaction(
|
|
2004
|
-
{ buyer: address, ...args },
|
|
2005
|
-
config
|
|
2006
|
-
);
|
|
2007
|
-
} : skipToken3
|
|
2008
|
-
});
|
|
2009
|
-
};
|
|
2010
|
-
|
|
2011
1802
|
// src/react/hooks/useCancelOrder.tsx
|
|
2012
1803
|
import { useWaasFeeOptions } from "@0xsequence/connect";
|
|
2013
1804
|
import { useEffect, useState } from "react";
|
|
2014
1805
|
|
|
2015
1806
|
// src/react/_internal/wallet/useWallet.ts
|
|
2016
|
-
import { skipToken as
|
|
1807
|
+
import { skipToken as skipToken2, useQuery as useQuery24 } from "@tanstack/react-query";
|
|
2017
1808
|
import {
|
|
2018
|
-
useAccount as
|
|
1809
|
+
useAccount as useAccount4,
|
|
2019
1810
|
useChainId,
|
|
2020
1811
|
usePublicClient,
|
|
2021
1812
|
useSwitchChain,
|
|
@@ -2277,12 +2068,16 @@ var awaitTransactionReceipt = async ({
|
|
|
2277
2068
|
// src/react/_internal/wallet/useWallet.ts
|
|
2278
2069
|
var useWallet = () => {
|
|
2279
2070
|
const { chains } = useSwitchChain();
|
|
2280
|
-
const {
|
|
2281
|
-
|
|
2071
|
+
const {
|
|
2072
|
+
data: walletClient,
|
|
2073
|
+
isLoading: wagmiWalletIsLoading,
|
|
2074
|
+
isError: wagmiWalletIsError
|
|
2075
|
+
} = useWalletClient();
|
|
2076
|
+
const { connector, isConnected, isConnecting } = useAccount4();
|
|
2282
2077
|
const sdkConfig = useConfig();
|
|
2283
2078
|
const chainId = useChainId();
|
|
2284
2079
|
const publicClient = usePublicClient();
|
|
2285
|
-
const { data, isLoading, isError } =
|
|
2080
|
+
const { data, isLoading, isError } = useQuery24({
|
|
2286
2081
|
queryKey: ["wallet", chainId, connector?.uid],
|
|
2287
2082
|
queryFn: walletClient && connector && isConnected && publicClient ? () => {
|
|
2288
2083
|
return wallet({
|
|
@@ -2292,13 +2087,13 @@ var useWallet = () => {
|
|
|
2292
2087
|
sdkConfig,
|
|
2293
2088
|
publicClient
|
|
2294
2089
|
});
|
|
2295
|
-
} :
|
|
2090
|
+
} : skipToken2,
|
|
2296
2091
|
staleTime: Number.POSITIVE_INFINITY
|
|
2297
2092
|
});
|
|
2298
2093
|
return {
|
|
2299
2094
|
wallet: data,
|
|
2300
2095
|
isLoading: isLoading || isConnecting || wagmiWalletIsLoading,
|
|
2301
|
-
isError
|
|
2096
|
+
isError: isError || wagmiWalletIsError
|
|
2302
2097
|
};
|
|
2303
2098
|
};
|
|
2304
2099
|
|
|
@@ -2630,11 +2425,11 @@ var useCancelOrder = ({
|
|
|
2630
2425
|
tokenID: opt.token.tokenID || null
|
|
2631
2426
|
}
|
|
2632
2427
|
})),
|
|
2633
|
-
chainId
|
|
2428
|
+
chainId
|
|
2634
2429
|
} : {
|
|
2635
2430
|
id: "",
|
|
2636
2431
|
options: void 0,
|
|
2637
|
-
chainId
|
|
2432
|
+
chainId
|
|
2638
2433
|
}
|
|
2639
2434
|
});
|
|
2640
2435
|
useEffect(() => {
|
|
@@ -2676,7 +2471,7 @@ var useCancelOrder = ({
|
|
|
2676
2471
|
};
|
|
2677
2472
|
|
|
2678
2473
|
// src/react/hooks/useCollectionDetails.tsx
|
|
2679
|
-
import { queryOptions as
|
|
2474
|
+
import { queryOptions as queryOptions20, useQuery as useQuery25 } from "@tanstack/react-query";
|
|
2680
2475
|
var fetchCollectionDetails = async (args, marketplaceClient) => {
|
|
2681
2476
|
const { collection } = await marketplaceClient.getCollectionDetail({
|
|
2682
2477
|
contractAddress: args.collectionAddress
|
|
@@ -2685,18 +2480,18 @@ var fetchCollectionDetails = async (args, marketplaceClient) => {
|
|
|
2685
2480
|
};
|
|
2686
2481
|
var collectionDetailsOptions = (args, config) => {
|
|
2687
2482
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
2688
|
-
return
|
|
2483
|
+
return queryOptions20({
|
|
2689
2484
|
queryKey: ["collectionDetails", args],
|
|
2690
2485
|
queryFn: () => fetchCollectionDetails(args, marketplaceClient)
|
|
2691
2486
|
});
|
|
2692
2487
|
};
|
|
2693
2488
|
var useCollectionDetails = (args) => {
|
|
2694
2489
|
const config = useConfig();
|
|
2695
|
-
return
|
|
2490
|
+
return useQuery25(collectionDetailsOptions(args, config));
|
|
2696
2491
|
};
|
|
2697
2492
|
|
|
2698
2493
|
// src/react/hooks/useCollectionDetailsPolling.tsx
|
|
2699
|
-
import { queryOptions as
|
|
2494
|
+
import { queryOptions as queryOptions21, useQuery as useQuery26 } from "@tanstack/react-query";
|
|
2700
2495
|
var INITIAL_POLLING_INTERVAL = 2e3;
|
|
2701
2496
|
var MAX_POLLING_INTERVAL = 3e4;
|
|
2702
2497
|
var MAX_ATTEMPTS = 30;
|
|
@@ -2709,7 +2504,7 @@ var isTerminalState = (status) => {
|
|
|
2709
2504
|
].includes(status);
|
|
2710
2505
|
};
|
|
2711
2506
|
var collectionDetailsPollingOptions = (args, config) => {
|
|
2712
|
-
return
|
|
2507
|
+
return queryOptions21({
|
|
2713
2508
|
...collectionDetailsOptions(args, config),
|
|
2714
2509
|
refetchInterval: (query) => {
|
|
2715
2510
|
const data = query.state.data;
|
|
@@ -2732,7 +2527,7 @@ var collectionDetailsPollingOptions = (args, config) => {
|
|
|
2732
2527
|
};
|
|
2733
2528
|
var useCollectionDetailsPolling = (args) => {
|
|
2734
2529
|
const config = useConfig();
|
|
2735
|
-
return
|
|
2530
|
+
return useQuery26(collectionDetailsPollingOptions(args, config));
|
|
2736
2531
|
};
|
|
2737
2532
|
|
|
2738
2533
|
export {
|
|
@@ -2768,7 +2563,6 @@ export {
|
|
|
2768
2563
|
useListBalances,
|
|
2769
2564
|
listCollectibleActivitiesOptions,
|
|
2770
2565
|
useListCollectibleActivities,
|
|
2771
|
-
listCollectiblesOptions,
|
|
2772
2566
|
useListCollectibles,
|
|
2773
2567
|
listCollectiblesPaginatedOptions,
|
|
2774
2568
|
useListCollectiblesPaginated,
|
|
@@ -2799,10 +2593,6 @@ export {
|
|
|
2799
2593
|
useCheckoutOptions,
|
|
2800
2594
|
listCollectionsOptions,
|
|
2801
2595
|
useListCollections,
|
|
2802
|
-
UseGenerateBuyTransactionArgsSchema,
|
|
2803
|
-
fetchGenerateBuyTransaction,
|
|
2804
|
-
generateBuyTransactionOptions,
|
|
2805
|
-
useGenerateBuyTransaction,
|
|
2806
2596
|
useWallet,
|
|
2807
2597
|
AlertMessage,
|
|
2808
2598
|
MODAL_OVERLAY_PROPS,
|
|
@@ -2815,4 +2605,4 @@ export {
|
|
|
2815
2605
|
collectionDetailsPollingOptions,
|
|
2816
2606
|
useCollectionDetailsPolling
|
|
2817
2607
|
};
|
|
2818
|
-
//# sourceMappingURL=chunk-
|
|
2608
|
+
//# sourceMappingURL=chunk-X3QNSQER.js.map
|