@0xsequence/marketplace-sdk 1.2.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (909) hide show
  1. package/.storybook/preview.tsx +4 -7
  2. package/CHANGELOG.md +179 -0
  3. package/compile-tailwind.js +1 -1
  4. package/dist/BellIcon.js +7 -4
  5. package/dist/BellIcon.js.map +1 -1
  6. package/dist/Card.js +831 -0
  7. package/dist/Card.js.map +1 -0
  8. package/dist/ShopCard.d.ts +83 -0
  9. package/dist/_internal.js +57 -1
  10. package/dist/_internal.js.map +1 -1
  11. package/dist/abi.js +24 -1
  12. package/dist/abi.js.map +1 -1
  13. package/dist/alertMessage.js +29 -0
  14. package/dist/alertMessage.js.map +1 -0
  15. package/dist/api.js +95 -108
  16. package/dist/api.js.map +1 -1
  17. package/dist/builder-api.js +17 -4
  18. package/dist/builder-api.js.map +1 -1
  19. package/dist/calendar.js +51 -0
  20. package/dist/calendar.js.map +1 -0
  21. package/dist/checkout.js +52 -0
  22. package/dist/checkout.js.map +1 -0
  23. package/dist/collectible.js +620 -0
  24. package/dist/collectible.js.map +1 -0
  25. package/dist/collection.js +396 -0
  26. package/dist/collection.js.map +1 -0
  27. package/dist/{marketplaceConfig.js → config.js} +25 -31
  28. package/dist/config.js.map +1 -0
  29. package/dist/consts.d.ts +7 -0
  30. package/dist/consts.js +8 -0
  31. package/dist/consts.js.map +1 -0
  32. package/dist/contracts.js +22 -2
  33. package/dist/contracts.js.map +1 -1
  34. package/dist/create-config.d.ts +12037 -1801
  35. package/dist/create-config.js +9 -7
  36. package/dist/create-config.js.map +1 -1
  37. package/dist/currency.js +186 -0
  38. package/dist/currency.js.map +1 -0
  39. package/dist/currencyImage.js +28 -0
  40. package/dist/currencyImage.js.map +1 -0
  41. package/dist/dist.js +2771 -0
  42. package/dist/dist.js.map +1 -0
  43. package/dist/expirationDateSelect.js +245 -0
  44. package/dist/expirationDateSelect.js.map +1 -0
  45. package/dist/filter-state.d.ts +153 -0
  46. package/dist/filters.d.ts +14 -45
  47. package/dist/hooks.js +26 -0
  48. package/dist/hooks.js.map +1 -0
  49. package/dist/hooks2.js +24 -0
  50. package/dist/hooks2.js.map +1 -0
  51. package/dist/index.d.ts +12 -8
  52. package/dist/index.js +7 -10
  53. package/dist/index10.d.ts +39 -261
  54. package/dist/index11.d.ts +461 -220
  55. package/dist/index12.d.ts +511 -85
  56. package/dist/index13.d.ts +17 -493
  57. package/dist/index14.d.ts +15 -66
  58. package/dist/index15.d.ts +25 -1
  59. package/dist/index16.d.ts +5 -47
  60. package/dist/index17.d.ts +840 -108
  61. package/dist/index18.d.ts +552 -1
  62. package/dist/index19.d.ts +317 -147
  63. package/dist/index2.d.ts +2172 -5
  64. package/dist/index21.d.ts +306 -93
  65. package/dist/index22.d.ts +230 -1
  66. package/dist/index23.d.ts +323 -797
  67. package/dist/index24.d.ts +22 -445
  68. package/dist/index25.d.ts +1 -357
  69. package/dist/index26.d.ts +20 -151
  70. package/dist/index27.d.ts +18 -794
  71. package/dist/index28.d.ts +109 -58
  72. package/dist/index29.d.ts +1 -24
  73. package/dist/index3.d.ts +2212 -51
  74. package/dist/index30.d.ts +1 -0
  75. package/dist/index31.d.ts +48 -0
  76. package/dist/index32.d.ts +1 -0
  77. package/dist/index33.d.ts +56 -0
  78. package/dist/index34.d.ts +99 -0
  79. package/dist/index35.d.ts +171 -0
  80. package/dist/index36.d.ts +131 -0
  81. package/dist/index37.d.ts +137 -0
  82. package/dist/index38.d.ts +85 -0
  83. package/dist/index39.d.ts +91 -0
  84. package/dist/index4.d.ts +2634 -17
  85. package/dist/index40.d.ts +46 -0
  86. package/dist/index5.d.ts +535 -2267
  87. package/dist/index6.d.ts +2025 -1287
  88. package/dist/index7.d.ts +1798 -116
  89. package/dist/index8.d.ts +123 -12
  90. package/dist/index9.d.ts +42 -56
  91. package/dist/inventory.d.ts +46 -0
  92. package/dist/inventory.js +58 -35
  93. package/dist/inventory.js.map +1 -1
  94. package/dist/marketplace-logos.js +1 -1
  95. package/dist/marketplace-logos.js.map +1 -1
  96. package/dist/marketplace2.js +70 -0
  97. package/dist/marketplace2.js.map +1 -0
  98. package/dist/metadata.d.ts +733 -0
  99. package/dist/network.js +1 -1
  100. package/dist/networkconfigToWagmiChain.js.map +1 -1
  101. package/dist/primary-sale-checkout-options.d.ts +29 -0
  102. package/dist/quantityInput.js +93 -0
  103. package/dist/quantityInput.js.map +1 -0
  104. package/dist/ranges.d.ts +125 -0
  105. package/dist/react/_internal/api/index.d.ts +5 -2
  106. package/dist/react/_internal/api/index.js +4 -7
  107. package/dist/react/_internal/databeat/index.d.ts +4 -1
  108. package/dist/react/_internal/databeat/index.js +4 -37
  109. package/dist/react/_internal/index.d.ts +5 -2
  110. package/dist/react/_internal/index.js +5 -10
  111. package/dist/react/_internal/wagmi/index.d.ts +4 -1
  112. package/dist/react/_internal/wagmi/index.js +1 -4
  113. package/dist/react/hooks/_deprecated/index.d.ts +47 -0
  114. package/dist/react/hooks/_deprecated/index.js +4 -0
  115. package/dist/react/hooks/checkout/index.d.ts +7 -0
  116. package/dist/react/hooks/checkout/index.js +7 -0
  117. package/dist/react/hooks/collectible/index.d.ts +7 -0
  118. package/dist/react/hooks/collectible/index.js +7 -0
  119. package/dist/react/hooks/collection/index.d.ts +11 -0
  120. package/dist/react/hooks/collection/index.js +7 -0
  121. package/dist/react/hooks/config/index.d.ts +5 -4
  122. package/dist/react/hooks/config/index.js +4 -37
  123. package/dist/react/hooks/contracts/index.d.ts +4 -7
  124. package/dist/react/hooks/contracts/index.js +3 -16
  125. package/dist/react/hooks/currency/index.d.ts +47 -0
  126. package/dist/react/hooks/currency/index.js +7 -0
  127. package/dist/react/hooks/index.d.ts +41 -31
  128. package/dist/react/hooks/index.js +14 -38
  129. package/dist/react/hooks/inventory/index.d.ts +7 -0
  130. package/dist/react/hooks/inventory/index.js +4 -0
  131. package/dist/react/hooks/token/index.d.ts +7 -0
  132. package/dist/react/hooks/token/index.js +7 -0
  133. package/dist/react/hooks/transactions/index.d.ts +5 -2
  134. package/dist/react/hooks/transactions/index.js +5 -38
  135. package/dist/react/hooks/ui/card-data/index.d.ts +8 -0
  136. package/dist/react/hooks/ui/card-data/index.js +4 -0
  137. package/dist/react/hooks/ui/index.d.ts +9 -3
  138. package/dist/react/hooks/ui/index.js +8 -38
  139. package/dist/react/hooks/ui/url-state/index.d.ts +7 -0
  140. package/dist/react/hooks/ui/url-state/index.js +4 -0
  141. package/dist/react/hooks/utils/index.d.ts +3 -34
  142. package/dist/react/hooks/utils/index.js +5 -38
  143. package/dist/react/index.d.ts +45 -35
  144. package/dist/react/index.js +19 -37
  145. package/dist/react/providers/index.d.ts +6 -0
  146. package/dist/react/providers/index.js +6 -0
  147. package/dist/react/queries/checkout/index.d.ts +7 -0
  148. package/dist/react/queries/checkout/index.js +4 -0
  149. package/dist/react/queries/collectible/index.d.ts +7 -0
  150. package/dist/react/queries/collectible/index.js +5 -0
  151. package/dist/react/queries/collection/index.d.ts +11 -0
  152. package/dist/react/queries/collection/index.js +4 -0
  153. package/dist/react/queries/currency/index.d.ts +6 -0
  154. package/dist/react/queries/currency/index.js +4 -0
  155. package/dist/react/queries/index.d.ts +20 -21
  156. package/dist/react/queries/index.js +11 -30
  157. package/dist/react/queries/inventory/index.d.ts +6 -2
  158. package/dist/react/queries/inventory/index.js +3 -21
  159. package/dist/react/queries/marketplace/index.d.ts +7 -0
  160. package/dist/react/queries/marketplace/index.js +5 -0
  161. package/dist/react/queries/token/index.d.ts +7 -0
  162. package/dist/react/queries/token/index.js +4 -0
  163. package/dist/react/ssr/index.d.ts +12 -24
  164. package/dist/react/ssr/index.js +13 -33
  165. package/dist/react/ui/components/marketplace-collectible-card/ActionButton/index.d.ts +6 -0
  166. package/dist/react/ui/components/marketplace-collectible-card/ActionButton/index.js +6 -0
  167. package/dist/react/ui/components/marketplace-collectible-card/Card/index.d.ts +10 -0
  168. package/dist/react/ui/components/marketplace-collectible-card/Card/index.js +6 -0
  169. package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +44 -4
  170. package/dist/react/ui/components/marketplace-collectible-card/index.js +6 -38
  171. package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +5 -2
  172. package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +3 -12
  173. package/dist/react/ui/components/marketplace-logos/index.d.ts +23 -22
  174. package/dist/react/ui/hooks/index.d.ts +47 -0
  175. package/dist/react/ui/hooks/index.js +15 -0
  176. package/dist/react/ui/icons/index.d.ts +3 -1
  177. package/dist/react/ui/icons/index.js +3 -14
  178. package/dist/react/ui/index.d.ts +47 -5
  179. package/dist/react/ui/index.js +6 -38
  180. package/dist/react/ui/modals/BuyModal/index.d.ts +47 -0
  181. package/dist/react/ui/modals/BuyModal/index.js +4 -0
  182. package/dist/react/ui/modals/CreateListingModal/index.d.ts +4 -0
  183. package/dist/react/ui/modals/CreateListingModal/index.js +6 -0
  184. package/dist/react/ui/modals/CreateListingModal/internal/hooks/index.d.ts +190 -0
  185. package/dist/react/ui/modals/CreateListingModal/internal/hooks/index.js +4 -0
  186. package/dist/react/ui/modals/MakeOfferModal/index.d.ts +4 -0
  187. package/dist/react/ui/modals/MakeOfferModal/index.js +4 -0
  188. package/dist/react/ui/modals/MakeOfferModal/internal/hooks/index.d.ts +188 -0
  189. package/dist/react/ui/modals/MakeOfferModal/internal/hooks/index.js +3 -0
  190. package/dist/react/ui/modals/SellModal/index.d.ts +6 -0
  191. package/dist/react/ui/modals/SellModal/index.js +6 -0
  192. package/dist/react/ui/modals/TransferModal/index.d.ts +47 -0
  193. package/dist/react/ui/modals/TransferModal/index.js +6 -0
  194. package/dist/react/ui/modals/_internal/components/alertMessage/index.d.ts +14 -0
  195. package/dist/react/ui/modals/_internal/components/alertMessage/index.js +3 -0
  196. package/dist/react/ui/modals/_internal/components/baseModal/index.d.ts +144 -0
  197. package/dist/react/ui/modals/_internal/components/baseModal/index.js +6 -0
  198. package/dist/react/ui/modals/_internal/components/calendar/index.d.ts +73 -0
  199. package/dist/react/ui/modals/_internal/components/calendar/index.js +5 -0
  200. package/dist/react/ui/modals/_internal/components/calendarDropdown/index.d.ts +21 -0
  201. package/dist/react/ui/modals/_internal/components/calendarDropdown/index.js +6 -0
  202. package/dist/react/ui/modals/_internal/components/currencyImage/index.d.ts +15 -0
  203. package/dist/react/ui/modals/_internal/components/currencyImage/index.js +5 -0
  204. package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.d.ts +30 -0
  205. package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.js +6 -0
  206. package/dist/react/ui/modals/_internal/components/expirationDateSelect/index.d.ts +2 -0
  207. package/dist/react/ui/modals/_internal/components/expirationDateSelect/index.js +6 -0
  208. package/dist/react/ui/modals/_internal/components/floorPriceText/index.d.ts +24 -0
  209. package/dist/react/ui/modals/_internal/components/floorPriceText/index.js +6 -0
  210. package/dist/react/ui/modals/_internal/components/priceInput/index.d.ts +43 -0
  211. package/dist/react/ui/modals/_internal/components/priceInput/index.js +6 -0
  212. package/dist/react/ui/modals/_internal/components/quantityInput/index.d.ts +24 -0
  213. package/dist/react/ui/modals/_internal/components/quantityInput/index.js +6 -0
  214. package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.d.ts +18 -0
  215. package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.js +6 -0
  216. package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.d.ts +14 -0
  217. package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.js +6 -0
  218. package/dist/react/ui/modals/_internal/components/timeAgo/index.d.ts +12 -0
  219. package/dist/react/ui/modals/_internal/components/timeAgo/index.js +5 -0
  220. package/dist/react/ui/modals/_internal/components/tokenPreview/index.d.ts +19 -0
  221. package/dist/react/ui/modals/_internal/components/tokenPreview/index.js +6 -0
  222. package/dist/react/ui/modals/_internal/components/transaction-footer/index.d.ts +26 -0
  223. package/dist/react/ui/modals/_internal/components/transaction-footer/index.js +4 -0
  224. package/dist/react/ui/modals/_internal/components/transactionDetails/index.d.ts +28 -0
  225. package/dist/react/ui/modals/_internal/components/transactionDetails/index.js +6 -0
  226. package/dist/react/ui/modals/_internal/components/transactionHeader/index.d.ts +16 -0
  227. package/dist/react/ui/modals/_internal/components/transactionHeader/index.js +3 -0
  228. package/dist/react/ui/modals/_internal/components/transactionPreview/index.d.ts +36 -0
  229. package/dist/react/ui/modals/_internal/components/transactionPreview/index.js +6 -0
  230. package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.d.ts +27 -0
  231. package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.js +6 -0
  232. package/dist/react/utils/index.d.ts +6 -19
  233. package/dist/react/utils/index.js +3 -8
  234. package/dist/react.js +12726 -9828
  235. package/dist/react.js.map +1 -1
  236. package/dist/src.js +0 -8
  237. package/dist/ssr.js +26 -0
  238. package/dist/ssr.js.map +1 -0
  239. package/dist/steps.d.ts +85 -0
  240. package/dist/styles/index.css +2056 -376
  241. package/dist/switchChainErrorModal.js +97 -0
  242. package/dist/switchChainErrorModal.js.map +1 -0
  243. package/dist/timeAgo.js +29 -0
  244. package/dist/timeAgo.js.map +1 -0
  245. package/dist/token-balances.d.ts +359 -0
  246. package/dist/token-balances.js +62 -0
  247. package/dist/token-balances.js.map +1 -0
  248. package/dist/token2.js +247 -0
  249. package/dist/token2.js.map +1 -0
  250. package/dist/transaction-footer.js +45 -0
  251. package/dist/transaction-footer.js.map +1 -0
  252. package/dist/transaction.js +1 -7
  253. package/dist/transaction.js.map +1 -1
  254. package/dist/transactionHeader.js +32 -0
  255. package/dist/transactionHeader.js.map +1 -0
  256. package/dist/types/index.d.ts +5 -2
  257. package/dist/types/index.js +3 -4
  258. package/dist/types.d.ts +26 -16
  259. package/dist/types.js +29 -1
  260. package/dist/types.js.map +1 -1
  261. package/dist/url-state.js +170 -0
  262. package/dist/url-state.js.map +1 -0
  263. package/dist/utils/abi/index.d.ts +6 -5
  264. package/dist/utils/abi/index.js +2 -2
  265. package/dist/utils/abi/marketplace/index.d.ts +1 -1
  266. package/dist/utils/abi/primary-sale/index.d.ts +1 -1
  267. package/dist/utils/abi/token/index.d.ts +1 -1
  268. package/dist/utils/index.d.ts +9 -7
  269. package/dist/utils/index.js +5 -9
  270. package/dist/utils.js +20 -9
  271. package/dist/utils.js.map +1 -1
  272. package/dist/utils2.js +64 -106
  273. package/dist/utils2.js.map +1 -1
  274. package/dist/waas-types.d.ts +19 -0
  275. package/dist/xstate-store.cjs.d.ts +18 -0
  276. package/eslint/sequence-types.js +1069 -0
  277. package/eslint.config.mjs +337 -9
  278. package/image.d.ts +5 -0
  279. package/package.json +49 -47
  280. package/postcss.config.mjs +1 -1
  281. package/preserve-directives.ts +235 -0
  282. package/public/mockServiceWorker.js +0 -1
  283. package/src/react/_internal/api/builder-api.ts +26 -4
  284. package/src/react/_internal/api/index.ts +1 -2
  285. package/src/react/_internal/api/marketplace-api.ts +57 -25
  286. package/src/react/_internal/api/services.ts +56 -4
  287. package/src/react/_internal/api-mocks.ts +8 -0
  288. package/src/react/_internal/databeat/index.ts +4 -0
  289. package/src/react/_internal/databeat/types.ts +24 -28
  290. package/src/react/_internal/index.ts +70 -0
  291. package/src/react/_internal/query-builder.ts +203 -0
  292. package/src/react/_internal/types.ts +88 -18
  293. package/src/react/_internal/utils.ts +34 -52
  294. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +11 -5
  295. package/src/react/_internal/wagmi/create-config.ts +2 -2
  296. package/src/react/_internal/wagmi/get-connectors.ts +10 -6
  297. package/src/react/hooks/_deprecated/index.ts +61 -0
  298. package/src/react/hooks/checkout/index.ts +1 -0
  299. package/src/react/hooks/{utils/useCheckoutOptionsSalesContract.test.tsx → checkout/primary-sale-checkout-options.test.tsx} +23 -23
  300. package/src/react/hooks/{utils/useCheckoutOptionsSalesContract.tsx → checkout/primary-sale-checkout-options.tsx} +35 -32
  301. package/src/react/hooks/{data/collectibles/useBalanceOfCollectible.test.tsx → collectible/balance.test.tsx} +37 -29
  302. package/src/react/hooks/{data/collectibles/useBalanceOfCollectible.tsx → collectible/balance.tsx} +11 -11
  303. package/src/react/hooks/{data/primary-sales/useErc721SalesData.tsx → collectible/erc721-sale-details.tsx} +6 -6
  304. package/src/react/hooks/collectible/index.ts +16 -0
  305. package/src/react/hooks/{data/collectibles/useCountOfCollectables.test.tsx → collectible/market-count.test.tsx} +21 -16
  306. package/src/react/hooks/{data/collectibles/useCountOfCollectables.tsx → collectible/market-count.tsx} +13 -8
  307. package/src/react/hooks/{data/orders/useHighestOffer.test.tsx → collectible/market-highest-offer.test.tsx} +35 -24
  308. package/src/react/hooks/{data/orders/useHighestOffer.tsx → collectible/market-highest-offer.tsx} +12 -10
  309. package/src/react/hooks/{data/collectibles/useListCollectiblesPaginated.test.tsx → collectible/market-list-paginated.test.tsx} +18 -18
  310. package/src/react/hooks/{data/collectibles/useListCollectiblesPaginated.tsx → collectible/market-list-paginated.tsx} +12 -10
  311. package/src/react/hooks/{data/collectibles/useListCollectibles.test.tsx → collectible/market-list.test.tsx} +51 -39
  312. package/src/react/hooks/{data/collectibles/useListCollectibles.tsx → collectible/market-list.tsx} +11 -10
  313. package/src/react/hooks/{data/orders/useCountListingsForCollectible.test.tsx → collectible/market-listings-count.test.tsx} +13 -10
  314. package/src/react/hooks/{data/orders/useCountListingsForCollectible.tsx → collectible/market-listings-count.tsx} +11 -11
  315. package/src/react/hooks/{data/orders/useListListingsForCollectible.test.tsx → collectible/market-listings.test.tsx} +19 -19
  316. package/src/react/hooks/{data/orders/useListListingsForCollectible.tsx → collectible/market-listings.tsx} +17 -19
  317. package/src/react/hooks/{data/orders/useLowestListing.test.tsx → collectible/market-lowest-listing.test.tsx} +35 -24
  318. package/src/react/hooks/{data/orders/useLowestListing.tsx → collectible/market-lowest-listing.tsx} +12 -10
  319. package/src/react/hooks/{data/orders/useCountOffersForCollectible.test.tsx → collectible/market-offers-count.test.tsx} +13 -10
  320. package/src/react/hooks/{data/orders/useCountOffersForCollectible.tsx → collectible/market-offers-count.tsx} +11 -11
  321. package/src/react/hooks/{data/orders/useListOffersForCollectible.test.tsx → collectible/market-offers.test.tsx} +17 -17
  322. package/src/react/hooks/{data/orders/useListOffersForCollectible.tsx → collectible/market-offers.tsx} +16 -17
  323. package/src/react/hooks/{data/collectibles/useCollectible.test.tsx → collectible/metadata.test.tsx} +25 -23
  324. package/src/react/hooks/{data/collectibles/useCollectible.tsx → collectible/metadata.tsx} +17 -14
  325. package/src/react/hooks/collectible/primary-sale-item.test.tsx +503 -0
  326. package/src/react/hooks/{data/primary-sales/usePrimarySaleItem.tsx → collectible/primary-sale-item.tsx} +6 -8
  327. package/src/react/hooks/collectible/primary-sale-items-count.test.tsx +154 -0
  328. package/src/react/hooks/collectible/primary-sale-items-count.tsx +22 -0
  329. package/src/react/hooks/collectible/primary-sale-items.test.tsx +259 -0
  330. package/src/react/hooks/{data/primary-sales/useListPrimarySaleItems.tsx → collectible/primary-sale-items.tsx} +9 -9
  331. package/src/react/hooks/{data/collectibles/useTokenBalances.test.tsx → collectible/token-balances.test.tsx} +52 -28
  332. package/src/react/hooks/{data/collectibles/useTokenBalances.tsx → collectible/token-balances.tsx} +10 -10
  333. package/src/react/hooks/{data/collections/__snapshots__/useListCollections.test.tsx.snap → collection/__snapshots__/list.test.tsx.snap} +20 -20
  334. package/src/react/hooks/{data/collections/useCollectionBalanceDetails.test.tsx → collection/balance-details.test.tsx} +13 -8
  335. package/src/react/hooks/{data/collections/useCollectionBalanceDetails.tsx → collection/balance-details.tsx} +3 -3
  336. package/src/react/hooks/collection/index.ts +11 -0
  337. package/src/react/hooks/{data/collections/useListCollections.test.tsx → collection/list.test.tsx} +15 -14
  338. package/src/react/hooks/{data/collections/useListCollections.tsx → collection/list.tsx} +7 -7
  339. package/src/react/hooks/collection/market-detail-polling.test.tsx +146 -0
  340. package/src/react/hooks/{data/collections/useCollectionDetailsPolling.tsx → collection/market-detail-polling.tsx} +13 -12
  341. package/src/react/hooks/collection/market-filtered-count.test.tsx +121 -0
  342. package/src/react/hooks/{data/orders/useGetCountOfFilteredOrders.tsx → collection/market-filtered-count.tsx} +6 -6
  343. package/src/react/hooks/{data/orders/useFloorOrder.test.tsx → collection/market-floor.test.tsx} +19 -15
  344. package/src/react/hooks/{data/orders/useFloorOrder.tsx → collection/market-floor.tsx} +13 -9
  345. package/src/react/hooks/collection/market-items-count.test.tsx +121 -0
  346. package/src/react/hooks/{data/orders/useCountItemsOrdersForCollection.tsx → collection/market-items-count.tsx} +9 -9
  347. package/src/react/hooks/collection/market-items-paginated.test.tsx +142 -0
  348. package/src/react/hooks/{data/orders/useListItemsOrdersForCollectionPaginated.tsx → collection/market-items-paginated.tsx} +11 -9
  349. package/src/react/hooks/collection/market-items.test.tsx +184 -0
  350. package/src/react/hooks/{data/orders/useListItemsOrdersForCollection.tsx → collection/market-items.tsx} +16 -14
  351. package/src/react/hooks/{data/collections/useCollection.test.tsx → collection/metadata.test.tsx} +18 -13
  352. package/src/react/hooks/{data/collections/useCollection.tsx → collection/metadata.tsx} +16 -7
  353. package/src/react/hooks/collection/useCollectionActiveListingsCurrencies.test.tsx +150 -0
  354. package/src/react/hooks/{data/collections → collection}/useCollectionActiveListingsCurrencies.tsx +3 -3
  355. package/src/react/hooks/collection/useCollectionActiveOffersCurrencies.test.tsx +150 -0
  356. package/src/react/hooks/{data/collections → collection}/useCollectionActiveOffersCurrencies.tsx +3 -3
  357. package/src/react/hooks/config/__snapshots__/useMarketplaceConfig.test.tsx.snap +12 -11
  358. package/src/react/hooks/config/useConnectorMetadata.tsx +1 -1
  359. package/src/react/hooks/config/useMarketplaceConfig.test.tsx +3 -1
  360. package/src/react/hooks/config/useMarketplaceConfig.tsx +1 -1
  361. package/src/react/hooks/contracts/index.ts +1 -0
  362. package/src/react/hooks/contracts/useERC721Owner.test.tsx +82 -0
  363. package/src/react/hooks/contracts/useERC721Owner.tsx +47 -0
  364. package/src/react/hooks/contracts/useSalesContractABI.ts +2 -2
  365. package/src/react/hooks/{utils/useComparePrices.test.tsx → currency/compare-prices.test.tsx} +17 -11
  366. package/src/react/hooks/{utils/useComparePrices.tsx → currency/compare-prices.tsx} +8 -6
  367. package/src/react/hooks/{utils/useConvertPriceToUSD.test.tsx → currency/convert-to-usd.test.tsx} +17 -16
  368. package/src/react/hooks/{utils/useConvertPriceToUSD.tsx → currency/convert-to-usd.tsx} +6 -6
  369. package/src/react/hooks/{data/market/useCurrency.test.tsx → currency/currency.test.tsx} +18 -14
  370. package/src/react/hooks/{data/market/useCurrency.tsx → currency/currency.tsx} +3 -3
  371. package/src/react/hooks/currency/index.ts +4 -0
  372. package/src/react/hooks/{data/market/useMarketCurrencies.test.tsx → currency/list.test.tsx} +55 -59
  373. package/src/react/hooks/{data/market/useMarketCurrencies.tsx → currency/list.tsx} +7 -7
  374. package/src/react/hooks/data/orders/useOrders.test.tsx +143 -0
  375. package/src/react/hooks/data/orders/useOrders.tsx +73 -0
  376. package/src/react/hooks/data/tokens/useCurrencyBalance.tsx +1 -1
  377. package/src/react/hooks/index.ts +9 -12
  378. package/src/react/hooks/inventory/index.ts +1 -0
  379. package/src/react/hooks/{data/inventory/useInventory.test.tsx → inventory/inventory.test.tsx} +12 -14
  380. package/src/react/hooks/inventory/inventory.tsx +17 -0
  381. package/src/react/hooks/{data/tokens/useListBalances.test.tsx → token/balances.test.tsx} +22 -11
  382. package/src/react/hooks/token/balances.tsx +59 -0
  383. package/src/react/hooks/{data/tokens/useCurrencyBalance.test.tsx → token/currency-balance.test.tsx} +6 -6
  384. package/src/react/hooks/token/currency-balance.tsx +151 -0
  385. package/src/react/hooks/token/index.ts +5 -0
  386. package/src/react/hooks/{data/tokens/useSearchTokenMetadata.test.tsx → token/metadata-search.test.tsx} +38 -30
  387. package/src/react/hooks/{data/tokens/useSearchTokenMetadata.tsx → token/metadata-search.tsx} +27 -24
  388. package/src/react/hooks/{data/tokens/useListTokenMetadata.test.tsx → token/metadata.test.tsx} +27 -24
  389. package/src/react/hooks/{data/tokens/useListTokenMetadata.tsx → token/metadata.tsx} +7 -7
  390. package/src/react/hooks/{data/tokens/useGetTokenRanges.test.tsx → token/ranges.test.tsx} +15 -14
  391. package/src/react/hooks/{data/tokens/useGetTokenRanges.tsx → token/ranges.tsx} +12 -13
  392. package/src/react/hooks/transactions/index.ts +5 -0
  393. package/src/react/hooks/transactions/useBuyTransaction.tsx +95 -0
  394. package/src/react/hooks/transactions/useCancelOrder.test.tsx +15 -35
  395. package/src/react/hooks/transactions/useCancelOrder.tsx +3 -9
  396. package/src/react/hooks/transactions/useCancelTransactionSteps.tsx +3 -9
  397. package/src/react/hooks/transactions/useGenerateCancelTransaction.test.tsx +23 -12
  398. package/src/react/hooks/transactions/useGenerateCancelTransaction.tsx +16 -11
  399. package/src/react/hooks/transactions/useGenerateListingTransaction.test.tsx +17 -57
  400. package/src/react/hooks/transactions/useGenerateListingTransaction.tsx +17 -12
  401. package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +14 -15
  402. package/src/react/hooks/transactions/useGenerateOfferTransaction.tsx +11 -11
  403. package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +28 -38
  404. package/src/react/hooks/transactions/useGenerateSellTransaction.tsx +16 -15
  405. package/src/react/hooks/transactions/useMarketTransactionSteps.test.tsx +105 -0
  406. package/src/react/hooks/transactions/useMarketTransactionSteps.tsx +129 -0
  407. package/src/react/hooks/transactions/useOrderSteps.tsx +23 -36
  408. package/src/react/hooks/transactions/usePrimarySaleTransactionSteps.ts +196 -0
  409. package/src/react/hooks/transactions/useProcessStep.test.tsx +63 -59
  410. package/src/react/hooks/transactions/useProcessStep.ts +52 -54
  411. package/src/react/hooks/transactions/useTransactionExecution.test.tsx +99 -0
  412. package/src/react/hooks/transactions/useTransactionExecution.ts +31 -0
  413. package/src/react/hooks/transactions/useTransactionType.ts +20 -0
  414. package/src/react/hooks/transactions/useTransferTokens.test.tsx +16 -16
  415. package/src/react/hooks/transactions/useTransferTokens.tsx +17 -5
  416. package/src/react/hooks/ui/card-data/index.ts +4 -0
  417. package/src/react/hooks/ui/card-data/market-card-data-paged.test.tsx +375 -0
  418. package/src/react/hooks/ui/card-data/market-card-data-paged.tsx +265 -0
  419. package/src/react/hooks/{data/market/useListMarketCardData.test.tsx → ui/card-data/market-card-data.test.tsx} +30 -28
  420. package/src/react/hooks/{data/market/useListMarketCardData.tsx → ui/card-data/market-card-data.tsx} +44 -31
  421. package/src/react/hooks/{data/primary-sales/useList1155ShopCardData.tsx → ui/card-data/primary-sale-1155-card-data.tsx} +24 -31
  422. package/src/react/hooks/{data/primary-sales/useList721ShopCardData.tsx → ui/card-data/primary-sale-721-card-data.tsx} +70 -37
  423. package/src/react/hooks/ui/index.ts +3 -1
  424. package/src/react/hooks/ui/url-state/filter-state.test.tsx +569 -0
  425. package/src/react/hooks/ui/{useFilterState.tsx → url-state/filter-state.tsx} +34 -20
  426. package/src/react/hooks/ui/url-state/index.ts +1 -0
  427. package/src/react/hooks/ui/useCollectibleCardOfferState.test.tsx +75 -0
  428. package/src/react/hooks/ui/useCollectibleCardOfferState.ts +47 -0
  429. package/src/react/hooks/ui/useFilters.test.tsx +4 -1
  430. package/src/react/hooks/ui/useFilters.tsx +2 -2
  431. package/src/react/hooks/util/optimisticCancelUpdates.test.ts +489 -0
  432. package/src/react/hooks/util/optimisticCancelUpdates.ts +21 -22
  433. package/src/react/hooks/utils/index.ts +0 -4
  434. package/src/react/hooks/utils/useAutoSelectFeeOption.test.tsx +8 -5
  435. package/src/react/hooks/utils/useAutoSelectFeeOption.tsx +33 -17
  436. package/src/react/hooks/utils/useRoyalty.test.tsx +1 -1
  437. package/src/react/hooks/utils/useRoyalty.tsx +99 -34
  438. package/src/react/hooks/utils/useWaasFeeOptions.tsx +234 -0
  439. package/src/react/hooks/utils/waasFeeOptionsStore.ts +141 -0
  440. package/src/react/index.ts +3 -0
  441. package/src/react/providers/index.tsx +3 -3
  442. package/src/react/providers/modal-provider.tsx +6 -17
  443. package/src/react/providers/provider.test.tsx +1 -1
  444. package/src/react/providers/shadow-root.tsx +1 -1
  445. package/src/react/providers/theme-provider.tsx +1 -1
  446. package/src/react/queries/checkout/index.ts +1 -0
  447. package/src/react/queries/checkout/primary-sale-checkout-options.ts +118 -0
  448. package/src/react/queries/collectible/balance.ts +113 -0
  449. package/src/react/queries/collectible/index.ts +15 -0
  450. package/src/react/queries/collectible/market-count.ts +91 -0
  451. package/src/react/queries/collectible/market-highest-offer.ts +74 -0
  452. package/src/react/queries/collectible/market-list-paginated.ts +110 -0
  453. package/src/react/queries/collectible/market-list.ts +118 -0
  454. package/src/react/queries/collectible/market-listings-count.ts +70 -0
  455. package/src/react/queries/collectible/market-listings.ts +71 -0
  456. package/src/react/queries/collectible/market-lowest-listing.ts +74 -0
  457. package/src/react/queries/collectible/market-offers-count.ts +70 -0
  458. package/src/react/queries/collectible/market-offers.ts +90 -0
  459. package/src/react/queries/collectible/metadata.ts +84 -0
  460. package/src/react/queries/collectible/primary-sale-item.ts +79 -0
  461. package/src/react/queries/collectible/primary-sale-items-count.ts +67 -0
  462. package/src/react/queries/collectible/primary-sale-items.ts +96 -0
  463. package/src/react/queries/collectible/queryKeys.ts +12 -0
  464. package/src/react/queries/collectible/token-balances.ts +83 -0
  465. package/src/react/queries/collection/activeListingsCurrencies.ts +74 -0
  466. package/src/react/queries/collection/activeOffersCurrencies.ts +74 -0
  467. package/src/react/queries/collection/balance-details.ts +103 -0
  468. package/src/react/queries/collection/index.ts +9 -0
  469. package/src/react/queries/collection/list.ts +195 -0
  470. package/src/react/queries/collection/market-detail.ts +60 -0
  471. package/src/react/queries/collection/market-filtered-count.ts +67 -0
  472. package/src/react/queries/collection/market-floor.ts +58 -0
  473. package/src/react/queries/collection/market-items-count.ts +69 -0
  474. package/src/react/queries/collection/market-items-paginated.ts +84 -0
  475. package/src/react/queries/collection/market-items.ts +72 -0
  476. package/src/react/queries/collection/metadata.ts +60 -0
  477. package/src/react/queries/collection/queryKeys.ts +12 -0
  478. package/src/react/queries/currency/compare-prices.ts +122 -0
  479. package/src/react/queries/currency/convert-to-usd.ts +99 -0
  480. package/src/react/queries/currency/currency.ts +82 -0
  481. package/src/react/queries/currency/index.ts +4 -0
  482. package/src/react/queries/currency/list.ts +103 -0
  483. package/src/react/queries/index.ts +6 -7
  484. package/src/react/queries/inventory/inventory.ts +144 -94
  485. package/src/react/queries/marketplace/config.ts +85 -0
  486. package/src/react/queries/marketplace/filters.ts +141 -0
  487. package/src/react/queries/marketplace/index.ts +2 -0
  488. package/src/react/queries/marketplace/queryKeys.ts +12 -0
  489. package/src/react/queries/orders.ts +48 -0
  490. package/src/react/queries/token/balances.ts +107 -0
  491. package/src/react/queries/token/index.ts +5 -0
  492. package/src/react/queries/token/metadata-search.ts +95 -0
  493. package/src/react/queries/token/metadata.ts +80 -0
  494. package/src/react/queries/token/queryKeys.ts +12 -0
  495. package/src/react/queries/token/ranges.ts +74 -0
  496. package/src/react/queries/token/supplies.ts +86 -0
  497. package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +11 -10
  498. package/src/react/ssr/create-ssr-client.ts +1 -1
  499. package/src/react/ssr/index.ts +5 -0
  500. package/src/react/types/query.ts +8 -7
  501. package/src/react/ui/components/_internals/ErrorDisplay.tsx +87 -0
  502. package/src/react/ui/components/_internals/ErrorLogBox.tsx +8 -1
  503. package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +13 -14
  504. package/src/react/ui/components/_internals/pill/__tests__/Pill.test.tsx +9 -5
  505. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/ActionButton.stories.tsx +24 -29
  506. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/ActionButton.tsx +20 -14
  507. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/ActionButtonBody.test.tsx +7 -5
  508. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/NonOwnerActions.test.tsx +11 -6
  509. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/OwnerActions.test.tsx +8 -6
  510. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/__tests__/useActionButtonLogic.test.tsx +6 -4
  511. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/components/ActionButtonBody.tsx +14 -9
  512. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/components/NonOwnerActions.tsx +26 -35
  513. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/components/OwnerActions.tsx +21 -13
  514. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/hooks/useActionButtonLogic.ts +3 -3
  515. package/src/react/ui/components/marketplace-collectible-card/ActionButton/index.ts +1 -0
  516. package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/store.ts +4 -4
  517. package/src/react/ui/components/marketplace-collectible-card/Card/card-badge.tsx +37 -0
  518. package/src/react/ui/components/marketplace-collectible-card/Card/card-content.tsx +27 -0
  519. package/src/react/ui/components/marketplace-collectible-card/Card/card-footer.tsx +38 -0
  520. package/src/react/ui/components/marketplace-collectible-card/Card/card-media.tsx +69 -0
  521. package/src/react/ui/components/marketplace-collectible-card/Card/card-price.tsx +44 -0
  522. package/src/react/ui/components/marketplace-collectible-card/Card/card-sale-details.tsx +37 -0
  523. package/src/react/ui/components/marketplace-collectible-card/Card/card-skeleton.tsx +39 -0
  524. package/src/react/ui/components/marketplace-collectible-card/Card/card-title.tsx +109 -0
  525. package/src/react/ui/components/marketplace-collectible-card/Card/card.tsx +51 -0
  526. package/src/react/ui/components/marketplace-collectible-card/Card/index.ts +30 -0
  527. package/src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx +1 -1
  528. package/src/react/ui/components/marketplace-collectible-card/_internals/PriceDisplay.tsx +87 -0
  529. package/src/react/ui/components/marketplace-collectible-card/constants.ts +20 -0
  530. package/src/react/ui/components/marketplace-collectible-card/index.ts +6 -0
  531. package/src/react/ui/components/marketplace-collectible-card/types.ts +31 -16
  532. package/src/react/ui/components/marketplace-collectible-card/utils/determineCardAction.ts +63 -0
  533. package/src/react/ui/components/marketplace-collectible-card/utils/formatPrice.ts +71 -2
  534. package/src/react/ui/components/marketplace-collectible-card/utils/index.ts +3 -0
  535. package/src/react/ui/components/marketplace-collectible-card/utils/renderSkeleton.tsx +44 -0
  536. package/src/react/ui/components/marketplace-collectible-card/utils/shopCardState.ts +83 -0
  537. package/src/react/ui/components/marketplace-collectible-card/utils/supplyStatus.ts +5 -5
  538. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +63 -78
  539. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCardPresentation.tsx +170 -0
  540. package/src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx +56 -38
  541. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +55 -65
  542. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCardPresentation.tsx +144 -0
  543. package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +1 -5
  544. package/src/react/ui/components/media/Media.tsx +1 -1
  545. package/src/react/ui/components/media/MediaSkeleton.tsx +1 -1
  546. package/src/react/ui/hooks/index.ts +2 -0
  547. package/src/react/ui/icons/BellIcon.tsx +7 -3
  548. package/src/react/ui/icons/iconVariants.ts +11 -0
  549. package/src/react/ui/icons/index.ts +0 -3
  550. package/src/react/ui/index.ts +37 -8
  551. package/src/react/ui/modals/BuyModal/components/BuyModalContent.tsx +195 -0
  552. package/src/react/ui/modals/BuyModal/components/CollectibleMetadataSummary.tsx +141 -0
  553. package/src/react/ui/modals/BuyModal/components/CryptoPaymentModal.tsx +177 -0
  554. package/src/react/ui/modals/BuyModal/components/CryptoPaymentModalSkeleton.tsx +48 -0
  555. package/src/react/ui/modals/BuyModal/components/Modal.tsx +2 -2
  556. package/src/react/ui/modals/BuyModal/components/TrailsCss.ts +216 -0
  557. package/src/react/ui/modals/BuyModal/components/{ERC1155QuantityModal.tsx → sequence-checkout/ERC1155QuantityModal.tsx} +71 -82
  558. package/src/react/ui/modals/BuyModal/components/sequence-checkout/SequenceCheckoutNew.tsx +161 -0
  559. package/src/react/ui/modals/BuyModal/{hooks → components/sequence-checkout}/usePaymentModalParams.ts +73 -112
  560. package/src/react/ui/modals/BuyModal/components/types.ts +6 -5
  561. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155SalePaymentParams.test.tsx +2 -14
  562. package/src/react/ui/modals/BuyModal/hooks/useBuyModalData.ts +151 -0
  563. package/src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts +15 -28
  564. package/src/react/ui/modals/BuyModal/hooks/useExecuteBundledTransactions.ts +167 -0
  565. package/src/react/ui/modals/BuyModal/hooks/useHasSufficientBalance.ts +30 -0
  566. package/src/react/ui/modals/BuyModal/hooks/useMarketPlatformFee.ts +7 -7
  567. package/src/react/ui/modals/BuyModal/index.tsx +6 -3
  568. package/src/react/ui/modals/BuyModal/internal/__tests__/determineCheckoutMode.test.ts +119 -0
  569. package/src/react/ui/modals/BuyModal/internal/buyModalContext.ts +146 -0
  570. package/src/react/ui/modals/BuyModal/internal/cryptoPaymentModalContext.tsx +399 -0
  571. package/src/react/ui/modals/BuyModal/internal/determineCheckoutMode.ts +49 -0
  572. package/src/react/ui/modals/BuyModal/store.ts +25 -94
  573. package/src/react/ui/modals/CreateListingModal/Modal.tsx +141 -308
  574. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +35 -61
  575. package/src/react/ui/modals/CreateListingModal/index.tsx +16 -9
  576. package/src/react/ui/modals/CreateListingModal/internal/context.ts +416 -0
  577. package/src/react/ui/modals/CreateListingModal/internal/helpers/validation.ts +79 -0
  578. package/src/react/ui/modals/CreateListingModal/internal/hooks/index.ts +1 -0
  579. package/src/react/ui/modals/CreateListingModal/internal/hooks/use-collectible-approval.ts +49 -0
  580. package/src/react/ui/modals/CreateListingModal/internal/listing-mutations.ts +267 -0
  581. package/src/react/ui/modals/CreateListingModal/internal/store.ts +153 -0
  582. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +130 -348
  583. package/src/react/ui/modals/MakeOfferModal/__stories__/MakeOfferModal.mock-data.ts +494 -0
  584. package/src/react/ui/modals/MakeOfferModal/__stories__/MakeOfferModal.stories.tsx +699 -0
  585. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +28 -155
  586. package/src/react/ui/modals/MakeOfferModal/index.tsx +17 -11
  587. package/src/react/ui/modals/MakeOfferModal/internal/context.ts +472 -0
  588. package/src/react/ui/modals/MakeOfferModal/internal/helpers/validation.ts +114 -0
  589. package/src/react/ui/modals/MakeOfferModal/internal/hooks/index.ts +1 -0
  590. package/src/react/ui/modals/MakeOfferModal/internal/hooks/use-erc20-allowance.ts +43 -0
  591. package/src/react/ui/modals/MakeOfferModal/internal/offer-mutations.ts +231 -0
  592. package/src/react/ui/modals/MakeOfferModal/internal/store.ts +153 -0
  593. package/src/react/ui/modals/SellModal/Modal.tsx +74 -213
  594. package/src/react/ui/modals/SellModal/index.tsx +5 -11
  595. package/src/react/ui/modals/SellModal/internal/context.ts +284 -0
  596. package/src/react/ui/modals/SellModal/internal/sell-mutations.ts +163 -0
  597. package/src/react/ui/modals/SellModal/internal/store.ts +79 -0
  598. package/src/react/ui/modals/SellModal/internal/use-generate-sell-transaction.ts +93 -0
  599. package/src/react/ui/modals/TransferModal/__tests__/store.test.ts +51 -345
  600. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +36 -34
  601. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +19 -28
  602. package/src/react/ui/modals/TransferModal/index.tsx +98 -119
  603. package/src/react/ui/modals/TransferModal/internal/context.ts +404 -0
  604. package/src/react/ui/modals/TransferModal/internal/store.ts +118 -0
  605. package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +2 -3
  606. package/src/react/ui/modals/_internal/components/baseModal/ActionModal.tsx +338 -0
  607. package/src/react/ui/modals/_internal/components/baseModal/BaseModal.tsx +51 -0
  608. package/src/react/ui/modals/_internal/components/baseModal/ErrorBoundary.tsx +83 -0
  609. package/src/react/ui/modals/_internal/components/baseModal/ErrorModal.tsx +51 -0
  610. package/src/react/ui/modals/_internal/components/baseModal/LoadingModal.tsx +35 -0
  611. package/src/react/ui/modals/_internal/components/baseModal/SmartErrorHandler.tsx +31 -0
  612. package/src/react/ui/modals/_internal/components/baseModal/__tests__/ErrorBoundary.test.tsx +390 -0
  613. package/src/react/ui/modals/_internal/components/baseModal/errors/ModalInitializationError.tsx +93 -0
  614. package/src/react/ui/modals/_internal/components/baseModal/errors/errorActionType.ts +5 -0
  615. package/src/react/ui/modals/_internal/components/baseModal/index.ts +13 -0
  616. package/src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx +1 -1
  617. package/src/react/ui/modals/_internal/components/calendarDropdown/index.tsx +14 -9
  618. package/src/react/ui/modals/_internal/components/consts.ts +19 -5
  619. package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +5 -7
  620. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +6 -14
  621. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +17 -24
  622. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
  623. package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +61 -40
  624. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +23 -19
  625. package/src/react/ui/modals/_internal/components/priceInput/__tests__/PriceInput.test.tsx +3 -3
  626. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +68 -75
  627. package/src/react/ui/modals/_internal/components/quantityInput/__tests__/index.test.tsx +22 -137
  628. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +84 -131
  629. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +14 -31
  630. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/ActionButtons.tsx +37 -25
  631. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +13 -6
  632. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts +9 -26
  633. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +27 -29
  634. package/src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts +2 -2
  635. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +10 -9
  636. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +16 -9
  637. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +8 -7
  638. package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
  639. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +3 -5
  640. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +3 -3
  641. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +4 -15
  642. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +14 -15
  643. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +8 -11
  644. package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +65 -10
  645. package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +484 -0
  646. package/src/react/ui/modals/_internal/helpers/currency.ts +56 -0
  647. package/src/react/ui/modals/_internal/helpers/dnum-utils.ts +40 -0
  648. package/src/react/ui/modals/_internal/helpers/flow-state.ts +269 -0
  649. package/src/react/ui/modals/_internal/helpers/step-guards.ts +131 -0
  650. package/src/react/ui/modals/_internal/types/steps.ts +145 -0
  651. package/src/react/ui/modals/_internal/types.ts +2 -9
  652. package/src/react/utils/index.ts +2 -0
  653. package/src/react/utils/normalize-attributes.test.ts +94 -0
  654. package/src/react/utils/normalize-attributes.ts +89 -0
  655. package/src/react/utils/normalize-properties.test.ts +77 -0
  656. package/src/react/utils/normalize-properties.ts +60 -0
  657. package/src/react/utils/normalizePriceFilters.ts +25 -0
  658. package/src/react/utils/waitForTransactionReceipt.ts +2 -2
  659. package/src/styles/index.css +2 -0
  660. package/src/styles/styles.ts +2056 -376
  661. package/src/types/api-types.ts +6 -14
  662. package/src/types/buyModalErrors.ts +24 -30
  663. package/src/types/index.ts +4 -2
  664. package/src/types/sdk-config.ts +14 -1
  665. package/src/types/transactions.ts +10 -0
  666. package/src/types/types.ts +93 -14
  667. package/src/utils/__tests__/getMarketplaceDetails.test.ts +1 -1
  668. package/src/utils/_internal/error/base.ts +1 -1
  669. package/src/utils/_internal/error/transaction.ts +4 -5
  670. package/src/utils/abi/helpers.ts +38 -0
  671. package/src/utils/abi/index.ts +1 -0
  672. package/src/utils/collection.ts +19 -0
  673. package/src/utils/decode/erc20.ts +2 -2
  674. package/src/utils/errors.ts +527 -0
  675. package/src/utils/getConduitAddressForOrderbook.ts +38 -0
  676. package/src/utils/getErrorMessage.ts +37 -0
  677. package/src/utils/getMarketplaceDetails.ts +1 -1
  678. package/src/utils/getSequenceMarketRequestId.ts +3 -7
  679. package/src/utils/getWagmiErrorMessage.ts +241 -0
  680. package/src/utils/getWebRPCErrorMessage.ts +63 -0
  681. package/src/utils/index.ts +1 -0
  682. package/src/utils/networkconfigToWagmiChain.ts +2 -1
  683. package/src/utils/price.ts +12 -10
  684. package/test/const.ts +3 -3
  685. package/test/globalSetup.ts +4 -5
  686. package/test/handlers.ts +2 -2
  687. package/test/server-setup.ts +8 -8
  688. package/test/setup.ts +11 -0
  689. package/test/test-utils.tsx +23 -6
  690. package/tsconfig.json +8 -1
  691. package/tsdown.config.ts +12 -3
  692. package/dist/CartIcon.js +0 -102
  693. package/dist/CartIcon.js.map +0 -1
  694. package/dist/CollectibleCard.d.ts +0 -8
  695. package/dist/builder.gen.js +0 -300
  696. package/dist/builder.gen.js.map +0 -1
  697. package/dist/collectibles.js +0 -319
  698. package/dist/collectibles.js.map +0 -1
  699. package/dist/collections.js +0 -320
  700. package/dist/collections.js.map +0 -1
  701. package/dist/components.js +0 -117
  702. package/dist/components.js.map +0 -1
  703. package/dist/listCollectiblesPaginated.d.ts +0 -322
  704. package/dist/listCollections.d.ts +0 -821
  705. package/dist/lowestListing.d.ts +0 -465
  706. package/dist/market.js +0 -207
  707. package/dist/market.js.map +0 -1
  708. package/dist/marketCurrencies.d.ts +0 -163
  709. package/dist/marketCurrencies.js +0 -56
  710. package/dist/marketCurrencies.js.map +0 -1
  711. package/dist/marketplace.gen.js +0 -1144
  712. package/dist/marketplace.gen.js.map +0 -1
  713. package/dist/marketplaceConfig.js.map +0 -1
  714. package/dist/orders.js +0 -462
  715. package/dist/orders.js.map +0 -1
  716. package/dist/primary-sales.js +0 -152
  717. package/dist/primary-sales.js.map +0 -1
  718. package/dist/query.d.ts +0 -31
  719. package/dist/react/hooks/data/collectibles/index.d.ts +0 -5
  720. package/dist/react/hooks/data/collectibles/index.js +0 -39
  721. package/dist/react/hooks/data/collections/index.d.ts +0 -11
  722. package/dist/react/hooks/data/collections/index.js +0 -39
  723. package/dist/react/hooks/data/index.d.ts +0 -37
  724. package/dist/react/hooks/data/index.js +0 -39
  725. package/dist/react/hooks/data/inventory/index.d.ts +0 -37
  726. package/dist/react/hooks/data/inventory/index.js +0 -39
  727. package/dist/react/hooks/data/market/index.d.ts +0 -6
  728. package/dist/react/hooks/data/market/index.js +0 -39
  729. package/dist/react/hooks/data/orders/index.d.ts +0 -5
  730. package/dist/react/hooks/data/orders/index.js +0 -39
  731. package/dist/react/hooks/data/primary-sales/index.d.ts +0 -37
  732. package/dist/react/hooks/data/primary-sales/index.js +0 -39
  733. package/dist/react/hooks/data/tokens/index.d.ts +0 -5
  734. package/dist/react/hooks/data/tokens/index.js +0 -39
  735. package/dist/react/queries/collectibles/index.d.ts +0 -5
  736. package/dist/react/queries/collectibles/index.js +0 -22
  737. package/dist/react/queries/collections/index.d.ts +0 -11
  738. package/dist/react/queries/collections/index.js +0 -20
  739. package/dist/react/queries/market/index.d.ts +0 -6
  740. package/dist/react/queries/market/index.js +0 -22
  741. package/dist/react/queries/orders/index.d.ts +0 -5
  742. package/dist/react/queries/orders/index.js +0 -13
  743. package/dist/react/queries/primary-sales/index.d.ts +0 -4
  744. package/dist/react/queries/primary-sales/index.js +0 -13
  745. package/dist/react/queries/tokens/index.d.ts +0 -5
  746. package/dist/react/queries/tokens/index.js +0 -13
  747. package/dist/react/queries/utils/index.d.ts +0 -4
  748. package/dist/react/queries/utils/index.js +0 -22
  749. package/dist/react/ssr/index.js.map +0 -1
  750. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +0 -3
  751. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +0 -22
  752. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +0 -51
  753. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +0 -39
  754. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +0 -40
  755. package/dist/react/ui/modals/_internal/components/actionModal/index.js +0 -39
  756. package/dist/src.js.map +0 -1
  757. package/dist/tokenBalances.js +0 -56
  758. package/dist/tokenBalances.js.map +0 -1
  759. package/dist/tokenSupplies.d.ts +0 -261
  760. package/dist/tokens.js +0 -219
  761. package/dist/tokens.js.map +0 -1
  762. package/dist/utils3.js +0 -43
  763. package/dist/utils3.js.map +0 -1
  764. package/dist/waitForTransactionReceipt.js +0 -25
  765. package/dist/waitForTransactionReceipt.js.map +0 -1
  766. package/src/react/_internal/api/__mocks__/builder.msw.ts +0 -239
  767. package/src/react/_internal/api/__mocks__/indexer.msw.ts +0 -216
  768. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +0 -402
  769. package/src/react/_internal/api/__mocks__/metadata.msw.ts +0 -195
  770. package/src/react/_internal/api/builder.gen.ts +0 -773
  771. package/src/react/_internal/api/marketplace.gen.ts +0 -2718
  772. package/src/react/_internal/api/query-keys.ts +0 -124
  773. package/src/react/hooks/data/collectibles/index.ts +0 -6
  774. package/src/react/hooks/data/collectibles/useListCollectibleActivities.test.tsx +0 -192
  775. package/src/react/hooks/data/collectibles/useListCollectibleActivities.tsx +0 -98
  776. package/src/react/hooks/data/collections/index.ts +0 -8
  777. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +0 -112
  778. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +0 -110
  779. package/src/react/hooks/data/collections/useCollectionDetails.test.tsx +0 -83
  780. package/src/react/hooks/data/collections/useCollectionDetails.ts +0 -69
  781. package/src/react/hooks/data/collections/useCollectionDetailsPolling.test.tsx +0 -137
  782. package/src/react/hooks/data/collections/useListCollectionActivities.test.tsx +0 -227
  783. package/src/react/hooks/data/collections/useListCollectionActivities.tsx +0 -93
  784. package/src/react/hooks/data/index.ts +0 -6
  785. package/src/react/hooks/data/inventory/index.ts +0 -1
  786. package/src/react/hooks/data/inventory/useInventory.tsx +0 -12
  787. package/src/react/hooks/data/market/index.ts +0 -3
  788. package/src/react/hooks/data/orders/index.ts +0 -11
  789. package/src/react/hooks/data/primary-sales/index.ts +0 -7
  790. package/src/react/hooks/data/primary-sales/useCountOfPrimarySaleItems.tsx +0 -13
  791. package/src/react/hooks/data/primary-sales/useGetCountOfPrimarySaleItems.tsx +0 -48
  792. package/src/react/hooks/data/tokens/index.ts +0 -5
  793. package/src/react/hooks/data/tokens/useListBalances.tsx +0 -29
  794. package/src/react/hooks/data/tokens/useTokenSupplies.ts +0 -69
  795. package/src/react/hooks/utils/useCheckoutOptions.test.tsx +0 -162
  796. package/src/react/hooks/utils/useCheckoutOptions.tsx +0 -98
  797. package/src/react/queries/collectibles/balanceOfCollectible.ts +0 -90
  798. package/src/react/queries/collectibles/collectible.ts +0 -81
  799. package/src/react/queries/collectibles/countOfCollectables.ts +0 -109
  800. package/src/react/queries/collectibles/index.ts +0 -7
  801. package/src/react/queries/collectibles/listCollectibleActivities.ts +0 -121
  802. package/src/react/queries/collectibles/listCollectibles.ts +0 -115
  803. package/src/react/queries/collectibles/listCollectiblesPaginated.ts +0 -104
  804. package/src/react/queries/collectibles/tokenBalances.ts +0 -89
  805. package/src/react/queries/collections/activeListingsCurrencies.ts +0 -84
  806. package/src/react/queries/collections/activeOffersCurrencies.ts +0 -84
  807. package/src/react/queries/collections/collection.ts +0 -69
  808. package/src/react/queries/collections/collectionBalanceDetails.ts +0 -107
  809. package/src/react/queries/collections/collectionDetails.ts +0 -79
  810. package/src/react/queries/collections/index.ts +0 -7
  811. package/src/react/queries/collections/listCollectionActivities.ts +0 -117
  812. package/src/react/queries/collections/listCollections.ts +0 -175
  813. package/src/react/queries/market/checkoutOptions.ts +0 -107
  814. package/src/react/queries/market/checkoutOptionsSalesContract.ts +0 -108
  815. package/src/react/queries/market/currency.ts +0 -92
  816. package/src/react/queries/market/filters.ts +0 -152
  817. package/src/react/queries/market/index.ts +0 -6
  818. package/src/react/queries/market/marketCurrencies.ts +0 -120
  819. package/src/react/queries/market/marketplaceConfig.ts +0 -117
  820. package/src/react/queries/orders/countItemsOrdersForCollection.ts +0 -86
  821. package/src/react/queries/orders/countListingsForCollectible.ts +0 -90
  822. package/src/react/queries/orders/countOffersForCollectible.ts +0 -90
  823. package/src/react/queries/orders/floorOrder.ts +0 -74
  824. package/src/react/queries/orders/getCountOfFilteredOrders.ts +0 -88
  825. package/src/react/queries/orders/highestOffer.ts +0 -78
  826. package/src/react/queries/orders/index.ts +0 -11
  827. package/src/react/queries/orders/listItemsOrdersForCollection.ts +0 -90
  828. package/src/react/queries/orders/listItemsOrdersForCollectionPaginated.ts +0 -90
  829. package/src/react/queries/orders/listListingsForCollectible.ts +0 -97
  830. package/src/react/queries/orders/listOffersForCollectible.ts +0 -116
  831. package/src/react/queries/orders/lowestListing.ts +0 -81
  832. package/src/react/queries/primary-sales/countOfPrimarySaleItems.ts +0 -62
  833. package/src/react/queries/primary-sales/index.ts +0 -4
  834. package/src/react/queries/primary-sales/primarySaleItem.ts +0 -80
  835. package/src/react/queries/primary-sales/primarySaleItems.ts +0 -94
  836. package/src/react/queries/primary-sales/primarySaleItemsCount.ts +0 -79
  837. package/src/react/queries/tokens/getTokenRanges.ts +0 -75
  838. package/src/react/queries/tokens/index.ts +0 -5
  839. package/src/react/queries/tokens/listBalances.ts +0 -71
  840. package/src/react/queries/tokens/listTokenMetadata.ts +0 -81
  841. package/src/react/queries/tokens/searchTokenMetadata.ts +0 -101
  842. package/src/react/queries/tokens/tokenSupplies.ts +0 -84
  843. package/src/react/queries/utils/comparePrices.ts +0 -132
  844. package/src/react/queries/utils/convertPriceToUSD.ts +0 -105
  845. package/src/react/queries/utils/index.ts +0 -2
  846. package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +0 -79
  847. package/src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx +0 -68
  848. package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +0 -165
  849. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/FooterName.tsx +0 -103
  850. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/PriceDisplay.tsx +0 -80
  851. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/SaleDetailsPill.tsx +0 -29
  852. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/TokenTypeBalancePill.tsx +0 -30
  853. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/index.ts +0 -4
  854. package/src/react/ui/components/marketplace-collectible-card/components/footer/index.ts +0 -2
  855. package/src/react/ui/icons/CalendarIcon.tsx +0 -37
  856. package/src/react/ui/icons/CartIcon.tsx +0 -52
  857. package/src/react/ui/icons/InfoIcon.tsx +0 -44
  858. package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +0 -557
  859. package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +0 -409
  860. package/src/react/ui/modals/BuyModal/__tests__/ERC721ShopModal.test.tsx +0 -272
  861. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx.bak +0 -112
  862. package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +0 -251
  863. package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +0 -105
  864. package/src/react/ui/modals/BuyModal/components/BuyModalRouter.tsx +0 -157
  865. package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +0 -198
  866. package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +0 -108
  867. package/src/react/ui/modals/BuyModal/components/ERC721BuyModal.tsx +0 -116
  868. package/src/react/ui/modals/BuyModal/components/ERC721ShopModal.tsx +0 -86
  869. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +0 -115
  870. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC721SalePaymentParams.test.tsx +0 -283
  871. package/src/react/ui/modals/BuyModal/hooks/__tests__/useMarketPlatformFee.test.tsx +0 -145
  872. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +0 -86
  873. package/src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts +0 -216
  874. package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +0 -120
  875. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +0 -98
  876. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +0 -87
  877. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +0 -246
  878. package/src/react/ui/modals/CreateListingModal/store.ts +0 -99
  879. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +0 -90
  880. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +0 -71
  881. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +0 -241
  882. package/src/react/ui/modals/MakeOfferModal/store.ts +0 -94
  883. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +0 -85
  884. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +0 -79
  885. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +0 -77
  886. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +0 -242
  887. package/src/react/ui/modals/SellModal/store.ts +0 -62
  888. package/src/react/ui/modals/SellModal/utils.ts +0 -38
  889. package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +0 -157
  890. package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +0 -154
  891. package/src/react/ui/modals/SuccessfulPurchaseModal/store.ts +0 -71
  892. package/src/react/ui/modals/TransferModal/__tests__/__snapshots__/store.test.ts.snap +0 -17
  893. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/__tests__/useHandleTransfer.test.tsx +0 -412
  894. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TransferButton.tsx +0 -66
  895. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +0 -137
  896. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +0 -97
  897. package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +0 -31
  898. package/src/react/ui/modals/TransferModal/messages.ts +0 -14
  899. package/src/react/ui/modals/TransferModal/store.ts +0 -122
  900. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +0 -281
  901. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +0 -113
  902. package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +0 -35
  903. package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +0 -32
  904. package/src/react/ui/modals/_internal/components/actionModal/index.ts +0 -1
  905. package/src/types/custom.d.ts +0 -1
  906. package/src/types/messages.ts +0 -43
  907. package/src/types/new-marketplace-types.ts +0 -95
  908. /package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/types.ts +0 -0
  909. /package/src/react/ui/modals/_internal/hooks/{useSelectWaasFeeOptions.ts → useSelectWaasFeeOptions.tsx} +0 -0
