@0xsequence/marketplace-sdk 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/preview.tsx +4 -7
- package/CHANGELOG.md +171 -0
- package/compile-tailwind.js +1 -1
- package/dist/BellIcon.js +6 -3
- package/dist/BellIcon.js.map +1 -1
- package/dist/Card.js +831 -0
- package/dist/Card.js.map +1 -0
- package/dist/ShopCard.d.ts +83 -0
- package/dist/_internal.js +57 -1
- package/dist/_internal.js.map +1 -1
- package/dist/abi.js +24 -1
- package/dist/abi.js.map +1 -1
- package/dist/alertMessage.js +29 -0
- package/dist/alertMessage.js.map +1 -0
- package/dist/api.js +95 -108
- package/dist/api.js.map +1 -1
- package/dist/builder-api.js +17 -4
- package/dist/builder-api.js.map +1 -1
- package/dist/calendar.js +51 -0
- package/dist/calendar.js.map +1 -0
- package/dist/checkout.js +52 -0
- package/dist/checkout.js.map +1 -0
- package/dist/collectible.js +620 -0
- package/dist/collectible.js.map +1 -0
- package/dist/collection.js +396 -0
- package/dist/collection.js.map +1 -0
- package/dist/{marketplaceConfig.js → config.js} +25 -31
- package/dist/config.js.map +1 -0
- package/dist/consts.d.ts +7 -0
- package/dist/consts.js +8 -0
- package/dist/consts.js.map +1 -0
- package/dist/contracts.js +22 -2
- package/dist/contracts.js.map +1 -1
- package/dist/create-config.d.ts +12037 -1801
- package/dist/create-config.js +9 -7
- package/dist/create-config.js.map +1 -1
- package/dist/currency.js +186 -0
- package/dist/currency.js.map +1 -0
- package/dist/currencyImage.js +28 -0
- package/dist/currencyImage.js.map +1 -0
- package/dist/dist.js +2771 -0
- package/dist/dist.js.map +1 -0
- package/dist/expirationDateSelect.js +245 -0
- package/dist/expirationDateSelect.js.map +1 -0
- package/dist/filter-state.d.ts +153 -0
- package/dist/filters.d.ts +14 -45
- package/dist/hooks.js +26 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks2.js +24 -0
- package/dist/hooks2.js.map +1 -0
- package/dist/index.d.ts +12 -8
- package/dist/index.js +6 -9
- package/dist/index10.d.ts +39 -261
- package/dist/index11.d.ts +461 -220
- package/dist/index12.d.ts +511 -85
- package/dist/index13.d.ts +17 -493
- package/dist/index14.d.ts +15 -66
- package/dist/index15.d.ts +25 -1
- package/dist/index16.d.ts +5 -47
- package/dist/index17.d.ts +840 -108
- package/dist/index18.d.ts +552 -1
- package/dist/index19.d.ts +317 -147
- package/dist/index2.d.ts +2172 -5
- package/dist/index21.d.ts +306 -93
- package/dist/index22.d.ts +230 -1
- package/dist/index23.d.ts +323 -797
- package/dist/index24.d.ts +22 -445
- package/dist/index25.d.ts +1 -357
- package/dist/index26.d.ts +20 -151
- package/dist/index27.d.ts +18 -794
- package/dist/index28.d.ts +109 -58
- package/dist/index29.d.ts +1 -24
- package/dist/index3.d.ts +2212 -51
- package/dist/index30.d.ts +1 -0
- package/dist/index31.d.ts +48 -0
- package/dist/index32.d.ts +1 -0
- package/dist/index33.d.ts +56 -0
- package/dist/index34.d.ts +99 -0
- package/dist/index35.d.ts +171 -0
- package/dist/index36.d.ts +131 -0
- package/dist/index37.d.ts +135 -0
- package/dist/index38.d.ts +85 -0
- package/dist/index39.d.ts +91 -0
- package/dist/index4.d.ts +2678 -61
- package/dist/index40.d.ts +46 -0
- package/dist/index5.d.ts +535 -2267
- package/dist/index6.d.ts +2025 -1287
- package/dist/index7.d.ts +1798 -116
- package/dist/index8.d.ts +115 -12
- package/dist/index9.d.ts +42 -56
- package/dist/inventory.d.ts +46 -0
- package/dist/inventory.js +56 -33
- package/dist/inventory.js.map +1 -1
- package/dist/marketplace-logos.js +1 -1
- package/dist/marketplace-logos.js.map +1 -1
- package/dist/marketplace2.js +70 -0
- package/dist/marketplace2.js.map +1 -0
- package/dist/metadata.d.ts +733 -0
- package/dist/network.js +1 -1
- package/dist/networkconfigToWagmiChain.js.map +1 -1
- package/dist/primary-sale-checkout-options.d.ts +29 -0
- package/dist/quantityInput.js +93 -0
- package/dist/quantityInput.js.map +1 -0
- package/dist/ranges.d.ts +125 -0
- package/dist/react/_internal/api/index.d.ts +5 -2
- package/dist/react/_internal/api/index.js +4 -7
- package/dist/react/_internal/databeat/index.d.ts +4 -1
- package/dist/react/_internal/databeat/index.js +4 -37
- package/dist/react/_internal/index.d.ts +5 -2
- package/dist/react/_internal/index.js +5 -10
- package/dist/react/_internal/wagmi/index.d.ts +4 -1
- package/dist/react/_internal/wagmi/index.js +1 -4
- package/dist/react/hooks/_deprecated/index.d.ts +47 -0
- package/dist/react/hooks/_deprecated/index.js +4 -0
- package/dist/react/hooks/checkout/index.d.ts +7 -0
- package/dist/react/hooks/checkout/index.js +7 -0
- package/dist/react/hooks/collectible/index.d.ts +7 -0
- package/dist/react/hooks/collectible/index.js +7 -0
- package/dist/react/hooks/collection/index.d.ts +11 -0
- package/dist/react/hooks/collection/index.js +7 -0
- package/dist/react/hooks/config/index.d.ts +5 -4
- package/dist/react/hooks/config/index.js +4 -37
- package/dist/react/hooks/contracts/index.d.ts +4 -7
- package/dist/react/hooks/contracts/index.js +3 -16
- package/dist/react/hooks/currency/index.d.ts +47 -0
- package/dist/react/hooks/currency/index.js +7 -0
- package/dist/react/hooks/index.d.ts +41 -31
- package/dist/react/hooks/index.js +14 -38
- package/dist/react/hooks/inventory/index.d.ts +7 -0
- package/dist/react/hooks/inventory/index.js +4 -0
- package/dist/react/hooks/token/index.d.ts +7 -0
- package/dist/react/hooks/token/index.js +7 -0
- package/dist/react/hooks/transactions/index.d.ts +5 -2
- package/dist/react/hooks/transactions/index.js +5 -38
- package/dist/react/hooks/ui/card-data/index.d.ts +8 -0
- package/dist/react/hooks/ui/card-data/index.js +4 -0
- package/dist/react/hooks/ui/index.d.ts +9 -3
- package/dist/react/hooks/ui/index.js +8 -38
- package/dist/react/hooks/ui/url-state/index.d.ts +7 -0
- package/dist/react/hooks/ui/url-state/index.js +4 -0
- package/dist/react/hooks/utils/index.d.ts +3 -34
- package/dist/react/hooks/utils/index.js +5 -38
- package/dist/react/index.d.ts +45 -35
- package/dist/react/index.js +19 -37
- package/dist/react/providers/index.d.ts +6 -0
- package/dist/react/providers/index.js +6 -0
- package/dist/react/queries/checkout/index.d.ts +7 -0
- package/dist/react/queries/checkout/index.js +4 -0
- package/dist/react/queries/collectible/index.d.ts +7 -0
- package/dist/react/queries/collectible/index.js +5 -0
- package/dist/react/queries/collection/index.d.ts +11 -0
- package/dist/react/queries/collection/index.js +4 -0
- package/dist/react/queries/currency/index.d.ts +6 -0
- package/dist/react/queries/currency/index.js +4 -0
- package/dist/react/queries/index.d.ts +20 -21
- package/dist/react/queries/index.js +11 -30
- package/dist/react/queries/inventory/index.d.ts +6 -2
- package/dist/react/queries/inventory/index.js +3 -21
- package/dist/react/queries/marketplace/index.d.ts +7 -0
- package/dist/react/queries/marketplace/index.js +5 -0
- package/dist/react/queries/token/index.d.ts +7 -0
- package/dist/react/queries/token/index.js +4 -0
- package/dist/react/ssr/index.d.ts +12 -24
- package/dist/react/ssr/index.js +13 -33
- package/dist/react/ui/components/marketplace-collectible-card/ActionButton/index.d.ts +6 -0
- package/dist/react/ui/components/marketplace-collectible-card/ActionButton/index.js +6 -0
- package/dist/react/ui/components/marketplace-collectible-card/Card/index.d.ts +10 -0
- package/dist/react/ui/components/marketplace-collectible-card/Card/index.js +6 -0
- package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +44 -4
- package/dist/react/ui/components/marketplace-collectible-card/index.js +6 -38
- package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +5 -2
- package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +3 -12
- package/dist/react/ui/components/marketplace-logos/index.d.ts +23 -22
- package/dist/react/ui/hooks/index.d.ts +47 -0
- package/dist/react/ui/hooks/index.js +15 -0
- package/dist/react/ui/icons/index.d.ts +3 -1
- package/dist/react/ui/icons/index.js +3 -14
- package/dist/react/ui/index.d.ts +47 -5
- package/dist/react/ui/index.js +6 -38
- package/dist/react/ui/modals/BuyModal/index.d.ts +47 -0
- package/dist/react/ui/modals/BuyModal/index.js +4 -0
- package/dist/react/ui/modals/CreateListingModal/index.d.ts +4 -0
- package/dist/react/ui/modals/CreateListingModal/index.js +6 -0
- package/dist/react/ui/modals/CreateListingModal/internal/hooks/index.d.ts +190 -0
- package/dist/react/ui/modals/CreateListingModal/internal/hooks/index.js +4 -0
- package/dist/react/ui/modals/MakeOfferModal/index.d.ts +4 -0
- package/dist/react/ui/modals/MakeOfferModal/index.js +4 -0
- package/dist/react/ui/modals/MakeOfferModal/internal/hooks/index.d.ts +188 -0
- package/dist/react/ui/modals/MakeOfferModal/internal/hooks/index.js +3 -0
- package/dist/react/ui/modals/SellModal/index.d.ts +6 -0
- package/dist/react/ui/modals/SellModal/index.js +6 -0
- package/dist/react/ui/modals/TransferModal/index.d.ts +47 -0
- package/dist/react/ui/modals/TransferModal/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/alertMessage/index.d.ts +14 -0
- package/dist/react/ui/modals/_internal/components/alertMessage/index.js +3 -0
- package/dist/react/ui/modals/_internal/components/baseModal/index.d.ts +144 -0
- package/dist/react/ui/modals/_internal/components/baseModal/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/calendar/index.d.ts +73 -0
- package/dist/react/ui/modals/_internal/components/calendar/index.js +5 -0
- package/dist/react/ui/modals/_internal/components/calendarDropdown/index.d.ts +21 -0
- package/dist/react/ui/modals/_internal/components/calendarDropdown/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/currencyImage/index.d.ts +15 -0
- package/dist/react/ui/modals/_internal/components/currencyImage/index.js +5 -0
- package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.d.ts +30 -0
- package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/expirationDateSelect/index.d.ts +2 -0
- package/dist/react/ui/modals/_internal/components/expirationDateSelect/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/floorPriceText/index.d.ts +24 -0
- package/dist/react/ui/modals/_internal/components/floorPriceText/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/priceInput/index.d.ts +45 -0
- package/dist/react/ui/modals/_internal/components/priceInput/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/quantityInput/index.d.ts +24 -0
- package/dist/react/ui/modals/_internal/components/quantityInput/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.d.ts +18 -0
- package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.d.ts +14 -0
- package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/timeAgo/index.d.ts +12 -0
- package/dist/react/ui/modals/_internal/components/timeAgo/index.js +5 -0
- package/dist/react/ui/modals/_internal/components/tokenPreview/index.d.ts +19 -0
- package/dist/react/ui/modals/_internal/components/tokenPreview/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/transaction-footer/index.d.ts +26 -0
- package/dist/react/ui/modals/_internal/components/transaction-footer/index.js +4 -0
- package/dist/react/ui/modals/_internal/components/transactionDetails/index.d.ts +28 -0
- package/dist/react/ui/modals/_internal/components/transactionDetails/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/transactionHeader/index.d.ts +16 -0
- package/dist/react/ui/modals/_internal/components/transactionHeader/index.js +3 -0
- package/dist/react/ui/modals/_internal/components/transactionPreview/index.d.ts +36 -0
- package/dist/react/ui/modals/_internal/components/transactionPreview/index.js +6 -0
- package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.d.ts +27 -0
- package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.js +6 -0
- package/dist/react/utils/index.d.ts +6 -19
- package/dist/react/utils/index.js +3 -8
- package/dist/react.js +12634 -9807
- package/dist/react.js.map +1 -1
- package/dist/src.js +0 -8
- package/dist/ssr.js +26 -0
- package/dist/ssr.js.map +1 -0
- package/dist/steps.d.ts +85 -0
- package/dist/styles/index.css +2040 -375
- package/dist/switchChainErrorModal.js +97 -0
- package/dist/switchChainErrorModal.js.map +1 -0
- package/dist/timeAgo.js +29 -0
- package/dist/timeAgo.js.map +1 -0
- package/dist/token-balances.d.ts +359 -0
- package/dist/token-balances.js +62 -0
- package/dist/token-balances.js.map +1 -0
- package/dist/token2.js +247 -0
- package/dist/token2.js.map +1 -0
- package/dist/transaction-footer.js +45 -0
- package/dist/transaction-footer.js.map +1 -0
- package/dist/transaction.js +1 -7
- package/dist/transaction.js.map +1 -1
- package/dist/transactionHeader.js +32 -0
- package/dist/transactionHeader.js.map +1 -0
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.js +3 -4
- package/dist/types.d.ts +26 -16
- package/dist/types.js +29 -1
- package/dist/types.js.map +1 -1
- package/dist/url-state.js +170 -0
- package/dist/url-state.js.map +1 -0
- package/dist/utils/abi/index.d.ts +6 -5
- package/dist/utils/abi/index.js +2 -2
- package/dist/utils/abi/marketplace/index.d.ts +1 -1
- package/dist/utils/abi/primary-sale/index.d.ts +1 -1
- package/dist/utils/abi/token/index.d.ts +1 -1
- package/dist/utils/index.d.ts +9 -7
- package/dist/utils/index.js +4 -8
- package/dist/utils.js +8 -8
- package/dist/utils.js.map +1 -1
- package/dist/utils2.js +64 -106
- package/dist/utils2.js.map +1 -1
- package/dist/waas-types.d.ts +19 -0
- package/dist/xstate-store.cjs.d.ts +18 -0
- package/eslint/sequence-types.js +1069 -0
- package/eslint.config.mjs +337 -9
- package/image.d.ts +5 -0
- package/package.json +49 -47
- package/postcss.config.mjs +1 -1
- package/preserve-directives.ts +235 -0
- package/public/mockServiceWorker.js +0 -1
- package/src/react/_internal/api/builder-api.ts +26 -4
- package/src/react/_internal/api/index.ts +1 -2
- package/src/react/_internal/api/marketplace-api.ts +57 -25
- package/src/react/_internal/api/services.ts +56 -4
- package/src/react/_internal/api-mocks.ts +8 -0
- package/src/react/_internal/databeat/index.ts +4 -0
- package/src/react/_internal/databeat/types.ts +24 -28
- package/src/react/_internal/index.ts +70 -0
- package/src/react/_internal/query-builder.ts +203 -0
- package/src/react/_internal/types.ts +88 -18
- package/src/react/_internal/utils.ts +34 -52
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +11 -5
- package/src/react/_internal/wagmi/create-config.ts +2 -2
- package/src/react/_internal/wagmi/get-connectors.ts +10 -6
- package/src/react/hooks/_deprecated/index.ts +61 -0
- package/src/react/hooks/checkout/index.ts +1 -0
- package/src/react/hooks/{utils/useCheckoutOptionsSalesContract.test.tsx → checkout/primary-sale-checkout-options.test.tsx} +23 -23
- package/src/react/hooks/{utils/useCheckoutOptionsSalesContract.tsx → checkout/primary-sale-checkout-options.tsx} +35 -32
- package/src/react/hooks/{data/collectibles/useBalanceOfCollectible.test.tsx → collectible/balance.test.tsx} +37 -29
- package/src/react/hooks/{data/collectibles/useBalanceOfCollectible.tsx → collectible/balance.tsx} +11 -11
- package/src/react/hooks/{data/primary-sales/useErc721SalesData.tsx → collectible/erc721-sale-details.tsx} +6 -6
- package/src/react/hooks/collectible/index.ts +16 -0
- package/src/react/hooks/{data/collectibles/useCountOfCollectables.test.tsx → collectible/market-count.test.tsx} +21 -16
- package/src/react/hooks/{data/collectibles/useCountOfCollectables.tsx → collectible/market-count.tsx} +13 -8
- package/src/react/hooks/{data/orders/useHighestOffer.test.tsx → collectible/market-highest-offer.test.tsx} +35 -24
- package/src/react/hooks/{data/orders/useHighestOffer.tsx → collectible/market-highest-offer.tsx} +12 -10
- package/src/react/hooks/{data/collectibles/useListCollectiblesPaginated.test.tsx → collectible/market-list-paginated.test.tsx} +18 -18
- package/src/react/hooks/{data/collectibles/useListCollectiblesPaginated.tsx → collectible/market-list-paginated.tsx} +12 -10
- package/src/react/hooks/{data/collectibles/useListCollectibles.test.tsx → collectible/market-list.test.tsx} +51 -39
- package/src/react/hooks/{data/collectibles/useListCollectibles.tsx → collectible/market-list.tsx} +11 -10
- package/src/react/hooks/{data/orders/useCountListingsForCollectible.test.tsx → collectible/market-listings-count.test.tsx} +13 -10
- package/src/react/hooks/{data/orders/useCountListingsForCollectible.tsx → collectible/market-listings-count.tsx} +11 -11
- package/src/react/hooks/{data/orders/useListListingsForCollectible.test.tsx → collectible/market-listings.test.tsx} +19 -19
- package/src/react/hooks/{data/orders/useListListingsForCollectible.tsx → collectible/market-listings.tsx} +17 -19
- package/src/react/hooks/{data/orders/useLowestListing.test.tsx → collectible/market-lowest-listing.test.tsx} +35 -24
- package/src/react/hooks/{data/orders/useLowestListing.tsx → collectible/market-lowest-listing.tsx} +12 -10
- package/src/react/hooks/{data/orders/useCountOffersForCollectible.test.tsx → collectible/market-offers-count.test.tsx} +13 -10
- package/src/react/hooks/{data/orders/useCountOffersForCollectible.tsx → collectible/market-offers-count.tsx} +11 -11
- package/src/react/hooks/{data/orders/useListOffersForCollectible.test.tsx → collectible/market-offers.test.tsx} +17 -17
- package/src/react/hooks/{data/orders/useListOffersForCollectible.tsx → collectible/market-offers.tsx} +16 -17
- package/src/react/hooks/{data/collectibles/useCollectible.test.tsx → collectible/metadata.test.tsx} +25 -23
- package/src/react/hooks/{data/collectibles/useCollectible.tsx → collectible/metadata.tsx} +17 -14
- package/src/react/hooks/collectible/primary-sale-item.test.tsx +503 -0
- package/src/react/hooks/{data/primary-sales/usePrimarySaleItem.tsx → collectible/primary-sale-item.tsx} +6 -8
- package/src/react/hooks/collectible/primary-sale-items-count.test.tsx +154 -0
- package/src/react/hooks/collectible/primary-sale-items-count.tsx +22 -0
- package/src/react/hooks/collectible/primary-sale-items.test.tsx +259 -0
- package/src/react/hooks/{data/primary-sales/useListPrimarySaleItems.tsx → collectible/primary-sale-items.tsx} +9 -9
- package/src/react/hooks/{data/collectibles/useTokenBalances.test.tsx → collectible/token-balances.test.tsx} +52 -28
- package/src/react/hooks/{data/collectibles/useTokenBalances.tsx → collectible/token-balances.tsx} +10 -10
- package/src/react/hooks/{data/collections/__snapshots__/useListCollections.test.tsx.snap → collection/__snapshots__/list.test.tsx.snap} +20 -20
- package/src/react/hooks/{data/collections/useCollectionBalanceDetails.test.tsx → collection/balance-details.test.tsx} +13 -8
- package/src/react/hooks/{data/collections/useCollectionBalanceDetails.tsx → collection/balance-details.tsx} +3 -3
- package/src/react/hooks/collection/index.ts +11 -0
- package/src/react/hooks/{data/collections/useListCollections.test.tsx → collection/list.test.tsx} +15 -14
- package/src/react/hooks/{data/collections/useListCollections.tsx → collection/list.tsx} +7 -7
- package/src/react/hooks/collection/market-detail-polling.test.tsx +146 -0
- package/src/react/hooks/{data/collections/useCollectionDetailsPolling.tsx → collection/market-detail-polling.tsx} +13 -12
- package/src/react/hooks/collection/market-filtered-count.test.tsx +121 -0
- package/src/react/hooks/{data/orders/useGetCountOfFilteredOrders.tsx → collection/market-filtered-count.tsx} +6 -6
- package/src/react/hooks/{data/orders/useFloorOrder.test.tsx → collection/market-floor.test.tsx} +19 -15
- package/src/react/hooks/{data/orders/useFloorOrder.tsx → collection/market-floor.tsx} +13 -9
- package/src/react/hooks/collection/market-items-count.test.tsx +121 -0
- package/src/react/hooks/{data/orders/useCountItemsOrdersForCollection.tsx → collection/market-items-count.tsx} +9 -9
- package/src/react/hooks/collection/market-items-paginated.test.tsx +142 -0
- package/src/react/hooks/{data/orders/useListItemsOrdersForCollectionPaginated.tsx → collection/market-items-paginated.tsx} +11 -9
- package/src/react/hooks/collection/market-items.test.tsx +184 -0
- package/src/react/hooks/{data/orders/useListItemsOrdersForCollection.tsx → collection/market-items.tsx} +16 -14
- package/src/react/hooks/{data/collections/useCollection.test.tsx → collection/metadata.test.tsx} +18 -13
- package/src/react/hooks/{data/collections/useCollection.tsx → collection/metadata.tsx} +16 -7
- package/src/react/hooks/collection/useCollectionActiveListingsCurrencies.test.tsx +150 -0
- package/src/react/hooks/{data/collections → collection}/useCollectionActiveListingsCurrencies.tsx +3 -3
- package/src/react/hooks/collection/useCollectionActiveOffersCurrencies.test.tsx +150 -0
- package/src/react/hooks/{data/collections → collection}/useCollectionActiveOffersCurrencies.tsx +3 -3
- package/src/react/hooks/config/__snapshots__/useMarketplaceConfig.test.tsx.snap +12 -11
- package/src/react/hooks/config/useConnectorMetadata.tsx +1 -1
- package/src/react/hooks/config/useMarketplaceConfig.test.tsx +3 -1
- package/src/react/hooks/config/useMarketplaceConfig.tsx +1 -1
- package/src/react/hooks/contracts/index.ts +1 -0
- package/src/react/hooks/contracts/useERC721Owner.test.tsx +82 -0
- package/src/react/hooks/contracts/useERC721Owner.tsx +47 -0
- package/src/react/hooks/contracts/useSalesContractABI.ts +2 -2
- package/src/react/hooks/{utils/useComparePrices.test.tsx → currency/compare-prices.test.tsx} +17 -11
- package/src/react/hooks/{utils/useComparePrices.tsx → currency/compare-prices.tsx} +8 -6
- package/src/react/hooks/{utils/useConvertPriceToUSD.test.tsx → currency/convert-to-usd.test.tsx} +17 -16
- package/src/react/hooks/{utils/useConvertPriceToUSD.tsx → currency/convert-to-usd.tsx} +6 -6
- package/src/react/hooks/{data/market/useCurrency.test.tsx → currency/currency.test.tsx} +18 -14
- package/src/react/hooks/{data/market/useCurrency.tsx → currency/currency.tsx} +3 -3
- package/src/react/hooks/currency/index.ts +4 -0
- package/src/react/hooks/{data/market/useMarketCurrencies.test.tsx → currency/list.test.tsx} +49 -74
- package/src/react/hooks/{data/market/useMarketCurrencies.tsx → currency/list.tsx} +7 -7
- package/src/react/hooks/data/orders/useOrders.test.tsx +143 -0
- package/src/react/hooks/data/orders/useOrders.tsx +73 -0
- package/src/react/hooks/data/tokens/useCurrencyBalance.tsx +1 -1
- package/src/react/hooks/index.ts +9 -12
- package/src/react/hooks/inventory/index.ts +1 -0
- package/src/react/hooks/{data/inventory/useInventory.test.tsx → inventory/inventory.test.tsx} +12 -14
- package/src/react/hooks/inventory/inventory.tsx +17 -0
- package/src/react/hooks/{data/tokens/useListBalances.test.tsx → token/balances.test.tsx} +22 -11
- package/src/react/hooks/token/balances.tsx +59 -0
- package/src/react/hooks/{data/tokens/useCurrencyBalance.test.tsx → token/currency-balance.test.tsx} +6 -6
- package/src/react/hooks/token/currency-balance.tsx +151 -0
- package/src/react/hooks/token/index.ts +5 -0
- package/src/react/hooks/{data/tokens/useSearchTokenMetadata.test.tsx → token/metadata-search.test.tsx} +38 -30
- package/src/react/hooks/{data/tokens/useSearchTokenMetadata.tsx → token/metadata-search.tsx} +27 -24
- package/src/react/hooks/{data/tokens/useListTokenMetadata.test.tsx → token/metadata.test.tsx} +27 -24
- package/src/react/hooks/{data/tokens/useListTokenMetadata.tsx → token/metadata.tsx} +7 -7
- package/src/react/hooks/{data/tokens/useGetTokenRanges.test.tsx → token/ranges.test.tsx} +15 -14
- package/src/react/hooks/{data/tokens/useGetTokenRanges.tsx → token/ranges.tsx} +12 -13
- package/src/react/hooks/transactions/index.ts +5 -0
- package/src/react/hooks/transactions/useBuyTransaction.tsx +95 -0
- package/src/react/hooks/transactions/useCancelOrder.test.tsx +15 -35
- package/src/react/hooks/transactions/useCancelOrder.tsx +3 -9
- package/src/react/hooks/transactions/useCancelTransactionSteps.tsx +3 -9
- package/src/react/hooks/transactions/useGenerateCancelTransaction.test.tsx +23 -12
- package/src/react/hooks/transactions/useGenerateCancelTransaction.tsx +16 -11
- package/src/react/hooks/transactions/useGenerateListingTransaction.test.tsx +17 -57
- package/src/react/hooks/transactions/useGenerateListingTransaction.tsx +17 -12
- package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +14 -15
- package/src/react/hooks/transactions/useGenerateOfferTransaction.tsx +11 -11
- package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +28 -38
- package/src/react/hooks/transactions/useGenerateSellTransaction.tsx +16 -15
- package/src/react/hooks/transactions/useMarketTransactionSteps.test.tsx +105 -0
- package/src/react/hooks/transactions/useMarketTransactionSteps.tsx +89 -0
- package/src/react/hooks/transactions/useOrderSteps.tsx +23 -36
- package/src/react/hooks/transactions/usePrimarySaleTransactionSteps.ts +196 -0
- package/src/react/hooks/transactions/useProcessStep.test.tsx +63 -59
- package/src/react/hooks/transactions/useProcessStep.ts +52 -54
- package/src/react/hooks/transactions/useTransactionExecution.test.tsx +99 -0
- package/src/react/hooks/transactions/useTransactionExecution.ts +31 -0
- package/src/react/hooks/transactions/useTransactionType.ts +20 -0
- package/src/react/hooks/transactions/useTransferTokens.test.tsx +16 -16
- package/src/react/hooks/transactions/useTransferTokens.tsx +17 -5
- package/src/react/hooks/ui/card-data/index.ts +4 -0
- package/src/react/hooks/ui/card-data/market-card-data-paged.test.tsx +375 -0
- package/src/react/hooks/ui/card-data/market-card-data-paged.tsx +265 -0
- package/src/react/hooks/{data/market/useListMarketCardData.test.tsx → ui/card-data/market-card-data.test.tsx} +30 -28
- package/src/react/hooks/{data/market/useListMarketCardData.tsx → ui/card-data/market-card-data.tsx} +44 -31
- package/src/react/hooks/{data/primary-sales/useList1155ShopCardData.tsx → ui/card-data/primary-sale-1155-card-data.tsx} +24 -31
- package/src/react/hooks/{data/primary-sales/useList721ShopCardData.tsx → ui/card-data/primary-sale-721-card-data.tsx} +70 -37
- package/src/react/hooks/ui/index.ts +3 -1
- package/src/react/hooks/ui/url-state/filter-state.test.tsx +569 -0
- package/src/react/hooks/ui/{useFilterState.tsx → url-state/filter-state.tsx} +34 -20
- package/src/react/hooks/ui/url-state/index.ts +1 -0
- package/src/react/hooks/ui/useCollectibleCardOfferState.test.tsx +75 -0
- package/src/react/hooks/ui/useCollectibleCardOfferState.ts +47 -0
- package/src/react/hooks/ui/useFilters.test.tsx +4 -1
- package/src/react/hooks/ui/useFilters.tsx +2 -2
- package/src/react/hooks/util/optimisticCancelUpdates.test.ts +489 -0
- package/src/react/hooks/util/optimisticCancelUpdates.ts +21 -22
- package/src/react/hooks/utils/index.ts +0 -4
- package/src/react/hooks/utils/useAutoSelectFeeOption.test.tsx +8 -5
- package/src/react/hooks/utils/useAutoSelectFeeOption.tsx +33 -17
- package/src/react/hooks/utils/useRoyalty.test.tsx +1 -1
- package/src/react/hooks/utils/useRoyalty.tsx +99 -34
- package/src/react/hooks/utils/useWaasFeeOptions.tsx +234 -0
- package/src/react/hooks/utils/waasFeeOptionsStore.ts +141 -0
- package/src/react/index.ts +3 -0
- package/src/react/providers/index.tsx +3 -3
- package/src/react/providers/modal-provider.tsx +6 -17
- package/src/react/providers/provider.test.tsx +1 -1
- package/src/react/providers/shadow-root.tsx +1 -1
- package/src/react/providers/theme-provider.tsx +1 -1
- package/src/react/queries/checkout/index.ts +1 -0
- package/src/react/queries/checkout/primary-sale-checkout-options.ts +118 -0
- package/src/react/queries/collectible/balance.ts +113 -0
- package/src/react/queries/collectible/index.ts +15 -0
- package/src/react/queries/collectible/market-count.ts +91 -0
- package/src/react/queries/collectible/market-highest-offer.ts +74 -0
- package/src/react/queries/collectible/market-list-paginated.ts +110 -0
- package/src/react/queries/collectible/market-list.ts +116 -0
- package/src/react/queries/collectible/market-listings-count.ts +70 -0
- package/src/react/queries/collectible/market-listings.ts +71 -0
- package/src/react/queries/collectible/market-lowest-listing.ts +74 -0
- package/src/react/queries/collectible/market-offers-count.ts +70 -0
- package/src/react/queries/collectible/market-offers.ts +90 -0
- package/src/react/queries/collectible/metadata.ts +84 -0
- package/src/react/queries/collectible/primary-sale-item.ts +79 -0
- package/src/react/queries/collectible/primary-sale-items-count.ts +67 -0
- package/src/react/queries/collectible/primary-sale-items.ts +96 -0
- package/src/react/queries/collectible/queryKeys.ts +12 -0
- package/src/react/queries/collectible/token-balances.ts +83 -0
- package/src/react/queries/collection/activeListingsCurrencies.ts +74 -0
- package/src/react/queries/collection/activeOffersCurrencies.ts +74 -0
- package/src/react/queries/collection/balance-details.ts +103 -0
- package/src/react/queries/collection/index.ts +9 -0
- package/src/react/queries/collection/list.ts +195 -0
- package/src/react/queries/collection/market-detail.ts +60 -0
- package/src/react/queries/collection/market-filtered-count.ts +67 -0
- package/src/react/queries/collection/market-floor.ts +58 -0
- package/src/react/queries/collection/market-items-count.ts +69 -0
- package/src/react/queries/collection/market-items-paginated.ts +84 -0
- package/src/react/queries/collection/market-items.ts +72 -0
- package/src/react/queries/collection/metadata.ts +60 -0
- package/src/react/queries/collection/queryKeys.ts +12 -0
- package/src/react/queries/currency/compare-prices.ts +122 -0
- package/src/react/queries/currency/convert-to-usd.ts +99 -0
- package/src/react/queries/currency/currency.ts +82 -0
- package/src/react/queries/currency/index.ts +4 -0
- package/src/react/queries/currency/list.ts +100 -0
- package/src/react/queries/index.ts +6 -7
- package/src/react/queries/inventory/inventory.ts +139 -91
- package/src/react/queries/marketplace/config.ts +85 -0
- package/src/react/queries/{market → marketplace}/filters.ts +48 -61
- package/src/react/queries/marketplace/index.ts +2 -0
- package/src/react/queries/marketplace/queryKeys.ts +12 -0
- package/src/react/queries/orders.ts +48 -0
- package/src/react/queries/token/balances.ts +107 -0
- package/src/react/queries/token/index.ts +5 -0
- package/src/react/queries/token/metadata-search.ts +95 -0
- package/src/react/queries/token/metadata.ts +80 -0
- package/src/react/queries/token/queryKeys.ts +12 -0
- package/src/react/queries/token/ranges.ts +74 -0
- package/src/react/queries/token/supplies.ts +86 -0
- package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +11 -10
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ssr/index.ts +5 -0
- package/src/react/types/query.ts +8 -7
- package/src/react/ui/components/_internals/ErrorDisplay.tsx +87 -0
- package/src/react/ui/components/_internals/ErrorLogBox.tsx +8 -1
- package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +13 -14
- package/src/react/ui/components/_internals/pill/__tests__/Pill.test.tsx +9 -5
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/ActionButton.stories.tsx +24 -29
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/ActionButton.tsx +20 -14
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/ActionButtonBody.test.tsx +7 -5
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/NonOwnerActions.test.tsx +11 -6
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/OwnerActions.test.tsx +8 -6
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/useActionButtonLogic.test.tsx +6 -4
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/components/ActionButtonBody.tsx +14 -9
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/components/NonOwnerActions.tsx +26 -35
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/components/OwnerActions.tsx +21 -13
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/hooks/useActionButtonLogic.ts +3 -3
- package/src/react/ui/components/marketplace-collectible-card/ActionButton/index.ts +1 -0
- package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/store.ts +4 -4
- package/src/react/ui/components/marketplace-collectible-card/Card/card-badge.tsx +37 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-content.tsx +27 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-footer.tsx +38 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-media.tsx +69 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-price.tsx +44 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-sale-details.tsx +37 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-skeleton.tsx +39 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card-title.tsx +109 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/card.tsx +51 -0
- package/src/react/ui/components/marketplace-collectible-card/Card/index.ts +30 -0
- package/src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx +1 -1
- package/src/react/ui/components/marketplace-collectible-card/_internals/PriceDisplay.tsx +87 -0
- package/src/react/ui/components/marketplace-collectible-card/constants.ts +20 -0
- package/src/react/ui/components/marketplace-collectible-card/index.ts +6 -0
- package/src/react/ui/components/marketplace-collectible-card/types.ts +31 -16
- package/src/react/ui/components/marketplace-collectible-card/utils/determineCardAction.ts +63 -0
- package/src/react/ui/components/marketplace-collectible-card/utils/formatPrice.ts +71 -2
- package/src/react/ui/components/marketplace-collectible-card/utils/index.ts +3 -0
- package/src/react/ui/components/marketplace-collectible-card/utils/renderSkeleton.tsx +44 -0
- package/src/react/ui/components/marketplace-collectible-card/utils/shopCardState.ts +83 -0
- package/src/react/ui/components/marketplace-collectible-card/utils/supplyStatus.ts +5 -5
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +63 -78
- package/src/react/ui/components/marketplace-collectible-card/variants/MarketCardPresentation.tsx +170 -0
- package/src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx +56 -38
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +55 -65
- package/src/react/ui/components/marketplace-collectible-card/variants/ShopCardPresentation.tsx +144 -0
- package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +1 -5
- package/src/react/ui/components/media/Media.tsx +1 -1
- package/src/react/ui/components/media/MediaSkeleton.tsx +1 -1
- package/src/react/ui/hooks/index.ts +2 -0
- package/src/react/ui/icons/BellIcon.tsx +7 -3
- package/src/react/ui/icons/iconVariants.ts +11 -0
- package/src/react/ui/icons/index.ts +0 -3
- package/src/react/ui/index.ts +37 -8
- package/src/react/ui/modals/BuyModal/components/BuyModalContent.tsx +161 -0
- package/src/react/ui/modals/BuyModal/components/CollectibleMetadataSummary.tsx +141 -0
- package/src/react/ui/modals/BuyModal/components/CryptoPaymentModal.tsx +177 -0
- package/src/react/ui/modals/BuyModal/components/CryptoPaymentModalSkeleton.tsx +48 -0
- package/src/react/ui/modals/BuyModal/components/Modal.tsx +2 -2
- package/src/react/ui/modals/BuyModal/components/TrailsCss.ts +216 -0
- package/src/react/ui/modals/BuyModal/components/{ERC1155QuantityModal.tsx → sequence-checkout/ERC1155QuantityModal.tsx} +71 -82
- package/src/react/ui/modals/BuyModal/components/sequence-checkout/SequenceCheckoutNew.tsx +161 -0
- package/src/react/ui/modals/BuyModal/{hooks → components/sequence-checkout}/usePaymentModalParams.ts +73 -112
- package/src/react/ui/modals/BuyModal/components/types.ts +6 -5
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155SalePaymentParams.test.tsx +2 -14
- package/src/react/ui/modals/BuyModal/hooks/useBuyModalData.ts +151 -0
- package/src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts +15 -28
- package/src/react/ui/modals/BuyModal/hooks/useExecuteBundledTransactions.ts +167 -0
- package/src/react/ui/modals/BuyModal/hooks/useHasSufficientBalance.ts +30 -0
- package/src/react/ui/modals/BuyModal/hooks/useMarketPlatformFee.ts +2 -2
- package/src/react/ui/modals/BuyModal/index.tsx +6 -3
- package/src/react/ui/modals/BuyModal/internal/__tests__/determineCheckoutMode.test.ts +119 -0
- package/src/react/ui/modals/BuyModal/internal/buyModalContext.ts +146 -0
- package/src/react/ui/modals/BuyModal/internal/cryptoPaymentModalContext.tsx +399 -0
- package/src/react/ui/modals/BuyModal/internal/determineCheckoutMode.ts +49 -0
- package/src/react/ui/modals/BuyModal/store.ts +25 -94
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +141 -308
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +35 -61
- package/src/react/ui/modals/CreateListingModal/index.tsx +16 -9
- package/src/react/ui/modals/CreateListingModal/internal/context.ts +416 -0
- package/src/react/ui/modals/CreateListingModal/internal/helpers/validation.ts +79 -0
- package/src/react/ui/modals/CreateListingModal/internal/hooks/index.ts +1 -0
- package/src/react/ui/modals/CreateListingModal/internal/hooks/use-collectible-approval.ts +49 -0
- package/src/react/ui/modals/CreateListingModal/internal/listing-mutations.ts +267 -0
- package/src/react/ui/modals/CreateListingModal/internal/store.ts +150 -0
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +130 -348
- package/src/react/ui/modals/MakeOfferModal/__stories__/MakeOfferModal.mock-data.ts +494 -0
- package/src/react/ui/modals/MakeOfferModal/__stories__/MakeOfferModal.stories.tsx +699 -0
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +28 -155
- package/src/react/ui/modals/MakeOfferModal/index.tsx +17 -11
- package/src/react/ui/modals/MakeOfferModal/internal/context.ts +453 -0
- package/src/react/ui/modals/MakeOfferModal/internal/helpers/validation.ts +99 -0
- package/src/react/ui/modals/MakeOfferModal/internal/hooks/index.ts +1 -0
- package/src/react/ui/modals/MakeOfferModal/internal/hooks/use-erc20-allowance.ts +43 -0
- package/src/react/ui/modals/MakeOfferModal/internal/offer-mutations.ts +231 -0
- package/src/react/ui/modals/MakeOfferModal/internal/store.ts +150 -0
- package/src/react/ui/modals/SellModal/Modal.tsx +74 -213
- package/src/react/ui/modals/SellModal/index.tsx +5 -11
- package/src/react/ui/modals/SellModal/internal/context.ts +284 -0
- package/src/react/ui/modals/SellModal/internal/sell-mutations.ts +163 -0
- package/src/react/ui/modals/SellModal/internal/store.ts +76 -0
- package/src/react/ui/modals/SellModal/internal/use-generate-sell-transaction.ts +93 -0
- package/src/react/ui/modals/TransferModal/__tests__/store.test.ts +51 -345
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +36 -34
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +19 -28
- package/src/react/ui/modals/TransferModal/index.tsx +98 -119
- package/src/react/ui/modals/TransferModal/internal/context.ts +404 -0
- package/src/react/ui/modals/TransferModal/internal/store.ts +118 -0
- package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +2 -3
- package/src/react/ui/modals/_internal/components/baseModal/ActionModal.tsx +338 -0
- package/src/react/ui/modals/_internal/components/baseModal/BaseModal.tsx +51 -0
- package/src/react/ui/modals/_internal/components/baseModal/ErrorBoundary.tsx +83 -0
- package/src/react/ui/modals/_internal/components/baseModal/ErrorModal.tsx +51 -0
- package/src/react/ui/modals/_internal/components/baseModal/LoadingModal.tsx +35 -0
- package/src/react/ui/modals/_internal/components/baseModal/SmartErrorHandler.tsx +31 -0
- package/src/react/ui/modals/_internal/components/baseModal/__tests__/ErrorBoundary.test.tsx +390 -0
- package/src/react/ui/modals/_internal/components/baseModal/errors/ModalInitializationError.tsx +91 -0
- package/src/react/ui/modals/_internal/components/baseModal/errors/errorActionType.ts +5 -0
- package/src/react/ui/modals/_internal/components/baseModal/index.ts +13 -0
- package/src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx +1 -1
- package/src/react/ui/modals/_internal/components/calendarDropdown/index.tsx +14 -9
- package/src/react/ui/modals/_internal/components/consts.ts +19 -5
- package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +5 -7
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +6 -14
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +17 -24
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +61 -40
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +23 -19
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/PriceInput.test.tsx +3 -3
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +66 -66
- package/src/react/ui/modals/_internal/components/quantityInput/__tests__/index.test.tsx +22 -137
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +84 -131
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +14 -31
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/ActionButtons.tsx +37 -25
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +13 -6
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts +9 -26
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +27 -29
- package/src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts +2 -2
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +10 -9
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +11 -7
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +8 -7
- package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +3 -5
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +3 -3
- package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +4 -15
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +14 -15
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +8 -11
- package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +65 -10
- package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +484 -0
- package/src/react/ui/modals/_internal/helpers/currency.ts +56 -0
- package/src/react/ui/modals/_internal/helpers/dnum-utils.ts +40 -0
- package/src/react/ui/modals/_internal/helpers/flow-state.ts +269 -0
- package/src/react/ui/modals/_internal/helpers/step-guards.ts +131 -0
- package/src/react/ui/modals/_internal/types/steps.ts +145 -0
- package/src/react/ui/modals/_internal/types.ts +2 -9
- package/src/react/utils/index.ts +2 -0
- package/src/react/utils/normalize-attributes.test.ts +94 -0
- package/src/react/utils/normalize-attributes.ts +89 -0
- package/src/react/utils/normalize-properties.test.ts +77 -0
- package/src/react/utils/normalize-properties.ts +60 -0
- package/src/react/utils/normalizePriceFilters.ts +25 -0
- package/src/react/utils/waitForTransactionReceipt.ts +2 -2
- package/src/styles/index.css +2 -0
- package/src/styles/styles.ts +2036 -374
- package/src/types/api-types.ts +6 -14
- package/src/types/buyModalErrors.ts +24 -30
- package/src/types/index.ts +4 -2
- package/src/types/sdk-config.ts +14 -1
- package/src/types/transactions.ts +10 -0
- package/src/types/types.ts +93 -14
- package/src/utils/__tests__/getMarketplaceDetails.test.ts +1 -1
- package/src/utils/_internal/error/base.ts +1 -1
- package/src/utils/_internal/error/transaction.ts +4 -5
- package/src/utils/abi/helpers.ts +38 -0
- package/src/utils/abi/index.ts +1 -0
- package/src/utils/decode/erc20.ts +2 -2
- package/src/utils/errors.ts +527 -0
- package/src/utils/getConduitAddressForOrderbook.ts +38 -0
- package/src/utils/getErrorMessage.ts +37 -0
- package/src/utils/getMarketplaceDetails.ts +1 -1
- package/src/utils/getSequenceMarketRequestId.ts +3 -7
- package/src/utils/getWagmiErrorMessage.ts +241 -0
- package/src/utils/getWebRPCErrorMessage.ts +63 -0
- package/src/utils/networkconfigToWagmiChain.ts +2 -1
- package/src/utils/price.ts +12 -10
- package/test/const.ts +3 -3
- package/test/globalSetup.ts +4 -5
- package/test/handlers.ts +2 -2
- package/test/server-setup.ts +8 -8
- package/test/setup.ts +11 -0
- package/test/test-utils.tsx +23 -6
- package/tsconfig.json +8 -1
- package/tsdown.config.ts +12 -3
- package/dist/CartIcon.js +0 -102
- package/dist/CartIcon.js.map +0 -1
- package/dist/CollectibleCard.d.ts +0 -8
- package/dist/builder.gen.js +0 -300
- package/dist/builder.gen.js.map +0 -1
- package/dist/collectibles.js +0 -319
- package/dist/collectibles.js.map +0 -1
- package/dist/collections.js +0 -320
- package/dist/collections.js.map +0 -1
- package/dist/components.js +0 -117
- package/dist/components.js.map +0 -1
- package/dist/listCollectiblesPaginated.d.ts +0 -322
- package/dist/listCollections.d.ts +0 -821
- package/dist/lowestListing.d.ts +0 -465
- package/dist/market.js +0 -207
- package/dist/market.js.map +0 -1
- package/dist/marketCurrencies.d.ts +0 -163
- package/dist/marketCurrencies.js +0 -56
- package/dist/marketCurrencies.js.map +0 -1
- package/dist/marketplace.gen.js +0 -1144
- package/dist/marketplace.gen.js.map +0 -1
- package/dist/marketplaceConfig.js.map +0 -1
- package/dist/orders.js +0 -462
- package/dist/orders.js.map +0 -1
- package/dist/primary-sales.js +0 -152
- package/dist/primary-sales.js.map +0 -1
- package/dist/query.d.ts +0 -31
- package/dist/react/hooks/data/collectibles/index.d.ts +0 -5
- package/dist/react/hooks/data/collectibles/index.js +0 -39
- package/dist/react/hooks/data/collections/index.d.ts +0 -11
- package/dist/react/hooks/data/collections/index.js +0 -39
- package/dist/react/hooks/data/index.d.ts +0 -37
- package/dist/react/hooks/data/index.js +0 -39
- package/dist/react/hooks/data/inventory/index.d.ts +0 -37
- package/dist/react/hooks/data/inventory/index.js +0 -39
- package/dist/react/hooks/data/market/index.d.ts +0 -6
- package/dist/react/hooks/data/market/index.js +0 -39
- package/dist/react/hooks/data/orders/index.d.ts +0 -5
- package/dist/react/hooks/data/orders/index.js +0 -39
- package/dist/react/hooks/data/primary-sales/index.d.ts +0 -37
- package/dist/react/hooks/data/primary-sales/index.js +0 -39
- package/dist/react/hooks/data/tokens/index.d.ts +0 -5
- package/dist/react/hooks/data/tokens/index.js +0 -39
- package/dist/react/queries/collectibles/index.d.ts +0 -5
- package/dist/react/queries/collectibles/index.js +0 -22
- package/dist/react/queries/collections/index.d.ts +0 -11
- package/dist/react/queries/collections/index.js +0 -20
- package/dist/react/queries/market/index.d.ts +0 -6
- package/dist/react/queries/market/index.js +0 -22
- package/dist/react/queries/orders/index.d.ts +0 -5
- package/dist/react/queries/orders/index.js +0 -13
- package/dist/react/queries/primary-sales/index.d.ts +0 -4
- package/dist/react/queries/primary-sales/index.js +0 -13
- package/dist/react/queries/tokens/index.d.ts +0 -5
- package/dist/react/queries/tokens/index.js +0 -13
- package/dist/react/queries/utils/index.d.ts +0 -4
- package/dist/react/queries/utils/index.js +0 -22
- package/dist/react/ssr/index.js.map +0 -1
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +0 -3
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +0 -22
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +0 -51
- package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +0 -39
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +0 -40
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +0 -39
- package/dist/src.js.map +0 -1
- package/dist/tokenBalances.js +0 -56
- package/dist/tokenBalances.js.map +0 -1
- package/dist/tokenSupplies.d.ts +0 -261
- package/dist/tokens.js +0 -219
- package/dist/tokens.js.map +0 -1
- package/dist/utils3.js +0 -43
- package/dist/utils3.js.map +0 -1
- package/dist/waitForTransactionReceipt.js +0 -25
- package/dist/waitForTransactionReceipt.js.map +0 -1
- package/src/react/_internal/api/__mocks__/builder.msw.ts +0 -239
- package/src/react/_internal/api/__mocks__/indexer.msw.ts +0 -216
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +0 -402
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +0 -195
- package/src/react/_internal/api/builder.gen.ts +0 -773
- package/src/react/_internal/api/marketplace.gen.ts +0 -2718
- package/src/react/_internal/api/query-keys.ts +0 -124
- package/src/react/hooks/data/collectibles/index.ts +0 -6
- package/src/react/hooks/data/collectibles/useListCollectibleActivities.test.tsx +0 -192
- package/src/react/hooks/data/collectibles/useListCollectibleActivities.tsx +0 -98
- package/src/react/hooks/data/collections/index.ts +0 -8
- package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +0 -112
- package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +0 -110
- package/src/react/hooks/data/collections/useCollectionDetails.test.tsx +0 -83
- package/src/react/hooks/data/collections/useCollectionDetails.ts +0 -69
- package/src/react/hooks/data/collections/useCollectionDetailsPolling.test.tsx +0 -137
- package/src/react/hooks/data/collections/useListCollectionActivities.test.tsx +0 -227
- package/src/react/hooks/data/collections/useListCollectionActivities.tsx +0 -93
- package/src/react/hooks/data/index.ts +0 -6
- package/src/react/hooks/data/inventory/index.ts +0 -1
- package/src/react/hooks/data/inventory/useInventory.tsx +0 -12
- package/src/react/hooks/data/market/index.ts +0 -3
- package/src/react/hooks/data/orders/index.ts +0 -11
- package/src/react/hooks/data/primary-sales/index.ts +0 -7
- package/src/react/hooks/data/primary-sales/useCountOfPrimarySaleItems.tsx +0 -13
- package/src/react/hooks/data/primary-sales/useGetCountOfPrimarySaleItems.tsx +0 -48
- package/src/react/hooks/data/tokens/index.ts +0 -5
- package/src/react/hooks/data/tokens/useListBalances.tsx +0 -29
- package/src/react/hooks/data/tokens/useTokenSupplies.ts +0 -69
- package/src/react/hooks/utils/useCheckoutOptions.test.tsx +0 -162
- package/src/react/hooks/utils/useCheckoutOptions.tsx +0 -98
- package/src/react/queries/collectibles/balanceOfCollectible.ts +0 -90
- package/src/react/queries/collectibles/collectible.ts +0 -81
- package/src/react/queries/collectibles/countOfCollectables.ts +0 -109
- package/src/react/queries/collectibles/index.ts +0 -7
- package/src/react/queries/collectibles/listCollectibleActivities.ts +0 -121
- package/src/react/queries/collectibles/listCollectibles.ts +0 -115
- package/src/react/queries/collectibles/listCollectiblesPaginated.ts +0 -104
- package/src/react/queries/collectibles/tokenBalances.ts +0 -89
- package/src/react/queries/collections/activeListingsCurrencies.ts +0 -84
- package/src/react/queries/collections/activeOffersCurrencies.ts +0 -84
- package/src/react/queries/collections/collection.ts +0 -69
- package/src/react/queries/collections/collectionBalanceDetails.ts +0 -107
- package/src/react/queries/collections/collectionDetails.ts +0 -79
- package/src/react/queries/collections/index.ts +0 -7
- package/src/react/queries/collections/listCollectionActivities.ts +0 -117
- package/src/react/queries/collections/listCollections.ts +0 -175
- package/src/react/queries/market/checkoutOptions.ts +0 -107
- package/src/react/queries/market/checkoutOptionsSalesContract.ts +0 -108
- package/src/react/queries/market/currency.ts +0 -92
- package/src/react/queries/market/index.ts +0 -6
- package/src/react/queries/market/marketCurrencies.ts +0 -120
- package/src/react/queries/market/marketplaceConfig.ts +0 -117
- package/src/react/queries/orders/countItemsOrdersForCollection.ts +0 -86
- package/src/react/queries/orders/countListingsForCollectible.ts +0 -90
- package/src/react/queries/orders/countOffersForCollectible.ts +0 -90
- package/src/react/queries/orders/floorOrder.ts +0 -74
- package/src/react/queries/orders/getCountOfFilteredOrders.ts +0 -88
- package/src/react/queries/orders/highestOffer.ts +0 -78
- package/src/react/queries/orders/index.ts +0 -11
- package/src/react/queries/orders/listItemsOrdersForCollection.ts +0 -90
- package/src/react/queries/orders/listItemsOrdersForCollectionPaginated.ts +0 -90
- package/src/react/queries/orders/listListingsForCollectible.ts +0 -97
- package/src/react/queries/orders/listOffersForCollectible.ts +0 -116
- package/src/react/queries/orders/lowestListing.ts +0 -81
- package/src/react/queries/primary-sales/countOfPrimarySaleItems.ts +0 -62
- package/src/react/queries/primary-sales/index.ts +0 -4
- package/src/react/queries/primary-sales/primarySaleItem.ts +0 -80
- package/src/react/queries/primary-sales/primarySaleItems.ts +0 -94
- package/src/react/queries/primary-sales/primarySaleItemsCount.ts +0 -79
- package/src/react/queries/tokens/getTokenRanges.ts +0 -75
- package/src/react/queries/tokens/index.ts +0 -5
- package/src/react/queries/tokens/listBalances.ts +0 -71
- package/src/react/queries/tokens/listTokenMetadata.ts +0 -81
- package/src/react/queries/tokens/searchTokenMetadata.ts +0 -101
- package/src/react/queries/tokens/tokenSupplies.ts +0 -84
- package/src/react/queries/utils/comparePrices.ts +0 -132
- package/src/react/queries/utils/convertPriceToUSD.ts +0 -105
- package/src/react/queries/utils/index.ts +0 -2
- package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +0 -79
- package/src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx +0 -68
- package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +0 -165
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/FooterName.tsx +0 -103
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/PriceDisplay.tsx +0 -80
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/SaleDetailsPill.tsx +0 -29
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/TokenTypeBalancePill.tsx +0 -30
- package/src/react/ui/components/marketplace-collectible-card/components/footer/components/index.ts +0 -4
- package/src/react/ui/components/marketplace-collectible-card/components/footer/index.ts +0 -2
- package/src/react/ui/icons/CalendarIcon.tsx +0 -37
- package/src/react/ui/icons/CartIcon.tsx +0 -52
- package/src/react/ui/icons/InfoIcon.tsx +0 -44
- package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +0 -557
- package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +0 -409
- package/src/react/ui/modals/BuyModal/__tests__/ERC721ShopModal.test.tsx +0 -272
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx.bak +0 -112
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +0 -251
- package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +0 -105
- package/src/react/ui/modals/BuyModal/components/BuyModalRouter.tsx +0 -157
- package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +0 -198
- package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +0 -108
- package/src/react/ui/modals/BuyModal/components/ERC721BuyModal.tsx +0 -116
- package/src/react/ui/modals/BuyModal/components/ERC721ShopModal.tsx +0 -86
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +0 -115
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC721SalePaymentParams.test.tsx +0 -283
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useMarketPlatformFee.test.tsx +0 -145
- package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +0 -86
- package/src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts +0 -216
- package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +0 -120
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +0 -98
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +0 -87
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +0 -246
- package/src/react/ui/modals/CreateListingModal/store.ts +0 -99
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +0 -90
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +0 -71
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +0 -241
- package/src/react/ui/modals/MakeOfferModal/store.ts +0 -94
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +0 -85
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +0 -79
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +0 -77
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +0 -242
- package/src/react/ui/modals/SellModal/store.ts +0 -62
- package/src/react/ui/modals/SellModal/utils.ts +0 -38
- package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +0 -157
- package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +0 -154
- package/src/react/ui/modals/SuccessfulPurchaseModal/store.ts +0 -71
- package/src/react/ui/modals/TransferModal/__tests__/__snapshots__/store.test.ts.snap +0 -17
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/__tests__/useHandleTransfer.test.tsx +0 -412
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TransferButton.tsx +0 -66
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +0 -137
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +0 -97
- package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +0 -31
- package/src/react/ui/modals/TransferModal/messages.ts +0 -14
- package/src/react/ui/modals/TransferModal/store.ts +0 -122
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +0 -281
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +0 -113
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +0 -35
- package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +0 -32
- package/src/react/ui/modals/_internal/components/actionModal/index.ts +0 -1
- package/src/types/custom.d.ts +0 -1
- package/src/types/messages.ts +0 -43
- package/src/types/new-marketplace-types.ts +0 -95
- /package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/types.ts +0 -0
- /package/src/react/ui/modals/_internal/hooks/{useSelectWaasFeeOptions.ts → useSelectWaasFeeOptions.tsx} +0 -0
package/dist/token2.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { h as serializeBigInts, i as getMetadataClient, n as getIndexerClient } from "./api.js";
|
|
2
|
+
import { n as buildInfiniteQueryOptions, r as buildQueryOptions } from "./_internal.js";
|
|
3
|
+
import { isAddress } from "viem";
|
|
4
|
+
import { infiniteQueryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
//#region src/react/queries/token/queryKeys.ts
|
|
7
|
+
/**
|
|
8
|
+
* Creates a type-safe query key for token domain with automatic bigint serialization
|
|
9
|
+
*
|
|
10
|
+
* @param operation - The specific operation (e.g., 'balances', 'metadata', 'ranges')
|
|
11
|
+
* @param params - The query parameters (will be automatically serialized)
|
|
12
|
+
* @returns A serialized query key safe for React Query
|
|
13
|
+
*/
|
|
14
|
+
function createTokenQueryKey(operation, params) {
|
|
15
|
+
return [
|
|
16
|
+
"token",
|
|
17
|
+
operation,
|
|
18
|
+
serializeBigInts(params)
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/react/queries/token/balances.ts
|
|
24
|
+
async function fetchBalances(params, page) {
|
|
25
|
+
const { chainId, accountAddress, contractAddress, tokenId, includeMetadata, metadataOptions, config } = params;
|
|
26
|
+
return getIndexerClient(chainId, config).getTokenBalances({
|
|
27
|
+
accountAddress,
|
|
28
|
+
contractAddress,
|
|
29
|
+
tokenId,
|
|
30
|
+
includeMetadata,
|
|
31
|
+
metadataOptions,
|
|
32
|
+
page: {
|
|
33
|
+
page: page.page,
|
|
34
|
+
pageSize: page.pageSize,
|
|
35
|
+
more: page.more ?? false
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function getListBalancesQueryKey(params) {
|
|
40
|
+
return createTokenQueryKey("balances", {
|
|
41
|
+
chainId: params.chainId,
|
|
42
|
+
accountAddress: params.accountAddress,
|
|
43
|
+
contractAddress: params.contractAddress,
|
|
44
|
+
tokenId: params.tokenId,
|
|
45
|
+
includeMetadata: params.includeMetadata,
|
|
46
|
+
metadataOptions: params.metadataOptions,
|
|
47
|
+
includeCollectionTokens: params.includeCollectionTokens
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates a tanstack infinite query options object for the balances query
|
|
52
|
+
*
|
|
53
|
+
* @param params - The query parameters including config
|
|
54
|
+
* @returns Query options configuration
|
|
55
|
+
*/
|
|
56
|
+
function listBalancesOptions(params) {
|
|
57
|
+
return buildInfiniteQueryOptions({
|
|
58
|
+
getQueryKey: getListBalancesQueryKey,
|
|
59
|
+
requiredParams: [
|
|
60
|
+
"chainId",
|
|
61
|
+
"accountAddress",
|
|
62
|
+
"config"
|
|
63
|
+
],
|
|
64
|
+
fetcher: fetchBalances,
|
|
65
|
+
getPageInfo: (response) => {
|
|
66
|
+
if (!response.page) return void 0;
|
|
67
|
+
return {
|
|
68
|
+
page: response.page.page ?? 1,
|
|
69
|
+
pageSize: response.page.pageSize ?? 30,
|
|
70
|
+
more: response.page.more ?? false
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
customValidation: (p) => !!p.chainId && p.chainId > 0 && !!p.accountAddress
|
|
74
|
+
}, params);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/react/queries/token/metadata.ts
|
|
79
|
+
/**
|
|
80
|
+
* Fetches token metadata from the metadata API
|
|
81
|
+
*/
|
|
82
|
+
async function fetchListTokenMetadata(params) {
|
|
83
|
+
const { config, contractAddress, chainId, tokenIds } = params;
|
|
84
|
+
const metadataClient = getMetadataClient(config);
|
|
85
|
+
const apiArgs = {
|
|
86
|
+
chainId,
|
|
87
|
+
tokenIds,
|
|
88
|
+
contractAddress
|
|
89
|
+
};
|
|
90
|
+
return (await metadataClient.getTokenMetadata(apiArgs)).tokenMetadata;
|
|
91
|
+
}
|
|
92
|
+
function getListTokenMetadataQueryKey(params) {
|
|
93
|
+
return createTokenQueryKey("metadata", {
|
|
94
|
+
chainId: params.chainId,
|
|
95
|
+
contractAddress: params.contractAddress,
|
|
96
|
+
tokenIds: params.tokenIds
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function listTokenMetadataQueryOptions(params) {
|
|
100
|
+
return buildQueryOptions({
|
|
101
|
+
getQueryKey: getListTokenMetadataQueryKey,
|
|
102
|
+
requiredParams: [
|
|
103
|
+
"chainId",
|
|
104
|
+
"contractAddress",
|
|
105
|
+
"tokenIds",
|
|
106
|
+
"config"
|
|
107
|
+
],
|
|
108
|
+
fetcher: fetchListTokenMetadata,
|
|
109
|
+
customValidation: (p) => !!p.chainId && p.chainId > 0 && !!p.tokenIds && p.tokenIds.length > 0 && !!p.contractAddress
|
|
110
|
+
}, params);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/react/queries/token/metadata-search.ts
|
|
115
|
+
/**
|
|
116
|
+
* Fetches token metadata from the metadata API using search filters
|
|
117
|
+
*/
|
|
118
|
+
async function fetchSearchTokenMetadata(params) {
|
|
119
|
+
const { chainId, collectionAddress, filter, page, config } = params;
|
|
120
|
+
const response = await getMetadataClient(config).searchTokenMetadata({
|
|
121
|
+
chainId,
|
|
122
|
+
collectionAddress,
|
|
123
|
+
filter: filter ?? {},
|
|
124
|
+
page
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
tokenMetadata: response.tokenMetadata,
|
|
128
|
+
page: response.page
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function getSearchTokenMetadataQueryKey(params) {
|
|
132
|
+
return createTokenQueryKey("metadata-search", {
|
|
133
|
+
chainId: params.chainId ?? 0,
|
|
134
|
+
collectionAddress: params.collectionAddress ?? "",
|
|
135
|
+
filter: params.filter
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function searchTokenMetadataQueryOptions(params) {
|
|
139
|
+
const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
|
|
140
|
+
const initialPageParam = {
|
|
141
|
+
page: 1,
|
|
142
|
+
pageSize: 30
|
|
143
|
+
};
|
|
144
|
+
const queryFn = ({ pageParam = initialPageParam }) => {
|
|
145
|
+
const requiredParams = params;
|
|
146
|
+
return fetchSearchTokenMetadata({
|
|
147
|
+
chainId: requiredParams.chainId,
|
|
148
|
+
collectionAddress: requiredParams.collectionAddress,
|
|
149
|
+
filter: params.filter,
|
|
150
|
+
config: requiredParams.config,
|
|
151
|
+
page: pageParam
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
return infiniteQueryOptions({
|
|
155
|
+
queryKey: getSearchTokenMetadataQueryKey(params),
|
|
156
|
+
queryFn,
|
|
157
|
+
initialPageParam,
|
|
158
|
+
getNextPageParam: (lastPage) => {
|
|
159
|
+
if (!lastPage.page?.more) return void 0;
|
|
160
|
+
return {
|
|
161
|
+
page: (lastPage.page.page || 1) + 1,
|
|
162
|
+
pageSize: lastPage.page.pageSize || 20
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
...params.query,
|
|
166
|
+
enabled
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/react/queries/token/supplies.ts
|
|
172
|
+
/**
|
|
173
|
+
* Fetches token supplies with support for indexer API
|
|
174
|
+
*/
|
|
175
|
+
async function fetchTokenSupplies(params) {
|
|
176
|
+
const { chainId, config, ...apiParams } = params;
|
|
177
|
+
return await getIndexerClient(chainId, config).getTokenSupplies(apiParams);
|
|
178
|
+
}
|
|
179
|
+
function getTokenSuppliesQueryKey(params) {
|
|
180
|
+
return createTokenQueryKey("supplies", {
|
|
181
|
+
chainId: params.chainId ?? 0,
|
|
182
|
+
collectionAddress: params.collectionAddress ?? "",
|
|
183
|
+
includeMetadata: params.includeMetadata,
|
|
184
|
+
metadataOptions: params.metadataOptions
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function tokenSuppliesQueryOptions(params) {
|
|
188
|
+
const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
|
|
189
|
+
const initialPageParam = {
|
|
190
|
+
page: 1,
|
|
191
|
+
pageSize: 30,
|
|
192
|
+
more: false
|
|
193
|
+
};
|
|
194
|
+
const queryFn = async ({ pageParam = initialPageParam }) => {
|
|
195
|
+
const requiredParams = params;
|
|
196
|
+
return fetchTokenSupplies({
|
|
197
|
+
chainId: requiredParams.chainId,
|
|
198
|
+
collectionAddress: requiredParams.collectionAddress,
|
|
199
|
+
config: requiredParams.config,
|
|
200
|
+
includeMetadata: params.includeMetadata,
|
|
201
|
+
metadataOptions: params.metadataOptions,
|
|
202
|
+
page: pageParam
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
return infiniteQueryOptions({
|
|
206
|
+
queryKey: getTokenSuppliesQueryKey(params),
|
|
207
|
+
queryFn,
|
|
208
|
+
initialPageParam,
|
|
209
|
+
getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0,
|
|
210
|
+
...params.query,
|
|
211
|
+
enabled
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/react/queries/token/ranges.ts
|
|
217
|
+
/**
|
|
218
|
+
* Fetches token ID ranges for a collection from the Indexer API
|
|
219
|
+
*/
|
|
220
|
+
async function fetchGetTokenRanges(params) {
|
|
221
|
+
const { chainId, collectionAddress, config } = params;
|
|
222
|
+
const response = await getIndexerClient(chainId, config).getTokenIDRanges({ collectionAddress });
|
|
223
|
+
if (!response) throw new Error("Failed to fetch token ranges");
|
|
224
|
+
return response;
|
|
225
|
+
}
|
|
226
|
+
function getTokenRangesQueryKey(params) {
|
|
227
|
+
return createTokenQueryKey("ranges", {
|
|
228
|
+
chainId: params.chainId,
|
|
229
|
+
collectionAddress: params.collectionAddress
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function getTokenRangesQueryOptions(params) {
|
|
233
|
+
return buildQueryOptions({
|
|
234
|
+
getQueryKey: getTokenRangesQueryKey,
|
|
235
|
+
requiredParams: [
|
|
236
|
+
"chainId",
|
|
237
|
+
"collectionAddress",
|
|
238
|
+
"config"
|
|
239
|
+
],
|
|
240
|
+
fetcher: fetchGetTokenRanges,
|
|
241
|
+
customValidation: (p) => !!p.chainId && p.chainId > 0 && !!p.collectionAddress && isAddress(p.collectionAddress)
|
|
242
|
+
}, params);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
//#endregion
|
|
246
|
+
export { getTokenSuppliesQueryKey as a, getSearchTokenMetadataQueryKey as c, getListTokenMetadataQueryKey as d, listTokenMetadataQueryOptions as f, listBalancesOptions as h, fetchTokenSupplies as i, searchTokenMetadataQueryOptions as l, getListBalancesQueryKey as m, getTokenRangesQueryKey as n, tokenSuppliesQueryOptions as o, fetchBalances as p, getTokenRangesQueryOptions as r, fetchSearchTokenMetadata as s, fetchGetTokenRanges as t, fetchListTokenMetadata as u };
|
|
247
|
+
//# sourceMappingURL=token2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token2.js","names":["initialPageParam: IndexerPage"],"sources":["../src/react/queries/token/queryKeys.ts","../src/react/queries/token/balances.ts","../src/react/queries/token/metadata.ts","../src/react/queries/token/metadata-search.ts","../src/react/queries/token/supplies.ts","../src/react/queries/token/ranges.ts"],"sourcesContent":["import { serializeBigInts } from '../../_internal/utils';\n\n/**\n * Creates a type-safe query key for token domain with automatic bigint serialization\n *\n * @param operation - The specific operation (e.g., 'balances', 'metadata', 'ranges')\n * @param params - The query parameters (will be automatically serialized)\n * @returns A serialized query key safe for React Query\n */\nexport function createTokenQueryKey<T>(operation: string, params: T) {\n\treturn ['token', operation, serializeBigInts(params)] as const;\n}\n","import type {\n\tGetTokenBalancesSdkRequest,\n\tIndexerPage,\n} from '@0xsequence/api-client';\nimport {\n\tbuildInfiniteQueryOptions,\n\tgetIndexerClient,\n\ttype Optional,\n\ttype SdkQueryParams,\n\ttype WithOptionalInfiniteParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createTokenQueryKey } from './queryKeys';\n\nexport type FetchBalancesParams = GetTokenBalancesSdkRequest & {\n\tincludeCollectionTokens?: boolean;\n};\n\nexport type ListBalancesQueryOptions = SdkQueryParams<FetchBalancesParams>;\n\n/**\n * Balances query params with accountAddress as required, contractAddress is optional\n */\nexport type UseListBalancesParams = Optional<\n\tListBalancesQueryOptions,\n\t'config' | 'contractAddress'\n> &\n\tRequired<Pick<ListBalancesQueryOptions, 'accountAddress'>>;\n\nexport async function fetchBalances(\n\tparams: WithRequired<\n\t\tListBalancesQueryOptions,\n\t\t'chainId' | 'accountAddress' | 'config'\n\t>,\n\tpage: IndexerPage,\n) {\n\tconst {\n\t\tchainId,\n\t\taccountAddress,\n\t\tcontractAddress,\n\t\ttokenId,\n\t\tincludeMetadata,\n\t\tmetadataOptions,\n\t\tconfig,\n\t} = params;\n\tconst indexerClient = getIndexerClient(chainId, config);\n\treturn indexerClient.getTokenBalances({\n\t\taccountAddress,\n\t\tcontractAddress,\n\t\ttokenId,\n\t\tincludeMetadata,\n\t\tmetadataOptions,\n\t\tpage: {\n\t\t\tpage: page.page,\n\t\t\tpageSize: page.pageSize,\n\t\t\tmore: page.more ?? false,\n\t\t},\n\t});\n}\n\nexport function getListBalancesQueryKey(params: ListBalancesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\taccountAddress: params.accountAddress,\n\t\tcontractAddress: params.contractAddress,\n\t\ttokenId: params.tokenId,\n\t\tincludeMetadata: params.includeMetadata,\n\t\tmetadataOptions: params.metadataOptions,\n\t\tincludeCollectionTokens: params.includeCollectionTokens,\n\t};\n\n\treturn createTokenQueryKey('balances', apiArgs);\n}\n\n/**\n * Creates a tanstack infinite query options object for the balances query\n *\n * @param params - The query parameters including config\n * @returns Query options configuration\n */\nexport function listBalancesOptions(\n\tparams: WithOptionalInfiniteParams<\n\t\tWithRequired<\n\t\t\tListBalancesQueryOptions,\n\t\t\t'chainId' | 'accountAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildInfiniteQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListBalancesQueryKey,\n\t\t\trequiredParams: ['chainId', 'accountAddress', 'config'] as const,\n\t\t\tfetcher: fetchBalances,\n\t\t\tgetPageInfo: (response) => {\n\t\t\t\tif (!response.page) return undefined;\n\t\t\t\treturn {\n\t\t\t\t\tpage: response.page.page ?? 1,\n\t\t\t\t\tpageSize: response.page.pageSize ?? 30,\n\t\t\t\t\tmore: response.page.more ?? false,\n\t\t\t\t};\n\t\t\t},\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.chainId && p.chainId > 0 && !!p.accountAddress,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tGetTokenMetadataSdkArgs,\n\tTokenMetadata,\n} from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\tgetMetadataClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createTokenQueryKey } from './queryKeys';\n\nexport type FetchListTokenMetadataParams = GetTokenMetadataSdkArgs;\n\nexport type ListTokenMetadataQueryOptions =\n\tSdkQueryParams<FetchListTokenMetadataParams>;\n\n/**\n * Fetches token metadata from the metadata API\n */\nexport async function fetchListTokenMetadata(\n\tparams: WithRequired<\n\t\tListTokenMetadataQueryOptions,\n\t\t'chainId' | 'contractAddress' | 'tokenIds' | 'config'\n\t>,\n): Promise<TokenMetadata[]> {\n\tconst { config, contractAddress, chainId, tokenIds } = params;\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst apiArgs = {\n\t\tchainId,\n\t\ttokenIds,\n\t\tcontractAddress,\n\t};\n\n\tconst response = await metadataClient.getTokenMetadata(apiArgs);\n\treturn response.tokenMetadata;\n}\n\nexport function getListTokenMetadataQueryKey(\n\tparams: ListTokenMetadataQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcontractAddress: params.contractAddress,\n\t\ttokenIds: params.tokenIds,\n\t};\n\n\treturn createTokenQueryKey('metadata', apiArgs);\n}\n\nexport function listTokenMetadataQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListTokenMetadataQueryOptions,\n\t\t\t'chainId' | 'contractAddress' | 'tokenIds' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListTokenMetadataQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'contractAddress',\n\t\t\t\t'tokenIds',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListTokenMetadata,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.chainId &&\n\t\t\t\tp.chainId > 0 &&\n\t\t\t\t!!p.tokenIds &&\n\t\t\t\tp.tokenIds.length > 0 &&\n\t\t\t\t!!p.contractAddress,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tSearchTokenMetadataReturn,\n\tSearchTokenMetadataSdkArgs,\n} from '@0xsequence/api-client';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport {\n\tgetMetadataClient,\n\ttype SdkInfiniteQueryParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createTokenQueryKey } from './queryKeys';\n\nexport type FetchSearchTokenMetadataParams = SearchTokenMetadataSdkArgs;\n\nexport type SearchTokenMetadataQueryOptions =\n\tSdkInfiniteQueryParams<FetchSearchTokenMetadataParams>;\n\n/**\n * Fetches token metadata from the metadata API using search filters\n */\nexport async function fetchSearchTokenMetadata(\n\tparams: WithRequired<\n\t\tSearchTokenMetadataQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'config'\n\t>,\n): Promise<SearchTokenMetadataReturn> {\n\tconst { chainId, collectionAddress, filter, page, config } = params;\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst response = await metadataClient.searchTokenMetadata({\n\t\tchainId,\n\t\tcollectionAddress,\n\t\tfilter: filter ?? {},\n\t\tpage,\n\t});\n\n\treturn {\n\t\ttokenMetadata: response.tokenMetadata,\n\t\tpage: response.page,\n\t};\n}\n\nexport function getSearchTokenMetadataQueryKey(\n\tparams: SearchTokenMetadataQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId ?? 0,\n\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\tfilter: params.filter,\n\t};\n\n\treturn createTokenQueryKey('metadata-search', apiArgs);\n}\n\nexport function searchTokenMetadataQueryOptions(\n\tparams: SearchTokenMetadataQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\tconst initialPageParam = { page: 1, pageSize: 30 };\n\n\tconst queryFn = ({ pageParam = initialPageParam }) => {\n\t\tconst requiredParams = params as WithRequired<\n\t\t\tSearchTokenMetadataQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'config'\n\t\t>;\n\t\treturn fetchSearchTokenMetadata({\n\t\t\tchainId: requiredParams.chainId,\n\t\t\tcollectionAddress: requiredParams.collectionAddress,\n\t\t\tfilter: params.filter,\n\t\t\tconfig: requiredParams.config,\n\t\t\tpage: pageParam,\n\t\t});\n\t};\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: getSearchTokenMetadataQueryKey(params),\n\t\tqueryFn,\n\t\tinitialPageParam,\n\t\tgetNextPageParam: (lastPage) => {\n\t\t\tif (!lastPage.page?.more) return undefined;\n\t\t\treturn {\n\t\t\t\tpage: (lastPage.page.page || 1) + 1,\n\t\t\t\tpageSize: lastPage.page.pageSize || 20,\n\t\t\t};\n\t\t},\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type {\n\tAddress,\n\tGetTokenSuppliesRequest,\n\tIndexerPage,\n} from '@0xsequence/api-client';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport {\n\tgetIndexerClient,\n\ttype SdkInfiniteQueryParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createTokenQueryKey } from './queryKeys';\n\nexport type FetchTokenSuppliesParams = Omit<\n\tGetTokenSuppliesRequest,\n\t'contractAddress' | 'collectionAddress'\n> & {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tpage?: IndexerPage;\n};\n\nexport type TokenSuppliesQueryOptions =\n\tSdkInfiniteQueryParams<FetchTokenSuppliesParams>;\n\n/**\n * Fetches token supplies with support for indexer API\n */\nexport async function fetchTokenSupplies(\n\tparams: WithRequired<\n\t\tTokenSuppliesQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'config'\n\t>,\n) {\n\tconst { chainId, config, ...apiParams } = params;\n\tconst indexerClient = getIndexerClient(chainId, config);\n\tconst result = await indexerClient.getTokenSupplies(apiParams);\n\treturn result;\n}\n\nexport function getTokenSuppliesQueryKey(params: TokenSuppliesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId ?? 0,\n\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\tincludeMetadata: params.includeMetadata,\n\t\tmetadataOptions: params.metadataOptions,\n\t};\n\n\treturn createTokenQueryKey('supplies', apiArgs);\n}\n\nexport function tokenSuppliesQueryOptions(params: TokenSuppliesQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\tconst initialPageParam: IndexerPage = { page: 1, pageSize: 30, more: false };\n\n\tconst queryFn = async ({ pageParam = initialPageParam }) => {\n\t\tconst requiredParams = params as WithRequired<\n\t\t\tTokenSuppliesQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'config'\n\t\t>;\n\t\treturn fetchTokenSupplies({\n\t\t\tchainId: requiredParams.chainId,\n\t\t\tcollectionAddress: requiredParams.collectionAddress,\n\t\t\tconfig: requiredParams.config,\n\t\t\tincludeMetadata: params.includeMetadata,\n\t\t\tmetadataOptions: params.metadataOptions,\n\t\t\tpage: pageParam,\n\t\t});\n\t};\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: getTokenSuppliesQueryKey(params),\n\t\tqueryFn,\n\t\tinitialPageParam,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more ? lastPage.page : undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type {\n\tAddress,\n\tGetTokenIDRangesRequest,\n\tGetTokenIDRangesResponse,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetIndexerClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createTokenQueryKey } from './queryKeys';\n\nexport type FetchGetTokenRangesParams = Extract<\n\tGetTokenIDRangesRequest,\n\t{ collectionAddress: Address }\n> & { chainId: number };\n\nexport type GetTokenRangesQueryOptions =\n\tSdkQueryParams<FetchGetTokenRangesParams>;\n\n/**\n * Fetches token ID ranges for a collection from the Indexer API\n */\nexport async function fetchGetTokenRanges(\n\tparams: WithRequired<\n\t\tGetTokenRangesQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'config'\n\t>,\n): Promise<GetTokenIDRangesResponse> {\n\tconst { chainId, collectionAddress, config } = params;\n\tconst indexerClient = getIndexerClient(chainId, config);\n\tconst response = await indexerClient.getTokenIDRanges({ collectionAddress });\n\n\tif (!response) {\n\t\tthrow new Error('Failed to fetch token ranges');\n\t}\n\n\treturn response;\n}\n\nexport function getTokenRangesQueryKey(params: GetTokenRangesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcollectionAddress: params.collectionAddress,\n\t};\n\n\treturn createTokenQueryKey('ranges', apiArgs);\n}\n\nexport function getTokenRangesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tGetTokenRangesQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getTokenRangesQueryKey,\n\t\t\trequiredParams: ['chainId', 'collectionAddress', 'config'],\n\t\t\tfetcher: fetchGetTokenRanges,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.chainId &&\n\t\t\t\tp.chainId > 0 &&\n\t\t\t\t!!p.collectionAddress &&\n\t\t\t\tisAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;AASA,SAAgB,oBAAuB,WAAmB,QAAW;AACpE,QAAO;EAAC;EAAS;EAAW,iBAAiB,OAAO;EAAC;;;;;ACmBtD,eAAsB,cACrB,QAIA,MACC;CACD,MAAM,EACL,SACA,gBACA,iBACA,SACA,iBACA,iBACA,WACG;AAEJ,QADsB,iBAAiB,SAAS,OAAO,CAClC,iBAAiB;EACrC;EACA;EACA;EACA;EACA;EACA,MAAM;GACL,MAAM,KAAK;GACX,UAAU,KAAK;GACf,MAAM,KAAK,QAAQ;GACnB;EACD,CAAC;;AAGH,SAAgB,wBAAwB,QAAkC;AAWzE,QAAO,oBAAoB,YAVX;EACf,SAAS,OAAO;EAChB,gBAAgB,OAAO;EACvB,iBAAiB,OAAO;EACxB,SAAS,OAAO;EAChB,iBAAiB,OAAO;EACxB,iBAAiB,OAAO;EACxB,yBAAyB,OAAO;EAChC,CAE8C;;;;;;;;AAShD,SAAgB,oBACf,QAMC;AACD,QAAO,0BACN;EACC,aAAa;EACb,gBAAgB;GAAC;GAAW;GAAkB;GAAS;EACvD,SAAS;EACT,cAAc,aAAa;AAC1B,OAAI,CAAC,SAAS,KAAM,QAAO;AAC3B,UAAO;IACN,MAAM,SAAS,KAAK,QAAQ;IAC5B,UAAU,SAAS,KAAK,YAAY;IACpC,MAAM,SAAS,KAAK,QAAQ;IAC5B;;EAEF,mBAAmB,MAClB,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,KAAK,CAAC,CAAC,EAAE;EACrC,EACD,OACA;;;;;;;;ACpFF,eAAsB,uBACrB,QAI2B;CAC3B,MAAM,EAAE,QAAQ,iBAAiB,SAAS,aAAa;CACvD,MAAM,iBAAiB,kBAAkB,OAAO;CAEhD,MAAM,UAAU;EACf;EACA;EACA;EACA;AAGD,SADiB,MAAM,eAAe,iBAAiB,QAAQ,EAC/C;;AAGjB,SAAgB,6BACf,QACC;AAOD,QAAO,oBAAoB,YANX;EACf,SAAS,OAAO;EAChB,iBAAiB,OAAO;EACxB,UAAU,OAAO;EACjB,CAE8C;;AAGhD,SAAgB,8BACf,QAMC;AACD,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GACf;GACA;GACA;GACA;GACA;EACD,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,WACJ,EAAE,UAAU,KACZ,CAAC,CAAC,EAAE,YACJ,EAAE,SAAS,SAAS,KACpB,CAAC,CAAC,EAAE;EACL,EACD,OACA;;;;;;;;AC1DF,eAAsB,yBACrB,QAIqC;CACrC,MAAM,EAAE,SAAS,mBAAmB,QAAQ,MAAM,WAAW;CAG7D,MAAM,WAAW,MAFM,kBAAkB,OAAO,CAEV,oBAAoB;EACzD;EACA;EACA,QAAQ,UAAU,EAAE;EACpB;EACA,CAAC;AAEF,QAAO;EACN,eAAe,SAAS;EACxB,MAAM,SAAS;EACf;;AAGF,SAAgB,+BACf,QACC;AAOD,QAAO,oBAAoB,mBANX;EACf,SAAS,OAAO,WAAW;EAC3B,mBAAmB,OAAO,qBAAqB;EAC/C,QAAQ,OAAO;EACf,CAEqD;;AAGvD,SAAgB,gCACf,QACC;CACD,MAAM,UAAU,QACf,OAAO,WACN,OAAO,qBACP,OAAO,WACN,OAAO,OAAO,WAAW,MAC3B;CAED,MAAM,mBAAmB;EAAE,MAAM;EAAG,UAAU;EAAI;CAElD,MAAM,WAAW,EAAE,YAAY,uBAAuB;EACrD,MAAM,iBAAiB;AAIvB,SAAO,yBAAyB;GAC/B,SAAS,eAAe;GACxB,mBAAmB,eAAe;GAClC,QAAQ,OAAO;GACf,QAAQ,eAAe;GACvB,MAAM;GACN,CAAC;;AAGH,QAAO,qBAAqB;EAC3B,UAAU,+BAA+B,OAAO;EAChD;EACA;EACA,mBAAmB,aAAa;AAC/B,OAAI,CAAC,SAAS,MAAM,KAAM,QAAO;AACjC,UAAO;IACN,OAAO,SAAS,KAAK,QAAQ,KAAK;IAClC,UAAU,SAAS,KAAK,YAAY;IACpC;;EAEF,GAAG,OAAO;EACV;EACA,CAAC;;;;;;;;ACjEH,eAAsB,mBACrB,QAIC;CACD,MAAM,EAAE,SAAS,QAAQ,GAAG,cAAc;AAG1C,QADe,MADO,iBAAiB,SAAS,OAAO,CACpB,iBAAiB,UAAU;;AAI/D,SAAgB,yBAAyB,QAAmC;AAQ3E,QAAO,oBAAoB,YAPX;EACf,SAAS,OAAO,WAAW;EAC3B,mBAAmB,OAAO,qBAAqB;EAC/C,iBAAiB,OAAO;EACxB,iBAAiB,OAAO;EACxB,CAE8C;;AAGhD,SAAgB,0BAA0B,QAAmC;CAC5E,MAAM,UAAU,QACf,OAAO,WACN,OAAO,qBACP,OAAO,WACN,OAAO,OAAO,WAAW,MAC3B;CAED,MAAMA,mBAAgC;EAAE,MAAM;EAAG,UAAU;EAAI,MAAM;EAAO;CAE5E,MAAM,UAAU,OAAO,EAAE,YAAY,uBAAuB;EAC3D,MAAM,iBAAiB;AAIvB,SAAO,mBAAmB;GACzB,SAAS,eAAe;GACxB,mBAAmB,eAAe;GAClC,QAAQ,eAAe;GACvB,iBAAiB,OAAO;GACxB,iBAAiB,OAAO;GACxB,MAAM;GACN,CAAC;;AAGH,QAAO,qBAAqB;EAC3B,UAAU,yBAAyB,OAAO;EAC1C;EACA;EACA,mBAAmB,aAClB,SAAS,MAAM,OAAO,SAAS,OAAO;EACvC,GAAG,OAAO;EACV;EACA,CAAC;;;;;;;;AC1DH,eAAsB,oBACrB,QAIoC;CACpC,MAAM,EAAE,SAAS,mBAAmB,WAAW;CAE/C,MAAM,WAAW,MADK,iBAAiB,SAAS,OAAO,CAClB,iBAAiB,EAAE,mBAAmB,CAAC;AAE5E,KAAI,CAAC,SACJ,OAAM,IAAI,MAAM,+BAA+B;AAGhD,QAAO;;AAGR,SAAgB,uBAAuB,QAAoC;AAM1E,QAAO,oBAAoB,UALX;EACf,SAAS,OAAO;EAChB,mBAAmB,OAAO;EAC1B,CAE4C;;AAG9C,SAAgB,2BACf,QAMC;AACD,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GAAC;GAAW;GAAqB;GAAS;EAC1D,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,WACJ,EAAE,UAAU,KACZ,CAAC,CAAC,EAAE,qBACJ,UAAU,EAAE,kBAAkB;EAC/B,EACD,OACA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { d as truncateMiddle } from "./utils.js";
|
|
2
|
+
import { networks } from "@0xsequence/network";
|
|
3
|
+
import { CheckmarkIcon, Spinner, Text } from "@0xsequence/design-system";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/react/ui/modals/_internal/components/transaction-footer/index.tsx
|
|
7
|
+
function TransactionFooter({ transactionHash, orderId, isConfirming, isConfirmed, isFailed, isTimeout, chainId }) {
|
|
8
|
+
const icon = (isConfirmed || orderId) && /* @__PURE__ */ jsx(PositiveCircle, {}) || isConfirming && /* @__PURE__ */ jsx(Spinner, { size: "md" });
|
|
9
|
+
const title = (isConfirmed || orderId) && "Transaction complete" || isConfirming && "Processing transaction" || isFailed && "Transaction failed" || isTimeout && "Transaction took longer than expected";
|
|
10
|
+
const transactionUrl = `${networks[chainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12
|
+
className: "flex items-center",
|
|
13
|
+
children: [
|
|
14
|
+
icon,
|
|
15
|
+
/* @__PURE__ */ jsx(Text, {
|
|
16
|
+
className: "ml-2 grow font-body text-sm",
|
|
17
|
+
color: "text50",
|
|
18
|
+
fontWeight: "medium",
|
|
19
|
+
children: title
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx("a", {
|
|
22
|
+
className: "ml-2 text-right no-underline",
|
|
23
|
+
href: transactionUrl,
|
|
24
|
+
target: "_blank",
|
|
25
|
+
rel: "noopener noreferrer",
|
|
26
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
27
|
+
className: "text-right font-body text-sm text-violet-400",
|
|
28
|
+
fontWeight: "medium",
|
|
29
|
+
children: transactionHash && truncateMiddle(transactionHash, 4, 4)
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const PositiveCircle = () => /* @__PURE__ */ jsx("div", {
|
|
36
|
+
className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#35a554]",
|
|
37
|
+
children: /* @__PURE__ */ jsx(CheckmarkIcon, {
|
|
38
|
+
size: "xs",
|
|
39
|
+
color: "white"
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { TransactionFooter as n, PositiveCircle as t };
|
|
45
|
+
//# sourceMappingURL=transaction-footer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-footer.js","names":[],"sources":["../src/react/ui/modals/_internal/components/transaction-footer/index.tsx"],"sourcesContent":["import { CheckmarkIcon, Spinner, Text } from '@0xsequence/design-system';\nimport { type ChainId, networks } from '@0xsequence/network';\nimport type { Hex } from 'viem';\nimport { truncateMiddle } from '../../../../../../utils';\n\ntype TransactionFooterProps = {\n\ttransactionHash: Hex | undefined;\n\torderId?: string;\n\tisConfirming: boolean;\n\tisConfirmed: boolean;\n\tisFailed: boolean;\n\tisTimeout: boolean;\n\tchainId: number;\n};\n\nexport default function TransactionFooter({\n\ttransactionHash,\n\torderId,\n\tisConfirming,\n\tisConfirmed,\n\tisFailed,\n\tisTimeout,\n\tchainId,\n}: TransactionFooterProps) {\n\tconst icon =\n\t\t((isConfirmed || orderId) && <PositiveCircle />) ||\n\t\t(isConfirming && <Spinner size=\"md\" />);\n\n\tconst title =\n\t\t((isConfirmed || orderId) && 'Transaction complete') ||\n\t\t(isConfirming && 'Processing transaction') ||\n\t\t(isFailed && 'Transaction failed') ||\n\t\t(isTimeout && 'Transaction took longer than expected');\n\n\tconst transactionUrl = `${networks[chainId as unknown as ChainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;\n\treturn (\n\t\t<div className=\"flex items-center\">\n\t\t\t{icon}\n\t\t\t<Text\n\t\t\t\tclassName=\"ml-2 grow font-body text-sm\"\n\t\t\t\tcolor=\"text50\"\n\t\t\t\tfontWeight=\"medium\"\n\t\t\t>\n\t\t\t\t{title}\n\t\t\t</Text>\n\t\t\t<a\n\t\t\t\tclassName=\"ml-2 text-right no-underline\"\n\t\t\t\thref={transactionUrl}\n\t\t\t\ttarget=\"_blank\"\n\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t>\n\t\t\t\t<Text\n\t\t\t\t\tclassName=\"text-right font-body text-sm text-violet-400\"\n\t\t\t\t\tfontWeight=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{transactionHash && truncateMiddle(transactionHash, 4, 4)}\n\t\t\t\t</Text>\n\t\t\t</a>\n\t\t</div>\n\t);\n}\n\nexport const PositiveCircle = () => (\n\t<div className=\"flex h-5 w-5 items-center justify-center rounded-full bg-[#35a554]\">\n\t\t<CheckmarkIcon size=\"xs\" color=\"white\" />\n\t</div>\n);\n"],"mappings":";;;;;;AAeA,SAAwB,kBAAkB,EACzC,iBACA,SACA,cACA,aACA,UACA,WACA,WAC0B;CAC1B,MAAM,QACH,eAAe,YAAY,oBAAC,mBAAiB,IAC9C,gBAAgB,oBAAC,WAAQ,MAAK,OAAO;CAEvC,MAAM,SACH,eAAe,YAAY,0BAC5B,gBAAgB,4BAChB,YAAY,wBACZ,aAAa;CAEf,MAAM,iBAAiB,GAAG,SAAS,UAAgC,eAAe,QAAQ,KAAK;AAC/F,QACC,qBAAC;EAAI,WAAU;;GACb;GACD,oBAAC;IACA,WAAU;IACV,OAAM;IACN,YAAW;cAEV;KACK;GACP,oBAAC;IACA,WAAU;IACV,MAAM;IACN,QAAO;IACP,KAAI;cAEJ,oBAAC;KACA,WAAU;KACV,YAAW;eAEV,mBAAmB,eAAe,iBAAiB,GAAG,EAAE;MACnD;KACJ;;GACC;;AAIR,MAAa,uBACZ,oBAAC;CAAI,WAAU;WACd,oBAAC;EAAc,MAAK;EAAK,OAAM;GAAU;EACpC"}
|
package/dist/transaction.js
CHANGED
|
@@ -58,12 +58,6 @@ var UserRejectedRequestError = class extends TransactionError {
|
|
|
58
58
|
super("User rejected the request", { details: "The user cancelled or rejected the transaction request." });
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
var InvalidContractTypeError = class extends TransactionError {
|
|
62
|
-
name = "InvalidContractTypeError";
|
|
63
|
-
constructor(contractType) {
|
|
64
|
-
super(`Invalid contract type: ${contractType}`, { details: "The contract type must be either ERC721 or ERC1155." });
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
61
|
var MissingConfigError = class extends TransactionError {
|
|
68
62
|
name = "MissingConfigError";
|
|
69
63
|
constructor(configName) {
|
|
@@ -72,5 +66,5 @@ var MissingConfigError = class extends TransactionError {
|
|
|
72
66
|
};
|
|
73
67
|
|
|
74
68
|
//#endregion
|
|
75
|
-
export {
|
|
69
|
+
export { TransactionSignatureError as a, TransactionExecutionError as i, MissingConfigError as n, UserRejectedRequestError as o, NoWalletConnectedError as r, BaseError as s, ChainSwitchError as t };
|
|
76
70
|
//# sourceMappingURL=transaction.js.map
|
package/dist/transaction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","names":[],"sources":["../src/utils/_internal/error/base.ts","../src/utils/_internal/error/transaction.ts"],"sourcesContent":["export type ErrorType<name extends string = 'Error'> = Error & { name: name };\n\nexport type Compute<type> = { [key in keyof type]: type[key] } & unknown;\n\ntype BaseErrorOptions = Compute<\n\t{ details?: string | undefined } | { cause: BaseError | Error }\n>;\n\nexport class BaseError extends Error {\n\tdetails: string;\n\tshortMessage: string;\n\n\tname = 'MarketplaceSdkBaseError';\n\n\tconstructor(shortMessage: string, options: BaseErrorOptions = {}) {\n\t\tsuper();\n\n\t\tconst details = 'details' in options ? options.details : '';\n\t\tthis.message = [\n\t\t\tshortMessage || 'An error occurred.',\n\t\t\t'',\n\t\t\t...(details ? [`Details: ${details}`] : []),\n\t\t].join('\\n');\n\n\t\tif ('cause' in options && options.cause) {\n\t\t\tthis.cause = options.cause;\n\t\t}\n\n\t\tthis.details = details || '';\n\t\tthis.shortMessage = shortMessage;\n\t}\n}\n","import type { Address } from 'viem';\nimport { BaseError } from './base';\n\nexport type TransactionErrorType<name extends string = 'TransactionError'> =\n\tBaseError & { name: name };\n\nexport class TransactionError extends BaseError {\n\toverride name = 'TransactionError';\n}\n\nexport class ChainSwitchError extends TransactionError {\n\toverride name = 'ChainSwitchError';\n\tconstructor(currentChainId: number, targetChainId: number) {\n\t\tsuper(\n\t\t\t`Failed to switch network from ${currentChainId} to ${targetChainId}`,\n\t\t\t{\n\t\t\t\tdetails:\n\t\t\t\t\t'The user may have rejected the network switch or there might be a network connectivity issue.',\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport class ChainSwitchUserRejectedError extends TransactionError {\n\toverride name = 'ChainSwitchUserRejectedError';\n\tconstructor() {\n\t\tsuper('User rejected chain switch', {\n\t\t\tdetails: 'The user rejected the chain switch request.',\n\t\t});\n\t}\n}\n\nexport class TransactionExecutionError extends TransactionError {\n\toverride name = 'TransactionExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction may have been rejected or failed during execution.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class TransactionSignatureError extends TransactionError {\n\toverride name = 'TransactionSignatureError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to sign transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The signature request may have been rejected by the user.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class NoWalletConnectedError extends TransactionError {\n\toverride name = 'NoWalletConnectedError';\n\tconstructor() {\n\t\tsuper('No wallet connected', {\n\t\t\tdetails: 'Please connect your wallet before attempting this transaction.',\n\t\t});\n\t}\n}\n\nexport class NoMarketplaceConfigError extends TransactionError {\n\toverride name = 'NoMarketplaceConfigError';\n\tconstructor() {\n\t\tsuper('Marketplace configuration not found', {\n\t\t\tdetails:\n\t\t\t\t'The marketplace configuration is missing or invalid. This could be due to an initialization error.',\n\t\t});\n\t}\n}\n\nexport class UserRejectedRequestError extends TransactionError {\n\toverride name = 'UserRejectedRequestError';\n\tconstructor() {\n\t\tsuper('User rejected the request', {\n\t\t\tdetails: 'The user cancelled or rejected the transaction request.',\n\t\t});\n\t}\n}\n\nexport class InsufficientFundsError extends TransactionError {\n\toverride name = 'InsufficientFundsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Insufficient funds for transaction', {\n\t\t\tdetails:\n\t\t\t\t'The wallet does not have enough funds to complete this transaction.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class SignatureExecutionError extends TransactionError {\n\toverride name = 'SignatureExecutionError';\n\tconstructor(signature: string, cause?: Error) {\n\t\tsuper(`Failed to execute signature: ${signature}`, {\n\t\t\tdetails: cause?.message || 'The execution of the signature failed.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepExecutionError extends TransactionError {\n\toverride name = 'StepExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute step ${stepId})`, {\n\t\t\tdetails: cause?.message || 'The step execution failed unexpectedly.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepGenerationError extends TransactionError {\n\toverride name = 'StepGenerationError';\n\tconstructor(transactionType: string, cause?: Error) {\n\t\tsuper(`Failed to generate steps for ${transactionType}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'Could not generate the required transaction steps.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalError extends TransactionError {\n\toverride name = 'PaymentModalError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Payment modal operation failed', {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'The payment modal operation was unsuccessful.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class InvalidStepError extends TransactionError {\n\toverride name = 'InvalidStepError';\n\tconstructor(stepId: string, reason: string) {\n\t\tsuper(`Invalid step configuration for ${stepId}`, {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class TransactionConfirmationError extends TransactionError {\n\toverride name = 'TransactionConfirmationError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to confirm transaction ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction could not be confirmed on the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrderNotFoundError extends TransactionError {\n\toverride name = 'OrderNotFoundError';\n\tconstructor(orderId: string) {\n\t\tsuper(`Order ${orderId} not found`, {\n\t\t\tdetails: 'The requested order could not be found in the marketplace.',\n\t\t});\n\t}\n}\n\nexport class MissingStepDataError extends TransactionError {\n\toverride name = 'MissingStepDataError';\n\tconstructor() {\n\t\tsuper('Step is missing required data', {\n\t\t\tdetails:\n\t\t\t\t'The transaction step is missing required \"to\" or \"signature\" data.',\n\t\t});\n\t}\n}\n\nexport class MissingSignatureDataError extends TransactionError {\n\toverride name = 'MissingSignatureDataError';\n\tconstructor() {\n\t\tsuper('Step is missing signature data', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required signature data configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidSignatureStepError extends TransactionError {\n\toverride name = 'InvalidSignatureStepError';\n\tconstructor(stepId: string) {\n\t\tsuper(`Invalid signature step type: ${stepId}`, {\n\t\t\tdetails: 'The signature step type is not supported.',\n\t\t});\n\t}\n}\n\nexport class MissingPostStepError extends TransactionError {\n\toverride name = 'MissingPostStepError';\n\tconstructor() {\n\t\tsuper('Missing post step configuration', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required post-step configuration.',\n\t\t});\n\t}\n}\n\nexport class UnexpectedStepsError extends TransactionError {\n\toverride name = 'UnexpectedStepsError';\n\tconstructor() {\n\t\tsuper('Unexpected steps found', {\n\t\t\tdetails: 'The transaction contains more steps than expected.',\n\t\t});\n\t}\n}\n\nexport class NoExecutionStepError extends TransactionError {\n\toverride name = 'NoExecutionStepError';\n\tconstructor() {\n\t\tsuper('No execution step found', {\n\t\t\tdetails: 'The transaction is missing the required execution step.',\n\t\t});\n\t}\n}\n\nexport class NoStepsFoundError extends TransactionError {\n\toverride name = 'NoStepsFoundError';\n\tconstructor() {\n\t\tsuper('No steps found', {\n\t\t\tdetails: 'The transaction contains no steps to execute.',\n\t\t});\n\t}\n}\n\nexport class UnknownTransactionTypeError extends TransactionError {\n\toverride name = 'UnknownTransactionTypeError';\n\tconstructor(type: string) {\n\t\tsuper(`Unknown transaction type: ${type}`, {\n\t\t\tdetails: 'The specified transaction type is not supported.',\n\t\t});\n\t}\n}\n\nexport class InvalidContractTypeError extends TransactionError {\n\toverride name = 'InvalidContractTypeError';\n\tconstructor(contractType: string | undefined) {\n\t\tsuper(`Invalid contract type: ${contractType}`, {\n\t\t\tdetails: 'The contract type must be either ERC721 or ERC1155.',\n\t\t});\n\t}\n}\n\nexport class CollectionNotFoundError extends TransactionError {\n\toverride name = 'CollectionNotFoundError';\n\tconstructor(collectionAddress: string) {\n\t\tsuper(`Collection not found: ${collectionAddress}`, {\n\t\t\tdetails:\n\t\t\t\t'The specified collection address could not be found in the marketplace configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidCurrencyOptionsError extends TransactionError {\n\toverride name = 'InvalidCurrencyOptionsError';\n\tconstructor(currencyOptions: Address[]) {\n\t\tsuper(`Invalid currency options: ${currencyOptions}`, {\n\t\t\tdetails:\n\t\t\t\t'The currency options must be an array of valid currency contract addresses.',\n\t\t});\n\t}\n}\n\nexport class ProjectNotFoundError extends TransactionError {\n\toverride name = 'ProjectNotFoundError';\n\tconstructor(projectId: string, url: string) {\n\t\tsuper('Project not found', {\n\t\t\tdetails: `Project id: ${projectId} not found at ${url}`,\n\t\t});\n\t}\n}\n\nexport class MarketplaceConfigFetchError extends TransactionError {\n\toverride name = 'MarketplaceConfigFetchError';\n\tconstructor(message: string) {\n\t\tsuper('Failed to fetch marketplace config', {\n\t\t\tdetails: message,\n\t\t});\n\t}\n}\n\nexport class MissingConfigError extends TransactionError {\n\toverride name = 'MissingConfigError';\n\tconstructor(configName: string) {\n\t\tsuper(`Missing required config: ${configName}`, {\n\t\t\tdetails: 'A required configuration parameter is missing.',\n\t\t});\n\t}\n}\n\nexport class TransactionValidationError extends TransactionError {\n\toverride name = 'TransactionValidationError';\n\tconstructor(reason: string) {\n\t\tsuper('Transaction validation failed', {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class ChainIdUnavailableError extends TransactionError {\n\toverride name = 'ChainIdUnavailableError';\n\tconstructor() {\n\t\tsuper('Chain ID is not available', {\n\t\t\tdetails: 'Could not determine the current chain ID from the wallet.',\n\t\t});\n\t}\n}\n\nexport class TransactionReceiptError extends TransactionError {\n\toverride name = 'TransactionReceiptError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to get transaction receipt for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the transaction receipt from the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalTransactionError extends TransactionError {\n\toverride name = 'PaymentModalTransactionError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Payment modal transaction failed for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction initiated from the payment modal failed.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class CheckoutOptionsError extends TransactionError {\n\toverride name = 'CheckoutOptionsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Failed to get checkout options', {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the checkout options from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrdersFetchError extends TransactionError {\n\toverride name = 'OrdersFetchError';\n\tconstructor(orderId: string, cause?: Error) {\n\t\tsuper(`Failed to fetch order ${orderId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the order details from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class SalesContractError extends TransactionError {\n\toverride name = 'SalesContractError';\n\tconstructor(contractAddress: string, method?: string, cause?: Error) {\n\t\tsuper(`Sales contract operation failed: ${contractAddress}`, {\n\t\t\tdetails: `Failed to interact with sales contract${\n\t\t\t\tmethod ? ` on method: ${method}` : ''\n\t\t\t}. ${cause?.message || 'Contract may be paused or misconfigured.'}`,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class QuantityValidationError extends TransactionError {\n\toverride name = 'QuantityValidationError';\n\tconstructor(provided: number, available: number, tokenId?: string) {\n\t\tsuper(`Invalid quantity: ${provided}`, {\n\t\t\tdetails: `Requested quantity (${provided}) exceeds available supply (${available})${\n\t\t\t\ttokenId ? ` for token ${tokenId}` : ''\n\t\t\t}.`,\n\t\t});\n\t}\n}\n\nexport class ShopDataValidationError extends TransactionError {\n\toverride name = 'ShopDataValidationError';\n\tconstructor(missingField: string) {\n\t\tsuper(`Invalid shop configuration: missing ${missingField}`, {\n\t\t\tdetails: `The shop is missing required field: ${missingField}. Check your marketplace configuration.`,\n\t\t});\n\t}\n}\n\nexport type TransactionErrorTypes =\n\t| ChainIdUnavailableError\n\t| TransactionReceiptError\n\t| PaymentModalTransactionError\n\t| CheckoutOptionsError\n\t| OrdersFetchError\n\t| TransactionConfirmationError\n\t| TransactionValidationError\n\t| MissingConfigError\n\t| MarketplaceConfigFetchError\n\t| ProjectNotFoundError\n\t| CollectionNotFoundError\n\t| InvalidCurrencyOptionsError\n\t| InvalidContractTypeError\n\t| UnknownTransactionTypeError\n\t| NoStepsFoundError\n\t| NoExecutionStepError\n\t| UnexpectedStepsError\n\t| MissingPostStepError\n\t| InvalidSignatureStepError\n\t| MissingSignatureDataError\n\t| MissingStepDataError\n\t| OrderNotFoundError\n\t| TransactionConfirmationError\n\t| InvalidStepError\n\t| PaymentModalError\n\t| StepGenerationError\n\t| StepExecutionError\n\t| UserRejectedRequestError\n\t| NoMarketplaceConfigError\n\t| InsufficientFundsError\n\t| ChainSwitchUserRejectedError\n\t| ChainSwitchError\n\t| TransactionSignatureError\n\t| TransactionExecutionError\n\t| NoWalletConnectedError\n\t| TransactionError\n\t| SalesContractError\n\t| QuantityValidationError\n\t| ShopDataValidationError;\n"],"mappings":";AAQA,IAAa,YAAb,cAA+B,MAAM;CACpC;CACA;CAEA,OAAO;CAEP,YAAY,cAAsB,UAA4B,EAAE,EAAE;AACjE,SAAO;EAEP,MAAM,UAAU,aAAa,UAAU,QAAQ,UAAU;AACzD,OAAK,UAAU;GACd,gBAAgB;GAChB;GACA,GAAI,UAAU,CAAC,YAAY,UAAU,GAAG,EAAE;GAC1C,CAAC,KAAK,KAAK;AAEZ,MAAI,WAAW,WAAW,QAAQ,MACjC,MAAK,QAAQ,QAAQ;AAGtB,OAAK,UAAU,WAAW;AAC1B,OAAK,eAAe;;;;;;ACvBtB,IAAa,mBAAb,cAAsC,UAAU;CAC/C,AAAS,OAAO;;AAGjB,IAAa,mBAAb,cAAsC,iBAAiB;CACtD,AAAS,OAAO;CAChB,YAAY,gBAAwB,eAAuB;AAC1D,QACC,iCAAiC,eAAe,MAAM,iBACtD,EACC,SACC,iGACD,CACD;;;AAaH,IAAa,4BAAb,cAA+C,iBAAiB;CAC/D,AAAS,OAAO;CAChB,YAAY,QAAgB,OAAe;AAC1C,QAAM,uCAAuC,UAAU;GACtD,SACC,OAAO,WACP;GACD;GACA,CAAC;;;AAIJ,IAAa,4BAAb,cAA+C,iBAAiB;CAC/D,AAAS,OAAO;CAChB,YAAY,QAAgB,OAAe;AAC1C,QAAM,oCAAoC,UAAU;GACnD,SACC,OAAO,WACP;GACD;GACA,CAAC;;;AAIJ,IAAa,yBAAb,cAA4C,iBAAiB;CAC5D,AAAS,OAAO;CAChB,cAAc;AACb,QAAM,uBAAuB,EAC5B,SAAS,kEACT,CAAC;;;AAcJ,IAAa,2BAAb,cAA8C,iBAAiB;CAC9D,AAAS,OAAO;CAChB,cAAc;AACb,QAAM,6BAA6B,EAClC,SAAS,2DACT,CAAC;;;AAkKJ,IAAa,2BAAb,cAA8C,iBAAiB;CAC9D,AAAS,OAAO;CAChB,YAAY,cAAkC;AAC7C,QAAM,0BAA0B,gBAAgB,EAC/C,SAAS,uDACT,CAAC;;;AA0CJ,IAAa,qBAAb,cAAwC,iBAAiB;CACxD,AAAS,OAAO;CAChB,YAAY,YAAoB;AAC/B,QAAM,4BAA4B,cAAc,EAC/C,SAAS,kDACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"transaction.js","names":[],"sources":["../src/utils/_internal/error/base.ts","../src/utils/_internal/error/transaction.ts"],"sourcesContent":["export type ErrorType<name extends string = 'Error'> = Error & { name: name };\n\nexport type Compute<type> = { [key in keyof type]: type[key] };\n\ntype BaseErrorOptions = Compute<\n\t{ details?: string | undefined } | { cause: BaseError | Error }\n>;\n\nexport class BaseError extends Error {\n\tdetails: string;\n\tshortMessage: string;\n\n\tname = 'MarketplaceSdkBaseError';\n\n\tconstructor(shortMessage: string, options: BaseErrorOptions = {}) {\n\t\tsuper();\n\n\t\tconst details = 'details' in options ? options.details : '';\n\t\tthis.message = [\n\t\t\tshortMessage || 'An error occurred.',\n\t\t\t'',\n\t\t\t...(details ? [`Details: ${details}`] : []),\n\t\t].join('\\n');\n\n\t\tif ('cause' in options && options.cause) {\n\t\t\tthis.cause = options.cause;\n\t\t}\n\n\t\tthis.details = details || '';\n\t\tthis.shortMessage = shortMessage;\n\t}\n}\n","import type { Address } from '@0xsequence/api-client';\nimport { BaseError } from './base';\n\nexport type TransactionErrorType<name extends string = 'TransactionError'> =\n\tBaseError & { name: name };\n\nexport class TransactionError extends BaseError {\n\toverride name = 'TransactionError';\n}\n\nexport class ChainSwitchError extends TransactionError {\n\toverride name = 'ChainSwitchError';\n\tconstructor(currentChainId: number, targetChainId: number) {\n\t\tsuper(\n\t\t\t`Failed to switch network from ${currentChainId} to ${targetChainId}`,\n\t\t\t{\n\t\t\t\tdetails:\n\t\t\t\t\t'The user may have rejected the network switch or there might be a network connectivity issue.',\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport class ChainSwitchUserRejectedError extends TransactionError {\n\toverride name = 'ChainSwitchUserRejectedError';\n\tconstructor() {\n\t\tsuper('User rejected chain switch', {\n\t\t\tdetails: 'The user rejected the chain switch request.',\n\t\t});\n\t}\n}\n\nexport class TransactionExecutionError extends TransactionError {\n\toverride name = 'TransactionExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction may have been rejected or failed during execution.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class TransactionSignatureError extends TransactionError {\n\toverride name = 'TransactionSignatureError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to sign transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The signature request may have been rejected by the user.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class NoWalletConnectedError extends TransactionError {\n\toverride name = 'NoWalletConnectedError';\n\tconstructor() {\n\t\tsuper('No wallet connected', {\n\t\t\tdetails: 'Please connect your wallet before attempting this transaction.',\n\t\t});\n\t}\n}\n\nexport class NoMarketplaceConfigError extends TransactionError {\n\toverride name = 'NoMarketplaceConfigError';\n\tconstructor() {\n\t\tsuper('Marketplace configuration not found', {\n\t\t\tdetails:\n\t\t\t\t'The marketplace configuration is missing or invalid. This could be due to an initialization error.',\n\t\t});\n\t}\n}\n\nexport class UserRejectedRequestError extends TransactionError {\n\toverride name = 'UserRejectedRequestError';\n\tconstructor() {\n\t\tsuper('User rejected the request', {\n\t\t\tdetails: 'The user cancelled or rejected the transaction request.',\n\t\t});\n\t}\n}\n\nexport class InsufficientFundsError extends TransactionError {\n\toverride name = 'InsufficientFundsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Insufficient funds for transaction', {\n\t\t\tdetails:\n\t\t\t\t'The wallet does not have enough funds to complete this transaction.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class SignatureExecutionError extends TransactionError {\n\toverride name = 'SignatureExecutionError';\n\tconstructor(signature: string, cause?: Error) {\n\t\tsuper(`Failed to execute signature: ${signature}`, {\n\t\t\tdetails: cause?.message || 'The execution of the signature failed.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepExecutionError extends TransactionError {\n\toverride name = 'StepExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute step ${stepId})`, {\n\t\t\tdetails: cause?.message || 'The step execution failed unexpectedly.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepGenerationError extends TransactionError {\n\toverride name = 'StepGenerationError';\n\tconstructor(transactionType: string, cause?: Error) {\n\t\tsuper(`Failed to generate steps for ${transactionType}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'Could not generate the required transaction steps.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalError extends TransactionError {\n\toverride name = 'PaymentModalError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Payment modal operation failed', {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'The payment modal operation was unsuccessful.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class InvalidStepError extends TransactionError {\n\toverride name = 'InvalidStepError';\n\tconstructor(stepId: string, reason: string) {\n\t\tsuper(`Invalid step configuration for ${stepId}`, {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class TransactionConfirmationError extends TransactionError {\n\toverride name = 'TransactionConfirmationError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to confirm transaction ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction could not be confirmed on the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrderNotFoundError extends TransactionError {\n\toverride name = 'OrderNotFoundError';\n\tconstructor(orderId: string) {\n\t\tsuper(`Order ${orderId} not found`, {\n\t\t\tdetails: 'The requested order could not be found in the marketplace.',\n\t\t});\n\t}\n}\n\nexport class MissingStepDataError extends TransactionError {\n\toverride name = 'MissingStepDataError';\n\tconstructor() {\n\t\tsuper('Step is missing required data', {\n\t\t\tdetails:\n\t\t\t\t'The transaction step is missing required \"to\" or \"signature\" data.',\n\t\t});\n\t}\n}\n\nexport class MissingSignatureDataError extends TransactionError {\n\toverride name = 'MissingSignatureDataError';\n\tconstructor() {\n\t\tsuper('Step is missing signature data', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required signature data configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidSignatureStepError extends TransactionError {\n\toverride name = 'InvalidSignatureStepError';\n\tconstructor(stepId: string) {\n\t\tsuper(`Invalid signature step type: ${stepId}`, {\n\t\t\tdetails: 'The signature step type is not supported.',\n\t\t});\n\t}\n}\n\nexport class MissingPostStepError extends TransactionError {\n\toverride name = 'MissingPostStepError';\n\tconstructor() {\n\t\tsuper('Missing post step configuration', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required post-step configuration.',\n\t\t});\n\t}\n}\n\nexport class UnexpectedStepsError extends TransactionError {\n\toverride name = 'UnexpectedStepsError';\n\tconstructor() {\n\t\tsuper('Unexpected steps found', {\n\t\t\tdetails: 'The transaction contains more steps than expected.',\n\t\t});\n\t}\n}\n\nexport class NoExecutionStepError extends TransactionError {\n\toverride name = 'NoExecutionStepError';\n\tconstructor() {\n\t\tsuper('No execution step found', {\n\t\t\tdetails: 'The transaction is missing the required execution step.',\n\t\t});\n\t}\n}\n\nexport class NoStepsFoundError extends TransactionError {\n\toverride name = 'NoStepsFoundError';\n\tconstructor() {\n\t\tsuper('No steps found', {\n\t\t\tdetails: 'The transaction contains no steps to execute.',\n\t\t});\n\t}\n}\n\nexport class UnknownTransactionTypeError extends TransactionError {\n\toverride name = 'UnknownTransactionTypeError';\n\tconstructor(type: string) {\n\t\tsuper(`Unknown transaction type: ${type}`, {\n\t\t\tdetails: 'The specified transaction type is not supported.',\n\t\t});\n\t}\n}\n\nexport class InvalidContractTypeError extends TransactionError {\n\toverride name = 'InvalidContractTypeError';\n\tconstructor(contractType: string | undefined) {\n\t\tsuper(`Invalid contract type: ${contractType}`, {\n\t\t\tdetails: 'The contract type must be either ERC721 or ERC1155.',\n\t\t});\n\t}\n}\n\nexport class CollectionNotFoundError extends TransactionError {\n\toverride name = 'CollectionNotFoundError';\n\tconstructor(collectionAddress: Address) {\n\t\tsuper(`Collection not found: ${collectionAddress}`, {\n\t\t\tdetails:\n\t\t\t\t'The specified collection address could not be found in the marketplace configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidCurrencyOptionsError extends TransactionError {\n\toverride name = 'InvalidCurrencyOptionsError';\n\tconstructor(currencyOptions: Address[]) {\n\t\tsuper(`Invalid currency options: ${currencyOptions.join(', ')}`, {\n\t\t\tdetails:\n\t\t\t\t'The currency options must be an array of valid currency contract addresses.',\n\t\t});\n\t}\n}\n\nexport class ProjectNotFoundError extends TransactionError {\n\toverride name = 'ProjectNotFoundError';\n\tconstructor(projectId: string, url: string) {\n\t\tsuper('Project not found', {\n\t\t\tdetails: `Project id: ${projectId} not found at ${url}`,\n\t\t});\n\t}\n}\n\nexport class MarketplaceConfigFetchError extends TransactionError {\n\toverride name = 'MarketplaceConfigFetchError';\n\tconstructor(message: string) {\n\t\tsuper('Failed to fetch marketplace config', {\n\t\t\tdetails: message,\n\t\t});\n\t}\n}\n\nexport class MissingConfigError extends TransactionError {\n\toverride name = 'MissingConfigError';\n\tconstructor(configName: string) {\n\t\tsuper(`Missing required config: ${configName}`, {\n\t\t\tdetails: 'A required configuration parameter is missing.',\n\t\t});\n\t}\n}\n\nexport class TransactionValidationError extends TransactionError {\n\toverride name = 'TransactionValidationError';\n\tconstructor(reason: string) {\n\t\tsuper('Transaction validation failed', {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class ChainIdUnavailableError extends TransactionError {\n\toverride name = 'ChainIdUnavailableError';\n\tconstructor() {\n\t\tsuper('Chain ID is not available', {\n\t\t\tdetails: 'Could not determine the current chain ID from the wallet.',\n\t\t});\n\t}\n}\n\nexport class TransactionReceiptError extends TransactionError {\n\toverride name = 'TransactionReceiptError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to get transaction receipt for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the transaction receipt from the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalTransactionError extends TransactionError {\n\toverride name = 'PaymentModalTransactionError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Payment modal transaction failed for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction initiated from the payment modal failed.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class CheckoutOptionsError extends TransactionError {\n\toverride name = 'CheckoutOptionsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Failed to get checkout options', {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the checkout options from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrdersFetchError extends TransactionError {\n\toverride name = 'OrdersFetchError';\n\tconstructor(orderId: string, cause?: Error) {\n\t\tsuper(`Failed to fetch order ${orderId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the order details from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class SalesContractError extends TransactionError {\n\toverride name = 'SalesContractError';\n\tconstructor(contractAddress: Address, method?: string, cause?: Error) {\n\t\tsuper(`Sales contract operation failed: ${contractAddress}`, {\n\t\t\tdetails: `Failed to interact with sales contract${\n\t\t\t\tmethod ? ` on method: ${method}` : ''\n\t\t\t}. ${cause?.message || 'Contract may be paused or misconfigured.'}`,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class QuantityValidationError extends TransactionError {\n\toverride name = 'QuantityValidationError';\n\tconstructor(provided: number, available: number, tokenId?: string) {\n\t\tsuper(`Invalid quantity: ${provided}`, {\n\t\t\tdetails: `Requested quantity (${provided}) exceeds available supply (${available})${\n\t\t\t\ttokenId ? ` for token ${tokenId}` : ''\n\t\t\t}.`,\n\t\t});\n\t}\n}\n\nexport class ShopDataValidationError extends TransactionError {\n\toverride name = 'ShopDataValidationError';\n\tconstructor(missingField: string) {\n\t\tsuper(`Invalid shop configuration: missing ${missingField}`, {\n\t\t\tdetails: `The shop is missing required field: ${missingField}. Check your marketplace configuration.`,\n\t\t});\n\t}\n}\n\nexport type TransactionErrorTypes =\n\t| ChainIdUnavailableError\n\t| TransactionReceiptError\n\t| PaymentModalTransactionError\n\t| CheckoutOptionsError\n\t| OrdersFetchError\n\t| TransactionConfirmationError\n\t| TransactionValidationError\n\t| MissingConfigError\n\t| MarketplaceConfigFetchError\n\t| ProjectNotFoundError\n\t| CollectionNotFoundError\n\t| InvalidCurrencyOptionsError\n\t| InvalidContractTypeError\n\t| UnknownTransactionTypeError\n\t| NoStepsFoundError\n\t| NoExecutionStepError\n\t| UnexpectedStepsError\n\t| MissingPostStepError\n\t| InvalidSignatureStepError\n\t| MissingSignatureDataError\n\t| MissingStepDataError\n\t| OrderNotFoundError\n\t| InvalidStepError\n\t| PaymentModalError\n\t| StepGenerationError\n\t| StepExecutionError\n\t| UserRejectedRequestError\n\t| NoMarketplaceConfigError\n\t| InsufficientFundsError\n\t| ChainSwitchUserRejectedError\n\t| ChainSwitchError\n\t| TransactionSignatureError\n\t| TransactionExecutionError\n\t| NoWalletConnectedError\n\t| TransactionError\n\t| SalesContractError\n\t| QuantityValidationError\n\t| ShopDataValidationError;\n"],"mappings":";AAQA,IAAa,YAAb,cAA+B,MAAM;CACpC;CACA;CAEA,OAAO;CAEP,YAAY,cAAsB,UAA4B,EAAE,EAAE;AACjE,SAAO;EAEP,MAAM,UAAU,aAAa,UAAU,QAAQ,UAAU;AACzD,OAAK,UAAU;GACd,gBAAgB;GAChB;GACA,GAAI,UAAU,CAAC,YAAY,UAAU,GAAG,EAAE;GAC1C,CAAC,KAAK,KAAK;AAEZ,MAAI,WAAW,WAAW,QAAQ,MACjC,MAAK,QAAQ,QAAQ;AAGtB,OAAK,UAAU,WAAW;AAC1B,OAAK,eAAe;;;;;;ACvBtB,IAAa,mBAAb,cAAsC,UAAU;CAC/C,AAAS,OAAO;;AAGjB,IAAa,mBAAb,cAAsC,iBAAiB;CACtD,AAAS,OAAO;CAChB,YAAY,gBAAwB,eAAuB;AAC1D,QACC,iCAAiC,eAAe,MAAM,iBACtD,EACC,SACC,iGACD,CACD;;;AAaH,IAAa,4BAAb,cAA+C,iBAAiB;CAC/D,AAAS,OAAO;CAChB,YAAY,QAAgB,OAAe;AAC1C,QAAM,uCAAuC,UAAU;GACtD,SACC,OAAO,WACP;GACD;GACA,CAAC;;;AAIJ,IAAa,4BAAb,cAA+C,iBAAiB;CAC/D,AAAS,OAAO;CAChB,YAAY,QAAgB,OAAe;AAC1C,QAAM,oCAAoC,UAAU;GACnD,SACC,OAAO,WACP;GACD;GACA,CAAC;;;AAIJ,IAAa,yBAAb,cAA4C,iBAAiB;CAC5D,AAAS,OAAO;CAChB,cAAc;AACb,QAAM,uBAAuB,EAC5B,SAAS,kEACT,CAAC;;;AAcJ,IAAa,2BAAb,cAA8C,iBAAiB;CAC9D,AAAS,OAAO;CAChB,cAAc;AACb,QAAM,6BAA6B,EAClC,SAAS,2DACT,CAAC;;;AAiNJ,IAAa,qBAAb,cAAwC,iBAAiB;CACxD,AAAS,OAAO;CAChB,YAAY,YAAoB;AAC/B,QAAM,4BAA4B,cAAc,EAC/C,SAAS,kDACT,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Image, Skeleton, Text } from "@0xsequence/design-system";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { formatDistanceToNow } from "date-fns";
|
|
4
|
+
|
|
5
|
+
//#region src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
6
|
+
function TransactionHeader({ title, currencyImageUrl, date }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8
|
+
className: "flex w-full items-center",
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ jsx(Text, {
|
|
11
|
+
className: "mr-1 font-body text-sm",
|
|
12
|
+
fontWeight: "medium",
|
|
13
|
+
color: "text80",
|
|
14
|
+
children: title
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ jsx(Image, {
|
|
17
|
+
className: "mr-1 h-3 w-3",
|
|
18
|
+
src: currencyImageUrl
|
|
19
|
+
}),
|
|
20
|
+
date && /* @__PURE__ */ jsxs(Text, {
|
|
21
|
+
className: "grow text-right font-body text-xs",
|
|
22
|
+
fontWeight: "medium",
|
|
23
|
+
color: "text50",
|
|
24
|
+
children: [formatDistanceToNow(date), " ago"]
|
|
25
|
+
}) || /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-8" })
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { TransactionHeader as t };
|
|
32
|
+
//# sourceMappingURL=transactionHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionHeader.js","names":[],"sources":["../src/react/ui/modals/_internal/components/transactionHeader/index.tsx"],"sourcesContent":["import { Image, Skeleton, Text } from '@0xsequence/design-system';\nimport { formatDistanceToNow } from 'date-fns';\n\ntype TransactionHeaderProps = {\n\ttitle: string;\n\tcurrencyImageUrl?: string;\n\tdate?: Date;\n};\n\nexport default function TransactionHeader({\n\ttitle,\n\tcurrencyImageUrl,\n\tdate,\n}: TransactionHeaderProps) {\n\treturn (\n\t\t<div className=\"flex w-full items-center\">\n\t\t\t<Text\n\t\t\t\tclassName=\"mr-1 font-body text-sm\"\n\t\t\t\tfontWeight=\"medium\"\n\t\t\t\tcolor=\"text80\"\n\t\t\t>\n\t\t\t\t{title}\n\t\t\t</Text>\n\t\t\t<Image className=\"mr-1 h-3 w-3\" src={currencyImageUrl} />\n\t\t\t{(date && (\n\t\t\t\t<Text\n\t\t\t\t\tclassName=\"grow text-right font-body text-xs\"\n\t\t\t\t\tfontWeight=\"medium\"\n\t\t\t\t\tcolor=\"text50\"\n\t\t\t\t>\n\t\t\t\t\t{formatDistanceToNow(date)} ago\n\t\t\t\t</Text>\n\t\t\t)) || <Skeleton className=\"h-4 w-8\" />}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AASA,SAAwB,kBAAkB,EACzC,OACA,kBACA,QAC0B;AAC1B,QACC,qBAAC;EAAI,WAAU;;GACd,oBAAC;IACA,WAAU;IACV,YAAW;IACX,OAAM;cAEL;KACK;GACP,oBAAC;IAAM,WAAU;IAAe,KAAK;KAAoB;GACvD,QACD,qBAAC;IACA,WAAU;IACV,YAAW;IACX,OAAM;eAEL,oBAAoB,KAAK,EAAC;KACrB,IACF,oBAAC,YAAS,WAAU,YAAY;;GACjC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Bt as AdditionalFee, Gt as CollectiblesFilter, Ht as CheckoutOptions, J as MarketplaceWallet, K as MarketplaceCollection, Kt as Collection, Mt as TokenBalance$1, Q as OrderData, Sn as TransactionCrypto, Tn as FilterCondition, U as MarketCollection, W as MarketPage, Wt as Collectible, Z as Order, _n as PropertyType, bn as StepType, c as CreateReq, cn as OrderSide, et as ShopCollection, fn as Page, ft as Filter, gn as PropertyFilter, i as CollectibleOrder, in as MarketplaceKind, it as Step, l as Currency, ln as OrderStatus, mn as PriceFilter, n as CheckoutOptionsItem, nt as Signature, pn as PostRequest, qt as CollectionStatus, s as ContractType, sn as OrderFilter, tt as ShopPage, un as OrderbookKind, ut as ContractInfo$1, vn as SortBy, wn as WalletKind, yn as SortOrder, yt as TokenMetadata$1 } from "../index2.js";
|
|
2
|
+
import { Dt as fetchMarketplaceConfig, Ot as marketplaceConfigOptions, _ as Price, a as CheckoutMode, c as SdkConfig, d as CollectionFilterSettings, f as EcosystemWalletSettings, g as MetadataFilterRule, h as MarketplaceWalletWaasSettings, i as ApiConfig, l as CardType, m as MarketplaceWalletOptions, o as Env, p as MarketplaceConfig, r as TransactionType, s as MarketplaceSdkContext, u as CollectibleCardAction, v as isMarketCollection, y as isShopCollection } from "../create-config.js";
|
|
3
|
+
import "../xstate-store.cjs.js";
|
|
4
|
+
import "../index3.js";
|
|
5
|
+
export { AdditionalFee, ApiConfig, CardType, CheckoutMode, CheckoutOptions, CheckoutOptionsItem, Collectible, CollectibleCardAction, CollectibleOrder, CollectiblesFilter, Collection, CollectionFilterSettings, CollectionStatus, ContractInfo$1 as ContractInfo, ContractType, CreateReq, Currency, EcosystemWalletSettings, Env, Filter, FilterCondition, TokenBalance$1 as IndexerTokenBalance, MarketCollection, MarketPage, MarketplaceCollection, MarketplaceConfig, MarketplaceKind, MarketplaceSdkContext, MarketplaceWallet, MarketplaceWalletOptions, MarketplaceWalletWaasSettings, MetadataFilterRule, Order, OrderData, OrderFilter, OrderSide, OrderStatus, OrderbookKind, Page, PostRequest, Price, PriceFilter, PropertyFilter, PropertyType, SdkConfig, ShopCollection, ShopPage, Signature, SortBy, SortOrder, Step, StepType, TokenMetadata$1 as TokenMetadata, TransactionCrypto, TransactionType, WalletKind, fetchMarketplaceConfig, isMarketCollection, isShopCollection, marketplaceConfigOptions };
|
package/dist/types/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as CollectibleCardAction } from "../types.js";
|
|
1
|
+
import { C as FilterCondition, S as WalletKind, _ as PropertyType, b as TransactionCrypto, c as CollectionStatus, d as MarketplaceKind, g as OrderbookKind, h as OrderStatus, m as OrderSide, t as ContractType, v as SortOrder, y as StepType } from "../dist.js";
|
|
2
|
+
import { i as TransactionType, n as isMarketCollection, r as isShopCollection, t as CollectibleCardAction } from "../types.js";
|
|
4
3
|
|
|
5
|
-
export { CollectibleCardAction,
|
|
4
|
+
export { CollectibleCardAction, CollectionStatus, ContractType, FilterCondition, MarketplaceKind, OrderSide, OrderStatus, OrderbookKind, PropertyType, SortOrder, StepType, TransactionCrypto, TransactionType, WalletKind, isMarketCollection, isShopCollection };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,36 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Address } from "viem";
|
|
1
|
+
import { Ft as Address$1, Z as Order, i as CollectibleOrder, s as ContractType, xn as TokenMetadata } from "./index2.js";
|
|
2
|
+
import { l as CardType, u as CollectibleCardAction } from "./create-config.js";
|
|
4
3
|
|
|
5
4
|
//#region src/react/ui/components/marketplace-collectible-card/types.d.ts
|
|
5
|
+
type CardClassNames = {
|
|
6
|
+
cardRoot?: string;
|
|
7
|
+
cardMedia?: string;
|
|
8
|
+
cardContent?: string;
|
|
9
|
+
cardTitle?: string;
|
|
10
|
+
cardPrice?: string;
|
|
11
|
+
cardBadge?: string;
|
|
12
|
+
cardFooter?: string;
|
|
13
|
+
cardActionButton?: string;
|
|
14
|
+
cardSaleDetails?: string;
|
|
15
|
+
cardSkeleton?: string;
|
|
16
|
+
};
|
|
6
17
|
type MarketplaceCardBaseProps = {
|
|
7
|
-
|
|
18
|
+
tokenId: bigint;
|
|
8
19
|
chainId: number;
|
|
9
|
-
collectionAddress: Address;
|
|
20
|
+
collectionAddress: Address$1;
|
|
10
21
|
collectionType?: ContractType;
|
|
11
22
|
assetSrcPrefixUrl?: string;
|
|
12
23
|
cardLoading: boolean;
|
|
13
24
|
cardType?: CardType;
|
|
25
|
+
classNames?: CardClassNames;
|
|
14
26
|
hideQuantitySelector?: boolean;
|
|
15
27
|
};
|
|
16
28
|
type ShopCardSpecificProps = {
|
|
17
|
-
salesContractAddress: Address;
|
|
18
|
-
tokenMetadata: TokenMetadata
|
|
29
|
+
salesContractAddress: Address$1;
|
|
30
|
+
tokenMetadata: Pick<TokenMetadata, 'name' | 'image' | 'video' | 'animation_url'>;
|
|
19
31
|
salePrice: {
|
|
20
|
-
amount:
|
|
21
|
-
currencyAddress: Address;
|
|
32
|
+
amount: bigint;
|
|
33
|
+
currencyAddress: Address$1;
|
|
22
34
|
} | undefined;
|
|
23
35
|
saleStartsAt: string | undefined;
|
|
24
36
|
saleEndsAt: string | undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
quantityRemaining: string | undefined;
|
|
37
|
+
quantityInitial: bigint | undefined;
|
|
38
|
+
quantityRemaining: bigint | undefined;
|
|
28
39
|
unlimitedSupply?: boolean;
|
|
29
40
|
};
|
|
30
41
|
type MarketCardSpecificProps = {
|
|
31
|
-
orderbookKind?: OrderbookKind;
|
|
32
42
|
collectible: CollectibleOrder | undefined;
|
|
33
|
-
onCollectibleClick?: (tokenId:
|
|
43
|
+
onCollectibleClick?: (tokenId: bigint) => void;
|
|
34
44
|
onOfferClick?: ({
|
|
35
45
|
order,
|
|
36
46
|
e
|
|
@@ -60,7 +70,7 @@ type MarketCardSpecificProps = {
|
|
|
60
70
|
type NonTradableInventoryCardSpecificProps = {
|
|
61
71
|
balance: string;
|
|
62
72
|
balanceIsLoading: boolean;
|
|
63
|
-
collectibleMetadata: TokenMetadata
|
|
73
|
+
collectibleMetadata: Pick<TokenMetadata, 'name' | 'image' | 'video' | 'animation_url'>;
|
|
64
74
|
};
|
|
65
75
|
type MarketplaceCollectibleCardProps = MarketplaceCardBaseProps & Partial<MarketCardSpecificProps & ShopCardSpecificProps>;
|
|
66
76
|
type ShopCollectibleCardProps = MarketplaceCardBaseProps & ShopCardSpecificProps & {
|
|
@@ -74,5 +84,5 @@ type NonTradableInventoryCardProps = MarketplaceCardBaseProps & NonTradableInven
|
|
|
74
84
|
};
|
|
75
85
|
type CollectibleCardProps = ShopCollectibleCardProps | MarketCollectibleCardProps | NonTradableInventoryCardProps;
|
|
76
86
|
//#endregion
|
|
77
|
-
export {
|
|
87
|
+
export { MarketplaceCardBaseProps as a, ShopCardSpecificProps as c, MarketCollectibleCardProps as i, ShopCollectibleCardProps as l, CollectibleCardProps as n, MarketplaceCollectibleCardProps as o, MarketCardSpecificProps as r, NonTradableInventoryCardProps as s, CardClassNames as t };
|
|
78
88
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
+
//#region src/types/transactions.ts
|
|
2
|
+
/**
|
|
3
|
+
* Transaction modes for the buy modal
|
|
4
|
+
* Used to distinguish between secondary market purchases and primary sales (minting)
|
|
5
|
+
*/
|
|
6
|
+
let TransactionType = /* @__PURE__ */ function(TransactionType$1) {
|
|
7
|
+
/** Secondary market purchases from existing orders */
|
|
8
|
+
TransactionType$1["MARKET_BUY"] = "MARKET_BUY";
|
|
9
|
+
/** Primary sales - direct from creator/contract (minting/shop) */
|
|
10
|
+
TransactionType$1["PRIMARY_SALE"] = "PRIMARY_SALE";
|
|
11
|
+
return TransactionType$1;
|
|
12
|
+
}({});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
1
15
|
//#region src/types/types.ts
|
|
16
|
+
/**
|
|
17
|
+
* Type guard to check if a collection is a ShopCollection
|
|
18
|
+
* Shop collections are for primary sales
|
|
19
|
+
*/
|
|
20
|
+
function isShopCollection(collection) {
|
|
21
|
+
return collection.marketplaceCollectionType === "shop";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Type guard to check if a collection is a MarketCollection
|
|
25
|
+
* Market collections are for secondary market trading
|
|
26
|
+
*/
|
|
27
|
+
function isMarketCollection(collection) {
|
|
28
|
+
return collection.marketplaceCollectionType === "market";
|
|
29
|
+
}
|
|
2
30
|
let CollectibleCardAction = /* @__PURE__ */ function(CollectibleCardAction$1) {
|
|
3
31
|
CollectibleCardAction$1["BUY"] = "Buy";
|
|
4
32
|
CollectibleCardAction$1["SELL"] = "Sell";
|
|
@@ -9,5 +37,5 @@ let CollectibleCardAction = /* @__PURE__ */ function(CollectibleCardAction$1) {
|
|
|
9
37
|
}({});
|
|
10
38
|
|
|
11
39
|
//#endregion
|
|
12
|
-
export { CollectibleCardAction as t };
|
|
40
|
+
export { TransactionType as i, isMarketCollection as n, isShopCollection as r, CollectibleCardAction as t };
|
|
13
41
|
//# sourceMappingURL=types.js.map
|