@0xsequence/marketplace-sdk 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -3
- package/dist/{BellIcon-ByhygxBO.js → BellIcon.js} +4 -4
- package/dist/BellIcon.js.map +1 -0
- package/dist/{CartIcon-Bt3rQYGk.js → CartIcon.js} +7 -7
- package/dist/CartIcon.js.map +1 -0
- package/dist/CollectibleCard.d.ts +8 -0
- package/dist/{_internal-DkS2VUn5.js → _internal.js} +2 -2
- package/dist/_internal.js.map +1 -0
- package/dist/{abi-fa-o9gH3.js → abi.js} +2 -2
- package/dist/abi.js.map +1 -0
- package/dist/{alien_swap-DoY6XfMA.js → alien_swap.js} +1 -1
- package/dist/alien_swap.js.map +1 -0
- package/dist/{api-BoO0V5aJ.js → api.js} +13 -64
- package/dist/api.js.map +1 -0
- package/dist/{aqua-xyz-BBDxnG14.js → aqua-xyz.js} +1 -1
- package/dist/aqua-xyz.js.map +1 -0
- package/dist/{aura-DGx2zwvF.js → aura.js} +1 -1
- package/dist/aura.js.map +1 -0
- package/dist/{blur-D8GKrRrq.js → blur.js} +1 -1
- package/dist/blur.js.map +1 -0
- package/dist/{builder-api-BFuZNOaN.js → builder-api.js} +3 -3
- package/dist/builder-api.js.map +1 -0
- package/dist/{builder.gen-B9wR2nvF.js → builder.gen.js} +3 -6
- package/dist/builder.gen.js.map +1 -0
- package/dist/{coinbase-DOry4PXY.js → coinbase.js} +1 -1
- package/dist/coinbase.js.map +1 -0
- package/dist/{collectibles-C_H8jMGH.js → collectibles.js} +9 -48
- package/dist/collectibles.js.map +1 -0
- package/dist/{collections-CKummc-R.js → collections.js} +79 -8
- package/dist/collections.js.map +1 -0
- package/dist/{components-CosnX7F9.js → components.js} +12 -14
- package/dist/components.js.map +1 -0
- package/dist/{contracts-BP_0vX48.js → contracts.js} +4 -4
- package/dist/contracts.js.map +1 -0
- package/dist/{create-config-ZOB7i4ZJ.d.ts → create-config.d.ts} +47 -60
- package/dist/{create-config-CIfejoCk.js → create-config.js} +10 -13
- package/dist/create-config.js.map +1 -0
- package/dist/{element-ciybd_VF.js → element.js} +1 -1
- package/dist/element.js.map +1 -0
- package/dist/{filters-V-V8Dn8f.d.ts → filters.d.ts} +7 -7
- package/dist/{foundation-Bq4lRz4x.js → foundation.js} +1 -1
- package/dist/foundation.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +16 -16
- package/dist/{index-DUXfvhxs.d.ts → index10.d.ts} +14 -29
- package/dist/{index-CxA34wP1.d.ts → index11.d.ts} +101 -23
- package/dist/{index-BtWMBHeP.d.ts → index12.d.ts} +11 -9
- package/dist/{index-DmudgrsN.d.ts → index13.d.ts} +16 -16
- package/dist/{index-U-zp70of.d.ts → index14.d.ts} +9 -13
- package/dist/{index-Stm5u0I0.d.ts → index16.d.ts} +7 -10
- package/dist/{index-BZIJTQT0.d.ts → index17.d.ts} +9 -9
- package/dist/{index-CnEbXm_t.d.ts → index19.d.ts} +50 -12
- package/dist/{index-C-745li7.d.ts → index2.d.ts} +2 -2
- package/dist/{index-BOiHR01C.d.ts → index21.d.ts} +9 -9
- package/dist/{index-Bsx6XsC2.d.ts → index23.d.ts} +100 -59
- package/dist/{index-CPzvNmq9.d.ts → index24.d.ts} +36 -36
- package/dist/{index-DFEnA6Wa.d.ts → index25.d.ts} +18 -18
- package/dist/{index-DqXd1EeB.d.ts → index26.d.ts} +14 -7
- package/dist/{index-NlPMNcqh.d.ts → index27.d.ts} +102 -114
- package/dist/{index-DWt6yrIG.d.ts → index28.d.ts} +8 -8
- package/dist/{index-C4MUKshG.d.ts → index29.d.ts} +3 -3
- package/dist/{index-BeRV-7AX.d.ts → index3.d.ts} +2 -2
- package/dist/{index-Bxzjy0d1.d.ts → index4.d.ts} +2 -2
- package/dist/{index-DwKr18CI.d.ts → index5.d.ts} +2 -2
- package/dist/{index-D9LPlmbC.d.ts → index6.d.ts} +2 -2
- package/dist/{index-CS65jqOq.d.ts → index7.d.ts} +19 -3
- package/dist/index8.d.ts +18 -0
- package/dist/{index-CxpFwGvR.d.ts → index9.d.ts} +4 -4
- package/dist/{inventory-Dd7TazvZ.js → inventory.js} +11 -15
- package/dist/inventory.js.map +1 -0
- package/dist/{listCollectiblesPaginated-Cy2_qEZA.d.ts → listCollectiblesPaginated.d.ts} +24 -29
- package/dist/{listCollections-BB9FxKj2.d.ts → listCollections.d.ts} +170 -100
- package/dist/{looks-rare-6H--x3AM.js → looks-rare.js} +1 -1
- package/dist/looks-rare.js.map +1 -0
- package/dist/{lowestListing-Cbsi6M1K.d.ts → lowestListing.d.ts} +28 -28
- package/dist/{magic-eden-BoxEQ1Li.js → magic-eden.js} +1 -1
- package/dist/magic-eden.js.map +1 -0
- package/dist/{manifold-DycKsljb.js → manifold.js} +1 -1
- package/dist/manifold.js.map +1 -0
- package/dist/{market-C3HV-awQ.js → market.js} +7 -9
- package/dist/market.js.map +1 -0
- package/dist/{marketCurrencies-Bpw1bIO0.d.ts → marketCurrencies.d.ts} +19 -9
- package/dist/{marketCurrencies-sKrTX0og.js → marketCurrencies.js} +10 -7
- package/dist/marketCurrencies.js.map +1 -0
- package/dist/{marketplace-logos-D4dS1Foy.js → marketplace-logos.js} +23 -23
- package/dist/marketplace-logos.js.map +1 -0
- package/dist/{marketplace.gen-ksUafDqS.js → marketplace.gen.js} +25 -9
- package/dist/marketplace.gen.js.map +1 -0
- package/dist/{marketplace-NQB-sEQL.js → marketplace.js} +2 -2
- package/dist/marketplace.js.map +1 -0
- package/dist/{marketplaceConfig-UHQMM9fq.js → marketplaceConfig.js} +3 -3
- package/dist/marketplaceConfig.js.map +1 -0
- package/dist/{mintify-Dyqyo8jQ.js → mintify.js} +1 -1
- package/dist/mintify.js.map +1 -0
- package/dist/{network-DtmiMhcg.js → network.js} +3 -3
- package/dist/network.js.map +1 -0
- package/dist/{networkconfigToWagmiChain-DbUf6HiO.js → networkconfigToWagmiChain.js} +4 -3
- package/dist/networkconfigToWagmiChain.js.map +1 -0
- package/dist/{nftx-2LbFjj9Q.js → nftx.js} +1 -1
- package/dist/nftx.js.map +1 -0
- package/dist/{okx-CBEWJNsR.js → okx.js} +1 -1
- package/dist/okx.js.map +1 -0
- package/dist/{open-sea-Dxntz_PA.js → open-sea.js} +1 -1
- package/dist/open-sea.js.map +1 -0
- package/dist/{orders-DnFfZAXV.js → orders.js} +10 -10
- package/dist/orders.js.map +1 -0
- package/dist/{primary-sale-1u4QlPdA.js → primary-sale.js} +2 -2
- package/dist/primary-sale.js.map +1 -0
- package/dist/{primary-sales-Dmsi6bqj.js → primary-sales.js} +41 -3
- package/dist/primary-sales.js.map +1 -0
- package/dist/{query-BWbCsXLY.d.ts → query.d.ts} +2 -2
- package/dist/{rarible-CS0SupHr.js → rarible.js} +1 -1
- package/dist/rarible.js.map +1 -0
- package/dist/react/_internal/api/index.d.ts +2 -2
- package/dist/react/_internal/api/index.js +7 -7
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +37 -38
- package/dist/react/_internal/index.d.ts +2 -2
- package/dist/react/_internal/index.js +11 -11
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/_internal/wagmi/index.js +5 -5
- package/dist/react/hooks/config/index.d.ts +8 -8
- package/dist/react/hooks/config/index.js +37 -38
- package/dist/react/hooks/contracts/index.d.ts +6 -6
- package/dist/react/hooks/contracts/index.js +15 -15
- package/dist/react/hooks/data/collectibles/index.d.ts +4 -10
- package/dist/react/hooks/data/collectibles/index.js +37 -38
- package/dist/react/hooks/data/collections/index.d.ts +11 -11
- package/dist/react/hooks/data/collections/index.js +38 -39
- package/dist/react/hooks/data/index.d.ts +37 -37
- package/dist/react/hooks/data/index.js +38 -39
- package/dist/react/hooks/data/inventory/index.d.ts +36 -36
- package/dist/react/hooks/data/inventory/index.js +37 -38
- package/dist/react/hooks/data/market/index.d.ts +5 -11
- package/dist/react/hooks/data/market/index.js +37 -38
- package/dist/react/hooks/data/orders/index.d.ts +4 -10
- package/dist/react/hooks/data/orders/index.js +37 -38
- package/dist/react/hooks/data/primary-sales/index.d.ts +37 -37
- package/dist/react/hooks/data/primary-sales/index.js +38 -39
- package/dist/react/hooks/data/tokens/index.d.ts +4 -4
- package/dist/react/hooks/data/tokens/index.js +37 -38
- package/dist/react/hooks/index.d.ts +37 -37
- package/dist/react/hooks/index.js +38 -39
- package/dist/react/hooks/transactions/index.d.ts +2 -2
- package/dist/react/hooks/transactions/index.js +37 -38
- package/dist/react/hooks/ui/index.d.ts +4 -4
- package/dist/react/hooks/ui/index.js +37 -38
- package/dist/react/hooks/utils/index.d.ts +36 -36
- package/dist/react/hooks/utils/index.js +37 -38
- package/dist/react/index.d.ts +37 -37
- package/dist/react/index.js +38 -39
- package/dist/react/queries/collectibles/index.d.ts +4 -10
- package/dist/react/queries/collectibles/index.js +20 -21
- package/dist/react/queries/collections/index.d.ts +11 -11
- package/dist/react/queries/collections/index.js +19 -19
- package/dist/react/queries/index.d.ts +24 -24
- package/dist/react/queries/index.js +30 -31
- package/dist/react/queries/inventory/index.d.ts +2 -2
- package/dist/react/queries/inventory/index.js +20 -20
- package/dist/react/queries/market/index.d.ts +5 -5
- package/dist/react/queries/market/index.js +20 -20
- package/dist/react/queries/orders/index.d.ts +4 -10
- package/dist/react/queries/orders/index.js +11 -11
- package/dist/react/queries/primary-sales/index.d.ts +4 -4
- package/dist/react/queries/primary-sales/index.js +12 -12
- package/dist/react/queries/tokens/index.d.ts +4 -4
- package/dist/react/queries/tokens/index.js +11 -12
- package/dist/react/queries/utils/index.d.ts +3 -3
- package/dist/react/queries/utils/index.js +20 -20
- package/dist/react/ssr/index.d.ts +7 -7
- package/dist/react/ssr/index.js +13 -16
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +2 -2
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +20 -20
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +7 -10
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +37 -38
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +4 -4
- package/dist/react/ui/components/marketplace-collectible-card/index.js +37 -38
- package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +2 -2
- package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +11 -11
- package/dist/react/ui/components/marketplace-logos/index.d.ts +21 -21
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/icons/index.js +14 -14
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +37 -38
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +37 -38
- package/dist/react/utils/index.d.ts +1 -1
- package/dist/react/utils/index.js +7 -7
- package/dist/{react-DE852KeT.js → react.js} +720 -926
- package/dist/react.js.map +1 -0
- package/dist/{sequence-paCCener.js → sequence.js} +1 -1
- package/dist/sequence.js.map +1 -0
- package/dist/{src-Dz2CfBL0.js → src.js} +2 -2
- package/dist/src.js.map +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/{sudo-swap-9rH2EgfT.js → sudo-swap.js} +1 -1
- package/dist/sudo-swap.js.map +1 -0
- package/dist/{super-rare-DHIuWtRw.js → super-rare.js} +1 -1
- package/dist/super-rare.js.map +1 -0
- package/dist/{token-Cv7l2ZaL.js → token.js} +2 -2
- package/dist/token.js.map +1 -0
- package/dist/{tokenBalances-ibDerNmM.js → tokenBalances.js} +4 -11
- package/dist/tokenBalances.js.map +1 -0
- package/dist/{tokenSupplies-Bfe8RHzI.d.ts → tokenSupplies.d.ts} +19 -30
- package/dist/{tokens-cGxMadd8.js → tokens.js} +47 -22
- package/dist/tokens.js.map +1 -0
- package/dist/{transaction-DZUW5RHu.js → transaction.js} +2 -2
- package/dist/transaction.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +3 -3
- package/dist/{types-D2TJ1dwv.d.ts → types.d.ts} +3 -3
- package/dist/{types-B_-cnkcP.js → types.js} +2 -2
- package/dist/types.js.map +1 -0
- package/dist/utils/abi/index.d.ts +4 -4
- package/dist/utils/abi/index.js +4 -4
- package/dist/utils/abi/marketplace/index.d.ts +1 -1
- package/dist/utils/abi/marketplace/index.js +1 -1
- package/dist/utils/abi/primary-sale/index.d.ts +1 -1
- package/dist/utils/abi/primary-sale/index.js +1 -1
- package/dist/utils/abi/token/index.d.ts +1 -1
- package/dist/utils/abi/token/index.js +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +13 -13
- package/dist/{utils-BfpDVibN.js → utils.js} +42 -4
- package/dist/utils.js.map +1 -0
- package/dist/{utils-BCgNhBFR.js → utils2.js} +11 -5
- package/dist/utils2.js.map +1 -0
- package/dist/{utils-BqxcalL2.js → utils3.js} +3 -3
- package/dist/utils3.js.map +1 -0
- package/dist/{waitForTransactionReceipt-DieAnV52.js → waitForTransactionReceipt.js} +3 -3
- package/dist/waitForTransactionReceipt.js.map +1 -0
- package/dist/{x2y2-45WDooeh.js → x2y2.js} +1 -1
- package/dist/x2y2.js.map +1 -0
- package/dist/{zora-CbeBoLvQ.js → zora.js} +1 -1
- package/dist/zora.js.map +1 -0
- package/package.json +42 -42
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +13 -0
- package/src/react/_internal/api/index.ts +0 -1
- package/src/react/_internal/api/marketplace.gen.ts +70 -26
- package/src/react/_internal/api/query-keys.ts +9 -0
- package/src/react/_internal/wagmi/get-connectors.ts +12 -1
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +0 -9
- package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -16
- package/src/react/hooks/data/collectibles/useTokenBalances.tsx +0 -9
- package/src/react/hooks/data/collections/index.ts +2 -0
- package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +112 -0
- package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx +74 -0
- package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +110 -0
- package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx +74 -0
- package/src/react/hooks/data/inventory/useInventory.tsx +1 -10
- package/src/react/hooks/data/market/useMarketCurrencies.test.tsx +31 -2
- package/src/react/hooks/data/primary-sales/index.ts +1 -0
- package/src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx +71 -0
- package/src/react/hooks/data/tokens/useListBalances.tsx +1 -10
- package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -13
- package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +2 -0
- package/src/react/hooks/transactions/useProcessStep.test.tsx +8 -6
- package/src/react/hooks/transactions/useProcessStep.ts +8 -6
- package/src/react/hooks/utils/useComparePrices.test.tsx +1 -1
- package/src/react/providers/modal-provider.tsx +2 -1
- package/src/react/queries/collectibles/balanceOfCollectible.ts +1 -15
- package/src/react/queries/collectibles/listCollectibles.ts +1 -54
- package/src/react/queries/collectibles/tokenBalances.ts +1 -15
- package/src/react/queries/collections/activeListingsCurrencies.ts +84 -0
- package/src/react/queries/collections/activeOffersCurrencies.ts +84 -0
- package/src/react/queries/collections/index.ts +2 -0
- package/src/react/queries/inventory/inventory.ts +2 -9
- package/src/react/queries/market/marketCurrencies.ts +8 -1
- package/src/react/queries/primary-sales/index.ts +1 -0
- package/src/react/queries/primary-sales/primarySaleItem.ts +80 -0
- package/src/react/queries/tokens/listBalances.ts +1 -21
- package/src/react/queries/tokens/tokenSupplies.ts +2 -31
- package/src/react/queries/utils/comparePrices.ts +13 -1
- package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +2 -0
- package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +4 -18
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +2 -2
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +0 -2
- package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +3 -0
- package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +152 -141
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +1 -0
- package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +44 -60
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155SalePaymentParams.test.tsx +381 -0
- package/src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts +257 -0
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +0 -23
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +22 -2
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +2 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +2 -0
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +2 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +1 -1
- package/src/react/ui/modals/TransferModal/index.tsx +24 -2
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +15 -12
- package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +2 -0
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +148 -11
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +2 -0
- package/src/styles/styles.ts +2 -2
- package/src/utils/networkconfigToWagmiChain.ts +7 -0
- package/src/utils/price.ts +58 -0
- package/test/const.ts +2 -0
- package/test/server-setup.ts +0 -2
- package/tsdown.config.ts +1 -0
- package/.changeset/honest-peas-arrive.md +0 -5
- package/.changeset/real-tips-stick.md +0 -8
- package/.changeset/tall-pandas-wear.md +0 -8
- package/dist/BellIcon-ByhygxBO.js.map +0 -1
- package/dist/CartIcon-Bt3rQYGk.js.map +0 -1
- package/dist/CollectibleCard-CVpdgXA8.d.ts +0 -8
- package/dist/_internal-DkS2VUn5.js.map +0 -1
- package/dist/abi-fa-o9gH3.js.map +0 -1
- package/dist/alien_swap-DoY6XfMA.js.map +0 -1
- package/dist/api-BoO0V5aJ.js.map +0 -1
- package/dist/aqua-xyz-BBDxnG14.js.map +0 -1
- package/dist/aura-DGx2zwvF.js.map +0 -1
- package/dist/blur-D8GKrRrq.js.map +0 -1
- package/dist/builder-api-BFuZNOaN.js.map +0 -1
- package/dist/builder.gen-B9wR2nvF.js.map +0 -1
- package/dist/coinbase-DOry4PXY.js.map +0 -1
- package/dist/collectibles-C_H8jMGH.js.map +0 -1
- package/dist/collections-CKummc-R.js.map +0 -1
- package/dist/components-CosnX7F9.js.map +0 -1
- package/dist/contracts-BP_0vX48.js.map +0 -1
- package/dist/create-config-CIfejoCk.js.map +0 -1
- package/dist/element-ciybd_VF.js.map +0 -1
- package/dist/foundation-Bq4lRz4x.js.map +0 -1
- package/dist/index-DNNUeZEq.d.ts +0 -18
- package/dist/inventory-Dd7TazvZ.js.map +0 -1
- package/dist/listBalances-BxpxBCvn.js +0 -57
- package/dist/listBalances-BxpxBCvn.js.map +0 -1
- package/dist/looks-rare-6H--x3AM.js.map +0 -1
- package/dist/magic-eden-BoxEQ1Li.js.map +0 -1
- package/dist/manifold-DycKsljb.js.map +0 -1
- package/dist/market-C3HV-awQ.js.map +0 -1
- package/dist/marketCurrencies-sKrTX0og.js.map +0 -1
- package/dist/marketplace-NQB-sEQL.js.map +0 -1
- package/dist/marketplace-logos-D4dS1Foy.js.map +0 -1
- package/dist/marketplace.gen-ksUafDqS.js.map +0 -1
- package/dist/marketplaceConfig-UHQMM9fq.js.map +0 -1
- package/dist/mintify-Dyqyo8jQ.js.map +0 -1
- package/dist/network-DtmiMhcg.js.map +0 -1
- package/dist/networkconfigToWagmiChain-DbUf6HiO.js.map +0 -1
- package/dist/nftx-2LbFjj9Q.js.map +0 -1
- package/dist/okx-CBEWJNsR.js.map +0 -1
- package/dist/open-sea-Dxntz_PA.js.map +0 -1
- package/dist/orders-DnFfZAXV.js.map +0 -1
- package/dist/primary-sale-1u4QlPdA.js.map +0 -1
- package/dist/primary-sales-Dmsi6bqj.js.map +0 -1
- package/dist/rarible-CS0SupHr.js.map +0 -1
- package/dist/react-DE852KeT.js.map +0 -1
- package/dist/sequence-paCCener.js.map +0 -1
- package/dist/src-Dz2CfBL0.js.map +0 -1
- package/dist/sudo-swap-9rH2EgfT.js.map +0 -1
- package/dist/super-rare-DHIuWtRw.js.map +0 -1
- package/dist/token-Cv7l2ZaL.js.map +0 -1
- package/dist/tokenBalances-ibDerNmM.js.map +0 -1
- package/dist/tokens-cGxMadd8.js.map +0 -1
- package/dist/transaction-DZUW5RHu.js.map +0 -1
- package/dist/types-B_-cnkcP.js.map +0 -1
- package/dist/utils-BCgNhBFR.js.map +0 -1
- package/dist/utils-BfpDVibN.js.map +0 -1
- package/dist/utils-BqxcalL2.js.map +0 -1
- package/dist/waitForTransactionReceipt-DieAnV52.js.map +0 -1
- package/dist/x2y2-45WDooeh.js.map +0 -1
- package/dist/zora-CbeBoLvQ.js.map +0 -1
- package/src/react/_internal/api/__mocks__/laos.msw.ts +0 -387
- package/src/react/_internal/api/__tests__/laos-api.test.ts +0 -756
- package/src/react/_internal/api/laos-api.ts +0 -106
- package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +0 -367
- package/src/react/queries/collectibles/__tests__/balanceOfCollectible.laos.test.ts +0 -123
- package/src/react/queries/collectibles/__tests__/tokenBalances.laos.test.ts +0 -123
- package/src/react/queries/inventory/__tests__/inventory.laos.test.ts +0 -499
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155Checkout.test.tsx +0 -395
- package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +0 -103
- package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +0 -481
- /package/dist/{index-6wsMChsg.d.ts → index15.d.ts} +0 -0
- /package/dist/{index-CZUtOTjh.d.ts → index18.d.ts} +0 -0
- /package/dist/{index-DW3njUfb.d.ts → index20.d.ts} +0 -0
- /package/dist/{index-DewGsFz5.d.ts → index22.d.ts} +0 -0
- /package/dist/{queries-KOcILNJO.js → queries.js} +0 -0
- /package/dist/{wagmi-Bseovd6Q.js → wagmi.js} +0 -0
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { DEFAULT_MARKETPLACE_FEE_PERCENTAGE } from "./src
|
|
3
|
-
import {
|
|
4
|
-
import { balanceQueries,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { PROVIDER_ID, TransactionType } from "./_internal
|
|
8
|
-
import { CollectibleCardAction } from "./types
|
|
9
|
-
import {
|
|
10
|
-
import { ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1 } from "./primary-sale
|
|
11
|
-
import { ERC1155_ABI, ERC721_ABI } from "./token
|
|
12
|
-
import {
|
|
13
|
-
import { marketplaceConfigOptions } from "./marketplaceConfig
|
|
14
|
-
import {
|
|
15
|
-
import { balanceOfCollectibleOptions,
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { FooterName, PriceDisplay, SaleDetailsPill, TokenTypeBalancePill } from "./components-CosnX7F9.js";
|
|
2
|
+
import { t as DEFAULT_MARKETPLACE_FEE_PERCENTAGE } from "./src.js";
|
|
3
|
+
import { a as TransactionExecutionError, c as BaseError$1, i as NoWalletConnectedError, n as InvalidContractTypeError, o as TransactionSignatureError, s as UserRejectedRequestError$1, t as ChainSwitchError } from "./transaction.js";
|
|
4
|
+
import { _ as getQueryClient, c as balanceQueries, o as marketplaceApiURL, r as getMarketplaceClient, u as collectableKeys } from "./api.js";
|
|
5
|
+
import { A as PropertyType, P as StepType, S as OrderbookKind, U as WalletKind, b as OrderSide, l as ExecuteType, o as CollectionStatus, s as ContractType, y as OfferType } from "./marketplace.gen.js";
|
|
6
|
+
import { n as getPresentableChainName, t as getNetwork } from "./network.js";
|
|
7
|
+
import { n as PROVIDER_ID, t as TransactionType } from "./_internal.js";
|
|
8
|
+
import { t as CollectibleCardAction } from "./types.js";
|
|
9
|
+
import { n as SequenceMarketplaceV1_ABI, r as EIP2981_ABI } from "./marketplace.js";
|
|
10
|
+
import { i as ERC721_SALE_ABI_V0, r as ERC721_SALE_ABI_V1 } from "./primary-sale.js";
|
|
11
|
+
import { n as ERC1155_ABI, r as ERC721_ABI } from "./token.js";
|
|
12
|
+
import { a as formatPriceWithFee, c as cn$1, d as truncateMiddle, l as compareAddress, o as validateOpenseaOfferDecimals, r as calculateTotalOfferCost, t as calculateEarningsAfterFees } from "./utils.js";
|
|
13
|
+
import { n as marketplaceConfigOptions } from "./marketplaceConfig.js";
|
|
14
|
+
import { n as useSalesContractABI, t as SalesContractVersion } from "./contracts.js";
|
|
15
|
+
import { g as balanceOfCollectibleOptions, l as listCollectibleActivitiesQueryOptions, o as listCollectiblesQueryOptions, p as collectibleQueryOptions, r as listCollectiblesPaginatedQueryOptions, u as countOfCollectablesQueryOptions } from "./collectibles.js";
|
|
16
|
+
import { _ as collectionActiveListingsCurrenciesQueryOptions, b as collectionQueryOptions, c as collectionDetailsQueryOptions, d as collectionBalanceDetailsQueryOptions, i as listCollectionsQueryOptions, m as collectionActiveOffersCurrenciesQueryOptions, s as listCollectionActivitiesQueryOptions } from "./collections.js";
|
|
17
|
+
import { i as checkoutOptionsSalesContractQueryOptions, n as filtersQueryOptions, s as checkoutOptionsQueryOptions, u as currencyQueryOptions } from "./market.js";
|
|
18
|
+
import { r as marketCurrenciesQueryOptions } from "./marketCurrencies.js";
|
|
19
|
+
import { A as countItemsOrdersForCollectionQueryOptions, D as countListingsForCollectibleQueryOptions, S as floorOrderQueryOptions, _ as highestOfferQueryOptions, b as getCountOfFilteredOrdersQueryOptions, d as listItemsOrdersForCollectionPaginatedQueryOptions, l as listListingsForCollectibleQueryOptions, m as listItemsOrdersForCollectionQueryOptions, o as listOffersForCollectibleQueryOptions, r as lowestListingQueryOptions, w as countOffersForCollectibleQueryOptions } from "./orders.js";
|
|
20
|
+
import { n as inventoryOptions } from "./inventory.js";
|
|
21
|
+
import { l as primarySaleItemQueryOptions, o as listPrimarySaleItemsQueryOptions, r as primarySaleItemsCountQueryOptions, u as countOfPrimarySaleItemsOptions } from "./primary-sales.js";
|
|
22
|
+
import { f as listBalancesOptions, h as getTokenRangesQueryOptions, l as listTokenMetadataQueryOptions, o as searchTokenMetadataQueryOptions, r as tokenSuppliesQueryOptions } from "./tokens.js";
|
|
23
|
+
import { i as convertPriceToUSDQueryOptions, t as comparePricesQueryOptions } from "./utils2.js";
|
|
24
|
+
import { t as waitForTransactionReceipt } from "./waitForTransactionReceipt.js";
|
|
25
|
+
import { n as CalendarIcon_default, r as InfoIcon_default, t as CartIcon_default } from "./CartIcon.js";
|
|
26
|
+
import { a as FooterName, n as SaleDetailsPill, r as PriceDisplay, t as TokenTypeBalancePill } from "./components.js";
|
|
28
27
|
import { NetworkType, networks } from "@0xsequence/network";
|
|
29
28
|
import { useAccount, useBalance, useChainId, usePublicClient, useReadContract, useReadContracts, useSendTransaction, useSignMessage, useSignTypedData, useSwitchChain, useWriteContract } from "wagmi";
|
|
30
29
|
import { useChain, useOpenConnectModal, useWaasFeeOptions } from "@0xsequence/connect";
|
|
31
30
|
import { Suspense, createContext, lazy, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
32
31
|
import { QueryClientProvider, queryOptions, skipToken, useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
|
33
32
|
import { TransactionStatus } from "@0xsequence/indexer";
|
|
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";
|
|
33
|
+
import { AddIcon, Button, CheckmarkIcon, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Divider, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger, ExternalLinkIcon, IconButton, Image, InfoIcon, Modal, NetworkImage, NumericInput, Select, Skeleton, Spinner, SubtractIcon, Text, TextInput, ThemeProvider, TimeIcon, TokenImage, Tooltip, WarningIcon, cn } from "@0xsequence/design-system";
|
|
35
34
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
35
|
import * as dn from "dnum";
|
|
37
36
|
import { BaseError, UserRejectedRequestError, WaitForTransactionReceiptTimeoutError, decodeFunctionData, encodeFunctionData, erc20Abi, erc721Abi, formatUnits, hexToBigInt, isAddress, isHex, maxUint256, parseEventLogs, parseUnits, toHex, zeroAddress } from "viem";
|
|
@@ -40,7 +39,7 @@ import { observable } from "@legendapp/state";
|
|
|
40
39
|
import { createStore } from "@xstate/store";
|
|
41
40
|
import { useSelector } from "@xstate/store/react";
|
|
42
41
|
import { createSerializer, parseAsBoolean, parseAsJson, parseAsString, useQueryState } from "nuqs";
|
|
43
|
-
import { SequenceCheckoutProvider,
|
|
42
|
+
import { SequenceCheckoutProvider, useSelectPaymentModal } from "@0xsequence/checkout";
|
|
44
43
|
import { Show, observer, use$ } from "@legendapp/state/react";
|
|
45
44
|
import { addDays, differenceInDays, endOfDay, format, formatDistanceToNow, getHours, getMinutes, isSameDay, setHours, setMinutes, startOfDay } from "date-fns";
|
|
46
45
|
import { avalanche, optimism } from "viem/chains";
|
|
@@ -183,9 +182,8 @@ function MarketplaceProvider({ config, children, openConnectModal }) {
|
|
|
183
182
|
});
|
|
184
183
|
}
|
|
185
184
|
function MarketplaceQueryClientProvider({ children }) {
|
|
186
|
-
const queryClient = getQueryClient();
|
|
187
185
|
return /* @__PURE__ */ jsx(QueryClientProvider, {
|
|
188
|
-
client:
|
|
186
|
+
client: getQueryClient(),
|
|
189
187
|
children
|
|
190
188
|
});
|
|
191
189
|
}
|
|
@@ -219,19 +217,17 @@ const useConnectorMetadata = () => {
|
|
|
219
217
|
const { connector } = useAccount();
|
|
220
218
|
const isWaaS = connector?.id.endsWith("waas") ?? false;
|
|
221
219
|
const isSequence = connector?.id.includes("sequence");
|
|
222
|
-
const walletKind = isSequence ? WalletKind.sequence : WalletKind.unknown;
|
|
223
220
|
return {
|
|
224
221
|
isWaaS,
|
|
225
222
|
isSequence,
|
|
226
|
-
walletKind
|
|
223
|
+
walletKind: isSequence ? WalletKind.sequence : WalletKind.unknown
|
|
227
224
|
};
|
|
228
225
|
};
|
|
229
226
|
|
|
230
227
|
//#endregion
|
|
231
228
|
//#region src/react/hooks/config/useMarketplaceConfig.tsx
|
|
232
229
|
const useMarketplaceConfig = () => {
|
|
233
|
-
|
|
234
|
-
return useQuery(marketplaceConfigOptions(config));
|
|
230
|
+
return useQuery(marketplaceConfigOptions(useConfig()));
|
|
235
231
|
};
|
|
236
232
|
|
|
237
233
|
//#endregion
|
|
@@ -258,12 +254,7 @@ const useMarketplaceConfig = () => {
|
|
|
258
254
|
*/
|
|
259
255
|
function useBalanceOfCollectible(args) {
|
|
260
256
|
const config = useConfig();
|
|
261
|
-
|
|
262
|
-
const isLaos721 = (marketplaceConfig?.market.collections.find((collection) => collection.itemsAddress === args.collectionAddress))?.contractType === ContractType.LAOS_ERC_721;
|
|
263
|
-
return useQuery(balanceOfCollectibleOptions({
|
|
264
|
-
...args,
|
|
265
|
-
isLaos721
|
|
266
|
-
}, config));
|
|
257
|
+
return useQuery(balanceOfCollectibleOptions({ ...args }, config));
|
|
267
258
|
}
|
|
268
259
|
|
|
269
260
|
//#endregion
|
|
@@ -308,12 +299,11 @@ function useBalanceOfCollectible(args) {
|
|
|
308
299
|
*/
|
|
309
300
|
function useCollectible(params) {
|
|
310
301
|
const defaultConfig = useConfig();
|
|
311
|
-
const { config = defaultConfig
|
|
312
|
-
|
|
302
|
+
const { config = defaultConfig, ...rest } = params;
|
|
303
|
+
return useQuery({ ...collectibleQueryOptions({
|
|
313
304
|
config,
|
|
314
305
|
...rest
|
|
315
|
-
});
|
|
316
|
-
return useQuery({ ...queryOptions$1 });
|
|
306
|
+
}) });
|
|
317
307
|
}
|
|
318
308
|
|
|
319
309
|
//#endregion
|
|
@@ -356,12 +346,11 @@ function useCollectible(params) {
|
|
|
356
346
|
*/
|
|
357
347
|
function useCountOfCollectables(params) {
|
|
358
348
|
const defaultConfig = useConfig();
|
|
359
|
-
const { config = defaultConfig
|
|
360
|
-
|
|
349
|
+
const { config = defaultConfig, ...rest } = params;
|
|
350
|
+
return useQuery({ ...countOfCollectablesQueryOptions({
|
|
361
351
|
config,
|
|
362
352
|
...rest
|
|
363
|
-
});
|
|
364
|
-
return useQuery({ ...queryOptions$1 });
|
|
353
|
+
}) });
|
|
365
354
|
}
|
|
366
355
|
|
|
367
356
|
//#endregion
|
|
@@ -419,12 +408,11 @@ function useCountOfCollectables(params) {
|
|
|
419
408
|
*/
|
|
420
409
|
function useListCollectibleActivities(params) {
|
|
421
410
|
const defaultConfig = useConfig();
|
|
422
|
-
const { config = defaultConfig
|
|
423
|
-
|
|
411
|
+
const { config = defaultConfig, ...rest } = params;
|
|
412
|
+
return useQuery({ ...listCollectibleActivitiesQueryOptions({
|
|
424
413
|
config,
|
|
425
414
|
...rest
|
|
426
|
-
});
|
|
427
|
-
return useQuery({ ...queryOptions$1 });
|
|
415
|
+
}) });
|
|
428
416
|
}
|
|
429
417
|
|
|
430
418
|
//#endregion
|
|
@@ -433,14 +421,13 @@ function useListCollectibleActivities(params) {
|
|
|
433
421
|
* Hook to fetch a list of collectibles with infinite pagination support
|
|
434
422
|
*
|
|
435
423
|
* Fetches collectibles from the marketplace with support for filtering, pagination,
|
|
436
|
-
* and special handling for shop marketplace types
|
|
424
|
+
* and special handling for shop marketplace types.
|
|
437
425
|
*
|
|
438
426
|
* @param params - Configuration parameters
|
|
439
427
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
440
428
|
* @param params.collectionAddress - The collection contract address
|
|
441
429
|
* @param params.side - Order side (listing or bid)
|
|
442
430
|
* @param params.filter - Optional filtering parameters
|
|
443
|
-
* @param params.isLaos721 - Whether the collection is a LAOS721 contract
|
|
444
431
|
* @param params.marketplaceType - Type of marketplace (shop, etc.)
|
|
445
432
|
* @param params.query - Optional React Query configuration
|
|
446
433
|
*
|
|
@@ -470,29 +457,14 @@ function useListCollectibleActivities(params) {
|
|
|
470
457
|
* }
|
|
471
458
|
* })
|
|
472
459
|
* ```
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* For LAOS721 collections:
|
|
476
|
-
* ```typescript
|
|
477
|
-
* const { data } = useListCollectibles({
|
|
478
|
-
* chainId: 137,
|
|
479
|
-
* collectionAddress: '0x...',
|
|
480
|
-
* side: OrderSide.listing,
|
|
481
|
-
* isLaos721: true,
|
|
482
|
-
* filter: {
|
|
483
|
-
* inAccounts: ['0x...']
|
|
484
|
-
* }
|
|
485
|
-
* })
|
|
486
|
-
* ```
|
|
487
460
|
*/
|
|
488
461
|
function useListCollectibles(params) {
|
|
489
462
|
const defaultConfig = useConfig();
|
|
490
|
-
const { config = defaultConfig
|
|
491
|
-
|
|
463
|
+
const { config = defaultConfig, ...rest } = params;
|
|
464
|
+
return useInfiniteQuery({ ...listCollectiblesQueryOptions({
|
|
492
465
|
config,
|
|
493
466
|
...rest
|
|
494
|
-
});
|
|
495
|
-
return useInfiniteQuery({ ...queryOptions$1 });
|
|
467
|
+
}) });
|
|
496
468
|
}
|
|
497
469
|
|
|
498
470
|
//#endregion
|
|
@@ -559,12 +531,11 @@ function useListCollectibles(params) {
|
|
|
559
531
|
*/
|
|
560
532
|
function useListCollectiblesPaginated(params) {
|
|
561
533
|
const defaultConfig = useConfig();
|
|
562
|
-
const { config = defaultConfig
|
|
563
|
-
|
|
534
|
+
const { config = defaultConfig, ...rest } = params;
|
|
535
|
+
return useQuery({ ...listCollectiblesPaginatedQueryOptions({
|
|
564
536
|
config,
|
|
565
537
|
...rest
|
|
566
|
-
});
|
|
567
|
-
return useQuery({ ...queryOptions$1 });
|
|
538
|
+
}) });
|
|
568
539
|
}
|
|
569
540
|
|
|
570
541
|
//#endregion
|
|
@@ -606,12 +577,103 @@ function useListCollectiblesPaginated(params) {
|
|
|
606
577
|
*/
|
|
607
578
|
function useCollection(params) {
|
|
608
579
|
const defaultConfig = useConfig();
|
|
609
|
-
const { config = defaultConfig
|
|
610
|
-
|
|
580
|
+
const { config = defaultConfig, ...rest } = params;
|
|
581
|
+
return useQuery({ ...collectionQueryOptions({
|
|
611
582
|
config,
|
|
612
583
|
...rest
|
|
613
|
-
});
|
|
614
|
-
|
|
584
|
+
}) });
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx
|
|
589
|
+
/**
|
|
590
|
+
* Hook to fetch the active listings currencies for a collection
|
|
591
|
+
*
|
|
592
|
+
* Retrieves all currencies that are currently being used in active listings
|
|
593
|
+
* for a specific collection from the marketplace.
|
|
594
|
+
*
|
|
595
|
+
* @param params - Configuration parameters
|
|
596
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
597
|
+
* @param params.collectionAddress - The collection contract address
|
|
598
|
+
* @param params.query - Optional React Query configuration
|
|
599
|
+
*
|
|
600
|
+
* @returns Query result containing the array of currencies used in active listings
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* Basic usage:
|
|
604
|
+
* ```typescript
|
|
605
|
+
* const { data, isLoading } = useCollectionActiveListingsCurrencies({
|
|
606
|
+
* chainId: 137,
|
|
607
|
+
* collectionAddress: '0x...'
|
|
608
|
+
* })
|
|
609
|
+
* ```
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* With custom query options:
|
|
613
|
+
* ```typescript
|
|
614
|
+
* const { data, isLoading } = useCollectionActiveListingsCurrencies({
|
|
615
|
+
* chainId: 1,
|
|
616
|
+
* collectionAddress: '0x...',
|
|
617
|
+
* query: {
|
|
618
|
+
* refetchInterval: 30000,
|
|
619
|
+
* enabled: hasCollectionAddress
|
|
620
|
+
* }
|
|
621
|
+
* })
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
function useCollectionActiveListingsCurrencies(params) {
|
|
625
|
+
const defaultConfig = useConfig();
|
|
626
|
+
const { config = defaultConfig, ...rest } = params;
|
|
627
|
+
return useQuery({ ...collectionActiveListingsCurrenciesQueryOptions({
|
|
628
|
+
config,
|
|
629
|
+
...rest
|
|
630
|
+
}) });
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx
|
|
635
|
+
/**
|
|
636
|
+
* Hook to fetch the active offers currencies for a collection
|
|
637
|
+
*
|
|
638
|
+
* Retrieves all currencies that are currently being used in active offers
|
|
639
|
+
* for a specific collection from the marketplace.
|
|
640
|
+
*
|
|
641
|
+
* @param params - Configuration parameters
|
|
642
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
643
|
+
* @param params.collectionAddress - The collection contract address
|
|
644
|
+
* @param params.query - Optional React Query configuration
|
|
645
|
+
*
|
|
646
|
+
* @returns Query result containing the array of currencies used in active offers
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* Basic usage:
|
|
650
|
+
* ```typescript
|
|
651
|
+
* const { data, isLoading } = useCollectionActiveOffersCurrencies({
|
|
652
|
+
* chainId: 137,
|
|
653
|
+
* collectionAddress: '0x...'
|
|
654
|
+
* })
|
|
655
|
+
* ```
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* With custom query options:
|
|
659
|
+
* ```typescript
|
|
660
|
+
* const { data, isLoading } = useCollectionActiveOffersCurrencies({
|
|
661
|
+
* chainId: 1,
|
|
662
|
+
* collectionAddress: '0x...',
|
|
663
|
+
* query: {
|
|
664
|
+
* refetchInterval: 30000,
|
|
665
|
+
* enabled: hasCollectionAddress
|
|
666
|
+
* }
|
|
667
|
+
* })
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
670
|
+
function useCollectionActiveOffersCurrencies(params) {
|
|
671
|
+
const defaultConfig = useConfig();
|
|
672
|
+
const { config = defaultConfig, ...rest } = params;
|
|
673
|
+
return useQuery({ ...collectionActiveOffersCurrenciesQueryOptions({
|
|
674
|
+
config,
|
|
675
|
+
...rest
|
|
676
|
+
}) });
|
|
615
677
|
}
|
|
616
678
|
|
|
617
679
|
//#endregion
|
|
@@ -669,12 +731,11 @@ function useCollection(params) {
|
|
|
669
731
|
*/
|
|
670
732
|
function useCollectionBalanceDetails(params) {
|
|
671
733
|
const defaultConfig = useConfig();
|
|
672
|
-
const { config = defaultConfig
|
|
673
|
-
|
|
734
|
+
const { config = defaultConfig, ...rest } = params;
|
|
735
|
+
return useQuery({ ...collectionBalanceDetailsQueryOptions({
|
|
674
736
|
config,
|
|
675
737
|
...rest
|
|
676
|
-
});
|
|
677
|
-
return useQuery({ ...queryOptions$1 });
|
|
738
|
+
}) });
|
|
678
739
|
}
|
|
679
740
|
|
|
680
741
|
//#endregion
|
|
@@ -716,12 +777,11 @@ function useCollectionBalanceDetails(params) {
|
|
|
716
777
|
*/
|
|
717
778
|
function useCollectionDetails(params) {
|
|
718
779
|
const defaultConfig = useConfig();
|
|
719
|
-
const { config = defaultConfig
|
|
720
|
-
|
|
780
|
+
const { config = defaultConfig, ...rest } = params;
|
|
781
|
+
return useQuery({ ...collectionDetailsQueryOptions({
|
|
721
782
|
config,
|
|
722
783
|
...rest
|
|
723
|
-
});
|
|
724
|
-
return useQuery({ ...queryOptions$1 });
|
|
784
|
+
}) });
|
|
725
785
|
}
|
|
726
786
|
|
|
727
787
|
//#endregion
|
|
@@ -756,8 +816,7 @@ const collectionDetailsPollingOptions = (args, config) => {
|
|
|
756
816
|
});
|
|
757
817
|
};
|
|
758
818
|
const useCollectionDetailsPolling = (args) => {
|
|
759
|
-
|
|
760
|
-
return useQuery(collectionDetailsPollingOptions(args, config));
|
|
819
|
+
return useQuery(collectionDetailsPollingOptions(args, useConfig()));
|
|
761
820
|
};
|
|
762
821
|
|
|
763
822
|
//#endregion
|
|
@@ -811,12 +870,11 @@ const useCollectionDetailsPolling = (args) => {
|
|
|
811
870
|
*/
|
|
812
871
|
function useListCollectionActivities(params) {
|
|
813
872
|
const defaultConfig = useConfig();
|
|
814
|
-
const { config = defaultConfig
|
|
815
|
-
|
|
873
|
+
const { config = defaultConfig, ...rest } = params;
|
|
874
|
+
return useQuery({ ...listCollectionActivitiesQueryOptions({
|
|
816
875
|
config,
|
|
817
876
|
...rest
|
|
818
|
-
});
|
|
819
|
-
return useQuery({ ...queryOptions$1 });
|
|
877
|
+
}) });
|
|
820
878
|
}
|
|
821
879
|
|
|
822
880
|
//#endregion
|
|
@@ -863,13 +921,12 @@ function useListCollectionActivities(params) {
|
|
|
863
921
|
function useListCollections(params = {}) {
|
|
864
922
|
const defaultConfig = useConfig();
|
|
865
923
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
866
|
-
const { config = defaultConfig, marketplaceConfig: paramMarketplaceConfig
|
|
867
|
-
|
|
924
|
+
const { config = defaultConfig, marketplaceConfig: paramMarketplaceConfig, ...rest } = params;
|
|
925
|
+
return useQuery({ ...listCollectionsQueryOptions({
|
|
868
926
|
config,
|
|
869
927
|
marketplaceConfig: paramMarketplaceConfig || marketplaceConfig,
|
|
870
928
|
...rest
|
|
871
|
-
});
|
|
872
|
-
return useQuery({ ...queryOptions$1 });
|
|
929
|
+
}) });
|
|
873
930
|
}
|
|
874
931
|
|
|
875
932
|
//#endregion
|
|
@@ -910,12 +967,11 @@ function useListCollections(params = {}) {
|
|
|
910
967
|
*/
|
|
911
968
|
function useCurrency(params) {
|
|
912
969
|
const defaultConfig = useConfig();
|
|
913
|
-
const { config = defaultConfig
|
|
914
|
-
|
|
970
|
+
const { config = defaultConfig, ...rest } = params;
|
|
971
|
+
return useQuery({ ...currencyQueryOptions({
|
|
915
972
|
config,
|
|
916
973
|
...rest
|
|
917
|
-
});
|
|
918
|
-
return useQuery({ ...queryOptions$1 });
|
|
974
|
+
}) });
|
|
919
975
|
}
|
|
920
976
|
|
|
921
977
|
//#endregion
|
|
@@ -1092,12 +1148,11 @@ function useListMarketCardData({ collectionAddress, chainId, orderbookKind, coll
|
|
|
1092
1148
|
*/
|
|
1093
1149
|
function useMarketCurrencies(params) {
|
|
1094
1150
|
const defaultConfig = useConfig();
|
|
1095
|
-
const { config = defaultConfig
|
|
1096
|
-
|
|
1151
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1152
|
+
return useQuery({ ...marketCurrenciesQueryOptions({
|
|
1097
1153
|
config,
|
|
1098
1154
|
...rest
|
|
1099
|
-
});
|
|
1100
|
-
return useQuery({ ...queryOptions$1 });
|
|
1155
|
+
}) });
|
|
1101
1156
|
}
|
|
1102
1157
|
|
|
1103
1158
|
//#endregion
|
|
@@ -1155,12 +1210,11 @@ function useMarketCurrencies(params) {
|
|
|
1155
1210
|
*/
|
|
1156
1211
|
function useCountItemsOrdersForCollection(params) {
|
|
1157
1212
|
const defaultConfig = useConfig();
|
|
1158
|
-
const { config = defaultConfig
|
|
1159
|
-
|
|
1213
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1214
|
+
return useQuery({ ...countItemsOrdersForCollectionQueryOptions({
|
|
1160
1215
|
config,
|
|
1161
1216
|
...rest
|
|
1162
|
-
});
|
|
1163
|
-
return useQuery({ ...queryOptions$1 });
|
|
1217
|
+
}) });
|
|
1164
1218
|
}
|
|
1165
1219
|
|
|
1166
1220
|
//#endregion
|
|
@@ -1203,12 +1257,11 @@ function useCountItemsOrdersForCollection(params) {
|
|
|
1203
1257
|
*/
|
|
1204
1258
|
function useCountListingsForCollectible(params) {
|
|
1205
1259
|
const defaultConfig = useConfig();
|
|
1206
|
-
const { config = defaultConfig
|
|
1207
|
-
|
|
1260
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1261
|
+
return useQuery({ ...countListingsForCollectibleQueryOptions({
|
|
1208
1262
|
config,
|
|
1209
1263
|
...rest
|
|
1210
|
-
});
|
|
1211
|
-
return useQuery({ ...queryOptions$1 });
|
|
1264
|
+
}) });
|
|
1212
1265
|
}
|
|
1213
1266
|
|
|
1214
1267
|
//#endregion
|
|
@@ -1251,12 +1304,11 @@ function useCountListingsForCollectible(params) {
|
|
|
1251
1304
|
*/
|
|
1252
1305
|
function useCountOffersForCollectible(params) {
|
|
1253
1306
|
const defaultConfig = useConfig();
|
|
1254
|
-
const { config = defaultConfig
|
|
1255
|
-
|
|
1307
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1308
|
+
return useQuery({ ...countOffersForCollectibleQueryOptions({
|
|
1256
1309
|
config,
|
|
1257
1310
|
...rest
|
|
1258
|
-
});
|
|
1259
|
-
return useQuery({ ...queryOptions$1 });
|
|
1311
|
+
}) });
|
|
1260
1312
|
}
|
|
1261
1313
|
|
|
1262
1314
|
//#endregion
|
|
@@ -1302,24 +1354,22 @@ function useCountOffersForCollectible(params) {
|
|
|
1302
1354
|
*/
|
|
1303
1355
|
function useFloorOrder(params) {
|
|
1304
1356
|
const defaultConfig = useConfig();
|
|
1305
|
-
const { config = defaultConfig
|
|
1306
|
-
|
|
1357
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1358
|
+
return useQuery({ ...floorOrderQueryOptions({
|
|
1307
1359
|
config,
|
|
1308
1360
|
...rest
|
|
1309
|
-
});
|
|
1310
|
-
return useQuery({ ...queryOptions$1 });
|
|
1361
|
+
}) });
|
|
1311
1362
|
}
|
|
1312
1363
|
|
|
1313
1364
|
//#endregion
|
|
1314
1365
|
//#region src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx
|
|
1315
1366
|
function useGetCountOfFilteredOrders(params) {
|
|
1316
1367
|
const defaultConfig = useConfig();
|
|
1317
|
-
const { config = defaultConfig
|
|
1318
|
-
|
|
1368
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1369
|
+
return useQuery({ ...getCountOfFilteredOrdersQueryOptions({
|
|
1319
1370
|
config,
|
|
1320
1371
|
...rest
|
|
1321
|
-
});
|
|
1322
|
-
return useQuery({ ...queryOptions$1 });
|
|
1372
|
+
}) });
|
|
1323
1373
|
}
|
|
1324
1374
|
|
|
1325
1375
|
//#endregion
|
|
@@ -1364,12 +1414,11 @@ function useGetCountOfFilteredOrders(params) {
|
|
|
1364
1414
|
*/
|
|
1365
1415
|
function useHighestOffer(params) {
|
|
1366
1416
|
const defaultConfig = useConfig();
|
|
1367
|
-
const { config = defaultConfig
|
|
1368
|
-
|
|
1417
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1418
|
+
return useQuery({ ...highestOfferQueryOptions({
|
|
1369
1419
|
config,
|
|
1370
1420
|
...rest
|
|
1371
|
-
});
|
|
1372
|
-
return useQuery({ ...queryOptions$1 });
|
|
1421
|
+
}) });
|
|
1373
1422
|
}
|
|
1374
1423
|
|
|
1375
1424
|
//#endregion
|
|
@@ -1423,12 +1472,11 @@ function useHighestOffer(params) {
|
|
|
1423
1472
|
*/
|
|
1424
1473
|
function useListItemsOrdersForCollection(params) {
|
|
1425
1474
|
const defaultConfig = useConfig();
|
|
1426
|
-
const { config = defaultConfig
|
|
1427
|
-
|
|
1475
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1476
|
+
return useInfiniteQuery({ ...listItemsOrdersForCollectionQueryOptions({
|
|
1428
1477
|
config,
|
|
1429
1478
|
...rest
|
|
1430
|
-
});
|
|
1431
|
-
return useInfiniteQuery({ ...queryOptions$1 });
|
|
1479
|
+
}) });
|
|
1432
1480
|
}
|
|
1433
1481
|
|
|
1434
1482
|
//#endregion
|
|
@@ -1496,12 +1544,11 @@ function useListItemsOrdersForCollection(params) {
|
|
|
1496
1544
|
*/
|
|
1497
1545
|
function useListItemsOrdersForCollectionPaginated(params) {
|
|
1498
1546
|
const defaultConfig = useConfig();
|
|
1499
|
-
const { config = defaultConfig
|
|
1500
|
-
|
|
1547
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1548
|
+
return useQuery({ ...listItemsOrdersForCollectionPaginatedQueryOptions({
|
|
1501
1549
|
config,
|
|
1502
1550
|
...rest
|
|
1503
|
-
});
|
|
1504
|
-
return useQuery({ ...queryOptions$1 });
|
|
1551
|
+
}) });
|
|
1505
1552
|
}
|
|
1506
1553
|
|
|
1507
1554
|
//#endregion
|
|
@@ -1562,12 +1609,11 @@ function useListItemsOrdersForCollectionPaginated(params) {
|
|
|
1562
1609
|
*/
|
|
1563
1610
|
function useListListingsForCollectible(params) {
|
|
1564
1611
|
const defaultConfig = useConfig();
|
|
1565
|
-
const { config = defaultConfig
|
|
1566
|
-
|
|
1612
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1613
|
+
return useQuery({ ...listListingsForCollectibleQueryOptions({
|
|
1567
1614
|
config,
|
|
1568
1615
|
...rest
|
|
1569
|
-
});
|
|
1570
|
-
return useQuery({ ...queryOptions$1 });
|
|
1616
|
+
}) });
|
|
1571
1617
|
}
|
|
1572
1618
|
|
|
1573
1619
|
//#endregion
|
|
@@ -1612,12 +1658,11 @@ function useListListingsForCollectible(params) {
|
|
|
1612
1658
|
*/
|
|
1613
1659
|
function useListOffersForCollectible(params) {
|
|
1614
1660
|
const defaultConfig = useConfig();
|
|
1615
|
-
const { config = defaultConfig
|
|
1616
|
-
|
|
1661
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1662
|
+
return useQuery({ ...listOffersForCollectibleQueryOptions({
|
|
1617
1663
|
config,
|
|
1618
1664
|
...rest
|
|
1619
|
-
});
|
|
1620
|
-
return useQuery({ ...queryOptions$1 });
|
|
1665
|
+
}) });
|
|
1621
1666
|
}
|
|
1622
1667
|
|
|
1623
1668
|
//#endregion
|
|
@@ -1662,19 +1707,17 @@ function useListOffersForCollectible(params) {
|
|
|
1662
1707
|
*/
|
|
1663
1708
|
function useLowestListing(params) {
|
|
1664
1709
|
const defaultConfig = useConfig();
|
|
1665
|
-
const { config = defaultConfig
|
|
1666
|
-
|
|
1710
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1711
|
+
return useQuery({ ...lowestListingQueryOptions({
|
|
1667
1712
|
config,
|
|
1668
1713
|
...rest
|
|
1669
|
-
});
|
|
1670
|
-
return useQuery({ ...queryOptions$1 });
|
|
1714
|
+
}) });
|
|
1671
1715
|
}
|
|
1672
1716
|
|
|
1673
1717
|
//#endregion
|
|
1674
1718
|
//#region src/react/hooks/data/primary-sales/useCountOfPrimarySaleItems.tsx
|
|
1675
1719
|
function useCountOfPrimarySaleItems(args) {
|
|
1676
|
-
|
|
1677
|
-
return useQuery(countOfPrimarySaleItemsOptions(args, config));
|
|
1720
|
+
return useQuery(countOfPrimarySaleItemsOptions(args, useConfig()));
|
|
1678
1721
|
}
|
|
1679
1722
|
|
|
1680
1723
|
//#endregion
|
|
@@ -1788,12 +1831,11 @@ const useErc721SaleDetailsV1 = ({ chainId, salesContractAddress, itemsContractAd
|
|
|
1788
1831
|
*/
|
|
1789
1832
|
function useGetCountOfPrimarySaleItems(params) {
|
|
1790
1833
|
const defaultConfig = useConfig();
|
|
1791
|
-
const { config = defaultConfig
|
|
1792
|
-
|
|
1834
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1835
|
+
return useQuery(primarySaleItemsCountQueryOptions({
|
|
1793
1836
|
config,
|
|
1794
1837
|
...rest
|
|
1795
|
-
});
|
|
1796
|
-
return useQuery(queryOptions$1);
|
|
1838
|
+
}));
|
|
1797
1839
|
}
|
|
1798
1840
|
|
|
1799
1841
|
//#endregion
|
|
@@ -1844,12 +1886,11 @@ function useGetCountOfPrimarySaleItems(params) {
|
|
|
1844
1886
|
*/
|
|
1845
1887
|
function useGetTokenRanges(params) {
|
|
1846
1888
|
const defaultConfig = useConfig();
|
|
1847
|
-
const { config = defaultConfig
|
|
1848
|
-
|
|
1889
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1890
|
+
return useQuery({ ...getTokenRangesQueryOptions({
|
|
1849
1891
|
config,
|
|
1850
1892
|
...rest
|
|
1851
|
-
});
|
|
1852
|
-
return useQuery({ ...queryOptions$1 });
|
|
1893
|
+
}) });
|
|
1853
1894
|
}
|
|
1854
1895
|
|
|
1855
1896
|
//#endregion
|
|
@@ -1875,12 +1916,7 @@ function useGetTokenRanges(params) {
|
|
|
1875
1916
|
*/
|
|
1876
1917
|
function useListBalances(args) {
|
|
1877
1918
|
const config = useConfig();
|
|
1878
|
-
|
|
1879
|
-
const isLaos721 = marketplaceConfig?.market?.collections?.find((c) => c.itemsAddress === args.contractAddress && c.chainId === args.chainId)?.contractType === ContractType.LAOS_ERC_721;
|
|
1880
|
-
return useInfiniteQuery(listBalancesOptions({
|
|
1881
|
-
...args,
|
|
1882
|
-
isLaos721
|
|
1883
|
-
}, config));
|
|
1919
|
+
return useInfiniteQuery(listBalancesOptions({ ...args }, config));
|
|
1884
1920
|
}
|
|
1885
1921
|
|
|
1886
1922
|
//#endregion
|
|
@@ -1926,26 +1962,23 @@ function useListBalances(args) {
|
|
|
1926
1962
|
*/
|
|
1927
1963
|
function useListTokenMetadata(params) {
|
|
1928
1964
|
const defaultConfig = useConfig();
|
|
1929
|
-
const { config = defaultConfig
|
|
1930
|
-
|
|
1965
|
+
const { config = defaultConfig, ...rest } = params;
|
|
1966
|
+
return useQuery({ ...listTokenMetadataQueryOptions({
|
|
1931
1967
|
config,
|
|
1932
1968
|
...rest
|
|
1933
|
-
});
|
|
1934
|
-
return useQuery({ ...queryOptions$1 });
|
|
1969
|
+
}) });
|
|
1935
1970
|
}
|
|
1936
1971
|
|
|
1937
1972
|
//#endregion
|
|
1938
1973
|
//#region src/react/hooks/data/tokens/useTokenSupplies.ts
|
|
1939
1974
|
/**
|
|
1940
|
-
* Hook to fetch token supplies from the indexer
|
|
1975
|
+
* Hook to fetch token supplies from the indexer
|
|
1941
1976
|
*
|
|
1942
1977
|
* Retrieves supply information for tokens from a specific collection.
|
|
1943
|
-
* Automatically chooses between indexer and LAOS APIs based on the isLaos721 flag.
|
|
1944
1978
|
*
|
|
1945
1979
|
* @param params - Configuration parameters
|
|
1946
1980
|
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
1947
1981
|
* @param params.collectionAddress - The collection contract address
|
|
1948
|
-
* @param params.isLaos721 - Whether to use LAOS API instead of indexer
|
|
1949
1982
|
* @param params.includeMetadata - Whether to include token metadata
|
|
1950
1983
|
* @param params.page - Pagination options
|
|
1951
1984
|
* @param params.query - Optional React Query configuration
|
|
@@ -1962,16 +1995,6 @@ function useListTokenMetadata(params) {
|
|
|
1962
1995
|
* ```
|
|
1963
1996
|
*
|
|
1964
1997
|
* @example
|
|
1965
|
-
* With LAOS API:
|
|
1966
|
-
* ```typescript
|
|
1967
|
-
* const { data, isLoading } = useTokenSupplies({
|
|
1968
|
-
* chainId: 1,
|
|
1969
|
-
* collectionAddress: '0x...',
|
|
1970
|
-
* isLaos721: true
|
|
1971
|
-
* })
|
|
1972
|
-
* ```
|
|
1973
|
-
*
|
|
1974
|
-
* @example
|
|
1975
1998
|
* With conditional fetching:
|
|
1976
1999
|
* ```typescript
|
|
1977
2000
|
* const { data, isLoading } = useTokenSupplies({
|
|
@@ -1985,12 +2008,11 @@ function useListTokenMetadata(params) {
|
|
|
1985
2008
|
*/
|
|
1986
2009
|
function useTokenSupplies(params) {
|
|
1987
2010
|
const defaultConfig = useConfig();
|
|
1988
|
-
const { config = defaultConfig
|
|
1989
|
-
|
|
2011
|
+
const { config = defaultConfig, ...rest } = params;
|
|
2012
|
+
return useInfiniteQuery({ ...tokenSuppliesQueryOptions({
|
|
1990
2013
|
config,
|
|
1991
2014
|
...rest
|
|
1992
|
-
});
|
|
1993
|
-
return useInfiniteQuery({ ...queryOptions$1 });
|
|
2015
|
+
}) });
|
|
1994
2016
|
}
|
|
1995
2017
|
|
|
1996
2018
|
//#endregion
|
|
@@ -2065,7 +2087,7 @@ function useTokenSupplies(params) {
|
|
|
2065
2087
|
*/
|
|
2066
2088
|
function useSearchTokenMetadata(params) {
|
|
2067
2089
|
const defaultConfig = useConfig();
|
|
2068
|
-
const { config = defaultConfig, onlyMinted
|
|
2090
|
+
const { config = defaultConfig, onlyMinted, ...rest } = params;
|
|
2069
2091
|
const { data: suppliesData, hasNextPage: hasNextSuppliesPage, isFetching: isSuppliesFetching, isLoading: isSuppliesLoading, error: suppliesError, fetchNextPage: fetchNextSuppliesPage } = useTokenSupplies({
|
|
2070
2092
|
chainId: params.chainId,
|
|
2071
2093
|
collectionAddress: params.collectionAddress,
|
|
@@ -2317,24 +2339,66 @@ function useList1155ShopCardData({ primarySaleItemsWithMetadata, chainId, contra
|
|
|
2317
2339
|
*/
|
|
2318
2340
|
function useListPrimarySaleItems(params) {
|
|
2319
2341
|
const defaultConfig = useConfig();
|
|
2320
|
-
const { config = defaultConfig
|
|
2321
|
-
|
|
2342
|
+
const { config = defaultConfig, ...rest } = params;
|
|
2343
|
+
return useInfiniteQuery(listPrimarySaleItemsQueryOptions({
|
|
2322
2344
|
config,
|
|
2323
2345
|
...rest
|
|
2324
|
-
});
|
|
2325
|
-
|
|
2346
|
+
}));
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
//#endregion
|
|
2350
|
+
//#region src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx
|
|
2351
|
+
/**
|
|
2352
|
+
* Hook to fetch a single primary sale item
|
|
2353
|
+
*
|
|
2354
|
+
* Retrieves details for a specific primary sale item from a primary sale contract.
|
|
2355
|
+
*
|
|
2356
|
+
* @param params - Configuration parameters
|
|
2357
|
+
* @param params.chainId - The chain ID (must be number, e.g., 1 for Ethereum, 137 for Polygon)
|
|
2358
|
+
* @param params.primarySaleContractAddress - The primary sale contract address
|
|
2359
|
+
* @param params.tokenId - The token ID of the primary sale item
|
|
2360
|
+
* @param params.query - Optional React Query configuration
|
|
2361
|
+
*
|
|
2362
|
+
* @returns Query result containing the primary sale item data
|
|
2363
|
+
*
|
|
2364
|
+
* @example
|
|
2365
|
+
* Basic usage:
|
|
2366
|
+
* ```typescript
|
|
2367
|
+
* const { data: item, isLoading } = usePrimarySaleItem({
|
|
2368
|
+
* chainId: 137,
|
|
2369
|
+
* primarySaleContractAddress: '0x...',
|
|
2370
|
+
* tokenId: '1',
|
|
2371
|
+
* })
|
|
2372
|
+
* ```
|
|
2373
|
+
*
|
|
2374
|
+
* @example
|
|
2375
|
+
* With custom query options:
|
|
2376
|
+
* ```typescript
|
|
2377
|
+
* const { data } = usePrimarySaleItem({
|
|
2378
|
+
* chainId: 1,
|
|
2379
|
+
* primarySaleContractAddress: '0x...',
|
|
2380
|
+
* tokenId: '42',
|
|
2381
|
+
* query: {
|
|
2382
|
+
* enabled: Boolean(primarySaleContractAddress && tokenId),
|
|
2383
|
+
* staleTime: 30_000
|
|
2384
|
+
* }
|
|
2385
|
+
* })
|
|
2386
|
+
* ```
|
|
2387
|
+
*/
|
|
2388
|
+
function usePrimarySaleItem(params) {
|
|
2389
|
+
const defaultConfig = useConfig();
|
|
2390
|
+
const { config = defaultConfig, ...rest } = params;
|
|
2391
|
+
return useQuery({ ...primarySaleItemQueryOptions({
|
|
2392
|
+
config,
|
|
2393
|
+
...rest
|
|
2394
|
+
}) });
|
|
2326
2395
|
}
|
|
2327
2396
|
|
|
2328
2397
|
//#endregion
|
|
2329
2398
|
//#region src/react/hooks/data/inventory/useInventory.tsx
|
|
2330
2399
|
function useInventory(args) {
|
|
2331
2400
|
const config = useConfig();
|
|
2332
|
-
|
|
2333
|
-
const isLaos721 = marketplaceConfig?.market?.collections?.find((c) => c.itemsAddress === args.collectionAddress && c.chainId === args.chainId)?.contractType === ContractType.LAOS_ERC_721;
|
|
2334
|
-
return useQuery(inventoryOptions({
|
|
2335
|
-
...args,
|
|
2336
|
-
isLaos721
|
|
2337
|
-
}, config));
|
|
2401
|
+
return useQuery(inventoryOptions({ ...args }, config));
|
|
2338
2402
|
}
|
|
2339
2403
|
|
|
2340
2404
|
//#endregion
|
|
@@ -2715,7 +2779,7 @@ const generateCancelTransaction = async (args, config) => {
|
|
|
2715
2779
|
};
|
|
2716
2780
|
const useGenerateCancelTransaction = (params) => {
|
|
2717
2781
|
const config = useConfig();
|
|
2718
|
-
const { mutate, mutateAsync
|
|
2782
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
2719
2783
|
onSuccess: params.onSuccess,
|
|
2720
2784
|
mutationFn: (args) => generateCancelTransaction(args, config)
|
|
2721
2785
|
});
|
|
@@ -2749,8 +2813,7 @@ const useProcessStep = () => {
|
|
|
2749
2813
|
const { sendTransactionAsync } = useSendTransaction();
|
|
2750
2814
|
const { signMessageAsync } = useSignMessage();
|
|
2751
2815
|
const { signTypedDataAsync } = useSignTypedData();
|
|
2752
|
-
const
|
|
2753
|
-
const marketplaceClient = getMarketplaceClient(config);
|
|
2816
|
+
const marketplaceClient = getMarketplaceClient(useConfig());
|
|
2754
2817
|
const processStep = async (step, chainId) => {
|
|
2755
2818
|
if (isTransactionStep(step)) return {
|
|
2756
2819
|
type: "transaction",
|
|
@@ -2766,10 +2829,8 @@ const useProcessStep = () => {
|
|
|
2766
2829
|
};
|
|
2767
2830
|
if (isSignatureStep(step)) {
|
|
2768
2831
|
let signature;
|
|
2769
|
-
if (step.id === StepType.signEIP191) {
|
|
2770
|
-
|
|
2771
|
-
signature = await signMessageAsync({ message });
|
|
2772
|
-
} else if (step.id === StepType.signEIP712) {
|
|
2832
|
+
if (step.id === StepType.signEIP191) signature = await signMessageAsync({ message: isHex(step.data) ? { raw: step.data } : step.data });
|
|
2833
|
+
else if (step.id === StepType.signEIP712) {
|
|
2773
2834
|
if (!step.signature) throw new Error("EIP712 step missing signature data");
|
|
2774
2835
|
signature = await signTypedDataAsync({
|
|
2775
2836
|
domain: step.signature.domain,
|
|
@@ -2781,14 +2842,14 @@ const useProcessStep = () => {
|
|
|
2781
2842
|
if (!signature) throw new Error("Failed to sign message");
|
|
2782
2843
|
if (step.post) return {
|
|
2783
2844
|
type: "signature",
|
|
2784
|
-
orderId: (await marketplaceClient.execute({
|
|
2845
|
+
orderId: (await marketplaceClient.execute({ params: {
|
|
2785
2846
|
chainId: String(chainId),
|
|
2786
2847
|
signature,
|
|
2787
2848
|
method: step.post.method,
|
|
2788
2849
|
endpoint: step.post.endpoint,
|
|
2789
2850
|
body: step.post.body,
|
|
2790
2851
|
executeType: ExecuteType.order
|
|
2791
|
-
})).orderId
|
|
2852
|
+
} })).orderId
|
|
2792
2853
|
};
|
|
2793
2854
|
return {
|
|
2794
2855
|
type: "signature",
|
|
@@ -2977,7 +3038,7 @@ const generateListingTransaction = async (params, config) => {
|
|
|
2977
3038
|
};
|
|
2978
3039
|
const useGenerateListingTransaction = (params) => {
|
|
2979
3040
|
const config = useConfig();
|
|
2980
|
-
const { mutate, mutateAsync
|
|
3041
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
2981
3042
|
onSuccess: params.onSuccess,
|
|
2982
3043
|
mutationFn: (args) => generateListingTransaction({
|
|
2983
3044
|
...args,
|
|
@@ -3008,7 +3069,7 @@ const generateOfferTransaction = async (params, config, walletKind) => {
|
|
|
3008
3069
|
const useGenerateOfferTransaction = (params) => {
|
|
3009
3070
|
const config = useConfig();
|
|
3010
3071
|
const { walletKind } = useConnectorMetadata();
|
|
3011
|
-
const { mutate, mutateAsync
|
|
3072
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
3012
3073
|
onSuccess: params.onSuccess,
|
|
3013
3074
|
mutationFn: (args) => generateOfferTransaction({
|
|
3014
3075
|
...args,
|
|
@@ -3034,7 +3095,7 @@ const generateSellTransaction = async (args, config) => {
|
|
|
3034
3095
|
};
|
|
3035
3096
|
const useGenerateSellTransaction = (params) => {
|
|
3036
3097
|
const config = useConfig();
|
|
3037
|
-
const { mutate, mutateAsync
|
|
3098
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
3038
3099
|
onSuccess: params.onSuccess,
|
|
3039
3100
|
mutationFn: (args) => generateSellTransaction({
|
|
3040
3101
|
...args,
|
|
@@ -3109,8 +3170,7 @@ const useTransactionOperations = () => {
|
|
|
3109
3170
|
try {
|
|
3110
3171
|
if (stepItem.id === StepType.signEIP191) {
|
|
3111
3172
|
logger.debug("Signing with EIP-191", { data: stepItem.data });
|
|
3112
|
-
|
|
3113
|
-
return await signMessageAsync({ message });
|
|
3173
|
+
return await signMessageAsync({ message: isHex(stepItem.data) ? { raw: stepItem.data } : stepItem.data });
|
|
3114
3174
|
}
|
|
3115
3175
|
if (stepItem.id === StepType.signEIP712) {
|
|
3116
3176
|
logger.debug("Signing with EIP-712", {
|
|
@@ -3227,8 +3287,7 @@ const useTransferTokens = () => {
|
|
|
3227
3287
|
const { writeContractAsync, data: hash, isPending, isError, isSuccess } = useWriteContract();
|
|
3228
3288
|
const transferTokensAsync = async (params) => {
|
|
3229
3289
|
if (!accountAddress) throw new NoWalletConnectedError();
|
|
3230
|
-
|
|
3231
|
-
return await writeContractAsync(config);
|
|
3290
|
+
return await writeContractAsync(prepareTransferConfig(params, accountAddress));
|
|
3232
3291
|
};
|
|
3233
3292
|
return {
|
|
3234
3293
|
transferTokensAsync,
|
|
@@ -3273,114 +3332,6 @@ function useFilterState() {
|
|
|
3273
3332
|
const [showListedOnly, setShowListedOnly] = useQueryState("listedOnly", listedOnlyParser);
|
|
3274
3333
|
const [showPriceFilter, setShowPriceFilter] = useQueryState("priceFilter", priceFilterParser);
|
|
3275
3334
|
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
3335
|
return {
|
|
3385
3336
|
filterOptions,
|
|
3386
3337
|
searchText,
|
|
@@ -3392,7 +3343,111 @@ function useFilterState() {
|
|
|
3392
3343
|
setShowListedOnly,
|
|
3393
3344
|
setShowPriceFilter,
|
|
3394
3345
|
setPriceFilters,
|
|
3395
|
-
...
|
|
3346
|
+
...useMemo(() => ({
|
|
3347
|
+
getFilter: (name) => {
|
|
3348
|
+
return filterOptions?.find((f) => f.name === name);
|
|
3349
|
+
},
|
|
3350
|
+
getFilterValues: (name) => {
|
|
3351
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3352
|
+
if (!filter) return void 0;
|
|
3353
|
+
if (filter.type === PropertyType.INT) return {
|
|
3354
|
+
type: PropertyType.INT,
|
|
3355
|
+
min: filter.min ?? 0,
|
|
3356
|
+
max: filter.max ?? 0
|
|
3357
|
+
};
|
|
3358
|
+
return {
|
|
3359
|
+
type: PropertyType.STRING,
|
|
3360
|
+
values: filter.values ?? []
|
|
3361
|
+
};
|
|
3362
|
+
},
|
|
3363
|
+
isFilterActive: (name) => {
|
|
3364
|
+
return !!filterOptions?.find((f) => f.name === name);
|
|
3365
|
+
},
|
|
3366
|
+
isStringValueSelected: (name, value) => {
|
|
3367
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3368
|
+
if (!filter || filter.type !== PropertyType.STRING) return false;
|
|
3369
|
+
return filter.values?.includes(value) ?? false;
|
|
3370
|
+
},
|
|
3371
|
+
isIntFilterActive: (name) => {
|
|
3372
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3373
|
+
return !!filter && filter.type === PropertyType.INT;
|
|
3374
|
+
},
|
|
3375
|
+
getIntFilterRange: (name) => {
|
|
3376
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3377
|
+
if (!filter || filter.type !== PropertyType.INT) return void 0;
|
|
3378
|
+
return [filter.min ?? 0, filter.max ?? 0];
|
|
3379
|
+
},
|
|
3380
|
+
deleteFilter: (name) => {
|
|
3381
|
+
setFilterOptions(filterOptions?.filter((f) => !(f.name === name)) ?? []);
|
|
3382
|
+
},
|
|
3383
|
+
toggleStringFilterValue: (name, value) => {
|
|
3384
|
+
const otherFilters = filterOptions?.filter((f) => !(f.name === name)) ?? [];
|
|
3385
|
+
const filter = filterOptions?.find((f) => f.name === name);
|
|
3386
|
+
const existingValues = filter?.type === PropertyType.STRING ? filter.values ?? [] : [];
|
|
3387
|
+
if (existingValues.includes(value)) {
|
|
3388
|
+
const newValues = existingValues.filter((v) => v !== value);
|
|
3389
|
+
if (newValues.length === 0) {
|
|
3390
|
+
setFilterOptions(otherFilters);
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
setFilterOptions([...otherFilters, {
|
|
3394
|
+
name,
|
|
3395
|
+
type: PropertyType.STRING,
|
|
3396
|
+
values: newValues
|
|
3397
|
+
}]);
|
|
3398
|
+
} else setFilterOptions([...otherFilters, {
|
|
3399
|
+
name,
|
|
3400
|
+
type: PropertyType.STRING,
|
|
3401
|
+
values: [...existingValues, value]
|
|
3402
|
+
}]);
|
|
3403
|
+
},
|
|
3404
|
+
setIntFilterValue: (name, min, max) => {
|
|
3405
|
+
if (min === max && min === 0) {
|
|
3406
|
+
setFilterOptions(filterOptions?.filter((f) => !(f.name === name)) ?? []);
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3409
|
+
setFilterOptions([...filterOptions?.filter((f) => !(f.name === name)) ?? [], {
|
|
3410
|
+
name,
|
|
3411
|
+
type: PropertyType.INT,
|
|
3412
|
+
min,
|
|
3413
|
+
max
|
|
3414
|
+
}]);
|
|
3415
|
+
},
|
|
3416
|
+
setPriceFilter: (contractAddress, min, max) => {
|
|
3417
|
+
const otherPriceFilters = priceFilters?.filter((f) => f.contractAddress !== contractAddress) ?? [];
|
|
3418
|
+
if (!min && !max) {
|
|
3419
|
+
setPriceFilters(otherPriceFilters);
|
|
3420
|
+
return;
|
|
3421
|
+
}
|
|
3422
|
+
const newPriceFilter = {
|
|
3423
|
+
contractAddress,
|
|
3424
|
+
...min && { min },
|
|
3425
|
+
...max && { max }
|
|
3426
|
+
};
|
|
3427
|
+
setPriceFilters([...otherPriceFilters, newPriceFilter]);
|
|
3428
|
+
},
|
|
3429
|
+
getPriceFilter: (contractAddress) => {
|
|
3430
|
+
return priceFilters?.find((f) => f.contractAddress === contractAddress);
|
|
3431
|
+
},
|
|
3432
|
+
clearPriceFilters: () => {
|
|
3433
|
+
setPriceFilters([]);
|
|
3434
|
+
},
|
|
3435
|
+
clearAllFilters: () => {
|
|
3436
|
+
setShowListedOnly(false);
|
|
3437
|
+
setShowPriceFilter(false);
|
|
3438
|
+
setFilterOptions([]);
|
|
3439
|
+
setSearchText("");
|
|
3440
|
+
setPriceFilters([]);
|
|
3441
|
+
}
|
|
3442
|
+
}), [
|
|
3443
|
+
filterOptions,
|
|
3444
|
+
setFilterOptions,
|
|
3445
|
+
setShowListedOnly,
|
|
3446
|
+
setSearchText,
|
|
3447
|
+
setShowPriceFilter,
|
|
3448
|
+
priceFilters,
|
|
3449
|
+
setPriceFilters
|
|
3450
|
+
]),
|
|
3396
3451
|
serialize
|
|
3397
3452
|
};
|
|
3398
3453
|
}
|
|
@@ -3460,12 +3515,11 @@ function useFilterState() {
|
|
|
3460
3515
|
*/
|
|
3461
3516
|
function useFilters(params) {
|
|
3462
3517
|
const defaultConfig = useConfig();
|
|
3463
|
-
const { config = defaultConfig
|
|
3464
|
-
|
|
3518
|
+
const { config = defaultConfig, ...rest } = params;
|
|
3519
|
+
return useQuery({ ...filtersQueryOptions({
|
|
3465
3520
|
config,
|
|
3466
3521
|
...rest
|
|
3467
|
-
});
|
|
3468
|
-
return useQuery({ ...queryOptions$1 });
|
|
3522
|
+
}) });
|
|
3469
3523
|
}
|
|
3470
3524
|
/**
|
|
3471
3525
|
* Hook to progressively load collection filters
|
|
@@ -3512,7 +3566,7 @@ function useFilters(params) {
|
|
|
3512
3566
|
*/
|
|
3513
3567
|
function useFiltersProgressive(params) {
|
|
3514
3568
|
const defaultConfig = useConfig();
|
|
3515
|
-
const { config = defaultConfig
|
|
3569
|
+
const { config = defaultConfig, ...rest } = params;
|
|
3516
3570
|
const namesQuery = useQuery(filtersQueryOptions({
|
|
3517
3571
|
config,
|
|
3518
3572
|
...rest,
|
|
@@ -3586,13 +3640,12 @@ const useOpenConnectModal$1 = () => {
|
|
|
3586
3640
|
function useCheckoutOptions$1(params) {
|
|
3587
3641
|
const { address } = useAccount();
|
|
3588
3642
|
const defaultConfig = useConfig();
|
|
3589
|
-
const { config = defaultConfig
|
|
3590
|
-
|
|
3643
|
+
const { config = defaultConfig, ...rest } = params;
|
|
3644
|
+
return useQuery({ ...checkoutOptionsQueryOptions({
|
|
3591
3645
|
config,
|
|
3592
3646
|
walletAddress: address,
|
|
3593
3647
|
...rest
|
|
3594
|
-
});
|
|
3595
|
-
return useQuery({ ...queryOptions$1 });
|
|
3648
|
+
}) });
|
|
3596
3649
|
}
|
|
3597
3650
|
|
|
3598
3651
|
//#endregion
|
|
@@ -3642,7 +3695,7 @@ function useCheckoutOptions$1(params) {
|
|
|
3642
3695
|
function useCheckoutOptionsSalesContract(params) {
|
|
3643
3696
|
const { address } = useAccount();
|
|
3644
3697
|
const defaultConfig = useConfig();
|
|
3645
|
-
|
|
3698
|
+
return useQuery({ ...checkoutOptionsSalesContractQueryOptions(params === skipToken ? {
|
|
3646
3699
|
config: defaultConfig,
|
|
3647
3700
|
walletAddress: address,
|
|
3648
3701
|
chainId: 0,
|
|
@@ -3654,8 +3707,7 @@ function useCheckoutOptionsSalesContract(params) {
|
|
|
3654
3707
|
config: defaultConfig,
|
|
3655
3708
|
walletAddress: address,
|
|
3656
3709
|
...params
|
|
3657
|
-
});
|
|
3658
|
-
return useQuery({ ...queryOptions$1 });
|
|
3710
|
+
}) });
|
|
3659
3711
|
}
|
|
3660
3712
|
|
|
3661
3713
|
//#endregion
|
|
@@ -3711,12 +3763,11 @@ function useCheckoutOptionsSalesContract(params) {
|
|
|
3711
3763
|
*/
|
|
3712
3764
|
function useComparePrices(params) {
|
|
3713
3765
|
const defaultConfig = useConfig();
|
|
3714
|
-
const { config = defaultConfig
|
|
3715
|
-
|
|
3766
|
+
const { config = defaultConfig, ...rest } = params;
|
|
3767
|
+
return useQuery({ ...comparePricesQueryOptions({
|
|
3716
3768
|
config,
|
|
3717
3769
|
...rest
|
|
3718
|
-
});
|
|
3719
|
-
return useQuery({ ...queryOptions$1 });
|
|
3770
|
+
}) });
|
|
3720
3771
|
}
|
|
3721
3772
|
|
|
3722
3773
|
//#endregion
|
|
@@ -3767,12 +3818,11 @@ function useComparePrices(params) {
|
|
|
3767
3818
|
*/
|
|
3768
3819
|
function useConvertPriceToUSD(params) {
|
|
3769
3820
|
const defaultConfig = useConfig();
|
|
3770
|
-
const { config = defaultConfig
|
|
3771
|
-
|
|
3821
|
+
const { config = defaultConfig, ...rest } = params;
|
|
3822
|
+
return useQuery({ ...convertPriceToUSDQueryOptions({
|
|
3772
3823
|
config,
|
|
3773
3824
|
...rest
|
|
3774
|
-
});
|
|
3775
|
-
return useQuery({ ...queryOptions$1 });
|
|
3825
|
+
}) });
|
|
3776
3826
|
}
|
|
3777
3827
|
|
|
3778
3828
|
//#endregion
|
|
@@ -3868,9 +3918,8 @@ const useGetReceiptFromHash = () => {
|
|
|
3868
3918
|
*/
|
|
3869
3919
|
function useRoyalty(args) {
|
|
3870
3920
|
const { chainId, collectionAddress, collectibleId, query } = args;
|
|
3871
|
-
const scopeKey = `${collectableKeys.royaltyPercentage.join(".")}-${chainId}-${collectionAddress}-${collectibleId}`;
|
|
3872
3921
|
const contractResult = useReadContract({
|
|
3873
|
-
scopeKey
|
|
3922
|
+
scopeKey: `${collectableKeys.royaltyPercentage.join(".")}-${chainId}-${collectionAddress}-${collectibleId}`,
|
|
3874
3923
|
abi: EIP2981_ABI,
|
|
3875
3924
|
address: collectionAddress,
|
|
3876
3925
|
functionName: "royaltyInfo",
|
|
@@ -3918,13 +3967,10 @@ const selectWaasFeeOptionsStore = createStore({
|
|
|
3918
3967
|
}
|
|
3919
3968
|
});
|
|
3920
3969
|
const useSelectWaasFeeOptionsStore = () => {
|
|
3921
|
-
const isVisible = useSelector(selectWaasFeeOptionsStore, (state) => state.context.isVisible);
|
|
3922
|
-
const selectedFeeOption = useSelector(selectWaasFeeOptionsStore, (state) => state.context.selectedFeeOption);
|
|
3923
|
-
const pendingFeeOptionConfirmation = useSelector(selectWaasFeeOptionsStore, (state) => state.context.pendingFeeOptionConfirmation);
|
|
3924
3970
|
return {
|
|
3925
|
-
isVisible,
|
|
3926
|
-
selectedFeeOption,
|
|
3927
|
-
pendingFeeOptionConfirmation,
|
|
3971
|
+
isVisible: useSelector(selectWaasFeeOptionsStore, (state) => state.context.isVisible),
|
|
3972
|
+
selectedFeeOption: useSelector(selectWaasFeeOptionsStore, (state) => state.context.selectedFeeOption),
|
|
3973
|
+
pendingFeeOptionConfirmation: useSelector(selectWaasFeeOptionsStore, (state) => state.context.pendingFeeOptionConfirmation),
|
|
3928
3974
|
show: () => selectWaasFeeOptionsStore.send({ type: "show" }),
|
|
3929
3975
|
hide: () => selectWaasFeeOptionsStore.send({ type: "hide" }),
|
|
3930
3976
|
setSelectedFeeOption: (feeOption) => selectWaasFeeOptionsStore.send({
|
|
@@ -4288,7 +4334,7 @@ const invalidateQueries = async (queriesToInvalidate) => {
|
|
|
4288
4334
|
const useTransactionStatusModal = () => {
|
|
4289
4335
|
return {
|
|
4290
4336
|
show: (args) => {
|
|
4291
|
-
const { type: transactionType
|
|
4337
|
+
const { type: transactionType, ...rest } = args;
|
|
4292
4338
|
transactionStatusModalStore.send({
|
|
4293
4339
|
type: "open",
|
|
4294
4340
|
transactionType,
|
|
@@ -4512,7 +4558,6 @@ const useOnError = () => useSelector(buyModalStore, (state) => state.context.onE
|
|
|
4512
4558
|
const useOnSuccess = () => useSelector(buyModalStore, (state) => state.context.onSuccess);
|
|
4513
4559
|
const useQuantity = () => useSelector(buyModalStore, (state) => state.context.quantity);
|
|
4514
4560
|
const usePaymentModalState = () => useSelector(buyModalStore, (state) => state.context.paymentModalState);
|
|
4515
|
-
const useCheckoutModalState = () => useSelector(buyModalStore, (state) => state.context.checkoutModalState);
|
|
4516
4561
|
const useBuyAnalyticsId = () => useSelector(buyModalStore, (state) => state.context.buyAnalyticsId);
|
|
4517
4562
|
|
|
4518
4563
|
//#endregion
|
|
@@ -4616,9 +4661,8 @@ const useMarketPlatformFee = (params) => {
|
|
|
4616
4661
|
const marketCollection = marketplaceConfig?.market?.collections?.find((col) => compareAddress(col.itemsAddress, collectionAddress) && String(col.chainId) === String(chainId));
|
|
4617
4662
|
const receiver = chainId === avalanche.id || chainId === optimism.id ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
4618
4663
|
const percentageToBPS = (percentage) => Number(percentage) * 1e4 / 100;
|
|
4619
|
-
const feePercentage = marketCollection?.feePercentage ?? defaultFee;
|
|
4620
4664
|
return {
|
|
4621
|
-
amount: percentageToBPS(feePercentage).toString(),
|
|
4665
|
+
amount: percentageToBPS(marketCollection?.feePercentage ?? defaultFee).toString(),
|
|
4622
4666
|
receiver
|
|
4623
4667
|
};
|
|
4624
4668
|
};
|
|
@@ -4823,15 +4867,6 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4823
4867
|
const approvedSpenderAddress = approveStep ? decodeERC20Approval(approveStep.data).spender : void 0;
|
|
4824
4868
|
if (!buyStep) throw new Error("Buy step not found");
|
|
4825
4869
|
const creditCardProviders = customCreditCardProviderCallback ? ["custom"] : checkoutOptions.nftCheckout || [];
|
|
4826
|
-
const isTransakSupported = creditCardProviders.includes("transak");
|
|
4827
|
-
let transakContractId;
|
|
4828
|
-
if (isTransakSupported) {
|
|
4829
|
-
const transakContractIdResponse = await getSequenceApiClient(config).checkoutOptionsGetTransakContractID({
|
|
4830
|
-
chainId,
|
|
4831
|
-
contractAddress: buyStep.to
|
|
4832
|
-
});
|
|
4833
|
-
if (transakContractIdResponse.contractId !== "") transakContractId = transakContractIdResponse.contractId;
|
|
4834
|
-
}
|
|
4835
4870
|
return {
|
|
4836
4871
|
chain: chainId,
|
|
4837
4872
|
collectibles: [{
|
|
@@ -4867,7 +4902,6 @@ const getBuyCollectableParams = async ({ chainId, collectionAddress, collectible
|
|
|
4867
4902
|
customCreditCardProviderCallback(buyStep);
|
|
4868
4903
|
buyModalStore.send({ type: "close" });
|
|
4869
4904
|
} },
|
|
4870
|
-
...transakContractId && { transakConfig: { contractId: transakContractId } },
|
|
4871
4905
|
onRampProvider,
|
|
4872
4906
|
successActionButtons: callbacks?.successActionButtons
|
|
4873
4907
|
};
|
|
@@ -4962,9 +4996,9 @@ const ERC721BuyModal = ({ collectable, order, address, checkoutOptions }) => {
|
|
|
4962
4996
|
});
|
|
4963
4997
|
if (isPaymentModalParamsLoading || !paymentModalParams) return null;
|
|
4964
4998
|
if (isPaymentModalParamsError) throw new Error("Failed to load payment parameters for ERC721 marketplace purchase");
|
|
4965
|
-
return /* @__PURE__ */ jsx(PaymentModalOpener$
|
|
4999
|
+
return /* @__PURE__ */ jsx(PaymentModalOpener$3, { paymentModalParams });
|
|
4966
5000
|
};
|
|
4967
|
-
const PaymentModalOpener$
|
|
5001
|
+
const PaymentModalOpener$3 = ({ paymentModalParams }) => {
|
|
4968
5002
|
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
4969
5003
|
const paymentModalState = usePaymentModalState();
|
|
4970
5004
|
useEffect(() => {
|
|
@@ -5075,9 +5109,8 @@ var BuyModalErrorFactory = class {
|
|
|
5075
5109
|
|
|
5076
5110
|
//#endregion
|
|
5077
5111
|
//#region src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts
|
|
5078
|
-
const DEFAULT_PROOF = [toHex(0, { size: 32 })];
|
|
5079
|
-
const encodeERC721MintData = ({ to, amount, paymentToken, price, proof = DEFAULT_PROOF }) => {
|
|
5080
|
-
const totalPrice = price * amount;
|
|
5112
|
+
const DEFAULT_PROOF$1 = [toHex(0, { size: 32 })];
|
|
5113
|
+
const encodeERC721MintData = ({ to, amount, paymentToken, price, proof = DEFAULT_PROOF$1 }) => {
|
|
5081
5114
|
return encodeFunctionData({
|
|
5082
5115
|
abi: ERC721_SALE_ABI_V0,
|
|
5083
5116
|
functionName: "mint",
|
|
@@ -5085,7 +5118,7 @@ const encodeERC721MintData = ({ to, amount, paymentToken, price, proof = DEFAULT
|
|
|
5085
5118
|
to,
|
|
5086
5119
|
amount,
|
|
5087
5120
|
paymentToken,
|
|
5088
|
-
|
|
5121
|
+
price * amount,
|
|
5089
5122
|
proof
|
|
5090
5123
|
]
|
|
5091
5124
|
});
|
|
@@ -5097,7 +5130,7 @@ const getERC721SalePaymentParams = async ({ chainId, address, salesContractAddre
|
|
|
5097
5130
|
amount: BigInt(quantity),
|
|
5098
5131
|
paymentToken: currencyAddress,
|
|
5099
5132
|
price,
|
|
5100
|
-
proof: DEFAULT_PROOF
|
|
5133
|
+
proof: DEFAULT_PROOF$1
|
|
5101
5134
|
});
|
|
5102
5135
|
const creditCardProviders = customCreditCardProviderCallback ? ["custom"] : checkoutProvider ? [checkoutProvider] : [];
|
|
5103
5136
|
return {
|
|
@@ -5180,9 +5213,9 @@ const ERC721ShopModal = ({ collection, shopData, chainId }) => {
|
|
|
5180
5213
|
});
|
|
5181
5214
|
if (isErc721PaymentParamsLoading || !erc721SalePaymentParams) return null;
|
|
5182
5215
|
if (isErc721PaymentParamsError) throw BuyModalErrorFactory.contractError(shopData.salesContractAddress, "Failed to load ERC721 sale parameters");
|
|
5183
|
-
return /* @__PURE__ */ jsx(PaymentModalOpener$
|
|
5216
|
+
return /* @__PURE__ */ jsx(PaymentModalOpener$2, { paymentModalParams: erc721SalePaymentParams });
|
|
5184
5217
|
};
|
|
5185
|
-
const PaymentModalOpener$
|
|
5218
|
+
const PaymentModalOpener$2 = ({ paymentModalParams }) => {
|
|
5186
5219
|
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
5187
5220
|
const paymentModalState = usePaymentModalState();
|
|
5188
5221
|
const totalPrice = BigInt(paymentModalParams.price) * BigInt(paymentModalParams.collectibles[0].quantity);
|
|
@@ -5330,8 +5363,7 @@ function QuantityInput({ quantity, invalidQuantity, onQuantityChange, onInvalidQ
|
|
|
5330
5363
|
const INFINITY_STRING = maxUint256.toString();
|
|
5331
5364
|
const ERC1155QuantityModal = ({ order, quantityDecimals, quantityRemaining, unlimitedSupply, salePrice, chainId, cardType }) => {
|
|
5332
5365
|
const isOpen = useIsOpen$2();
|
|
5333
|
-
const
|
|
5334
|
-
const [localQuantity, setLocalQuantity] = useState(minQuantity);
|
|
5366
|
+
const [localQuantity, setLocalQuantity] = useState(quantityDecimals > 0 ? `0.${"1".padStart(quantityDecimals, "0")}` : "1");
|
|
5335
5367
|
const [invalidQuantity, setInvalidQuantity] = useState(false);
|
|
5336
5368
|
const maxQuantity = unlimitedSupply ? INFINITY_STRING : quantityDecimals > 0 ? (Number(quantityRemaining) / 10 ** quantityDecimals).toString() : quantityRemaining;
|
|
5337
5369
|
const handleBuyNow = () => {
|
|
@@ -5385,16 +5417,12 @@ const TotalPrice = ({ order, quantityStr, salePrice, chainId, cardType, quantity
|
|
|
5385
5417
|
const quantityForCalculation = parseUnits(quantityStr, quantityDecimals);
|
|
5386
5418
|
if (isMarket && currency && order) try {
|
|
5387
5419
|
const marketplaceFeePercentage = (marketplaceConfig?.market?.collections?.find((col) => col.itemsAddress.toLowerCase() === order.collectionContractAddress.toLowerCase() && col.chainId === chainId))?.feePercentage ?? DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
5388
|
-
|
|
5389
|
-
formattedPrice = formatPriceWithFee(totalPriceRaw, currency.decimals, marketplaceFeePercentage);
|
|
5420
|
+
formattedPrice = formatPriceWithFee(BigInt(order ? order.priceAmount : "0") * quantityForCalculation, currency.decimals, marketplaceFeePercentage);
|
|
5390
5421
|
} catch (e) {
|
|
5391
5422
|
console.error("Error formatting price", e);
|
|
5392
5423
|
error = "Unable to calculate total price";
|
|
5393
5424
|
}
|
|
5394
|
-
if (isShop && salePrice && currency)
|
|
5395
|
-
const totalPriceRaw = BigInt(salePrice.amount) * quantityForCalculation;
|
|
5396
|
-
formattedPrice = formatPriceWithFee(totalPriceRaw, currency.decimals, 0);
|
|
5397
|
-
}
|
|
5425
|
+
if (isShop && salePrice && currency) formattedPrice = formatPriceWithFee(BigInt(salePrice.amount) * quantityForCalculation, currency.decimals, 0);
|
|
5398
5426
|
return error ? /* @__PURE__ */ jsx(Text, {
|
|
5399
5427
|
className: "font-body font-medium text-xs",
|
|
5400
5428
|
color: "text50",
|
|
@@ -5510,9 +5538,9 @@ const Modal$4 = ({ address, quantity, order, collectable, checkoutOptions }) =>
|
|
|
5510
5538
|
title: "Loading checkout"
|
|
5511
5539
|
});
|
|
5512
5540
|
if (isPaymentModalParamsError) throw new Error("Failed to load payment parameters for ERC1155 marketplace purchase");
|
|
5513
|
-
return /* @__PURE__ */ jsx(PaymentModalOpener, { paymentModalParams });
|
|
5541
|
+
return /* @__PURE__ */ jsx(PaymentModalOpener$1, { paymentModalParams });
|
|
5514
5542
|
};
|
|
5515
|
-
const PaymentModalOpener = ({ paymentModalParams }) => {
|
|
5543
|
+
const PaymentModalOpener$1 = ({ paymentModalParams }) => {
|
|
5516
5544
|
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
5517
5545
|
const paymentModalState = usePaymentModalState();
|
|
5518
5546
|
useEffect(() => {
|
|
@@ -5530,51 +5558,126 @@ const PaymentModalOpener = ({ paymentModalParams }) => {
|
|
|
5530
5558
|
};
|
|
5531
5559
|
|
|
5532
5560
|
//#endregion
|
|
5533
|
-
//#region src/react/ui/modals/BuyModal/hooks/
|
|
5534
|
-
const
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5561
|
+
//#region src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts
|
|
5562
|
+
const DEFAULT_PROOF = [toHex(0, { size: 32 })];
|
|
5563
|
+
const encodeERC1155MintData = ({ to, tokenIds, amounts, data = "0x", paymentToken, maxTotal, proof = DEFAULT_PROOF, abi }) => {
|
|
5564
|
+
return encodeFunctionData({
|
|
5565
|
+
abi,
|
|
5566
|
+
functionName: "mint",
|
|
5567
|
+
args: [
|
|
5568
|
+
to,
|
|
5569
|
+
tokenIds,
|
|
5570
|
+
amounts,
|
|
5571
|
+
data,
|
|
5572
|
+
paymentToken,
|
|
5573
|
+
maxTotal,
|
|
5574
|
+
proof
|
|
5575
|
+
]
|
|
5576
|
+
});
|
|
5577
|
+
};
|
|
5578
|
+
const getERC1155SalePaymentParams = async ({ chainId, address, salesContractAddress, collectionAddress, tokenId, quantity, price, currencyAddress, callbacks, customCreditCardProviderCallback, skipNativeBalanceCheck, nativeTokenAddress, checkoutProvider, successActionButtons, onRampProvider, saleAnalyticsId, abi }) => {
|
|
5579
|
+
try {
|
|
5580
|
+
const totalPrice = price * BigInt(quantity);
|
|
5581
|
+
const purchaseTransactionData = encodeERC1155MintData({
|
|
5582
|
+
to: address,
|
|
5583
|
+
tokenIds: [BigInt(tokenId)],
|
|
5584
|
+
amounts: [BigInt(quantity)],
|
|
5585
|
+
data: "0x",
|
|
5586
|
+
paymentToken: currencyAddress,
|
|
5587
|
+
maxTotal: totalPrice,
|
|
5588
|
+
proof: DEFAULT_PROOF,
|
|
5589
|
+
abi
|
|
5590
|
+
});
|
|
5591
|
+
const creditCardProviders = customCreditCardProviderCallback ? ["custom"] : checkoutProvider ? [checkoutProvider] : [];
|
|
5592
|
+
return {
|
|
5543
5593
|
chain: chainId,
|
|
5544
|
-
|
|
5594
|
+
collectibles: [{
|
|
5595
|
+
quantity: quantity.toString(),
|
|
5596
|
+
decimals: 0,
|
|
5597
|
+
tokenId
|
|
5598
|
+
}],
|
|
5599
|
+
currencyAddress,
|
|
5600
|
+
price: price.toString(),
|
|
5601
|
+
targetContractAddress: salesContractAddress,
|
|
5602
|
+
txData: purchaseTransactionData,
|
|
5545
5603
|
collectionAddress,
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
quantity: quantity?.toString() || "1"
|
|
5549
|
-
}],
|
|
5550
|
-
wallet: accountAddress ?? "",
|
|
5551
|
-
...checkoutOptions && { checkoutOptions },
|
|
5604
|
+
recipientAddress: address,
|
|
5605
|
+
creditCardProviders,
|
|
5552
5606
|
onSuccess: (txHash) => {
|
|
5553
|
-
if (txHash) onSuccess({ hash: txHash });
|
|
5554
|
-
},
|
|
5555
|
-
onError: (error) => {
|
|
5556
|
-
onError(error);
|
|
5607
|
+
if (txHash) callbacks?.onSuccess?.({ hash: txHash });
|
|
5557
5608
|
},
|
|
5609
|
+
onError: callbacks?.onError,
|
|
5558
5610
|
onClose: () => {
|
|
5559
|
-
|
|
5560
|
-
queryClient.invalidateQueries({ queryKey: balanceQueries.inventory });
|
|
5561
|
-
queryClient.invalidateQueries({
|
|
5562
|
-
queryKey: [...collectableKeys.userBalances],
|
|
5563
|
-
refetchType: "inactive"
|
|
5564
|
-
});
|
|
5565
|
-
queryClient.invalidateQueries({ queryKey: collectableKeys.listPrimarySaleItems });
|
|
5611
|
+
getQueryClient().invalidateQueries({ predicate: (query) => !query.meta?.persistent });
|
|
5566
5612
|
buyModalStore.send({ type: "close" });
|
|
5567
5613
|
},
|
|
5568
|
-
|
|
5614
|
+
skipNativeBalanceCheck,
|
|
5569
5615
|
supplementaryAnalyticsInfo: {
|
|
5570
5616
|
marketplaceType: "shop",
|
|
5571
|
-
saleAnalyticsId
|
|
5617
|
+
...saleAnalyticsId && { saleAnalyticsId }
|
|
5618
|
+
},
|
|
5619
|
+
nativeTokenAddress,
|
|
5620
|
+
...customCreditCardProviderCallback && { customProviderCallback: () => {
|
|
5621
|
+
customCreditCardProviderCallback(price.toString());
|
|
5622
|
+
buyModalStore.send({ type: "close" });
|
|
5623
|
+
} },
|
|
5624
|
+
successActionButtons,
|
|
5625
|
+
onRampProvider
|
|
5626
|
+
};
|
|
5627
|
+
} catch (error) {
|
|
5628
|
+
throw BuyModalErrorFactory.priceCalculation("ERC1155 payment params calculation", [
|
|
5629
|
+
price.toString(),
|
|
5630
|
+
quantity.toString(),
|
|
5631
|
+
tokenId
|
|
5632
|
+
], error instanceof Error ? error.message : "Unknown error");
|
|
5633
|
+
}
|
|
5634
|
+
};
|
|
5635
|
+
const useERC1155SalePaymentParams = (args) => {
|
|
5636
|
+
const { salesContractAddress, collectionAddress, tokenId, price, currencyAddress, enabled = true, checkoutProvider, chainId } = args;
|
|
5637
|
+
const { address } = useAccount();
|
|
5638
|
+
const quantity = useQuantity();
|
|
5639
|
+
const onSuccess = useOnSuccess();
|
|
5640
|
+
const onError = useOnError();
|
|
5641
|
+
const buyModalProps = useBuyModalProps();
|
|
5642
|
+
const saleAnalyticsId = useBuyAnalyticsId();
|
|
5643
|
+
const { abi, isLoading: isABILoading, version } = useSalesContractABI({
|
|
5644
|
+
contractAddress: salesContractAddress,
|
|
5645
|
+
contractType: ContractType.ERC1155,
|
|
5646
|
+
chainId,
|
|
5647
|
+
enabled: enabled && !!salesContractAddress
|
|
5648
|
+
});
|
|
5649
|
+
const queryEnabled = enabled && !!address && !!salesContractAddress && !!collectionAddress && !!tokenId && price !== void 0 && !!currencyAddress && !!quantity && !!abi && !isABILoading;
|
|
5650
|
+
return useQuery({
|
|
5651
|
+
queryKey: [
|
|
5652
|
+
"erc1155SalePaymentParams",
|
|
5653
|
+
args,
|
|
5654
|
+
quantity,
|
|
5655
|
+
version
|
|
5656
|
+
],
|
|
5657
|
+
queryFn: queryEnabled && abi ? () => getERC1155SalePaymentParams({
|
|
5658
|
+
chainId,
|
|
5659
|
+
address,
|
|
5660
|
+
salesContractAddress,
|
|
5661
|
+
collectionAddress,
|
|
5662
|
+
tokenId,
|
|
5663
|
+
quantity,
|
|
5664
|
+
price: BigInt(price),
|
|
5665
|
+
currencyAddress,
|
|
5666
|
+
callbacks: {
|
|
5667
|
+
onSuccess,
|
|
5668
|
+
onError
|
|
5572
5669
|
},
|
|
5670
|
+
customCreditCardProviderCallback: void 0,
|
|
5671
|
+
skipNativeBalanceCheck: false,
|
|
5672
|
+
nativeTokenAddress: void 0,
|
|
5673
|
+
checkoutProvider,
|
|
5573
5674
|
successActionButtons: buyModalProps.successActionButtons,
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5675
|
+
onRampProvider: buyModalProps.onRampProvider,
|
|
5676
|
+
saleAnalyticsId,
|
|
5677
|
+
abi
|
|
5678
|
+
}) : skipToken,
|
|
5679
|
+
enabled: queryEnabled
|
|
5680
|
+
});
|
|
5578
5681
|
};
|
|
5579
5682
|
|
|
5580
5683
|
//#endregion
|
|
@@ -5586,6 +5689,17 @@ const ERC1155ShopModal = ({ collection, shopData, chainId }) => {
|
|
|
5586
5689
|
const quantityDecimals = isShop && modalProps.quantityDecimals ? modalProps.quantityDecimals : 0;
|
|
5587
5690
|
const quantityRemaining = isShop && modalProps.quantityRemaining ? modalProps.quantityRemaining.toString() : "0";
|
|
5588
5691
|
const unlimitedSupply = isShop && modalProps.unlimitedSupply ? modalProps.unlimitedSupply : false;
|
|
5692
|
+
const tokenId = shopData.items[0]?.tokenId;
|
|
5693
|
+
const checkoutProvider = shopData.checkoutOptions?.nftCheckout?.[0] ? String(shopData.checkoutOptions.nftCheckout[0]) : void 0;
|
|
5694
|
+
const { data: erc1155SalePaymentParams } = useERC1155SalePaymentParams({
|
|
5695
|
+
salesContractAddress: shopData.salesContractAddress,
|
|
5696
|
+
collectionAddress: collection.address,
|
|
5697
|
+
tokenId,
|
|
5698
|
+
price: shopData.salePrice?.amount,
|
|
5699
|
+
currencyAddress: shopData.salePrice?.currencyAddress,
|
|
5700
|
+
chainId,
|
|
5701
|
+
checkoutProvider
|
|
5702
|
+
});
|
|
5589
5703
|
if (!quantity) return /* @__PURE__ */ jsx(ERC1155QuantityModal, {
|
|
5590
5704
|
salePrice: {
|
|
5591
5705
|
amount: shopData.salePrice?.amount ?? "0",
|
|
@@ -5597,49 +5711,26 @@ const ERC1155ShopModal = ({ collection, shopData, chainId }) => {
|
|
|
5597
5711
|
unlimitedSupply,
|
|
5598
5712
|
chainId
|
|
5599
5713
|
});
|
|
5600
|
-
return /* @__PURE__ */ jsx(
|
|
5601
|
-
chainId,
|
|
5602
|
-
salesContractAddress: shopData.salesContractAddress,
|
|
5603
|
-
collectionAddress: collection.address,
|
|
5604
|
-
items: shopData.items.map((item) => ({
|
|
5605
|
-
...item,
|
|
5606
|
-
tokenId: item.tokenId ?? "0",
|
|
5607
|
-
quantity: quantity.toString() ?? "1"
|
|
5608
|
-
})),
|
|
5609
|
-
checkoutOptions: shopData.checkoutOptions,
|
|
5610
|
-
enabled: !!shopData.salesContractAddress && !!shopData.items
|
|
5611
|
-
});
|
|
5714
|
+
return /* @__PURE__ */ jsx(PaymentModalOpener, { paymentModalParams: erc1155SalePaymentParams });
|
|
5612
5715
|
};
|
|
5613
|
-
const
|
|
5614
|
-
const
|
|
5615
|
-
const
|
|
5616
|
-
chainId,
|
|
5617
|
-
salesContractAddress,
|
|
5618
|
-
collectionAddress,
|
|
5619
|
-
items,
|
|
5620
|
-
checkoutOptions,
|
|
5621
|
-
customProviderCallback,
|
|
5622
|
-
enabled
|
|
5623
|
-
});
|
|
5716
|
+
const PaymentModalOpener = ({ paymentModalParams }) => {
|
|
5717
|
+
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
5718
|
+
const paymentModalState = usePaymentModalState();
|
|
5624
5719
|
useEffect(() => {
|
|
5625
|
-
if (
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5720
|
+
if (paymentModalState !== "idle") return;
|
|
5721
|
+
if (!paymentModalParams) return;
|
|
5722
|
+
const totalPrice = BigInt(paymentModalParams.price) * BigInt(paymentModalParams.collectibles[0].quantity);
|
|
5723
|
+
buyModalStore.send({ type: "openPaymentModal" });
|
|
5724
|
+
openSelectPaymentModal({
|
|
5725
|
+
...paymentModalParams,
|
|
5726
|
+
price: String(totalPrice)
|
|
5727
|
+
});
|
|
5728
|
+
buyModalStore.send({ type: "paymentModalOpened" });
|
|
5630
5729
|
}, [
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
isEnabled,
|
|
5635
|
-
openCheckoutModal
|
|
5730
|
+
paymentModalState,
|
|
5731
|
+
paymentModalParams,
|
|
5732
|
+
openSelectPaymentModal
|
|
5636
5733
|
]);
|
|
5637
|
-
if (isLoading) return /* @__PURE__ */ jsx(LoadingModal, {
|
|
5638
|
-
isOpen: true,
|
|
5639
|
-
chainId,
|
|
5640
|
-
onClose: () => buyModalStore.send({ type: "close" }),
|
|
5641
|
-
title: "Loading payment options"
|
|
5642
|
-
});
|
|
5643
5734
|
return null;
|
|
5644
5735
|
};
|
|
5645
5736
|
|
|
@@ -5913,14 +6004,13 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5913
6004
|
children: [/* @__PURE__ */ jsx("div", {
|
|
5914
6005
|
className: "flex flex-col",
|
|
5915
6006
|
children: Object.values(PRESET_RANGES).map((preset) => {
|
|
5916
|
-
const isActive = matchingPreset === preset.value;
|
|
5917
6007
|
return /* @__PURE__ */ jsx(Button, {
|
|
5918
6008
|
onClick: () => {
|
|
5919
6009
|
onSelectPreset(preset.value);
|
|
5920
6010
|
setIsOpen(false);
|
|
5921
6011
|
},
|
|
5922
6012
|
variant: "text",
|
|
5923
|
-
className: `w-full justify-start py-1.5 font-bold text-xs transition-colors ${
|
|
6013
|
+
className: `w-full justify-start py-1.5 font-bold text-xs transition-colors ${matchingPreset === preset.value ? "text-text-100" : "text-text-50 hover:text-text-80"}`,
|
|
5924
6014
|
tabIndex: 0,
|
|
5925
6015
|
children: preset.label
|
|
5926
6016
|
}, preset.value);
|
|
@@ -5932,8 +6022,7 @@ function CalendarDropdown({ selectedDate, setSelectedDate, onSelectPreset, isOpe
|
|
|
5932
6022
|
setSelectedDate: (date) => {
|
|
5933
6023
|
const newDate = new Date(date);
|
|
5934
6024
|
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
5935
|
-
|
|
5936
|
-
if (isSameDay(selectedDay, today)) setSelectedDate(endOfDay(newDate));
|
|
6025
|
+
if (isSameDay(startOfDay(newDate), today)) setSelectedDate(endOfDay(newDate));
|
|
5937
6026
|
else {
|
|
5938
6027
|
newDate.setHours(selectedDate.getHours(), selectedDate.getMinutes(), 0, 0);
|
|
5939
6028
|
setSelectedDate(newDate);
|
|
@@ -5986,12 +6075,11 @@ const ExpirationDateSelect = function ExpirationDateSelect$1({ className, date,
|
|
|
5986
6075
|
if (!presetRange) return;
|
|
5987
6076
|
const baseDate = /* @__PURE__ */ new Date();
|
|
5988
6077
|
const targetDate = presetRange.value === "today" ? baseDate : addDays(baseDate, presetRange.offset);
|
|
5989
|
-
|
|
6078
|
+
onDateChange(presetRange.value === "today" ? endOfDay(targetDate) : (() => {
|
|
5990
6079
|
const preservedTimeDate = new Date(targetDate);
|
|
5991
6080
|
preservedTimeDate.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
5992
6081
|
return preservedTimeDate;
|
|
5993
|
-
})();
|
|
5994
|
-
onDateChange(newDate);
|
|
6082
|
+
})());
|
|
5995
6083
|
}
|
|
5996
6084
|
function handleDateValueChange(date$1) {
|
|
5997
6085
|
onDateChange(date$1);
|
|
@@ -6049,7 +6137,7 @@ function FloorPriceText({ chainId, collectionAddress, tokenId, price, onBuyNow }
|
|
|
6049
6137
|
showBuyNowButton = true;
|
|
6050
6138
|
}
|
|
6051
6139
|
return /* @__PURE__ */ jsxs("div", {
|
|
6052
|
-
className: "flex w-full items-center justify-between gap-2",
|
|
6140
|
+
className: "flex w-full flex-wrap items-center justify-between gap-2",
|
|
6053
6141
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
6054
6142
|
className: "text-left font-body font-medium text-muted text-xs",
|
|
6055
6143
|
children: floorPriceDifferenceText
|
|
@@ -6250,394 +6338,6 @@ const CustomSelect = ({ items, onValueChange, defaultValue, placeholder = "Selec
|
|
|
6250
6338
|
}) })] });
|
|
6251
6339
|
};
|
|
6252
6340
|
|
|
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
|
-
|
|
6641
6341
|
//#endregion
|
|
6642
6342
|
//#region src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
6643
6343
|
function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDefault, selectedCurrency, onCurrencyChange, includeNativeCurrency, orderbookKind, modalType }) {
|
|
@@ -6647,10 +6347,11 @@ function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDef
|
|
|
6647
6347
|
includeNativeCurrency
|
|
6648
6348
|
});
|
|
6649
6349
|
let filteredCurrencies = currencies;
|
|
6650
|
-
if (currencies && orderbookKind === OrderbookKind.opensea && modalType) {
|
|
6651
|
-
|
|
6652
|
-
if (
|
|
6653
|
-
|
|
6350
|
+
if (currencies && orderbookKind === OrderbookKind.opensea && modalType) filteredCurrencies = currencies.filter((currency) => {
|
|
6351
|
+
if (modalType === "listing") return currency.openseaListing;
|
|
6352
|
+
if (modalType === "offer") return currency.openseaOffer;
|
|
6353
|
+
return false;
|
|
6354
|
+
});
|
|
6654
6355
|
useEffect(() => {
|
|
6655
6356
|
if (filteredCurrencies && filteredCurrencies.length > 0 && !selectedCurrency?.contractAddress) if (secondCurrencyAsDefault && filteredCurrencies.length > 1) onCurrencyChange(filteredCurrencies[1]);
|
|
6656
6357
|
else onCurrencyChange(filteredCurrencies[0]);
|
|
@@ -6670,6 +6371,7 @@ function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDef
|
|
|
6670
6371
|
const selectedCurrency$1 = filteredCurrencies.find((currency) => currency.contractAddress === value);
|
|
6671
6372
|
if (selectedCurrency$1) onCurrencyChange(selectedCurrency$1);
|
|
6672
6373
|
};
|
|
6374
|
+
const isDropdownDisabled = orderbookKind === OrderbookKind.opensea;
|
|
6673
6375
|
return /* @__PURE__ */ jsx(CustomSelect, {
|
|
6674
6376
|
items: options,
|
|
6675
6377
|
onValueChange: onChange,
|
|
@@ -6677,6 +6379,7 @@ function CurrencyOptionsSelect({ chainId, collectionAddress, secondCurrencyAsDef
|
|
|
6677
6379
|
value: selectedCurrency.contractAddress,
|
|
6678
6380
|
content: selectedCurrency.symbol
|
|
6679
6381
|
},
|
|
6382
|
+
disabled: isDropdownDisabled,
|
|
6680
6383
|
testId: "currency-select"
|
|
6681
6384
|
});
|
|
6682
6385
|
}
|
|
@@ -6684,7 +6387,7 @@ var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
|
6684
6387
|
|
|
6685
6388
|
//#endregion
|
|
6686
6389
|
//#region src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
6687
|
-
function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurrencyChange, checkBalance, secondCurrencyAsDefault, includeNativeCurrency, disabled, orderbookKind, setOpenseaLowestPriceCriteriaMet, modalType }) {
|
|
6390
|
+
function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurrencyChange, checkBalance, secondCurrencyAsDefault, includeNativeCurrency, disabled, orderbookKind, setOpenseaLowestPriceCriteriaMet, modalType, feeData }) {
|
|
6688
6391
|
const { address: accountAddress } = useAccount();
|
|
6689
6392
|
const inputRef = useRef(null);
|
|
6690
6393
|
const currency = price?.currency;
|
|
@@ -6708,26 +6411,57 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
6708
6411
|
chainId,
|
|
6709
6412
|
userAddress: accountAddress
|
|
6710
6413
|
});
|
|
6711
|
-
const
|
|
6414
|
+
const getTotalRequiredBalance = () => {
|
|
6415
|
+
if (!priceAmountRaw || !currencyDecimals) return BigInt(0);
|
|
6416
|
+
const offerAmountRaw = BigInt(priceAmountRaw);
|
|
6417
|
+
if (modalType === "offer" && feeData) return calculateTotalOfferCost(offerAmountRaw, currencyDecimals, feeData.royaltyPercentage || 0);
|
|
6418
|
+
return offerAmountRaw;
|
|
6419
|
+
};
|
|
6420
|
+
const balanceError = !!checkBalance?.enabled && !!isBalanceSuccess && !!priceAmountRaw && !!currencyDecimals && getTotalRequiredBalance() > BigInt(balance?.value || 0n);
|
|
6421
|
+
const hasEnoughForBaseOffer = !!isBalanceSuccess && !!priceAmountRaw && BigInt(priceAmountRaw) <= BigInt(balance?.value || 0n);
|
|
6422
|
+
const getRoyaltyFeeAmount = () => {
|
|
6423
|
+
if (!priceAmountRaw || !currencyDecimals || !feeData?.royaltyPercentage) return null;
|
|
6424
|
+
return formatUnits(BigInt(priceAmountRaw) * BigInt(Math.round(feeData.royaltyPercentage * 100)) / BigInt(1e4), currencyDecimals);
|
|
6425
|
+
};
|
|
6426
|
+
const royaltyFeeFormatted = getRoyaltyFeeAmount();
|
|
6427
|
+
const RoyaltyFeeTooltip = ({ children }) => /* @__PURE__ */ jsx(Tooltip, {
|
|
6428
|
+
message: /* @__PURE__ */ jsxs("div", {
|
|
6429
|
+
className: "flex flex-col gap-1",
|
|
6430
|
+
children: [
|
|
6431
|
+
/* @__PURE__ */ jsx(Text, {
|
|
6432
|
+
className: "font-body font-medium text-xs",
|
|
6433
|
+
children: "A royalty fee is a percentage of each resale"
|
|
6434
|
+
}),
|
|
6435
|
+
/* @__PURE__ */ jsx(Text, {
|
|
6436
|
+
className: "font-body font-medium text-xs",
|
|
6437
|
+
children: "price that automatically compensates the original"
|
|
6438
|
+
}),
|
|
6439
|
+
/* @__PURE__ */ jsx(Text, {
|
|
6440
|
+
className: "font-body font-medium text-xs",
|
|
6441
|
+
children: "creator every time their collectible changes hands."
|
|
6442
|
+
})
|
|
6443
|
+
]
|
|
6444
|
+
}),
|
|
6445
|
+
children
|
|
6446
|
+
});
|
|
6712
6447
|
const openseaLowestPriceCriteriaMet = orderbookKind === OrderbookKind.opensea && !!conversion?.usdAmount && conversion.usdAmount >= .01;
|
|
6713
6448
|
if (checkBalance?.enabled) checkBalance.callback(balanceError);
|
|
6714
6449
|
if (setOpenseaLowestPriceCriteriaMet) setOpenseaLowestPriceCriteriaMet(openseaLowestPriceCriteriaMet);
|
|
6715
6450
|
const [value, setValue] = useState("0");
|
|
6716
6451
|
const prevCurrencyDecimals = useRef(currencyDecimals);
|
|
6452
|
+
const [openseaDecimalError, setOpenseaDecimalError] = useState(null);
|
|
6717
6453
|
useEffect(() => {
|
|
6718
6454
|
if (prevCurrencyDecimals.current !== currencyDecimals && value !== "0" && price && onPriceChange) try {
|
|
6719
6455
|
const parsedAmount = parseUnits(value, Number(currencyDecimals));
|
|
6720
|
-
|
|
6456
|
+
onPriceChange({
|
|
6721
6457
|
...price,
|
|
6722
6458
|
amountRaw: parsedAmount.toString()
|
|
6723
|
-
};
|
|
6724
|
-
onPriceChange(updatedPrice);
|
|
6459
|
+
});
|
|
6725
6460
|
} catch {
|
|
6726
|
-
|
|
6461
|
+
onPriceChange({
|
|
6727
6462
|
...price,
|
|
6728
6463
|
amountRaw: "0"
|
|
6729
|
-
};
|
|
6730
|
-
onPriceChange(updatedPrice);
|
|
6464
|
+
});
|
|
6731
6465
|
}
|
|
6732
6466
|
prevCurrencyDecimals.current = currencyDecimals;
|
|
6733
6467
|
}, [
|
|
@@ -6740,19 +6474,37 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
6740
6474
|
const newValue = event.target.value;
|
|
6741
6475
|
setValue(newValue);
|
|
6742
6476
|
if (!price || !onPriceChange) return;
|
|
6477
|
+
if (orderbookKind === OrderbookKind.opensea && modalType === "offer") {
|
|
6478
|
+
const validation = validateOpenseaOfferDecimals(newValue);
|
|
6479
|
+
if (!validation.isValid) {
|
|
6480
|
+
setOpenseaDecimalError(validation.errorMessage || null);
|
|
6481
|
+
try {
|
|
6482
|
+
const parsedAmount = parseUnits(newValue, Number(currencyDecimals));
|
|
6483
|
+
onPriceChange({
|
|
6484
|
+
...price,
|
|
6485
|
+
amountRaw: parsedAmount.toString()
|
|
6486
|
+
});
|
|
6487
|
+
} catch {
|
|
6488
|
+
onPriceChange({
|
|
6489
|
+
...price,
|
|
6490
|
+
amountRaw: "0"
|
|
6491
|
+
});
|
|
6492
|
+
}
|
|
6493
|
+
return;
|
|
6494
|
+
}
|
|
6495
|
+
setOpenseaDecimalError(null);
|
|
6496
|
+
}
|
|
6743
6497
|
try {
|
|
6744
6498
|
const parsedAmount = parseUnits(newValue, Number(currencyDecimals));
|
|
6745
|
-
|
|
6499
|
+
onPriceChange({
|
|
6746
6500
|
...price,
|
|
6747
6501
|
amountRaw: parsedAmount.toString()
|
|
6748
|
-
};
|
|
6749
|
-
onPriceChange(updatedPrice);
|
|
6502
|
+
});
|
|
6750
6503
|
} catch {
|
|
6751
|
-
|
|
6504
|
+
onPriceChange({
|
|
6752
6505
|
...price,
|
|
6753
6506
|
amountRaw: "0"
|
|
6754
|
-
};
|
|
6755
|
-
onPriceChange(updatedPrice);
|
|
6507
|
+
});
|
|
6756
6508
|
}
|
|
6757
6509
|
};
|
|
6758
6510
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -6785,15 +6537,58 @@ function PriceInput({ chainId, collectionAddress, price, onPriceChange, onCurren
|
|
|
6785
6537
|
onChange: handleChange
|
|
6786
6538
|
})
|
|
6787
6539
|
}),
|
|
6788
|
-
balanceError && /* @__PURE__ */ jsx(
|
|
6789
|
-
className: "-
|
|
6790
|
-
|
|
6791
|
-
|
|
6540
|
+
balanceError && /* @__PURE__ */ jsx("div", {
|
|
6541
|
+
className: "mt-2",
|
|
6542
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
6543
|
+
className: "font-body font-medium text-xs",
|
|
6544
|
+
color: "negative",
|
|
6545
|
+
children: modalType === "offer" && hasEnoughForBaseOffer && royaltyFeeFormatted && Number(royaltyFeeFormatted) > 0 ? /* @__PURE__ */ jsx(RoyaltyFeeTooltip, { children: /* @__PURE__ */ jsxs("div", {
|
|
6546
|
+
className: "flex items-center gap-1",
|
|
6547
|
+
children: [/* @__PURE__ */ jsx(InfoIcon, { className: "h-4 w-4 text-negative" }), /* @__PURE__ */ jsxs(Text, {
|
|
6548
|
+
className: "font-body font-medium text-xs",
|
|
6549
|
+
color: "negative",
|
|
6550
|
+
children: [
|
|
6551
|
+
"You need ",
|
|
6552
|
+
royaltyFeeFormatted,
|
|
6553
|
+
" ",
|
|
6554
|
+
currency?.symbol,
|
|
6555
|
+
" for royalty fees"
|
|
6556
|
+
]
|
|
6557
|
+
})]
|
|
6558
|
+
}) }) : "Insufficient balance"
|
|
6559
|
+
})
|
|
6560
|
+
}),
|
|
6561
|
+
!balanceError && modalType === "offer" && royaltyFeeFormatted && Number(royaltyFeeFormatted) > 0 && /* @__PURE__ */ jsx("div", {
|
|
6562
|
+
className: "mt-2",
|
|
6563
|
+
children: /* @__PURE__ */ jsx(RoyaltyFeeTooltip, { children: /* @__PURE__ */ jsxs("div", {
|
|
6564
|
+
className: "flex items-center gap-1",
|
|
6565
|
+
children: [/* @__PURE__ */ jsx(InfoIcon, { className: "h-4 w-4 text-text-50" }), /* @__PURE__ */ jsxs(Text, {
|
|
6566
|
+
className: "font-body font-medium text-xs",
|
|
6567
|
+
color: "text50",
|
|
6568
|
+
children: [
|
|
6569
|
+
"Total:",
|
|
6570
|
+
" ",
|
|
6571
|
+
(Number(value) + Number(royaltyFeeFormatted)).toFixed(6).replace(/\.?0+$/, ""),
|
|
6572
|
+
" ",
|
|
6573
|
+
currency?.symbol,
|
|
6574
|
+
" (includes ",
|
|
6575
|
+
royaltyFeeFormatted,
|
|
6576
|
+
" ",
|
|
6577
|
+
currency?.symbol,
|
|
6578
|
+
" royalty fee)"
|
|
6579
|
+
]
|
|
6580
|
+
})]
|
|
6581
|
+
}) })
|
|
6792
6582
|
}),
|
|
6793
|
-
!balanceError && priceAmountRaw !== "0" && !openseaLowestPriceCriteriaMet && orderbookKind === OrderbookKind.opensea && !isConversionLoading && modalType === "offer" && /* @__PURE__ */ jsx(Text, {
|
|
6583
|
+
!balanceError && priceAmountRaw !== "0" && !openseaLowestPriceCriteriaMet && orderbookKind === OrderbookKind.opensea && !isConversionLoading && modalType === "offer" && !openseaDecimalError && /* @__PURE__ */ jsx(Text, {
|
|
6794
6584
|
className: "-bottom-5 absolute font-body font-medium text-xs",
|
|
6795
6585
|
color: "negative",
|
|
6796
6586
|
children: "Lowest price must be at least $0.01"
|
|
6587
|
+
}),
|
|
6588
|
+
!balanceError && openseaDecimalError && orderbookKind === OrderbookKind.opensea && modalType === "offer" && /* @__PURE__ */ jsx(Text, {
|
|
6589
|
+
className: "font-body font-medium text-xs",
|
|
6590
|
+
color: "negative",
|
|
6591
|
+
children: openseaDecimalError
|
|
6797
6592
|
})
|
|
6798
6593
|
]
|
|
6799
6594
|
});
|
|
@@ -6810,9 +6605,8 @@ const WaasFeeOptionsSelect = ({ options, selectedFeeOption, onSelectedFeeOptionC
|
|
|
6810
6605
|
}
|
|
6811
6606
|
}));
|
|
6812
6607
|
const feeOptions = options.map((option) => {
|
|
6813
|
-
const value = option.token.contractAddress ?? "";
|
|
6814
6608
|
return FeeOptionSelectItem({
|
|
6815
|
-
value,
|
|
6609
|
+
value: option.token.contractAddress ?? "",
|
|
6816
6610
|
option
|
|
6817
6611
|
});
|
|
6818
6612
|
});
|
|
@@ -6831,8 +6625,7 @@ const WaasFeeOptionsSelect = ({ options, selectedFeeOption, onSelectedFeeOptionC
|
|
|
6831
6625
|
value: option.value
|
|
6832
6626
|
})),
|
|
6833
6627
|
onValueChange: (value) => {
|
|
6834
|
-
|
|
6835
|
-
onSelectedFeeOptionChange(selectedOption);
|
|
6628
|
+
onSelectedFeeOptionChange(options.find((option) => option.token.contractAddress === value));
|
|
6836
6629
|
},
|
|
6837
6630
|
defaultValue: options[0].token.contractAddress ?? void 0
|
|
6838
6631
|
});
|
|
@@ -7111,8 +6904,7 @@ function TransactionDetails({ collectibleId, collectionAddress, chainId, include
|
|
|
7111
6904
|
const fees = [];
|
|
7112
6905
|
if (royalty !== null) fees.push(Number(royalty.percentage));
|
|
7113
6906
|
if (marketplaceFeePercentage > 0) fees.push(marketplaceFeePercentage);
|
|
7114
|
-
|
|
7115
|
-
setFormattedAmount(newFormattedAmount);
|
|
6907
|
+
setFormattedAmount(calculateEarningsAfterFees(BigInt(price.amountRaw), price.currency.decimals, fees));
|
|
7116
6908
|
}, [
|
|
7117
6909
|
price,
|
|
7118
6910
|
royalty,
|
|
@@ -7149,7 +6941,7 @@ function TransactionDetails({ collectibleId, collectionAddress, chainId, include
|
|
|
7149
6941
|
color: "text100",
|
|
7150
6942
|
children: ["0 ", price.currency.symbol]
|
|
7151
6943
|
}) : overflow.status ? /* @__PURE__ */ jsx(Tooltip, {
|
|
7152
|
-
message: formattedAmount
|
|
6944
|
+
message: `${formattedAmount} ${price.currency.symbol}`,
|
|
7153
6945
|
children: /* @__PURE__ */ jsxs("div", {
|
|
7154
6946
|
className: "flex items-center",
|
|
7155
6947
|
children: [/* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3 text-text-100" }), /* @__PURE__ */ jsxs(Text, {
|
|
@@ -7734,7 +7526,8 @@ const useGetTokenApprovalData$1 = (params) => {
|
|
|
7734
7526
|
contractType: params.contractType,
|
|
7735
7527
|
orderbook: params.orderbook,
|
|
7736
7528
|
offer,
|
|
7737
|
-
additionalFees: []
|
|
7529
|
+
additionalFees: [],
|
|
7530
|
+
offerType: OfferType.item
|
|
7738
7531
|
};
|
|
7739
7532
|
const tokenApprovalStep = (await marketplaceClient.generateOfferTransaction(args).then((resp) => resp.steps)).find((step) => step.id === StepType.tokenApproval);
|
|
7740
7533
|
if (!tokenApprovalStep) return { step: null };
|
|
@@ -7784,7 +7577,8 @@ const useTransactionSteps$1 = ({ offerInput, chainId, collectionAddress, orderbo
|
|
|
7784
7577
|
...offerInput.offer,
|
|
7785
7578
|
expiry: /* @__PURE__ */ new Date(Number(offerInput.offer.expiry) * 1e3)
|
|
7786
7579
|
},
|
|
7787
|
-
additionalFees: []
|
|
7580
|
+
additionalFees: [],
|
|
7581
|
+
offerType: OfferType.item
|
|
7788
7582
|
});
|
|
7789
7583
|
} catch (error) {
|
|
7790
7584
|
if (callbacks?.onError) callbacks.onError(error);
|
|
@@ -8017,9 +7811,15 @@ const Modal$2 = observer(() => {
|
|
|
8017
7811
|
});
|
|
8018
7812
|
const { data: currencies, isLoading: currenciesLoading, isError: currenciesIsError } = useMarketCurrencies({
|
|
8019
7813
|
chainId,
|
|
7814
|
+
collectionAddress,
|
|
8020
7815
|
includeNativeCurrency: false
|
|
8021
7816
|
});
|
|
8022
|
-
const
|
|
7817
|
+
const { data: royalty, isLoading: royaltyLoading } = useRoyalty({
|
|
7818
|
+
chainId,
|
|
7819
|
+
collectionAddress,
|
|
7820
|
+
collectibleId
|
|
7821
|
+
});
|
|
7822
|
+
const modalLoading = collectableIsLoading || collectionIsLoading || currenciesLoading || royaltyLoading;
|
|
8023
7823
|
const { isLoading, executeApproval, makeOffer, isError: approvalIsError } = useMakeOffer({
|
|
8024
7824
|
offerInput: {
|
|
8025
7825
|
contractType: collection?.type,
|
|
@@ -8051,7 +7851,7 @@ const Modal$2 = observer(() => {
|
|
|
8051
7851
|
onClose: makeOfferModal$.close,
|
|
8052
7852
|
title: "Make an offer"
|
|
8053
7853
|
});
|
|
8054
|
-
if (!
|
|
7854
|
+
if (!currenciesLoading && !currenciesIsError && (!currencies || currencies.length === 0)) return /* @__PURE__ */ jsx(ErrorModal, {
|
|
8055
7855
|
isOpen: makeOfferModal$.isOpen.get(),
|
|
8056
7856
|
chainId: Number(chainId),
|
|
8057
7857
|
onClose: makeOfferModal$.close,
|
|
@@ -8130,7 +7930,8 @@ const Modal$2 = observer(() => {
|
|
|
8130
7930
|
setOpenseaLowestPriceCriteriaMet: (state) => setOpenseaLowestPriceCriteriaMet(state),
|
|
8131
7931
|
orderbookKind,
|
|
8132
7932
|
modalType: "offer",
|
|
8133
|
-
disabled: shouldHideOfferButton
|
|
7933
|
+
disabled: shouldHideOfferButton,
|
|
7934
|
+
feeData: { royaltyPercentage: royalty ? Number(royalty.percentage) : 0 }
|
|
8134
7935
|
}),
|
|
8135
7936
|
collection?.type === ContractType.ERC1155 && /* @__PURE__ */ jsx(QuantityInput, {
|
|
8136
7937
|
quantity: use$(makeOfferModal$.quantity),
|
|
@@ -8686,10 +8487,9 @@ function SuccessfulPurchaseActions({ modalState }) {
|
|
|
8686
8487
|
}
|
|
8687
8488
|
function CollectiblesGrid({ collectibles }) {
|
|
8688
8489
|
const total = collectibles.length;
|
|
8689
|
-
const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
|
|
8690
8490
|
return /* @__PURE__ */ jsx("div", {
|
|
8691
8491
|
className: "grid grid-cols-[repeat(auto-fill,minmax(150px,1fr))] gap-2 [&:has(div:nth-child(4))>div]:col-[unset] [&>div:nth-child(1):only-child]:h-[312px] [&>div:nth-child(1):only-child]:w-[312px] [&>div:nth-child(3)]:col-[1/-1] [&>div:nth-child(3)]:justify-self-center",
|
|
8692
|
-
children:
|
|
8492
|
+
children: (total > 4 ? collectibles.slice(0, 4) : collectibles).map((collectible) => {
|
|
8693
8493
|
const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
|
|
8694
8494
|
return /* @__PURE__ */ jsxs("div", {
|
|
8695
8495
|
className: "relative h-[150px] w-[150px]",
|
|
@@ -8987,7 +8787,7 @@ const EnterWalletAddressView = () => {
|
|
|
8987
8787
|
accountAddress: connectedAddress,
|
|
8988
8788
|
query: { enabled: !!connectedAddress }
|
|
8989
8789
|
});
|
|
8990
|
-
const balanceAmount = tokenBalance?.pages[0]
|
|
8790
|
+
const balanceAmount = tokenBalance?.pages[0]?.balances[0]?.balance;
|
|
8991
8791
|
let insufficientBalance = true;
|
|
8992
8792
|
if (balanceAmount !== void 0 && quantity) try {
|
|
8993
8793
|
insufficientBalance = BigInt(quantity) > BigInt(balanceAmount);
|
|
@@ -9078,17 +8878,24 @@ var followWalletInstructions_default = FollowWalletInstructionsView;
|
|
|
9078
8878
|
|
|
9079
8879
|
//#endregion
|
|
9080
8880
|
//#region src/react/ui/modals/TransferModal/index.tsx
|
|
9081
|
-
const useTransferModal = () => {
|
|
8881
|
+
const useTransferModal = (args) => {
|
|
9082
8882
|
const { ensureCorrectChain } = useEnsureCorrectChain();
|
|
9083
|
-
const
|
|
8883
|
+
const { address: accountAddress } = useAccount();
|
|
8884
|
+
useListBalances({
|
|
8885
|
+
chainId: args?.prefetch?.chainId,
|
|
8886
|
+
contractAddress: args?.prefetch?.collectionAddress,
|
|
8887
|
+
tokenId: args?.prefetch?.collectibleId,
|
|
8888
|
+
accountAddress,
|
|
8889
|
+
query: { enabled: !!accountAddress && !!args?.prefetch }
|
|
8890
|
+
});
|
|
8891
|
+
const openModal = (args$1) => {
|
|
9084
8892
|
transferModalStore.send({
|
|
9085
8893
|
type: "open",
|
|
9086
|
-
...args
|
|
8894
|
+
...args$1
|
|
9087
8895
|
});
|
|
9088
8896
|
};
|
|
9089
|
-
const handleShowModal = (args) => {
|
|
9090
|
-
|
|
9091
|
-
ensureCorrectChain(targetChainId, { onSuccess: () => openModal(args) });
|
|
8897
|
+
const handleShowModal = (args$1) => {
|
|
8898
|
+
ensureCorrectChain(Number(args$1.chainId), { onSuccess: () => openModal(args$1) });
|
|
9092
8899
|
};
|
|
9093
8900
|
return {
|
|
9094
8901
|
show: handleShowModal,
|
|
@@ -9176,7 +8983,7 @@ const styles = String.raw`/* Modified Tailwind CSS, to avoid issues with shadow
|
|
|
9176
8983
|
--tw-gradient-via-position: 50%;
|
|
9177
8984
|
--tw-gradient-to-position: 100%;
|
|
9178
8985
|
}
|
|
9179
|
-
/*! tailwindcss v4.1.
|
|
8986
|
+
/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
|
|
9180
8987
|
@layer properties;
|
|
9181
8988
|
@layer theme, base, components, utilities;
|
|
9182
8989
|
@layer theme {
|
|
@@ -12645,9 +12452,8 @@ const ModalProvider = observer(({ children }) => {
|
|
|
12645
12452
|
const sdkConfig = useConfig();
|
|
12646
12453
|
const { shadowDom, experimentalShadowDomCssOverride } = sdkConfig;
|
|
12647
12454
|
const overrides = sdkConfig._internal?.overrides?.api?.marketplace;
|
|
12648
|
-
const marketplaceApiUrl = overrides?.url || marketplaceApiURL(overrides?.env || "production");
|
|
12649
12455
|
return /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx(SequenceCheckoutProvider, {
|
|
12650
|
-
config: { env: { marketplaceApiUrl } },
|
|
12456
|
+
config: { env: { marketplaceApiUrl: overrides?.url || marketplaceApiURL(overrides?.env || "production") } },
|
|
12651
12457
|
children: /* @__PURE__ */ jsxs(ShadowRoot, {
|
|
12652
12458
|
enabled: shadowDom ?? true,
|
|
12653
12459
|
customCSS: experimentalShadowDomCssOverride,
|
|
@@ -12899,16 +12705,14 @@ const useActionButtonLogic = ({ tokenId, owned, action, onCannotPerformAction })
|
|
|
12899
12705
|
executePendingAction,
|
|
12900
12706
|
clearPendingAction
|
|
12901
12707
|
]);
|
|
12902
|
-
const shouldShowAction = !address ? [CollectibleCardAction.BUY, CollectibleCardAction.OFFER].includes(action) : true;
|
|
12903
|
-
const isOwnerAction = address && owned && [
|
|
12904
|
-
CollectibleCardAction.LIST,
|
|
12905
|
-
CollectibleCardAction.TRANSFER,
|
|
12906
|
-
CollectibleCardAction.SELL
|
|
12907
|
-
].includes(action);
|
|
12908
12708
|
return {
|
|
12909
12709
|
address,
|
|
12910
|
-
shouldShowAction,
|
|
12911
|
-
isOwnerAction
|
|
12710
|
+
shouldShowAction: !address ? [CollectibleCardAction.BUY, CollectibleCardAction.OFFER].includes(action) : true,
|
|
12711
|
+
isOwnerAction: address && owned && [
|
|
12712
|
+
CollectibleCardAction.LIST,
|
|
12713
|
+
CollectibleCardAction.TRANSFER,
|
|
12714
|
+
CollectibleCardAction.SELL
|
|
12715
|
+
].includes(action)
|
|
12912
12716
|
};
|
|
12913
12717
|
};
|
|
12914
12718
|
|
|
@@ -13167,17 +12971,15 @@ function Media({ name, assets, assetSrcPrefixUrl, className = "", containerClass
|
|
|
13167
12971
|
}
|
|
13168
12972
|
const determineContentType = async () => {
|
|
13169
12973
|
try {
|
|
13170
|
-
const type = await getContentType(proxiedAssetUrl);
|
|
13171
12974
|
setContentType({
|
|
13172
|
-
type,
|
|
12975
|
+
type: await getContentType(proxiedAssetUrl),
|
|
13173
12976
|
loading: false,
|
|
13174
12977
|
failed: false
|
|
13175
12978
|
});
|
|
13176
12979
|
} catch {
|
|
13177
12980
|
try {
|
|
13178
|
-
const type = await fetchContentType(proxiedAssetUrl);
|
|
13179
12981
|
setContentType({
|
|
13180
|
-
type,
|
|
12982
|
+
type: await fetchContentType(proxiedAssetUrl),
|
|
13181
12983
|
loading: false,
|
|
13182
12984
|
failed: false
|
|
13183
12985
|
});
|
|
@@ -13347,23 +13149,17 @@ function BaseCard({ name, image, video, animationUrl, onClick, onKeyDown, assetS
|
|
|
13347
13149
|
|
|
13348
13150
|
//#endregion
|
|
13349
13151
|
//#region src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx
|
|
13350
|
-
const Footer = ({ chainId,
|
|
13152
|
+
const Footer = ({ chainId, name, type, decimals, onOfferClick, highestOffer, lowestListing, balance, quantityInitial, quantityRemaining, unlimitedSupply, cardType, salePriceAmount, salePriceCurrency }) => {
|
|
13351
13153
|
const isShop = cardType === "shop";
|
|
13352
13154
|
const isMarket = cardType === "market";
|
|
13353
13155
|
const isInventoryNonTradable = cardType === "inventory-non-tradable";
|
|
13354
|
-
const { data: lowestListing, isLoading: isLowestListingLoading } = useLowestListing({
|
|
13355
|
-
chainId,
|
|
13356
|
-
collectionAddress,
|
|
13357
|
-
tokenId: collectibleId,
|
|
13358
|
-
query: { enabled: isMarket }
|
|
13359
|
-
});
|
|
13360
13156
|
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
13361
13157
|
chainId,
|
|
13362
13158
|
currencyAddress: lowestListing?.priceCurrencyAddress,
|
|
13363
13159
|
query: { enabled: isMarket && !!lowestListing?.priceCurrencyAddress }
|
|
13364
13160
|
});
|
|
13365
13161
|
const listed = !!lowestListing?.priceAmount && !!lowestListing?.priceCurrencyAddress;
|
|
13366
|
-
const isPriceLoading = isMarket &&
|
|
13162
|
+
const isPriceLoading = isMarket && !!lowestListing?.priceCurrencyAddress && isCurrencyLoading;
|
|
13367
13163
|
return /* @__PURE__ */ jsxs("div", {
|
|
13368
13164
|
className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4",
|
|
13369
13165
|
children: [
|
|
@@ -13439,6 +13235,7 @@ const NonTradableInventoryFooter = ({ name, balance, decimals, type }) => {
|
|
|
13439
13235
|
function MarketCard({ collectibleId, chainId, collectionAddress, collectionType, assetSrcPrefixUrl, cardLoading, orderbookKind, collectible, onCollectibleClick, onOfferClick, balance, balanceIsLoading = false, onCannotPerformAction, prioritizeOwnerActions, hideQuantitySelector }) {
|
|
13440
13236
|
const collectibleMetadata = collectible?.metadata;
|
|
13441
13237
|
const highestOffer = collectible?.offer;
|
|
13238
|
+
const lowestListing = collectible?.listing;
|
|
13442
13239
|
if (!collectibleMetadata) {
|
|
13443
13240
|
console.error("Collectible metadata is undefined");
|
|
13444
13241
|
return null;
|
|
@@ -13467,8 +13264,6 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
13467
13264
|
hideQuantitySelector,
|
|
13468
13265
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
13469
13266
|
chainId,
|
|
13470
|
-
collectionAddress,
|
|
13471
|
-
collectibleId,
|
|
13472
13267
|
name: collectibleMetadata.name || "",
|
|
13473
13268
|
type: collectionType,
|
|
13474
13269
|
onOfferClick: (e) => onOfferClick?.({
|
|
@@ -13476,6 +13271,7 @@ function MarketCard({ collectibleId, chainId, collectionAddress, collectionType,
|
|
|
13476
13271
|
e
|
|
13477
13272
|
}),
|
|
13478
13273
|
highestOffer,
|
|
13274
|
+
lowestListing,
|
|
13479
13275
|
balance,
|
|
13480
13276
|
decimals: collectibleMetadata.decimals,
|
|
13481
13277
|
quantityInitial: highestOffer?.quantityInitial !== void 0 ? highestOffer.quantityInitial : collectible?.listing?.quantityInitial !== void 0 ? collectible.listing.quantityInitial : void 0,
|
|
@@ -13560,8 +13356,6 @@ function ShopCard({ collectibleId, chainId, collectionAddress, collectionType, a
|
|
|
13560
13356
|
hideQuantitySelector,
|
|
13561
13357
|
children: [/* @__PURE__ */ jsx(Footer, {
|
|
13562
13358
|
chainId,
|
|
13563
|
-
collectionAddress,
|
|
13564
|
-
collectibleId,
|
|
13565
13359
|
name: tokenMetadata.name || "",
|
|
13566
13360
|
type: collectionType,
|
|
13567
13361
|
decimals: tokenMetadata.decimals,
|
|
@@ -13599,5 +13393,5 @@ function CollectibleCard(props) {
|
|
|
13599
13393
|
}
|
|
13600
13394
|
|
|
13601
13395
|
//#endregion
|
|
13602
|
-
export {
|
|
13603
|
-
//# sourceMappingURL=react
|
|
13396
|
+
export { useListItemsOrdersForCollectionPaginated as $, useCancelOrder as A, MarketplaceQueryClientProvider as At, useList1155ShopCardData as B, useOrderSteps as C, useCountOfCollectables as Ct, useGenerateOfferTransaction as D, useConnectorMetadata as Dt, generateOfferTransaction as E, useMarketplaceConfig as Et, useEnsureCorrectChain as F, useListBalances as G, useSearchTokenMetadata as H, useAutoSelectFeeOption as I, useErc721SaleDetails as J, useGetTokenRanges as K, useInventory as L, useProcessStep as M, DatabeatAnalytics as Mt, generateCancelTransaction as N, useAnalytics as Nt, generateListingTransaction as O, useConfig as Ot, useGenerateCancelTransaction as P, useListListingsForCollectible as Q, usePrimarySaleItem as R, useTransferTokens as S, useListCollectibleActivities as St, useGenerateSellTransaction as T, useBalanceOfCollectible as Tt, useTokenSupplies as U, useList721ShopCardData as V, useListTokenMetadata as W, useLowestListing as X, useCountOfPrimarySaleItems as Y, useListOffersForCollectible as Z, useCheckoutOptions$1 as _, useCollectionActiveOffersCurrencies as _t, useCreateListingModal as a, useCountListingsForCollectible as at, useFiltersProgressive as b, useListCollectiblesPaginated as bt, useTransferModal as c, useListMarketCardData as ct, ActionModal as d, useListCollections as dt, useListItemsOrdersForCollection as et, useRoyalty as f, useListCollectionActivities as ft, useCheckoutOptionsSalesContract as g, useCollectionBalanceDetails as gt, useComparePrices as h, useCollectionDetails as ht, Media as i, useCountOffersForCollectible as it, useCancelTransactionSteps as j, MarketplaceSdkContext as jt, useGenerateListingTransaction as k, MarketplaceProvider as kt, useSuccessfulPurchaseModal as l, useSellModal as lt, useConvertPriceToUSD as m, useCollectionDetailsPolling as mt, Footer as n, useGetCountOfFilteredOrders as nt, useMakeOfferModal as o, useCountItemsOrdersForCollection as ot, useGetReceiptFromHash as p, collectionDetailsPollingOptions as pt, useGetCountOfPrimarySaleItems as q, NonTradableInventoryFooter as r, useFloorOrder as rt, ModalProvider as s, useMarketCurrencies as st, CollectibleCard as t, useHighestOffer as tt, useBuyModal as u, useCurrency as ut, useOpenConnectModal$1 as v, useCollectionActiveListingsCurrencies as vt, generateSellTransaction as w, useCollectible as wt, useFilterState as x, useListCollectibles as xt, useFilters as y, useCollection as yt, useListPrimarySaleItems as z };
|
|
13397
|
+
//# sourceMappingURL=react.js.map
|