package/dist/index8.d.ts CHANGED
@@ -1,18 +1,129 @@
1
- import { W as MarketplaceSdkContext, Xi as WalletKind, c as MarketplaceConfig } from "./create-config.js";
2
- import * as _tanstack_react_query45 from "@tanstack/react-query";
1
+ import { U as MarketCollection, in as MarketplaceKind } from "./index2.js";
2
+ import { r as ClassValue } from "./index3.js";
3
+ import { n as Image } from "./index9.js";
4
+ import * as _0xsequence_network0 from "@0xsequence/network";
5
+ import { NetworkConfig } from "@0xsequence/network";
6
+ import { ComponentType } from "react";
7
+ import { Chain } from "viem";
3
8
 
4
- //#region src/react/hooks/config/useConfig.d.ts
5
- declare function useConfig(): MarketplaceSdkContext;
9
+ //#region src/utils/address.d.ts
10
+ declare const truncateMiddle: (address: string, minPrefix?: number, minSuffix?: number) => string;
11
+ declare const truncateEnd: (text: string | undefined, truncateAt: number) => string;
12
+ declare const compareAddress: (a?: string, b?: string) => boolean;
6
13
  //#endregion
7
- //#region src/react/hooks/config/useConnectorMetadata.d.ts
8
- declare const useConnectorMetadata: () => {
9
- isWaaS: boolean;
10
- isSequence: boolean | undefined;
11
- walletKind: WalletKind;
14
+ //#region src/utils/cn.d.ts
15
+ declare function cn(...inputs: ClassValue[]): string;
16
+ //#endregion
17
+ //#region src/utils/collection.d.ts
18
+ /**
19
+ * Finds a market collection matching both the collection address and chain ID.
20
+ * Always use this instead of manually searching market.collections to avoid
21
+ * multi-chain bugs where the same collection address exists on different chains.
22
+ */
23
+ declare const findMarketCollection: (collections: MarketCollection[], collectionAddress: string, chainId: string | number) => MarketCollection | undefined;
24
+ //#endregion
25
+ //#region src/utils/getMarketplaceDetails.d.ts
26
+ interface Marketplace {
27
+ logo: ComponentType<React.ComponentProps<typeof Image>>;
28
+ displayName: string;
29
+ }
30
+ type MarketplaceDetailsProp = {
31
+ originName: string;
32
+ kind: MarketplaceKind;
12
33
  };
34
+ declare function getMarketplaceDetails({
35
+ originName,
36
+ kind
37
+ }: MarketplaceDetailsProp): Marketplace | undefined;
38
+ //#endregion
39
+ //#region src/utils/network.d.ts
40
+ type ChainNameOrId = string | number;
41
+ declare const getNetwork: (nameOrId: ChainNameOrId) => _0xsequence_network0.NetworkMetadata;
42
+ declare const getPresentableChainName: (chainId: number) => string;
13
43
  //#endregion
14
- //#region src/react/hooks/config/useMarketplaceConfig.d.ts
15
- declare const useMarketplaceConfig: () => _tanstack_react_query45.UseQueryResult<MarketplaceConfig, Error>;
44
+ //#region src/utils/networkconfigToWagmiChain.d.ts
45
+ declare const networkToWagmiChain: (network: NetworkConfig) => Chain;
46
+ //#endregion
47
+ //#region src/utils/price.d.ts
48
+ type CalculatePriceDifferencePercentageArgs = {
49
+ inputPriceRaw: bigint;
50
+ basePriceRaw: bigint;
51
+ decimals: number;
52
+ };
53
+ /**
54
+ * Calculates the percentage difference between two prices
55
+ * @param args - Object containing input price, base price, and decimals
56
+ * @returns The percentage difference as a string with 2 decimal places
57
+ * @example
58
+ * ```ts
59
+ * const diff = calculatePriceDifferencePercentage({
60
+ * inputPriceRaw: 1000000n,
61
+ * basePriceRaw: 900000n,
62
+ * decimals: 6
63
+ * }); // Returns "11.11"
64
+ * ```
65
+ */
66
+ declare const calculatePriceDifferencePercentage: ({
67
+ inputPriceRaw,
68
+ basePriceRaw,
69
+ decimals
70
+ }: CalculatePriceDifferencePercentageArgs) => string;
71
+ /**
72
+ * Formats a raw price amount with the specified number of decimal places
73
+ * @param amount - The raw price amount as a bigint
74
+ * @param decimals - Number of decimal places to format to
75
+ * @returns Formatted price string with proper decimal and thousands separators
76
+ * @example
77
+ * ```ts
78
+ * const formatted = formatPrice(1000000n, 6); // Returns "1.000000"
79
+ * ```
80
+ */
81
+ declare const formatPrice: (amount: bigint, decimals: number) => string;
82
+ /**
83
+ * Calculates the final earnings amount after applying multiple fee percentages
84
+ * @param amount - The raw amount as a bigint (e.g., from a blockchain transaction)
85
+ * @param decimals - The number of decimal places for the currency (e.g., 18 for ETH, 6 for USDC)
86
+ * @param fees - Array of fee percentages to apply (e.g., [2.5, 1.0] for 2.5% and 1% fees)
87
+ * @returns Formatted string representing the final earnings after all fees are applied
88
+ * @throws Will return '0' if there's an error in calculation
89
+ * @example
90
+ * ```ts
91
+ * const earnings = calculateEarningsAfterFees(
92
+ * 1000000000000000000n, // 1 ETH
93
+ * 18, // ETH decimals
94
+ * [2.5, 1.0] // 2.5% and 1% fees
95
+ * ); // Returns "0.96525" (1 ETH after 2.5% and 1% fees)
96
+ * ```
97
+ */
98
+ declare const calculateEarningsAfterFees: (amount: bigint, decimals: number, fees: number[]) => string;
99
+ /**
100
+ * Formats a price amount with fee applied
101
+ * @param amount - The raw price amount as a bigint
102
+ * @param decimals - Number of decimal places for the currency
103
+ * @param feePercentage - Fee percentage to apply (e.g., 3.5 for 3.5%)
104
+ * @returns Formatted price string with fee applied and proper decimal/thousands separators
105
+ * @example
106
+ * ```ts
107
+ * const priceWithFee = formatPriceWithFee(1000000n, 6, 3.5); // Returns "1.035"
108
+ * ```
109
+ */
110
+ declare const formatPriceWithFee: (amount: bigint, decimals: number, feePercentage: number) => string;
111
+ declare const calculateTotalOfferCost: (offerAmountRaw: bigint, decimals: number, royaltyPercentage?: number) => bigint;
112
+ /**
113
+ * Validates if a price value meets OpenSea's decimal constraints for offers
114
+ * OpenSea allows maximum 4 decimal places for offers and minimum 0.0001
115
+ * @param value - The price value as a string
116
+ * @returns Object containing validation result and error message
117
+ * @example
118
+ * ```ts
119
+ * const result = validateOpenseaOfferDecimals('0.12345');
120
+ * // Returns { isValid: false, errorMessage: "Offer amount must be at least 0.0001" }
121
+ * ```
122
+ */
123
+ declare const validateOpenseaOfferDecimals: (value: string) => {
124
+ isValid: boolean;
125
+ errorMessage?: string;
126
+ };
16
127
  //#endregion
17
- export { useConnectorMetadata as n, useConfig as r, useMarketplaceConfig as t };
128
+ export { formatPriceWithFee as a, getNetwork as c, findMarketCollection as d, cn as f, truncateMiddle as h, formatPrice as i, getPresentableChainName as l, truncateEnd as m, calculatePriceDifferencePercentage as n, validateOpenseaOfferDecimals as o, compareAddress as p, calculateTotalOfferCost as r, networkToWagmiChain as s, calculateEarningsAfterFees as t, getMarketplaceDetails as u };
18
129
  //# sourceMappingURL=index8.d.ts.map
package/dist/index9.d.ts CHANGED
@@ -1,61 +1,47 @@
1
- import { Lt as ContractType } from "./create-config.js";
2
- import { i as ERC721_SALE_ABI_V0, n as ERC1155_SALES_CONTRACT_ABI_V0, r as ERC721_SALE_ABI_V1, t as ERC1155_SALES_CONTRACT_ABI_V1 } from "./index5.js";
3
- import { Address } from "viem";
1
+ import { n as ClassProp, t as HTMLMotionProps } from "./index3.js";
2
+ import { ComponentProps, ComponentType, JSX, ReactNode, SVGProps } from "react";
3
+ import * as react_jsx_runtime from "react/jsx-runtime";
4
+ import { VariantProps } from "class-variance-authority";
4
5
 
5
- //#region src/react/hooks/contracts/useSalesContractABI.d.ts
6
- declare enum SalesContractVersion {
7
- V0 = "v0",
8
- V1 = "v1",
9
- }
10
- interface UseSalesContractABIProps {
11
- contractAddress: Address;
12
- contractType: ContractType.ERC721 | ContractType.ERC1155;
13
- chainId: number;
14
- enabled?: boolean;
6
+ //#region ../node_modules/.pnpm/@0xsequence+design-system@3.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+rea_f2f94e8fde2d88ade6b8ffe1be436d4d/node_modules/@0xsequence/design-system/dist/index.d.ts
7
+
8
+ declare const iconVariants: (props?: ({
9
+ size?: "default" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
10
+ } & ClassProp) | undefined) => string;
11
+ interface IconProps extends SVGProps<SVGSVGElement>, VariantProps<typeof iconVariants> {}
12
+ declare const buttonVariants: (props?: ({
13
+ size?: "xs" | "sm" | "md" | "lg" | null | undefined;
14
+ shape?: "circle" | "square" | null | undefined;
15
+ variant?: "destructive" | "primary" | "secondary" | "text" | "outline" | "ghost" | "emphasis" | null | undefined;
16
+ disabled?: boolean | null | undefined;
17
+ iconOnly?: boolean | null | undefined;
18
+ } & ClassProp) | undefined) => string;
19
+ declare function Button({
20
+ className,
21
+ variant,
22
+ size,
23
+ shape,
24
+ iconOnly,
25
+ disabled,
26
+ asChild,
27
+ ...props
28
+ }: ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
29
+ asChild?: boolean;
30
+ }): react_jsx_runtime.JSX.Element;
31
+ declare namespace Button {
32
+ var Helper: (props: ButtonHelperProps) => react_jsx_runtime.JSX.Element;
15
33
  }
16
- type UseSalesContractABIResult = {
17
- version: null;
18
- abi: null;
19
- contractType: null;
20
- isLoading: true;
21
- error: null;
22
- } | {
23
- version: SalesContractVersion.V0;
24
- abi: typeof ERC721_SALE_ABI_V0;
25
- contractType: ContractType.ERC721;
26
- isLoading: false;
27
- error: null;
28
- } | {
29
- version: SalesContractVersion.V0;
30
- abi: typeof ERC1155_SALES_CONTRACT_ABI_V0;
31
- contractType: ContractType.ERC1155;
32
- isLoading: false;
33
- error: null;
34
- } | {
35
- version: SalesContractVersion.V1;
36
- abi: typeof ERC721_SALE_ABI_V1;
37
- contractType: ContractType.ERC721;
38
- isLoading: false;
39
- error: null;
40
- } | {
41
- version: SalesContractVersion.V1;
42
- abi: typeof ERC1155_SALES_CONTRACT_ABI_V1;
43
- contractType: ContractType.ERC1155;
44
- isLoading: false;
45
- error: null;
46
- } | {
47
- version: null;
48
- abi: null;
49
- contractType: null;
50
- isLoading: false;
51
- error: Error;
34
+ type ButtonHelperProps = ComponentProps<typeof Button> & VariantProps<typeof buttonVariants> & {
35
+ asChild?: boolean;
36
+ pending?: boolean;
37
+ label?: ReactNode;
38
+ leftIcon?: ComponentType<IconProps>;
39
+ rightIcon?: ComponentType<IconProps>;
52
40
  };
53
- declare function useSalesContractABI({
54
- contractAddress,
55
- contractType,
56
- chainId,
57
- enabled
58
- }: UseSalesContractABIProps): UseSalesContractABIResult;
41
+ interface ImageProps extends HTMLMotionProps<'img'> {
42
+ fadeIn?: boolean;
43
+ }
44
+ declare const Image: (props: ImageProps) => react_jsx_runtime.JSX.Element;
59
45
  //#endregion
60
- export { useSalesContractABI as n, SalesContractVersion as t };
46
+ export { Image as n, Button as t };
61
47
  //# sourceMappingURL=index9.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { It as ChainId, Mt as TokenBalance$1, Pt as TokenMetadata$1, an as MetadataStatus, fn as Page, kt as GetUserCollectionBalancesRequest, s as ContractType } from "./index2.js";
2
+ import { W as SdkQueryParams, X as WithRequired, it as WithOptionalParams } from "./create-config.js";
3
+ import * as _tanstack_react_query421 from "@tanstack/react-query";
4
+
5
+ //#region src/react/queries/inventory/inventory.d.ts
6
+ type FetchInventoryParams = GetUserCollectionBalancesRequest & {
7
+ chainId: ChainId;
8
+ includeNonTradable?: boolean;
9
+ page?: number;
10
+ pageSize?: number;
11
+ };
12
+ type CollectibleMetadata = Pick<TokenMetadata$1, 'tokenId' | 'attributes' | 'image' | 'name' | 'description' | 'video' | 'audio'> & {
13
+ status: MetadataStatus;
14
+ };
15
+ type CollectibleWithBalance = Pick<TokenBalance$1, 'contractInfo'> & {
16
+ metadata: CollectibleMetadata;
17
+ balance: string;
18
+ contractType: ContractType.ERC1155 | ContractType.ERC721;
19
+ };
20
+ type CollectiblesResponse = {
21
+ collectibles: CollectibleWithBalance[];
22
+ page: Page;
23
+ isTradable: boolean;
24
+ };
25
+ type InventoryQueryOptions = SdkQueryParams<FetchInventoryParams, {
26
+ enabled?: boolean;
27
+ }>;
28
+ /**
29
+ * @deprecated Use InventoryQueryOptions instead
30
+ */
31
+ type UseInventoryArgs = Omit<InventoryQueryOptions, 'config'> & {
32
+ config?: InventoryQueryOptions['config'];
33
+ };
34
+ declare function fetchInventory(params: WithRequired<InventoryQueryOptions, 'userAddress' | 'collectionAddress' | 'chainId' | 'config'>): Promise<CollectiblesResponse>;
35
+ declare function getInventoryQueryKey(params: InventoryQueryOptions): readonly ["inventory", `0x${string}` | undefined, `0x${string}` | undefined, number | undefined, number, number];
36
+ declare function inventoryOptions(params: WithOptionalParams<WithRequired<InventoryQueryOptions, 'userAddress' | 'collectionAddress' | 'chainId' | 'config'>>): _tanstack_react_query421.OmitKeyof<_tanstack_react_query421.UseQueryOptions<CollectiblesResponse, Error, CollectiblesResponse, readonly unknown[]>, "queryFn"> & {
37
+ queryFn?: _tanstack_react_query421.QueryFunction<CollectiblesResponse, readonly unknown[], never> | undefined;
38
+ } & {
39
+ queryKey: readonly unknown[] & {
40
+ [dataTagSymbol]: CollectiblesResponse;
41
+ [dataTagErrorSymbol]: Error;
42
+ };
43
+ };
44
+ //#endregion
45
+ export { InventoryQueryOptions as a, getInventoryQueryKey as c, FetchInventoryParams as i, inventoryOptions as l, CollectibleWithBalance as n, UseInventoryArgs as o, CollectiblesResponse as r, fetchInventory as s, CollectibleMetadata as t };
46
+ //# sourceMappingURL=inventory.d.ts.map
package/dist/inventory.js CHANGED
@@ -1,15 +1,26 @@
1
- import { _ as getQueryClient } from "./api.js";
2
- import { h as MetadataStatus } from "./marketplace.gen.js";
3
- import { l as compareAddress } from "./utils.js";
4
- import { t as fetchMarketplaceConfig } from "./marketplaceConfig.js";
5
- import { r as tokenBalancesOptions } from "./tokenBalances.js";
6
- import { queryOptions } from "@tanstack/react-query";
1
+ import { f as MetadataStatus, t as ContractType } from "./dist.js";
2
+ import { c as findMarketCollection } from "./utils.js";
3
+ import { g as getQueryClient } from "./api.js";
4
+ import { r as buildQueryOptions } from "./_internal.js";
5
+ import { r as tokenBalancesOptions } from "./token-balances.js";
6
+ import { t as fetchMarketplaceConfig } from "./config.js";
7
+ import { isAddress } from "viem";
7
8
 
8
9
  //#region src/react/queries/inventory/inventory.ts
10
+ /**
11
+ * Validates if a contract type is a valid collectible type (ERC721 or ERC1155)
12
+ */
13
+ function isCollectibleContractType(contractType) {
14
+ return contractType === ContractType.ERC721 || contractType === ContractType.ERC1155;
15
+ }
16
+ /**
17
+ * Transforms an Indexer token balance into a collectible with metadata
18
+ * @throws Error if token is not a valid collectible type (ERC721/ERC1155)
19
+ */
9
20
  function collectibleFromTokenBalance(token) {
10
21
  return {
11
22
  metadata: {
12
- tokenId: token.tokenID ?? "",
23
+ tokenId: token.tokenId ?? 0n,
13
24
  attributes: token.tokenMetadata?.attributes ?? [],
14
25
  image: token.tokenMetadata?.image,
15
26
  name: token.tokenMetadata?.name ?? "",
@@ -20,49 +31,61 @@ function collectibleFromTokenBalance(token) {
20
31
  },
21
32
  contractInfo: token.contractInfo,
22
33
  contractType: token.contractType,
23
- balance: token.balance
34
+ balance: token.balance.toString()
24
35
  };
25
36
  }
26
- async function fetchIndexerTokens(chainId, accountAddress, collectionAddress, config) {
37
+ async function fetchIndexerTokens(params) {
38
+ const { chainId, userAddress, collectionAddress, config } = params;
27
39
  return { collectibles: (await getQueryClient().fetchQuery(tokenBalancesOptions({
28
40
  collectionAddress,
29
- userAddress: accountAddress,
41
+ userAddress,
30
42
  chainId,
31
- includeMetadata: true
32
- }, config))).map((balance) => collectibleFromTokenBalance(balance)) };
43
+ includeMetadata: true,
44
+ config
45
+ }))).filter((balance) => isCollectibleContractType(balance.contractType)).map((balance) => collectibleFromTokenBalance(balance)) };
33
46
  }
