@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,17 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
type SelectPaymentSettings,
|
|
5
|
+
useSelectPaymentModal,
|
|
6
|
+
} from '@0xsequence/checkout';
|
|
3
7
|
import type { ContractInfo } from '@0xsequence/metadata';
|
|
4
8
|
import { useEffect } from 'react';
|
|
5
9
|
import { type Address, zeroAddress } from 'viem';
|
|
6
|
-
import
|
|
7
|
-
import { LoadingModal } from '../../_internal/components/actionModal/LoadingModal';
|
|
8
|
-
import { useERC1155Checkout } from '../hooks/useERC1155Checkout';
|
|
10
|
+
import { useERC1155SalePaymentParams } from '../hooks/useERC1155SalePaymentParams';
|
|
9
11
|
import {
|
|
10
12
|
buyModalStore,
|
|
11
|
-
type CheckoutOptionsSalesContractProps,
|
|
12
13
|
isShopProps,
|
|
13
14
|
useBuyModalProps,
|
|
14
|
-
|
|
15
|
+
usePaymentModalState,
|
|
15
16
|
useQuantity,
|
|
16
17
|
} from '../store';
|
|
17
18
|
import { ERC1155QuantityModal } from './ERC1155QuantityModal';
|
|
@@ -40,6 +41,21 @@ export const ERC1155ShopModal = ({
|
|
|
40
41
|
const unlimitedSupply =
|
|
41
42
|
isShop && modalProps.unlimitedSupply ? modalProps.unlimitedSupply : false;
|
|
42
43
|
|
|
44
|
+
const tokenId = shopData.items[0]?.tokenId;
|
|
45
|
+
const checkoutProvider = shopData.checkoutOptions?.nftCheckout?.[0]
|
|
46
|
+
? String(shopData.checkoutOptions.nftCheckout[0])
|
|
47
|
+
: undefined;
|
|
48
|
+
|
|
49
|
+
const { data: erc1155SalePaymentParams } = useERC1155SalePaymentParams({
|
|
50
|
+
salesContractAddress: shopData.salesContractAddress,
|
|
51
|
+
collectionAddress: collection.address,
|
|
52
|
+
tokenId,
|
|
53
|
+
price: shopData.salePrice?.amount,
|
|
54
|
+
currencyAddress: shopData.salePrice?.currencyAddress,
|
|
55
|
+
chainId,
|
|
56
|
+
checkoutProvider,
|
|
57
|
+
});
|
|
58
|
+
|
|
43
59
|
if (!quantity) {
|
|
44
60
|
return (
|
|
45
61
|
<ERC1155QuantityModal
|
|
@@ -57,68 +73,36 @@ export const ERC1155ShopModal = ({
|
|
|
57
73
|
);
|
|
58
74
|
}
|
|
59
75
|
|
|
60
|
-
return
|
|
61
|
-
<ERC1155SaleContractCheckoutModalOpener
|
|
62
|
-
chainId={chainId}
|
|
63
|
-
salesContractAddress={shopData.salesContractAddress as Address}
|
|
64
|
-
collectionAddress={collection.address as Address}
|
|
65
|
-
items={shopData.items.map((item) => ({
|
|
66
|
-
...item,
|
|
67
|
-
tokenId: item.tokenId ?? '0',
|
|
68
|
-
quantity: quantity.toString() ?? '1',
|
|
69
|
-
}))}
|
|
70
|
-
checkoutOptions={shopData.checkoutOptions}
|
|
71
|
-
enabled={!!shopData.salesContractAddress && !!shopData.items}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
76
|
+
return <PaymentModalOpener paymentModalParams={erc1155SalePaymentParams!} />;
|
|
74
77
|
};
|
|
75
78
|
|
|
76
|
-
interface
|
|
77
|
-
|
|
78
|
-
enabled: boolean;
|
|
79
|
-
checkoutOptions?: CheckoutOptions;
|
|
79
|
+
interface PaymentModalOpenerProps {
|
|
80
|
+
paymentModalParams: SelectPaymentSettings;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
checkoutOptions,
|
|
88
|
-
enabled,
|
|
89
|
-
customProviderCallback,
|
|
90
|
-
}: ERC1155SaleContractCheckoutModalOpenerProps) => {
|
|
91
|
-
const checkoutModalState = useCheckoutModalState();
|
|
92
|
-
|
|
93
|
-
const { openCheckoutModal, isLoading, isError, isEnabled } =
|
|
94
|
-
useERC1155Checkout({
|
|
95
|
-
chainId,
|
|
96
|
-
salesContractAddress,
|
|
97
|
-
collectionAddress,
|
|
98
|
-
items,
|
|
99
|
-
checkoutOptions,
|
|
100
|
-
customProviderCallback,
|
|
101
|
-
enabled,
|
|
102
|
-
});
|
|
83
|
+
const PaymentModalOpener = ({
|
|
84
|
+
paymentModalParams,
|
|
85
|
+
}: PaymentModalOpenerProps) => {
|
|
86
|
+
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
87
|
+
const paymentModalState = usePaymentModalState();
|
|
103
88
|
|
|
104
89
|
useEffect(() => {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
openCheckoutModal();
|
|
108
|
-
buyModalStore.send({ type: 'checkoutModalOpened' });
|
|
109
|
-
}
|
|
110
|
-
}, [checkoutModalState, isLoading, isError, isEnabled, openCheckoutModal]);
|
|
90
|
+
if (paymentModalState !== 'idle') return;
|
|
91
|
+
if (!paymentModalParams) return;
|
|
111
92
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
93
|
+
const totalPrice =
|
|
94
|
+
BigInt(paymentModalParams.price) *
|
|
95
|
+
BigInt(paymentModalParams.collectibles[0].quantity);
|
|
96
|
+
|
|
97
|
+
buyModalStore.send({ type: 'openPaymentModal' });
|
|
98
|
+
|
|
99
|
+
openSelectPaymentModal({
|
|
100
|
+
...paymentModalParams,
|
|
101
|
+
price: String(totalPrice),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
buyModalStore.send({ type: 'paymentModalOpened' });
|
|
105
|
+
}, [paymentModalState, paymentModalParams, openSelectPaymentModal]);
|
|
122
106
|
|
|
123
107
|
return null;
|
|
124
108
|
};
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { renderHook } from '@test';
|
|
2
|
+
import type { Address } from 'viem';
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { ERC1155_SALES_CONTRACT_ABI_V0 } from '../../../../../../utils/abi';
|
|
5
|
+
import {
|
|
6
|
+
getERC1155SalePaymentParams,
|
|
7
|
+
useERC1155SalePaymentParams,
|
|
8
|
+
} from '../useERC1155SalePaymentParams';
|
|
9
|
+
|
|
10
|
+
// Mock wagmi's useAccount hook
|
|
11
|
+
vi.mock('wagmi', async () => {
|
|
12
|
+
const actual = await vi.importActual('wagmi');
|
|
13
|
+
return {
|
|
14
|
+
...actual,
|
|
15
|
+
useAccount: vi.fn(() => ({
|
|
16
|
+
address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as Address,
|
|
17
|
+
})),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Mock store hooks
|
|
22
|
+
vi.mock('../../store', () => ({
|
|
23
|
+
useOnSuccess: vi.fn(() => vi.fn()),
|
|
24
|
+
useOnError: vi.fn(() => vi.fn()),
|
|
25
|
+
useQuantity: vi.fn(() => 1),
|
|
26
|
+
useBuyModalProps: vi.fn(() => ({
|
|
27
|
+
chainId: 1,
|
|
28
|
+
collectionAddress: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
|
|
29
|
+
marketplaceType: 'shop',
|
|
30
|
+
salesContractAddress: '0x1234567890123456789012345678901234567890',
|
|
31
|
+
items: [],
|
|
32
|
+
quantityDecimals: 0,
|
|
33
|
+
quantityRemaining: 100,
|
|
34
|
+
salePrice: {
|
|
35
|
+
amount: '1000000000000000000',
|
|
36
|
+
currencyAddress: '0x0000000000000000000000000000000000000000',
|
|
37
|
+
},
|
|
38
|
+
successActionButtons: undefined,
|
|
39
|
+
onRampProvider: undefined,
|
|
40
|
+
})),
|
|
41
|
+
useBuyAnalyticsId: vi.fn(() => undefined),
|
|
42
|
+
buyModalStore: {
|
|
43
|
+
send: vi.fn(),
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
// Mock useSalesContractABI hook
|
|
48
|
+
vi.mock('../../../../../hooks/contracts/useSalesContractABI', () => ({
|
|
49
|
+
useSalesContractABI: vi.fn(() => ({
|
|
50
|
+
abi: ERC1155_SALES_CONTRACT_ABI_V0,
|
|
51
|
+
isLoading: false,
|
|
52
|
+
version: 'v0',
|
|
53
|
+
})),
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
const mockSalesContractAddress = '0x1234567890123456789012345678901234567890';
|
|
57
|
+
const mockCollectionAddress = '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd';
|
|
58
|
+
const mockTokenId = '1';
|
|
59
|
+
const mockPrice = '1000000000000000000'; // 1 ETH in wei
|
|
60
|
+
const mockCurrencyAddress = '0x0000000000000000000000000000000000000000'; // ETH
|
|
61
|
+
|
|
62
|
+
// TODO: Write proper tests for getERC1155SalePaymentParams
|
|
63
|
+
describe.skip('getERC1155SalePaymentParams', () => {
|
|
64
|
+
it('should generate correct payment parameters', async () => {
|
|
65
|
+
const params = {
|
|
66
|
+
chainId: 1,
|
|
67
|
+
address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as Address,
|
|
68
|
+
salesContractAddress: mockSalesContractAddress,
|
|
69
|
+
collectionAddress: mockCollectionAddress,
|
|
70
|
+
tokenId: mockTokenId,
|
|
71
|
+
quantity: 1,
|
|
72
|
+
price: BigInt(mockPrice),
|
|
73
|
+
currencyAddress: mockCurrencyAddress,
|
|
74
|
+
callbacks: {
|
|
75
|
+
onSuccess: vi.fn(),
|
|
76
|
+
onError: vi.fn(),
|
|
77
|
+
},
|
|
78
|
+
customCreditCardProviderCallback: undefined,
|
|
79
|
+
skipNativeBalanceCheck: false,
|
|
80
|
+
nativeTokenAddress: undefined,
|
|
81
|
+
checkoutProvider: undefined,
|
|
82
|
+
successActionButtons: undefined,
|
|
83
|
+
onRampProvider: undefined,
|
|
84
|
+
saleAnalyticsId: undefined,
|
|
85
|
+
abi: ERC1155_SALES_CONTRACT_ABI_V0,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const result = await getERC1155SalePaymentParams(params);
|
|
89
|
+
|
|
90
|
+
expect(result).toMatchObject({
|
|
91
|
+
chain: 1,
|
|
92
|
+
collectibles: [
|
|
93
|
+
{
|
|
94
|
+
quantity: '1',
|
|
95
|
+
decimals: 0,
|
|
96
|
+
tokenId: mockTokenId,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
currencyAddress: mockCurrencyAddress,
|
|
100
|
+
price: mockPrice,
|
|
101
|
+
targetContractAddress: mockSalesContractAddress,
|
|
102
|
+
collectionAddress: mockCollectionAddress,
|
|
103
|
+
recipientAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
104
|
+
creditCardProviders: [],
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
expect(result.txData).toBeDefined();
|
|
108
|
+
expect(typeof result.txData).toBe('string');
|
|
109
|
+
expect(result.txData).toMatch(/^0x/);
|
|
110
|
+
expect(result.onSuccess).toBeInstanceOf(Function);
|
|
111
|
+
expect(result.onError).toBe(params.callbacks.onError);
|
|
112
|
+
expect(result.onClose).toBeInstanceOf(Function);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should handle custom checkout provider', async () => {
|
|
116
|
+
const params = {
|
|
117
|
+
chainId: 1,
|
|
118
|
+
address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as Address,
|
|
119
|
+
salesContractAddress: mockSalesContractAddress,
|
|
120
|
+
collectionAddress: mockCollectionAddress,
|
|
121
|
+
tokenId: mockTokenId,
|
|
122
|
+
quantity: 1,
|
|
123
|
+
price: BigInt(mockPrice),
|
|
124
|
+
currencyAddress: mockCurrencyAddress,
|
|
125
|
+
callbacks: undefined,
|
|
126
|
+
customCreditCardProviderCallback: undefined,
|
|
127
|
+
skipNativeBalanceCheck: false,
|
|
128
|
+
nativeTokenAddress: undefined,
|
|
129
|
+
checkoutProvider: 'stripe',
|
|
130
|
+
successActionButtons: undefined,
|
|
131
|
+
onRampProvider: undefined,
|
|
132
|
+
saleAnalyticsId: undefined,
|
|
133
|
+
abi: ERC1155_SALES_CONTRACT_ABI_V0,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const result = await getERC1155SalePaymentParams(params);
|
|
137
|
+
expect(result.creditCardProviders).toEqual(['stripe']);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should handle custom credit card provider callback', async () => {
|
|
141
|
+
const customCallback = vi.fn();
|
|
142
|
+
const params = {
|
|
143
|
+
chainId: 1,
|
|
144
|
+
address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as Address,
|
|
145
|
+
salesContractAddress: mockSalesContractAddress,
|
|
146
|
+
collectionAddress: mockCollectionAddress,
|
|
147
|
+
tokenId: mockTokenId,
|
|
148
|
+
quantity: 1,
|
|
149
|
+
price: BigInt(mockPrice),
|
|
150
|
+
currencyAddress: mockCurrencyAddress,
|
|
151
|
+
callbacks: undefined,
|
|
152
|
+
customCreditCardProviderCallback: customCallback,
|
|
153
|
+
skipNativeBalanceCheck: false,
|
|
154
|
+
nativeTokenAddress: undefined,
|
|
155
|
+
checkoutProvider: undefined,
|
|
156
|
+
successActionButtons: undefined,
|
|
157
|
+
onRampProvider: undefined,
|
|
158
|
+
saleAnalyticsId: undefined,
|
|
159
|
+
abi: ERC1155_SALES_CONTRACT_ABI_V0,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const result = await getERC1155SalePaymentParams(params);
|
|
163
|
+
expect(result.creditCardProviders).toEqual(['custom']);
|
|
164
|
+
expect(result.customProviderCallback).toBeInstanceOf(Function);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('should handle multiple quantities', async () => {
|
|
168
|
+
const params = {
|
|
169
|
+
chainId: 1,
|
|
170
|
+
address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as Address,
|
|
171
|
+
salesContractAddress: mockSalesContractAddress,
|
|
172
|
+
collectionAddress: mockCollectionAddress,
|
|
173
|
+
tokenId: mockTokenId,
|
|
174
|
+
quantity: 5,
|
|
175
|
+
price: BigInt(mockPrice),
|
|
176
|
+
currencyAddress: mockCurrencyAddress,
|
|
177
|
+
callbacks: undefined,
|
|
178
|
+
customCreditCardProviderCallback: undefined,
|
|
179
|
+
skipNativeBalanceCheck: false,
|
|
180
|
+
nativeTokenAddress: undefined,
|
|
181
|
+
checkoutProvider: undefined,
|
|
182
|
+
successActionButtons: undefined,
|
|
183
|
+
onRampProvider: undefined,
|
|
184
|
+
saleAnalyticsId: undefined,
|
|
185
|
+
abi: ERC1155_SALES_CONTRACT_ABI_V0,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const result = await getERC1155SalePaymentParams(params);
|
|
189
|
+
expect(result.collectibles[0].quantity).toBe('5');
|
|
190
|
+
expect(result.collectibles[0].tokenId).toBe(mockTokenId);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should calculate total price correctly for multiple quantities', async () => {
|
|
194
|
+
const params = {
|
|
195
|
+
chainId: 1,
|
|
196
|
+
address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as Address,
|
|
197
|
+
salesContractAddress: mockSalesContractAddress,
|
|
198
|
+
collectionAddress: mockCollectionAddress,
|
|
199
|
+
tokenId: mockTokenId,
|
|
200
|
+
quantity: 3,
|
|
201
|
+
price: BigInt(mockPrice),
|
|
202
|
+
currencyAddress: mockCurrencyAddress,
|
|
203
|
+
callbacks: undefined,
|
|
204
|
+
customCreditCardProviderCallback: undefined,
|
|
205
|
+
skipNativeBalanceCheck: false,
|
|
206
|
+
nativeTokenAddress: undefined,
|
|
207
|
+
checkoutProvider: undefined,
|
|
208
|
+
successActionButtons: undefined,
|
|
209
|
+
onRampProvider: undefined,
|
|
210
|
+
saleAnalyticsId: undefined,
|
|
211
|
+
abi: ERC1155_SALES_CONTRACT_ABI_V0,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const result = await getERC1155SalePaymentParams(params);
|
|
215
|
+
// The price in the result is per-item price, total is calculated in the component
|
|
216
|
+
expect(result.price).toBe(mockPrice);
|
|
217
|
+
expect(result.collectibles[0].quantity).toBe('3');
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
describe.skip('useERC1155SalePaymentParams', () => {
|
|
222
|
+
beforeEach(() => {
|
|
223
|
+
vi.clearAllMocks();
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
afterEach(() => {
|
|
227
|
+
vi.restoreAllMocks();
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('should return loading state initially', () => {
|
|
231
|
+
const { result } = renderHook(() =>
|
|
232
|
+
useERC1155SalePaymentParams({
|
|
233
|
+
salesContractAddress: mockSalesContractAddress,
|
|
234
|
+
collectionAddress: mockCollectionAddress,
|
|
235
|
+
tokenId: mockTokenId,
|
|
236
|
+
price: mockPrice,
|
|
237
|
+
currencyAddress: mockCurrencyAddress,
|
|
238
|
+
enabled: true,
|
|
239
|
+
chainId: 1,
|
|
240
|
+
}),
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
expect(result.current.isLoading).toBe(true);
|
|
244
|
+
expect(result.current.data).toBeUndefined();
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should handle skipToken when disabled', () => {
|
|
248
|
+
const { result } = renderHook(() =>
|
|
249
|
+
useERC1155SalePaymentParams({
|
|
250
|
+
salesContractAddress: mockSalesContractAddress,
|
|
251
|
+
collectionAddress: mockCollectionAddress,
|
|
252
|
+
tokenId: mockTokenId,
|
|
253
|
+
price: mockPrice,
|
|
254
|
+
currencyAddress: mockCurrencyAddress,
|
|
255
|
+
enabled: false,
|
|
256
|
+
chainId: 1,
|
|
257
|
+
}),
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
// Should not be loading when disabled
|
|
261
|
+
expect(result.current.isLoading).toBe(false);
|
|
262
|
+
expect(result.current.isFetching).toBe(false);
|
|
263
|
+
expect(result.current.data).toBeUndefined();
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('should not fetch when wallet is not connected', async () => {
|
|
267
|
+
const { useAccount } = vi.mocked(await import('wagmi'));
|
|
268
|
+
useAccount.mockReturnValue({
|
|
269
|
+
address: undefined,
|
|
270
|
+
isConnected: false,
|
|
271
|
+
isConnecting: false,
|
|
272
|
+
isDisconnected: true,
|
|
273
|
+
isReconnecting: false,
|
|
274
|
+
connector: null,
|
|
275
|
+
addresses: undefined,
|
|
276
|
+
chain: undefined,
|
|
277
|
+
chainId: undefined,
|
|
278
|
+
status: 'disconnected',
|
|
279
|
+
} as never);
|
|
280
|
+
|
|
281
|
+
const { result } = renderHook(() =>
|
|
282
|
+
useERC1155SalePaymentParams({
|
|
283
|
+
salesContractAddress: mockSalesContractAddress,
|
|
284
|
+
collectionAddress: mockCollectionAddress,
|
|
285
|
+
tokenId: mockTokenId,
|
|
286
|
+
price: mockPrice,
|
|
287
|
+
currencyAddress: mockCurrencyAddress,
|
|
288
|
+
enabled: true,
|
|
289
|
+
chainId: 1,
|
|
290
|
+
}),
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
expect(result.current.isLoading).toBe(false);
|
|
294
|
+
expect(result.current.isFetching).toBe(false);
|
|
295
|
+
expect(result.current.data).toBeUndefined();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('should not fetch when required parameters are missing', () => {
|
|
299
|
+
const { result } = renderHook(() =>
|
|
300
|
+
useERC1155SalePaymentParams({
|
|
301
|
+
salesContractAddress: undefined,
|
|
302
|
+
collectionAddress: mockCollectionAddress,
|
|
303
|
+
tokenId: mockTokenId,
|
|
304
|
+
price: mockPrice,
|
|
305
|
+
currencyAddress: mockCurrencyAddress,
|
|
306
|
+
enabled: true,
|
|
307
|
+
chainId: 1,
|
|
308
|
+
}),
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
expect(result.current.isLoading).toBe(false);
|
|
312
|
+
expect(result.current.isFetching).toBe(false);
|
|
313
|
+
expect(result.current.data).toBeUndefined();
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it('should not fetch when tokenId is missing', () => {
|
|
317
|
+
const { result } = renderHook(() =>
|
|
318
|
+
useERC1155SalePaymentParams({
|
|
319
|
+
salesContractAddress: mockSalesContractAddress,
|
|
320
|
+
collectionAddress: mockCollectionAddress,
|
|
321
|
+
tokenId: undefined,
|
|
322
|
+
price: mockPrice,
|
|
323
|
+
currencyAddress: mockCurrencyAddress,
|
|
324
|
+
enabled: true,
|
|
325
|
+
chainId: 1,
|
|
326
|
+
}),
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
expect(result.current.isLoading).toBe(false);
|
|
330
|
+
expect(result.current.isFetching).toBe(false);
|
|
331
|
+
expect(result.current.data).toBeUndefined();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('should not fetch when quantity is not set', async () => {
|
|
335
|
+
const { useQuantity } = vi.mocked(await import('../../store'));
|
|
336
|
+
useQuantity.mockReturnValue(undefined as never);
|
|
337
|
+
|
|
338
|
+
const { result } = renderHook(() =>
|
|
339
|
+
useERC1155SalePaymentParams({
|
|
340
|
+
salesContractAddress: mockSalesContractAddress,
|
|
341
|
+
collectionAddress: mockCollectionAddress,
|
|
342
|
+
tokenId: mockTokenId,
|
|
343
|
+
price: mockPrice,
|
|
344
|
+
currencyAddress: mockCurrencyAddress,
|
|
345
|
+
enabled: true,
|
|
346
|
+
chainId: 1,
|
|
347
|
+
}),
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
expect(result.current.isLoading).toBe(false);
|
|
351
|
+
expect(result.current.isFetching).toBe(false);
|
|
352
|
+
expect(result.current.data).toBeUndefined();
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('should not fetch when ABI is loading', async () => {
|
|
356
|
+
const { useSalesContractABI } = vi.mocked(
|
|
357
|
+
await import('../../../../../hooks/contracts/useSalesContractABI'),
|
|
358
|
+
);
|
|
359
|
+
useSalesContractABI.mockReturnValue({
|
|
360
|
+
abi: null,
|
|
361
|
+
isLoading: true,
|
|
362
|
+
version: null,
|
|
363
|
+
} as never);
|
|
364
|
+
|
|
365
|
+
const { result } = renderHook(() =>
|
|
366
|
+
useERC1155SalePaymentParams({
|
|
367
|
+
salesContractAddress: mockSalesContractAddress,
|
|
368
|
+
collectionAddress: mockCollectionAddress,
|
|
369
|
+
tokenId: mockTokenId,
|
|
370
|
+
price: mockPrice,
|
|
371
|
+
currencyAddress: mockCurrencyAddress,
|
|
372
|
+
enabled: true,
|
|
373
|
+
chainId: 1,
|
|
374
|
+
}),
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
expect(result.current.isLoading).toBe(false);
|
|
378
|
+
expect(result.current.isFetching).toBe(false);
|
|
379
|
+
expect(result.current.data).toBeUndefined();
|
|
380
|
+
});
|
|
381
|
+
});
|