@0xsequence/marketplace-sdk 1.1.0 → 1.2.0
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 +58 -5
- package/dist/{BellIcon-IpHHEy8h.js → BellIcon-DMKEumAz.js} +2 -2
- package/dist/BellIcon-DMKEumAz.js.map +1 -0
- package/dist/{CartIcon-C8zbor8H.js → CartIcon-UyB4NYKt.js} +3 -3
- package/dist/CartIcon-UyB4NYKt.js.map +1 -0
- package/dist/CollectibleCard-z05qWzKE.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-Cq8LuElo.js} +1 -1
- package/dist/{alien_swap-BTJ7mSR-.js.map → alien_swap-Cq8LuElo.js.map} +1 -1
- package/dist/{api-DuLKn__v.js → api-GwTR0dBA.js} +13 -49
- package/dist/api-GwTR0dBA.js.map +1 -0
- package/dist/{aqua-xyz-BYJ9WSP_.js → aqua-xyz-0yye_c-Z.js} +1 -1
- package/dist/{aqua-xyz-BYJ9WSP_.js.map → aqua-xyz-0yye_c-Z.js.map} +1 -1
- package/dist/{aura-D7SUjgro.js → aura-TaxFvTFQ.js} +1 -1
- package/dist/{aura-D7SUjgro.js.map → aura-TaxFvTFQ.js.map} +1 -1
- package/dist/{blur-BcnRFCaV.js → blur-BupOTobO.js} +1 -1
- package/dist/{blur-BcnRFCaV.js.map → blur-BupOTobO.js.map} +1 -1
- package/dist/{builder-api-BFuZNOaN.js → builder-api-m4JAA6ee.js} +3 -3
- package/dist/builder-api-m4JAA6ee.js.map +1 -0
- package/dist/{builder.gen-B9wR2nvF.js → builder.gen--XD71cNL.js} +2 -2
- package/dist/builder.gen--XD71cNL.js.map +1 -0
- package/dist/{coinbase-ChoX9Hw2.js → coinbase-DTgZ4wDT.js} +1 -1
- package/dist/{coinbase-ChoX9Hw2.js.map → coinbase-DTgZ4wDT.js.map} +1 -1
- package/dist/collectibles-CZ6i8sXK.js +324 -0
- package/dist/collectibles-CZ6i8sXK.js.map +1 -0
- package/dist/collections-5NcU-7ZR.js +331 -0
- package/dist/collections-5NcU-7ZR.js.map +1 -0
- package/dist/{components-CUv-wQr8.js → components-CY8kx2kb.js} +13 -9
- package/dist/components-CY8kx2kb.js.map +1 -0
- package/dist/{contracts-D72LBOX3.js → contracts-DRJHF89h.js} +5 -4
- package/dist/{contracts-D72LBOX3.js.map → contracts-DRJHF89h.js.map} +1 -1
- package/dist/{create-config-CIfejoCk.js → create-config-BxyfYCEk.js} +6 -5
- package/dist/create-config-BxyfYCEk.js.map +1 -0
- package/dist/{create-config-DV_dtaLt.d.ts → create-config-CFBeD8CB.d.ts} +149 -57
- package/dist/{element-Dbcv5qya.js → element-D4dDznlu.js} +1 -1
- package/dist/{element-Dbcv5qya.js.map → element-D4dDznlu.js.map} +1 -1
- package/dist/filters-B5niI_fX.d.ts +60 -0
- package/dist/{foundation-QPhUEUy8.js → foundation-GHZOKAzN.js} +1 -1
- package/dist/{foundation-QPhUEUy8.js.map → foundation-GHZOKAzN.js.map} +1 -1
- package/dist/index-8scPf0CS.d.ts +55 -0
- package/dist/index-9qsplZ8r.d.ts +18 -0
- package/dist/index-BIuYTMc2.d.ts +122 -0
- package/dist/{index-BoNNplSx.d.ts → index-BNrz99xy.d.ts} +3 -3
- package/dist/{index-BaytncQc.d.ts → index-BYQOPS8e.d.ts} +108 -51
- package/dist/{index-CXscCUg7.d.ts → index-BkZ7SPLc.d.ts} +19 -29
- package/dist/{index-D6YMj82n.d.ts → index-BnUku_aF.d.ts} +109 -114
- package/dist/index-BtDAHMW_.d.ts +50 -0
- package/dist/index-C-c_M_sE.d.ts +107 -0
- package/dist/index-CKefEBrI.d.ts +1 -0
- package/dist/{index-CMPUveNz.d.ts → index-CNIiC8Z_.d.ts} +11 -8
- package/dist/{index-DLUjc7Bx.d.ts → index-CbERNN3s.d.ts} +201 -12
- package/dist/{index-C768pAfu.d.ts → index-CsfxsN0t.d.ts} +4 -4
- package/dist/{index-CQecU53t.d.ts → index-DASjaiJL.d.ts} +119 -24
- package/dist/{index-CT8ZorFd.d.ts → index-DD7Vc4cE.d.ts} +2 -2
- package/dist/{index-DpeWm_vF.d.ts → index-DIc8OqWV.d.ts} +7 -6
- package/dist/index-DVI_vggD.d.ts +171 -0
- package/dist/index-DgsCqh_P.d.ts +1 -0
- package/dist/{index-DMBMM16q.d.ts → index-DqxQeYT2.d.ts} +39 -36
- package/dist/{index-D-UXGo5d.d.ts → index-Dsf9FRtr.d.ts} +19 -3
- package/dist/{index-DJG0kiII.d.ts → index-DxAReMEO.d.ts} +45 -34
- package/dist/index-UXRoZmd_.d.ts +70 -0
- package/dist/{index-CM0ZTePs.d.ts → index-isFvc5gd.d.ts} +2 -2
- package/dist/{index-jGgfEHfQ.d.ts → index-j3nuJWyJ.d.ts} +18 -10
- package/dist/{index-B6aSbaw2.d.ts → index-nVb7o0hc.d.ts} +2 -2
- package/dist/{index-Bv5XVLjH.d.ts → index-pbE88Tt7.d.ts} +2 -2
- package/dist/index-xpO4AQyS.d.ts +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +13 -13
- package/dist/inventory--t6Zu55O.js +75 -0
- package/dist/inventory--t6Zu55O.js.map +1 -0
- package/dist/listCollectiblesPaginated-BlE5mSzh.d.ts +327 -0
- package/dist/listCollections-DWyqFSQ3.d.ts +828 -0
- package/dist/{looks-rare-C7cQztTR.js → looks-rare-2HBhMpOf.js} +1 -1
- package/dist/{looks-rare-C7cQztTR.js.map → looks-rare-2HBhMpOf.js.map} +1 -1
- package/dist/lowestListing-DsunDO1c.d.ts +475 -0
- package/dist/{magic-eden-D3r7jiBG.js → magic-eden-BYdTp-uk.js} +1 -1
- package/dist/{magic-eden-D3r7jiBG.js.map → magic-eden-BYdTp-uk.js.map} +1 -1
- package/dist/{manifold-DsX0CBP-.js → manifold-yE0x6ZmO.js} +1 -1
- package/dist/{manifold-DsX0CBP-.js.map → manifold-yE0x6ZmO.js.map} +1 -1
- package/dist/market-DuBpFsDg.js +219 -0
- package/dist/market-DuBpFsDg.js.map +1 -0
- package/dist/{marketCurrencies-Bzj8X4TL.d.ts → marketCurrencies-BgwmbGFk.d.ts} +57 -15
- package/dist/marketCurrencies-Bolonndy.js +59 -0
- package/dist/marketCurrencies-Bolonndy.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-Cz9RrtQo.js} +21 -21
- package/dist/marketplace-logos-Cz9RrtQo.js.map +1 -0
- package/dist/{marketplace.gen-w2YvbEEo.js → marketplace.gen-906FrJQJ.js} +75 -5
- package/dist/marketplace.gen-906FrJQJ.js.map +1 -0
- package/dist/{marketplaceConfig-BTy75Mbf.js → marketplaceConfig-Bqjo7NYO.js} +9 -5
- package/dist/marketplaceConfig-Bqjo7NYO.js.map +1 -0
- package/dist/{mintify-DiOoDmO1.js → mintify-BXQx3mZB.js} +1 -1
- package/dist/{mintify-DiOoDmO1.js.map → mintify-BXQx3mZB.js.map} +1 -1
- package/dist/{network-DtmiMhcg.js → network-DwdZ_5-7.js} +2 -2
- package/dist/network-DwdZ_5-7.js.map +1 -0
- package/dist/{networkconfigToWagmiChain-DbUf6HiO.js → networkconfigToWagmiChain-Ct-hGq8M.js} +4 -3
- package/dist/networkconfigToWagmiChain-Ct-hGq8M.js.map +1 -0
- package/dist/{nftx-CP82jNra.js → nftx-B929_3Ce.js} +1 -1
- package/dist/{nftx-CP82jNra.js.map → nftx-B929_3Ce.js.map} +1 -1
- package/dist/{okx-p9-4xRjs.js → okx-sZ0-Udny.js} +1 -1
- package/dist/{okx-p9-4xRjs.js.map → okx-sZ0-Udny.js.map} +1 -1
- package/dist/{open-sea-D2GwAmKS.js → open-sea-DO9PhTrz.js} +1 -1
- package/dist/{open-sea-D2GwAmKS.js.map → open-sea-DO9PhTrz.js.map} +1 -1
- package/dist/orders-DH76ym2e.js +469 -0
- package/dist/orders-DH76ym2e.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-CECrqatg.js +156 -0
- package/dist/primary-sales-CECrqatg.js.map +1 -0
- package/dist/{query-BG-MA1MB.d.ts → query-brXxOcH0.d.ts} +1 -1
- package/dist/{rarible-DqiiW9ki.js → rarible-Ccb2hs7y.js} +1 -1
- package/dist/{rarible-DqiiW9ki.js.map → rarible-Ccb2hs7y.js.map} +1 -1
- package/dist/react/_internal/api/index.d.ts +2 -2
- package/dist/react/_internal/api/index.js +6 -6
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +32 -22
- package/dist/react/_internal/index.d.ts +2 -2
- package/dist/react/_internal/index.js +8 -8
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/_internal/wagmi/index.js +3 -3
- package/dist/react/hooks/config/index.d.ts +8 -8
- package/dist/react/hooks/config/index.js +32 -22
- package/dist/react/hooks/contracts/index.d.ts +6 -6
- package/dist/react/hooks/contracts/index.js +12 -12
- package/dist/react/hooks/data/collectibles/index.d.ts +10 -4
- package/dist/react/hooks/data/collectibles/index.js +32 -22
- package/dist/react/hooks/data/collections/index.d.ts +11 -11
- package/dist/react/hooks/data/collections/index.js +33 -23
- package/dist/react/hooks/data/index.d.ts +37 -29
- package/dist/react/hooks/data/index.js +33 -23
- package/dist/react/hooks/data/inventory/index.d.ts +36 -28
- package/dist/react/hooks/data/inventory/index.js +32 -22
- package/dist/react/hooks/data/market/index.d.ts +11 -5
- package/dist/react/hooks/data/market/index.js +32 -22
- package/dist/react/hooks/data/orders/index.d.ts +11 -5
- package/dist/react/hooks/data/orders/index.js +33 -23
- package/dist/react/hooks/data/primary-sales/index.d.ts +37 -29
- package/dist/react/hooks/data/primary-sales/index.js +33 -23
- package/dist/react/hooks/data/tokens/index.d.ts +4 -4
- package/dist/react/hooks/data/tokens/index.js +32 -22
- package/dist/react/hooks/index.d.ts +37 -29
- package/dist/react/hooks/index.js +33 -23
- package/dist/react/hooks/transactions/index.d.ts +2 -2
- package/dist/react/hooks/transactions/index.js +32 -22
- package/dist/react/hooks/ui/index.d.ts +4 -4
- package/dist/react/hooks/ui/index.js +32 -22
- package/dist/react/hooks/utils/index.d.ts +36 -28
- package/dist/react/hooks/utils/index.js +32 -22
- package/dist/react/index.d.ts +37 -29
- package/dist/react/index.js +33 -23
- package/dist/react/queries/collectibles/index.d.ts +11 -0
- package/dist/react/queries/collectibles/index.js +22 -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 +26 -16
- 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 +13 -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 +8 -8
- 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 +16 -16
- 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 +32 -22
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +4 -4
- package/dist/react/ui/components/marketplace-collectible-card/index.js +32 -22
- 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 +8 -8
- 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 +12 -12
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +32 -22
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +32 -22
- package/dist/react/utils/index.d.ts +3 -3
- package/dist/react/utils/index.js +6 -6
- package/dist/{react-BLJ4DkPx.js → react-CBsgOdVP.js} +1540 -474
- package/dist/react-CBsgOdVP.js.map +1 -0
- package/dist/{sequence-Bbb-TFKg.js → sequence-CRdb1yEs.js} +1 -1
- package/dist/{sequence-Bbb-TFKg.js.map → sequence-CRdb1yEs.js.map} +1 -1
- package/dist/styles/index.css +155 -1
- package/dist/{sudo-swap-CEPIM3Js.js → sudo-swap-BIklG2gq.js} +1 -1
- package/dist/{sudo-swap-CEPIM3Js.js.map → sudo-swap-BIklG2gq.js.map} +1 -1
- package/dist/{super-rare-CMEn9PoO.js → super-rare-h8645_5E.js} +1 -1
- package/dist/{super-rare-CMEn9PoO.js.map → super-rare-h8645_5E.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-CouzNX4j.js +57 -0
- package/dist/tokenBalances-CouzNX4j.js.map +1 -0
- package/dist/tokenSupplies-C3zJll0M.d.ts +265 -0
- package/dist/tokens-BvIRUCGG.js +225 -0
- package/dist/tokens-BvIRUCGG.js.map +1 -0
- package/dist/transaction-DZUW5RHu.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types-B_-cnkcP.js.map +1 -1
- package/dist/{types-D6LkVrF0.d.ts → types-CMDwfhfR.d.ts} +6 -5
- 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 +11 -11
- package/dist/{utils-BZEkdqWK.js → utils-9ToOvt-c.js} +50 -7
- package/dist/utils-9ToOvt-c.js.map +1 -0
- package/dist/{utils-oVZxdK0o.js → utils-B6di6O-C.js} +2 -2
- package/dist/utils-B6di6O-C.js.map +1 -0
- package/dist/utils-BCYTEOvy.js +122 -0
- package/dist/utils-BCYTEOvy.js.map +1 -0
- package/dist/waitForTransactionReceipt-CbSeUSXe.js +26 -0
- package/dist/waitForTransactionReceipt-CbSeUSXe.js.map +1 -0
- package/dist/{x2y2-DNe6JgtG.js → x2y2-OvF__ugj.js} +1 -1
- package/dist/{x2y2-DNe6JgtG.js.map → x2y2-OvF__ugj.js.map} +1 -1
- package/dist/{zora-w0Zqxxs4.js → zora-DzCeu-eE.js} +1 -1
- package/dist/{zora-w0Zqxxs4.js.map → zora-DzCeu-eE.js.map} +1 -1
- package/package.json +46 -41
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +15 -0
- package/src/react/_internal/api/index.ts +0 -1
- package/src/react/_internal/api/marketplace.gen.ts +1774 -2383
- package/src/react/_internal/api/query-keys.ts +23 -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 -10
- 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 +2 -17
- package/src/react/hooks/data/collectibles/useListCollectiblesPaginated.tsx +1 -1
- package/src/react/hooks/data/collectibles/useTokenBalances.tsx +1 -10
- package/src/react/hooks/data/collections/index.ts +2 -0
- package/src/react/hooks/data/collections/useCollection.tsx +1 -1
- 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/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 +2 -11
- 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.test.tsx +31 -2
- 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/index.ts +1 -0
- 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/primary-sales/usePrimarySaleItem.tsx +71 -0
- package/src/react/hooks/data/tokens/useGetTokenRanges.tsx +2 -2
- package/src/react/hooks/data/tokens/useListBalances.tsx +3 -12
- 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 +2 -14
- 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 +3 -0
- package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +6 -0
- package/src/react/hooks/transactions/useProcessStep.test.tsx +8 -6
- package/src/react/hooks/transactions/useProcessStep.ts +8 -6
- 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.test.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 +14 -2
- package/src/react/queries/{balanceOfCollectible.ts → collectibles/balanceOfCollectible.ts} +23 -16
- 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} +22 -56
- package/src/react/queries/{listCollectiblesPaginated.ts → collectibles/listCollectiblesPaginated.ts} +22 -5
- package/src/react/queries/{tokenBalances.ts → collectibles/tokenBalances.ts} +20 -16
- package/src/react/queries/collections/activeListingsCurrencies.ts +84 -0
- package/src/react/queries/collections/activeOffersCurrencies.ts +84 -0
- 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 +7 -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/inventory/index.ts +1 -0
- package/src/react/queries/{inventory.ts → inventory/inventory.ts} +13 -14
- 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} +32 -6
- 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 +4 -0
- package/src/react/queries/primary-sales/primarySaleItem.ts +80 -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} +17 -22
- 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} +17 -34
- package/src/react/queries/{comparePrices.ts → utils/comparePrices.ts} +29 -5
- 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.stories.tsx +2 -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/components/footer/Footer.tsx +4 -18
- package/src/react/ui/components/marketplace-collectible-card/types.ts +1 -0
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +5 -2
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +2 -2
- package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +3 -0
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +1 -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 -25
- 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 +77 -10
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +12 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +6 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +15 -26
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +3 -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 +34 -10
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +18 -9
- 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 +198 -11
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +58 -10
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +2 -0
- package/src/react/utils/waitForTransactionReceipt.ts +26 -32
- package/src/styles/index.css +1 -0
- package/src/styles/styles.ts +156 -2
- package/src/types/index.ts +1 -1
- package/src/utils/abi/index.ts +1 -0
- package/src/utils/abi/mainModule.ts +158 -0
- 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/dist/BellIcon-IpHHEy8h.js.map +0 -1
- package/dist/CartIcon-C8zbor8H.js.map +0 -1
- package/dist/CollectibleCard-C2EWF0zo.d.ts +0 -8
- package/dist/api-DuLKn__v.js.map +0 -1
- package/dist/builder-api-BFuZNOaN.js.map +0 -1
- package/dist/builder.gen-B9wR2nvF.js.map +0 -1
- package/dist/components-CUv-wQr8.js.map +0 -1
- package/dist/create-config-CIfejoCk.js.map +0 -1
- package/dist/filters-zkMJaPey.d.ts +0 -31
- package/dist/index-B8vaT3_s.d.ts +0 -18
- package/dist/index-Yobo6icm.d.ts +0 -234
- package/dist/listCollectiblesPaginated-Bq0QSOjJ.d.ts +0 -168
- package/dist/listCollections-dTCq00l5.d.ts +0 -669
- package/dist/lowestListing-CB5Te-Q9.d.ts +0 -168
- package/dist/marketplace-logos-Csv2MBwf.js.map +0 -1
- package/dist/marketplace.gen-w2YvbEEo.js.map +0 -1
- package/dist/marketplaceConfig-BTy75Mbf.js.map +0 -1
- package/dist/network-DtmiMhcg.js.map +0 -1
- package/dist/networkconfigToWagmiChain-DbUf6HiO.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/utils-BZEkdqWK.js.map +0 -1
- package/dist/utils-oVZxdK0o.js.map +0 -1
- package/dist/waitForTransactionReceipt-B08YZiDY.js +0 -26
- package/dist/waitForTransactionReceipt-B08YZiDY.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/__tests__/balanceOfCollectible.laos.test.ts +0 -123
- package/src/react/queries/__tests__/inventory.laos.test.ts +0 -499
- package/src/react/queries/__tests__/tokenBalances.laos.test.ts +0 -123
- /package/dist/{index-Cg5cFzs-.d.ts → index-CCggO_hw.d.ts} +0 -0
- /package/dist/{abi-DYsUABe6.js → queries-CyajGg_O.js} +0 -0
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { DEFAULT_MARKETPLACE_FEE_PERCENTAGE } from "./src-Dz2CfBL0.js";
|
|
3
|
-
import { BaseError
|
|
4
|
-
import { balanceQueries, collectableKeys, getMarketplaceClient, getQueryClient,
|
|
5
|
-
import { CollectionStatus, ContractType, ExecuteType, OrderSide, OrderbookKind, PropertyType, StepType, WalletKind } from "./marketplace.gen-
|
|
6
|
-
import { getNetwork, getPresentableChainName } from "./network-
|
|
3
|
+
import { BaseError, ChainSwitchError, InvalidContractTypeError, NoWalletConnectedError, TransactionExecutionError, TransactionSignatureError, UserRejectedRequestError } from "./transaction-DZUW5RHu.js";
|
|
4
|
+
import { balanceQueries, collectableKeys, getMarketplaceClient, getQueryClient, marketplaceApiURL } from "./api-GwTR0dBA.js";
|
|
5
|
+
import { CollectionStatus$1 as CollectionStatus, ContractType$1 as ContractType, ExecuteType$1 as ExecuteType, OfferType$1 as OfferType, OrderSide$1 as OrderSide, OrderbookKind$1 as OrderbookKind, PropertyType$1 as PropertyType, StepType$1 as StepType, WalletKind$1 as WalletKind } from "./marketplace.gen-906FrJQJ.js";
|
|
6
|
+
import { getNetwork$1 as getNetwork, getPresentableChainName$1 as getPresentableChainName } from "./network-DwdZ_5-7.js";
|
|
7
7
|
import { PROVIDER_ID, TransactionType } from "./_internal-DkS2VUn5.js";
|
|
8
8
|
import { CollectibleCardAction } from "./types-B_-cnkcP.js";
|
|
9
|
-
import { EIP2981_ABI, SequenceMarketplaceV1_ABI } from "./marketplace-
|
|
10
|
-
import { ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1 } from "./primary-sale-
|
|
11
|
-
import { ERC1155_ABI, ERC721_ABI } from "./token-
|
|
12
|
-
import { calculateEarningsAfterFees,
|
|
13
|
-
import { marketplaceConfigOptions } from "./marketplaceConfig-
|
|
14
|
-
import { SalesContractVersion, useSalesContractABI } from "./contracts-
|
|
15
|
-
import { balanceOfCollectibleOptions,
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
9
|
+
import { EIP2981_ABI, SequenceMarketplaceV1_ABI } from "./marketplace-NQB-sEQL.js";
|
|
10
|
+
import { ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1 } from "./primary-sale-1u4QlPdA.js";
|
|
11
|
+
import { ERC1155_ABI, ERC721_ABI } from "./token-Cv7l2ZaL.js";
|
|
12
|
+
import { calculateEarningsAfterFees, calculateTotalOfferCost, cn, compareAddress, formatPriceWithFee, truncateMiddle, validateOpenseaOfferDecimals } from "./utils-9ToOvt-c.js";
|
|
13
|
+
import { marketplaceConfigOptions$1 as marketplaceConfigOptions } from "./marketplaceConfig-Bqjo7NYO.js";
|
|
14
|
+
import { SalesContractVersion, useSalesContractABI } from "./contracts-DRJHF89h.js";
|
|
15
|
+
import { balanceOfCollectibleOptions, collectibleQueryOptions, countOfCollectablesQueryOptions, listCollectibleActivitiesQueryOptions, listCollectiblesPaginatedQueryOptions, listCollectiblesQueryOptions } from "./collectibles-CZ6i8sXK.js";
|
|
16
|
+
import { collectionActiveListingsCurrenciesQueryOptions, collectionActiveOffersCurrenciesQueryOptions, collectionBalanceDetailsQueryOptions, collectionDetailsQueryOptions, collectionQueryOptions, listCollectionActivitiesQueryOptions, listCollectionsQueryOptions } from "./collections-5NcU-7ZR.js";
|
|
17
|
+
import { checkoutOptionsQueryOptions, checkoutOptionsSalesContractQueryOptions, currencyQueryOptions, filtersQueryOptions } from "./market-DuBpFsDg.js";
|
|
18
|
+
import { marketCurrenciesQueryOptions } from "./marketCurrencies-Bolonndy.js";
|
|
19
|
+
import { countItemsOrdersForCollectionQueryOptions, countListingsForCollectibleQueryOptions, countOffersForCollectibleQueryOptions, floorOrderQueryOptions, getCountOfFilteredOrdersQueryOptions, highestOfferQueryOptions, listItemsOrdersForCollectionPaginatedQueryOptions, listItemsOrdersForCollectionQueryOptions, listListingsForCollectibleQueryOptions, listOffersForCollectibleQueryOptions, lowestListingQueryOptions } from "./orders-DH76ym2e.js";
|
|
20
|
+
import { inventoryOptions } from "./inventory--t6Zu55O.js";
|
|
21
|
+
import { countOfPrimarySaleItemsOptions, listPrimarySaleItemsQueryOptions, primarySaleItemQueryOptions, primarySaleItemsCountQueryOptions } from "./primary-sales-CECrqatg.js";
|
|
22
|
+
import { getTokenRangesQueryOptions, listBalancesOptions, listTokenMetadataQueryOptions, searchTokenMetadataQueryOptions, tokenSuppliesQueryOptions } from "./tokens-BvIRUCGG.js";
|
|
23
|
+
import { comparePricesQueryOptions, convertPriceToUSDQueryOptions } from "./utils-BCYTEOvy.js";
|
|
24
|
+
import { waitForTransactionReceipt } from "./waitForTransactionReceipt-CbSeUSXe.js";
|
|
25
|
+
import { CalendarIcon_default, CartIcon_default, InfoIcon_default } from "./CartIcon-UyB4NYKt.js";
|
|
26
|
+
import { FooterName, PriceDisplay, SaleDetailsPill, TokenTypeBalancePill } from "./components-CY8kx2kb.js";
|
|
19
27
|
import { NetworkType, networks } from "@0xsequence/network";
|
|
20
28
|
import { useAccount, useBalance, useChainId, usePublicClient, useReadContract, useReadContracts, useSendTransaction, useSignMessage, useSignTypedData, useSwitchChain, useWriteContract } from "wagmi";
|
|
21
29
|
import { useChain, useOpenConnectModal, useWaasFeeOptions } from "@0xsequence/connect";
|
|
22
30
|
import { Suspense, createContext, lazy, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
23
31
|
import { QueryClientProvider, queryOptions, skipToken, useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
|
24
32
|
import { TransactionStatus } from "@0xsequence/indexer";
|
|
25
|
-
import { AddIcon, Button, CheckmarkIcon, ChevronDownIcon, Divider, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger, ExternalLinkIcon, IconButton, Image, Modal, NetworkImage, NumericInput, Select, Skeleton, Spinner, SubtractIcon, Text, TextInput, ThemeProvider, TokenImage, Tooltip, WarningIcon, cn } from "@0xsequence/design-system";
|
|
33
|
+
import { AddIcon, Button, CheckmarkIcon, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Divider, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger, ExternalLinkIcon, IconButton, Image, InfoIcon, Modal, NetworkImage, NumericInput, Select, Skeleton, Spinner, SubtractIcon, Text, TextInput, ThemeProvider, TimeIcon, TokenImage, Tooltip, WarningIcon, cn as cn$1 } from "@0xsequence/design-system";
|
|
26
34
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
27
35
|
import * as dn from "dnum";
|
|
28
|
-
import
|
|
36
|
+
import * as dnum from "dnum";
|
|
37
|
+
import { BaseError as BaseError$1, UserRejectedRequestError as UserRejectedRequestError$1, WaitForTransactionReceiptTimeoutError, decodeFunctionData, encodeFunctionData, erc20Abi, erc721Abi, formatUnits, hexToBigInt, isAddress, isHex, maxUint256, parseEventLogs, parseUnits, toHex, zeroAddress } from "viem";
|
|
29
38
|
import { Databeat } from "@databeat/tracker";
|
|
30
39
|
import { observable } from "@legendapp/state";
|
|
31
40
|
import { createStore } from "@xstate/store";
|
|
@@ -33,14 +42,14 @@ import { useSelector } from "@xstate/store/react";
|
|
|
33
42
|
import { createSerializer, parseAsBoolean, parseAsJson, parseAsString, useQueryState } from "nuqs";
|
|
34
43
|
import { SequenceCheckoutProvider, useERC1155SaleContractCheckout, useSelectPaymentModal } from "@0xsequence/checkout";
|
|
35
44
|
import { Show, observer, use$ } from "@legendapp/state/react";
|
|
36
|
-
import { addDays, differenceInDays, format, formatDistanceToNow, isSameDay, startOfDay } from "date-fns";
|
|
45
|
+
import { addDays, differenceInDays, endOfDay, format, formatDistanceToNow, getHours, getMinutes, isSameDay, setHours, setMinutes, startOfDay } from "date-fns";
|
|
37
46
|
import { avalanche, optimism } from "viem/chains";
|
|
38
47
|
import { DayPicker } from "react-day-picker";
|
|
39
48
|
import { addDays as addDays$1 } from "date-fns/addDays";
|
|
40
49
|
import { createPortal } from "react-dom";
|
|
41
50
|
|
|
42
51
|
//#region src/utils/_internal/error/context.ts
|
|
43
|
-
var MarketplaceSdkProviderNotFoundError = class extends BaseError
|
|
52
|
+
var MarketplaceSdkProviderNotFoundError = class extends BaseError {
|
|
44
53
|
name = "MarketplaceSDKProviderNotFoundError";
|
|
45
54
|
constructor() {
|
|
46
55
|
super("`useConfig` must be used within `MarketplaceSdkProvider`.");
|
|
@@ -49,7 +58,7 @@ var MarketplaceSdkProviderNotFoundError = class extends BaseError$1 {
|
|
|
49
58
|
|
|
50
59
|
//#endregion
|
|
51
60
|
//#region src/utils/_internal/error/config.ts
|
|
52
|
-
var ConfigError = class extends BaseError
|
|
61
|
+
var ConfigError = class extends BaseError {
|
|
53
62
|
name = "ConfigError";
|
|
54
63
|
};
|
|
55
64
|
var InvalidProjectAccessKeyError = class extends ConfigError {
|
|
@@ -98,9 +107,40 @@ var DatabeatAnalytics = class extends Databeat {
|
|
|
98
107
|
}
|
|
99
108
|
};
|
|
100
109
|
const useAnalytics = () => {
|
|
101
|
-
|
|
110
|
+
const context = useContext(MarketplaceSdkContext);
|
|
111
|
+
return context.analytics;
|
|
102
112
|
};
|
|
103
113
|
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/react/providers/analytics-provider.tsx
|
|
116
|
+
function AnalyticsProvider({ config, children }) {
|
|
117
|
+
const { address, isConnected } = useAccount();
|
|
118
|
+
const isWindowDefined = typeof window !== "undefined";
|
|
119
|
+
const analytics = useMemo(() => {
|
|
120
|
+
const server = "https://nodes.sequence.app";
|
|
121
|
+
const auth = {};
|
|
122
|
+
auth.headers = { "X-Access-Key": config.projectAccessKey };
|
|
123
|
+
return new DatabeatAnalytics(server, auth, {
|
|
124
|
+
defaultEnabled: true,
|
|
125
|
+
initProps: () => {
|
|
126
|
+
return { origin: isWindowDefined ? window.location.origin : "" };
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}, [config.projectAccessKey, isWindowDefined]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (!isConnected || !address) {
|
|
132
|
+
analytics?.reset();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
analytics?.identify(address.toLowerCase());
|
|
136
|
+
}, [
|
|
137
|
+
analytics,
|
|
138
|
+
address,
|
|
139
|
+
isConnected
|
|
140
|
+
]);
|
|
141
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(analytics) });
|
|
142
|
+
}
|
|
143
|
+
|
|
104
144
|
//#endregion
|
|
105
145
|
//#region src/react/providers/theme-provider.tsx
|
|
106
146
|
const ThemeProvider$1 = ({ children, theme, root }) => {
|
|
@@ -118,36 +158,29 @@ const ThemeProvider$1 = ({ children, theme, root }) => {
|
|
|
118
158
|
const MarketplaceSdkContext = createContext({});
|
|
119
159
|
function MarketplaceProvider({ config, children, openConnectModal }) {
|
|
120
160
|
if (config.projectAccessKey === "" || !config.projectAccessKey) throw new InvalidProjectAccessKeyError(config.projectAccessKey);
|
|
121
|
-
|
|
122
|
-
const analytics = useMemo(() => {
|
|
123
|
-
const server = "https://nodes.sequence.app";
|
|
124
|
-
const auth = {};
|
|
125
|
-
auth.headers = { "X-Access-Key": config.projectAccessKey };
|
|
126
|
-
return new DatabeatAnalytics(server, auth, {
|
|
127
|
-
defaultEnabled: true,
|
|
128
|
-
initProps: () => {
|
|
129
|
-
return { origin: isWindowDefined ? window.location.origin : "" };
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}, [config.projectAccessKey, isWindowDefined]);
|
|
133
|
-
if (openConnectModal) {
|
|
134
|
-
const context = {
|
|
135
|
-
...config,
|
|
136
|
-
openConnectModal,
|
|
137
|
-
analytics
|
|
138
|
-
};
|
|
139
|
-
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
140
|
-
value: context,
|
|
141
|
-
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children: /* @__PURE__ */ jsx("div", {
|
|
142
|
-
id: PROVIDER_ID,
|
|
143
|
-
children
|
|
144
|
-
}) })
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
return /* @__PURE__ */ jsx(MarketplaceProviderWithSequenceConnect, {
|
|
161
|
+
return /* @__PURE__ */ jsx(AnalyticsProvider, {
|
|
148
162
|
config,
|
|
149
|
-
analytics
|
|
150
|
-
|
|
163
|
+
children: (analytics) => {
|
|
164
|
+
if (openConnectModal) {
|
|
165
|
+
const context = {
|
|
166
|
+
...config,
|
|
167
|
+
openConnectModal,
|
|
168
|
+
analytics
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
171
|
+
value: context,
|
|
172
|
+
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children: /* @__PURE__ */ jsx("div", {
|
|
173
|
+
id: PROVIDER_ID,
|
|
174
|
+
children
|
|
175
|
+
}) })
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ jsx(MarketplaceProviderWithSequenceConnect, {
|
|
179
|
+
config,
|
|
180
|
+
analytics,
|
|
181
|
+
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children })
|
|
182
|
+
});
|
|
183
|
+
}
|
|
151
184
|
});
|
|
152
185
|
}
|
|
153
186
|
function MarketplaceQueryClientProvider({ children }) {
|
|
@@ -226,12 +259,7 @@ const useMarketplaceConfig = () => {
|
|
|
226
259
|
*/
|
|
227
260
|
function useBalanceOfCollectible(args) {
|
|
228
261
|
const config = useConfig();
|
|
229
|
-
|
|
230
|
-
const isLaos721 = (marketplaceConfig?.market.collections.find((collection) => collection.itemsAddress === args.collectionAddress))?.contractType === ContractType.LAOS_ERC_721;
|
|
231
|
-
return useQuery(balanceOfCollectibleOptions({
|
|
232
|
-
...args,
|
|
233
|
-
isLaos721
|
|
234
|
-
}, config));
|
|
262
|
+
return useQuery(balanceOfCollectibleOptions({ ...args }, config));
|
|
235
263
|
}
|
|
236
264
|
|
|
237
265
|
//#endregion
|
|
@@ -401,14 +429,13 @@ function useListCollectibleActivities(params) {
|
|
|
401
429
|
* Hook to fetch a list of collectibles with infinite pagination support
|
|
402
430
|
*
|
|
403
431
|
* Fetches collectibles from the marketplace with support for filtering, pagination,
|
|
404
|
-
* and special handling for shop marketplace types
|
|
432
|
+
* and special handling for shop marketplace types.
|
|
405
433
|
*
|
|
406
434
|
* @param params - Configuration parameters
|
|
407
435
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
408
436
|
* @param params.collectionAddress - The collection contract address
|
|
409
437
|
* @param params.side - Order side (listing or bid)
|
|
410
438
|
* @param params.filter - Optional filtering parameters
|
|
411
|
-
* @param params.isLaos721 - Whether the collection is a LAOS721 contract
|
|
412
439
|
* @param params.marketplaceType - Type of marketplace (shop, etc.)
|
|
413
440
|
* @param params.query - Optional React Query configuration
|
|
414
441
|
*
|
|
@@ -438,20 +465,6 @@ function useListCollectibleActivities(params) {
|
|
|
438
465
|
* }
|
|
439
466
|
* })
|
|
440
467
|
* ```
|
|
441
|
-
*
|
|
442
|
-
* @example
|
|
443
|
-
* For LAOS721 collections:
|
|
444
|
-
* ```typescript
|
|
445
|
-
* const { data } = useListCollectibles({
|
|
446
|
-
* chainId: 137,
|
|
447
|
-
* collectionAddress: '0x...',
|
|
448
|
-
* side: OrderSide.listing,
|
|
449
|
-
* isLaos721: true,
|
|
450
|
-
* filter: {
|
|
451
|
-
* inAccounts: ['0x...']
|
|
452
|
-
* }
|
|
453
|
-
* })
|
|
454
|
-
* ```
|
|
455
468
|
*/
|
|
456
469
|
function useListCollectibles(params) {
|
|
457
470
|
const defaultConfig = useConfig();
|
|
@@ -582,6 +595,100 @@ function useCollection(params) {
|
|
|
582
595
|
return useQuery({ ...queryOptions$1 });
|
|
583
596
|
}
|
|
584
597
|
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx
|
|
600
|
+
/**
|
|
601
|
+
* Hook to fetch the active listings currencies for a collection
|
|
602
|
+
*
|
|
603
|
+
* Retrieves all currencies that are currently being used in active listings
|
|
604
|
+
* for a specific collection from the marketplace.
|
|
605
|
+
*
|
|
606
|
+
* @param params - Configuration parameters
|
|
607
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
608
|
+
* @param params.collectionAddress - The collection contract address
|
|
609
|
+
* @param params.query - Optional React Query configuration
|
|
610
|
+
*
|
|
611
|
+
* @returns Query result containing the array of currencies used in active listings
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* Basic usage:
|
|
615
|
+
* ```typescript
|
|
616
|
+
* const { data, isLoading } = useCollectionActiveListingsCurrencies({
|
|
617
|
+
* chainId: 137,
|
|
618
|
+
* collectionAddress: '0x...'
|
|
619
|
+
* })
|
|
620
|
+
* ```
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* With custom query options:
|
|
624
|
+
* ```typescript
|
|
625
|
+
* const { data, isLoading } = useCollectionActiveListingsCurrencies({
|
|
626
|
+
* chainId: 1,
|
|
627
|
+
* collectionAddress: '0x...',
|
|
628
|
+
* query: {
|
|
629
|
+
* refetchInterval: 30000,
|
|
630
|
+
* enabled: hasCollectionAddress
|
|
631
|
+
* }
|
|
632
|
+
* })
|
|
633
|
+
* ```
|
|
634
|
+
*/
|
|
635
|
+
function useCollectionActiveListingsCurrencies(params) {
|
|
636
|
+
const defaultConfig = useConfig();
|
|
637
|
+
const { config = defaultConfig,...rest } = params;
|
|
638
|
+
const queryOptions$1 = collectionActiveListingsCurrenciesQueryOptions({
|
|
639
|
+
config,
|
|
640
|
+
...rest
|
|
641
|
+
});
|
|
642
|
+
return useQuery({ ...queryOptions$1 });
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx
|
|
647
|
+
/**
|
|
648
|
+
* Hook to fetch the active offers currencies for a collection
|
|
649
|
+
*
|
|
650
|
+
* Retrieves all currencies that are currently being used in active offers
|
|
651
|
+
* for a specific collection from the marketplace.
|
|
652
|
+
*
|
|
653
|
+
* @param params - Configuration parameters
|
|
654
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
655
|
+
* @param params.collectionAddress - The collection contract address
|
|
656
|
+
* @param params.query - Optional React Query configuration
|
|
657
|
+
*
|
|
658
|
+
* @returns Query result containing the array of currencies used in active offers
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* Basic usage:
|
|
662
|
+
* ```typescript
|
|
663
|
+
* const { data, isLoading } = useCollectionActiveOffersCurrencies({
|
|
664
|
+
* chainId: 137,
|
|
665
|
+
* collectionAddress: '0x...'
|
|
666
|
+
* })
|
|
667
|
+
* ```
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* With custom query options:
|
|
671
|
+
* ```typescript
|
|
672
|
+
* const { data, isLoading } = useCollectionActiveOffersCurrencies({
|
|
673
|
+
* chainId: 1,
|
|
674
|
+
* collectionAddress: '0x...',
|
|
675
|
+
* query: {
|
|
676
|
+
* refetchInterval: 30000,
|
|
677
|
+
* enabled: hasCollectionAddress
|
|
678
|
+
* }
|
|
679
|
+
* })
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
682
|
+
function useCollectionActiveOffersCurrencies(params) {
|
|
683
|
+
const defaultConfig = useConfig();
|
|
684
|
+
const { config = defaultConfig,...rest } = params;
|
|
685
|
+
const queryOptions$1 = collectionActiveOffersCurrenciesQueryOptions({
|
|
686
|
+
config,
|
|
687
|
+
...rest
|
|
688
|
+
});
|
|
689
|
+
return useQuery({ ...queryOptions$1 });
|
|
690
|
+
}
|
|
691
|
+
|
|
585
692
|
//#endregion
|
|
586
693
|
//#region src/react/hooks/data/collections/useCollectionBalanceDetails.tsx
|
|
587
694
|
/**
|
|
@@ -716,7 +823,8 @@ const collectionDetailsPollingOptions = (args, config) => {
|
|
|
716
823
|
if (data && isTerminalState(data.status)) return false;
|
|
717
824
|
const currentAttempt = (query.state.dataUpdateCount || 0) + 1;
|
|
718
825
|
if (currentAttempt >= MAX_ATTEMPTS) return false;
|
|
719
|
-
|
|
826
|
+
const interval = Math.min(INITIAL_POLLING_INTERVAL * 1.5 ** currentAttempt, MAX_POLLING_INTERVAL);
|
|
827
|
+
return interval;
|
|
720
828
|
},
|
|
721
829
|
refetchOnWindowFocus: false,
|
|
722
830
|
retry: false,
|
|
@@ -938,7 +1046,7 @@ const useSellModal = (callbacks) => {
|
|
|
938
1046
|
|
|
939
1047
|
//#endregion
|
|
940
1048
|
//#region src/react/hooks/data/market/useListMarketCardData.tsx
|
|
941
|
-
function useListMarketCardData({ collectionAddress, chainId, orderbookKind, collectionType, filterOptions, searchText, showListedOnly = false, onCollectibleClick, onCannotPerformAction, prioritizeOwnerActions, assetSrcPrefixUrl }) {
|
|
1049
|
+
function useListMarketCardData({ collectionAddress, chainId, orderbookKind, collectionType, filterOptions, searchText, showListedOnly = false, priceFilters, onCollectibleClick, onCannotPerformAction, prioritizeOwnerActions, assetSrcPrefixUrl, hideQuantitySelector }) {
|
|
942
1050
|
const { address: accountAddress } = useAccount();
|
|
943
1051
|
const { show: showSellModal } = useSellModal();
|
|
944
1052
|
const { data: collectiblesList, isLoading: collectiblesListIsLoading, fetchNextPage, hasNextPage, isFetchingNextPage, error: collectiblesListError } = useListCollectibles({
|
|
@@ -948,7 +1056,8 @@ function useListMarketCardData({ collectionAddress, chainId, orderbookKind, coll
|
|
|
948
1056
|
filter: {
|
|
949
1057
|
includeEmpty: !showListedOnly,
|
|
950
1058
|
searchText,
|
|
951
|
-
properties: filterOptions
|
|
1059
|
+
properties: filterOptions,
|
|
1060
|
+
prices: priceFilters
|
|
952
1061
|
},
|
|
953
1062
|
query: { enabled: !!collectionAddress && !!chainId }
|
|
954
1063
|
});
|
|
@@ -965,55 +1074,58 @@ function useListMarketCardData({ collectionAddress, chainId, orderbookKind, coll
|
|
|
965
1074
|
if (!collectiblesList?.pages) return [];
|
|
966
1075
|
return collectiblesList.pages.flatMap((page) => page.collectibles);
|
|
967
1076
|
}, [collectiblesList?.pages]);
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
}
|
|
1077
|
+
const collectibleCards = useMemo(() => {
|
|
1078
|
+
return allCollectibles.map((collectible) => {
|
|
1079
|
+
const balance = collectionBalance?.balances.find((balance$1) => balance$1.tokenID === collectible.metadata.tokenId)?.balance;
|
|
1080
|
+
const cardProps = {
|
|
1081
|
+
collectibleId: collectible.metadata.tokenId,
|
|
1082
|
+
chainId,
|
|
1083
|
+
collectionAddress,
|
|
1084
|
+
collectionType,
|
|
1085
|
+
cardLoading: collectiblesListIsLoading || balanceLoading,
|
|
1086
|
+
cardType: "market",
|
|
1087
|
+
orderbookKind,
|
|
1088
|
+
collectible,
|
|
1089
|
+
onCollectibleClick,
|
|
1090
|
+
balance,
|
|
1091
|
+
balanceIsLoading: balanceLoading,
|
|
1092
|
+
onCannotPerformAction,
|
|
1093
|
+
prioritizeOwnerActions,
|
|
1094
|
+
assetSrcPrefixUrl,
|
|
1095
|
+
hideQuantitySelector,
|
|
1096
|
+
onOfferClick: ({ order }) => {
|
|
1097
|
+
if (!accountAddress) return;
|
|
1098
|
+
if (balance) {
|
|
1099
|
+
showSellModal({
|
|
1100
|
+
chainId,
|
|
1101
|
+
collectionAddress,
|
|
1102
|
+
tokenId: collectible.metadata.tokenId,
|
|
1103
|
+
order
|
|
1104
|
+
});
|
|
1105
|
+
return;
|
|
998
1106
|
}
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
return cardProps;
|
|
1110
|
+
});
|
|
1111
|
+
}, [
|
|
1112
|
+
allCollectibles,
|
|
1113
|
+
chainId,
|
|
1114
|
+
collectionAddress,
|
|
1115
|
+
collectionType,
|
|
1116
|
+
collectiblesListIsLoading,
|
|
1117
|
+
balanceLoading,
|
|
1118
|
+
orderbookKind,
|
|
1119
|
+
onCollectibleClick,
|
|
1120
|
+
collectionBalance?.balances,
|
|
1121
|
+
onCannotPerformAction,
|
|
1122
|
+
prioritizeOwnerActions,
|
|
1123
|
+
assetSrcPrefixUrl,
|
|
1124
|
+
accountAddress,
|
|
1125
|
+
showSellModal
|
|
1126
|
+
]);
|
|
1127
|
+
return {
|
|
1128
|
+
collectibleCards,
|
|
1017
1129
|
isLoading: collectiblesListIsLoading || balanceLoading,
|
|
1018
1130
|
error: collectiblesListError,
|
|
1019
1131
|
hasNextPage,
|
|
@@ -1066,6 +1178,69 @@ function useMarketCurrencies(params) {
|
|
|
1066
1178
|
return useQuery({ ...queryOptions$1 });
|
|
1067
1179
|
}
|
|
1068
1180
|
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/react/hooks/data/orders/useCountItemsOrdersForCollection.tsx
|
|
1183
|
+
/**
|
|
1184
|
+
* Hook to get the count of orders for a collection
|
|
1185
|
+
*
|
|
1186
|
+
* Counts the total number of active orders (listings) for all tokens
|
|
1187
|
+
* in a collection. Useful for displaying order counts in collection UI.
|
|
1188
|
+
*
|
|
1189
|
+
* @param params - Configuration parameters
|
|
1190
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1191
|
+
* @param params.collectionAddress - The collection contract address
|
|
1192
|
+
* @param params.filter - Optional filter criteria for orders
|
|
1193
|
+
* @param params.query - Optional React Query configuration
|
|
1194
|
+
*
|
|
1195
|
+
* @returns Query result containing the count of orders
|
|
1196
|
+
*
|
|
1197
|
+
* @example
|
|
1198
|
+
* Basic usage:
|
|
1199
|
+
* ```typescript
|
|
1200
|
+
* const { data: orderCount, isLoading } = useCountItemsOrdersForCollection({
|
|
1201
|
+
* chainId: 137,
|
|
1202
|
+
* collectionAddress: '0x...'
|
|
1203
|
+
* })
|
|
1204
|
+
* ```
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* With filter:
|
|
1208
|
+
* ```typescript
|
|
1209
|
+
* const { data: filteredCount } = useCountItemsOrdersForCollection({
|
|
1210
|
+
* chainId: 137,
|
|
1211
|
+
* collectionAddress: '0x...',
|
|
1212
|
+
* filter: {
|
|
1213
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2]
|
|
1214
|
+
* }
|
|
1215
|
+
* })
|
|
1216
|
+
* ```
|
|
1217
|
+
*
|
|
1218
|
+
* @example
|
|
1219
|
+
* Combined with list hook:
|
|
1220
|
+
* ```typescript
|
|
1221
|
+
* const { data: totalCount } = useCountItemsOrdersForCollection({
|
|
1222
|
+
* chainId: 137,
|
|
1223
|
+
* collectionAddress: '0x...'
|
|
1224
|
+
* })
|
|
1225
|
+
*
|
|
1226
|
+
* const { data: orders } = useListItemsOrdersForCollection({
|
|
1227
|
+
* chainId: 137,
|
|
1228
|
+
* collectionAddress: '0x...'
|
|
1229
|
+
* })
|
|
1230
|
+
*
|
|
1231
|
+
* return <div>Showing {orders?.pages[0]?.listings.length ?? 0} of {totalCount} orders</div>
|
|
1232
|
+
* ```
|
|
1233
|
+
*/
|
|
1234
|
+
function useCountItemsOrdersForCollection(params) {
|
|
1235
|
+
const defaultConfig = useConfig();
|
|
1236
|
+
const { config = defaultConfig,...rest } = params;
|
|
1237
|
+
const queryOptions$1 = countItemsOrdersForCollectionQueryOptions({
|
|
1238
|
+
config,
|
|
1239
|
+
...rest
|
|
1240
|
+
});
|
|
1241
|
+
return useQuery({ ...queryOptions$1 });
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1069
1244
|
//#endregion
|
|
1070
1245
|
//#region src/react/hooks/data/orders/useCountListingsForCollectible.tsx
|
|
1071
1246
|
/**
|
|
@@ -1213,6 +1388,18 @@ function useFloorOrder(params) {
|
|
|
1213
1388
|
return useQuery({ ...queryOptions$1 });
|
|
1214
1389
|
}
|
|
1215
1390
|
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx
|
|
1393
|
+
function useGetCountOfFilteredOrders(params) {
|
|
1394
|
+
const defaultConfig = useConfig();
|
|
1395
|
+
const { config = defaultConfig,...rest } = params;
|
|
1396
|
+
const queryOptions$1 = getCountOfFilteredOrdersQueryOptions({
|
|
1397
|
+
config,
|
|
1398
|
+
...rest
|
|
1399
|
+
});
|
|
1400
|
+
return useQuery({ ...queryOptions$1 });
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1216
1403
|
//#endregion
|
|
1217
1404
|
//#region src/react/hooks/data/orders/useHighestOffer.tsx
|
|
1218
1405
|
/**
|
|
@@ -1263,6 +1450,138 @@ function useHighestOffer(params) {
|
|
|
1263
1450
|
return useQuery({ ...queryOptions$1 });
|
|
1264
1451
|
}
|
|
1265
1452
|
|
|
1453
|
+
//#endregion
|
|
1454
|
+
//#region src/react/hooks/data/orders/useListItemsOrdersForCollection.tsx
|
|
1455
|
+
/**
|
|
1456
|
+
* Hook to fetch all listings for a collection with infinite pagination support
|
|
1457
|
+
*
|
|
1458
|
+
* Fetches active listings (sales) for all tokens in a collection from the marketplace
|
|
1459
|
+
* with support for filtering and infinite scroll pagination.
|
|
1460
|
+
*
|
|
1461
|
+
* @param params - Configuration parameters
|
|
1462
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1463
|
+
* @param params.collectionAddress - The collection contract address
|
|
1464
|
+
* @param params.filter - Optional filtering parameters (marketplace, currencies, etc.)
|
|
1465
|
+
* @param params.query - Optional React Query configuration
|
|
1466
|
+
*
|
|
1467
|
+
* @returns Infinite query result containing listings data with pagination
|
|
1468
|
+
*
|
|
1469
|
+
* @example
|
|
1470
|
+
* Basic usage:
|
|
1471
|
+
* ```typescript
|
|
1472
|
+
* const { data, isLoading, fetchNextPage, hasNextPage } = useListItemsOrdersForCollection({
|
|
1473
|
+
* chainId: 137,
|
|
1474
|
+
* collectionAddress: '0x...'
|
|
1475
|
+
* })
|
|
1476
|
+
* ```
|
|
1477
|
+
*
|
|
1478
|
+
* @example
|
|
1479
|
+
* With filtering:
|
|
1480
|
+
* ```typescript
|
|
1481
|
+
* const { data, fetchNextPage } = useListItemsOrdersForCollection({
|
|
1482
|
+
* chainId: 1,
|
|
1483
|
+
* collectionAddress: '0x...',
|
|
1484
|
+
* filter: {
|
|
1485
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2],
|
|
1486
|
+
* currencies: ['0x...']
|
|
1487
|
+
* }
|
|
1488
|
+
* })
|
|
1489
|
+
* ```
|
|
1490
|
+
*
|
|
1491
|
+
* @example
|
|
1492
|
+
* Accessing paginated data:
|
|
1493
|
+
* ```typescript
|
|
1494
|
+
* const { data } = useListItemsOrdersForCollection({
|
|
1495
|
+
* chainId: 137,
|
|
1496
|
+
* collectionAddress: '0x...'
|
|
1497
|
+
* })
|
|
1498
|
+
*
|
|
1499
|
+
* const allListings = data?.pages.flatMap(page => page.listings) ?? []
|
|
1500
|
+
* ```
|
|
1501
|
+
*/
|
|
1502
|
+
function useListItemsOrdersForCollection(params) {
|
|
1503
|
+
const defaultConfig = useConfig();
|
|
1504
|
+
const { config = defaultConfig,...rest } = params;
|
|
1505
|
+
const queryOptions$1 = listItemsOrdersForCollectionQueryOptions({
|
|
1506
|
+
config,
|
|
1507
|
+
...rest
|
|
1508
|
+
});
|
|
1509
|
+
return useInfiniteQuery({ ...queryOptions$1 });
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
//#endregion
|
|
1513
|
+
//#region src/react/hooks/data/orders/useListItemsOrdersForCollectionPaginated.tsx
|
|
1514
|
+
/**
|
|
1515
|
+
* Hook to fetch all listings for a collection with pagination support
|
|
1516
|
+
*
|
|
1517
|
+
* Fetches active listings (sales) for all tokens in a collection from the marketplace
|
|
1518
|
+
* with support for filtering and pagination. Unlike the infinite query version,
|
|
1519
|
+
* this hook fetches a specific page of results.
|
|
1520
|
+
*
|
|
1521
|
+
* @param params - Configuration parameters
|
|
1522
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1523
|
+
* @param params.collectionAddress - The collection contract address
|
|
1524
|
+
* @param params.side - Order side (listing or bid)
|
|
1525
|
+
* @param params.filter - Optional filtering parameters (marketplace, currencies, etc.)
|
|
1526
|
+
* @param params.page - Page number to fetch (default: 1)
|
|
1527
|
+
* @param params.pageSize - Number of items per page (default: 30)
|
|
1528
|
+
* @param params.query - Optional React Query configuration
|
|
1529
|
+
*
|
|
1530
|
+
* @returns Query result containing listings data for the specific page
|
|
1531
|
+
*
|
|
1532
|
+
* @example
|
|
1533
|
+
* Basic usage:
|
|
1534
|
+
* ```typescript
|
|
1535
|
+
* const { data, isLoading } = useListItemsOrdersForCollectionPaginated({
|
|
1536
|
+
* chainId: 137,
|
|
1537
|
+
* collectionAddress: '0x...',
|
|
1538
|
+
* side: OrderSide.listing,
|
|
1539
|
+
* page: 1,
|
|
1540
|
+
* pageSize: 20
|
|
1541
|
+
* })
|
|
1542
|
+
* ```
|
|
1543
|
+
*
|
|
1544
|
+
* @example
|
|
1545
|
+
* With filtering:
|
|
1546
|
+
* ```typescript
|
|
1547
|
+
* const { data } = useListItemsOrdersForCollectionPaginated({
|
|
1548
|
+
* chainId: 1,
|
|
1549
|
+
* collectionAddress: '0x...',
|
|
1550
|
+
* side: OrderSide.listing,
|
|
1551
|
+
* page: 2,
|
|
1552
|
+
* pageSize: 50,
|
|
1553
|
+
* filter: {
|
|
1554
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2],
|
|
1555
|
+
* currencies: ['0x...']
|
|
1556
|
+
* }
|
|
1557
|
+
* })
|
|
1558
|
+
* ```
|
|
1559
|
+
*
|
|
1560
|
+
* @example
|
|
1561
|
+
* Controlled pagination:
|
|
1562
|
+
* ```typescript
|
|
1563
|
+
* const [currentPage, setCurrentPage] = useState(1);
|
|
1564
|
+
* const { data, isLoading } = useListItemsOrdersForCollectionPaginated({
|
|
1565
|
+
* chainId: 137,
|
|
1566
|
+
* collectionAddress: '0x...',
|
|
1567
|
+
* side: OrderSide.listing,
|
|
1568
|
+
* page: currentPage,
|
|
1569
|
+
* pageSize: 25
|
|
1570
|
+
* });
|
|
1571
|
+
*
|
|
1572
|
+
* const hasMorePages = data?.page?.more;
|
|
1573
|
+
* ```
|
|
1574
|
+
*/
|
|
1575
|
+
function useListItemsOrdersForCollectionPaginated(params) {
|
|
1576
|
+
const defaultConfig = useConfig();
|
|
1577
|
+
const { config = defaultConfig,...rest } = params;
|
|
1578
|
+
const queryOptions$1 = listItemsOrdersForCollectionPaginatedQueryOptions({
|
|
1579
|
+
config,
|
|
1580
|
+
...rest
|
|
1581
|
+
});
|
|
1582
|
+
return useQuery({ ...queryOptions$1 });
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1266
1585
|
//#endregion
|
|
1267
1586
|
//#region src/react/hooks/data/orders/useListListingsForCollectible.tsx
|
|
1268
1587
|
/**
|
|
@@ -1457,11 +1776,15 @@ function useErc721SaleDetails({ chainId, salesContractAddress, itemsContractAddr
|
|
|
1457
1776
|
itemsContractAddress,
|
|
1458
1777
|
enabled: enabled && !versionLoading && version === SalesContractVersion.V1
|
|
1459
1778
|
});
|
|
1779
|
+
const saleDetails = saleDetailsV0 || saleDetailsV1;
|
|
1780
|
+
const quantityMinted = quantityMintedV0 || quantityMintedV1;
|
|
1781
|
+
const quantityTotal = quantityTotalV0 || quantityTotalV1;
|
|
1782
|
+
const quantityRemaining = quantityRemainingV0 || quantityRemainingV1;
|
|
1460
1783
|
return {
|
|
1461
|
-
saleDetails
|
|
1462
|
-
quantityMinted
|
|
1463
|
-
quantityTotal
|
|
1464
|
-
quantityRemaining
|
|
1784
|
+
saleDetails,
|
|
1785
|
+
quantityMinted,
|
|
1786
|
+
quantityTotal,
|
|
1787
|
+
quantityRemaining,
|
|
1465
1788
|
isLoading: versionLoading || saleDetailsLoadingV0 || saleDetailsLoadingV1,
|
|
1466
1789
|
error: versionError || saleDetailsErrorV0 || saleDetailsErrorV1
|
|
1467
1790
|
};
|
|
@@ -1634,12 +1957,7 @@ function useGetTokenRanges(params) {
|
|
|
1634
1957
|
*/
|
|
1635
1958
|
function useListBalances(args) {
|
|
1636
1959
|
const config = useConfig();
|
|
1637
|
-
|
|
1638
|
-
const isLaos721 = marketplaceConfig?.market?.collections?.find((c) => c.itemsAddress === args.contractAddress && c.chainId === args.chainId)?.contractType === ContractType.LAOS_ERC_721;
|
|
1639
|
-
return useInfiniteQuery(listBalancesOptions({
|
|
1640
|
-
...args,
|
|
1641
|
-
isLaos721
|
|
1642
|
-
}, config));
|
|
1960
|
+
return useInfiniteQuery(listBalancesOptions({ ...args }, config));
|
|
1643
1961
|
}
|
|
1644
1962
|
|
|
1645
1963
|
//#endregion
|
|
@@ -1696,15 +2014,13 @@ function useListTokenMetadata(params) {
|
|
|
1696
2014
|
//#endregion
|
|
1697
2015
|
//#region src/react/hooks/data/tokens/useTokenSupplies.ts
|
|
1698
2016
|
/**
|
|
1699
|
-
* Hook to fetch token supplies from the indexer
|
|
2017
|
+
* Hook to fetch token supplies from the indexer
|
|
1700
2018
|
*
|
|
1701
2019
|
* Retrieves supply information for tokens from a specific collection.
|
|
1702
|
-
* Automatically chooses between indexer and LAOS APIs based on the isLaos721 flag.
|
|
1703
2020
|
*
|
|
1704
2021
|
* @param params - Configuration parameters
|
|
1705
2022
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1706
2023
|
* @param params.collectionAddress - The collection contract address
|
|
1707
|
-
* @param params.isLaos721 - Whether to use LAOS API instead of indexer
|
|
1708
2024
|
* @param params.includeMetadata - Whether to include token metadata
|
|
1709
2025
|
* @param params.page - Pagination options
|
|
1710
2026
|
* @param params.query - Optional React Query configuration
|
|
@@ -1721,16 +2037,6 @@ function useListTokenMetadata(params) {
|
|
|
1721
2037
|
* ```
|
|
1722
2038
|
*
|
|
1723
2039
|
* @example
|
|
1724
|
-
* With LAOS API:
|
|
1725
|
-
* ```typescript
|
|
1726
|
-
* const { data, isLoading } = useTokenSupplies({
|
|
1727
|
-
* chainId: 1,
|
|
1728
|
-
* collectionAddress: '0x...',
|
|
1729
|
-
* isLaos721: true
|
|
1730
|
-
* })
|
|
1731
|
-
* ```
|
|
1732
|
-
*
|
|
1733
|
-
* @example
|
|
1734
2040
|
* With conditional fetching:
|
|
1735
2041
|
* ```typescript
|
|
1736
2042
|
* const { data, isLoading } = useTokenSupplies({
|
|
@@ -1886,13 +2192,14 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1886
2192
|
});
|
|
1887
2193
|
const config = useConfig();
|
|
1888
2194
|
const tokenSuppliesEnabled = Boolean(chainId && contractAddress && config && (enabled ?? true));
|
|
1889
|
-
const
|
|
2195
|
+
const tokenSuppliesQuery = useInfiniteQuery({ ...tokenSuppliesQueryOptions({
|
|
1890
2196
|
chainId,
|
|
1891
2197
|
collectionAddress: contractAddress,
|
|
1892
2198
|
includeMetadata: true,
|
|
1893
2199
|
config,
|
|
1894
2200
|
query: { enabled: tokenSuppliesEnabled }
|
|
1895
2201
|
}) });
|
|
2202
|
+
const { data: tokenSuppliesData, fetchNextPage: fetchNextTokenSuppliesPage, hasNextPage: hasNextSuppliesPage, isFetchingNextPage: isFetchingNextSuppliesPage, isLoading: tokenSuppliesLoading } = tokenSuppliesQuery;
|
|
1896
2203
|
useEffect(() => {
|
|
1897
2204
|
async function fetchAllPages() {
|
|
1898
2205
|
if (!tokenSuppliesEnabled) return;
|
|
@@ -1920,7 +2227,8 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1920
2227
|
functionName: "saleDetails",
|
|
1921
2228
|
query: { enabled: enabled && !versionLoading && !!abi }
|
|
1922
2229
|
});
|
|
1923
|
-
const
|
|
2230
|
+
const unmintedPrimarySaleItems = primarySaleItemsWithMetadata.filter((item) => !matchingTokenSupplies?.some((supply) => supply.tokenID === item.metadata.tokenId));
|
|
2231
|
+
const primarySaleItemsCollectibleCards = unmintedPrimarySaleItems.map((item) => {
|
|
1924
2232
|
const { metadata, primarySaleItem } = item;
|
|
1925
2233
|
const salePrice = {
|
|
1926
2234
|
amount: primarySaleItem.priceAmount?.toString(),
|
|
@@ -2001,33 +2309,34 @@ function useList1155ShopCardData({ primarySaleItemsWithMetadata, chainId, contra
|
|
|
2001
2309
|
query: { enabled: enabled && !versionLoading && !!abi }
|
|
2002
2310
|
});
|
|
2003
2311
|
const isLoading = versionLoading || collectionLoading || paymentTokenLoading;
|
|
2312
|
+
const collectibleCards = primarySaleItemsWithMetadata.map((item) => {
|
|
2313
|
+
const { metadata, primarySaleItem: saleData } = item;
|
|
2314
|
+
const salePrice = {
|
|
2315
|
+
amount: saleData?.priceAmount?.toString() || "",
|
|
2316
|
+
currencyAddress: saleData?.currencyAddress || paymentToken || "0x"
|
|
2317
|
+
};
|
|
2318
|
+
const supply = saleData?.supply?.toString();
|
|
2319
|
+
const unlimitedSupply = saleData?.unlimitedSupply;
|
|
2320
|
+
return {
|
|
2321
|
+
collectibleId: metadata.tokenId,
|
|
2322
|
+
chainId,
|
|
2323
|
+
collectionAddress: contractAddress,
|
|
2324
|
+
collectionType: ContractType.ERC1155,
|
|
2325
|
+
tokenMetadata: metadata,
|
|
2326
|
+
cardLoading: isLoading,
|
|
2327
|
+
salesContractAddress,
|
|
2328
|
+
salePrice,
|
|
2329
|
+
quantityInitial: supply,
|
|
2330
|
+
quantityDecimals: collection?.decimals || 0,
|
|
2331
|
+
quantityRemaining: supply,
|
|
2332
|
+
unlimitedSupply,
|
|
2333
|
+
saleStartsAt: saleData?.startDate?.toString(),
|
|
2334
|
+
saleEndsAt: saleData?.endDate?.toString(),
|
|
2335
|
+
cardType: "shop"
|
|
2336
|
+
};
|
|
2337
|
+
});
|
|
2004
2338
|
return {
|
|
2005
|
-
collectibleCards
|
|
2006
|
-
const { metadata, primarySaleItem: saleData } = item;
|
|
2007
|
-
const salePrice = {
|
|
2008
|
-
amount: saleData?.priceAmount?.toString() || "",
|
|
2009
|
-
currencyAddress: saleData?.currencyAddress || paymentToken || "0x"
|
|
2010
|
-
};
|
|
2011
|
-
const supply = saleData?.supply?.toString();
|
|
2012
|
-
const unlimitedSupply = saleData?.unlimitedSupply;
|
|
2013
|
-
return {
|
|
2014
|
-
collectibleId: metadata.tokenId,
|
|
2015
|
-
chainId,
|
|
2016
|
-
collectionAddress: contractAddress,
|
|
2017
|
-
collectionType: ContractType.ERC1155,
|
|
2018
|
-
tokenMetadata: metadata,
|
|
2019
|
-
cardLoading: isLoading,
|
|
2020
|
-
salesContractAddress,
|
|
2021
|
-
salePrice,
|
|
2022
|
-
quantityInitial: supply,
|
|
2023
|
-
quantityDecimals: collection?.decimals || 0,
|
|
2024
|
-
quantityRemaining: supply,
|
|
2025
|
-
unlimitedSupply,
|
|
2026
|
-
saleStartsAt: saleData?.startDate?.toString(),
|
|
2027
|
-
saleEndsAt: saleData?.endDate?.toString(),
|
|
2028
|
-
cardType: "shop"
|
|
2029
|
-
};
|
|
2030
|
-
}),
|
|
2339
|
+
collectibleCards,
|
|
2031
2340
|
tokenMetadataError: null,
|
|
2032
2341
|
tokenSaleDetailsError: null,
|
|
2033
2342
|
isLoading: enabled && isLoading
|
|
@@ -2084,16 +2393,60 @@ function useListPrimarySaleItems(params) {
|
|
|
2084
2393
|
return useInfiniteQuery(queryOptions$1);
|
|
2085
2394
|
}
|
|
2086
2395
|
|
|
2396
|
+
//#endregion
|
|
2397
|
+
//#region src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx
|
|
2398
|
+
/**
|
|
2399
|
+
* Hook to fetch a single primary sale item
|
|
2400
|
+
*
|
|
2401
|
+
* Retrieves details for a specific primary sale item from a primary sale contract.
|
|
2402
|
+
*
|
|
2403
|
+
* @param params - Configuration parameters
|
|
2404
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
2405
|
+
* @param params.primarySaleContractAddress - The primary sale contract address
|
|
2406
|
+
* @param params.tokenId - The token ID of the primary sale item
|
|
2407
|
+
* @param params.query - Optional React Query configuration
|
|
2408
|
+
*
|
|
2409
|
+
* @returns Query result containing the primary sale item data
|
|
2410
|
+
*
|
|
2411
|
+
* @example
|
|
2412
|
+
* Basic usage:
|
|
2413
|
+
* ```typescript
|
|
2414
|
+
* const { data: item, isLoading } = usePrimarySaleItem({
|
|
2415
|
+
* chainId: 137,
|
|
2416
|
+
* primarySaleContractAddress: '0x...',
|
|
2417
|
+
* tokenId: '1',
|
|
2418
|
+
* })
|
|
2419
|
+
* ```
|
|
2420
|
+
*
|
|
2421
|
+
* @example
|
|
2422
|
+
* With custom query options:
|
|
2423
|
+
* ```typescript
|
|
2424
|
+
* const { data } = usePrimarySaleItem({
|
|
2425
|
+
* chainId: 1,
|
|
2426
|
+
* primarySaleContractAddress: '0x...',
|
|
2427
|
+
* tokenId: '42',
|
|
2428
|
+
* query: {
|
|
2429
|
+
* enabled: Boolean(primarySaleContractAddress && tokenId),
|
|
2430
|
+
* staleTime: 30_000
|
|
2431
|
+
* }
|
|
2432
|
+
* })
|
|
2433
|
+
* ```
|
|
2434
|
+
*/
|
|
2435
|
+
function usePrimarySaleItem(params) {
|
|
2436
|
+
const defaultConfig = useConfig();
|
|
2437
|
+
const { config = defaultConfig,...rest } = params;
|
|
2438
|
+
const queryOptions$1 = primarySaleItemQueryOptions({
|
|
2439
|
+
config,
|
|
2440
|
+
...rest
|
|
2441
|
+
});
|
|
2442
|
+
return useQuery({ ...queryOptions$1 });
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2087
2445
|
//#endregion
|
|
2088
2446
|
//#region src/react/hooks/data/inventory/useInventory.tsx
|
|
2089
2447
|
function useInventory(args) {
|
|
2090
2448
|
const config = useConfig();
|
|
2091
|
-
|
|
2092
|
-
const isLaos721 = marketplaceConfig?.market?.collections?.find((c) => c.itemsAddress === args.collectionAddress && c.chainId === args.chainId)?.contractType === ContractType.LAOS_ERC_721;
|
|
2093
|
-
return useQuery(inventoryOptions({
|
|
2094
|
-
...args,
|
|
2095
|
-
isLaos721
|
|
2096
|
-
}, config));
|
|
2449
|
+
return useQuery(inventoryOptions({ ...args }, config));
|
|
2097
2450
|
}
|
|
2098
2451
|
|
|
2099
2452
|
//#endregion
|
|
@@ -2196,7 +2549,7 @@ function useAutoSelectFeeOption({ pendingFeeOptionConfirmation, enabled }) {
|
|
|
2196
2549
|
useEffect(() => {
|
|
2197
2550
|
if (combinedBalances) console.debug("currency balances", combinedBalances);
|
|
2198
2551
|
}, [combinedBalances]);
|
|
2199
|
-
|
|
2552
|
+
const autoSelectedOption = useCallback(async () => {
|
|
2200
2553
|
if (!userAddress) return {
|
|
2201
2554
|
selectedOption: null,
|
|
2202
2555
|
error: AutoSelectFeeOptionError.UserNotConnected
|
|
@@ -2234,7 +2587,8 @@ function useAutoSelectFeeOption({ pendingFeeOptionConfirmation, enabled }) {
|
|
|
2234
2587
|
isBalanceDetailsLoading,
|
|
2235
2588
|
isBalanceDetailsError,
|
|
2236
2589
|
combinedBalances
|
|
2237
|
-
])
|
|
2590
|
+
]);
|
|
2591
|
+
return autoSelectedOption();
|
|
2238
2592
|
}
|
|
2239
2593
|
|
|
2240
2594
|
//#endregion
|
|
@@ -2443,22 +2797,23 @@ const useEnsureCorrectChain = () => {
|
|
|
2443
2797
|
switchChainAsync,
|
|
2444
2798
|
showSwitchChainErrorModal
|
|
2445
2799
|
]);
|
|
2800
|
+
const ensureCorrectChain = useCallback((targetChainId, callbacks) => {
|
|
2801
|
+
if (currentChainId === targetChainId) {
|
|
2802
|
+
callbacks?.onSuccess?.();
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
switchChain({ chainId: targetChainId }, {
|
|
2806
|
+
onSuccess: callbacks?.onSuccess,
|
|
2807
|
+
onError: () => showSwitchChainErrorModal({ chainIdToSwitchTo: targetChainId })
|
|
2808
|
+
});
|
|
2809
|
+
}, [
|
|
2810
|
+
currentChainId,
|
|
2811
|
+
isWaaS,
|
|
2812
|
+
switchChain,
|
|
2813
|
+
showSwitchChainErrorModal
|
|
2814
|
+
]);
|
|
2446
2815
|
return {
|
|
2447
|
-
ensureCorrectChain
|
|
2448
|
-
if (currentChainId === targetChainId) {
|
|
2449
|
-
callbacks?.onSuccess?.();
|
|
2450
|
-
return;
|
|
2451
|
-
}
|
|
2452
|
-
switchChain({ chainId: targetChainId }, {
|
|
2453
|
-
onSuccess: callbacks?.onSuccess,
|
|
2454
|
-
onError: () => showSwitchChainErrorModal({ chainIdToSwitchTo: targetChainId })
|
|
2455
|
-
});
|
|
2456
|
-
}, [
|
|
2457
|
-
currentChainId,
|
|
2458
|
-
isWaaS,
|
|
2459
|
-
switchChain,
|
|
2460
|
-
showSwitchChainErrorModal
|
|
2461
|
-
]),
|
|
2816
|
+
ensureCorrectChain,
|
|
2462
2817
|
ensureCorrectChainAsync,
|
|
2463
2818
|
currentChainId
|
|
2464
2819
|
};
|
|
@@ -2467,7 +2822,8 @@ const useEnsureCorrectChain = () => {
|
|
|
2467
2822
|
//#endregion
|
|
2468
2823
|
//#region src/react/hooks/transactions/useGenerateCancelTransaction.tsx
|
|
2469
2824
|
const generateCancelTransaction = async (args, config) => {
|
|
2470
|
-
|
|
2825
|
+
const marketplaceClient = getMarketplaceClient(config);
|
|
2826
|
+
return marketplaceClient.generateCancelTransaction({
|
|
2471
2827
|
...args,
|
|
2472
2828
|
chainId: String(args.chainId)
|
|
2473
2829
|
}).then((data) => data.steps);
|
|
@@ -2500,6 +2856,7 @@ function isTransactionStep(step) {
|
|
|
2500
2856
|
StepType.createListing
|
|
2501
2857
|
].includes(step.id);
|
|
2502
2858
|
}
|
|
2859
|
+
const clamp = (val, min, max) => Math.max(min, Math.min(max, val));
|
|
2503
2860
|
|
|
2504
2861
|
//#endregion
|
|
2505
2862
|
//#region src/react/hooks/transactions/useProcessStep.ts
|
|
@@ -2510,9 +2867,8 @@ const useProcessStep = () => {
|
|
|
2510
2867
|
const config = useConfig();
|
|
2511
2868
|
const marketplaceClient = getMarketplaceClient(config);
|
|
2512
2869
|
const processStep = async (step, chainId) => {
|
|
2513
|
-
if (isTransactionStep(step))
|
|
2514
|
-
|
|
2515
|
-
hash: await sendTransactionAsync({
|
|
2870
|
+
if (isTransactionStep(step)) {
|
|
2871
|
+
const hash = await sendTransactionAsync({
|
|
2516
2872
|
chainId,
|
|
2517
2873
|
to: step.to,
|
|
2518
2874
|
data: step.data,
|
|
@@ -2520,8 +2876,12 @@ const useProcessStep = () => {
|
|
|
2520
2876
|
...step.maxFeePerGas && { maxFeePerGas: hexToBigInt(step.maxFeePerGas) },
|
|
2521
2877
|
...step.maxPriorityFeePerGas && { maxPriorityFeePerGas: hexToBigInt(step.maxPriorityFeePerGas) },
|
|
2522
2878
|
...step.gas && { gas: hexToBigInt(step.gas) }
|
|
2523
|
-
})
|
|
2524
|
-
|
|
2879
|
+
});
|
|
2880
|
+
return {
|
|
2881
|
+
type: "transaction",
|
|
2882
|
+
hash
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2525
2885
|
if (isSignatureStep(step)) {
|
|
2526
2886
|
let signature;
|
|
2527
2887
|
if (step.id === StepType.signEIP191) {
|
|
@@ -2537,17 +2897,20 @@ const useProcessStep = () => {
|
|
|
2537
2897
|
});
|
|
2538
2898
|
}
|
|
2539
2899
|
if (!signature) throw new Error("Failed to sign message");
|
|
2540
|
-
if (step.post)
|
|
2541
|
-
|
|
2542
|
-
orderId: (await marketplaceClient.execute({
|
|
2900
|
+
if (step.post) {
|
|
2901
|
+
const result = await marketplaceClient.execute({ params: {
|
|
2543
2902
|
chainId: String(chainId),
|
|
2544
2903
|
signature,
|
|
2545
2904
|
method: step.post.method,
|
|
2546
2905
|
endpoint: step.post.endpoint,
|
|
2547
2906
|
body: step.post.body,
|
|
2548
2907
|
executeType: ExecuteType.order
|
|
2549
|
-
})
|
|
2550
|
-
|
|
2908
|
+
} });
|
|
2909
|
+
return {
|
|
2910
|
+
type: "signature",
|
|
2911
|
+
orderId: result.orderId
|
|
2912
|
+
};
|
|
2913
|
+
}
|
|
2551
2914
|
return {
|
|
2552
2915
|
type: "signature",
|
|
2553
2916
|
signature
|
|
@@ -2570,13 +2933,14 @@ const useCancelTransactionSteps = ({ collectionAddress, chainId, callbacks, setS
|
|
|
2570
2933
|
try {
|
|
2571
2934
|
if (!address) throw new NoWalletConnectedError();
|
|
2572
2935
|
if (!address) throw new Error("Wallet address not found");
|
|
2573
|
-
|
|
2936
|
+
const steps$2 = await generateCancelTransactionAsync({
|
|
2574
2937
|
chainId,
|
|
2575
2938
|
collectionAddress,
|
|
2576
2939
|
maker: address,
|
|
2577
2940
|
marketplace,
|
|
2578
2941
|
orderId
|
|
2579
2942
|
});
|
|
2943
|
+
return steps$2;
|
|
2580
2944
|
} catch (error) {
|
|
2581
2945
|
if (callbacks?.onError) callbacks.onError(error);
|
|
2582
2946
|
else console.debug("onError callback not provided:", error);
|
|
@@ -2731,7 +3095,8 @@ const generateListingTransaction = async (params, config) => {
|
|
|
2731
3095
|
expiry: dateToUnixTime(params.listing.expiry)
|
|
2732
3096
|
}
|
|
2733
3097
|
};
|
|
2734
|
-
|
|
3098
|
+
const marketplaceClient = getMarketplaceClient(config);
|
|
3099
|
+
return (await marketplaceClient.generateListingTransaction(args)).steps;
|
|
2735
3100
|
};
|
|
2736
3101
|
const useGenerateListingTransaction = (params) => {
|
|
2737
3102
|
const config = useConfig();
|
|
@@ -2761,7 +3126,8 @@ const generateOfferTransaction = async (params, config, walletKind) => {
|
|
|
2761
3126
|
},
|
|
2762
3127
|
walletType: walletKind
|
|
2763
3128
|
};
|
|
2764
|
-
|
|
3129
|
+
const marketplaceClient = getMarketplaceClient(config);
|
|
3130
|
+
return (await marketplaceClient.generateOfferTransaction(args)).steps;
|
|
2765
3131
|
};
|
|
2766
3132
|
const useGenerateOfferTransaction = (params) => {
|
|
2767
3133
|
const config = useConfig();
|
|
@@ -2859,7 +3225,7 @@ const useTransactionOperations = () => {
|
|
|
2859
3225
|
} catch (e) {
|
|
2860
3226
|
const error = e;
|
|
2861
3227
|
logger.error("Chain switch failed", error);
|
|
2862
|
-
if (error.name === "UserRejectedRequestError") throw new UserRejectedRequestError
|
|
3228
|
+
if (error.name === "UserRejectedRequestError") throw new UserRejectedRequestError();
|
|
2863
3229
|
throw new ChainSwitchError(0, chainId);
|
|
2864
3230
|
}
|
|
2865
3231
|
};
|
|
@@ -2885,8 +3251,9 @@ const useTransactionOperations = () => {
|
|
|
2885
3251
|
} catch (e) {
|
|
2886
3252
|
const error = e;
|
|
2887
3253
|
logger.error("Signature failed", error);
|
|
2888
|
-
if (error.cause instanceof BaseError) {
|
|
2889
|
-
|
|
3254
|
+
if (error.cause instanceof BaseError$1) {
|
|
3255
|
+
const viemError = error.cause;
|
|
3256
|
+
if (viemError instanceof UserRejectedRequestError$1) throw new UserRejectedRequestError();
|
|
2890
3257
|
}
|
|
2891
3258
|
throw new TransactionSignatureError(stepItem.id, error);
|
|
2892
3259
|
}
|
|
@@ -2910,8 +3277,9 @@ const useTransactionOperations = () => {
|
|
|
2910
3277
|
} catch (e) {
|
|
2911
3278
|
const error = e;
|
|
2912
3279
|
logger.error("Transaction failed", error);
|
|
2913
|
-
if (error.cause instanceof BaseError) {
|
|
2914
|
-
|
|
3280
|
+
if (error.cause instanceof BaseError$1) {
|
|
3281
|
+
const viemError = error.cause;
|
|
3282
|
+
if (viemError instanceof UserRejectedRequestError$1) throw new UserRejectedRequestError();
|
|
2915
3283
|
}
|
|
2916
3284
|
throw new TransactionExecutionError(stepItem.id || "unknown", error);
|
|
2917
3285
|
}
|
|
@@ -3003,22 +3371,34 @@ const validateFilters = (value) => {
|
|
|
3003
3371
|
if (!Array.isArray(value)) return [];
|
|
3004
3372
|
return value.filter((f) => typeof f === "object" && typeof f.name === "string" && Object.values(PropertyType).includes(f.type));
|
|
3005
3373
|
};
|
|
3374
|
+
const validatePriceFilters = (value) => {
|
|
3375
|
+
if (!Array.isArray(value)) return [];
|
|
3376
|
+
return value.filter((f) => typeof f === "object" && typeof f.contractAddress === "string" && (f.min === void 0 || typeof f.min === "string") && (f.max === void 0 || typeof f.max === "string"));
|
|
3377
|
+
};
|
|
3006
3378
|
const filtersParser = parseAsJson(validateFilters).withDefault([]);
|
|
3007
3379
|
const searchParser = parseAsString.withDefault("");
|
|
3008
3380
|
const listedOnlyParser = parseAsBoolean.withDefault(false);
|
|
3381
|
+
const priceFilterParser = parseAsBoolean.withDefault(false);
|
|
3382
|
+
const priceFiltersParser = parseAsJson(validatePriceFilters).withDefault([]);
|
|
3009
3383
|
const serialize = createSerializer({
|
|
3010
3384
|
filters: filtersParser,
|
|
3011
3385
|
search: searchParser,
|
|
3012
|
-
listedOnly: listedOnlyParser
|
|
3386
|
+
listedOnly: listedOnlyParser,
|
|
3387
|
+
priceFilter: priceFilterParser,
|
|
3388
|
+
priceFilters: priceFiltersParser
|
|
3013
3389
|
}, { urlKeys: {
|
|
3014
3390
|
filters: "f",
|
|
3015
3391
|
search: "q",
|
|
3016
|
-
listedOnly: "l"
|
|
3392
|
+
listedOnly: "l",
|
|
3393
|
+
priceFilter: "p",
|
|
3394
|
+
priceFilters: "pf"
|
|
3017
3395
|
} });
|
|
3018
3396
|
function useFilterState() {
|
|
3019
3397
|
const [filterOptions, setFilterOptions] = useQueryState("filters", filtersParser);
|
|
3020
3398
|
const [searchText, setSearchText] = useQueryState("search", searchParser);
|
|
3021
3399
|
const [showListedOnly, setShowListedOnly] = useQueryState("listedOnly", listedOnlyParser);
|
|
3400
|
+
const [showPriceFilter, setShowPriceFilter] = useQueryState("priceFilter", priceFilterParser);
|
|
3401
|
+
const [priceFilters, setPriceFilters] = useQueryState("priceFilters", priceFiltersParser);
|
|
3022
3402
|
const helpers = useMemo(() => ({
|
|
3023
3403
|
getFilter: (name) => {
|
|
3024
3404
|
return filterOptions?.find((f) => f.name === name);
|
|
@@ -3092,24 +3472,52 @@ function useFilterState() {
|
|
|
3092
3472
|
max
|
|
3093
3473
|
}]);
|
|
3094
3474
|
},
|
|
3475
|
+
setPriceFilter: (contractAddress, min, max) => {
|
|
3476
|
+
const otherPriceFilters = priceFilters?.filter((f) => f.contractAddress !== contractAddress) ?? [];
|
|
3477
|
+
if (!min && !max) {
|
|
3478
|
+
setPriceFilters(otherPriceFilters);
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
const newPriceFilter = {
|
|
3482
|
+
contractAddress,
|
|
3483
|
+
...min && { min },
|
|
3484
|
+
...max && { max }
|
|
3485
|
+
};
|
|
3486
|
+
setPriceFilters([...otherPriceFilters, newPriceFilter]);
|
|
3487
|
+
},
|
|
3488
|
+
getPriceFilter: (contractAddress) => {
|
|
3489
|
+
return priceFilters?.find((f) => f.contractAddress === contractAddress);
|
|
3490
|
+
},
|
|
3491
|
+
clearPriceFilters: () => {
|
|
3492
|
+
setPriceFilters([]);
|
|
3493
|
+
},
|
|
3095
3494
|
clearAllFilters: () => {
|
|
3096
3495
|
setShowListedOnly(false);
|
|
3496
|
+
setShowPriceFilter(false);
|
|
3097
3497
|
setFilterOptions([]);
|
|
3098
3498
|
setSearchText("");
|
|
3499
|
+
setPriceFilters([]);
|
|
3099
3500
|
}
|
|
3100
3501
|
}), [
|
|
3101
3502
|
filterOptions,
|
|
3102
3503
|
setFilterOptions,
|
|
3103
3504
|
setShowListedOnly,
|
|
3104
|
-
setSearchText
|
|
3505
|
+
setSearchText,
|
|
3506
|
+
setShowPriceFilter,
|
|
3507
|
+
priceFilters,
|
|
3508
|
+
setPriceFilters
|
|
3105
3509
|
]);
|
|
3106
3510
|
return {
|
|
3107
3511
|
filterOptions,
|
|
3108
3512
|
searchText,
|
|
3109
3513
|
showListedOnly,
|
|
3514
|
+
showPriceFilter,
|
|
3515
|
+
priceFilters,
|
|
3110
3516
|
setFilterOptions,
|
|
3111
3517
|
setSearchText,
|
|
3112
3518
|
setShowListedOnly,
|
|
3519
|
+
setShowPriceFilter,
|
|
3520
|
+
setPriceFilters,
|
|
3113
3521
|
...helpers,
|
|
3114
3522
|
serialize
|
|
3115
3523
|
};
|
|
@@ -3255,7 +3663,8 @@ function useFiltersProgressive(params) {
|
|
|
3255
3663
|
//#endregion
|
|
3256
3664
|
//#region src/react/hooks/ui/useOpenConnectModal.tsx
|
|
3257
3665
|
const useOpenConnectModal$1 = () => {
|
|
3258
|
-
|
|
3666
|
+
const context = useConfig();
|
|
3667
|
+
return { openConnectModal: context.openConnectModal };
|
|
3259
3668
|
};
|
|
3260
3669
|
|
|
3261
3670
|
//#endregion
|
|
@@ -3533,10 +3942,12 @@ function useConvertPriceToUSD(params) {
|
|
|
3533
3942
|
*/
|
|
3534
3943
|
const useGetReceiptFromHash = () => {
|
|
3535
3944
|
const publicClient = usePublicClient();
|
|
3536
|
-
|
|
3945
|
+
const waitForReceipt = useCallback(async (transactionHash) => {
|
|
3537
3946
|
if (!publicClient) throw new Error("Public client not found");
|
|
3538
|
-
|
|
3539
|
-
|
|
3947
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash: transactionHash });
|
|
3948
|
+
return receipt;
|
|
3949
|
+
}, [publicClient]);
|
|
3950
|
+
return { waitForReceipt };
|
|
3540
3951
|
};
|
|
3541
3952
|
|
|
3542
3953
|
//#endregion
|
|
@@ -3851,7 +4262,7 @@ const TransactionPreview = ({ orderId, price, collectionAddress, chainId, collec
|
|
|
3851
4262
|
chainId: Number(chainId),
|
|
3852
4263
|
size: "xs"
|
|
3853
4264
|
}),
|
|
3854
|
-
isConfirming && /* @__PURE__ */ jsx(TimeAgo, { date:
|
|
4265
|
+
isConfirming && /* @__PURE__ */ jsx(TimeAgo, { date: new Date() })
|
|
3855
4266
|
]
|
|
3856
4267
|
}), /* @__PURE__ */ jsxs("div", {
|
|
3857
4268
|
className: "mt-2 flex items-center",
|
|
@@ -3939,7 +4350,7 @@ const useTransactionStatus = (hash, chainId, callbacks) => {
|
|
|
3939
4350
|
return;
|
|
3940
4351
|
}
|
|
3941
4352
|
setStatus("FAILED");
|
|
3942
|
-
callbacks?.onError?.(
|
|
4353
|
+
callbacks?.onError?.(new Error("Transaction failed"));
|
|
3943
4354
|
}, [
|
|
3944
4355
|
confirmationResult,
|
|
3945
4356
|
error,
|
|
@@ -4019,7 +4430,8 @@ const useTransactionStatusModal = () => {
|
|
|
4019
4430
|
};
|
|
4020
4431
|
};
|
|
4021
4432
|
const TransactionStatusModal = () => {
|
|
4022
|
-
|
|
4433
|
+
const isOpen = useIsOpen$3();
|
|
4434
|
+
return isOpen ? /* @__PURE__ */ jsx(TransactionStatusModalContent, {}) : null;
|
|
4023
4435
|
};
|
|
4024
4436
|
function TransactionStatusModalContent() {
|
|
4025
4437
|
const { transactionType: type, hash, orderId, price, collectionAddress, chainId, collectibleId, callbacks, queriesToInvalidate } = useTransactionModalState();
|
|
@@ -4137,8 +4549,8 @@ const initialContext$2 = {
|
|
|
4137
4549
|
isOpen: false,
|
|
4138
4550
|
props: null,
|
|
4139
4551
|
buyAnalyticsId: "",
|
|
4140
|
-
onError: (
|
|
4141
|
-
onSuccess: (
|
|
4552
|
+
onError: () => {},
|
|
4553
|
+
onSuccess: () => {},
|
|
4142
4554
|
quantity: null,
|
|
4143
4555
|
modalState: "idle",
|
|
4144
4556
|
paymentModalState: "idle",
|
|
@@ -4332,7 +4744,8 @@ const useMarketPlatformFee = (params) => {
|
|
|
4332
4744
|
};
|
|
4333
4745
|
const { chainId, collectionAddress } = params;
|
|
4334
4746
|
const marketCollection = marketplaceConfig?.market?.collections?.find((col) => compareAddress(col.itemsAddress, collectionAddress) && String(col.chainId) === String(chainId));
|
|
4335
|
-
const
|
|
4747
|
+
const avalancheOrOptimism = chainId === avalanche.id || chainId === optimism.id;
|
|
4748
|
+
const receiver = avalancheOrOptimism ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
4336
4749
|
const percentageToBPS = (percentage) => Number(percentage) * 1e4 / 100;
|
|
4337
4750
|
const feePercentage = marketCollection?.feePercentage ?? defaultFee;
|
|
4338
4751
|
return {
|
|
@@ -4370,14 +4783,15 @@ const useCheckoutOptions = (input) => {
|
|
|
4370
4783
|
}],
|
|
4371
4784
|
additionalFee: Number(fees.amount)
|
|
4372
4785
|
});
|
|
4373
|
-
const
|
|
4786
|
+
const orderResponse = await marketplaceClient.getOrders({
|
|
4374
4787
|
chainId: String(input.chainId),
|
|
4375
4788
|
input: [{
|
|
4376
4789
|
contractAddress: input.collectionAddress,
|
|
4377
4790
|
orderId: input.orderId,
|
|
4378
4791
|
marketplace: input.marketplace
|
|
4379
4792
|
}]
|
|
4380
|
-
})
|
|
4793
|
+
});
|
|
4794
|
+
const order = orderResponse.orders[0];
|
|
4381
4795
|
return {
|
|
4382
4796
|
...response.options,
|
|
4383
4797
|
order
|
|
@@ -4446,6 +4860,65 @@ const useLoadData = () => {
|
|
|
4446
4860
|
};
|
|
4447
4861
|
};
|
|
4448
4862
|
|
|
4863
|
+
//#endregion
|
|
4864
|
+
//#region src/react/ui/components/_internals/ErrorLogBox.tsx
|
|
4865
|
+
const ErrorLogBox = ({ title, message, error, onDismiss }) => {
|
|
4866
|
+
const [showFullError, setShowFullError] = useState(false);
|
|
4867
|
+
const toggleFullError = () => {
|
|
4868
|
+
setShowFullError(!showFullError);
|
|
4869
|
+
};
|
|
4870
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4871
|
+
className: "relative max-h-96 w-full overflow-y-auto rounded-lg border border-red-900 bg-[#2b0000] p-3",
|
|
4872
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4873
|
+
className: "flex items-start gap-3",
|
|
4874
|
+
children: [
|
|
4875
|
+
/* @__PURE__ */ jsx(WarningIcon, {
|
|
4876
|
+
className: "absolute mt-0.5 flex-shrink-0 text-red-500",
|
|
4877
|
+
size: "sm"
|
|
4878
|
+
}),
|
|
4879
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4880
|
+
className: "min-w-0 flex-1",
|
|
4881
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4882
|
+
className: "relative ml-10 flex flex-col",
|
|
4883
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
4884
|
+
className: "font-bold text-red-400 text-sm",
|
|
4885
|
+
children: title
|
|
4886
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
4887
|
+
className: "mt-1 text-red-300 text-xs",
|
|
4888
|
+
children: message
|
|
4889
|
+
})]
|
|
4890
|
+
}), error && /* @__PURE__ */ jsxs("div", {
|
|
4891
|
+
className: "mt-2",
|
|
4892
|
+
children: [
|
|
4893
|
+
/* @__PURE__ */ jsxs("button", {
|
|
4894
|
+
onClick: toggleFullError,
|
|
4895
|
+
className: "flex items-center gap-1 text-red-400 text-xs transition-colors hover:text-red-300",
|
|
4896
|
+
type: "button",
|
|
4897
|
+
children: [showFullError ? "Hide full error" : "Show full error", showFullError ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" })]
|
|
4898
|
+
}),
|
|
4899
|
+
showFullError && /* @__PURE__ */ jsx("div", { className: "mt-2 h-px bg-red-900" }),
|
|
4900
|
+
showFullError && /* @__PURE__ */ jsx("div", {
|
|
4901
|
+
className: "mt-2 overflow-auto rounded-md bg-red-950 p-2",
|
|
4902
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
4903
|
+
className: "whitespace-pre-wrap break-words font-mono text-red-100 text-xs",
|
|
4904
|
+
children: JSON.stringify(error, null, 2)
|
|
4905
|
+
})
|
|
4906
|
+
})
|
|
4907
|
+
]
|
|
4908
|
+
})]
|
|
4909
|
+
}),
|
|
4910
|
+
onDismiss && /* @__PURE__ */ jsx("button", {
|
|
4911
|
+
onClick: onDismiss,
|
|
4912
|
+
className: "absolute right-4 flex-shrink-0 text-red-400 transition-colors hover:text-red-300",
|
|
4913
|
+
type: "button",
|
|
4914
|
+
"aria-label": "Dismiss error",
|
|
4915
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "h-3 w-3" })
|
|
4916
|
+
})
|
|
4917
|
+
]
|
|
4918
|
+
})
|
|
4919
|
+
});
|
|
4920
|
+
};
|
|
4921
|
+
|
|
4449
4922
|
//#endregion
|
|
4450
4923
|
//#region src/utils/decode/erc20.ts
|
|
4451
4924
|
function decodeERC20Approval(calldata) {
|
|
@@ -4463,8 +4936,9 @@ function decodeERC20Approval(calldata) {
|
|
|
4463
4936
|
|
|
4464
4937
|
//#endregion
|
|
4465
4938
|
//#region src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts
|
|
4466
|
-
const getBuyCollectableParams = async ({ chainId, collectionAddress, collectibleId, callbacks, priceCurrencyAddress, customCreditCardProviderCallback, config, address, marketplace, orderId, quantity, collectable, checkoutOptions, fee, skipNativeBalanceCheck, nativeTokenAddress, buyAnalyticsId }) => {
|
|
4467
|
-
const
|
|
4939
|
+
const getBuyCollectableParams = async ({ chainId, collectionAddress, collectibleId, callbacks, priceCurrencyAddress, customCreditCardProviderCallback, config, address, marketplace, orderId, quantity, collectable, checkoutOptions, fee, skipNativeBalanceCheck, nativeTokenAddress, buyAnalyticsId, onRampProvider }) => {
|
|
4940
|
+
const marketplaceClient = getMarketplaceClient(config);
|
|
4941
|
+
const { steps: steps$2 } = await marketplaceClient.generateBuyTransaction({
|
|
4468
4942
|
chainId: String(chainId),
|
|
4469
4943
|
collectionAddress,
|
|
4470
4944
|
buyer: address,
|
|
@@ -4482,15 +4956,6 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4482
4956
|
const approvedSpenderAddress = approveStep ? decodeERC20Approval(approveStep.data).spender : void 0;
|
|
4483
4957
|
if (!buyStep) throw new Error("Buy step not found");
|
|
4484
4958
|
const creditCardProviders = customCreditCardProviderCallback ? ["custom"] : checkoutOptions.nftCheckout || [];
|
|
4485
|
-
const isTransakSupported = creditCardProviders.includes("transak");
|
|
4486
|
-
let transakContractId;
|
|
4487
|
-
if (isTransakSupported) {
|
|
4488
|
-
const transakContractIdResponse = await getSequenceApiClient(config).checkoutOptionsGetTransakContractID({
|
|
4489
|
-
chainId,
|
|
4490
|
-
contractAddress: buyStep.to
|
|
4491
|
-
});
|
|
4492
|
-
if (transakContractIdResponse.contractId !== "") transakContractId = transakContractIdResponse.contractId;
|
|
4493
|
-
}
|
|
4494
4959
|
return {
|
|
4495
4960
|
chain: chainId,
|
|
4496
4961
|
collectibles: [{
|
|
@@ -4506,8 +4971,8 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4506
4971
|
collectionAddress,
|
|
4507
4972
|
recipientAddress: address,
|
|
4508
4973
|
creditCardProviders,
|
|
4509
|
-
onSuccess: (
|
|
4510
|
-
callbacks?.onSuccess?.({ hash });
|
|
4974
|
+
onSuccess: (txHash) => {
|
|
4975
|
+
if (txHash) callbacks?.onSuccess?.({ hash: txHash });
|
|
4511
4976
|
},
|
|
4512
4977
|
supplementaryAnalyticsInfo: {
|
|
4513
4978
|
requestId: orderId,
|
|
@@ -4517,7 +4982,8 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4517
4982
|
},
|
|
4518
4983
|
onError: callbacks?.onError,
|
|
4519
4984
|
onClose: () => {
|
|
4520
|
-
|
|
4985
|
+
const queryClient = getQueryClient();
|
|
4986
|
+
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4521
4987
|
buyModalStore.send({ type: "close" });
|
|
4522
4988
|
},
|
|
4523
4989
|
skipNativeBalanceCheck,
|
|
@@ -4526,14 +4992,14 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4526
4992
|
customCreditCardProviderCallback(buyStep);
|
|
4527
4993
|
buyModalStore.send({ type: "close" });
|
|
4528
4994
|
} },
|
|
4529
|
-
|
|
4995
|
+
onRampProvider,
|
|
4530
4996
|
successActionButtons: callbacks?.successActionButtons
|
|
4531
4997
|
};
|
|
4532
4998
|
};
|
|
4533
4999
|
const usePaymentModalParams = (args) => {
|
|
4534
5000
|
const { address, marketplace, collectable, checkoutOptions, priceCurrencyAddress, quantity, enabled } = args;
|
|
4535
5001
|
const buyModalProps = useBuyModalProps();
|
|
4536
|
-
const { chainId, collectionAddress, skipNativeBalanceCheck, nativeTokenAddress } = buyModalProps;
|
|
5002
|
+
const { chainId, collectionAddress, skipNativeBalanceCheck, nativeTokenAddress, onRampProvider } = buyModalProps;
|
|
4537
5003
|
const collectibleId = isMarketProps(buyModalProps) ? buyModalProps.collectibleId : "";
|
|
4538
5004
|
const orderId = isMarketProps(buyModalProps) ? buyModalProps.orderId : "";
|
|
4539
5005
|
const customCreditCardProviderCallback = isMarketProps(buyModalProps) ? buyModalProps.customCreditCardProviderCallback : void 0;
|
|
@@ -4545,6 +5011,7 @@ const usePaymentModalParams = (args) => {
|
|
|
4545
5011
|
const onSuccess = useOnSuccess();
|
|
4546
5012
|
const onError = useOnError();
|
|
4547
5013
|
const buyAnalyticsId = useBuyAnalyticsId();
|
|
5014
|
+
const queryEnabled = !!address && !!marketplace && !!collectable && !!checkoutOptions && !!priceCurrencyAddress && !!quantity && enabled;
|
|
4548
5015
|
return useQuery({
|
|
4549
5016
|
queryKey: [
|
|
4550
5017
|
"buyCollectableParams",
|
|
@@ -4552,7 +5019,7 @@ const usePaymentModalParams = (args) => {
|
|
|
4552
5019
|
args,
|
|
4553
5020
|
fee
|
|
4554
5021
|
],
|
|
4555
|
-
queryFn:
|
|
5022
|
+
queryFn: queryEnabled ? () => getBuyCollectableParams({
|
|
4556
5023
|
chainId,
|
|
4557
5024
|
config,
|
|
4558
5025
|
address,
|
|
@@ -4573,8 +5040,10 @@ const usePaymentModalParams = (args) => {
|
|
|
4573
5040
|
customCreditCardProviderCallback,
|
|
4574
5041
|
skipNativeBalanceCheck,
|
|
4575
5042
|
nativeTokenAddress,
|
|
4576
|
-
buyAnalyticsId
|
|
4577
|
-
|
|
5043
|
+
buyAnalyticsId,
|
|
5044
|
+
onRampProvider
|
|
5045
|
+
}) : skipToken,
|
|
5046
|
+
retry: false
|
|
4578
5047
|
});
|
|
4579
5048
|
};
|
|
4580
5049
|
|
|
@@ -4588,7 +5057,7 @@ const ERC721BuyModal = ({ collectable, order, address, checkoutOptions }) => {
|
|
|
4588
5057
|
quantity: 1
|
|
4589
5058
|
});
|
|
4590
5059
|
}, [quantity]);
|
|
4591
|
-
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError } = usePaymentModalParams({
|
|
5060
|
+
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError, failureReason } = usePaymentModalParams({
|
|
4592
5061
|
address,
|
|
4593
5062
|
quantity: quantity ?? void 0,
|
|
4594
5063
|
marketplace: order?.marketplace,
|
|
@@ -4597,6 +5066,25 @@ const ERC721BuyModal = ({ collectable, order, address, checkoutOptions }) => {
|
|
|
4597
5066
|
priceCurrencyAddress: order?.priceCurrencyAddress,
|
|
4598
5067
|
enabled: true
|
|
4599
5068
|
});
|
|
5069
|
+
if (failureReason) return /* @__PURE__ */ jsx(ActionModal, {
|
|
5070
|
+
isOpen: true,
|
|
5071
|
+
onClose: () => {
|
|
5072
|
+
buyModalStore.send({ type: "close" });
|
|
5073
|
+
},
|
|
5074
|
+
title: "An error occurred while purchasing",
|
|
5075
|
+
children: /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
5076
|
+
title: failureReason.name,
|
|
5077
|
+
message: failureReason.message,
|
|
5078
|
+
error: failureReason
|
|
5079
|
+
}),
|
|
5080
|
+
ctas: [{
|
|
5081
|
+
label: "Close",
|
|
5082
|
+
onClick: () => {
|
|
5083
|
+
buyModalStore.send({ type: "close" });
|
|
5084
|
+
}
|
|
5085
|
+
}],
|
|
5086
|
+
chainId: order.chainId
|
|
5087
|
+
});
|
|
4600
5088
|
if (isPaymentModalParamsLoading || !paymentModalParams) return null;
|
|
4601
5089
|
if (isPaymentModalParamsError) throw new Error("Failed to load payment parameters for ERC721 marketplace purchase");
|
|
4602
5090
|
return /* @__PURE__ */ jsx(PaymentModalOpener$2, { paymentModalParams });
|
|
@@ -4727,7 +5215,7 @@ const encodeERC721MintData = ({ to, amount, paymentToken, price, proof = DEFAULT
|
|
|
4727
5215
|
]
|
|
4728
5216
|
});
|
|
4729
5217
|
};
|
|
4730
|
-
const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddress, collectionAddress, price, currencyAddress, callbacks, customCreditCardProviderCallback, skipNativeBalanceCheck, nativeTokenAddress, checkoutProvider, quantity, successActionButtons }) => {
|
|
5218
|
+
const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddress, collectionAddress, price, currencyAddress, callbacks, customCreditCardProviderCallback, skipNativeBalanceCheck, nativeTokenAddress, checkoutProvider, quantity, successActionButtons, onRampProvider }) => {
|
|
4731
5219
|
try {
|
|
4732
5220
|
const purchaseTransactionData = encodeERC721MintData({
|
|
4733
5221
|
to: address,
|
|
@@ -4750,12 +5238,13 @@ const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddre
|
|
|
4750
5238
|
collectionAddress,
|
|
4751
5239
|
recipientAddress: address,
|
|
4752
5240
|
creditCardProviders,
|
|
4753
|
-
onSuccess: (
|
|
4754
|
-
callbacks?.onSuccess?.({ hash });
|
|
5241
|
+
onSuccess: (txHash) => {
|
|
5242
|
+
if (txHash) callbacks?.onSuccess?.({ hash: txHash });
|
|
4755
5243
|
},
|
|
4756
5244
|
onError: callbacks?.onError,
|
|
4757
5245
|
onClose: () => {
|
|
4758
|
-
|
|
5246
|
+
const queryClient = getQueryClient();
|
|
5247
|
+
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4759
5248
|
buyModalStore.send({ type: "close" });
|
|
4760
5249
|
},
|
|
4761
5250
|
skipNativeBalanceCheck,
|
|
@@ -4765,7 +5254,8 @@ const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddre
|
|
|
4765
5254
|
customCreditCardProviderCallback(price.toString());
|
|
4766
5255
|
buyModalStore.send({ type: "close" });
|
|
4767
5256
|
} },
|
|
4768
|
-
successActionButtons
|
|
5257
|
+
successActionButtons,
|
|
5258
|
+
onRampProvider
|
|
4769
5259
|
};
|
|
4770
5260
|
} catch (error) {
|
|
4771
5261
|
throw BuyModalErrorFactory.priceCalculation("ERC721 payment params calculation", [price.toString(), quantity.toString()], error instanceof Error ? error.message : "Unknown error");
|
|
@@ -4777,9 +5267,10 @@ const useERC721SalePaymentParams = (args) => {
|
|
|
4777
5267
|
const onSuccess = useOnSuccess();
|
|
4778
5268
|
const onError = useOnError();
|
|
4779
5269
|
const buyModalProps = useBuyModalProps();
|
|
5270
|
+
const queryEnabled = enabled && !!address && !!salesContractAddress && !!collectionAddress && !!price && !!currencyAddress;
|
|
4780
5271
|
return useQuery({
|
|
4781
5272
|
queryKey: ["erc721SalePaymentParams", args],
|
|
4782
|
-
queryFn:
|
|
5273
|
+
queryFn: queryEnabled ? () => getERC721SalePaymentParams({
|
|
4783
5274
|
chainId,
|
|
4784
5275
|
address,
|
|
4785
5276
|
salesContractAddress,
|
|
@@ -4795,7 +5286,8 @@ const useERC721SalePaymentParams = (args) => {
|
|
|
4795
5286
|
nativeTokenAddress: void 0,
|
|
4796
5287
|
checkoutProvider,
|
|
4797
5288
|
quantity,
|
|
4798
|
-
successActionButtons: buyModalProps.successActionButtons
|
|
5289
|
+
successActionButtons: buyModalProps.successActionButtons,
|
|
5290
|
+
onRampProvider: buyModalProps.onRampProvider
|
|
4799
5291
|
}) : skipToken
|
|
4800
5292
|
});
|
|
4801
5293
|
};
|
|
@@ -4887,7 +5379,8 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
4887
5379
|
}
|
|
4888
5380
|
const dnValue = dn.from(value, decimals);
|
|
4889
5381
|
const isBiggerThanMax = dn.greaterThan(dnValue, dnMaxQuantity);
|
|
4890
|
-
|
|
5382
|
+
const isLessThanMin = dn.lessThan(dnValue, dnMin);
|
|
5383
|
+
if (isLessThanMin) {
|
|
4891
5384
|
setQuantity({
|
|
4892
5385
|
value,
|
|
4893
5386
|
isValid: false
|
|
@@ -4929,7 +5422,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
4929
5422
|
});
|
|
4930
5423
|
}
|
|
4931
5424
|
return /* @__PURE__ */ jsxs("div", {
|
|
4932
|
-
className: cn
|
|
5425
|
+
className: cn("flex w-full flex-col [&>label>div>div>div:has(:disabled):hover]:opacity-100 [&>label>div>div>div:has(:disabled)]:opacity-100 [&>label>div>div>div>input]:text-xs [&>label>div>div>div]:h-9 [&>label>div>div>div]:rounded [&>label>div>div>div]:pr-0 [&>label>div>div>div]:pl-3 [&>label>div>div>div]:text-xs [&>label]:gap-[2px]", className, disabled && "pointer-events-none opacity-50"),
|
|
4933
5426
|
children: [/* @__PURE__ */ jsx(NumericInput, {
|
|
4934
5427
|
className: "w-full pl-1",
|
|
4935
5428
|
name: "quantity",
|
|
@@ -5019,7 +5512,8 @@ const TotalPrice = ({ order, quantityStr, salePrice, chainId, cardType, quantity
|
|
|
5019
5512
|
let formattedPrice = "0";
|
|
5020
5513
|
const quantityForCalculation = parseUnits(quantityStr, quantityDecimals);
|
|
5021
5514
|
if (isMarket && currency && order) try {
|
|
5022
|
-
const
|
|
5515
|
+
const marketCollection = marketplaceConfig?.market?.collections?.find((col) => col.itemsAddress.toLowerCase() === order.collectionContractAddress.toLowerCase() && col.chainId === chainId);
|
|
5516
|
+
const marketplaceFeePercentage = marketCollection?.feePercentage ?? DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
5023
5517
|
const totalPriceRaw = BigInt(order ? order.priceAmount : "0") * quantityForCalculation;
|
|
5024
5518
|
formattedPrice = formatPriceWithFee(totalPriceRaw, currency.decimals, marketplaceFeePercentage);
|
|
5025
5519
|
} catch (e) {
|
|
@@ -5075,14 +5569,32 @@ const ERC1155BuyModal = ({ collectable, order, address, checkoutOptions, chainId
|
|
|
5075
5569
|
const isShop = isShopProps(modalProps);
|
|
5076
5570
|
const quantityDecimals = isShop ? modalProps.quantityDecimals : collectable.decimals || 0;
|
|
5077
5571
|
const quantityRemaining = isShop ? modalProps.quantityRemaining?.toString() : order?.quantityRemaining;
|
|
5078
|
-
|
|
5572
|
+
const unlimitedSupply = isShop ? modalProps.unlimitedSupply : false;
|
|
5573
|
+
useEffect(() => {
|
|
5574
|
+
if (modalProps.hideQuantitySelector && !quantity) {
|
|
5575
|
+
const minQuantity = quantityDecimals > 0 ? 10 ** quantityDecimals : 1;
|
|
5576
|
+
const autoQuantity = unlimitedSupply ? minQuantity : Math.min(Number(quantityRemaining), minQuantity);
|
|
5577
|
+
buyModalStore.send({
|
|
5578
|
+
type: "setQuantity",
|
|
5579
|
+
quantity: autoQuantity
|
|
5580
|
+
});
|
|
5581
|
+
}
|
|
5582
|
+
}, [
|
|
5583
|
+
modalProps.hideQuantitySelector,
|
|
5584
|
+
quantity,
|
|
5585
|
+
quantityDecimals,
|
|
5586
|
+
unlimitedSupply,
|
|
5587
|
+
quantityRemaining
|
|
5588
|
+
]);
|
|
5589
|
+
if (!quantity && !modalProps.hideQuantitySelector) return /* @__PURE__ */ jsx(ERC1155QuantityModal, {
|
|
5079
5590
|
order,
|
|
5080
5591
|
cardType,
|
|
5081
5592
|
quantityDecimals,
|
|
5082
5593
|
quantityRemaining,
|
|
5594
|
+
unlimitedSupply,
|
|
5083
5595
|
chainId
|
|
5084
5596
|
});
|
|
5085
|
-
if (!checkoutOptions) return null;
|
|
5597
|
+
if (!checkoutOptions || !quantity) return null;
|
|
5086
5598
|
return /* @__PURE__ */ jsx(Modal$4, {
|
|
5087
5599
|
address,
|
|
5088
5600
|
quantity,
|
|
@@ -5092,7 +5604,7 @@ const ERC1155BuyModal = ({ collectable, order, address, checkoutOptions, chainId
|
|
|
5092
5604
|
});
|
|
5093
5605
|
};
|
|
5094
5606
|
const Modal$4 = ({ address, quantity, order, collectable, checkoutOptions }) => {
|
|
5095
|
-
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError } = usePaymentModalParams({
|
|
5607
|
+
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError, failureReason } = usePaymentModalParams({
|
|
5096
5608
|
address,
|
|
5097
5609
|
quantity,
|
|
5098
5610
|
marketplace: order?.marketplace,
|
|
@@ -5101,7 +5613,31 @@ const Modal$4 = ({ address, quantity, order, collectable, checkoutOptions }) =>
|
|
|
5101
5613
|
priceCurrencyAddress: order?.priceCurrencyAddress,
|
|
5102
5614
|
enabled: true
|
|
5103
5615
|
});
|
|
5104
|
-
if (
|
|
5616
|
+
if (failureReason) return /* @__PURE__ */ jsx(ActionModal, {
|
|
5617
|
+
isOpen: true,
|
|
5618
|
+
onClose: () => {
|
|
5619
|
+
buyModalStore.send({ type: "close" });
|
|
5620
|
+
},
|
|
5621
|
+
title: "An error occurred while purchasing",
|
|
5622
|
+
children: /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
5623
|
+
title: failureReason.name,
|
|
5624
|
+
message: failureReason.message,
|
|
5625
|
+
error: failureReason
|
|
5626
|
+
}),
|
|
5627
|
+
ctas: [{
|
|
5628
|
+
label: "Close",
|
|
5629
|
+
onClick: () => {
|
|
5630
|
+
buyModalStore.send({ type: "close" });
|
|
5631
|
+
}
|
|
5632
|
+
}],
|
|
5633
|
+
chainId: order.chainId
|
|
5634
|
+
});
|
|
5635
|
+
if (isPaymentModalParamsLoading || !paymentModalParams) return /* @__PURE__ */ jsx(LoadingModal, {
|
|
5636
|
+
isOpen: true,
|
|
5637
|
+
chainId: order.chainId,
|
|
5638
|
+
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5639
|
+
title: "Loading checkout"
|
|
5640
|
+
});
|
|
5105
5641
|
if (isPaymentModalParamsError) throw new Error("Failed to load payment parameters for ERC1155 marketplace purchase");
|
|
5106
5642
|
return /* @__PURE__ */ jsx(PaymentModalOpener, { paymentModalParams });
|
|
5107
5643
|
};
|
|
@@ -5131,40 +5667,42 @@ const useERC1155Checkout = ({ chainId, salesContractAddress, collectionAddress,
|
|
|
5131
5667
|
const onError = useOnError();
|
|
5132
5668
|
const saleAnalyticsId = useBuyAnalyticsId();
|
|
5133
5669
|
const buyModalProps = useBuyModalProps();
|
|
5670
|
+
const checkout = useERC1155SaleContractCheckout({
|
|
5671
|
+
chain: chainId,
|
|
5672
|
+
contractAddress: salesContractAddress,
|
|
5673
|
+
collectionAddress,
|
|
5674
|
+
items: [{
|
|
5675
|
+
...items[0],
|
|
5676
|
+
quantity: quantity?.toString() || "1"
|
|
5677
|
+
}],
|
|
5678
|
+
wallet: accountAddress ?? "",
|
|
5679
|
+
...checkoutOptions && { checkoutOptions },
|
|
5680
|
+
onSuccess: (txHash) => {
|
|
5681
|
+
if (txHash) onSuccess({ hash: txHash });
|
|
5682
|
+
},
|
|
5683
|
+
onError: (error) => {
|
|
5684
|
+
onError(error);
|
|
5685
|
+
},
|
|
5686
|
+
onClose: () => {
|
|
5687
|
+
const queryClient = getQueryClient();
|
|
5688
|
+
queryClient.invalidateQueries({ queryKey: balanceQueries.inventory });
|
|
5689
|
+
queryClient.invalidateQueries({
|
|
5690
|
+
queryKey: [...collectableKeys.userBalances],
|
|
5691
|
+
refetchType: "inactive"
|
|
5692
|
+
});
|
|
5693
|
+
queryClient.invalidateQueries({ queryKey: collectableKeys.listPrimarySaleItems });
|
|
5694
|
+
buyModalStore.send({ type: "close" });
|
|
5695
|
+
},
|
|
5696
|
+
customProviderCallback,
|
|
5697
|
+
supplementaryAnalyticsInfo: {
|
|
5698
|
+
marketplaceType: "shop",
|
|
5699
|
+
saleAnalyticsId
|
|
5700
|
+
},
|
|
5701
|
+
successActionButtons: buyModalProps.successActionButtons,
|
|
5702
|
+
...buyModalProps.onRampProvider && { onRampProvider: buyModalProps.onRampProvider }
|
|
5703
|
+
});
|
|
5134
5704
|
return {
|
|
5135
|
-
...
|
|
5136
|
-
chain: chainId,
|
|
5137
|
-
contractAddress: salesContractAddress,
|
|
5138
|
-
collectionAddress,
|
|
5139
|
-
items: [{
|
|
5140
|
-
...items[0],
|
|
5141
|
-
quantity: quantity?.toString() || "1"
|
|
5142
|
-
}],
|
|
5143
|
-
wallet: accountAddress ?? "",
|
|
5144
|
-
...checkoutOptions && { checkoutOptions },
|
|
5145
|
-
onSuccess: (hash) => {
|
|
5146
|
-
onSuccess({ hash });
|
|
5147
|
-
},
|
|
5148
|
-
onError: (error) => {
|
|
5149
|
-
onError(error);
|
|
5150
|
-
},
|
|
5151
|
-
onClose: () => {
|
|
5152
|
-
const queryClient = getQueryClient();
|
|
5153
|
-
queryClient.invalidateQueries({ queryKey: balanceQueries.inventory });
|
|
5154
|
-
queryClient.invalidateQueries({
|
|
5155
|
-
queryKey: [...collectableKeys.userBalances],
|
|
5156
|
-
refetchType: "inactive"
|
|
5157
|
-
});
|
|
5158
|
-
queryClient.invalidateQueries({ queryKey: collectableKeys.listPrimarySaleItems });
|
|
5159
|
-
buyModalStore.send({ type: "close" });
|
|
5160
|
-
},
|
|
5161
|
-
customProviderCallback,
|
|
5162
|
-
supplementaryAnalyticsInfo: {
|
|
5163
|
-
marketplaceType: "shop",
|
|
5164
|
-
saleAnalyticsId
|
|
5165
|
-
},
|
|
5166
|
-
successActionButtons: buyModalProps.successActionButtons
|
|
5167
|
-
}),
|
|
5705
|
+
...checkout,
|
|
5168
5706
|
isEnabled: Boolean(enabled && accountAddress)
|
|
5169
5707
|
};
|
|
5170
5708
|
};
|
|
@@ -5316,7 +5854,7 @@ const BuyModalRouter = () => {
|
|
|
5316
5854
|
});
|
|
5317
5855
|
}
|
|
5318
5856
|
}
|
|
5319
|
-
onError(
|
|
5857
|
+
onError(new Error(`Unsupported configuration: ${collection.type} in ${isShop ? "shop" : "market"} mode`));
|
|
5320
5858
|
return /* @__PURE__ */ jsx(ErrorModal, {
|
|
5321
5859
|
isOpen: true,
|
|
5322
5860
|
chainId,
|
|
@@ -5328,7 +5866,8 @@ const BuyModalRouter = () => {
|
|
|
5328
5866
|
//#endregion
|
|
5329
5867
|
//#region src/react/ui/modals/BuyModal/components/Modal.tsx
|
|
5330
5868
|
const BuyModal = () => {
|
|
5331
|
-
|
|
5869
|
+
const isOpen = useIsOpen$2();
|
|
5870
|
+
if (!isOpen) return null;
|
|
5332
5871
|
return /* @__PURE__ */ jsx(BuyModalRouter, {});
|
|
5333
5872
|
};
|
|
5334
5873
|
|
|
@@ -5337,7 +5876,7 @@ const BuyModal = () => {
|
|
|
5337
5876
|
function Calendar({ ...props }) {
|
|
5338
5877
|
const { selectedDate, setSelectedDate } = props;
|
|
5339
5878
|
return /* @__PURE__ */ jsx(DayPicker, {
|
|
5340
|
-
disabled: { before:
|
|
5879
|
+
disabled: { before: new Date() },
|
|
5341
5880
|
selected: selectedDate,
|
|
5342
5881
|
onDayClick: setSelectedDate,
|
|
5343
5882
|
defaultMonth: selectedDate,
|
|
@@ -5376,13 +5915,99 @@ function Calendar({ ...props }) {
|
|
|
5376
5915
|
Calendar.displayName = "Calendar";
|
|
5377
5916
|
var calendar_default = Calendar;
|
|
5378
5917
|
|
|
5918
|
+
//#endregion
|
|
5919
|
+
//#region src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx
|
|
5920
|
+
function TimeSelector({ selectedDate, onTimeChange }) {
|
|
5921
|
+
const minutesRef = useRef(null);
|
|
5922
|
+
const [draft, setDraft] = useState(null);
|
|
5923
|
+
const currentHours = getHours(selectedDate);
|
|
5924
|
+
const currentMinutes = getMinutes(selectedDate);
|
|
5925
|
+
const commitChange = () => {
|
|
5926
|
+
if (!draft) return;
|
|
5927
|
+
const now = new Date();
|
|
5928
|
+
const parse = (val, fallback) => {
|
|
5929
|
+
const n = Number.parseInt(val, 10);
|
|
5930
|
+
return Number.isNaN(n) ? fallback : n;
|
|
5931
|
+
};
|
|
5932
|
+
let h = clamp(parse(draft.hours, currentHours), 0, 23);
|
|
5933
|
+
let m = clamp(parse(draft.minutes, currentMinutes), 0, 59);
|
|
5934
|
+
const newDate = setMinutes(setHours(selectedDate, h), m);
|
|
5935
|
+
if (newDate < now) {
|
|
5936
|
+
h = getHours(now);
|
|
5937
|
+
m = getMinutes(now);
|
|
5938
|
+
}
|
|
5939
|
+
onTimeChange(h, m);
|
|
5940
|
+
setDraft(null);
|
|
5941
|
+
};
|
|
5942
|
+
const handleKeyDown = (e, field) => {
|
|
5943
|
+
if (e.key === "Enter") {
|
|
5944
|
+
e.preventDefault();
|
|
5945
|
+
if (field === "hours") minutesRef.current?.focus();
|
|
5946
|
+
else commitChange();
|
|
5947
|
+
} else if (e.key === "Escape") {
|
|
5948
|
+
e.preventDefault();
|
|
5949
|
+
setDraft(null);
|
|
5950
|
+
e.currentTarget.blur();
|
|
5951
|
+
}
|
|
5952
|
+
};
|
|
5953
|
+
const hours = draft?.hours ?? currentHours.toString().padStart(2, "0");
|
|
5954
|
+
const minutes = draft?.minutes ?? currentMinutes.toString().padStart(2, "0");
|
|
5955
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5956
|
+
className: "mt-3 flex items-center gap-6 border-border-base border-t pt-3",
|
|
5957
|
+
children: [/* @__PURE__ */ jsx(TimeIcon, { color: "white" }), /* @__PURE__ */ jsxs("div", {
|
|
5958
|
+
className: "flex flex-1 items-center justify-between gap-2",
|
|
5959
|
+
children: [
|
|
5960
|
+
/* @__PURE__ */ jsx("div", {
|
|
5961
|
+
className: "w-16 [&>label]:w-16",
|
|
5962
|
+
children: /* @__PURE__ */ jsx(NumericInput, {
|
|
5963
|
+
className: "h-9 [&>input]:text-xs",
|
|
5964
|
+
name: "hours",
|
|
5965
|
+
value: hours,
|
|
5966
|
+
onChange: (e) => setDraft({
|
|
5967
|
+
hours: e.target.value,
|
|
5968
|
+
minutes
|
|
5969
|
+
}),
|
|
5970
|
+
onBlur: commitChange,
|
|
5971
|
+
onKeyDown: (e) => handleKeyDown(e, "hours"),
|
|
5972
|
+
min: 0,
|
|
5973
|
+
max: 23,
|
|
5974
|
+
tabIndex: 0
|
|
5975
|
+
})
|
|
5976
|
+
}),
|
|
5977
|
+
/* @__PURE__ */ jsx(Text, {
|
|
5978
|
+
className: "font-medium text-sm text-text-80",
|
|
5979
|
+
children: ":"
|
|
5980
|
+
}),
|
|
5981
|
+
/* @__PURE__ */ jsx("div", {
|
|
5982
|
+
className: "w-16 [&>label]:w-16",
|
|
5983
|
+
children: /* @__PURE__ */ jsx(NumericInput, {
|
|
5984
|
+
ref: minutesRef,
|
|
5985
|
+
className: "h-9 [&>input]:text-xs",
|
|
5986
|
+
name: "minutes",
|
|
5987
|
+
value: minutes,
|
|
5988
|
+
onChange: (e) => setDraft({
|
|
5989
|
+
hours,
|
|
5990
|
+
minutes: e.target.value
|
|
5991
|
+
}),
|
|
5992
|
+
onBlur: commitChange,
|
|
5993
|
+
onKeyDown: (e) => handleKeyDown(e, "minutes"),
|
|
5994
|
+
min: 0,
|
|
5995
|
+
max: 59,
|
|
5996
|
+
tabIndex: 0
|
|
5997
|
+
})
|
|
5998
|
+
})
|
|
5999
|
+
]
|
|
6000
|
+
})]
|
|
6001
|
+
});
|
|
6002
|
+
}
|
|
6003
|
+
|
|
5379
6004
|
//#endregion
|
|
5380
6005
|
//#region src/react/ui/modals/_internal/components/calendarDropdown/index.tsx
|
|
5381
6006
|
/**
|
|
5382
6007
|
* Determines if the selected date matches a preset range
|
|
5383
6008
|
*/
|
|
5384
6009
|
function getMatchingPreset(selectedDate) {
|
|
5385
|
-
const today = startOfDay(
|
|
6010
|
+
const today = startOfDay(new Date());
|
|
5386
6011
|
const selectedDay = startOfDay(selectedDate);
|
|
5387
6012
|
const daysDifference = differenceInDays(selectedDay, today);
|
|
5388
6013
|
if (isSameDay(selectedDay, today)) return PRESET_RANGES.TODAY.value;
|
|
@@ -5394,6 +6019,11 @@ function getMatchingPreset(selectedDate) {
|
|
|
5394
6019
|
}
|
|
5395
6020
|
function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpen, setIsOpen }) {
|
|
5396
6021
|
const matchingPreset = getMatchingPreset(selectedDate);
|
|
6022
|
+
const handleTimeChange = (hours, minutes) => {
|
|
6023
|
+
const newDate = new Date(selectedDate);
|
|
6024
|
+
newDate.setHours(hours, minutes, 0, 0);
|
|
6025
|
+
setSelectedDate(newDate);
|
|
6026
|
+
};
|
|
5397
6027
|
return /* @__PURE__ */ jsxs(DropdownMenuRoot, {
|
|
5398
6028
|
open: isOpen,
|
|
5399
6029
|
onOpenChange: setIsOpen,
|
|
@@ -5403,7 +6033,7 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5403
6033
|
leftIcon: CalendarIcon_default,
|
|
5404
6034
|
className: "h-9 flex-1 rounded-sm p-2 font-medium text-xs",
|
|
5405
6035
|
variant: "base",
|
|
5406
|
-
label: format(selectedDate, "
|
|
6036
|
+
label: format(selectedDate, "yyyy/MM/dd HH:mm"),
|
|
5407
6037
|
shape: "square",
|
|
5408
6038
|
onClick: () => setIsOpen(!isOpen)
|
|
5409
6039
|
})
|
|
@@ -5423,16 +6053,29 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5423
6053
|
},
|
|
5424
6054
|
variant: "text",
|
|
5425
6055
|
className: `w-full justify-start py-1.5 font-bold text-xs transition-colors ${isActive ? "text-text-100" : "text-text-50 hover:text-text-80"}`,
|
|
6056
|
+
tabIndex: 0,
|
|
5426
6057
|
children: preset.label
|
|
5427
6058
|
}, preset.value);
|
|
5428
6059
|
})
|
|
5429
|
-
}), /* @__PURE__ */
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
6060
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6061
|
+
className: "flex flex-col",
|
|
6062
|
+
children: [/* @__PURE__ */ jsx(calendar_default, {
|
|
6063
|
+
selectedDate,
|
|
6064
|
+
setSelectedDate: (date) => {
|
|
6065
|
+
const newDate = new Date(date);
|
|
6066
|
+
const today = startOfDay(new Date());
|
|
6067
|
+
const selectedDay = startOfDay(newDate);
|
|
6068
|
+
if (isSameDay(selectedDay, today)) setSelectedDate(endOfDay(newDate));
|
|
6069
|
+
else {
|
|
6070
|
+
newDate.setHours(selectedDate.getHours(), selectedDate.getMinutes(), 0, 0);
|
|
6071
|
+
setSelectedDate(newDate);
|
|
6072
|
+
}
|
|
6073
|
+
},
|
|
6074
|
+
mode: "single"
|
|
6075
|
+
}), /* @__PURE__ */ jsx(TimeSelector, {
|
|
6076
|
+
selectedDate,
|
|
6077
|
+
onTimeChange: handleTimeChange
|
|
6078
|
+
})]
|
|
5436
6079
|
})]
|
|
5437
6080
|
})
|
|
5438
6081
|
}) })]
|
|
@@ -5441,11 +6084,6 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5441
6084
|
|
|
5442
6085
|
//#endregion
|
|
5443
6086
|
//#region src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
5444
|
-
const setToEndOfDay = (date) => {
|
|
5445
|
-
const endOfDay = new Date(date);
|
|
5446
|
-
endOfDay.setHours(23, 59, 59, 999);
|
|
5447
|
-
return endOfDay;
|
|
5448
|
-
};
|
|
5449
6087
|
const PRESET_RANGES = {
|
|
5450
6088
|
TODAY: {
|
|
5451
6089
|
label: "Today",
|
|
@@ -5478,8 +6116,13 @@ const ExpirationDateSelect = function ExpirationDateSelect$1({ className, date,
|
|
|
5478
6116
|
function handleSelectPresetRange(range) {
|
|
5479
6117
|
const presetRange = Object.values(PRESET_RANGES).find((preset) => preset.value === range);
|
|
5480
6118
|
if (!presetRange) return;
|
|
5481
|
-
const baseDate =
|
|
5482
|
-
const
|
|
6119
|
+
const baseDate = new Date();
|
|
6120
|
+
const targetDate = presetRange.value === "today" ? baseDate : addDays(baseDate, presetRange.offset);
|
|
6121
|
+
const newDate = presetRange.value === "today" ? endOfDay(targetDate) : (() => {
|
|
6122
|
+
const preservedTimeDate = new Date(targetDate);
|
|
6123
|
+
preservedTimeDate.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
6124
|
+
return preservedTimeDate;
|
|
6125
|
+
})();
|
|
5483
6126
|
onDateChange(newDate);
|
|
5484
6127
|
}
|
|
5485
6128
|
function handleDateValueChange(date$1) {
|
|
@@ -5487,7 +6130,7 @@ const ExpirationDateSelect = function ExpirationDateSelect$1({ className, date,
|
|
|
5487
6130
|
}
|
|
5488
6131
|
if (!date) return /* @__PURE__ */ jsx(Skeleton, { className: "mr-3 h-7 w-20 rounded-2xl" });
|
|
5489
6132
|
return /* @__PURE__ */ jsxs("div", {
|
|
5490
|
-
className: cn
|
|
6133
|
+
className: cn("relative w-full", disabled && "pointer-events-none opacity-50"),
|
|
5491
6134
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
5492
6135
|
className: "w-full text-left font-body font-medium text-xs",
|
|
5493
6136
|
fontWeight: "medium",
|
|
@@ -5538,7 +6181,7 @@ function FloorPriceText({ chainId, collectionAddress, tokenId, price, onBuyNow }
|
|
|
5538
6181
|
showBuyNowButton = true;
|
|
5539
6182
|
}
|
|
5540
6183
|
return /* @__PURE__ */ jsxs("div", {
|
|
5541
|
-
className: "flex w-full items-center justify-between gap-2",
|
|
6184
|
+
className: "flex w-full flex-wrap items-center justify-between gap-2",
|
|
5542
6185
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
5543
6186
|
className: "text-left font-body font-medium text-muted text-xs",
|
|
5544
6187
|
children: floorPriceDifferenceText
|
|
@@ -5741,31 +6384,38 @@ const CustomSelect = ({ items, onValueChange, defaultValue, placeholder = "Selec
|
|
|
5741
6384
|
|
|
5742
6385
|
//#endregion
|
|
5743
6386
|
//#region src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
5744
|
-
function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDefault, selectedCurrency, onCurrencyChange, includeNativeCurrency }) {
|
|
6387
|
+
function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDefault, selectedCurrency, onCurrencyChange, includeNativeCurrency, orderbookKind, modalType }) {
|
|
5745
6388
|
const { data: currencies, isLoading: currenciesLoading } = useMarketCurrencies({
|
|
5746
6389
|
chainId,
|
|
5747
6390
|
collectionAddress,
|
|
5748
6391
|
includeNativeCurrency
|
|
5749
6392
|
});
|
|
6393
|
+
let filteredCurrencies = currencies;
|
|
6394
|
+
if (currencies && orderbookKind === OrderbookKind.opensea && modalType) filteredCurrencies = currencies.filter((currency) => {
|
|
6395
|
+
if (modalType === "listing") return currency.openseaListing;
|
|
6396
|
+
if (modalType === "offer") return currency.openseaOffer;
|
|
6397
|
+
return false;
|
|
6398
|
+
});
|
|
5750
6399
|
useEffect(() => {
|
|
5751
|
-
if (
|
|
5752
|
-
else onCurrencyChange(
|
|
6400
|
+
if (filteredCurrencies && filteredCurrencies.length > 0 && !selectedCurrency?.contractAddress) if (secondCurrencyAsDefault && filteredCurrencies.length > 1) onCurrencyChange(filteredCurrencies[1]);
|
|
6401
|
+
else onCurrencyChange(filteredCurrencies[0]);
|
|
5753
6402
|
}, [
|
|
5754
|
-
|
|
6403
|
+
filteredCurrencies,
|
|
5755
6404
|
selectedCurrency?.contractAddress,
|
|
5756
6405
|
secondCurrencyAsDefault,
|
|
5757
6406
|
onCurrencyChange
|
|
5758
6407
|
]);
|
|
5759
|
-
if (!
|
|
5760
|
-
const options =
|
|
6408
|
+
if (!filteredCurrencies || currenciesLoading || !selectedCurrency?.symbol) return /* @__PURE__ */ jsx(Skeleton, { className: "mr-3 h-7 w-20 rounded-2xl" });
|
|
6409
|
+
const options = filteredCurrencies.map((currency) => ({
|
|
5761
6410
|
label: currency.symbol,
|
|
5762
6411
|
value: currency.contractAddress,
|
|
5763
6412
|
content: currency.symbol
|
|
5764
6413
|
}));
|
|
5765
6414
|
const onChange = (value) => {
|
|
5766
|
-
const selectedCurrency$1 =
|
|
6415
|
+
const selectedCurrency$1 = filteredCurrencies.find((currency) => currency.contractAddress === value);
|
|
5767
6416
|
if (selectedCurrency$1) onCurrencyChange(selectedCurrency$1);
|
|
5768
6417
|
};
|
|
6418
|
+
const isDropdownDisabled = orderbookKind === OrderbookKind.opensea;
|
|
5769
6419
|
return /* @__PURE__ */ jsx(CustomSelect, {
|
|
5770
6420
|
items: options,
|
|
5771
6421
|
onValueChange: onChange,
|
|
@@ -5773,6 +6423,7 @@ function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDef
|
|
|
5773
6423
|
value: selectedCurrency.contractAddress,
|
|
5774
6424
|
content: selectedCurrency.symbol
|
|
5775
6425
|
},
|
|
6426
|
+
disabled: isDropdownDisabled,
|
|
5776
6427
|
testId: "currency-select"
|
|
5777
6428
|
});
|
|
5778
6429
|
}
|
|
@@ -5780,7 +6431,7 @@ var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
|
5780
6431
|
|
|
5781
6432
|
//#endregion
|
|
5782
6433
|
//#region src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
5783
|
-
function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurrencyChange, checkBalance, secondCurrencyAsDefault, includeNativeCurrency, disabled }) {
|
|
6434
|
+
function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurrencyChange, checkBalance, secondCurrencyAsDefault, includeNativeCurrency, disabled, orderbookKind, setOpenseaLowestPriceCriteriaMet, modalType, feeData }) {
|
|
5784
6435
|
const { address: accountAddress } = useAccount();
|
|
5785
6436
|
const inputRef = useRef(null);
|
|
5786
6437
|
const currency = price?.currency;
|
|
@@ -5790,6 +6441,12 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5790
6441
|
const handleCurrencyChange = (newCurrency) => {
|
|
5791
6442
|
if (price && onCurrencyChange) onCurrencyChange(newCurrency);
|
|
5792
6443
|
};
|
|
6444
|
+
const { data: conversion, isLoading: isConversionLoading } = useConvertPriceToUSD({
|
|
6445
|
+
chainId,
|
|
6446
|
+
currencyAddress,
|
|
6447
|
+
amountRaw: priceAmountRaw,
|
|
6448
|
+
query: { enabled: orderbookKind === OrderbookKind.opensea && !!currencyAddress && !!priceAmountRaw && !!setOpenseaLowestPriceCriteriaMet }
|
|
6449
|
+
});
|
|
5793
6450
|
useEffect(() => {
|
|
5794
6451
|
if (inputRef.current) inputRef.current.focus();
|
|
5795
6452
|
}, []);
|
|
@@ -5798,10 +6455,47 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5798
6455
|
chainId,
|
|
5799
6456
|
userAddress: accountAddress
|
|
5800
6457
|
});
|
|
5801
|
-
const
|
|
6458
|
+
const getTotalRequiredBalance = () => {
|
|
6459
|
+
if (!priceAmountRaw || !currencyDecimals) return BigInt(0);
|
|
6460
|
+
const offerAmountRaw = BigInt(priceAmountRaw);
|
|
6461
|
+
if (modalType === "offer" && feeData) return calculateTotalOfferCost(offerAmountRaw, currencyDecimals, feeData.royaltyPercentage || 0);
|
|
6462
|
+
return offerAmountRaw;
|
|
6463
|
+
};
|
|
6464
|
+
const balanceError = !!checkBalance?.enabled && !!isBalanceSuccess && !!priceAmountRaw && !!currencyDecimals && getTotalRequiredBalance() > BigInt(balance?.value || 0n);
|
|
6465
|
+
const hasEnoughForBaseOffer = !!isBalanceSuccess && !!priceAmountRaw && BigInt(priceAmountRaw) <= BigInt(balance?.value || 0n);
|
|
6466
|
+
const getRoyaltyFeeAmount = () => {
|
|
6467
|
+
if (!priceAmountRaw || !currencyDecimals || !feeData?.royaltyPercentage) return null;
|
|
6468
|
+
const offerAmount = BigInt(priceAmountRaw);
|
|
6469
|
+
const royaltyFeeAmount = offerAmount * BigInt(Math.round(feeData.royaltyPercentage * 100)) / BigInt(1e4);
|
|
6470
|
+
return formatUnits(royaltyFeeAmount, currencyDecimals);
|
|
6471
|
+
};
|
|
6472
|
+
const royaltyFeeFormatted = getRoyaltyFeeAmount();
|
|
6473
|
+
const RoyaltyFeeTooltip = ({ children }) => /* @__PURE__ */ jsx(Tooltip, {
|
|
6474
|
+
message: /* @__PURE__ */ jsxs("div", {
|
|
6475
|
+
className: "flex flex-col gap-1",
|
|
6476
|
+
children: [
|
|
6477
|
+
/* @__PURE__ */ jsx(Text, {
|
|
6478
|
+
className: "font-body font-medium text-xs",
|
|
6479
|
+
children: "A royalty fee is a percentage of each resale"
|
|
6480
|
+
}),
|
|
6481
|
+
/* @__PURE__ */ jsx(Text, {
|
|
6482
|
+
className: "font-body font-medium text-xs",
|
|
6483
|
+
children: "price that automatically compensates the original"
|
|
6484
|
+
}),
|
|
6485
|
+
/* @__PURE__ */ jsx(Text, {
|
|
6486
|
+
className: "font-body font-medium text-xs",
|
|
6487
|
+
children: "creator every time their collectible changes hands."
|
|
6488
|
+
})
|
|
6489
|
+
]
|
|
6490
|
+
}),
|
|
6491
|
+
children
|
|
6492
|
+
});
|
|
6493
|
+
const openseaLowestPriceCriteriaMet = orderbookKind === OrderbookKind.opensea && !!conversion?.usdAmount && conversion.usdAmount >= .01;
|
|
5802
6494
|
if (checkBalance?.enabled) checkBalance.callback(balanceError);
|
|
6495
|
+
if (setOpenseaLowestPriceCriteriaMet) setOpenseaLowestPriceCriteriaMet(openseaLowestPriceCriteriaMet);
|
|
5803
6496
|
const [value, setValue] = useState("0");
|
|
5804
6497
|
const prevCurrencyDecimals = useRef(currencyDecimals);
|
|
6498
|
+
const [openseaDecimalError, setOpenseaDecimalError] = useState(null);
|
|
5805
6499
|
useEffect(() => {
|
|
5806
6500
|
if (prevCurrencyDecimals.current !== currencyDecimals && value !== "0" && price && onPriceChange) try {
|
|
5807
6501
|
const parsedAmount = parseUnits(value, Number(currencyDecimals));
|
|
@@ -5828,6 +6522,28 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5828
6522
|
const newValue = event.target.value;
|
|
5829
6523
|
setValue(newValue);
|
|
5830
6524
|
if (!price || !onPriceChange) return;
|
|
6525
|
+
if (orderbookKind === OrderbookKind.opensea && modalType === "offer") {
|
|
6526
|
+
const validation = validateOpenseaOfferDecimals(newValue);
|
|
6527
|
+
if (!validation.isValid) {
|
|
6528
|
+
setOpenseaDecimalError(validation.errorMessage || null);
|
|
6529
|
+
try {
|
|
6530
|
+
const parsedAmount = parseUnits(newValue, Number(currencyDecimals));
|
|
6531
|
+
const updatedPrice = {
|
|
6532
|
+
...price,
|
|
6533
|
+
amountRaw: parsedAmount.toString()
|
|
6534
|
+
};
|
|
6535
|
+
onPriceChange(updatedPrice);
|
|
6536
|
+
} catch {
|
|
6537
|
+
const updatedPrice = {
|
|
6538
|
+
...price,
|
|
6539
|
+
amountRaw: "0"
|
|
6540
|
+
};
|
|
6541
|
+
onPriceChange(updatedPrice);
|
|
6542
|
+
}
|
|
6543
|
+
return;
|
|
6544
|
+
}
|
|
6545
|
+
setOpenseaDecimalError(null);
|
|
6546
|
+
}
|
|
5831
6547
|
try {
|
|
5832
6548
|
const parsedAmount = parseUnits(newValue, Number(currencyDecimals));
|
|
5833
6549
|
const updatedPrice = {
|
|
@@ -5844,7 +6560,7 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5844
6560
|
}
|
|
5845
6561
|
};
|
|
5846
6562
|
return /* @__PURE__ */ jsxs("div", {
|
|
5847
|
-
className: cn
|
|
6563
|
+
className: cn("price-input relative flex w-full flex-col", disabled && "pointer-events-none opacity-50"),
|
|
5848
6564
|
children: [
|
|
5849
6565
|
/* @__PURE__ */ jsx("div", {
|
|
5850
6566
|
className: "absolute top-8 left-2 flex items-center",
|
|
@@ -5865,16 +6581,66 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5865
6581
|
collectionAddress,
|
|
5866
6582
|
chainId,
|
|
5867
6583
|
secondCurrencyAsDefault,
|
|
5868
|
-
includeNativeCurrency
|
|
6584
|
+
includeNativeCurrency,
|
|
6585
|
+
orderbookKind,
|
|
6586
|
+
modalType
|
|
5869
6587
|
}),
|
|
5870
6588
|
value,
|
|
5871
6589
|
onChange: handleChange
|
|
5872
6590
|
})
|
|
5873
6591
|
}),
|
|
5874
|
-
balanceError && /* @__PURE__ */ jsx(
|
|
6592
|
+
balanceError && /* @__PURE__ */ jsx("div", {
|
|
6593
|
+
className: "mt-2",
|
|
6594
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
6595
|
+
className: "font-body font-medium text-xs",
|
|
6596
|
+
color: "negative",
|
|
6597
|
+
children: modalType === "offer" && hasEnoughForBaseOffer && royaltyFeeFormatted && Number(royaltyFeeFormatted) > 0 ? /* @__PURE__ */ jsx(RoyaltyFeeTooltip, { children: /* @__PURE__ */ jsxs("div", {
|
|
6598
|
+
className: "flex items-center gap-1",
|
|
6599
|
+
children: [/* @__PURE__ */ jsx(InfoIcon, { className: "h-4 w-4 text-negative" }), /* @__PURE__ */ jsxs(Text, {
|
|
6600
|
+
className: "font-body font-medium text-xs",
|
|
6601
|
+
color: "negative",
|
|
6602
|
+
children: [
|
|
6603
|
+
"You need ",
|
|
6604
|
+
royaltyFeeFormatted,
|
|
6605
|
+
" ",
|
|
6606
|
+
currency?.symbol,
|
|
6607
|
+
" for royalty fees"
|
|
6608
|
+
]
|
|
6609
|
+
})]
|
|
6610
|
+
}) }) : "Insufficient balance"
|
|
6611
|
+
})
|
|
6612
|
+
}),
|
|
6613
|
+
!balanceError && modalType === "offer" && royaltyFeeFormatted && Number(royaltyFeeFormatted) > 0 && /* @__PURE__ */ jsx("div", {
|
|
6614
|
+
className: "mt-2",
|
|
6615
|
+
children: /* @__PURE__ */ jsx(RoyaltyFeeTooltip, { children: /* @__PURE__ */ jsxs("div", {
|
|
6616
|
+
className: "flex items-center gap-1",
|
|
6617
|
+
children: [/* @__PURE__ */ jsx(InfoIcon, { className: "h-4 w-4 text-text-50" }), /* @__PURE__ */ jsxs(Text, {
|
|
6618
|
+
className: "font-body font-medium text-xs",
|
|
6619
|
+
color: "text50",
|
|
6620
|
+
children: [
|
|
6621
|
+
"Total:",
|
|
6622
|
+
" ",
|
|
6623
|
+
(Number(value) + Number(royaltyFeeFormatted)).toFixed(6).replace(/\.?0+$/, ""),
|
|
6624
|
+
" ",
|
|
6625
|
+
currency?.symbol,
|
|
6626
|
+
" (includes ",
|
|
6627
|
+
royaltyFeeFormatted,
|
|
6628
|
+
" ",
|
|
6629
|
+
currency?.symbol,
|
|
6630
|
+
" royalty fee)"
|
|
6631
|
+
]
|
|
6632
|
+
})]
|
|
6633
|
+
}) })
|
|
6634
|
+
}),
|
|
6635
|
+
!balanceError && priceAmountRaw !== "0" && !openseaLowestPriceCriteriaMet && orderbookKind === OrderbookKind.opensea && !isConversionLoading && modalType === "offer" && !openseaDecimalError && /* @__PURE__ */ jsx(Text, {
|
|
5875
6636
|
className: "-bottom-5 absolute font-body font-medium text-xs",
|
|
5876
6637
|
color: "negative",
|
|
5877
|
-
children: "
|
|
6638
|
+
children: "Lowest price must be at least $0.01"
|
|
6639
|
+
}),
|
|
6640
|
+
!balanceError && openseaDecimalError && orderbookKind === OrderbookKind.opensea && modalType === "offer" && /* @__PURE__ */ jsx(Text, {
|
|
6641
|
+
className: "font-body font-medium text-xs",
|
|
6642
|
+
color: "negative",
|
|
6643
|
+
children: openseaDecimalError
|
|
5878
6644
|
})
|
|
5879
6645
|
]
|
|
5880
6646
|
});
|
|
@@ -6096,7 +6862,7 @@ const SelectWaasFeeOptions = ({ chainId, onCancel, titleOnConfirm, className })
|
|
|
6096
6862
|
const isSponsored = pendingFeeOptionConfirmation?.options?.length === 0;
|
|
6097
6863
|
if (!isVisible || isSponsored || !selectedFeeOption) return null;
|
|
6098
6864
|
return /* @__PURE__ */ jsxs("div", {
|
|
6099
|
-
className: cn
|
|
6865
|
+
className: cn("flex w-full flex-col gap-2 rounded-2xl bg-button-emphasis p-0 backdrop-blur-md", className),
|
|
6100
6866
|
children: [
|
|
6101
6867
|
/* @__PURE__ */ jsx(Divider, { className: "mt-0 mb-4" }),
|
|
6102
6868
|
/* @__PURE__ */ jsx(Text, {
|
|
@@ -6105,7 +6871,7 @@ const SelectWaasFeeOptions = ({ chainId, onCancel, titleOnConfirm, className })
|
|
|
6105
6871
|
}),
|
|
6106
6872
|
!feeOptionsConfirmed && !pendingFeeOptionConfirmation && /* @__PURE__ */ jsx(Skeleton, { className: "h-[52px] w-full animate-shimmer rounded-xl" }),
|
|
6107
6873
|
(feeOptionsConfirmed || pendingFeeOptionConfirmation) && /* @__PURE__ */ jsx("div", {
|
|
6108
|
-
className: cn
|
|
6874
|
+
className: cn("[&>label>button>span]:overflow-hidden [&>label>button]:w-full [&>label>button]:text-xs [&>label>div]:w-full [&>label]:flex [&>label]:w-full", feeOptionsConfirmed && "pointer-events-none opacity-70"),
|
|
6109
6875
|
children: /* @__PURE__ */ jsx(WaasFeeOptionsSelect_default, {
|
|
6110
6876
|
options: pendingFeeOptionConfirmation?.options || [selectedFeeOption],
|
|
6111
6877
|
selectedFeeOption,
|
|
@@ -6181,14 +6947,36 @@ function TransactionDetails({ collectibleId, collectionAddress, chainId, include
|
|
|
6181
6947
|
collectionAddress,
|
|
6182
6948
|
collectibleId
|
|
6183
6949
|
});
|
|
6950
|
+
const [overflow, setOverflow] = useState({
|
|
6951
|
+
status: false,
|
|
6952
|
+
amount: "0"
|
|
6953
|
+
});
|
|
6184
6954
|
const priceLoading = !price || marketplaceConfigLoading || royaltyLoading;
|
|
6185
|
-
|
|
6186
|
-
|
|
6955
|
+
const [formattedAmount, setFormattedAmount] = useState("0");
|
|
6956
|
+
useEffect(() => {
|
|
6957
|
+
if (!price || royaltyLoading || marketplaceConfigLoading) return;
|
|
6187
6958
|
const fees = [];
|
|
6188
6959
|
if (royalty !== null) fees.push(Number(royalty.percentage));
|
|
6189
6960
|
if (marketplaceFeePercentage > 0) fees.push(marketplaceFeePercentage);
|
|
6190
|
-
|
|
6191
|
-
|
|
6961
|
+
const newFormattedAmount = calculateEarningsAfterFees(BigInt(price.amountRaw), price.currency.decimals, fees);
|
|
6962
|
+
setFormattedAmount(newFormattedAmount);
|
|
6963
|
+
}, [
|
|
6964
|
+
price,
|
|
6965
|
+
royalty,
|
|
6966
|
+
marketplaceFeePercentage,
|
|
6967
|
+
royaltyLoading,
|
|
6968
|
+
marketplaceConfigLoading
|
|
6969
|
+
]);
|
|
6970
|
+
useEffect(() => {
|
|
6971
|
+
if (formattedAmount.length > 15) setOverflow((prev) => prev.status ? prev : {
|
|
6972
|
+
status: true,
|
|
6973
|
+
amount: formattedAmount.slice(0, 15)
|
|
6974
|
+
});
|
|
6975
|
+
else setOverflow({
|
|
6976
|
+
status: false,
|
|
6977
|
+
amount: formattedAmount
|
|
6978
|
+
});
|
|
6979
|
+
}, [formattedAmount]);
|
|
6192
6980
|
return /* @__PURE__ */ jsxs("div", {
|
|
6193
6981
|
className: "flex w-full items-center justify-between",
|
|
6194
6982
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
@@ -6200,14 +6988,36 @@ function TransactionDetails({ collectibleId, collectionAddress, chainId, include
|
|
|
6200
6988
|
children: [/* @__PURE__ */ jsx(Image, {
|
|
6201
6989
|
className: "h-3 w-3",
|
|
6202
6990
|
src: currencyImageUrl
|
|
6203
|
-
}), priceLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 animate-shimmer" }) : /* @__PURE__ */
|
|
6991
|
+
}), priceLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 animate-shimmer" }) : /* @__PURE__ */ jsx(Text, {
|
|
6204
6992
|
className: "font-body font-medium text-xs",
|
|
6205
6993
|
color: "text100",
|
|
6206
|
-
children:
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
price.currency.symbol
|
|
6210
|
-
|
|
6994
|
+
children: showPlaceholderPrice ? /* @__PURE__ */ jsxs(Text, {
|
|
6995
|
+
className: "font-body font-medium text-xs",
|
|
6996
|
+
color: "text100",
|
|
6997
|
+
children: ["0 ", price.currency.symbol]
|
|
6998
|
+
}) : overflow.status ? /* @__PURE__ */ jsx(Tooltip, {
|
|
6999
|
+
message: `${formattedAmount} ${price.currency.symbol}`,
|
|
7000
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
7001
|
+
className: "flex items-center",
|
|
7002
|
+
children: [/* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3 text-text-100" }), /* @__PURE__ */ jsxs(Text, {
|
|
7003
|
+
className: "font-body font-medium text-xs",
|
|
7004
|
+
color: "text100",
|
|
7005
|
+
children: [
|
|
7006
|
+
overflow.amount,
|
|
7007
|
+
" ",
|
|
7008
|
+
price.currency.symbol
|
|
7009
|
+
]
|
|
7010
|
+
})]
|
|
7011
|
+
})
|
|
7012
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
7013
|
+
className: "font-body font-medium text-xs",
|
|
7014
|
+
color: "text100",
|
|
7015
|
+
children: [
|
|
7016
|
+
formattedAmount,
|
|
7017
|
+
" ",
|
|
7018
|
+
price.currency.symbol
|
|
7019
|
+
]
|
|
7020
|
+
})
|
|
6211
7021
|
})]
|
|
6212
7022
|
})]
|
|
6213
7023
|
});
|
|
@@ -6236,7 +7046,7 @@ const useSelectWaasFeeOptions = ({ isProcessing, feeOptionsVisible, selectedFeeO
|
|
|
6236
7046
|
|
|
6237
7047
|
//#endregion
|
|
6238
7048
|
//#region src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts
|
|
6239
|
-
const ONE_DAY_IN_SECONDS$1 =
|
|
7049
|
+
const ONE_DAY_IN_SECONDS$1 = 60 * 60 * 24;
|
|
6240
7050
|
const useGetTokenApprovalData$2 = (params) => {
|
|
6241
7051
|
const config = useConfig();
|
|
6242
7052
|
const { walletKind } = useConnectorMetadata();
|
|
@@ -6247,10 +7057,10 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6247
7057
|
quantity: "1",
|
|
6248
7058
|
currencyAddress: params.currencyAddress,
|
|
6249
7059
|
pricePerToken: "100000",
|
|
6250
|
-
expiry: String(Number(dateToUnixTime(
|
|
7060
|
+
expiry: String(Number(dateToUnixTime(new Date())) + ONE_DAY_IN_SECONDS$1)
|
|
6251
7061
|
};
|
|
6252
7062
|
const isEnabled = address && (params.query?.enabled ?? true) && !!params.currencyAddress;
|
|
6253
|
-
const { data, isLoading, isSuccess } = useQuery({
|
|
7063
|
+
const { data, isLoading, isSuccess, isError, error } = useQuery({
|
|
6254
7064
|
queryKey: [
|
|
6255
7065
|
"token-approval-data",
|
|
6256
7066
|
params,
|
|
@@ -6264,9 +7074,11 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6264
7074
|
walletType: walletKind,
|
|
6265
7075
|
contractType: params.contractType,
|
|
6266
7076
|
orderbook: params.orderbook,
|
|
6267
|
-
listing
|
|
7077
|
+
listing,
|
|
7078
|
+
additionalFees: []
|
|
6268
7079
|
};
|
|
6269
|
-
const
|
|
7080
|
+
const steps$2 = await marketplaceClient.generateListingTransaction(args).then((resp) => resp.steps);
|
|
7081
|
+
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
6270
7082
|
if (!tokenApprovalStep) return { step: null };
|
|
6271
7083
|
return { step: tokenApprovalStep };
|
|
6272
7084
|
} : skipToken
|
|
@@ -6274,7 +7086,9 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6274
7086
|
return {
|
|
6275
7087
|
data,
|
|
6276
7088
|
isLoading,
|
|
6277
|
-
isSuccess
|
|
7089
|
+
isSuccess,
|
|
7090
|
+
isError,
|
|
7091
|
+
error
|
|
6278
7092
|
};
|
|
6279
7093
|
};
|
|
6280
7094
|
|
|
@@ -6283,12 +7097,13 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6283
7097
|
const getSequenceMarketplaceRequestId = async (hash, publicClient, walletAddress) => {
|
|
6284
7098
|
try {
|
|
6285
7099
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
6286
|
-
|
|
7100
|
+
const logs = parseEventLogs({
|
|
6287
7101
|
abi: SequenceMarketplaceV1_ABI,
|
|
6288
7102
|
eventName: "RequestCreated",
|
|
6289
7103
|
args: { creator: walletAddress },
|
|
6290
7104
|
logs: receipt.logs
|
|
6291
|
-
})
|
|
7105
|
+
});
|
|
7106
|
+
return logs[0].args.requestId.toString();
|
|
6292
7107
|
} catch (error) {
|
|
6293
7108
|
console.error(error);
|
|
6294
7109
|
}
|
|
@@ -6315,7 +7130,7 @@ const useTransactionSteps$2 = ({ listingInput, chainId, collectionAddress, order
|
|
|
6315
7130
|
const getListingSteps = async () => {
|
|
6316
7131
|
if (!address) return;
|
|
6317
7132
|
try {
|
|
6318
|
-
|
|
7133
|
+
const steps$2 = await generateListingTransactionAsync({
|
|
6319
7134
|
collectionAddress,
|
|
6320
7135
|
owner: address,
|
|
6321
7136
|
walletType: walletKind,
|
|
@@ -6323,9 +7138,11 @@ const useTransactionSteps$2 = ({ listingInput, chainId, collectionAddress, order
|
|
|
6323
7138
|
orderbook: orderbookKind,
|
|
6324
7139
|
listing: {
|
|
6325
7140
|
...listingInput.listing,
|
|
6326
|
-
expiry:
|
|
6327
|
-
}
|
|
7141
|
+
expiry: new Date(Number(listingInput.listing.expiry) * 1e3)
|
|
7142
|
+
},
|
|
7143
|
+
additionalFees: []
|
|
6328
7144
|
});
|
|
7145
|
+
return steps$2;
|
|
6329
7146
|
} catch (error) {
|
|
6330
7147
|
if (callbacks?.onError) callbacks.onError(error);
|
|
6331
7148
|
else console.debug("onError callback not provided:", error);
|
|
@@ -6440,7 +7257,7 @@ const useCreateListing = ({ listingInput, chainId, collectionAddress, orderbookK
|
|
|
6440
7257
|
const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
|
|
6441
7258
|
const collectionConfig = marketplaceConfig?.market.collections.find((c) => compareAddress(c.itemsAddress, collectionAddress));
|
|
6442
7259
|
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? OrderbookKind.sequence_marketplace_v2;
|
|
6443
|
-
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData$2({
|
|
7260
|
+
const { data: tokenApproval, isLoading: tokenApprovalIsLoading, isError, error } = useGetTokenApprovalData$2({
|
|
6444
7261
|
chainId,
|
|
6445
7262
|
tokenId: listingInput.listing.tokenId,
|
|
6446
7263
|
collectionAddress,
|
|
@@ -6466,7 +7283,9 @@ const useCreateListing = ({ listingInput, chainId, collectionAddress, orderbookK
|
|
|
6466
7283
|
executeApproval,
|
|
6467
7284
|
createListing,
|
|
6468
7285
|
tokenApprovalStepExists: tokenApproval?.step !== null,
|
|
6469
|
-
tokenApprovalIsLoading
|
|
7286
|
+
tokenApprovalIsLoading,
|
|
7287
|
+
isError,
|
|
7288
|
+
error
|
|
6470
7289
|
};
|
|
6471
7290
|
};
|
|
6472
7291
|
|
|
@@ -6501,7 +7320,7 @@ const initialState$1 = {
|
|
|
6501
7320
|
listingPrice: { ...listingPrice },
|
|
6502
7321
|
quantity: "1",
|
|
6503
7322
|
invalidQuantity: false,
|
|
6504
|
-
expiry: new Date(addDays$1(
|
|
7323
|
+
expiry: new Date(addDays$1(new Date(), 7).toJSON()),
|
|
6505
7324
|
callbacks: void 0,
|
|
6506
7325
|
steps: { ...steps$1 },
|
|
6507
7326
|
listingIsBeingProcessed: false
|
|
@@ -6542,7 +7361,12 @@ const CreateListingModal = () => {
|
|
|
6542
7361
|
});
|
|
6543
7362
|
};
|
|
6544
7363
|
const Modal$3 = observer(() => {
|
|
6545
|
-
const
|
|
7364
|
+
const state = createListingModal$.get();
|
|
7365
|
+
const { collectionAddress, chainId, listingPrice: listingPrice$1, collectibleId, orderbookKind: orderbookKindProp, callbacks, listingIsBeingProcessed } = state;
|
|
7366
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
7367
|
+
const [error, setError] = useState(void 0);
|
|
7368
|
+
const collectionConfig = marketplaceConfig?.market.collections.find((c) => c.itemsAddress === collectionAddress);
|
|
7369
|
+
const orderbookKind = orderbookKindProp ?? collectionConfig?.destinationMarketplace;
|
|
6546
7370
|
const steps$ = createListingModal$.steps;
|
|
6547
7371
|
const { isWaaS } = useConnectorMetadata();
|
|
6548
7372
|
const { isVisible: feeOptionsVisible, selectedFeeOption } = useSelectWaasFeeOptionsStore();
|
|
@@ -6573,8 +7397,8 @@ const Modal$3 = observer(() => {
|
|
|
6573
7397
|
collectableId: collectibleId,
|
|
6574
7398
|
userAddress: address ?? void 0
|
|
6575
7399
|
});
|
|
6576
|
-
const balanceWithDecimals = balance?.balance ?
|
|
6577
|
-
const { isLoading, executeApproval, createListing, tokenApprovalIsLoading } = useCreateListing({
|
|
7400
|
+
const balanceWithDecimals = balance?.balance ? dnum.toNumber(dnum.from([BigInt(balance.balance), collectible?.decimals || 0])) : 0;
|
|
7401
|
+
const { isLoading, executeApproval, createListing, tokenApprovalIsLoading, isError: tokenApprovalIsError } = useCreateListing({
|
|
6578
7402
|
listingInput: {
|
|
6579
7403
|
contractType: collection?.type,
|
|
6580
7404
|
listing: {
|
|
@@ -6592,7 +7416,7 @@ const Modal$3 = observer(() => {
|
|
|
6592
7416
|
closeMainModal: () => createListingModal$.close(),
|
|
6593
7417
|
steps$
|
|
6594
7418
|
});
|
|
6595
|
-
if (collectableIsError || collectionIsError || currenciesIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7419
|
+
if (collectableIsError || collectionIsError || currenciesIsError || tokenApprovalIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
6596
7420
|
isOpen: createListingModal$.isOpen.get(),
|
|
6597
7421
|
chainId: Number(chainId),
|
|
6598
7422
|
onClose: createListingModal$.close,
|
|
@@ -6610,17 +7434,24 @@ const Modal$3 = observer(() => {
|
|
|
6610
7434
|
try {
|
|
6611
7435
|
if (isWaaS) selectWaasFeeOptionsStore.send({ type: "show" });
|
|
6612
7436
|
await createListing({ isTransactionExecuting: !!isWaaS });
|
|
6613
|
-
} catch (error) {
|
|
6614
|
-
console.error("Create listing failed:", error);
|
|
7437
|
+
} catch (error$1) {
|
|
7438
|
+
console.error("Create listing failed:", error$1);
|
|
7439
|
+
setError(error$1);
|
|
6615
7440
|
} finally {
|
|
6616
7441
|
createListingModal$.listingIsBeingProcessed.set(false);
|
|
6617
7442
|
steps$.transaction.isExecuting.set(false);
|
|
6618
7443
|
}
|
|
6619
7444
|
};
|
|
7445
|
+
const handleApproveToken = async () => {
|
|
7446
|
+
await executeApproval().catch((error$1) => {
|
|
7447
|
+
console.error("Approve TOKEN failed:", error$1);
|
|
7448
|
+
setError(error$1);
|
|
7449
|
+
});
|
|
7450
|
+
};
|
|
6620
7451
|
const listCtaLabel = getActionLabel("List item for sale");
|
|
6621
7452
|
const ctas = [{
|
|
6622
7453
|
label: "Approve TOKEN",
|
|
6623
|
-
onClick:
|
|
7454
|
+
onClick: handleApproveToken,
|
|
6624
7455
|
hidden: !steps$.approval.exist.get(),
|
|
6625
7456
|
pending: steps$?.approval.isExecuting.get(),
|
|
6626
7457
|
variant: "glass",
|
|
@@ -6663,7 +7494,9 @@ const Modal$3 = observer(() => {
|
|
|
6663
7494
|
onCurrencyChange: (newCurrency) => {
|
|
6664
7495
|
createListingModal$.listingPrice.currency.set(newCurrency);
|
|
6665
7496
|
},
|
|
6666
|
-
disabled: shouldHideListButton
|
|
7497
|
+
disabled: shouldHideListButton,
|
|
7498
|
+
orderbookKind,
|
|
7499
|
+
modalType: "listing"
|
|
6667
7500
|
}), listingPrice$1.amountRaw !== "0" && /* @__PURE__ */ jsx(FloorPriceText, {
|
|
6668
7501
|
tokenId: collectibleId,
|
|
6669
7502
|
chainId,
|
|
@@ -6700,6 +7533,11 @@ const Modal$3 = observer(() => {
|
|
|
6700
7533
|
steps$.transaction.isExecuting.set(false);
|
|
6701
7534
|
},
|
|
6702
7535
|
titleOnConfirm: "Processing listing..."
|
|
7536
|
+
}),
|
|
7537
|
+
error && /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
7538
|
+
title: "An error occurred while listing",
|
|
7539
|
+
message: "Please try again",
|
|
7540
|
+
error
|
|
6703
7541
|
})
|
|
6704
7542
|
]
|
|
6705
7543
|
});
|
|
@@ -6722,7 +7560,7 @@ const useBuyModal = (callbacks) => {
|
|
|
6722
7560
|
|
|
6723
7561
|
//#endregion
|
|
6724
7562
|
//#region src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx
|
|
6725
|
-
const ONE_DAY_IN_SECONDS =
|
|
7563
|
+
const ONE_DAY_IN_SECONDS = 60 * 60 * 24;
|
|
6726
7564
|
const useGetTokenApprovalData$1 = (params) => {
|
|
6727
7565
|
const config = useConfig();
|
|
6728
7566
|
const { address } = useAccount();
|
|
@@ -6733,10 +7571,10 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6733
7571
|
quantity: "1",
|
|
6734
7572
|
currencyAddress: params.currencyAddress,
|
|
6735
7573
|
pricePerToken: "1",
|
|
6736
|
-
expiry: String(Number(dateToUnixTime(
|
|
7574
|
+
expiry: String(Number(dateToUnixTime(new Date())) + ONE_DAY_IN_SECONDS)
|
|
6737
7575
|
};
|
|
6738
7576
|
const isEnabled = address && params.query?.enabled !== false;
|
|
6739
|
-
const { data, isLoading, isSuccess } = useQuery({
|
|
7577
|
+
const { data, isLoading, isSuccess, isError, error } = useQuery({
|
|
6740
7578
|
queryKey: ["token-approval-data", params.currencyAddress],
|
|
6741
7579
|
queryFn: isEnabled ? async () => {
|
|
6742
7580
|
const args = {
|
|
@@ -6746,9 +7584,12 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6746
7584
|
walletType: walletKind,
|
|
6747
7585
|
contractType: params.contractType,
|
|
6748
7586
|
orderbook: params.orderbook,
|
|
6749
|
-
offer
|
|
7587
|
+
offer,
|
|
7588
|
+
additionalFees: [],
|
|
7589
|
+
offerType: OfferType.item
|
|
6750
7590
|
};
|
|
6751
|
-
const
|
|
7591
|
+
const steps$2 = await marketplaceClient.generateOfferTransaction(args).then((resp) => resp.steps);
|
|
7592
|
+
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
6752
7593
|
if (!tokenApprovalStep) return { step: null };
|
|
6753
7594
|
return { step: tokenApprovalStep };
|
|
6754
7595
|
} : skipToken,
|
|
@@ -6757,7 +7598,9 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6757
7598
|
return {
|
|
6758
7599
|
data,
|
|
6759
7600
|
isLoading,
|
|
6760
|
-
isSuccess
|
|
7601
|
+
isSuccess,
|
|
7602
|
+
isError,
|
|
7603
|
+
error
|
|
6761
7604
|
};
|
|
6762
7605
|
};
|
|
6763
7606
|
|
|
@@ -6784,7 +7627,7 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6784
7627
|
const getOfferSteps = async () => {
|
|
6785
7628
|
if (!address) return;
|
|
6786
7629
|
try {
|
|
6787
|
-
|
|
7630
|
+
const steps$2 = await generateOfferTransactionAsync({
|
|
6788
7631
|
collectionAddress,
|
|
6789
7632
|
maker: address,
|
|
6790
7633
|
walletType: walletKind,
|
|
@@ -6792,9 +7635,12 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6792
7635
|
orderbook: orderbookKind,
|
|
6793
7636
|
offer: {
|
|
6794
7637
|
...offerInput.offer,
|
|
6795
|
-
expiry:
|
|
6796
|
-
}
|
|
7638
|
+
expiry: new Date(Number(offerInput.offer.expiry) * 1e3)
|
|
7639
|
+
},
|
|
7640
|
+
additionalFees: [],
|
|
7641
|
+
offerType: OfferType.item
|
|
6797
7642
|
});
|
|
7643
|
+
return steps$2;
|
|
6798
7644
|
} catch (error) {
|
|
6799
7645
|
if (callbacks?.onError) callbacks.onError(error);
|
|
6800
7646
|
else console.debug("onError callback not provided:", error);
|
|
@@ -6860,6 +7706,10 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6860
7706
|
steps$.transaction.isExecuting.set(false);
|
|
6861
7707
|
steps$.transaction.exist.set(false);
|
|
6862
7708
|
}
|
|
7709
|
+
if (orderId) {
|
|
7710
|
+
steps$.transaction.isExecuting.set(false);
|
|
7711
|
+
steps$.transaction.exist.set(false);
|
|
7712
|
+
}
|
|
6863
7713
|
if (hash || orderId) {
|
|
6864
7714
|
const currencyDecimal = currency?.decimals || 0;
|
|
6865
7715
|
const currencyValueRaw = Number(offerInput.offer.pricePerToken);
|
|
@@ -6898,17 +7748,13 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6898
7748
|
//#endregion
|
|
6899
7749
|
//#region src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx
|
|
6900
7750
|
const useMakeOffer = ({ offerInput, chainId, collectionAddress, orderbookKind, callbacks, closeMainModal, steps$ }) => {
|
|
6901
|
-
const { data:
|
|
6902
|
-
const collectionConfig = marketplaceConfig?.market.collections.find((c) => c.itemsAddress === collectionAddress);
|
|
6903
|
-
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? OrderbookKind.sequence_marketplace_v2;
|
|
6904
|
-
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData$1({
|
|
7751
|
+
const { data: tokenApproval, isLoading: tokenApprovalIsLoading, isError, error } = useGetTokenApprovalData$1({
|
|
6905
7752
|
chainId,
|
|
6906
7753
|
tokenId: offerInput.offer.tokenId,
|
|
6907
7754
|
collectionAddress,
|
|
6908
7755
|
currencyAddress: offerInput.offer.currencyAddress,
|
|
6909
7756
|
contractType: offerInput.contractType,
|
|
6910
|
-
orderbook: orderbookKind
|
|
6911
|
-
query: { enabled: !marketplaceIsLoading }
|
|
7757
|
+
orderbook: orderbookKind || OrderbookKind.sequence_marketplace_v2
|
|
6912
7758
|
});
|
|
6913
7759
|
useEffect(() => {
|
|
6914
7760
|
if (!tokenApprovalIsLoading) steps$.approval.exist.set(!!tokenApproval?.step);
|
|
@@ -6927,7 +7773,9 @@ const useMakeOffer = ({ offerInput, chainId, collectionAddress, orderbookKind, c
|
|
|
6927
7773
|
executeApproval,
|
|
6928
7774
|
makeOffer,
|
|
6929
7775
|
tokenApprovalStepExists: tokenApproval?.step !== null,
|
|
6930
|
-
tokenApprovalIsLoading
|
|
7776
|
+
tokenApprovalIsLoading,
|
|
7777
|
+
isError,
|
|
7778
|
+
error
|
|
6931
7779
|
};
|
|
6932
7780
|
};
|
|
6933
7781
|
|
|
@@ -6962,7 +7810,7 @@ const initialState = {
|
|
|
6962
7810
|
offerPriceChanged: false,
|
|
6963
7811
|
quantity: "1",
|
|
6964
7812
|
invalidQuantity: false,
|
|
6965
|
-
expiry: new Date(addDays$1(
|
|
7813
|
+
expiry: new Date(addDays$1(new Date(), 7).toJSON()),
|
|
6966
7814
|
collectionType: void 0,
|
|
6967
7815
|
steps: { ...steps },
|
|
6968
7816
|
offerIsBeingProcessed: false
|
|
@@ -7001,9 +7849,15 @@ const MakeOfferModal = () => {
|
|
|
7001
7849
|
});
|
|
7002
7850
|
};
|
|
7003
7851
|
const Modal$2 = observer(() => {
|
|
7004
|
-
const
|
|
7852
|
+
const state = makeOfferModal$.get();
|
|
7853
|
+
const { collectionAddress, chainId, offerPrice: offerPrice$1, offerPriceChanged, invalidQuantity, collectibleId, orderbookKind: orderbookKindProp, callbacks } = state;
|
|
7854
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
7855
|
+
const [error, setError] = useState(void 0);
|
|
7856
|
+
const collectionConfig = marketplaceConfig?.market.collections.find((c) => c.itemsAddress === collectionAddress);
|
|
7857
|
+
const orderbookKind = orderbookKindProp ?? collectionConfig?.destinationMarketplace;
|
|
7005
7858
|
const steps$ = makeOfferModal$.steps;
|
|
7006
7859
|
const [insufficientBalance, setInsufficientBalance] = useState(false);
|
|
7860
|
+
const [openseaLowestPriceCriteriaMet, setOpenseaLowestPriceCriteriaMet] = useState(true);
|
|
7007
7861
|
const { data: collectible, isLoading: collectableIsLoading, isError: collectableIsError } = useCollectible({
|
|
7008
7862
|
chainId,
|
|
7009
7863
|
collectionAddress,
|
|
@@ -7023,10 +7877,16 @@ const Modal$2 = observer(() => {
|
|
|
7023
7877
|
});
|
|
7024
7878
|
const { data: currencies, isLoading: currenciesLoading, isError: currenciesIsError } = useMarketCurrencies({
|
|
7025
7879
|
chainId,
|
|
7880
|
+
collectionAddress,
|
|
7026
7881
|
includeNativeCurrency: false
|
|
7027
7882
|
});
|
|
7028
|
-
const
|
|
7029
|
-
|
|
7883
|
+
const { data: royalty, isLoading: royaltyLoading } = useRoyalty({
|
|
7884
|
+
chainId,
|
|
7885
|
+
collectionAddress,
|
|
7886
|
+
collectibleId
|
|
7887
|
+
});
|
|
7888
|
+
const modalLoading = collectableIsLoading || collectionIsLoading || currenciesLoading || royaltyLoading;
|
|
7889
|
+
const { isLoading, executeApproval, makeOffer, isError: approvalIsError } = useMakeOffer({
|
|
7030
7890
|
offerInput: {
|
|
7031
7891
|
contractType: collection?.type,
|
|
7032
7892
|
offer: {
|
|
@@ -7039,8 +7899,8 @@ const Modal$2 = observer(() => {
|
|
|
7039
7899
|
},
|
|
7040
7900
|
chainId,
|
|
7041
7901
|
collectionAddress,
|
|
7042
|
-
orderbookKind,
|
|
7043
7902
|
callbacks,
|
|
7903
|
+
orderbookKind,
|
|
7044
7904
|
closeMainModal: () => makeOfferModal$.close(),
|
|
7045
7905
|
steps$
|
|
7046
7906
|
});
|
|
@@ -7051,13 +7911,14 @@ const Modal$2 = observer(() => {
|
|
|
7051
7911
|
collectionAddress,
|
|
7052
7912
|
filter: { currencies: [offerPrice$1.currency.contractAddress] }
|
|
7053
7913
|
});
|
|
7054
|
-
if (collectableIsError || collectionIsError || currenciesIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7914
|
+
if (collectableIsError || collectionIsError || currenciesIsError || approvalIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7055
7915
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
7056
7916
|
chainId: Number(chainId),
|
|
7057
7917
|
onClose: makeOfferModal$.close,
|
|
7058
7918
|
title: "Make an offer"
|
|
7059
7919
|
});
|
|
7060
|
-
|
|
7920
|
+
const shouldShowNoERC20Error = !currenciesLoading && !currenciesIsError && (!currencies || currencies.length === 0);
|
|
7921
|
+
if (shouldShowNoERC20Error) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7061
7922
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
7062
7923
|
chainId: Number(chainId),
|
|
7063
7924
|
onClose: makeOfferModal$.close,
|
|
@@ -7069,26 +7930,33 @@ const Modal$2 = observer(() => {
|
|
|
7069
7930
|
try {
|
|
7070
7931
|
if (isWaaS) selectWaasFeeOptionsStore.send({ type: "show" });
|
|
7071
7932
|
await makeOffer({ isTransactionExecuting: isWaaS ? getNetwork(Number(chainId)).type !== NetworkType.TESTNET : false });
|
|
7072
|
-
} catch (error) {
|
|
7073
|
-
console.error("Make offer failed:", error);
|
|
7933
|
+
} catch (error$1) {
|
|
7934
|
+
console.error("Make offer failed:", error$1);
|
|
7935
|
+
setError(error$1);
|
|
7074
7936
|
} finally {
|
|
7075
7937
|
makeOfferModal$.offerIsBeingProcessed.set(false);
|
|
7076
7938
|
steps$.transaction.isExecuting.set(false);
|
|
7077
7939
|
}
|
|
7078
7940
|
};
|
|
7941
|
+
const handleApproveToken = async () => {
|
|
7942
|
+
await executeApproval().catch((error$1) => {
|
|
7943
|
+
console.error("Approve TOKEN failed:", error$1);
|
|
7944
|
+
setError(error$1);
|
|
7945
|
+
});
|
|
7946
|
+
};
|
|
7079
7947
|
const offerCtaLabel = getActionLabel("Make offer");
|
|
7080
7948
|
const ctas = [{
|
|
7081
7949
|
label: "Approve TOKEN",
|
|
7082
|
-
onClick:
|
|
7950
|
+
onClick: handleApproveToken,
|
|
7083
7951
|
hidden: !steps$.approval.exist.get(),
|
|
7084
7952
|
pending: steps$.approval.isExecuting.get(),
|
|
7085
7953
|
variant: "glass",
|
|
7086
|
-
disabled: invalidQuantity || isLoading || insufficientBalance || offerPrice$1.amountRaw === "0" || !offerPriceChanged
|
|
7954
|
+
disabled: invalidQuantity || isLoading || insufficientBalance || offerPrice$1.amountRaw === "0" || !offerPriceChanged || orderbookKind === OrderbookKind.opensea && !openseaLowestPriceCriteriaMet
|
|
7087
7955
|
}, {
|
|
7088
7956
|
label: offerCtaLabel,
|
|
7089
7957
|
onClick: () => handleMakeOffer(),
|
|
7090
7958
|
pending: steps$?.transaction.isExecuting.get() || makeOfferModal$.offerIsBeingProcessed.get(),
|
|
7091
|
-
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice$1.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity
|
|
7959
|
+
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice$1.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity || orderbookKind === OrderbookKind.opensea && !openseaLowestPriceCriteriaMet
|
|
7092
7960
|
}];
|
|
7093
7961
|
return /* @__PURE__ */ jsxs(ActionModal, {
|
|
7094
7962
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
@@ -7124,9 +7992,13 @@ const Modal$2 = observer(() => {
|
|
|
7124
7992
|
includeNativeCurrency: false,
|
|
7125
7993
|
checkBalance: {
|
|
7126
7994
|
enabled: true,
|
|
7127
|
-
callback: (state) => setInsufficientBalance(state)
|
|
7995
|
+
callback: (state$1) => setInsufficientBalance(state$1)
|
|
7128
7996
|
},
|
|
7129
|
-
|
|
7997
|
+
setOpenseaLowestPriceCriteriaMet: (state$1) => setOpenseaLowestPriceCriteriaMet(state$1),
|
|
7998
|
+
orderbookKind,
|
|
7999
|
+
modalType: "offer",
|
|
8000
|
+
disabled: shouldHideOfferButton,
|
|
8001
|
+
feeData: { royaltyPercentage: royalty ? Number(royalty.percentage) : 0 }
|
|
7130
8002
|
}),
|
|
7131
8003
|
collection?.type === ContractType.ERC1155 && /* @__PURE__ */ jsx(QuantityInput, {
|
|
7132
8004
|
quantity: use$(makeOfferModal$.quantity),
|
|
@@ -7165,6 +8037,11 @@ const Modal$2 = observer(() => {
|
|
|
7165
8037
|
steps$.transaction.isExecuting.set(false);
|
|
7166
8038
|
},
|
|
7167
8039
|
titleOnConfirm: "Processing offer..."
|
|
8040
|
+
}),
|
|
8041
|
+
error && /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
8042
|
+
title: "An error occurred while making an offer",
|
|
8043
|
+
message: "Please try again",
|
|
8044
|
+
error
|
|
7168
8045
|
})
|
|
7169
8046
|
]
|
|
7170
8047
|
});
|
|
@@ -7207,7 +8084,7 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7207
8084
|
chainId: Number(params.chainId),
|
|
7208
8085
|
collectionAddress: params.collectionAddress
|
|
7209
8086
|
});
|
|
7210
|
-
const { data, isLoading, isSuccess } = useQuery({
|
|
8087
|
+
const { data, isLoading, isSuccess, isError, error } = useQuery({
|
|
7211
8088
|
queryKey: ["token-approval-data", params.ordersData],
|
|
7212
8089
|
queryFn: address ? async () => {
|
|
7213
8090
|
const args = {
|
|
@@ -7222,7 +8099,8 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7222
8099
|
receiver
|
|
7223
8100
|
}]
|
|
7224
8101
|
};
|
|
7225
|
-
const
|
|
8102
|
+
const steps$2 = await marketplaceClient.generateSellTransaction(args).then((resp) => resp.steps);
|
|
8103
|
+
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
7226
8104
|
if (!tokenApprovalStep) return { step: null };
|
|
7227
8105
|
return { step: tokenApprovalStep };
|
|
7228
8106
|
} : skipToken,
|
|
@@ -7231,7 +8109,9 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7231
8109
|
return {
|
|
7232
8110
|
data,
|
|
7233
8111
|
isLoading,
|
|
7234
|
-
isSuccess
|
|
8112
|
+
isSuccess,
|
|
8113
|
+
isError,
|
|
8114
|
+
error
|
|
7235
8115
|
};
|
|
7236
8116
|
};
|
|
7237
8117
|
|
|
@@ -7258,7 +8138,7 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7258
8138
|
const getSellSteps = async () => {
|
|
7259
8139
|
if (!address) return;
|
|
7260
8140
|
try {
|
|
7261
|
-
|
|
8141
|
+
const steps$2 = await generateSellTransactionAsync({
|
|
7262
8142
|
collectionAddress,
|
|
7263
8143
|
walletType: walletKind,
|
|
7264
8144
|
marketplace,
|
|
@@ -7269,6 +8149,7 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7269
8149
|
}],
|
|
7270
8150
|
seller: address
|
|
7271
8151
|
});
|
|
8152
|
+
return steps$2;
|
|
7272
8153
|
} catch (error) {
|
|
7273
8154
|
if (callbacks?.onError) callbacks.onError(error);
|
|
7274
8155
|
else console.debug("onError callback not provided:", error);
|
|
@@ -7378,7 +8259,7 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7378
8259
|
//#endregion
|
|
7379
8260
|
//#region src/react/ui/modals/SellModal/hooks/useSell.tsx
|
|
7380
8261
|
const useSell = ({ collectibleId, chainId, collectionAddress, marketplace, ordersData, callbacks, closeMainModal, steps$ }) => {
|
|
7381
|
-
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData({
|
|
8262
|
+
const { data: tokenApproval, isLoading: tokenApprovalIsLoading, isError, error } = useGetTokenApprovalData({
|
|
7382
8263
|
chainId,
|
|
7383
8264
|
collectionAddress,
|
|
7384
8265
|
ordersData,
|
|
@@ -7402,7 +8283,9 @@ const useSell = ({ collectibleId, chainId, collectionAddress, marketplace, order
|
|
|
7402
8283
|
executeApproval,
|
|
7403
8284
|
sell,
|
|
7404
8285
|
tokenApprovalStepExists: tokenApproval?.step !== null,
|
|
7405
|
-
tokenApprovalIsLoading
|
|
8286
|
+
tokenApprovalIsLoading,
|
|
8287
|
+
isError,
|
|
8288
|
+
error
|
|
7406
8289
|
};
|
|
7407
8290
|
};
|
|
7408
8291
|
|
|
@@ -7421,6 +8304,7 @@ const Modal$1 = observer(() => {
|
|
|
7421
8304
|
chainId,
|
|
7422
8305
|
collectionAddress
|
|
7423
8306
|
});
|
|
8307
|
+
const [error, setError] = useState(void 0);
|
|
7424
8308
|
const { data: collection, isLoading: collectionLoading, isError: collectionError } = useCollection({
|
|
7425
8309
|
chainId,
|
|
7426
8310
|
collectionAddress
|
|
@@ -7431,14 +8315,15 @@ const Modal$1 = observer(() => {
|
|
|
7431
8315
|
});
|
|
7432
8316
|
const { isWaaS } = useConnectorMetadata();
|
|
7433
8317
|
const { isVisible: feeOptionsVisible, selectedFeeOption } = useSelectWaasFeeOptionsStore();
|
|
7434
|
-
const
|
|
8318
|
+
const network = getNetwork(Number(chainId));
|
|
8319
|
+
const isTestnet = network.type === NetworkType.TESTNET;
|
|
7435
8320
|
const isProcessing = sellModal$.sellIsBeingProcessed.get();
|
|
7436
8321
|
const { shouldHideActionButton: shouldHideSellButton } = useSelectWaasFeeOptions({
|
|
7437
8322
|
isProcessing,
|
|
7438
8323
|
feeOptionsVisible,
|
|
7439
8324
|
selectedFeeOption
|
|
7440
8325
|
});
|
|
7441
|
-
const { isLoading, executeApproval, sell } = useSell({
|
|
8326
|
+
const { isLoading, executeApproval, sell, isError } = useSell({
|
|
7442
8327
|
collectionAddress,
|
|
7443
8328
|
chainId,
|
|
7444
8329
|
collectibleId: tokenId,
|
|
@@ -7454,7 +8339,7 @@ const Modal$1 = observer(() => {
|
|
|
7454
8339
|
steps$
|
|
7455
8340
|
});
|
|
7456
8341
|
const modalLoading = collectionLoading || currencyLoading;
|
|
7457
|
-
if ((collectionError || order === void 0 || currencyError) && !modalLoading) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
8342
|
+
if ((collectionError || order === void 0 || currencyError || isError) && !modalLoading) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7458
8343
|
isOpen: sellModal$.isOpen.get(),
|
|
7459
8344
|
chainId: Number(chainId),
|
|
7460
8345
|
onClose: sellModal$.close,
|
|
@@ -7465,17 +8350,23 @@ const Modal$1 = observer(() => {
|
|
|
7465
8350
|
try {
|
|
7466
8351
|
if (isWaaS) selectWaasFeeOptionsStore.send({ type: "show" });
|
|
7467
8352
|
await sell({ isTransactionExecuting: isWaaS ? !isTestnet : false });
|
|
7468
|
-
} catch (error) {
|
|
7469
|
-
console.error("Sell failed:", error);
|
|
8353
|
+
} catch (error$1) {
|
|
8354
|
+
console.error("Sell failed:", error$1);
|
|
7470
8355
|
} finally {
|
|
7471
8356
|
sellModal$.sellIsBeingProcessed.set(false);
|
|
7472
8357
|
steps$.transaction.isExecuting.set(false);
|
|
7473
8358
|
}
|
|
7474
8359
|
};
|
|
8360
|
+
const handleApproveToken = async () => {
|
|
8361
|
+
await executeApproval().catch((error$1) => {
|
|
8362
|
+
console.error("Approve TOKEN failed:", error$1);
|
|
8363
|
+
setError(error$1);
|
|
8364
|
+
});
|
|
8365
|
+
};
|
|
7475
8366
|
const sellCtaLabel = isProcessing ? isWaaS && !isTestnet ? "Loading fee options" : "Accept" : "Accept";
|
|
7476
8367
|
const ctas = [{
|
|
7477
8368
|
label: "Approve TOKEN",
|
|
7478
|
-
onClick:
|
|
8369
|
+
onClick: handleApproveToken,
|
|
7479
8370
|
hidden: !steps$.approval.exist.get(),
|
|
7480
8371
|
pending: steps$.approval.isExecuting.get(),
|
|
7481
8372
|
variant: "glass",
|
|
@@ -7530,6 +8421,11 @@ const Modal$1 = observer(() => {
|
|
|
7530
8421
|
steps$.transaction.isExecuting.set(false);
|
|
7531
8422
|
},
|
|
7532
8423
|
titleOnConfirm: "Accepting offer..."
|
|
8424
|
+
}),
|
|
8425
|
+
error && /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
8426
|
+
title: "An error occurred while selling",
|
|
8427
|
+
message: error.message,
|
|
8428
|
+
error
|
|
7533
8429
|
})
|
|
7534
8430
|
]
|
|
7535
8431
|
});
|
|
@@ -7774,12 +8670,13 @@ const TokenQuantityInput = ({ balanceAmount, collection, isProcessingWithWaaS })
|
|
|
7774
8670
|
const [invalidQuantity, setInvalidQuantity] = useState(false);
|
|
7775
8671
|
let insufficientBalance = true;
|
|
7776
8672
|
if (balanceAmount !== void 0 && modalState.quantity) try {
|
|
7777
|
-
|
|
8673
|
+
const quantityBigInt = BigInt(modalState.quantity);
|
|
8674
|
+
insufficientBalance = quantityBigInt > balanceAmount;
|
|
7778
8675
|
} catch (_e) {
|
|
7779
8676
|
insufficientBalance = true;
|
|
7780
8677
|
}
|
|
7781
8678
|
return /* @__PURE__ */ jsxs("div", {
|
|
7782
|
-
className: cn("flex flex-col gap-3", isProcessingWithWaaS && "pointer-events-none opacity-50"),
|
|
8679
|
+
className: cn$1("flex flex-col gap-3", isProcessingWithWaaS && "pointer-events-none opacity-50"),
|
|
7783
8680
|
children: [/* @__PURE__ */ jsx(QuantityInput, {
|
|
7784
8681
|
quantity: modalState.quantity,
|
|
7785
8682
|
invalidQuantity,
|
|
@@ -7852,7 +8749,8 @@ const MAX_WALLET_ADDRESS_LENGTH = 42;
|
|
|
7852
8749
|
const WalletAddressInput = () => {
|
|
7853
8750
|
const { address: connectedAddress } = useAccount();
|
|
7854
8751
|
const { receiverAddress, transferIsProcessing } = useModalState();
|
|
7855
|
-
const
|
|
8752
|
+
const isWalletAddressValid = isAddress(receiverAddress);
|
|
8753
|
+
const isSelfTransfer = isWalletAddressValid && connectedAddress && receiverAddress.toLowerCase() === connectedAddress.toLowerCase();
|
|
7856
8754
|
const handleChangeWalletAddress = (event) => {
|
|
7857
8755
|
transferModalStore.send({
|
|
7858
8756
|
type: "updateTransferDetails",
|
|
@@ -7965,7 +8863,8 @@ const EnterWalletAddressView = () => {
|
|
|
7965
8863
|
const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
|
|
7966
8864
|
let insufficientBalance = true;
|
|
7967
8865
|
if (balanceAmount !== void 0 && quantity) try {
|
|
7968
|
-
|
|
8866
|
+
const quantityBigInt = BigInt(quantity);
|
|
8867
|
+
insufficientBalance = quantityBigInt > BigInt(balanceAmount);
|
|
7969
8868
|
} catch (_e) {
|
|
7970
8869
|
insufficientBalance = true;
|
|
7971
8870
|
}
|
|
@@ -7983,7 +8882,8 @@ const EnterWalletAddressView = () => {
|
|
|
7983
8882
|
console.error("Transfer failed:", error);
|
|
7984
8883
|
}
|
|
7985
8884
|
};
|
|
7986
|
-
const
|
|
8885
|
+
const isErc1155 = collection?.type === ContractType.ERC1155;
|
|
8886
|
+
const showQuantityInput = isErc1155 && !!balanceAmount;
|
|
7987
8887
|
const isTransferDisabled = transferIsProcessing || !isWalletAddressValid || insufficientBalance || !quantity || Number(quantity) === 0 || isSelfTransfer;
|
|
7988
8888
|
return /* @__PURE__ */ jsxs("div", {
|
|
7989
8889
|
className: "grid grow gap-6",
|
|
@@ -8111,7 +9011,7 @@ const TransferModal = () => {
|
|
|
8111
9011
|
onCancel: () => {
|
|
8112
9012
|
transferModalStore.send({
|
|
8113
9013
|
type: "failTransfer",
|
|
8114
|
-
error:
|
|
9014
|
+
error: new Error("Transfer cancelled")
|
|
8115
9015
|
});
|
|
8116
9016
|
},
|
|
8117
9017
|
titleOnConfirm: "Processing transfer...",
|
|
@@ -8151,14 +9051,19 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8151
9051
|
--tw-gradient-via-position: 50%;
|
|
8152
9052
|
--tw-gradient-to-position: 100%;
|
|
8153
9053
|
}
|
|
8154
|
-
/*! tailwindcss v4.1.
|
|
9054
|
+
/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */
|
|
8155
9055
|
@layer properties;
|
|
8156
9056
|
@layer theme, base, components, utilities;
|
|
8157
9057
|
@layer theme {
|
|
8158
9058
|
:root, :host {
|
|
8159
9059
|
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
|
|
8160
9060
|
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
9061
|
+
--color-red-100: oklch(93.6% 0.032 17.717);
|
|
9062
|
+
--color-red-300: oklch(80.8% 0.114 19.571);
|
|
9063
|
+
--color-red-400: oklch(70.4% 0.191 22.216);
|
|
8161
9064
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
9065
|
+
--color-red-900: oklch(39.6% 0.141 25.723);
|
|
9066
|
+
--color-red-950: oklch(25.8% 0.092 26.042);
|
|
8162
9067
|
--color-green-500: oklch(72.3% 0.219 149.579);
|
|
8163
9068
|
--color-blue-500: oklch(62.3% 0.214 259.815);
|
|
8164
9069
|
--color-indigo-400: oklch(67.3% 0.182 276.935);
|
|
@@ -8576,6 +9481,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8576
9481
|
.ml-5 {
|
|
8577
9482
|
margin-left: calc(var(--spacing) * 5);
|
|
8578
9483
|
}
|
|
9484
|
+
.ml-10 {
|
|
9485
|
+
margin-left: calc(var(--spacing) * 10);
|
|
9486
|
+
}
|
|
8579
9487
|
.block {
|
|
8580
9488
|
display: block;
|
|
8581
9489
|
}
|
|
@@ -8699,6 +9607,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8699
9607
|
.h-px {
|
|
8700
9608
|
height: 1px;
|
|
8701
9609
|
}
|
|
9610
|
+
.max-h-96 {
|
|
9611
|
+
max-height: calc(var(--spacing) * 96);
|
|
9612
|
+
}
|
|
8702
9613
|
.max-h-\[240px\] {
|
|
8703
9614
|
max-height: 240px;
|
|
8704
9615
|
}
|
|
@@ -8855,6 +9766,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8855
9766
|
.flex-shrink {
|
|
8856
9767
|
flex-shrink: 1;
|
|
8857
9768
|
}
|
|
9769
|
+
.flex-shrink-0 {
|
|
9770
|
+
flex-shrink: 0;
|
|
9771
|
+
}
|
|
8858
9772
|
.shrink-0 {
|
|
8859
9773
|
flex-shrink: 0;
|
|
8860
9774
|
}
|
|
@@ -9111,6 +10025,10 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9111
10025
|
border-style: var(--tw-border-style);
|
|
9112
10026
|
border-width: 2px;
|
|
9113
10027
|
}
|
|
10028
|
+
.border-t {
|
|
10029
|
+
border-top-style: var(--tw-border-style);
|
|
10030
|
+
border-top-width: 1px;
|
|
10031
|
+
}
|
|
9114
10032
|
.border-b-2 {
|
|
9115
10033
|
border-bottom-style: var(--tw-border-style);
|
|
9116
10034
|
border-bottom-width: 2px;
|
|
@@ -9142,6 +10060,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9142
10060
|
.border-border-normal {
|
|
9143
10061
|
border-color: var(--seq-color-border-normal);
|
|
9144
10062
|
}
|
|
10063
|
+
.border-red-900 {
|
|
10064
|
+
border-color: var(--color-red-900);
|
|
10065
|
+
}
|
|
9145
10066
|
.border-transparent {
|
|
9146
10067
|
border-color: transparent;
|
|
9147
10068
|
}
|
|
@@ -9154,6 +10075,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9154
10075
|
.border-b-transparent {
|
|
9155
10076
|
border-bottom-color: transparent;
|
|
9156
10077
|
}
|
|
10078
|
+
.bg-\[\#2b0000\] {
|
|
10079
|
+
background-color: #2b0000;
|
|
10080
|
+
}
|
|
9157
10081
|
.bg-\[\#35a554\] {
|
|
9158
10082
|
background-color: #35a554;
|
|
9159
10083
|
}
|
|
@@ -9226,6 +10150,12 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9226
10150
|
.bg-red-500 {
|
|
9227
10151
|
background-color: var(--color-red-500);
|
|
9228
10152
|
}
|
|
10153
|
+
.bg-red-900 {
|
|
10154
|
+
background-color: var(--color-red-900);
|
|
10155
|
+
}
|
|
10156
|
+
.bg-red-950 {
|
|
10157
|
+
background-color: var(--color-red-950);
|
|
10158
|
+
}
|
|
9229
10159
|
.bg-surface-neutral {
|
|
9230
10160
|
background-color: var(--color-surface-neutral);
|
|
9231
10161
|
}
|
|
@@ -9535,12 +10465,18 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9535
10465
|
--tw-tracking: var(--tracking-widest);
|
|
9536
10466
|
letter-spacing: var(--tracking-widest);
|
|
9537
10467
|
}
|
|
10468
|
+
.break-words {
|
|
10469
|
+
overflow-wrap: break-word;
|
|
10470
|
+
}
|
|
9538
10471
|
.text-ellipsis {
|
|
9539
10472
|
text-overflow: ellipsis;
|
|
9540
10473
|
}
|
|
9541
10474
|
.whitespace-nowrap {
|
|
9542
10475
|
white-space: nowrap;
|
|
9543
10476
|
}
|
|
10477
|
+
.whitespace-pre-wrap {
|
|
10478
|
+
white-space: pre-wrap;
|
|
10479
|
+
}
|
|
9544
10480
|
.text-background-raised {
|
|
9545
10481
|
color: var(--seq-color-background-raised);
|
|
9546
10482
|
}
|
|
@@ -9577,6 +10513,15 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9577
10513
|
.text-primary {
|
|
9578
10514
|
color: var(--seq-color-primary);
|
|
9579
10515
|
}
|
|
10516
|
+
.text-red-100 {
|
|
10517
|
+
color: var(--color-red-100);
|
|
10518
|
+
}
|
|
10519
|
+
.text-red-300 {
|
|
10520
|
+
color: var(--color-red-300);
|
|
10521
|
+
}
|
|
10522
|
+
.text-red-400 {
|
|
10523
|
+
color: var(--color-red-400);
|
|
10524
|
+
}
|
|
9580
10525
|
.text-red-500 {
|
|
9581
10526
|
color: var(--color-red-500);
|
|
9582
10527
|
}
|
|
@@ -10149,6 +11094,13 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10149
11094
|
}
|
|
10150
11095
|
}
|
|
10151
11096
|
}
|
|
11097
|
+
.hover\:text-red-300 {
|
|
11098
|
+
&:hover {
|
|
11099
|
+
@media (hover: hover) {
|
|
11100
|
+
color: var(--color-red-300);
|
|
11101
|
+
}
|
|
11102
|
+
}
|
|
11103
|
+
}
|
|
10152
11104
|
.hover\:text-text-80 {
|
|
10153
11105
|
&:hover {
|
|
10154
11106
|
@media (hover: hover) {
|
|
@@ -10540,6 +11492,11 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10540
11492
|
display: flex;
|
|
10541
11493
|
}
|
|
10542
11494
|
}
|
|
11495
|
+
.\[\&\>label\]\:w-16 {
|
|
11496
|
+
&>label {
|
|
11497
|
+
width: calc(var(--spacing) * 16);
|
|
11498
|
+
}
|
|
11499
|
+
}
|
|
10543
11500
|
.\[\&\>label\]\:w-full {
|
|
10544
11501
|
&>label {
|
|
10545
11502
|
width: 100%;
|
|
@@ -11128,6 +12085,103 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
11128
12085
|
.rdp-caption_before_exit {
|
|
11129
12086
|
animation: rdp-fade_out var(--rdp-animation_duration) var(--rdp-animation_timing) forwards;
|
|
11130
12087
|
}
|
|
12088
|
+
.rdp-root {
|
|
12089
|
+
width: 100% !important;
|
|
12090
|
+
padding: 0 !important;
|
|
12091
|
+
user-select: none;
|
|
12092
|
+
}
|
|
12093
|
+
.rdp-nav {
|
|
12094
|
+
position: absolute;
|
|
12095
|
+
width: 100%;
|
|
12096
|
+
height: fit-content !important;
|
|
12097
|
+
display: flex;
|
|
12098
|
+
align-items: center;
|
|
12099
|
+
justify-content: space-between;
|
|
12100
|
+
}
|
|
12101
|
+
.rdp-caption_label {
|
|
12102
|
+
color: var(--color-text-100) !important;
|
|
12103
|
+
}
|
|
12104
|
+
.rdp-months {
|
|
12105
|
+
width: 100%;
|
|
12106
|
+
max-width: unset !important;
|
|
12107
|
+
}
|
|
12108
|
+
.rdp-month_caption {
|
|
12109
|
+
text-align: center;
|
|
12110
|
+
width: 100%;
|
|
12111
|
+
height: 36px !important;
|
|
12112
|
+
display: block !important;
|
|
12113
|
+
font-size: 14px !important;
|
|
12114
|
+
}
|
|
12115
|
+
.rdp-month_grid {
|
|
12116
|
+
width: 100%;
|
|
12117
|
+
}
|
|
12118
|
+
.rdp-month {
|
|
12119
|
+
width: 100%;
|
|
12120
|
+
}
|
|
12121
|
+
.rdp-button_previous {
|
|
12122
|
+
background-color: var(--color-overlay-light) !important;
|
|
12123
|
+
border-radius: 50%;
|
|
12124
|
+
}
|
|
12125
|
+
.rdp-button_previous:hover {
|
|
12126
|
+
background-color: var(--color-overlay-glass) !important;
|
|
12127
|
+
}
|
|
12128
|
+
.rdp-button_previous > svg {
|
|
12129
|
+
fill: var(--color-text-100) !important;
|
|
12130
|
+
width: 16px !important;
|
|
12131
|
+
height: 16px !important;
|
|
12132
|
+
}
|
|
12133
|
+
.rdp-button_next {
|
|
12134
|
+
background-color: var(--color-overlay-light) !important;
|
|
12135
|
+
border-radius: 50%;
|
|
12136
|
+
}
|
|
12137
|
+
.rdp-button_next:hover {
|
|
12138
|
+
background-color: var(--color-overlay-glass) !important;
|
|
12139
|
+
}
|
|
12140
|
+
.rdp-button_next > svg {
|
|
12141
|
+
fill: var(--color-text-100) !important;
|
|
12142
|
+
width: 16px !important;
|
|
12143
|
+
height: 16px !important;
|
|
12144
|
+
}
|
|
12145
|
+
.rdp-weekdays {
|
|
12146
|
+
display: flex;
|
|
12147
|
+
justify-content: space-between;
|
|
12148
|
+
}
|
|
12149
|
+
.rdp-weekday {
|
|
12150
|
+
padding: 16px 0 !important;
|
|
12151
|
+
font-size: 14px !important;
|
|
12152
|
+
font-weight: var(--font-weight-medium) !important;
|
|
12153
|
+
color: var(--color-text-80) !important;
|
|
12154
|
+
}
|
|
12155
|
+
.rdp-weeks {
|
|
12156
|
+
display: flex;
|
|
12157
|
+
flex-direction: column;
|
|
12158
|
+
gap: 4px;
|
|
12159
|
+
}
|
|
12160
|
+
.rdp-week {
|
|
12161
|
+
display: flex;
|
|
12162
|
+
justify-content: space-between;
|
|
12163
|
+
}
|
|
12164
|
+
.rdp-day {
|
|
12165
|
+
width: 24px !important;
|
|
12166
|
+
height: 24px !important;
|
|
12167
|
+
}
|
|
12168
|
+
.rdp-day_button {
|
|
12169
|
+
width: 24px !important;
|
|
12170
|
+
height: 24px !important;
|
|
12171
|
+
font-size: var(--text-xs) !important;
|
|
12172
|
+
color: var(--color-text-80) !important;
|
|
12173
|
+
}
|
|
12174
|
+
.rdp-day_button:disabled {
|
|
12175
|
+
color: var(--color-text-50) !important;
|
|
12176
|
+
}
|
|
12177
|
+
.rdp-day.rdp-today {
|
|
12178
|
+
outline: 1px solid var(--color-violet-700) !important;
|
|
12179
|
+
border-radius: 50% !important;
|
|
12180
|
+
}
|
|
12181
|
+
.rdp-day.rdp-selected {
|
|
12182
|
+
background: var(--seq-color-gradient-primary) !important;
|
|
12183
|
+
border-radius: 50% !important;
|
|
12184
|
+
}
|
|
11131
12185
|
@keyframes fadeIn {
|
|
11132
12186
|
0% {
|
|
11133
12187
|
opacity: 0;
|
|
@@ -11463,21 +12517,27 @@ const ShadowRoot = (props) => {
|
|
|
11463
12517
|
//#endregion
|
|
11464
12518
|
//#region src/react/providers/modal-provider.tsx
|
|
11465
12519
|
const ModalProvider = observer(({ children }) => {
|
|
11466
|
-
const
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
12520
|
+
const sdkConfig = useConfig();
|
|
12521
|
+
const { shadowDom, experimentalShadowDomCssOverride } = sdkConfig;
|
|
12522
|
+
const overrides = sdkConfig._internal?.overrides?.api?.marketplace;
|
|
12523
|
+
const marketplaceApiUrl = overrides?.url || marketplaceApiURL(overrides?.env || "production");
|
|
12524
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx(SequenceCheckoutProvider, {
|
|
12525
|
+
config: { env: { marketplaceApiUrl } },
|
|
12526
|
+
children: /* @__PURE__ */ jsxs(ShadowRoot, {
|
|
12527
|
+
enabled: shadowDom ?? true,
|
|
12528
|
+
customCSS: experimentalShadowDomCssOverride,
|
|
12529
|
+
children: [
|
|
12530
|
+
/* @__PURE__ */ jsx(CreateListingModal, {}),
|
|
12531
|
+
/* @__PURE__ */ jsx(MakeOfferModal, {}),
|
|
12532
|
+
/* @__PURE__ */ jsx(TransferModal, {}),
|
|
12533
|
+
/* @__PURE__ */ jsx(SellModal, {}),
|
|
12534
|
+
/* @__PURE__ */ jsx(BuyModal, {}),
|
|
12535
|
+
/* @__PURE__ */ jsx(SuccessfulPurchaseModal_default, {}),
|
|
12536
|
+
/* @__PURE__ */ jsx(switchChainErrorModal_default, {}),
|
|
12537
|
+
/* @__PURE__ */ jsx(transactionStatusModal_default, {})
|
|
12538
|
+
]
|
|
12539
|
+
})
|
|
12540
|
+
})] });
|
|
11481
12541
|
});
|
|
11482
12542
|
|
|
11483
12543
|
//#endregion
|
|
@@ -11529,7 +12589,7 @@ const useActionButtonStore = () => {
|
|
|
11529
12589
|
if (!pendingAction) return;
|
|
11530
12590
|
const { timestamp, callback } = pendingAction;
|
|
11531
12591
|
if (timestamp && callback) {
|
|
11532
|
-
if (Date.now() - timestamp <
|
|
12592
|
+
if (Date.now() - timestamp < 5 * 60 * 1e3 && typeof callback === "function") callback();
|
|
11533
12593
|
}
|
|
11534
12594
|
}
|
|
11535
12595
|
};
|
|
@@ -11563,7 +12623,7 @@ function ActionButtonBody({ tokenId, label, onClick, icon, action }) {
|
|
|
11563
12623
|
//#endregion
|
|
11564
12624
|
//#region src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx
|
|
11565
12625
|
function NonOwnerActions(props) {
|
|
11566
|
-
const { action, tokenId, collectionAddress, chainId, quantityDecimals, quantityRemaining, unlimitedSupply, cardType } = props;
|
|
12626
|
+
const { action, tokenId, collectionAddress, chainId, quantityDecimals, quantityRemaining, unlimitedSupply, cardType, hideQuantitySelector } = props;
|
|
11567
12627
|
const { show: showBuyModal } = useBuyModal();
|
|
11568
12628
|
const { show: showMakeOfferModal } = useMakeOfferModal();
|
|
11569
12629
|
if (cardType === "shop") {
|
|
@@ -11587,7 +12647,8 @@ function NonOwnerActions(props) {
|
|
|
11587
12647
|
},
|
|
11588
12648
|
quantityDecimals: quantityDecimals ?? 0,
|
|
11589
12649
|
quantityRemaining: quantityRemaining ?? 0,
|
|
11590
|
-
unlimitedSupply
|
|
12650
|
+
unlimitedSupply,
|
|
12651
|
+
hideQuantitySelector
|
|
11591
12652
|
}),
|
|
11592
12653
|
icon: CartIcon_default
|
|
11593
12654
|
});
|
|
@@ -11605,7 +12666,8 @@ function NonOwnerActions(props) {
|
|
|
11605
12666
|
collectibleId: tokenId,
|
|
11606
12667
|
orderId: lowestListing.orderId,
|
|
11607
12668
|
marketplace: lowestListing.marketplace,
|
|
11608
|
-
cardType: "market"
|
|
12669
|
+
cardType: "market",
|
|
12670
|
+
hideQuantitySelector
|
|
11609
12671
|
}),
|
|
11610
12672
|
icon: CartIcon_default
|
|
11611
12673
|
});
|
|
@@ -11727,7 +12789,7 @@ const useActionButtonLogic = ({ tokenId, owned, action, onCannotPerformAction })
|
|
|
11727
12789
|
|
|
11728
12790
|
//#endregion
|
|
11729
12791
|
//#region src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
11730
|
-
function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, action, owned, highestOffer, lowestListing, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply }) {
|
|
12792
|
+
function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, action, owned, highestOffer, lowestListing, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply, hideQuantitySelector }) {
|
|
11731
12793
|
const { shouldShowAction, isOwnerAction } = useActionButtonLogic({
|
|
11732
12794
|
tokenId,
|
|
11733
12795
|
owned,
|
|
@@ -11743,7 +12805,7 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11743
12805
|
orderbookKind,
|
|
11744
12806
|
highestOffer
|
|
11745
12807
|
});
|
|
11746
|
-
|
|
12808
|
+
const nonOwnerProps = cardType === "shop" && salesContractAddress && salePrice ? {
|
|
11747
12809
|
cardType: "shop",
|
|
11748
12810
|
salesContractAddress,
|
|
11749
12811
|
salePrice,
|
|
@@ -11753,7 +12815,8 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11753
12815
|
chainId,
|
|
11754
12816
|
quantityDecimals,
|
|
11755
12817
|
quantityRemaining,
|
|
11756
|
-
unlimitedSupply
|
|
12818
|
+
unlimitedSupply,
|
|
12819
|
+
hideQuantitySelector
|
|
11757
12820
|
} : {
|
|
11758
12821
|
cardType: "market",
|
|
11759
12822
|
orderbookKind,
|
|
@@ -11763,13 +12826,15 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11763
12826
|
collectionAddress,
|
|
11764
12827
|
chainId,
|
|
11765
12828
|
quantityDecimals,
|
|
11766
|
-
quantityRemaining
|
|
11767
|
-
|
|
12829
|
+
quantityRemaining,
|
|
12830
|
+
hideQuantitySelector
|
|
12831
|
+
};
|
|
12832
|
+
return /* @__PURE__ */ jsx(NonOwnerActions, { ...nonOwnerProps });
|
|
11768
12833
|
}
|
|
11769
12834
|
|
|
11770
12835
|
//#endregion
|
|
11771
12836
|
//#region src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx
|
|
11772
|
-
function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderbookKind, action, highestOffer, lowestListing, owned, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply }) {
|
|
12837
|
+
function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderbookKind, action, highestOffer, lowestListing, owned, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply, hideQuantitySelector }) {
|
|
11773
12838
|
if (!show) return null;
|
|
11774
12839
|
return /* @__PURE__ */ jsx("div", {
|
|
11775
12840
|
className: "-bottom-16 absolute flex w-full origin-bottom items-center justify-center bg-overlay-light p-2 backdrop-blur transition-transform duration-200 ease-in-out group-hover:translate-y-[-64px]",
|
|
@@ -11789,7 +12854,8 @@ function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderb
|
|
|
11789
12854
|
salePrice,
|
|
11790
12855
|
quantityDecimals,
|
|
11791
12856
|
quantityRemaining,
|
|
11792
|
-
unlimitedSupply
|
|
12857
|
+
unlimitedSupply,
|
|
12858
|
+
hideQuantitySelector
|
|
11793
12859
|
})
|
|
11794
12860
|
});
|
|
11795
12861
|
}
|
|
@@ -11804,7 +12870,7 @@ function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderb
|
|
|
11804
12870
|
function fetchContentType(url) {
|
|
11805
12871
|
return new Promise((resolve, reject) => {
|
|
11806
12872
|
if (typeof XMLHttpRequest === "undefined") {
|
|
11807
|
-
reject(
|
|
12873
|
+
reject(new Error("XMLHttpRequest is not supported in this environment."));
|
|
11808
12874
|
return;
|
|
11809
12875
|
}
|
|
11810
12876
|
if (!url) return;
|
|
@@ -11914,22 +12980,26 @@ function MediaSkeleton() {
|
|
|
11914
12980
|
//#endregion
|
|
11915
12981
|
//#region src/react/ui/components/media/utils.ts
|
|
11916
12982
|
const isImage = (fileName) => {
|
|
11917
|
-
|
|
12983
|
+
const isImage$1 = /.*\.(png|jpg|jpeg|gif|svg|webp)$/.test(fileName?.toLowerCase() || "");
|
|
12984
|
+
return isImage$1;
|
|
11918
12985
|
};
|
|
11919
12986
|
const isHtml = (fileName) => {
|
|
11920
|
-
|
|
12987
|
+
const isHtml$1 = /.*\.(html\?.+|html)$/.test(fileName?.toLowerCase() || "");
|
|
12988
|
+
return isHtml$1;
|
|
11921
12989
|
};
|
|
11922
12990
|
const isVideo = (fileName) => {
|
|
11923
|
-
|
|
12991
|
+
const isVideo$1 = /.*\.(mp4|ogg|webm)$/.test(fileName?.toLowerCase() || "");
|
|
12992
|
+
return isVideo$1;
|
|
11924
12993
|
};
|
|
11925
12994
|
const is3dModel = (fileName) => {
|
|
11926
|
-
|
|
12995
|
+
const is3dFile = /.*\.(gltf|glb|obj|fbx|stl|usdz)$/.test(fileName?.toLowerCase() || "");
|
|
12996
|
+
return is3dFile;
|
|
11927
12997
|
};
|
|
11928
12998
|
const getContentType = (url) => {
|
|
11929
12999
|
return new Promise((resolve, reject) => {
|
|
11930
13000
|
const type = isHtml(url) ? "html" : isVideo(url) ? "video" : isImage(url) ? "image" : is3dModel(url) ? "3d-model" : null;
|
|
11931
13001
|
if (type) resolve(type);
|
|
11932
|
-
else reject(
|
|
13002
|
+
else reject(new Error("Unsupported file type"));
|
|
11933
13003
|
});
|
|
11934
13004
|
};
|
|
11935
13005
|
|
|
@@ -11963,9 +13033,10 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
11963
13033
|
useEffect(() => {
|
|
11964
13034
|
setIsSafari(/^((?!chrome|android).)*safari/i.test(navigator.userAgent));
|
|
11965
13035
|
}, []);
|
|
11966
|
-
const
|
|
13036
|
+
const validAssets = assets.filter((asset) => !!asset);
|
|
13037
|
+
const assetUrl = validAssets[currentAssetIndex];
|
|
11967
13038
|
const proxiedAssetUrl = assetUrl ? assetSrcPrefixUrl ? `${assetSrcPrefixUrl}${assetUrl}` : assetUrl : "";
|
|
11968
|
-
const containerClassNames = cn
|
|
13039
|
+
const containerClassNames = cn("relative aspect-square overflow-hidden bg-background-secondary", containerClassName || className);
|
|
11969
13040
|
useEffect(() => {
|
|
11970
13041
|
if (!assetUrl) {
|
|
11971
13042
|
setContentType({
|
|
@@ -12016,11 +13087,11 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12016
13087
|
};
|
|
12017
13088
|
const renderFallback = () => {
|
|
12018
13089
|
if (fallbackContent) return /* @__PURE__ */ jsx("div", {
|
|
12019
|
-
className: cn
|
|
13090
|
+
className: cn("flex h-full w-full items-center justify-center", containerClassNames),
|
|
12020
13091
|
children: fallbackContent
|
|
12021
13092
|
});
|
|
12022
13093
|
return /* @__PURE__ */ jsx("div", {
|
|
12023
|
-
className: cn
|
|
13094
|
+
className: cn("h-full w-full", containerClassNames),
|
|
12024
13095
|
children: /* @__PURE__ */ jsx("img", {
|
|
12025
13096
|
src: chess_tile_default,
|
|
12026
13097
|
alt: name || "Collectible",
|
|
@@ -12034,10 +13105,10 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12034
13105
|
};
|
|
12035
13106
|
if (assetLoadFailed || !isLoading && contentType.failed || !assetUrl) return renderFallback();
|
|
12036
13107
|
if (contentType.type === "html" && !assetLoadFailed) return /* @__PURE__ */ jsxs("div", {
|
|
12037
|
-
className: cn
|
|
13108
|
+
className: cn("flex w-full items-center justify-center rounded-lg", containerClassNames),
|
|
12038
13109
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("iframe", {
|
|
12039
13110
|
title: name || "Collectible",
|
|
12040
|
-
className: cn
|
|
13111
|
+
className: cn("aspect-square w-full", mediaClassname),
|
|
12041
13112
|
src: proxiedAssetUrl,
|
|
12042
13113
|
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
12043
13114
|
sandbox: "allow-scripts",
|
|
@@ -12047,7 +13118,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12047
13118
|
})]
|
|
12048
13119
|
});
|
|
12049
13120
|
if (contentType.type === "3d-model" && !assetLoadFailed) return /* @__PURE__ */ jsx("div", {
|
|
12050
|
-
className: cn
|
|
13121
|
+
className: cn("h-full w-full", containerClassNames),
|
|
12051
13122
|
children: /* @__PURE__ */ jsx(ModelViewer_default, {
|
|
12052
13123
|
src: proxiedAssetUrl,
|
|
12053
13124
|
posterSrc: chess_tile_default,
|
|
@@ -12056,7 +13127,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12056
13127
|
})
|
|
12057
13128
|
});
|
|
12058
13129
|
if (contentType.type === "video" && !assetLoadFailed) {
|
|
12059
|
-
const videoClassNames = cn
|
|
13130
|
+
const videoClassNames = cn("absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover", assetLoading || isLoading ? "invisible" : "visible", isSafari && "pointer-events-none", mediaClassname);
|
|
12060
13131
|
return /* @__PURE__ */ jsxs("div", {
|
|
12061
13132
|
className: containerClassNames,
|
|
12062
13133
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("video", {
|
|
@@ -12076,7 +13147,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12076
13147
|
});
|
|
12077
13148
|
}
|
|
12078
13149
|
const imgSrc = assetLoadFailed || contentType.failed ? chess_tile_default : proxiedAssetUrl;
|
|
12079
|
-
const imgClassNames = cn
|
|
13150
|
+
const imgClassNames = cn("absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover", assetLoading || contentType.loading || isLoading ? "invisible" : "visible", mediaClassname);
|
|
12080
13151
|
return /* @__PURE__ */ jsxs("div", {
|
|
12081
13152
|
className: containerClassNames,
|
|
12082
13153
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("img", {
|
|
@@ -12148,7 +13219,7 @@ function BaseCard({ name, image, video, animationUrl, onClick, onKeyDown, assetS
|
|
|
12148
13219
|
animationUrl
|
|
12149
13220
|
],
|
|
12150
13221
|
assetSrcPrefixUrl,
|
|
12151
|
-
mediaClassname: cn("object-contain", mediaClassName)
|
|
13222
|
+
mediaClassname: cn$1("object-contain", mediaClassName)
|
|
12152
13223
|
}), children]
|
|
12153
13224
|
})
|
|
12154
13225
|
})
|
|
@@ -12157,23 +13228,17 @@ function BaseCard({ name, image, video, animationUrl, onClick, onKeyDown, assetS
|
|
|
12157
13228
|
|
|
12158
13229
|
//#endregion
|
|
12159
13230
|
//#region src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx
|
|
12160
|
-
const Footer = ({ chainId,
|
|
13231
|
+
const Footer = ({ chainId, name, type, decimals, onOfferClick, highestOffer, lowestListing, balance, quantityInitial, quantityRemaining, unlimitedSupply, cardType, salePriceAmount, salePriceCurrency }) => {
|
|
12161
13232
|
const isShop = cardType === "shop";
|
|
12162
13233
|
const isMarket = cardType === "market";
|
|
12163
13234
|
const isInventoryNonTradable = cardType === "inventory-non-tradable";
|
|
12164
|
-
const { data: lowestListing, isLoading: isLowestListingLoading } = useLowestListing({
|
|
12165
|
-
chainId,
|
|
12166
|
-
collectionAddress,
|
|
12167
|
-
tokenId: collectibleId,
|
|
12168
|
-
query: { enabled: isMarket }
|
|
12169
|
-
});
|
|
12170
13235
|
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
12171
13236
|
chainId,
|
|
12172
13237
|
currencyAddress: lowestListing?.priceCurrencyAddress,
|
|
12173
13238
|
query: { enabled: isMarket && !!lowestListing?.priceCurrencyAddress }
|
|
12174
13239
|
});
|
|
12175
13240
|
const listed = !!lowestListing?.priceAmount && !!lowestListing?.priceCurrencyAddress;
|
|
12176
|
-
const isPriceLoading = isMarket &&
|
|
13241
|
+
const isPriceLoading = isMarket && !!lowestListing?.priceCurrencyAddress && isCurrencyLoading;
|
|
12177
13242
|
return /* @__PURE__ */ jsxs("div", {
|
|
12178
13243
|
className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4",
|
|
12179
13244
|
children: [
|
|
@@ -12187,7 +13252,7 @@ const Footer = ({ chainId, collectionAddress, collectibleId, name, type, decimal
|
|
|
12187
13252
|
balance
|
|
12188
13253
|
}),
|
|
12189
13254
|
/* @__PURE__ */ jsxs("div", {
|
|
12190
|
-
className: cn
|
|
13255
|
+
className: cn("flex items-center gap-1", isShop && type === ContractType.ERC721 && "hidden"),
|
|
12191
13256
|
children: [
|
|
12192
13257
|
isPriceLoading && /* @__PURE__ */ jsx(Skeleton, {
|
|
12193
13258
|
size: "sm",
|
|
@@ -12246,9 +13311,10 @@ const NonTradableInventoryFooter = ({ name, balance, decimals, type }) => {
|
|
|
12246
13311
|
|
|
12247
13312
|
//#endregion
|
|
12248
13313
|
//#region src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx
|
|
12249
|
-
function MarketCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, orderbookKind, collectible, onCollectibleClick, onOfferClick, balance, balanceIsLoading = false, onCannotPerformAction, prioritizeOwnerActions }) {
|
|
13314
|
+
function MarketCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, orderbookKind, collectible, onCollectibleClick, onOfferClick, balance, balanceIsLoading = false, onCannotPerformAction, prioritizeOwnerActions, hideQuantitySelector }) {
|
|
12250
13315
|
const collectibleMetadata = collectible?.metadata;
|
|
12251
13316
|
const highestOffer = collectible?.offer;
|
|
13317
|
+
const lowestListing = collectible?.listing;
|
|
12252
13318
|
if (!collectibleMetadata) {
|
|
12253
13319
|
console.error("Collectible metadata is undefined");
|
|
12254
13320
|
return null;
|
|
@@ -12274,10 +13340,9 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12274
13340
|
isShop: false,
|
|
12275
13341
|
onClick: () => onCollectibleClick?.(collectibleId),
|
|
12276
13342
|
onKeyDown: handleKeyDown,
|
|
13343
|
+
hideQuantitySelector,
|
|
12277
13344
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
12278
13345
|
chainId,
|
|
12279
|
-
collectionAddress,
|
|
12280
|
-
collectibleId,
|
|
12281
13346
|
name: collectibleMetadata.name || "",
|
|
12282
13347
|
type: collectionType,
|
|
12283
13348
|
onOfferClick: (e) => onOfferClick?.({
|
|
@@ -12285,6 +13350,7 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12285
13350
|
e
|
|
12286
13351
|
}),
|
|
12287
13352
|
highestOffer,
|
|
13353
|
+
lowestListing,
|
|
12288
13354
|
balance,
|
|
12289
13355
|
decimals: collectibleMetadata.decimals,
|
|
12290
13356
|
quantityInitial: highestOffer?.quantityInitial !== void 0 ? highestOffer.quantityInitial : collectible?.listing?.quantityInitial !== void 0 ? collectible.listing.quantityInitial : void 0,
|
|
@@ -12302,7 +13368,8 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12302
13368
|
owned: !!balance,
|
|
12303
13369
|
onCannotPerformAction,
|
|
12304
13370
|
cardType: "market",
|
|
12305
|
-
prioritizeOwnerActions
|
|
13371
|
+
prioritizeOwnerActions,
|
|
13372
|
+
hideQuantitySelector
|
|
12306
13373
|
})]
|
|
12307
13374
|
});
|
|
12308
13375
|
}
|
|
@@ -12334,7 +13401,7 @@ function NonTradableInventoryCard({ collectibleId, chainId, collectionAddress, c
|
|
|
12334
13401
|
|
|
12335
13402
|
//#endregion
|
|
12336
13403
|
//#region src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx
|
|
12337
|
-
function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, cardType, salesContractAddress, tokenMetadata, salePrice, quantityDecimals, quantityInitial, quantityRemaining, unlimitedSupply }) {
|
|
13404
|
+
function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, cardType, salesContractAddress, tokenMetadata, salePrice, quantityDecimals, quantityInitial, quantityRemaining, unlimitedSupply, hideQuantitySelector }) {
|
|
12338
13405
|
const { data: saleCurrency, isLoading: saleCurrencyLoading } = useCurrency({
|
|
12339
13406
|
chainId,
|
|
12340
13407
|
currencyAddress: salePrice?.currencyAddress,
|
|
@@ -12365,10 +13432,9 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12365
13432
|
mediaClassName,
|
|
12366
13433
|
contractType: collectionType,
|
|
12367
13434
|
isShop: true,
|
|
13435
|
+
hideQuantitySelector,
|
|
12368
13436
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
12369
13437
|
chainId,
|
|
12370
|
-
collectionAddress,
|
|
12371
|
-
collectibleId,
|
|
12372
13438
|
name: tokenMetadata.name || "",
|
|
12373
13439
|
type: collectionType,
|
|
12374
13440
|
decimals: tokenMetadata.decimals,
|
|
@@ -12406,5 +13472,5 @@ function CollectibleCard(props) {
|
|
|
12406
13472
|
}
|
|
12407
13473
|
|
|
12408
13474
|
//#endregion
|
|
12409
|
-
export { ActionModal, CollectibleCard, DatabeatAnalytics, Footer, MarketplaceProvider, MarketplaceQueryClientProvider, MarketplaceSdkContext, Media, ModalProvider, NonTradableInventoryFooter, collectionDetailsPollingOptions, generateCancelTransaction, generateListingTransaction, generateOfferTransaction, generateSellTransaction, useAnalytics, useAutoSelectFeeOption, useBalanceOfCollectible, useBuyModal, useCancelOrder, useCancelTransactionSteps, useCheckoutOptions$1 as useCheckoutOptions, useCheckoutOptionsSalesContract, useCollectible, useCollection, useCollectionBalanceDetails, useCollectionDetails, useCollectionDetailsPolling, useComparePrices, useConfig, useConnectorMetadata, useConvertPriceToUSD, useCountListingsForCollectible, useCountOfCollectables, useCountOfPrimarySaleItems, useCountOffersForCollectible, useCreateListingModal, useCurrency, useEnsureCorrectChain, useErc721SaleDetails, useFilterState, useFilters, useFiltersProgressive, useFloorOrder, useGenerateCancelTransaction, useGenerateListingTransaction, useGenerateOfferTransaction, useGenerateSellTransaction, useGetCountOfPrimarySaleItems, useGetReceiptFromHash, useGetTokenRanges, useHighestOffer, useInventory, useList1155ShopCardData, useList721ShopCardData, useListBalances, useListCollectibleActivities, useListCollectibles, useListCollectiblesPaginated, useListCollectionActivities, useListCollections, useListListingsForCollectible, useListMarketCardData, useListOffersForCollectible, useListPrimarySaleItems, useListTokenMetadata, useLowestListing, useMakeOfferModal, useMarketCurrencies, useMarketplaceConfig, useOpenConnectModal$1 as useOpenConnectModal, useOrderSteps, useProcessStep, useRoyalty, useSearchTokenMetadata, useSellModal, useSuccessfulPurchaseModal, useTokenSupplies, useTransferModal, useTransferTokens };
|
|
12410
|
-
//# sourceMappingURL=react-
|
|
13475
|
+
export { ActionModal, CollectibleCard, DatabeatAnalytics, Footer, MarketplaceProvider, MarketplaceQueryClientProvider, MarketplaceSdkContext, Media, ModalProvider, NonTradableInventoryFooter, collectionDetailsPollingOptions, generateCancelTransaction, generateListingTransaction, generateOfferTransaction, generateSellTransaction, useAnalytics, useAutoSelectFeeOption, useBalanceOfCollectible, useBuyModal, useCancelOrder, useCancelTransactionSteps, useCheckoutOptions$1 as useCheckoutOptions, useCheckoutOptionsSalesContract, useCollectible, useCollection, useCollectionActiveListingsCurrencies, useCollectionActiveOffersCurrencies, useCollectionBalanceDetails, useCollectionDetails, useCollectionDetailsPolling, useComparePrices, useConfig, useConnectorMetadata, useConvertPriceToUSD, useCountItemsOrdersForCollection, useCountListingsForCollectible, useCountOfCollectables, useCountOfPrimarySaleItems, useCountOffersForCollectible, useCreateListingModal, useCurrency, useEnsureCorrectChain, useErc721SaleDetails, useFilterState, useFilters, useFiltersProgressive, useFloorOrder, useGenerateCancelTransaction, useGenerateListingTransaction, useGenerateOfferTransaction, useGenerateSellTransaction, useGetCountOfFilteredOrders, useGetCountOfPrimarySaleItems, useGetReceiptFromHash, useGetTokenRanges, useHighestOffer, useInventory, useList1155ShopCardData, useList721ShopCardData, useListBalances, useListCollectibleActivities, useListCollectibles, useListCollectiblesPaginated, useListCollectionActivities, useListCollections, useListItemsOrdersForCollection, useListItemsOrdersForCollectionPaginated, useListListingsForCollectible, useListMarketCardData, useListOffersForCollectible, useListPrimarySaleItems, useListTokenMetadata, useLowestListing, useMakeOfferModal, useMarketCurrencies, useMarketplaceConfig, useOpenConnectModal$1 as useOpenConnectModal, useOrderSteps, usePrimarySaleItem, useProcessStep, useRoyalty, useSearchTokenMetadata, useSellModal, useSuccessfulPurchaseModal, useTokenSupplies, useTransferModal, useTransferTokens };
|
|
13476
|
+
//# sourceMappingURL=react-CBsgOdVP.js.map
|