34
- async function fetchInventory(args, config, page) {
35
- const { accountAddress, collectionAddress, chainId } = args;
36
- const isTradable = ((await fetchMarketplaceConfig({ config }))?.market.collections || []).some((collection) => compareAddress(collection.itemsAddress, collectionAddress));
37
- const { collectibles } = await fetchIndexerTokens(chainId, accountAddress, collectionAddress, config);
47
+ async function fetchInventory(params) {
48
+ const { userAddress, collectionAddress, chainId, config, page = 1, pageSize = 30 } = params;
49
+ const isTradable = !!findMarketCollection((await fetchMarketplaceConfig({ config }))?.market.collections || [], collectionAddress, chainId);
50
+ const { collectibles } = await fetchIndexerTokens({
51
+ chainId,
52
+ userAddress,
53
+ collectionAddress,
54
+ config
55
+ });
38
56
  return {
39
57
  collectibles,
40
58
  page: {
41
- page: page.page,
42
- pageSize: page.pageSize
59
+ page,
60
+ pageSize
43
61
  },
44
62
  isTradable
45
63
  };
46
64
  }
47
- function inventoryOptions(args, config) {
48
- const enabled = (args.query?.enabled ?? true) && !!args.accountAddress && !!args.collectionAddress;
49
- return queryOptions({
50
- queryKey: [
51
- "inventory",
52
- args.accountAddress,
53
- args.collectionAddress,
54
- args.chainId,
55
- args.query?.page ?? 1,
56
- args.query?.pageSize ?? 30
65
+ function getInventoryQueryKey(params) {
66
+ return [
67
+ "inventory",
68
+ params.userAddress,
69
+ params.collectionAddress,
70
+ params.chainId,
71
+ params.page ?? 1,
72
+ params.pageSize ?? 30
73
+ ];
74
+ }
75
+ function inventoryOptions(params) {
76
+ return buildQueryOptions({
77
+ getQueryKey: getInventoryQueryKey,
78
+ requiredParams: [
79
+ "userAddress",
80
+ "collectionAddress",
81
+ "chainId",
82
+ "config"
57
83
  ],
58
- queryFn: () => fetchInventory({ ...args }, config, {
59
- page: args.query?.page ?? 1,
60
- pageSize: args.query?.pageSize ?? 30
61
- }),
62
- enabled
63
- });
84
+ fetcher: fetchInventory,
85
+ customValidation: (p) => !!p.collectionAddress && isAddress(p.collectionAddress)
86
+ }, params);
64
87
  }
65
88
 
66
89
  //#endregion
67
- export { inventoryOptions as n, fetchInventory as t };
90
+ export { getInventoryQueryKey as n, inventoryOptions as r, fetchInventory as t };
68
91
  //# sourceMappingURL=inventory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inventory.js","names":[],"sources":["../src/react/queries/inventory/inventory.ts"],"sourcesContent":["import type { ContractInfo, TokenBalance } from '@0xsequence/indexer';\nimport { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { Page, SdkConfig } from '../../../types';\nimport { compareAddress } from '../../../utils';\nimport {\n\ttype ContractType,\n\tgetQueryClient,\n\tMetadataStatus,\n} from '../../_internal';\nimport { tokenBalancesOptions } from '../collectibles/tokenBalances';\nimport { fetchMarketplaceConfig } from '../market/marketplaceConfig';\n\nexport interface UseInventoryArgs {\n\taccountAddress: Address;\n\tcollectionAddress: Address;\n\tchainId: number;\n\tincludeNonTradable?: boolean;\n\tquery?: {\n\t\tenabled?: boolean;\n\t\tpage?: number;\n\t\tpageSize?: number;\n\t};\n}\n\ntype GetInventoryArgs = Omit<UseInventoryArgs, 'query'>;\n\ninterface CollectibleWithBalance {\n\tmetadata: {\n\t\ttokenId: string;\n\t\tattributes: Array<any>;\n\t\timage?: string;\n\t\tname: string;\n\t\tdescription?: string;\n\t\tvideo?: string;\n\t\taudio?: string;\n\t\tstatus: MetadataStatus;\n\t};\n\tbalance: string;\n\tcontractInfo?: ContractInfo;\n\tcontractType: ContractType.ERC1155 | ContractType.ERC721;\n}\n\nexport interface CollectiblesResponse {\n\tcollectibles: CollectibleWithBalance[];\n\tpage: Page;\n\tisTradable: boolean;\n}\n\nfunction collectibleFromTokenBalance(\n\ttoken: TokenBalance,\n): CollectibleWithBalance {\n\treturn {\n\t\tmetadata: {\n\t\t\ttokenId: token.tokenID ?? '',\n\t\t\tattributes: token.tokenMetadata?.attributes ?? [],\n\t\t\timage: token.tokenMetadata?.image,\n\t\t\tname: token.tokenMetadata?.name ?? '',\n\t\t\tdescription: token.tokenMetadata?.description,\n\t\t\tvideo: token.tokenMetadata?.video,\n\t\t\taudio: token.tokenMetadata?.audio,\n\t\t\tstatus: MetadataStatus.AVAILABLE,\n\t\t},\n\t\tcontractInfo: token.contractInfo,\n\t\tcontractType: token.contractType as unknown as\n\t\t\t| ContractType.ERC1155\n\t\t\t| ContractType.ERC721,\n\t\tbalance: token.balance,\n\t};\n}\n\nasync function fetchIndexerTokens(\n\tchainId: number,\n\taccountAddress: Address,\n\tcollectionAddress: Address,\n\tconfig: SdkConfig,\n): Promise<{ collectibles: CollectibleWithBalance[] }> {\n\tconst queryClient = getQueryClient();\n\tconst balances = await queryClient.fetchQuery(\n\t\ttokenBalancesOptions(\n\t\t\t{\n\t\t\t\tcollectionAddress,\n\t\t\t\tuserAddress: accountAddress,\n\t\t\t\tchainId,\n\t\t\t\tincludeMetadata: true,\n\t\t\t},\n\t\t\tconfig,\n\t\t),\n\t);\n\n\tconst collectibles = balances.map((balance) =>\n\t\tcollectibleFromTokenBalance(balance),\n\t);\n\n\treturn {\n\t\tcollectibles,\n\t};\n}\n\nexport async function fetchInventory(\n\targs: GetInventoryArgs,\n\tconfig: SdkConfig,\n\tpage: Page,\n): Promise<CollectiblesResponse> {\n\tconst { accountAddress, collectionAddress, chainId } = args;\n\tconst marketplaceConfig = await fetchMarketplaceConfig({ config });\n\n\tconst marketCollections = marketplaceConfig?.market.collections || [];\n\n\tconst isMarketCollection = marketCollections.some((collection) =>\n\t\tcompareAddress(collection.itemsAddress, collectionAddress),\n\t);\n\n\t// Determine if this collection is tradable (market collection vs shop collection)\n\tconst isTradable = isMarketCollection;\n\n\t// Fetch collectibles from indexer\n\tconst { collectibles } = await fetchIndexerTokens(\n\t\tchainId,\n\t\taccountAddress,\n\t\tcollectionAddress,\n\t\tconfig,\n\t);\n\n\treturn {\n\t\tcollectibles,\n\t\tpage: {\n\t\t\tpage: page.page,\n\t\t\tpageSize: page.pageSize,\n\t\t},\n\t\tisTradable,\n\t};\n}\n\nexport function inventoryOptions(args: UseInventoryArgs, config: SdkConfig) {\n\tconst enabledQuery = args.query?.enabled ?? true;\n\tconst enabled =\n\t\tenabledQuery && !!args.accountAddress && !!args.collectionAddress;\n\n\treturn queryOptions({\n\t\tqueryKey: [\n\t\t\t'inventory',\n\t\t\targs.accountAddress,\n\t\t\targs.collectionAddress,\n\t\t\targs.chainId,\n\t\t\targs.query?.page ?? 1,\n\t\t\targs.query?.pageSize ?? 30,\n\t\t],\n\t\tqueryFn: () =>\n\t\t\tfetchInventory(\n\t\t\t\t{\n\t\t\t\t\t...args,\n\t\t\t\t},\n\t\t\t\tconfig,\n\t\t\t\t{\n\t\t\t\t\tpage: args.query?.page ?? 1,\n\t\t\t\t\tpageSize: args.query?.pageSize ?? 30,\n\t\t\t\t},\n\t\t\t),\n\t\tenabled,\n\t});\n}\n"],"mappings":";;;;;;;;AAiDA,SAAS,4BACR,OACyB;AACzB,QAAO;EACN,UAAU;GACT,SAAS,MAAM,WAAW;GAC1B,YAAY,MAAM,eAAe,cAAc,EAAE;GACjD,OAAO,MAAM,eAAe;GAC5B,MAAM,MAAM,eAAe,QAAQ;GACnC,aAAa,MAAM,eAAe;GAClC,OAAO,MAAM,eAAe;GAC5B,OAAO,MAAM,eAAe;GAC5B,QAAQ,eAAe;GACvB;EACD,cAAc,MAAM;EACpB,cAAc,MAAM;EAGpB,SAAS,MAAM;EACf;;AAGF,eAAe,mBACd,SACA,gBACA,mBACA,QACsD;AAkBtD,QAAO,EACN,eAjBgB,MADG,gBAAgB,CACD,WAClC,qBACC;EACC;EACA,aAAa;EACb;EACA,iBAAiB;EACjB,EACD,OACA,CACD,EAE6B,KAAK,YAClC,4BAA4B,QAAQ,CACpC,EAIA;;AAGF,eAAsB,eACrB,MACA,QACA,MACgC;CAChC,MAAM,EAAE,gBAAgB,mBAAmB,YAAY;CAUvD,MAAM,eAToB,MAAM,uBAAuB,EAAE,QAAQ,CAAC,GAErB,OAAO,eAAe,EAAE,EAExB,MAAM,eAClD,eAAe,WAAW,cAAc,kBAAkB,CAC1D;CAMD,MAAM,EAAE,iBAAiB,MAAM,mBAC9B,SACA,gBACA,mBACA,OACA;AAED,QAAO;EACN;EACA,MAAM;GACL,MAAM,KAAK;GACX,UAAU,KAAK;GACf;EACD;EACA;;AAGF,SAAgB,iBAAiB,MAAwB,QAAmB;CAE3E,MAAM,WADe,KAAK,OAAO,WAAW,SAE3B,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,KAAK;AAEjD,QAAO,aAAa;EACnB,UAAU;GACT;GACA,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK,OAAO,QAAQ;GACpB,KAAK,OAAO,YAAY;GACxB;EACD,eACC,eACC,EACC,GAAG,MACH,EACD,QACA;GACC,MAAM,KAAK,OAAO,QAAQ;GAC1B,UAAU,KAAK,OAAO,YAAY;GAClC,CACD;EACF;EACA,CAAC"}
1
+ {"version":3,"file":"inventory.js","names":[],"sources":["../src/react/queries/inventory/inventory.ts"],"sourcesContent":["import type {\n\tChainId,\n\tGetUserCollectionBalancesRequest,\n\tIndexerTokenMetadata,\n\tIndexerTokenBalance as TokenBalance,\n} from '@0xsequence/api-client';\nimport { ContractType, MetadataStatus } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport type { Page } from '../../../types';\nimport { findMarketCollection } from '../../../utils';\nimport {\n\tbuildQueryOptions,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { tokenBalancesOptions } from '../collectible/token-balances';\nimport { fetchMarketplaceConfig } from '../marketplace/config';\n\nexport type FetchInventoryParams = GetUserCollectionBalancesRequest & {\n\tchainId: ChainId;\n\tincludeNonTradable?: boolean;\n\tpage?: number;\n\tpageSize?: number;\n};\n\nexport type CollectibleMetadata = Pick<\n\tIndexerTokenMetadata,\n\t| 'tokenId'\n\t| 'attributes'\n\t| 'image'\n\t| 'name'\n\t| 'description'\n\t| 'video'\n\t| 'audio'\n> & {\n\tstatus: MetadataStatus;\n};\n\nexport type CollectibleWithBalance = Pick<TokenBalance, 'contractInfo'> & {\n\tmetadata: CollectibleMetadata;\n\tbalance: string;\n\tcontractType: ContractType.ERC1155 | ContractType.ERC721;\n};\n\nexport type CollectiblesResponse = {\n\tcollectibles: CollectibleWithBalance[];\n\tpage: Page;\n\tisTradable: boolean;\n};\n\n/**\n * Validates if a contract type is a valid collectible type (ERC721 or ERC1155)\n */\nfunction isCollectibleContractType(\n\tcontractType: string,\n): contractType is ContractType.ERC721 | ContractType.ERC1155 {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- Intentional type guard comparing string with enum\n\treturn (\n\t\tcontractType === ContractType.ERC721 ||\n\t\tcontractType === ContractType.ERC1155\n\t);\n}\n\n/**\n * Transforms an Indexer token balance into a collectible with metadata\n * @throws Error if token is not a valid collectible type (ERC721/ERC1155)\n */\nfunction collectibleFromTokenBalance(\n\ttoken: TokenBalance,\n): CollectibleWithBalance {\n\treturn {\n\t\tmetadata: {\n\t\t\ttokenId: token.tokenId ?? 0n,\n\t\t\tattributes: token.tokenMetadata?.attributes ?? [],\n\t\t\timage: token.tokenMetadata?.image,\n\t\t\tname: token.tokenMetadata?.name ?? '',\n\t\t\tdescription: token.tokenMetadata?.description,\n\t\t\tvideo: token.tokenMetadata?.video,\n\t\t\taudio: token.tokenMetadata?.audio,\n\t\t\tstatus: MetadataStatus.AVAILABLE,\n\t\t},\n\t\tcontractInfo: token.contractInfo,\n\t\tcontractType: token.contractType as\n\t\t\t| ContractType.ERC721\n\t\t\t| ContractType.ERC1155,\n\t\tbalance: token.balance.toString(),\n\t};\n}\n\nasync function fetchIndexerTokens(\n\tparams: WithRequired<\n\t\tInventoryQueryOptions,\n\t\t'chainId' | 'userAddress' | 'collectionAddress' | 'config'\n\t>,\n): Promise<{ collectibles: CollectibleWithBalance[] }> {\n\tconst { chainId, userAddress, collectionAddress, config } = params;\n\tconst queryClient = getQueryClient();\n\tconst balances = await queryClient.fetchQuery(\n\t\ttokenBalancesOptions({\n\t\t\tcollectionAddress,\n\t\t\tuserAddress,\n\t\t\tchainId,\n\t\t\tincludeMetadata: true,\n\t\t\tconfig,\n\t\t}),\n\t);\n\n\tconst collectibles = balances\n\t\t.filter((balance) => isCollectibleContractType(balance.contractType))\n\t\t.map((balance) => collectibleFromTokenBalance(balance));\n\n\treturn {\n\t\tcollectibles,\n\t};\n}\n\nexport type InventoryQueryOptions = SdkQueryParams<\n\tFetchInventoryParams,\n\t{\n\t\tenabled?: boolean;\n\t}\n>;\n\n/**\n * @deprecated Use InventoryQueryOptions instead\n */\nexport type UseInventoryArgs = Omit<InventoryQueryOptions, 'config'> & {\n\tconfig?: InventoryQueryOptions['config'];\n};\n\nexport async function fetchInventory(\n\tparams: WithRequired<\n\t\tInventoryQueryOptions,\n\t\t'userAddress' | 'collectionAddress' | 'chainId' | 'config'\n\t>,\n): Promise<CollectiblesResponse> {\n\tconst {\n\t\tuserAddress,\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tconfig,\n\t\tpage = 1,\n\t\tpageSize = 30,\n\t} = params;\n\tconst marketplaceConfig = await fetchMarketplaceConfig({ config });\n\n\tconst marketCollections = marketplaceConfig?.market.collections || [];\n\n\tconst isMarketCollection = !!findMarketCollection(\n\t\tmarketCollections,\n\t\tcollectionAddress,\n\t\tchainId,\n\t);\n\n\t// Determine if this collection is tradable (market collection vs shop collection)\n\tconst isTradable = isMarketCollection;\n\n\t// Fetch collectibles from indexer\n\tconst { collectibles } = await fetchIndexerTokens({\n\t\tchainId,\n\t\tuserAddress,\n\t\tcollectionAddress,\n\t\tconfig,\n\t});\n\n\treturn {\n\t\tcollectibles,\n\t\tpage: {\n\t\t\tpage,\n\t\t\tpageSize,\n\t\t},\n\t\tisTradable,\n\t};\n}\n\nexport function getInventoryQueryKey(params: InventoryQueryOptions) {\n\treturn [\n\t\t'inventory',\n\t\tparams.userAddress,\n\t\tparams.collectionAddress,\n\t\tparams.chainId,\n\t\tparams.page ?? 1,\n\t\tparams.pageSize ?? 30,\n\t] as const;\n}\n\nexport function inventoryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tInventoryQueryOptions,\n\t\t\t'userAddress' | 'collectionAddress' | 'chainId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getInventoryQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'userAddress',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'chainId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchInventory,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;AAuDA,SAAS,0BACR,cAC6D;AAE7D,QACC,iBAAiB,aAAa,UAC9B,iBAAiB,aAAa;;;;;;AAQhC,SAAS,4BACR,OACyB;AACzB,QAAO;EACN,UAAU;GACT,SAAS,MAAM,WAAW;GAC1B,YAAY,MAAM,eAAe,cAAc,EAAE;GACjD,OAAO,MAAM,eAAe;GAC5B,MAAM,MAAM,eAAe,QAAQ;GACnC,aAAa,MAAM,eAAe;GAClC,OAAO,MAAM,eAAe;GAC5B,OAAO,MAAM,eAAe;GAC5B,QAAQ,eAAe;GACvB;EACD,cAAc,MAAM;EACpB,cAAc,MAAM;EAGpB,SAAS,MAAM,QAAQ,UAAU;EACjC;;AAGF,eAAe,mBACd,QAIsD;CACtD,MAAM,EAAE,SAAS,aAAa,mBAAmB,WAAW;AAgB5D,QAAO,EACN,eAfgB,MADG,gBAAgB,CACD,WAClC,qBAAqB;EACpB;EACA;EACA;EACA,iBAAiB;EACjB;EACA,CAAC,CACF,EAGC,QAAQ,YAAY,0BAA0B,QAAQ,aAAa,CAAC,CACpE,KAAK,YAAY,4BAA4B,QAAQ,CAAC,EAIvD;;AAiBF,eAAsB,eACrB,QAIgC;CAChC,MAAM,EACL,aACA,mBACA,SACA,QACA,OAAO,GACP,WAAW,OACR;CAYJ,MAAM,aAPqB,CAAC,CAAC,sBAJH,MAAM,uBAAuB,EAAE,QAAQ,CAAC,GAErB,OAAO,eAAe,EAAE,EAIpE,mBACA,QACA;CAMD,MAAM,EAAE,iBAAiB,MAAM,mBAAmB;EACjD;EACA;EACA;EACA;EACA,CAAC;AAEF,QAAO;EACN;EACA,MAAM;GACL;GACA;GACA;EACD;EACA;;AAGF,SAAgB,qBAAqB,QAA+B;AACnE,QAAO;EACN;EACA,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO,QAAQ;EACf,OAAO,YAAY;EACnB;;AAGF,SAAgB,iBACf,QAMC;AACD,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GACf;GACA;GACA;GACA;GACA;EACD,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,qBAAqB,UAAU,EAAE,kBAAkB;EACxD,EACD,OACA"}
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
6
6
  const createMarketplaceLogo = (importFn, alt) => {
7
7
  const LazyLogo = lazy(async () => {
8
8
  const src = await importFn();
9
- return { default: function MarketplaceLogo({ alt: altProp, ...props }) {
9
+ return { default({ alt: altProp, ...props }) {
10
10
  return /* @__PURE__ */ jsx(Image, {
11
11
  src: src.default,
12
12
  alt: altProp || alt,
@@ -1 +1 @@
1
- {"version":3,"file":"marketplace-logos.js","names":[],"sources":["../src/react/ui/components/marketplace-logos/marketplace-logos.tsx"],"sourcesContent":["import { Image } from '@0xsequence/design-system';\nimport { type ComponentProps, lazy, Suspense } from 'react';\n\n/* @__PURE__ */\nconst createMarketplaceLogo = (\n\timportFn: () => Promise<{ default: string }>,\n\talt: string,\n) => {\n\tconst LazyLogo = lazy(async () => {\n\t\tconst src = await importFn();\n\t\treturn {\n\t\t\tdefault: function MarketplaceLogo({\n\t\t\t\talt: altProp,\n\t\t\t\t...props\n\t\t\t}: ComponentProps<typeof Image>) {\n\t\t\t\treturn <Image src={src.default} alt={altProp || alt} {...props} />;\n\t\t\t},\n\t\t};\n\t});\n\n\treturn function MarketplaceLogo(props: ComponentProps<typeof Image>) {\n\t\treturn (\n\t\t\t<Suspense\n\t\t\t\tfallback={<div style={{ width: props.width, height: props.height }} />}\n\t\t\t>\n\t\t\t\t{/* @ts-ignore */}\n\t\t\t\t<LazyLogo {...props} />\n\t\t\t</Suspense>\n\t\t);\n\t};\n};\n\nexport const AlienSwapLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/alien_swap.png'),\n\t'AlienSwap Logo',\n);\nexport const AquaXyzLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/aqua-xyz.png'),\n\t'AquaXyz Logo',\n);\nexport const AuraLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/aura.png'),\n\t'Aura Logo',\n);\nexport const BlurLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/blur.png'),\n\t'Blur Logo',\n);\nexport const CoinbaseLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/coinbase.png'),\n\t'Coinbase Logo',\n);\nexport const ElementLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/element.png'),\n\t'Element Logo',\n);\nexport const FoundationLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/foundation.png'),\n\t'Foundation Logo',\n);\nexport const LooksRareLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/looks-rare.png'),\n\t'LooksRare Logo',\n);\nexport const MagicEdenLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/magic-eden.png'),\n\t'MagicEden Logo',\n);\nexport const ManifoldLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/manifold.png'),\n\t'Manifold Logo',\n);\nexport const MintifyLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/mintify.png'),\n\t'Mintify Logo',\n);\nexport const NftxLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/nftx.png'),\n\t'NFTX Logo',\n);\nexport const OkxLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/okx.png'),\n\t'OKX Logo',\n);\nexport const OpenSeaLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/open-sea.png'),\n\t'OpenSea Logo',\n);\nexport const RaribleLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/rarible.png'),\n\t'Rarible Logo',\n);\nexport const SequenceLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/sequence.png'),\n\t'Sequence Logo',\n);\nexport const SudoSwapLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/sudo-swap.png'),\n\t'SudoSwap Logo',\n);\nexport const SuperRareLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/super-rare.png'),\n\t'SuperRare Logo',\n);\nexport const X2y2Logo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/x2y2.png'),\n\t'X2Y2 Logo',\n);\nexport const ZoraLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/zora.png'),\n\t'Zora Logo',\n);\n"],"mappings":";;;;;AAIA,MAAM,yBACL,UACA,QACI;CACJ,MAAM,WAAW,KAAK,YAAY;EACjC,MAAM,MAAM,MAAM,UAAU;AAC5B,SAAO,EACN,SAAS,SAAS,gBAAgB,EACjC,KAAK,SACL,GAAG,SAC6B;AAChC,UAAO,oBAAC;IAAM,KAAK,IAAI;IAAS,KAAK,WAAW;IAAK,GAAI;KAAS;KAEnE;GACA;AAEF,QAAO,SAAS,gBAAgB,OAAqC;AACpE,SACC,oBAAC;GACA,UAAU,oBAAC,SAAI,OAAO;IAAE,OAAO,MAAM;IAAO,QAAQ,MAAM;IAAQ,GAAI;aAGtE,oBAAC,YAAS,GAAI,QAAS;IACb;;;AAKd,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,cAAc,4BACpB,OAAO,kBACb,eACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,eAAe,4BACrB,OAAO,kBACb,gBACA;AACD,MAAa,cAAc,4BACpB,OAAO,iBACb,eACA;AACD,MAAa,iBAAiB,4BACvB,OAAO,oBACb,kBACA;AACD,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,eAAe,4BACrB,OAAO,kBACb,gBACA;AACD,MAAa,cAAc,4BACpB,OAAO,iBACb,eACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,UAAU,4BAChB,OAAO,aACb,WACA;AACD,MAAa,cAAc,4BACpB,OAAO,kBACb,eACA;AACD,MAAa,cAAc,4BACpB,OAAO,iBACb,eACA;AACD,MAAa,eAAe,4BACrB,OAAO,kBACb,gBACA;AACD,MAAa,eAAe,4BACrB,OAAO,mBACb,gBACA;AACD,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA"}
1
+ {"version":3,"file":"marketplace-logos.js","names":[],"sources":["../src/react/ui/components/marketplace-logos/marketplace-logos.tsx"],"sourcesContent":["import { Image } from '@0xsequence/design-system';\nimport { type ComponentProps, lazy, Suspense } from 'react';\n\n/* @__PURE__ */\nconst createMarketplaceLogo = (\n\timportFn: () => Promise<{ default: string }>,\n\talt: string,\n) => {\n\tconst LazyLogo = lazy(async () => {\n\t\tconst src = await importFn();\n\t\treturn {\n\t\t\tdefault({ alt: altProp, ...props }: ComponentProps<typeof Image>) {\n\t\t\t\treturn <Image src={src.default} alt={altProp || alt} {...props} />;\n\t\t\t},\n\t\t};\n\t});\n\n\treturn function MarketplaceLogo(props: ComponentProps<typeof Image>) {\n\t\treturn (\n\t\t\t<Suspense\n\t\t\t\tfallback={<div style={{ width: props.width, height: props.height }} />}\n\t\t\t>\n\t\t\t\t<LazyLogo {...props} />\n\t\t\t</Suspense>\n\t\t);\n\t};\n};\n\nexport const AlienSwapLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/alien_swap.png'),\n\t'AlienSwap Logo',\n);\nexport const AquaXyzLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/aqua-xyz.png'),\n\t'AquaXyz Logo',\n);\nexport const AuraLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/aura.png'),\n\t'Aura Logo',\n);\nexport const BlurLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/blur.png'),\n\t'Blur Logo',\n);\nexport const CoinbaseLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/coinbase.png'),\n\t'Coinbase Logo',\n);\nexport const ElementLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/element.png'),\n\t'Element Logo',\n);\nexport const FoundationLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/foundation.png'),\n\t'Foundation Logo',\n);\nexport const LooksRareLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/looks-rare.png'),\n\t'LooksRare Logo',\n);\nexport const MagicEdenLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/magic-eden.png'),\n\t'MagicEden Logo',\n);\nexport const ManifoldLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/manifold.png'),\n\t'Manifold Logo',\n);\nexport const MintifyLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/mintify.png'),\n\t'Mintify Logo',\n);\nexport const NftxLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/nftx.png'),\n\t'NFTX Logo',\n);\nexport const OkxLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/okx.png'),\n\t'OKX Logo',\n);\nexport const OpenSeaLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/open-sea.png'),\n\t'OpenSea Logo',\n);\nexport const RaribleLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/rarible.png'),\n\t'Rarible Logo',\n);\nexport const SequenceLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/sequence.png'),\n\t'Sequence Logo',\n);\nexport const SudoSwapLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/sudo-swap.png'),\n\t'SudoSwap Logo',\n);\nexport const SuperRareLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/super-rare.png'),\n\t'SuperRare Logo',\n);\nexport const X2y2Logo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/x2y2.png'),\n\t'X2Y2 Logo',\n);\nexport const ZoraLogo = createMarketplaceLogo(\n\t() => import('../../images/marketplaces/zora.png'),\n\t'Zora Logo',\n);\n"],"mappings":";;;;;AAIA,MAAM,yBACL,UACA,QACI;CACJ,MAAM,WAAW,KAAK,YAAY;EACjC,MAAM,MAAM,MAAM,UAAU;AAC5B,SAAO,EACN,QAAQ,EAAE,KAAK,SAAS,GAAG,SAAuC;AACjE,UAAO,oBAAC;IAAM,KAAK,IAAI;IAAS,KAAK,WAAW;IAAK,GAAI;KAAS;KAEnE;GACA;AAEF,QAAO,SAAS,gBAAgB,OAAqC;AACpE,SACC,oBAAC;GACA,UAAU,oBAAC,SAAI,OAAO;IAAE,OAAO,MAAM;IAAO,QAAQ,MAAM;IAAQ,GAAI;aAEtE,oBAAC,YAAS,GAAI,QAAS;IACb;;;AAKd,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,cAAc,4BACpB,OAAO,kBACb,eACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,eAAe,4BACrB,OAAO,kBACb,gBACA;AACD,MAAa,cAAc,4BACpB,OAAO,iBACb,eACA;AACD,MAAa,iBAAiB,4BACvB,OAAO,oBACb,kBACA;AACD,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,eAAe,4BACrB,OAAO,kBACb,gBACA;AACD,MAAa,cAAc,4BACpB,OAAO,iBACb,eACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,UAAU,4BAChB,OAAO,aACb,WACA;AACD,MAAa,cAAc,4BACpB,OAAO,kBACb,eACA;AACD,MAAa,cAAc,4BACpB,OAAO,iBACb,eACA;AACD,MAAa,eAAe,4BACrB,OAAO,kBACb,gBACA;AACD,MAAa,eAAe,4BACrB,OAAO,mBACb,gBACA;AACD,MAAa,gBAAgB,4BACtB,OAAO,oBACb,iBACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA;AACD,MAAa,WAAW,4BACjB,OAAO,cACb,YACA"}
@@ -0,0 +1,70 @@
1
+ import { C as FilterCondition } from "./dist.js";
2
+ import { c as findMarketCollection } from "./utils.js";
3
+ import { g as getQueryClient, i as getMetadataClient } from "./api.js";
4
+ import { r as buildQueryOptions } from "./_internal.js";
5
+ import { n as marketplaceConfigOptions, r as createMarketplaceQueryKey } from "./config.js";
6
+ import { isAddress } from "viem";
7
+
8
+ //#region src/react/queries/marketplace/filters.ts
9
+ /**
10
+ * Fetches collection filters from the Metadata API with optional marketplace filtering
11
+ */
12
+ async function fetchFilters(params) {
13
+ const { chainId, collectionAddress, showAllFilters, excludePropertyValues, config } = params;
14
+ const filters = (await getMetadataClient(config).getTokenMetadataPropertyFilters({
15
+ chainId,
16
+ collectionAddress,
17
+ excludeProperties: [],
18
+ excludePropertyValues
19
+ })).filters;
20
+ if (showAllFilters) return filters;
21
+ const collectionFilters = findMarketCollection((await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections, collectionAddress, chainId)?.filterSettings;
22
+ const filterOrder = collectionFilters?.filterOrder;
23
+ const exclusions = collectionFilters?.exclusions;
24
+ let sortedFilters = filters;
25
+ if (filterOrder) sortedFilters = filters.toSorted((a, b) => {
26
+ return (filterOrder.indexOf(a.name) > -1 ? filterOrder.indexOf(a.name) : filterOrder.length) - (filterOrder.indexOf(b.name) > -1 ? filterOrder.indexOf(b.name) : filterOrder.length);
27
+ });
28
+ if (exclusions) sortedFilters = sortedFilters.reduce((acc, filter) => {
29
+ const exclusionRule = exclusions.find((rule) => rule.key === filter.name);
30
+ if (!exclusionRule) {
31
+ acc.push(filter);
32
+ return acc;
33
+ }
34
+ if (exclusionRule.condition === FilterCondition.ENTIRE_KEY) return acc;
35
+ if (exclusionRule.condition === FilterCondition.SPECIFIC_VALUE && exclusionRule.value) {
36
+ const filteredValues = filter.values?.filter((value) => value !== exclusionRule.value) || [];
37
+ if (filteredValues.length > 0) acc.push({
38
+ ...filter,
39
+ values: filteredValues
40
+ });
41
+ }
42
+ return acc;
43
+ }, []);
44
+ return sortedFilters;
45
+ }
46
+ function getFiltersQueryKey(params) {
47
+ return createMarketplaceQueryKey("filters", {
48
+ chainId: params.chainId,
49
+ collectionAddress: params.collectionAddress,
50
+ excludeProperties: void 0,
51
+ excludePropertyValues: params.excludePropertyValues,
52
+ showAllFilters: params.showAllFilters
53
+ });
54
+ }
55
+ function filtersQueryOptions(params) {
56
+ return buildQueryOptions({
57
+ getQueryKey: getFiltersQueryKey,
58
+ requiredParams: [
59
+ "chainId",
60
+ "collectionAddress",
61
+ "config"
62
+ ],
63
+ fetcher: fetchFilters,
64
+ customValidation: (p) => !!p.collectionAddress && isAddress(p.collectionAddress)
65
+ }, params);
66
+ }
67
+
68
+ //#endregion
69
+ export { filtersQueryOptions as n, getFiltersQueryKey as r, fetchFilters as t };
70
+ //# sourceMappingURL=marketplace2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketplace2.js","names":[],"sources":["../src/react/queries/marketplace/filters.ts"],"sourcesContent":["import type { GetFiltersArgs, PropertyFilter } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport { FilterCondition } from '../../../types';\nimport { findMarketCollection } from '../../../utils';\nimport {\n\tbuildQueryOptions,\n\tgetMetadataClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketplaceConfigOptions } from './config';\nimport { createMarketplaceQueryKey } from './queryKeys';\n\nexport type FetchFiltersParams = GetFiltersArgs;\n\n/**\n * Fetches collection filters from the Metadata API with optional marketplace filtering\n */\nexport async function fetchFilters(\n\tparams: WithRequired<\n\t\tFiltersQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'config'\n\t>,\n): Promise<PropertyFilter[]> {\n\tconst {\n\t\tchainId,\n\t\tcollectionAddress,\n\t\tshowAllFilters,\n\t\texcludePropertyValues,\n\t\tconfig,\n\t} = params;\n\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst result = await metadataClient.getTokenMetadataPropertyFilters({\n\t\tchainId,\n\t\tcollectionAddress,\n\t\texcludeProperties: [],\n\t\texcludePropertyValues,\n\t});\n\n\tconst filters = result.filters as PropertyFilter[];\n\n\tif (showAllFilters) return filters;\n\n\tconst queryClient = getQueryClient();\n\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\tmarketplaceConfigOptions(config),\n\t);\n\tconst collectionFilters = findMarketCollection(\n\t\tmarketplaceConfig.market.collections,\n\t\tcollectionAddress,\n\t\tchainId,\n\t)?.filterSettings;\n\n\tconst filterOrder = collectionFilters?.filterOrder;\n\tconst exclusions = collectionFilters?.exclusions;\n\tlet sortedFilters = filters;\n\n\tif (filterOrder) {\n\t\tsortedFilters = filters.toSorted((a, b) => {\n\t\t\tconst aIndex =\n\t\t\t\tfilterOrder.indexOf(a.name) > -1\n\t\t\t\t\t? filterOrder.indexOf(a.name)\n\t\t\t\t\t: filterOrder.length;\n\t\t\tconst bIndex =\n\t\t\t\tfilterOrder.indexOf(b.name) > -1\n\t\t\t\t\t? filterOrder.indexOf(b.name)\n\t\t\t\t\t: filterOrder.length;\n\t\t\treturn aIndex - bIndex;\n\t\t});\n\t}\n\n\tif (exclusions) {\n\t\tsortedFilters = sortedFilters.reduce<PropertyFilter[]>((acc, filter) => {\n\t\t\tconst exclusionRule = exclusions.find((rule) => rule.key === filter.name);\n\n\t\t\tif (!exclusionRule) {\n\t\t\t\tacc.push(filter);\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\tif (exclusionRule.condition === FilterCondition.ENTIRE_KEY) {\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\texclusionRule.condition === FilterCondition.SPECIFIC_VALUE &&\n\t\t\t\texclusionRule.value\n\t\t\t) {\n\t\t\t\tconst filteredValues =\n\t\t\t\t\tfilter.values?.filter((value) => value !== exclusionRule.value) || [];\n\t\t\t\tif (filteredValues.length > 0) {\n\t\t\t\t\tacc.push({ ...filter, values: filteredValues });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t}, []);\n\t}\n\n\treturn sortedFilters;\n}\n\nexport type FiltersQueryOptions = SdkQueryParams<FetchFiltersParams>;\n\nexport function getFiltersQueryKey(params: FiltersQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcollectionAddress: params.collectionAddress,\n\t\texcludeProperties: undefined,\n\t\texcludePropertyValues: params.excludePropertyValues,\n\t};\n\n\treturn createMarketplaceQueryKey('filters', {\n\t\t...apiArgs,\n\t\tshowAllFilters: params.showAllFilters,\n\t});\n}\n\nexport function filtersQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tFiltersQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getFiltersQueryKey,\n\t\t\trequiredParams: ['chainId', 'collectionAddress', 'config'] as const,\n\t\t\tfetcher: fetchFilters,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAoBA,eAAsB,aACrB,QAI4B;CAC5B,MAAM,EACL,SACA,mBACA,gBACA,uBACA,WACG;CAWJ,MAAM,WAPS,MAFQ,kBAAkB,OAAO,CAEZ,gCAAgC;EACnE;EACA;EACA,mBAAmB,EAAE;EACrB;EACA,CAAC,EAEqB;AAEvB,KAAI,eAAgB,QAAO;CAM3B,MAAM,oBAAoB,sBAHA,MADN,gBAAgB,CACQ,WAC3C,yBAAyB,OAAO,CAChC,EAEkB,OAAO,aACzB,mBACA,QACA,EAAE;CAEH,MAAM,cAAc,mBAAmB;CACvC,MAAM,aAAa,mBAAmB;CACtC,IAAI,gBAAgB;AAEpB,KAAI,YACH,iBAAgB,QAAQ,UAAU,GAAG,MAAM;AAS1C,UAPC,YAAY,QAAQ,EAAE,KAAK,GAAG,KAC3B,YAAY,QAAQ,EAAE,KAAK,GAC3B,YAAY,WAEf,YAAY,QAAQ,EAAE,KAAK,GAAG,KAC3B,YAAY,QAAQ,EAAE,KAAK,GAC3B,YAAY;GAEf;AAGH,KAAI,WACH,iBAAgB,cAAc,QAA0B,KAAK,WAAW;EACvE,MAAM,gBAAgB,WAAW,MAAM,SAAS,KAAK,QAAQ,OAAO,KAAK;AAEzE,MAAI,CAAC,eAAe;AACnB,OAAI,KAAK,OAAO;AAChB,UAAO;;AAGR,MAAI,cAAc,cAAc,gBAAgB,WAC/C,QAAO;AAGR,MACC,cAAc,cAAc,gBAAgB,kBAC5C,cAAc,OACb;GACD,MAAM,iBACL,OAAO,QAAQ,QAAQ,UAAU,UAAU,cAAc,MAAM,IAAI,EAAE;AACtE,OAAI,eAAe,SAAS,EAC3B,KAAI,KAAK;IAAE,GAAG;IAAQ,QAAQ;IAAgB,CAAC;;AAIjD,SAAO;IACL,EAAE,CAAC;AAGP,QAAO;;AAKR,SAAgB,mBAAmB,QAA6B;AAQ/D,QAAO,0BAA0B,WAAW;EAN3C,SAAS,OAAO;EAChB,mBAAmB,OAAO;EAC1B,mBAAmB;EACnB,uBAAuB,OAAO;EAK9B,gBAAgB,OAAO;EACvB,CAAC;;AAGH,SAAgB,oBACf,QAMC;AACD,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GAAC;GAAW;GAAqB;GAAS;EAC1D,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,qBAAqB,UAAU,EAAE,kBAAkB;EACxD,EACD,OACA"}