@0xsequence/marketplace-sdk 1.1.1 → 1.2.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/CHANGELOG.md +54 -3
- package/dist/{BellIcon-ByhygxBO.js → BellIcon.js} +4 -4
- package/dist/BellIcon.js.map +1 -0
- package/dist/{CartIcon-Bt3rQYGk.js → CartIcon.js} +7 -7
- package/dist/CartIcon.js.map +1 -0
- package/dist/CollectibleCard.d.ts +8 -0
- package/dist/{_internal-DkS2VUn5.js → _internal.js} +2 -2
- package/dist/_internal.js.map +1 -0
- package/dist/{abi-fa-o9gH3.js → abi.js} +2 -2
- package/dist/abi.js.map +1 -0
- package/dist/{alien_swap-DoY6XfMA.js → alien_swap.js} +1 -1
- package/dist/alien_swap.js.map +1 -0
- package/dist/{api-BoO0V5aJ.js → api.js} +13 -64
- package/dist/api.js.map +1 -0
- package/dist/{aqua-xyz-BBDxnG14.js → aqua-xyz.js} +1 -1
- package/dist/aqua-xyz.js.map +1 -0
- package/dist/{aura-DGx2zwvF.js → aura.js} +1 -1
- package/dist/aura.js.map +1 -0
- package/dist/{blur-D8GKrRrq.js → blur.js} +1 -1
- package/dist/blur.js.map +1 -0
- package/dist/{builder-api-BFuZNOaN.js → builder-api.js} +3 -3
- package/dist/builder-api.js.map +1 -0
- package/dist/{builder.gen-B9wR2nvF.js → builder.gen.js} +3 -6
- package/dist/builder.gen.js.map +1 -0
- package/dist/{coinbase-DOry4PXY.js → coinbase.js} +1 -1
- package/dist/coinbase.js.map +1 -0
- package/dist/{collectibles-C_H8jMGH.js → collectibles.js} +9 -48
- package/dist/collectibles.js.map +1 -0
- package/dist/{collections-CKummc-R.js → collections.js} +79 -8
- package/dist/collections.js.map +1 -0
- package/dist/{components-CosnX7F9.js → components.js} +12 -14
- package/dist/components.js.map +1 -0
- package/dist/{contracts-BP_0vX48.js → contracts.js} +4 -4
- package/dist/contracts.js.map +1 -0
- package/dist/{create-config-ZOB7i4ZJ.d.ts → create-config.d.ts} +47 -60
- package/dist/{create-config-CIfejoCk.js → create-config.js} +10 -13
- package/dist/create-config.js.map +1 -0
- package/dist/{element-ciybd_VF.js → element.js} +1 -1
- package/dist/element.js.map +1 -0
- package/dist/{filters-V-V8Dn8f.d.ts → filters.d.ts} +7 -7
- package/dist/{foundation-Bq4lRz4x.js → foundation.js} +1 -1
- package/dist/foundation.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +16 -16
- package/dist/{index-DUXfvhxs.d.ts → index10.d.ts} +14 -29
- package/dist/{index-CxA34wP1.d.ts → index11.d.ts} +101 -23
- package/dist/{index-BtWMBHeP.d.ts → index12.d.ts} +11 -9
- package/dist/{index-DmudgrsN.d.ts → index13.d.ts} +16 -16
- package/dist/{index-U-zp70of.d.ts → index14.d.ts} +9 -13
- package/dist/{index-Stm5u0I0.d.ts → index16.d.ts} +7 -10
- package/dist/{index-BZIJTQT0.d.ts → index17.d.ts} +9 -9
- package/dist/{index-CnEbXm_t.d.ts → index19.d.ts} +50 -12
- package/dist/{index-C-745li7.d.ts → index2.d.ts} +2 -2
- package/dist/{index-BOiHR01C.d.ts → index21.d.ts} +9 -9
- package/dist/{index-Bsx6XsC2.d.ts → index23.d.ts} +100 -59
- package/dist/{index-CPzvNmq9.d.ts → index24.d.ts} +36 -36
- package/dist/{index-DFEnA6Wa.d.ts → index25.d.ts} +18 -18
- package/dist/{index-DqXd1EeB.d.ts → index26.d.ts} +14 -7
- package/dist/{index-NlPMNcqh.d.ts → index27.d.ts} +102 -114
- package/dist/{index-DWt6yrIG.d.ts → index28.d.ts} +8 -8
- package/dist/{index-C4MUKshG.d.ts → index29.d.ts} +3 -3
- package/dist/{index-BeRV-7AX.d.ts → index3.d.ts} +2 -2
- package/dist/{index-Bxzjy0d1.d.ts → index4.d.ts} +2 -2
- package/dist/{index-DwKr18CI.d.ts → index5.d.ts} +2 -2
- package/dist/{index-D9LPlmbC.d.ts → index6.d.ts} +2 -2
- package/dist/{index-CS65jqOq.d.ts → index7.d.ts} +19 -3
- package/dist/index8.d.ts +18 -0
- package/dist/{index-CxpFwGvR.d.ts → index9.d.ts} +4 -4
- package/dist/{inventory-Dd7TazvZ.js → inventory.js} +11 -15
- package/dist/inventory.js.map +1 -0
- package/dist/{listCollectiblesPaginated-Cy2_qEZA.d.ts → listCollectiblesPaginated.d.ts} +24 -29
- package/dist/{listCollections-BB9FxKj2.d.ts → listCollections.d.ts} +170 -100
- package/dist/{looks-rare-6H--x3AM.js → looks-rare.js} +1 -1
- package/dist/looks-rare.js.map +1 -0
- package/dist/{lowestListing-Cbsi6M1K.d.ts → lowestListing.d.ts} +28 -28
- package/dist/{magic-eden-BoxEQ1Li.js → magic-eden.js} +1 -1
- package/dist/magic-eden.js.map +1 -0
- package/dist/{manifold-DycKsljb.js → manifold.js} +1 -1
- package/dist/manifold.js.map +1 -0
- package/dist/{market-C3HV-awQ.js → market.js} +7 -9
- package/dist/market.js.map +1 -0
- package/dist/{marketCurrencies-Bpw1bIO0.d.ts → marketCurrencies.d.ts} +19 -9
- package/dist/{marketCurrencies-sKrTX0og.js → marketCurrencies.js} +10 -7
- package/dist/marketCurrencies.js.map +1 -0
- package/dist/{marketplace-logos-D4dS1Foy.js → marketplace-logos.js} +23 -23
- package/dist/marketplace-logos.js.map +1 -0
- package/dist/{marketplace.gen-ksUafDqS.js → marketplace.gen.js} +25 -9
- package/dist/marketplace.gen.js.map +1 -0
- package/dist/{marketplace-NQB-sEQL.js → marketplace.js} +2 -2
- package/dist/marketplace.js.map +1 -0
- package/dist/{marketplaceConfig-UHQMM9fq.js → marketplaceConfig.js} +3 -3
- package/dist/marketplaceConfig.js.map +1 -0
- package/dist/{mintify-Dyqyo8jQ.js → mintify.js} +1 -1
- package/dist/mintify.js.map +1 -0
- package/dist/{network-DtmiMhcg.js → network.js} +3 -3
- package/dist/network.js.map +1 -0
- package/dist/{networkconfigToWagmiChain-DbUf6HiO.js → networkconfigToWagmiChain.js} +4 -3
- package/dist/networkconfigToWagmiChain.js.map +1 -0
- package/dist/{nftx-2LbFjj9Q.js → nftx.js} +1 -1
- package/dist/nftx.js.map +1 -0
- package/dist/{okx-CBEWJNsR.js → okx.js} +1 -1
- package/dist/okx.js.map +1 -0
- package/dist/{open-sea-Dxntz_PA.js → open-sea.js} +1 -1
- package/dist/open-sea.js.map +1 -0
- package/dist/{orders-DnFfZAXV.js → orders.js} +10 -10
- package/dist/orders.js.map +1 -0
- package/dist/{primary-sale-1u4QlPdA.js → primary-sale.js} +2 -2
- package/dist/primary-sale.js.map +1 -0
- package/dist/{primary-sales-Dmsi6bqj.js → primary-sales.js} +41 -3
- package/dist/primary-sales.js.map +1 -0
- package/dist/{query-BWbCsXLY.d.ts → query.d.ts} +2 -2
- package/dist/{rarible-CS0SupHr.js → rarible.js} +1 -1
- package/dist/rarible.js.map +1 -0
- package/dist/react/_internal/api/index.d.ts +2 -2
- package/dist/react/_internal/api/index.js +7 -7
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +37 -38
- package/dist/react/_internal/index.d.ts +2 -2
- package/dist/react/_internal/index.js +11 -11
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/_internal/wagmi/index.js +5 -5
- package/dist/react/hooks/config/index.d.ts +8 -8
- package/dist/react/hooks/config/index.js +37 -38
- package/dist/react/hooks/contracts/index.d.ts +6 -6
- package/dist/react/hooks/contracts/index.js +15 -15
- package/dist/react/hooks/data/collectibles/index.d.ts +4 -10
- package/dist/react/hooks/data/collectibles/index.js +37 -38
- package/dist/react/hooks/data/collections/index.d.ts +11 -11
- package/dist/react/hooks/data/collections/index.js +38 -39
- package/dist/react/hooks/data/index.d.ts +37 -37
- package/dist/react/hooks/data/index.js +38 -39
- package/dist/react/hooks/data/inventory/index.d.ts +36 -36
- package/dist/react/hooks/data/inventory/index.js +37 -38
- package/dist/react/hooks/data/market/index.d.ts +5 -11
- package/dist/react/hooks/data/market/index.js +37 -38
- package/dist/react/hooks/data/orders/index.d.ts +4 -10
- package/dist/react/hooks/data/orders/index.js +37 -38
- package/dist/react/hooks/data/primary-sales/index.d.ts +37 -37
- package/dist/react/hooks/data/primary-sales/index.js +38 -39
- package/dist/react/hooks/data/tokens/index.d.ts +4 -4
- package/dist/react/hooks/data/tokens/index.js +37 -38
- package/dist/react/hooks/index.d.ts +37 -37
- package/dist/react/hooks/index.js +38 -39
- package/dist/react/hooks/transactions/index.d.ts +2 -2
- package/dist/react/hooks/transactions/index.js +37 -38
- package/dist/react/hooks/ui/index.d.ts +4 -4
- package/dist/react/hooks/ui/index.js +37 -38
- package/dist/react/hooks/utils/index.d.ts +36 -36
- package/dist/react/hooks/utils/index.js +37 -38
- package/dist/react/index.d.ts +37 -37
- package/dist/react/index.js +38 -39
- package/dist/react/queries/collectibles/index.d.ts +4 -10
- package/dist/react/queries/collectibles/index.js +20 -21
- package/dist/react/queries/collections/index.d.ts +11 -11
- package/dist/react/queries/collections/index.js +19 -19
- package/dist/react/queries/index.d.ts +24 -24
- package/dist/react/queries/index.js +30 -31
- package/dist/react/queries/inventory/index.d.ts +2 -2
- package/dist/react/queries/inventory/index.js +20 -20
- package/dist/react/queries/market/index.d.ts +5 -5
- package/dist/react/queries/market/index.js +20 -20
- package/dist/react/queries/orders/index.d.ts +4 -10
- package/dist/react/queries/orders/index.js +11 -11
- package/dist/react/queries/primary-sales/index.d.ts +4 -4
- package/dist/react/queries/primary-sales/index.js +12 -12
- package/dist/react/queries/tokens/index.d.ts +4 -4
- package/dist/react/queries/tokens/index.js +11 -12
- package/dist/react/queries/utils/index.d.ts +3 -3
- package/dist/react/queries/utils/index.js +20 -20
- package/dist/react/ssr/index.d.ts +7 -7
- package/dist/react/ssr/index.js +13 -16
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +2 -2
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +20 -20
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +7 -10
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +37 -38
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +4 -4
- package/dist/react/ui/components/marketplace-collectible-card/index.js +37 -38
- package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +2 -2
- package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +11 -11
- package/dist/react/ui/components/marketplace-logos/index.d.ts +21 -21
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/icons/index.js +14 -14
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +37 -38
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +37 -38
- package/dist/react/utils/index.d.ts +1 -1
- package/dist/react/utils/index.js +7 -7
- package/dist/{react-DE852KeT.js → react.js} +720 -926
- package/dist/react.js.map +1 -0
- package/dist/{sequence-paCCener.js → sequence.js} +1 -1
- package/dist/sequence.js.map +1 -0
- package/dist/{src-Dz2CfBL0.js → src.js} +2 -2
- package/dist/src.js.map +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/{sudo-swap-9rH2EgfT.js → sudo-swap.js} +1 -1
- package/dist/sudo-swap.js.map +1 -0
- package/dist/{super-rare-DHIuWtRw.js → super-rare.js} +1 -1
- package/dist/super-rare.js.map +1 -0
- package/dist/{token-Cv7l2ZaL.js → token.js} +2 -2
- package/dist/token.js.map +1 -0
- package/dist/{tokenBalances-ibDerNmM.js → tokenBalances.js} +4 -11
- package/dist/tokenBalances.js.map +1 -0
- package/dist/{tokenSupplies-Bfe8RHzI.d.ts → tokenSupplies.d.ts} +19 -30
- package/dist/{tokens-cGxMadd8.js → tokens.js} +47 -22
- package/dist/tokens.js.map +1 -0
- package/dist/{transaction-DZUW5RHu.js → transaction.js} +2 -2
- package/dist/transaction.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +3 -3
- package/dist/{types-D2TJ1dwv.d.ts → types.d.ts} +3 -3
- package/dist/{types-B_-cnkcP.js → types.js} +2 -2
- package/dist/types.js.map +1 -0
- package/dist/utils/abi/index.d.ts +4 -4
- package/dist/utils/abi/index.js +4 -4
- package/dist/utils/abi/marketplace/index.d.ts +1 -1
- package/dist/utils/abi/marketplace/index.js +1 -1
- package/dist/utils/abi/primary-sale/index.d.ts +1 -1
- package/dist/utils/abi/primary-sale/index.js +1 -1
- package/dist/utils/abi/token/index.d.ts +1 -1
- package/dist/utils/abi/token/index.js +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +13 -13
- package/dist/{utils-BfpDVibN.js → utils.js} +42 -4
- package/dist/utils.js.map +1 -0
- package/dist/{utils-BCgNhBFR.js → utils2.js} +11 -5
- package/dist/utils2.js.map +1 -0
- package/dist/{utils-BqxcalL2.js → utils3.js} +3 -3
- package/dist/utils3.js.map +1 -0
- package/dist/{waitForTransactionReceipt-DieAnV52.js → waitForTransactionReceipt.js} +3 -3
- package/dist/waitForTransactionReceipt.js.map +1 -0
- package/dist/{x2y2-45WDooeh.js → x2y2.js} +1 -1
- package/dist/x2y2.js.map +1 -0
- package/dist/{zora-CbeBoLvQ.js → zora.js} +1 -1
- package/dist/zora.js.map +1 -0
- package/package.json +42 -42
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +13 -0
- package/src/react/_internal/api/index.ts +0 -1
- package/src/react/_internal/api/marketplace.gen.ts +70 -26
- package/src/react/_internal/api/query-keys.ts +9 -0
- package/src/react/_internal/wagmi/get-connectors.ts +12 -1
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +0 -9
- package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -16
- package/src/react/hooks/data/collectibles/useTokenBalances.tsx +0 -9
- package/src/react/hooks/data/collections/index.ts +2 -0
- package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +112 -0
- package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx +74 -0
- package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +110 -0
- package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx +74 -0
- package/src/react/hooks/data/inventory/useInventory.tsx +1 -10
- package/src/react/hooks/data/market/useMarketCurrencies.test.tsx +31 -2
- package/src/react/hooks/data/primary-sales/index.ts +1 -0
- package/src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx +71 -0
- package/src/react/hooks/data/tokens/useListBalances.tsx +1 -10
- package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -13
- package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +2 -0
- package/src/react/hooks/transactions/useProcessStep.test.tsx +8 -6
- package/src/react/hooks/transactions/useProcessStep.ts +8 -6
- package/src/react/hooks/utils/useComparePrices.test.tsx +1 -1
- package/src/react/providers/modal-provider.tsx +2 -1
- package/src/react/queries/collectibles/balanceOfCollectible.ts +1 -15
- package/src/react/queries/collectibles/listCollectibles.ts +1 -54
- package/src/react/queries/collectibles/tokenBalances.ts +1 -15
- package/src/react/queries/collections/activeListingsCurrencies.ts +84 -0
- package/src/react/queries/collections/activeOffersCurrencies.ts +84 -0
- package/src/react/queries/collections/index.ts +2 -0
- package/src/react/queries/inventory/inventory.ts +2 -9
- package/src/react/queries/market/marketCurrencies.ts +8 -1
- package/src/react/queries/primary-sales/index.ts +1 -0
- package/src/react/queries/primary-sales/primarySaleItem.ts +80 -0
- package/src/react/queries/tokens/listBalances.ts +1 -21
- package/src/react/queries/tokens/tokenSupplies.ts +2 -31
- package/src/react/queries/utils/comparePrices.ts +13 -1
- package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +2 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +4 -18
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +2 -2
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +0 -2
- package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +3 -0
- package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +152 -141
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +1 -0
- package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +44 -60
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155SalePaymentParams.test.tsx +381 -0
- package/src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts +257 -0
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +0 -23
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +22 -2
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +2 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +2 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +2 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +1 -1
- package/src/react/ui/modals/TransferModal/index.tsx +24 -2
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +15 -12
- package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +2 -0
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +148 -11
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +2 -0
- package/src/styles/styles.ts +2 -2
- package/src/utils/networkconfigToWagmiChain.ts +7 -0
- package/src/utils/price.ts +58 -0
- package/test/const.ts +2 -0
- package/test/server-setup.ts +0 -2
- package/tsdown.config.ts +1 -0
- package/.changeset/honest-peas-arrive.md +0 -5
- package/.changeset/real-tips-stick.md +0 -8
- package/.changeset/tall-pandas-wear.md +0 -8
- package/dist/BellIcon-ByhygxBO.js.map +0 -1
- package/dist/CartIcon-Bt3rQYGk.js.map +0 -1
- package/dist/CollectibleCard-CVpdgXA8.d.ts +0 -8
- package/dist/_internal-DkS2VUn5.js.map +0 -1
- package/dist/abi-fa-o9gH3.js.map +0 -1
- package/dist/alien_swap-DoY6XfMA.js.map +0 -1
- package/dist/api-BoO0V5aJ.js.map +0 -1
- package/dist/aqua-xyz-BBDxnG14.js.map +0 -1
- package/dist/aura-DGx2zwvF.js.map +0 -1
- package/dist/blur-D8GKrRrq.js.map +0 -1
- package/dist/builder-api-BFuZNOaN.js.map +0 -1
- package/dist/builder.gen-B9wR2nvF.js.map +0 -1
- package/dist/coinbase-DOry4PXY.js.map +0 -1
- package/dist/collectibles-C_H8jMGH.js.map +0 -1
- package/dist/collections-CKummc-R.js.map +0 -1
- package/dist/components-CosnX7F9.js.map +0 -1
- package/dist/contracts-BP_0vX48.js.map +0 -1
- package/dist/create-config-CIfejoCk.js.map +0 -1
- package/dist/element-ciybd_VF.js.map +0 -1
- package/dist/foundation-Bq4lRz4x.js.map +0 -1
- package/dist/index-DNNUeZEq.d.ts +0 -18
- package/dist/inventory-Dd7TazvZ.js.map +0 -1
- package/dist/listBalances-BxpxBCvn.js +0 -57
- package/dist/listBalances-BxpxBCvn.js.map +0 -1
- package/dist/looks-rare-6H--x3AM.js.map +0 -1
- package/dist/magic-eden-BoxEQ1Li.js.map +0 -1
- package/dist/manifold-DycKsljb.js.map +0 -1
- package/dist/market-C3HV-awQ.js.map +0 -1
- package/dist/marketCurrencies-sKrTX0og.js.map +0 -1
- package/dist/marketplace-NQB-sEQL.js.map +0 -1
- package/dist/marketplace-logos-D4dS1Foy.js.map +0 -1
- package/dist/marketplace.gen-ksUafDqS.js.map +0 -1
- package/dist/marketplaceConfig-UHQMM9fq.js.map +0 -1
- package/dist/mintify-Dyqyo8jQ.js.map +0 -1
- package/dist/network-DtmiMhcg.js.map +0 -1
- package/dist/networkconfigToWagmiChain-DbUf6HiO.js.map +0 -1
- package/dist/nftx-2LbFjj9Q.js.map +0 -1
- package/dist/okx-CBEWJNsR.js.map +0 -1
- package/dist/open-sea-Dxntz_PA.js.map +0 -1
- package/dist/orders-DnFfZAXV.js.map +0 -1
- package/dist/primary-sale-1u4QlPdA.js.map +0 -1
- package/dist/primary-sales-Dmsi6bqj.js.map +0 -1
- package/dist/rarible-CS0SupHr.js.map +0 -1
- package/dist/react-DE852KeT.js.map +0 -1
- package/dist/sequence-paCCener.js.map +0 -1
- package/dist/src-Dz2CfBL0.js.map +0 -1
- package/dist/sudo-swap-9rH2EgfT.js.map +0 -1
- package/dist/super-rare-DHIuWtRw.js.map +0 -1
- package/dist/token-Cv7l2ZaL.js.map +0 -1
- package/dist/tokenBalances-ibDerNmM.js.map +0 -1
- package/dist/tokens-cGxMadd8.js.map +0 -1
- package/dist/transaction-DZUW5RHu.js.map +0 -1
- package/dist/types-B_-cnkcP.js.map +0 -1
- package/dist/utils-BCgNhBFR.js.map +0 -1
- package/dist/utils-BfpDVibN.js.map +0 -1
- package/dist/utils-BqxcalL2.js.map +0 -1
- package/dist/waitForTransactionReceipt-DieAnV52.js.map +0 -1
- package/dist/x2y2-45WDooeh.js.map +0 -1
- package/dist/zora-CbeBoLvQ.js.map +0 -1
- package/src/react/_internal/api/__mocks__/laos.msw.ts +0 -387
- package/src/react/_internal/api/__tests__/laos-api.test.ts +0 -756
- package/src/react/_internal/api/laos-api.ts +0 -106
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +0 -367
- package/src/react/queries/collectibles/__tests__/balanceOfCollectible.laos.test.ts +0 -123
- package/src/react/queries/collectibles/__tests__/tokenBalances.laos.test.ts +0 -123
- package/src/react/queries/inventory/__tests__/inventory.laos.test.ts +0 -499
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155Checkout.test.tsx +0 -395
- package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +0 -103
- package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +0 -481
- /package/dist/{index-6wsMChsg.d.ts → index15.d.ts} +0 -0
- /package/dist/{index-CZUtOTjh.d.ts → index18.d.ts} +0 -0
- /package/dist/{index-DW3njUfb.d.ts → index20.d.ts} +0 -0
- /package/dist/{index-DewGsFz5.d.ts → index22.d.ts} +0 -0
- /package/dist/{queries-KOcILNJO.js → queries.js} +0 -0
- /package/dist/{wagmi-Bseovd6Q.js → wagmi.js} +0 -0
|
@@ -18,14 +18,13 @@ export type UseListCollectiblesParams = Optional<
|
|
|
18
18
|
* Hook to fetch a list of collectibles with infinite pagination support
|
|
19
19
|
*
|
|
20
20
|
* Fetches collectibles from the marketplace with support for filtering, pagination,
|
|
21
|
-
* and special handling for shop marketplace types
|
|
21
|
+
* and special handling for shop marketplace types.
|
|
22
22
|
*
|
|
23
23
|
* @param params - Configuration parameters
|
|
24
24
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
25
25
|
* @param params.collectionAddress - The collection contract address
|
|
26
26
|
* @param params.side - Order side (listing or bid)
|
|
27
27
|
* @param params.filter - Optional filtering parameters
|
|
28
|
-
* @param params.isLaos721 - Whether the collection is a LAOS721 contract
|
|
29
28
|
* @param params.marketplaceType - Type of marketplace (shop, etc.)
|
|
30
29
|
* @param params.query - Optional React Query configuration
|
|
31
30
|
*
|
|
@@ -55,20 +54,6 @@ export type UseListCollectiblesParams = Optional<
|
|
|
55
54
|
* }
|
|
56
55
|
* })
|
|
57
56
|
* ```
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* For LAOS721 collections:
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const { data } = useListCollectibles({
|
|
63
|
-
* chainId: 137,
|
|
64
|
-
* collectionAddress: '0x...',
|
|
65
|
-
* side: OrderSide.listing,
|
|
66
|
-
* isLaos721: true,
|
|
67
|
-
* filter: {
|
|
68
|
-
* inAccounts: ['0x...']
|
|
69
|
-
* }
|
|
70
|
-
* })
|
|
71
|
-
* ```
|
|
72
57
|
*/
|
|
73
58
|
export function useListCollectibles(params: UseListCollectiblesParams) {
|
|
74
59
|
const defaultConfig = useConfig();
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { ContractType } from '../../../_internal';
|
|
3
2
|
import {
|
|
4
3
|
tokenBalancesOptions,
|
|
5
4
|
type UseTokenBalancesArgs,
|
|
6
5
|
} from '../../../queries/collectibles/tokenBalances';
|
|
7
6
|
import { useConfig } from '../../config/useConfig';
|
|
8
|
-
import { useMarketplaceConfig } from '../../config/useMarketplaceConfig';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Hook to fetch all token balances for a user in a collection
|
|
@@ -28,18 +26,11 @@ import { useMarketplaceConfig } from '../../config/useMarketplaceConfig';
|
|
|
28
26
|
*/
|
|
29
27
|
export function useTokenBalances(args: UseTokenBalancesArgs) {
|
|
30
28
|
const config = useConfig();
|
|
31
|
-
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
32
|
-
|
|
33
|
-
const collection = marketplaceConfig?.market.collections.find(
|
|
34
|
-
(collection) => collection.itemsAddress === args.collectionAddress,
|
|
35
|
-
);
|
|
36
|
-
const isLaos721 = collection?.contractType === ContractType.LAOS_ERC_721;
|
|
37
29
|
|
|
38
30
|
return useQuery(
|
|
39
31
|
tokenBalancesOptions(
|
|
40
32
|
{
|
|
41
33
|
...args,
|
|
42
|
-
isLaos721,
|
|
43
34
|
},
|
|
44
35
|
config,
|
|
45
36
|
),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './useCollection';
|
|
2
|
+
export * from './useCollectionActiveListingsCurrencies';
|
|
3
|
+
export * from './useCollectionActiveOffersCurrencies';
|
|
2
4
|
export * from './useCollectionBalanceDetails';
|
|
3
5
|
export * from './useCollectionDetails';
|
|
4
6
|
export * from './useCollectionDetailsPolling';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { renderHook, server, waitFor } from '@test';
|
|
2
|
+
import { HttpResponse, http } from 'msw';
|
|
3
|
+
import { zeroAddress } from 'viem';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import {
|
|
6
|
+
mockCurrencies,
|
|
7
|
+
mockMarketplaceEndpoint,
|
|
8
|
+
} from '../../../_internal/api/__mocks__/marketplace.msw';
|
|
9
|
+
import type { UseCollectionActiveListingsCurrenciesParams } from './useCollectionActiveListingsCurrencies';
|
|
10
|
+
import { useCollectionActiveListingsCurrencies } from './useCollectionActiveListingsCurrencies';
|
|
11
|
+
|
|
12
|
+
describe('useCollectionActiveListingsCurrencies', () => {
|
|
13
|
+
const defaultArgs: UseCollectionActiveListingsCurrenciesParams = {
|
|
14
|
+
chainId: 1,
|
|
15
|
+
collectionAddress: zeroAddress,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
it('should fetch active listings currencies data successfully', async () => {
|
|
19
|
+
const { result } = renderHook(() =>
|
|
20
|
+
useCollectionActiveListingsCurrencies(defaultArgs),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Initially loading
|
|
24
|
+
expect(result.current.isLoading).toBe(true);
|
|
25
|
+
expect(result.current.data).toBeUndefined();
|
|
26
|
+
|
|
27
|
+
// Wait for data to be loaded
|
|
28
|
+
await waitFor(() => {
|
|
29
|
+
expect(result.current.isLoading).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Verify the data matches our mock
|
|
33
|
+
expect(result.current.data).toEqual(mockCurrencies);
|
|
34
|
+
expect(result.current.error).toBeNull();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should handle error states', async () => {
|
|
38
|
+
// Override the handler for this test to return an error
|
|
39
|
+
server.use(
|
|
40
|
+
http.post(
|
|
41
|
+
mockMarketplaceEndpoint('GetCollectionActiveListingsCurrencies'),
|
|
42
|
+
() => {
|
|
43
|
+
return HttpResponse.json(
|
|
44
|
+
{
|
|
45
|
+
error: { message: 'Failed to fetch active listings currencies' },
|
|
46
|
+
},
|
|
47
|
+
{ status: 500 },
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const { result } = renderHook(() =>
|
|
54
|
+
useCollectionActiveListingsCurrencies(defaultArgs),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
await waitFor(() => {
|
|
58
|
+
expect(result.current.isError).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
expect(result.current.error).toBeDefined();
|
|
62
|
+
expect(result.current.data).toBeUndefined();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should refetch when args change', async () => {
|
|
66
|
+
const { result, rerender } = renderHook(() =>
|
|
67
|
+
useCollectionActiveListingsCurrencies(defaultArgs),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// Wait for initial data
|
|
71
|
+
await waitFor(() => {
|
|
72
|
+
expect(result.current.isLoading).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Change args and rerender
|
|
76
|
+
const newArgs = {
|
|
77
|
+
...defaultArgs,
|
|
78
|
+
collectionAddress:
|
|
79
|
+
'0x1234567890123456789012345678901234567890' as `0x${string}`,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
rerender(() => useCollectionActiveListingsCurrencies(newArgs));
|
|
83
|
+
|
|
84
|
+
// Wait for new data
|
|
85
|
+
await waitFor(() => {
|
|
86
|
+
expect(result.current.data).toBeDefined();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Verify that the query was refetched with new args
|
|
90
|
+
expect(result.current.data).toBeDefined();
|
|
91
|
+
expect(result.current.isSuccess).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should handle undefined query params', async () => {
|
|
95
|
+
const argsWithoutQuery: UseCollectionActiveListingsCurrenciesParams = {
|
|
96
|
+
chainId: 1,
|
|
97
|
+
collectionAddress: zeroAddress,
|
|
98
|
+
query: {},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const { result } = renderHook(() =>
|
|
102
|
+
useCollectionActiveListingsCurrencies(argsWithoutQuery),
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
await waitFor(() => {
|
|
106
|
+
expect(result.current.isLoading).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
expect(result.current.data).toBeDefined();
|
|
110
|
+
expect(result.current.error).toBeNull();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import type { Optional } from '../../../_internal';
|
|
5
|
+
import {
|
|
6
|
+
type CollectionActiveListingsCurrenciesQueryOptions,
|
|
7
|
+
collectionActiveListingsCurrenciesQueryOptions,
|
|
8
|
+
type FetchCollectionActiveListingsCurrenciesParams,
|
|
9
|
+
} from '../../../queries/collections/activeListingsCurrencies';
|
|
10
|
+
import { useConfig } from '../../config/useConfig';
|
|
11
|
+
|
|
12
|
+
export type UseCollectionActiveListingsCurrenciesParams = Optional<
|
|
13
|
+
CollectionActiveListingsCurrenciesQueryOptions,
|
|
14
|
+
'config'
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to fetch the active listings currencies for a collection
|
|
19
|
+
*
|
|
20
|
+
* Retrieves all currencies that are currently being used in active listings
|
|
21
|
+
* for a specific collection from the marketplace.
|
|
22
|
+
*
|
|
23
|
+
* @param params - Configuration parameters
|
|
24
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
25
|
+
* @param params.collectionAddress - The collection contract address
|
|
26
|
+
* @param params.query - Optional React Query configuration
|
|
27
|
+
*
|
|
28
|
+
* @returns Query result containing the array of currencies used in active listings
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Basic usage:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const { data, isLoading } = useCollectionActiveListingsCurrencies({
|
|
34
|
+
* chainId: 137,
|
|
35
|
+
* collectionAddress: '0x...'
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* With custom query options:
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const { data, isLoading } = useCollectionActiveListingsCurrencies({
|
|
43
|
+
* chainId: 1,
|
|
44
|
+
* collectionAddress: '0x...',
|
|
45
|
+
* query: {
|
|
46
|
+
* refetchInterval: 30000,
|
|
47
|
+
* enabled: hasCollectionAddress
|
|
48
|
+
* }
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export function useCollectionActiveListingsCurrencies(
|
|
53
|
+
params: UseCollectionActiveListingsCurrenciesParams,
|
|
54
|
+
) {
|
|
55
|
+
const defaultConfig = useConfig();
|
|
56
|
+
|
|
57
|
+
const { config = defaultConfig, ...rest } = params;
|
|
58
|
+
|
|
59
|
+
const queryOptions = collectionActiveListingsCurrenciesQueryOptions({
|
|
60
|
+
config,
|
|
61
|
+
...rest,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return useQuery({
|
|
65
|
+
...queryOptions,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { collectionActiveListingsCurrenciesQueryOptions };
|
|
70
|
+
|
|
71
|
+
export type {
|
|
72
|
+
FetchCollectionActiveListingsCurrenciesParams,
|
|
73
|
+
CollectionActiveListingsCurrenciesQueryOptions,
|
|
74
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { renderHook, server, waitFor } from '@test';
|
|
2
|
+
import { HttpResponse, http } from 'msw';
|
|
3
|
+
import { zeroAddress } from 'viem';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import {
|
|
6
|
+
mockCurrencies,
|
|
7
|
+
mockMarketplaceEndpoint,
|
|
8
|
+
} from '../../../_internal/api/__mocks__/marketplace.msw';
|
|
9
|
+
import type { UseCollectionActiveOffersCurrenciesParams } from './useCollectionActiveOffersCurrencies';
|
|
10
|
+
import { useCollectionActiveOffersCurrencies } from './useCollectionActiveOffersCurrencies';
|
|
11
|
+
|
|
12
|
+
describe('useCollectionActiveOffersCurrencies', () => {
|
|
13
|
+
const defaultArgs: UseCollectionActiveOffersCurrenciesParams = {
|
|
14
|
+
chainId: 1,
|
|
15
|
+
collectionAddress: zeroAddress,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
it('should fetch active offers currencies data successfully', async () => {
|
|
19
|
+
const { result } = renderHook(() =>
|
|
20
|
+
useCollectionActiveOffersCurrencies(defaultArgs),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Initially loading
|
|
24
|
+
expect(result.current.isLoading).toBe(true);
|
|
25
|
+
expect(result.current.data).toBeUndefined();
|
|
26
|
+
|
|
27
|
+
// Wait for data to be loaded
|
|
28
|
+
await waitFor(() => {
|
|
29
|
+
expect(result.current.isLoading).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Verify the data matches our mock
|
|
33
|
+
expect(result.current.data).toEqual(mockCurrencies);
|
|
34
|
+
expect(result.current.error).toBeNull();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should handle error states', async () => {
|
|
38
|
+
// Override the handler for this test to return an error
|
|
39
|
+
server.use(
|
|
40
|
+
http.post(
|
|
41
|
+
mockMarketplaceEndpoint('GetCollectionActiveOffersCurrencies'),
|
|
42
|
+
() => {
|
|
43
|
+
return HttpResponse.json(
|
|
44
|
+
{ error: { message: 'Failed to fetch active offers currencies' } },
|
|
45
|
+
{ status: 500 },
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const { result } = renderHook(() =>
|
|
52
|
+
useCollectionActiveOffersCurrencies(defaultArgs),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
await waitFor(() => {
|
|
56
|
+
expect(result.current.isError).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(result.current.error).toBeDefined();
|
|
60
|
+
expect(result.current.data).toBeUndefined();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should refetch when args change', async () => {
|
|
64
|
+
const { result, rerender } = renderHook(() =>
|
|
65
|
+
useCollectionActiveOffersCurrencies(defaultArgs),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// Wait for initial data
|
|
69
|
+
await waitFor(() => {
|
|
70
|
+
expect(result.current.isLoading).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Change args and rerender
|
|
74
|
+
const newArgs = {
|
|
75
|
+
...defaultArgs,
|
|
76
|
+
collectionAddress:
|
|
77
|
+
'0x1234567890123456789012345678901234567890' as `0x${string}`,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
rerender(() => useCollectionActiveOffersCurrencies(newArgs));
|
|
81
|
+
|
|
82
|
+
// Wait for new data
|
|
83
|
+
await waitFor(() => {
|
|
84
|
+
expect(result.current.data).toBeDefined();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Verify that the query was refetched with new args
|
|
88
|
+
expect(result.current.data).toBeDefined();
|
|
89
|
+
expect(result.current.isSuccess).toBe(true);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should handle undefined query params', async () => {
|
|
93
|
+
const argsWithoutQuery: UseCollectionActiveOffersCurrenciesParams = {
|
|
94
|
+
chainId: 1,
|
|
95
|
+
collectionAddress: zeroAddress,
|
|
96
|
+
query: {},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const { result } = renderHook(() =>
|
|
100
|
+
useCollectionActiveOffersCurrencies(argsWithoutQuery),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
await waitFor(() => {
|
|
104
|
+
expect(result.current.isLoading).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
expect(result.current.data).toBeDefined();
|
|
108
|
+
expect(result.current.error).toBeNull();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import type { Optional } from '../../../_internal';
|
|
5
|
+
import {
|
|
6
|
+
type CollectionActiveOffersCurrenciesQueryOptions,
|
|
7
|
+
collectionActiveOffersCurrenciesQueryOptions,
|
|
8
|
+
type FetchCollectionActiveOffersCurrenciesParams,
|
|
9
|
+
} from '../../../queries/collections/activeOffersCurrencies';
|
|
10
|
+
import { useConfig } from '../../config/useConfig';
|
|
11
|
+
|
|
12
|
+
export type UseCollectionActiveOffersCurrenciesParams = Optional<
|
|
13
|
+
CollectionActiveOffersCurrenciesQueryOptions,
|
|
14
|
+
'config'
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to fetch the active offers currencies for a collection
|
|
19
|
+
*
|
|
20
|
+
* Retrieves all currencies that are currently being used in active offers
|
|
21
|
+
* for a specific collection from the marketplace.
|
|
22
|
+
*
|
|
23
|
+
* @param params - Configuration parameters
|
|
24
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
25
|
+
* @param params.collectionAddress - The collection contract address
|
|
26
|
+
* @param params.query - Optional React Query configuration
|
|
27
|
+
*
|
|
28
|
+
* @returns Query result containing the array of currencies used in active offers
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Basic usage:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const { data, isLoading } = useCollectionActiveOffersCurrencies({
|
|
34
|
+
* chainId: 137,
|
|
35
|
+
* collectionAddress: '0x...'
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* With custom query options:
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const { data, isLoading } = useCollectionActiveOffersCurrencies({
|
|
43
|
+
* chainId: 1,
|
|
44
|
+
* collectionAddress: '0x...',
|
|
45
|
+
* query: {
|
|
46
|
+
* refetchInterval: 30000,
|
|
47
|
+
* enabled: hasCollectionAddress
|
|
48
|
+
* }
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export function useCollectionActiveOffersCurrencies(
|
|
53
|
+
params: UseCollectionActiveOffersCurrenciesParams,
|
|
54
|
+
) {
|
|
55
|
+
const defaultConfig = useConfig();
|
|
56
|
+
|
|
57
|
+
const { config = defaultConfig, ...rest } = params;
|
|
58
|
+
|
|
59
|
+
const queryOptions = collectionActiveOffersCurrenciesQueryOptions({
|
|
60
|
+
config,
|
|
61
|
+
...rest,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return useQuery({
|
|
65
|
+
...queryOptions,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { collectionActiveOffersCurrenciesQueryOptions };
|
|
70
|
+
|
|
71
|
+
export type {
|
|
72
|
+
FetchCollectionActiveOffersCurrenciesParams,
|
|
73
|
+
CollectionActiveOffersCurrenciesQueryOptions,
|
|
74
|
+
};
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { ContractType } from '../../../_internal';
|
|
3
2
|
import {
|
|
4
3
|
inventoryOptions,
|
|
5
4
|
type UseInventoryArgs,
|
|
6
5
|
} from '../../../queries/inventory/inventory';
|
|
7
6
|
import { useConfig } from '../../config/useConfig';
|
|
8
|
-
import { useMarketplaceConfig } from '../../config/useMarketplaceConfig';
|
|
9
7
|
|
|
10
8
|
export function useInventory(args: UseInventoryArgs) {
|
|
11
9
|
const config = useConfig();
|
|
12
|
-
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
marketplaceConfig?.market?.collections?.find(
|
|
16
|
-
(c) =>
|
|
17
|
-
c.itemsAddress === args.collectionAddress && c.chainId === args.chainId,
|
|
18
|
-
)?.contractType === ContractType.LAOS_ERC_721;
|
|
19
|
-
|
|
20
|
-
return useQuery(inventoryOptions({ ...args, isLaos721 }, config));
|
|
11
|
+
return useQuery(inventoryOptions({ ...args }, config));
|
|
21
12
|
}
|
|
@@ -49,7 +49,30 @@ describe('useMarketCurrencies', () => {
|
|
|
49
49
|
);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
it('should filter currencies by collection address', async () => {
|
|
52
|
+
it('should filter currencies by collection address for non-OpenSea collections', async () => {
|
|
53
|
+
const args = {
|
|
54
|
+
...defaultArgs,
|
|
55
|
+
collectionAddress: mockConfig.marketCollections[0]
|
|
56
|
+
.itemsAddress as Address,
|
|
57
|
+
} satisfies Parameters<typeof useMarketCurrencies>[0];
|
|
58
|
+
|
|
59
|
+
const { result } = renderHook(() => useMarketCurrencies(args));
|
|
60
|
+
|
|
61
|
+
await waitFor(() => {
|
|
62
|
+
expect(result.current.isLoading).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const currencyAddresses = result.current.data?.map(
|
|
66
|
+
(c) => c.contractAddress,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// For non-OpenSea collections, currencies should be filtered by currencyOptions
|
|
70
|
+
expect(currencyAddresses).toEqual(
|
|
71
|
+
mockConfig.marketCollections[0].currencyOptions,
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should not filter currencies by collection address for OpenSea collections', async () => {
|
|
53
76
|
const args = {
|
|
54
77
|
...defaultArgs,
|
|
55
78
|
collectionAddress: mockConfig.marketCollections[1]
|
|
@@ -65,8 +88,12 @@ describe('useMarketCurrencies', () => {
|
|
|
65
88
|
const currencyAddresses = result.current.data?.map(
|
|
66
89
|
(c) => c.contractAddress,
|
|
67
90
|
);
|
|
91
|
+
|
|
92
|
+
// For OpenSea collections, currencies are not filtered by currencyOptions
|
|
93
|
+
// Instead, all currencies are returned and filtering happens at the UI level
|
|
94
|
+
// based on openseaListing/openseaOffer flags
|
|
68
95
|
expect(currencyAddresses).toEqual(
|
|
69
|
-
|
|
96
|
+
mockCurrencies.map((c) => c.contractAddress),
|
|
70
97
|
);
|
|
71
98
|
});
|
|
72
99
|
|
|
@@ -161,6 +188,8 @@ describe('useMarketCurrencies', () => {
|
|
|
161
188
|
"imageUrl": "https://example.com/usdc.png",
|
|
162
189
|
"name": "USD Coin",
|
|
163
190
|
"nativeCurrency": false,
|
|
191
|
+
"openseaListing": true,
|
|
192
|
+
"openseaOffer": true,
|
|
164
193
|
"status": "active",
|
|
165
194
|
"symbol": "USDC",
|
|
166
195
|
"updatedAt": "2025-03-16T13:04:16.098Z",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import type { Optional } from '../../../_internal';
|
|
5
|
+
import {
|
|
6
|
+
type FetchPrimarySaleItemParams,
|
|
7
|
+
type PrimarySaleItemQueryOptions,
|
|
8
|
+
primarySaleItemQueryOptions,
|
|
9
|
+
} from '../../../queries/primary-sales/primarySaleItem';
|
|
10
|
+
import { useConfig } from '../../config/useConfig';
|
|
11
|
+
|
|
12
|
+
export type UsePrimarySaleItemParams = Optional<
|
|
13
|
+
PrimarySaleItemQueryOptions,
|
|
14
|
+
'config'
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to fetch a single primary sale item
|
|
19
|
+
*
|
|
20
|
+
* Retrieves details for a specific primary sale item from a primary sale contract.
|
|
21
|
+
*
|
|
22
|
+
* @param params - Configuration parameters
|
|
23
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
24
|
+
* @param params.primarySaleContractAddress - The primary sale contract address
|
|
25
|
+
* @param params.tokenId - The token ID of the primary sale item
|
|
26
|
+
* @param params.query - Optional React Query configuration
|
|
27
|
+
*
|
|
28
|
+
* @returns Query result containing the primary sale item data
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Basic usage:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const { data: item, isLoading } = usePrimarySaleItem({
|
|
34
|
+
* chainId: 137,
|
|
35
|
+
* primarySaleContractAddress: '0x...',
|
|
36
|
+
* tokenId: '1',
|
|
37
|
+
* })
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* With custom query options:
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const { data } = usePrimarySaleItem({
|
|
44
|
+
* chainId: 1,
|
|
45
|
+
* primarySaleContractAddress: '0x...',
|
|
46
|
+
* tokenId: '42',
|
|
47
|
+
* query: {
|
|
48
|
+
* enabled: Boolean(primarySaleContractAddress && tokenId),
|
|
49
|
+
* staleTime: 30_000
|
|
50
|
+
* }
|
|
51
|
+
* })
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function usePrimarySaleItem(params: UsePrimarySaleItemParams) {
|
|
55
|
+
const defaultConfig = useConfig();
|
|
56
|
+
|
|
57
|
+
const { config = defaultConfig, ...rest } = params;
|
|
58
|
+
|
|
59
|
+
const queryOptions = primarySaleItemQueryOptions({
|
|
60
|
+
config,
|
|
61
|
+
...rest,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return useQuery({
|
|
65
|
+
...queryOptions,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { primarySaleItemQueryOptions };
|
|
70
|
+
|
|
71
|
+
export type { FetchPrimarySaleItemParams, PrimarySaleItemQueryOptions };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
|
-
import { ContractType } from '../../../_internal';
|
|
3
2
|
import type { UseListBalancesArgs } from '../../../queries/tokens/listBalances';
|
|
4
3
|
import { listBalancesOptions } from '../../../queries/tokens/listBalances';
|
|
5
4
|
import { useConfig } from '../../config/useConfig';
|
|
6
|
-
import { useMarketplaceConfig } from '../../config/useMarketplaceConfig';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Hook to fetch a list of token balances with pagination support
|
|
@@ -26,13 +24,6 @@ import { useMarketplaceConfig } from '../../config/useMarketplaceConfig';
|
|
|
26
24
|
*/
|
|
27
25
|
export function useListBalances(args: UseListBalancesArgs) {
|
|
28
26
|
const config = useConfig();
|
|
29
|
-
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
marketplaceConfig?.market?.collections?.find(
|
|
33
|
-
(c) =>
|
|
34
|
-
c.itemsAddress === args.contractAddress && c.chainId === args.chainId,
|
|
35
|
-
)?.contractType === ContractType.LAOS_ERC_721;
|
|
36
|
-
|
|
37
|
-
return useInfiniteQuery(listBalancesOptions({ ...args, isLaos721 }, config));
|
|
28
|
+
return useInfiniteQuery(listBalancesOptions({ ...args }, config));
|
|
38
29
|
}
|
|
@@ -15,15 +15,13 @@ export type UseTokenSuppliesParams = Optional<
|
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Hook to fetch token supplies from the indexer
|
|
18
|
+
* Hook to fetch token supplies from the indexer
|
|
19
19
|
*
|
|
20
20
|
* Retrieves supply information for tokens from a specific collection.
|
|
21
|
-
* Automatically chooses between indexer and LAOS APIs based on the isLaos721 flag.
|
|
22
21
|
*
|
|
23
22
|
* @param params - Configuration parameters
|
|
24
23
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
25
24
|
* @param params.collectionAddress - The collection contract address
|
|
26
|
-
* @param params.isLaos721 - Whether to use LAOS API instead of indexer
|
|
27
25
|
* @param params.includeMetadata - Whether to include token metadata
|
|
28
26
|
* @param params.page - Pagination options
|
|
29
27
|
* @param params.query - Optional React Query configuration
|
|
@@ -40,16 +38,6 @@ export type UseTokenSuppliesParams = Optional<
|
|
|
40
38
|
* ```
|
|
41
39
|
*
|
|
42
40
|
* @example
|
|
43
|
-
* With LAOS API:
|
|
44
|
-
* ```typescript
|
|
45
|
-
* const { data, isLoading } = useTokenSupplies({
|
|
46
|
-
* chainId: 1,
|
|
47
|
-
* collectionAddress: '0x...',
|
|
48
|
-
* isLaos721: true
|
|
49
|
-
* })
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
41
|
* With conditional fetching:
|
|
54
42
|
* ```typescript
|
|
55
43
|
* const { data, isLoading } = useTokenSupplies({
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../../_internal/api/__mocks__/marketplace.msw';
|
|
10
10
|
import {
|
|
11
11
|
ContractType,
|
|
12
|
+
OfferType,
|
|
12
13
|
OrderbookKind,
|
|
13
14
|
StepType,
|
|
14
15
|
} from '../../_internal/api/marketplace.gen';
|
|
@@ -33,6 +34,7 @@ describe('useGenerateOfferTransaction', () => {
|
|
|
33
34
|
orderbook: OrderbookKind.sequence_marketplace_v2,
|
|
34
35
|
offer: mockOffer,
|
|
35
36
|
additionalFees: [],
|
|
37
|
+
offerType: OfferType.item,
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
const defaultArgs = {
|