@0xsequence/marketplace-sdk 1.1.0 → 1.1.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/honest-peas-arrive.md +5 -0
- package/.changeset/real-tips-stick.md +8 -0
- package/.changeset/tall-pandas-wear.md +8 -0
- package/CHANGELOG.md +24 -2
- package/dist/{BellIcon-IpHHEy8h.js → BellIcon-ByhygxBO.js} +2 -2
- package/dist/{BellIcon-IpHHEy8h.js.map → BellIcon-ByhygxBO.js.map} +1 -1
- package/dist/{CartIcon-C8zbor8H.js → CartIcon-Bt3rQYGk.js} +3 -3
- package/dist/{CartIcon-C8zbor8H.js.map → CartIcon-Bt3rQYGk.js.map} +1 -1
- package/dist/CollectibleCard-CVpdgXA8.d.ts +8 -0
- package/dist/_internal-DkS2VUn5.js.map +1 -1
- package/dist/abi-fa-o9gH3.js +134 -0
- package/dist/abi-fa-o9gH3.js.map +1 -0
- package/dist/{alien_swap-BTJ7mSR-.js → alien_swap-DoY6XfMA.js} +1 -1
- package/dist/{alien_swap-BTJ7mSR-.js.map → alien_swap-DoY6XfMA.js.map} +1 -1
- package/dist/{api-DuLKn__v.js → api-BoO0V5aJ.js} +8 -3
- package/dist/api-BoO0V5aJ.js.map +1 -0
- package/dist/{aqua-xyz-BYJ9WSP_.js → aqua-xyz-BBDxnG14.js} +1 -1
- package/dist/{aqua-xyz-BYJ9WSP_.js.map → aqua-xyz-BBDxnG14.js.map} +1 -1
- package/dist/{aura-D7SUjgro.js → aura-DGx2zwvF.js} +1 -1
- package/dist/{aura-D7SUjgro.js.map → aura-DGx2zwvF.js.map} +1 -1
- package/dist/{blur-BcnRFCaV.js → blur-D8GKrRrq.js} +1 -1
- package/dist/{blur-BcnRFCaV.js.map → blur-D8GKrRrq.js.map} +1 -1
- package/dist/{coinbase-ChoX9Hw2.js → coinbase-DOry4PXY.js} +1 -1
- package/dist/{coinbase-ChoX9Hw2.js.map → coinbase-DOry4PXY.js.map} +1 -1
- package/dist/collectibles-C_H8jMGH.js +358 -0
- package/dist/collectibles-C_H8jMGH.js.map +1 -0
- package/dist/collections-CKummc-R.js +249 -0
- package/dist/collections-CKummc-R.js.map +1 -0
- package/dist/{components-CUv-wQr8.js → components-CosnX7F9.js} +5 -5
- package/dist/{components-CUv-wQr8.js.map → components-CosnX7F9.js.map} +1 -1
- package/dist/{contracts-D72LBOX3.js → contracts-BP_0vX48.js} +3 -3
- package/dist/{contracts-D72LBOX3.js.map → contracts-BP_0vX48.js.map} +1 -1
- package/dist/{create-config-DV_dtaLt.d.ts → create-config-ZOB7i4ZJ.d.ts} +117 -12
- package/dist/{element-Dbcv5qya.js → element-ciybd_VF.js} +1 -1
- package/dist/{element-Dbcv5qya.js.map → element-ciybd_VF.js.map} +1 -1
- package/dist/filters-V-V8Dn8f.d.ts +60 -0
- package/dist/{foundation-QPhUEUy8.js → foundation-Bq4lRz4x.js} +1 -1
- package/dist/{foundation-QPhUEUy8.js.map → foundation-Bq4lRz4x.js.map} +1 -1
- package/dist/index-BOiHR01C.d.ts +106 -0
- package/dist/index-BZIJTQT0.d.ts +121 -0
- package/dist/index-BeRV-7AX.d.ts +55 -0
- package/dist/{index-BaytncQc.d.ts → index-Bsx6XsC2.d.ts} +58 -55
- package/dist/{index-jGgfEHfQ.d.ts → index-BtWMBHeP.d.ts} +13 -9
- package/dist/{index-CT8ZorFd.d.ts → index-Bxzjy0d1.d.ts} +1 -1
- package/dist/{index-B6aSbaw2.d.ts → index-C-745li7.d.ts} +1 -1
- package/dist/{index-BoNNplSx.d.ts → index-C4MUKshG.d.ts} +2 -2
- package/dist/{index-DMBMM16q.d.ts → index-CPzvNmq9.d.ts} +35 -35
- package/dist/{index-D-UXGo5d.d.ts → index-CS65jqOq.d.ts} +2 -2
- package/dist/index-CZUtOTjh.d.ts +1 -0
- package/dist/index-CnEbXm_t.d.ts +130 -0
- package/dist/{index-CQecU53t.d.ts → index-CxA34wP1.d.ts} +32 -23
- package/dist/{index-C768pAfu.d.ts → index-CxpFwGvR.d.ts} +3 -3
- package/dist/{index-Bv5XVLjH.d.ts → index-D9LPlmbC.d.ts} +1 -1
- package/dist/{index-DJG0kiII.d.ts → index-DFEnA6Wa.d.ts} +28 -17
- package/dist/{index-B8vaT3_s.d.ts → index-DNNUeZEq.d.ts} +4 -4
- package/dist/{index-CXscCUg7.d.ts → index-DUXfvhxs.d.ts} +12 -12
- package/dist/index-DW3njUfb.d.ts +1 -0
- package/dist/{index-CMPUveNz.d.ts → index-DWt6yrIG.d.ts} +7 -7
- package/dist/index-DewGsFz5.d.ts +1 -0
- package/dist/{index-DLUjc7Bx.d.ts → index-DmudgrsN.d.ts} +191 -12
- package/dist/{index-DpeWm_vF.d.ts → index-DqXd1EeB.d.ts} +5 -5
- package/dist/{index-CM0ZTePs.d.ts → index-DwKr18CI.d.ts} +1 -1
- package/dist/{index-D6YMj82n.d.ts → index-NlPMNcqh.d.ts} +100 -100
- package/dist/index-Stm5u0I0.d.ts +53 -0
- package/dist/index-U-zp70of.d.ts +74 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -8
- package/dist/inventory-Dd7TazvZ.js +72 -0
- package/dist/inventory-Dd7TazvZ.js.map +1 -0
- package/dist/listBalances-BxpxBCvn.js +57 -0
- package/dist/listBalances-BxpxBCvn.js.map +1 -0
- package/dist/listCollectiblesPaginated-Cy2_qEZA.d.ts +327 -0
- package/dist/{listCollections-dTCq00l5.d.ts → listCollections-BB9FxKj2.d.ts} +193 -111
- package/dist/{looks-rare-C7cQztTR.js → looks-rare-6H--x3AM.js} +1 -1
- package/dist/{looks-rare-C7cQztTR.js.map → looks-rare-6H--x3AM.js.map} +1 -1
- package/dist/lowestListing-Cbsi6M1K.d.ts +465 -0
- package/dist/{magic-eden-D3r7jiBG.js → magic-eden-BoxEQ1Li.js} +1 -1
- package/dist/{magic-eden-D3r7jiBG.js.map → magic-eden-BoxEQ1Li.js.map} +1 -1
- package/dist/{manifold-DsX0CBP-.js → manifold-DycKsljb.js} +1 -1
- package/dist/{manifold-DsX0CBP-.js.map → manifold-DycKsljb.js.map} +1 -1
- package/dist/market-C3HV-awQ.js +209 -0
- package/dist/market-C3HV-awQ.js.map +1 -0
- package/dist/{marketCurrencies-Bzj8X4TL.d.ts → marketCurrencies-Bpw1bIO0.d.ts} +46 -15
- package/dist/marketCurrencies-sKrTX0og.js +53 -0
- package/dist/marketCurrencies-sKrTX0og.js.map +1 -0
- package/dist/{marketplace-BYY8OloA.js → marketplace-NQB-sEQL.js} +1 -1
- package/dist/{marketplace-BYY8OloA.js.map → marketplace-NQB-sEQL.js.map} +1 -1
- package/dist/{marketplace-logos-Csv2MBwf.js → marketplace-logos-D4dS1Foy.js} +21 -21
- package/dist/{marketplace-logos-Csv2MBwf.js.map → marketplace-logos-D4dS1Foy.js.map} +1 -1
- package/dist/{marketplace.gen-w2YvbEEo.js → marketplace.gen-ksUafDqS.js} +56 -5
- package/dist/marketplace.gen-ksUafDqS.js.map +1 -0
- package/dist/{marketplaceConfig-BTy75Mbf.js → marketplaceConfig-UHQMM9fq.js} +3 -3
- package/dist/marketplaceConfig-UHQMM9fq.js.map +1 -0
- package/dist/{mintify-DiOoDmO1.js → mintify-Dyqyo8jQ.js} +1 -1
- package/dist/{mintify-DiOoDmO1.js.map → mintify-Dyqyo8jQ.js.map} +1 -1
- package/dist/{nftx-CP82jNra.js → nftx-2LbFjj9Q.js} +1 -1
- package/dist/{nftx-CP82jNra.js.map → nftx-2LbFjj9Q.js.map} +1 -1
- package/dist/{okx-p9-4xRjs.js → okx-CBEWJNsR.js} +1 -1
- package/dist/{okx-p9-4xRjs.js.map → okx-CBEWJNsR.js.map} +1 -1
- package/dist/{open-sea-D2GwAmKS.js → open-sea-Dxntz_PA.js} +1 -1
- package/dist/{open-sea-D2GwAmKS.js.map → open-sea-Dxntz_PA.js.map} +1 -1
- package/dist/orders-DnFfZAXV.js +462 -0
- package/dist/orders-DnFfZAXV.js.map +1 -0
- package/dist/{primary-sale-DOmNDq2P.js → primary-sale-1u4QlPdA.js} +1 -1
- package/dist/{primary-sale-DOmNDq2P.js.map → primary-sale-1u4QlPdA.js.map} +1 -1
- package/dist/primary-sales-Dmsi6bqj.js +114 -0
- package/dist/primary-sales-Dmsi6bqj.js.map +1 -0
- package/dist/{query-BG-MA1MB.d.ts → query-BWbCsXLY.d.ts} +1 -1
- package/dist/{rarible-DqiiW9ki.js → rarible-CS0SupHr.js} +1 -1
- package/dist/{rarible-DqiiW9ki.js.map → rarible-CS0SupHr.js.map} +1 -1
- package/dist/react/_internal/api/index.d.ts +2 -2
- package/dist/react/_internal/api/index.js +3 -3
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +28 -17
- package/dist/react/_internal/index.d.ts +2 -2
- package/dist/react/_internal/index.js +3 -3
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/hooks/config/index.d.ts +8 -8
- package/dist/react/hooks/config/index.js +28 -17
- package/dist/react/hooks/contracts/index.d.ts +6 -6
- package/dist/react/hooks/contracts/index.js +7 -7
- package/dist/react/hooks/data/collectibles/index.d.ts +10 -4
- package/dist/react/hooks/data/collectibles/index.js +28 -17
- package/dist/react/hooks/data/collections/index.d.ts +10 -10
- package/dist/react/hooks/data/collections/index.js +28 -17
- package/dist/react/hooks/data/index.d.ts +37 -29
- package/dist/react/hooks/data/index.js +29 -18
- package/dist/react/hooks/data/inventory/index.d.ts +36 -28
- package/dist/react/hooks/data/inventory/index.js +28 -17
- package/dist/react/hooks/data/market/index.d.ts +11 -5
- package/dist/react/hooks/data/market/index.js +28 -17
- package/dist/react/hooks/data/orders/index.d.ts +11 -5
- package/dist/react/hooks/data/orders/index.js +29 -18
- package/dist/react/hooks/data/primary-sales/index.d.ts +36 -28
- package/dist/react/hooks/data/primary-sales/index.js +28 -17
- package/dist/react/hooks/data/tokens/index.d.ts +4 -4
- package/dist/react/hooks/data/tokens/index.js +28 -17
- package/dist/react/hooks/index.d.ts +37 -29
- package/dist/react/hooks/index.js +29 -18
- package/dist/react/hooks/transactions/index.d.ts +2 -2
- package/dist/react/hooks/transactions/index.js +28 -17
- package/dist/react/hooks/ui/index.d.ts +4 -4
- package/dist/react/hooks/ui/index.js +28 -17
- package/dist/react/hooks/utils/index.d.ts +36 -28
- package/dist/react/hooks/utils/index.js +28 -17
- package/dist/react/index.d.ts +37 -29
- package/dist/react/index.js +29 -18
- package/dist/react/queries/collectibles/index.d.ts +11 -0
- package/dist/react/queries/collectibles/index.js +23 -0
- package/dist/react/queries/collections/index.d.ts +11 -0
- package/dist/react/queries/collections/index.js +20 -0
- package/dist/react/queries/index.d.ts +24 -16
- package/dist/react/queries/index.js +22 -11
- package/dist/react/queries/inventory/index.d.ts +3 -0
- package/dist/react/queries/inventory/index.js +22 -0
- package/dist/react/queries/market/index.d.ts +6 -0
- package/dist/react/queries/market/index.js +22 -0
- package/dist/react/queries/orders/index.d.ts +11 -0
- package/dist/react/queries/orders/index.js +13 -0
- package/dist/react/queries/primary-sales/index.d.ts +4 -0
- package/dist/react/queries/primary-sales/index.js +13 -0
- package/dist/react/queries/tokens/index.d.ts +5 -0
- package/dist/react/queries/tokens/index.js +14 -0
- package/dist/react/queries/utils/index.d.ts +4 -0
- package/dist/react/queries/utils/index.js +22 -0
- package/dist/react/ssr/index.d.ts +7 -7
- package/dist/react/ssr/index.js +3 -3
- 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 +11 -11
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +5 -5
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +28 -17
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +4 -4
- package/dist/react/ui/components/marketplace-collectible-card/index.js +28 -17
- 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 +3 -3
- 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 +9 -9
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +28 -17
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +28 -17
- package/dist/react/utils/index.d.ts +3 -3
- package/dist/react/utils/index.js +3 -3
- package/dist/{react-BLJ4DkPx.js → react-DE852KeT.js} +1365 -172
- package/dist/react-DE852KeT.js.map +1 -0
- package/dist/{sequence-Bbb-TFKg.js → sequence-paCCener.js} +1 -1
- package/dist/{sequence-Bbb-TFKg.js.map → sequence-paCCener.js.map} +1 -1
- package/dist/styles/index.css +154 -0
- package/dist/{sudo-swap-CEPIM3Js.js → sudo-swap-9rH2EgfT.js} +1 -1
- package/dist/{sudo-swap-CEPIM3Js.js.map → sudo-swap-9rH2EgfT.js.map} +1 -1
- package/dist/{super-rare-CMEn9PoO.js → super-rare-DHIuWtRw.js} +1 -1
- package/dist/{super-rare-CMEn9PoO.js.map → super-rare-DHIuWtRw.js.map} +1 -1
- package/dist/{token-CcyLz8Z8.js → token-Cv7l2ZaL.js} +1 -1
- package/dist/{token-CcyLz8Z8.js.map → token-Cv7l2ZaL.js.map} +1 -1
- package/dist/tokenBalances-ibDerNmM.js +63 -0
- package/dist/tokenBalances-ibDerNmM.js.map +1 -0
- package/dist/tokenSupplies-Bfe8RHzI.d.ts +272 -0
- package/dist/tokens-cGxMadd8.js +194 -0
- package/dist/tokens-cGxMadd8.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/{types-D6LkVrF0.d.ts → types-D2TJ1dwv.d.ts} +3 -2
- package/dist/utils/abi/index.d.ts +5 -5
- package/dist/utils/abi/index.js +5 -5
- 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 +8 -8
- package/dist/utils-BCgNhBFR.js +112 -0
- package/dist/utils-BCgNhBFR.js.map +1 -0
- package/dist/{utils-BZEkdqWK.js → utils-BfpDVibN.js} +3 -3
- package/dist/{utils-BZEkdqWK.js.map → utils-BfpDVibN.js.map} +1 -1
- package/dist/{utils-oVZxdK0o.js → utils-BqxcalL2.js} +2 -2
- package/dist/{utils-oVZxdK0o.js.map → utils-BqxcalL2.js.map} +1 -1
- package/dist/waitForTransactionReceipt-DieAnV52.js +25 -0
- package/dist/waitForTransactionReceipt-DieAnV52.js.map +1 -0
- package/dist/{x2y2-DNe6JgtG.js → x2y2-45WDooeh.js} +1 -1
- package/dist/{x2y2-DNe6JgtG.js.map → x2y2-45WDooeh.js.map} +1 -1
- package/dist/{zora-w0Zqxxs4.js → zora-CbeBoLvQ.js} +1 -1
- package/dist/{zora-w0Zqxxs4.js.map → zora-CbeBoLvQ.js.map} +1 -1
- package/package.json +10 -5
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +2 -0
- package/src/react/_internal/api/marketplace.gen.ts +1730 -2383
- package/src/react/_internal/api/query-keys.ts +14 -0
- package/src/react/_internal/api/services.ts +1 -1
- package/src/react/_internal/databeat/types.ts +1 -0
- package/src/react/_internal/types.ts +14 -0
- package/src/react/_internal/utils.ts +3 -0
- package/src/react/hooks/config/useMarketplaceConfig.tsx +1 -1
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +1 -1
- package/src/react/hooks/data/collectibles/useCollectible.tsx +1 -1
- package/src/react/hooks/data/collectibles/useCountOfCollectables.tsx +1 -1
- package/src/react/hooks/data/collectibles/useListCollectibleActivities.tsx +1 -1
- package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -1
- package/src/react/hooks/data/collectibles/useListCollectiblesPaginated.tsx +1 -1
- package/src/react/hooks/data/collectibles/useTokenBalances.tsx +1 -1
- package/src/react/hooks/data/collections/useCollection.tsx +1 -1
- package/src/react/hooks/data/collections/useCollectionBalanceDetails.tsx +1 -1
- package/src/react/hooks/data/collections/useCollectionDetails.ts +1 -1
- package/src/react/hooks/data/collections/useListCollectionActivities.tsx +1 -1
- package/src/react/hooks/data/collections/useListCollections.tsx +1 -1
- package/src/react/hooks/data/inventory/useInventory.tsx +1 -1
- package/src/react/hooks/data/market/useCurrency.tsx +1 -1
- package/src/react/hooks/data/market/useListMarketCardData.tsx +7 -0
- package/src/react/hooks/data/market/useMarketCurrencies.tsx +1 -1
- package/src/react/hooks/data/orders/index.ts +4 -0
- package/src/react/hooks/data/orders/useCountItemsOrdersForCollection.tsx +90 -0
- package/src/react/hooks/data/orders/useCountListingsForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useCountOffersForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useFloorOrder.tsx +1 -1
- package/src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx +39 -0
- package/src/react/hooks/data/orders/useHighestOffer.tsx +1 -1
- package/src/react/hooks/data/orders/useListItemsOrdersForCollection.tsx +93 -0
- package/src/react/hooks/data/orders/useListItemsOrdersForCollectionPaginated.tsx +108 -0
- package/src/react/hooks/data/orders/useListListingsForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useListOffersForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useLowestListing.tsx +1 -1
- package/src/react/hooks/data/primary-sales/useGetCountOfPrimarySaleItems.tsx +2 -2
- package/src/react/hooks/data/primary-sales/useListPrimarySaleItems.tsx +1 -1
- package/src/react/hooks/data/tokens/useGetTokenRanges.tsx +2 -2
- package/src/react/hooks/data/tokens/useListBalances.tsx +2 -2
- package/src/react/hooks/data/tokens/useListTokenMetadata.tsx +1 -1
- package/src/react/hooks/data/tokens/useSearchTokenMetadata.tsx +1 -1
- package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -1
- package/src/react/hooks/transactions/useGenerateCancelTransaction.test.tsx +1 -0
- package/src/react/hooks/transactions/useGenerateListingTransaction.test.tsx +13 -0
- package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +1 -0
- package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +6 -0
- package/src/react/hooks/ui/useFilterState.tsx +72 -2
- package/src/react/hooks/ui/useFilters.tsx +1 -1
- package/src/react/hooks/utils/useCheckoutOptions.tsx +2 -2
- package/src/react/hooks/utils/useCheckoutOptionsSalesContract.tsx +1 -1
- package/src/react/hooks/utils/useComparePrices.tsx +1 -1
- package/src/react/hooks/utils/useConvertPriceToUSD.tsx +1 -1
- package/src/react/providers/analytics-provider.tsx +45 -0
- package/src/react/providers/index.tsx +30 -41
- package/src/react/providers/modal-provider.tsx +13 -2
- package/src/react/queries/{__tests__ → collectibles/__tests__}/balanceOfCollectible.laos.test.ts +1 -1
- package/src/react/queries/{__tests__ → collectibles/__tests__}/tokenBalances.laos.test.ts +1 -1
- package/src/react/queries/{balanceOfCollectible.ts → collectibles/balanceOfCollectible.ts} +24 -3
- package/src/react/queries/{collectible.ts → collectibles/collectible.ts} +20 -5
- package/src/react/queries/{countOfCollectables.ts → collectibles/countOfCollectables.ts} +32 -6
- package/src/react/queries/collectibles/index.ts +7 -0
- package/src/react/queries/{listCollectibleActivities.ts → collectibles/listCollectibleActivities.ts} +29 -5
- package/src/react/queries/{listCollectibles.ts → collectibles/listCollectibles.ts} +28 -9
- package/src/react/queries/{listCollectiblesPaginated.ts → collectibles/listCollectiblesPaginated.ts} +22 -5
- package/src/react/queries/{tokenBalances.ts → collectibles/tokenBalances.ts} +21 -3
- package/src/react/queries/{collection.ts → collections/collection.ts} +19 -5
- package/src/react/queries/{collectionBalanceDetails.ts → collections/collectionBalanceDetails.ts} +19 -4
- package/src/react/queries/{collectionDetails.ts → collections/collectionDetails.ts} +21 -6
- package/src/react/queries/collections/index.ts +5 -0
- package/src/react/queries/{listCollectionActivities.ts → collections/listCollectionActivities.ts} +28 -6
- package/src/react/queries/{listCollections.ts → collections/listCollections.ts} +17 -6
- package/src/react/queries/index.ts +7 -34
- package/src/react/queries/{__tests__ → inventory/__tests__}/inventory.laos.test.ts +4 -4
- package/src/react/queries/inventory/index.ts +1 -0
- package/src/react/queries/{inventory.ts → inventory/inventory.ts} +11 -5
- package/src/react/queries/{checkoutOptions.ts → market/checkoutOptions.ts} +28 -6
- package/src/react/queries/{checkoutOptionsSalesContract.ts → market/checkoutOptionsSalesContract.ts} +24 -5
- package/src/react/queries/{currency.ts → market/currency.ts} +13 -4
- package/src/react/queries/{filters.ts → market/filters.ts} +25 -6
- package/src/react/queries/market/index.ts +6 -0
- package/src/react/queries/{marketCurrencies.ts → market/marketCurrencies.ts} +24 -5
- package/src/react/queries/{marketplaceConfig.ts → market/marketplaceConfig.ts} +5 -5
- package/src/react/queries/orders/countItemsOrdersForCollection.ts +86 -0
- package/src/react/queries/{countListingsForCollectible.ts → orders/countListingsForCollectible.ts} +23 -6
- package/src/react/queries/{countOffersForCollectible.ts → orders/countOffersForCollectible.ts} +23 -6
- package/src/react/queries/{floorOrder.ts → orders/floorOrder.ts} +15 -4
- package/src/react/queries/orders/getCountOfFilteredOrders.ts +88 -0
- package/src/react/queries/{highestOffer.ts → orders/highestOffer.ts} +16 -4
- package/src/react/queries/orders/index.ts +11 -0
- package/src/react/queries/orders/listItemsOrdersForCollection.ts +90 -0
- package/src/react/queries/orders/listItemsOrdersForCollectionPaginated.ts +90 -0
- package/src/react/queries/{listListingsForCollectible.ts → orders/listListingsForCollectible.ts} +20 -5
- package/src/react/queries/{listOffersForCollectible.ts → orders/listOffersForCollectible.ts} +20 -5
- package/src/react/queries/{lowestListing.ts → orders/lowestListing.ts} +16 -4
- package/src/react/queries/{countOfPrimarySaleItems.ts → primary-sales/countOfPrimarySaleItems.ts} +17 -3
- package/src/react/queries/primary-sales/index.ts +3 -0
- package/src/react/queries/{primarySaleItems.ts → primary-sales/primarySaleItems.ts} +18 -4
- package/src/react/queries/{primarySaleItemsCount.ts → primary-sales/primarySaleItemsCount.ts} +19 -4
- package/src/react/queries/{getTokenRanges.ts → tokens/getTokenRanges.ts} +17 -4
- package/src/react/queries/tokens/index.ts +5 -0
- package/src/react/queries/{listBalances.ts → tokens/listBalances.ts} +18 -3
- package/src/react/queries/{listTokenMetadata.ts → tokens/listTokenMetadata.ts} +18 -4
- package/src/react/queries/{searchTokenMetadata.ts → tokens/searchTokenMetadata.ts} +18 -4
- package/src/react/queries/{tokenSupplies.ts → tokens/tokenSupplies.ts} +16 -4
- package/src/react/queries/{comparePrices.ts → utils/comparePrices.ts} +16 -4
- package/src/react/queries/{convertPriceToUSD.ts → utils/convertPriceToUSD.ts} +18 -5
- package/src/react/queries/utils/index.ts +2 -0
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ui/components/_internals/ErrorLogBox.tsx +85 -0
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +4 -0
- package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -0
- package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +3 -0
- package/src/react/ui/components/marketplace-collectible-card/types.ts +1 -0
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +3 -0
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +2 -0
- package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +65 -3
- package/src/react/ui/modals/BuyModal/components/ERC721BuyModal.tsx +31 -0
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC721SalePaymentParams.test.tsx +20 -1
- package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +7 -2
- package/src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts +12 -3
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +11 -2
- package/src/react/ui/modals/BuyModal/store.ts +3 -0
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +63 -24
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +4 -0
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +18 -12
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +4 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +1 -0
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +55 -8
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +10 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +4 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +15 -26
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +1 -0
- package/src/react/ui/modals/SellModal/Modal.tsx +21 -3
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +2 -0
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +3 -1
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +13 -7
- package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +9 -0
- package/src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx +105 -0
- package/src/react/ui/modals/_internal/components/calendarDropdown/index.tsx +45 -12
- package/src/react/ui/modals/_internal/components/calendarDropdown/overrides.css +39 -0
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +31 -10
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +18 -9
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +51 -1
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +58 -10
- package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +481 -0
- package/src/react/utils/waitForTransactionReceipt.ts +26 -32
- package/src/styles/index.css +1 -0
- package/src/styles/styles.ts +155 -1
- package/src/types/index.ts +1 -1
- package/src/utils/abi/index.ts +1 -0
- package/src/utils/abi/mainModule.ts +158 -0
- package/dist/CollectibleCard-C2EWF0zo.d.ts +0 -8
- package/dist/api-DuLKn__v.js.map +0 -1
- package/dist/filters-zkMJaPey.d.ts +0 -31
- package/dist/index-Yobo6icm.d.ts +0 -234
- package/dist/listCollectiblesPaginated-Bq0QSOjJ.d.ts +0 -168
- package/dist/lowestListing-CB5Te-Q9.d.ts +0 -168
- package/dist/marketplace.gen-w2YvbEEo.js.map +0 -1
- package/dist/marketplaceConfig-BTy75Mbf.js.map +0 -1
- package/dist/queries-EMA5CcwY.js +0 -1399
- package/dist/queries-EMA5CcwY.js.map +0 -1
- package/dist/react-BLJ4DkPx.js.map +0 -1
- package/dist/react-F03jPjPk.css +0 -80
- package/dist/react-F03jPjPk.css.map +0 -1
- package/dist/tokenSupplies-C470zTT0.d.ts +0 -147
- package/dist/waitForTransactionReceipt-B08YZiDY.js +0 -26
- package/dist/waitForTransactionReceipt-B08YZiDY.js.map +0 -1
- /package/dist/{index-Cg5cFzs-.d.ts → index-6wsMChsg.d.ts} +0 -0
- /package/dist/{abi-DYsUABe6.js → queries-KOcILNJO.js} +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { FilterCondition } from "./builder.gen-B9wR2nvF.js";
|
|
2
|
+
import { checkoutKeys, currencyKeys, getMarketplaceClient, getMetadataClient, getQueryClient } from "./api-BoO0V5aJ.js";
|
|
3
|
+
import { compareAddress } from "./utils-BfpDVibN.js";
|
|
4
|
+
import { marketplaceConfigOptions } from "./marketplaceConfig-UHQMM9fq.js";
|
|
5
|
+
import { queryOptions, skipToken } from "@tanstack/react-query";
|
|
6
|
+
|
|
7
|
+
//#region src/react/queries/market/currency.ts
|
|
8
|
+
/**
|
|
9
|
+
* Fetches currency details from the marketplace API
|
|
10
|
+
*/
|
|
11
|
+
async function fetchCurrency(params) {
|
|
12
|
+
const { chainId, currencyAddress, config } = params;
|
|
13
|
+
let currencies = getQueryClient().getQueryData([...currencyKeys.lists, chainId]);
|
|
14
|
+
if (!currencies) currencies = await getMarketplaceClient(config).listCurrencies({ chainId: String(chainId) }).then((resp) => resp.currencies);
|
|
15
|
+
if (!currencies?.length) throw new Error("No currencies returned");
|
|
16
|
+
const currency = currencies.find((currency$1) => currency$1.contractAddress.toLowerCase() === currencyAddress.toLowerCase());
|
|
17
|
+
if (!currency) throw new Error("Currency not found");
|
|
18
|
+
return currency;
|
|
19
|
+
}
|
|
20
|
+
function getCurrencyQueryKey(params) {
|
|
21
|
+
const apiArgs = {
|
|
22
|
+
chainId: String(params.chainId),
|
|
23
|
+
currencyAddress: params.currencyAddress
|
|
24
|
+
};
|
|
25
|
+
return [...currencyKeys.details, apiArgs];
|
|
26
|
+
}
|
|
27
|
+
function currencyQueryOptions(params) {
|
|
28
|
+
const enabled = Boolean(params.chainId && params.currencyAddress && params.config && (params.query?.enabled ?? true));
|
|
29
|
+
return queryOptions({
|
|
30
|
+
queryKey: getCurrencyQueryKey(params),
|
|
31
|
+
queryFn: params.chainId && params.currencyAddress ? () => fetchCurrency({
|
|
32
|
+
chainId: params.chainId,
|
|
33
|
+
currencyAddress: params.currencyAddress,
|
|
34
|
+
config: params.config
|
|
35
|
+
}) : skipToken,
|
|
36
|
+
...params.query,
|
|
37
|
+
enabled
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/react/queries/market/checkoutOptions.ts
|
|
43
|
+
/**
|
|
44
|
+
* Fetches checkout options from the Marketplace API
|
|
45
|
+
*/
|
|
46
|
+
async function fetchCheckoutOptions(params) {
|
|
47
|
+
const { chainId, walletAddress, orders, config, additionalFee } = params;
|
|
48
|
+
const client = getMarketplaceClient(config);
|
|
49
|
+
const apiArgs = {
|
|
50
|
+
chainId: String(chainId),
|
|
51
|
+
wallet: walletAddress,
|
|
52
|
+
orders: orders.map((order) => ({
|
|
53
|
+
contractAddress: order.collectionAddress,
|
|
54
|
+
orderId: order.orderId,
|
|
55
|
+
marketplace: order.marketplace
|
|
56
|
+
})),
|
|
57
|
+
additionalFee: additionalFee ?? 0
|
|
58
|
+
};
|
|
59
|
+
return await client.checkoutOptionsMarketplace(apiArgs);
|
|
60
|
+
}
|
|
61
|
+
function getCheckoutOptionsQueryKey(params) {
|
|
62
|
+
const apiArgs = {
|
|
63
|
+
chainId: String(params.chainId),
|
|
64
|
+
wallet: params.walletAddress,
|
|
65
|
+
orders: params.orders?.map((order) => ({
|
|
66
|
+
contractAddress: order.collectionAddress,
|
|
67
|
+
orderId: order.orderId,
|
|
68
|
+
marketplace: order.marketplace
|
|
69
|
+
})),
|
|
70
|
+
additionalFee: params.additionalFee
|
|
71
|
+
};
|
|
72
|
+
return [...checkoutKeys.options, apiArgs];
|
|
73
|
+
}
|
|
74
|
+
function checkoutOptionsQueryOptions(params) {
|
|
75
|
+
const enabled = Boolean(params.chainId && params.walletAddress && params.orders?.length && params.config && (params.query?.enabled ?? true));
|
|
76
|
+
return queryOptions({
|
|
77
|
+
queryKey: getCheckoutOptionsQueryKey(params),
|
|
78
|
+
queryFn: () => fetchCheckoutOptions({
|
|
79
|
+
chainId: params.chainId,
|
|
80
|
+
walletAddress: params.walletAddress,
|
|
81
|
+
orders: params.orders,
|
|
82
|
+
config: params.config,
|
|
83
|
+
additionalFee: params.additionalFee ?? 0
|
|
84
|
+
}),
|
|
85
|
+
...params.query,
|
|
86
|
+
enabled
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/react/queries/market/checkoutOptionsSalesContract.ts
|
|
92
|
+
/**
|
|
93
|
+
* Fetches checkout options for sales contract from the Marketplace API
|
|
94
|
+
*/
|
|
95
|
+
async function fetchCheckoutOptionsSalesContract(params) {
|
|
96
|
+
const { chainId, walletAddress, contractAddress, collectionAddress, items, config } = params;
|
|
97
|
+
const client = getMarketplaceClient(config);
|
|
98
|
+
const apiArgs = {
|
|
99
|
+
chainId: String(chainId),
|
|
100
|
+
wallet: walletAddress,
|
|
101
|
+
contractAddress,
|
|
102
|
+
collectionAddress,
|
|
103
|
+
items
|
|
104
|
+
};
|
|
105
|
+
return await client.checkoutOptionsSalesContract(apiArgs);
|
|
106
|
+
}
|
|
107
|
+
function getCheckoutOptionsSalesContractQueryKey(params) {
|
|
108
|
+
const apiArgs = {
|
|
109
|
+
chainId: String(params.chainId),
|
|
110
|
+
wallet: params.walletAddress,
|
|
111
|
+
contractAddress: params.contractAddress,
|
|
112
|
+
collectionAddress: params.collectionAddress,
|
|
113
|
+
items: params.items
|
|
114
|
+
};
|
|
115
|
+
return [
|
|
116
|
+
...checkoutKeys.options,
|
|
117
|
+
"salesContract",
|
|
118
|
+
apiArgs
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
function checkoutOptionsSalesContractQueryOptions(params) {
|
|
122
|
+
const enabled = Boolean(params.chainId && params.walletAddress && params.contractAddress && params.collectionAddress && params.items?.length && params.config && (params.query?.enabled ?? true));
|
|
123
|
+
return queryOptions({
|
|
124
|
+
queryKey: getCheckoutOptionsSalesContractQueryKey(params),
|
|
125
|
+
queryFn: () => fetchCheckoutOptionsSalesContract({
|
|
126
|
+
chainId: params.chainId,
|
|
127
|
+
walletAddress: params.walletAddress,
|
|
128
|
+
contractAddress: params.contractAddress,
|
|
129
|
+
collectionAddress: params.collectionAddress,
|
|
130
|
+
items: params.items,
|
|
131
|
+
config: params.config
|
|
132
|
+
}),
|
|
133
|
+
...params.query,
|
|
134
|
+
enabled
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/react/queries/market/filters.ts
|
|
140
|
+
/**
|
|
141
|
+
* Fetches collection filters from the Metadata API with optional marketplace filtering
|
|
142
|
+
*/
|
|
143
|
+
async function fetchFilters(params) {
|
|
144
|
+
const { chainId, collectionAddress, showAllFilters, excludePropertyValues, config } = params;
|
|
145
|
+
const filters = await getMetadataClient(config).getTokenMetadataPropertyFilters({
|
|
146
|
+
chainID: chainId.toString(),
|
|
147
|
+
contractAddress: collectionAddress,
|
|
148
|
+
excludeProperties: [],
|
|
149
|
+
excludePropertyValues
|
|
150
|
+
}).then((resp) => resp.filters);
|
|
151
|
+
if (showAllFilters) return filters;
|
|
152
|
+
const collectionFilters = (await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections.find((c) => compareAddress(c.itemsAddress, collectionAddress))?.filterSettings;
|
|
153
|
+
const filterOrder = collectionFilters?.filterOrder;
|
|
154
|
+
const exclusions = collectionFilters?.exclusions;
|
|
155
|
+
let sortedFilters = filters;
|
|
156
|
+
if (filterOrder) sortedFilters = filters.toSorted((a, b) => {
|
|
157
|
+
const aIndex = filterOrder.indexOf(a.name) > -1 ? filterOrder.indexOf(a.name) : filterOrder.length;
|
|
158
|
+
const bIndex = filterOrder.indexOf(b.name) > -1 ? filterOrder.indexOf(b.name) : filterOrder.length;
|
|
159
|
+
return aIndex - bIndex;
|
|
160
|
+
});
|
|
161
|
+
if (exclusions) sortedFilters = sortedFilters.reduce((acc, filter) => {
|
|
162
|
+
const exclusionRule = exclusions.find((rule) => rule.key === filter.name);
|
|
163
|
+
if (!exclusionRule) {
|
|
164
|
+
acc.push(filter);
|
|
165
|
+
return acc;
|
|
166
|
+
}
|
|
167
|
+
if (exclusionRule.condition === FilterCondition.ENTIRE_KEY) return acc;
|
|
168
|
+
if (exclusionRule.condition === FilterCondition.SPECIFIC_VALUE && exclusionRule.value) {
|
|
169
|
+
const filteredValues = filter.values?.filter((value) => value !== exclusionRule.value) || [];
|
|
170
|
+
if (filteredValues.length > 0) acc.push({
|
|
171
|
+
...filter,
|
|
172
|
+
values: filteredValues
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return acc;
|
|
176
|
+
}, []);
|
|
177
|
+
return sortedFilters;
|
|
178
|
+
}
|
|
179
|
+
function getFiltersQueryKey(params) {
|
|
180
|
+
return [
|
|
181
|
+
"filters",
|
|
182
|
+
{
|
|
183
|
+
chainID: String(params.chainId),
|
|
184
|
+
contractAddress: params.collectionAddress,
|
|
185
|
+
excludeProperties: void 0,
|
|
186
|
+
excludePropertyValues: params.excludePropertyValues
|
|
187
|
+
},
|
|
188
|
+
{ showAllFilters: params.showAllFilters }
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
function filtersQueryOptions(params) {
|
|
192
|
+
const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
|
|
193
|
+
return queryOptions({
|
|
194
|
+
queryKey: getFiltersQueryKey(params),
|
|
195
|
+
queryFn: () => fetchFilters({
|
|
196
|
+
chainId: params.chainId,
|
|
197
|
+
collectionAddress: params.collectionAddress,
|
|
198
|
+
showAllFilters: params.showAllFilters,
|
|
199
|
+
excludePropertyValues: params.excludePropertyValues,
|
|
200
|
+
config: params.config
|
|
201
|
+
}),
|
|
202
|
+
...params.query,
|
|
203
|
+
enabled
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
//#endregion
|
|
208
|
+
export { checkoutOptionsQueryOptions, checkoutOptionsSalesContractQueryOptions, currencyQueryOptions, fetchCheckoutOptions, fetchCheckoutOptionsSalesContract, fetchCurrency, fetchFilters, filtersQueryOptions, getCheckoutOptionsQueryKey, getCheckoutOptionsSalesContractQueryKey, getCurrencyQueryKey, getFiltersQueryKey };
|
|
209
|
+
//# sourceMappingURL=market-C3HV-awQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market-C3HV-awQ.js","names":["currency","apiArgs: CheckoutOptionsMarketplaceArgs","apiArgs: CheckoutOptionsSalesContractArgs"],"sources":["../src/react/queries/market/currency.ts","../src/react/queries/market/checkoutOptions.ts","../src/react/queries/market/checkoutOptionsSalesContract.ts","../src/react/queries/market/filters.ts"],"sourcesContent":["import { queryOptions, skipToken } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../../types';\nimport {\n\ttype Currency,\n\tcurrencyKeys,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype ValuesOptional,\n} from '../../_internal';\nimport type { StandardQueryOptions } from '../../types/query';\n\nexport interface FetchCurrencyParams {\n\tchainId: number;\n\tcurrencyAddress: Address;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches currency details from the marketplace API\n */\nexport async function fetchCurrency(\n\tparams: FetchCurrencyParams,\n): Promise<Currency | undefined> {\n\tconst { chainId, currencyAddress, config } = params;\n\tconst queryClient = getQueryClient();\n\n\tlet currencies = queryClient.getQueryData([...currencyKeys.lists, chainId]) as\n\t\t| Currency[]\n\t\t| undefined;\n\n\tif (!currencies) {\n\t\tconst marketplaceClient = getMarketplaceClient(config);\n\t\tcurrencies = await marketplaceClient\n\t\t\t.listCurrencies({ chainId: String(chainId) })\n\t\t\t.then((resp) => resp.currencies);\n\t}\n\n\tif (!currencies?.length) {\n\t\tthrow new Error('No currencies returned');\n\t}\n\tconst currency = currencies.find(\n\t\t(currency) =>\n\t\t\tcurrency.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currency) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\treturn currency;\n}\n\nexport type CurrencyQueryOptions = ValuesOptional<FetchCurrencyParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function getCurrencyQueryKey(params: CurrencyQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId!),\n\t\tcurrencyAddress: params.currencyAddress!,\n\t};\n\n\treturn [...currencyKeys.details, apiArgs] as const;\n}\n\nexport function currencyQueryOptions(params: CurrencyQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.currencyAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: getCurrencyQueryKey(params),\n\t\tqueryFn:\n\t\t\tparams.chainId && params.currencyAddress\n\t\t\t\t? () =>\n\t\t\t\t\t\tfetchCurrency({\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\t\tchainId: params.chainId!,\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\t\tcurrencyAddress: params.currencyAddress!,\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\t\tconfig: params.config!,\n\t\t\t\t\t\t})\n\t\t\t\t: skipToken,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../../types';\nimport type { MarketplaceKind } from '../../_internal';\nimport {\n\tcheckoutKeys,\n\tgetMarketplaceClient,\n\ttype QueryKeyArgs,\n\ttype ValuesOptional,\n} from '../../_internal';\nimport type {\n\tCheckoutOptionsMarketplaceArgs,\n\tCheckoutOptionsMarketplaceReturn,\n} from '../../_internal/api/marketplace.gen';\nimport type { StandardQueryOptions } from '../../types/query';\n\nexport interface FetchCheckoutOptionsParams\n\textends Omit<\n\t\tCheckoutOptionsMarketplaceArgs,\n\t\t'chainId' | 'wallet' | 'orders'\n\t> {\n\tchainId: number;\n\twalletAddress: Address;\n\torders: Array<{\n\t\tcollectionAddress: string;\n\t\torderId: string;\n\t\tmarketplace: MarketplaceKind;\n\t}>;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches checkout options from the Marketplace API\n */\nexport async function fetchCheckoutOptions(\n\tparams: FetchCheckoutOptionsParams,\n): Promise<CheckoutOptionsMarketplaceReturn> {\n\tconst { chainId, walletAddress, orders, config, additionalFee } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tconst apiArgs: CheckoutOptionsMarketplaceArgs = {\n\t\tchainId: String(chainId),\n\t\twallet: walletAddress,\n\t\torders: orders.map((order) => ({\n\t\t\tcontractAddress: order.collectionAddress,\n\t\t\torderId: order.orderId,\n\t\t\tmarketplace: order.marketplace,\n\t\t})),\n\t\tadditionalFee: additionalFee ?? 0,\n\t};\n\n\tconst result = await client.checkoutOptionsMarketplace(apiArgs);\n\treturn result;\n}\n\nexport type CheckoutOptionsQueryOptions =\n\tValuesOptional<FetchCheckoutOptionsParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function getCheckoutOptionsQueryKey(\n\tparams: CheckoutOptionsQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId),\n\t\twallet: params.walletAddress,\n\t\torders: params.orders?.map((order) => ({\n\t\t\tcontractAddress: order.collectionAddress,\n\t\t\torderId: order.orderId,\n\t\t\tmarketplace: order.marketplace,\n\t\t})),\n\t\tadditionalFee: params.additionalFee,\n\t} satisfies QueryKeyArgs<CheckoutOptionsMarketplaceArgs>;\n\n\treturn [...checkoutKeys.options, apiArgs] as const;\n}\n\nexport function checkoutOptionsQueryOptions(\n\tparams: CheckoutOptionsQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.walletAddress &&\n\t\t\tparams.orders?.length &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: getCheckoutOptionsQueryKey(params),\n\t\tqueryFn: () =>\n\t\t\tfetchCheckoutOptions({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\twalletAddress: params.walletAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\torders: params.orders!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tadditionalFee: params.additionalFee ?? 0,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../../types';\nimport {\n\tcheckoutKeys,\n\tgetMarketplaceClient,\n\ttype QueryKeyArgs,\n\ttype ValuesOptional,\n} from '../../_internal';\nimport type {\n\tCheckoutOptionsItem,\n\tCheckoutOptionsSalesContractArgs,\n\tCheckoutOptionsSalesContractReturn,\n} from '../../_internal/api/marketplace.gen';\nimport type { StandardQueryOptions } from '../../types/query';\n\nexport interface FetchCheckoutOptionsSalesContractParams\n\textends Omit<CheckoutOptionsSalesContractArgs, 'chainId' | 'wallet'> {\n\tchainId: number;\n\twalletAddress: Address;\n\tcontractAddress: string;\n\tcollectionAddress: string;\n\titems: Array<CheckoutOptionsItem>;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches checkout options for sales contract from the Marketplace API\n */\nexport async function fetchCheckoutOptionsSalesContract(\n\tparams: FetchCheckoutOptionsSalesContractParams,\n): Promise<CheckoutOptionsSalesContractReturn> {\n\tconst {\n\t\tchainId,\n\t\twalletAddress,\n\t\tcontractAddress,\n\t\tcollectionAddress,\n\t\titems,\n\t\tconfig,\n\t} = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tconst apiArgs: CheckoutOptionsSalesContractArgs = {\n\t\tchainId: String(chainId),\n\t\twallet: walletAddress,\n\t\tcontractAddress,\n\t\tcollectionAddress,\n\t\titems,\n\t};\n\n\tconst result = await client.checkoutOptionsSalesContract(apiArgs);\n\treturn result;\n}\n\nexport type CheckoutOptionsSalesContractQueryOptions =\n\tValuesOptional<FetchCheckoutOptionsSalesContractParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function getCheckoutOptionsSalesContractQueryKey(\n\tparams: CheckoutOptionsSalesContractQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId),\n\t\twallet: params.walletAddress,\n\t\tcontractAddress: params.contractAddress,\n\t\tcollectionAddress: params.collectionAddress,\n\t\titems: params.items,\n\t} satisfies QueryKeyArgs<CheckoutOptionsSalesContractArgs>;\n\n\treturn [...checkoutKeys.options, 'salesContract', apiArgs] as const;\n}\n\nexport function checkoutOptionsSalesContractQueryOptions(\n\tparams: CheckoutOptionsSalesContractQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.walletAddress &&\n\t\t\tparams.contractAddress &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.items?.length &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: getCheckoutOptionsSalesContractQueryKey(params),\n\t\tqueryFn: () =>\n\t\t\tfetchCheckoutOptionsSalesContract({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\twalletAddress: params.walletAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcontractAddress: params.contractAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\titems: params.items!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type {\n\tGetTokenMetadataPropertyFiltersArgs,\n\tPropertyFilter,\n} from '@0xsequence/metadata';\nimport { queryOptions } from '@tanstack/react-query';\nimport { FilterCondition, type SdkConfig } from '../../../types';\nimport { compareAddress } from '../../../utils';\nimport {\n\tgetMetadataClient,\n\tgetQueryClient,\n\ttype QueryKeyArgs,\n\ttype ValuesOptional,\n} from '../../_internal';\nimport type { StandardQueryOptions } from '../../types/query';\nimport { marketplaceConfigOptions } from './marketplaceConfig';\n\nexport interface FetchFiltersParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tshowAllFilters?: boolean;\n\texcludePropertyValues?: boolean;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collection filters from the Metadata API with optional marketplace filtering\n */\nexport async function fetchFilters(\n\tparams: FetchFiltersParams,\n): Promise<PropertyFilter[]> {\n\tconst {\n\t\tchainId,\n\t\tcollectionAddress,\n\t\tshowAllFilters,\n\t\texcludePropertyValues,\n\t\tconfig,\n\t} = params;\n\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst filters = await metadataClient\n\t\t.getTokenMetadataPropertyFilters({\n\t\t\tchainID: chainId.toString(),\n\t\t\tcontractAddress: collectionAddress,\n\t\t\texcludeProperties: [],\n\t\t\texcludePropertyValues,\n\t\t})\n\t\t.then((resp) => resp.filters);\n\n\tif (showAllFilters) return filters;\n\n\tconst queryClient = getQueryClient();\n\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\tmarketplaceConfigOptions(config),\n\t);\n\tconst collectionFilters = marketplaceConfig.market.collections.find((c) =>\n\t\tcompareAddress(c.itemsAddress, collectionAddress),\n\t)?.filterSettings;\n\n\tconst filterOrder = collectionFilters?.filterOrder;\n\tconst exclusions = collectionFilters?.exclusions;\n\tlet sortedFilters = filters;\n\n\tif (filterOrder) {\n\t\tsortedFilters = filters.toSorted((a, b) => {\n\t\t\tconst aIndex =\n\t\t\t\tfilterOrder.indexOf(a.name) > -1\n\t\t\t\t\t? filterOrder.indexOf(a.name)\n\t\t\t\t\t: filterOrder.length;\n\t\t\tconst bIndex =\n\t\t\t\tfilterOrder.indexOf(b.name) > -1\n\t\t\t\t\t? filterOrder.indexOf(b.name)\n\t\t\t\t\t: filterOrder.length;\n\t\t\treturn aIndex - bIndex;\n\t\t});\n\t}\n\n\tif (exclusions) {\n\t\tsortedFilters = sortedFilters.reduce<PropertyFilter[]>((acc, filter) => {\n\t\t\tconst exclusionRule = exclusions.find((rule) => rule.key === filter.name);\n\n\t\t\tif (!exclusionRule) {\n\t\t\t\tacc.push(filter);\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\tif (exclusionRule.condition === FilterCondition.ENTIRE_KEY) {\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\texclusionRule.condition === FilterCondition.SPECIFIC_VALUE &&\n\t\t\t\texclusionRule.value\n\t\t\t) {\n\t\t\t\tconst filteredValues =\n\t\t\t\t\tfilter.values?.filter((value) => value !== exclusionRule.value) || [];\n\t\t\t\tif (filteredValues.length > 0) {\n\t\t\t\t\tacc.push({ ...filter, values: filteredValues });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t}, []);\n\t}\n\n\treturn sortedFilters;\n}\n\nexport type FiltersQueryOptions = ValuesOptional<FetchFiltersParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function getFiltersQueryKey(params: FiltersQueryOptions) {\n\tconst apiArgs = {\n\t\tchainID: String(params.chainId),\n\t\tcontractAddress: params.collectionAddress,\n\t\texcludeProperties: undefined,\n\t\texcludePropertyValues: params.excludePropertyValues,\n\t} satisfies QueryKeyArgs<GetTokenMetadataPropertyFiltersArgs>;\n\n\treturn [\n\t\t'filters',\n\t\tapiArgs,\n\t\t{ showAllFilters: params.showAllFilters },\n\t] as const;\n}\n\nexport function filtersQueryOptions(params: FiltersQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: getFiltersQueryKey(params),\n\t\tqueryFn: () =>\n\t\t\tfetchFilters({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\tshowAllFilters: params.showAllFilters,\n\t\t\t\texcludePropertyValues: params.excludePropertyValues,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n"],"mappings":"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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Currency, CurrencyStatus, SdkConfig, ValuesOptional } from "./create-config-
|
|
2
|
-
import { StandardQueryOptions } from "./query-
|
|
3
|
-
import * as
|
|
1
|
+
import { Currency, CurrencyStatus, SdkConfig, ValuesOptional } from "./create-config-ZOB7i4ZJ.js";
|
|
2
|
+
import { StandardQueryOptions } from "./query-BWbCsXLY.js";
|
|
3
|
+
import * as _tanstack_react_query396 from "@tanstack/react-query";
|
|
4
4
|
import { Address } from "viem";
|
|
5
5
|
|
|
6
|
-
//#region src/react/queries/currency.d.ts
|
|
6
|
+
//#region src/react/queries/market/currency.d.ts
|
|
7
7
|
interface FetchCurrencyParams {
|
|
8
8
|
chainId: number;
|
|
9
9
|
currencyAddress: Address;
|
|
@@ -16,16 +16,26 @@ declare function fetchCurrency(params: FetchCurrencyParams): Promise<Currency |
|
|
|
16
16
|
type CurrencyQueryOptions = ValuesOptional<FetchCurrencyParams> & {
|
|
17
17
|
query?: StandardQueryOptions;
|
|
18
18
|
};
|
|
19
|
-
declare function
|
|
20
|
-
|
|
19
|
+
declare function getCurrencyQueryKey(params: CurrencyQueryOptions): readonly ["currencies", "details", {
|
|
20
|
+
chainId: string;
|
|
21
|
+
currencyAddress: `0x${string}`;
|
|
22
|
+
}];
|
|
23
|
+
declare function currencyQueryOptions(params: CurrencyQueryOptions): _tanstack_react_query396.UseQueryOptions<Currency | undefined, Error, Currency | undefined, readonly ["currencies", "details", {
|
|
24
|
+
chainId: string;
|
|
25
|
+
currencyAddress: `0x${string}`;
|
|
26
|
+
}]> & {
|
|
27
|
+
initialData?: Currency | _tanstack_react_query396.InitialDataFunction<Currency> | undefined;
|
|
21
28
|
} & {
|
|
22
|
-
queryKey:
|
|
29
|
+
queryKey: readonly ["currencies", "details", {
|
|
30
|
+
chainId: string;
|
|
31
|
+
currencyAddress: `0x${string}`;
|
|
32
|
+
}] & {
|
|
23
33
|
[dataTagSymbol]: Currency | undefined;
|
|
24
34
|
[dataTagErrorSymbol]: Error;
|
|
25
35
|
};
|
|
26
36
|
};
|
|
27
37
|
//#endregion
|
|
28
|
-
//#region src/react/queries/marketCurrencies.d.ts
|
|
38
|
+
//#region src/react/queries/market/marketCurrencies.d.ts
|
|
29
39
|
interface FetchMarketCurrenciesParams {
|
|
30
40
|
chainId: number;
|
|
31
41
|
includeNativeCurrency?: boolean;
|
|
@@ -53,7 +63,13 @@ declare function fetchMarketCurrencies(params: FetchMarketCurrenciesParams): Pro
|
|
|
53
63
|
type MarketCurrenciesQueryOptions = ValuesOptional<FetchMarketCurrenciesParams> & {
|
|
54
64
|
query?: StandardQueryOptions;
|
|
55
65
|
};
|
|
56
|
-
declare function
|
|
66
|
+
declare function getMarketCurrenciesQueryKey(params: MarketCurrenciesQueryOptions): readonly ["currencies", "list", {
|
|
67
|
+
chainId: string;
|
|
68
|
+
}, {
|
|
69
|
+
readonly includeNativeCurrency: boolean | undefined;
|
|
70
|
+
readonly collectionAddress: `0x${string}` | undefined;
|
|
71
|
+
}];
|
|
72
|
+
declare function marketCurrenciesQueryOptions(params: MarketCurrenciesQueryOptions): _tanstack_react_query396.OmitKeyof<_tanstack_react_query396.UseQueryOptions<{
|
|
57
73
|
contractAddress: string;
|
|
58
74
|
chainId: number;
|
|
59
75
|
status: CurrencyStatus;
|
|
@@ -81,8 +97,13 @@ declare function marketCurrenciesQueryOptions(params: MarketCurrenciesQueryOptio
|
|
|
81
97
|
createdAt: string;
|
|
82
98
|
updatedAt: string;
|
|
83
99
|
deletedAt?: string;
|
|
84
|
-
}[],
|
|
85
|
-
|
|
100
|
+
}[], readonly ["currencies", "list", {
|
|
101
|
+
chainId: string;
|
|
102
|
+
}, {
|
|
103
|
+
readonly includeNativeCurrency: boolean | undefined;
|
|
104
|
+
readonly collectionAddress: `0x${string}` | undefined;
|
|
105
|
+
}]>, "queryFn"> & {
|
|
106
|
+
queryFn?: _tanstack_react_query396.QueryFunction<{
|
|
86
107
|
contractAddress: string;
|
|
87
108
|
chainId: number;
|
|
88
109
|
status: CurrencyStatus;
|
|
@@ -96,9 +117,19 @@ declare function marketCurrenciesQueryOptions(params: MarketCurrenciesQueryOptio
|
|
|
96
117
|
createdAt: string;
|
|
97
118
|
updatedAt: string;
|
|
98
119
|
deletedAt?: string;
|
|
99
|
-
}[],
|
|
120
|
+
}[], readonly ["currencies", "list", {
|
|
121
|
+
chainId: string;
|
|
122
|
+
}, {
|
|
123
|
+
readonly includeNativeCurrency: boolean | undefined;
|
|
124
|
+
readonly collectionAddress: `0x${string}` | undefined;
|
|
125
|
+
}], never> | undefined;
|
|
100
126
|
} & {
|
|
101
|
-
queryKey:
|
|
127
|
+
queryKey: readonly ["currencies", "list", {
|
|
128
|
+
chainId: string;
|
|
129
|
+
}, {
|
|
130
|
+
readonly includeNativeCurrency: boolean | undefined;
|
|
131
|
+
readonly collectionAddress: `0x${string}` | undefined;
|
|
132
|
+
}] & {
|
|
102
133
|
[dataTagSymbol]: {
|
|
103
134
|
contractAddress: string;
|
|
104
135
|
chainId: number;
|
|
@@ -118,5 +149,5 @@ declare function marketCurrenciesQueryOptions(params: MarketCurrenciesQueryOptio
|
|
|
118
149
|
};
|
|
119
150
|
};
|
|
120
151
|
//#endregion
|
|
121
|
-
export { CurrencyQueryOptions, FetchCurrencyParams, FetchMarketCurrenciesParams, MarketCurrenciesQueryOptions, currencyQueryOptions, fetchCurrency, fetchMarketCurrencies, marketCurrenciesQueryOptions };
|
|
122
|
-
//# sourceMappingURL=marketCurrencies-
|
|
152
|
+
export { CurrencyQueryOptions, FetchCurrencyParams, FetchMarketCurrenciesParams, MarketCurrenciesQueryOptions, currencyQueryOptions, fetchCurrency, fetchMarketCurrencies, getCurrencyQueryKey, getMarketCurrenciesQueryKey, marketCurrenciesQueryOptions };
|
|
153
|
+
//# sourceMappingURL=marketCurrencies-Bpw1bIO0.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { currencyKeys, getMarketplaceClient, getQueryClient } from "./api-BoO0V5aJ.js";
|
|
2
|
+
import { compareAddress } from "./utils-BfpDVibN.js";
|
|
3
|
+
import { marketplaceConfigOptions } from "./marketplaceConfig-UHQMM9fq.js";
|
|
4
|
+
import { queryOptions } from "@tanstack/react-query";
|
|
5
|
+
import { zeroAddress } from "viem";
|
|
6
|
+
|
|
7
|
+
//#region src/react/queries/market/marketCurrencies.ts
|
|
8
|
+
/**
|
|
9
|
+
* Fetches supported currencies for a marketplace
|
|
10
|
+
*/
|
|
11
|
+
async function fetchMarketCurrencies(params) {
|
|
12
|
+
const { chainId, includeNativeCurrency, collectionAddress, config } = params;
|
|
13
|
+
const includeNativeCurrencyOption = includeNativeCurrency ?? true;
|
|
14
|
+
let currencies = await getMarketplaceClient(config).listCurrencies({ chainId: String(chainId) }).then((resp) => resp.currencies.map((currency) => ({
|
|
15
|
+
...currency,
|
|
16
|
+
contractAddress: currency.contractAddress || zeroAddress
|
|
17
|
+
})));
|
|
18
|
+
if (collectionAddress) {
|
|
19
|
+
const currenciesOptions = (await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections.find((collection) => compareAddress(collection.itemsAddress, collectionAddress))?.currencyOptions;
|
|
20
|
+
if (currenciesOptions) currencies = currencies.filter((currency) => currenciesOptions.includes(currency.contractAddress));
|
|
21
|
+
}
|
|
22
|
+
if (!includeNativeCurrencyOption) currencies = currencies.filter((currency) => !currency.nativeCurrency);
|
|
23
|
+
return currencies;
|
|
24
|
+
}
|
|
25
|
+
function getMarketCurrenciesQueryKey(params) {
|
|
26
|
+
const apiArgs = { chainId: String(params.chainId) };
|
|
27
|
+
return [
|
|
28
|
+
...currencyKeys.lists,
|
|
29
|
+
apiArgs,
|
|
30
|
+
{
|
|
31
|
+
includeNativeCurrency: params.includeNativeCurrency,
|
|
32
|
+
collectionAddress: params.collectionAddress
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
function marketCurrenciesQueryOptions(params) {
|
|
37
|
+
const enabled = Boolean(params.chainId && params.config && (params.query?.enabled ?? true));
|
|
38
|
+
return queryOptions({
|
|
39
|
+
queryKey: getMarketCurrenciesQueryKey(params),
|
|
40
|
+
queryFn: () => fetchMarketCurrencies({
|
|
41
|
+
chainId: params.chainId,
|
|
42
|
+
config: params.config,
|
|
43
|
+
includeNativeCurrency: params.includeNativeCurrency,
|
|
44
|
+
collectionAddress: params.collectionAddress
|
|
45
|
+
}),
|
|
46
|
+
...params.query,
|
|
47
|
+
enabled
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { fetchMarketCurrencies, getMarketCurrenciesQueryKey, marketCurrenciesQueryOptions };
|
|
53
|
+
//# sourceMappingURL=marketCurrencies-sKrTX0og.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketCurrencies-sKrTX0og.js","names":[],"sources":["../src/react/queries/market/marketCurrencies.ts"],"sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { type Address, zeroAddress } from 'viem';\nimport type { SdkConfig } from '../../../types';\nimport { compareAddress } from '../../../utils';\nimport {\n\tcurrencyKeys,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype ListCurrenciesArgs,\n\ttype QueryKeyArgs,\n\ttype ValuesOptional,\n} from '../../_internal';\nimport type { StandardQueryOptions } from '../../types/query';\nimport { marketplaceConfigOptions } from './marketplaceConfig';\n\nexport interface FetchMarketCurrenciesParams {\n\tchainId: number;\n\tincludeNativeCurrency?: boolean;\n\tcollectionAddress?: Address;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches supported currencies for a marketplace\n */\nexport async function fetchMarketCurrencies(\n\tparams: FetchMarketCurrenciesParams,\n) {\n\tconst { chainId, includeNativeCurrency, collectionAddress, config } = params;\n\tconst includeNativeCurrencyOption = includeNativeCurrency ?? true;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tlet currencies = await marketplaceClient\n\t\t.listCurrencies({\n\t\t\tchainId: String(chainId),\n\t\t})\n\t\t.then((resp) =>\n\t\t\tresp.currencies.map((currency) => ({\n\t\t\t\t...currency,\n\t\t\t\tcontractAddress: currency.contractAddress || zeroAddress,\n\t\t\t})),\n\t\t);\n\n\tif (collectionAddress) {\n\t\tconst queryClient = getQueryClient();\n\t\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\t\tmarketplaceConfigOptions(config),\n\t\t);\n\n\t\tconst currenciesOptions = marketplaceConfig.market.collections.find(\n\t\t\t(collection) =>\n\t\t\t\tcompareAddress(collection.itemsAddress, collectionAddress),\n\t\t)?.currencyOptions;\n\n\t\t// Filter currencies based on collection currency options\n\t\tif (currenciesOptions) {\n\t\t\tcurrencies = currencies.filter((currency) =>\n\t\t\t\tcurrenciesOptions.includes(currency.contractAddress),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!includeNativeCurrencyOption) {\n\t\tcurrencies = currencies.filter((currency) => !currency.nativeCurrency);\n\t}\n\n\treturn currencies;\n}\n\nexport type MarketCurrenciesQueryOptions =\n\tValuesOptional<FetchMarketCurrenciesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function getMarketCurrenciesQueryKey(\n\tparams: MarketCurrenciesQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId),\n\t} satisfies QueryKeyArgs<ListCurrenciesArgs>;\n\n\treturn [\n\t\t...currencyKeys.lists,\n\t\tapiArgs,\n\t\t{\n\t\t\tincludeNativeCurrency: params.includeNativeCurrency,\n\t\t\tcollectionAddress: params.collectionAddress,\n\t\t},\n\t] as const;\n}\n\nexport function marketCurrenciesQueryOptions(\n\tparams: MarketCurrenciesQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId && params.config && (params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: getMarketCurrenciesQueryKey(params),\n\t\tqueryFn: () =>\n\t\t\tfetchMarketCurrencies({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tincludeNativeCurrency: params.includeNativeCurrency,\n\t\t\t\tcollectionAddress: params.collectionAddress,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n"],"mappings":";;;;;;;;;;AAyBA,eAAsB,sBACrB,QACC;CACD,MAAM,EAAE,SAAS,uBAAuB,mBAAmB,WAAW;CACtE,MAAM,8BAA8B,yBAAyB;CAG7D,IAAI,aAAa,MAFS,qBAAqB,OAAO,CAGpD,eAAe,EACf,SAAS,OAAO,QAAQ,EACxB,CAAC,CACD,MAAM,SACN,KAAK,WAAW,KAAK,cAAc;EAClC,GAAG;EACH,iBAAiB,SAAS,mBAAmB;EAC7C,EAAE,CACH;AAEF,KAAI,mBAAmB;EAMtB,MAAM,qBAJoB,MADN,gBAAgB,CACQ,WAC3C,yBAAyB,OAAO,CAChC,EAE2C,OAAO,YAAY,MAC7D,eACA,eAAe,WAAW,cAAc,kBAAkB,CAC3D,EAAE;AAGH,MAAI,kBACH,cAAa,WAAW,QAAQ,aAC/B,kBAAkB,SAAS,SAAS,gBAAgB,CACpD;;AAIH,KAAI,CAAC,4BACJ,cAAa,WAAW,QAAQ,aAAa,CAAC,SAAS,eAAe;AAGvE,QAAO;;AAQR,SAAgB,4BACf,QACC;CACD,MAAM,UAAU,EACf,SAAS,OAAO,OAAO,QAAQ,EAC/B;AAED,QAAO;EACN,GAAG,aAAa;EAChB;EACA;GACC,uBAAuB,OAAO;GAC9B,mBAAmB,OAAO;GAC1B;EACD;;AAGF,SAAgB,6BACf,QACC;CACD,MAAM,UAAU,QACf,OAAO,WAAW,OAAO,WAAW,OAAO,OAAO,WAAW,MAC7D;AAED,QAAO,aAAa;EACnB,UAAU,4BAA4B,OAAO;EAC7C,eACC,sBAAsB;GAErB,SAAS,OAAO;GAEhB,QAAQ,OAAO;GACf,uBAAuB,OAAO;GAC9B,mBAAmB,OAAO;GAC1B,CAAC;EACH,GAAG,OAAO;EACV;EACA,CAAC"}
|