@0xsequence/marketplace-sdk 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/honest-peas-arrive.md +5 -0
- package/.changeset/real-tips-stick.md +8 -0
- package/.changeset/tall-pandas-wear.md +8 -0
- package/.storybook/main.ts +1 -1
- package/.storybook/preview.tsx +0 -1
- package/CHANGELOG.md +84 -13
- package/dist/BellIcon-ByhygxBO.js +45 -0
- package/dist/BellIcon-ByhygxBO.js.map +1 -0
- package/dist/{BellIcon-Cb9YEUzJ.js → CartIcon-Bt3rQYGk.js} +10 -49
- package/dist/CartIcon-Bt3rQYGk.js.map +1 -0
- package/dist/CollectibleCard-CVpdgXA8.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/abi-fa-o9gH3.js +134 -0
- package/dist/abi-fa-o9gH3.js.map +1 -0
- package/dist/{alien_swap-DJ98gZQp.js → alien_swap-DoY6XfMA.js} +1 -1
- package/dist/{alien_swap-DJ98gZQp.js.map → alien_swap-DoY6XfMA.js.map} +1 -1
- package/dist/{api-BmEQfSQa.js → api-BoO0V5aJ.js} +11 -4
- package/dist/api-BoO0V5aJ.js.map +1 -0
- package/dist/{aqua-xyz-n1PcCCZ0.js → aqua-xyz-BBDxnG14.js} +1 -1
- package/dist/{aqua-xyz-n1PcCCZ0.js.map → aqua-xyz-BBDxnG14.js.map} +1 -1
- package/dist/{aura-Bevk_YkS.js → aura-DGx2zwvF.js} +1 -1
- package/dist/{aura-Bevk_YkS.js.map → aura-DGx2zwvF.js.map} +1 -1
- package/dist/{blur-B5sHErx5.js → blur-D8GKrRrq.js} +1 -1
- package/dist/{blur-B5sHErx5.js.map → blur-D8GKrRrq.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-DOry4PXY.js} +1 -1
- package/dist/{coinbase-D30W-lxA.js.map → coinbase-DOry4PXY.js.map} +1 -1
- package/dist/collectibles-C_H8jMGH.js +358 -0
- package/dist/collectibles-C_H8jMGH.js.map +1 -0
- package/dist/collections-CKummc-R.js +249 -0
- package/dist/collections-CKummc-R.js.map +1 -0
- package/dist/components-CosnX7F9.js +119 -0
- package/dist/components-CosnX7F9.js.map +1 -0
- package/dist/{contracts-DPHFT2TA.js → contracts-BP_0vX48.js} +4 -5
- package/dist/{contracts-DPHFT2TA.js.map → contracts-BP_0vX48.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-ZOB7i4ZJ.d.ts} +135 -37
- package/dist/{element-C2NJexro.js → element-ciybd_VF.js} +1 -1
- package/dist/{element-C2NJexro.js.map → element-ciybd_VF.js.map} +1 -1
- package/dist/filters-V-V8Dn8f.d.ts +60 -0
- package/dist/{foundation-QgY1lvUj.js → foundation-Bq4lRz4x.js} +1 -1
- package/dist/{foundation-QgY1lvUj.js.map → foundation-Bq4lRz4x.js.map} +1 -1
- package/dist/index-BOiHR01C.d.ts +106 -0
- package/dist/index-BZIJTQT0.d.ts +121 -0
- package/dist/index-BeRV-7AX.d.ts +55 -0
- package/dist/{index-DonXiSg2.d.ts → index-Bsx6XsC2.d.ts} +117 -70
- package/dist/{index-BGJXqdg6.d.ts → index-BtWMBHeP.d.ts} +13 -9
- package/dist/{index-CtF7EE2z.d.ts → index-Bxzjy0d1.d.ts} +1 -1
- package/dist/{index-ChSKFOMx.d.ts → index-C-745li7.d.ts} +1 -1
- package/dist/{index-CY5UEX4h.d.ts → index-C4MUKshG.d.ts} +2 -2
- package/dist/{index-C7xKVIr4.d.ts → index-CPzvNmq9.d.ts} +37 -37
- package/dist/{index-ByW08-Z7.d.ts → index-CS65jqOq.d.ts} +2 -2
- package/dist/index-CZUtOTjh.d.ts +1 -0
- package/dist/index-CnEbXm_t.d.ts +130 -0
- package/dist/{index-ThUIs-Sy.d.ts → index-CxA34wP1.d.ts} +37 -23
- package/dist/{index-CIkpYltz.d.ts → index-CxpFwGvR.d.ts} +3 -3
- package/dist/{index-QxxS6f9r.d.ts → index-D9LPlmbC.d.ts} +1 -1
- package/dist/{index-CQnGIGb5.d.ts → index-DFEnA6Wa.d.ts} +44 -33
- package/dist/{index-PSPpUxCE.d.ts → index-DNNUeZEq.d.ts} +4 -4
- package/dist/{index-Dpyp7fQz.d.ts → index-DUXfvhxs.d.ts} +12 -12
- package/dist/index-DW3njUfb.d.ts +1 -0
- package/dist/index-DWt6yrIG.d.ts +64 -0
- package/dist/index-DewGsFz5.d.ts +1 -0
- package/dist/index-DmudgrsN.d.ts +495 -0
- package/dist/{index-DNU9xoGK.d.ts → index-DqXd1EeB.d.ts} +5 -5
- package/dist/{index-DX0Vm8HY.d.ts → index-DwKr18CI.d.ts} +1 -1
- package/dist/{index-D71J5Ghd.d.ts → index-NlPMNcqh.d.ts} +99 -99
- package/dist/index-Stm5u0I0.d.ts +53 -0
- package/dist/index-U-zp70of.d.ts +74 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +13 -12
- package/dist/inventory-Dd7TazvZ.js +72 -0
- package/dist/inventory-Dd7TazvZ.js.map +1 -0
- package/dist/listBalances-BxpxBCvn.js +57 -0
- package/dist/listBalances-BxpxBCvn.js.map +1 -0
- package/dist/listCollectiblesPaginated-Cy2_qEZA.d.ts +327 -0
- package/dist/{listCollections-Bbzbz7qW.d.ts → listCollections-BB9FxKj2.d.ts} +264 -137
- package/dist/{looks-rare-CMVPny4v.js → looks-rare-6H--x3AM.js} +1 -1
- package/dist/{looks-rare-CMVPny4v.js.map → looks-rare-6H--x3AM.js.map} +1 -1
- package/dist/lowestListing-Cbsi6M1K.d.ts +465 -0
- package/dist/{magic-eden-IrWp2ZXk.js → magic-eden-BoxEQ1Li.js} +1 -1
- package/dist/{magic-eden-IrWp2ZXk.js.map → magic-eden-BoxEQ1Li.js.map} +1 -1
- package/dist/{manifold-DeOE-p2G.js → manifold-DycKsljb.js} +1 -1
- package/dist/{manifold-DeOE-p2G.js.map → manifold-DycKsljb.js.map} +1 -1
- package/dist/market-C3HV-awQ.js +209 -0
- package/dist/market-C3HV-awQ.js.map +1 -0
- package/dist/{marketCurrencies-CmOMCCOr.d.ts → marketCurrencies-Bpw1bIO0.d.ts} +46 -15
- package/dist/marketCurrencies-sKrTX0og.js +53 -0
- package/dist/marketCurrencies-sKrTX0og.js.map +1 -0
- package/dist/{marketplace-B5Z8G03R.js → marketplace-NQB-sEQL.js} +1 -1
- package/dist/{marketplace-B5Z8G03R.js.map → marketplace-NQB-sEQL.js.map} +1 -1
- package/dist/{marketplace-logos-D8t86gsW.js → marketplace-logos-D4dS1Foy.js} +21 -21
- package/dist/marketplace-logos-D4dS1Foy.js.map +1 -0
- package/dist/{marketplace.gen-JzNYpM0U.js → marketplace.gen-ksUafDqS.js} +56 -5
- package/dist/marketplace.gen-ksUafDqS.js.map +1 -0
- package/dist/{marketplaceConfig-sNh-MA5M.js → marketplaceConfig-UHQMM9fq.js} +9 -10
- package/dist/marketplaceConfig-UHQMM9fq.js.map +1 -0
- package/dist/{mintify-DG3GrljJ.js → mintify-Dyqyo8jQ.js} +1 -1
- package/dist/{mintify-DG3GrljJ.js.map → mintify-Dyqyo8jQ.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-2LbFjj9Q.js} +1 -1
- package/dist/{nftx-B3LH-ZYM.js.map → nftx-2LbFjj9Q.js.map} +1 -1
- package/dist/{okx-CRFLrT3Z.js → okx-CBEWJNsR.js} +1 -1
- package/dist/{okx-CRFLrT3Z.js.map → okx-CBEWJNsR.js.map} +1 -1
- package/dist/{open-sea-cOpfl366.js → open-sea-Dxntz_PA.js} +1 -1
- package/dist/{open-sea-cOpfl366.js.map → open-sea-Dxntz_PA.js.map} +1 -1
- package/dist/orders-DnFfZAXV.js +462 -0
- package/dist/orders-DnFfZAXV.js.map +1 -0
- package/dist/{primary-sale-CLjXRrDj.js → primary-sale-1u4QlPdA.js} +1 -1
- package/dist/{primary-sale-CLjXRrDj.js.map → primary-sale-1u4QlPdA.js.map} +1 -1
- package/dist/primary-sales-Dmsi6bqj.js +114 -0
- package/dist/primary-sales-Dmsi6bqj.js.map +1 -0
- package/dist/{query-BTe7Wkrs.d.ts → query-BWbCsXLY.d.ts} +1 -1
- package/dist/{rarible-guwUx4cn.js → rarible-CS0SupHr.js} +1 -1
- package/dist/{rarible-guwUx4cn.js.map → rarible-CS0SupHr.js.map} +1 -1
- package/dist/react/_internal/api/index.d.ts +2 -2
- package/dist/react/_internal/api/index.js +5 -5
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +35 -21
- package/dist/react/_internal/index.d.ts +2 -2
- package/dist/react/_internal/index.js +9 -8
- 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 +35 -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 +10 -4
- package/dist/react/hooks/data/collectibles/index.js +35 -21
- package/dist/react/hooks/data/collections/index.d.ts +10 -10
- package/dist/react/hooks/data/collections/index.js +35 -21
- package/dist/react/hooks/data/index.d.ts +37 -29
- package/dist/react/hooks/data/index.js +36 -22
- package/dist/react/hooks/data/inventory/index.d.ts +36 -28
- package/dist/react/hooks/data/inventory/index.js +35 -21
- package/dist/react/hooks/data/market/index.d.ts +11 -11
- package/dist/react/hooks/data/market/index.js +35 -21
- package/dist/react/hooks/data/orders/index.d.ts +11 -11
- package/dist/react/hooks/data/orders/index.js +36 -22
- package/dist/react/hooks/data/primary-sales/index.d.ts +36 -28
- package/dist/react/hooks/data/primary-sales/index.js +35 -21
- package/dist/react/hooks/data/tokens/index.d.ts +4 -4
- package/dist/react/hooks/data/tokens/index.js +35 -21
- package/dist/react/hooks/index.d.ts +37 -29
- package/dist/react/hooks/index.js +36 -22
- package/dist/react/hooks/transactions/index.d.ts +2 -2
- package/dist/react/hooks/transactions/index.js +35 -21
- package/dist/react/hooks/ui/index.d.ts +4 -4
- package/dist/react/hooks/ui/index.js +35 -21
- package/dist/react/hooks/utils/index.d.ts +37 -29
- package/dist/react/hooks/utils/index.js +36 -22
- package/dist/react/index.d.ts +37 -29
- package/dist/react/index.js +36 -22
- package/dist/react/queries/collectibles/index.d.ts +11 -0
- package/dist/react/queries/collectibles/index.js +23 -0
- package/dist/react/queries/collections/index.d.ts +11 -0
- package/dist/react/queries/collections/index.js +20 -0
- package/dist/react/queries/index.d.ts +24 -16
- package/dist/react/queries/index.js +29 -17
- package/dist/react/queries/inventory/index.d.ts +3 -0
- package/dist/react/queries/inventory/index.js +22 -0
- package/dist/react/queries/market/index.d.ts +6 -0
- package/dist/react/queries/market/index.js +22 -0
- package/dist/react/queries/orders/index.d.ts +11 -0
- package/dist/react/queries/orders/index.js +13 -0
- package/dist/react/queries/primary-sales/index.d.ts +4 -0
- package/dist/react/queries/primary-sales/index.js +13 -0
- package/dist/react/queries/tokens/index.d.ts +5 -0
- package/dist/react/queries/tokens/index.js +14 -0
- package/dist/react/queries/utils/index.d.ts +4 -0
- package/dist/react/queries/utils/index.js +22 -0
- package/dist/react/ssr/index.d.ts +7 -7
- package/dist/react/ssr/index.js +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 +40 -0
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +5 -5
- package/dist/react/ui/components/marketplace-collectible-card/index.js +35 -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 +35 -21
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +35 -21
- package/dist/react/utils/index.d.ts +3 -3
- package/dist/react/utils/index.js +5 -5
- package/dist/{react-Ceq8mamy.js → react-DE852KeT.js} +2111 -1002
- package/dist/react-DE852KeT.js.map +1 -0
- package/dist/{sequence-Dt2Xo7Fa.js → sequence-paCCener.js} +1 -1
- package/dist/{sequence-Dt2Xo7Fa.js.map → sequence-paCCener.js.map} +1 -1
- package/dist/styles/index.css +200 -24
- package/dist/{sudo-swap-CGoARONs.js → sudo-swap-9rH2EgfT.js} +1 -1
- package/dist/{sudo-swap-CGoARONs.js.map → sudo-swap-9rH2EgfT.js.map} +1 -1
- package/dist/{super-rare-NeQtZjcn.js → super-rare-DHIuWtRw.js} +1 -1
- package/dist/{super-rare-NeQtZjcn.js.map → super-rare-DHIuWtRw.js.map} +1 -1
- package/dist/{token-D9gZVqbX.js → token-Cv7l2ZaL.js} +1 -1
- package/dist/{token-D9gZVqbX.js.map → token-Cv7l2ZaL.js.map} +1 -1
- package/dist/tokenBalances-ibDerNmM.js +63 -0
- package/dist/tokenBalances-ibDerNmM.js.map +1 -0
- package/dist/tokenSupplies-Bfe8RHzI.d.ts +272 -0
- package/dist/tokens-cGxMadd8.js +194 -0
- package/dist/tokens-cGxMadd8.js.map +1 -0
- package/dist/{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-D2TJ1dwv.d.ts} +19 -10
- package/dist/utils/abi/index.d.ts +5 -5
- package/dist/utils/abi/index.js +5 -5
- package/dist/utils/abi/marketplace/index.d.ts +1 -1
- package/dist/utils/abi/marketplace/index.js +1 -1
- package/dist/utils/abi/primary-sale/index.d.ts +1 -1
- package/dist/utils/abi/primary-sale/index.js +1 -1
- package/dist/utils/abi/token/index.d.ts +1 -1
- package/dist/utils/abi/token/index.js +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +12 -11
- package/dist/utils-BCgNhBFR.js +112 -0
- package/dist/utils-BCgNhBFR.js.map +1 -0
- package/dist/{utils-CKJd-CRf.js → utils-BfpDVibN.js} +7 -24
- package/dist/utils-BfpDVibN.js.map +1 -0
- package/dist/{utils-wquIhK6T.js → utils-BqxcalL2.js} +2 -2
- package/dist/utils-BqxcalL2.js.map +1 -0
- package/dist/waitForTransactionReceipt-DieAnV52.js +25 -0
- package/dist/waitForTransactionReceipt-DieAnV52.js.map +1 -0
- package/dist/{x2y2-CQdg24VP.js → x2y2-45WDooeh.js} +1 -1
- package/dist/{x2y2-CQdg24VP.js.map → x2y2-45WDooeh.js.map} +1 -1
- package/dist/{zora-DdEydy4L.js → zora-CbeBoLvQ.js} +1 -1
- package/dist/{zora-DdEydy4L.js.map → zora-CbeBoLvQ.js.map} +1 -1
- package/package.json +43 -38
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +2 -0
- package/src/react/_internal/api/marketplace.gen.ts +1730 -2383
- package/src/react/_internal/api/query-keys.ts +16 -0
- package/src/react/_internal/api/services.ts +1 -1
- package/src/react/_internal/databeat/types.ts +1 -0
- package/src/react/_internal/types.ts +14 -0
- package/src/react/_internal/utils.ts +3 -0
- package/src/react/_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/config/useMarketplaceConfig.tsx +1 -1
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +2 -2
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +1 -1
- package/src/react/hooks/data/collectibles/useCollectible.tsx +1 -1
- package/src/react/hooks/data/collectibles/useCountOfCollectables.tsx +1 -1
- package/src/react/hooks/data/collectibles/useListCollectibleActivities.tsx +1 -1
- package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -1
- package/src/react/hooks/data/collectibles/useListCollectiblesPaginated.tsx +1 -1
- package/src/react/hooks/data/collectibles/useTokenBalances.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/collections/useCollection.tsx +1 -1
- package/src/react/hooks/data/collections/useCollectionBalanceDetails.tsx +1 -1
- package/src/react/hooks/data/collections/useCollectionDetails.ts +1 -1
- package/src/react/hooks/data/collections/useListCollectionActivities.tsx +1 -1
- package/src/react/hooks/data/collections/useListCollections.tsx +1 -1
- package/src/react/hooks/data/inventory/useInventory.test.tsx +3 -98
- package/src/react/hooks/data/inventory/useInventory.tsx +3 -3
- package/src/react/hooks/data/market/useCurrency.tsx +1 -1
- package/src/react/hooks/data/market/useListMarketCardData.tsx +8 -1
- package/src/react/hooks/data/market/useMarketCurrencies.tsx +1 -1
- package/src/react/hooks/data/orders/index.ts +4 -0
- package/src/react/hooks/data/orders/useCountItemsOrdersForCollection.tsx +90 -0
- package/src/react/hooks/data/orders/useCountListingsForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useCountOffersForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useFloorOrder.tsx +1 -1
- package/src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx +39 -0
- package/src/react/hooks/data/orders/useHighestOffer.tsx +1 -1
- package/src/react/hooks/data/orders/useListItemsOrdersForCollection.tsx +93 -0
- package/src/react/hooks/data/orders/useListItemsOrdersForCollectionPaginated.tsx +108 -0
- package/src/react/hooks/data/orders/useListListingsForCollectible.tsx +1 -1
- package/src/react/hooks/data/orders/useListOffersForCollectible.tsx +70 -45
- package/src/react/hooks/data/orders/useLowestListing.tsx +1 -1
- package/src/react/hooks/data/primary-sales/useGetCountOfPrimarySaleItems.tsx +2 -2
- package/src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx +21 -37
- package/src/react/hooks/data/primary-sales/useList721ShopCardData.tsx +14 -3
- package/src/react/hooks/data/primary-sales/useListPrimarySaleItems.tsx +1 -1
- package/src/react/hooks/data/tokens/useGetTokenRanges.tsx +2 -2
- package/src/react/hooks/data/tokens/useListBalances.tsx +2 -2
- package/src/react/hooks/data/tokens/useListTokenMetadata.tsx +1 -1
- package/src/react/hooks/data/tokens/useSearchTokenMetadata.tsx +5 -2
- package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -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/useGenerateCancelTransaction.test.tsx +1 -0
- package/src/react/hooks/transactions/useGenerateListingTransaction.test.tsx +13 -0
- package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +1 -0
- package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +6 -0
- package/src/react/hooks/transactions/useProcessStep.test.tsx +2 -2
- package/src/react/hooks/ui/useFilterState.tsx +72 -2
- package/src/react/hooks/ui/useFilters.tsx +1 -1
- 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/useCheckoutOptions.tsx +2 -2
- package/src/react/hooks/utils/useCheckoutOptionsSalesContract.tsx +1 -1
- package/src/react/hooks/utils/useComparePrices.tsx +1 -1
- package/src/react/hooks/utils/useConvertPriceToUSD.tsx +1 -1
- package/src/react/hooks/utils/useEnsureCorrectChain.ts +31 -34
- package/src/react/providers/analytics-provider.tsx +45 -0
- package/src/react/providers/index.tsx +33 -46
- package/src/react/providers/modal-provider.tsx +15 -4
- package/src/react/queries/{__tests__ → collectibles/__tests__}/balanceOfCollectible.laos.test.ts +4 -4
- package/src/react/queries/collectibles/__tests__/tokenBalances.laos.test.ts +123 -0
- package/src/react/queries/{balanceOfCollectible.ts → collectibles/balanceOfCollectible.ts} +26 -4
- package/src/react/queries/{collectible.ts → collectibles/collectible.ts} +20 -5
- package/src/react/queries/{countOfCollectables.ts → collectibles/countOfCollectables.ts} +32 -6
- package/src/react/queries/collectibles/index.ts +7 -0
- package/src/react/queries/{listCollectibleActivities.ts → collectibles/listCollectibleActivities.ts} +29 -5
- package/src/react/queries/{listCollectibles.ts → collectibles/listCollectibles.ts} +47 -54
- package/src/react/queries/{listCollectiblesPaginated.ts → collectibles/listCollectiblesPaginated.ts} +22 -5
- package/src/react/queries/collectibles/tokenBalances.ts +103 -0
- package/src/react/queries/{collection.ts → collections/collection.ts} +19 -5
- package/src/react/queries/{collectionBalanceDetails.ts → collections/collectionBalanceDetails.ts} +19 -4
- package/src/react/queries/{collectionDetails.ts → collections/collectionDetails.ts} +21 -6
- package/src/react/queries/collections/index.ts +5 -0
- package/src/react/queries/{listCollectionActivities.ts → collections/listCollectionActivities.ts} +28 -6
- package/src/react/queries/{listCollections.ts → collections/listCollections.ts} +26 -18
- package/src/react/queries/index.ts +7 -33
- package/src/react/queries/{__tests__ → inventory/__tests__}/inventory.laos.test.ts +10 -7
- package/src/react/queries/inventory/index.ts +1 -0
- package/src/react/queries/inventory/inventory.ts +169 -0
- package/src/react/queries/{checkoutOptions.ts → market/checkoutOptions.ts} +28 -6
- package/src/react/queries/{checkoutOptionsSalesContract.ts → market/checkoutOptionsSalesContract.ts} +24 -5
- package/src/react/queries/{currency.ts → market/currency.ts} +13 -4
- package/src/react/queries/{filters.ts → market/filters.ts} +48 -34
- package/src/react/queries/market/index.ts +6 -0
- package/src/react/queries/{marketCurrencies.ts → market/marketCurrencies.ts} +24 -5
- package/src/react/queries/{marketplaceConfig.ts → market/marketplaceConfig.ts} +11 -7
- package/src/react/queries/orders/countItemsOrdersForCollection.ts +86 -0
- package/src/react/queries/{countListingsForCollectible.ts → orders/countListingsForCollectible.ts} +23 -6
- package/src/react/queries/{countOffersForCollectible.ts → orders/countOffersForCollectible.ts} +23 -6
- package/src/react/queries/{floorOrder.ts → orders/floorOrder.ts} +15 -4
- package/src/react/queries/orders/getCountOfFilteredOrders.ts +88 -0
- package/src/react/queries/{highestOffer.ts → orders/highestOffer.ts} +16 -4
- package/src/react/queries/orders/index.ts +11 -0
- package/src/react/queries/orders/listItemsOrdersForCollection.ts +90 -0
- package/src/react/queries/orders/listItemsOrdersForCollectionPaginated.ts +90 -0
- package/src/react/queries/{listListingsForCollectible.ts → orders/listListingsForCollectible.ts} +20 -5
- package/src/react/queries/orders/listOffersForCollectible.ts +116 -0
- package/src/react/queries/{lowestListing.ts → orders/lowestListing.ts} +16 -4
- package/src/react/queries/{countOfPrimarySaleItems.ts → primary-sales/countOfPrimarySaleItems.ts} +17 -3
- package/src/react/queries/primary-sales/index.ts +3 -0
- package/src/react/queries/{primarySaleItems.ts → primary-sales/primarySaleItems.ts} +18 -4
- package/src/react/queries/{primarySaleItemsCount.ts → primary-sales/primarySaleItemsCount.ts} +19 -4
- package/src/react/queries/{getTokenRanges.ts → tokens/getTokenRanges.ts} +17 -4
- package/src/react/queries/tokens/index.ts +5 -0
- package/src/react/queries/{listBalances.ts → tokens/listBalances.ts} +18 -3
- package/src/react/queries/{listTokenMetadata.ts → tokens/listTokenMetadata.ts} +18 -4
- package/src/react/queries/{searchTokenMetadata.ts → tokens/searchTokenMetadata.ts} +18 -4
- package/src/react/queries/{tokenSupplies.ts → tokens/tokenSupplies.ts} +16 -4
- package/src/react/queries/{comparePrices.ts → utils/comparePrices.ts} +16 -4
- package/src/react/queries/{convertPriceToUSD.ts → utils/convertPriceToUSD.ts} +18 -5
- package/src/react/queries/utils/index.ts +2 -0
- package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +4 -4
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ui/components/_internals/ErrorLogBox.tsx +85 -0
- package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +8 -8
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +10 -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 +10 -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 +7 -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 +19 -6
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +14 -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 +17 -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 +67 -5
- 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/components/ERC721BuyModal.tsx +31 -0
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC721SalePaymentParams.test.tsx +20 -1
- package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +20 -4
- package/src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts +12 -3
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +11 -2
- package/src/react/ui/modals/BuyModal/store.ts +9 -6
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +63 -24
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +4 -0
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +20 -13
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +4 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +2 -1
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +141 -96
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +10 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +4 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +17 -27
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +2 -1
- package/src/react/ui/modals/SellModal/Modal.tsx +21 -3
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +2 -0
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +5 -2
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +15 -8
- package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +9 -0
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +20 -9
- package/src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx +105 -0
- package/src/react/ui/modals/_internal/components/calendarDropdown/index.tsx +45 -12
- package/src/react/ui/modals/_internal/components/calendarDropdown/overrides.css +39 -0
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +31 -10
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +18 -9
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +53 -3
- 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/components/transactionDetails/index.tsx +58 -10
- package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +481 -0
- package/src/react/ui/modals/_internal/types.ts +0 -1
- package/src/react/utils/waitForTransactionReceipt.ts +26 -32
- package/src/styles/index.css +1 -0
- package/src/styles/styles.ts +201 -25
- package/src/types/index.ts +1 -1
- package/src/types/new-marketplace-types.ts +9 -18
- package/src/types/types.ts +1 -1
- package/src/utils/abi/index.ts +1 -0
- package/src/utils/abi/mainModule.ts +158 -0
- 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/filters-B8XS4tFH.d.ts +0 -31
- package/dist/index-BuY_NKSX.d.ts +0 -222
- package/dist/index-D2HohSwO.d.ts +0 -293
- package/dist/listCollectiblesPaginated--AgXjajA.d.ts +0 -166
- package/dist/lowestListing-BQHfQpfg.d.ts +0 -144
- 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 +0 -1478
- package/dist/queries-BYT4GJw3.js.map +0 -1
- package/dist/react-CbqXKOpt.css +0 -80
- package/dist/react-CbqXKOpt.css.map +0 -1
- package/dist/react-Ceq8mamy.js.map +0 -1
- package/dist/tokenSupplies-DXtkRYNO.d.ts +0 -147
- 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/dist/waitForTransactionReceipt-DZxAuR9N.js +0 -27
- package/dist/waitForTransactionReceipt-DZxAuR9N.js.map +0 -1
- package/src/react/hooks/utils/useSwitchChainWithModal.ts +0 -38
- package/src/react/queries/inventory.ts +0 -343
- 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/{index-q7f-WDBS.d.ts → index-6wsMChsg.d.ts} +0 -0
- /package/dist/{abi-Wr_aTZFi.js → queries-KOcILNJO.js} +0 -0
- /package/dist/{wagmi-BhP3mdhP.js → wagmi-Bseovd6Q.js} +0 -0
|
@@ -1,46 +1,55 @@
|
|
|
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,
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
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, marketplaceApiURL } from "./api-BoO0V5aJ.js";
|
|
5
|
+
import { CollectionStatus, ContractType, ExecuteType, OrderSide, OrderbookKind, PropertyType, StepType, WalletKind } from "./marketplace.gen-ksUafDqS.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-NQB-sEQL.js";
|
|
10
|
+
import { ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1 } from "./primary-sale-1u4QlPdA.js";
|
|
11
|
+
import { ERC1155_ABI, ERC721_ABI } from "./token-Cv7l2ZaL.js";
|
|
12
|
+
import { calculateEarningsAfterFees, cn as cn$1, compareAddress, formatPriceWithFee, truncateMiddle } from "./utils-BfpDVibN.js";
|
|
13
|
+
import { marketplaceConfigOptions } from "./marketplaceConfig-UHQMM9fq.js";
|
|
14
|
+
import { SalesContractVersion, useSalesContractABI } from "./contracts-BP_0vX48.js";
|
|
15
|
+
import { balanceOfCollectibleOptions, collectibleQueryOptions, countOfCollectablesQueryOptions, listCollectibleActivitiesQueryOptions, listCollectiblesPaginatedQueryOptions, listCollectiblesQueryOptions } from "./collectibles-C_H8jMGH.js";
|
|
16
|
+
import { listBalancesOptions } from "./listBalances-BxpxBCvn.js";
|
|
17
|
+
import { collectionBalanceDetailsQueryOptions, collectionDetailsQueryOptions, collectionQueryOptions, listCollectionActivitiesQueryOptions, listCollectionsQueryOptions } from "./collections-CKummc-R.js";
|
|
18
|
+
import { checkoutOptionsQueryOptions, checkoutOptionsSalesContractQueryOptions, currencyQueryOptions, filtersQueryOptions } from "./market-C3HV-awQ.js";
|
|
19
|
+
import { marketCurrenciesQueryOptions } from "./marketCurrencies-sKrTX0og.js";
|
|
20
|
+
import { countItemsOrdersForCollectionQueryOptions, countListingsForCollectibleQueryOptions, countOffersForCollectibleQueryOptions, floorOrderQueryOptions, getCountOfFilteredOrdersQueryOptions, highestOfferQueryOptions, listItemsOrdersForCollectionPaginatedQueryOptions, listItemsOrdersForCollectionQueryOptions, listListingsForCollectibleQueryOptions, listOffersForCollectibleQueryOptions, lowestListingQueryOptions } from "./orders-DnFfZAXV.js";
|
|
21
|
+
import { inventoryOptions } from "./inventory-Dd7TazvZ.js";
|
|
22
|
+
import { countOfPrimarySaleItemsOptions, listPrimarySaleItemsQueryOptions, primarySaleItemsCountQueryOptions } from "./primary-sales-Dmsi6bqj.js";
|
|
23
|
+
import { getTokenRangesQueryOptions, listTokenMetadataQueryOptions, searchTokenMetadataQueryOptions, tokenSuppliesQueryOptions } from "./tokens-cGxMadd8.js";
|
|
24
|
+
import { comparePricesQueryOptions, convertPriceToUSDQueryOptions } from "./utils-BCgNhBFR.js";
|
|
25
|
+
import { waitForTransactionReceipt } from "./waitForTransactionReceipt-DieAnV52.js";
|
|
26
|
+
import { CalendarIcon_default, CartIcon_default, InfoIcon_default } from "./CartIcon-Bt3rQYGk.js";
|
|
27
|
+
import { FooterName, PriceDisplay, SaleDetailsPill, TokenTypeBalancePill } from "./components-CosnX7F9.js";
|
|
20
28
|
import { NetworkType, networks } from "@0xsequence/network";
|
|
21
29
|
import { useAccount, useBalance, useChainId, usePublicClient, useReadContract, useReadContracts, useSendTransaction, useSignMessage, useSignTypedData, useSwitchChain, useWriteContract } from "wagmi";
|
|
30
|
+
import { useChain, useOpenConnectModal, useWaasFeeOptions } from "@0xsequence/connect";
|
|
22
31
|
import { Suspense, createContext, lazy, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
23
32
|
import { QueryClientProvider, queryOptions, skipToken, useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
|
24
33
|
import { TransactionStatus } from "@0xsequence/indexer";
|
|
25
|
-
import { AddIcon, Button, CheckmarkIcon, ChevronDownIcon,
|
|
34
|
+
import { AddIcon, Button, CheckmarkIcon, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Divider, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger, ExternalLinkIcon, IconButton, Image, Modal, NetworkImage, NumericInput, Select, Skeleton, Spinner, SubtractIcon, Text, TextInput, ThemeProvider, TimeIcon, TokenImage, Tooltip, WarningIcon, cn } from "@0xsequence/design-system";
|
|
26
35
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
27
36
|
import * as dn from "dnum";
|
|
28
|
-
import { BaseError
|
|
37
|
+
import { BaseError, UserRejectedRequestError, WaitForTransactionReceiptTimeoutError, decodeFunctionData, encodeFunctionData, erc20Abi, erc721Abi, formatUnits, hexToBigInt, isAddress, isHex, maxUint256, parseEventLogs, parseUnits, toHex, zeroAddress } from "viem";
|
|
29
38
|
import { Databeat } from "@databeat/tracker";
|
|
30
39
|
import { observable } from "@legendapp/state";
|
|
31
|
-
import { createSerializer, parseAsBoolean, parseAsJson, parseAsString, useQueryState } from "nuqs";
|
|
32
40
|
import { createStore } from "@xstate/store";
|
|
33
41
|
import { useSelector } from "@xstate/store/react";
|
|
42
|
+
import { createSerializer, parseAsBoolean, parseAsJson, parseAsString, useQueryState } from "nuqs";
|
|
34
43
|
import { SequenceCheckoutProvider, useERC1155SaleContractCheckout, useSelectPaymentModal } from "@0xsequence/checkout";
|
|
35
44
|
import { Show, observer, use$ } from "@legendapp/state/react";
|
|
36
|
-
import { addDays, differenceInDays, format, formatDistanceToNow, isSameDay, startOfDay } from "date-fns";
|
|
45
|
+
import { addDays, differenceInDays, endOfDay, format, formatDistanceToNow, getHours, getMinutes, isSameDay, setHours, setMinutes, startOfDay } from "date-fns";
|
|
37
46
|
import { avalanche, optimism } from "viem/chains";
|
|
38
47
|
import { DayPicker } from "react-day-picker";
|
|
39
48
|
import { addDays as addDays$1 } from "date-fns/addDays";
|
|
40
49
|
import { createPortal } from "react-dom";
|
|
41
50
|
|
|
42
51
|
//#region src/utils/_internal/error/context.ts
|
|
43
|
-
var MarketplaceSdkProviderNotFoundError = class extends BaseError {
|
|
52
|
+
var MarketplaceSdkProviderNotFoundError = class extends BaseError$1 {
|
|
44
53
|
name = "MarketplaceSDKProviderNotFoundError";
|
|
45
54
|
constructor() {
|
|
46
55
|
super("`useConfig` must be used within `MarketplaceSdkProvider`.");
|
|
@@ -49,7 +58,7 @@ var MarketplaceSdkProviderNotFoundError = class extends BaseError {
|
|
|
49
58
|
|
|
50
59
|
//#endregion
|
|
51
60
|
//#region src/utils/_internal/error/config.ts
|
|
52
|
-
var ConfigError = class extends BaseError {
|
|
61
|
+
var ConfigError = class extends BaseError$1 {
|
|
53
62
|
name = "ConfigError";
|
|
54
63
|
};
|
|
55
64
|
var InvalidProjectAccessKeyError = class extends ConfigError {
|
|
@@ -98,10 +107,39 @@ var DatabeatAnalytics = class extends Databeat {
|
|
|
98
107
|
}
|
|
99
108
|
};
|
|
100
109
|
const useAnalytics = () => {
|
|
101
|
-
|
|
102
|
-
return context.analytics;
|
|
110
|
+
return useContext(MarketplaceSdkContext).analytics;
|
|
103
111
|
};
|
|
104
112
|
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/react/providers/analytics-provider.tsx
|
|
115
|
+
function AnalyticsProvider({ config, children }) {
|
|
116
|
+
const { address, isConnected } = useAccount();
|
|
117
|
+
const isWindowDefined = typeof window !== "undefined";
|
|
118
|
+
const analytics = useMemo(() => {
|
|
119
|
+
const server = "https://nodes.sequence.app";
|
|
120
|
+
const auth = {};
|
|
121
|
+
auth.headers = { "X-Access-Key": config.projectAccessKey };
|
|
122
|
+
return new DatabeatAnalytics(server, auth, {
|
|
123
|
+
defaultEnabled: true,
|
|
124
|
+
initProps: () => {
|
|
125
|
+
return { origin: isWindowDefined ? window.location.origin : "" };
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}, [config.projectAccessKey, isWindowDefined]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (!isConnected || !address) {
|
|
131
|
+
analytics?.reset();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
analytics?.identify(address.toLowerCase());
|
|
135
|
+
}, [
|
|
136
|
+
analytics,
|
|
137
|
+
address,
|
|
138
|
+
isConnected
|
|
139
|
+
]);
|
|
140
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(analytics) });
|
|
141
|
+
}
|
|
142
|
+
|
|
105
143
|
//#endregion
|
|
106
144
|
//#region src/react/providers/theme-provider.tsx
|
|
107
145
|
const ThemeProvider$1 = ({ children, theme, root }) => {
|
|
@@ -119,35 +157,29 @@ const ThemeProvider$1 = ({ children, theme, root }) => {
|
|
|
119
157
|
const MarketplaceSdkContext = createContext({});
|
|
120
158
|
function MarketplaceProvider({ config, children, openConnectModal }) {
|
|
121
159
|
if (config.projectAccessKey === "" || !config.projectAccessKey) throw new InvalidProjectAccessKeyError(config.projectAccessKey);
|
|
122
|
-
|
|
123
|
-
const server = "https://nodes.sequence.app";
|
|
124
|
-
const auth = {};
|
|
125
|
-
auth.headers = { "X-Access-Key": config.projectAccessKey };
|
|
126
|
-
return new DatabeatAnalytics(server, auth, {
|
|
127
|
-
defaultEnabled: true,
|
|
128
|
-
initProps: () => {
|
|
129
|
-
return { origin: typeof window !== "undefined" ? window.location.origin : "" };
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}, [config.projectAccessKey, window]);
|
|
133
|
-
if (openConnectModal) {
|
|
134
|
-
const context = {
|
|
135
|
-
...config,
|
|
136
|
-
openConnectModal,
|
|
137
|
-
analytics
|
|
138
|
-
};
|
|
139
|
-
return /* @__PURE__ */ jsx(MarketplaceQueryClientProvider, { children: /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
140
|
-
value: context,
|
|
141
|
-
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children: /* @__PURE__ */ jsx("div", {
|
|
142
|
-
id: PROVIDER_ID,
|
|
143
|
-
children
|
|
144
|
-
}) })
|
|
145
|
-
}) });
|
|
146
|
-
}
|
|
147
|
-
return /* @__PURE__ */ jsx(MarketplaceProviderWithSequenceConnect, {
|
|
160
|
+
return /* @__PURE__ */ jsx(AnalyticsProvider, {
|
|
148
161
|
config,
|
|
149
|
-
analytics
|
|
150
|
-
|
|
162
|
+
children: (analytics) => {
|
|
163
|
+
if (openConnectModal) {
|
|
164
|
+
const context = {
|
|
165
|
+
...config,
|
|
166
|
+
openConnectModal,
|
|
167
|
+
analytics
|
|
168
|
+
};
|
|
169
|
+
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
170
|
+
value: context,
|
|
171
|
+
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children: /* @__PURE__ */ jsx("div", {
|
|
172
|
+
id: PROVIDER_ID,
|
|
173
|
+
children
|
|
174
|
+
}) })
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return /* @__PURE__ */ jsx(MarketplaceProviderWithSequenceConnect, {
|
|
178
|
+
config,
|
|
179
|
+
analytics,
|
|
180
|
+
children: /* @__PURE__ */ jsx(ThemeProvider$1, { children })
|
|
181
|
+
});
|
|
182
|
+
}
|
|
151
183
|
});
|
|
152
184
|
}
|
|
153
185
|
function MarketplaceQueryClientProvider({ children }) {
|
|
@@ -164,13 +196,13 @@ function MarketplaceProviderWithSequenceConnect({ config, children, analytics })
|
|
|
164
196
|
openConnectModal: () => setOpenConnectModal(true),
|
|
165
197
|
analytics
|
|
166
198
|
};
|
|
167
|
-
return /* @__PURE__ */ jsx(
|
|
199
|
+
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, {
|
|
168
200
|
value: context,
|
|
169
201
|
children: /* @__PURE__ */ jsx("div", {
|
|
170
202
|
id: PROVIDER_ID,
|
|
171
203
|
children
|
|
172
204
|
})
|
|
173
|
-
})
|
|
205
|
+
});
|
|
174
206
|
}
|
|
175
207
|
|
|
176
208
|
//#endregion
|
|
@@ -227,8 +259,7 @@ const useMarketplaceConfig = () => {
|
|
|
227
259
|
function useBalanceOfCollectible(args) {
|
|
228
260
|
const config = useConfig();
|
|
229
261
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
230
|
-
const
|
|
231
|
-
const isLaos721 = collection?.contractType === ContractType.LAOS_ERC_721;
|
|
262
|
+
const isLaos721 = (marketplaceConfig?.market.collections.find((collection) => collection.itemsAddress === args.collectionAddress))?.contractType === ContractType.LAOS_ERC_721;
|
|
232
263
|
return useQuery(balanceOfCollectibleOptions({
|
|
233
264
|
...args,
|
|
234
265
|
isLaos721
|
|
@@ -717,8 +748,7 @@ const collectionDetailsPollingOptions = (args, config) => {
|
|
|
717
748
|
if (data && isTerminalState(data.status)) return false;
|
|
718
749
|
const currentAttempt = (query.state.dataUpdateCount || 0) + 1;
|
|
719
750
|
if (currentAttempt >= MAX_ATTEMPTS) return false;
|
|
720
|
-
|
|
721
|
-
return interval;
|
|
751
|
+
return Math.min(INITIAL_POLLING_INTERVAL * 1.5 ** currentAttempt, MAX_POLLING_INTERVAL);
|
|
722
752
|
},
|
|
723
753
|
refetchOnWindowFocus: false,
|
|
724
754
|
retry: false,
|
|
@@ -940,7 +970,7 @@ const useSellModal = (callbacks) => {
|
|
|
940
970
|
|
|
941
971
|
//#endregion
|
|
942
972
|
//#region src/react/hooks/data/market/useListMarketCardData.tsx
|
|
943
|
-
function useListMarketCardData({ collectionAddress, chainId, orderbookKind, collectionType, filterOptions, searchText, showListedOnly = false, onCollectibleClick, onCannotPerformAction, prioritizeOwnerActions, assetSrcPrefixUrl }) {
|
|
973
|
+
function useListMarketCardData({ collectionAddress, chainId, orderbookKind, collectionType, filterOptions, searchText, showListedOnly = false, priceFilters, onCollectibleClick, onCannotPerformAction, prioritizeOwnerActions, assetSrcPrefixUrl, hideQuantitySelector }) {
|
|
944
974
|
const { address: accountAddress } = useAccount();
|
|
945
975
|
const { show: showSellModal } = useSellModal();
|
|
946
976
|
const { data: collectiblesList, isLoading: collectiblesListIsLoading, fetchNextPage, hasNextPage, isFetchingNextPage, error: collectiblesListError } = useListCollectibles({
|
|
@@ -950,7 +980,8 @@ function useListMarketCardData({ collectionAddress, chainId, orderbookKind, coll
|
|
|
950
980
|
filter: {
|
|
951
981
|
includeEmpty: !showListedOnly,
|
|
952
982
|
searchText,
|
|
953
|
-
properties: filterOptions
|
|
983
|
+
properties: filterOptions,
|
|
984
|
+
prices: priceFilters
|
|
954
985
|
},
|
|
955
986
|
query: { enabled: !!collectionAddress && !!chainId }
|
|
956
987
|
});
|
|
@@ -967,57 +998,56 @@ function useListMarketCardData({ collectionAddress, chainId, orderbookKind, coll
|
|
|
967
998
|
if (!collectiblesList?.pages) return [];
|
|
968
999
|
return collectiblesList.pages.flatMap((page) => page.collectibles);
|
|
969
1000
|
}, [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
1001
|
return {
|
|
1020
|
-
collectibleCards
|
|
1002
|
+
collectibleCards: useMemo(() => {
|
|
1003
|
+
return allCollectibles.map((collectible) => {
|
|
1004
|
+
const balance = collectionBalance?.balances.find((balance$1) => balance$1.tokenID === collectible.metadata.tokenId)?.balance;
|
|
1005
|
+
return {
|
|
1006
|
+
collectibleId: collectible.metadata.tokenId,
|
|
1007
|
+
chainId,
|
|
1008
|
+
collectionAddress,
|
|
1009
|
+
collectionType,
|
|
1010
|
+
cardLoading: collectiblesListIsLoading || balanceLoading,
|
|
1011
|
+
cardType: "market",
|
|
1012
|
+
orderbookKind,
|
|
1013
|
+
collectible,
|
|
1014
|
+
onCollectibleClick,
|
|
1015
|
+
balance,
|
|
1016
|
+
balanceIsLoading: balanceLoading,
|
|
1017
|
+
onCannotPerformAction,
|
|
1018
|
+
prioritizeOwnerActions,
|
|
1019
|
+
assetSrcPrefixUrl,
|
|
1020
|
+
hideQuantitySelector,
|
|
1021
|
+
onOfferClick: ({ order }) => {
|
|
1022
|
+
if (!accountAddress) return;
|
|
1023
|
+
if (balance) {
|
|
1024
|
+
showSellModal({
|
|
1025
|
+
chainId,
|
|
1026
|
+
collectionAddress,
|
|
1027
|
+
tokenId: collectible.metadata.tokenId,
|
|
1028
|
+
order
|
|
1029
|
+
});
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
});
|
|
1035
|
+
}, [
|
|
1036
|
+
allCollectibles,
|
|
1037
|
+
chainId,
|
|
1038
|
+
collectionAddress,
|
|
1039
|
+
collectionType,
|
|
1040
|
+
collectiblesListIsLoading,
|
|
1041
|
+
balanceLoading,
|
|
1042
|
+
orderbookKind,
|
|
1043
|
+
onCollectibleClick,
|
|
1044
|
+
collectionBalance?.balances,
|
|
1045
|
+
onCannotPerformAction,
|
|
1046
|
+
prioritizeOwnerActions,
|
|
1047
|
+
assetSrcPrefixUrl,
|
|
1048
|
+
accountAddress,
|
|
1049
|
+
showSellModal
|
|
1050
|
+
]),
|
|
1021
1051
|
isLoading: collectiblesListIsLoading || balanceLoading,
|
|
1022
1052
|
error: collectiblesListError,
|
|
1023
1053
|
hasNextPage,
|
|
@@ -1070,6 +1100,69 @@ function useMarketCurrencies(params) {
|
|
|
1070
1100
|
return useQuery({ ...queryOptions$1 });
|
|
1071
1101
|
}
|
|
1072
1102
|
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/react/hooks/data/orders/useCountItemsOrdersForCollection.tsx
|
|
1105
|
+
/**
|
|
1106
|
+
* Hook to get the count of orders for a collection
|
|
1107
|
+
*
|
|
1108
|
+
* Counts the total number of active orders (listings) for all tokens
|
|
1109
|
+
* in a collection. Useful for displaying order counts in collection UI.
|
|
1110
|
+
*
|
|
1111
|
+
* @param params - Configuration parameters
|
|
1112
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1113
|
+
* @param params.collectionAddress - The collection contract address
|
|
1114
|
+
* @param params.filter - Optional filter criteria for orders
|
|
1115
|
+
* @param params.query - Optional React Query configuration
|
|
1116
|
+
*
|
|
1117
|
+
* @returns Query result containing the count of orders
|
|
1118
|
+
*
|
|
1119
|
+
* @example
|
|
1120
|
+
* Basic usage:
|
|
1121
|
+
* ```typescript
|
|
1122
|
+
* const { data: orderCount, isLoading } = useCountItemsOrdersForCollection({
|
|
1123
|
+
* chainId: 137,
|
|
1124
|
+
* collectionAddress: '0x...'
|
|
1125
|
+
* })
|
|
1126
|
+
* ```
|
|
1127
|
+
*
|
|
1128
|
+
* @example
|
|
1129
|
+
* With filter:
|
|
1130
|
+
* ```typescript
|
|
1131
|
+
* const { data: filteredCount } = useCountItemsOrdersForCollection({
|
|
1132
|
+
* chainId: 137,
|
|
1133
|
+
* collectionAddress: '0x...',
|
|
1134
|
+
* filter: {
|
|
1135
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2]
|
|
1136
|
+
* }
|
|
1137
|
+
* })
|
|
1138
|
+
* ```
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
* Combined with list hook:
|
|
1142
|
+
* ```typescript
|
|
1143
|
+
* const { data: totalCount } = useCountItemsOrdersForCollection({
|
|
1144
|
+
* chainId: 137,
|
|
1145
|
+
* collectionAddress: '0x...'
|
|
1146
|
+
* })
|
|
1147
|
+
*
|
|
1148
|
+
* const { data: orders } = useListItemsOrdersForCollection({
|
|
1149
|
+
* chainId: 137,
|
|
1150
|
+
* collectionAddress: '0x...'
|
|
1151
|
+
* })
|
|
1152
|
+
*
|
|
1153
|
+
* return <div>Showing {orders?.pages[0]?.listings.length ?? 0} of {totalCount} orders</div>
|
|
1154
|
+
* ```
|
|
1155
|
+
*/
|
|
1156
|
+
function useCountItemsOrdersForCollection(params) {
|
|
1157
|
+
const defaultConfig = useConfig();
|
|
1158
|
+
const { config = defaultConfig,...rest } = params;
|
|
1159
|
+
const queryOptions$1 = countItemsOrdersForCollectionQueryOptions({
|
|
1160
|
+
config,
|
|
1161
|
+
...rest
|
|
1162
|
+
});
|
|
1163
|
+
return useQuery({ ...queryOptions$1 });
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1073
1166
|
//#endregion
|
|
1074
1167
|
//#region src/react/hooks/data/orders/useCountListingsForCollectible.tsx
|
|
1075
1168
|
/**
|
|
@@ -1217,6 +1310,18 @@ function useFloorOrder(params) {
|
|
|
1217
1310
|
return useQuery({ ...queryOptions$1 });
|
|
1218
1311
|
}
|
|
1219
1312
|
|
|
1313
|
+
//#endregion
|
|
1314
|
+
//#region src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx
|
|
1315
|
+
function useGetCountOfFilteredOrders(params) {
|
|
1316
|
+
const defaultConfig = useConfig();
|
|
1317
|
+
const { config = defaultConfig,...rest } = params;
|
|
1318
|
+
const queryOptions$1 = getCountOfFilteredOrdersQueryOptions({
|
|
1319
|
+
config,
|
|
1320
|
+
...rest
|
|
1321
|
+
});
|
|
1322
|
+
return useQuery({ ...queryOptions$1 });
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1220
1325
|
//#endregion
|
|
1221
1326
|
//#region src/react/hooks/data/orders/useHighestOffer.tsx
|
|
1222
1327
|
/**
|
|
@@ -1268,143 +1373,131 @@ function useHighestOffer(params) {
|
|
|
1268
1373
|
}
|
|
1269
1374
|
|
|
1270
1375
|
//#endregion
|
|
1271
|
-
//#region src/react/hooks/data/orders/
|
|
1376
|
+
//#region src/react/hooks/data/orders/useListItemsOrdersForCollection.tsx
|
|
1272
1377
|
/**
|
|
1273
|
-
* Hook to fetch listings for a
|
|
1378
|
+
* Hook to fetch all listings for a collection with infinite pagination support
|
|
1274
1379
|
*
|
|
1275
|
-
* Fetches active listings (sales) for a
|
|
1276
|
-
* with support for filtering and pagination.
|
|
1380
|
+
* Fetches active listings (sales) for all tokens in a collection from the marketplace
|
|
1381
|
+
* with support for filtering and infinite scroll pagination.
|
|
1277
1382
|
*
|
|
1278
1383
|
* @param params - Configuration parameters
|
|
1279
1384
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1280
1385
|
* @param params.collectionAddress - The collection contract address
|
|
1281
|
-
* @param params.collectibleId - The specific token ID to fetch listings for
|
|
1282
1386
|
* @param params.filter - Optional filtering parameters (marketplace, currencies, etc.)
|
|
1283
|
-
* @param params.page - Optional pagination parameters
|
|
1284
1387
|
* @param params.query - Optional React Query configuration
|
|
1285
1388
|
*
|
|
1286
|
-
* @returns
|
|
1389
|
+
* @returns Infinite query result containing listings data with pagination
|
|
1287
1390
|
*
|
|
1288
1391
|
* @example
|
|
1289
1392
|
* Basic usage:
|
|
1290
1393
|
* ```typescript
|
|
1291
|
-
* const { data, isLoading } =
|
|
1394
|
+
* const { data, isLoading, fetchNextPage, hasNextPage } = useListItemsOrdersForCollection({
|
|
1292
1395
|
* chainId: 137,
|
|
1293
|
-
* collectionAddress: '0x...'
|
|
1294
|
-
* collectibleId: '123'
|
|
1396
|
+
* collectionAddress: '0x...'
|
|
1295
1397
|
* })
|
|
1296
1398
|
* ```
|
|
1297
1399
|
*
|
|
1298
1400
|
* @example
|
|
1299
|
-
* With
|
|
1401
|
+
* With filtering:
|
|
1300
1402
|
* ```typescript
|
|
1301
|
-
* const { data } =
|
|
1403
|
+
* const { data, fetchNextPage } = useListItemsOrdersForCollection({
|
|
1302
1404
|
* chainId: 1,
|
|
1303
1405
|
* collectionAddress: '0x...',
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
* pageSize: 20
|
|
1406
|
+
* filter: {
|
|
1407
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2],
|
|
1408
|
+
* currencies: ['0x...']
|
|
1308
1409
|
* }
|
|
1309
1410
|
* })
|
|
1310
1411
|
* ```
|
|
1311
1412
|
*
|
|
1312
1413
|
* @example
|
|
1313
|
-
*
|
|
1414
|
+
* Accessing paginated data:
|
|
1314
1415
|
* ```typescript
|
|
1315
|
-
* const { data } =
|
|
1416
|
+
* const { data } = useListItemsOrdersForCollection({
|
|
1316
1417
|
* chainId: 137,
|
|
1317
|
-
* collectionAddress: '0x...'
|
|
1318
|
-
* collectibleId: '789',
|
|
1319
|
-
* filter: {
|
|
1320
|
-
* marketplace: [MarketplaceKind.sequence_marketplace_v2],
|
|
1321
|
-
* currencies: ['0x...'] // Specific currency addresses
|
|
1322
|
-
* }
|
|
1418
|
+
* collectionAddress: '0x...'
|
|
1323
1419
|
* })
|
|
1420
|
+
*
|
|
1421
|
+
* const allListings = data?.pages.flatMap(page => page.listings) ?? []
|
|
1324
1422
|
* ```
|
|
1325
1423
|
*/
|
|
1326
|
-
function
|
|
1424
|
+
function useListItemsOrdersForCollection(params) {
|
|
1327
1425
|
const defaultConfig = useConfig();
|
|
1328
1426
|
const { config = defaultConfig,...rest } = params;
|
|
1329
|
-
const queryOptions$1 =
|
|
1427
|
+
const queryOptions$1 = listItemsOrdersForCollectionQueryOptions({
|
|
1330
1428
|
config,
|
|
1331
1429
|
...rest
|
|
1332
1430
|
});
|
|
1333
|
-
return
|
|
1431
|
+
return useInfiniteQuery({ ...queryOptions$1 });
|
|
1334
1432
|
}
|
|
1335
1433
|
|
|
1336
1434
|
//#endregion
|
|
1337
|
-
//#region src/react/hooks/data/orders/
|
|
1338
|
-
const fetchListOffersForCollectible = async (config, args) => {
|
|
1339
|
-
const arg = {
|
|
1340
|
-
chainId: String(args.chainId),
|
|
1341
|
-
contractAddress: args.collectionAddress,
|
|
1342
|
-
tokenId: args.collectibleId,
|
|
1343
|
-
filter: args.filter,
|
|
1344
|
-
page: args.page
|
|
1345
|
-
};
|
|
1346
|
-
const marketplaceClient = getMarketplaceClient(config);
|
|
1347
|
-
return marketplaceClient.listCollectibleOffers(arg);
|
|
1348
|
-
};
|
|
1349
|
-
const listOffersForCollectibleOptions = (args, config) => {
|
|
1350
|
-
return queryOptions({
|
|
1351
|
-
queryKey: [
|
|
1352
|
-
...collectableKeys.offers,
|
|
1353
|
-
args,
|
|
1354
|
-
config
|
|
1355
|
-
],
|
|
1356
|
-
queryFn: () => fetchListOffersForCollectible(config, args)
|
|
1357
|
-
});
|
|
1358
|
-
};
|
|
1359
|
-
const useListOffersForCollectible = (args) => {
|
|
1360
|
-
const config = useConfig();
|
|
1361
|
-
return useQuery(listOffersForCollectibleOptions(args, config));
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
|
-
//#endregion
|
|
1365
|
-
//#region src/react/hooks/data/orders/useLowestListing.tsx
|
|
1435
|
+
//#region src/react/hooks/data/orders/useListItemsOrdersForCollectionPaginated.tsx
|
|
1366
1436
|
/**
|
|
1367
|
-
* Hook to fetch
|
|
1437
|
+
* Hook to fetch all listings for a collection with pagination support
|
|
1368
1438
|
*
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1439
|
+
* Fetches active listings (sales) for all tokens in a collection from the marketplace
|
|
1440
|
+
* with support for filtering and pagination. Unlike the infinite query version,
|
|
1441
|
+
* this hook fetches a specific page of results.
|
|
1371
1442
|
*
|
|
1372
1443
|
* @param params - Configuration parameters
|
|
1373
1444
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1374
1445
|
* @param params.collectionAddress - The collection contract address
|
|
1375
|
-
* @param params.
|
|
1446
|
+
* @param params.side - Order side (listing or bid)
|
|
1447
|
+
* @param params.filter - Optional filtering parameters (marketplace, currencies, etc.)
|
|
1448
|
+
* @param params.page - Page number to fetch (default: 1)
|
|
1449
|
+
* @param params.pageSize - Number of items per page (default: 30)
|
|
1376
1450
|
* @param params.query - Optional React Query configuration
|
|
1377
1451
|
*
|
|
1378
|
-
* @returns Query result containing
|
|
1452
|
+
* @returns Query result containing listings data for the specific page
|
|
1379
1453
|
*
|
|
1380
1454
|
* @example
|
|
1381
1455
|
* Basic usage:
|
|
1382
1456
|
* ```typescript
|
|
1383
|
-
* const { data, isLoading } =
|
|
1457
|
+
* const { data, isLoading } = useListItemsOrdersForCollectionPaginated({
|
|
1384
1458
|
* chainId: 137,
|
|
1385
1459
|
* collectionAddress: '0x...',
|
|
1386
|
-
*
|
|
1460
|
+
* side: OrderSide.listing,
|
|
1461
|
+
* page: 1,
|
|
1462
|
+
* pageSize: 20
|
|
1387
1463
|
* })
|
|
1388
1464
|
* ```
|
|
1389
1465
|
*
|
|
1390
1466
|
* @example
|
|
1391
|
-
* With
|
|
1467
|
+
* With filtering:
|
|
1392
1468
|
* ```typescript
|
|
1393
|
-
* const { data
|
|
1469
|
+
* const { data } = useListItemsOrdersForCollectionPaginated({
|
|
1394
1470
|
* chainId: 1,
|
|
1395
1471
|
* collectionAddress: '0x...',
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1472
|
+
* side: OrderSide.listing,
|
|
1473
|
+
* page: 2,
|
|
1474
|
+
* pageSize: 50,
|
|
1475
|
+
* filter: {
|
|
1476
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2],
|
|
1477
|
+
* currencies: ['0x...']
|
|
1400
1478
|
* }
|
|
1401
1479
|
* })
|
|
1402
1480
|
* ```
|
|
1481
|
+
*
|
|
1482
|
+
* @example
|
|
1483
|
+
* Controlled pagination:
|
|
1484
|
+
* ```typescript
|
|
1485
|
+
* const [currentPage, setCurrentPage] = useState(1);
|
|
1486
|
+
* const { data, isLoading } = useListItemsOrdersForCollectionPaginated({
|
|
1487
|
+
* chainId: 137,
|
|
1488
|
+
* collectionAddress: '0x...',
|
|
1489
|
+
* side: OrderSide.listing,
|
|
1490
|
+
* page: currentPage,
|
|
1491
|
+
* pageSize: 25
|
|
1492
|
+
* });
|
|
1493
|
+
*
|
|
1494
|
+
* const hasMorePages = data?.page?.more;
|
|
1495
|
+
* ```
|
|
1403
1496
|
*/
|
|
1404
|
-
function
|
|
1497
|
+
function useListItemsOrdersForCollectionPaginated(params) {
|
|
1405
1498
|
const defaultConfig = useConfig();
|
|
1406
1499
|
const { config = defaultConfig,...rest } = params;
|
|
1407
|
-
const queryOptions$1 =
|
|
1500
|
+
const queryOptions$1 = listItemsOrdersForCollectionPaginatedQueryOptions({
|
|
1408
1501
|
config,
|
|
1409
1502
|
...rest
|
|
1410
1503
|
});
|
|
@@ -1412,43 +1505,205 @@ function useLowestListing(params) {
|
|
|
1412
1505
|
}
|
|
1413
1506
|
|
|
1414
1507
|
//#endregion
|
|
1415
|
-
//#region src/react/hooks/data/
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1508
|
+
//#region src/react/hooks/data/orders/useListListingsForCollectible.tsx
|
|
1509
|
+
/**
|
|
1510
|
+
* Hook to fetch listings for a specific collectible
|
|
1511
|
+
*
|
|
1512
|
+
* Fetches active listings (sales) for a specific token from the marketplace
|
|
1513
|
+
* with support for filtering and pagination.
|
|
1514
|
+
*
|
|
1515
|
+
* @param params - Configuration parameters
|
|
1516
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1517
|
+
* @param params.collectionAddress - The collection contract address
|
|
1518
|
+
* @param params.collectibleId - The specific token ID to fetch listings for
|
|
1519
|
+
* @param params.filter - Optional filtering parameters (marketplace, currencies, etc.)
|
|
1520
|
+
* @param params.page - Optional pagination parameters
|
|
1521
|
+
* @param params.query - Optional React Query configuration
|
|
1522
|
+
*
|
|
1523
|
+
* @returns Query result containing listings data for the collectible
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* Basic usage:
|
|
1527
|
+
* ```typescript
|
|
1528
|
+
* const { data, isLoading } = useListListingsForCollectible({
|
|
1529
|
+
* chainId: 137,
|
|
1530
|
+
* collectionAddress: '0x...',
|
|
1531
|
+
* collectibleId: '123'
|
|
1532
|
+
* })
|
|
1533
|
+
* ```
|
|
1534
|
+
*
|
|
1535
|
+
* @example
|
|
1536
|
+
* With pagination:
|
|
1537
|
+
* ```typescript
|
|
1538
|
+
* const { data } = useListListingsForCollectible({
|
|
1539
|
+
* chainId: 1,
|
|
1540
|
+
* collectionAddress: '0x...',
|
|
1541
|
+
* collectibleId: '456',
|
|
1542
|
+
* page: {
|
|
1543
|
+
* page: 2,
|
|
1544
|
+
* pageSize: 20
|
|
1545
|
+
* }
|
|
1546
|
+
* })
|
|
1547
|
+
* ```
|
|
1548
|
+
*
|
|
1549
|
+
* @example
|
|
1550
|
+
* With filtering:
|
|
1551
|
+
* ```typescript
|
|
1552
|
+
* const { data } = useListListingsForCollectible({
|
|
1553
|
+
* chainId: 137,
|
|
1554
|
+
* collectionAddress: '0x...',
|
|
1555
|
+
* collectibleId: '789',
|
|
1556
|
+
* filter: {
|
|
1557
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2],
|
|
1558
|
+
* currencies: ['0x...'] // Specific currency addresses
|
|
1559
|
+
* }
|
|
1560
|
+
* })
|
|
1561
|
+
* ```
|
|
1562
|
+
*/
|
|
1563
|
+
function useListListingsForCollectible(params) {
|
|
1564
|
+
const defaultConfig = useConfig();
|
|
1565
|
+
const { config = defaultConfig,...rest } = params;
|
|
1566
|
+
const queryOptions$1 = listListingsForCollectibleQueryOptions({
|
|
1567
|
+
config,
|
|
1568
|
+
...rest
|
|
1569
|
+
});
|
|
1570
|
+
return useQuery({ ...queryOptions$1 });
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
//#endregion
|
|
1574
|
+
//#region src/react/hooks/data/orders/useListOffersForCollectible.tsx
|
|
1575
|
+
/**
|
|
1576
|
+
* Hook to fetch offers for a specific collectible
|
|
1577
|
+
*
|
|
1578
|
+
* Fetches offers for a specific collectible from the marketplace.
|
|
1579
|
+
*
|
|
1580
|
+
* @param params - Configuration parameters
|
|
1581
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1582
|
+
* @param params.collectionAddress - The collection contract address
|
|
1583
|
+
* @param params.collectibleId - The specific collectible ID to fetch offers for
|
|
1584
|
+
* @param params.filter - Optional filtering parameters
|
|
1585
|
+
* @param params.page - Optional pagination parameters
|
|
1586
|
+
* @param params.query - Optional React Query configuration
|
|
1587
|
+
*
|
|
1588
|
+
* @returns Query result containing offers data
|
|
1589
|
+
*
|
|
1590
|
+
* @example
|
|
1591
|
+
* Basic usage:
|
|
1592
|
+
* ```typescript
|
|
1593
|
+
* const { data, isLoading } = useListOffersForCollectible({
|
|
1594
|
+
* chainId: 137,
|
|
1595
|
+
* collectionAddress: '0x...',
|
|
1596
|
+
* collectibleId: '1'
|
|
1597
|
+
* })
|
|
1598
|
+
* ```
|
|
1599
|
+
*
|
|
1600
|
+
* @example
|
|
1601
|
+
* With filtering:
|
|
1602
|
+
* ```typescript
|
|
1603
|
+
* const { data } = useListOffersForCollectible({
|
|
1604
|
+
* chainId: 1,
|
|
1605
|
+
* collectionAddress: '0x...',
|
|
1606
|
+
* collectibleId: '1',
|
|
1607
|
+
* filter: {
|
|
1608
|
+
* marketplace: [MarketplaceKind.sequence_marketplace_v2]
|
|
1609
|
+
* }
|
|
1610
|
+
* })
|
|
1611
|
+
* ```
|
|
1612
|
+
*/
|
|
1613
|
+
function useListOffersForCollectible(params) {
|
|
1614
|
+
const defaultConfig = useConfig();
|
|
1615
|
+
const { config = defaultConfig,...rest } = params;
|
|
1616
|
+
const queryOptions$1 = listOffersForCollectibleQueryOptions({
|
|
1617
|
+
config,
|
|
1618
|
+
...rest
|
|
1619
|
+
});
|
|
1620
|
+
return useQuery({ ...queryOptions$1 });
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
//#endregion
|
|
1624
|
+
//#region src/react/hooks/data/orders/useLowestListing.tsx
|
|
1625
|
+
/**
|
|
1626
|
+
* Hook to fetch the lowest listing for a collectible
|
|
1627
|
+
*
|
|
1628
|
+
* Retrieves the lowest priced listing currently available for a specific token
|
|
1629
|
+
* in a collection from the marketplace.
|
|
1630
|
+
*
|
|
1631
|
+
* @param params - Configuration parameters
|
|
1632
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1633
|
+
* @param params.collectionAddress - The collection contract address
|
|
1634
|
+
* @param params.tokenId - The token ID within the collection
|
|
1635
|
+
* @param params.query - Optional React Query configuration
|
|
1636
|
+
*
|
|
1637
|
+
* @returns Query result containing the lowest listing data or null if no listings exist
|
|
1638
|
+
*
|
|
1639
|
+
* @example
|
|
1640
|
+
* Basic usage:
|
|
1641
|
+
* ```typescript
|
|
1642
|
+
* const { data, isLoading } = useLowestListing({
|
|
1643
|
+
* chainId: 137,
|
|
1644
|
+
* collectionAddress: '0x...',
|
|
1645
|
+
* tokenId: '1'
|
|
1646
|
+
* })
|
|
1647
|
+
* ```
|
|
1648
|
+
*
|
|
1649
|
+
* @example
|
|
1650
|
+
* With custom query options:
|
|
1651
|
+
* ```typescript
|
|
1652
|
+
* const { data, isLoading } = useLowestListing({
|
|
1653
|
+
* chainId: 1,
|
|
1654
|
+
* collectionAddress: '0x...',
|
|
1655
|
+
* tokenId: '42',
|
|
1656
|
+
* query: {
|
|
1657
|
+
* refetchInterval: 15000,
|
|
1658
|
+
* enabled: hasTokenId
|
|
1659
|
+
* }
|
|
1660
|
+
* })
|
|
1661
|
+
* ```
|
|
1662
|
+
*/
|
|
1663
|
+
function useLowestListing(params) {
|
|
1664
|
+
const defaultConfig = useConfig();
|
|
1665
|
+
const { config = defaultConfig,...rest } = params;
|
|
1666
|
+
const queryOptions$1 = lowestListingQueryOptions({
|
|
1667
|
+
config,
|
|
1668
|
+
...rest
|
|
1669
|
+
});
|
|
1670
|
+
return useQuery({ ...queryOptions$1 });
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
//#endregion
|
|
1674
|
+
//#region src/react/hooks/data/primary-sales/useCountOfPrimarySaleItems.tsx
|
|
1675
|
+
function useCountOfPrimarySaleItems(args) {
|
|
1676
|
+
const config = useConfig();
|
|
1677
|
+
return useQuery(countOfPrimarySaleItemsOptions(args, config));
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
//#endregion
|
|
1681
|
+
//#region src/react/hooks/data/primary-sales/useErc721SalesData.tsx
|
|
1682
|
+
function useErc721SaleDetails({ chainId, salesContractAddress, itemsContractAddress, enabled }) {
|
|
1683
|
+
const { version, isLoading: versionLoading, error: versionError } = useSalesContractABI({
|
|
1684
|
+
contractAddress: salesContractAddress,
|
|
1685
|
+
contractType: ContractType.ERC721,
|
|
1686
|
+
chainId,
|
|
1687
|
+
enabled
|
|
1688
|
+
});
|
|
1689
|
+
const { saleDetails: saleDetailsV0, quantityMinted: quantityMintedV0, quantityTotal: quantityTotalV0, quantityRemaining: quantityRemainingV0, isLoading: saleDetailsLoadingV0, error: saleDetailsErrorV0 } = useErc721SaleDetailsV0({
|
|
1690
|
+
chainId,
|
|
1691
|
+
salesContractAddress,
|
|
1692
|
+
itemsContractAddress,
|
|
1693
|
+
enabled: enabled && !versionLoading && version === SalesContractVersion.V0
|
|
1694
|
+
});
|
|
1695
|
+
const { saleDetails: saleDetailsV1, quantityMinted: quantityMintedV1, quantityTotal: quantityTotalV1, quantityRemaining: quantityRemainingV1, isLoading: saleDetailsLoadingV1, error: saleDetailsErrorV1 } = useErc721SaleDetailsV1({
|
|
1696
|
+
chainId,
|
|
1697
|
+
salesContractAddress,
|
|
1698
|
+
itemsContractAddress,
|
|
1699
|
+
enabled: enabled && !versionLoading && version === SalesContractVersion.V1
|
|
1700
|
+
});
|
|
1701
|
+
return {
|
|
1702
|
+
saleDetails: saleDetailsV0 || saleDetailsV1,
|
|
1703
|
+
quantityMinted: quantityMintedV0 || quantityMintedV1,
|
|
1704
|
+
quantityTotal: quantityTotalV0 || quantityTotalV1,
|
|
1705
|
+
quantityRemaining: quantityRemainingV0 || quantityRemainingV1,
|
|
1706
|
+
isLoading: versionLoading || saleDetailsLoadingV0 || saleDetailsLoadingV1,
|
|
1452
1707
|
error: versionError || saleDetailsErrorV0 || saleDetailsErrorV1
|
|
1453
1708
|
};
|
|
1454
1709
|
}
|
|
@@ -1815,7 +2070,7 @@ function useSearchTokenMetadata(params) {
|
|
|
1815
2070
|
chainId: params.chainId,
|
|
1816
2071
|
collectionAddress: params.collectionAddress,
|
|
1817
2072
|
includeMetadata: true,
|
|
1818
|
-
query: { enabled: onlyMinted && (params.query?.enabled ?? true) }
|
|
2073
|
+
query: { enabled: onlyMinted && !!params.collectionAddress && (params.query?.enabled ?? true) }
|
|
1819
2074
|
});
|
|
1820
2075
|
const queryOptions$1 = searchTokenMetadataQueryOptions({
|
|
1821
2076
|
config,
|
|
@@ -1871,15 +2126,17 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1871
2126
|
enabled
|
|
1872
2127
|
});
|
|
1873
2128
|
const config = useConfig();
|
|
1874
|
-
const
|
|
2129
|
+
const tokenSuppliesEnabled = Boolean(chainId && contractAddress && config && (enabled ?? true));
|
|
2130
|
+
const { data: tokenSuppliesData, fetchNextPage: fetchNextTokenSuppliesPage, hasNextPage: hasNextSuppliesPage, isFetchingNextPage: isFetchingNextSuppliesPage, isLoading: tokenSuppliesLoading } = useInfiniteQuery({ ...tokenSuppliesQueryOptions({
|
|
1875
2131
|
chainId,
|
|
1876
2132
|
collectionAddress: contractAddress,
|
|
1877
2133
|
includeMetadata: true,
|
|
1878
|
-
config
|
|
2134
|
+
config,
|
|
2135
|
+
query: { enabled: tokenSuppliesEnabled }
|
|
1879
2136
|
}) });
|
|
1880
|
-
const { data: tokenSuppliesData, fetchNextPage: fetchNextTokenSuppliesPage, hasNextPage: hasNextSuppliesPage, isFetchingNextPage: isFetchingNextSuppliesPage, isLoading: tokenSuppliesLoading } = tokenSuppliesQuery;
|
|
1881
2137
|
useEffect(() => {
|
|
1882
2138
|
async function fetchAllPages() {
|
|
2139
|
+
if (!tokenSuppliesEnabled) return;
|
|
1883
2140
|
if (!hasNextSuppliesPage && tokenSuppliesData) {
|
|
1884
2141
|
setAllTokenSuppliesFetched(true);
|
|
1885
2142
|
return;
|
|
@@ -1892,7 +2149,8 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1892
2149
|
hasNextSuppliesPage,
|
|
1893
2150
|
isFetchingNextSuppliesPage,
|
|
1894
2151
|
tokenSuppliesLoading,
|
|
1895
|
-
fetchNextTokenSuppliesPage
|
|
2152
|
+
fetchNextTokenSuppliesPage,
|
|
2153
|
+
tokenSuppliesEnabled
|
|
1896
2154
|
]);
|
|
1897
2155
|
const allTokenSupplies = tokenSuppliesData?.pages.flatMap((page) => page.tokenIDs);
|
|
1898
2156
|
const matchingTokenSupplies = allTokenSupplies?.filter((item) => primarySaleItemsWithMetadata.some((primarySaleItem) => primarySaleItem.metadata.tokenId === item.tokenID));
|
|
@@ -1903,8 +2161,7 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1903
2161
|
functionName: "saleDetails",
|
|
1904
2162
|
query: { enabled: enabled && !versionLoading && !!abi }
|
|
1905
2163
|
});
|
|
1906
|
-
const
|
|
1907
|
-
const primarySaleItemsCollectibleCards = unmintedPrimarySaleItems.map((item) => {
|
|
2164
|
+
const primarySaleItemsCollectibleCards = primarySaleItemsWithMetadata.filter((item) => !matchingTokenSupplies?.some((supply) => supply.tokenID === item.metadata.tokenId)).map((item) => {
|
|
1908
2165
|
const { metadata, primarySaleItem } = item;
|
|
1909
2166
|
const salePrice = {
|
|
1910
2167
|
amount: primarySaleItem.priceAmount?.toString(),
|
|
@@ -1928,7 +2185,7 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1928
2185
|
quantityDecimals: 0,
|
|
1929
2186
|
saleStartsAt,
|
|
1930
2187
|
saleEndsAt,
|
|
1931
|
-
|
|
2188
|
+
cardType: "shop"
|
|
1932
2189
|
};
|
|
1933
2190
|
});
|
|
1934
2191
|
const mintedTokensCollectibleCards = allTokenSupplies?.map((item) => {
|
|
@@ -1942,142 +2199,79 @@ function useList721ShopCardData({ primarySaleItemsWithMetadata, chainId, contrac
|
|
|
1942
2199
|
salesContractAddress,
|
|
1943
2200
|
salePrice: {
|
|
1944
2201
|
amount: "0",
|
|
1945
|
-
currencyAddress: "0x0000000000000000000000000000000000000000"
|
|
1946
|
-
},
|
|
1947
|
-
quantityInitial: void 0,
|
|
1948
|
-
quantityRemaining: void 0,
|
|
1949
|
-
quantityDecimals: 0,
|
|
1950
|
-
saleStartsAt: void 0,
|
|
1951
|
-
saleEndsAt: void 0,
|
|
1952
|
-
|
|
1953
|
-
};
|
|
1954
|
-
});
|
|
1955
|
-
const collectibleCards = showAvailableSales ? primarySaleItemsCollectibleCards : [...mintedTokensCollectibleCards ?? [], ...primarySaleItemsCollectibleCards];
|
|
1956
|
-
return {
|
|
1957
|
-
salePrice: collectibleCards[0]?.salePrice,
|
|
1958
|
-
collectibleCards,
|
|
1959
|
-
saleDetailsError,
|
|
1960
|
-
saleDetails,
|
|
1961
|
-
isLoading: saleDetailsLoading || tokenSuppliesLoading || !allTokenSuppliesFetched,
|
|
1962
|
-
tokenSuppliesData
|
|
1963
|
-
};
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
//#endregion
|
|
1967
|
-
//#region src/react/hooks/ui/useFilterState.tsx
|
|
1968
|
-
const validateFilters = (value) => {
|
|
1969
|
-
if (!Array.isArray(value)) return [];
|
|
1970
|
-
return value.filter((f) => typeof f === "object" && typeof f.name === "string" && Object.values(PropertyType).includes(f.type));
|
|
1971
|
-
};
|
|
1972
|
-
const filtersParser = parseAsJson(validateFilters).withDefault([]);
|
|
1973
|
-
const searchParser = parseAsString.withDefault("");
|
|
1974
|
-
const listedOnlyParser = parseAsBoolean.withDefault(false);
|
|
1975
|
-
const serialize = createSerializer({
|
|
1976
|
-
filters: filtersParser,
|
|
1977
|
-
search: searchParser,
|
|
1978
|
-
listedOnly: listedOnlyParser
|
|
1979
|
-
}, { urlKeys: {
|
|
1980
|
-
filters: "f",
|
|
1981
|
-
search: "q",
|
|
1982
|
-
listedOnly: "l"
|
|
1983
|
-
} });
|
|
1984
|
-
function useFilterState() {
|
|
1985
|
-
const [filterOptions, setFilterOptions] = useQueryState("filters", filtersParser);
|
|
1986
|
-
const [searchText, setSearchText] = useQueryState("search", searchParser);
|
|
1987
|
-
const [showListedOnly, setShowListedOnly] = useQueryState("listedOnly", listedOnlyParser);
|
|
1988
|
-
const helpers = useMemo(() => ({
|
|
1989
|
-
getFilter: (name) => {
|
|
1990
|
-
return filterOptions?.find((f) => f.name === name);
|
|
1991
|
-
},
|
|
1992
|
-
getFilterValues: (name) => {
|
|
1993
|
-
const filter = filterOptions?.find((f) => f.name === name);
|
|
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
|
|
1999
|
-
};
|
|
2000
|
-
return {
|
|
2001
|
-
type: PropertyType.STRING,
|
|
2002
|
-
values: filter.values ?? []
|
|
2003
|
-
};
|
|
2004
|
-
},
|
|
2005
|
-
isFilterActive: (name) => {
|
|
2006
|
-
return !!filterOptions?.find((f) => f.name === name);
|
|
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
|
-
]);
|
|
2202
|
+
currencyAddress: "0x0000000000000000000000000000000000000000"
|
|
2203
|
+
},
|
|
2204
|
+
quantityInitial: void 0,
|
|
2205
|
+
quantityRemaining: void 0,
|
|
2206
|
+
quantityDecimals: 0,
|
|
2207
|
+
saleStartsAt: void 0,
|
|
2208
|
+
saleEndsAt: void 0,
|
|
2209
|
+
cardType: "shop"
|
|
2210
|
+
};
|
|
2211
|
+
});
|
|
2212
|
+
const collectibleCards = showAvailableSales ? primarySaleItemsCollectibleCards : [...mintedTokensCollectibleCards ?? [], ...primarySaleItemsCollectibleCards];
|
|
2072
2213
|
return {
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2214
|
+
salePrice: collectibleCards[0]?.salePrice,
|
|
2215
|
+
collectibleCards,
|
|
2216
|
+
saleDetailsError,
|
|
2217
|
+
saleDetails,
|
|
2218
|
+
isLoading: enabled && (saleDetailsLoading || tokenSuppliesLoading || !allTokenSuppliesFetched),
|
|
2219
|
+
tokenSuppliesData
|
|
2220
|
+
};
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
//#endregion
|
|
2224
|
+
//#region src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx
|
|
2225
|
+
function useList1155ShopCardData({ primarySaleItemsWithMetadata, chainId, contractAddress, salesContractAddress, enabled = true }) {
|
|
2226
|
+
const { abi, isLoading: versionLoading } = useSalesContractABI({
|
|
2227
|
+
contractAddress: salesContractAddress,
|
|
2228
|
+
contractType: ContractType.ERC1155,
|
|
2229
|
+
chainId,
|
|
2230
|
+
enabled
|
|
2231
|
+
});
|
|
2232
|
+
const { data: collection, isLoading: collectionLoading } = useCollection({
|
|
2233
|
+
chainId,
|
|
2234
|
+
collectionAddress: contractAddress,
|
|
2235
|
+
query: { enabled }
|
|
2236
|
+
});
|
|
2237
|
+
const { data: paymentToken, isLoading: paymentTokenLoading } = useReadContract({
|
|
2238
|
+
chainId,
|
|
2239
|
+
address: salesContractAddress,
|
|
2240
|
+
abi: abi || [],
|
|
2241
|
+
functionName: "paymentToken",
|
|
2242
|
+
query: { enabled: enabled && !versionLoading && !!abi }
|
|
2243
|
+
});
|
|
2244
|
+
const isLoading = versionLoading || collectionLoading || paymentTokenLoading;
|
|
2245
|
+
return {
|
|
2246
|
+
collectibleCards: primarySaleItemsWithMetadata.map((item) => {
|
|
2247
|
+
const { metadata, primarySaleItem: saleData } = item;
|
|
2248
|
+
const salePrice = {
|
|
2249
|
+
amount: saleData?.priceAmount?.toString() || "",
|
|
2250
|
+
currencyAddress: saleData?.currencyAddress || paymentToken || "0x"
|
|
2251
|
+
};
|
|
2252
|
+
const supply = saleData?.supply?.toString();
|
|
2253
|
+
const unlimitedSupply = saleData?.unlimitedSupply;
|
|
2254
|
+
return {
|
|
2255
|
+
collectibleId: metadata.tokenId,
|
|
2256
|
+
chainId,
|
|
2257
|
+
collectionAddress: contractAddress,
|
|
2258
|
+
collectionType: ContractType.ERC1155,
|
|
2259
|
+
tokenMetadata: metadata,
|
|
2260
|
+
cardLoading: isLoading,
|
|
2261
|
+
salesContractAddress,
|
|
2262
|
+
salePrice,
|
|
2263
|
+
quantityInitial: supply,
|
|
2264
|
+
quantityDecimals: collection?.decimals || 0,
|
|
2265
|
+
quantityRemaining: supply,
|
|
2266
|
+
unlimitedSupply,
|
|
2267
|
+
saleStartsAt: saleData?.startDate?.toString(),
|
|
2268
|
+
saleEndsAt: saleData?.endDate?.toString(),
|
|
2269
|
+
cardType: "shop"
|
|
2270
|
+
};
|
|
2271
|
+
}),
|
|
2272
|
+
tokenMetadataError: null,
|
|
2273
|
+
tokenSaleDetailsError: null,
|
|
2274
|
+
isLoading: enabled && isLoading
|
|
2081
2275
|
};
|
|
2082
2276
|
}
|
|
2083
2277
|
|
|
@@ -2131,77 +2325,13 @@ function useListPrimarySaleItems(params) {
|
|
|
2131
2325
|
return useInfiniteQuery(queryOptions$1);
|
|
2132
2326
|
}
|
|
2133
2327
|
|
|
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
2328
|
//#endregion
|
|
2199
2329
|
//#region src/react/hooks/data/inventory/useInventory.tsx
|
|
2200
2330
|
function useInventory(args) {
|
|
2201
2331
|
const config = useConfig();
|
|
2202
2332
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
2203
2333
|
const isLaos721 = marketplaceConfig?.market?.collections?.find((c) => c.itemsAddress === args.collectionAddress && c.chainId === args.chainId)?.contractType === ContractType.LAOS_ERC_721;
|
|
2204
|
-
return
|
|
2334
|
+
return useQuery(inventoryOptions({
|
|
2205
2335
|
...args,
|
|
2206
2336
|
isLaos721
|
|
2207
2337
|
}, config));
|
|
@@ -2307,7 +2437,7 @@ function useAutoSelectFeeOption({ pendingFeeOptionConfirmation, enabled }) {
|
|
|
2307
2437
|
useEffect(() => {
|
|
2308
2438
|
if (combinedBalances) console.debug("currency balances", combinedBalances);
|
|
2309
2439
|
}, [combinedBalances]);
|
|
2310
|
-
|
|
2440
|
+
return useCallback(async () => {
|
|
2311
2441
|
if (!userAddress) return {
|
|
2312
2442
|
selectedOption: null,
|
|
2313
2443
|
error: AutoSelectFeeOptionError.UserNotConnected
|
|
@@ -2345,8 +2475,7 @@ function useAutoSelectFeeOption({ pendingFeeOptionConfirmation, enabled }) {
|
|
|
2345
2475
|
isBalanceDetailsLoading,
|
|
2346
2476
|
isBalanceDetailsError,
|
|
2347
2477
|
combinedBalances
|
|
2348
|
-
]);
|
|
2349
|
-
return autoSelectedOption();
|
|
2478
|
+
])();
|
|
2350
2479
|
}
|
|
2351
2480
|
|
|
2352
2481
|
//#endregion
|
|
@@ -2462,92 +2591,51 @@ const MODAL_CONTENT_PROPS = { style: {
|
|
|
2462
2591
|
} };
|
|
2463
2592
|
|
|
2464
2593
|
//#endregion
|
|
2465
|
-
//#region src/react/ui/modals/_internal/components/
|
|
2594
|
+
//#region src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts
|
|
2466
2595
|
const initialContext$4 = {
|
|
2467
2596
|
isOpen: false,
|
|
2468
2597
|
chainIdToSwitchTo: void 0,
|
|
2469
|
-
isSwitching: false
|
|
2470
|
-
onSuccess: void 0,
|
|
2471
|
-
onError: void 0,
|
|
2472
|
-
onClose: void 0
|
|
2598
|
+
isSwitching: false
|
|
2473
2599
|
};
|
|
2474
|
-
const
|
|
2600
|
+
const switchChainErrorModalStore = createStore({
|
|
2475
2601
|
context: initialContext$4,
|
|
2476
2602
|
on: {
|
|
2477
2603
|
open: (context, event) => ({
|
|
2478
2604
|
...context,
|
|
2479
2605
|
isOpen: true,
|
|
2480
|
-
chainIdToSwitchTo: event.chainIdToSwitchTo
|
|
2481
|
-
onSuccess: event.onSuccess,
|
|
2482
|
-
onError: event.onError,
|
|
2483
|
-
onClose: event.onClose
|
|
2606
|
+
chainIdToSwitchTo: event.chainIdToSwitchTo
|
|
2484
2607
|
}),
|
|
2485
2608
|
close: (context) => ({
|
|
2486
2609
|
...context,
|
|
2487
2610
|
isOpen: false,
|
|
2488
2611
|
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
|
|
2612
|
+
isSwitching: false
|
|
2497
2613
|
})
|
|
2498
2614
|
}
|
|
2499
2615
|
});
|
|
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);
|
|
2616
|
+
const useIsOpen$4 = () => useSelector(switchChainErrorModalStore, (state) => state.context.isOpen);
|
|
2617
|
+
const useChainIdToSwitchTo = () => useSelector(switchChainErrorModalStore, (state) => state.context.chainIdToSwitchTo);
|
|
2506
2618
|
|
|
2507
2619
|
//#endregion
|
|
2508
|
-
//#region src/react/ui/modals/_internal/components/
|
|
2509
|
-
const
|
|
2620
|
+
//#region src/react/ui/modals/_internal/components/switchChainErrorModal/index.tsx
|
|
2621
|
+
const useSwitchChainErrorModal = () => {
|
|
2510
2622
|
return {
|
|
2511
|
-
show: (args) =>
|
|
2623
|
+
show: (args) => switchChainErrorModalStore.send({
|
|
2512
2624
|
type: "open",
|
|
2513
2625
|
...args
|
|
2514
2626
|
}),
|
|
2515
|
-
close: () =>
|
|
2627
|
+
close: () => switchChainErrorModalStore.send({ type: "close" })
|
|
2516
2628
|
};
|
|
2517
2629
|
};
|
|
2518
|
-
const
|
|
2630
|
+
const SwitchChainErrorModal = () => {
|
|
2631
|
+
const { chainId: currentChainId } = useAccount();
|
|
2519
2632
|
const isOpen = useIsOpen$4();
|
|
2520
2633
|
const chainIdToSwitchTo = useChainIdToSwitchTo();
|
|
2521
|
-
const isSwitching = useIsSwitching();
|
|
2522
|
-
const onSuccess = useOnSuccess$1();
|
|
2523
|
-
const onError = useOnError$1();
|
|
2524
|
-
const onClose = useOnClose();
|
|
2525
2634
|
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
2635
|
const handleClose = () => {
|
|
2547
|
-
|
|
2548
|
-
switchChainModalStore.send({ type: "close" });
|
|
2636
|
+
switchChainErrorModalStore.send({ type: "close" });
|
|
2549
2637
|
};
|
|
2550
|
-
if (!isOpen || !chainIdToSwitchTo) return null;
|
|
2638
|
+
if (!isOpen || !chainIdToSwitchTo || currentChainId === chainIdToSwitchTo) return null;
|
|
2551
2639
|
return /* @__PURE__ */ jsx(Modal, {
|
|
2552
2640
|
isDismissible: true,
|
|
2553
2641
|
onClose: handleClose,
|
|
@@ -2556,88 +2644,62 @@ const SwitchChainModal = () => {
|
|
|
2556
2644
|
overlayProps: MODAL_OVERLAY_PROPS,
|
|
2557
2645
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2558
2646
|
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
|
-
]
|
|
2647
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2648
|
+
className: "text-xl",
|
|
2649
|
+
fontWeight: "bold",
|
|
2650
|
+
color: "text100",
|
|
2651
|
+
children: "Switching network failed"
|
|
2652
|
+
}), /* @__PURE__ */ jsx(AlertMessage, {
|
|
2653
|
+
type: "warning",
|
|
2654
|
+
message: `There was an error switching to ${chainName}. Please try changing the network in your wallet manually.`
|
|
2655
|
+
})]
|
|
2586
2656
|
})
|
|
2587
2657
|
});
|
|
2588
2658
|
};
|
|
2589
|
-
var
|
|
2659
|
+
var switchChainErrorModal_default = SwitchChainErrorModal;
|
|
2590
2660
|
|
|
2591
2661
|
//#endregion
|
|
2592
2662
|
//#region src/react/hooks/utils/useEnsureCorrectChain.ts
|
|
2593
2663
|
const useEnsureCorrectChain = () => {
|
|
2594
2664
|
const { chainId: currentChainId } = useAccount();
|
|
2595
2665
|
const { switchChain, switchChainAsync } = useSwitchChain();
|
|
2596
|
-
const { show:
|
|
2666
|
+
const { show: showSwitchChainErrorModal, close: closeSwitchChainErrorModal } = useSwitchChainErrorModal();
|
|
2667
|
+
const chainIdToSwitchTo = useChainIdToSwitchTo();
|
|
2597
2668
|
const { isWaaS } = useConnectorMetadata();
|
|
2669
|
+
useEffect(() => {
|
|
2670
|
+
if (currentChainId && chainIdToSwitchTo && currentChainId === chainIdToSwitchTo) closeSwitchChainErrorModal();
|
|
2671
|
+
}, [
|
|
2672
|
+
currentChainId,
|
|
2673
|
+
chainIdToSwitchTo,
|
|
2674
|
+
closeSwitchChainErrorModal
|
|
2675
|
+
]);
|
|
2598
2676
|
const ensureCorrectChainAsync = useCallback(async (targetChainId) => {
|
|
2599
2677
|
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
|
-
});
|
|
2678
|
+
return switchChainAsync({ chainId: targetChainId }).catch(() => {
|
|
2679
|
+
showSwitchChainErrorModal({ chainIdToSwitchTo: targetChainId });
|
|
2608
2680
|
});
|
|
2609
2681
|
}, [
|
|
2610
2682
|
currentChainId,
|
|
2611
2683
|
isWaaS,
|
|
2612
2684
|
switchChainAsync,
|
|
2613
|
-
|
|
2685
|
+
showSwitchChainErrorModal
|
|
2614
2686
|
]);
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2687
|
+
return {
|
|
2688
|
+
ensureCorrectChain: useCallback((targetChainId, callbacks) => {
|
|
2689
|
+
if (currentChainId === targetChainId) {
|
|
2690
|
+
callbacks?.onSuccess?.();
|
|
2691
|
+
return;
|
|
2692
|
+
}
|
|
2621
2693
|
switchChain({ chainId: targetChainId }, {
|
|
2622
2694
|
onSuccess: callbacks?.onSuccess,
|
|
2623
|
-
onError:
|
|
2695
|
+
onError: () => showSwitchChainErrorModal({ chainIdToSwitchTo: targetChainId })
|
|
2624
2696
|
});
|
|
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,
|
|
2697
|
+
}, [
|
|
2698
|
+
currentChainId,
|
|
2699
|
+
isWaaS,
|
|
2700
|
+
switchChain,
|
|
2701
|
+
showSwitchChainErrorModal
|
|
2702
|
+
]),
|
|
2641
2703
|
ensureCorrectChainAsync,
|
|
2642
2704
|
currentChainId
|
|
2643
2705
|
};
|
|
@@ -2646,8 +2708,7 @@ const useEnsureCorrectChain = () => {
|
|
|
2646
2708
|
//#endregion
|
|
2647
2709
|
//#region src/react/hooks/transactions/useGenerateCancelTransaction.tsx
|
|
2648
2710
|
const generateCancelTransaction = async (args, config) => {
|
|
2649
|
-
|
|
2650
|
-
return marketplaceClient.generateCancelTransaction({
|
|
2711
|
+
return getMarketplaceClient(config).generateCancelTransaction({
|
|
2651
2712
|
...args,
|
|
2652
2713
|
chainId: String(args.chainId)
|
|
2653
2714
|
}).then((data) => data.steps);
|
|
@@ -2680,6 +2741,7 @@ function isTransactionStep(step) {
|
|
|
2680
2741
|
StepType.createListing
|
|
2681
2742
|
].includes(step.id);
|
|
2682
2743
|
}
|
|
2744
|
+
const clamp = (val, min, max) => Math.max(min, Math.min(max, val));
|
|
2683
2745
|
|
|
2684
2746
|
//#endregion
|
|
2685
2747
|
//#region src/react/hooks/transactions/useProcessStep.ts
|
|
@@ -2690,8 +2752,9 @@ const useProcessStep = () => {
|
|
|
2690
2752
|
const config = useConfig();
|
|
2691
2753
|
const marketplaceClient = getMarketplaceClient(config);
|
|
2692
2754
|
const processStep = async (step, chainId) => {
|
|
2693
|
-
if (isTransactionStep(step)) {
|
|
2694
|
-
|
|
2755
|
+
if (isTransactionStep(step)) return {
|
|
2756
|
+
type: "transaction",
|
|
2757
|
+
hash: await sendTransactionAsync({
|
|
2695
2758
|
chainId,
|
|
2696
2759
|
to: step.to,
|
|
2697
2760
|
data: step.data,
|
|
@@ -2699,12 +2762,8 @@ const useProcessStep = () => {
|
|
|
2699
2762
|
...step.maxFeePerGas && { maxFeePerGas: hexToBigInt(step.maxFeePerGas) },
|
|
2700
2763
|
...step.maxPriorityFeePerGas && { maxPriorityFeePerGas: hexToBigInt(step.maxPriorityFeePerGas) },
|
|
2701
2764
|
...step.gas && { gas: hexToBigInt(step.gas) }
|
|
2702
|
-
})
|
|
2703
|
-
|
|
2704
|
-
type: "transaction",
|
|
2705
|
-
hash
|
|
2706
|
-
};
|
|
2707
|
-
}
|
|
2765
|
+
})
|
|
2766
|
+
};
|
|
2708
2767
|
if (isSignatureStep(step)) {
|
|
2709
2768
|
let signature;
|
|
2710
2769
|
if (step.id === StepType.signEIP191) {
|
|
@@ -2720,20 +2779,17 @@ const useProcessStep = () => {
|
|
|
2720
2779
|
});
|
|
2721
2780
|
}
|
|
2722
2781
|
if (!signature) throw new Error("Failed to sign message");
|
|
2723
|
-
if (step.post) {
|
|
2724
|
-
|
|
2782
|
+
if (step.post) return {
|
|
2783
|
+
type: "signature",
|
|
2784
|
+
orderId: (await marketplaceClient.execute({
|
|
2725
2785
|
chainId: String(chainId),
|
|
2726
2786
|
signature,
|
|
2727
2787
|
method: step.post.method,
|
|
2728
2788
|
endpoint: step.post.endpoint,
|
|
2729
2789
|
body: step.post.body,
|
|
2730
2790
|
executeType: ExecuteType.order
|
|
2731
|
-
})
|
|
2732
|
-
|
|
2733
|
-
type: "signature",
|
|
2734
|
-
orderId: result.orderId
|
|
2735
|
-
};
|
|
2736
|
-
}
|
|
2791
|
+
})).orderId
|
|
2792
|
+
};
|
|
2737
2793
|
return {
|
|
2738
2794
|
type: "signature",
|
|
2739
2795
|
signature
|
|
@@ -2756,14 +2812,13 @@ const useCancelTransactionSteps = ({ collectionAddress, chainId, callbacks, setS
|
|
|
2756
2812
|
try {
|
|
2757
2813
|
if (!address) throw new NoWalletConnectedError();
|
|
2758
2814
|
if (!address) throw new Error("Wallet address not found");
|
|
2759
|
-
|
|
2815
|
+
return await generateCancelTransactionAsync({
|
|
2760
2816
|
chainId,
|
|
2761
2817
|
collectionAddress,
|
|
2762
2818
|
maker: address,
|
|
2763
2819
|
marketplace,
|
|
2764
2820
|
orderId
|
|
2765
2821
|
});
|
|
2766
|
-
return steps$2;
|
|
2767
2822
|
} catch (error) {
|
|
2768
2823
|
if (callbacks?.onError) callbacks.onError(error);
|
|
2769
2824
|
else console.debug("onError callback not provided:", error);
|
|
@@ -2918,8 +2973,7 @@ const generateListingTransaction = async (params, config) => {
|
|
|
2918
2973
|
expiry: dateToUnixTime(params.listing.expiry)
|
|
2919
2974
|
}
|
|
2920
2975
|
};
|
|
2921
|
-
|
|
2922
|
-
return (await marketplaceClient.generateListingTransaction(args)).steps;
|
|
2976
|
+
return (await getMarketplaceClient(config).generateListingTransaction(args)).steps;
|
|
2923
2977
|
};
|
|
2924
2978
|
const useGenerateListingTransaction = (params) => {
|
|
2925
2979
|
const config = useConfig();
|
|
@@ -2949,8 +3003,7 @@ const generateOfferTransaction = async (params, config, walletKind) => {
|
|
|
2949
3003
|
},
|
|
2950
3004
|
walletType: walletKind
|
|
2951
3005
|
};
|
|
2952
|
-
|
|
2953
|
-
return (await marketplaceClient.generateOfferTransaction(args)).steps;
|
|
3006
|
+
return (await getMarketplaceClient(config).generateOfferTransaction(args)).steps;
|
|
2954
3007
|
};
|
|
2955
3008
|
const useGenerateOfferTransaction = (params) => {
|
|
2956
3009
|
const config = useConfig();
|
|
@@ -3048,7 +3101,7 @@ const useTransactionOperations = () => {
|
|
|
3048
3101
|
} catch (e) {
|
|
3049
3102
|
const error = e;
|
|
3050
3103
|
logger.error("Chain switch failed", error);
|
|
3051
|
-
if (error.name === "UserRejectedRequestError") throw new UserRejectedRequestError();
|
|
3104
|
+
if (error.name === "UserRejectedRequestError") throw new UserRejectedRequestError$1();
|
|
3052
3105
|
throw new ChainSwitchError(0, chainId);
|
|
3053
3106
|
}
|
|
3054
3107
|
};
|
|
@@ -3074,9 +3127,8 @@ const useTransactionOperations = () => {
|
|
|
3074
3127
|
} catch (e) {
|
|
3075
3128
|
const error = e;
|
|
3076
3129
|
logger.error("Signature failed", error);
|
|
3077
|
-
if (error.cause instanceof BaseError
|
|
3078
|
-
|
|
3079
|
-
if (viemError instanceof UserRejectedRequestError$1) throw new UserRejectedRequestError();
|
|
3130
|
+
if (error.cause instanceof BaseError) {
|
|
3131
|
+
if (error.cause instanceof UserRejectedRequestError) throw new UserRejectedRequestError$1();
|
|
3080
3132
|
}
|
|
3081
3133
|
throw new TransactionSignatureError(stepItem.id, error);
|
|
3082
3134
|
}
|
|
@@ -3100,9 +3152,8 @@ const useTransactionOperations = () => {
|
|
|
3100
3152
|
} catch (e) {
|
|
3101
3153
|
const error = e;
|
|
3102
3154
|
logger.error("Transaction failed", error);
|
|
3103
|
-
if (error.cause instanceof BaseError
|
|
3104
|
-
|
|
3105
|
-
if (viemError instanceof UserRejectedRequestError$1) throw new UserRejectedRequestError();
|
|
3155
|
+
if (error.cause instanceof BaseError) {
|
|
3156
|
+
if (error.cause instanceof UserRejectedRequestError) throw new UserRejectedRequestError$1();
|
|
3106
3157
|
}
|
|
3107
3158
|
throw new TransactionExecutionError(stepItem.id || "unknown", error);
|
|
3108
3159
|
}
|
|
@@ -3180,13 +3231,171 @@ const useTransferTokens = () => {
|
|
|
3180
3231
|
return await writeContractAsync(config);
|
|
3181
3232
|
};
|
|
3182
3233
|
return {
|
|
3183
|
-
transferTokensAsync,
|
|
3184
|
-
hash,
|
|
3185
|
-
transferring: isPending,
|
|
3186
|
-
transferFailed: isError,
|
|
3187
|
-
transferSuccess: isSuccess
|
|
3234
|
+
transferTokensAsync,
|
|
3235
|
+
hash,
|
|
3236
|
+
transferring: isPending,
|
|
3237
|
+
transferFailed: isError,
|
|
3238
|
+
transferSuccess: isSuccess
|
|
3239
|
+
};
|
|
3240
|
+
};
|
|
3241
|
+
|
|
3242
|
+
//#endregion
|
|
3243
|
+
//#region src/react/hooks/ui/useFilterState.tsx
|
|
3244
|
+
const validateFilters = (value) => {
|
|
3245
|
+
if (!Array.isArray(value)) return [];
|
|
3246
|
+
return value.filter((f) => typeof f === "object" && typeof f.name === "string" && Object.values(PropertyType).includes(f.type));
|
|
3247
|
+
};
|
|
3248
|
+
const validatePriceFilters = (value) => {
|
|
3249
|
+
if (!Array.isArray(value)) return [];
|
|
3250
|
+
return value.filter((f) => typeof f === "object" && typeof f.contractAddress === "string" && (f.min === void 0 || typeof f.min === "string") && (f.max === void 0 || typeof f.max === "string"));
|
|
3251
|
+
};
|
|
3252
|
+
const filtersParser = parseAsJson(validateFilters).withDefault([]);
|
|
3253
|
+
const searchParser = parseAsString.withDefault("");
|
|
3254
|
+
const listedOnlyParser = parseAsBoolean.withDefault(false);
|
|
3255
|
+
const priceFilterParser = parseAsBoolean.withDefault(false);
|
|
3256
|
+
const priceFiltersParser = parseAsJson(validatePriceFilters).withDefault([]);
|
|
3257
|
+
const serialize = createSerializer({
|
|
3258
|
+
filters: filtersParser,
|
|
3259
|
+
search: searchParser,
|
|
3260
|
+
listedOnly: listedOnlyParser,
|
|
3261
|
+
priceFilter: priceFilterParser,
|
|
3262
|
+
priceFilters: priceFiltersParser
|
|
3263
|
+
}, { urlKeys: {
|
|
3264
|
+
filters: "f",
|
|
3265
|
+
search: "q",
|
|
3266
|
+
listedOnly: "l",
|
|
3267
|
+
priceFilter: "p",
|
|
3268
|
+
priceFilters: "pf"
|
|
3269
|
+
} });
|
|
3270
|
+
function useFilterState() {
|
|
3271
|
+
const [filterOptions, setFilterOptions] = useQueryState("filters", filtersParser);
|
|
3272
|
+
const [searchText, setSearchText] = useQueryState("search", searchParser);
|
|
3273
|
+
const [showListedOnly, setShowListedOnly] = useQueryState("listedOnly", listedOnlyParser);
|
|
3274
|
+
const [showPriceFilter, setShowPriceFilter] = useQueryState("priceFilter", priceFilterParser);
|
|
3275
|
+
const [priceFilters, setPriceFilters] = useQueryState("priceFilters", priceFiltersParser);
|
|
3276
|
+
const helpers = useMemo(() => ({
|
|
3277
|
+
getFilter: (name) => {
|
|
3278
|
+
return filterOptions?.find((f) => f.name === name);
|
|
3279
|
+
},
|
|
3280
|
+
getFilterValues: (name) => {
|
|
3281
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3282
|
+
if (!filter) return void 0;
|
|
3283
|
+
if (filter.type === PropertyType.INT) return {
|
|
3284
|
+
type: PropertyType.INT,
|
|
3285
|
+
min: filter.min ?? 0,
|
|
3286
|
+
max: filter.max ?? 0
|
|
3287
|
+
};
|
|
3288
|
+
return {
|
|
3289
|
+
type: PropertyType.STRING,
|
|
3290
|
+
values: filter.values ?? []
|
|
3291
|
+
};
|
|
3292
|
+
},
|
|
3293
|
+
isFilterActive: (name) => {
|
|
3294
|
+
return !!filterOptions?.find((f) => f.name === name);
|
|
3295
|
+
},
|
|
3296
|
+
isStringValueSelected: (name, value) => {
|
|
3297
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3298
|
+
if (!filter || filter.type !== PropertyType.STRING) return false;
|
|
3299
|
+
return filter.values?.includes(value) ?? false;
|
|
3300
|
+
},
|
|
3301
|
+
isIntFilterActive: (name) => {
|
|
3302
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3303
|
+
return !!filter && filter.type === PropertyType.INT;
|
|
3304
|
+
},
|
|
3305
|
+
getIntFilterRange: (name) => {
|
|
3306
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3307
|
+
if (!filter || filter.type !== PropertyType.INT) return void 0;
|
|
3308
|
+
return [filter.min ?? 0, filter.max ?? 0];
|
|
3309
|
+
},
|
|
3310
|
+
deleteFilter: (name) => {
|
|
3311
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3312
|
+
setFilterOptions(otherFilters);
|
|
3313
|
+
},
|
|
3314
|
+
toggleStringFilterValue: (name, value) => {
|
|
3315
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3316
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3317
|
+
const existingValues = filter?.type === PropertyType.STRING ? filter.values ?? [] : [];
|
|
3318
|
+
if (existingValues.includes(value)) {
|
|
3319
|
+
const newValues = existingValues.filter((v) => v !== value);
|
|
3320
|
+
if (newValues.length === 0) {
|
|
3321
|
+
setFilterOptions(otherFilters);
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3324
|
+
setFilterOptions([...otherFilters, {
|
|
3325
|
+
name,
|
|
3326
|
+
type: PropertyType.STRING,
|
|
3327
|
+
values: newValues
|
|
3328
|
+
}]);
|
|
3329
|
+
} else setFilterOptions([...otherFilters, {
|
|
3330
|
+
name,
|
|
3331
|
+
type: PropertyType.STRING,
|
|
3332
|
+
values: [...existingValues, value]
|
|
3333
|
+
}]);
|
|
3334
|
+
},
|
|
3335
|
+
setIntFilterValue: (name, min, max) => {
|
|
3336
|
+
if (min === max && min === 0) {
|
|
3337
|
+
const otherFilters$1 = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3338
|
+
setFilterOptions(otherFilters$1);
|
|
3339
|
+
return;
|
|
3340
|
+
}
|
|
3341
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3342
|
+
setFilterOptions([...otherFilters, {
|
|
3343
|
+
name,
|
|
3344
|
+
type: PropertyType.INT,
|
|
3345
|
+
min,
|
|
3346
|
+
max
|
|
3347
|
+
}]);
|
|
3348
|
+
},
|
|
3349
|
+
setPriceFilter: (contractAddress, min, max) => {
|
|
3350
|
+
const otherPriceFilters = priceFilters?.filter((f) => f.contractAddress !== contractAddress) ?? [];
|
|
3351
|
+
if (!min && !max) {
|
|
3352
|
+
setPriceFilters(otherPriceFilters);
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
const newPriceFilter = {
|
|
3356
|
+
contractAddress,
|
|
3357
|
+
...min && { min },
|
|
3358
|
+
...max && { max }
|
|
3359
|
+
};
|
|
3360
|
+
setPriceFilters([...otherPriceFilters, newPriceFilter]);
|
|
3361
|
+
},
|
|
3362
|
+
getPriceFilter: (contractAddress) => {
|
|
3363
|
+
return priceFilters?.find((f) => f.contractAddress === contractAddress);
|
|
3364
|
+
},
|
|
3365
|
+
clearPriceFilters: () => {
|
|
3366
|
+
setPriceFilters([]);
|
|
3367
|
+
},
|
|
3368
|
+
clearAllFilters: () => {
|
|
3369
|
+
setShowListedOnly(false);
|
|
3370
|
+
setShowPriceFilter(false);
|
|
3371
|
+
setFilterOptions([]);
|
|
3372
|
+
setSearchText("");
|
|
3373
|
+
setPriceFilters([]);
|
|
3374
|
+
}
|
|
3375
|
+
}), [
|
|
3376
|
+
filterOptions,
|
|
3377
|
+
setFilterOptions,
|
|
3378
|
+
setShowListedOnly,
|
|
3379
|
+
setSearchText,
|
|
3380
|
+
setShowPriceFilter,
|
|
3381
|
+
priceFilters,
|
|
3382
|
+
setPriceFilters
|
|
3383
|
+
]);
|
|
3384
|
+
return {
|
|
3385
|
+
filterOptions,
|
|
3386
|
+
searchText,
|
|
3387
|
+
showListedOnly,
|
|
3388
|
+
showPriceFilter,
|
|
3389
|
+
priceFilters,
|
|
3390
|
+
setFilterOptions,
|
|
3391
|
+
setSearchText,
|
|
3392
|
+
setShowListedOnly,
|
|
3393
|
+
setShowPriceFilter,
|
|
3394
|
+
setPriceFilters,
|
|
3395
|
+
...helpers,
|
|
3396
|
+
serialize
|
|
3188
3397
|
};
|
|
3189
|
-
}
|
|
3398
|
+
}
|
|
3190
3399
|
|
|
3191
3400
|
//#endregion
|
|
3192
3401
|
//#region src/react/hooks/ui/useFilters.tsx
|
|
@@ -3328,8 +3537,7 @@ function useFiltersProgressive(params) {
|
|
|
3328
3537
|
//#endregion
|
|
3329
3538
|
//#region src/react/hooks/ui/useOpenConnectModal.tsx
|
|
3330
3539
|
const useOpenConnectModal$1 = () => {
|
|
3331
|
-
|
|
3332
|
-
return { openConnectModal: context.openConnectModal };
|
|
3540
|
+
return { openConnectModal: useConfig().openConnectModal };
|
|
3333
3541
|
};
|
|
3334
3542
|
|
|
3335
3543
|
//#endregion
|
|
@@ -3607,12 +3815,10 @@ function useConvertPriceToUSD(params) {
|
|
|
3607
3815
|
*/
|
|
3608
3816
|
const useGetReceiptFromHash = () => {
|
|
3609
3817
|
const publicClient = usePublicClient();
|
|
3610
|
-
|
|
3818
|
+
return { waitForReceipt: useCallback(async (transactionHash) => {
|
|
3611
3819
|
if (!publicClient) throw new Error("Public client not found");
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
}, [publicClient]);
|
|
3615
|
-
return { waitForReceipt };
|
|
3820
|
+
return await publicClient.waitForTransactionReceipt({ hash: transactionHash });
|
|
3821
|
+
}, [publicClient]) };
|
|
3616
3822
|
};
|
|
3617
3823
|
|
|
3618
3824
|
//#endregion
|
|
@@ -3683,27 +3889,6 @@ function useRoyalty(args) {
|
|
|
3683
3889
|
};
|
|
3684
3890
|
}
|
|
3685
3891
|
|
|
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
3892
|
//#endregion
|
|
3708
3893
|
//#region src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts
|
|
3709
3894
|
const selectWaasFeeOptionsStore = createStore({
|
|
@@ -4116,8 +4301,7 @@ const useTransactionStatusModal = () => {
|
|
|
4116
4301
|
};
|
|
4117
4302
|
};
|
|
4118
4303
|
const TransactionStatusModal = () => {
|
|
4119
|
-
|
|
4120
|
-
return isOpen ? /* @__PURE__ */ jsx(TransactionStatusModalContent, {}) : null;
|
|
4304
|
+
return useIsOpen$3() ? /* @__PURE__ */ jsx(TransactionStatusModalContent, {}) : null;
|
|
4121
4305
|
};
|
|
4122
4306
|
function TransactionStatusModalContent() {
|
|
4123
4307
|
const { transactionType: type, hash, orderId, price, collectionAddress, chainId, collectibleId, callbacks, queriesToInvalidate } = useTransactionModalState();
|
|
@@ -4226,10 +4410,10 @@ function isPojo(val) {
|
|
|
4226
4410
|
//#endregion
|
|
4227
4411
|
//#region src/react/ui/modals/BuyModal/store.ts
|
|
4228
4412
|
function isShopProps(props) {
|
|
4229
|
-
return props.
|
|
4413
|
+
return props.cardType === "shop";
|
|
4230
4414
|
}
|
|
4231
4415
|
function isMarketProps(props) {
|
|
4232
|
-
return !props.
|
|
4416
|
+
return !props.cardType || props.cardType === "market";
|
|
4233
4417
|
}
|
|
4234
4418
|
const initialContext$2 = {
|
|
4235
4419
|
isOpen: false,
|
|
@@ -4430,8 +4614,7 @@ const useMarketPlatformFee = (params) => {
|
|
|
4430
4614
|
};
|
|
4431
4615
|
const { chainId, collectionAddress } = params;
|
|
4432
4616
|
const marketCollection = marketplaceConfig?.market?.collections?.find((col) => compareAddress(col.itemsAddress, collectionAddress) && String(col.chainId) === String(chainId));
|
|
4433
|
-
const
|
|
4434
|
-
const receiver = avalancheOrOptimism ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
4617
|
+
const receiver = chainId === avalanche.id || chainId === optimism.id ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
4435
4618
|
const percentageToBPS = (percentage) => Number(percentage) * 1e4 / 100;
|
|
4436
4619
|
const feePercentage = marketCollection?.feePercentage ?? defaultFee;
|
|
4437
4620
|
return {
|
|
@@ -4469,15 +4652,14 @@ const useCheckoutOptions = (input) => {
|
|
|
4469
4652
|
}],
|
|
4470
4653
|
additionalFee: Number(fees.amount)
|
|
4471
4654
|
});
|
|
4472
|
-
const
|
|
4655
|
+
const order = (await marketplaceClient.getOrders({
|
|
4473
4656
|
chainId: String(input.chainId),
|
|
4474
4657
|
input: [{
|
|
4475
4658
|
contractAddress: input.collectionAddress,
|
|
4476
4659
|
orderId: input.orderId,
|
|
4477
4660
|
marketplace: input.marketplace
|
|
4478
4661
|
}]
|
|
4479
|
-
});
|
|
4480
|
-
const order = orderResponse.orders[0];
|
|
4662
|
+
})).orders[0];
|
|
4481
4663
|
return {
|
|
4482
4664
|
...response.options,
|
|
4483
4665
|
order
|
|
@@ -4546,6 +4728,65 @@ const useLoadData = () => {
|
|
|
4546
4728
|
};
|
|
4547
4729
|
};
|
|
4548
4730
|
|
|
4731
|
+
//#endregion
|
|
4732
|
+
//#region src/react/ui/components/_internals/ErrorLogBox.tsx
|
|
4733
|
+
const ErrorLogBox = ({ title, message, error, onDismiss }) => {
|
|
4734
|
+
const [showFullError, setShowFullError] = useState(false);
|
|
4735
|
+
const toggleFullError = () => {
|
|
4736
|
+
setShowFullError(!showFullError);
|
|
4737
|
+
};
|
|
4738
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4739
|
+
className: "relative max-h-96 w-full overflow-y-auto rounded-lg border border-red-900 bg-[#2b0000] p-3",
|
|
4740
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4741
|
+
className: "flex items-start gap-3",
|
|
4742
|
+
children: [
|
|
4743
|
+
/* @__PURE__ */ jsx(WarningIcon, {
|
|
4744
|
+
className: "absolute mt-0.5 flex-shrink-0 text-red-500",
|
|
4745
|
+
size: "sm"
|
|
4746
|
+
}),
|
|
4747
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4748
|
+
className: "min-w-0 flex-1",
|
|
4749
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4750
|
+
className: "relative ml-10 flex flex-col",
|
|
4751
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
4752
|
+
className: "font-bold text-red-400 text-sm",
|
|
4753
|
+
children: title
|
|
4754
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
4755
|
+
className: "mt-1 text-red-300 text-xs",
|
|
4756
|
+
children: message
|
|
4757
|
+
})]
|
|
4758
|
+
}), error && /* @__PURE__ */ jsxs("div", {
|
|
4759
|
+
className: "mt-2",
|
|
4760
|
+
children: [
|
|
4761
|
+
/* @__PURE__ */ jsxs("button", {
|
|
4762
|
+
onClick: toggleFullError,
|
|
4763
|
+
className: "flex items-center gap-1 text-red-400 text-xs transition-colors hover:text-red-300",
|
|
4764
|
+
type: "button",
|
|
4765
|
+
children: [showFullError ? "Hide full error" : "Show full error", showFullError ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" })]
|
|
4766
|
+
}),
|
|
4767
|
+
showFullError && /* @__PURE__ */ jsx("div", { className: "mt-2 h-px bg-red-900" }),
|
|
4768
|
+
showFullError && /* @__PURE__ */ jsx("div", {
|
|
4769
|
+
className: "mt-2 overflow-auto rounded-md bg-red-950 p-2",
|
|
4770
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
4771
|
+
className: "whitespace-pre-wrap break-words font-mono text-red-100 text-xs",
|
|
4772
|
+
children: JSON.stringify(error, null, 2)
|
|
4773
|
+
})
|
|
4774
|
+
})
|
|
4775
|
+
]
|
|
4776
|
+
})]
|
|
4777
|
+
}),
|
|
4778
|
+
onDismiss && /* @__PURE__ */ jsx("button", {
|
|
4779
|
+
onClick: onDismiss,
|
|
4780
|
+
className: "absolute right-4 flex-shrink-0 text-red-400 transition-colors hover:text-red-300",
|
|
4781
|
+
type: "button",
|
|
4782
|
+
"aria-label": "Dismiss error",
|
|
4783
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "h-3 w-3" })
|
|
4784
|
+
})
|
|
4785
|
+
]
|
|
4786
|
+
})
|
|
4787
|
+
});
|
|
4788
|
+
};
|
|
4789
|
+
|
|
4549
4790
|
//#endregion
|
|
4550
4791
|
//#region src/utils/decode/erc20.ts
|
|
4551
4792
|
function decodeERC20Approval(calldata) {
|
|
@@ -4563,9 +4804,8 @@ function decodeERC20Approval(calldata) {
|
|
|
4563
4804
|
|
|
4564
4805
|
//#endregion
|
|
4565
4806
|
//#region src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts
|
|
4566
|
-
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({
|
|
4807
|
+
const getBuyCollectableParams = async ({ chainId, collectionAddress, collectibleId, callbacks, priceCurrencyAddress, customCreditCardProviderCallback, config, address, marketplace, orderId, quantity, collectable, checkoutOptions, fee, skipNativeBalanceCheck, nativeTokenAddress, buyAnalyticsId, onRampProvider }) => {
|
|
4808
|
+
const { steps: steps$2 } = await getMarketplaceClient(config).generateBuyTransaction({
|
|
4569
4809
|
chainId: String(chainId),
|
|
4570
4810
|
collectionAddress,
|
|
4571
4811
|
buyer: address,
|
|
@@ -4586,8 +4826,7 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4586
4826
|
const isTransakSupported = creditCardProviders.includes("transak");
|
|
4587
4827
|
let transakContractId;
|
|
4588
4828
|
if (isTransakSupported) {
|
|
4589
|
-
const
|
|
4590
|
-
const transakContractIdResponse = await sequenceApiClient.checkoutOptionsGetTransakContractID({
|
|
4829
|
+
const transakContractIdResponse = await getSequenceApiClient(config).checkoutOptionsGetTransakContractID({
|
|
4591
4830
|
chainId,
|
|
4592
4831
|
contractAddress: buyStep.to
|
|
4593
4832
|
});
|
|
@@ -4608,8 +4847,8 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4608
4847
|
collectionAddress,
|
|
4609
4848
|
recipientAddress: address,
|
|
4610
4849
|
creditCardProviders,
|
|
4611
|
-
onSuccess: (
|
|
4612
|
-
callbacks?.onSuccess?.({ hash });
|
|
4850
|
+
onSuccess: (txHash) => {
|
|
4851
|
+
if (txHash) callbacks?.onSuccess?.({ hash: txHash });
|
|
4613
4852
|
},
|
|
4614
4853
|
supplementaryAnalyticsInfo: {
|
|
4615
4854
|
requestId: orderId,
|
|
@@ -4619,8 +4858,7 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4619
4858
|
},
|
|
4620
4859
|
onError: callbacks?.onError,
|
|
4621
4860
|
onClose: () => {
|
|
4622
|
-
|
|
4623
|
-
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4861
|
+
getQueryClient().invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4624
4862
|
buyModalStore.send({ type: "close" });
|
|
4625
4863
|
},
|
|
4626
4864
|
skipNativeBalanceCheck,
|
|
@@ -4630,13 +4868,14 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4630
4868
|
buyModalStore.send({ type: "close" });
|
|
4631
4869
|
} },
|
|
4632
4870
|
...transakContractId && { transakConfig: { contractId: transakContractId } },
|
|
4871
|
+
onRampProvider,
|
|
4633
4872
|
successActionButtons: callbacks?.successActionButtons
|
|
4634
4873
|
};
|
|
4635
4874
|
};
|
|
4636
4875
|
const usePaymentModalParams = (args) => {
|
|
4637
4876
|
const { address, marketplace, collectable, checkoutOptions, priceCurrencyAddress, quantity, enabled } = args;
|
|
4638
4877
|
const buyModalProps = useBuyModalProps();
|
|
4639
|
-
const { chainId, collectionAddress, skipNativeBalanceCheck, nativeTokenAddress } = buyModalProps;
|
|
4878
|
+
const { chainId, collectionAddress, skipNativeBalanceCheck, nativeTokenAddress, onRampProvider } = buyModalProps;
|
|
4640
4879
|
const collectibleId = isMarketProps(buyModalProps) ? buyModalProps.collectibleId : "";
|
|
4641
4880
|
const orderId = isMarketProps(buyModalProps) ? buyModalProps.orderId : "";
|
|
4642
4881
|
const customCreditCardProviderCallback = isMarketProps(buyModalProps) ? buyModalProps.customCreditCardProviderCallback : void 0;
|
|
@@ -4648,7 +4887,6 @@ const usePaymentModalParams = (args) => {
|
|
|
4648
4887
|
const onSuccess = useOnSuccess();
|
|
4649
4888
|
const onError = useOnError();
|
|
4650
4889
|
const buyAnalyticsId = useBuyAnalyticsId();
|
|
4651
|
-
const queryEnabled = !!address && !!marketplace && !!collectable && !!checkoutOptions && !!priceCurrencyAddress && !!quantity && enabled;
|
|
4652
4890
|
return useQuery({
|
|
4653
4891
|
queryKey: [
|
|
4654
4892
|
"buyCollectableParams",
|
|
@@ -4656,7 +4894,7 @@ const usePaymentModalParams = (args) => {
|
|
|
4656
4894
|
args,
|
|
4657
4895
|
fee
|
|
4658
4896
|
],
|
|
4659
|
-
queryFn:
|
|
4897
|
+
queryFn: !!address && !!marketplace && !!collectable && !!checkoutOptions && !!priceCurrencyAddress && !!quantity && enabled ? () => getBuyCollectableParams({
|
|
4660
4898
|
chainId,
|
|
4661
4899
|
config,
|
|
4662
4900
|
address,
|
|
@@ -4677,8 +4915,10 @@ const usePaymentModalParams = (args) => {
|
|
|
4677
4915
|
customCreditCardProviderCallback,
|
|
4678
4916
|
skipNativeBalanceCheck,
|
|
4679
4917
|
nativeTokenAddress,
|
|
4680
|
-
buyAnalyticsId
|
|
4681
|
-
|
|
4918
|
+
buyAnalyticsId,
|
|
4919
|
+
onRampProvider
|
|
4920
|
+
}) : skipToken,
|
|
4921
|
+
retry: false
|
|
4682
4922
|
});
|
|
4683
4923
|
};
|
|
4684
4924
|
|
|
@@ -4692,7 +4932,7 @@ const ERC721BuyModal = ({ collectable, order, address, checkoutOptions }) => {
|
|
|
4692
4932
|
quantity: 1
|
|
4693
4933
|
});
|
|
4694
4934
|
}, [quantity]);
|
|
4695
|
-
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError } = usePaymentModalParams({
|
|
4935
|
+
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError, failureReason } = usePaymentModalParams({
|
|
4696
4936
|
address,
|
|
4697
4937
|
quantity: quantity ?? void 0,
|
|
4698
4938
|
marketplace: order?.marketplace,
|
|
@@ -4701,6 +4941,25 @@ const ERC721BuyModal = ({ collectable, order, address, checkoutOptions }) => {
|
|
|
4701
4941
|
priceCurrencyAddress: order?.priceCurrencyAddress,
|
|
4702
4942
|
enabled: true
|
|
4703
4943
|
});
|
|
4944
|
+
if (failureReason) return /* @__PURE__ */ jsx(ActionModal, {
|
|
4945
|
+
isOpen: true,
|
|
4946
|
+
onClose: () => {
|
|
4947
|
+
buyModalStore.send({ type: "close" });
|
|
4948
|
+
},
|
|
4949
|
+
title: "An error occurred while purchasing",
|
|
4950
|
+
children: /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
4951
|
+
title: failureReason.name,
|
|
4952
|
+
message: failureReason.message,
|
|
4953
|
+
error: failureReason
|
|
4954
|
+
}),
|
|
4955
|
+
ctas: [{
|
|
4956
|
+
label: "Close",
|
|
4957
|
+
onClick: () => {
|
|
4958
|
+
buyModalStore.send({ type: "close" });
|
|
4959
|
+
}
|
|
4960
|
+
}],
|
|
4961
|
+
chainId: order.chainId
|
|
4962
|
+
});
|
|
4704
4963
|
if (isPaymentModalParamsLoading || !paymentModalParams) return null;
|
|
4705
4964
|
if (isPaymentModalParamsError) throw new Error("Failed to load payment parameters for ERC721 marketplace purchase");
|
|
4706
4965
|
return /* @__PURE__ */ jsx(PaymentModalOpener$2, { paymentModalParams });
|
|
@@ -4831,7 +5090,7 @@ const encodeERC721MintData = ({ to, amount, paymentToken, price, proof = DEFAULT
|
|
|
4831
5090
|
]
|
|
4832
5091
|
});
|
|
4833
5092
|
};
|
|
4834
|
-
const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddress, collectionAddress, price, currencyAddress, callbacks, customCreditCardProviderCallback, skipNativeBalanceCheck, nativeTokenAddress, checkoutProvider, quantity, successActionButtons }) => {
|
|
5093
|
+
const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddress, collectionAddress, price, currencyAddress, callbacks, customCreditCardProviderCallback, skipNativeBalanceCheck, nativeTokenAddress, checkoutProvider, quantity, successActionButtons, onRampProvider }) => {
|
|
4835
5094
|
try {
|
|
4836
5095
|
const purchaseTransactionData = encodeERC721MintData({
|
|
4837
5096
|
to: address,
|
|
@@ -4854,13 +5113,12 @@ const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddre
|
|
|
4854
5113
|
collectionAddress,
|
|
4855
5114
|
recipientAddress: address,
|
|
4856
5115
|
creditCardProviders,
|
|
4857
|
-
onSuccess: (
|
|
4858
|
-
callbacks?.onSuccess?.({ hash });
|
|
5116
|
+
onSuccess: (txHash) => {
|
|
5117
|
+
if (txHash) callbacks?.onSuccess?.({ hash: txHash });
|
|
4859
5118
|
},
|
|
4860
5119
|
onError: callbacks?.onError,
|
|
4861
5120
|
onClose: () => {
|
|
4862
|
-
|
|
4863
|
-
queryClient.invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
5121
|
+
getQueryClient().invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
4864
5122
|
buyModalStore.send({ type: "close" });
|
|
4865
5123
|
},
|
|
4866
5124
|
skipNativeBalanceCheck,
|
|
@@ -4870,7 +5128,8 @@ const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddre
|
|
|
4870
5128
|
customCreditCardProviderCallback(price.toString());
|
|
4871
5129
|
buyModalStore.send({ type: "close" });
|
|
4872
5130
|
} },
|
|
4873
|
-
successActionButtons
|
|
5131
|
+
successActionButtons,
|
|
5132
|
+
onRampProvider
|
|
4874
5133
|
};
|
|
4875
5134
|
} catch (error) {
|
|
4876
5135
|
throw BuyModalErrorFactory.priceCalculation("ERC721 payment params calculation", [price.toString(), quantity.toString()], error instanceof Error ? error.message : "Unknown error");
|
|
@@ -4882,10 +5141,9 @@ const useERC721SalePaymentParams = (args) => {
|
|
|
4882
5141
|
const onSuccess = useOnSuccess();
|
|
4883
5142
|
const onError = useOnError();
|
|
4884
5143
|
const buyModalProps = useBuyModalProps();
|
|
4885
|
-
const queryEnabled = enabled && !!address && !!salesContractAddress && !!collectionAddress && !!price && !!currencyAddress;
|
|
4886
5144
|
return useQuery({
|
|
4887
5145
|
queryKey: ["erc721SalePaymentParams", args],
|
|
4888
|
-
queryFn:
|
|
5146
|
+
queryFn: enabled && !!address && !!salesContractAddress && !!collectionAddress && !!price && !!currencyAddress ? () => getERC721SalePaymentParams({
|
|
4889
5147
|
chainId,
|
|
4890
5148
|
address,
|
|
4891
5149
|
salesContractAddress,
|
|
@@ -4901,7 +5159,8 @@ const useERC721SalePaymentParams = (args) => {
|
|
|
4901
5159
|
nativeTokenAddress: void 0,
|
|
4902
5160
|
checkoutProvider,
|
|
4903
5161
|
quantity,
|
|
4904
|
-
successActionButtons: buyModalProps.successActionButtons
|
|
5162
|
+
successActionButtons: buyModalProps.successActionButtons,
|
|
5163
|
+
onRampProvider: buyModalProps.onRampProvider
|
|
4905
5164
|
}) : skipToken
|
|
4906
5165
|
});
|
|
4907
5166
|
};
|
|
@@ -4993,8 +5252,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
4993
5252
|
}
|
|
4994
5253
|
const dnValue = dn.from(value, decimals);
|
|
4995
5254
|
const isBiggerThanMax = dn.greaterThan(dnValue, dnMaxQuantity);
|
|
4996
|
-
|
|
4997
|
-
if (isLessThanMin) {
|
|
5255
|
+
if (dn.lessThan(dnValue, dnMin)) {
|
|
4998
5256
|
setQuantity({
|
|
4999
5257
|
value,
|
|
5000
5258
|
isValid: false
|
|
@@ -5036,7 +5294,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
5036
5294
|
});
|
|
5037
5295
|
}
|
|
5038
5296
|
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"),
|
|
5297
|
+
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
5298
|
children: [/* @__PURE__ */ jsx(NumericInput, {
|
|
5041
5299
|
className: "w-full pl-1",
|
|
5042
5300
|
name: "quantity",
|
|
@@ -5070,7 +5328,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
5070
5328
|
//#endregion
|
|
5071
5329
|
//#region src/react/ui/modals/BuyModal/components/ERC1155QuantityModal.tsx
|
|
5072
5330
|
const INFINITY_STRING = maxUint256.toString();
|
|
5073
|
-
const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unlimitedSupply, salePrice, chainId,
|
|
5331
|
+
const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unlimitedSupply, salePrice, chainId, cardType }) => {
|
|
5074
5332
|
const isOpen = useIsOpen$2();
|
|
5075
5333
|
const minQuantity = quantityDecimals > 0 ? `0.${"1".padStart(quantityDecimals, "0")}` : "1";
|
|
5076
5334
|
const [localQuantity, setLocalQuantity] = useState(minQuantity);
|
|
@@ -5108,15 +5366,15 @@ const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unli
|
|
|
5108
5366
|
quantityStr: localQuantity,
|
|
5109
5367
|
salePrice,
|
|
5110
5368
|
chainId,
|
|
5111
|
-
|
|
5369
|
+
cardType,
|
|
5112
5370
|
quantityDecimals
|
|
5113
5371
|
})]
|
|
5114
5372
|
})
|
|
5115
5373
|
});
|
|
5116
5374
|
};
|
|
5117
|
-
const TotalPrice = ({ order, quantityStr, salePrice, chainId,
|
|
5118
|
-
const isShop =
|
|
5119
|
-
const isMarket =
|
|
5375
|
+
const TotalPrice = ({ order, quantityStr, salePrice, chainId, cardType, quantityDecimals }) => {
|
|
5376
|
+
const isShop = cardType === "shop";
|
|
5377
|
+
const isMarket = cardType === "market";
|
|
5120
5378
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
5121
5379
|
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
5122
5380
|
chainId,
|
|
@@ -5126,8 +5384,7 @@ const TotalPrice = ({ order, quantityStr, salePrice, chainId, marketplaceType, q
|
|
|
5126
5384
|
let formattedPrice = "0";
|
|
5127
5385
|
const quantityForCalculation = parseUnits(quantityStr, quantityDecimals);
|
|
5128
5386
|
if (isMarket && currency && order) try {
|
|
5129
|
-
const
|
|
5130
|
-
const marketplaceFeePercentage = marketCollection?.feePercentage ?? DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
5387
|
+
const marketplaceFeePercentage = (marketplaceConfig?.market?.collections?.find((col) => col.itemsAddress.toLowerCase() === order.collectionContractAddress.toLowerCase() && col.chainId === chainId))?.feePercentage ?? DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
5131
5388
|
const totalPriceRaw = BigInt(order ? order.priceAmount : "0") * quantityForCalculation;
|
|
5132
5389
|
formattedPrice = formatPriceWithFee(totalPriceRaw, currency.decimals, marketplaceFeePercentage);
|
|
5133
5390
|
} catch (e) {
|
|
@@ -5179,18 +5436,36 @@ const TotalPrice = ({ order, quantityStr, salePrice, chainId, marketplaceType, q
|
|
|
5179
5436
|
const ERC1155BuyModal = ({ collectable, order, address, checkoutOptions, chainId }) => {
|
|
5180
5437
|
const quantity = useQuantity();
|
|
5181
5438
|
const modalProps = useBuyModalProps();
|
|
5182
|
-
const
|
|
5439
|
+
const cardType = modalProps.cardType || "market";
|
|
5183
5440
|
const isShop = isShopProps(modalProps);
|
|
5184
5441
|
const quantityDecimals = isShop ? modalProps.quantityDecimals : collectable.decimals || 0;
|
|
5185
5442
|
const quantityRemaining = isShop ? modalProps.quantityRemaining?.toString() : order?.quantityRemaining;
|
|
5186
|
-
|
|
5443
|
+
const unlimitedSupply = isShop ? modalProps.unlimitedSupply : false;
|
|
5444
|
+
useEffect(() => {
|
|
5445
|
+
if (modalProps.hideQuantitySelector && !quantity) {
|
|
5446
|
+
const minQuantity = quantityDecimals > 0 ? 10 ** quantityDecimals : 1;
|
|
5447
|
+
const autoQuantity = unlimitedSupply ? minQuantity : Math.min(Number(quantityRemaining), minQuantity);
|
|
5448
|
+
buyModalStore.send({
|
|
5449
|
+
type: "setQuantity",
|
|
5450
|
+
quantity: autoQuantity
|
|
5451
|
+
});
|
|
5452
|
+
}
|
|
5453
|
+
}, [
|
|
5454
|
+
modalProps.hideQuantitySelector,
|
|
5455
|
+
quantity,
|
|
5456
|
+
quantityDecimals,
|
|
5457
|
+
unlimitedSupply,
|
|
5458
|
+
quantityRemaining
|
|
5459
|
+
]);
|
|
5460
|
+
if (!quantity && !modalProps.hideQuantitySelector) return /* @__PURE__ */ jsx(ERC1155QuantityModal, {
|
|
5187
5461
|
order,
|
|
5188
|
-
|
|
5462
|
+
cardType,
|
|
5189
5463
|
quantityDecimals,
|
|
5190
5464
|
quantityRemaining,
|
|
5465
|
+
unlimitedSupply,
|
|
5191
5466
|
chainId
|
|
5192
5467
|
});
|
|
5193
|
-
if (!checkoutOptions) return null;
|
|
5468
|
+
if (!checkoutOptions || !quantity) return null;
|
|
5194
5469
|
return /* @__PURE__ */ jsx(Modal$4, {
|
|
5195
5470
|
address,
|
|
5196
5471
|
quantity,
|
|
@@ -5200,7 +5475,7 @@ const ERC1155BuyModal = ({ collectable, order, address, checkoutOptions, chainId
|
|
|
5200
5475
|
});
|
|
5201
5476
|
};
|
|
5202
5477
|
const Modal$4 = ({ address, quantity, order, collectable, checkoutOptions }) => {
|
|
5203
|
-
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError } = usePaymentModalParams({
|
|
5478
|
+
const { data: paymentModalParams, isLoading: isPaymentModalParamsLoading, isError: isPaymentModalParamsError, failureReason } = usePaymentModalParams({
|
|
5204
5479
|
address,
|
|
5205
5480
|
quantity,
|
|
5206
5481
|
marketplace: order?.marketplace,
|
|
@@ -5209,7 +5484,31 @@ const Modal$4 = ({ address, quantity, order, collectable, checkoutOptions }) =>
|
|
|
5209
5484
|
priceCurrencyAddress: order?.priceCurrencyAddress,
|
|
5210
5485
|
enabled: true
|
|
5211
5486
|
});
|
|
5212
|
-
if (
|
|
5487
|
+
if (failureReason) return /* @__PURE__ */ jsx(ActionModal, {
|
|
5488
|
+
isOpen: true,
|
|
5489
|
+
onClose: () => {
|
|
5490
|
+
buyModalStore.send({ type: "close" });
|
|
5491
|
+
},
|
|
5492
|
+
title: "An error occurred while purchasing",
|
|
5493
|
+
children: /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
5494
|
+
title: failureReason.name,
|
|
5495
|
+
message: failureReason.message,
|
|
5496
|
+
error: failureReason
|
|
5497
|
+
}),
|
|
5498
|
+
ctas: [{
|
|
5499
|
+
label: "Close",
|
|
5500
|
+
onClick: () => {
|
|
5501
|
+
buyModalStore.send({ type: "close" });
|
|
5502
|
+
}
|
|
5503
|
+
}],
|
|
5504
|
+
chainId: order.chainId
|
|
5505
|
+
});
|
|
5506
|
+
if (isPaymentModalParamsLoading || !paymentModalParams) return /* @__PURE__ */ jsx(LoadingModal, {
|
|
5507
|
+
isOpen: true,
|
|
5508
|
+
chainId: order.chainId,
|
|
5509
|
+
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5510
|
+
title: "Loading checkout"
|
|
5511
|
+
});
|
|
5213
5512
|
if (isPaymentModalParamsError) throw new Error("Failed to load payment parameters for ERC1155 marketplace purchase");
|
|
5214
5513
|
return /* @__PURE__ */ jsx(PaymentModalOpener, { paymentModalParams });
|
|
5215
5514
|
};
|
|
@@ -5239,36 +5538,41 @@ const useERC1155Checkout = ({ chainId, salesContractAddress, collectionAddress,
|
|
|
5239
5538
|
const onError = useOnError();
|
|
5240
5539
|
const saleAnalyticsId = useBuyAnalyticsId();
|
|
5241
5540
|
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
5541
|
return {
|
|
5271
|
-
...
|
|
5542
|
+
...useERC1155SaleContractCheckout({
|
|
5543
|
+
chain: chainId,
|
|
5544
|
+
contractAddress: salesContractAddress,
|
|
5545
|
+
collectionAddress,
|
|
5546
|
+
items: [{
|
|
5547
|
+
...items[0],
|
|
5548
|
+
quantity: quantity?.toString() || "1"
|
|
5549
|
+
}],
|
|
5550
|
+
wallet: accountAddress ?? "",
|
|
5551
|
+
...checkoutOptions && { checkoutOptions },
|
|
5552
|
+
onSuccess: (txHash) => {
|
|
5553
|
+
if (txHash) onSuccess({ hash: txHash });
|
|
5554
|
+
},
|
|
5555
|
+
onError: (error) => {
|
|
5556
|
+
onError(error);
|
|
5557
|
+
},
|
|
5558
|
+
onClose: () => {
|
|
5559
|
+
const queryClient = getQueryClient();
|
|
5560
|
+
queryClient.invalidateQueries({ queryKey: balanceQueries.inventory });
|
|
5561
|
+
queryClient.invalidateQueries({
|
|
5562
|
+
queryKey: [...collectableKeys.userBalances],
|
|
5563
|
+
refetchType: "inactive"
|
|
5564
|
+
});
|
|
5565
|
+
queryClient.invalidateQueries({ queryKey: collectableKeys.listPrimarySaleItems });
|
|
5566
|
+
buyModalStore.send({ type: "close" });
|
|
5567
|
+
},
|
|
5568
|
+
customProviderCallback,
|
|
5569
|
+
supplementaryAnalyticsInfo: {
|
|
5570
|
+
marketplaceType: "shop",
|
|
5571
|
+
saleAnalyticsId
|
|
5572
|
+
},
|
|
5573
|
+
successActionButtons: buyModalProps.successActionButtons,
|
|
5574
|
+
...buyModalProps.onRampProvider && { onRampProvider: buyModalProps.onRampProvider }
|
|
5575
|
+
}),
|
|
5272
5576
|
isEnabled: Boolean(enabled && accountAddress)
|
|
5273
5577
|
};
|
|
5274
5578
|
};
|
|
@@ -5287,7 +5591,7 @@ const ERC1155ShopModal = ({ collection, shopData, chainId }) => {
|
|
|
5287
5591
|
amount: shopData.salePrice?.amount ?? "0",
|
|
5288
5592
|
currencyAddress: shopData.salePrice?.currencyAddress ?? zeroAddress
|
|
5289
5593
|
},
|
|
5290
|
-
|
|
5594
|
+
cardType: "shop",
|
|
5291
5595
|
quantityDecimals,
|
|
5292
5596
|
quantityRemaining,
|
|
5293
5597
|
unlimitedSupply,
|
|
@@ -5334,7 +5638,7 @@ const ERC1155SaleContractCheckoutModalOpener = ({ chainId, salesContractAddress,
|
|
|
5334
5638
|
isOpen: true,
|
|
5335
5639
|
chainId,
|
|
5336
5640
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5337
|
-
title: "Loading
|
|
5641
|
+
title: "Loading payment options"
|
|
5338
5642
|
});
|
|
5339
5643
|
return null;
|
|
5340
5644
|
};
|
|
@@ -5357,7 +5661,7 @@ const BuyModalRouter = () => {
|
|
|
5357
5661
|
isOpen: true,
|
|
5358
5662
|
chainId,
|
|
5359
5663
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5360
|
-
title: "Loading
|
|
5664
|
+
title: "Loading payment options"
|
|
5361
5665
|
});
|
|
5362
5666
|
if (isShop) {
|
|
5363
5667
|
if (collection.type === "ERC721") {
|
|
@@ -5365,7 +5669,7 @@ const BuyModalRouter = () => {
|
|
|
5365
5669
|
isOpen: true,
|
|
5366
5670
|
chainId,
|
|
5367
5671
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5368
|
-
title: "Loading
|
|
5672
|
+
title: "Loading payment options"
|
|
5369
5673
|
});
|
|
5370
5674
|
return /* @__PURE__ */ jsx(ERC721ShopModal, {
|
|
5371
5675
|
collection,
|
|
@@ -5378,7 +5682,7 @@ const BuyModalRouter = () => {
|
|
|
5378
5682
|
isOpen: true,
|
|
5379
5683
|
chainId,
|
|
5380
5684
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5381
|
-
title: "Loading
|
|
5685
|
+
title: "Loading payment options"
|
|
5382
5686
|
});
|
|
5383
5687
|
return /* @__PURE__ */ jsx(ERC1155ShopModal, {
|
|
5384
5688
|
collection,
|
|
@@ -5392,7 +5696,7 @@ const BuyModalRouter = () => {
|
|
|
5392
5696
|
isOpen: true,
|
|
5393
5697
|
chainId,
|
|
5394
5698
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5395
|
-
title: "Loading
|
|
5699
|
+
title: "Loading payment options"
|
|
5396
5700
|
});
|
|
5397
5701
|
return /* @__PURE__ */ jsx(ERC721BuyModal, {
|
|
5398
5702
|
collection,
|
|
@@ -5408,7 +5712,7 @@ const BuyModalRouter = () => {
|
|
|
5408
5712
|
isOpen: true,
|
|
5409
5713
|
chainId,
|
|
5410
5714
|
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5411
|
-
title: "Loading
|
|
5715
|
+
title: "Loading payment options"
|
|
5412
5716
|
});
|
|
5413
5717
|
return /* @__PURE__ */ jsx(ERC1155BuyModal, {
|
|
5414
5718
|
collection,
|
|
@@ -5432,8 +5736,7 @@ const BuyModalRouter = () => {
|
|
|
5432
5736
|
//#endregion
|
|
5433
5737
|
//#region src/react/ui/modals/BuyModal/components/Modal.tsx
|
|
5434
5738
|
const BuyModal = () => {
|
|
5435
|
-
|
|
5436
|
-
if (!isOpen) return null;
|
|
5739
|
+
if (!useIsOpen$2()) return null;
|
|
5437
5740
|
return /* @__PURE__ */ jsx(BuyModalRouter, {});
|
|
5438
5741
|
};
|
|
5439
5742
|
|
|
@@ -5481,6 +5784,91 @@ function Calendar({ ...props }) {
|
|
|
5481
5784
|
Calendar.displayName = "Calendar";
|
|
5482
5785
|
var calendar_default = Calendar;
|
|
5483
5786
|
|
|
5787
|
+
//#endregion
|
|
5788
|
+
//#region src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx
|
|
5789
|
+
function TimeSelector({ selectedDate, onTimeChange }) {
|
|
5790
|
+
const minutesRef = useRef(null);
|
|
5791
|
+
const [draft, setDraft] = useState(null);
|
|
5792
|
+
const currentHours = getHours(selectedDate);
|
|
5793
|
+
const currentMinutes = getMinutes(selectedDate);
|
|
5794
|
+
const commitChange = () => {
|
|
5795
|
+
if (!draft) return;
|
|
5796
|
+
const now = /* @__PURE__ */ new Date();
|
|
5797
|
+
const parse = (val, fallback) => {
|
|
5798
|
+
const n = Number.parseInt(val, 10);
|
|
5799
|
+
return Number.isNaN(n) ? fallback : n;
|
|
5800
|
+
};
|
|
5801
|
+
let h = clamp(parse(draft.hours, currentHours), 0, 23);
|
|
5802
|
+
let m = clamp(parse(draft.minutes, currentMinutes), 0, 59);
|
|
5803
|
+
if (setMinutes(setHours(selectedDate, h), m) < now) {
|
|
5804
|
+
h = getHours(now);
|
|
5805
|
+
m = getMinutes(now);
|
|
5806
|
+
}
|
|
5807
|
+
onTimeChange(h, m);
|
|
5808
|
+
setDraft(null);
|
|
5809
|
+
};
|
|
5810
|
+
const handleKeyDown = (e, field) => {
|
|
5811
|
+
if (e.key === "Enter") {
|
|
5812
|
+
e.preventDefault();
|
|
5813
|
+
if (field === "hours") minutesRef.current?.focus();
|
|
5814
|
+
else commitChange();
|
|
5815
|
+
} else if (e.key === "Escape") {
|
|
5816
|
+
e.preventDefault();
|
|
5817
|
+
setDraft(null);
|
|
5818
|
+
e.currentTarget.blur();
|
|
5819
|
+
}
|
|
5820
|
+
};
|
|
5821
|
+
const hours = draft?.hours ?? currentHours.toString().padStart(2, "0");
|
|
5822
|
+
const minutes = draft?.minutes ?? currentMinutes.toString().padStart(2, "0");
|
|
5823
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5824
|
+
className: "mt-3 flex items-center gap-6 border-border-base border-t pt-3",
|
|
5825
|
+
children: [/* @__PURE__ */ jsx(TimeIcon, { color: "white" }), /* @__PURE__ */ jsxs("div", {
|
|
5826
|
+
className: "flex flex-1 items-center justify-between gap-2",
|
|
5827
|
+
children: [
|
|
5828
|
+
/* @__PURE__ */ jsx("div", {
|
|
5829
|
+
className: "w-16 [&>label]:w-16",
|
|
5830
|
+
children: /* @__PURE__ */ jsx(NumericInput, {
|
|
5831
|
+
className: "h-9 [&>input]:text-xs",
|
|
5832
|
+
name: "hours",
|
|
5833
|
+
value: hours,
|
|
5834
|
+
onChange: (e) => setDraft({
|
|
5835
|
+
hours: e.target.value,
|
|
5836
|
+
minutes
|
|
5837
|
+
}),
|
|
5838
|
+
onBlur: commitChange,
|
|
5839
|
+
onKeyDown: (e) => handleKeyDown(e, "hours"),
|
|
5840
|
+
min: 0,
|
|
5841
|
+
max: 23,
|
|
5842
|
+
tabIndex: 0
|
|
5843
|
+
})
|
|
5844
|
+
}),
|
|
5845
|
+
/* @__PURE__ */ jsx(Text, {
|
|
5846
|
+
className: "font-medium text-sm text-text-80",
|
|
5847
|
+
children: ":"
|
|
5848
|
+
}),
|
|
5849
|
+
/* @__PURE__ */ jsx("div", {
|
|
5850
|
+
className: "w-16 [&>label]:w-16",
|
|
5851
|
+
children: /* @__PURE__ */ jsx(NumericInput, {
|
|
5852
|
+
ref: minutesRef,
|
|
5853
|
+
className: "h-9 [&>input]:text-xs",
|
|
5854
|
+
name: "minutes",
|
|
5855
|
+
value: minutes,
|
|
5856
|
+
onChange: (e) => setDraft({
|
|
5857
|
+
hours,
|
|
5858
|
+
minutes: e.target.value
|
|
5859
|
+
}),
|
|
5860
|
+
onBlur: commitChange,
|
|
5861
|
+
onKeyDown: (e) => handleKeyDown(e, "minutes"),
|
|
5862
|
+
min: 0,
|
|
5863
|
+
max: 59,
|
|
5864
|
+
tabIndex: 0
|
|
5865
|
+
})
|
|
5866
|
+
})
|
|
5867
|
+
]
|
|
5868
|
+
})]
|
|
5869
|
+
});
|
|
5870
|
+
}
|
|
5871
|
+
|
|
5484
5872
|
//#endregion
|
|
5485
5873
|
//#region src/react/ui/modals/_internal/components/calendarDropdown/index.tsx
|
|
5486
5874
|
/**
|
|
@@ -5499,6 +5887,11 @@ function getMatchingPreset(selectedDate) {
|
|
|
5499
5887
|
}
|
|
5500
5888
|
function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpen, setIsOpen }) {
|
|
5501
5889
|
const matchingPreset = getMatchingPreset(selectedDate);
|
|
5890
|
+
const handleTimeChange = (hours, minutes) => {
|
|
5891
|
+
const newDate = new Date(selectedDate);
|
|
5892
|
+
newDate.setHours(hours, minutes, 0, 0);
|
|
5893
|
+
setSelectedDate(newDate);
|
|
5894
|
+
};
|
|
5502
5895
|
return /* @__PURE__ */ jsxs(DropdownMenuRoot, {
|
|
5503
5896
|
open: isOpen,
|
|
5504
5897
|
onOpenChange: setIsOpen,
|
|
@@ -5508,7 +5901,7 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5508
5901
|
leftIcon: CalendarIcon_default,
|
|
5509
5902
|
className: "h-9 flex-1 rounded-sm p-2 font-medium text-xs",
|
|
5510
5903
|
variant: "base",
|
|
5511
|
-
label: format(selectedDate, "
|
|
5904
|
+
label: format(selectedDate, "yyyy/MM/dd HH:mm"),
|
|
5512
5905
|
shape: "square",
|
|
5513
5906
|
onClick: () => setIsOpen(!isOpen)
|
|
5514
5907
|
})
|
|
@@ -5528,16 +5921,29 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5528
5921
|
},
|
|
5529
5922
|
variant: "text",
|
|
5530
5923
|
className: `w-full justify-start py-1.5 font-bold text-xs transition-colors ${isActive ? "text-text-100" : "text-text-50 hover:text-text-80"}`,
|
|
5924
|
+
tabIndex: 0,
|
|
5531
5925
|
children: preset.label
|
|
5532
5926
|
}, preset.value);
|
|
5533
5927
|
})
|
|
5534
|
-
}), /* @__PURE__ */
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5928
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5929
|
+
className: "flex flex-col",
|
|
5930
|
+
children: [/* @__PURE__ */ jsx(calendar_default, {
|
|
5931
|
+
selectedDate,
|
|
5932
|
+
setSelectedDate: (date) => {
|
|
5933
|
+
const newDate = new Date(date);
|
|
5934
|
+
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
5935
|
+
const selectedDay = startOfDay(newDate);
|
|
5936
|
+
if (isSameDay(selectedDay, today)) setSelectedDate(endOfDay(newDate));
|
|
5937
|
+
else {
|
|
5938
|
+
newDate.setHours(selectedDate.getHours(), selectedDate.getMinutes(), 0, 0);
|
|
5939
|
+
setSelectedDate(newDate);
|
|
5940
|
+
}
|
|
5941
|
+
},
|
|
5942
|
+
mode: "single"
|
|
5943
|
+
}), /* @__PURE__ */ jsx(TimeSelector, {
|
|
5944
|
+
selectedDate,
|
|
5945
|
+
onTimeChange: handleTimeChange
|
|
5946
|
+
})]
|
|
5541
5947
|
})]
|
|
5542
5948
|
})
|
|
5543
5949
|
}) })]
|
|
@@ -5546,11 +5952,6 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5546
5952
|
|
|
5547
5953
|
//#endregion
|
|
5548
5954
|
//#region src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
5549
|
-
const setToEndOfDay = (date) => {
|
|
5550
|
-
const endOfDay = new Date(date);
|
|
5551
|
-
endOfDay.setHours(23, 59, 59, 999);
|
|
5552
|
-
return endOfDay;
|
|
5553
|
-
};
|
|
5554
5955
|
const PRESET_RANGES = {
|
|
5555
5956
|
TODAY: {
|
|
5556
5957
|
label: "Today",
|
|
@@ -5584,7 +5985,12 @@ const ExpirationDateSelect = function ExpirationDateSelect$1({ className, date,
|
|
|
5584
5985
|
const presetRange = Object.values(PRESET_RANGES).find((preset) => preset.value === range);
|
|
5585
5986
|
if (!presetRange) return;
|
|
5586
5987
|
const baseDate = /* @__PURE__ */ new Date();
|
|
5587
|
-
const
|
|
5988
|
+
const targetDate = presetRange.value === "today" ? baseDate : addDays(baseDate, presetRange.offset);
|
|
5989
|
+
const newDate = presetRange.value === "today" ? endOfDay(targetDate) : (() => {
|
|
5990
|
+
const preservedTimeDate = new Date(targetDate);
|
|
5991
|
+
preservedTimeDate.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
5992
|
+
return preservedTimeDate;
|
|
5993
|
+
})();
|
|
5588
5994
|
onDateChange(newDate);
|
|
5589
5995
|
}
|
|
5590
5996
|
function handleDateValueChange(date$1) {
|
|
@@ -5592,7 +5998,7 @@ const ExpirationDateSelect = function ExpirationDateSelect$1({ className, date,
|
|
|
5592
5998
|
}
|
|
5593
5999
|
if (!date) return /* @__PURE__ */ jsx(Skeleton, { className: "mr-3 h-7 w-20 rounded-2xl" });
|
|
5594
6000
|
return /* @__PURE__ */ jsxs("div", {
|
|
5595
|
-
className: cn("relative w-full", disabled && "pointer-events-none opacity-50"),
|
|
6001
|
+
className: cn$1("relative w-full", disabled && "pointer-events-none opacity-50"),
|
|
5596
6002
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
5597
6003
|
className: "w-full text-left font-body font-medium text-xs",
|
|
5598
6004
|
fontWeight: "medium",
|
|
@@ -5844,31 +6250,424 @@ const CustomSelect = ({ items, onValueChange, defaultValue, placeholder = "Selec
|
|
|
5844
6250
|
}) })] });
|
|
5845
6251
|
};
|
|
5846
6252
|
|
|
6253
|
+
//#endregion
|
|
6254
|
+
//#region src/react/ui/modals/_internal/constants/opensea-currencies.ts
|
|
6255
|
+
const OPENSEA_CHAIN_CURRENCIES = {
|
|
6256
|
+
"1": {
|
|
6257
|
+
chainId: 1,
|
|
6258
|
+
openseaId: "ethereum",
|
|
6259
|
+
name: "Ethereum",
|
|
6260
|
+
nativeCurrency: {
|
|
6261
|
+
symbol: "ETH",
|
|
6262
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6263
|
+
},
|
|
6264
|
+
wrappedNativeCurrency: { address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
|
|
6265
|
+
offerCurrency: {
|
|
6266
|
+
symbol: "WETH",
|
|
6267
|
+
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
|
6268
|
+
},
|
|
6269
|
+
listingCurrency: {
|
|
6270
|
+
symbol: "ETH",
|
|
6271
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6272
|
+
}
|
|
6273
|
+
},
|
|
6274
|
+
"10": {
|
|
6275
|
+
chainId: 10,
|
|
6276
|
+
openseaId: "optimism",
|
|
6277
|
+
name: "Optimism",
|
|
6278
|
+
nativeCurrency: {
|
|
6279
|
+
symbol: "ETH",
|
|
6280
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6281
|
+
},
|
|
6282
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6283
|
+
offerCurrency: {
|
|
6284
|
+
symbol: "WETH",
|
|
6285
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6286
|
+
},
|
|
6287
|
+
listingCurrency: {
|
|
6288
|
+
symbol: "ETH",
|
|
6289
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6290
|
+
}
|
|
6291
|
+
},
|
|
6292
|
+
"137": {
|
|
6293
|
+
chainId: 137,
|
|
6294
|
+
openseaId: "matic",
|
|
6295
|
+
name: "Polygon",
|
|
6296
|
+
nativeCurrency: {
|
|
6297
|
+
symbol: "POL",
|
|
6298
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6299
|
+
},
|
|
6300
|
+
wrappedNativeCurrency: { address: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" },
|
|
6301
|
+
offerCurrency: {
|
|
6302
|
+
symbol: "WETH",
|
|
6303
|
+
address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"
|
|
6304
|
+
},
|
|
6305
|
+
listingCurrency: {
|
|
6306
|
+
symbol: "WETH",
|
|
6307
|
+
address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"
|
|
6308
|
+
}
|
|
6309
|
+
},
|
|
6310
|
+
"360": {
|
|
6311
|
+
chainId: 360,
|
|
6312
|
+
openseaId: "shape",
|
|
6313
|
+
name: "Shape",
|
|
6314
|
+
nativeCurrency: {
|
|
6315
|
+
symbol: "ETH",
|
|
6316
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6317
|
+
},
|
|
6318
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6319
|
+
offerCurrency: {
|
|
6320
|
+
symbol: "WETH",
|
|
6321
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6322
|
+
},
|
|
6323
|
+
listingCurrency: {
|
|
6324
|
+
symbol: "ETH",
|
|
6325
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6326
|
+
}
|
|
6327
|
+
},
|
|
6328
|
+
"998": {
|
|
6329
|
+
chainId: 998,
|
|
6330
|
+
openseaId: "hyperevm",
|
|
6331
|
+
name: "HyperEVM",
|
|
6332
|
+
nativeCurrency: {
|
|
6333
|
+
symbol: "HYPE",
|
|
6334
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6335
|
+
},
|
|
6336
|
+
wrappedNativeCurrency: { address: "0x5555555555555555555555555555555555555555" },
|
|
6337
|
+
offerCurrency: {
|
|
6338
|
+
symbol: "WHYPE",
|
|
6339
|
+
address: "0x5555555555555555555555555555555555555555"
|
|
6340
|
+
},
|
|
6341
|
+
listingCurrency: {
|
|
6342
|
+
symbol: "HYPE",
|
|
6343
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6344
|
+
}
|
|
6345
|
+
},
|
|
6346
|
+
"130": {
|
|
6347
|
+
chainId: 130,
|
|
6348
|
+
openseaId: "unichain",
|
|
6349
|
+
name: "Unichain",
|
|
6350
|
+
nativeCurrency: {
|
|
6351
|
+
symbol: "ETH",
|
|
6352
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6353
|
+
},
|
|
6354
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6355
|
+
offerCurrency: {
|
|
6356
|
+
symbol: "WETH",
|
|
6357
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6358
|
+
},
|
|
6359
|
+
listingCurrency: {
|
|
6360
|
+
symbol: "ETH",
|
|
6361
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6362
|
+
}
|
|
6363
|
+
},
|
|
6364
|
+
"1329": {
|
|
6365
|
+
chainId: 1329,
|
|
6366
|
+
openseaId: "sei",
|
|
6367
|
+
name: "Sei",
|
|
6368
|
+
nativeCurrency: {
|
|
6369
|
+
symbol: "SEI",
|
|
6370
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6371
|
+
},
|
|
6372
|
+
wrappedNativeCurrency: { address: "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7" },
|
|
6373
|
+
offerCurrency: {
|
|
6374
|
+
symbol: "WSEI",
|
|
6375
|
+
address: "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7"
|
|
6376
|
+
},
|
|
6377
|
+
listingCurrency: {
|
|
6378
|
+
symbol: "SEI",
|
|
6379
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6380
|
+
}
|
|
6381
|
+
},
|
|
6382
|
+
"1868": {
|
|
6383
|
+
chainId: 1868,
|
|
6384
|
+
openseaId: "soneium",
|
|
6385
|
+
name: "Soneium",
|
|
6386
|
+
nativeCurrency: {
|
|
6387
|
+
symbol: "ETH",
|
|
6388
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6389
|
+
},
|
|
6390
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6391
|
+
offerCurrency: {
|
|
6392
|
+
symbol: "WETH",
|
|
6393
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6394
|
+
},
|
|
6395
|
+
listingCurrency: {
|
|
6396
|
+
symbol: "ETH",
|
|
6397
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6398
|
+
}
|
|
6399
|
+
},
|
|
6400
|
+
"2020": {
|
|
6401
|
+
chainId: 2020,
|
|
6402
|
+
openseaId: "ronin",
|
|
6403
|
+
name: "Ronin",
|
|
6404
|
+
nativeCurrency: {
|
|
6405
|
+
symbol: "RON",
|
|
6406
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6407
|
+
},
|
|
6408
|
+
wrappedNativeCurrency: { address: "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4" },
|
|
6409
|
+
offerCurrency: {
|
|
6410
|
+
symbol: "WRON",
|
|
6411
|
+
address: "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4"
|
|
6412
|
+
},
|
|
6413
|
+
listingCurrency: {
|
|
6414
|
+
symbol: "RON",
|
|
6415
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6416
|
+
}
|
|
6417
|
+
},
|
|
6418
|
+
"2741": {
|
|
6419
|
+
chainId: 2741,
|
|
6420
|
+
openseaId: "abstract",
|
|
6421
|
+
name: "Abstract",
|
|
6422
|
+
nativeCurrency: {
|
|
6423
|
+
symbol: "ETH",
|
|
6424
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6425
|
+
},
|
|
6426
|
+
wrappedNativeCurrency: { address: "0x3439153eb7af838ad19d56e1571fbd09333c2809" },
|
|
6427
|
+
offerCurrency: {
|
|
6428
|
+
symbol: "WETH",
|
|
6429
|
+
address: "0x3439153eb7af838ad19d56e1571fbd09333c2809"
|
|
6430
|
+
},
|
|
6431
|
+
listingCurrency: {
|
|
6432
|
+
symbol: "ETH",
|
|
6433
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6434
|
+
}
|
|
6435
|
+
},
|
|
6436
|
+
"8333": {
|
|
6437
|
+
chainId: 8333,
|
|
6438
|
+
openseaId: "b3",
|
|
6439
|
+
name: "B3",
|
|
6440
|
+
nativeCurrency: {
|
|
6441
|
+
symbol: "ETH",
|
|
6442
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6443
|
+
},
|
|
6444
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6445
|
+
offerCurrency: {
|
|
6446
|
+
symbol: "WETH",
|
|
6447
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6448
|
+
},
|
|
6449
|
+
listingCurrency: {
|
|
6450
|
+
symbol: "ETH",
|
|
6451
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6452
|
+
}
|
|
6453
|
+
},
|
|
6454
|
+
"8453": {
|
|
6455
|
+
chainId: 8453,
|
|
6456
|
+
openseaId: "base",
|
|
6457
|
+
name: "Base",
|
|
6458
|
+
nativeCurrency: {
|
|
6459
|
+
symbol: "ETH",
|
|
6460
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6461
|
+
},
|
|
6462
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6463
|
+
offerCurrency: {
|
|
6464
|
+
symbol: "WETH",
|
|
6465
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6466
|
+
},
|
|
6467
|
+
listingCurrency: {
|
|
6468
|
+
symbol: "ETH",
|
|
6469
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6470
|
+
}
|
|
6471
|
+
},
|
|
6472
|
+
"33139": {
|
|
6473
|
+
chainId: 33139,
|
|
6474
|
+
openseaId: "ape_chain",
|
|
6475
|
+
name: "ApeChain",
|
|
6476
|
+
nativeCurrency: {
|
|
6477
|
+
symbol: "APE",
|
|
6478
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6479
|
+
},
|
|
6480
|
+
wrappedNativeCurrency: { address: "0x48b62137edfa95a428d35c09e44256a739f6b557" },
|
|
6481
|
+
offerCurrency: {
|
|
6482
|
+
symbol: "WAPE",
|
|
6483
|
+
address: "0x48b62137edfa95a428d35c09e44256a739f6b557"
|
|
6484
|
+
},
|
|
6485
|
+
listingCurrency: {
|
|
6486
|
+
symbol: "APE",
|
|
6487
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6488
|
+
}
|
|
6489
|
+
},
|
|
6490
|
+
"42161": {
|
|
6491
|
+
chainId: 42161,
|
|
6492
|
+
openseaId: "arbitrum",
|
|
6493
|
+
name: "Arbitrum",
|
|
6494
|
+
nativeCurrency: {
|
|
6495
|
+
symbol: "ETH",
|
|
6496
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6497
|
+
},
|
|
6498
|
+
wrappedNativeCurrency: { address: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" },
|
|
6499
|
+
offerCurrency: {
|
|
6500
|
+
symbol: "WETH",
|
|
6501
|
+
address: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"
|
|
6502
|
+
},
|
|
6503
|
+
listingCurrency: {
|
|
6504
|
+
symbol: "ETH",
|
|
6505
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6506
|
+
}
|
|
6507
|
+
},
|
|
6508
|
+
"42170": {
|
|
6509
|
+
chainId: 42170,
|
|
6510
|
+
openseaId: "arbitrum_nova",
|
|
6511
|
+
name: "Arbitrum Nova",
|
|
6512
|
+
nativeCurrency: {
|
|
6513
|
+
symbol: "ETH",
|
|
6514
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6515
|
+
},
|
|
6516
|
+
wrappedNativeCurrency: { address: "0x722e8bdd2ce80a4422e880164f2079488e115365" },
|
|
6517
|
+
offerCurrency: {
|
|
6518
|
+
symbol: "WETH",
|
|
6519
|
+
address: "0x722e8bdd2ce80a4422e880164f2079488e115365"
|
|
6520
|
+
},
|
|
6521
|
+
listingCurrency: {
|
|
6522
|
+
symbol: "ETH",
|
|
6523
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6524
|
+
}
|
|
6525
|
+
},
|
|
6526
|
+
"43114": {
|
|
6527
|
+
chainId: 43114,
|
|
6528
|
+
openseaId: "avalanche",
|
|
6529
|
+
name: "Avalanche",
|
|
6530
|
+
nativeCurrency: {
|
|
6531
|
+
symbol: "AVAX",
|
|
6532
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6533
|
+
},
|
|
6534
|
+
wrappedNativeCurrency: { address: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" },
|
|
6535
|
+
offerCurrency: {
|
|
6536
|
+
symbol: "WAVAX",
|
|
6537
|
+
address: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"
|
|
6538
|
+
},
|
|
6539
|
+
listingCurrency: {
|
|
6540
|
+
symbol: "AVAX",
|
|
6541
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6542
|
+
}
|
|
6543
|
+
},
|
|
6544
|
+
"43419": {
|
|
6545
|
+
chainId: 43419,
|
|
6546
|
+
openseaId: "gunzilla",
|
|
6547
|
+
name: "GUNZ",
|
|
6548
|
+
nativeCurrency: {
|
|
6549
|
+
symbol: "GUN",
|
|
6550
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6551
|
+
},
|
|
6552
|
+
wrappedNativeCurrency: { address: "0x5aad7bba61d95c2c4e525a35f4062040264611f1" },
|
|
6553
|
+
offerCurrency: {
|
|
6554
|
+
symbol: "WGUN",
|
|
6555
|
+
address: "0x5aad7bba61d95c2c4e525a35f4062040264611f1"
|
|
6556
|
+
},
|
|
6557
|
+
listingCurrency: {
|
|
6558
|
+
symbol: "GUN",
|
|
6559
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6560
|
+
}
|
|
6561
|
+
},
|
|
6562
|
+
"50311": {
|
|
6563
|
+
chainId: 50311,
|
|
6564
|
+
openseaId: "somnia",
|
|
6565
|
+
name: "Somnia",
|
|
6566
|
+
nativeCurrency: {
|
|
6567
|
+
symbol: "SOMI",
|
|
6568
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6569
|
+
},
|
|
6570
|
+
wrappedNativeCurrency: { address: "0x046ede9564a72571df6f5e44d0405360c0f4dcab" },
|
|
6571
|
+
offerCurrency: {
|
|
6572
|
+
symbol: "WSOMI",
|
|
6573
|
+
address: "0x046ede9564a72571df6f5e44d0405360c0f4dcab"
|
|
6574
|
+
},
|
|
6575
|
+
listingCurrency: {
|
|
6576
|
+
symbol: "SOMI",
|
|
6577
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6578
|
+
}
|
|
6579
|
+
},
|
|
6580
|
+
"80094": {
|
|
6581
|
+
chainId: 80094,
|
|
6582
|
+
openseaId: "bera_chain",
|
|
6583
|
+
name: "Berachain",
|
|
6584
|
+
nativeCurrency: {
|
|
6585
|
+
symbol: "BERA",
|
|
6586
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6587
|
+
},
|
|
6588
|
+
wrappedNativeCurrency: { address: "0x6969696969696969696969696969696969696969" },
|
|
6589
|
+
offerCurrency: {
|
|
6590
|
+
symbol: "WBERA",
|
|
6591
|
+
address: "0x6969696969696969696969696969696969696969"
|
|
6592
|
+
},
|
|
6593
|
+
listingCurrency: {
|
|
6594
|
+
symbol: "BERA",
|
|
6595
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6596
|
+
}
|
|
6597
|
+
},
|
|
6598
|
+
"81457": {
|
|
6599
|
+
chainId: 81457,
|
|
6600
|
+
openseaId: "blast",
|
|
6601
|
+
name: "Blast",
|
|
6602
|
+
nativeCurrency: {
|
|
6603
|
+
symbol: "ETH",
|
|
6604
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6605
|
+
},
|
|
6606
|
+
wrappedNativeCurrency: { address: "0x4300000000000000000000000000000000000004" },
|
|
6607
|
+
offerCurrency: {
|
|
6608
|
+
symbol: "WETH",
|
|
6609
|
+
address: "0x4300000000000000000000000000000000000004"
|
|
6610
|
+
},
|
|
6611
|
+
listingCurrency: {
|
|
6612
|
+
symbol: "ETH",
|
|
6613
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6614
|
+
}
|
|
6615
|
+
},
|
|
6616
|
+
"7777777": {
|
|
6617
|
+
chainId: 7777777,
|
|
6618
|
+
openseaId: "zora",
|
|
6619
|
+
name: "Zora",
|
|
6620
|
+
nativeCurrency: {
|
|
6621
|
+
symbol: "ETH",
|
|
6622
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6623
|
+
},
|
|
6624
|
+
wrappedNativeCurrency: { address: "0x4200000000000000000000000000000000000006" },
|
|
6625
|
+
offerCurrency: {
|
|
6626
|
+
symbol: "WETH",
|
|
6627
|
+
address: "0x4200000000000000000000000000000000000006"
|
|
6628
|
+
},
|
|
6629
|
+
listingCurrency: {
|
|
6630
|
+
symbol: "ETH",
|
|
6631
|
+
address: "0x0000000000000000000000000000000000000000"
|
|
6632
|
+
}
|
|
6633
|
+
}
|
|
6634
|
+
};
|
|
6635
|
+
function getOpenseaCurrencyForChain(chainId, modalType) {
|
|
6636
|
+
const config = OPENSEA_CHAIN_CURRENCIES[chainId.toString()];
|
|
6637
|
+
if (!config) return;
|
|
6638
|
+
return modalType === "listing" ? config.listingCurrency : config.offerCurrency;
|
|
6639
|
+
}
|
|
6640
|
+
|
|
5847
6641
|
//#endregion
|
|
5848
6642
|
//#region src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
5849
|
-
function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDefault, selectedCurrency, onCurrencyChange, includeNativeCurrency }) {
|
|
6643
|
+
function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDefault, selectedCurrency, onCurrencyChange, includeNativeCurrency, orderbookKind, modalType }) {
|
|
5850
6644
|
const { data: currencies, isLoading: currenciesLoading } = useMarketCurrencies({
|
|
5851
6645
|
chainId,
|
|
5852
6646
|
collectionAddress,
|
|
5853
6647
|
includeNativeCurrency
|
|
5854
6648
|
});
|
|
6649
|
+
let filteredCurrencies = currencies;
|
|
6650
|
+
if (currencies && orderbookKind === OrderbookKind.opensea && modalType) {
|
|
6651
|
+
const openseaCurrency = getOpenseaCurrencyForChain(chainId, modalType);
|
|
6652
|
+
if (openseaCurrency) filteredCurrencies = currencies.filter((currency) => compareAddress(currency.contractAddress, openseaCurrency.address));
|
|
6653
|
+
}
|
|
5855
6654
|
useEffect(() => {
|
|
5856
|
-
if (
|
|
5857
|
-
else onCurrencyChange(
|
|
6655
|
+
if (filteredCurrencies && filteredCurrencies.length > 0 && !selectedCurrency?.contractAddress) if (secondCurrencyAsDefault && filteredCurrencies.length > 1) onCurrencyChange(filteredCurrencies[1]);
|
|
6656
|
+
else onCurrencyChange(filteredCurrencies[0]);
|
|
5858
6657
|
}, [
|
|
5859
|
-
|
|
6658
|
+
filteredCurrencies,
|
|
5860
6659
|
selectedCurrency?.contractAddress,
|
|
5861
6660
|
secondCurrencyAsDefault,
|
|
5862
6661
|
onCurrencyChange
|
|
5863
6662
|
]);
|
|
5864
|
-
if (!
|
|
5865
|
-
const options =
|
|
6663
|
+
if (!filteredCurrencies || currenciesLoading || !selectedCurrency?.symbol) return /* @__PURE__ */ jsx(Skeleton, { className: "mr-3 h-7 w-20 rounded-2xl" });
|
|
6664
|
+
const options = filteredCurrencies.map((currency) => ({
|
|
5866
6665
|
label: currency.symbol,
|
|
5867
6666
|
value: currency.contractAddress,
|
|
5868
6667
|
content: currency.symbol
|
|
5869
6668
|
}));
|
|
5870
6669
|
const onChange = (value) => {
|
|
5871
|
-
const selectedCurrency$1 =
|
|
6670
|
+
const selectedCurrency$1 = filteredCurrencies.find((currency) => currency.contractAddress === value);
|
|
5872
6671
|
if (selectedCurrency$1) onCurrencyChange(selectedCurrency$1);
|
|
5873
6672
|
};
|
|
5874
6673
|
return /* @__PURE__ */ jsx(CustomSelect, {
|
|
@@ -5885,7 +6684,7 @@ var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
|
5885
6684
|
|
|
5886
6685
|
//#endregion
|
|
5887
6686
|
//#region src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
5888
|
-
function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurrencyChange, checkBalance, secondCurrencyAsDefault, includeNativeCurrency, disabled }) {
|
|
6687
|
+
function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurrencyChange, checkBalance, secondCurrencyAsDefault, includeNativeCurrency, disabled, orderbookKind, setOpenseaLowestPriceCriteriaMet, modalType }) {
|
|
5889
6688
|
const { address: accountAddress } = useAccount();
|
|
5890
6689
|
const inputRef = useRef(null);
|
|
5891
6690
|
const currency = price?.currency;
|
|
@@ -5895,6 +6694,12 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5895
6694
|
const handleCurrencyChange = (newCurrency) => {
|
|
5896
6695
|
if (price && onCurrencyChange) onCurrencyChange(newCurrency);
|
|
5897
6696
|
};
|
|
6697
|
+
const { data: conversion, isLoading: isConversionLoading } = useConvertPriceToUSD({
|
|
6698
|
+
chainId,
|
|
6699
|
+
currencyAddress,
|
|
6700
|
+
amountRaw: priceAmountRaw,
|
|
6701
|
+
query: { enabled: orderbookKind === OrderbookKind.opensea && !!currencyAddress && !!priceAmountRaw && !!setOpenseaLowestPriceCriteriaMet }
|
|
6702
|
+
});
|
|
5898
6703
|
useEffect(() => {
|
|
5899
6704
|
if (inputRef.current) inputRef.current.focus();
|
|
5900
6705
|
}, []);
|
|
@@ -5904,7 +6709,9 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5904
6709
|
userAddress: accountAddress
|
|
5905
6710
|
});
|
|
5906
6711
|
const balanceError = !!checkBalance?.enabled && !!isBalanceSuccess && !!priceAmountRaw && !!currencyDecimals && BigInt(priceAmountRaw) > BigInt(balance?.value || 0n);
|
|
6712
|
+
const openseaLowestPriceCriteriaMet = orderbookKind === OrderbookKind.opensea && !!conversion?.usdAmount && conversion.usdAmount >= .01;
|
|
5907
6713
|
if (checkBalance?.enabled) checkBalance.callback(balanceError);
|
|
6714
|
+
if (setOpenseaLowestPriceCriteriaMet) setOpenseaLowestPriceCriteriaMet(openseaLowestPriceCriteriaMet);
|
|
5908
6715
|
const [value, setValue] = useState("0");
|
|
5909
6716
|
const prevCurrencyDecimals = useRef(currencyDecimals);
|
|
5910
6717
|
useEffect(() => {
|
|
@@ -5949,17 +6756,17 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5949
6756
|
}
|
|
5950
6757
|
};
|
|
5951
6758
|
return /* @__PURE__ */ jsxs("div", {
|
|
5952
|
-
className: cn("price-input relative flex w-full flex-col", disabled && "pointer-events-none opacity-50"),
|
|
6759
|
+
className: cn$1("price-input relative flex w-full flex-col", disabled && "pointer-events-none opacity-50"),
|
|
5953
6760
|
children: [
|
|
5954
6761
|
/* @__PURE__ */ jsx("div", {
|
|
5955
6762
|
className: "absolute top-8 left-2 flex items-center",
|
|
5956
6763
|
children: /* @__PURE__ */ jsx(currencyImage_default, { price })
|
|
5957
6764
|
}),
|
|
5958
6765
|
/* @__PURE__ */ jsx("div", {
|
|
5959
|
-
className: "[&>label
|
|
6766
|
+
className: "[&>label]:gap-1",
|
|
5960
6767
|
children: /* @__PURE__ */ jsx(NumericInput, {
|
|
5961
6768
|
ref: inputRef,
|
|
5962
|
-
className: "
|
|
6769
|
+
className: "h-9 w-full rounded-sm px-2 [&>input]:pl-5 [&>input]:text-xs",
|
|
5963
6770
|
name: "price-input",
|
|
5964
6771
|
decimals: currencyDecimals,
|
|
5965
6772
|
label: "Enter price",
|
|
@@ -5970,7 +6777,9 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5970
6777
|
collectionAddress,
|
|
5971
6778
|
chainId,
|
|
5972
6779
|
secondCurrencyAsDefault,
|
|
5973
|
-
includeNativeCurrency
|
|
6780
|
+
includeNativeCurrency,
|
|
6781
|
+
orderbookKind,
|
|
6782
|
+
modalType
|
|
5974
6783
|
}),
|
|
5975
6784
|
value,
|
|
5976
6785
|
onChange: handleChange
|
|
@@ -5980,6 +6789,11 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
5980
6789
|
className: "-bottom-5 absolute font-body font-medium text-xs",
|
|
5981
6790
|
color: "negative",
|
|
5982
6791
|
children: "Insufficient balance"
|
|
6792
|
+
}),
|
|
6793
|
+
!balanceError && priceAmountRaw !== "0" && !openseaLowestPriceCriteriaMet && orderbookKind === OrderbookKind.opensea && !isConversionLoading && modalType === "offer" && /* @__PURE__ */ jsx(Text, {
|
|
6794
|
+
className: "-bottom-5 absolute font-body font-medium text-xs",
|
|
6795
|
+
color: "negative",
|
|
6796
|
+
children: "Lowest price must be at least $0.01"
|
|
5983
6797
|
})
|
|
5984
6798
|
]
|
|
5985
6799
|
});
|
|
@@ -6201,7 +7015,7 @@ const SelectWaasFeeOptions = ({ chainId, onCancel, titleOnConfirm, className })
|
|
|
6201
7015
|
const isSponsored = pendingFeeOptionConfirmation?.options?.length === 0;
|
|
6202
7016
|
if (!isVisible || isSponsored || !selectedFeeOption) return null;
|
|
6203
7017
|
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),
|
|
7018
|
+
className: cn$1("flex w-full flex-col gap-2 rounded-2xl bg-button-emphasis p-0 backdrop-blur-md", className),
|
|
6205
7019
|
children: [
|
|
6206
7020
|
/* @__PURE__ */ jsx(Divider, { className: "mt-0 mb-4" }),
|
|
6207
7021
|
/* @__PURE__ */ jsx(Text, {
|
|
@@ -6210,7 +7024,7 @@ const SelectWaasFeeOptions = ({ chainId, onCancel, titleOnConfirm, className })
|
|
|
6210
7024
|
}),
|
|
6211
7025
|
!feeOptionsConfirmed && !pendingFeeOptionConfirmation && /* @__PURE__ */ jsx(Skeleton, { className: "h-[52px] w-full animate-shimmer rounded-xl" }),
|
|
6212
7026
|
(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"),
|
|
7027
|
+
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
7028
|
children: /* @__PURE__ */ jsx(WaasFeeOptionsSelect_default, {
|
|
6215
7029
|
options: pendingFeeOptionConfirmation?.options || [selectedFeeOption],
|
|
6216
7030
|
selectedFeeOption,
|
|
@@ -6286,14 +7100,36 @@ function TransactionDetails({ collectibleId, collectionAddress, chainId, include
|
|
|
6286
7100
|
collectionAddress,
|
|
6287
7101
|
collectibleId
|
|
6288
7102
|
});
|
|
7103
|
+
const [overflow, setOverflow] = useState({
|
|
7104
|
+
status: false,
|
|
7105
|
+
amount: "0"
|
|
7106
|
+
});
|
|
6289
7107
|
const priceLoading = !price || marketplaceConfigLoading || royaltyLoading;
|
|
6290
|
-
|
|
6291
|
-
|
|
7108
|
+
const [formattedAmount, setFormattedAmount] = useState("0");
|
|
7109
|
+
useEffect(() => {
|
|
7110
|
+
if (!price || royaltyLoading || marketplaceConfigLoading) return;
|
|
6292
7111
|
const fees = [];
|
|
6293
7112
|
if (royalty !== null) fees.push(Number(royalty.percentage));
|
|
6294
7113
|
if (marketplaceFeePercentage > 0) fees.push(marketplaceFeePercentage);
|
|
6295
|
-
|
|
6296
|
-
|
|
7114
|
+
const newFormattedAmount = calculateEarningsAfterFees(BigInt(price.amountRaw), price.currency.decimals, fees);
|
|
7115
|
+
setFormattedAmount(newFormattedAmount);
|
|
7116
|
+
}, [
|
|
7117
|
+
price,
|
|
7118
|
+
royalty,
|
|
7119
|
+
marketplaceFeePercentage,
|
|
7120
|
+
royaltyLoading,
|
|
7121
|
+
marketplaceConfigLoading
|
|
7122
|
+
]);
|
|
7123
|
+
useEffect(() => {
|
|
7124
|
+
if (formattedAmount.length > 15) setOverflow((prev) => prev.status ? prev : {
|
|
7125
|
+
status: true,
|
|
7126
|
+
amount: formattedAmount.slice(0, 15)
|
|
7127
|
+
});
|
|
7128
|
+
else setOverflow({
|
|
7129
|
+
status: false,
|
|
7130
|
+
amount: formattedAmount
|
|
7131
|
+
});
|
|
7132
|
+
}, [formattedAmount]);
|
|
6297
7133
|
return /* @__PURE__ */ jsxs("div", {
|
|
6298
7134
|
className: "flex w-full items-center justify-between",
|
|
6299
7135
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
@@ -6305,14 +7141,36 @@ function TransactionDetails({ collectibleId, collectionAddress, chainId, include
|
|
|
6305
7141
|
children: [/* @__PURE__ */ jsx(Image, {
|
|
6306
7142
|
className: "h-3 w-3",
|
|
6307
7143
|
src: currencyImageUrl
|
|
6308
|
-
}), priceLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 animate-shimmer" }) : /* @__PURE__ */
|
|
7144
|
+
}), priceLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 animate-shimmer" }) : /* @__PURE__ */ jsx(Text, {
|
|
6309
7145
|
className: "font-body font-medium text-xs",
|
|
6310
7146
|
color: "text100",
|
|
6311
|
-
children:
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
price.currency.symbol
|
|
6315
|
-
|
|
7147
|
+
children: showPlaceholderPrice ? /* @__PURE__ */ jsxs(Text, {
|
|
7148
|
+
className: "font-body font-medium text-xs",
|
|
7149
|
+
color: "text100",
|
|
7150
|
+
children: ["0 ", price.currency.symbol]
|
|
7151
|
+
}) : overflow.status ? /* @__PURE__ */ jsx(Tooltip, {
|
|
7152
|
+
message: formattedAmount + " " + price.currency.symbol,
|
|
7153
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
7154
|
+
className: "flex items-center",
|
|
7155
|
+
children: [/* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3 text-text-100" }), /* @__PURE__ */ jsxs(Text, {
|
|
7156
|
+
className: "font-body font-medium text-xs",
|
|
7157
|
+
color: "text100",
|
|
7158
|
+
children: [
|
|
7159
|
+
overflow.amount,
|
|
7160
|
+
" ",
|
|
7161
|
+
price.currency.symbol
|
|
7162
|
+
]
|
|
7163
|
+
})]
|
|
7164
|
+
})
|
|
7165
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
7166
|
+
className: "font-body font-medium text-xs",
|
|
7167
|
+
color: "text100",
|
|
7168
|
+
children: [
|
|
7169
|
+
formattedAmount,
|
|
7170
|
+
" ",
|
|
7171
|
+
price.currency.symbol
|
|
7172
|
+
]
|
|
7173
|
+
})
|
|
6316
7174
|
})]
|
|
6317
7175
|
})]
|
|
6318
7176
|
});
|
|
@@ -6355,7 +7213,7 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6355
7213
|
expiry: String(Number(dateToUnixTime(/* @__PURE__ */ new Date())) + ONE_DAY_IN_SECONDS$1)
|
|
6356
7214
|
};
|
|
6357
7215
|
const isEnabled = address && (params.query?.enabled ?? true) && !!params.currencyAddress;
|
|
6358
|
-
const { data, isLoading, isSuccess } = useQuery({
|
|
7216
|
+
const { data, isLoading, isSuccess, isError, error } = useQuery({
|
|
6359
7217
|
queryKey: [
|
|
6360
7218
|
"token-approval-data",
|
|
6361
7219
|
params,
|
|
@@ -6369,10 +7227,10 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6369
7227
|
walletType: walletKind,
|
|
6370
7228
|
contractType: params.contractType,
|
|
6371
7229
|
orderbook: params.orderbook,
|
|
6372
|
-
listing
|
|
7230
|
+
listing,
|
|
7231
|
+
additionalFees: []
|
|
6373
7232
|
};
|
|
6374
|
-
const
|
|
6375
|
-
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
7233
|
+
const tokenApprovalStep = (await marketplaceClient.generateListingTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
6376
7234
|
if (!tokenApprovalStep) return { step: null };
|
|
6377
7235
|
return { step: tokenApprovalStep };
|
|
6378
7236
|
} : skipToken
|
|
@@ -6380,7 +7238,9 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6380
7238
|
return {
|
|
6381
7239
|
data,
|
|
6382
7240
|
isLoading,
|
|
6383
|
-
isSuccess
|
|
7241
|
+
isSuccess,
|
|
7242
|
+
isError,
|
|
7243
|
+
error
|
|
6384
7244
|
};
|
|
6385
7245
|
};
|
|
6386
7246
|
|
|
@@ -6389,13 +7249,12 @@ const useGetTokenApprovalData$2 = (params) => {
|
|
|
6389
7249
|
const getSequenceMarketplaceRequestId = async (hash, publicClient, walletAddress) => {
|
|
6390
7250
|
try {
|
|
6391
7251
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
6392
|
-
|
|
7252
|
+
return parseEventLogs({
|
|
6393
7253
|
abi: SequenceMarketplaceV1_ABI,
|
|
6394
7254
|
eventName: "RequestCreated",
|
|
6395
7255
|
args: { creator: walletAddress },
|
|
6396
7256
|
logs: receipt.logs
|
|
6397
|
-
});
|
|
6398
|
-
return logs[0].args.requestId.toString();
|
|
7257
|
+
})[0].args.requestId.toString();
|
|
6399
7258
|
} catch (error) {
|
|
6400
7259
|
console.error(error);
|
|
6401
7260
|
}
|
|
@@ -6422,7 +7281,7 @@ const useTransactionSteps$2 = ({ listingInput, chainId, collectionAddress, order
|
|
|
6422
7281
|
const getListingSteps = async () => {
|
|
6423
7282
|
if (!address) return;
|
|
6424
7283
|
try {
|
|
6425
|
-
|
|
7284
|
+
return await generateListingTransactionAsync({
|
|
6426
7285
|
collectionAddress,
|
|
6427
7286
|
owner: address,
|
|
6428
7287
|
walletType: walletKind,
|
|
@@ -6431,9 +7290,9 @@ const useTransactionSteps$2 = ({ listingInput, chainId, collectionAddress, order
|
|
|
6431
7290
|
listing: {
|
|
6432
7291
|
...listingInput.listing,
|
|
6433
7292
|
expiry: /* @__PURE__ */ new Date(Number(listingInput.listing.expiry) * 1e3)
|
|
6434
|
-
}
|
|
7293
|
+
},
|
|
7294
|
+
additionalFees: []
|
|
6435
7295
|
});
|
|
6436
|
-
return steps$2;
|
|
6437
7296
|
} catch (error) {
|
|
6438
7297
|
if (callbacks?.onError) callbacks.onError(error);
|
|
6439
7298
|
else console.debug("onError callback not provided:", error);
|
|
@@ -6548,7 +7407,7 @@ const useCreateListing = ({ listingInput, chainId, collectionAddress, orderbookK
|
|
|
6548
7407
|
const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
|
|
6549
7408
|
const collectionConfig = marketplaceConfig?.market.collections.find((c) => compareAddress(c.itemsAddress, collectionAddress));
|
|
6550
7409
|
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? OrderbookKind.sequence_marketplace_v2;
|
|
6551
|
-
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData$2({
|
|
7410
|
+
const { data: tokenApproval, isLoading: tokenApprovalIsLoading, isError, error } = useGetTokenApprovalData$2({
|
|
6552
7411
|
chainId,
|
|
6553
7412
|
tokenId: listingInput.listing.tokenId,
|
|
6554
7413
|
collectionAddress,
|
|
@@ -6574,7 +7433,9 @@ const useCreateListing = ({ listingInput, chainId, collectionAddress, orderbookK
|
|
|
6574
7433
|
executeApproval,
|
|
6575
7434
|
createListing,
|
|
6576
7435
|
tokenApprovalStepExists: tokenApproval?.step !== null,
|
|
6577
|
-
tokenApprovalIsLoading
|
|
7436
|
+
tokenApprovalIsLoading,
|
|
7437
|
+
isError,
|
|
7438
|
+
error
|
|
6578
7439
|
};
|
|
6579
7440
|
};
|
|
6580
7441
|
|
|
@@ -6650,8 +7511,11 @@ const CreateListingModal = () => {
|
|
|
6650
7511
|
});
|
|
6651
7512
|
};
|
|
6652
7513
|
const Modal$3 = observer(() => {
|
|
6653
|
-
const
|
|
6654
|
-
const {
|
|
7514
|
+
const { collectionAddress, chainId, listingPrice: listingPrice$1, collectibleId, orderbookKind: orderbookKindProp, callbacks, listingIsBeingProcessed } = createListingModal$.get();
|
|
7515
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
7516
|
+
const [error, setError] = useState(void 0);
|
|
7517
|
+
const collectionConfig = marketplaceConfig?.market.collections.find((c) => c.itemsAddress === collectionAddress);
|
|
7518
|
+
const orderbookKind = orderbookKindProp ?? collectionConfig?.destinationMarketplace;
|
|
6655
7519
|
const steps$ = createListingModal$.steps;
|
|
6656
7520
|
const { isWaaS } = useConnectorMetadata();
|
|
6657
7521
|
const { isVisible: feeOptionsVisible, selectedFeeOption } = useSelectWaasFeeOptionsStore();
|
|
@@ -6683,7 +7547,7 @@ const Modal$3 = observer(() => {
|
|
|
6683
7547
|
userAddress: address ?? void 0
|
|
6684
7548
|
});
|
|
6685
7549
|
const balanceWithDecimals = balance?.balance ? dn.toNumber(dn.from([BigInt(balance.balance), collectible?.decimals || 0])) : 0;
|
|
6686
|
-
const { isLoading, executeApproval, createListing, tokenApprovalIsLoading } = useCreateListing({
|
|
7550
|
+
const { isLoading, executeApproval, createListing, tokenApprovalIsLoading, isError: tokenApprovalIsError } = useCreateListing({
|
|
6687
7551
|
listingInput: {
|
|
6688
7552
|
contractType: collection?.type,
|
|
6689
7553
|
listing: {
|
|
@@ -6701,7 +7565,7 @@ const Modal$3 = observer(() => {
|
|
|
6701
7565
|
closeMainModal: () => createListingModal$.close(),
|
|
6702
7566
|
steps$
|
|
6703
7567
|
});
|
|
6704
|
-
if (collectableIsError || collectionIsError || currenciesIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7568
|
+
if (collectableIsError || collectionIsError || currenciesIsError || tokenApprovalIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
6705
7569
|
isOpen: createListingModal$.isOpen.get(),
|
|
6706
7570
|
chainId: Number(chainId),
|
|
6707
7571
|
onClose: createListingModal$.close,
|
|
@@ -6719,17 +7583,24 @@ const Modal$3 = observer(() => {
|
|
|
6719
7583
|
try {
|
|
6720
7584
|
if (isWaaS) selectWaasFeeOptionsStore.send({ type: "show" });
|
|
6721
7585
|
await createListing({ isTransactionExecuting: !!isWaaS });
|
|
6722
|
-
} catch (error) {
|
|
6723
|
-
console.error("Create listing failed:", error);
|
|
7586
|
+
} catch (error$1) {
|
|
7587
|
+
console.error("Create listing failed:", error$1);
|
|
7588
|
+
setError(error$1);
|
|
6724
7589
|
} finally {
|
|
6725
7590
|
createListingModal$.listingIsBeingProcessed.set(false);
|
|
6726
7591
|
steps$.transaction.isExecuting.set(false);
|
|
6727
7592
|
}
|
|
6728
7593
|
};
|
|
7594
|
+
const handleApproveToken = async () => {
|
|
7595
|
+
await executeApproval().catch((error$1) => {
|
|
7596
|
+
console.error("Approve TOKEN failed:", error$1);
|
|
7597
|
+
setError(error$1);
|
|
7598
|
+
});
|
|
7599
|
+
};
|
|
6729
7600
|
const listCtaLabel = getActionLabel("List item for sale");
|
|
6730
7601
|
const ctas = [{
|
|
6731
7602
|
label: "Approve TOKEN",
|
|
6732
|
-
onClick:
|
|
7603
|
+
onClick: handleApproveToken,
|
|
6733
7604
|
hidden: !steps$.approval.exist.get(),
|
|
6734
7605
|
pending: steps$?.approval.isExecuting.get(),
|
|
6735
7606
|
variant: "glass",
|
|
@@ -6772,7 +7643,9 @@ const Modal$3 = observer(() => {
|
|
|
6772
7643
|
onCurrencyChange: (newCurrency) => {
|
|
6773
7644
|
createListingModal$.listingPrice.currency.set(newCurrency);
|
|
6774
7645
|
},
|
|
6775
|
-
disabled: shouldHideListButton
|
|
7646
|
+
disabled: shouldHideListButton,
|
|
7647
|
+
orderbookKind,
|
|
7648
|
+
modalType: "listing"
|
|
6776
7649
|
}), listingPrice$1.amountRaw !== "0" && /* @__PURE__ */ jsx(FloorPriceText, {
|
|
6777
7650
|
tokenId: collectibleId,
|
|
6778
7651
|
chainId,
|
|
@@ -6809,6 +7682,11 @@ const Modal$3 = observer(() => {
|
|
|
6809
7682
|
steps$.transaction.isExecuting.set(false);
|
|
6810
7683
|
},
|
|
6811
7684
|
titleOnConfirm: "Processing listing..."
|
|
7685
|
+
}),
|
|
7686
|
+
error && /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
7687
|
+
title: "An error occurred while listing",
|
|
7688
|
+
message: "Please try again",
|
|
7689
|
+
error
|
|
6812
7690
|
})
|
|
6813
7691
|
]
|
|
6814
7692
|
});
|
|
@@ -6845,7 +7723,7 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6845
7723
|
expiry: String(Number(dateToUnixTime(/* @__PURE__ */ new Date())) + ONE_DAY_IN_SECONDS)
|
|
6846
7724
|
};
|
|
6847
7725
|
const isEnabled = address && params.query?.enabled !== false;
|
|
6848
|
-
const { data, isLoading, isSuccess } = useQuery({
|
|
7726
|
+
const { data, isLoading, isSuccess, isError, error } = useQuery({
|
|
6849
7727
|
queryKey: ["token-approval-data", params.currencyAddress],
|
|
6850
7728
|
queryFn: isEnabled ? async () => {
|
|
6851
7729
|
const args = {
|
|
@@ -6855,10 +7733,10 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6855
7733
|
walletType: walletKind,
|
|
6856
7734
|
contractType: params.contractType,
|
|
6857
7735
|
orderbook: params.orderbook,
|
|
6858
|
-
offer
|
|
7736
|
+
offer,
|
|
7737
|
+
additionalFees: []
|
|
6859
7738
|
};
|
|
6860
|
-
const
|
|
6861
|
-
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
7739
|
+
const tokenApprovalStep = (await marketplaceClient.generateOfferTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
6862
7740
|
if (!tokenApprovalStep) return { step: null };
|
|
6863
7741
|
return { step: tokenApprovalStep };
|
|
6864
7742
|
} : skipToken,
|
|
@@ -6867,7 +7745,9 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
6867
7745
|
return {
|
|
6868
7746
|
data,
|
|
6869
7747
|
isLoading,
|
|
6870
|
-
isSuccess
|
|
7748
|
+
isSuccess,
|
|
7749
|
+
isError,
|
|
7750
|
+
error
|
|
6871
7751
|
};
|
|
6872
7752
|
};
|
|
6873
7753
|
|
|
@@ -6894,7 +7774,7 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6894
7774
|
const getOfferSteps = async () => {
|
|
6895
7775
|
if (!address) return;
|
|
6896
7776
|
try {
|
|
6897
|
-
|
|
7777
|
+
return await generateOfferTransactionAsync({
|
|
6898
7778
|
collectionAddress,
|
|
6899
7779
|
maker: address,
|
|
6900
7780
|
walletType: walletKind,
|
|
@@ -6903,9 +7783,9 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
6903
7783
|
offer: {
|
|
6904
7784
|
...offerInput.offer,
|
|
6905
7785
|
expiry: /* @__PURE__ */ new Date(Number(offerInput.offer.expiry) * 1e3)
|
|
6906
|
-
}
|
|
7786
|
+
},
|
|
7787
|
+
additionalFees: []
|
|
6907
7788
|
});
|
|
6908
|
-
return steps$2;
|
|
6909
7789
|
} catch (error) {
|
|
6910
7790
|
if (callbacks?.onError) callbacks.onError(error);
|
|
6911
7791
|
else console.debug("onError callback not provided:", error);
|
|
@@ -7009,17 +7889,13 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
7009
7889
|
//#endregion
|
|
7010
7890
|
//#region src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx
|
|
7011
7891
|
const useMakeOffer = ({ offerInput, chainId, collectionAddress, orderbookKind, callbacks, closeMainModal, steps$ }) => {
|
|
7012
|
-
const { data:
|
|
7013
|
-
const collectionConfig = marketplaceConfig?.market.collections.find((c) => c.itemsAddress === collectionAddress);
|
|
7014
|
-
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? OrderbookKind.sequence_marketplace_v2;
|
|
7015
|
-
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData$1({
|
|
7892
|
+
const { data: tokenApproval, isLoading: tokenApprovalIsLoading, isError, error } = useGetTokenApprovalData$1({
|
|
7016
7893
|
chainId,
|
|
7017
7894
|
tokenId: offerInput.offer.tokenId,
|
|
7018
7895
|
collectionAddress,
|
|
7019
7896
|
currencyAddress: offerInput.offer.currencyAddress,
|
|
7020
7897
|
contractType: offerInput.contractType,
|
|
7021
|
-
orderbook: orderbookKind
|
|
7022
|
-
query: { enabled: !marketplaceIsLoading }
|
|
7898
|
+
orderbook: orderbookKind || OrderbookKind.sequence_marketplace_v2
|
|
7023
7899
|
});
|
|
7024
7900
|
useEffect(() => {
|
|
7025
7901
|
if (!tokenApprovalIsLoading) steps$.approval.exist.set(!!tokenApproval?.step);
|
|
@@ -7038,7 +7914,9 @@ const useMakeOffer = ({ offerInput, chainId, collectionAddress, orderbookKind, c
|
|
|
7038
7914
|
executeApproval,
|
|
7039
7915
|
makeOffer,
|
|
7040
7916
|
tokenApprovalStepExists: tokenApproval?.step !== null,
|
|
7041
|
-
tokenApprovalIsLoading
|
|
7917
|
+
tokenApprovalIsLoading,
|
|
7918
|
+
isError,
|
|
7919
|
+
error
|
|
7042
7920
|
};
|
|
7043
7921
|
};
|
|
7044
7922
|
|
|
@@ -7112,10 +7990,14 @@ const MakeOfferModal = () => {
|
|
|
7112
7990
|
});
|
|
7113
7991
|
};
|
|
7114
7992
|
const Modal$2 = observer(() => {
|
|
7115
|
-
const
|
|
7116
|
-
const {
|
|
7993
|
+
const { collectionAddress, chainId, offerPrice: offerPrice$1, offerPriceChanged, invalidQuantity, collectibleId, orderbookKind: orderbookKindProp, callbacks } = makeOfferModal$.get();
|
|
7994
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
7995
|
+
const [error, setError] = useState(void 0);
|
|
7996
|
+
const collectionConfig = marketplaceConfig?.market.collections.find((c) => c.itemsAddress === collectionAddress);
|
|
7997
|
+
const orderbookKind = orderbookKindProp ?? collectionConfig?.destinationMarketplace;
|
|
7117
7998
|
const steps$ = makeOfferModal$.steps;
|
|
7118
7999
|
const [insufficientBalance, setInsufficientBalance] = useState(false);
|
|
8000
|
+
const [openseaLowestPriceCriteriaMet, setOpenseaLowestPriceCriteriaMet] = useState(true);
|
|
7119
8001
|
const { data: collectible, isLoading: collectableIsLoading, isError: collectableIsError } = useCollectible({
|
|
7120
8002
|
chainId,
|
|
7121
8003
|
collectionAddress,
|
|
@@ -7138,7 +8020,7 @@ const Modal$2 = observer(() => {
|
|
|
7138
8020
|
includeNativeCurrency: false
|
|
7139
8021
|
});
|
|
7140
8022
|
const modalLoading = collectableIsLoading || collectionIsLoading || currenciesLoading;
|
|
7141
|
-
const { isLoading, executeApproval, makeOffer } = useMakeOffer({
|
|
8023
|
+
const { isLoading, executeApproval, makeOffer, isError: approvalIsError } = useMakeOffer({
|
|
7142
8024
|
offerInput: {
|
|
7143
8025
|
contractType: collection?.type,
|
|
7144
8026
|
offer: {
|
|
@@ -7151,8 +8033,8 @@ const Modal$2 = observer(() => {
|
|
|
7151
8033
|
},
|
|
7152
8034
|
chainId,
|
|
7153
8035
|
collectionAddress,
|
|
7154
|
-
orderbookKind,
|
|
7155
8036
|
callbacks,
|
|
8037
|
+
orderbookKind,
|
|
7156
8038
|
closeMainModal: () => makeOfferModal$.close(),
|
|
7157
8039
|
steps$
|
|
7158
8040
|
});
|
|
@@ -7163,7 +8045,7 @@ const Modal$2 = observer(() => {
|
|
|
7163
8045
|
collectionAddress,
|
|
7164
8046
|
filter: { currencies: [offerPrice$1.currency.contractAddress] }
|
|
7165
8047
|
});
|
|
7166
|
-
if (collectableIsError || collectionIsError || currenciesIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
8048
|
+
if (collectableIsError || collectionIsError || currenciesIsError || approvalIsError) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7167
8049
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
7168
8050
|
chainId: Number(chainId),
|
|
7169
8051
|
onClose: makeOfferModal$.close,
|
|
@@ -7181,28 +8063,35 @@ const Modal$2 = observer(() => {
|
|
|
7181
8063
|
try {
|
|
7182
8064
|
if (isWaaS) selectWaasFeeOptionsStore.send({ type: "show" });
|
|
7183
8065
|
await makeOffer({ isTransactionExecuting: isWaaS ? getNetwork(Number(chainId)).type !== NetworkType.TESTNET : false });
|
|
7184
|
-
} catch (error) {
|
|
7185
|
-
console.error("Make offer failed:", error);
|
|
8066
|
+
} catch (error$1) {
|
|
8067
|
+
console.error("Make offer failed:", error$1);
|
|
8068
|
+
setError(error$1);
|
|
7186
8069
|
} finally {
|
|
7187
8070
|
makeOfferModal$.offerIsBeingProcessed.set(false);
|
|
7188
8071
|
steps$.transaction.isExecuting.set(false);
|
|
7189
8072
|
}
|
|
7190
8073
|
};
|
|
8074
|
+
const handleApproveToken = async () => {
|
|
8075
|
+
await executeApproval().catch((error$1) => {
|
|
8076
|
+
console.error("Approve TOKEN failed:", error$1);
|
|
8077
|
+
setError(error$1);
|
|
8078
|
+
});
|
|
8079
|
+
};
|
|
7191
8080
|
const offerCtaLabel = getActionLabel("Make offer");
|
|
7192
8081
|
const ctas = [{
|
|
7193
8082
|
label: "Approve TOKEN",
|
|
7194
|
-
onClick:
|
|
8083
|
+
onClick: handleApproveToken,
|
|
7195
8084
|
hidden: !steps$.approval.exist.get(),
|
|
7196
8085
|
pending: steps$.approval.isExecuting.get(),
|
|
7197
8086
|
variant: "glass",
|
|
7198
|
-
disabled: invalidQuantity || isLoading || insufficientBalance || offerPrice$1.amountRaw === "0" || !offerPriceChanged
|
|
8087
|
+
disabled: invalidQuantity || isLoading || insufficientBalance || offerPrice$1.amountRaw === "0" || !offerPriceChanged || orderbookKind === OrderbookKind.opensea && !openseaLowestPriceCriteriaMet
|
|
7199
8088
|
}, {
|
|
7200
8089
|
label: offerCtaLabel,
|
|
7201
8090
|
onClick: () => handleMakeOffer(),
|
|
7202
8091
|
pending: steps$?.transaction.isExecuting.get() || makeOfferModal$.offerIsBeingProcessed.get(),
|
|
7203
|
-
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice$1.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity
|
|
8092
|
+
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice$1.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity || orderbookKind === OrderbookKind.opensea && !openseaLowestPriceCriteriaMet
|
|
7204
8093
|
}];
|
|
7205
|
-
return /* @__PURE__ */
|
|
8094
|
+
return /* @__PURE__ */ jsxs(ActionModal, {
|
|
7206
8095
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
7207
8096
|
chainId: Number(chainId),
|
|
7208
8097
|
onClose: () => {
|
|
@@ -7236,8 +8125,11 @@ const Modal$2 = observer(() => {
|
|
|
7236
8125
|
includeNativeCurrency: false,
|
|
7237
8126
|
checkBalance: {
|
|
7238
8127
|
enabled: true,
|
|
7239
|
-
callback: (state
|
|
8128
|
+
callback: (state) => setInsufficientBalance(state)
|
|
7240
8129
|
},
|
|
8130
|
+
setOpenseaLowestPriceCriteriaMet: (state) => setOpenseaLowestPriceCriteriaMet(state),
|
|
8131
|
+
orderbookKind,
|
|
8132
|
+
modalType: "offer",
|
|
7241
8133
|
disabled: shouldHideOfferButton
|
|
7242
8134
|
}),
|
|
7243
8135
|
collection?.type === ContractType.ERC1155 && /* @__PURE__ */ jsx(QuantityInput, {
|
|
@@ -7277,9 +8169,14 @@ const Modal$2 = observer(() => {
|
|
|
7277
8169
|
steps$.transaction.isExecuting.set(false);
|
|
7278
8170
|
},
|
|
7279
8171
|
titleOnConfirm: "Processing offer..."
|
|
8172
|
+
}),
|
|
8173
|
+
error && /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
8174
|
+
title: "An error occurred while making an offer",
|
|
8175
|
+
message: "Please try again",
|
|
8176
|
+
error
|
|
7280
8177
|
})
|
|
7281
8178
|
]
|
|
7282
|
-
})
|
|
8179
|
+
});
|
|
7283
8180
|
});
|
|
7284
8181
|
|
|
7285
8182
|
//#endregion
|
|
@@ -7319,7 +8216,7 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7319
8216
|
chainId: Number(params.chainId),
|
|
7320
8217
|
collectionAddress: params.collectionAddress
|
|
7321
8218
|
});
|
|
7322
|
-
const { data, isLoading, isSuccess } = useQuery({
|
|
8219
|
+
const { data, isLoading, isSuccess, isError, error } = useQuery({
|
|
7323
8220
|
queryKey: ["token-approval-data", params.ordersData],
|
|
7324
8221
|
queryFn: address ? async () => {
|
|
7325
8222
|
const args = {
|
|
@@ -7334,8 +8231,7 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7334
8231
|
receiver
|
|
7335
8232
|
}]
|
|
7336
8233
|
};
|
|
7337
|
-
const
|
|
7338
|
-
const tokenApprovalStep = steps$2.find((step) => step.id === StepType.tokenApproval);
|
|
8234
|
+
const tokenApprovalStep = (await marketplaceClient.generateSellTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
7339
8235
|
if (!tokenApprovalStep) return { step: null };
|
|
7340
8236
|
return { step: tokenApprovalStep };
|
|
7341
8237
|
} : skipToken,
|
|
@@ -7344,7 +8240,9 @@ const useGetTokenApprovalData = (params) => {
|
|
|
7344
8240
|
return {
|
|
7345
8241
|
data,
|
|
7346
8242
|
isLoading,
|
|
7347
|
-
isSuccess
|
|
8243
|
+
isSuccess,
|
|
8244
|
+
isError,
|
|
8245
|
+
error
|
|
7348
8246
|
};
|
|
7349
8247
|
};
|
|
7350
8248
|
|
|
@@ -7371,7 +8269,7 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7371
8269
|
const getSellSteps = async () => {
|
|
7372
8270
|
if (!address) return;
|
|
7373
8271
|
try {
|
|
7374
|
-
|
|
8272
|
+
return await generateSellTransactionAsync({
|
|
7375
8273
|
collectionAddress,
|
|
7376
8274
|
walletType: walletKind,
|
|
7377
8275
|
marketplace,
|
|
@@ -7382,7 +8280,6 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7382
8280
|
}],
|
|
7383
8281
|
seller: address
|
|
7384
8282
|
});
|
|
7385
|
-
return steps$2;
|
|
7386
8283
|
} catch (error) {
|
|
7387
8284
|
if (callbacks?.onError) callbacks.onError(error);
|
|
7388
8285
|
else console.debug("onError callback not provided:", error);
|
|
@@ -7492,7 +8389,7 @@ const useTransactionSteps = ({ collectibleId, chainId, collectionAddress, market
|
|
|
7492
8389
|
//#endregion
|
|
7493
8390
|
//#region src/react/ui/modals/SellModal/hooks/useSell.tsx
|
|
7494
8391
|
const useSell = ({ collectibleId, chainId, collectionAddress, marketplace, ordersData, callbacks, closeMainModal, steps$ }) => {
|
|
7495
|
-
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData({
|
|
8392
|
+
const { data: tokenApproval, isLoading: tokenApprovalIsLoading, isError, error } = useGetTokenApprovalData({
|
|
7496
8393
|
chainId,
|
|
7497
8394
|
collectionAddress,
|
|
7498
8395
|
ordersData,
|
|
@@ -7516,7 +8413,9 @@ const useSell = ({ collectibleId, chainId, collectionAddress, marketplace, order
|
|
|
7516
8413
|
executeApproval,
|
|
7517
8414
|
sell,
|
|
7518
8415
|
tokenApprovalStepExists: tokenApproval?.step !== null,
|
|
7519
|
-
tokenApprovalIsLoading
|
|
8416
|
+
tokenApprovalIsLoading,
|
|
8417
|
+
isError,
|
|
8418
|
+
error
|
|
7520
8419
|
};
|
|
7521
8420
|
};
|
|
7522
8421
|
|
|
@@ -7535,6 +8434,7 @@ const Modal$1 = observer(() => {
|
|
|
7535
8434
|
chainId,
|
|
7536
8435
|
collectionAddress
|
|
7537
8436
|
});
|
|
8437
|
+
const [error, setError] = useState(void 0);
|
|
7538
8438
|
const { data: collection, isLoading: collectionLoading, isError: collectionError } = useCollection({
|
|
7539
8439
|
chainId,
|
|
7540
8440
|
collectionAddress
|
|
@@ -7545,15 +8445,14 @@ const Modal$1 = observer(() => {
|
|
|
7545
8445
|
});
|
|
7546
8446
|
const { isWaaS } = useConnectorMetadata();
|
|
7547
8447
|
const { isVisible: feeOptionsVisible, selectedFeeOption } = useSelectWaasFeeOptionsStore();
|
|
7548
|
-
const
|
|
7549
|
-
const isTestnet = network.type === NetworkType.TESTNET;
|
|
8448
|
+
const isTestnet = getNetwork(Number(chainId)).type === NetworkType.TESTNET;
|
|
7550
8449
|
const isProcessing = sellModal$.sellIsBeingProcessed.get();
|
|
7551
8450
|
const { shouldHideActionButton: shouldHideSellButton } = useSelectWaasFeeOptions({
|
|
7552
8451
|
isProcessing,
|
|
7553
8452
|
feeOptionsVisible,
|
|
7554
8453
|
selectedFeeOption
|
|
7555
8454
|
});
|
|
7556
|
-
const { isLoading, executeApproval, sell } = useSell({
|
|
8455
|
+
const { isLoading, executeApproval, sell, isError } = useSell({
|
|
7557
8456
|
collectionAddress,
|
|
7558
8457
|
chainId,
|
|
7559
8458
|
collectibleId: tokenId,
|
|
@@ -7569,7 +8468,7 @@ const Modal$1 = observer(() => {
|
|
|
7569
8468
|
steps$
|
|
7570
8469
|
});
|
|
7571
8470
|
const modalLoading = collectionLoading || currencyLoading;
|
|
7572
|
-
if ((collectionError || order === void 0 || currencyError) && !modalLoading) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
8471
|
+
if ((collectionError || order === void 0 || currencyError || isError) && !modalLoading) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
7573
8472
|
isOpen: sellModal$.isOpen.get(),
|
|
7574
8473
|
chainId: Number(chainId),
|
|
7575
8474
|
onClose: sellModal$.close,
|
|
@@ -7580,17 +8479,23 @@ const Modal$1 = observer(() => {
|
|
|
7580
8479
|
try {
|
|
7581
8480
|
if (isWaaS) selectWaasFeeOptionsStore.send({ type: "show" });
|
|
7582
8481
|
await sell({ isTransactionExecuting: isWaaS ? !isTestnet : false });
|
|
7583
|
-
} catch (error) {
|
|
7584
|
-
console.error("Sell failed:", error);
|
|
8482
|
+
} catch (error$1) {
|
|
8483
|
+
console.error("Sell failed:", error$1);
|
|
7585
8484
|
} finally {
|
|
7586
8485
|
sellModal$.sellIsBeingProcessed.set(false);
|
|
7587
8486
|
steps$.transaction.isExecuting.set(false);
|
|
7588
8487
|
}
|
|
7589
8488
|
};
|
|
8489
|
+
const handleApproveToken = async () => {
|
|
8490
|
+
await executeApproval().catch((error$1) => {
|
|
8491
|
+
console.error("Approve TOKEN failed:", error$1);
|
|
8492
|
+
setError(error$1);
|
|
8493
|
+
});
|
|
8494
|
+
};
|
|
7590
8495
|
const sellCtaLabel = isProcessing ? isWaaS && !isTestnet ? "Loading fee options" : "Accept" : "Accept";
|
|
7591
8496
|
const ctas = [{
|
|
7592
8497
|
label: "Approve TOKEN",
|
|
7593
|
-
onClick:
|
|
8498
|
+
onClick: handleApproveToken,
|
|
7594
8499
|
hidden: !steps$.approval.exist.get(),
|
|
7595
8500
|
pending: steps$.approval.isExecuting.get(),
|
|
7596
8501
|
variant: "glass",
|
|
@@ -7645,6 +8550,11 @@ const Modal$1 = observer(() => {
|
|
|
7645
8550
|
steps$.transaction.isExecuting.set(false);
|
|
7646
8551
|
},
|
|
7647
8552
|
titleOnConfirm: "Accepting offer..."
|
|
8553
|
+
}),
|
|
8554
|
+
error && /* @__PURE__ */ jsx(ErrorLogBox, {
|
|
8555
|
+
title: "An error occurred while selling",
|
|
8556
|
+
message: error.message,
|
|
8557
|
+
error
|
|
7648
8558
|
})
|
|
7649
8559
|
]
|
|
7650
8560
|
});
|
|
@@ -7889,13 +8799,12 @@ const TokenQuantityInput = ({ balanceAmount, collection, isProcessingWithWaaS })
|
|
|
7889
8799
|
const [invalidQuantity, setInvalidQuantity] = useState(false);
|
|
7890
8800
|
let insufficientBalance = true;
|
|
7891
8801
|
if (balanceAmount !== void 0 && modalState.quantity) try {
|
|
7892
|
-
|
|
7893
|
-
insufficientBalance = quantityBigInt > balanceAmount;
|
|
8802
|
+
insufficientBalance = BigInt(modalState.quantity) > balanceAmount;
|
|
7894
8803
|
} catch (_e) {
|
|
7895
8804
|
insufficientBalance = true;
|
|
7896
8805
|
}
|
|
7897
8806
|
return /* @__PURE__ */ jsxs("div", {
|
|
7898
|
-
className: cn
|
|
8807
|
+
className: cn("flex flex-col gap-3", isProcessingWithWaaS && "pointer-events-none opacity-50"),
|
|
7899
8808
|
children: [/* @__PURE__ */ jsx(QuantityInput, {
|
|
7900
8809
|
quantity: modalState.quantity,
|
|
7901
8810
|
invalidQuantity,
|
|
@@ -7968,8 +8877,7 @@ const MAX_WALLET_ADDRESS_LENGTH = 42;
|
|
|
7968
8877
|
const WalletAddressInput = () => {
|
|
7969
8878
|
const { address: connectedAddress } = useAccount();
|
|
7970
8879
|
const { receiverAddress, transferIsProcessing } = useModalState();
|
|
7971
|
-
const
|
|
7972
|
-
const isSelfTransfer = isWalletAddressValid && connectedAddress && receiverAddress.toLowerCase() === connectedAddress.toLowerCase();
|
|
8880
|
+
const isSelfTransfer = isAddress(receiverAddress) && connectedAddress && receiverAddress.toLowerCase() === connectedAddress.toLowerCase();
|
|
7973
8881
|
const handleChangeWalletAddress = (event) => {
|
|
7974
8882
|
transferModalStore.send({
|
|
7975
8883
|
type: "updateTransferDetails",
|
|
@@ -8082,8 +8990,7 @@ const EnterWalletAddressView = () => {
|
|
|
8082
8990
|
const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
|
|
8083
8991
|
let insufficientBalance = true;
|
|
8084
8992
|
if (balanceAmount !== void 0 && quantity) try {
|
|
8085
|
-
|
|
8086
|
-
insufficientBalance = quantityBigInt > BigInt(balanceAmount);
|
|
8993
|
+
insufficientBalance = BigInt(quantity) > BigInt(balanceAmount);
|
|
8087
8994
|
} catch (_e) {
|
|
8088
8995
|
insufficientBalance = true;
|
|
8089
8996
|
}
|
|
@@ -8101,8 +9008,7 @@ const EnterWalletAddressView = () => {
|
|
|
8101
9008
|
console.error("Transfer failed:", error);
|
|
8102
9009
|
}
|
|
8103
9010
|
};
|
|
8104
|
-
const
|
|
8105
|
-
const showQuantityInput = isErc1155 && !!balanceAmount;
|
|
9011
|
+
const showQuantityInput = collection?.type === ContractType.ERC1155 && !!balanceAmount;
|
|
8106
9012
|
const isTransferDisabled = transferIsProcessing || !isWalletAddressValid || insufficientBalance || !quantity || Number(quantity) === 0 || isSelfTransfer;
|
|
8107
9013
|
return /* @__PURE__ */ jsxs("div", {
|
|
8108
9014
|
className: "grid grow gap-6",
|
|
@@ -8270,14 +9176,19 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8270
9176
|
--tw-gradient-via-position: 50%;
|
|
8271
9177
|
--tw-gradient-to-position: 100%;
|
|
8272
9178
|
}
|
|
8273
|
-
/*! tailwindcss v4.1.
|
|
9179
|
+
/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
8274
9180
|
@layer properties;
|
|
8275
9181
|
@layer theme, base, components, utilities;
|
|
8276
9182
|
@layer theme {
|
|
8277
9183
|
:root, :host {
|
|
8278
9184
|
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
|
|
8279
9185
|
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
9186
|
+
--color-red-100: oklch(93.6% 0.032 17.717);
|
|
9187
|
+
--color-red-300: oklch(80.8% 0.114 19.571);
|
|
9188
|
+
--color-red-400: oklch(70.4% 0.191 22.216);
|
|
8280
9189
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
9190
|
+
--color-red-900: oklch(39.6% 0.141 25.723);
|
|
9191
|
+
--color-red-950: oklch(25.8% 0.092 26.042);
|
|
8281
9192
|
--color-green-500: oklch(72.3% 0.219 149.579);
|
|
8282
9193
|
--color-blue-500: oklch(62.3% 0.214 259.815);
|
|
8283
9194
|
--color-indigo-400: oklch(67.3% 0.182 276.935);
|
|
@@ -8474,6 +9385,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8474
9385
|
::-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
9386
|
padding-block: 0;
|
|
8476
9387
|
}
|
|
9388
|
+
::-webkit-calendar-picker-indicator {
|
|
9389
|
+
line-height: 1;
|
|
9390
|
+
}
|
|
8477
9391
|
:-moz-ui-invalid {
|
|
8478
9392
|
box-shadow: none;
|
|
8479
9393
|
}
|
|
@@ -8692,6 +9606,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8692
9606
|
.ml-5 {
|
|
8693
9607
|
margin-left: calc(var(--spacing) * 5);
|
|
8694
9608
|
}
|
|
9609
|
+
.ml-10 {
|
|
9610
|
+
margin-left: calc(var(--spacing) * 10);
|
|
9611
|
+
}
|
|
8695
9612
|
.block {
|
|
8696
9613
|
display: block;
|
|
8697
9614
|
}
|
|
@@ -8815,6 +9732,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8815
9732
|
.h-px {
|
|
8816
9733
|
height: 1px;
|
|
8817
9734
|
}
|
|
9735
|
+
.max-h-96 {
|
|
9736
|
+
max-height: calc(var(--spacing) * 96);
|
|
9737
|
+
}
|
|
8818
9738
|
.max-h-\[240px\] {
|
|
8819
9739
|
max-height: 240px;
|
|
8820
9740
|
}
|
|
@@ -8914,9 +9834,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8914
9834
|
.w-\[124px\] {
|
|
8915
9835
|
width: 124px;
|
|
8916
9836
|
}
|
|
8917
|
-
.w-\[147px\] {
|
|
8918
|
-
width: 147px;
|
|
8919
|
-
}
|
|
8920
9837
|
.w-\[148px\] {
|
|
8921
9838
|
width: 148px;
|
|
8922
9839
|
}
|
|
@@ -8974,6 +9891,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
8974
9891
|
.flex-shrink {
|
|
8975
9892
|
flex-shrink: 1;
|
|
8976
9893
|
}
|
|
9894
|
+
.flex-shrink-0 {
|
|
9895
|
+
flex-shrink: 0;
|
|
9896
|
+
}
|
|
8977
9897
|
.shrink-0 {
|
|
8978
9898
|
flex-shrink: 0;
|
|
8979
9899
|
}
|
|
@@ -9230,6 +10150,10 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9230
10150
|
border-style: var(--tw-border-style);
|
|
9231
10151
|
border-width: 2px;
|
|
9232
10152
|
}
|
|
10153
|
+
.border-t {
|
|
10154
|
+
border-top-style: var(--tw-border-style);
|
|
10155
|
+
border-top-width: 1px;
|
|
10156
|
+
}
|
|
9233
10157
|
.border-b-2 {
|
|
9234
10158
|
border-bottom-style: var(--tw-border-style);
|
|
9235
10159
|
border-bottom-width: 2px;
|
|
@@ -9261,6 +10185,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9261
10185
|
.border-border-normal {
|
|
9262
10186
|
border-color: var(--seq-color-border-normal);
|
|
9263
10187
|
}
|
|
10188
|
+
.border-red-900 {
|
|
10189
|
+
border-color: var(--color-red-900);
|
|
10190
|
+
}
|
|
9264
10191
|
.border-transparent {
|
|
9265
10192
|
border-color: transparent;
|
|
9266
10193
|
}
|
|
@@ -9273,6 +10200,9 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9273
10200
|
.border-b-transparent {
|
|
9274
10201
|
border-bottom-color: transparent;
|
|
9275
10202
|
}
|
|
10203
|
+
.bg-\[\#2b0000\] {
|
|
10204
|
+
background-color: #2b0000;
|
|
10205
|
+
}
|
|
9276
10206
|
.bg-\[\#35a554\] {
|
|
9277
10207
|
background-color: #35a554;
|
|
9278
10208
|
}
|
|
@@ -9300,6 +10230,12 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9300
10230
|
.bg-background-primary {
|
|
9301
10231
|
background-color: var(--seq-color-background-primary);
|
|
9302
10232
|
}
|
|
10233
|
+
.bg-background-primary\/25 {
|
|
10234
|
+
background-color: var(--seq-color-background-primary);
|
|
10235
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
10236
|
+
background-color: color-mix(in oklab, var(--seq-color-background-primary) 25%, transparent);
|
|
10237
|
+
}
|
|
10238
|
+
}
|
|
9303
10239
|
.bg-background-raised {
|
|
9304
10240
|
background-color: var(--seq-color-background-raised);
|
|
9305
10241
|
}
|
|
@@ -9339,6 +10275,12 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9339
10275
|
.bg-red-500 {
|
|
9340
10276
|
background-color: var(--color-red-500);
|
|
9341
10277
|
}
|
|
10278
|
+
.bg-red-900 {
|
|
10279
|
+
background-color: var(--color-red-900);
|
|
10280
|
+
}
|
|
10281
|
+
.bg-red-950 {
|
|
10282
|
+
background-color: var(--color-red-950);
|
|
10283
|
+
}
|
|
9342
10284
|
.bg-surface-neutral {
|
|
9343
10285
|
background-color: var(--color-surface-neutral);
|
|
9344
10286
|
}
|
|
@@ -9648,12 +10590,18 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9648
10590
|
--tw-tracking: var(--tracking-widest);
|
|
9649
10591
|
letter-spacing: var(--tracking-widest);
|
|
9650
10592
|
}
|
|
10593
|
+
.break-words {
|
|
10594
|
+
overflow-wrap: break-word;
|
|
10595
|
+
}
|
|
9651
10596
|
.text-ellipsis {
|
|
9652
10597
|
text-overflow: ellipsis;
|
|
9653
10598
|
}
|
|
9654
10599
|
.whitespace-nowrap {
|
|
9655
10600
|
white-space: nowrap;
|
|
9656
10601
|
}
|
|
10602
|
+
.whitespace-pre-wrap {
|
|
10603
|
+
white-space: pre-wrap;
|
|
10604
|
+
}
|
|
9657
10605
|
.text-background-raised {
|
|
9658
10606
|
color: var(--seq-color-background-raised);
|
|
9659
10607
|
}
|
|
@@ -9690,6 +10638,15 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9690
10638
|
.text-primary {
|
|
9691
10639
|
color: var(--seq-color-primary);
|
|
9692
10640
|
}
|
|
10641
|
+
.text-red-100 {
|
|
10642
|
+
color: var(--color-red-100);
|
|
10643
|
+
}
|
|
10644
|
+
.text-red-300 {
|
|
10645
|
+
color: var(--color-red-300);
|
|
10646
|
+
}
|
|
10647
|
+
.text-red-400 {
|
|
10648
|
+
color: var(--color-red-400);
|
|
10649
|
+
}
|
|
9693
10650
|
.text-red-500 {
|
|
9694
10651
|
color: var(--color-red-500);
|
|
9695
10652
|
}
|
|
@@ -9843,7 +10800,7 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9843
10800
|
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
10801
|
}
|
|
9845
10802
|
.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,
|
|
10803
|
+
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
10804
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
9848
10805
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
9849
10806
|
}
|
|
@@ -10206,7 +11163,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10206
11163
|
}
|
|
10207
11164
|
.after\:content-\[\"\"\] {
|
|
10208
11165
|
&::after {
|
|
10209
|
-
content: var(--tw-content);
|
|
10210
11166
|
--tw-content: "";
|
|
10211
11167
|
content: var(--tw-content);
|
|
10212
11168
|
}
|
|
@@ -10249,6 +11205,13 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10249
11205
|
}
|
|
10250
11206
|
}
|
|
10251
11207
|
}
|
|
11208
|
+
.hover\:animate-none {
|
|
11209
|
+
&:hover {
|
|
11210
|
+
@media (hover: hover) {
|
|
11211
|
+
animation: none;
|
|
11212
|
+
}
|
|
11213
|
+
}
|
|
11214
|
+
}
|
|
10252
11215
|
.hover\:bg-button-glass {
|
|
10253
11216
|
&:hover {
|
|
10254
11217
|
@media (hover: hover) {
|
|
@@ -10256,6 +11219,13 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10256
11219
|
}
|
|
10257
11220
|
}
|
|
10258
11221
|
}
|
|
11222
|
+
.hover\:text-red-300 {
|
|
11223
|
+
&:hover {
|
|
11224
|
+
@media (hover: hover) {
|
|
11225
|
+
color: var(--color-red-300);
|
|
11226
|
+
}
|
|
11227
|
+
}
|
|
11228
|
+
}
|
|
10259
11229
|
.hover\:text-text-80 {
|
|
10260
11230
|
&:hover {
|
|
10261
11231
|
@media (hover: hover) {
|
|
@@ -10263,6 +11233,13 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10263
11233
|
}
|
|
10264
11234
|
}
|
|
10265
11235
|
}
|
|
11236
|
+
.hover\:opacity-50 {
|
|
11237
|
+
&:hover {
|
|
11238
|
+
@media (hover: hover) {
|
|
11239
|
+
opacity: 50%;
|
|
11240
|
+
}
|
|
11241
|
+
}
|
|
11242
|
+
}
|
|
10266
11243
|
.hover\:opacity-80 {
|
|
10267
11244
|
&:hover {
|
|
10268
11245
|
@media (hover: hover) {
|
|
@@ -10624,11 +11601,27 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10624
11601
|
justify-self: center;
|
|
10625
11602
|
}
|
|
10626
11603
|
}
|
|
11604
|
+
.\[\&\>input\]\:pl-5 {
|
|
11605
|
+
&>input {
|
|
11606
|
+
padding-left: calc(var(--spacing) * 5);
|
|
11607
|
+
}
|
|
11608
|
+
}
|
|
11609
|
+
.\[\&\>input\]\:text-xs {
|
|
11610
|
+
&>input {
|
|
11611
|
+
font-size: var(--text-xs);
|
|
11612
|
+
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
10627
11615
|
.\[\&\>label\]\:flex {
|
|
10628
11616
|
&>label {
|
|
10629
11617
|
display: flex;
|
|
10630
11618
|
}
|
|
10631
11619
|
}
|
|
11620
|
+
.\[\&\>label\]\:w-16 {
|
|
11621
|
+
&>label {
|
|
11622
|
+
width: calc(var(--spacing) * 16);
|
|
11623
|
+
}
|
|
11624
|
+
}
|
|
10632
11625
|
.\[\&\>label\]\:w-full {
|
|
10633
11626
|
&>label {
|
|
10634
11627
|
width: 100%;
|
|
@@ -10665,21 +11658,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10665
11658
|
width: 100%;
|
|
10666
11659
|
}
|
|
10667
11660
|
}
|
|
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
11661
|
.\[\&\>label\>div\>div\>div\]\:h-9 {
|
|
10684
11662
|
&>label>div>div>div {
|
|
10685
11663
|
height: calc(var(--spacing) * 9);
|
|
@@ -10899,9 +11877,17 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
10899
11877
|
--rdp-range_middle-background-color: var(--rdp-accent-background-color);
|
|
10900
11878
|
--rdp-range_middle-color: inherit;
|
|
10901
11879
|
--rdp-range_start-color: white;
|
|
10902
|
-
--rdp-range_start-background: linear-gradient(
|
|
11880
|
+
--rdp-range_start-background: linear-gradient(
|
|
11881
|
+
var(--rdp-gradient-direction),
|
|
11882
|
+
transparent 50%,
|
|
11883
|
+
var(--rdp-range_middle-background-color) 50%
|
|
11884
|
+
);
|
|
10903
11885
|
--rdp-range_start-date-background-color: var(--rdp-accent-color);
|
|
10904
|
-
--rdp-range_end-background: linear-gradient(
|
|
11886
|
+
--rdp-range_end-background: linear-gradient(
|
|
11887
|
+
var(--rdp-gradient-direction),
|
|
11888
|
+
var(--rdp-range_middle-background-color) 50%,
|
|
11889
|
+
transparent 50%
|
|
11890
|
+
);
|
|
10905
11891
|
--rdp-range_end-color: white;
|
|
10906
11892
|
--rdp-range_end-date-background-color: var(--rdp-accent-color);
|
|
10907
11893
|
--rdp-week_number-border-radius: 100%;
|
|
@@ -11122,7 +12108,6 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
11122
12108
|
background-color: var(--rdp-range_middle-background-color);
|
|
11123
12109
|
}
|
|
11124
12110
|
.rdp-range_middle .rdp-day_button {
|
|
11125
|
-
border-color: transparent;
|
|
11126
12111
|
border: unset;
|
|
11127
12112
|
border-radius: unset;
|
|
11128
12113
|
color: var(--rdp-range_middle-color);
|
|
@@ -11225,6 +12210,103 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
11225
12210
|
.rdp-caption_before_exit {
|
|
11226
12211
|
animation: rdp-fade_out var(--rdp-animation_duration) var(--rdp-animation_timing) forwards;
|
|
11227
12212
|
}
|
|
12213
|
+
.rdp-root {
|
|
12214
|
+
width: 100% !important;
|
|
12215
|
+
padding: 0 !important;
|
|
12216
|
+
user-select: none;
|
|
12217
|
+
}
|
|
12218
|
+
.rdp-nav {
|
|
12219
|
+
position: absolute;
|
|
12220
|
+
width: 100%;
|
|
12221
|
+
height: fit-content !important;
|
|
12222
|
+
display: flex;
|
|
12223
|
+
align-items: center;
|
|
12224
|
+
justify-content: space-between;
|
|
12225
|
+
}
|
|
12226
|
+
.rdp-caption_label {
|
|
12227
|
+
color: var(--color-text-100) !important;
|
|
12228
|
+
}
|
|
12229
|
+
.rdp-months {
|
|
12230
|
+
width: 100%;
|
|
12231
|
+
max-width: unset !important;
|
|
12232
|
+
}
|
|
12233
|
+
.rdp-month_caption {
|
|
12234
|
+
text-align: center;
|
|
12235
|
+
width: 100%;
|
|
12236
|
+
height: 36px !important;
|
|
12237
|
+
display: block !important;
|
|
12238
|
+
font-size: 14px !important;
|
|
12239
|
+
}
|
|
12240
|
+
.rdp-month_grid {
|
|
12241
|
+
width: 100%;
|
|
12242
|
+
}
|
|
12243
|
+
.rdp-month {
|
|
12244
|
+
width: 100%;
|
|
12245
|
+
}
|
|
12246
|
+
.rdp-button_previous {
|
|
12247
|
+
background-color: var(--color-overlay-light) !important;
|
|
12248
|
+
border-radius: 50%;
|
|
12249
|
+
}
|
|
12250
|
+
.rdp-button_previous:hover {
|
|
12251
|
+
background-color: var(--color-overlay-glass) !important;
|
|
12252
|
+
}
|
|
12253
|
+
.rdp-button_previous > svg {
|
|
12254
|
+
fill: var(--color-text-100) !important;
|
|
12255
|
+
width: 16px !important;
|
|
12256
|
+
height: 16px !important;
|
|
12257
|
+
}
|
|
12258
|
+
.rdp-button_next {
|
|
12259
|
+
background-color: var(--color-overlay-light) !important;
|
|
12260
|
+
border-radius: 50%;
|
|
12261
|
+
}
|
|
12262
|
+
.rdp-button_next:hover {
|
|
12263
|
+
background-color: var(--color-overlay-glass) !important;
|
|
12264
|
+
}
|
|
12265
|
+
.rdp-button_next > svg {
|
|
12266
|
+
fill: var(--color-text-100) !important;
|
|
12267
|
+
width: 16px !important;
|
|
12268
|
+
height: 16px !important;
|
|
12269
|
+
}
|
|
12270
|
+
.rdp-weekdays {
|
|
12271
|
+
display: flex;
|
|
12272
|
+
justify-content: space-between;
|
|
12273
|
+
}
|
|
12274
|
+
.rdp-weekday {
|
|
12275
|
+
padding: 16px 0 !important;
|
|
12276
|
+
font-size: 14px !important;
|
|
12277
|
+
font-weight: var(--font-weight-medium) !important;
|
|
12278
|
+
color: var(--color-text-80) !important;
|
|
12279
|
+
}
|
|
12280
|
+
.rdp-weeks {
|
|
12281
|
+
display: flex;
|
|
12282
|
+
flex-direction: column;
|
|
12283
|
+
gap: 4px;
|
|
12284
|
+
}
|
|
12285
|
+
.rdp-week {
|
|
12286
|
+
display: flex;
|
|
12287
|
+
justify-content: space-between;
|
|
12288
|
+
}
|
|
12289
|
+
.rdp-day {
|
|
12290
|
+
width: 24px !important;
|
|
12291
|
+
height: 24px !important;
|
|
12292
|
+
}
|
|
12293
|
+
.rdp-day_button {
|
|
12294
|
+
width: 24px !important;
|
|
12295
|
+
height: 24px !important;
|
|
12296
|
+
font-size: var(--text-xs) !important;
|
|
12297
|
+
color: var(--color-text-80) !important;
|
|
12298
|
+
}
|
|
12299
|
+
.rdp-day_button:disabled {
|
|
12300
|
+
color: var(--color-text-50) !important;
|
|
12301
|
+
}
|
|
12302
|
+
.rdp-day.rdp-today {
|
|
12303
|
+
outline: 1px solid var(--color-violet-700) !important;
|
|
12304
|
+
border-radius: 50% !important;
|
|
12305
|
+
}
|
|
12306
|
+
.rdp-day.rdp-selected {
|
|
12307
|
+
background: var(--seq-color-gradient-primary) !important;
|
|
12308
|
+
border-radius: 50% !important;
|
|
12309
|
+
}
|
|
11228
12310
|
@keyframes fadeIn {
|
|
11229
12311
|
0% {
|
|
11230
12312
|
opacity: 0;
|
|
@@ -11560,21 +12642,27 @@ const ShadowRoot = (props) => {
|
|
|
11560
12642
|
//#endregion
|
|
11561
12643
|
//#region src/react/providers/modal-provider.tsx
|
|
11562
12644
|
const ModalProvider = observer(({ children }) => {
|
|
11563
|
-
const
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
12645
|
+
const sdkConfig = useConfig();
|
|
12646
|
+
const { shadowDom, experimentalShadowDomCssOverride } = sdkConfig;
|
|
12647
|
+
const overrides = sdkConfig._internal?.overrides?.api?.marketplace;
|
|
12648
|
+
const marketplaceApiUrl = overrides?.url || marketplaceApiURL(overrides?.env || "production");
|
|
12649
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx(SequenceCheckoutProvider, {
|
|
12650
|
+
config: { env: { marketplaceApiUrl } },
|
|
12651
|
+
children: /* @__PURE__ */ jsxs(ShadowRoot, {
|
|
12652
|
+
enabled: shadowDom ?? true,
|
|
12653
|
+
customCSS: experimentalShadowDomCssOverride,
|
|
12654
|
+
children: [
|
|
12655
|
+
/* @__PURE__ */ jsx(CreateListingModal, {}),
|
|
12656
|
+
/* @__PURE__ */ jsx(MakeOfferModal, {}),
|
|
12657
|
+
/* @__PURE__ */ jsx(TransferModal, {}),
|
|
12658
|
+
/* @__PURE__ */ jsx(SellModal, {}),
|
|
12659
|
+
/* @__PURE__ */ jsx(BuyModal, {}),
|
|
12660
|
+
/* @__PURE__ */ jsx(SuccessfulPurchaseModal_default, {}),
|
|
12661
|
+
/* @__PURE__ */ jsx(switchChainErrorModal_default, {}),
|
|
12662
|
+
/* @__PURE__ */ jsx(transactionStatusModal_default, {})
|
|
12663
|
+
]
|
|
12664
|
+
})
|
|
12665
|
+
})] });
|
|
11578
12666
|
});
|
|
11579
12667
|
|
|
11580
12668
|
//#endregion
|
|
@@ -11660,10 +12748,10 @@ function ActionButtonBody({ tokenId, label, onClick, icon, action }) {
|
|
|
11660
12748
|
//#endregion
|
|
11661
12749
|
//#region src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx
|
|
11662
12750
|
function NonOwnerActions(props) {
|
|
11663
|
-
const { action, tokenId, collectionAddress, chainId, quantityDecimals, quantityRemaining, unlimitedSupply,
|
|
12751
|
+
const { action, tokenId, collectionAddress, chainId, quantityDecimals, quantityRemaining, unlimitedSupply, cardType, hideQuantitySelector } = props;
|
|
11664
12752
|
const { show: showBuyModal } = useBuyModal();
|
|
11665
12753
|
const { show: showMakeOfferModal } = useMakeOfferModal();
|
|
11666
|
-
if (
|
|
12754
|
+
if (cardType === "shop") {
|
|
11667
12755
|
const { salesContractAddress, salePrice } = props;
|
|
11668
12756
|
return /* @__PURE__ */ jsx(ActionButtonBody, {
|
|
11669
12757
|
action: CollectibleCardAction.BUY,
|
|
@@ -11677,14 +12765,15 @@ function NonOwnerActions(props) {
|
|
|
11677
12765
|
tokenId,
|
|
11678
12766
|
quantity: "1"
|
|
11679
12767
|
}],
|
|
11680
|
-
|
|
12768
|
+
cardType: "shop",
|
|
11681
12769
|
salePrice: {
|
|
11682
12770
|
amount: salePrice.amount,
|
|
11683
12771
|
currencyAddress: salePrice.currencyAddress
|
|
11684
12772
|
},
|
|
11685
12773
|
quantityDecimals: quantityDecimals ?? 0,
|
|
11686
12774
|
quantityRemaining: quantityRemaining ?? 0,
|
|
11687
|
-
unlimitedSupply
|
|
12775
|
+
unlimitedSupply,
|
|
12776
|
+
hideQuantitySelector
|
|
11688
12777
|
}),
|
|
11689
12778
|
icon: CartIcon_default
|
|
11690
12779
|
});
|
|
@@ -11702,7 +12791,8 @@ function NonOwnerActions(props) {
|
|
|
11702
12791
|
collectibleId: tokenId,
|
|
11703
12792
|
orderId: lowestListing.orderId,
|
|
11704
12793
|
marketplace: lowestListing.marketplace,
|
|
11705
|
-
|
|
12794
|
+
cardType: "market",
|
|
12795
|
+
hideQuantitySelector
|
|
11706
12796
|
}),
|
|
11707
12797
|
icon: CartIcon_default
|
|
11708
12798
|
});
|
|
@@ -11824,7 +12914,7 @@ const useActionButtonLogic = ({ tokenId, owned, action, onCannotPerformAction })
|
|
|
11824
12914
|
|
|
11825
12915
|
//#endregion
|
|
11826
12916
|
//#region src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
11827
|
-
function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, action, owned, highestOffer, lowestListing, onCannotPerformAction,
|
|
12917
|
+
function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, action, owned, highestOffer, lowestListing, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply, hideQuantitySelector }) {
|
|
11828
12918
|
const { shouldShowAction, isOwnerAction } = useActionButtonLogic({
|
|
11829
12919
|
tokenId,
|
|
11830
12920
|
owned,
|
|
@@ -11840,8 +12930,8 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11840
12930
|
orderbookKind,
|
|
11841
12931
|
highestOffer
|
|
11842
12932
|
});
|
|
11843
|
-
|
|
11844
|
-
|
|
12933
|
+
return /* @__PURE__ */ jsx(NonOwnerActions, { ...cardType === "shop" && salesContractAddress && salePrice ? {
|
|
12934
|
+
cardType: "shop",
|
|
11845
12935
|
salesContractAddress,
|
|
11846
12936
|
salePrice,
|
|
11847
12937
|
action,
|
|
@@ -11850,9 +12940,10 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11850
12940
|
chainId,
|
|
11851
12941
|
quantityDecimals,
|
|
11852
12942
|
quantityRemaining,
|
|
11853
|
-
unlimitedSupply
|
|
12943
|
+
unlimitedSupply,
|
|
12944
|
+
hideQuantitySelector
|
|
11854
12945
|
} : {
|
|
11855
|
-
|
|
12946
|
+
cardType: "market",
|
|
11856
12947
|
orderbookKind,
|
|
11857
12948
|
lowestListing,
|
|
11858
12949
|
action,
|
|
@@ -11860,14 +12951,14 @@ function ActionButton({ collectionAddress, chainId, tokenId, orderbookKind, acti
|
|
|
11860
12951
|
collectionAddress,
|
|
11861
12952
|
chainId,
|
|
11862
12953
|
quantityDecimals,
|
|
11863
|
-
quantityRemaining
|
|
11864
|
-
|
|
11865
|
-
|
|
12954
|
+
quantityRemaining,
|
|
12955
|
+
hideQuantitySelector
|
|
12956
|
+
} });
|
|
11866
12957
|
}
|
|
11867
12958
|
|
|
11868
12959
|
//#endregion
|
|
11869
12960
|
//#region src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx
|
|
11870
|
-
function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderbookKind, action, highestOffer, lowestListing, owned, onCannotPerformAction,
|
|
12961
|
+
function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderbookKind, action, highestOffer, lowestListing, owned, onCannotPerformAction, cardType, salesContractAddress, prioritizeOwnerActions, salePrice, quantityDecimals, quantityRemaining, unlimitedSupply, hideQuantitySelector }) {
|
|
11871
12962
|
if (!show) return null;
|
|
11872
12963
|
return /* @__PURE__ */ jsx("div", {
|
|
11873
12964
|
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,13 +12972,14 @@ function ActionButtonWrapper({ show, chainId, collectionAddress, tokenId, orderb
|
|
|
11881
12972
|
lowestListing,
|
|
11882
12973
|
owned,
|
|
11883
12974
|
onCannotPerformAction,
|
|
11884
|
-
|
|
12975
|
+
cardType,
|
|
11885
12976
|
salesContractAddress,
|
|
11886
12977
|
prioritizeOwnerActions,
|
|
11887
12978
|
salePrice,
|
|
11888
12979
|
quantityDecimals,
|
|
11889
12980
|
quantityRemaining,
|
|
11890
|
-
unlimitedSupply
|
|
12981
|
+
unlimitedSupply,
|
|
12982
|
+
hideQuantitySelector
|
|
11891
12983
|
})
|
|
11892
12984
|
});
|
|
11893
12985
|
}
|
|
@@ -12012,20 +13104,16 @@ function MediaSkeleton() {
|
|
|
12012
13104
|
//#endregion
|
|
12013
13105
|
//#region src/react/ui/components/media/utils.ts
|
|
12014
13106
|
const isImage = (fileName) => {
|
|
12015
|
-
|
|
12016
|
-
return isImage$1;
|
|
13107
|
+
return /.*\.(png|jpg|jpeg|gif|svg|webp)$/.test(fileName?.toLowerCase() || "");
|
|
12017
13108
|
};
|
|
12018
13109
|
const isHtml = (fileName) => {
|
|
12019
|
-
|
|
12020
|
-
return isHtml$1;
|
|
13110
|
+
return /.*\.(html\?.+|html)$/.test(fileName?.toLowerCase() || "");
|
|
12021
13111
|
};
|
|
12022
13112
|
const isVideo = (fileName) => {
|
|
12023
|
-
|
|
12024
|
-
return isVideo$1;
|
|
13113
|
+
return /.*\.(mp4|ogg|webm)$/.test(fileName?.toLowerCase() || "");
|
|
12025
13114
|
};
|
|
12026
13115
|
const is3dModel = (fileName) => {
|
|
12027
|
-
|
|
12028
|
-
return is3dFile;
|
|
13116
|
+
return /.*\.(gltf|glb|obj|fbx|stl|usdz)$/.test(fileName?.toLowerCase() || "");
|
|
12029
13117
|
};
|
|
12030
13118
|
const getContentType = (url) => {
|
|
12031
13119
|
return new Promise((resolve, reject) => {
|
|
@@ -12065,10 +13153,9 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12065
13153
|
useEffect(() => {
|
|
12066
13154
|
setIsSafari(/^((?!chrome|android).)*safari/i.test(navigator.userAgent));
|
|
12067
13155
|
}, []);
|
|
12068
|
-
const
|
|
12069
|
-
const assetUrl = validAssets[currentAssetIndex];
|
|
13156
|
+
const assetUrl = assets.filter((asset) => !!asset)[currentAssetIndex];
|
|
12070
13157
|
const proxiedAssetUrl = assetUrl ? assetSrcPrefixUrl ? `${assetSrcPrefixUrl}${assetUrl}` : assetUrl : "";
|
|
12071
|
-
const containerClassNames = cn("relative aspect-square overflow-hidden bg-background-secondary", containerClassName || className);
|
|
13158
|
+
const containerClassNames = cn$1("relative aspect-square overflow-hidden bg-background-secondary", containerClassName || className);
|
|
12072
13159
|
useEffect(() => {
|
|
12073
13160
|
if (!assetUrl) {
|
|
12074
13161
|
setContentType({
|
|
@@ -12119,11 +13206,11 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12119
13206
|
};
|
|
12120
13207
|
const renderFallback = () => {
|
|
12121
13208
|
if (fallbackContent) return /* @__PURE__ */ jsx("div", {
|
|
12122
|
-
className: cn("flex h-full w-full items-center justify-center", containerClassNames),
|
|
13209
|
+
className: cn$1("flex h-full w-full items-center justify-center", containerClassNames),
|
|
12123
13210
|
children: fallbackContent
|
|
12124
13211
|
});
|
|
12125
13212
|
return /* @__PURE__ */ jsx("div", {
|
|
12126
|
-
className: cn("h-full w-full", containerClassNames),
|
|
13213
|
+
className: cn$1("h-full w-full", containerClassNames),
|
|
12127
13214
|
children: /* @__PURE__ */ jsx("img", {
|
|
12128
13215
|
src: chess_tile_default,
|
|
12129
13216
|
alt: name || "Collectible",
|
|
@@ -12137,10 +13224,10 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12137
13224
|
};
|
|
12138
13225
|
if (assetLoadFailed || !isLoading && contentType.failed || !assetUrl) return renderFallback();
|
|
12139
13226
|
if (contentType.type === "html" && !assetLoadFailed) return /* @__PURE__ */ jsxs("div", {
|
|
12140
|
-
className: cn("flex w-full items-center justify-center rounded-lg", containerClassNames),
|
|
13227
|
+
className: cn$1("flex w-full items-center justify-center rounded-lg", containerClassNames),
|
|
12141
13228
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("iframe", {
|
|
12142
13229
|
title: name || "Collectible",
|
|
12143
|
-
className: cn("aspect-square w-full", mediaClassname),
|
|
13230
|
+
className: cn$1("aspect-square w-full", mediaClassname),
|
|
12144
13231
|
src: proxiedAssetUrl,
|
|
12145
13232
|
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
12146
13233
|
sandbox: "allow-scripts",
|
|
@@ -12150,7 +13237,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12150
13237
|
})]
|
|
12151
13238
|
});
|
|
12152
13239
|
if (contentType.type === "3d-model" && !assetLoadFailed) return /* @__PURE__ */ jsx("div", {
|
|
12153
|
-
className: cn("h-full w-full", containerClassNames),
|
|
13240
|
+
className: cn$1("h-full w-full", containerClassNames),
|
|
12154
13241
|
children: /* @__PURE__ */ jsx(ModelViewer_default, {
|
|
12155
13242
|
src: proxiedAssetUrl,
|
|
12156
13243
|
posterSrc: chess_tile_default,
|
|
@@ -12159,7 +13246,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12159
13246
|
})
|
|
12160
13247
|
});
|
|
12161
13248
|
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);
|
|
13249
|
+
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
13250
|
return /* @__PURE__ */ jsxs("div", {
|
|
12164
13251
|
className: containerClassNames,
|
|
12165
13252
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("video", {
|
|
@@ -12179,7 +13266,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12179
13266
|
});
|
|
12180
13267
|
}
|
|
12181
13268
|
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);
|
|
13269
|
+
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
13270
|
return /* @__PURE__ */ jsxs("div", {
|
|
12184
13271
|
className: containerClassNames,
|
|
12185
13272
|
children: [(assetLoading || contentType.loading || isLoading) && /* @__PURE__ */ jsx(MediaSkeleton, {}), /* @__PURE__ */ jsx("img", {
|
|
@@ -12194,7 +13281,7 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
12194
13281
|
|
|
12195
13282
|
//#endregion
|
|
12196
13283
|
//#region src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx
|
|
12197
|
-
function MarketplaceCollectibleCardSkeleton() {
|
|
13284
|
+
function MarketplaceCollectibleCardSkeleton({ contractType, isShop }) {
|
|
12198
13285
|
return /* @__PURE__ */ jsxs("div", {
|
|
12199
13286
|
"data-testid": "collectible-card-skeleton",
|
|
12200
13287
|
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 +13294,31 @@ function MarketplaceCollectibleCardSkeleton() {
|
|
|
12207
13294
|
})
|
|
12208
13295
|
}), /* @__PURE__ */ jsxs("div", {
|
|
12209
13296
|
className: "mt-2 flex flex-col gap-2 px-4 pb-4",
|
|
12210
|
-
children: [
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
13297
|
+
children: [
|
|
13298
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
13299
|
+
size: "lg",
|
|
13300
|
+
className: "animate-shimmer"
|
|
13301
|
+
}),
|
|
13302
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
13303
|
+
size: "sm",
|
|
13304
|
+
className: "h-5 w-16 animate-shimmer"
|
|
13305
|
+
}),
|
|
13306
|
+
isShop && contractType === ContractType.ERC1155 && /* @__PURE__ */ jsx(Skeleton, {
|
|
13307
|
+
size: "lg",
|
|
13308
|
+
className: "h-6 w-20 animate-shimmer"
|
|
13309
|
+
})
|
|
13310
|
+
]
|
|
12217
13311
|
})]
|
|
12218
13312
|
});
|
|
12219
13313
|
}
|
|
12220
13314
|
|
|
12221
13315
|
//#endregion
|
|
12222
13316
|
//#region src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx
|
|
12223
|
-
function BaseCard({
|
|
12224
|
-
if (
|
|
13317
|
+
function BaseCard({ name, image, video, animationUrl, onClick, onKeyDown, assetSrcPrefixUrl, children, mediaClassName, cardLoading, contractType, isShop }) {
|
|
13318
|
+
if (cardLoading) return /* @__PURE__ */ jsx(MarketplaceCollectibleCardSkeleton, {
|
|
13319
|
+
contractType,
|
|
13320
|
+
isShop
|
|
13321
|
+
});
|
|
12225
13322
|
return /* @__PURE__ */ jsx("div", {
|
|
12226
13323
|
"data-testid": "collectible-card",
|
|
12227
13324
|
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 +13338,7 @@ function BaseCard({ isLoading, name, image, video, animationUrl, onClick, onKeyD
|
|
|
12241
13338
|
animationUrl
|
|
12242
13339
|
],
|
|
12243
13340
|
assetSrcPrefixUrl,
|
|
12244
|
-
mediaClassname: cn
|
|
13341
|
+
mediaClassname: cn("object-contain", mediaClassName)
|
|
12245
13342
|
}), children]
|
|
12246
13343
|
})
|
|
12247
13344
|
})
|
|
@@ -12249,75 +13346,58 @@ function BaseCard({ isLoading, name, image, video, animationUrl, onClick, onKeyD
|
|
|
12249
13346
|
}
|
|
12250
13347
|
|
|
12251
13348
|
//#endregion
|
|
12252
|
-
//#region src/react/ui/components/marketplace-collectible-card/Footer.tsx
|
|
12253
|
-
const
|
|
12254
|
-
const
|
|
12255
|
-
const
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
13349
|
+
//#region src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx
|
|
13350
|
+
const Footer = ({ chainId, collectionAddress, collectibleId, name, type, decimals, onOfferClick, highestOffer, balance, quantityInitial, quantityRemaining, unlimitedSupply, cardType, salePriceAmount, salePriceCurrency }) => {
|
|
13351
|
+
const isShop = cardType === "shop";
|
|
13352
|
+
const isMarket = cardType === "market";
|
|
13353
|
+
const isInventoryNonTradable = cardType === "inventory-non-tradable";
|
|
13354
|
+
const { data: lowestListing, isLoading: isLowestListingLoading } = useLowestListing({
|
|
13355
|
+
chainId,
|
|
13356
|
+
collectionAddress,
|
|
13357
|
+
tokenId: collectibleId,
|
|
13358
|
+
query: { enabled: isMarket }
|
|
12260
13359
|
});
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
13360
|
+
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
13361
|
+
chainId,
|
|
13362
|
+
currencyAddress: lowestListing?.priceCurrencyAddress,
|
|
13363
|
+
query: { enabled: isMarket && !!lowestListing?.priceCurrencyAddress }
|
|
12264
13364
|
});
|
|
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
|
-
})();
|
|
13365
|
+
const listed = !!lowestListing?.priceAmount && !!lowestListing?.priceCurrencyAddress;
|
|
13366
|
+
const isPriceLoading = isMarket && (isLowestListingLoading || !!lowestListing?.priceCurrencyAddress && isCurrencyLoading);
|
|
12283
13367
|
return /* @__PURE__ */ jsxs("div", {
|
|
12284
13368
|
className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4",
|
|
12285
13369
|
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
|
-
})]
|
|
13370
|
+
/* @__PURE__ */ jsx(FooterName, {
|
|
13371
|
+
name,
|
|
13372
|
+
isShop,
|
|
13373
|
+
highestOffer,
|
|
13374
|
+
onOfferClick,
|
|
13375
|
+
quantityInitial,
|
|
13376
|
+
quantityRemaining,
|
|
13377
|
+
balance
|
|
12303
13378
|
}),
|
|
12304
13379
|
/* @__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
|
-
|
|
13380
|
+
className: cn$1("flex items-center gap-1", isShop && type === ContractType.ERC721 && "hidden"),
|
|
13381
|
+
children: [
|
|
13382
|
+
isPriceLoading && /* @__PURE__ */ jsx(Skeleton, {
|
|
13383
|
+
size: "sm",
|
|
13384
|
+
className: "h-5 w-20 animate-shimmer"
|
|
13385
|
+
}),
|
|
13386
|
+
!isPriceLoading && listed && isMarket && lowestListing && currency && /* @__PURE__ */ jsx(PriceDisplay, {
|
|
13387
|
+
amount: lowestListing.priceAmount,
|
|
13388
|
+
currency,
|
|
13389
|
+
className: "text-text-100"
|
|
13390
|
+
}),
|
|
13391
|
+
!isPriceLoading && !listed && isMarket && /* @__PURE__ */ jsx(Text, {
|
|
13392
|
+
className: "text-left font-body font-bold text-sm text-text-50",
|
|
13393
|
+
children: "Not listed yet"
|
|
13394
|
+
}),
|
|
13395
|
+
isShop && salePriceAmount && salePriceCurrency && type === ContractType.ERC1155 && /* @__PURE__ */ jsx(PriceDisplay, {
|
|
13396
|
+
amount: salePriceAmount,
|
|
13397
|
+
currency: salePriceCurrency,
|
|
13398
|
+
className: "text-text-100"
|
|
13399
|
+
})
|
|
13400
|
+
]
|
|
12321
13401
|
}),
|
|
12322
13402
|
isShop && /* @__PURE__ */ jsx(SaleDetailsPill, {
|
|
12323
13403
|
quantityRemaining,
|
|
@@ -12325,7 +13405,7 @@ const Footer = ({ name, type, decimals, onOfferClick, highestOffer, lowestListin
|
|
|
12325
13405
|
unlimitedSupply
|
|
12326
13406
|
}),
|
|
12327
13407
|
isShop && !salePriceAmount && /* @__PURE__ */ jsx("div", { className: "h-5 w-full" }),
|
|
12328
|
-
|
|
13408
|
+
(isMarket || isInventoryNonTradable) && /* @__PURE__ */ jsx(TokenTypeBalancePill, {
|
|
12329
13409
|
balance,
|
|
12330
13410
|
type,
|
|
12331
13411
|
decimals
|
|
@@ -12333,36 +13413,32 @@ const Footer = ({ name, type, decimals, onOfferClick, highestOffer, lowestListin
|
|
|
12333
13413
|
]
|
|
12334
13414
|
});
|
|
12335
13415
|
};
|
|
12336
|
-
const
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
13416
|
+
const NonTradableInventoryFooter = ({ name, balance, decimals, type }) => {
|
|
13417
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13418
|
+
className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4",
|
|
13419
|
+
children: [
|
|
13420
|
+
/* @__PURE__ */ jsx(FooterName, { name }),
|
|
13421
|
+
/* @__PURE__ */ jsx("div", {
|
|
13422
|
+
className: "flex items-center gap-1",
|
|
13423
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13424
|
+
className: "text-left font-body font-bold text-sm text-text-50",
|
|
13425
|
+
children: "Not listed yet"
|
|
13426
|
+
})
|
|
13427
|
+
}),
|
|
13428
|
+
/* @__PURE__ */ jsx(TokenTypeBalancePill, {
|
|
13429
|
+
balance,
|
|
13430
|
+
type,
|
|
13431
|
+
decimals
|
|
13432
|
+
})
|
|
13433
|
+
]
|
|
12352
13434
|
});
|
|
12353
13435
|
};
|
|
12354
13436
|
|
|
12355
13437
|
//#endregion
|
|
12356
13438
|
//#region src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx
|
|
12357
|
-
function MarketCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, orderbookKind, collectible, onCollectibleClick, onOfferClick, balance, balanceIsLoading = false, onCannotPerformAction, prioritizeOwnerActions }) {
|
|
13439
|
+
function MarketCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, orderbookKind, collectible, onCollectibleClick, onOfferClick, balance, balanceIsLoading = false, onCannotPerformAction, prioritizeOwnerActions, hideQuantitySelector }) {
|
|
12358
13440
|
const collectibleMetadata = collectible?.metadata;
|
|
12359
13441
|
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
13442
|
if (!collectibleMetadata) {
|
|
12367
13443
|
console.error("Collectible metadata is undefined");
|
|
12368
13444
|
return null;
|
|
@@ -12379,15 +13455,20 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12379
13455
|
collectionType,
|
|
12380
13456
|
assetSrcPrefixUrl,
|
|
12381
13457
|
cardLoading,
|
|
12382
|
-
|
|
12383
|
-
isLoading,
|
|
13458
|
+
cardType: "market",
|
|
12384
13459
|
name: collectibleMetadata.name || "",
|
|
12385
13460
|
image: collectibleMetadata.image,
|
|
12386
13461
|
video: collectibleMetadata.video,
|
|
12387
13462
|
animationUrl: collectibleMetadata.animation_url,
|
|
13463
|
+
contractType: collectionType,
|
|
13464
|
+
isShop: false,
|
|
12388
13465
|
onClick: () => onCollectibleClick?.(collectibleId),
|
|
12389
13466
|
onKeyDown: handleKeyDown,
|
|
13467
|
+
hideQuantitySelector,
|
|
12390
13468
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
13469
|
+
chainId,
|
|
13470
|
+
collectionAddress,
|
|
13471
|
+
collectibleId,
|
|
12391
13472
|
name: collectibleMetadata.name || "",
|
|
12392
13473
|
type: collectionType,
|
|
12393
13474
|
onOfferClick: (e) => onOfferClick?.({
|
|
@@ -12395,15 +13476,13 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12395
13476
|
e
|
|
12396
13477
|
}),
|
|
12397
13478
|
highestOffer,
|
|
12398
|
-
lowestListingPriceAmount: collectible?.listing?.priceAmount,
|
|
12399
|
-
lowestListingCurrency,
|
|
12400
13479
|
balance,
|
|
12401
13480
|
decimals: collectibleMetadata.decimals,
|
|
12402
13481
|
quantityInitial: highestOffer?.quantityInitial !== void 0 ? highestOffer.quantityInitial : collectible?.listing?.quantityInitial !== void 0 ? collectible.listing.quantityInitial : void 0,
|
|
12403
13482
|
quantityRemaining: highestOffer?.quantityRemaining !== void 0 ? highestOffer.quantityRemaining : collectible?.listing?.quantityRemaining !== void 0 ? collectible.listing.quantityRemaining : void 0,
|
|
12404
|
-
|
|
13483
|
+
cardType: "market"
|
|
12405
13484
|
}), /* @__PURE__ */ jsx(ActionButtonWrapper, {
|
|
12406
|
-
show: showActionButton,
|
|
13485
|
+
show: showActionButton ?? false,
|
|
12407
13486
|
chainId,
|
|
12408
13487
|
collectionAddress,
|
|
12409
13488
|
tokenId: collectibleId,
|
|
@@ -12413,21 +13492,46 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
12413
13492
|
lowestListing: collectible?.listing,
|
|
12414
13493
|
owned: !!balance,
|
|
12415
13494
|
onCannotPerformAction,
|
|
12416
|
-
|
|
12417
|
-
prioritizeOwnerActions
|
|
13495
|
+
cardType: "market",
|
|
13496
|
+
prioritizeOwnerActions,
|
|
13497
|
+
hideQuantitySelector
|
|
12418
13498
|
})]
|
|
12419
13499
|
});
|
|
12420
13500
|
}
|
|
12421
13501
|
|
|
13502
|
+
//#endregion
|
|
13503
|
+
//#region src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx
|
|
13504
|
+
function NonTradableInventoryCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, balance, balanceIsLoading, collectibleMetadata }) {
|
|
13505
|
+
return /* @__PURE__ */ jsx(BaseCard, {
|
|
13506
|
+
collectibleId,
|
|
13507
|
+
image: collectibleMetadata.image,
|
|
13508
|
+
video: collectibleMetadata.video,
|
|
13509
|
+
animationUrl: collectibleMetadata.animation_url,
|
|
13510
|
+
chainId,
|
|
13511
|
+
collectionAddress,
|
|
13512
|
+
collectionType,
|
|
13513
|
+
assetSrcPrefixUrl,
|
|
13514
|
+
cardLoading: cardLoading || balanceIsLoading,
|
|
13515
|
+
contractType: collectionType,
|
|
13516
|
+
isShop: false,
|
|
13517
|
+
name: collectibleMetadata.name,
|
|
13518
|
+
children: /* @__PURE__ */ jsx(NonTradableInventoryFooter, {
|
|
13519
|
+
name: collectibleMetadata.name || "",
|
|
13520
|
+
type: collectionType,
|
|
13521
|
+
balance,
|
|
13522
|
+
decimals: collectibleMetadata.decimals
|
|
13523
|
+
})
|
|
13524
|
+
});
|
|
13525
|
+
}
|
|
13526
|
+
|
|
12422
13527
|
//#endregion
|
|
12423
13528
|
//#region src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx
|
|
12424
|
-
function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading,
|
|
13529
|
+
function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, cardType, salesContractAddress, tokenMetadata, salePrice, quantityDecimals, quantityInitial, quantityRemaining, unlimitedSupply, hideQuantitySelector }) {
|
|
12425
13530
|
const { data: saleCurrency, isLoading: saleCurrencyLoading } = useCurrency({
|
|
12426
13531
|
chainId,
|
|
12427
13532
|
currencyAddress: salePrice?.currencyAddress,
|
|
12428
13533
|
query: { enabled: !!salePrice?.currencyAddress && !!salesContractAddress && collectionType === ContractType.ERC1155 }
|
|
12429
13534
|
});
|
|
12430
|
-
const isLoading = cardLoading || saleCurrencyLoading;
|
|
12431
13535
|
if (!tokenMetadata || !salePrice) {
|
|
12432
13536
|
console.error("Token metadata or sale price is undefined", {
|
|
12433
13537
|
tokenMetadata,
|
|
@@ -12437,29 +13541,34 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12437
13541
|
}
|
|
12438
13542
|
const showActionButton = salesContractAddress && collectionType === ContractType.ERC1155 && (unlimitedSupply || quantityRemaining !== void 0 && Number(quantityRemaining) > 0);
|
|
12439
13543
|
const action = CollectibleCardAction.BUY;
|
|
12440
|
-
const mediaClassName = quantityRemaining === "0" || quantityRemaining === void 0 ? "opacity-50" : "opacity-100";
|
|
13544
|
+
const mediaClassName = unlimitedSupply ? "opacity-100" : quantityRemaining === "0" || quantityRemaining === void 0 ? "opacity-50" : "opacity-100";
|
|
12441
13545
|
return /* @__PURE__ */ jsxs(BaseCard, {
|
|
12442
13546
|
collectibleId,
|
|
12443
13547
|
chainId,
|
|
12444
13548
|
collectionAddress,
|
|
12445
13549
|
collectionType,
|
|
12446
13550
|
assetSrcPrefixUrl,
|
|
12447
|
-
cardLoading,
|
|
12448
|
-
|
|
12449
|
-
isLoading,
|
|
13551
|
+
cardLoading: cardLoading || saleCurrencyLoading,
|
|
13552
|
+
cardType,
|
|
12450
13553
|
name: tokenMetadata.name || "",
|
|
12451
13554
|
image: tokenMetadata.image,
|
|
12452
13555
|
video: tokenMetadata.video,
|
|
12453
13556
|
animationUrl: tokenMetadata.animation_url,
|
|
12454
13557
|
mediaClassName,
|
|
13558
|
+
contractType: collectionType,
|
|
13559
|
+
isShop: true,
|
|
13560
|
+
hideQuantitySelector,
|
|
12455
13561
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
13562
|
+
chainId,
|
|
13563
|
+
collectionAddress,
|
|
13564
|
+
collectibleId,
|
|
12456
13565
|
name: tokenMetadata.name || "",
|
|
12457
13566
|
type: collectionType,
|
|
12458
13567
|
decimals: tokenMetadata.decimals,
|
|
12459
13568
|
quantityInitial,
|
|
12460
13569
|
quantityRemaining,
|
|
12461
13570
|
unlimitedSupply,
|
|
12462
|
-
|
|
13571
|
+
cardType,
|
|
12463
13572
|
salePriceAmount: salePrice?.amount,
|
|
12464
13573
|
salePriceCurrency: saleCurrency
|
|
12465
13574
|
}), /* @__PURE__ */ jsx(ActionButtonWrapper, {
|
|
@@ -12469,7 +13578,7 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12469
13578
|
tokenId: collectibleId,
|
|
12470
13579
|
action,
|
|
12471
13580
|
owned: false,
|
|
12472
|
-
|
|
13581
|
+
cardType,
|
|
12473
13582
|
salesContractAddress,
|
|
12474
13583
|
salePrice,
|
|
12475
13584
|
quantityDecimals,
|
|
@@ -12482,13 +13591,13 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
12482
13591
|
//#endregion
|
|
12483
13592
|
//#region src/react/ui/components/marketplace-collectible-card/CollectibleCard.tsx
|
|
12484
13593
|
function CollectibleCard(props) {
|
|
12485
|
-
switch (props.
|
|
13594
|
+
switch (props.cardType) {
|
|
12486
13595
|
case "shop": return /* @__PURE__ */ jsx(ShopCard, { ...props });
|
|
12487
|
-
case "market":
|
|
12488
|
-
|
|
13596
|
+
case "market": return /* @__PURE__ */ jsx(MarketCard, { ...props });
|
|
13597
|
+
case "inventory-non-tradable": return /* @__PURE__ */ jsx(NonTradableInventoryCard, { ...props });
|
|
12489
13598
|
}
|
|
12490
13599
|
}
|
|
12491
13600
|
|
|
12492
13601
|
//#endregion
|
|
12493
|
-
export { ActionModal, CollectibleCard, DatabeatAnalytics, MarketplaceProvider, MarketplaceQueryClientProvider, MarketplaceSdkContext, Media, ModalProvider, collectionDetailsPollingOptions, generateCancelTransaction, generateListingTransaction, generateOfferTransaction, generateSellTransaction,
|
|
12494
|
-
//# sourceMappingURL=react-
|
|
13602
|
+
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, useCountItemsOrdersForCollection, useCountListingsForCollectible, useCountOfCollectables, useCountOfPrimarySaleItems, useCountOffersForCollectible, useCreateListingModal, useCurrency, useEnsureCorrectChain, useErc721SaleDetails, useFilterState, useFilters, useFiltersProgressive, useFloorOrder, useGenerateCancelTransaction, useGenerateListingTransaction, useGenerateOfferTransaction, useGenerateSellTransaction, useGetCountOfFilteredOrders, useGetCountOfPrimarySaleItems, useGetReceiptFromHash, useGetTokenRanges, useHighestOffer, useInventory, useList1155ShopCardData, useList721ShopCardData, useListBalances, useListCollectibleActivities, useListCollectibles, useListCollectiblesPaginated, useListCollectionActivities, useListCollections, useListItemsOrdersForCollection, useListItemsOrdersForCollectionPaginated, useListListingsForCollectible, useListMarketCardData, useListOffersForCollectible, useListPrimarySaleItems, useListTokenMetadata, useLowestListing, useMakeOfferModal, useMarketCurrencies, useMarketplaceConfig, useOpenConnectModal$1 as useOpenConnectModal, useOrderSteps, useProcessStep, useRoyalty, useSearchTokenMetadata, useSellModal, useSuccessfulPurchaseModal, useTokenSupplies, useTransferModal, useTransferTokens };
|
|
13603
|
+
//# sourceMappingURL=react-DE852KeT.js.map
|