@0xsequence/marketplace-sdk 1.0.0 → 1.1.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/.storybook/main.ts +1 -1
- package/.storybook/preview.tsx +0 -1
- package/CHANGELOG.md +62 -13
- package/dist/BellIcon-IpHHEy8h.js +45 -0
- package/dist/BellIcon-IpHHEy8h.js.map +1 -0
- package/dist/{BellIcon-Cb9YEUzJ.js → CartIcon-C8zbor8H.js} +10 -49
- package/dist/CartIcon-C8zbor8H.js.map +1 -0
- package/dist/CollectibleCard-C2EWF0zo.d.ts +8 -0
- package/dist/{_internal-DslqcNC1.js → _internal-DkS2VUn5.js} +1 -1
- package/dist/{_internal-DslqcNC1.js.map → _internal-DkS2VUn5.js.map} +1 -1
- package/dist/{alien_swap-DJ98gZQp.js → alien_swap-BTJ7mSR-.js} +1 -1
- package/dist/{alien_swap-DJ98gZQp.js.map → alien_swap-BTJ7mSR-.js.map} +1 -1
- package/dist/{api-BmEQfSQa.js → api-DuLKn__v.js} +5 -3
- package/dist/api-DuLKn__v.js.map +1 -0
- package/dist/{aqua-xyz-n1PcCCZ0.js → aqua-xyz-BYJ9WSP_.js} +1 -1
- package/dist/{aqua-xyz-n1PcCCZ0.js.map → aqua-xyz-BYJ9WSP_.js.map} +1 -1
- package/dist/{aura-Bevk_YkS.js → aura-D7SUjgro.js} +1 -1
- package/dist/{aura-Bevk_YkS.js.map → aura-D7SUjgro.js.map} +1 -1
- package/dist/{blur-B5sHErx5.js → blur-BcnRFCaV.js} +1 -1
- package/dist/{blur-B5sHErx5.js.map → blur-BcnRFCaV.js.map} +1 -1
- package/dist/builder-api-BFuZNOaN.js.map +1 -1
- package/dist/builder.gen-B9wR2nvF.js.map +1 -1
- package/dist/{coinbase-D30W-lxA.js → coinbase-ChoX9Hw2.js} +1 -1
- package/dist/{coinbase-D30W-lxA.js.map → coinbase-ChoX9Hw2.js.map} +1 -1
- package/dist/components-CUv-wQr8.js +119 -0
- package/dist/components-CUv-wQr8.js.map +1 -0
- package/dist/{contracts-DPHFT2TA.js → contracts-D72LBOX3.js} +4 -5
- package/dist/{contracts-DPHFT2TA.js.map → contracts-D72LBOX3.js.map} +1 -1
- package/dist/{create-config-6uynwTeb.js → create-config-CIfejoCk.js} +6 -11
- package/dist/create-config-CIfejoCk.js.map +1 -0
- package/dist/{create-config-lLSrnkbb.d.ts → create-config-DV_dtaLt.d.ts} +24 -31
- package/dist/{element-C2NJexro.js → element-Dbcv5qya.js} +1 -1
- package/dist/{element-C2NJexro.js.map → element-Dbcv5qya.js.map} +1 -1
- package/dist/{filters-B8XS4tFH.d.ts → filters-zkMJaPey.d.ts} +6 -6
- package/dist/{foundation-QgY1lvUj.js → foundation-QPhUEUy8.js} +1 -1
- package/dist/{foundation-QgY1lvUj.js.map → foundation-QPhUEUy8.js.map} +1 -1
- package/dist/{index-ChSKFOMx.d.ts → index-B6aSbaw2.d.ts} +1 -1
- package/dist/{index-PSPpUxCE.d.ts → index-B8vaT3_s.d.ts} +4 -4
- package/dist/{index-DonXiSg2.d.ts → index-BaytncQc.d.ts} +100 -56
- package/dist/{index-CY5UEX4h.d.ts → index-BoNNplSx.d.ts} +2 -2
- package/dist/{index-QxxS6f9r.d.ts → index-Bv5XVLjH.d.ts} +1 -1
- package/dist/{index-CIkpYltz.d.ts → index-C768pAfu.d.ts} +3 -3
- package/dist/{index-DX0Vm8HY.d.ts → index-CM0ZTePs.d.ts} +1 -1
- package/dist/index-CMPUveNz.d.ts +64 -0
- package/dist/{index-ThUIs-Sy.d.ts → index-CQecU53t.d.ts} +28 -23
- package/dist/{index-CtF7EE2z.d.ts → index-CT8ZorFd.d.ts} +1 -1
- package/dist/{index-Dpyp7fQz.d.ts → index-CXscCUg7.d.ts} +12 -12
- package/dist/{index-ByW08-Z7.d.ts → index-D-UXGo5d.d.ts} +2 -2
- package/dist/{index-D71J5Ghd.d.ts → index-D6YMj82n.d.ts} +79 -79
- package/dist/{index-CQnGIGb5.d.ts → index-DJG0kiII.d.ts} +33 -33
- package/dist/{index-D2HohSwO.d.ts → index-DLUjc7Bx.d.ts} +52 -29
- package/dist/{index-C7xKVIr4.d.ts → index-DMBMM16q.d.ts} +37 -37
- package/dist/{index-DNU9xoGK.d.ts → index-DpeWm_vF.d.ts} +5 -5
- package/dist/{index-BuY_NKSX.d.ts → index-Yobo6icm.d.ts} +40 -28
- package/dist/{index-BGJXqdg6.d.ts → index-jGgfEHfQ.d.ts} +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +12 -11
- package/dist/{listCollectiblesPaginated--AgXjajA.d.ts → listCollectiblesPaginated-Bq0QSOjJ.d.ts} +28 -26
- package/dist/{listCollections-Bbzbz7qW.d.ts → listCollections-dTCq00l5.d.ts} +168 -123
- package/dist/{looks-rare-CMVPny4v.js → looks-rare-C7cQztTR.js} +1 -1
- package/dist/{looks-rare-CMVPny4v.js.map → looks-rare-C7cQztTR.js.map} +1 -1
- package/dist/{lowestListing-BQHfQpfg.d.ts → lowestListing-CB5Te-Q9.d.ts} +41 -17
- package/dist/{magic-eden-IrWp2ZXk.js → magic-eden-D3r7jiBG.js} +1 -1
- package/dist/{magic-eden-IrWp2ZXk.js.map → magic-eden-D3r7jiBG.js.map} +1 -1
- package/dist/{manifold-DeOE-p2G.js → manifold-DsX0CBP-.js} +1 -1
- package/dist/{manifold-DeOE-p2G.js.map → manifold-DsX0CBP-.js.map} +1 -1
- package/dist/{marketCurrencies-CmOMCCOr.d.ts → marketCurrencies-Bzj8X4TL.d.ts} +8 -8
- package/dist/{marketplace-B5Z8G03R.js → marketplace-BYY8OloA.js} +1 -1
- package/dist/{marketplace-B5Z8G03R.js.map → marketplace-BYY8OloA.js.map} +1 -1
- package/dist/{marketplace-logos-D8t86gsW.js → marketplace-logos-Csv2MBwf.js} +21 -21
- package/dist/marketplace-logos-Csv2MBwf.js.map +1 -0
- package/dist/{marketplace.gen-JzNYpM0U.js → marketplace.gen-w2YvbEEo.js} +2 -2
- package/dist/marketplace.gen-w2YvbEEo.js.map +1 -0
- package/dist/{marketplaceConfig-sNh-MA5M.js → marketplaceConfig-BTy75Mbf.js} +8 -9
- package/dist/marketplaceConfig-BTy75Mbf.js.map +1 -0
- package/dist/{mintify-DG3GrljJ.js → mintify-DiOoDmO1.js} +1 -1
- package/dist/{mintify-DG3GrljJ.js.map → mintify-DiOoDmO1.js.map} +1 -1
- package/dist/{network-DnBEe1Ur.js → network-DtmiMhcg.js} +2 -2
- package/dist/network-DtmiMhcg.js.map +1 -0
- package/dist/networkconfigToWagmiChain-DbUf6HiO.js +15 -0
- package/dist/networkconfigToWagmiChain-DbUf6HiO.js.map +1 -0
- package/dist/{nftx-B3LH-ZYM.js → nftx-CP82jNra.js} +1 -1
- package/dist/{nftx-B3LH-ZYM.js.map → nftx-CP82jNra.js.map} +1 -1
- package/dist/{okx-CRFLrT3Z.js → okx-p9-4xRjs.js} +1 -1
- package/dist/{okx-CRFLrT3Z.js.map → okx-p9-4xRjs.js.map} +1 -1
- package/dist/{open-sea-cOpfl366.js → open-sea-D2GwAmKS.js} +1 -1
- package/dist/{open-sea-cOpfl366.js.map → open-sea-D2GwAmKS.js.map} +1 -1
- package/dist/{primary-sale-CLjXRrDj.js → primary-sale-DOmNDq2P.js} +1 -1
- package/dist/{primary-sale-CLjXRrDj.js.map → primary-sale-DOmNDq2P.js.map} +1 -1
- package/dist/{queries-BYT4GJw3.js → queries-EMA5CcwY.js} +208 -287
- package/dist/queries-EMA5CcwY.js.map +1 -0
- package/dist/{query-BTe7Wkrs.d.ts → query-BG-MA1MB.d.ts} +1 -1
- package/dist/{rarible-guwUx4cn.js → rarible-DqiiW9ki.js} +1 -1
- package/dist/{rarible-guwUx4cn.js.map → rarible-DqiiW9ki.js.map} +1 -1
- package/dist/react/_internal/api/index.d.ts +1 -1
- package/dist/react/_internal/api/index.js +4 -4
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +24 -21
- package/dist/react/_internal/index.d.ts +1 -1
- package/dist/react/_internal/index.js +8 -7
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/_internal/wagmi/index.js +4 -3
- package/dist/react/hooks/config/index.d.ts +8 -8
- package/dist/react/hooks/config/index.js +24 -21
- package/dist/react/hooks/contracts/index.d.ts +6 -6
- package/dist/react/hooks/contracts/index.js +13 -12
- package/dist/react/hooks/data/collectibles/index.d.ts +4 -4
- package/dist/react/hooks/data/collectibles/index.js +24 -21
- package/dist/react/hooks/data/collections/index.d.ts +10 -10
- package/dist/react/hooks/data/collections/index.js +24 -21
- package/dist/react/hooks/data/index.d.ts +29 -29
- package/dist/react/hooks/data/index.js +25 -22
- package/dist/react/hooks/data/inventory/index.d.ts +28 -28
- package/dist/react/hooks/data/inventory/index.js +24 -21
- package/dist/react/hooks/data/market/index.d.ts +5 -11
- package/dist/react/hooks/data/market/index.js +24 -21
- package/dist/react/hooks/data/orders/index.d.ts +5 -11
- package/dist/react/hooks/data/orders/index.js +25 -22
- package/dist/react/hooks/data/primary-sales/index.d.ts +28 -28
- package/dist/react/hooks/data/primary-sales/index.js +24 -21
- package/dist/react/hooks/data/tokens/index.d.ts +4 -4
- package/dist/react/hooks/data/tokens/index.js +24 -21
- package/dist/react/hooks/index.d.ts +29 -29
- package/dist/react/hooks/index.js +25 -22
- package/dist/react/hooks/transactions/index.d.ts +2 -2
- package/dist/react/hooks/transactions/index.js +24 -21
- package/dist/react/hooks/ui/index.d.ts +4 -4
- package/dist/react/hooks/ui/index.js +24 -21
- package/dist/react/hooks/utils/index.d.ts +29 -29
- package/dist/react/hooks/utils/index.js +25 -22
- package/dist/react/index.d.ts +29 -29
- package/dist/react/index.js +25 -22
- package/dist/react/queries/index.d.ts +16 -16
- package/dist/react/queries/index.js +18 -17
- package/dist/react/ssr/index.d.ts +7 -7
- package/dist/react/ssr/index.js +9 -8
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +3 -0
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +22 -0
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +54 -0
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +29 -0
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +5 -5
- package/dist/react/ui/components/marketplace-collectible-card/index.js +24 -21
- 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 +9 -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 +13 -11
- package/dist/react/ui/index.d.ts +5 -5
- package/dist/react/ui/index.js +24 -21
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +24 -21
- package/dist/react/utils/index.d.ts +1 -1
- package/dist/react/utils/index.js +5 -5
- package/dist/{react-Ceq8mamy.js → react-BLJ4DkPx.js} +723 -807
- package/dist/react-BLJ4DkPx.js.map +1 -0
- package/dist/{react-CbqXKOpt.css → react-F03jPjPk.css} +1 -1
- package/dist/{react-CbqXKOpt.css.map → react-F03jPjPk.css.map} +1 -1
- package/dist/{sequence-Dt2Xo7Fa.js → sequence-Bbb-TFKg.js} +1 -1
- package/dist/{sequence-Dt2Xo7Fa.js.map → sequence-Bbb-TFKg.js.map} +1 -1
- package/dist/styles/index.css +46 -24
- package/dist/{sudo-swap-CGoARONs.js → sudo-swap-CEPIM3Js.js} +1 -1
- package/dist/{sudo-swap-CGoARONs.js.map → sudo-swap-CEPIM3Js.js.map} +1 -1
- package/dist/{super-rare-NeQtZjcn.js → super-rare-CMEn9PoO.js} +1 -1
- package/dist/{super-rare-NeQtZjcn.js.map → super-rare-CMEn9PoO.js.map} +1 -1
- package/dist/{token-D9gZVqbX.js → token-CcyLz8Z8.js} +1 -1
- package/dist/{token-D9gZVqbX.js.map → token-CcyLz8Z8.js.map} +1 -1
- package/dist/{tokenSupplies-DXtkRYNO.d.ts → tokenSupplies-C470zTT0.d.ts} +23 -23
- package/dist/{transaction-CC2KxNF6.js → transaction-DZUW5RHu.js} +2 -8
- package/dist/transaction-DZUW5RHu.js.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{types-G2PWxiJR.js → types-B_-cnkcP.js} +1 -1
- package/dist/types-B_-cnkcP.js.map +1 -0
- package/dist/{types-BlCa0TVE.d.ts → types-D6LkVrF0.d.ts} +18 -10
- package/dist/utils/abi/index.d.ts +4 -4
- package/dist/utils/abi/index.js +4 -4
- package/dist/utils/abi/marketplace/index.d.ts +1 -1
- package/dist/utils/abi/marketplace/index.js +1 -1
- package/dist/utils/abi/primary-sale/index.d.ts +1 -1
- package/dist/utils/abi/primary-sale/index.js +1 -1
- package/dist/utils/abi/token/index.d.ts +1 -1
- package/dist/utils/abi/token/index.js +1 -1
- package/dist/utils/index.d.ts +6 -6
- package/dist/utils/index.js +11 -10
- package/dist/{utils-CKJd-CRf.js → utils-BZEkdqWK.js} +7 -24
- package/dist/utils-BZEkdqWK.js.map +1 -0
- package/dist/{utils-wquIhK6T.js → utils-oVZxdK0o.js} +2 -2
- package/dist/utils-oVZxdK0o.js.map +1 -0
- package/dist/{waitForTransactionReceipt-DZxAuR9N.js → waitForTransactionReceipt-B08YZiDY.js} +3 -4
- package/dist/{waitForTransactionReceipt-DZxAuR9N.js.map → waitForTransactionReceipt-B08YZiDY.js.map} +1 -1
- package/dist/{x2y2-CQdg24VP.js → x2y2-DNe6JgtG.js} +1 -1
- package/dist/{x2y2-CQdg24VP.js.map → x2y2-DNe6JgtG.js.map} +1 -1
- package/dist/{zora-DdEydy4L.js → zora-w0Zqxxs4.js} +1 -1
- package/dist/{zora-DdEydy4L.js.map → zora-w0Zqxxs4.js.map} +1 -1
- package/package.json +35 -35
- package/src/react/_internal/api/marketplace.gen.ts +1 -1
- package/src/react/_internal/api/query-keys.ts +2 -0
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +19 -8
- package/src/react/_internal/wagmi/create-config.ts +6 -17
- package/src/react/hooks/config/__snapshots__/useMarketplaceConfig.test.tsx.snap +4 -4
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +2 -2
- package/src/react/hooks/data/collectibles/useTokenBalances.test.tsx +151 -0
- package/src/react/hooks/data/collectibles/useTokenBalances.tsx +47 -0
- package/src/react/hooks/data/collections/__snapshots__/useListCollections.test.tsx.snap +6 -6
- package/src/react/hooks/data/inventory/useInventory.test.tsx +3 -98
- package/src/react/hooks/data/inventory/useInventory.tsx +2 -2
- package/src/react/hooks/data/market/useListMarketCardData.tsx +1 -1
- package/src/react/hooks/data/orders/useListOffersForCollectible.tsx +70 -45
- package/src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx +21 -37
- package/src/react/hooks/data/primary-sales/useList721ShopCardData.tsx +14 -3
- package/src/react/hooks/data/tokens/useSearchTokenMetadata.tsx +4 -1
- package/src/react/hooks/transactions/useCancelOrder.test.tsx +7 -4
- package/src/react/hooks/transactions/useCancelOrder.tsx +2 -1
- package/src/react/hooks/transactions/useCancelTransactionSteps.tsx +2 -2
- package/src/react/hooks/transactions/useProcessStep.test.tsx +2 -2
- package/src/react/hooks/utils/__tests__/useEnsureCorrectChain.test.tsx +75 -0
- package/src/react/hooks/utils/index.ts +0 -1
- package/src/react/hooks/utils/useEnsureCorrectChain.ts +31 -34
- package/src/react/providers/index.tsx +12 -14
- package/src/react/providers/modal-provider.tsx +2 -2
- package/src/react/queries/__tests__/balanceOfCollectible.laos.test.ts +3 -3
- package/src/react/queries/__tests__/inventory.laos.test.ts +6 -3
- package/src/react/queries/__tests__/tokenBalances.laos.test.ts +123 -0
- package/src/react/queries/balanceOfCollectible.ts +2 -1
- package/src/react/queries/filters.ts +23 -28
- package/src/react/queries/index.ts +1 -0
- package/src/react/queries/inventory.ts +63 -243
- package/src/react/queries/listCollectibles.ts +22 -48
- package/src/react/queries/listCollections.ts +10 -13
- package/src/react/queries/listOffersForCollectible.ts +101 -0
- package/src/react/queries/marketplaceConfig.ts +6 -2
- package/src/react/queries/tokenBalances.ts +85 -0
- package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +4 -4
- package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +8 -8
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +6 -9
- package/src/react/ui/components/_internals/action-button/__tests__/NonOwnerActions.test.tsx +4 -4
- package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +6 -6
- package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +1 -1
- package/src/react/ui/components/marketplace-collectible-card/CollectibleCard.tsx +4 -3
- package/src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx +13 -2
- package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +4 -7
- package/src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx +14 -5
- package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +179 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/FooterName.tsx +103 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/PriceDisplay.tsx +80 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/SaleDetailsPill.tsx +29 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/TokenTypeBalancePill.tsx +30 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/index.ts +4 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/index.ts +2 -0
- package/src/react/ui/components/marketplace-collectible-card/types.ts +18 -6
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +11 -23
- package/src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx +42 -0
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +15 -12
- package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +10 -10
- package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +3 -3
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx.bak +3 -3
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +6 -6
- package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +3 -3
- package/src/react/ui/modals/BuyModal/components/BuyModalRouter.tsx +5 -5
- package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +2 -2
- package/src/react/ui/modals/BuyModal/components/ERC1155QuantityModal.tsx +8 -8
- package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +2 -2
- package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +13 -2
- package/src/react/ui/modals/BuyModal/store.ts +6 -6
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +2 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +87 -89
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +2 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +2 -1
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +2 -1
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +20 -9
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/switchChainErrorModal/__tests__/SwitchChainErrorModal.test.tsx +80 -0
- package/src/react/ui/modals/_internal/components/switchChainErrorModal/index.tsx +64 -0
- package/src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts +42 -0
- package/src/react/ui/modals/_internal/types.ts +0 -1
- package/src/styles/styles.ts +46 -24
- package/src/types/new-marketplace-types.ts +9 -18
- package/src/types/types.ts +1 -1
- package/test/globalSetup.ts +1 -1
- package/test/test-utils.tsx +1 -0
- package/dist/BellIcon-Cb9YEUzJ.js.map +0 -1
- package/dist/CollectibleCard-CYyWzk6u.d.ts +0 -8
- package/dist/api-BmEQfSQa.js.map +0 -1
- package/dist/create-config-6uynwTeb.js.map +0 -1
- package/dist/marketplace-logos-D8t86gsW.js.map +0 -1
- package/dist/marketplace.gen-JzNYpM0U.js.map +0 -1
- package/dist/marketplaceConfig-sNh-MA5M.js.map +0 -1
- package/dist/network-DnBEe1Ur.js.map +0 -1
- package/dist/queries-BYT4GJw3.js.map +0 -1
- package/dist/react-Ceq8mamy.js.map +0 -1
- package/dist/transaction-CC2KxNF6.js.map +0 -1
- package/dist/types-G2PWxiJR.js.map +0 -1
- package/dist/utils-CKJd-CRf.js.map +0 -1
- package/dist/utils-wquIhK6T.js.map +0 -1
- package/src/react/hooks/utils/useSwitchChainWithModal.ts +0 -38
- package/src/react/ui/components/marketplace-collectible-card/Footer.tsx +0 -238
- package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +0 -117
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +0 -124
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +0 -71
- /package/dist/{abi-Wr_aTZFi.js → abi-DYsUABe6.js} +0 -0
- /package/dist/{index-q7f-WDBS.d.ts → index-Cg5cFzs-.d.ts} +0 -0
- /package/dist/{wagmi-BhP3mdhP.js → wagmi-Bseovd6Q.js} +0 -0
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { DEFAULT_MARKETPLACE_FEE_PERCENTAGE } from "./src-Dz2CfBL0.js";
|
|
3
|
-
import { BaseError, ChainSwitchError,
|
|
4
|
-
import { balanceQueries, collectableKeys, getMarketplaceClient, getQueryClient, getSequenceApiClient } from "./api-
|
|
5
|
-
import { CollectionStatus, ContractType, ExecuteType, OrderSide, OrderbookKind, PropertyType, StepType, WalletKind } from "./marketplace.gen-
|
|
6
|
-
import { getNetwork, getPresentableChainName } from "./network-
|
|
7
|
-
import { PROVIDER_ID, TransactionType } from "./_internal-
|
|
8
|
-
import { CollectibleCardAction } from "./types-
|
|
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, cn, compareAddress, formatPriceWithFee, truncateMiddle } from "./utils-
|
|
13
|
-
import { marketplaceConfigOptions } from "./marketplaceConfig-
|
|
14
|
-
import { SalesContractVersion, useSalesContractABI } from "./contracts-
|
|
15
|
-
import { balanceOfCollectibleOptions, checkoutOptionsQueryOptions, checkoutOptionsSalesContractQueryOptions, collectibleQueryOptions, collectionBalanceDetailsQueryOptions, collectionDetailsQueryOptions, collectionQueryOptions, comparePricesQueryOptions, convertPriceToUSDQueryOptions, countListingsForCollectibleQueryOptions, countOfCollectablesQueryOptions, countOfPrimarySaleItemsOptions, countOffersForCollectibleQueryOptions, currencyQueryOptions, filtersQueryOptions, floorOrderQueryOptions, getTokenRangesQueryOptions, highestOfferQueryOptions, inventoryOptions, listBalancesOptions, listCollectibleActivitiesQueryOptions, listCollectiblesPaginatedQueryOptions, listCollectiblesQueryOptions, listCollectionActivitiesQueryOptions, listCollectionsQueryOptions, listListingsForCollectibleQueryOptions, listPrimarySaleItemsQueryOptions, listTokenMetadataQueryOptions, lowestListingQueryOptions, marketCurrenciesQueryOptions, primarySaleItemsCountQueryOptions, searchTokenMetadataQueryOptions, tokenSuppliesQueryOptions } from "./queries-
|
|
16
|
-
import { waitForTransactionReceipt } from "./waitForTransactionReceipt-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useChain, useOpenConnectModal, useWaasFeeOptions } from "@0xsequence/connect";
|
|
3
|
+
import { BaseError as BaseError$1, ChainSwitchError, InvalidContractTypeError, NoWalletConnectedError, TransactionExecutionError, TransactionSignatureError, UserRejectedRequestError as UserRejectedRequestError$1 } from "./transaction-DZUW5RHu.js";
|
|
4
|
+
import { balanceQueries, collectableKeys, getMarketplaceClient, getQueryClient, getSequenceApiClient } from "./api-DuLKn__v.js";
|
|
5
|
+
import { CollectionStatus, ContractType, ExecuteType, OrderSide, OrderbookKind, PropertyType, StepType, WalletKind } from "./marketplace.gen-w2YvbEEo.js";
|
|
6
|
+
import { getNetwork, getPresentableChainName } from "./network-DtmiMhcg.js";
|
|
7
|
+
import { PROVIDER_ID, TransactionType } from "./_internal-DkS2VUn5.js";
|
|
8
|
+
import { CollectibleCardAction } from "./types-B_-cnkcP.js";
|
|
9
|
+
import { EIP2981_ABI, SequenceMarketplaceV1_ABI } from "./marketplace-BYY8OloA.js";
|
|
10
|
+
import { ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1 } from "./primary-sale-DOmNDq2P.js";
|
|
11
|
+
import { ERC1155_ABI, ERC721_ABI } from "./token-CcyLz8Z8.js";
|
|
12
|
+
import { calculateEarningsAfterFees, cn as cn$1, compareAddress, formatPriceWithFee, truncateMiddle } from "./utils-BZEkdqWK.js";
|
|
13
|
+
import { marketplaceConfigOptions } from "./marketplaceConfig-BTy75Mbf.js";
|
|
14
|
+
import { SalesContractVersion, useSalesContractABI } from "./contracts-D72LBOX3.js";
|
|
15
|
+
import { balanceOfCollectibleOptions, checkoutOptionsQueryOptions, checkoutOptionsSalesContractQueryOptions, collectibleQueryOptions, collectionBalanceDetailsQueryOptions, collectionDetailsQueryOptions, collectionQueryOptions, comparePricesQueryOptions, convertPriceToUSDQueryOptions, countListingsForCollectibleQueryOptions, countOfCollectablesQueryOptions, countOfPrimarySaleItemsOptions, countOffersForCollectibleQueryOptions, currencyQueryOptions, filtersQueryOptions, floorOrderQueryOptions, getTokenRangesQueryOptions, highestOfferQueryOptions, inventoryOptions, listBalancesOptions, listCollectibleActivitiesQueryOptions, listCollectiblesPaginatedQueryOptions, listCollectiblesQueryOptions, listCollectionActivitiesQueryOptions, listCollectionsQueryOptions, listListingsForCollectibleQueryOptions, listOffersForCollectibleQueryOptions, listPrimarySaleItemsQueryOptions, listTokenMetadataQueryOptions, lowestListingQueryOptions, marketCurrenciesQueryOptions, primarySaleItemsCountQueryOptions, searchTokenMetadataQueryOptions, tokenSuppliesQueryOptions } from "./queries-EMA5CcwY.js";
|
|
16
|
+
import { waitForTransactionReceipt } from "./waitForTransactionReceipt-B08YZiDY.js";
|
|
17
|
+
import { CalendarIcon_default, CartIcon_default, InfoIcon_default } from "./CartIcon-C8zbor8H.js";
|
|
18
|
+
import { FooterName, PriceDisplay, SaleDetailsPill, TokenTypeBalancePill } from "./components-CUv-wQr8.js";
|
|
20
19
|
import { NetworkType, networks } from "@0xsequence/network";
|
|
21
20
|
import { useAccount, useBalance, useChainId, usePublicClient, useReadContract, useReadContracts, useSendTransaction, useSignMessage, useSignTypedData, useSwitchChain, useWriteContract } from "wagmi";
|
|
21
|
+
import { useChain, useOpenConnectModal, useWaasFeeOptions } from "@0xsequence/connect";
|
|
22
22
|
import { Suspense, createContext, lazy, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
23
23
|
import { QueryClientProvider, queryOptions, skipToken, useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
|
24
24
|
import { TransactionStatus } from "@0xsequence/indexer";
|
|
25
|
-
import { AddIcon, Button, CheckmarkIcon, ChevronDownIcon,
|
|
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";
|
|
26
26
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
27
27
|
import * as dn from "dnum";
|
|
28
|
-
import { BaseError
|
|
28
|
+
import { BaseError, UserRejectedRequestError, WaitForTransactionReceiptTimeoutError, decodeFunctionData, encodeFunctionData, erc20Abi, erc721Abi, formatUnits, hexToBigInt, isAddress, isHex, maxUint256, parseEventLogs, parseUnits, toHex, zeroAddress } from "viem";
|
|
29
29
|
import { Databeat } from "@databeat/tracker";
|
|
30
30
|
import { observable } from "@legendapp/state";
|
|
31
|
-
import { createSerializer, parseAsBoolean, parseAsJson, parseAsString, useQueryState } from "nuqs";
|
|
32
31
|
import { createStore } from "@xstate/store";
|
|
33
32
|
import { useSelector } from "@xstate/store/react";
|
|
33
|
+
import { createSerializer, parseAsBoolean, parseAsJson, parseAsString, useQueryState } from "nuqs";
|
|
34
34
|
import { SequenceCheckoutProvider, useERC1155SaleContractCheckout, useSelectPaymentModal } from "@0xsequence/checkout";
|
|
35
35
|
import { Show, observer, use$ } from "@legendapp/state/react";
|
|
36
36
|
import { addDays, differenceInDays, format, formatDistanceToNow, isSameDay, startOfDay } from "date-fns";
|
|
@@ -40,7 +40,7 @@ import { addDays as addDays$1 } from "date-fns/addDays";
|
|
|
40
40
|
import { createPortal } from "react-dom";
|
|
41
41
|
|
|
42
42
|
//#region src/utils/_internal/error/context.ts
|
|
43
|
-
var MarketplaceSdkProviderNotFoundError = class extends BaseError {
|
|
43
|
+
var MarketplaceSdkProviderNotFoundError = class extends BaseError$1 {
|
|
44
44
|
name = "MarketplaceSDKProviderNotFoundError";
|
|
45
45
|
constructor() {
|
|
46
46
|
super("`useConfig` must be used within `MarketplaceSdkProvider`.");
|
|
@@ -49,7 +49,7 @@ var MarketplaceSdkProviderNotFoundError = class extends BaseError {
|
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/utils/_internal/error/config.ts
|
|
52
|
-
var ConfigError = class extends BaseError {
|
|
52
|
+
var ConfigError = class extends BaseError$1 {
|
|
53
53
|
name = "ConfigError";
|
|
54
54
|
};
|
|
55
55
|
var InvalidProjectAccessKeyError = class extends ConfigError {
|
|
@@ -98,8 +98,7 @@ var DatabeatAnalytics = class extends Databeat {
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
const useAnalytics = () => {
|
|
101
|
-
|
|
102
|
-
return context.analytics;
|
|
101
|
+
return useContext(MarketplaceSdkContext).analytics;
|
|
103
102
|
};
|
|
104
103
|
|
|
105
104
|
//#endregion
|
|
@@ -119,6 +118,7 @@ const ThemeProvider$1 = ({ children, theme, root }) => {
|
|
|
119
118
|
const MarketplaceSdkContext = createContext({});
|
|
120
119
|
function MarketplaceProvider({ config, children, openConnectModal }) {
|
|
121
120
|
if (config.projectAccessKey === "" || !config.projectAccessKey) throw new InvalidProjectAccessKeyError(config.projectAccessKey);
|
|
121
|
+
const isWindowDefined = typeof window !== "undefined";
|
|
122
122
|
const analytics = useMemo(() => {
|
|
123
123
|
const server = "https://nodes.sequence.app";
|
|
124
124
|
const auth = {};
|
|
@@ -126,23 +126,23 @@ function MarketplaceProvider({ config, children, openConnectModal }) {
|
|
|
126
126
|
return new DatabeatAnalytics(server, auth, {
|
|
127
127
|
defaultEnabled: true,
|
|
128
128
|
initProps: () => {
|
|
129
|
-
return { origin:
|
|
129
|
+
return { origin: isWindowDefined ? window.location.origin : "" };
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
-
}, [config.projectAccessKey,
|
|
132
|
+
}, [config.projectAccessKey, isWindowDefined]);
|
|
133
133
|
if (openConnectModal) {
|
|
134
134
|
const context = {
|
|
135
135
|
...config,
|
|
136
136
|
openConnectModal,
|
|
137
137
|
analytics
|
|
138
138
|
};
|
|
139
|
-
return /* @__PURE__ */ jsx(
|
|
139
|
+
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
140
140
|
value: context,
|
|
141
141
|
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children: /* @__PURE__ */ jsx("div", {
|
|
142
142
|
id: PROVIDER_ID,
|
|
143
143
|
children
|
|
144
144
|
}) })
|
|
145
|
-
})
|
|
145
|
+
});
|
|
146
146
|
}
|
|
147
147
|
return /* @__PURE__ */ jsx(MarketplaceProviderWithSequenceConnect, {
|
|
148
148
|
config,
|
|
@@ -164,13 +164,13 @@ function MarketplaceProviderWithSequenceConnect({ config, children, analytics })
|
|
|
164
164
|
openConnectModal: () => setOpenConnectModal(true),
|
|
165
165
|
analytics
|
|
166
166
|
};
|
|
167
|
-
return /* @__PURE__ */ jsx(
|
|
167
|
+
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
168
168
|
value: context,
|
|
169
169
|
children: /* @__PURE__ */ jsx("div", {
|
|
170
170
|
id: PROVIDER_ID,
|
|
171
171
|
children
|
|
172
172
|
})
|
|
173
|
-
})
|
|
173
|
+
});
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
//#endregion
|
|
@@ -227,8 +227,7 @@ const useMarketplaceConfig = () => {
|
|
|
227
227
|
function useBalanceOfCollectible(args) {
|
|
228
228
|
const config = useConfig();
|
|
229
229
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
230
|
-
const
|
|
231
|
-
const isLaos721 = collection?.contractType === ContractType.LAOS_ERC_721;
|
|
230
|
+
const isLaos721 = (marketplaceConfig?.market.collections.find((collection) => collection.itemsAddress === args.collectionAddress))?.contractType === ContractType.LAOS_ERC_721;
|
|
232
231
|
return useQuery(balanceOfCollectibleOptions({
|
|
233
232
|
...args,
|
|
234
233
|
isLaos721
|
|
@@ -717,8 +716,7 @@ const collectionDetailsPollingOptions = (args, config) => {
|
|
|
717
716
|
if (data && isTerminalState(data.status)) return false;
|
|
718
717
|
const currentAttempt = (query.state.dataUpdateCount || 0) + 1;
|
|
719
718
|
if (currentAttempt >= MAX_ATTEMPTS) return false;
|
|
720
|
-
|
|
721
|
-
return interval;
|
|
719
|
+
return Math.min(INITIAL_POLLING_INTERVAL * 1.5 ** currentAttempt, MAX_POLLING_INTERVAL);
|
|
722
720
|
},
|
|
723
721
|
refetchOnWindowFocus: false,
|
|
724
722
|
retry: false,
|
|
@@ -967,57 +965,55 @@ function useListMarketCardData({ collectionAddress, chainId, orderbookKind, coll
|
|
|
967
965
|
if (!collectiblesList?.pages) return [];
|
|
968
966
|
return collectiblesList.pages.flatMap((page) => page.collectibles);
|
|
969
967
|
}, [collectiblesList?.pages]);
|
|
970
|
-
const collectibleCards = useMemo(() => {
|
|
971
|
-
return allCollectibles.map((collectible) => {
|
|
972
|
-
const balance = collectionBalance?.balances.find((balance$1) => balance$1.tokenID === collectible.metadata.tokenId)?.balance;
|
|
973
|
-
const cardProps = {
|
|
974
|
-
collectibleId: collectible.metadata.tokenId,
|
|
975
|
-
chainId,
|
|
976
|
-
collectionAddress,
|
|
977
|
-
collectionType,
|
|
978
|
-
cardLoading: collectiblesListIsLoading || balanceLoading,
|
|
979
|
-
marketplaceType: "market",
|
|
980
|
-
orderbookKind,
|
|
981
|
-
collectible,
|
|
982
|
-
onCollectibleClick,
|
|
983
|
-
balance,
|
|
984
|
-
balanceIsLoading: balanceLoading,
|
|
985
|
-
onCannotPerformAction,
|
|
986
|
-
prioritizeOwnerActions,
|
|
987
|
-
assetSrcPrefixUrl,
|
|
988
|
-
onOfferClick: ({ order }) => {
|
|
989
|
-
if (!accountAddress) return;
|
|
990
|
-
if (balance) {
|
|
991
|
-
showSellModal({
|
|
992
|
-
chainId,
|
|
993
|
-
collectionAddress,
|
|
994
|
-
tokenId: collectible.metadata.tokenId,
|
|
995
|
-
order
|
|
996
|
-
});
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
return cardProps;
|
|
1002
|
-
});
|
|
1003
|
-
}, [
|
|
1004
|
-
allCollectibles,
|
|
1005
|
-
chainId,
|
|
1006
|
-
collectionAddress,
|
|
1007
|
-
collectionType,
|
|
1008
|
-
collectiblesListIsLoading,
|
|
1009
|
-
balanceLoading,
|
|
1010
|
-
orderbookKind,
|
|
1011
|
-
onCollectibleClick,
|
|
1012
|
-
collectionBalance?.balances,
|
|
1013
|
-
onCannotPerformAction,
|
|
1014
|
-
prioritizeOwnerActions,
|
|
1015
|
-
assetSrcPrefixUrl,
|
|
1016
|
-
accountAddress,
|
|
1017
|
-
showSellModal
|
|
1018
|
-
]);
|
|
1019
968
|
return {
|
|
1020
|
-
collectibleCards
|
|
969
|
+
collectibleCards: useMemo(() => {
|
|
970
|
+
return allCollectibles.map((collectible) => {
|
|
971
|
+
const balance = collectionBalance?.balances.find((balance$1) => balance$1.tokenID === collectible.metadata.tokenId)?.balance;
|
|
972
|
+
return {
|
|
973
|
+
collectibleId: collectible.metadata.tokenId,
|
|
974
|
+
chainId,
|
|
975
|
+
collectionAddress,
|
|
976
|
+
collectionType,
|
|
977
|
+
cardLoading: collectiblesListIsLoading || balanceLoading,
|
|
978
|
+
cardType: "market",
|
|
979
|
+
orderbookKind,
|
|
980
|
+
collectible,
|
|
981
|
+
onCollectibleClick,
|
|
982
|
+
balance,
|
|
983
|
+
balanceIsLoading: balanceLoading,
|
|
984
|
+
onCannotPerformAction,
|
|
985
|
+
prioritizeOwnerActions,
|
|
986
|
+
assetSrcPrefixUrl,
|
|
987
|
+
onOfferClick: ({ order }) => {
|
|
988
|
+
if (!accountAddress) return;
|
|
989
|
+
if (balance) {
|
|
990
|
+
showSellModal({
|
|
991
|
+
chainId,
|
|
992
|
+
collectionAddress,
|
|
993
|
+
tokenId: collectible.metadata.tokenId,
|
|
994
|
+
order
|
|
995
|
+
});
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
});
|
|
1001
|
+
}, [
|
|
1002
|
+
allCollectibles,
|
|
1003
|
+
chainId,
|
|
1004
|
+
collectionAddress,
|
|
1005
|
+
collectionType,
|
|
1006
|
+
collectiblesListIsLoading,
|
|
1007
|
+
balanceLoading,
|
|
1008
|
+
orderbookKind,
|
|
1009
|
+
onCollectibleClick,
|
|
1010
|
+
collectionBalance?.balances,
|
|
1011
|
+
onCannotPerformAction,
|
|
1012
|
+
prioritizeOwnerActions,
|
|
1013
|
+
assetSrcPrefixUrl,
|
|
1014
|
+
accountAddress,
|
|
1015
|
+
showSellModal
|
|
1016
|
+
]),
|
|
1021
1017
|
isLoading: collectiblesListIsLoading || balanceLoading,
|
|
1022
1018
|
error: collectiblesListError,
|
|
1023
1019
|
hasNextPage,
|
|
@@ -1335,31 +1331,53 @@ function useListListingsForCollectible(params) {
|
|
|
1335
1331
|
|
|
1336
1332
|
//#endregion
|
|
1337
1333
|
//#region src/react/hooks/data/orders/useListOffersForCollectible.tsx
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1334
|
+
/**
|
|
1335
|
+
* Hook to fetch offers for a specific collectible
|
|
1336
|
+
*
|
|
1337
|
+
* Fetches offers for a specific collectible from the marketplace.
|
|
1338
|
+
*
|
|
1339
|
+
* @param params - Configuration parameters
|
|
1340
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1341
|
+
* @param params.collectionAddress - The collection contract address
|
|
1342
|
+
* @param params.collectibleId - The specific collectible ID to fetch offers for
|
|
1343
|
+
* @param params.filter - Optional filtering parameters
|
|
1344
|
+
* @param params.page - Optional pagination parameters
|
|
1345
|
+
* @param params.query - Optional React Query configuration
|
|
1346
|
+
*
|
|
1347
|
+
* @returns Query result containing offers data
|
|
1348
|
+
*
|
|
1349
|
+
* @example
|
|
1350
|
+
* Basic usage:
|
|
1351
|
+
* ```typescript
|
|
1352
|
+
* const { data, isLoading } = useListOffersForCollectible({
|
|
1353
|
+
* chainId: 137,
|
|
1354
|
+
* collectionAddress: '0x...',
|
|
1355
|
+
* collectibleId: '1'
|
|
1356
|
+
* })
|
|
1357
|
+
* ```
|
|
1358
|
+
*
|
|
1359
|
+
* @example
|
|
1360
|
+
* With filtering:
|
|
1361
|
+
* ```typescript
|
|
1362
|
+
* const { data } = useListOffersForCollectible({
|
|
1363
|
+
* chainId: 1,
|
|
1364
|
+
* collectionAddress: '0x...',
|
|
1365
|
+
* collectibleId: '1',
|
|
1366
|
+
* filter: {
|
|
1367
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2]
|
|
1368
|
+
* }
|
|
1369
|
+
* })
|
|
1370
|
+
* ```
|
|
1371
|
+
*/
|
|
1372
|
+
function useListOffersForCollectible(params) {
|
|
1373
|
+
const defaultConfig = useConfig();
|
|
1374
|
+
const { config = defaultConfig,...rest } = params;
|
|
1375
|
+
const queryOptions$1 = listOffersForCollectibleQueryOptions({
|
|
1376
|
+
config,
|
|
1377
|
+
...rest
|
|
1357
1378
|
});
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
const config = useConfig();
|
|
1361
|
-
return useQuery(listOffersForCollectibleOptions(args, config));
|
|
1362
|
-
};
|
|
1379
|
+
return useQuery({ ...queryOptions$1 });
|
|
1380
|
+
}
|
|
1363
1381
|
|
|
1364
1382
|
//#endregion
|
|
1365
1383
|
//#region src/react/hooks/data/orders/useLowestListing.tsx
|
|
@@ -1439,15 +1457,11 @@ function useErc721SaleDetails({ chainId, salesContractAddress, itemsContractAddr
|
|
|
1439
1457
|
itemsContractAddress,
|
|
1440
1458
|
enabled: enabled && !versionLoading && version === SalesContractVersion.V1
|
|
1441
1459
|
});
|
|
1442
|
-
const saleDetails = saleDetailsV0 || saleDetailsV1;
|
|
1443
|
-
const quantityMinted = quantityMintedV0 || quantityMintedV1;
|
|
1444
|
-
const quantityTotal = quantityTotalV0 || quantityTotalV1;
|
|
1445
|
-
const quantityRemaining = quantityRemainingV0 || quantityRemainingV1;
|
|
1446
1460
|
return {
|
|
1447
|
-
saleDetails,
|
|
1448
|
-
quantityMinted,
|
|
1449
|
-
quantityTotal,
|
|
1450
|
-
quantityRemaining,
|
|
1461
|
+
saleDetails: saleDetailsV0 || saleDetailsV1,
|
|
1462
|
+
quantityMinted: quantityMintedV0 || quantityMintedV1,
|
|
1463
|
+
quantityTotal: quantityTotalV0 || quantityTotalV1,
|
|
1464
|
+
quantityRemaining: quantityRemainingV0 || quantityRemainingV1,
|
|
1451
1465
|
isLoading: versionLoading || saleDetailsLoadingV0 || saleDetailsLoadingV1,
|
|
1452
1466
|
error: versionError || saleDetailsErrorV0 || saleDetailsErrorV1
|
|
1453
1467
|
};
|
|
@@ -1815,7 +1829,7 @@ function useSearchTokenMetadata(params) {
|
|
|
1815
1829
|
chainId: params.chainId,
|
|
1816
1830
|
collectionAddress: params.collectionAddress,
|
|
1817
1831
|
includeMetadata: true,
|
|
1818
|
-
query: { enabled: onlyMinted && (params.query?.enabled ?? true) }
|
|
1832
|
+
query: { enabled: onlyMinted && !!params.collectionAddress && (params.query?.enabled ?? true) }
|
|
1819
1833
|
});
|
|
1820
1834
|
const queryOptions$1 = searchTokenMetadataQueryOptions({
|
|
1821
1835
|
config,
|
|
@@ -1871,15 +1885,17 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1871
1885
|
enabled
|
|
1872
1886
|
});
|
|
1873
1887
|
const config = useConfig();
|
|
1874
|
-
const
|
|
1888
|
+
const tokenSuppliesEnabled = Boolean(chainId && contractAddress && config && (enabled ?? true));
|
|
1889
|
+
const { data: tokenSuppliesData, fetchNextPage: fetchNextTokenSuppliesPage, hasNextPage: hasNextSuppliesPage, isFetchingNextPage: isFetchingNextSuppliesPage, isLoading: tokenSuppliesLoading } = useInfiniteQuery({ ...tokenSuppliesQueryOptions({
|
|
1875
1890
|
chainId,
|
|
1876
1891
|
collectionAddress: contractAddress,
|
|
1877
1892
|
includeMetadata: true,
|
|
1878
|
-
config
|
|
1893
|
+
config,
|
|
1894
|
+
query: { enabled: tokenSuppliesEnabled }
|
|
1879
1895
|
}) });
|
|
1880
|
-
const { data: tokenSuppliesData, fetchNextPage: fetchNextTokenSuppliesPage, hasNextPage: hasNextSuppliesPage, isFetchingNextPage: isFetchingNextSuppliesPage, isLoading: tokenSuppliesLoading } = tokenSuppliesQuery;
|
|
1881
1896
|
useEffect(() => {
|
|
1882
1897
|
async function fetchAllPages() {
|
|
1898
|
+
if (!tokenSuppliesEnabled) return;
|
|
1883
1899
|
if (!hasNextSuppliesPage && tokenSuppliesData) {
|
|
1884
1900
|
setAllTokenSuppliesFetched(true);
|
|
1885
1901
|
return;
|
|
@@ -1892,7 +1908,8 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1892
1908
|
hasNextSuppliesPage,
|
|
1893
1909
|
isFetchingNextSuppliesPage,
|
|
1894
1910
|
tokenSuppliesLoading,
|
|
1895
|
-
fetchNextTokenSuppliesPage
|
|
1911
|
+
fetchNextTokenSuppliesPage,
|
|
1912
|
+
tokenSuppliesEnabled
|
|
1896
1913
|
]);
|
|
1897
1914
|
const allTokenSupplies = tokenSuppliesData?.pages.flatMap((page) => page.tokenIDs);
|
|
1898
1915
|
const matchingTokenSupplies = allTokenSupplies?.filter((item) => primarySaleItemsWithMetadata.some((primarySaleItem) => primarySaleItem.metadata.tokenId === item.tokenID));
|
|
@@ -1903,8 +1920,7 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1903
1920
|
functionName: "saleDetails",
|
|
1904
1921
|
query: { enabled: enabled && !versionLoading && !!abi }
|
|
1905
1922
|
});
|
|
1906
|
-
const
|
|
1907
|
-
const primarySaleItemsCollectibleCards = unmintedPrimarySaleItems.map((item) => {
|
|
1923
|
+
const primarySaleItemsCollectibleCards = primarySaleItemsWithMetadata.filter((item) => !matchingTokenSupplies?.some((supply) => supply.tokenID === item.metadata.tokenId)).map((item) => {
|
|
1908
1924
|
const { metadata, primarySaleItem } = item;
|
|
1909
1925
|
const salePrice = {
|
|
1910
1926
|
amount: primarySaleItem.priceAmount?.toString(),
|
|
@@ -1928,7 +1944,7 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1928
1944
|
quantityDecimals: 0,
|
|
1929
1945
|
saleStartsAt,
|
|
1930
1946
|
saleEndsAt,
|
|
1931
|
-
|
|
1947
|
+
cardType: "shop"
|
|
1932
1948
|
};
|
|
1933
1949
|
});
|
|
1934
1950
|
const mintedTokensCollectibleCards = allTokenSupplies?.map((item) => {
|
|
@@ -1949,7 +1965,7 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1949
1965
|
quantityDecimals: 0,
|
|
1950
1966
|
saleStartsAt: void 0,
|
|
1951
1967
|
saleEndsAt: void 0,
|
|
1952
|
-
|
|
1968
|
+
cardType: "shop"
|
|
1953
1969
|
};
|
|
1954
1970
|
});
|
|
1955
1971
|
const collectibleCards = showAvailableSales ? primarySaleItemsCollectibleCards : [...mintedTokensCollectibleCards ?? [], ...primarySaleItemsCollectibleCards];
|
|
@@ -1958,126 +1974,63 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1958
1974
|
collectibleCards,
|
|
1959
1975
|
saleDetailsError,
|
|
1960
1976
|
saleDetails,
|
|
1961
|
-
isLoading: saleDetailsLoading || tokenSuppliesLoading || !allTokenSuppliesFetched,
|
|
1977
|
+
isLoading: enabled && (saleDetailsLoading || tokenSuppliesLoading || !allTokenSuppliesFetched),
|
|
1962
1978
|
tokenSuppliesData
|
|
1963
1979
|
};
|
|
1964
1980
|
}
|
|
1965
1981
|
|
|
1966
1982
|
//#endregion
|
|
1967
|
-
//#region src/react/hooks/
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
if (!filter) return void 0;
|
|
1995
|
-
if (filter.type === PropertyType.INT) return {
|
|
1996
|
-
type: PropertyType.INT,
|
|
1997
|
-
min: filter.min ?? 0,
|
|
1998
|
-
max: filter.max ?? 0
|
|
1983
|
+
//#region src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx
|
|
1984
|
+
function useList1155ShopCardData({ primarySaleItemsWithMetadata, chainId, contractAddress, salesContractAddress, enabled = true }) {
|
|
1985
|
+
const { abi, isLoading: versionLoading } = useSalesContractABI({
|
|
1986
|
+
contractAddress: salesContractAddress,
|
|
1987
|
+
contractType: ContractType.ERC1155,
|
|
1988
|
+
chainId,
|
|
1989
|
+
enabled
|
|
1990
|
+
});
|
|
1991
|
+
const { data: collection, isLoading: collectionLoading } = useCollection({
|
|
1992
|
+
chainId,
|
|
1993
|
+
collectionAddress: contractAddress,
|
|
1994
|
+
query: { enabled }
|
|
1995
|
+
});
|
|
1996
|
+
const { data: paymentToken, isLoading: paymentTokenLoading } = useReadContract({
|
|
1997
|
+
chainId,
|
|
1998
|
+
address: salesContractAddress,
|
|
1999
|
+
abi: abi || [],
|
|
2000
|
+
functionName: "paymentToken",
|
|
2001
|
+
query: { enabled: enabled && !versionLoading && !!abi }
|
|
2002
|
+
});
|
|
2003
|
+
const isLoading = versionLoading || collectionLoading || paymentTokenLoading;
|
|
2004
|
+
return {
|
|
2005
|
+
collectibleCards: primarySaleItemsWithMetadata.map((item) => {
|
|
2006
|
+
const { metadata, primarySaleItem: saleData } = item;
|
|
2007
|
+
const salePrice = {
|
|
2008
|
+
amount: saleData?.priceAmount?.toString() || "",
|
|
2009
|
+
currencyAddress: saleData?.currencyAddress || paymentToken || "0x"
|
|
1999
2010
|
};
|
|
2011
|
+
const supply = saleData?.supply?.toString();
|
|
2012
|
+
const unlimitedSupply = saleData?.unlimitedSupply;
|
|
2000
2013
|
return {
|
|
2001
|
-
|
|
2002
|
-
|
|
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"
|
|
2003
2029
|
};
|
|
2004
|
-
},
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
isStringValueSelected: (name, value) => {
|
|
2009
|
-
const filter = filterOptions?.find((f) => f.name === name);
|
|
2010
|
-
if (!filter || filter.type !== PropertyType.STRING) return false;
|
|
2011
|
-
return filter.values?.includes(value) ?? false;
|
|
2012
|
-
},
|
|
2013
|
-
isIntFilterActive: (name) => {
|
|
2014
|
-
const filter = filterOptions?.find((f) => f.name === name);
|
|
2015
|
-
return !!filter && filter.type === PropertyType.INT;
|
|
2016
|
-
},
|
|
2017
|
-
getIntFilterRange: (name) => {
|
|
2018
|
-
const filter = filterOptions?.find((f) => f.name === name);
|
|
2019
|
-
if (!filter || filter.type !== PropertyType.INT) return void 0;
|
|
2020
|
-
return [filter.min ?? 0, filter.max ?? 0];
|
|
2021
|
-
},
|
|
2022
|
-
deleteFilter: (name) => {
|
|
2023
|
-
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
2024
|
-
setFilterOptions(otherFilters);
|
|
2025
|
-
},
|
|
2026
|
-
toggleStringFilterValue: (name, value) => {
|
|
2027
|
-
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
2028
|
-
const filter = filterOptions?.find((f) => f.name === name);
|
|
2029
|
-
const existingValues = filter?.type === PropertyType.STRING ? filter.values ?? [] : [];
|
|
2030
|
-
if (existingValues.includes(value)) {
|
|
2031
|
-
const newValues = existingValues.filter((v) => v !== value);
|
|
2032
|
-
if (newValues.length === 0) {
|
|
2033
|
-
setFilterOptions(otherFilters);
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
setFilterOptions([...otherFilters, {
|
|
2037
|
-
name,
|
|
2038
|
-
type: PropertyType.STRING,
|
|
2039
|
-
values: newValues
|
|
2040
|
-
}]);
|
|
2041
|
-
} else setFilterOptions([...otherFilters, {
|
|
2042
|
-
name,
|
|
2043
|
-
type: PropertyType.STRING,
|
|
2044
|
-
values: [...existingValues, value]
|
|
2045
|
-
}]);
|
|
2046
|
-
},
|
|
2047
|
-
setIntFilterValue: (name, min, max) => {
|
|
2048
|
-
if (min === max && min === 0) {
|
|
2049
|
-
const otherFilters$1 = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
2050
|
-
setFilterOptions(otherFilters$1);
|
|
2051
|
-
return;
|
|
2052
|
-
}
|
|
2053
|
-
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
2054
|
-
setFilterOptions([...otherFilters, {
|
|
2055
|
-
name,
|
|
2056
|
-
type: PropertyType.INT,
|
|
2057
|
-
min,
|
|
2058
|
-
max
|
|
2059
|
-
}]);
|
|
2060
|
-
},
|
|
2061
|
-
clearAllFilters: () => {
|
|
2062
|
-
setShowListedOnly(false);
|
|
2063
|
-
setFilterOptions([]);
|
|
2064
|
-
setSearchText("");
|
|
2065
|
-
}
|
|
2066
|
-
}), [
|
|
2067
|
-
filterOptions,
|
|
2068
|
-
setFilterOptions,
|
|
2069
|
-
setShowListedOnly,
|
|
2070
|
-
setSearchText
|
|
2071
|
-
]);
|
|
2072
|
-
return {
|
|
2073
|
-
filterOptions,
|
|
2074
|
-
searchText,
|
|
2075
|
-
showListedOnly,
|
|
2076
|
-
setFilterOptions,
|
|
2077
|
-
setSearchText,
|
|
2078
|
-
setShowListedOnly,
|
|
2079
|
-
...helpers,
|
|
2080
|
-
serialize
|
|
2030
|
+
}),
|
|
2031
|
+
tokenMetadataError: null,
|
|
2032
|
+
tokenSaleDetailsError: null,
|
|
2033
|
+
isLoading: enabled && isLoading
|
|
2081
2034
|
};
|
|
2082
2035
|
}
|
|
2083
2036
|
|
|
@@ -2131,77 +2084,13 @@ function useListPrimarySaleItems(params) {
|
|
|
2131
2084
|
return useInfiniteQuery(queryOptions$1);
|
|
2132
2085
|
}
|
|
2133
2086
|
|
|
2134
|
-
//#endregion
|
|
2135
|
-
//#region src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx
|
|
2136
|
-
function useList1155ShopCardData({ tokenIds, chainId, contractAddress, salesContractAddress, enabled = true }) {
|
|
2137
|
-
const { showListedOnly } = useFilterState();
|
|
2138
|
-
const { abi, isLoading: versionLoading } = useSalesContractABI({
|
|
2139
|
-
contractAddress: salesContractAddress,
|
|
2140
|
-
contractType: ContractType.ERC1155,
|
|
2141
|
-
chainId,
|
|
2142
|
-
enabled
|
|
2143
|
-
});
|
|
2144
|
-
const { data: primarySaleItems, isLoading: primarySaleItemsLoading, error: primarySaleItemsError } = useListPrimarySaleItems({
|
|
2145
|
-
chainId,
|
|
2146
|
-
primarySaleContractAddress: salesContractAddress,
|
|
2147
|
-
filter: { includeEmpty: !showListedOnly }
|
|
2148
|
-
});
|
|
2149
|
-
const { data: collection, isLoading: collectionLoading } = useCollection({
|
|
2150
|
-
chainId,
|
|
2151
|
-
collectionAddress: contractAddress
|
|
2152
|
-
});
|
|
2153
|
-
const { data: paymentToken, isLoading: paymentTokenLoading } = useReadContract({
|
|
2154
|
-
chainId,
|
|
2155
|
-
address: salesContractAddress,
|
|
2156
|
-
abi: abi || [],
|
|
2157
|
-
functionName: "paymentToken",
|
|
2158
|
-
query: { enabled: enabled && !versionLoading && !!abi }
|
|
2159
|
-
});
|
|
2160
|
-
const isLoading = primarySaleItemsLoading || collectionLoading || paymentTokenLoading;
|
|
2161
|
-
const allPrimarySaleItems = primarySaleItems?.pages.flatMap((page) => page.primarySaleItems) ?? [];
|
|
2162
|
-
const collectibleCards = tokenIds.map((tokenId) => {
|
|
2163
|
-
const matchingPrimarySaleItem = allPrimarySaleItems.find((item) => item.primarySaleItem.tokenId?.toString() === tokenId);
|
|
2164
|
-
const saleData = matchingPrimarySaleItem?.primarySaleItem;
|
|
2165
|
-
const tokenMetadata = matchingPrimarySaleItem?.metadata || {};
|
|
2166
|
-
const salePrice = {
|
|
2167
|
-
amount: saleData?.priceAmount?.toString() || "",
|
|
2168
|
-
currencyAddress: saleData?.currencyAddress || paymentToken || "0x"
|
|
2169
|
-
};
|
|
2170
|
-
const supply = saleData?.supply?.toString();
|
|
2171
|
-
const unlimitedSupply = saleData?.unlimitedSupply;
|
|
2172
|
-
return {
|
|
2173
|
-
collectibleId: tokenId,
|
|
2174
|
-
chainId,
|
|
2175
|
-
collectionAddress: contractAddress,
|
|
2176
|
-
collectionType: ContractType.ERC1155,
|
|
2177
|
-
tokenMetadata,
|
|
2178
|
-
cardLoading: isLoading,
|
|
2179
|
-
salesContractAddress,
|
|
2180
|
-
salePrice,
|
|
2181
|
-
quantityInitial: supply,
|
|
2182
|
-
quantityDecimals: collection?.decimals || 0,
|
|
2183
|
-
quantityRemaining: supply,
|
|
2184
|
-
unlimitedSupply,
|
|
2185
|
-
saleStartsAt: saleData?.startDate?.toString(),
|
|
2186
|
-
saleEndsAt: saleData?.endDate?.toString(),
|
|
2187
|
-
marketplaceType: "shop"
|
|
2188
|
-
};
|
|
2189
|
-
});
|
|
2190
|
-
return {
|
|
2191
|
-
collectibleCards,
|
|
2192
|
-
tokenMetadataError: primarySaleItemsError,
|
|
2193
|
-
tokenSaleDetailsError: null,
|
|
2194
|
-
isLoading
|
|
2195
|
-
};
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
2087
|
//#endregion
|
|
2199
2088
|
//#region src/react/hooks/data/inventory/useInventory.tsx
|
|
2200
2089
|
function useInventory(args) {
|
|
2201
2090
|
const config = useConfig();
|
|
2202
2091
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
2203
2092
|
const isLaos721 = marketplaceConfig?.market?.collections?.find((c) => c.itemsAddress === args.collectionAddress && c.chainId === args.chainId)?.contractType === ContractType.LAOS_ERC_721;
|
|
2204
|
-
return
|
|
2093
|
+
return useQuery(inventoryOptions({
|
|
2205
2094
|
...args,
|
|
2206
2095
|
isLaos721
|
|
2207
2096
|
}, config));
|
|
@@ -2307,7 +2196,7 @@ function useAutoSelectFeeOption({ pendingFeeOptionConfirmation, enabled }) {
|
|
|
2307
2196
|
useEffect(() => {
|
|
2308
2197
|
if (combinedBalances) console.debug("currency balances", combinedBalances);
|
|
2309
2198
|
}, [combinedBalances]);
|
|
2310
|
-
|
|
2199
|
+
return useCallback(async () => {
|
|
2311
2200
|
if (!userAddress) return {
|
|
2312
2201
|
selectedOption: null,
|
|
2313
2202
|
error: AutoSelectFeeOptionError.UserNotConnected
|
|
@@ -2345,8 +2234,7 @@ function useAutoSelectFeeOption({ pendingFeeOptionConfirmation, enabled }) {
|
|
|
2345
2234
|
isBalanceDetailsLoading,
|
|
2346
2235
|
isBalanceDetailsError,
|
|
2347
2236
|
combinedBalances
|
|
2348
|
-
]);
|
|
2349
|
-
return autoSelectedOption();
|
|
2237
|
+
])();
|
|
2350
2238
|
}
|
|
2351
2239
|
|
|
2352
2240
|
//#endregion
|
|
@@ -2462,92 +2350,51 @@ const MODAL_CONTENT_PROPS = { style: {
|
|
|
2462
2350
|
} };
|
|
2463
2351
|
|
|
2464
2352
|
//#endregion
|
|
2465
|
-
//#region src/react/ui/modals/_internal/components/
|
|
2353
|
+
//#region src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts
|
|
2466
2354
|
const initialContext$4 = {
|
|
2467
2355
|
isOpen: false,
|
|
2468
2356
|
chainIdToSwitchTo: void 0,
|
|
2469
|
-
isSwitching: false
|
|
2470
|
-
onSuccess: void 0,
|
|
2471
|
-
onError: void 0,
|
|
2472
|
-
onClose: void 0
|
|
2357
|
+
isSwitching: false
|
|
2473
2358
|
};
|
|
2474
|
-
const
|
|
2359
|
+
const switchChainErrorModalStore = createStore({
|
|
2475
2360
|
context: initialContext$4,
|
|
2476
2361
|
on: {
|
|
2477
2362
|
open: (context, event) => ({
|
|
2478
2363
|
...context,
|
|
2479
2364
|
isOpen: true,
|
|
2480
|
-
chainIdToSwitchTo: event.chainIdToSwitchTo
|
|
2481
|
-
onSuccess: event.onSuccess,
|
|
2482
|
-
onError: event.onError,
|
|
2483
|
-
onClose: event.onClose
|
|
2365
|
+
chainIdToSwitchTo: event.chainIdToSwitchTo
|
|
2484
2366
|
}),
|
|
2485
2367
|
close: (context) => ({
|
|
2486
2368
|
...context,
|
|
2487
2369
|
isOpen: false,
|
|
2488
2370
|
chainIdToSwitchTo: void 0,
|
|
2489
|
-
isSwitching: false
|
|
2490
|
-
onSuccess: void 0,
|
|
2491
|
-
onError: void 0,
|
|
2492
|
-
onClose: void 0
|
|
2493
|
-
}),
|
|
2494
|
-
setSwitching: (context, event) => ({
|
|
2495
|
-
...context,
|
|
2496
|
-
isSwitching: event.isSwitching
|
|
2371
|
+
isSwitching: false
|
|
2497
2372
|
})
|
|
2498
2373
|
}
|
|
2499
2374
|
});
|
|
2500
|
-
const useIsOpen$4 = () => useSelector(
|
|
2501
|
-
const useChainIdToSwitchTo = () => useSelector(
|
|
2502
|
-
const useIsSwitching = () => useSelector(switchChainModalStore, (state) => state.context.isSwitching);
|
|
2503
|
-
const useOnSuccess$1 = () => useSelector(switchChainModalStore, (state) => state.context.onSuccess);
|
|
2504
|
-
const useOnError$1 = () => useSelector(switchChainModalStore, (state) => state.context.onError);
|
|
2505
|
-
const useOnClose = () => useSelector(switchChainModalStore, (state) => state.context.onClose);
|
|
2375
|
+
const useIsOpen$4 = () => useSelector(switchChainErrorModalStore, (state) => state.context.isOpen);
|
|
2376
|
+
const useChainIdToSwitchTo = () => useSelector(switchChainErrorModalStore, (state) => state.context.chainIdToSwitchTo);
|
|
2506
2377
|
|
|
2507
2378
|
//#endregion
|
|
2508
|
-
//#region src/react/ui/modals/_internal/components/
|
|
2509
|
-
const
|
|
2379
|
+
//#region src/react/ui/modals/_internal/components/switchChainErrorModal/index.tsx
|
|
2380
|
+
const useSwitchChainErrorModal = () => {
|
|
2510
2381
|
return {
|
|
2511
|
-
show: (args) =>
|
|
2382
|
+
show: (args) => switchChainErrorModalStore.send({
|
|
2512
2383
|
type: "open",
|
|
2513
2384
|
...args
|
|
2514
2385
|
}),
|
|
2515
|
-
close: () =>
|
|
2386
|
+
close: () => switchChainErrorModalStore.send({ type: "close" })
|
|
2516
2387
|
};
|
|
2517
2388
|
};
|
|
2518
|
-
const
|
|
2389
|
+
const SwitchChainErrorModal = () => {
|
|
2390
|
+
const { chainId: currentChainId } = useAccount();
|
|
2519
2391
|
const isOpen = useIsOpen$4();
|
|
2520
2392
|
const chainIdToSwitchTo = useChainIdToSwitchTo();
|
|
2521
|
-
const isSwitching = useIsSwitching();
|
|
2522
|
-
const onSuccess = useOnSuccess$1();
|
|
2523
|
-
const onError = useOnError$1();
|
|
2524
|
-
const onClose = useOnClose();
|
|
2525
2393
|
const chainName = chainIdToSwitchTo ? getPresentableChainName(chainIdToSwitchTo) : "";
|
|
2526
|
-
const { switchChainAsync } = useSwitchChain();
|
|
2527
|
-
async function handleSwitchChain() {
|
|
2528
|
-
switchChainModalStore.send({
|
|
2529
|
-
type: "setSwitching",
|
|
2530
|
-
isSwitching: true
|
|
2531
|
-
});
|
|
2532
|
-
try {
|
|
2533
|
-
if (!chainIdToSwitchTo) return;
|
|
2534
|
-
await switchChainAsync({ chainId: Number(chainIdToSwitchTo) });
|
|
2535
|
-
if (onSuccess && typeof onSuccess === "function") onSuccess();
|
|
2536
|
-
switchChainModalStore.send({ type: "close" });
|
|
2537
|
-
} catch (error) {
|
|
2538
|
-
if (error instanceof Error && onError && typeof onError === "function") onError(error);
|
|
2539
|
-
} finally {
|
|
2540
|
-
switchChainModalStore.send({
|
|
2541
|
-
type: "setSwitching",
|
|
2542
|
-
isSwitching: false
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
2394
|
const handleClose = () => {
|
|
2547
|
-
|
|
2548
|
-
switchChainModalStore.send({ type: "close" });
|
|
2395
|
+
switchChainErrorModalStore.send({ type: "close" });
|
|
2549
2396
|
};
|
|
2550
|
-
if (!isOpen || !chainIdToSwitchTo) return null;
|
|
2397
|
+
if (!isOpen || !chainIdToSwitchTo || currentChainId === chainIdToSwitchTo) return null;
|
|
2551
2398
|
return /* @__PURE__ */ jsx(Modal, {
|
|
2552
2399
|
isDismissible: true,
|
|
2553
2400
|
onClose: handleClose,
|
|
@@ -2556,88 +2403,62 @@ const SwitchChainModal = () => {
|
|
|
2556
2403
|
overlayProps: MODAL_OVERLAY_PROPS,
|
|
2557
2404
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2558
2405
|
className: "grid flex-col gap-6 p-7",
|
|
2559
|
-
children: [
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
message: `You need to switch to ${chainName} network before completing the transaction`
|
|
2569
|
-
}),
|
|
2570
|
-
/* @__PURE__ */ jsx(Button, {
|
|
2571
|
-
className: `${isSwitching ? "flex w-[147px] items-center justify-center [&>div]:justify-center" : "w-[147px]"} flex justify-self-end`,
|
|
2572
|
-
name: "switch-chain",
|
|
2573
|
-
id: "switch-chain-button",
|
|
2574
|
-
size: "sm",
|
|
2575
|
-
label: isSwitching ? /* @__PURE__ */ jsx("div", {
|
|
2576
|
-
"data-testid": "switch-chain-spinner",
|
|
2577
|
-
children: /* @__PURE__ */ jsx(Spinner, { className: "spinner" })
|
|
2578
|
-
}) : "Switch Network",
|
|
2579
|
-
variant: "primary",
|
|
2580
|
-
pending: isSwitching,
|
|
2581
|
-
shape: "square",
|
|
2582
|
-
onClick: handleSwitchChain,
|
|
2583
|
-
"data-testid": "switch-chain-button"
|
|
2584
|
-
})
|
|
2585
|
-
]
|
|
2406
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2407
|
+
className: "text-xl",
|
|
2408
|
+
fontWeight: "bold",
|
|
2409
|
+
color: "text100",
|
|
2410
|
+
children: "Switching network failed"
|
|
2411
|
+
}), /* @__PURE__ */ jsx(AlertMessage, {
|
|
2412
|
+
type: "warning",
|
|
2413
|
+
message: `There was an error switching to ${chainName}. Please try changing the network in your wallet manually.`
|
|
2414
|
+
})]
|
|
2586
2415
|
})
|
|
2587
2416
|
});
|
|
2588
2417
|
};
|
|
2589
|
-
var
|
|
2418
|
+
var switchChainErrorModal_default = SwitchChainErrorModal;
|
|
2590
2419
|
|
|
2591
2420
|
//#endregion
|
|
2592
2421
|
//#region src/react/hooks/utils/useEnsureCorrectChain.ts
|
|
2593
2422
|
const useEnsureCorrectChain = () => {
|
|
2594
2423
|
const { chainId: currentChainId } = useAccount();
|
|
2595
2424
|
const { switchChain, switchChainAsync } = useSwitchChain();
|
|
2596
|
-
const { show:
|
|
2425
|
+
const { show: showSwitchChainErrorModal, close: closeSwitchChainErrorModal } = useSwitchChainErrorModal();
|
|
2426
|
+
const chainIdToSwitchTo = useChainIdToSwitchTo();
|
|
2597
2427
|
const { isWaaS } = useConnectorMetadata();
|
|
2428
|
+
useEffect(() => {
|
|
2429
|
+
if (currentChainId && chainIdToSwitchTo && currentChainId === chainIdToSwitchTo) closeSwitchChainErrorModal();
|
|
2430
|
+
}, [
|
|
2431
|
+
currentChainId,
|
|
2432
|
+
chainIdToSwitchTo,
|
|
2433
|
+
closeSwitchChainErrorModal
|
|
2434
|
+
]);
|
|
2598
2435
|
const ensureCorrectChainAsync = useCallback(async (targetChainId) => {
|
|
2599
2436
|
if (currentChainId === targetChainId) return Promise.resolve();
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
showSwitchChainModal({
|
|
2603
|
-
chainIdToSwitchTo: targetChainId,
|
|
2604
|
-
onSuccess: () => resolve(targetChainId),
|
|
2605
|
-
onError: (error) => reject(error),
|
|
2606
|
-
onClose: () => reject(new ChainSwitchUserRejectedError())
|
|
2607
|
-
});
|
|
2437
|
+
return switchChainAsync({ chainId: targetChainId }).catch(() => {
|
|
2438
|
+
showSwitchChainErrorModal({ chainIdToSwitchTo: targetChainId });
|
|
2608
2439
|
});
|
|
2609
2440
|
}, [
|
|
2610
2441
|
currentChainId,
|
|
2611
2442
|
isWaaS,
|
|
2612
2443
|
switchChainAsync,
|
|
2613
|
-
|
|
2444
|
+
showSwitchChainErrorModal
|
|
2614
2445
|
]);
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2446
|
+
return {
|
|
2447
|
+
ensureCorrectChain: useCallback((targetChainId, callbacks) => {
|
|
2448
|
+
if (currentChainId === targetChainId) {
|
|
2449
|
+
callbacks?.onSuccess?.();
|
|
2450
|
+
return;
|
|
2451
|
+
}
|
|
2621
2452
|
switchChain({ chainId: targetChainId }, {
|
|
2622
2453
|
onSuccess: callbacks?.onSuccess,
|
|
2623
|
-
onError:
|
|
2454
|
+
onError: () => showSwitchChainErrorModal({ chainIdToSwitchTo: targetChainId })
|
|
2624
2455
|
});
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
onClose: callbacks?.onClose
|
|
2632
|
-
});
|
|
2633
|
-
}, [
|
|
2634
|
-
currentChainId,
|
|
2635
|
-
isWaaS,
|
|
2636
|
-
switchChain,
|
|
2637
|
-
showSwitchChainModal
|
|
2638
|
-
]);
|
|
2639
|
-
return {
|
|
2640
|
-
ensureCorrectChain,
|
|
2456
|
+
}, [
|
|
2457
|
+
currentChainId,
|
|
2458
|
+
isWaaS,
|
|
2459
|
+
switchChain,
|
|
2460
|
+
showSwitchChainErrorModal
|
|
2461
|
+
]),
|
|
2641
2462
|
ensureCorrectChainAsync,
|
|
2642
2463
|
currentChainId
|
|
2643
2464
|
};
|
|
@@ -2646,8 +2467,7 @@ const useEnsureCorrectChain = () => {
|
|
|
2646
2467
|
//#endregion
|
|
2647
2468
|
//#region src/react/hooks/transactions/useGenerateCancelTransaction.tsx
|
|
2648
2469
|
const generateCancelTransaction = async (args, config) => {
|
|
2649
|
-
|
|
2650
|
-
return marketplaceClient.generateCancelTransaction({
|
|
2470
|
+
return getMarketplaceClient(config).generateCancelTransaction({
|
|
2651
2471
|
...args,
|
|
2652
2472
|
chainId: String(args.chainId)
|
|
2653
2473
|
}).then((data) => data.steps);
|
|
@@ -2690,8 +2510,9 @@ const useProcessStep = () => {
|
|
|
2690
2510
|
const config = useConfig();
|
|
2691
2511
|
const marketplaceClient = getMarketplaceClient(config);
|
|
2692
2512
|
const processStep = async (step, chainId) => {
|
|
2693
|
-
if (isTransactionStep(step)) {
|
|
2694
|
-
|
|
2513
|
+
if (isTransactionStep(step)) return {
|
|
2514
|
+
type: "transaction",
|
|
2515
|
+
hash: await sendTransactionAsync({
|
|
2695
2516
|
chainId,
|
|
2696
2517
|
to: step.to,
|
|
2697
2518
|
data: step.data,
|
|
@@ -2699,12 +2520,8 @@ const useProcessStep = () => {
|
|
|
2699
2520
|
...step.maxFeePerGas && { maxFeePerGas: hexToBigInt(step.maxFeePerGas) },
|
|
2700
2521
|
...step.maxPriorityFeePerGas && { maxPriorityFeePerGas: hexToBigInt(step.maxPriorityFeePerGas) },
|
|
2701
2522
|
...step.gas && { gas: hexToBigInt(step.gas) }
|
|
2702
|
-
})
|
|
2703
|
-
|
|
2704
|
-
type: "transaction",
|
|
2705
|
-
hash
|
|
2706
|
-
};
|
|
2707
|
-
}
|
|
2523
|
+
})
|
|
2524
|
+
};
|
|
2708
2525
|
if (isSignatureStep(step)) {
|
|
2709
2526
|
let signature;
|
|
2710
2527
|
if (step.id === StepType.signEIP191) {
|
|
@@ -2720,20 +2537,17 @@ const useProcessStep = () => {
|
|
|
2720
2537
|
});
|
|
2721
2538
|
}
|
|
2722
2539
|
if (!signature) throw new Error("Failed to sign message");
|
|
2723
|
-
if (step.post) {
|
|
2724
|
-
|
|
2540
|
+
if (step.post) return {
|
|
2541
|
+
type: "signature",
|
|
2542
|
+
orderId: (await marketplaceClient.execute({
|
|
2725
2543
|
chainId: String(chainId),
|
|
2726
2544
|
signature,
|
|
2727
2545
|
method: step.post.method,
|
|
2728
2546
|
endpoint: step.post.endpoint,
|
|
2729
2547
|
body: step.post.body,
|
|
2730
2548
|
executeType: ExecuteType.order
|
|
2731
|
-
})
|
|
2732
|
-
|
|
2733
|
-
type: "signature",
|
|
2734
|
-
orderId: result.orderId
|
|
2735
|
-
};
|
|
2736
|
-
}
|
|
2549
|
+
})).orderId
|
|
2550
|
+
};
|
|
2737
2551
|
return {
|
|
2738
2552
|
type: "signature",
|
|
2739
2553
|
signature
|
|
@@ -2756,14 +2570,13 @@ const useCancelTransactionSteps = ({ collectionAddress, chainId, callbacks, setS
|
|
|
2756
2570
|
try {
|
|
2757
2571
|
if (!address) throw new NoWalletConnectedError();
|
|
2758
2572
|
if (!address) throw new Error("Wallet address not found");
|
|
2759
|
-
|
|
2573
|
+
return await generateCancelTransactionAsync({
|
|
2760
2574
|
chainId,
|
|
2761
2575
|
collectionAddress,
|
|
2762
2576
|
maker: address,
|
|
2763
2577
|
marketplace,
|
|
2764
2578
|
orderId
|
|
2765
2579
|
});
|
|
2766
|
-
return steps$2;
|
|
2767
2580
|
} catch (error) {
|
|
2768
2581
|
if (callbacks?.onError) callbacks.onError(error);
|
|
2769
2582
|
else console.debug("onError callback not provided:", error);
|
|
@@ -2918,8 +2731,7 @@ const generateListingTransaction = async (params, config) => {
|
|
|
2918
2731
|
expiry: dateToUnixTime(params.listing.expiry)
|
|
2919
2732
|
}
|
|
2920
2733
|
};
|
|
2921
|
-
|
|
2922
|
-
return (await marketplaceClient.generateListingTransaction(args)).steps;
|
|
2734
|
+
return (await getMarketplaceClient(config).generateListingTransaction(args)).steps;
|
|
2923
2735
|
};
|
|
2924
2736
|
const useGenerateListingTransaction = (params) => {
|
|
2925
2737
|
const config = useConfig();
|
|
@@ -2949,8 +2761,7 @@ const generateOfferTransaction = async (params, config, walletKind) => {
|
|
|
2949
2761
|
},
|
|
2950
2762
|
walletType: walletKind
|
|
2951
2763
|
};
|
|
2952
|
-
|
|
2953
|
-
return (await marketplaceClient.generateOfferTransaction(args)).steps;
|
|
2764
|
+
return (await getMarketplaceClient(config).generateOfferTransaction(args)).steps;
|
|
2954
2765
|
};
|
|
2955
2766
|
const useGenerateOfferTransaction = (params) => {
|
|
2956
2767
|
const config = useConfig();
|
|
@@ -3048,7 +2859,7 @@ const useTransactionOperations = () => {
|
|
|
3048
2859
|
} catch (e) {
|
|
3049
2860
|
const error = e;
|
|
3050
2861
|
logger.error("Chain switch failed", error);
|
|
3051
|
-
if (error.name === "UserRejectedRequestError") throw new UserRejectedRequestError();
|
|
2862
|
+
if (error.name === "UserRejectedRequestError") throw new UserRejectedRequestError$1();
|
|
3052
2863
|
throw new ChainSwitchError(0, chainId);
|
|
3053
2864
|
}
|
|
3054
2865
|
};
|
|
@@ -3074,9 +2885,8 @@ const useTransactionOperations = () => {
|
|
|
3074
2885
|
} catch (e) {
|
|
3075
2886
|
const error = e;
|
|
3076
2887
|
logger.error("Signature failed", error);
|
|
3077
|
-
if (error.cause instanceof BaseError
|
|
3078
|
-
|
|
3079
|
-
if (viemError instanceof UserRejectedRequestError$1) throw new UserRejectedRequestError();
|
|
2888
|
+
if (error.cause instanceof BaseError) {
|
|
2889
|
+
if (error.cause instanceof UserRejectedRequestError) throw new UserRejectedRequestError$1();
|
|
3080
2890
|
}
|
|
3081
2891
|
throw new TransactionSignatureError(stepItem.id, error);
|
|
3082
2892
|
}
|
|
@@ -3100,9 +2910,8 @@ const useTransactionOperations = () => {
|
|
|
3100
2910
|
} catch (e) {
|
|
3101
2911
|
const error = e;
|
|
3102
2912
|
logger.error("Transaction failed", error);
|
|
3103
|
-
if (error.cause instanceof BaseError
|
|
3104
|
-
|
|
3105
|
-
if (viemError instanceof UserRejectedRequestError$1) throw new UserRejectedRequestError();
|
|
2913
|
+
if (error.cause instanceof BaseError) {
|
|
2914
|
+
if (error.cause instanceof UserRejectedRequestError) throw new UserRejectedRequestError$1();
|
|
3106
2915
|
}
|
|
3107
2916
|
throw new TransactionExecutionError(stepItem.id || "unknown", error);
|
|
3108
2917
|
}
|
|
@@ -3140,53 +2949,171 @@ const useOrderSteps = () => {
|
|
|
3140
2949
|
console.error(_exhaustiveCheck);
|
|
3141
2950
|
}
|
|
3142
2951
|
}
|
|
3143
|
-
return result;
|
|
3144
|
-
};
|
|
3145
|
-
return { executeStep };
|
|
3146
|
-
};
|
|
3147
|
-
|
|
3148
|
-
//#endregion
|
|
3149
|
-
//#region src/react/hooks/transactions/useTransferTokens.tsx
|
|
3150
|
-
const prepareTransferConfig = (params, accountAddress) => {
|
|
3151
|
-
if (params.contractType === "ERC721") return {
|
|
3152
|
-
abi: erc721Abi,
|
|
3153
|
-
address: params.collectionAddress,
|
|
3154
|
-
functionName: "safeTransferFrom",
|
|
3155
|
-
args: [
|
|
3156
|
-
accountAddress,
|
|
3157
|
-
params.receiverAddress,
|
|
3158
|
-
BigInt(params.tokenId)
|
|
3159
|
-
]
|
|
3160
|
-
};
|
|
3161
|
-
return {
|
|
3162
|
-
abi: ERC1155_ABI,
|
|
3163
|
-
address: params.collectionAddress,
|
|
3164
|
-
functionName: "safeTransferFrom",
|
|
3165
|
-
args: [
|
|
3166
|
-
accountAddress,
|
|
3167
|
-
params.receiverAddress,
|
|
3168
|
-
BigInt(params.tokenId),
|
|
3169
|
-
params.quantity,
|
|
3170
|
-
"0x"
|
|
3171
|
-
]
|
|
3172
|
-
};
|
|
3173
|
-
};
|
|
3174
|
-
const useTransferTokens = () => {
|
|
3175
|
-
const { address: accountAddress } = useAccount();
|
|
3176
|
-
const { writeContractAsync, data: hash, isPending, isError, isSuccess } = useWriteContract();
|
|
3177
|
-
const transferTokensAsync = async (params) => {
|
|
3178
|
-
if (!accountAddress) throw new NoWalletConnectedError();
|
|
3179
|
-
const config = prepareTransferConfig(params, accountAddress);
|
|
3180
|
-
return await writeContractAsync(config);
|
|
3181
|
-
};
|
|
2952
|
+
return result;
|
|
2953
|
+
};
|
|
2954
|
+
return { executeStep };
|
|
2955
|
+
};
|
|
2956
|
+
|
|
2957
|
+
//#endregion
|
|
2958
|
+
//#region src/react/hooks/transactions/useTransferTokens.tsx
|
|
2959
|
+
const prepareTransferConfig = (params, accountAddress) => {
|
|
2960
|
+
if (params.contractType === "ERC721") return {
|
|
2961
|
+
abi: erc721Abi,
|
|
2962
|
+
address: params.collectionAddress,
|
|
2963
|
+
functionName: "safeTransferFrom",
|
|
2964
|
+
args: [
|
|
2965
|
+
accountAddress,
|
|
2966
|
+
params.receiverAddress,
|
|
2967
|
+
BigInt(params.tokenId)
|
|
2968
|
+
]
|
|
2969
|
+
};
|
|
2970
|
+
return {
|
|
2971
|
+
abi: ERC1155_ABI,
|
|
2972
|
+
address: params.collectionAddress,
|
|
2973
|
+
functionName: "safeTransferFrom",
|
|
2974
|
+
args: [
|
|
2975
|
+
accountAddress,
|
|
2976
|
+
params.receiverAddress,
|
|
2977
|
+
BigInt(params.tokenId),
|
|
2978
|
+
params.quantity,
|
|
2979
|
+
"0x"
|
|
2980
|
+
]
|
|
2981
|
+
};
|
|
2982
|
+
};
|
|
2983
|
+
const useTransferTokens = () => {
|
|
2984
|
+
const { address: accountAddress } = useAccount();
|
|
2985
|
+
const { writeContractAsync, data: hash, isPending, isError, isSuccess } = useWriteContract();
|
|
2986
|
+
const transferTokensAsync = async (params) => {
|
|
2987
|
+
if (!accountAddress) throw new NoWalletConnectedError();
|
|
2988
|
+
const config = prepareTransferConfig(params, accountAddress);
|
|
2989
|
+
return await writeContractAsync(config);
|
|
2990
|
+
};
|
|
2991
|
+
return {
|
|
2992
|
+
transferTokensAsync,
|
|
2993
|
+
hash,
|
|
2994
|
+
transferring: isPending,
|
|
2995
|
+
transferFailed: isError,
|
|
2996
|
+
transferSuccess: isSuccess
|
|
2997
|
+
};
|
|
2998
|
+
};
|
|
2999
|
+
|
|
3000
|
+
//#endregion
|
|
3001
|
+
//#region src/react/hooks/ui/useFilterState.tsx
|
|
3002
|
+
const validateFilters = (value) => {
|
|
3003
|
+
if (!Array.isArray(value)) return [];
|
|
3004
|
+
return value.filter((f) => typeof f === "object" && typeof f.name === "string" && Object.values(PropertyType).includes(f.type));
|
|
3005
|
+
};
|
|
3006
|
+
const filtersParser = parseAsJson(validateFilters).withDefault([]);
|
|
3007
|
+
const searchParser = parseAsString.withDefault("");
|
|
3008
|
+
const listedOnlyParser = parseAsBoolean.withDefault(false);
|
|
3009
|
+
const serialize = createSerializer({
|
|
3010
|
+
filters: filtersParser,
|
|
3011
|
+
search: searchParser,
|
|
3012
|
+
listedOnly: listedOnlyParser
|
|
3013
|
+
}, { urlKeys: {
|
|
3014
|
+
filters: "f",
|
|
3015
|
+
search: "q",
|
|
3016
|
+
listedOnly: "l"
|
|
3017
|
+
} });
|
|
3018
|
+
function useFilterState() {
|
|
3019
|
+
const [filterOptions, setFilterOptions] = useQueryState("filters", filtersParser);
|
|
3020
|
+
const [searchText, setSearchText] = useQueryState("search", searchParser);
|
|
3021
|
+
const [showListedOnly, setShowListedOnly] = useQueryState("listedOnly", listedOnlyParser);
|
|
3022
|
+
const helpers = useMemo(() => ({
|
|
3023
|
+
getFilter: (name) => {
|
|
3024
|
+
return filterOptions?.find((f) => f.name === name);
|
|
3025
|
+
},
|
|
3026
|
+
getFilterValues: (name) => {
|
|
3027
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3028
|
+
if (!filter) return void 0;
|
|
3029
|
+
if (filter.type === PropertyType.INT) return {
|
|
3030
|
+
type: PropertyType.INT,
|
|
3031
|
+
min: filter.min ?? 0,
|
|
3032
|
+
max: filter.max ?? 0
|
|
3033
|
+
};
|
|
3034
|
+
return {
|
|
3035
|
+
type: PropertyType.STRING,
|
|
3036
|
+
values: filter.values ?? []
|
|
3037
|
+
};
|
|
3038
|
+
},
|
|
3039
|
+
isFilterActive: (name) => {
|
|
3040
|
+
return !!filterOptions?.find((f) => f.name === name);
|
|
3041
|
+
},
|
|
3042
|
+
isStringValueSelected: (name, value) => {
|
|
3043
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3044
|
+
if (!filter || filter.type !== PropertyType.STRING) return false;
|
|
3045
|
+
return filter.values?.includes(value) ?? false;
|
|
3046
|
+
},
|
|
3047
|
+
isIntFilterActive: (name) => {
|
|
3048
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3049
|
+
return !!filter && filter.type === PropertyType.INT;
|
|
3050
|
+
},
|
|
3051
|
+
getIntFilterRange: (name) => {
|
|
3052
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3053
|
+
if (!filter || filter.type !== PropertyType.INT) return void 0;
|
|
3054
|
+
return [filter.min ?? 0, filter.max ?? 0];
|
|
3055
|
+
},
|
|
3056
|
+
deleteFilter: (name) => {
|
|
3057
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3058
|
+
setFilterOptions(otherFilters);
|
|
3059
|
+
},
|
|
3060
|
+
toggleStringFilterValue: (name, value) => {
|
|
3061
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3062
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3063
|
+
const existingValues = filter?.type === PropertyType.STRING ? filter.values ?? [] : [];
|
|
3064
|
+
if (existingValues.includes(value)) {
|
|
3065
|
+
const newValues = existingValues.filter((v) => v !== value);
|
|
3066
|
+
if (newValues.length === 0) {
|
|
3067
|
+
setFilterOptions(otherFilters);
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
setFilterOptions([...otherFilters, {
|
|
3071
|
+
name,
|
|
3072
|
+
type: PropertyType.STRING,
|
|
3073
|
+
values: newValues
|
|
3074
|
+
}]);
|
|
3075
|
+
} else setFilterOptions([...otherFilters, {
|
|
3076
|
+
name,
|
|
3077
|
+
type: PropertyType.STRING,
|
|
3078
|
+
values: [...existingValues, value]
|
|
3079
|
+
}]);
|
|
3080
|
+
},
|
|
3081
|
+
setIntFilterValue: (name, min, max) => {
|
|
3082
|
+
if (min === max && min === 0) {
|
|
3083
|
+
const otherFilters$1 = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3084
|
+
setFilterOptions(otherFilters$1);
|
|
3085
|
+
return;
|
|
3086
|
+
}
|
|
3087
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3088
|
+
setFilterOptions([...otherFilters, {
|
|
3089
|
+
name,
|
|
3090
|
+
type: PropertyType.INT,
|
|
3091
|
+
min,
|
|
3092
|
+
max
|
|
3093
|
+
}]);
|
|
3094
|
+
},
|
|
3095
|
+
clearAllFilters: () => {
|
|
3096
|
+
setShowListedOnly(false);
|
|
3097
|
+
setFilterOptions([]);
|
|
3098
|
+
setSearchText("");
|
|
3099
|
+
}
|
|
3100
|
+
}), [
|
|
3101
|
+
filterOptions,
|
|
3102
|
+
setFilterOptions,
|
|
3103
|
+
setShowListedOnly,
|
|
3104
|
+
setSearchText
|
|
3105
|
+
]);
|
|
3182
3106
|
return {
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3107
|
+
filterOptions,
|
|
3108
|
+
searchText,
|
|
3109
|
+
showListedOnly,
|
|
3110
|
+
setFilterOptions,
|
|
3111
|
+
setSearchText,
|
|
3112
|
+
setShowListedOnly,
|
|
3113
|
+
...helpers,
|
|
3114
|
+
serialize
|
|
3188
3115
|
};
|
|
3189
|
-
}
|
|
3116
|
+
}
|
|
3190
3117
|
|
|
3191
3118
|
//#endregion
|
|
3192
3119
|
//#region src/react/hooks/ui/useFilters.tsx
|
|
@@ -3328,8 +3255,7 @@ function useFiltersProgressive(params) {
|
|
|
3328
3255
|
//#endregion
|
|
3329
3256
|
//#region src/react/hooks/ui/useOpenConnectModal.tsx
|
|
3330
3257
|
const useOpenConnectModal$1 = () => {
|
|
3331
|
-
|
|
3332
|
-
return { openConnectModal: context.openConnectModal };
|
|
3258
|
+
return { openConnectModal: useConfig().openConnectModal };
|
|
3333
3259
|
};
|
|
3334
3260
|
|
|
3335
3261
|
//#endregion
|
|
@@ -3607,12 +3533,10 @@ function useConvertPriceToUSD(params) {
|
|
|
3607
3533
|
*/
|
|
3608
3534
|
const useGetReceiptFromHash = () => {
|
|
3609
3535
|
const publicClient = usePublicClient();
|
|
3610
|
-
|
|
3536
|
+
return { waitForReceipt: useCallback(async (transactionHash) => {
|
|
3611
3537
|
if (!publicClient) throw new Error("Public client not found");
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
}, [publicClient]);
|
|
3615
|
-
return { waitForReceipt };
|
|
3538
|
+
return await publicClient.waitForTransactionReceipt({ hash: transactionHash });
|
|
3539
|
+
}, [publicClient]) };
|
|
3616
3540
|
};
|
|
3617
3541
|
|
|
3618
3542
|
//#endregion
|
|
@@ -3683,27 +3607,6 @@ function useRoyalty(args) {
|
|
|
3683
3607
|
};
|
|
3684
3608
|
}
|
|
3685
3609
|
|
|
3686
|
-
//#endregion
|
|
3687
|
-
//#region src/react/hooks/utils/useSwitchChainWithModal.ts
|
|
3688
|
-
const useSwitchChainWithModal = () => {
|
|
3689
|
-
const { show: showSwitchChainModal } = useSwitchChainModal();
|
|
3690
|
-
const { isWaaS } = useConnectorMetadata();
|
|
3691
|
-
const { switchChainAsync } = useSwitchChain();
|
|
3692
|
-
return { switchChainWithModal: async (currentChainId, targetChainId) => {
|
|
3693
|
-
const chainIdMismatch = currentChainId !== Number(targetChainId);
|
|
3694
|
-
return new Promise((resolve, reject) => {
|
|
3695
|
-
if (chainIdMismatch) if (isWaaS) switchChainAsync({ chainId: targetChainId }).then(resolve).catch(reject);
|
|
3696
|
-
else showSwitchChainModal({
|
|
3697
|
-
chainIdToSwitchTo: targetChainId,
|
|
3698
|
-
onSuccess: () => resolve({ chainId: targetChainId }),
|
|
3699
|
-
onError: (error) => reject(error),
|
|
3700
|
-
onClose: () => reject(new ChainSwitchUserRejectedError())
|
|
3701
|
-
});
|
|
3702
|
-
else resolve({ chainId: targetChainId });
|
|
3703
|
-
});
|
|
3704
|
-
} };
|
|
3705
|
-
};
|
|
3706
|
-
|
|
3707
3610
|
//#endregion
|
|
3708
3611
|
//#region src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts
|
|
3709
3612
|
const selectWaasFeeOptionsStore = createStore({
|
|
@@ -4116,8 +4019,7 @@ const useTransactionStatusModal = () => {
|
|
|
4116
4019
|
};
|
|
4117
4020
|
};
|
|
4118
4021
|
const TransactionStatusModal = () => {
|
|
4119
|
-
|
|
4120
|
-
return isOpen ? /* @__PURE__ */ jsx(TransactionStatusModalContent, {}) : null;
|
|
4022
|
+
return useIsOpen$3() ? /* @__PURE__ */ jsx(TransactionStatusModalContent, {}) : null;
|
|
4121
4023
|
};
|
|
4122
4024
|
function TransactionStatusModalContent() {
|
|
4123
4025
|
const { transactionType: type, hash, orderId, price, collectionAddress, chainId, collectibleId, callbacks, queriesToInvalidate } = useTransactionModalState();
|
|
@@ -4226,10 +4128,10 @@ function isPojo(val) {
|
|
|
4226
4128
|
//#endregion
|
|
4227
4129
|
//#region src/react/ui/modals/BuyModal/store.ts
|
|
4228
4130
|
function isShopProps(props) {
|
|
4229
|
-
return props.
|
|
4131
|
+
return props.cardType === "shop";
|
|
4230
4132
|
}
|
|
4231
4133
|
function isMarketProps(props) {
|
|
4232
|
-
return !props.
|
|
4134
|
+
return !props.cardType || props.cardType === "market";
|
|
4233
4135
|
}
|
|
4234
4136
|
const initialContext$2 = {
|
|
4235
4137
|
isOpen: false,
|
|
@@ -4430,8 +4332,7 @@ const useMarketPlatformFee = (params) => {
|
|
|
4430
4332
|
};
|
|
4431
4333
|
const { chainId, collectionAddress } = params;
|
|
4432
4334
|
const marketCollection = marketplaceConfig?.market?.collections?.find((col) => compareAddress(col.itemsAddress, collectionAddress) && String(col.chainId) === String(chainId));
|
|
4433
|
-
const
|
|
4434
|
-
const receiver = avalancheOrOptimism ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
4335
|
+
const receiver = chainId === avalanche.id || chainId === optimism.id ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
4435
4336
|
const percentageToBPS = (percentage) => Number(percentage) * 1e4 / 100;
|
|
4436
4337
|
const feePercentage = marketCollection?.feePercentage ?? defaultFee;
|
|
4437
4338
|
return {
|
|
@@ -4469,15 +4370,14 @@ const useCheckoutOptions = (input) => {
|
|
|
4469
4370
|
}],
|
|
4470
4371
|
additionalFee: Number(fees.amount)
|
|
4471
4372
|
});
|
|
4472
|
-
const
|
|
4373
|
+
const order = (await marketplaceClient.getOrders({
|
|
4473
4374
|
chainId: String(input.chainId),
|
|
4474
4375
|
input: [{
|
|
4475
4376
|
contractAddress: input.collectionAddress,
|
|
4476
4377
|
orderId: input.orderId,
|
|
4477
4378
|
marketplace: input.marketplace
|
|
4478
4379
|
}]
|
|
4479
|
-
});
|
|
4480
|
-
const order = orderResponse.orders[0];
|
|
4380
|
+
})).orders[0];
|
|
4481
4381
|
return {
|
|
4482
4382
|
...response.options,
|
|
4483
4383
|
order
|
|
@@ -4564,8 +4464,7 @@ function decodeERC20Approval(calldata) {
|
|
|
4564
4464
|
//#endregion
|
|
4565
4465
|
//#region src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts
|
|
4566
4466
|
const getBuyCollectableParams = async ({ chainId, collectionAddress, collectibleId, callbacks, priceCurrencyAddress, customCreditCardProviderCallback, config, address, marketplace, orderId, quantity, collectable, checkoutOptions, fee, skipNativeBalanceCheck, nativeTokenAddress, buyAnalyticsId }) => {
|
|
4567
|
-
const
|
|
4568
|
-
const { steps: steps$2 } = await marketplaceClient.generateBuyTransaction({
|
|
4467
|
+
const { steps: steps$2 } = await getMarketplaceClient(config).generateBuyTransaction({
|
|
4569
4468
|
chainId: String(chainId),
|
|
4570
4469
|
collectionAddress,
|
|
4571
4470
|
buyer: address,
|
|
@@ -4586,8 +4485,7 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4586
4485
|
const isTransakSupported = creditCardProviders.includes("transak");
|
|
4587
4486
|
let transakContractId;
|
|
4588
4487
|
if (isTransakSupported) {
|
|
4589
|
-
const
|
|
4590
|
-
const transakContractIdResponse = await sequenceApiClient.checkoutOptionsGetTransakContractID({
|
|
4488
|
+
const transakContractIdResponse = await getSequenceApiClient(config).checkoutOptionsGetTransakContractID({
|
|
4591
4489
|
chainId,
|
|
4592
4490
|
contractAddress: buyStep.to
|
|
4593
4491
|
});
|
|
@@ -4619,8 +4517,7 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4619
4517
|
},
|
|
4620
4518
|
onError: callbacks?.onError,
|
|
4621
4519
|
onClose: () => {
|
|
4622
|
-
|
|
4623
|
-
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4520
|
+
getQueryClient().invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4624
4521
|
buyModalStore.send({ type: "close" });
|
|
4625
4522
|
},
|
|
4626
4523
|
skipNativeBalanceCheck,
|
|
@@ -4648,7 +4545,6 @@ const usePaymentModalParams = (args) => {
|
|
|
4648
4545
|
const onSuccess = useOnSuccess();
|
|
4649
4546
|
const onError = useOnError();
|
|
4650
4547
|
const buyAnalyticsId = useBuyAnalyticsId();
|
|
4651
|
-
const queryEnabled = !!address && !!marketplace && !!collectable && !!checkoutOptions && !!priceCurrencyAddress && !!quantity && enabled;
|
|
4652
4548
|
return useQuery({
|
|
4653
4549
|
queryKey: [
|
|
4654
4550
|
"buyCollectableParams",
|
|
@@ -4656,7 +4552,7 @@ const usePaymentModalParams = (args) => {
|
|
|
4656
4552
|
args,
|
|
4657
4553
|
fee
|
|
4658
4554
|
],
|
|
4659
|
-
queryFn:
|
|
4555
|
+
queryFn: !!address && !!marketplace && !!collectable && !!checkoutOptions && !!priceCurrencyAddress && !!quantity && enabled ? () => getBuyCollectableParams({
|
|
4660
4556
|
chainId,
|
|
4661
4557
|
config,
|
|
4662
4558
|
address,
|
|
@@ -4859,8 +4755,7 @@ const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddre
|
|
|
4859
4755
|
},
|
|
4860
4756
|
onError: callbacks?.onError,
|
|
4861
4757
|
onClose: () => {
|
|
4862
|
-
|
|
4863
|
-
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4758
|
+
getQueryClient().invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4864
4759
|
buyModalStore.send({ type: "close" });
|
|
4865
4760
|
},
|
|
4866
4761
|
skipNativeBalanceCheck,
|
|
@@ -4882,10 +4777,9 @@ const useERC721SalePaymentParams = (args) => {
|
|
|
4882
4777
|
const onSuccess = useOnSuccess();
|
|
4883
4778
|
const onError = useOnError();
|
|
4884
4779
|
const buyModalProps = useBuyModalProps();
|
|
4885
|
-
const queryEnabled = enabled && !!address && !!salesContractAddress && !!collectionAddress && !!price && !!currencyAddress;
|
|
4886
4780
|
return useQuery({
|
|
4887
4781
|
queryKey: ["erc721SalePaymentParams", args],
|
|
4888
|
-
queryFn:
|
|
4782
|
+
queryFn: enabled && !!address && !!salesContractAddress && !!collectionAddress && !!price && !!currencyAddress ? () => getERC721SalePaymentParams({
|
|
4889
4783
|
chainId,
|
|
4890
4784
|
address,
|
|
4891
4785
|
salesContractAddress,
|
|
@@ -4993,8 +4887,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
4993
4887
|
}
|
|
4994
4888
|
const dnValue = dn.from(value, decimals);
|
|
4995
4889
|
const isBiggerThanMax = dn.greaterThan(dnValue, dnMaxQuantity);
|
|
4996
|
-
|
|
4997
|
-
if (isLessThanMin) {
|
|
4890
|
+
if (dn.lessThan(dnValue, dnMin)) {
|
|
4998
4891
|
setQuantity({
|
|
4999
4892
|
value,
|
|
5000
4893
|
isValid: false
|
|
@@ -5036,7 +4929,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
5036
4929
|
});
|
|
5037
4930
|
}
|
|
5038
4931
|
return /* @__PURE__ */ jsxs("div", {
|
|
5039
|
-
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"),
|
|
4932
|
+
className: cn$1("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"),
|
|
5040
4933
|
children: [/* @__PURE__ */ jsx(NumericInput, {
|
|
5041
4934
|
className: "w-full pl-1",
|
|
5042
4935
|
name: "quantity",
|
|
@@ -5070,7 +4963,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
5070
4963
|
//#endregion
|
|
5071
4964
|
//#region src/react/ui/modals/BuyModal/components/ERC1155QuantityModal.tsx
|
|
5072
4965
|
const INFINITY_STRING = maxUint256.toString();
|
|
5073
|
-
const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unlimitedSupply, salePrice, chainId,
|
|
4966
|
+
const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unlimitedSupply, salePrice, chainId, cardType }) => {
|
|
5074
4967
|
const isOpen = useIsOpen$2();
|
|
5075
4968
|
const minQuantity = quantityDecimals > 0 ? `0.${"1".padStart(quantityDecimals, "0")}` : "1";
|
|
5076
4969
|
const [localQuantity, setLocalQuantity] = useState(minQuantity);
|
|
@@ -5108,15 +5001,15 @@ const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unli
|
|
|
5108
5001
|
quantityStr: localQuantity,
|
|
5109
5002
|
salePrice,
|
|
5110
5003
|
chainId,
|
|
5111
|
-
|
|
5004
|
+
cardType,
|
|
5112
5005
|
quantityDecimals
|
|
5113
5006
|
})]
|
|
5114
5007
|
})
|
|
5115
5008
|
});
|
|
5116
5009
|
};
|
|
5117
|
-
const TotalPrice = ({ order, quantityStr, salePrice, chainId,
|
|
5118
|
-
const isShop =
|
|
5119
|
-
const isMarket =
|
|
5010
|
+
const TotalPrice = ({ order, quantityStr, salePrice, chainId, cardType, quantityDecimals }) => {
|
|
5011
|
+
const isShop = cardType === "shop";
|
|
5012
|
+
const isMarket = cardType === "market";
|
|
5120
5013
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
5121
5014
|
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
5122
5015
|
chainId,
|
|
@@ -5126,8 +5019,7 @@ const TotalPrice = ({ order, quantityStr, salePrice, chainId, marketplaceType, q
|
|
|
5126
5019
|
let formattedPrice = "0";
|
|
5127
5020
|
const quantityForCalculation = parseUnits(quantityStr, quantityDecimals);
|
|
5128
5021
|
if (isMarket && currency && order) try {
|
|
5129
|
-
const
|
|
5130
|
-
const marketplaceFeePercentage = marketCollection?.feePercentage ?? DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
5022
|
+
const marketplaceFeePercentage = (marketplaceConfig?.market?.collections?.find((col) => col.itemsAddress.toLowerCase() === order.collectionContractAddress.toLowerCase() && col.chainId === chainId))?.feePercentage ?? DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
5131
5023
|
const totalPriceRaw = BigInt(order ? order.priceAmount : "0") * quantityForCalculation;
|
|
5132
5024
|
formattedPrice = formatPriceWithFee(totalPriceRaw, currency.decimals, marketplaceFeePercentage);
|
|
5133
5025
|
} catch (e) {
|
|
@@ -5179,13 +5071,13 @@ const TotalPrice = ({ order, quantityStr, salePrice, chainId, marketplaceType, q
|
|
|
5179
5071
|
const ERC1155BuyModal = ({ collectable, order, address, checkoutOptions, chainId }) => {
|
|
5180
5072
|
const quantity = useQuantity();
|
|
5181
5073
|
const modalProps = useBuyModalProps();
|
|
5182
|
-
const
|
|
5074
|
+
const cardType = modalProps.cardType || "market";
|
|
5183
5075
|
const isShop = isShopProps(modalProps);
|
|
5184
5076
|
const quantityDecimals = isShop ? modalProps.quantityDecimals : collectable.decimals || 0;
|
|
5185
5077
|
const quantityRemaining = isShop ? modalProps.quantityRemaining?.toString() : order?.quantityRemaining;
|
|
5186
5078
|
if (!quantity) return /* @__PURE__ */ jsx(ERC1155QuantityModal, {
|
|
5187
5079
|
order,
|
|
5188
|
-
|
|
5080
|
+
cardType,
|
|
5189
5081
|
quantityDecimals,
|
|
5190
5082
|
quantityRemaining,
|
|
5191
5083
|
chainId
|
|
@@ -5239,36 +5131,40 @@ const useERC1155Checkout = ({ chainId, salesContractAddress, collectionAddress,
|
|
|
5239
5131
|
const onError = useOnError();
|
|
5240
5132
|
const saleAnalyticsId = useBuyAnalyticsId();
|
|
5241
5133
|
const buyModalProps = useBuyModalProps();
|
|
5242
|
-
const checkout = useERC1155SaleContractCheckout({
|
|
5243
|
-
chain: chainId,
|
|
5244
|
-
contractAddress: salesContractAddress,
|
|
5245
|
-
collectionAddress,
|
|
5246
|
-
items: [{
|
|
5247
|
-
...items[0],
|
|
5248
|
-
quantity: quantity?.toString() || "1"
|
|
5249
|
-
}],
|
|
5250
|
-
wallet: accountAddress ?? "",
|
|
5251
|
-
...checkoutOptions && { checkoutOptions },
|
|
5252
|
-
onSuccess: (hash) => {
|
|
5253
|
-
onSuccess({ hash });
|
|
5254
|
-
},
|
|
5255
|
-
onError: (error) => {
|
|
5256
|
-
onError(error);
|
|
5257
|
-
},
|
|
5258
|
-
onClose: () => {
|
|
5259
|
-
const queryClient = getQueryClient();
|
|
5260
|
-
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
5261
|
-
buyModalStore.send({ type: "close" });
|
|
5262
|
-
},
|
|
5263
|
-
customProviderCallback,
|
|
5264
|
-
supplementaryAnalyticsInfo: {
|
|
5265
|
-
marketplaceType: "shop",
|
|
5266
|
-
saleAnalyticsId
|
|
5267
|
-
},
|
|
5268
|
-
successActionButtons: buyModalProps.successActionButtons
|
|
5269
|
-
});
|
|
5270
5134
|
return {
|
|
5271
|
-
...
|
|
5135
|
+
...useERC1155SaleContractCheckout({
|
|
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
|
+
}),
|
|
5272
5168
|
isEnabled: Boolean(enabled && accountAddress)
|
|
5273
5169
|
};
|
|
5274
5170
|
};
|
|
@@ -5287,7 +5183,7 @@ const ERC1155ShopModal = ({ collection, shopData, chainId }) => {
|
|
|
5287
5183
|
amount: shopData.salePrice?.amount ?? "0",
|
|
5288
5184
|
currencyAddress: shopData.salePrice?.currencyAddress ?? zeroAddress
|
|
5289
5185
|
},
|
|
5290
|
-
|
|
5186
|
+
cardType: "shop",
|
|
5291
5187
|
quantityDecimals,
|
|
5292
5188
|
quantityRemaining,
|
|
5293
5189
|
unlimitedSupply,
|
|
@@ -5334,7 +5230,7 @@ const ERC1155SaleContractCheckoutModalOpener = ({ chainId, salesContractAddress,
|
|
|
5334
5230
|
isOpen: true,
|
|
5335
5231
|
chainId,
|
|
5336
5232
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5337
|
-
title: "Loading
|
|
5233
|
+
title: "Loading payment options"
|
|
5338
5234
|
});
|
|
5339
5235
|
return null;
|
|
5340
5236
|
};
|
|
@@ -5357,7 +5253,7 @@ const BuyModalRouter = () => {
|
|
|
5357
5253
|
isOpen: true,
|
|
5358
5254
|
chainId,
|
|
5359
5255
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5360
|
-
title: "Loading
|
|
5256
|
+
title: "Loading payment options"
|
|
5361
5257
|
});
|
|
5362
5258
|
if (isShop) {
|
|
5363
5259
|
if (collection.type === "ERC721") {
|
|
@@ -5365,7 +5261,7 @@ const BuyModalRouter = () => {
|
|
|
5365
5261
|
isOpen: true,
|
|
5366
5262
|
chainId,
|
|
5367
5263
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5368
|
-
title: "Loading
|
|
5264
|
+
title: "Loading payment options"
|
|
5369
5265
|
});
|
|
5370
5266
|
return /* @__PURE__ */ jsx(ERC721ShopModal, {
|
|
5371
5267
|
collection,
|
|
@@ -5378,7 +5274,7 @@ const BuyModalRouter = () => {
|
|
|
5378
5274
|
isOpen: true,
|
|
5379
5275
|
chainId,
|
|
5380
5276
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5381
|
-
title: "Loading
|
|
5277
|
+
title: "Loading payment options"
|
|
5382
5278
|
});
|
|
5383
5279
|
return /* @__PURE__ */ jsx(ERC1155ShopModal, {
|
|
5384
5280
|
collection,
|
|
@@ -5392,7 +5288,7 @@ const BuyModalRouter = () => {
|
|
|
5392
5288
|
isOpen: true,
|
|
5393
5289
|
chainId,
|
|
5394
5290
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5395
|
-
title: "Loading
|
|
5291
|
+
title: "Loading payment options"
|
|
5396
5292
|
});
|
|
5397
5293
|
return /* @__PURE__ */ jsx(ERC721BuyModal, {
|
|
5398
5294
|
collection,
|
|
@@ -5408,7 +5304,7 @@ const BuyModalRouter = () => {
|
|
|
5408
5304
|
isOpen: true,
|
|
5409
5305
|
chainId,
|
|
5410
5306
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5411
|
-
title: "Loading
|
|
5307
|
+
title: "Loading payment options"
|
|
5412
5308
|
});
|
|
5413
5309
|
return /* @__PURE__ */ jsx(ERC1155BuyModal, {
|
|
5414
5310
|
collection,
|
|
@@ -5432,8 +5328,7 @@ const BuyModalRouter = () => {
|
|
|
5432
5328
|
//#endregion
|
|
5433
5329
|
//#region src/react/ui/modals/BuyModal/components/Modal.tsx
|
|
5434
5330
|
const BuyModal = () => {
|
|
5435
|
-
|
|
5436
|
-
if (!isOpen) return null;
|
|
5331
|
+
if (!useIsOpen$2()) return null;
|
|
5437
5332
|
return /* @__PURE__ */ jsx(BuyModalRouter, {});
|
|
5438
5333
|
};
|
|
5439
5334
|
|
|
@@ -5592,7 +5487,7 @@ const ExpirationDateSelect = function ExpirationDateSelect$1({ className, date,
|
|
|
5592
5487
|
}
|
|
5593
5488
|
if (!date) return /* @__PURE__ */ jsx(Skeleton, { className: "mr-3 h-7 w-20 rounded-2xl" });
|
|
5594
5489
|
return /* @__PURE__ */ jsxs("div", {
|
|
5595
|
-
className: cn("relative w-full", disabled && "pointer-events-none opacity-50"),
|
|
5490
|
+
className: cn$1("relative w-full", disabled && "pointer-events-none opacity-50"),
|
|
5596
5491
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
5597
5492
|
className: "w-full text-left font-body font-medium text-xs",
|
|
5598
5493
|
fontWeight: "medium",
|
|
@@ -5949,17 +5844,17 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5949
5844
|
}
|
|
5950
5845
|
};
|
|
5951
5846
|
return /* @__PURE__ */ jsxs("div", {
|
|
5952
|
-
className: cn("price-input relative flex w-full flex-col", disabled && "pointer-events-none opacity-50"),
|
|
5847
|
+
className: cn$1("price-input relative flex w-full flex-col", disabled && "pointer-events-none opacity-50"),
|
|
5953
5848
|
children: [
|
|
5954
5849
|
/* @__PURE__ */ jsx("div", {
|
|
5955
5850
|
className: "absolute top-8 left-2 flex items-center",
|
|
5956
5851
|
children: /* @__PURE__ */ jsx(currencyImage_default, { price })
|
|
5957
5852
|
}),
|
|
5958
5853
|
/* @__PURE__ */ jsx("div", {
|
|
5959
|
-
className: "[&>label
|
|
5854
|
+
className: "[&>label]:gap-1",
|
|
5960
5855
|
children: /* @__PURE__ */ jsx(NumericInput, {
|
|
5961
5856
|
ref: inputRef,
|
|
5962
|
-
className: "
|
|
5857
|
+
className: "h-9 w-full rounded-sm px-2 [&>input]:pl-5 [&>input]:text-xs",
|
|
5963
5858
|
name: "price-input",
|
|
5964
5859
|
decimals: currencyDecimals,
|
|
5965
5860
|
label: "Enter price",
|
|
@@ -6201,7 +6096,7 @@ const SelectWaasFeeOptions = ({ chainId, onCancel, titleOnConfirm, className })
|
|
|
6201
6096
|
const isSponsored = pendingFeeOptionConfirmation?.options?.length === 0;
|
|
6202
6097
|
if (!isVisible || isSponsored || !selectedFeeOption) return null;
|
|
6203
6098
|
return /* @__PURE__ */ jsxs("div", {
|
|
6204
|
-
className: cn("flex w-full flex-col gap-2 rounded-2xl bg-button-emphasis p-0 backdrop-blur-md", className),
|
|
6099
|
+
className: cn$1("flex w-full flex-col gap-2 rounded-2xl bg-button-emphasis p-0 backdrop-blur-md", className),
|
|
6205
6100
|
children: [
|
|
6206
6101
|
/* @__PURE__ */ jsx(Divider, { className: "mt-0 mb-4" }),
|
|
6207
6102
|
/* @__PURE__ */ jsx(Text, {
|
|
@@ -6210,7 +6105,7 @@ const SelectWaasFeeOptions = ({ chainId, onCancel, titleOnConfirm, className })
|
|
|
6210
6105
|
}),
|
|
6211
6106
|
!feeOptionsConfirmed && !pendingFeeOptionConfirmation && /* @__PURE__ */ jsx(Skeleton, { className: "h-[52px] w-full animate-shimmer rounded-xl" }),
|
|
6212
6107
|
(feeOptionsConfirmed || pendingFeeOptionConfirmation) && /* @__PURE__ */ jsx("div", {
|
|
6213
|
-
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"),
|
|
6108
|
+
className: cn$1("[&>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"),
|
|
6214
6109
|
children: /* @__PURE__ */ jsx(WaasFeeOptionsSelect_default, {
|
|
6215
6110
|
options: pendingFeeOptionConfirmation?.options || [selectedFeeOption],
|
|
6216
6111
|
selectedFeeOption,
|
|
@@ -6371,8 +6266,7 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6371
6266
|
orderbook: params.orderbook,
|
|
6372
6267
|
listing
|
|
6373
6268
|
};
|
|
6374
|
-
const
|
|
6375
|
-
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
6269
|
+
const tokenApprovalStep = (await marketplaceClient.generateListingTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
6376
6270
|
if (!tokenApprovalStep) return { step: null };
|
|
6377
6271
|
return { step: tokenApprovalStep };
|
|
6378
6272
|
} : skipToken
|
|
@@ -6389,13 +6283,12 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6389
6283
|
const getSequenceMarketplaceRequestId = async (hash, publicClient, walletAddress) => {
|
|
6390
6284
|
try {
|
|
6391
6285
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
6392
|
-
|
|
6286
|
+
return parseEventLogs({
|
|
6393
6287
|
abi: SequenceMarketplaceV1_ABI,
|
|
6394
6288
|
eventName: "RequestCreated",
|
|
6395
6289
|
args: { creator: walletAddress },
|
|
6396
6290
|
logs: receipt.logs
|
|
6397
|
-
});
|
|
6398
|
-
return logs[0].args.requestId.toString();
|
|
6291
|
+
})[0].args.requestId.toString();
|
|
6399
6292
|
} catch (error) {
|
|
6400
6293
|
console.error(error);
|
|
6401
6294
|
}
|
|
@@ -6422,7 +6315,7 @@ const useTransactionSteps$2 = ({ listingInput, chainId, collectionAddress, order
|
|
|
6422
6315
|
const getListingSteps = async () => {
|
|
6423
6316
|
if (!address) return;
|
|
6424
6317
|
try {
|
|
6425
|
-
|
|
6318
|
+
return await generateListingTransactionAsync({
|
|
6426
6319
|
collectionAddress,
|
|
6427
6320
|
owner: address,
|
|
6428
6321
|
walletType: walletKind,
|
|
@@ -6433,7 +6326,6 @@ const useTransactionSteps$2 = ({ listingInput, chainId, collectionAddress, order
|
|
|
6433
6326
|
expiry: /* @__PURE__ */ new Date(Number(listingInput.listing.expiry) * 1e3)
|
|
6434
6327
|
}
|
|
6435
6328
|
});
|
|
6436
|
-
return steps$2;
|
|
6437
6329
|
} catch (error) {
|
|
6438
6330
|
if (callbacks?.onError) callbacks.onError(error);
|
|
6439
6331
|
else console.debug("onError callback not provided:", error);
|
|
@@ -6650,8 +6542,7 @@ const CreateListingModal = () => {
|
|
|
6650
6542
|
});
|
|
6651
6543
|
};
|
|
6652
6544
|
const Modal$3 = observer(() => {
|
|
6653
|
-
const
|
|
6654
|
-
const { collectionAddress, chainId, listingPrice: listingPrice$1, collectibleId, orderbookKind, callbacks, listingIsBeingProcessed } = state;
|
|
6545
|
+
const { collectionAddress, chainId, listingPrice: listingPrice$1, collectibleId, orderbookKind, callbacks, listingIsBeingProcessed } = createListingModal$.get();
|
|
6655
6546
|
const steps$ = createListingModal$.steps;
|
|
6656
6547
|
const { isWaaS } = useConnectorMetadata();
|
|
6657
6548
|
const { isVisible: feeOptionsVisible, selectedFeeOption } = useSelectWaasFeeOptionsStore();
|
|
@@ -6857,8 +6748,7 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6857
6748
|
orderbook: params.orderbook,
|
|
6858
6749
|
offer
|
|
6859
6750
|
};
|
|
6860
|
-
const
|
|
6861
|
-
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
6751
|
+
const tokenApprovalStep = (await marketplaceClient.generateOfferTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
6862
6752
|
if (!tokenApprovalStep) return { step: null };
|
|
6863
6753
|
return { step: tokenApprovalStep };
|
|
6864
6754
|
} : skipToken,
|
|
@@ -6894,7 +6784,7 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6894
6784
|
const getOfferSteps = async () => {
|
|
6895
6785
|
if (!address) return;
|
|
6896
6786
|
try {
|
|
6897
|
-
|
|
6787
|
+
return await generateOfferTransactionAsync({
|
|
6898
6788
|
collectionAddress,
|
|
6899
6789
|
maker: address,
|
|
6900
6790
|
walletType: walletKind,
|
|
@@ -6905,7 +6795,6 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6905
6795
|
expiry: /* @__PURE__ */ new Date(Number(offerInput.offer.expiry) * 1e3)
|
|
6906
6796
|
}
|
|
6907
6797
|
});
|
|
6908
|
-
return steps$2;
|
|
6909
6798
|
} catch (error) {
|
|
6910
6799
|
if (callbacks?.onError) callbacks.onError(error);
|
|
6911
6800
|
else console.debug("onError callback not provided:", error);
|
|
@@ -7112,8 +7001,7 @@ const MakeOfferModal = () => {
|
|
|
7112
7001
|
});
|
|
7113
7002
|
};
|
|
7114
7003
|
const Modal$2 = observer(() => {
|
|
7115
|
-
const
|
|
7116
|
-
const { collectionAddress, chainId, offerPrice: offerPrice$1, offerPriceChanged, invalidQuantity, collectibleId, orderbookKind, callbacks } = state;
|
|
7004
|
+
const { collectionAddress, chainId, offerPrice: offerPrice$1, offerPriceChanged, invalidQuantity, collectibleId, orderbookKind, callbacks } = makeOfferModal$.get();
|
|
7117
7005
|
const steps$ = makeOfferModal$.steps;
|
|
7118
7006
|
const [insufficientBalance, setInsufficientBalance] = useState(false);
|
|
7119
7007
|
const { data: collectible, isLoading: collectableIsLoading, isError: collectableIsError } = useCollectible({
|
|
@@ -7202,7 +7090,7 @@ const Modal$2 = observer(() => {
|
|
|
7202
7090
|
pending: steps$?.transaction.isExecuting.get() || makeOfferModal$.offerIsBeingProcessed.get(),
|
|
7203
7091
|
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice$1.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity
|
|
7204
7092
|
}];
|
|
7205
|
-
return /* @__PURE__ */
|
|
7093
|
+
return /* @__PURE__ */ jsxs(ActionModal, {
|
|
7206
7094
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
7207
7095
|
chainId: Number(chainId),
|
|
7208
7096
|
onClose: () => {
|
|
@@ -7236,7 +7124,7 @@ const Modal$2 = observer(() => {
|
|
|
7236
7124
|
includeNativeCurrency: false,
|
|
7237
7125
|
checkBalance: {
|
|
7238
7126
|
enabled: true,
|
|
7239
|
-
callback: (state
|
|
7127
|
+
callback: (state) => setInsufficientBalance(state)
|
|
7240
7128
|
},
|
|
7241
7129
|
disabled: shouldHideOfferButton
|
|
7242
7130
|
}),
|
|
@@ -7279,7 +7167,7 @@ const Modal$2 = observer(() => {
|
|
|
7279
7167
|
titleOnConfirm: "Processing offer..."
|
|
7280
7168
|
})
|
|
7281
7169
|
]
|
|
7282
|
-
})
|
|
7170
|
+
});
|
|
7283
7171
|
});
|
|
7284
7172
|
|
|
7285
7173
|
//#endregion
|
|
@@ -7334,8 +7222,7 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7334
7222
|
receiver
|
|
7335
7223
|
}]
|
|
7336
7224
|
};
|
|
7337
|
-
const
|
|
7338
|
-
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
7225
|
+
const tokenApprovalStep = (await marketplaceClient.generateSellTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
7339
7226
|
if (!tokenApprovalStep) return { step: null };
|
|
7340
7227
|
return { step: tokenApprovalStep };
|
|
7341
7228
|
} : skipToken,
|
|
@@ -7371,7 +7258,7 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7371
7258
|
const getSellSteps = async () => {
|
|
7372
7259
|
if (!address) return;
|
|
7373
7260
|
try {
|
|
7374
|
-
|
|
7261
|
+
return await generateSellTransactionAsync({
|
|
7375
7262
|
collectionAddress,
|
|
7376
7263
|
walletType: walletKind,
|
|
7377
7264
|
marketplace,
|
|
@@ -7382,7 +7269,6 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7382
7269
|
}],
|
|
7383
7270
|
seller: address
|
|
7384
7271
|
});
|
|
7385
|
-
return steps$2;
|
|
7386
7272
|
} catch (error) {
|
|
7387
7273
|
if (callbacks?.onError) callbacks.onError(error);
|
|
7388
7274
|
else console.debug("onError callback not provided:", error);
|
|
@@ -7545,8 +7431,7 @@ const Modal$1 = observer(() => {
|
|
|
7545
7431
|
});
|
|
7546
7432
|
const { isWaaS } = useConnectorMetadata();
|
|
7547
7433
|
const { isVisible: feeOptionsVisible, selectedFeeOption } = useSelectWaasFeeOptionsStore();
|
|
7548
|
-
const
|
|
7549
|
-
const isTestnet = network.type === NetworkType.TESTNET;
|
|
7434
|
+
const isTestnet = getNetwork(Number(chainId)).type === NetworkType.TESTNET;
|
|
7550
7435
|
const isProcessing = sellModal$.sellIsBeingProcessed.get();
|
|
7551
7436
|
const { shouldHideActionButton: shouldHideSellButton } = useSelectWaasFeeOptions({
|
|
7552
7437
|
isProcessing,
|
|
@@ -7889,13 +7774,12 @@ const TokenQuantityInput = ({ balanceAmount, collection, isProcessingWithWaaS })
|
|
|
7889
7774
|
const [invalidQuantity, setInvalidQuantity] = useState(false);
|
|
7890
7775
|
let insufficientBalance = true;
|
|
7891
7776
|
if (balanceAmount !== void 0 && modalState.quantity) try {
|
|
7892
|
-
|
|
7893
|
-
insufficientBalance = quantityBigInt > balanceAmount;
|
|
7777
|
+
insufficientBalance = BigInt(modalState.quantity) > balanceAmount;
|
|
7894
7778
|
} catch (_e) {
|
|
7895
7779
|
insufficientBalance = true;
|
|
7896
7780
|
}
|
|
7897
7781
|
return /* @__PURE__ */ jsxs("div", {
|
|
7898
|
-
className: cn
|
|
7782
|
+
className: cn("flex flex-col gap-3", isProcessingWithWaaS && "pointer-events-none opacity-50"),
|
|
7899
7783
|
children: [/* @__PURE__ */ jsx(QuantityInput, {
|
|
7900
7784
|
quantity: modalState.quantity,
|
|
7901
7785
|
invalidQuantity,
|
|
@@ -7968,8 +7852,7 @@ const MAX_WALLET_ADDRESS_LENGTH = 42;
|
|
|
7968
7852
|
const WalletAddressInput = () => {
|
|
7969
7853
|
const { address: connectedAddress } = useAccount();
|
|
7970
7854
|
const { receiverAddress, transferIsProcessing } = useModalState();
|
|
7971
|
-
const
|
|
7972
|
-
const isSelfTransfer = isWalletAddressValid && connectedAddress && receiverAddress.toLowerCase() === connectedAddress.toLowerCase();
|
|
7855
|
+
const isSelfTransfer = isAddress(receiverAddress) && connectedAddress && receiverAddress.toLowerCase() === connectedAddress.toLowerCase();
|
|
7973
7856
|
const handleChangeWalletAddress = (event) => {
|
|
7974
7857
|
transferModalStore.send({
|
|
7975
7858
|
type: "updateTransferDetails",
|
|
@@ -8082,8 +7965,7 @@ const EnterWalletAddressView = () => {
|
|
|
8082
7965
|
const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
|
|
8083
7966
|
let insufficientBalance = true;
|
|
8084
7967
|
if (balanceAmount !== void 0 && quantity) try {
|
|
8085
|
-
|
|
8086
|
-
insufficientBalance = quantityBigInt > BigInt(balanceAmount);
|
|
7968
|
+
insufficientBalance = BigInt(quantity) > BigInt(balanceAmount);
|
|
8087
7969
|
} catch (_e) {
|
|
8088
7970
|
insufficientBalance = true;
|
|
8089
7971
|
}
|
|
@@ -8101,8 +7983,7 @@ const EnterWalletAddressView = () => {
|
|
|
8101
7983
|
console.error("Transfer failed:", error);
|
|
8102
7984
|
}
|
|
8103
7985
|
};
|
|
8104
|
-
const
|
|
8105
|
-
const showQuantityInput = isErc1155 && !!balanceAmount;
|
|
7986
|
+
const showQuantityInput = collection?.type === ContractType.ERC1155 && !!balanceAmount;
|
|
8106
7987
|
const isTransferDisabled = transferIsProcessing || !isWalletAddressValid || insufficientBalance || !quantity || Number(quantity) === 0 || isSelfTransfer;
|
|
8107
7988
|
return /* @__PURE__ */ jsxs("div", {
|
|
8108
7989
|
className: "grid grow gap-6",
|
|
@@ -8270,7 +8151,7 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8270
8151
|
--tw-gradient-via-position: 50%;
|
|
8271
8152
|
--tw-gradient-to-position: 100%;
|
|
8272
8153
|
}
|
|
8273
|
-
/*! tailwindcss v4.1.
|
|
8154
|
+
/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
8274
8155
|
@layer properties;
|
|
8275
8156
|
@layer theme, base, components, utilities;
|
|
8276
8157
|
@layer theme {
|
|
@@ -8474,6 +8355,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8474
8355
|
::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
|
|
8475
8356
|
padding-block: 0;
|
|
8476
8357
|
}
|
|
8358
|
+
::-webkit-calendar-picker-indicator {
|
|
8359
|
+
line-height: 1;
|
|
8360
|
+
}
|
|
8477
8361
|
:-moz-ui-invalid {
|
|
8478
8362
|
box-shadow: none;
|
|
8479
8363
|
}
|
|
@@ -8914,9 +8798,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8914
8798
|
.w-\[124px\] {
|
|
8915
8799
|
width: 124px;
|
|
8916
8800
|
}
|
|
8917
|
-
.w-\[147px\] {
|
|
8918
|
-
width: 147px;
|
|
8919
|
-
}
|
|
8920
8801
|
.w-\[148px\] {
|
|
8921
8802
|
width: 148px;
|
|
8922
8803
|
}
|
|
@@ -9300,6 +9181,12 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9300
9181
|
.bg-background-primary {
|
|
9301
9182
|
background-color: var(--seq-color-background-primary);
|
|
9302
9183
|
}
|
|
9184
|
+
.bg-background-primary\/25 {
|
|
9185
|
+
background-color: var(--seq-color-background-primary);
|
|
9186
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
9187
|
+
background-color: color-mix(in oklab, var(--seq-color-background-primary) 25%, transparent);
|
|
9188
|
+
}
|
|
9189
|
+
}
|
|
9303
9190
|
.bg-background-raised {
|
|
9304
9191
|
background-color: var(--seq-color-background-raised);
|
|
9305
9192
|
}
|
|
@@ -9843,7 +9730,7 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9843
9730
|
backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
9844
9731
|
}
|
|
9845
9732
|
.transition {
|
|
9846
|
-
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display,
|
|
9733
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
|
|
9847
9734
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
9848
9735
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
9849
9736
|
}
|
|
@@ -10206,7 +10093,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10206
10093
|
}
|
|
10207
10094
|
.after\:content-\[\"\"\] {
|
|
10208
10095
|
&::after {
|
|
10209
|
-
content: var(--tw-content);
|
|
10210
10096
|
--tw-content: "";
|
|
10211
10097
|
content: var(--tw-content);
|
|
10212
10098
|
}
|
|
@@ -10249,6 +10135,13 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10249
10135
|
}
|
|
10250
10136
|
}
|
|
10251
10137
|
}
|
|
10138
|
+
.hover\:animate-none {
|
|
10139
|
+
&:hover {
|
|
10140
|
+
@media (hover: hover) {
|
|
10141
|
+
animation: none;
|
|
10142
|
+
}
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
10252
10145
|
.hover\:bg-button-glass {
|
|
10253
10146
|
&:hover {
|
|
10254
10147
|
@media (hover: hover) {
|
|
@@ -10263,6 +10156,13 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10263
10156
|
}
|
|
10264
10157
|
}
|
|
10265
10158
|
}
|
|
10159
|
+
.hover\:opacity-50 {
|
|
10160
|
+
&:hover {
|
|
10161
|
+
@media (hover: hover) {
|
|
10162
|
+
opacity: 50%;
|
|
10163
|
+
}
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10266
10166
|
.hover\:opacity-80 {
|
|
10267
10167
|
&:hover {
|
|
10268
10168
|
@media (hover: hover) {
|
|
@@ -10624,6 +10524,17 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10624
10524
|
justify-self: center;
|
|
10625
10525
|
}
|
|
10626
10526
|
}
|
|
10527
|
+
.\[\&\>input\]\:pl-5 {
|
|
10528
|
+
&>input {
|
|
10529
|
+
padding-left: calc(var(--spacing) * 5);
|
|
10530
|
+
}
|
|
10531
|
+
}
|
|
10532
|
+
.\[\&\>input\]\:text-xs {
|
|
10533
|
+
&>input {
|
|
10534
|
+
font-size: var(--text-xs);
|
|
10535
|
+
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
10536
|
+
}
|
|
10537
|
+
}
|
|
10627
10538
|
.\[\&\>label\]\:flex {
|
|
10628
10539
|
&>label {
|
|
10629
10540
|
display: flex;
|
|
@@ -10665,21 +10576,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10665
10576
|
width: 100%;
|
|
10666
10577
|
}
|
|
10667
10578
|
}
|
|
10668
|
-
.\[\&\>label\>div\>div\>\.rounded-xl\]\:h-9 {
|
|
10669
|
-
&>label>div>div>.rounded-xl {
|
|
10670
|
-
height: calc(var(--spacing) * 9);
|
|
10671
|
-
}
|
|
10672
|
-
}
|
|
10673
|
-
.\[\&\>label\>div\>div\>\.rounded-xl\]\:rounded-sm {
|
|
10674
|
-
&>label>div>div>.rounded-xl {
|
|
10675
|
-
border-radius: var(--radius-sm);
|
|
10676
|
-
}
|
|
10677
|
-
}
|
|
10678
|
-
.\[\&\>label\>div\>div\>\.rounded-xl\]\:px-2 {
|
|
10679
|
-
&>label>div>div>.rounded-xl {
|
|
10680
|
-
padding-inline: calc(var(--spacing) * 2);
|
|
10681
|
-
}
|
|
10682
|
-
}
|
|
10683
10579
|
.\[\&\>label\>div\>div\>div\]\:h-9 {
|
|
10684
10580
|
&>label>div>div>div {
|
|
10685
10581
|
height: calc(var(--spacing) * 9);
|
|
@@ -10899,9 +10795,17 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10899
10795
|
--rdp-range_middle-background-color: var(--rdp-accent-background-color);
|
|
10900
10796
|
--rdp-range_middle-color: inherit;
|
|
10901
10797
|
--rdp-range_start-color: white;
|
|
10902
|
-
--rdp-range_start-background: linear-gradient(
|
|
10798
|
+
--rdp-range_start-background: linear-gradient(
|
|
10799
|
+
var(--rdp-gradient-direction),
|
|
10800
|
+
transparent 50%,
|
|
10801
|
+
var(--rdp-range_middle-background-color) 50%
|
|
10802
|
+
);
|
|
10903
10803
|
--rdp-range_start-date-background-color: var(--rdp-accent-color);
|
|
10904
|
-
--rdp-range_end-background: linear-gradient(
|
|
10804
|
+
--rdp-range_end-background: linear-gradient(
|
|
10805
|
+
var(--rdp-gradient-direction),
|
|
10806
|
+
var(--rdp-range_middle-background-color) 50%,
|
|
10807
|
+
transparent 50%
|
|
10808
|
+
);
|
|
10905
10809
|
--rdp-range_end-color: white;
|
|
10906
10810
|
--rdp-range_end-date-background-color: var(--rdp-accent-color);
|
|
10907
10811
|
--rdp-week_number-border-radius: 100%;
|
|
@@ -11122,7 +11026,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
11122
11026
|
background-color: var(--rdp-range_middle-background-color);
|
|
11123
11027
|
}
|
|
11124
11028
|
.rdp-range_middle .rdp-day_button {
|
|
11125
|
-
border-color: transparent;
|
|
11126
11029
|
border: unset;
|
|
11127
11030
|
border-radius: unset;
|
|
11128
11031
|
color: var(--rdp-range_middle-color);
|
|
@@ -11571,7 +11474,7 @@ const ModalProvider = observer(({ children }) => {
|
|
|
11571
11474
|
/* @__PURE__ */ jsx(SellModal, {}),
|
|
11572
11475
|
/* @__PURE__ */ jsx(BuyModal, {}),
|
|
11573
11476
|
/* @__PURE__ */ jsx(SuccessfulPurchaseModal_default, {}),
|
|
11574
|
-
/* @__PURE__ */ jsx(
|
|
11477
|
+
/* @__PURE__ */ jsx(switchChainErrorModal_default, {}),
|
|
11575
11478
|
/* @__PURE__ */ jsx(transactionStatusModal_default, {})
|
|
11576
11479
|
]
|
|
11577
11480
|
}) })] });
|
|
@@ -11660,10 +11563,10 @@ function ActionButtonBody({ tokenId, label, onClick, icon, action }) {
|
|
|
11660
11563
|
//#endregion
|
|
11661
11564
|
//#region src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx
|
|
11662
11565
|
function NonOwnerActions(props) {
|
|
11663
|
-
const { action, tokenId, collectionAddress, chainId, quantityDecimals, quantityRemaining, unlimitedSupply,
|
|
11566
|
+
const { action, tokenId, collectionAddress, chainId, quantityDecimals, quantityRemaining, unlimitedSupply, cardType } = props;
|
|
11664
11567
|
const { show: showBuyModal } = useBuyModal();
|
|
11665
11568
|
const { show: showMakeOfferModal } = useMakeOfferModal();
|
|
11666
|
-
if (
|
|
11569
|
+
if (cardType === "shop") {
|
|
11667
11570
|
const { salesContractAddress, salePrice } = props;
|
|
11668
11571
|
return /* @__PURE__ */ jsx(ActionButtonBody, {
|
|
11669
11572
|
action: CollectibleCardAction.BUY,
|
|
@@ -11677,7 +11580,7 @@ function NonOwnerActions(props) {
|
|
|
11677
11580
|
tokenId,
|
|
11678
11581
|
quantity: "1"
|
|
11679
11582
|
}],
|
|
11680
|
-
|
|
11583
|
+
cardType: "shop",
|
|
11681
11584
|
salePrice: {
|
|
11682
11585
|
amount: salePrice.amount,
|
|
11683
11586
|
currencyAddress: salePrice.currencyAddress
|
|
@@ -11702,7 +11605,7 @@ function NonOwnerActions(props) {
|
|
|
11702
11605
|
collectibleId: tokenId,
|
|
11703
11606
|
orderId: lowestListing.orderId,
|
|
11704
11607
|
marketplace: lowestListing.marketplace,
|
|
11705
|
-
|
|
11608
|
+
cardType: "market"
|
|
11706
11609
|
}),
|
|
11707
11610
|
icon: CartIcon_default
|
|
11708
11611
|
});
|
|
@@ -11824,7 +11727,7 @@ const useActionButtonLogic = ({ tokenId, owned, action, onCannotPerformAction })
|
|
|
11824
11727
|
|
|
11825
11728
|
//#endregion
|
|
11826
11729
|
//#region src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
11827
|
-
function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, action, owned, highestOffer, lowestListing, onCannotPerformAction,
|
|
11730
|
+
function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, action, owned, highestOffer, lowestListing, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply }) {
|
|
11828
11731
|
const { shouldShowAction, isOwnerAction } = useActionButtonLogic({
|
|
11829
11732
|
tokenId,
|
|
11830
11733
|
owned,
|
|
@@ -11840,8 +11743,8 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11840
11743
|
orderbookKind,
|
|
11841
11744
|
highestOffer
|
|
11842
11745
|
});
|
|
11843
|
-
|
|
11844
|
-
|
|
11746
|
+
return /* @__PURE__ */ jsx(NonOwnerActions, { ...cardType === "shop" && salesContractAddress && salePrice ? {
|
|
11747
|
+
cardType: "shop",
|
|
11845
11748
|
salesContractAddress,
|
|
11846
11749
|
salePrice,
|
|
11847
11750
|
action,
|
|
@@ -11852,7 +11755,7 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11852
11755
|
quantityRemaining,
|
|
11853
11756
|
unlimitedSupply
|
|
11854
11757
|
} : {
|
|
11855
|
-
|
|
11758
|
+
cardType: "market",
|
|
11856
11759
|
orderbookKind,
|
|
11857
11760
|
lowestListing,
|
|
11858
11761
|
action,
|
|
@@ -11861,13 +11764,12 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11861
11764
|
chainId,
|
|
11862
11765
|
quantityDecimals,
|
|
11863
11766
|
quantityRemaining
|
|
11864
|
-
};
|
|
11865
|
-
return /* @__PURE__ */ jsx(NonOwnerActions, { ...nonOwnerProps });
|
|
11767
|
+
} });
|
|
11866
11768
|
}
|
|
11867
11769
|
|
|
11868
11770
|
//#endregion
|
|
11869
11771
|
//#region src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx
|
|
11870
|
-
function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderbookKind, action, highestOffer, lowestListing, owned, onCannotPerformAction,
|
|
11772
|
+
function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderbookKind, action, highestOffer, lowestListing, owned, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply }) {
|
|
11871
11773
|
if (!show) return null;
|
|
11872
11774
|
return /* @__PURE__ */ jsx("div", {
|
|
11873
11775
|
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]",
|
|
@@ -11881,7 +11783,7 @@ function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderb
|
|
|
11881
11783
|
lowestListing,
|
|
11882
11784
|
owned,
|
|
11883
11785
|
onCannotPerformAction,
|
|
11884
|
-
|
|
11786
|
+
cardType,
|
|
11885
11787
|
salesContractAddress,
|
|
11886
11788
|
prioritizeOwnerActions,
|
|
11887
11789
|
salePrice,
|
|
@@ -12012,20 +11914,16 @@ function MediaSkeleton() {
|
|
|
12012
11914
|
//#endregion
|
|
12013
11915
|
//#region src/react/ui/components/media/utils.ts
|
|
12014
11916
|
const isImage = (fileName) => {
|
|
12015
|
-
|
|
12016
|
-
return isImage$1;
|
|
11917
|
+
return /.*\.(png|jpg|jpeg|gif|svg|webp)$/.test(fileName?.toLowerCase() || "");
|
|
12017
11918
|
};
|
|
12018
11919
|
const isHtml = (fileName) => {
|
|
12019
|
-
|
|
12020
|
-
return isHtml$1;
|
|
11920
|
+
return /.*\.(html\?.+|html)$/.test(fileName?.toLowerCase() || "");
|
|
12021
11921
|
};
|
|
12022
11922
|
const isVideo = (fileName) => {
|
|
12023
|
-
|
|
12024
|
-
return isVideo$1;
|
|
11923
|
+
return /.*\.(mp4|ogg|webm)$/.test(fileName?.toLowerCase() || "");
|
|
12025
11924
|
};
|
|
12026
11925
|
const is3dModel = (fileName) => {
|
|
12027
|
-
|
|
12028
|
-
return is3dFile;
|
|
11926
|
+
return /.*\.(gltf|glb|obj|fbx|stl|usdz)$/.test(fileName?.toLowerCase() || "");
|
|
12029
11927
|
};
|
|
12030
11928
|
const getContentType = (url) => {
|
|
12031
11929
|
return new Promise((resolve, reject) => {
|
|
@@ -12065,10 +11963,9 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12065
11963
|
useEffect(() => {
|
|
12066
11964
|
setIsSafari(/^((?!chrome|android).)*safari/i.test(navigator.userAgent));
|
|
12067
11965
|
}, []);
|
|
12068
|
-
const
|
|
12069
|
-
const assetUrl = validAssets[currentAssetIndex];
|
|
11966
|
+
const assetUrl = assets.filter((asset) => !!asset)[currentAssetIndex];
|
|
12070
11967
|
const proxiedAssetUrl = assetUrl ? assetSrcPrefixUrl ? `${assetSrcPrefixUrl}${assetUrl}` : assetUrl : "";
|
|
12071
|
-
const containerClassNames = cn("relative aspect-square overflow-hidden bg-background-secondary", containerClassName || className);
|
|
11968
|
+
const containerClassNames = cn$1("relative aspect-square overflow-hidden bg-background-secondary", containerClassName || className);
|
|
12072
11969
|
useEffect(() => {
|
|
12073
11970
|
if (!assetUrl) {
|
|
12074
11971
|
setContentType({
|
|
@@ -12119,11 +12016,11 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12119
12016
|
};
|
|
12120
12017
|
const renderFallback = () => {
|
|
12121
12018
|
if (fallbackContent) return /* @__PURE__ */ jsx("div", {
|
|
12122
|
-
className: cn("flex h-full w-full items-center justify-center", containerClassNames),
|
|
12019
|
+
className: cn$1("flex h-full w-full items-center justify-center", containerClassNames),
|
|
12123
12020
|
children: fallbackContent
|
|
12124
12021
|
});
|
|
12125
12022
|
return /* @__PURE__ */ jsx("div", {
|
|
12126
|
-
className: cn("h-full w-full", containerClassNames),
|
|
12023
|
+
className: cn$1("h-full w-full", containerClassNames),
|
|
12127
12024
|
children: /* @__PURE__ */ jsx("img", {
|
|
12128
12025
|
src: chess_tile_default,
|
|
12129
12026
|
alt: name || "Collectible",
|
|
@@ -12137,10 +12034,10 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12137
12034
|
};
|
|
12138
12035
|
if (assetLoadFailed || !isLoading && contentType.failed || !assetUrl) return renderFallback();
|
|
12139
12036
|
if (contentType.type === "html" && !assetLoadFailed) return /* @__PURE__ */ jsxs("div", {
|
|
12140
|
-
className: cn("flex w-full items-center justify-center rounded-lg", containerClassNames),
|
|
12037
|
+
className: cn$1("flex w-full items-center justify-center rounded-lg", containerClassNames),
|
|
12141
12038
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("iframe", {
|
|
12142
12039
|
title: name || "Collectible",
|
|
12143
|
-
className: cn("aspect-square w-full", mediaClassname),
|
|
12040
|
+
className: cn$1("aspect-square w-full", mediaClassname),
|
|
12144
12041
|
src: proxiedAssetUrl,
|
|
12145
12042
|
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
12146
12043
|
sandbox: "allow-scripts",
|
|
@@ -12150,7 +12047,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12150
12047
|
})]
|
|
12151
12048
|
});
|
|
12152
12049
|
if (contentType.type === "3d-model" && !assetLoadFailed) return /* @__PURE__ */ jsx("div", {
|
|
12153
|
-
className: cn("h-full w-full", containerClassNames),
|
|
12050
|
+
className: cn$1("h-full w-full", containerClassNames),
|
|
12154
12051
|
children: /* @__PURE__ */ jsx(ModelViewer_default, {
|
|
12155
12052
|
src: proxiedAssetUrl,
|
|
12156
12053
|
posterSrc: chess_tile_default,
|
|
@@ -12159,7 +12056,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12159
12056
|
})
|
|
12160
12057
|
});
|
|
12161
12058
|
if (contentType.type === "video" && !assetLoadFailed) {
|
|
12162
|
-
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);
|
|
12059
|
+
const videoClassNames = cn$1("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);
|
|
12163
12060
|
return /* @__PURE__ */ jsxs("div", {
|
|
12164
12061
|
className: containerClassNames,
|
|
12165
12062
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("video", {
|
|
@@ -12179,7 +12076,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12179
12076
|
});
|
|
12180
12077
|
}
|
|
12181
12078
|
const imgSrc = assetLoadFailed || contentType.failed ? chess_tile_default : proxiedAssetUrl;
|
|
12182
|
-
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);
|
|
12079
|
+
const imgClassNames = cn$1("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);
|
|
12183
12080
|
return /* @__PURE__ */ jsxs("div", {
|
|
12184
12081
|
className: containerClassNames,
|
|
12185
12082
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("img", {
|
|
@@ -12194,7 +12091,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12194
12091
|
|
|
12195
12092
|
//#endregion
|
|
12196
12093
|
//#region src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx
|
|
12197
|
-
function MarketplaceCollectibleCardSkeleton() {
|
|
12094
|
+
function MarketplaceCollectibleCardSkeleton({ contractType, isShop }) {
|
|
12198
12095
|
return /* @__PURE__ */ jsxs("div", {
|
|
12199
12096
|
"data-testid": "collectible-card-skeleton",
|
|
12200
12097
|
className: "w-card-width overflow-hidden rounded-xl border border-border-base focus-visible:border-border-focus focus-visible:shadow-none focus-visible:outline-focus active:border-border-focus active:shadow-none",
|
|
@@ -12207,21 +12104,31 @@ function MarketplaceCollectibleCardSkeleton() {
|
|
|
12207
12104
|
})
|
|
12208
12105
|
}), /* @__PURE__ */ jsxs("div", {
|
|
12209
12106
|
className: "mt-2 flex flex-col gap-2 px-4 pb-4",
|
|
12210
|
-
children: [
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
12107
|
+
children: [
|
|
12108
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
12109
|
+
size: "lg",
|
|
12110
|
+
className: "animate-shimmer"
|
|
12111
|
+
}),
|
|
12112
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
12113
|
+
size: "sm",
|
|
12114
|
+
className: "h-5 w-16 animate-shimmer"
|
|
12115
|
+
}),
|
|
12116
|
+
isShop && contractType === ContractType.ERC1155 && /* @__PURE__ */ jsx(Skeleton, {
|
|
12117
|
+
size: "lg",
|
|
12118
|
+
className: "h-6 w-20 animate-shimmer"
|
|
12119
|
+
})
|
|
12120
|
+
]
|
|
12217
12121
|
})]
|
|
12218
12122
|
});
|
|
12219
12123
|
}
|
|
12220
12124
|
|
|
12221
12125
|
//#endregion
|
|
12222
12126
|
//#region src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx
|
|
12223
|
-
function BaseCard({
|
|
12224
|
-
if (
|
|
12127
|
+
function BaseCard({ name, image, video, animationUrl, onClick, onKeyDown, assetSrcPrefixUrl, children, mediaClassName, cardLoading, contractType, isShop }) {
|
|
12128
|
+
if (cardLoading) return /* @__PURE__ */ jsx(MarketplaceCollectibleCardSkeleton, {
|
|
12129
|
+
contractType,
|
|
12130
|
+
isShop
|
|
12131
|
+
});
|
|
12225
12132
|
return /* @__PURE__ */ jsx("div", {
|
|
12226
12133
|
"data-testid": "collectible-card",
|
|
12227
12134
|
className: "w-card-width min-w-card-min-width overflow-hidden rounded-xl border border-border-base bg-background-primary focus-visible:border-border-focus focus-visible:shadow-focus-ring focus-visible:outline-focus active:border-border-focus active:shadow-active-ring",
|
|
@@ -12241,7 +12148,7 @@ function BaseCard({ isLoading, name, image, video, animationUrl, onClick, onKeyD
|
|
|
12241
12148
|
animationUrl
|
|
12242
12149
|
],
|
|
12243
12150
|
assetSrcPrefixUrl,
|
|
12244
|
-
mediaClassname: cn
|
|
12151
|
+
mediaClassname: cn("object-contain", mediaClassName)
|
|
12245
12152
|
}), children]
|
|
12246
12153
|
})
|
|
12247
12154
|
})
|
|
@@ -12249,75 +12156,58 @@ function BaseCard({ isLoading, name, image, video, animationUrl, onClick, onKeyD
|
|
|
12249
12156
|
}
|
|
12250
12157
|
|
|
12251
12158
|
//#endregion
|
|
12252
|
-
//#region src/react/ui/components/marketplace-collectible-card/Footer.tsx
|
|
12253
|
-
const
|
|
12254
|
-
const
|
|
12255
|
-
const
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12159
|
+
//#region src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx
|
|
12160
|
+
const Footer = ({ chainId, collectionAddress, collectibleId, name, type, decimals, onOfferClick, highestOffer, balance, quantityInitial, quantityRemaining, unlimitedSupply, cardType, salePriceAmount, salePriceCurrency }) => {
|
|
12161
|
+
const isShop = cardType === "shop";
|
|
12162
|
+
const isMarket = cardType === "market";
|
|
12163
|
+
const isInventoryNonTradable = cardType === "inventory-non-tradable";
|
|
12164
|
+
const { data: lowestListing, isLoading: isLowestListingLoading } = useLowestListing({
|
|
12165
|
+
chainId,
|
|
12166
|
+
collectionAddress,
|
|
12167
|
+
tokenId: collectibleId,
|
|
12168
|
+
query: { enabled: isMarket }
|
|
12260
12169
|
});
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12170
|
+
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
12171
|
+
chainId,
|
|
12172
|
+
currencyAddress: lowestListing?.priceCurrencyAddress,
|
|
12173
|
+
query: { enabled: isMarket && !!lowestListing?.priceCurrencyAddress }
|
|
12264
12174
|
});
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
12268
|
-
formattedNumber,
|
|
12269
|
-
" ",
|
|
12270
|
-
currency.symbol
|
|
12271
|
-
] })
|
|
12272
|
-
});
|
|
12273
|
-
};
|
|
12274
|
-
const Footer = ({ name, type, decimals, onOfferClick, highestOffer, lowestListingPriceAmount, lowestListingCurrency, balance, quantityInitial, quantityRemaining, unlimitedSupply, marketplaceType, salePriceAmount, salePriceCurrency }) => {
|
|
12275
|
-
const listed = !!lowestListingPriceAmount && !!lowestListingCurrency;
|
|
12276
|
-
const isShop = marketplaceType === "shop";
|
|
12277
|
-
const isMarketplace = marketplaceType === "market";
|
|
12278
|
-
const displayName = (() => {
|
|
12279
|
-
if (name.length > 15 && highestOffer && !isShop) return `${name.substring(0, 13)}...`;
|
|
12280
|
-
if (name.length > 17 && !highestOffer && !isShop) return `${name.substring(0, 17)}...`;
|
|
12281
|
-
return name;
|
|
12282
|
-
})();
|
|
12175
|
+
const listed = !!lowestListing?.priceAmount && !!lowestListing?.priceCurrencyAddress;
|
|
12176
|
+
const isPriceLoading = isMarket && (isLowestListingLoading || !!lowestListing?.priceCurrencyAddress && isCurrencyLoading);
|
|
12283
12177
|
return /* @__PURE__ */ jsxs("div", {
|
|
12284
12178
|
className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4",
|
|
12285
12179
|
children: [
|
|
12286
|
-
/* @__PURE__ */
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
variant: "primary",
|
|
12295
|
-
onClick: (e) => {
|
|
12296
|
-
onOfferClick?.(e);
|
|
12297
|
-
},
|
|
12298
|
-
icon: (props) => /* @__PURE__ */ jsx(BellIcon_default, {
|
|
12299
|
-
...props,
|
|
12300
|
-
size: "xs"
|
|
12301
|
-
})
|
|
12302
|
-
})]
|
|
12180
|
+
/* @__PURE__ */ jsx(FooterName, {
|
|
12181
|
+
name,
|
|
12182
|
+
isShop,
|
|
12183
|
+
highestOffer,
|
|
12184
|
+
onOfferClick,
|
|
12185
|
+
quantityInitial,
|
|
12186
|
+
quantityRemaining,
|
|
12187
|
+
balance
|
|
12303
12188
|
}),
|
|
12304
12189
|
/* @__PURE__ */ jsxs("div", {
|
|
12305
|
-
className: cn$1("flex items-center gap-1", isShop &&
|
|
12306
|
-
children: [
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12190
|
+
className: cn$1("flex items-center gap-1", isShop && type === ContractType.ERC721 && "hidden"),
|
|
12191
|
+
children: [
|
|
12192
|
+
isPriceLoading && /* @__PURE__ */ jsx(Skeleton, {
|
|
12193
|
+
size: "sm",
|
|
12194
|
+
className: "h-5 w-20 animate-shimmer"
|
|
12195
|
+
}),
|
|
12196
|
+
!isPriceLoading && listed && isMarket && lowestListing && currency && /* @__PURE__ */ jsx(PriceDisplay, {
|
|
12197
|
+
amount: lowestListing.priceAmount,
|
|
12198
|
+
currency,
|
|
12199
|
+
className: "text-text-100"
|
|
12200
|
+
}),
|
|
12201
|
+
!isPriceLoading && !listed && isMarket && /* @__PURE__ */ jsx(Text, {
|
|
12202
|
+
className: "text-left font-body font-bold text-sm text-text-50",
|
|
12203
|
+
children: "Not listed yet"
|
|
12204
|
+
}),
|
|
12205
|
+
isShop && salePriceAmount && salePriceCurrency && type === ContractType.ERC1155 && /* @__PURE__ */ jsx(PriceDisplay, {
|
|
12206
|
+
amount: salePriceAmount,
|
|
12207
|
+
currency: salePriceCurrency,
|
|
12208
|
+
className: "text-text-100"
|
|
12209
|
+
})
|
|
12210
|
+
]
|
|
12321
12211
|
}),
|
|
12322
12212
|
isShop && /* @__PURE__ */ jsx(SaleDetailsPill, {
|
|
12323
12213
|
quantityRemaining,
|
|
@@ -12325,7 +12215,7 @@ const Footer = ({ name, type, decimals, onOfferClick, highestOffer, lowestListin
|
|
|
12325
12215
|
unlimitedSupply
|
|
12326
12216
|
}),
|
|
12327
12217
|
isShop && !salePriceAmount && /* @__PURE__ */ jsx("div", { className: "h-5 w-full" }),
|
|
12328
|
-
|
|
12218
|
+
(isMarket || isInventoryNonTradable) && /* @__PURE__ */ jsx(TokenTypeBalancePill, {
|
|
12329
12219
|
balance,
|
|
12330
12220
|
type,
|
|
12331
12221
|
decimals
|
|
@@ -12333,22 +12223,24 @@ const Footer = ({ name, type, decimals, onOfferClick, highestOffer, lowestListin
|
|
|
12333
12223
|
]
|
|
12334
12224
|
});
|
|
12335
12225
|
};
|
|
12336
|
-
const
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12226
|
+
const NonTradableInventoryFooter = ({ name, balance, decimals, type }) => {
|
|
12227
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12228
|
+
className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4",
|
|
12229
|
+
children: [
|
|
12230
|
+
/* @__PURE__ */ jsx(FooterName, { name }),
|
|
12231
|
+
/* @__PURE__ */ jsx("div", {
|
|
12232
|
+
className: "flex items-center gap-1",
|
|
12233
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
12234
|
+
className: "text-left font-body font-bold text-sm text-text-50",
|
|
12235
|
+
children: "Not listed yet"
|
|
12236
|
+
})
|
|
12237
|
+
}),
|
|
12238
|
+
/* @__PURE__ */ jsx(TokenTypeBalancePill, {
|
|
12239
|
+
balance,
|
|
12240
|
+
type,
|
|
12241
|
+
decimals
|
|
12242
|
+
})
|
|
12243
|
+
]
|
|
12352
12244
|
});
|
|
12353
12245
|
};
|
|
12354
12246
|
|
|
@@ -12357,12 +12249,6 @@ const SaleDetailsPill = ({ quantityRemaining, collectionType, unlimitedSupply })
|
|
|
12357
12249
|
function MarketCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, orderbookKind, collectible, onCollectibleClick, onOfferClick, balance, balanceIsLoading = false, onCannotPerformAction, prioritizeOwnerActions }) {
|
|
12358
12250
|
const collectibleMetadata = collectible?.metadata;
|
|
12359
12251
|
const highestOffer = collectible?.offer;
|
|
12360
|
-
const { data: lowestListingCurrency, isLoading: lowestListingCurrencyLoading } = useCurrency({
|
|
12361
|
-
chainId,
|
|
12362
|
-
currencyAddress: collectible?.listing?.priceCurrencyAddress,
|
|
12363
|
-
query: { enabled: !!collectible?.listing?.priceCurrencyAddress }
|
|
12364
|
-
});
|
|
12365
|
-
const isLoading = cardLoading || lowestListingCurrencyLoading;
|
|
12366
12252
|
if (!collectibleMetadata) {
|
|
12367
12253
|
console.error("Collectible metadata is undefined");
|
|
12368
12254
|
return null;
|
|
@@ -12379,15 +12265,19 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12379
12265
|
collectionType,
|
|
12380
12266
|
assetSrcPrefixUrl,
|
|
12381
12267
|
cardLoading,
|
|
12382
|
-
|
|
12383
|
-
isLoading,
|
|
12268
|
+
cardType: "market",
|
|
12384
12269
|
name: collectibleMetadata.name || "",
|
|
12385
12270
|
image: collectibleMetadata.image,
|
|
12386
12271
|
video: collectibleMetadata.video,
|
|
12387
12272
|
animationUrl: collectibleMetadata.animation_url,
|
|
12273
|
+
contractType: collectionType,
|
|
12274
|
+
isShop: false,
|
|
12388
12275
|
onClick: () => onCollectibleClick?.(collectibleId),
|
|
12389
12276
|
onKeyDown: handleKeyDown,
|
|
12390
12277
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
12278
|
+
chainId,
|
|
12279
|
+
collectionAddress,
|
|
12280
|
+
collectibleId,
|
|
12391
12281
|
name: collectibleMetadata.name || "",
|
|
12392
12282
|
type: collectionType,
|
|
12393
12283
|
onOfferClick: (e) => onOfferClick?.({
|
|
@@ -12395,15 +12285,13 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12395
12285
|
e
|
|
12396
12286
|
}),
|
|
12397
12287
|
highestOffer,
|
|
12398
|
-
lowestListingPriceAmount: collectible?.listing?.priceAmount,
|
|
12399
|
-
lowestListingCurrency,
|
|
12400
12288
|
balance,
|
|
12401
12289
|
decimals: collectibleMetadata.decimals,
|
|
12402
12290
|
quantityInitial: highestOffer?.quantityInitial !== void 0 ? highestOffer.quantityInitial : collectible?.listing?.quantityInitial !== void 0 ? collectible.listing.quantityInitial : void 0,
|
|
12403
12291
|
quantityRemaining: highestOffer?.quantityRemaining !== void 0 ? highestOffer.quantityRemaining : collectible?.listing?.quantityRemaining !== void 0 ? collectible.listing.quantityRemaining : void 0,
|
|
12404
|
-
|
|
12292
|
+
cardType: "market"
|
|
12405
12293
|
}), /* @__PURE__ */ jsx(ActionButtonWrapper, {
|
|
12406
|
-
show: showActionButton,
|
|
12294
|
+
show: showActionButton ?? false,
|
|
12407
12295
|
chainId,
|
|
12408
12296
|
collectionAddress,
|
|
12409
12297
|
tokenId: collectibleId,
|
|
@@ -12413,21 +12301,45 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12413
12301
|
lowestListing: collectible?.listing,
|
|
12414
12302
|
owned: !!balance,
|
|
12415
12303
|
onCannotPerformAction,
|
|
12416
|
-
|
|
12304
|
+
cardType: "market",
|
|
12417
12305
|
prioritizeOwnerActions
|
|
12418
12306
|
})]
|
|
12419
12307
|
});
|
|
12420
12308
|
}
|
|
12421
12309
|
|
|
12310
|
+
//#endregion
|
|
12311
|
+
//#region src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx
|
|
12312
|
+
function NonTradableInventoryCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, balance, balanceIsLoading, collectibleMetadata }) {
|
|
12313
|
+
return /* @__PURE__ */ jsx(BaseCard, {
|
|
12314
|
+
collectibleId,
|
|
12315
|
+
image: collectibleMetadata.image,
|
|
12316
|
+
video: collectibleMetadata.video,
|
|
12317
|
+
animationUrl: collectibleMetadata.animation_url,
|
|
12318
|
+
chainId,
|
|
12319
|
+
collectionAddress,
|
|
12320
|
+
collectionType,
|
|
12321
|
+
assetSrcPrefixUrl,
|
|
12322
|
+
cardLoading: cardLoading || balanceIsLoading,
|
|
12323
|
+
contractType: collectionType,
|
|
12324
|
+
isShop: false,
|
|
12325
|
+
name: collectibleMetadata.name,
|
|
12326
|
+
children: /* @__PURE__ */ jsx(NonTradableInventoryFooter, {
|
|
12327
|
+
name: collectibleMetadata.name || "",
|
|
12328
|
+
type: collectionType,
|
|
12329
|
+
balance,
|
|
12330
|
+
decimals: collectibleMetadata.decimals
|
|
12331
|
+
})
|
|
12332
|
+
});
|
|
12333
|
+
}
|
|
12334
|
+
|
|
12422
12335
|
//#endregion
|
|
12423
12336
|
//#region src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx
|
|
12424
|
-
function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading,
|
|
12337
|
+
function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, cardType, salesContractAddress, tokenMetadata, salePrice, quantityDecimals, quantityInitial, quantityRemaining, unlimitedSupply }) {
|
|
12425
12338
|
const { data: saleCurrency, isLoading: saleCurrencyLoading } = useCurrency({
|
|
12426
12339
|
chainId,
|
|
12427
12340
|
currencyAddress: salePrice?.currencyAddress,
|
|
12428
12341
|
query: { enabled: !!salePrice?.currencyAddress && !!salesContractAddress && collectionType === ContractType.ERC1155 }
|
|
12429
12342
|
});
|
|
12430
|
-
const isLoading = cardLoading || saleCurrencyLoading;
|
|
12431
12343
|
if (!tokenMetadata || !salePrice) {
|
|
12432
12344
|
console.error("Token metadata or sale price is undefined", {
|
|
12433
12345
|
tokenMetadata,
|
|
@@ -12437,29 +12349,33 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12437
12349
|
}
|
|
12438
12350
|
const showActionButton = salesContractAddress && collectionType === ContractType.ERC1155 && (unlimitedSupply || quantityRemaining !== void 0 && Number(quantityRemaining) > 0);
|
|
12439
12351
|
const action = CollectibleCardAction.BUY;
|
|
12440
|
-
const mediaClassName = quantityRemaining === "0" || quantityRemaining === void 0 ? "opacity-50" : "opacity-100";
|
|
12352
|
+
const mediaClassName = unlimitedSupply ? "opacity-100" : quantityRemaining === "0" || quantityRemaining === void 0 ? "opacity-50" : "opacity-100";
|
|
12441
12353
|
return /* @__PURE__ */ jsxs(BaseCard, {
|
|
12442
12354
|
collectibleId,
|
|
12443
12355
|
chainId,
|
|
12444
12356
|
collectionAddress,
|
|
12445
12357
|
collectionType,
|
|
12446
12358
|
assetSrcPrefixUrl,
|
|
12447
|
-
cardLoading,
|
|
12448
|
-
|
|
12449
|
-
isLoading,
|
|
12359
|
+
cardLoading: cardLoading || saleCurrencyLoading,
|
|
12360
|
+
cardType,
|
|
12450
12361
|
name: tokenMetadata.name || "",
|
|
12451
12362
|
image: tokenMetadata.image,
|
|
12452
12363
|
video: tokenMetadata.video,
|
|
12453
12364
|
animationUrl: tokenMetadata.animation_url,
|
|
12454
12365
|
mediaClassName,
|
|
12366
|
+
contractType: collectionType,
|
|
12367
|
+
isShop: true,
|
|
12455
12368
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
12369
|
+
chainId,
|
|
12370
|
+
collectionAddress,
|
|
12371
|
+
collectibleId,
|
|
12456
12372
|
name: tokenMetadata.name || "",
|
|
12457
12373
|
type: collectionType,
|
|
12458
12374
|
decimals: tokenMetadata.decimals,
|
|
12459
12375
|
quantityInitial,
|
|
12460
12376
|
quantityRemaining,
|
|
12461
12377
|
unlimitedSupply,
|
|
12462
|
-
|
|
12378
|
+
cardType,
|
|
12463
12379
|
salePriceAmount: salePrice?.amount,
|
|
12464
12380
|
salePriceCurrency: saleCurrency
|
|
12465
12381
|
}), /* @__PURE__ */ jsx(ActionButtonWrapper, {
|
|
@@ -12469,7 +12385,7 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12469
12385
|
tokenId: collectibleId,
|
|
12470
12386
|
action,
|
|
12471
12387
|
owned: false,
|
|
12472
|
-
|
|
12388
|
+
cardType,
|
|
12473
12389
|
salesContractAddress,
|
|
12474
12390
|
salePrice,
|
|
12475
12391
|
quantityDecimals,
|
|
@@ -12482,13 +12398,13 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12482
12398
|
//#endregion
|
|
12483
12399
|
//#region src/react/ui/components/marketplace-collectible-card/CollectibleCard.tsx
|
|
12484
12400
|
function CollectibleCard(props) {
|
|
12485
|
-
switch (props.
|
|
12401
|
+
switch (props.cardType) {
|
|
12486
12402
|
case "shop": return /* @__PURE__ */ jsx(ShopCard, { ...props });
|
|
12487
|
-
case "market":
|
|
12488
|
-
|
|
12403
|
+
case "market": return /* @__PURE__ */ jsx(MarketCard, { ...props });
|
|
12404
|
+
case "inventory-non-tradable": return /* @__PURE__ */ jsx(NonTradableInventoryCard, { ...props });
|
|
12489
12405
|
}
|
|
12490
12406
|
}
|
|
12491
12407
|
|
|
12492
12408
|
//#endregion
|
|
12493
|
-
export { ActionModal, CollectibleCard, DatabeatAnalytics, MarketplaceProvider, MarketplaceQueryClientProvider, MarketplaceSdkContext, Media, ModalProvider, collectionDetailsPollingOptions, generateCancelTransaction, generateListingTransaction, generateOfferTransaction, generateSellTransaction,
|
|
12494
|
-
//# sourceMappingURL=react-
|
|
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-BLJ4DkPx.js.map
|