@0xsequence/marketplace-sdk 0.5.2 → 0.5.3

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.
Files changed (165) hide show
  1. package/dist/builder-types-wOwfTJpd.d.ts +73 -0
  2. package/dist/{chunk-FCF57DZI.js → chunk-7FN62HOP.js} +5 -9
  3. package/dist/chunk-7FN62HOP.js.map +1 -0
  4. package/dist/{chunk-MSTTVFVQ.js → chunk-BVXIRVEC.js} +251 -241
  5. package/dist/chunk-BVXIRVEC.js.map +1 -0
  6. package/dist/{chunk-XP3WY5AX.js → chunk-BZD2LDJJ.js} +2 -2
  7. package/dist/{chunk-XP3WY5AX.js.map → chunk-BZD2LDJJ.js.map} +1 -1
  8. package/dist/chunk-DZKPDV63.js +27 -0
  9. package/dist/chunk-DZKPDV63.js.map +1 -0
  10. package/dist/{chunk-I37CRQ4S.js → chunk-H5YWG6WN.js} +128 -88
  11. package/dist/chunk-H5YWG6WN.js.map +1 -0
  12. package/dist/{chunk-ZUEQGPLO.js → chunk-J6F5QOW5.js} +2 -2
  13. package/dist/{chunk-ZUEQGPLO.js.map → chunk-J6F5QOW5.js.map} +1 -1
  14. package/dist/{chunk-LJAB3S6U.js → chunk-TFRAOS7F.js} +22 -13
  15. package/dist/chunk-TFRAOS7F.js.map +1 -0
  16. package/dist/{chunk-5NORRVPM.js → chunk-UZIAX32Y.js} +1 -1
  17. package/dist/{chunk-5NORRVPM.js.map → chunk-UZIAX32Y.js.map} +1 -1
  18. package/dist/{chunk-MKGSGTQC.js → chunk-Y7YTLAO2.js} +3 -3
  19. package/dist/{create-config-BXvwUh55.d.ts → create-config-Bltg8Enl.d.ts} +1 -1
  20. package/dist/index.css +1 -1
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +10 -6
  23. package/dist/react/_internal/index.d.ts +3 -3
  24. package/dist/react/_internal/index.js +6 -6
  25. package/dist/react/_internal/wagmi/index.d.ts +2 -3
  26. package/dist/react/_internal/wagmi/index.js +1 -1
  27. package/dist/react/hooks/index.d.ts +72 -20
  28. package/dist/react/hooks/index.js +5 -7
  29. package/dist/react/index.css +1 -1
  30. package/dist/react/index.css.map +1 -1
  31. package/dist/react/index.d.ts +4 -4
  32. package/dist/react/index.js +10 -12
  33. package/dist/react/ssr/index.d.ts +54 -41
  34. package/dist/react/ssr/index.js +5 -9
  35. package/dist/react/ssr/index.js.map +1 -1
  36. package/dist/react/ui/components/collectible-card/index.css +1 -1
  37. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  38. package/dist/react/ui/components/collectible-card/index.d.ts +2 -2
  39. package/dist/react/ui/components/collectible-card/index.js +8 -8
  40. package/dist/react/ui/index.css +1 -1
  41. package/dist/react/ui/index.css.map +1 -1
  42. package/dist/react/ui/index.d.ts +2 -2
  43. package/dist/react/ui/index.js +8 -8
  44. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
  45. package/dist/react/ui/modals/_internal/components/actionModal/index.js +6 -6
  46. package/dist/react/ui/styles/index.d.ts +1 -1
  47. package/dist/styles/index.css +1 -1
  48. package/dist/styles/index.css.map +1 -1
  49. package/dist/styles/index.d.ts +1 -1
  50. package/dist/styles/index.js +1 -1
  51. package/dist/types/index.d.ts +1 -3
  52. package/dist/types/index.js +9 -5
  53. package/dist/{types-Yto6KrTN.d.ts → types-BY3husBh.d.ts} +1 -1
  54. package/dist/utils/index.d.ts +2 -2
  55. package/dist/utils/index.js +4 -4
  56. package/package.json +11 -10
  57. package/src/react/_internal/api/__mocks__/indexer.msw.ts +197 -0
  58. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +140 -1
  59. package/src/react/_internal/api/__mocks__/metadata.msw.ts +162 -0
  60. package/src/react/_internal/test/mocks/publicClient.ts +39 -0
  61. package/src/react/_internal/test/mocks/wagmi.ts +61 -0
  62. package/src/react/_internal/test/mocks/wallet.ts +61 -0
  63. package/src/react/_internal/test/setup.ts +28 -0
  64. package/src/react/_internal/test-utils.tsx +31 -2
  65. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +53 -20
  66. package/src/react/_internal/wagmi/create-config.ts +3 -4
  67. package/src/react/_internal/wagmi/embedded.ts +1 -4
  68. package/src/react/_internal/wagmi/universal.ts +1 -4
  69. package/src/react/_internal/wallet/wallet.ts +1 -0
  70. package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +314 -0
  71. package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +148 -0
  72. package/src/react/hooks/__tests__/useCancelOrder.test.tsx +410 -0
  73. package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +269 -0
  74. package/src/react/hooks/__tests__/useCollectible.test.tsx +120 -0
  75. package/src/react/hooks/__tests__/useCollection.test.tsx +101 -0
  76. package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +175 -0
  77. package/src/react/hooks/__tests__/useCollectionDetails.test.tsx +82 -0
  78. package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +133 -0
  79. package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +108 -0
  80. package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +129 -0
  81. package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +108 -0
  82. package/src/react/hooks/__tests__/useCurrencies.test.tsx +176 -0
  83. package/src/react/hooks/__tests__/useCurrency.test.tsx +153 -0
  84. package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +111 -0
  85. package/src/react/hooks/__tests__/useFilters.test.tsx +127 -0
  86. package/src/react/hooks/__tests__/useFloorOrder.test.tsx +101 -0
  87. package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +173 -0
  88. package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +207 -0
  89. package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +207 -0
  90. package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +205 -0
  91. package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +181 -0
  92. package/src/react/hooks/__tests__/useHighestOffer.test.tsx +118 -0
  93. package/src/react/hooks/__tests__/useListBalances.test.tsx +136 -0
  94. package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +200 -0
  95. package/src/react/hooks/__tests__/useListCollectibles.test.tsx +232 -0
  96. package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +235 -0
  97. package/src/react/hooks/__tests__/useListCollections.test.tsx +296 -0
  98. package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +140 -0
  99. package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +140 -0
  100. package/src/react/hooks/__tests__/useLowestListing.test.tsx +148 -0
  101. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +106 -0
  102. package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +129 -0
  103. package/src/react/hooks/index.ts +0 -1
  104. package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +66 -10
  105. package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +2 -11
  106. package/src/react/hooks/options/marketplaceConfigOptions.ts +8 -3
  107. package/src/react/hooks/useAutoSelectFeeOption.tsx +4 -3
  108. package/src/react/hooks/useCancelTransactionSteps.tsx +17 -9
  109. package/src/react/hooks/useCollectionDetailsPolling.tsx +1 -1
  110. package/src/react/hooks/useCurrencies.tsx +29 -28
  111. package/src/react/hooks/useFilters.tsx +69 -2
  112. package/src/react/hooks/useGenerateBuyTransaction.tsx +13 -5
  113. package/src/react/hooks/useListCollectibleActivities.tsx +1 -0
  114. package/src/react/hooks/useListCollectibles.tsx +1 -0
  115. package/src/react/hooks/useListCollectionActivities.tsx +1 -0
  116. package/src/react/hooks/useListCollections.tsx +2 -2
  117. package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +6 -2
  118. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +1 -1
  119. package/src/react/ui/components/collectible-card/Footer.tsx +9 -5
  120. package/src/react/ui/modals/BuyModal/Modal.tsx +9 -4
  121. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +0 -1
  122. package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +4 -2
  123. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +1 -24
  124. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +152 -210
  125. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +19 -49
  126. package/src/react/ui/modals/BuyModal/hooks/useFees.ts +6 -6
  127. package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +4 -2
  128. package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +161 -52
  129. package/src/react/ui/modals/BuyModal/store.ts +7 -0
  130. package/src/react/ui/modals/CreateListingModal/Modal.tsx +1 -3
  131. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +59 -227
  132. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +2 -1
  133. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +9 -5
  134. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +1 -8
  135. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +41 -118
  136. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +2 -1
  137. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +9 -5
  138. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +4 -3
  139. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +33 -31
  140. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +1 -0
  141. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +9 -5
  142. package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +0 -1
  143. package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +4 -2
  144. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +129 -57
  145. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +1 -3
  146. package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -3
  147. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
  148. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +8 -8
  149. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +1 -0
  150. package/src/types/builder-types.ts +79 -0
  151. package/src/types/index.ts +1 -1
  152. package/src/utils/__tests__/get-public-rpc-client.test.ts +2 -0
  153. package/src/utils/getMarketplaceDetails.ts +2 -2
  154. package/tsconfig.tsbuildinfo +1 -1
  155. package/vitest.config.js +2 -1
  156. package/dist/chunk-FCF57DZI.js.map +0 -1
  157. package/dist/chunk-I37CRQ4S.js.map +0 -1
  158. package/dist/chunk-LJAB3S6U.js.map +0 -1
  159. package/dist/chunk-MSTTVFVQ.js.map +0 -1
  160. package/dist/chunk-RK6KYMZM.js +0 -18
  161. package/dist/chunk-RK6KYMZM.js.map +0 -1
  162. package/dist/marketplace-config-znEu4L0K.d.ts +0 -60
  163. package/src/react/hooks/useCurrencyOptions.tsx +0 -16
  164. package/src/types/marketplace-config.ts +0 -67
  165. /package/dist/{chunk-MKGSGTQC.js.map → chunk-Y7YTLAO2.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  ActionModal,
4
4
  CustomSelect,
5
5
  useCurrencyBalance
6
- } from "./chunk-MKGSGTQC.js";
6
+ } from "./chunk-Y7YTLAO2.js";
7
7
  import {
8
8
  CalendarIcon_default,
9
9
  MinusIcon_default,
@@ -33,7 +33,7 @@ import {
33
33
  quantityInputWrapper,
34
34
  tokenPreview,
35
35
  transferModalContent
36
- } from "./chunk-5NORRVPM.js";
36
+ } from "./chunk-UZIAX32Y.js";
37
37
  import {
38
38
  AlertMessage,
39
39
  dateToUnixTime,
@@ -44,7 +44,6 @@ import {
44
44
  useConfig,
45
45
  useCurrencies,
46
46
  useCurrency,
47
- useCurrencyOptions,
48
47
  useGenerateListingTransaction,
49
48
  useGenerateOfferTransaction,
50
49
  useGenerateSellTransaction,
@@ -55,14 +54,14 @@ import {
55
54
  useSwitchChainModal,
56
55
  useTransferTokens,
57
56
  useWallet
58
- } from "./chunk-I37CRQ4S.js";
57
+ } from "./chunk-H5YWG6WN.js";
59
58
  import {
60
59
  iconVariants
61
60
  } from "./chunk-TQWM4ER6.js";
62
61
  import {
63
62
  calculatePriceDifferencePercentage,
64
63
  truncateMiddle
65
- } from "./chunk-XP3WY5AX.js";
64
+ } from "./chunk-BZD2LDJJ.js";
66
65
  import {
67
66
  getProviderEl
68
67
  } from "./chunk-YOKGP2EQ.js";
