@0xsequence/marketplace-sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/.storybook/main.ts +1 -1
  2. package/.storybook/preview.tsx +0 -1
  3. package/CHANGELOG.md +62 -13
  4. package/dist/BellIcon-IpHHEy8h.js +45 -0
  5. package/dist/BellIcon-IpHHEy8h.js.map +1 -0
  6. package/dist/{BellIcon-Cb9YEUzJ.js → CartIcon-C8zbor8H.js} +10 -49
  7. package/dist/CartIcon-C8zbor8H.js.map +1 -0
  8. package/dist/CollectibleCard-C2EWF0zo.d.ts +8 -0
  9. package/dist/{_internal-DslqcNC1.js → _internal-DkS2VUn5.js} +1 -1
  10. package/dist/{_internal-DslqcNC1.js.map → _internal-DkS2VUn5.js.map} +1 -1
  11. package/dist/{alien_swap-DJ98gZQp.js → alien_swap-BTJ7mSR-.js} +1 -1
  12. package/dist/{alien_swap-DJ98gZQp.js.map → alien_swap-BTJ7mSR-.js.map} +1 -1
  13. package/dist/{api-BmEQfSQa.js → api-DuLKn__v.js} +5 -3
  14. package/dist/api-DuLKn__v.js.map +1 -0
  15. package/dist/{aqua-xyz-n1PcCCZ0.js → aqua-xyz-BYJ9WSP_.js} +1 -1
  16. package/dist/{aqua-xyz-n1PcCCZ0.js.map → aqua-xyz-BYJ9WSP_.js.map} +1 -1
  17. package/dist/{aura-Bevk_YkS.js → aura-D7SUjgro.js} +1 -1
  18. package/dist/{aura-Bevk_YkS.js.map → aura-D7SUjgro.js.map} +1 -1
  19. package/dist/{blur-B5sHErx5.js → blur-BcnRFCaV.js} +1 -1
  20. package/dist/{blur-B5sHErx5.js.map → blur-BcnRFCaV.js.map} +1 -1
  21. package/dist/builder-api-BFuZNOaN.js.map +1 -1
  22. package/dist/builder.gen-B9wR2nvF.js.map +1 -1
  23. package/dist/{coinbase-D30W-lxA.js → coinbase-ChoX9Hw2.js} +1 -1
  24. package/dist/{coinbase-D30W-lxA.js.map → coinbase-ChoX9Hw2.js.map} +1 -1
  25. package/dist/components-CUv-wQr8.js +119 -0
  26. package/dist/components-CUv-wQr8.js.map +1 -0
  27. package/dist/{contracts-DPHFT2TA.js → contracts-D72LBOX3.js} +4 -5
  28. package/dist/{contracts-DPHFT2TA.js.map → contracts-D72LBOX3.js.map} +1 -1
  29. package/dist/{create-config-6uynwTeb.js → create-config-CIfejoCk.js} +6 -11
  30. package/dist/create-config-CIfejoCk.js.map +1 -0
  31. package/dist/{create-config-lLSrnkbb.d.ts → create-config-DV_dtaLt.d.ts} +24 -31
  32. package/dist/{element-C2NJexro.js → element-Dbcv5qya.js} +1 -1
  33. package/dist/{element-C2NJexro.js.map → element-Dbcv5qya.js.map} +1 -1
  34. package/dist/{filters-B8XS4tFH.d.ts → filters-zkMJaPey.d.ts} +6 -6
  35. package/dist/{foundation-QgY1lvUj.js → foundation-QPhUEUy8.js} +1 -1
  36. package/dist/{foundation-QgY1lvUj.js.map → foundation-QPhUEUy8.js.map} +1 -1
  37. package/dist/{index-ChSKFOMx.d.ts → index-B6aSbaw2.d.ts} +1 -1
  38. package/dist/{index-PSPpUxCE.d.ts → index-B8vaT3_s.d.ts} +4 -4
  39. package/dist/{index-DonXiSg2.d.ts → index-BaytncQc.d.ts} +100 -56
  40. package/dist/{index-CY5UEX4h.d.ts → index-BoNNplSx.d.ts} +2 -2
  41. package/dist/{index-QxxS6f9r.d.ts → index-Bv5XVLjH.d.ts} +1 -1
  42. package/dist/{index-CIkpYltz.d.ts → index-C768pAfu.d.ts} +3 -3
  43. package/dist/{index-DX0Vm8HY.d.ts → index-CM0ZTePs.d.ts} +1 -1
  44. package/dist/index-CMPUveNz.d.ts +64 -0
  45. package/dist/{index-ThUIs-Sy.d.ts → index-CQecU53t.d.ts} +28 -23
  46. package/dist/{index-CtF7EE2z.d.ts → index-CT8ZorFd.d.ts} +1 -1
  47. package/dist/{index-Dpyp7fQz.d.ts → index-CXscCUg7.d.ts} +12 -12
  48. package/dist/{index-ByW08-Z7.d.ts → index-D-UXGo5d.d.ts} +2 -2
  49. package/dist/{index-D71J5Ghd.d.ts → index-D6YMj82n.d.ts} +79 -79
  50. package/dist/{index-CQnGIGb5.d.ts → index-DJG0kiII.d.ts} +33 -33
  51. package/dist/{index-D2HohSwO.d.ts → index-DLUjc7Bx.d.ts} +52 -29
  52. package/dist/{index-C7xKVIr4.d.ts → index-DMBMM16q.d.ts} +37 -37
  53. package/dist/{index-DNU9xoGK.d.ts → index-DpeWm_vF.d.ts} +5 -5
  54. package/dist/{index-BuY_NKSX.d.ts → index-Yobo6icm.d.ts} +40 -28
  55. package/dist/{index-BGJXqdg6.d.ts → index-jGgfEHfQ.d.ts} +8 -8
  56. package/dist/index.d.ts +8 -8
  57. package/dist/index.js +12 -11
  58. package/dist/{listCollectiblesPaginated--AgXjajA.d.ts → listCollectiblesPaginated-Bq0QSOjJ.d.ts} +28 -26
  59. package/dist/{listCollections-Bbzbz7qW.d.ts → listCollections-dTCq00l5.d.ts} +168 -123
  60. package/dist/{looks-rare-CMVPny4v.js → looks-rare-C7cQztTR.js} +1 -1
  61. package/dist/{looks-rare-CMVPny4v.js.map → looks-rare-C7cQztTR.js.map} +1 -1
  62. package/dist/{lowestListing-BQHfQpfg.d.ts → lowestListing-CB5Te-Q9.d.ts} +41 -17
  63. package/dist/{magic-eden-IrWp2ZXk.js → magic-eden-D3r7jiBG.js} +1 -1
  64. package/dist/{magic-eden-IrWp2ZXk.js.map → magic-eden-D3r7jiBG.js.map} +1 -1
  65. package/dist/{manifold-DeOE-p2G.js → manifold-DsX0CBP-.js} +1 -1
  66. package/dist/{manifold-DeOE-p2G.js.map → manifold-DsX0CBP-.js.map} +1 -1
  67. package/dist/{marketCurrencies-CmOMCCOr.d.ts → marketCurrencies-Bzj8X4TL.d.ts} +8 -8
  68. package/dist/{marketplace-B5Z8G03R.js → marketplace-BYY8OloA.js} +1 -1
  69. package/dist/{marketplace-B5Z8G03R.js.map → marketplace-BYY8OloA.js.map} +1 -1
  70. package/dist/{marketplace-logos-D8t86gsW.js → marketplace-logos-Csv2MBwf.js} +21 -21
  71. package/dist/marketplace-logos-Csv2MBwf.js.map +1 -0
  72. package/dist/{marketplace.gen-JzNYpM0U.js → marketplace.gen-w2YvbEEo.js} +2 -2
  73. package/dist/marketplace.gen-w2YvbEEo.js.map +1 -0
  74. package/dist/{marketplaceConfig-sNh-MA5M.js → marketplaceConfig-BTy75Mbf.js} +8 -9
  75. package/dist/marketplaceConfig-BTy75Mbf.js.map +1 -0
  76. package/dist/{mintify-DG3GrljJ.js → mintify-DiOoDmO1.js} +1 -1
  77. package/dist/{mintify-DG3GrljJ.js.map → mintify-DiOoDmO1.js.map} +1 -1
  78. package/dist/{network-DnBEe1Ur.js → network-DtmiMhcg.js} +2 -2
  79. package/dist/network-DtmiMhcg.js.map +1 -0
  80. package/dist/networkconfigToWagmiChain-DbUf6HiO.js +15 -0
  81. package/dist/networkconfigToWagmiChain-DbUf6HiO.js.map +1 -0
  82. package/dist/{nftx-B3LH-ZYM.js → nftx-CP82jNra.js} +1 -1
  83. package/dist/{nftx-B3LH-ZYM.js.map → nftx-CP82jNra.js.map} +1 -1
  84. package/dist/{okx-CRFLrT3Z.js → okx-p9-4xRjs.js} +1 -1
  85. package/dist/{okx-CRFLrT3Z.js.map → okx-p9-4xRjs.js.map} +1 -1
  86. package/dist/{open-sea-cOpfl366.js → open-sea-D2GwAmKS.js} +1 -1
  87. package/dist/{open-sea-cOpfl366.js.map → open-sea-D2GwAmKS.js.map} +1 -1
  88. package/dist/{primary-sale-CLjXRrDj.js → primary-sale-DOmNDq2P.js} +1 -1
  89. package/dist/{primary-sale-CLjXRrDj.js.map → primary-sale-DOmNDq2P.js.map} +1 -1
  90. package/dist/{queries-BYT4GJw3.js → queries-EMA5CcwY.js} +208 -287
  91. package/dist/queries-EMA5CcwY.js.map +1 -0
  92. package/dist/{query-BTe7Wkrs.d.ts → query-BG-MA1MB.d.ts} +1 -1
  93. package/dist/{rarible-guwUx4cn.js → rarible-DqiiW9ki.js} +1 -1
  94. package/dist/{rarible-guwUx4cn.js.map → rarible-DqiiW9ki.js.map} +1 -1
  95. package/dist/react/_internal/api/index.d.ts +1 -1
  96. package/dist/react/_internal/api/index.js +4 -4
  97. package/dist/react/_internal/databeat/index.d.ts +1 -1
  98. package/dist/react/_internal/databeat/index.js +24 -21
  99. package/dist/react/_internal/index.d.ts +1 -1
  100. package/dist/react/_internal/index.js +8 -7
  101. package/dist/react/_internal/wagmi/index.d.ts +1 -1
  102. package/dist/react/_internal/wagmi/index.js +4 -3
  103. package/dist/react/hooks/config/index.d.ts +8 -8
  104. package/dist/react/hooks/config/index.js +24 -21
  105. package/dist/react/hooks/contracts/index.d.ts +6 -6
  106. package/dist/react/hooks/contracts/index.js +13 -12
  107. package/dist/react/hooks/data/collectibles/index.d.ts +4 -4
  108. package/dist/react/hooks/data/collectibles/index.js +24 -21
  109. package/dist/react/hooks/data/collections/index.d.ts +10 -10
  110. package/dist/react/hooks/data/collections/index.js +24 -21
  111. package/dist/react/hooks/data/index.d.ts +29 -29
  112. package/dist/react/hooks/data/index.js +25 -22
  113. package/dist/react/hooks/data/inventory/index.d.ts +28 -28
  114. package/dist/react/hooks/data/inventory/index.js +24 -21
  115. package/dist/react/hooks/data/market/index.d.ts +5 -11
  116. package/dist/react/hooks/data/market/index.js +24 -21
  117. package/dist/react/hooks/data/orders/index.d.ts +5 -11
  118. package/dist/react/hooks/data/orders/index.js +25 -22
  119. package/dist/react/hooks/data/primary-sales/index.d.ts +28 -28
  120. package/dist/react/hooks/data/primary-sales/index.js +24 -21
  121. package/dist/react/hooks/data/tokens/index.d.ts +4 -4
  122. package/dist/react/hooks/data/tokens/index.js +24 -21
  123. package/dist/react/hooks/index.d.ts +29 -29
  124. package/dist/react/hooks/index.js +25 -22
  125. package/dist/react/hooks/transactions/index.d.ts +2 -2
  126. package/dist/react/hooks/transactions/index.js +24 -21
  127. package/dist/react/hooks/ui/index.d.ts +4 -4
  128. package/dist/react/hooks/ui/index.js +24 -21
  129. package/dist/react/hooks/utils/index.d.ts +29 -29
  130. package/dist/react/hooks/utils/index.js +25 -22
  131. package/dist/react/index.d.ts +29 -29
  132. package/dist/react/index.js +25 -22
  133. package/dist/react/queries/index.d.ts +16 -16
  134. package/dist/react/queries/index.js +18 -17
  135. package/dist/react/ssr/index.d.ts +7 -7
  136. package/dist/react/ssr/index.js +9 -8
  137. package/dist/react/ssr/index.js.map +1 -1
  138. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +3 -0
  139. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +22 -0
  140. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +54 -0
  141. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +29 -0
  142. package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +5 -5
  143. package/dist/react/ui/components/marketplace-collectible-card/index.js +24 -21
  144. package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +2 -2
  145. package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +9 -8
  146. package/dist/react/ui/components/marketplace-logos/index.d.ts +21 -21
  147. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  148. package/dist/react/ui/icons/index.js +13 -11
  149. package/dist/react/ui/index.d.ts +5 -5
  150. package/dist/react/ui/index.js +24 -21
  151. package/dist/react/ui/modals/_internal/components/actionModal/index.js +24 -21
  152. package/dist/react/utils/index.d.ts +1 -1
  153. package/dist/react/utils/index.js +5 -5
  154. package/dist/{react-Ceq8mamy.js → react-BLJ4DkPx.js} +723 -807
  155. package/dist/react-BLJ4DkPx.js.map +1 -0
  156. package/dist/{react-CbqXKOpt.css → react-F03jPjPk.css} +1 -1
  157. package/dist/{react-CbqXKOpt.css.map → react-F03jPjPk.css.map} +1 -1
  158. package/dist/{sequence-Dt2Xo7Fa.js → sequence-Bbb-TFKg.js} +1 -1
  159. package/dist/{sequence-Dt2Xo7Fa.js.map → sequence-Bbb-TFKg.js.map} +1 -1
  160. package/dist/styles/index.css +46 -24
  161. package/dist/{sudo-swap-CGoARONs.js → sudo-swap-CEPIM3Js.js} +1 -1
  162. package/dist/{sudo-swap-CGoARONs.js.map → sudo-swap-CEPIM3Js.js.map} +1 -1
  163. package/dist/{super-rare-NeQtZjcn.js → super-rare-CMEn9PoO.js} +1 -1
  164. package/dist/{super-rare-NeQtZjcn.js.map → super-rare-CMEn9PoO.js.map} +1 -1
  165. package/dist/{token-D9gZVqbX.js → token-CcyLz8Z8.js} +1 -1
  166. package/dist/{token-D9gZVqbX.js.map → token-CcyLz8Z8.js.map} +1 -1
  167. package/dist/{tokenSupplies-DXtkRYNO.d.ts → tokenSupplies-C470zTT0.d.ts} +23 -23
  168. package/dist/{transaction-CC2KxNF6.js → transaction-DZUW5RHu.js} +2 -8
  169. package/dist/transaction-DZUW5RHu.js.map +1 -0
  170. package/dist/types/index.d.ts +2 -2
  171. package/dist/types/index.js +2 -2
  172. package/dist/{types-G2PWxiJR.js → types-B_-cnkcP.js} +1 -1
  173. package/dist/types-B_-cnkcP.js.map +1 -0
  174. package/dist/{types-BlCa0TVE.d.ts → types-D6LkVrF0.d.ts} +18 -10
  175. package/dist/utils/abi/index.d.ts +4 -4
  176. package/dist/utils/abi/index.js +4 -4
  177. package/dist/utils/abi/marketplace/index.d.ts +1 -1
  178. package/dist/utils/abi/marketplace/index.js +1 -1
  179. package/dist/utils/abi/primary-sale/index.d.ts +1 -1
  180. package/dist/utils/abi/primary-sale/index.js +1 -1
  181. package/dist/utils/abi/token/index.d.ts +1 -1
  182. package/dist/utils/abi/token/index.js +1 -1
  183. package/dist/utils/index.d.ts +6 -6
  184. package/dist/utils/index.js +11 -10
  185. package/dist/{utils-CKJd-CRf.js → utils-BZEkdqWK.js} +7 -24
  186. package/dist/utils-BZEkdqWK.js.map +1 -0
  187. package/dist/{utils-wquIhK6T.js → utils-oVZxdK0o.js} +2 -2
  188. package/dist/utils-oVZxdK0o.js.map +1 -0
  189. package/dist/{waitForTransactionReceipt-DZxAuR9N.js → waitForTransactionReceipt-B08YZiDY.js} +3 -4
  190. package/dist/{waitForTransactionReceipt-DZxAuR9N.js.map → waitForTransactionReceipt-B08YZiDY.js.map} +1 -1
  191. package/dist/{x2y2-CQdg24VP.js → x2y2-DNe6JgtG.js} +1 -1
  192. package/dist/{x2y2-CQdg24VP.js.map → x2y2-DNe6JgtG.js.map} +1 -1
  193. package/dist/{zora-DdEydy4L.js → zora-w0Zqxxs4.js} +1 -1
  194. package/dist/{zora-DdEydy4L.js.map → zora-w0Zqxxs4.js.map} +1 -1
  195. package/package.json +35 -35
  196. package/src/react/_internal/api/marketplace.gen.ts +1 -1
  197. package/src/react/_internal/api/query-keys.ts +2 -0
  198. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +19 -8
  199. package/src/react/_internal/wagmi/create-config.ts +6 -17
  200. package/src/react/hooks/config/__snapshots__/useMarketplaceConfig.test.tsx.snap +4 -4
  201. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +2 -2
  202. package/src/react/hooks/data/collectibles/useTokenBalances.test.tsx +151 -0
  203. package/src/react/hooks/data/collectibles/useTokenBalances.tsx +47 -0
  204. package/src/react/hooks/data/collections/__snapshots__/useListCollections.test.tsx.snap +6 -6
  205. package/src/react/hooks/data/inventory/useInventory.test.tsx +3 -98
  206. package/src/react/hooks/data/inventory/useInventory.tsx +2 -2
  207. package/src/react/hooks/data/market/useListMarketCardData.tsx +1 -1
  208. package/src/react/hooks/data/orders/useListOffersForCollectible.tsx +70 -45
  209. package/src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx +21 -37
  210. package/src/react/hooks/data/primary-sales/useList721ShopCardData.tsx +14 -3
  211. package/src/react/hooks/data/tokens/useSearchTokenMetadata.tsx +4 -1
  212. package/src/react/hooks/transactions/useCancelOrder.test.tsx +7 -4
  213. package/src/react/hooks/transactions/useCancelOrder.tsx +2 -1
  214. package/src/react/hooks/transactions/useCancelTransactionSteps.tsx +2 -2
  215. package/src/react/hooks/transactions/useProcessStep.test.tsx +2 -2
  216. package/src/react/hooks/utils/__tests__/useEnsureCorrectChain.test.tsx +75 -0
  217. package/src/react/hooks/utils/index.ts +0 -1
  218. package/src/react/hooks/utils/useEnsureCorrectChain.ts +31 -34
  219. package/src/react/providers/index.tsx +12 -14
  220. package/src/react/providers/modal-provider.tsx +2 -2
  221. package/src/react/queries/__tests__/balanceOfCollectible.laos.test.ts +3 -3
  222. package/src/react/queries/__tests__/inventory.laos.test.ts +6 -3
  223. package/src/react/queries/__tests__/tokenBalances.laos.test.ts +123 -0
  224. package/src/react/queries/balanceOfCollectible.ts +2 -1
  225. package/src/react/queries/filters.ts +23 -28
  226. package/src/react/queries/index.ts +1 -0
  227. package/src/react/queries/inventory.ts +63 -243
  228. package/src/react/queries/listCollectibles.ts +22 -48
  229. package/src/react/queries/listCollections.ts +10 -13
  230. package/src/react/queries/listOffersForCollectible.ts +101 -0
  231. package/src/react/queries/marketplaceConfig.ts +6 -2
  232. package/src/react/queries/tokenBalances.ts +85 -0
  233. package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +4 -4
  234. package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +8 -8
  235. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +6 -9
  236. package/src/react/ui/components/_internals/action-button/__tests__/NonOwnerActions.test.tsx +4 -4
  237. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +6 -6
  238. package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +1 -1
  239. package/src/react/ui/components/marketplace-collectible-card/CollectibleCard.tsx +4 -3
  240. package/src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx +13 -2
  241. package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +4 -7
  242. package/src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx +14 -5
  243. package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +179 -0
  244. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/FooterName.tsx +103 -0
  245. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/PriceDisplay.tsx +80 -0
  246. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/SaleDetailsPill.tsx +29 -0
  247. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/TokenTypeBalancePill.tsx +30 -0
  248. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/index.ts +4 -0
  249. package/src/react/ui/components/marketplace-collectible-card/components/footer/index.ts +2 -0
  250. package/src/react/ui/components/marketplace-collectible-card/types.ts +18 -6
  251. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +11 -23
  252. package/src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx +42 -0
  253. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +15 -12
  254. package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +10 -10
  255. package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +3 -3
  256. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx.bak +3 -3
  257. package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +6 -6
  258. package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +3 -3
  259. package/src/react/ui/modals/BuyModal/components/BuyModalRouter.tsx +5 -5
  260. package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +2 -2
  261. package/src/react/ui/modals/BuyModal/components/ERC1155QuantityModal.tsx +8 -8
  262. package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +2 -2
  263. package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +13 -2
  264. package/src/react/ui/modals/BuyModal/store.ts +6 -6
  265. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +2 -1
  266. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +1 -1
  267. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +87 -89
  268. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +2 -1
  269. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +1 -1
  270. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +2 -1
  271. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +2 -1
  272. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +20 -9
  273. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +2 -2
  274. package/src/react/ui/modals/_internal/components/switchChainErrorModal/__tests__/SwitchChainErrorModal.test.tsx +80 -0
  275. package/src/react/ui/modals/_internal/components/switchChainErrorModal/index.tsx +64 -0
  276. package/src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts +42 -0
  277. package/src/react/ui/modals/_internal/types.ts +0 -1
  278. package/src/styles/styles.ts +46 -24
  279. package/src/types/new-marketplace-types.ts +9 -18
  280. package/src/types/types.ts +1 -1
  281. package/test/globalSetup.ts +1 -1
  282. package/test/test-utils.tsx +1 -0
  283. package/dist/BellIcon-Cb9YEUzJ.js.map +0 -1
  284. package/dist/CollectibleCard-CYyWzk6u.d.ts +0 -8
  285. package/dist/api-BmEQfSQa.js.map +0 -1
  286. package/dist/create-config-6uynwTeb.js.map +0 -1
  287. package/dist/marketplace-logos-D8t86gsW.js.map +0 -1
  288. package/dist/marketplace.gen-JzNYpM0U.js.map +0 -1
  289. package/dist/marketplaceConfig-sNh-MA5M.js.map +0 -1
  290. package/dist/network-DnBEe1Ur.js.map +0 -1
  291. package/dist/queries-BYT4GJw3.js.map +0 -1
  292. package/dist/react-Ceq8mamy.js.map +0 -1
  293. package/dist/transaction-CC2KxNF6.js.map +0 -1
  294. package/dist/types-G2PWxiJR.js.map +0 -1
  295. package/dist/utils-CKJd-CRf.js.map +0 -1
  296. package/dist/utils-wquIhK6T.js.map +0 -1
  297. package/src/react/hooks/utils/useSwitchChainWithModal.ts +0 -38
  298. package/src/react/ui/components/marketplace-collectible-card/Footer.tsx +0 -238
  299. package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +0 -117
  300. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +0 -124
  301. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +0 -71
  302. /package/dist/{abi-Wr_aTZFi.js → abi-DYsUABe6.js} +0 -0
  303. /package/dist/{index-q7f-WDBS.d.ts → index-Cg5cFzs-.d.ts} +0 -0
  304. /package/dist/{wagmi-BhP3mdhP.js → wagmi-Bseovd6Q.js} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"queries-BYT4GJw3.js","names":["args: Omit<UseBalanceOfCollectibleArgs, 'userAddress'> & {\n\t\tuserAddress: Address;\n\t}","config: SdkConfig","args: UseBalanceOfCollectibleArgs","params: FetchCollectibleParams","apiArgs: GetTokenMetadataArgs","params: CollectibleQueryOptions","params: FetchCountOfCollectablesParams","apiArgs: GetCountOfFilteredCollectiblesArgs","result","apiArgs","apiArgs: GetCountOfAllCollectiblesArgs","params: CountOfCollectablesQueryOptions","params: FetchListCollectibleActivitiesParams","pageParams: Page | undefined","apiArgs: ListCollectibleActivitiesArgs","params: ListCollectibleActivitiesQueryOptions","args: UseListBalancesArgs","config: SdkConfig","page: Page","params: FetchListCollectiblesParams","marketplaceConfig: MarketplaceConfig","page: Page","apiArgs: ListCollectiblesArgs","collectibles: CollectibleOrder[]","params: ListCollectiblesQueryOptions","params: FetchListCollectiblesPaginatedParams","pageParams: Page","apiArgs: ListCollectiblesArgs","params: ListCollectiblesPaginatedQueryOptions","params: FetchCollectionParams","params: CollectionQueryOptions","params: FetchCollectionBalanceDetailsParams","params: CollectionBalanceDetailsQueryOptions","params: FetchCollectionDetailsParams","apiArgs: GetCollectionDetailArgs","params: CollectionDetailsQueryOptions","params: FetchListCollectionActivitiesParams","pageParams: Page | undefined","apiArgs: ListCollectionActivitiesArgs","params: ListCollectionActivitiesQueryOptions","marketplaceConfig: MarketplaceConfig","params: FetchListCollectionsParams","params: ListCollectionsQueryOptions","params: FetchCurrencyParams","currency","params: CurrencyQueryOptions","params: FetchMarketCurrenciesParams","params: MarketCurrenciesQueryOptions","params: FetchCountListingsForCollectibleParams","apiArgs: GetCountOfListingsForCollectibleArgs","params: CountListingsForCollectibleQueryOptions","params: FetchCountOffersForCollectibleParams","apiArgs: GetCountOfOffersForCollectibleArgs","params: CountOffersForCollectibleQueryOptions","params: FetchFloorOrderParams","apiArgs: GetFloorOrderArgs","params: FloorOrderQueryOptions","params: FetchHighestOfferParams","apiArgs: GetCollectibleHighestOfferArgs","params: HighestOfferQueryOptions","params: FetchListListingsForCollectibleParams","apiArgs: ListCollectibleListingsArgs","params: ListListingsForCollectibleQueryOptions","params: FetchLowestListingParams","apiArgs: GetCollectibleLowestListingArgs","params: LowestListingQueryOptions","params: FetchCheckoutOptionsParams","apiArgs: CheckoutOptionsMarketplaceArgs","params: CheckoutOptionsQueryOptions","params: FetchCheckoutOptionsSalesContractParams","apiArgs: CheckoutOptionsSalesContractArgs","params: CheckoutOptionsSalesContractQueryOptions","params: FetchConvertPriceToUSDParams","c: Currency","params: ConvertPriceToUSDQueryOptions","params: FetchComparePricesParams","params: ComparePricesQueryOptions","args: UseCountOfPrimarySaleItemsArgs","config: SdkConfig","params: FetchFiltersParams","params: FiltersQueryOptions","params: FetchGetTokenRangesParams","params: GetTokenRangesQueryOptions","args: UseInventoryArgs","collectionKey: string","token: TokenBalance","chainId: number","accountAddress: Address","collectionAddress: Address","config: SdkConfig","state: InventoryState","isLaos721: boolean","page: IndexerPage","page: Page","collectibles: CollectibleOrder[]","c: CollectibleOrder","args: GetInventoryArgs","params: FetchListTokenMetadataParams","params: ListTokenMetadataQueryOptions","params: FetchPrimarySaleItemsParams","params: ListPrimarySaleItemsQueryOptions","initialPage: PageParam","params: FetchPrimarySaleItemsCountParams","args: PrimarySaleItemsCountQueryOptions","params: FetchSearchTokenMetadataParams","params: SearchTokenMetadataQueryOptions","params: FetchTokenSuppliesParams","result","apiArgs: GetTokenSuppliesArgs","params: TokenSuppliesQueryOptions"],"sources":["../src/react/queries/balanceOfCollectible.ts","../src/react/queries/collectible.ts","../src/react/queries/countOfCollectables.ts","../src/react/queries/listCollectibleActivities.ts","../src/react/queries/listBalances.ts","../src/react/queries/listCollectibles.ts","../src/react/queries/listCollectiblesPaginated.ts","../src/react/queries/collection.ts","../src/react/queries/collectionBalanceDetails.ts","../src/react/queries/collectionDetails.ts","../src/react/queries/listCollectionActivities.ts","../src/react/queries/listCollections.ts","../src/react/queries/currency.ts","../src/react/queries/marketCurrencies.ts","../src/react/queries/countListingsForCollectible.ts","../src/react/queries/countOffersForCollectible.ts","../src/react/queries/floorOrder.ts","../src/react/queries/highestOffer.ts","../src/react/queries/listListingsForCollectible.ts","../src/react/queries/lowestListing.ts","../src/react/queries/checkoutOptions.ts","../src/react/queries/checkoutOptionsSalesContract.ts","../src/react/queries/convertPriceToUSD.ts","../src/react/queries/comparePrices.ts","../src/react/queries/countOfPrimarySaleItems.ts","../src/react/queries/filters.ts","../src/react/queries/getTokenRanges.ts","../src/react/queries/inventory.ts","../src/react/queries/listTokenMetadata.ts","../src/react/queries/primarySaleItems.ts","../src/react/queries/primarySaleItemsCount.ts","../src/react/queries/searchTokenMetadata.ts","../src/react/queries/tokenSupplies.ts"],"sourcesContent":["import { queryOptions, skipToken } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { UseQueryParameters } from 'wagmi/query';\nimport type { SdkConfig } from '../../types';\nimport { collectableKeys, getIndexerClient, LaosAPI } from '../_internal';\n\nexport type UseBalanceOfCollectibleArgs = {\n\tcollectionAddress: Address;\n\tcollectableId: string;\n\tuserAddress: Address | undefined;\n\tchainId: number;\n\tisLaos721?: boolean;\n\tquery?: UseQueryParameters;\n};\n\n/**\n * Fetches the balance of a specific collectible for a user\n *\n * @param args - Arguments for the API call\n * @param config - SDK configuration\n * @returns The balance data\n */\nexport async function fetchBalanceOfCollectible(\n\targs: Omit<UseBalanceOfCollectibleArgs, 'userAddress'> & {\n\t\tuserAddress: Address;\n\t},\n\tconfig: SdkConfig,\n) {\n\tif (args.isLaos721) {\n\t\tconst laosApi = new LaosAPI();\n\t\tconst response = await laosApi.getTokenBalances({\n\t\t\tchainId: args.chainId.toString(),\n\t\t\tcontractAddress: args.collectionAddress,\n\t\t\taccountAddress: args.userAddress,\n\t\t\tincludeMetadata: true,\n\t\t});\n\n\t\treturn response.balances[0] || null;\n\t}\n\n\tconst indexerClient = getIndexerClient(args.chainId, config);\n\treturn indexerClient\n\t\t.getTokenBalances({\n\t\t\taccountAddress: args.userAddress,\n\t\t\tcontractAddress: args.collectionAddress,\n\t\t\ttokenID: args.collectableId,\n\t\t\tincludeMetadata: false,\n\t\t\tmetadataOptions: {\n\t\t\t\tverifiedOnly: true,\n\t\t\t\tincludeContracts: [args.collectionAddress],\n\t\t\t},\n\t\t})\n\t\t.then((res) => res.balances[0] || null);\n}\n\n/**\n * Creates a tanstack query options object for the balance query\n *\n * @param args - The query arguments\n * @param config - SDK configuration\n * @returns Query options configuration\n */\nexport function balanceOfCollectibleOptions(\n\targs: UseBalanceOfCollectibleArgs,\n\tconfig: SdkConfig,\n) {\n\tconst enabled = !!args.userAddress && (args.query?.enabled ?? true);\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.userBalances, args],\n\t\tqueryFn: enabled\n\t\t\t? () =>\n\t\t\t\t\tfetchBalanceOfCollectible(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...args,\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: this is guaranteed by the userAddress check above\n\t\t\t\t\t\t\tuserAddress: args.userAddress!,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t)\n\t\t\t: skipToken,\n\t});\n}\n","import type { GetTokenMetadataArgs } from '@0xsequence/metadata';\nimport { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport { getMetadataClient, type ValuesOptional } from '../_internal';\nimport { collectableKeys } from '../_internal/api/query-keys';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCollectibleParams\n\textends Omit<\n\t\tGetTokenMetadataArgs,\n\t\t'chainID' | 'contractAddress' | 'tokenIDs'\n\t> {\n\tchainId: number;\n\tcollectionAddress: string;\n\tcollectibleId: string;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collectible metadata from the metadata API\n */\nexport async function fetchCollectible(params: FetchCollectibleParams) {\n\tconst { collectionAddress, collectibleId, chainId, config } = params;\n\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst apiArgs: GetTokenMetadataArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainID: String(chainId),\n\t\ttokenIDs: [collectibleId],\n\t};\n\n\tconst result = await metadataClient.getTokenMetadata(apiArgs);\n\treturn result.tokenMetadata[0];\n}\n\nexport type CollectibleQueryOptions = ValuesOptional<FetchCollectibleParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function collectibleQueryOptions(params: CollectibleQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.collectibleId &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.details, params],\n\t\tqueryFn: () =>\n\t\t\tfetchCollectible({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectibleId: params.collectibleId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport { getMarketplaceClient, type ValuesOptional } from '../_internal';\nimport type {\n\tCollectiblesFilter,\n\tGetCountOfAllCollectiblesArgs,\n\tGetCountOfFilteredCollectiblesArgs,\n\tOrderSide,\n} from '../_internal/api/marketplace.gen';\nimport { collectableKeys } from '../_internal/api/query-keys';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCountOfCollectablesParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tconfig: SdkConfig;\n\tfilter?: CollectiblesFilter;\n\tside?: OrderSide;\n}\n\n/**\n * Fetches count of collectibles from the marketplace API\n */\nexport async function fetchCountOfCollectables(\n\tparams: FetchCountOfCollectablesParams,\n) {\n\tconst { collectionAddress, chainId, config, filter, side } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tif (filter && side) {\n\t\tconst apiArgs: GetCountOfFilteredCollectiblesArgs = {\n\t\t\tcontractAddress: collectionAddress,\n\t\t\tchainId: String(chainId),\n\t\t\tfilter,\n\t\t\tside,\n\t\t};\n\n\t\tconst result = await client.getCountOfFilteredCollectibles(apiArgs);\n\t\treturn result.count;\n\t}\n\n\tconst apiArgs: GetCountOfAllCollectiblesArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t};\n\n\tconst result = await client.getCountOfAllCollectibles(apiArgs);\n\treturn result.count;\n}\n\nexport type CountOfCollectablesQueryOptions =\n\tValuesOptional<FetchCountOfCollectablesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function countOfCollectablesQueryOptions(\n\tparams: CountOfCollectablesQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.counts, params],\n\t\tqueryFn: () =>\n\t\t\tfetchCountOfCollectables({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tfilter: params.filter,\n\t\t\t\tside: params.side,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { Page, SdkConfig } from '../../types';\nimport type {\n\tListCollectibleActivitiesArgs,\n\tListCollectibleActivitiesReturn,\n\tSortBy,\n\tValuesOptional,\n} from '../_internal';\nimport { collectableKeys, getMarketplaceClient } from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchListCollectibleActivitiesParams\n\textends Omit<\n\t\tListCollectibleActivitiesArgs,\n\t\t'chainId' | 'contractAddress' | 'page'\n\t> {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tpage?: number;\n\tpageSize?: number;\n\tsort?: SortBy[];\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collectible activities from the Marketplace API\n */\nexport async function fetchListCollectibleActivities(\n\tparams: FetchListCollectibleActivitiesParams,\n): Promise<ListCollectibleActivitiesReturn> {\n\tconst {\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tconfig,\n\t\tpage,\n\t\tpageSize,\n\t\tsort,\n\t\t...additionalApiParams\n\t} = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst pageParams: Page | undefined =\n\t\tpage || pageSize || sort\n\t\t\t? {\n\t\t\t\t\tpage: page ?? 1,\n\t\t\t\t\tpageSize: pageSize ?? 10,\n\t\t\t\t\tsort,\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst apiArgs: ListCollectibleActivitiesArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\tpage: pageParams,\n\t\t...additionalApiParams,\n\t};\n\n\treturn await marketplaceClient.listCollectibleActivities(apiArgs);\n}\n\nexport type ListCollectibleActivitiesQueryOptions =\n\tValuesOptional<FetchListCollectibleActivitiesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function listCollectibleActivitiesQueryOptions(\n\tparams: ListCollectibleActivitiesQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.tokenId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.collectibleActivities, params],\n\t\tqueryFn: () =>\n\t\t\tfetchListCollectibleActivities({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\ttokenId: params.tokenId!,\n\t\t\t\tpage: params.page,\n\t\t\t\tpageSize: params.pageSize,\n\t\t\t\tsort: params.sort,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type { GetTokenBalancesReturn, Page } from '@0xsequence/indexer';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { Address, Hex } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport { balanceQueries, getIndexerClient, LaosAPI } from '../_internal';\n\nexport type UseListBalancesArgs = {\n\tchainId: number;\n\taccountAddress?: Address;\n\tcontractAddress?: Address;\n\ttokenId?: string;\n\tincludeMetadata?: boolean;\n\tmetadataOptions?: {\n\t\tverifiedOnly?: boolean;\n\t\tunverifiedOnly?: boolean;\n\t\tincludeContracts?: Hex[];\n\t};\n\tincludeCollectionTokens?: boolean;\n\tpage?: Page;\n\tisLaos721?: boolean;\n\t//TODO: More options\n\tquery?: {\n\t\tenabled?: boolean;\n\t};\n};\n\nexport async function fetchBalances(\n\targs: UseListBalancesArgs,\n\tconfig: SdkConfig,\n\tpage: Page,\n): Promise<GetTokenBalancesReturn> {\n\tif (args.isLaos721 && args.accountAddress) {\n\t\tconst laosClient = new LaosAPI();\n\t\treturn laosClient.getTokenBalances({\n\t\t\tchainId: args.chainId.toString(),\n\t\t\taccountAddress: args.accountAddress,\n\t\t\tcontractAddress: args.contractAddress as Address,\n\t\t\tincludeMetadata: args.includeMetadata,\n\t\t\tpage: {\n\t\t\t\tsort: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumn: 'CREATED_AT',\n\t\t\t\t\t\torder: 'DESC',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\t}\n\n\tconst indexerClient = getIndexerClient(args.chainId, config);\n\treturn indexerClient.getTokenBalances({\n\t\t...args,\n\t\ttokenID: args.tokenId,\n\t\tpage: page,\n\t});\n}\n\n/**\n * Creates a tanstack infinite query options object for the balances query\n *\n * @param args - The query arguments\n * @param config - SDK configuration\n * @returns Query options configuration\n */\nexport function listBalancesOptions(\n\targs: UseListBalancesArgs,\n\tconfig: SdkConfig,\n) {\n\treturn infiniteQueryOptions({\n\t\t...args.query,\n\t\tqueryKey: [...balanceQueries.lists, args, config],\n\t\tqueryFn: ({ pageParam }) => fetchBalances(args, config, pageParam),\n\t\tinitialPageParam: { page: 1, pageSize: 30 } as Page,\n\t\tgetNextPageParam: (lastPage) => lastPage.page.after,\n\t});\n}\n","import { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { MarketplaceConfig, Page, SdkConfig } from '../../types';\nimport type { MarketplaceType } from '../../types/types';\nimport { compareAddress } from '../../utils';\nimport type {\n\tListCollectiblesArgs,\n\tListCollectiblesReturn,\n\tValuesOptional,\n} from '../_internal';\nimport {\n\ttype CollectibleOrder,\n\tcollectableKeys,\n\tgetMarketplaceClient,\n\tOrderSide,\n} from '../_internal';\nimport { fetchMarketplaceConfig } from '../queries/marketplaceConfig';\nimport type { StandardInfiniteQueryOptions } from '../types/query';\nimport { fetchBalances, type UseListBalancesArgs } from './listBalances';\n\nexport interface FetchListCollectiblesParams\n\textends Omit<ListCollectiblesArgs, 'chainId' | 'contractAddress'> {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tisLaos721?: boolean;\n\tmarketplaceType?: MarketplaceType;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches a list of collectibles with pagination support from the Marketplace API\n */\nexport async function fetchListCollectibles(\n\tparams: FetchListCollectiblesParams,\n\tmarketplaceConfig: MarketplaceConfig,\n\tpage: Page,\n): Promise<ListCollectiblesReturn> {\n\tconst { collectionAddress, chainId, config, ...additionalApiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst apiArgs: ListCollectiblesArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\tpage: page,\n\t\t...additionalApiParams,\n\t};\n\n\tif (params.marketplaceType === 'shop') {\n\t\tconst shopCollection = marketplaceConfig.shop.collections.find(\n\t\t\t(collection) =>\n\t\t\t\tcompareAddress(collection.itemsAddress, params.collectionAddress),\n\t\t);\n\n\t\tif (!shopCollection) {\n\t\t\treturn { collectibles: [] };\n\t\t}\n\n\t\tconst primarySaleItemsList = await marketplaceClient.listPrimarySaleItems(\n\t\t\t{\n\t\t\t\tchainId: params.chainId.toString(),\n\t\t\t\tprimarySaleContractAddress: shopCollection.saleAddress as Address,\n\t\t\t},\n\t\t\tmarketplaceConfig,\n\t\t);\n\n\t\treturn {\n\t\t\tcollectibles: primarySaleItemsList.primarySaleItems.map((item) => ({\n\t\t\t\tmetadata: item.metadata,\n\t\t\t\tprimarySale: {\n\t\t\t\t\tprice: {\n\t\t\t\t\t\tamount: item.primarySaleItem.priceAmount,\n\t\t\t\t\t\tformatted: item.primarySaleItem.priceAmountFormatted,\n\t\t\t\t\t\tdecimals: item.primarySaleItem.priceDecimals,\n\t\t\t\t\t\tcurrencyAddress: item.primarySaleItem.currencyAddress,\n\t\t\t\t\t},\n\t\t\t\t\tstartDate: item.primarySaleItem.startDate,\n\t\t\t\t\tendDate: item.primarySaleItem.endDate,\n\t\t\t\t\tsupplyCap: item.primarySaleItem.supply,\n\t\t\t\t\titemType: item.primarySaleItem.itemType,\n\t\t\t\t},\n\t\t\t})),\n\t\t};\n\t}\n\n\tif (params.isLaos721 && params.side === OrderSide.listing) {\n\t\ttry {\n\t\t\tconst fetchBalancesArgs = {\n\t\t\t\tchainId: params.chainId,\n\t\t\t\taccountAddress: params.filter?.inAccounts?.[0] as Address,\n\t\t\t\tcontractAddress: params.collectionAddress,\n\t\t\t\tpage: page,\n\t\t\t\tincludeMetadata: true,\n\t\t\t\tisLaos721: true,\n\t\t\t} satisfies UseListBalancesArgs;\n\n\t\t\tconst balances = await fetchBalances(fetchBalancesArgs, config, page);\n\t\t\tconst collectibles: CollectibleOrder[] = balances.balances.map(\n\t\t\t\t(balance) => {\n\t\t\t\t\tif (!balance.tokenMetadata)\n\t\t\t\t\t\tthrow new Error('Token metadata not found');\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\ttokenId: balance.tokenID ?? '',\n\t\t\t\t\t\t\tattributes: balance.tokenMetadata.attributes,\n\t\t\t\t\t\t\timage: balance.tokenMetadata.image,\n\t\t\t\t\t\t\tname: balance.tokenMetadata.name,\n\t\t\t\t\t\t\tdescription: balance.tokenMetadata.description,\n\t\t\t\t\t\t\tvideo: balance.tokenMetadata.video,\n\t\t\t\t\t\t\taudio: balance.tokenMetadata.audio,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcollectibles: collectibles,\n\t\t\t\t//@ts-expect-error\n\t\t\t\tpage: balances.page,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\t// If the request fails, ignore the error and return the collectibles from our indexer\n\t\t\tconsole.error(error);\n\t\t}\n\t}\n\n\treturn await marketplaceClient.listCollectibles(apiArgs);\n}\n\nexport type ListCollectiblesQueryOptions =\n\tValuesOptional<FetchListCollectiblesParams> & {\n\t\tquery?: StandardInfiniteQueryOptions;\n\t};\n\nexport function listCollectiblesQueryOptions(\n\tparams: ListCollectiblesQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.side &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: [...collectableKeys.lists, params],\n\t\tqueryFn: async ({ pageParam }) => {\n\t\t\tconst marketplaceConfig = await fetchMarketplaceConfig({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t});\n\t\t\treturn fetchListCollectibles(\n\t\t\t\t{\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\tchainId: params.chainId!,\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\tconfig: params.config!,\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\tside: params.side!,\n\t\t\t\t\tfilter: params.filter,\n\t\t\t\t\tisLaos721: params.isLaos721,\n\t\t\t\t\tmarketplaceType: params.marketplaceType,\n\t\t\t\t},\n\t\t\t\tmarketplaceConfig,\n\t\t\t\tpageParam,\n\t\t\t);\n\t\t},\n\t\tinitialPageParam: { page: 1, pageSize: 30 } as Page,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more ? lastPage.page : undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { Page, SdkConfig } from '../../types';\nimport type {\n\tListCollectiblesArgs,\n\tListCollectiblesReturn,\n\tValuesOptional,\n} from '../_internal';\nimport { collectableKeys, getMarketplaceClient } from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchListCollectiblesPaginatedParams\n\textends Omit<ListCollectiblesArgs, 'chainId' | 'contractAddress' | 'page'> {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tpage?: number;\n\tpageSize?: number;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches a list of collectibles with pagination support from the Marketplace API\n */\nexport async function fetchListCollectiblesPaginated(\n\tparams: FetchListCollectiblesPaginatedParams,\n): Promise<ListCollectiblesReturn> {\n\tconst {\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tconfig,\n\t\tpage = 1,\n\t\tpageSize = 30,\n\t\t...additionalApiParams\n\t} = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst pageParams: Page = {\n\t\tpage,\n\t\tpageSize,\n\t};\n\n\tconst apiArgs: ListCollectiblesArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\tpage: pageParams,\n\t\t...additionalApiParams,\n\t};\n\n\treturn await marketplaceClient.listCollectibles(apiArgs);\n}\n\nexport type ListCollectiblesPaginatedQueryOptions =\n\tValuesOptional<FetchListCollectiblesPaginatedParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function listCollectiblesPaginatedQueryOptions(\n\tparams: ListCollectiblesPaginatedQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.side &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.lists, 'paginated', params],\n\t\tqueryFn: () =>\n\t\t\tfetchListCollectiblesPaginated({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tside: params.side!,\n\t\t\t\tfilter: params.filter,\n\t\t\t\tpage: params.page,\n\t\t\t\tpageSize: params.pageSize,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport { getMetadataClient, type ValuesOptional } from '../_internal';\nimport { collectionKeys } from '../_internal/api/query-keys';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCollectionParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collection information from the metadata API\n */\nexport async function fetchCollection(params: FetchCollectionParams) {\n\tconst { collectionAddress, chainId, config } = params;\n\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst result = await metadataClient.getContractInfo({\n\t\tchainID: chainId.toString(),\n\t\tcontractAddress: collectionAddress,\n\t});\n\n\treturn result.contractInfo;\n}\n\nexport type CollectionQueryOptions = ValuesOptional<FetchCollectionParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function collectionQueryOptions(params: CollectionQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectionKeys.detail, params],\n\t\tqueryFn: () =>\n\t\t\tfetchCollection({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type { GetTokenBalancesDetailsReturn } from '@0xsequence/indexer';\nimport { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport { getIndexerClient, type ValuesOptional } from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface CollectionBalanceFilter {\n\taccountAddresses: Array<Address>;\n\tcontractWhitelist?: Array<Address>;\n\tomitNativeBalances: boolean;\n}\n\nexport interface FetchCollectionBalanceDetailsParams {\n\tchainId: number;\n\tfilter: CollectionBalanceFilter;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches detailed balance information for multiple accounts from the Indexer API\n */\nexport async function fetchCollectionBalanceDetails(\n\tparams: FetchCollectionBalanceDetailsParams,\n): Promise<GetTokenBalancesDetailsReturn> {\n\tconst { chainId, filter, config } = params;\n\n\tconst indexerClient = getIndexerClient(chainId, config);\n\n\tconst promises = filter.accountAddresses.map((accountAddress) =>\n\t\tindexerClient.getTokenBalancesDetails({\n\t\t\tfilter: {\n\t\t\t\taccountAddresses: [accountAddress],\n\t\t\t\tcontractWhitelist: filter.contractWhitelist,\n\t\t\t\tomitNativeBalances: filter.omitNativeBalances,\n\t\t\t},\n\t\t}),\n\t);\n\n\tconst responses = await Promise.all(promises);\n\tconst mergedResponse = responses.reduce<GetTokenBalancesDetailsReturn>(\n\t\t(acc, curr) => {\n\t\t\tif (!curr) return acc;\n\t\t\treturn {\n\t\t\t\tpage: curr.page,\n\t\t\t\tnativeBalances: [\n\t\t\t\t\t...(acc.nativeBalances || []),\n\t\t\t\t\t...(curr.nativeBalances || []),\n\t\t\t\t],\n\t\t\t\tbalances: [...(acc.balances || []), ...(curr.balances || [])],\n\t\t\t};\n\t\t},\n\t\t{ page: {}, nativeBalances: [], balances: [] },\n\t);\n\n\tif (!mergedResponse) {\n\t\tthrow new Error('Failed to fetch collection balance details');\n\t}\n\n\treturn mergedResponse;\n}\n\nexport type CollectionBalanceDetailsQueryOptions =\n\tValuesOptional<FetchCollectionBalanceDetailsParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function collectionBalanceDetailsQueryOptions(\n\tparams: CollectionBalanceDetailsQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.filter?.accountAddresses?.length &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['balances', 'collectionBalanceDetails', params],\n\t\tqueryFn: () =>\n\t\t\tfetchCollectionBalanceDetails({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tfilter: params.filter!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport { getMarketplaceClient, type ValuesOptional } from '../_internal';\nimport type { GetCollectionDetailArgs } from '../_internal/api/marketplace.gen';\nimport { collectionKeys } from '../_internal/api/query-keys';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCollectionDetailsParams\n\textends Omit<GetCollectionDetailArgs, 'chainId' | 'contractAddress'> {\n\tchainId: number;\n\tcollectionAddress: string;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collection details from the marketplace API\n */\nexport async function fetchCollectionDetails(\n\tparams: FetchCollectionDetailsParams,\n) {\n\tconst { collectionAddress, chainId, config, ...additionalApiParams } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst apiArgs: GetCollectionDetailArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\t...additionalApiParams,\n\t};\n\n\tconst result = await marketplaceClient.getCollectionDetail(apiArgs);\n\treturn result.collection;\n}\n\nexport type CollectionDetailsQueryOptions =\n\tValuesOptional<FetchCollectionDetailsParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function collectionDetailsQueryOptions(\n\tparams: CollectionDetailsQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectionKeys.detail, params],\n\t\tqueryFn: () =>\n\t\t\tfetchCollectionDetails({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { Page, SdkConfig } from '../../types';\nimport type {\n\tListCollectionActivitiesArgs,\n\tListCollectionActivitiesReturn,\n\tSortBy,\n\tValuesOptional,\n} from '../_internal';\nimport { getMarketplaceClient } from '../_internal';\nimport { collectionKeys } from '../_internal/api';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchListCollectionActivitiesParams\n\textends Omit<\n\t\tListCollectionActivitiesArgs,\n\t\t'chainId' | 'contractAddress' | 'page'\n\t> {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tpage?: number;\n\tpageSize?: number;\n\tsort?: SortBy[];\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collection activities from the Marketplace API\n */\nexport async function fetchListCollectionActivities(\n\tparams: FetchListCollectionActivitiesParams,\n): Promise<ListCollectionActivitiesReturn> {\n\tconst {\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tconfig,\n\t\tpage,\n\t\tpageSize,\n\t\tsort,\n\t\t...additionalApiParams\n\t} = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst pageParams: Page | undefined =\n\t\tpage || pageSize || sort\n\t\t\t? {\n\t\t\t\t\tpage: page ?? 1,\n\t\t\t\t\tpageSize: pageSize ?? 10,\n\t\t\t\t\tsort,\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst apiArgs: ListCollectionActivitiesArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\tpage: pageParams,\n\t\t...additionalApiParams,\n\t};\n\n\treturn await marketplaceClient.listCollectionActivities(apiArgs);\n}\n\nexport type ListCollectionActivitiesQueryOptions =\n\tValuesOptional<FetchListCollectionActivitiesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function listCollectionActivitiesQueryOptions(\n\tparams: ListCollectionActivitiesQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectionKeys.collectionActivities, params],\n\t\tqueryFn: () =>\n\t\t\tfetchListCollectionActivities({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tpage: params.page,\n\t\t\t\tpageSize: params.pageSize,\n\t\t\t\tsort: params.sort,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type { ContractInfo } from '@0xsequence/metadata';\nimport { queryOptions, skipToken } from '@tanstack/react-query';\nimport type { MarketplaceType, SdkConfig } from '../../types';\nimport type {\n\tMarketCollection,\n\tMarketplaceConfig,\n\tShopCollection,\n} from '../../types/new-marketplace-types';\nimport { compareAddress } from '../../utils';\nimport {\n\tcollectionKeys,\n\tgetMetadataClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nconst allCollections = (marketplaceConfig: MarketplaceConfig) => {\n\treturn [\n\t\t...marketplaceConfig.market.collections,\n\t\t...marketplaceConfig.shop.collections,\n\t];\n};\n\nexport interface FetchListCollectionsParams {\n\tmarketplaceType?: MarketplaceType;\n\tmarketplaceConfig: MarketplaceConfig;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collections from the metadata API with marketplace config filtering\n */\nexport async function fetchListCollections(params: FetchListCollectionsParams) {\n\tconst { marketplaceType, marketplaceConfig, config } = params;\n\tconst metadataClient = getMetadataClient(config);\n\n\tlet collections = allCollections(marketplaceConfig);\n\n\tif (!collections?.length) {\n\t\treturn [];\n\t}\n\n\tif (marketplaceType) {\n\t\tcollections = collections.filter(\n\t\t\t(collection) => collection.marketplaceType === marketplaceType,\n\t\t);\n\t}\n\n\t// Group collections by chainId\n\tconst collectionsByChain = collections.reduce<Record<string, string[]>>(\n\t\t(acc, curr) => {\n\t\t\tconst { chainId, itemsAddress } = curr;\n\t\t\tif (!acc[chainId]) {\n\t\t\t\tacc[chainId] = [];\n\t\t\t}\n\t\t\tacc[chainId].push(itemsAddress);\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\t// Fetch collections for each chain\n\tconst promises = Object.entries(collectionsByChain).map(\n\t\t([chainId, addresses]) =>\n\t\t\tmetadataClient\n\t\t\t\t.getContractInfoBatch({\n\t\t\t\t\tchainID: chainId,\n\t\t\t\t\tcontractAddresses: addresses,\n\t\t\t\t})\n\t\t\t\t.then((resp) => Object.values(resp.contractInfoMap)),\n\t);\n\n\tconst settled = await Promise.allSettled(promises);\n\n\t// If all promises failed, throw the first error\n\tif (settled.every((result) => result.status === 'rejected')) {\n\t\tconst firstError = settled[0] as PromiseRejectedResult;\n\t\tthrow firstError.reason;\n\t}\n\n\tconst results = settled\n\t\t.filter(\n\t\t\t(r): r is PromiseFulfilledResult<ContractInfo[]> =>\n\t\t\t\tr.status === 'fulfilled',\n\t\t)\n\t\t.flatMap((r) => r.value);\n\n\tconst collectionsWithMetadata = collections\n\t\t.map((collection) => {\n\t\t\tconst metadata = results.find((result) =>\n\t\t\t\tcompareAddress(result.address, collection.itemsAddress),\n\t\t\t);\n\t\t\treturn { collection, metadata };\n\t\t})\n\t\t.filter(\n\t\t\t(\n\t\t\t\titem,\n\t\t\t): item is {\n\t\t\t\tcollection: MarketCollection | ShopCollection;\n\t\t\t\tmetadata: ContractInfo;\n\t\t\t} => item.metadata !== undefined,\n\t\t)\n\t\t.map(({ collection, metadata }) => ({\n\t\t\t...collection,\n\t\t\t...metadata,\n\t\t}));\n\n\treturn collectionsWithMetadata;\n}\n\nexport type ListCollectionsQueryOptions =\n\tValuesOptional<FetchListCollectionsParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function listCollectionsQueryOptions(\n\tparams: ListCollectionsQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.marketplaceConfig &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectionKeys.list, params],\n\t\tqueryFn: enabled\n\t\t\t? () =>\n\t\t\t\t\tfetchListCollections({\n\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\tmarketplaceConfig: params.marketplaceConfig!,\n\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\tconfig: params.config!,\n\t\t\t\t\t\tmarketplaceType: params.marketplaceType,\n\t\t\t\t\t})\n\t\t\t: skipToken,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n\n// Keep old function for backward compatibility during migration\nexport const listCollectionsOptions = ({\n\tmarketplaceType,\n\tmarketplaceConfig,\n\tconfig,\n}: {\n\tmarketplaceType?: MarketplaceType;\n\tmarketplaceConfig: MarketplaceConfig | undefined;\n\tconfig: SdkConfig;\n}) => {\n\treturn queryOptions({\n\t\tqueryKey: [\n\t\t\t...collectionKeys.list,\n\t\t\t{ marketplaceType, marketplaceConfig, config },\n\t\t],\n\t\tqueryFn: marketplaceConfig\n\t\t\t? () =>\n\t\t\t\t\tfetchListCollections({\n\t\t\t\t\t\tmarketplaceConfig,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tmarketplaceType,\n\t\t\t\t\t})\n\t\t\t: skipToken,\n\t\tenabled: Boolean(marketplaceConfig),\n\t});\n};\n","import { queryOptions, skipToken } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport {\n\ttype Currency,\n\tcurrencyKeys,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCurrencyParams {\n\tchainId: number;\n\tcurrencyAddress: Address;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches currency details from the marketplace API\n */\nexport async function fetchCurrency(\n\tparams: FetchCurrencyParams,\n): Promise<Currency | undefined> {\n\tconst { chainId, currencyAddress, config } = params;\n\tconst queryClient = getQueryClient();\n\n\tlet currencies = queryClient.getQueryData([...currencyKeys.lists, chainId]) as\n\t\t| Currency[]\n\t\t| undefined;\n\n\tif (!currencies) {\n\t\tconst marketplaceClient = getMarketplaceClient(config);\n\t\tcurrencies = await marketplaceClient\n\t\t\t.listCurrencies({ chainId: String(chainId) })\n\t\t\t.then((resp) => resp.currencies);\n\t}\n\n\tif (!currencies?.length) {\n\t\tthrow new Error('No currencies returned');\n\t}\n\tconst currency = currencies.find(\n\t\t(currency) =>\n\t\t\tcurrency.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currency) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\treturn currency;\n}\n\nexport type CurrencyQueryOptions = ValuesOptional<FetchCurrencyParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function currencyQueryOptions(params: CurrencyQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.currencyAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...currencyKeys.details, params],\n\t\tqueryFn:\n\t\t\tparams.chainId && params.currencyAddress\n\t\t\t\t? () =>\n\t\t\t\t\t\tfetchCurrency({\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\t\tchainId: params.chainId!,\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\t\tcurrencyAddress: params.currencyAddress!,\n\t\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\t\t\t\tconfig: params.config!,\n\t\t\t\t\t\t})\n\t\t\t\t: skipToken,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport { type Address, zeroAddress } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport { compareAddress } from '../../utils';\nimport {\n\tcurrencyKeys,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\nimport { marketplaceConfigOptions } from './marketplaceConfig';\n\nexport interface FetchMarketCurrenciesParams {\n\tchainId: number;\n\tincludeNativeCurrency?: boolean;\n\tcollectionAddress?: Address;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches supported currencies for a marketplace\n */\nexport async function fetchMarketCurrencies(\n\tparams: FetchMarketCurrenciesParams,\n) {\n\tconst { chainId, includeNativeCurrency, collectionAddress, config } = params;\n\tconst includeNativeCurrencyOption = includeNativeCurrency ?? true;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tlet currencies = await marketplaceClient\n\t\t.listCurrencies({\n\t\t\tchainId: String(chainId),\n\t\t})\n\t\t.then((resp) =>\n\t\t\tresp.currencies.map((currency) => ({\n\t\t\t\t...currency,\n\t\t\t\tcontractAddress: currency.contractAddress || zeroAddress,\n\t\t\t})),\n\t\t);\n\n\tif (collectionAddress) {\n\t\tconst queryClient = getQueryClient();\n\t\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\t\tmarketplaceConfigOptions(config),\n\t\t);\n\n\t\tconst currenciesOptions = marketplaceConfig.market.collections.find(\n\t\t\t(collection) =>\n\t\t\t\tcompareAddress(collection.itemsAddress, collectionAddress),\n\t\t)?.currencyOptions;\n\n\t\t// Filter currencies based on collection currency options\n\t\tif (currenciesOptions) {\n\t\t\tcurrencies = currencies.filter((currency) =>\n\t\t\t\tcurrenciesOptions.includes(currency.contractAddress),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!includeNativeCurrencyOption) {\n\t\tcurrencies = currencies.filter((currency) => !currency.nativeCurrency);\n\t}\n\n\treturn currencies;\n}\n\nexport type MarketCurrenciesQueryOptions =\n\tValuesOptional<FetchMarketCurrenciesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function marketCurrenciesQueryOptions(\n\tparams: MarketCurrenciesQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId && params.config && (params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...currencyKeys.lists, params],\n\t\tqueryFn: () =>\n\t\t\tfetchMarketCurrencies({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tincludeNativeCurrency: params.includeNativeCurrency,\n\t\t\t\tcollectionAddress: params.collectionAddress,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport { getMarketplaceClient, type ValuesOptional } from '../_internal';\nimport type {\n\tGetCountOfListingsForCollectibleArgs,\n\tOrderFilter,\n} from '../_internal/api/marketplace.gen';\nimport { collectableKeys } from '../_internal/api/query-keys';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCountListingsForCollectibleParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tcollectibleId: string;\n\tconfig: SdkConfig;\n\tfilter?: OrderFilter;\n}\n\n/**\n * Fetches count of listings for a collectible from the marketplace API\n */\nexport async function fetchCountListingsForCollectible(\n\tparams: FetchCountListingsForCollectibleParams,\n) {\n\tconst { collectionAddress, chainId, collectibleId, config, filter } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tconst apiArgs: GetCountOfListingsForCollectibleArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\ttokenId: collectibleId,\n\t\tfilter,\n\t};\n\n\tconst result = await client.getCountOfListingsForCollectible(apiArgs);\n\treturn result.count;\n}\n\nexport type CountListingsForCollectibleQueryOptions =\n\tValuesOptional<FetchCountListingsForCollectibleParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function countListingsForCollectibleQueryOptions(\n\tparams: CountListingsForCollectibleQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.collectibleId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.listingsCount, params],\n\t\tqueryFn: () =>\n\t\t\tfetchCountListingsForCollectible({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectibleId: params.collectibleId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tfilter: params.filter,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport { getMarketplaceClient, type ValuesOptional } from '../_internal';\nimport type {\n\tGetCountOfOffersForCollectibleArgs,\n\tOrderFilter,\n} from '../_internal/api/marketplace.gen';\nimport { collectableKeys } from '../_internal/api/query-keys';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCountOffersForCollectibleParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tcollectibleId: string;\n\tconfig: SdkConfig;\n\tfilter?: OrderFilter;\n}\n\n/**\n * Fetches count of offers for a collectible from the marketplace API\n */\nexport async function fetchCountOffersForCollectible(\n\tparams: FetchCountOffersForCollectibleParams,\n) {\n\tconst { collectionAddress, chainId, collectibleId, config, filter } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tconst apiArgs: GetCountOfOffersForCollectibleArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\ttokenId: collectibleId,\n\t\tfilter,\n\t};\n\n\tconst result = await client.getCountOfOffersForCollectible(apiArgs);\n\treturn result.count;\n}\n\nexport type CountOffersForCollectibleQueryOptions =\n\tValuesOptional<FetchCountOffersForCollectibleParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function countOffersForCollectibleQueryOptions(\n\tparams: CountOffersForCollectibleQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.collectibleId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.offersCount, params],\n\t\tqueryFn: () =>\n\t\t\tfetchCountOffersForCollectible({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectibleId: params.collectibleId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tfilter: params.filter,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport {\n\tcollectableKeys,\n\ttype GetFloorOrderArgs,\n\tgetMarketplaceClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchFloorOrderParams\n\textends Omit<GetFloorOrderArgs, 'contractAddress' | 'chainId'> {\n\tcollectionAddress: string;\n\tchainId: number;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches the floor order for a collection from the marketplace API\n */\nexport async function fetchFloorOrder(params: FetchFloorOrderParams) {\n\tconst { collectionAddress, chainId, config, ...additionalApiParams } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst apiArgs: GetFloorOrderArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\t...additionalApiParams,\n\t};\n\n\tconst result = await marketplaceClient.getFloorOrder(apiArgs);\n\treturn result.collectible;\n}\n\nexport type FloorOrderQueryOptions = ValuesOptional<FetchFloorOrderParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function floorOrderQueryOptions(params: FloorOrderQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.floorOrders, params],\n\t\tqueryFn: () =>\n\t\t\tfetchFloorOrder({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\t...((params.filter && { filter: params.filter }) || {}),\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport {\n\tcollectableKeys,\n\ttype GetCollectibleHighestOfferArgs,\n\tgetMarketplaceClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchHighestOfferParams\n\textends Omit<GetCollectibleHighestOfferArgs, 'contractAddress' | 'chainId'> {\n\tcollectionAddress: string;\n\tchainId: number;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches the highest offer for a collectible from the marketplace API\n */\nexport async function fetchHighestOffer(params: FetchHighestOfferParams) {\n\tconst { collectionAddress, chainId, config, ...additionalApiParams } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst apiArgs: GetCollectibleHighestOfferArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\t...additionalApiParams,\n\t};\n\n\tconst result = await marketplaceClient.getCollectibleHighestOffer(apiArgs);\n\treturn result.order ?? null;\n}\n\nexport type HighestOfferQueryOptions =\n\tValuesOptional<FetchHighestOfferParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function highestOfferQueryOptions(params: HighestOfferQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.tokenId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.highestOffers, params],\n\t\tqueryFn: () =>\n\t\t\tfetchHighestOffer({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\ttokenId: params.tokenId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport type {\n\tListCollectibleListingsArgs,\n\tListCollectibleListingsReturn,\n\tValuesOptional,\n} from '../_internal';\nimport { collectableKeys, getMarketplaceClient } from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchListListingsForCollectibleParams\n\textends Omit<\n\t\tListCollectibleListingsArgs,\n\t\t'chainId' | 'contractAddress' | 'tokenId'\n\t> {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tcollectibleId: string;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches listings for a specific collectible from the Marketplace API\n */\nexport async function fetchListListingsForCollectible(\n\tparams: FetchListListingsForCollectibleParams,\n): Promise<ListCollectibleListingsReturn> {\n\tconst {\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tcollectibleId,\n\t\tconfig,\n\t\t...additionalApiParams\n\t} = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst apiArgs: ListCollectibleListingsArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\ttokenId: collectibleId,\n\t\t...additionalApiParams,\n\t};\n\n\treturn await marketplaceClient.listCollectibleListings(apiArgs);\n}\n\nexport type ListListingsForCollectibleQueryOptions =\n\tValuesOptional<FetchListListingsForCollectibleParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function listListingsForCollectibleQueryOptions(\n\tparams: ListListingsForCollectibleQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.collectibleId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.listings, params],\n\t\tqueryFn: () =>\n\t\t\tfetchListListingsForCollectible({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectibleId: params.collectibleId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tfilter: params.filter,\n\t\t\t\tpage: params.page,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport {\n\tcollectableKeys,\n\ttype GetCollectibleLowestListingArgs,\n\ttype GetCollectibleLowestListingReturn,\n\tgetMarketplaceClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchLowestListingParams\n\textends Omit<GetCollectibleLowestListingArgs, 'contractAddress' | 'chainId'> {\n\tcollectionAddress: string;\n\tchainId: number;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches the lowest listing for a collectible from the marketplace API\n */\nexport async function fetchLowestListing(\n\tparams: FetchLowestListingParams,\n): Promise<GetCollectibleLowestListingReturn['order'] | null> {\n\tconst { collectionAddress, chainId, config, ...additionalApiParams } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst apiArgs: GetCollectibleLowestListingArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\tchainId: String(chainId),\n\t\t...additionalApiParams,\n\t};\n\n\tconst result = await marketplaceClient.getCollectibleLowestListing(apiArgs);\n\treturn result.order || null;\n}\n\nexport type LowestListingQueryOptions =\n\tValuesOptional<FetchLowestListingParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function lowestListingQueryOptions(params: LowestListingQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.collectionAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.tokenId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...collectableKeys.lowestListings, params],\n\t\tqueryFn: () =>\n\t\t\tfetchLowestListing({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\ttokenId: params.tokenId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport type { MarketplaceKind } from '../_internal';\nimport { getMarketplaceClient, type ValuesOptional } from '../_internal';\nimport type {\n\tCheckoutOptionsMarketplaceArgs,\n\tCheckoutOptionsMarketplaceReturn,\n} from '../_internal/api/marketplace.gen';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCheckoutOptionsParams\n\textends Omit<\n\t\tCheckoutOptionsMarketplaceArgs,\n\t\t'chainId' | 'wallet' | 'orders'\n\t> {\n\tchainId: number;\n\twalletAddress: Address;\n\torders: Array<{\n\t\tcollectionAddress: string;\n\t\torderId: string;\n\t\tmarketplace: MarketplaceKind;\n\t}>;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches checkout options from the Marketplace API\n */\nexport async function fetchCheckoutOptions(\n\tparams: FetchCheckoutOptionsParams,\n): Promise<CheckoutOptionsMarketplaceReturn> {\n\tconst { chainId, walletAddress, orders, config, additionalFee } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tconst apiArgs: CheckoutOptionsMarketplaceArgs = {\n\t\tchainId: String(chainId),\n\t\twallet: walletAddress,\n\t\torders: orders.map((order) => ({\n\t\t\tcontractAddress: order.collectionAddress,\n\t\t\torderId: order.orderId,\n\t\t\tmarketplace: order.marketplace,\n\t\t})),\n\t\tadditionalFee: additionalFee ?? 0,\n\t};\n\n\tconst result = await client.checkoutOptionsMarketplace(apiArgs);\n\treturn result;\n}\n\nexport type CheckoutOptionsQueryOptions =\n\tValuesOptional<FetchCheckoutOptionsParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function checkoutOptionsQueryOptions(\n\tparams: CheckoutOptionsQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.walletAddress &&\n\t\t\tparams.orders?.length &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['checkout', 'options', params],\n\t\tqueryFn: () =>\n\t\t\tfetchCheckoutOptions({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\twalletAddress: params.walletAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\torders: params.orders!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tadditionalFee: params.additionalFee ?? 0,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport { getMarketplaceClient, type ValuesOptional } from '../_internal';\nimport type {\n\tCheckoutOptionsItem,\n\tCheckoutOptionsSalesContractArgs,\n\tCheckoutOptionsSalesContractReturn,\n} from '../_internal/api/marketplace.gen';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchCheckoutOptionsSalesContractParams\n\textends Omit<CheckoutOptionsSalesContractArgs, 'chainId' | 'wallet'> {\n\tchainId: number;\n\twalletAddress: Address;\n\tcontractAddress: string;\n\tcollectionAddress: string;\n\titems: Array<CheckoutOptionsItem>;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches checkout options for sales contract from the Marketplace API\n */\nexport async function fetchCheckoutOptionsSalesContract(\n\tparams: FetchCheckoutOptionsSalesContractParams,\n): Promise<CheckoutOptionsSalesContractReturn> {\n\tconst {\n\t\tchainId,\n\t\twalletAddress,\n\t\tcontractAddress,\n\t\tcollectionAddress,\n\t\titems,\n\t\tconfig,\n\t} = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tconst apiArgs: CheckoutOptionsSalesContractArgs = {\n\t\tchainId: String(chainId),\n\t\twallet: walletAddress,\n\t\tcontractAddress,\n\t\tcollectionAddress,\n\t\titems,\n\t};\n\n\tconst result = await client.checkoutOptionsSalesContract(apiArgs);\n\treturn result;\n}\n\nexport type CheckoutOptionsSalesContractQueryOptions =\n\tValuesOptional<FetchCheckoutOptionsSalesContractParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function checkoutOptionsSalesContractQueryOptions(\n\tparams: CheckoutOptionsSalesContractQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.walletAddress &&\n\t\t\tparams.contractAddress &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.items?.length &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['checkout', 'options', 'salesContract', params],\n\t\tqueryFn: () =>\n\t\t\tfetchCheckoutOptionsSalesContract({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\twalletAddress: params.walletAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcontractAddress: params.contractAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\titems: params.items!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport { type Address, formatUnits } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport {\n\ttype Currency,\n\tgetQueryClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\nimport { marketCurrenciesQueryOptions } from './marketCurrencies';\n\nexport interface FetchConvertPriceToUSDParams {\n\tchainId: number;\n\tcurrencyAddress: Address;\n\tamountRaw: string;\n\tconfig: SdkConfig;\n}\n\nexport interface ConvertPriceToUSDReturn {\n\tusdAmount: number;\n\tusdAmountFormatted: string;\n}\n\n/**\n * Converts a price amount from a specific currency to USD using exchange rates\n */\nexport async function fetchConvertPriceToUSD(\n\tparams: FetchConvertPriceToUSDParams,\n): Promise<ConvertPriceToUSDReturn> {\n\tconst { chainId, currencyAddress, amountRaw, config } = params;\n\n\tconst queryClient = getQueryClient();\n\tconst currencies = (await queryClient.fetchQuery(\n\t\tmarketCurrenciesQueryOptions({\n\t\t\tchainId,\n\t\t\tconfig,\n\t\t}),\n\t)) as Currency[];\n\n\tconst currencyDetails = currencies.find(\n\t\t(c: Currency) =>\n\t\t\tc.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currencyDetails) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\tconst amountDecimal = Number(\n\t\tformatUnits(BigInt(amountRaw), currencyDetails.decimals),\n\t);\n\tconst usdAmount = amountDecimal * currencyDetails.exchangeRate;\n\n\treturn {\n\t\tusdAmount,\n\t\tusdAmountFormatted: usdAmount.toFixed(2),\n\t};\n}\n\nexport type ConvertPriceToUSDQueryOptions =\n\tValuesOptional<FetchConvertPriceToUSDParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function convertPriceToUSDQueryOptions(\n\tparams: ConvertPriceToUSDQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.currencyAddress &&\n\t\t\tparams.amountRaw &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['currency', 'convertPriceToUSD', params],\n\t\tqueryFn: () =>\n\t\t\tfetchConvertPriceToUSD({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcurrencyAddress: params.currencyAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tamountRaw: params.amountRaw!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport type { ValuesOptional } from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\nimport { fetchConvertPriceToUSD } from './convertPriceToUSD';\n\nexport interface FetchComparePricesParams {\n\tchainId: number;\n\t// First price details\n\tpriceAmountRaw: string;\n\tpriceCurrencyAddress: Address;\n\t// Second price details (to compare against)\n\tcompareToPriceAmountRaw: string;\n\tcompareToPriceCurrencyAddress: Address;\n\tconfig: SdkConfig;\n}\n\nexport type ComparePricesReturn = {\n\tpercentageDifference: number;\n\tpercentageDifferenceFormatted: string;\n\tstatus: 'above' | 'same' | 'below';\n};\n\n/**\n * Compares prices between different currencies by converting both to USD\n */\nexport async function fetchComparePrices(\n\tparams: FetchComparePricesParams,\n): Promise<ComparePricesReturn> {\n\tconst {\n\t\tchainId,\n\t\tpriceAmountRaw,\n\t\tpriceCurrencyAddress,\n\t\tcompareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress,\n\t\tconfig,\n\t} = params;\n\n\tconst [priceUSD, compareToPriceUSD] = await Promise.all([\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: priceCurrencyAddress,\n\t\t\tamountRaw: priceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: compareToPriceCurrencyAddress,\n\t\t\tamountRaw: compareToPriceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t]);\n\n\tconst difference = priceUSD.usdAmount - compareToPriceUSD.usdAmount;\n\n\tif (compareToPriceUSD.usdAmount === 0) {\n\t\tthrow new Error('Cannot compare to zero price');\n\t}\n\n\tconst percentageDifference = (difference / compareToPriceUSD.usdAmount) * 100;\n\tconst isAbove = percentageDifference > 0;\n\tconst isSame = percentageDifference === 0;\n\n\treturn {\n\t\tpercentageDifference,\n\t\tpercentageDifferenceFormatted: Math.abs(percentageDifference).toFixed(2),\n\t\tstatus: isAbove ? 'above' : isSame ? 'same' : 'below',\n\t};\n}\n\nexport type ComparePricesQueryOptions =\n\tValuesOptional<FetchComparePricesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function comparePricesQueryOptions(params: ComparePricesQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.priceAmountRaw &&\n\t\t\tparams.priceCurrencyAddress &&\n\t\t\tparams.compareToPriceAmountRaw &&\n\t\t\tparams.compareToPriceCurrencyAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['currency', 'conversion', 'compare', params],\n\t\tqueryFn: () =>\n\t\t\tfetchComparePrices({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tpriceAmountRaw: params.priceAmountRaw!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tpriceCurrencyAddress: params.priceCurrencyAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcompareToPriceAmountRaw: params.compareToPriceAmountRaw!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcompareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport {\n\ttype GetCountOfPrimarySaleItemsArgs,\n\tgetMarketplaceClient,\n\ttype PrimarySaleItemsFilter,\n} from '../_internal';\n\nexport interface UseCountOfPrimarySaleItemsArgs\n\textends Omit<\n\t\tGetCountOfPrimarySaleItemsArgs,\n\t\t'chainId' | 'primarySaleContractAddress'\n\t> {\n\tchainId: number;\n\tprimarySaleContractAddress: Address;\n\tfilter?: PrimarySaleItemsFilter;\n\tquery?: {\n\t\tenabled?: boolean;\n\t};\n}\n\nexport async function fetchCountOfPrimarySaleItems(\n\targs: UseCountOfPrimarySaleItemsArgs,\n\tconfig: SdkConfig,\n) {\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst { chainId, primarySaleContractAddress, filter } = args;\n\tconst data = await marketplaceClient.getCountOfPrimarySaleItems({\n\t\tchainId: String(chainId),\n\t\tprimarySaleContractAddress,\n\t\tfilter,\n\t});\n\n\treturn data.count;\n}\n\nexport function countOfPrimarySaleItemsOptions(\n\targs: UseCountOfPrimarySaleItemsArgs,\n\tconfig: SdkConfig,\n) {\n\treturn queryOptions({\n\t\tenabled: args.query?.enabled ?? true,\n\t\tqueryKey: ['countOfPrimarySaleItems', args],\n\t\tqueryFn: () => fetchCountOfPrimarySaleItems(args, config),\n\t});\n}\n","import type { PropertyFilter } from '@0xsequence/metadata';\nimport { queryOptions } from '@tanstack/react-query';\nimport { FilterCondition, type SdkConfig } from '../../types';\nimport { compareAddress } from '../../utils';\nimport {\n\tgetMetadataClient,\n\tgetQueryClient,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\nimport { marketplaceConfigOptions } from './marketplaceConfig';\n\nexport interface FetchFiltersParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tshowAllFilters?: boolean;\n\texcludePropertyValues?: boolean;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches collection filters from the Metadata API with optional marketplace filtering\n */\nexport async function fetchFilters(\n\tparams: FetchFiltersParams,\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 filters = await metadataClient\n\t\t.getTokenMetadataPropertyFilters({\n\t\t\tchainID: chainId.toString(),\n\t\t\tcontractAddress: collectionAddress,\n\t\t\texcludeProperties: [],\n\t\t\texcludePropertyValues,\n\t\t})\n\t\t.then((resp) => resp.filters);\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 = marketplaceConfig.market.collections.find((c) =>\n\t\tcompareAddress(c.itemsAddress, collectionAddress),\n\t)?.filterSettings;\n\n\tif (\n\t\t!collectionFilters?.exclusions ||\n\t\tcollectionFilters.exclusions.length === 0 ||\n\t\t!collectionFilters.filterOrder ||\n\t\tcollectionFilters.filterOrder.length === 0\n\t)\n\t\treturn filters;\n\n\tconst { filterOrder, exclusions } = collectionFilters;\n\n\tconst sortedFilters = filters.toSorted((a, b) => {\n\t\tconst aIndex =\n\t\t\tfilterOrder.indexOf(a.name) > -1\n\t\t\t\t? filterOrder.indexOf(a.name)\n\t\t\t\t: filterOrder.length;\n\t\tconst bIndex =\n\t\t\tfilterOrder.indexOf(b.name) > -1\n\t\t\t\t? filterOrder.indexOf(b.name)\n\t\t\t\t: filterOrder.length;\n\t\treturn aIndex - bIndex;\n\t});\n\n\tconst filteredResults = sortedFilters.reduce<PropertyFilter[]>(\n\t\t(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\t[],\n\t);\n\n\treturn filteredResults;\n}\n\nexport type FiltersQueryOptions = ValuesOptional<FetchFiltersParams> & {\n\tquery?: StandardQueryOptions;\n};\n\nexport function filtersQueryOptions(params: FiltersQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['filters', params],\n\t\tqueryFn: () =>\n\t\t\tfetchFilters({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\tshowAllFilters: params.showAllFilters,\n\t\t\t\texcludePropertyValues: params.excludePropertyValues,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type { GetTokenIDRangesReturn } from '@0xsequence/indexer';\nimport { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport { getIndexerClient, type ValuesOptional } from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchGetTokenRangesParams {\n\tchainId: number;\n\tcollectionAddress: Address;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches token ID ranges for a collection from the Indexer API\n */\nexport async function fetchGetTokenRanges(\n\tparams: FetchGetTokenRangesParams,\n): Promise<GetTokenIDRangesReturn> {\n\tconst { chainId, collectionAddress, config } = params;\n\n\tconst indexerClient = getIndexerClient(chainId, config);\n\n\tconst response = await indexerClient.getTokenIDRanges({\n\t\tcontractAddress: collectionAddress,\n\t});\n\n\tif (!response) {\n\t\tthrow new Error('Failed to fetch token ranges');\n\t}\n\n\treturn response;\n}\n\nexport type GetTokenRangesQueryOptions =\n\tValuesOptional<FetchGetTokenRangesParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function getTokenRangesQueryOptions(params: GetTokenRangesQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['indexer', 'tokenRanges', params],\n\t\tqueryFn: () =>\n\t\t\tfetchGetTokenRanges({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type {\n\tContractInfo,\n\tPage as IndexerPage,\n\tTokenBalance,\n} from '@0xsequence/indexer';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport { OrderSide, type Page, type SdkConfig } from '../../types';\nimport {\n\ttype CollectibleOrder,\n\ttype ContractType,\n\tgetIndexerClient,\n\tLaosAPI,\n} from '../_internal';\nimport { fetchListCollectibles } from './listCollectibles';\nimport { fetchMarketplaceConfig } from './marketplaceConfig';\n\nexport interface UseInventoryArgs {\n\taccountAddress: Address;\n\tcollectionAddress: Address;\n\tchainId: number;\n\tisLaos721?: boolean;\n\tquery?: {\n\t\tenabled?: boolean;\n\t};\n}\n\n// Maintain collection state across calls\ninterface InventoryState {\n\tseenTokenIds: Set<string>;\n\tmarketplaceFinished: boolean;\n\t// Track if we've already fetched all indexer tokens\n\tindexerTokensFetched: boolean;\n\t// Store the token balances from the indexer\n\tindexerTokenBalances: Map<string, CollectibleWithBalance>;\n}\n\n// Store state per collection\nconst stateByCollection = new Map<string, InventoryState>();\n\n// Test helper to clear state between tests\nexport const clearInventoryState = () => {\n\tstateByCollection.clear();\n};\n\nconst getCollectionKey = (args: UseInventoryArgs) =>\n\t`${args.chainId}-${args.collectionAddress}-${args.accountAddress}`;\n\ninterface GetInventoryArgs extends Omit<UseInventoryArgs, 'query'> {\n\tisLaos721: boolean;\n}\n\ninterface CollectibleWithBalance extends CollectibleOrder {\n\tbalance: string;\n\tcontractInfo?: ContractInfo;\n\tcontractType: ContractType.ERC1155 | ContractType.ERC721;\n}\n\nexport interface CollectiblesResponse {\n\tcollectibles: CollectibleWithBalance[];\n\tpage: Page;\n}\n\nfunction getOrInitState(collectionKey: string): InventoryState {\n\tif (!stateByCollection.has(collectionKey)) {\n\t\tstateByCollection.set(collectionKey, {\n\t\t\tseenTokenIds: new Set<string>(),\n\t\t\tmarketplaceFinished: false,\n\t\t\tindexerTokensFetched: false,\n\t\t\tindexerTokenBalances: new Map(),\n\t\t});\n\t}\n\n\t// biome-ignore lint/style/noNonNullAssertion: guaranteed to exist, by the above init\n\treturn stateByCollection.get(collectionKey)!;\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},\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 fetchAllIndexerTokens(\n\tchainId: number,\n\taccountAddress: Address,\n\tcollectionAddress: Address,\n\tconfig: SdkConfig,\n\tstate: InventoryState,\n\tisLaos721: boolean,\n): Promise<void> {\n\tif (isLaos721) {\n\t\tconst laosClient = new LaosAPI();\n\t\tconst { balances } = await laosClient.getTokenBalances({\n\t\t\tchainId: chainId.toString(),\n\t\t\taccountAddress,\n\t\t\tincludeMetadata: true,\n\t\t\tcontractAddress: collectionAddress,\n\t\t\tpage: {\n\t\t\t\tsort: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumn: 'CREATED_AT',\n\t\t\t\t\t\torder: 'DESC',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\n\t\tfor (const balance of balances) {\n\t\t\tif (balance.tokenID) {\n\t\t\t\tstate.indexerTokenBalances.set(\n\t\t\t\t\tbalance.tokenID,\n\t\t\t\t\tcollectibleFromTokenBalance(balance),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tstate.indexerTokensFetched = true;\n\t\treturn;\n\t}\n\n\tconst indexerClient = getIndexerClient(chainId, config);\n\n\tlet page: IndexerPage = {\n\t\tpageSize: 50,\n\t};\n\n\twhile (true) {\n\t\tconst { balances, page: nextPage } = await indexerClient.getTokenBalances({\n\t\t\taccountAddress,\n\t\t\tcontractAddress: collectionAddress,\n\t\t\tincludeMetadata: true,\n\t\t\tpage: page,\n\t\t});\n\n\t\tfor (const balance of balances) {\n\t\t\tif (balance.tokenID) {\n\t\t\t\tstate.indexerTokenBalances.set(\n\t\t\t\t\tbalance.tokenID,\n\t\t\t\t\tcollectibleFromTokenBalance(balance),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!nextPage.more) {\n\t\t\tbreak;\n\t\t}\n\t\tpage = nextPage;\n\t}\n\n\tstate.indexerTokensFetched = true;\n}\n\n// Process indexer tokens that we haven't seen yet\nfunction processRemainingIndexerTokens(\n\tstate: InventoryState,\n\tpage: Page,\n): CollectiblesResponse {\n\tconst allTokens = Array.from(state.indexerTokenBalances.values());\n\n\t// Filter out tokens that we've already seen\n\tconst newTokens = allTokens.filter(\n\t\t(token) => !state.seenTokenIds.has(token.metadata.tokenId),\n\t);\n\n\t// Calculate pagination\n\tconst startIndex = (page.page - 1) * page.pageSize;\n\tconst endIndex = startIndex + page.pageSize;\n\tconst paginatedTokens = newTokens.slice(startIndex, endIndex);\n\n\t// Add new token IDs to the set\n\tfor (const token of paginatedTokens) {\n\t\tstate.seenTokenIds.add(token.metadata.tokenId);\n\t}\n\n\treturn {\n\t\tcollectibles: paginatedTokens,\n\t\tpage: {\n\t\t\tpage: page.page,\n\t\t\tpageSize: page.pageSize,\n\t\t\tmore: endIndex < newTokens.length,\n\t\t},\n\t};\n}\n\nfunction processMarketplaceCollectibles(\n\tcollectibles: CollectibleOrder[],\n\tstate: InventoryState,\n\tpage: Page,\n): {\n\tenrichedCollectibles: CollectibleWithBalance[];\n\tmissingTokens: CollectibleWithBalance[];\n} {\n\t// Add new token IDs to the set\n\tfor (const c of collectibles) {\n\t\tstate.seenTokenIds.add(c.metadata.tokenId);\n\t}\n\n\t// Enrich marketplace collectibles with balance data from indexer\n\tconst enrichedCollectibles = collectibles.map((c: CollectibleOrder) => {\n\t\tconst tokenId = c.metadata.tokenId;\n\t\tconst indexerData = state.indexerTokenBalances.get(tokenId);\n\n\t\treturn {\n\t\t\t...c,\n\t\t\tbalance: indexerData?.balance,\n\t\t\tcontractInfo: indexerData?.contractInfo,\n\t\t\tcontractType: indexerData?.contractType,\n\t\t} as CollectibleWithBalance;\n\t});\n\n\t// Check for missing tokens in the marketplace data\n\tconst marketplaceTokenIds = new Set(\n\t\tenrichedCollectibles.map((c) => c.metadata.tokenId),\n\t);\n\n\tconst missingTokens = Array.from(state.indexerTokenBalances.entries())\n\t\t.filter(([tokenId]) => !marketplaceTokenIds.has(tokenId))\n\t\t.map(([_, balance]) => balance)\n\t\t.slice(0, page.pageSize);\n\n\treturn { enrichedCollectibles, missingTokens };\n}\n\nexport async function fetchInventory(\n\targs: GetInventoryArgs,\n\tconfig: SdkConfig,\n\tpage: Page,\n): Promise<CollectiblesResponse> {\n\tconst { accountAddress, collectionAddress, chainId, isLaos721 } = args;\n\tconst collectionKey = getCollectionKey(args);\n\tconst state = getOrInitState(collectionKey);\n\n\t// On first run, fetch all pages from the indexer\n\tif (!state.indexerTokensFetched) {\n\t\tawait fetchAllIndexerTokens(\n\t\t\tchainId,\n\t\t\taccountAddress,\n\t\t\tcollectionAddress,\n\t\t\tconfig,\n\t\t\tstate,\n\t\t\tisLaos721,\n\t\t);\n\t}\n\n\t// If marketplace API has no more results, use the indexer data\n\tif (state.marketplaceFinished) {\n\t\treturn processRemainingIndexerTokens(state, page);\n\t}\n\n\t// Fetch collectibles from marketplace API\n\tconst marketplaceConfig = await fetchMarketplaceConfig({ config });\n\tconst collectibles = await fetchListCollectibles(\n\t\t{\n\t\t\tchainId,\n\t\t\tcollectionAddress,\n\t\t\tfilter: {\n\t\t\t\tinAccounts: [accountAddress],\n\t\t\t\tincludeEmpty: true,\n\t\t\t},\n\t\t\tside: OrderSide.listing,\n\t\t\tconfig,\n\t\t},\n\t\tmarketplaceConfig,\n\t\tpage,\n\t);\n\n\t// Process the collectibles and find missing tokens\n\tconst { enrichedCollectibles, missingTokens } =\n\t\tprocessMarketplaceCollectibles(collectibles.collectibles, state, page);\n\n\t// If there are no more results from the marketplace API\n\tif (!collectibles.page?.more) {\n\t\t// Mark marketplace as finished and start using indexer data on next call\n\t\tstate.marketplaceFinished = true;\n\t\treturn {\n\t\t\tcollectibles: [...enrichedCollectibles, ...missingTokens],\n\t\t\tpage: {\n\t\t\t\tpage: collectibles.page?.page ?? page.page,\n\t\t\t\tpageSize: collectibles.page?.pageSize ?? page.pageSize,\n\t\t\t\tmore: missingTokens.length > 0,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tcollectibles: enrichedCollectibles,\n\t\tpage: {\n\t\t\tpage: collectibles.page?.page ?? page.page,\n\t\t\tpageSize: collectibles.page?.pageSize ?? page.pageSize,\n\t\t\tmore: Boolean(collectibles.page?.more),\n\t\t},\n\t};\n}\n\nexport function inventoryOptions(args: UseInventoryArgs, config: SdkConfig) {\n\tconst collectionKey = getCollectionKey(args);\n\tconst enabledQuery = args.query?.enabled ?? true;\n\tconst enabled =\n\t\tenabledQuery && !!args.accountAddress && !!args.collectionAddress;\n\n\treturn infiniteQueryOptions({\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],\n\t\tqueryFn: ({ pageParam }) =>\n\t\t\tfetchInventory(\n\t\t\t\t{\n\t\t\t\t\t...args,\n\t\t\t\t\tisLaos721: args.isLaos721 ?? false,\n\t\t\t\t},\n\t\t\t\tconfig,\n\t\t\t\tpageParam,\n\t\t\t),\n\t\tinitialPageParam: { page: 1, pageSize: 30 } as Page,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more ? lastPage.page : undefined,\n\t\tenabled,\n\t\tmeta: {\n\t\t\tonInvalidate: () => {\n\t\t\t\tstateByCollection.delete(collectionKey);\n\t\t\t},\n\t\t},\n\t});\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport {\n\tgetMetadataClient,\n\ttokenKeys,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchListTokenMetadataParams {\n\tchainId: number;\n\tcontractAddress: string;\n\ttokenIds: string[];\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches token metadata from the metadata API\n */\nexport async function fetchListTokenMetadata(\n\tparams: FetchListTokenMetadataParams,\n) {\n\tconst { chainId, contractAddress, tokenIds, config } = params;\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst response = await metadataClient.getTokenMetadata({\n\t\tchainID: chainId.toString(),\n\t\tcontractAddress: contractAddress,\n\t\ttokenIDs: tokenIds,\n\t});\n\n\treturn response.tokenMetadata;\n}\n\nexport type ListTokenMetadataQueryOptions =\n\tValuesOptional<FetchListTokenMetadataParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function listTokenMetadataQueryOptions(\n\tparams: ListTokenMetadataQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.contractAddress &&\n\t\t\tparams.tokenIds?.length &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: [...tokenKeys.metadata, params],\n\t\tqueryFn: () =>\n\t\t\tfetchListTokenMetadata({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcontractAddress: params.contractAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\ttokenIds: params.tokenIds!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t}),\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport {\n\tgetMarketplaceClient,\n\ttype ListPrimarySaleItemsArgs,\n\ttype ListPrimarySaleItemsReturn,\n\ttype Page,\n\ttype PrimarySaleItemsFilter,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchPrimarySaleItemsParams {\n\tchainId: number;\n\tprimarySaleContractAddress: Address;\n\tfilter?: PrimarySaleItemsFilter;\n\tpage?: Page;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches primary sale items from the marketplace API\n */\nexport async function fetchPrimarySaleItems(\n\tparams: FetchPrimarySaleItemsParams,\n): Promise<ListPrimarySaleItemsReturn> {\n\tconst { chainId, primarySaleContractAddress, filter, page, config } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn marketplaceClient.listPrimarySaleItems({\n\t\tchainId: String(chainId),\n\t\tprimarySaleContractAddress,\n\t\tfilter,\n\t\tpage,\n\t});\n}\n\nexport type ListPrimarySaleItemsQueryOptions =\n\tValuesOptional<FetchPrimarySaleItemsParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport const listPrimarySaleItemsQueryOptions = (\n\tparams: ListPrimarySaleItemsQueryOptions,\n) => {\n\tconst enabled = Boolean(\n\t\tparams.primarySaleContractAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\ttype PageParam = { page: number; pageSize: number };\n\tconst initialPage: PageParam = params.page || { page: 1, pageSize: 30 };\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: ['listPrimarySaleItems', params],\n\t\tqueryFn: async ({ pageParam }) => {\n\t\t\treturn fetchPrimarySaleItems({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tprimarySaleContractAddress: params.primarySaleContractAddress!,\n\t\t\t\tfilter: params.filter,\n\t\t\t\tpage: pageParam,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t});\n\t\t},\n\t\tinitialPageParam: initialPage,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more ? lastPage.page : undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n};\n\nexport type { ListPrimarySaleItemsArgs, ListPrimarySaleItemsReturn };\n","import { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../types';\nimport {\n\ttype GetCountOfPrimarySaleItemsReturn,\n\tgetMarketplaceClient,\n\ttype PrimarySaleItemsFilter,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchPrimarySaleItemsCountParams {\n\tchainId: number;\n\tprimarySaleContractAddress: Address;\n\tfilter?: PrimarySaleItemsFilter;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches the count of primary sale items from the marketplace API\n */\nexport async function fetchPrimarySaleItemsCount(\n\tparams: FetchPrimarySaleItemsCountParams,\n): Promise<GetCountOfPrimarySaleItemsReturn> {\n\tconst { chainId, primarySaleContractAddress, filter, config } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\treturn marketplaceClient.getCountOfPrimarySaleItems({\n\t\tchainId: String(chainId),\n\t\tprimarySaleContractAddress,\n\t\tfilter,\n\t});\n}\n\nexport type PrimarySaleItemsCountQueryOptions =\n\tPartial<FetchPrimarySaleItemsCountParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport const primarySaleItemsCountQueryOptions = (\n\targs: PrimarySaleItemsCountQueryOptions,\n) => {\n\tconst enabled = Boolean(\n\t\targs.primarySaleContractAddress &&\n\t\t\targs.chainId &&\n\t\t\targs.config &&\n\t\t\t(args.query?.enabled ?? true),\n\t);\n\n\treturn queryOptions({\n\t\tqueryKey: ['primarySaleItemsCount', args],\n\t\tqueryFn: () =>\n\t\t\tfetchPrimarySaleItemsCount({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: args.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tprimarySaleContractAddress: args.primarySaleContractAddress!,\n\t\t\t\tfilter: args.filter,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: args.config!,\n\t\t\t}),\n\t\t...args.query,\n\t\tenabled,\n\t});\n};\n","import type {\n\tFilter,\n\tPage,\n\tSearchTokenMetadataReturn,\n} from '@0xsequence/metadata';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport {\n\tgetMetadataClient,\n\ttokenKeys,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardQueryOptions } from '../types/query';\n\nexport interface FetchSearchTokenMetadataParams {\n\tchainId: number;\n\tcollectionAddress: string;\n\tfilter?: Filter;\n\tpage?: Page;\n\tconfig: SdkConfig;\n}\n\n/**\n * Fetches token metadata from the metadata API using search filters\n */\nexport async function fetchSearchTokenMetadata(\n\tparams: FetchSearchTokenMetadataParams,\n): Promise<SearchTokenMetadataReturn> {\n\tconst { chainId, collectionAddress, filter, page, config } = params;\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst response = await metadataClient.searchTokenMetadata({\n\t\tchainID: chainId.toString(),\n\t\tcontractAddress: collectionAddress,\n\t\tfilter: filter ?? {},\n\t\tpage,\n\t});\n\n\treturn {\n\t\ttokenMetadata: response.tokenMetadata,\n\t\tpage: response.page,\n\t};\n}\n\nexport type SearchTokenMetadataQueryOptions =\n\tValuesOptional<FetchSearchTokenMetadataParams> & {\n\t\tquery?: StandardQueryOptions;\n\t};\n\nexport function searchTokenMetadataQueryOptions(\n\tparams: SearchTokenMetadataQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\tconst initialPageParam = { page: 1, pageSize: 30 };\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: [...tokenKeys.metadata, 'search', params],\n\t\tqueryFn: ({ pageParam = initialPageParam }) =>\n\t\t\tfetchSearchTokenMetadata({\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tchainId: params.chainId!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tfilter: params.filter!,\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\t\tconfig: params.config!,\n\t\t\t\tpage: pageParam,\n\t\t\t}),\n\t\tinitialPageParam,\n\t\tgetNextPageParam: (lastPage) => {\n\t\t\tif (!lastPage.page?.more) return undefined;\n\t\t\treturn {\n\t\t\t\tpage: (lastPage.page.page || 1) + 1,\n\t\t\t\tpageSize: lastPage.page.pageSize || 20,\n\t\t\t};\n\t\t},\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n","import type { GetTokenSuppliesArgs, Page } from '@0xsequence/indexer';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../types';\nimport {\n\tgetIndexerClient,\n\tLaosAPI,\n\ttokenKeys,\n\ttype ValuesOptional,\n} from '../_internal';\nimport type { StandardInfiniteQueryOptions } from '../types/query';\n\nexport interface FetchTokenSuppliesParams\n\textends Omit<GetTokenSuppliesArgs, 'contractAddress'> {\n\tchainId: number;\n\tcollectionAddress: string;\n\tconfig: SdkConfig;\n\tisLaos721?: boolean;\n\tpage?: Page;\n}\n\n/**\n * Fetches token supplies with support for both indexer and LAOS APIs\n * Uses the more efficient single-contract APIs from both services\n */\nexport async function fetchTokenSupplies(params: FetchTokenSuppliesParams) {\n\tconst { chainId, collectionAddress, config, isLaos721, ...rest } = params;\n\n\tif (isLaos721) {\n\t\tconst laosApi = new LaosAPI();\n\n\t\t// Convert indexer Page format to LAOS PaginationOptions format\n\t\tconst laosPage = rest.page\n\t\t\t? {\n\t\t\t\t\tsort:\n\t\t\t\t\t\trest.page.sort?.map((sortBy) => ({\n\t\t\t\t\t\t\tcolumn: sortBy.column,\n\t\t\t\t\t\t\torder: sortBy.order,\n\t\t\t\t\t\t})) || [],\n\t\t\t\t}\n\t\t\t: undefined;\n\n\t\tconst result = await laosApi.getTokenSupplies({\n\t\t\tchainId: chainId.toString(),\n\t\t\tcontractAddress: collectionAddress,\n\t\t\tincludeMetadata: rest.includeMetadata,\n\t\t\tpage: laosPage,\n\t\t});\n\n\t\treturn result;\n\t}\n\n\tconst indexerClient = getIndexerClient(chainId, config);\n\n\tconst apiArgs: GetTokenSuppliesArgs = {\n\t\tcontractAddress: collectionAddress,\n\t\t...rest,\n\t};\n\n\tconst result = await indexerClient.getTokenSupplies(apiArgs);\n\treturn result;\n}\n\nexport type TokenSuppliesQueryOptions =\n\tValuesOptional<FetchTokenSuppliesParams> & {\n\t\tquery?: StandardInfiniteQueryOptions;\n\t};\n\nexport function tokenSuppliesQueryOptions(params: TokenSuppliesQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\tconst initialPageParam = { page: 1, pageSize: 30 } as Page;\n\n\tconst queryFn = async ({ pageParam = initialPageParam }) =>\n\t\tfetchTokenSupplies({\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\tchainId: params.chainId!,\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\tcollectionAddress: params.collectionAddress!,\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: The enabled check above ensures these are not undefined\n\t\t\tconfig: params.config!,\n\t\t\tisLaos721: params.isLaos721,\n\t\t\tincludeMetadata: params.includeMetadata,\n\t\t\tmetadataOptions: params.metadataOptions,\n\t\t\tpage: pageParam,\n\t\t});\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: [...tokenKeys.supplies, params],\n\t\tqueryFn,\n\t\tinitialPageParam,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more ? lastPage.page : undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,eAAsB,0BACrBA,MAGAC,QACC;AACD,KAAI,KAAK,WAAW;EACnB,MAAM,UAAU,IAAI;EACpB,MAAM,WAAW,MAAM,QAAQ,iBAAiB;GAC/C,SAAS,KAAK,QAAQ,UAAU;GAChC,iBAAiB,KAAK;GACtB,gBAAgB,KAAK;GACrB,iBAAiB;EACjB,EAAC;AAEF,SAAO,SAAS,SAAS,MAAM;CAC/B;CAED,MAAM,gBAAgB,iBAAiB,KAAK,SAAS,OAAO;A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