@@ -837,7 +836,8 @@ var useTransactionSteps = ({
837
836
  if (!transactionStep && !signatureStep) {
838
837
  throw new Error("No transaction or signature step found");
839
838
  }
840
- let hash, orderId;
839
+ let hash;
840
+ let orderId;
841
841
  if (transactionStep) {
842
842
  hash = await executeTransaction({ transactionStep });
843
843
  }
@@ -925,7 +925,7 @@ var useMakeOffer = ({
925
925
  }) => {
926
926
  const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
927
927
  const collectionConfig = marketplaceConfig?.collections.find(
928
- (c) => c.collectionAddress === collectionAddress
928
+ (c) => c.address === collectionAddress
929
929
  );
930
930
  orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
931
931
  const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData({
@@ -963,7 +963,7 @@ var useMakeOffer = ({
963
963
  };
964
964
 
965
965
  // src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
966
- import { Box as Box4 } from "@0xsequence/design-system";
966
+ import { Box as Box4, Text as Text5 } from "@0xsequence/design-system";
967
967
  import { jsx as jsx5 } from "react/jsx-runtime";
968
968
  var ErrorModal = ({
969
969
  isOpen,
@@ -987,7 +987,7 @@ var ErrorModal = ({
987
987
  justifyContent: "center",
988
988
  alignItems: "center",
989
989
  padding: "4",
990
- children: message || "Error loading item details"
990
+ children: /* @__PURE__ */ jsx5(Text5, { color: "text80", fontFamily: "body", children: message || "Error loading item details" })
991
991
  }
992
992
  )
993
993
  }
@@ -1024,7 +1024,7 @@ var LoadingModal = ({
1024
1024
  );
1025
1025
 
1026
1026
  // src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
1027
- import { Box as Box6, Skeleton as Skeleton3, Text as Text5 } from "@0xsequence/design-system";
1027
+ import { Box as Box6, Skeleton as Skeleton3, Text as Text6 } from "@0xsequence/design-system";
1028
1028
  import { observer as observer2 } from "@legendapp/state/react";
1029
1029
  import { addDays } from "date-fns";
1030
1030
 
@@ -1175,7 +1175,7 @@ var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
1175
1175
  }
1176
1176
  return /* @__PURE__ */ jsxs5(Box6, { width: "full", position: "relative", children: [
1177
1177
  /* @__PURE__ */ jsx9(
1178
- Text5,
1178
+ Text6,
1179
1179
  {
1180
1180
  fontSize: "small",
1181
1181
  fontWeight: "medium",
@@ -1235,7 +1235,7 @@ var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
1235
1235
  var expirationDateSelect_default = ExpirationDateSelect;
1236
1236
 
1237
1237
  // src/react/ui/modals/_internal/components/floorPriceText/index.tsx
1238
- import { Text as Text6 } from "@0xsequence/design-system";
1238
+ import { Text as Text7 } from "@0xsequence/design-system";
1239
1239
  import { jsx as jsx10 } from "react/jsx-runtime";
1240
1240
  function FloorPriceText({
1241
1241
  chainId,
@@ -1262,7 +1262,7 @@ function FloorPriceText({
1262
1262
  });
1263
1263
  const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
1264
1264
  return /* @__PURE__ */ jsx10(
1265
- Text6,
1265
+ Text7,
1266
1266
  {
1267
1267
  fontSize: "small",
1268
1268
  fontWeight: "medium",
@@ -1276,7 +1276,7 @@ function FloorPriceText({
1276
1276
  }
1277
1277
 
1278
1278
  // src/react/ui/modals/_internal/components/priceInput/index.tsx
1279
- import { Box as Box8, NumericInput, Text as Text7 } from "@0xsequence/design-system";
1279
+ import { Box as Box8, NumericInput, Text as Text8 } from "@0xsequence/design-system";
1280
1280
  import { parseUnits } from "viem";
1281
1281
  import { useAccount } from "wagmi";
1282
1282
 
@@ -1338,10 +1338,9 @@ var CurrencyOptionsSelect = observer3(function CurrencyOptionsSelect2({
1338
1338
  includeNativeCurrency
1339
1339
  }) {
1340
1340
  const currency = selectedCurrency$.get();
1341
- const currencyOptions = useCurrencyOptions({ collectionAddress });
1342
1341
  const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
1343
1342
  chainId,
1344
- currencyOptions,
1343
+ collectionAddress,
1345
1344
  includeNativeCurrency
1346
1345
  });
1347
1346
  useEffect4(() => {
@@ -1458,7 +1457,7 @@ function PriceInput({
1458
1457
  }
1459
1458
  ),
1460
1459
  balanceError && /* @__PURE__ */ jsx13(
1461
- Text7,
1460
+ Text8,
1462
1461
  {
1463
1462
  color: "negative",
1464
1463
  fontSize: "xsmall",
@@ -1586,7 +1585,7 @@ function QuantityInput({
1586
1585
  }
1587
1586
 
1588
1587
  // src/react/ui/modals/_internal/components/tokenPreview/index.tsx
1589
- import { Box as Box10, Image as Image2, Skeleton as Skeleton5, Text as Text8 } from "@0xsequence/design-system";
1588
+ import { Box as Box10, Image as Image2, Skeleton as Skeleton5, Text as Text9 } from "@0xsequence/design-system";
1590
1589
  import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
1591
1590
  function TokenPreview({
1592
1591
  collectionName,
@@ -1622,7 +1621,7 @@ function TokenPreview({
1622
1621
  ),
1623
1622
  /* @__PURE__ */ jsxs8(Box10, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
1624
1623
  /* @__PURE__ */ jsx15(
1625
- Text8,
1624
+ Text9,
1626
1625
  {
1627
1626
  fontSize: "small",
1628
1627
  color: "text80",
@@ -1632,7 +1631,7 @@ function TokenPreview({
1632
1631
  }
1633
1632
  ),
1634
1633
  /* @__PURE__ */ jsx15(
1635
- Text8,
1634
+ Text9,
1636
1635
  {
1637
1636
  fontSize: "small",
1638
1637
  fontWeight: "bold",
@@ -1739,14 +1738,12 @@ var Modal2 = observer4(() => {
1739
1738
  chainId,
1740
1739
  collectionAddress
1741
1740
  });
1742
- const currencyOptions = useCurrencyOptions({ collectionAddress });
1743
1741
  const {
1744
1742
  data: currencies,
1745
1743
  isLoading: currenciesLoading,
1746
1744
  isError: currenciesIsError
1747
1745
  } = useCurrencies({
1748
1746
  chainId,
1749
- currencyOptions,
1750
1747
  includeNativeCurrency: false
1751
1748
  });
1752
1749
  const { isLoading, executeApproval, makeOffer } = useMakeOffer({
@@ -1881,7 +1878,7 @@ import { Show as Show2, observer as observer5 } from "@legendapp/state/react";
1881
1878
  import { parseUnits as parseUnits3 } from "viem";
1882
1879
 
1883
1880
  // src/react/ui/modals/_internal/components/transactionDetails/index.tsx
1884
- import { Box as Box11, Image as Image3, Skeleton as Skeleton6, Text as Text9 } from "@0xsequence/design-system";
1881
+ import { Box as Box11, Image as Image3, Skeleton as Skeleton6, Text as Text10 } from "@0xsequence/design-system";
1885
1882
  import { formatUnits as formatUnits3 } from "viem";
1886
1883
  import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
1887
1884
  var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
@@ -1895,8 +1892,8 @@ function TransactionDetails({
1895
1892
  }) {
1896
1893
  const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
1897
1894
  const marketplaceFeePercentage = data?.collections.find(
1898
- (collection) => collection.collectionAddress === collectionAddress
1899
- )?.marketplaceFeePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
1895
+ (collection) => collection.address === collectionAddress
1896
+ )?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
1900
1897
  const { data: royaltyPercentage, isLoading: royaltyPercentageLoading } = useRoyaltyPercentage({
1901
1898
  chainId,
1902
1899
  collectionAddress,
@@ -1918,10 +1915,10 @@ function TransactionDetails({
1918
1915
  justifyContent: "space-between",
1919
1916
  alignItems: "center",
1920
1917
  children: [
1921
- /* @__PURE__ */ jsx17(Text9, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
1918
+ /* @__PURE__ */ jsx17(Text10, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
1922
1919
  /* @__PURE__ */ jsxs10(Box11, { display: "flex", alignItems: "center", gap: "2", children: [
1923
1920
  /* @__PURE__ */ jsx17(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
1924
- priceLoading ? /* @__PURE__ */ jsx17(Skeleton6, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs10(Text9, { fontSize: "small", color: "text100", fontFamily: "body", children: [
1921
+ priceLoading ? /* @__PURE__ */ jsx17(Skeleton6, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs10(Text10, { fontSize: "small", color: "text100", fontFamily: "body", children: [
1925
1922
  showPlaceholderPrice ? "0" : formattedAmount,
1926
1923
  " ",
1927
1924
  price.currency.symbol
@@ -1933,7 +1930,7 @@ function TransactionDetails({
1933
1930
  }
1934
1931
 
1935
1932
  // src/react/ui/modals/_internal/components/transactionHeader/index.tsx
1936
- import { Box as Box12, Image as Image4, Skeleton as Skeleton7, Text as Text10 } from "@0xsequence/design-system";
1933
+ import { Box as Box12, Image as Image4, Skeleton as Skeleton7, Text as Text11 } from "@0xsequence/design-system";
1937
1934
  import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
1938
1935
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
1939
1936
  function TransactionHeader({
@@ -1943,7 +1940,7 @@ function TransactionHeader({
1943
1940
  }) {
1944
1941
  return /* @__PURE__ */ jsxs11(Box12, { display: "flex", alignItems: "center", width: "full", children: [
1945
1942
  /* @__PURE__ */ jsx18(
1946
- Text10,
1943
+ Text11,
1947
1944
  {
1948
1945
  fontSize: "small",
1949
1946
  fontWeight: "medium",
@@ -1955,7 +1952,7 @@ function TransactionHeader({
1955
1952
  ),
1956
1953
  /* @__PURE__ */ jsx18(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
1957
1954
  date && /* @__PURE__ */ jsxs11(
1958
- Text10,
1955
+ Text11,
1959
1956
  {
1960
1957
  fontSize: "small",
1961
1958
  color: "text50",
@@ -2008,7 +2005,7 @@ var initialState3 = {
2008
2005
  var sellModal$ = observable3(initialState3);
2009
2006
 
2010
2007
  // src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx
2011
- import { useQuery as useQuery3 } from "@tanstack/react-query";
2008
+ import { skipToken as skipToken3, useQuery as useQuery3 } from "@tanstack/react-query";
2012
2009
 
2013
2010
  // src/react/ui/modals/BuyModal/hooks/useFees.ts
2014
2011
  import { avalanche, optimism } from "viem/chains";
@@ -2021,15 +2018,13 @@ var useFees = ({
2021
2018
  const avalancheAndOptimismPlatformFeeRecipient = "0x400cdab4676c17aec07e8ec748a5fc3b674bca41";
2022
2019
  const { data: marketplaceConfig } = useMarketplaceConfig();
2023
2020
  const collection = marketplaceConfig?.collections.find(
2024
- (collection2) => collection2.collectionAddress.toLowerCase() === collectionAddress.toLowerCase() && chainId === Number(collection2.chainId)
2021
+ (collection2) => collection2.address.toLowerCase() === collectionAddress.toLowerCase() && chainId === Number(collection2.chainId)
2025
2022
  );
2026
2023
  const avalancheOrOptimism = chainId === avalanche.id || chainId === optimism.id;
2027
2024
  const receiver = avalancheOrOptimism ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
2028
2025
  const percentageToBPS = (percentage) => Number(percentage) * 1e4 / 100;
2029
2026
  return {
2030
- amount: percentageToBPS(
2031
- collection?.marketplaceFeePercentage || defaultFee
2032
- ).toString(),
2027
+ amount: percentageToBPS(collection?.feePercentage || defaultFee).toString(),
2033
2028
  receiver
2034
2029
  };
2035
2030
  };
@@ -2045,7 +2040,7 @@ var useGetTokenApprovalData2 = (params) => {
2045
2040
  });
2046
2041
  const { data, isLoading, isSuccess } = useQuery3({
2047
2042
  queryKey: ["token-approval-data", params.ordersData],
2048
- queryFn: async () => {
2043
+ queryFn: wallet ? async () => {
2049
2044
  const address = await wallet.address();
2050
2045
  const args = {
2051
2046
  collectionAddress: params.collectionAddress,
@@ -2072,7 +2067,7 @@ var useGetTokenApprovalData2 = (params) => {
2072
2067
  return {
2073
2068
  step: tokenApprovalStep
2074
2069
  };
2075
- },
2070
+ } : skipToken3,
2076
2071
  enabled: !!wallet && !!params.collectionAddress
2077
2072
  });
2078
2073
  return {
@@ -2165,7 +2160,8 @@ var useTransactionSteps2 = ({
2165
2160
  if (!transactionStep && !signatureStep) {
2166
2161
  throw new Error("No transaction or signature step found");
2167
2162
  }
2168
- let hash, orderId;
2163
+ let hash;
2164
+ let orderId;
2169
2165
  if (transactionStep) {
2170
2166
  hash = await executeTransaction({ transactionStep });
2171
2167
  }
@@ -2409,7 +2405,7 @@ import {
2409
2405
  ExternalLinkIcon,
2410
2406
  IconButton as IconButton3,
2411
2407
  Image as Image5,
2412
- Text as Text11
2408
+ Text as Text12
2413
2409
  } from "@0xsequence/design-system";
2414
2410
  import { observer as observer6 } from "@legendapp/state/react";
2415
2411
  import { Close as Close2, Content as Content3, Overlay as Overlay2, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
@@ -2470,7 +2466,7 @@ var SuccessfulPurchaseModal = observer6(() => {
2470
2466
  /* @__PURE__ */ jsxs13(Content3, { className: dialogContent.narrow, children: [
2471
2467
  /* @__PURE__ */ jsxs13(Box13, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
2472
2468
  /* @__PURE__ */ jsx20(
2473
- Text11,
2469
+ Text12,
2474
2470
  {
2475
2471
  textAlign: "center",
2476
2472
  fontSize: "medium",
@@ -2486,10 +2482,10 @@ var SuccessfulPurchaseModal = observer6(() => {
2486
2482
  }
2487
2483
  ),
2488
2484
  /* @__PURE__ */ jsxs13(Box13, { display: "flex", alignItems: "center", gap: "1", children: [
2489
- /* @__PURE__ */ jsx20(Text11, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
2490
- /* @__PURE__ */ jsx20(Text11, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
2491
- /* @__PURE__ */ jsx20(Text11, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
2492
- /* @__PURE__ */ jsx20(Text11, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
2485
+ /* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
2486
+ /* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
2487
+ /* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
2488
+ /* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
2493
2489
  ] }),
2494
2490
  /* @__PURE__ */ jsx20(SuccessfulPurchaseActions, {})
2495
2491
  ] }),
@@ -2570,7 +2566,7 @@ function CollectiblesGrid({ collectibles }) {
2570
2566
  background: "backgroundOverlay",
2571
2567
  backdropFilter: "blur",
2572
2568
  children: /* @__PURE__ */ jsxs13(
2573
- Text11,
2569
+ Text12,
2574
2570
  {
2575
2571
  fontSize: "small",
2576
2572
  fontWeight: "medium",
@@ -2642,7 +2638,7 @@ var initialState5 = {
2642
2638
  var transferModal$ = observable5(initialState5);
2643
2639
 
2644
2640
  // src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
2645
- import { Box as Box14, Button as Button3, Text as Text12, TextInput } from "@0xsequence/design-system";
2641
+ import { Box as Box14, Button as Button3, Text as Text13, TextInput } from "@0xsequence/design-system";
2646
2642
  import { observable as observable6 } from "@legendapp/state";
2647
2643
  import { isAddress } from "viem";
2648
2644
  import { useAccount as useAccount2 } from "wagmi";
@@ -2752,7 +2748,7 @@ var EnterWalletAddressView = () => {
2752
2748
  transferModal$.view.set("followWalletInstructions");
2753
2749
  }
2754
2750
  return /* @__PURE__ */ jsxs14(Box14, { display: "grid", gap: "6", flexGrow: "1", children: [
2755
- /* @__PURE__ */ jsx21(Text12, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2751
+ /* @__PURE__ */ jsx21(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2756
2752
  /* @__PURE__ */ jsxs14(Box14, { display: "flex", flexDirection: "column", gap: "3", children: [
2757
2753
  /* @__PURE__ */ jsx21(
2758
2754
  AlertMessage,
@@ -2783,7 +2779,7 @@ var EnterWalletAddressView = () => {
2783
2779
  }
2784
2780
  ),
2785
2781
  /* @__PURE__ */ jsx21(
2786
- Text12,
2782
+ Text13,
2787
2783
  {
2788
2784
  color: insufficientBalance ? "negative" : "text50",
2789
2785
  fontSize: "small",
@@ -2813,12 +2809,12 @@ var EnterWalletAddressView = () => {
2813
2809
  var enterWalletAddress_default = EnterWalletAddressView;
2814
2810
 
2815
2811
  // src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
2816
- import { Box as Box15, Button as Button4, Text as Text13 } from "@0xsequence/design-system";
2812
+ import { Box as Box15, Button as Button4, Text as Text14 } from "@0xsequence/design-system";
2817
2813
  import { observer as observer7 } from "@legendapp/state/react";
2818
2814
  import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
2819
2815
  var FollowWalletInstructionsView = observer7(() => {
2820
2816
  return /* @__PURE__ */ jsxs15(Box15, { display: "grid", gap: "6", flexGrow: "1", children: [
2821
- /* @__PURE__ */ jsx22(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2817
+ /* @__PURE__ */ jsx22(Text14, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2822
2818
  /* @__PURE__ */ jsx22(Box15, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx22(
2823
2819
  AlertMessage,
2824
2820
  {
@@ -2973,7 +2969,7 @@ var createListingModal$ = observable7({
2973
2969
  import { useEffect as useEffect6 } from "react";
2974
2970
 
2975
2971
  // src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts
2976
- import { skipToken as skipToken3, useQuery as useQuery4 } from "@tanstack/react-query";
2972
+ import { skipToken as skipToken4, useQuery as useQuery4 } from "@tanstack/react-query";
2977
2973
  import { useAccount as useAccount4 } from "wagmi";
2978
2974
  var ONE_DAY_IN_SECONDS2 = 60 * 60 * 24;
2979
2975
  var useGetTokenApprovalData3 = (params) => {
@@ -3012,7 +3008,7 @@ var useGetTokenApprovalData3 = (params) => {
3012
3008
  return {
3013
3009
  step: tokenApprovalStep
3014
3010
  };
3015
- } : skipToken3
3011
+ } : skipToken4
3016
3012
  });
3017
3013
  return {
3018
3014
  data,
@@ -3100,7 +3096,8 @@ var useTransactionSteps3 = ({
3100
3096
  if (!transactionStep && !signatureStep) {
3101
3097
  throw new Error("No transaction or signature step found");
3102
3098
  }
3103
- let hash, orderId;
3099
+ let hash;
3100
+ let orderId;
3104
3101
  if (transactionStep) {
3105
3102
  hash = await executeTransaction({ transactionStep });
3106
3103
  }
@@ -3184,7 +3181,7 @@ var useCreateListing = ({
3184
3181
  }) => {
3185
3182
  const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
3186
3183
  const collectionConfig = marketplaceConfig?.collections.find(
3187
- (c) => c.collectionAddress === collectionAddress
3184
+ (c) => c.address === collectionAddress
3188
3185
  );
3189
3186
  orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
3190
3187
  const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData3({
@@ -3246,14 +3243,13 @@ var Modal5 = observer9(() => {
3246
3243
  collectionAddress,
3247
3244
  collectibleId
3248
3245
  });
3249
- const currencyOptions = useCurrencyOptions({ collectionAddress });
3250
3246
  const {
3251
3247
  data: currencies,
3252
3248
  isLoading: currenciesLoading,
3253
3249
  isError: currenciesIsError
3254
3250
  } = useCurrencies({
3255
3251
  chainId,
3256
- currencyOptions,
3252
+ collectionAddress,
3257
3253
  includeNativeCurrency: true
3258
3254
  });
3259
3255
  const {
@@ -3408,6 +3404,9 @@ var Modal5 = observer9(() => {
3408
3404
  // src/react/ui/modals/BuyModal/Modal.tsx
3409
3405
  import { use$ as use$3 } from "@legendapp/state/react";
3410
3406
 
3407
+ // src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
3408
+ import { useSelectPaymentModal } from "@0xsequence/kit-checkout";
3409
+
3411
3410
  // src/react/ui/modals/BuyModal/store.ts
3412
3411
  import { observable as observable8 } from "@legendapp/state";
3413
3412
  var buyState = {
@@ -3415,7 +3414,8 @@ var buyState = {
3415
3414
  quantity: "1",
3416
3415
  invalidQuantity: false,
3417
3416
  checkoutModalIsLoading: false,
3418
- checkoutModalLoaded: false
3417
+ checkoutModalLoaded: false,
3418
+ purchaseProcessing: false
3419
3419
  };
3420
3420
  var initialState7 = {
3421
3421
  isOpen: false,
@@ -3429,7 +3429,8 @@ var initialState7 = {
3429
3429
  order: args.order,
3430
3430
  invalidQuantity: false,
3431
3431
  checkoutModalIsLoading: false,
3432
- checkoutModalLoaded: false
3432
+ checkoutModalLoaded: false,
3433
+ purchaseProcessing: false
3433
3434
  });
3434
3435
  buyModal$.callbacks.set(callbacks || defaultCallbacks);
3435
3436
  buyModal$.isOpen.set(true);
@@ -3446,10 +3447,180 @@ var initialState7 = {
3446
3447
  setCheckoutModalLoaded: (isLoaded) => {
3447
3448
  buyModal$.state.checkoutModalLoaded.set(isLoaded);
3448
3449
  },
3450
+ setPurchaseProcessing: (isProcessing) => {
3451
+ buyModal$.state.purchaseProcessing.set(isProcessing);
3452
+ },
3449
3453
  callbacks: void 0
3450
3454
  };
3451
3455
  var buyModal$ = observable8(initialState7);
3452
3456
 
3457
+ // src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
3458
+ var useBuyCollectable = ({
3459
+ chainId,
3460
+ collectionAddress,
3461
+ tokenId,
3462
+ callbacks,
3463
+ priceCurrencyAddress,
3464
+ setCheckoutModalIsLoading,
3465
+ setCheckoutModalLoaded
3466
+ }) => {
3467
+ const { openSelectPaymentModal } = useSelectPaymentModal();
3468
+ const config = useConfig();
3469
+ const marketplaceClient = getMarketplaceClient(Number(chainId), config);
3470
+ const fees = useFees({ chainId: Number(chainId), collectionAddress });
3471
+ const { wallet, isLoading, isError } = useWallet();
3472
+ if (isLoading) {
3473
+ return { status: "loading", buy: null, isLoading, isError: false };
3474
+ }
3475
+ if (isError || !wallet) {
3476
+ return { status: "error", buy: null, isLoading, isError: true };
3477
+ }
3478
+ const invalidateQueries2 = async (queriesToInvalidate) => {
3479
+ const queryClient = getQueryClient();
3480
+ for (const queryKey of queriesToInvalidate) {
3481
+ await queryClient.invalidateQueries({ queryKey });
3482
+ }
3483
+ };
3484
+ return {
3485
+ status: "ready",
3486
+ isLoading,
3487
+ isError,
3488
+ buy: async (input) => {
3489
+ setCheckoutModalIsLoading(true);
3490
+ const { steps: steps3 } = await marketplaceClient.generateBuyTransaction({
3491
+ collectionAddress,
3492
+ buyer: await wallet.address(),
3493
+ marketplace: input.marketplace,
3494
+ ordersData: [
3495
+ {
3496
+ orderId: input.orderId,
3497
+ quantity: input.quantity
3498
+ }
3499
+ ],
3500
+ additionalFees: [fees],
3501
+ walletType: "unknown" /* unknown */
3502
+ });
3503
+ setCheckoutModalLoaded(true);
3504
+ setCheckoutModalIsLoading(false);
3505
+ const step = steps3[0];
3506
+ openSelectPaymentModal({
3507
+ chain: chainId,
3508
+ collectibles: [
3509
+ {
3510
+ tokenId,
3511
+ quantity: input.quantity,
3512
+ decimals: input.collectableDecimals
3513
+ }
3514
+ ],
3515
+ currencyAddress: priceCurrencyAddress,
3516
+ price: step.value,
3517
+ targetContractAddress: step.to,
3518
+ txData: step.data,
3519
+ collectionAddress,
3520
+ recipientAddress: await wallet.address(),
3521
+ enableMainCurrencyPayment: true,
3522
+ enableSwapPayments: !!input.checkoutOptions.swap,
3523
+ creditCardProviders: input.checkoutOptions.nftCheckout || [],
3524
+ onSuccess: (hash) => {
3525
+ callbacks?.onSuccess?.({ hash });
3526
+ },
3527
+ onError: callbacks?.onError,
3528
+ onClose: () => {
3529
+ invalidateQueries2([
3530
+ collectableKeys.listings,
3531
+ collectableKeys.lowestListings,
3532
+ collectableKeys.listingsCount,
3533
+ collectableKeys.lists,
3534
+ collectableKeys.userBalances,
3535
+ balanceQueries.all,
3536
+ balanceQueries.collectionBalanceDetails
3537
+ ]);
3538
+ buyModal$.close();
3539
+ }
3540
+ });
3541
+ }
3542
+ };
3543
+ };
3544
+
3545
+ // src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts
3546
+ import { skipToken as skipToken5, useQuery as useQuery5 } from "@tanstack/react-query";
3547
+ var useCheckoutOptions = (input) => {
3548
+ const config = useConfig();
3549
+ const { wallet } = useWallet();
3550
+ const fees = useFees({
3551
+ chainId: input.chainId,
3552
+ collectionAddress: input.collectionAddress
3553
+ });
3554
+ return useQuery5({
3555
+ queryKey: [
3556
+ "checkoutOptions",
3557
+ input.chainId,
3558
+ input.collectionAddress,
3559
+ input.orderId,
3560
+ input.marketplace
3561
+ ],
3562
+ queryFn: wallet ? async () => {
3563
+ const marketplaceClient = getMarketplaceClient(input.chainId, config);
3564
+ return marketplaceClient.checkoutOptionsMarketplace({
3565
+ wallet: await wallet.address(),
3566
+ orders: [
3567
+ {
3568
+ contractAddress: input.collectionAddress,
3569
+ orderId: input.orderId,
3570
+ marketplace: input.marketplace
3571
+ }
3572
+ ],
3573
+ additionalFee: Number(fees.amount)
3574
+ }).then((res) => res.options);
3575
+ } : skipToken5,
3576
+ enabled: !!wallet
3577
+ });
3578
+ };
3579
+
3580
+ // src/react/ui/modals/BuyModal/hooks/useLoadData.ts
3581
+ var useLoadData = ({
3582
+ chainId,
3583
+ collectionAddress,
3584
+ collectibleId,
3585
+ orderId,
3586
+ marketplace
3587
+ }) => {
3588
+ const {
3589
+ data: collection,
3590
+ isLoading: collectionLoading,
3591
+ isError: collectionError
3592
+ } = useCollection({
3593
+ chainId,
3594
+ collectionAddress
3595
+ });
3596
+ const {
3597
+ data: collectable,
3598
+ isLoading: collectableLoading,
3599
+ isError: collectableError
3600
+ } = useCollectible({
3601
+ chainId: String(chainId),
3602
+ collectionAddress,
3603
+ collectibleId
3604
+ });
3605
+ const {
3606
+ data: checkoutOptions,
3607
+ isLoading: checkoutOptionsLoading,
3608
+ isError: checkoutOptionsError
3609
+ } = useCheckoutOptions({
3610
+ chainId,
3611
+ collectionAddress,
3612
+ orderId,
3613
+ marketplace
3614
+ });
3615
+ return {
3616
+ collection,
3617
+ collectable,
3618
+ checkoutOptions,
3619
+ isLoading: collectionLoading || collectableLoading || checkoutOptionsLoading,
3620
+ isError: collectionError || collectableError || checkoutOptionsError
3621
+ };
3622
+ };
3623
+
3453
3624
  // src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx
3454
3625
  import { useEffect as useEffect7 } from "react";
3455
3626
  import { parseUnits as parseUnits5 } from "viem";
@@ -3471,7 +3642,7 @@ function CheckoutModal({ buy, collectable, order }) {
3471
3642
  }
3472
3643
 
3473
3644
  // src/react/ui/modals/BuyModal/modals/Modal1155.tsx
3474
- import { Box as Box17, Text as Text14, TokenImage as TokenImage2 } from "@0xsequence/design-system";
3645
+ import { Box as Box17, Text as Text15, TokenImage as TokenImage2 } from "@0xsequence/design-system";
3475
3646
  import { observer as observer10 } from "@legendapp/state/react";
3476
3647
  import { formatUnits as formatUnits4, parseUnits as parseUnits6 } from "viem";
3477
3648
  import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -3484,7 +3655,7 @@ var ERC1155QuantityModal = observer10(
3484
3655
  const quantity = Number(buyModal$.state.quantity.get());
3485
3656
  const pricePerToken = order.priceAmount;
3486
3657
  const totalPrice = (BigInt(quantity) * BigInt(pricePerToken)).toString();
3487
- if (buyModal$.state.checkoutModalLoaded.get() && buyModal$.isOpen.get() && buyModal$.state.checkoutModalIsLoading.get()) {
3658
+ if (buyModal$.state.checkoutModalLoaded.get() && buyModal$.isOpen.get() && buyModal$.state.checkoutModalIsLoading.get() && buyModal$.state.purchaseProcessing.get()) {
3488
3659
  return null;
3489
3660
  }
3490
3661
  return /* @__PURE__ */ jsx25(
@@ -3499,6 +3670,7 @@ var ERC1155QuantityModal = observer10(
3499
3670
  label: "Buy now",
3500
3671
  onClick: () => {
3501
3672
  buyModal$.state.checkoutModalIsLoading.set(true);
3673
+ buyModal$.state.purchaseProcessing.set(true);
3502
3674
  buy({
3503
3675
  quantity: parseUnits6(
3504
3676
  buyModal$.state.quantity.get(),
@@ -3524,11 +3696,11 @@ var ERC1155QuantityModal = observer10(
3524
3696
  }
3525
3697
  ),
3526
3698
  /* @__PURE__ */ jsxs18(Box17, { display: "flex", justifyContent: "space-between", children: [
3527
- /* @__PURE__ */ jsx25(Text14, { color: "text50", fontSize: "small", fontFamily: "body", children: "Total Price" }),
3528
- /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: isCurrencyLoading || !currency ? /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: /* @__PURE__ */ jsx25(Text14, { color: "text50", fontSize: "small", fontFamily: "body", children: "Loading..." }) }) : /* @__PURE__ */ jsxs18(Fragment3, { children: [
3699
+ /* @__PURE__ */ jsx25(Text15, { color: "text50", fontSize: "small", fontFamily: "body", children: "Total Price" }),
3700
+ /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: isCurrencyLoading || !currency ? /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: /* @__PURE__ */ jsx25(Text15, { color: "text50", fontSize: "small", fontFamily: "body", children: "Loading..." }) }) : /* @__PURE__ */ jsxs18(Fragment3, { children: [
3529
3701
  currency.imageUrl && /* @__PURE__ */ jsx25(TokenImage2, { src: currency.imageUrl, size: "xs" }),
3530
3702
  /* @__PURE__ */ jsx25(
3531
- Text14,
3703
+ Text15,
3532
3704
  {
3533
3705
  color: "text100",
3534
3706
  fontSize: "small",
@@ -3537,7 +3709,7 @@ var ERC1155QuantityModal = observer10(
3537
3709
  children: formatUnits4(BigInt(totalPrice), currency.decimals || 0)
3538
3710
  }
3539
3711
  ),
3540
- /* @__PURE__ */ jsx25(Text14, { color: "text80", fontSize: "small", fontFamily: "body", children: currency?.symbol })
3712
+ /* @__PURE__ */ jsx25(Text15, { color: "text80", fontSize: "small", fontFamily: "body", children: currency?.symbol })
3541
3713
  ] }) })
3542
3714
  ] })
3543
3715
  ] })
@@ -3546,174 +3718,6 @@ var ERC1155QuantityModal = observer10(
3546
3718
  }
3547
3719
  );
3548
3720
 
3549
- // src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts
3550
- import { skipToken as skipToken4, useQuery as useQuery5 } from "@tanstack/react-query";
3551
- var useCheckoutOptions = (input) => {
3552
- const config = useConfig();
3553
- const { wallet } = useWallet();
3554
- const fees = useFees({
3555
- chainId: input.chainId,
3556
- collectionAddress: input.collectionAddress
3557
- });
3558
- return useQuery5({
3559
- queryKey: [
3560
- "checkoutOptions",
3561
- input.chainId,
3562
- input.collectionAddress,
3563
- input.orderId,
3564
- input.marketplace
3565
- ],
3566
- queryFn: wallet ? async () => {
3567
- const marketplaceClient = getMarketplaceClient(input.chainId, config);
3568
- return marketplaceClient.checkoutOptionsMarketplace({
3569
- wallet: await wallet.address(),
3570
- orders: [
3571
- {
3572
- contractAddress: input.collectionAddress,
3573
- orderId: input.orderId,
3574
- marketplace: input.marketplace
3575
- }
3576
- ],
3577
- additionalFee: Number(fees.amount)
3578
- }).then((res) => res.options);
3579
- } : skipToken4,
3580
- enabled: !!wallet
3581
- });
3582
- };
3583
-
3584
- // src/react/ui/modals/BuyModal/hooks/useLoadData.ts
3585
- var useLoadData = ({
3586
- chainId,
3587
- collectionAddress,
3588
- collectibleId,
3589
- orderId,
3590
- marketplace
3591
- }) => {
3592
- const {
3593
- data: collection,
3594
- isLoading: collectionLoading,
3595
- isError: collectionError
3596
- } = useCollection({
3597
- chainId,
3598
- collectionAddress
3599
- });
3600
- const {
3601
- data: collectable,
3602
- isLoading: collectableLoading,
3603
- isError: collectableError
3604
- } = useCollectible({
3605
- chainId: String(chainId),
3606
- collectionAddress,
3607
- collectibleId
3608
- });
3609
- const {
3610
- data: checkoutOptions,
3611
- isLoading: checkoutOptionsLoading,
3612
- isError: checkoutOptionsError
3613
- } = useCheckoutOptions({
3614
- chainId,
3615
- collectionAddress,
3616
- orderId,
3617
- marketplace
3618
- });
3619
- return {
3620
- collection,
3621
- collectable,
3622
- checkoutOptions,
3623
- isLoading: collectionLoading || collectableLoading || checkoutOptionsLoading,
3624
- isError: collectionError || collectableError || checkoutOptionsError
3625
- };
3626
- };
3627
-
3628
- // src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
3629
- import { useSelectPaymentModal } from "@0xsequence/kit-checkout";
3630
- var useBuyCollectable = ({
3631
- chainId,
3632
- collectionAddress,
3633
- tokenId,
3634
- callbacks,
3635
- priceCurrencyAddress,
3636
- setCheckoutModalIsLoading,
3637
- setCheckoutModalLoaded
3638
- }) => {
3639
- const { openSelectPaymentModal } = useSelectPaymentModal();
3640
- const config = useConfig();
3641
- const marketplaceClient = getMarketplaceClient(Number(chainId), config);
3642
- const fees = useFees({ chainId: Number(chainId), collectionAddress });
3643
- const { wallet, isLoading, isError } = useWallet();
3644
- if (isLoading) {
3645
- return { status: "loading", buy: null, isLoading, isError: false };
3646
- }
3647
- if (isError || !wallet) {
3648
- return { status: "error", buy: null, isLoading, isError: true };
3649
- }
3650
- const invalidateQueries2 = async (queriesToInvalidate) => {
3651
- const queryClient = getQueryClient();
3652
- for (const queryKey of queriesToInvalidate) {
3653
- await queryClient.invalidateQueries({ queryKey });
3654
- }
3655
- };
3656
- return {
3657
- status: "ready",
3658
- isLoading,
3659
- isError,
3660
- buy: async (input) => {
3661
- setCheckoutModalIsLoading(true);
3662
- const { steps: steps3 } = await marketplaceClient.generateBuyTransaction({
3663
- collectionAddress,
3664
- buyer: await wallet.address(),
3665
- marketplace: input.marketplace,
3666
- ordersData: [
3667
- {
3668
- orderId: input.orderId,
3669
- quantity: input.quantity
3670
- }
3671
- ],
3672
- additionalFees: [fees],
3673
- walletType: "unknown" /* unknown */
3674
- });
3675
- setCheckoutModalLoaded(true);
3676
- setCheckoutModalIsLoading(false);
3677
- const step = steps3[0];
3678
- openSelectPaymentModal({
3679
- chain: chainId,
3680
- collectibles: [
3681
- {
3682
- tokenId,
3683
- quantity: input.quantity,
3684
- decimals: input.collectableDecimals
3685
- }
3686
- ],
3687
- currencyAddress: priceCurrencyAddress,
3688
- price: step.value,
3689
- targetContractAddress: step.to,
3690
- txData: step.data,
3691
- collectionAddress,
3692
- recipientAddress: await wallet.address(),
3693
- enableMainCurrencyPayment: true,
3694
- enableSwapPayments: !!input.checkoutOptions.swap,
3695
- creditCardProviders: input.checkoutOptions.nftCheckout || [],
3696
- onSuccess: (hash) => {
3697
- callbacks?.onSuccess?.({ hash });
3698
- },
3699
- onError: callbacks?.onError,
3700
- onClose: () => {
3701
- invalidateQueries2([
3702
- collectableKeys.listings,
3703
- collectableKeys.lowestListings,
3704
- collectableKeys.listingsCount,
3705
- collectableKeys.lists,
3706
- collectableKeys.userBalances,
3707
- balanceQueries.all,
3708
- balanceQueries.collectionBalanceDetails
3709
- ]);
3710
- buyModal$.close();
3711
- }
3712
- });
3713
- }
3714
- };
3715
- };
3716
-
3717
3721
  // src/react/ui/modals/BuyModal/Modal.tsx
3718
3722
  import { jsx as jsx26 } from "react/jsx-runtime";
3719
3723
  var BuyModal = () => {
@@ -3756,6 +3760,7 @@ var BuyModalContent = () => {
3756
3760
  const buyAction = (input) => {
3757
3761
  if (buy && checkoutOptions) {
3758
3762
  buy({ ...input, checkoutOptions });
3763
+ buyModal$.state.purchaseProcessing.set(true);
3759
3764
  } else {
3760
3765
  console.error("buy is null or undefined");
3761
3766
  }
@@ -3782,6 +3787,9 @@ var BuyModalContent = () => {
3782
3787
  }
3783
3788
  );
3784
3789
  }
3790
+ if (buyModal$.state.purchaseProcessing.get()) {
3791
+ return null;
3792
+ }
3785
3793
  return collection.type === "ERC721" /* ERC721 */ ? /* @__PURE__ */ jsx26(
3786
3794
  CheckoutModal,
3787
3795
  {
@@ -4239,7 +4247,7 @@ var ActionButton = observer12(
4239
4247
  );
4240
4248
 
4241
4249
  // src/react/ui/components/collectible-card/Footer.tsx
4242
- import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as Text15 } from "@0xsequence/design-system";
4250
+ import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as Text16 } from "@0xsequence/design-system";
4243
4251
  import { formatUnits as formatUnits5 } from "viem";
4244
4252
 
4245
4253
  // src/react/ui/icons/Bell.tsx
@@ -4283,6 +4291,11 @@ var Bell_default = SvgBellIcon;
4283
4291
 
4284
4292
  // src/react/ui/components/collectible-card/Footer.tsx
4285
4293
  import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
4294
+ var formatPrice = (amount, currency) => {
4295
+ const formattedPrice = formatUnits5(BigInt(amount), currency.decimals);
4296
+ const numericPrice = Number.parseFloat(formattedPrice);
4297
+ return numericPrice < 1e-4 ? `< 0.0001 ${currency.symbol}` : `${formattedPrice} ${currency.symbol}`;
4298
+ };
4286
4299
  var Footer = ({
4287
4300
  name,
4288
4301
  type,
@@ -4321,7 +4334,7 @@ var Footer = ({
4321
4334
  width: "full",
4322
4335
  children: [
4323
4336
  /* @__PURE__ */ jsx35(
4324
- Text15,
4337
+ Text16,
4325
4338
  {
4326
4339
  color: "text100",
4327
4340
  fontSize: "normal",
@@ -4354,7 +4367,7 @@ var Footer = ({
4354
4367
  /* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", gap: "1", children: [
4355
4368
  listed && lowestListingCurrency.imageUrl && /* @__PURE__ */ jsx35(Image6, { src: lowestListingCurrency.imageUrl, width: "3", height: "3" }),
4356
4369
  /* @__PURE__ */ jsxs23(
4357
- Text15,
4370
+ Text16,
4358
4371
  {
4359
4372
  color: listed ? "text100" : "text50",
4360
4373
  fontSize: "small",
@@ -4362,10 +4375,7 @@ var Footer = ({
4362
4375
  textAlign: "left",
4363
4376
  fontFamily: "body",
4364
4377
  children: [
4365
- listed && `${formatUnits5(
4366
- BigInt(lowestListingPriceAmount),
4367
- lowestListingCurrency.decimals
4368
- )} ${lowestListingCurrency.symbol}`,
4378
+ listed && formatPrice(lowestListingPriceAmount, lowestListingCurrency),
4369
4379
  !listed && "Not listed yet"
4370
4380
  ]
4371
4381
  }
@@ -4382,7 +4392,7 @@ var TokenTypeBalancePill = ({
4382
4392
  }) => {
4383
4393
  const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
4384
4394
  return /* @__PURE__ */ jsx35(
4385
- Text15,
4395
+ Text16,
4386
4396
  {
4387
4397
  background: "backgroundSecondary",
4388
4398
  color: "text80",
@@ -4578,4 +4588,4 @@ export {
4578
4588
  useBuyModal,
4579
4589
  CollectibleCard
4580
4590
  };
4581
- //# sourceMappingURL=chunk-MSTTVFVQ.js.map
4591
+ //# sourceMappingURL=chunk-BVXIRVEC.js.map