@0xsequence/marketplace-sdk 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/.changeset/honest-peas-arrive.md +5 -0
  2. package/.changeset/real-tips-stick.md +8 -0
  3. package/.changeset/tall-pandas-wear.md +8 -0
  4. package/CHANGELOG.md +24 -2
  5. package/dist/{BellIcon-IpHHEy8h.js → BellIcon-ByhygxBO.js} +2 -2
  6. package/dist/{BellIcon-IpHHEy8h.js.map → BellIcon-ByhygxBO.js.map} +1 -1
  7. package/dist/{CartIcon-C8zbor8H.js → CartIcon-Bt3rQYGk.js} +3 -3
  8. package/dist/{CartIcon-C8zbor8H.js.map → CartIcon-Bt3rQYGk.js.map} +1 -1
  9. package/dist/CollectibleCard-CVpdgXA8.d.ts +8 -0
  10. package/dist/_internal-DkS2VUn5.js.map +1 -1
  11. package/dist/abi-fa-o9gH3.js +134 -0
  12. package/dist/abi-fa-o9gH3.js.map +1 -0
  13. package/dist/{alien_swap-BTJ7mSR-.js → alien_swap-DoY6XfMA.js} +1 -1
  14. package/dist/{alien_swap-BTJ7mSR-.js.map → alien_swap-DoY6XfMA.js.map} +1 -1
  15. package/dist/{api-DuLKn__v.js → api-BoO0V5aJ.js} +8 -3
  16. package/dist/api-BoO0V5aJ.js.map +1 -0
  17. package/dist/{aqua-xyz-BYJ9WSP_.js → aqua-xyz-BBDxnG14.js} +1 -1
  18. package/dist/{aqua-xyz-BYJ9WSP_.js.map → aqua-xyz-BBDxnG14.js.map} +1 -1
  19. package/dist/{aura-D7SUjgro.js → aura-DGx2zwvF.js} +1 -1
  20. package/dist/{aura-D7SUjgro.js.map → aura-DGx2zwvF.js.map} +1 -1
  21. package/dist/{blur-BcnRFCaV.js → blur-D8GKrRrq.js} +1 -1
  22. package/dist/{blur-BcnRFCaV.js.map → blur-D8GKrRrq.js.map} +1 -1
  23. package/dist/{coinbase-ChoX9Hw2.js → coinbase-DOry4PXY.js} +1 -1
  24. package/dist/{coinbase-ChoX9Hw2.js.map → coinbase-DOry4PXY.js.map} +1 -1
  25. package/dist/collectibles-C_H8jMGH.js +358 -0
  26. package/dist/collectibles-C_H8jMGH.js.map +1 -0
  27. package/dist/collections-CKummc-R.js +249 -0
  28. package/dist/collections-CKummc-R.js.map +1 -0
  29. package/dist/{components-CUv-wQr8.js → components-CosnX7F9.js} +5 -5
  30. package/dist/{components-CUv-wQr8.js.map → components-CosnX7F9.js.map} +1 -1
  31. package/dist/{contracts-D72LBOX3.js → contracts-BP_0vX48.js} +3 -3
  32. package/dist/{contracts-D72LBOX3.js.map → contracts-BP_0vX48.js.map} +1 -1
  33. package/dist/{create-config-DV_dtaLt.d.ts → create-config-ZOB7i4ZJ.d.ts} +117 -12
  34. package/dist/{element-Dbcv5qya.js → element-ciybd_VF.js} +1 -1
  35. package/dist/{element-Dbcv5qya.js.map → element-ciybd_VF.js.map} +1 -1
  36. package/dist/filters-V-V8Dn8f.d.ts +60 -0
  37. package/dist/{foundation-QPhUEUy8.js → foundation-Bq4lRz4x.js} +1 -1
  38. package/dist/{foundation-QPhUEUy8.js.map → foundation-Bq4lRz4x.js.map} +1 -1
  39. package/dist/index-BOiHR01C.d.ts +106 -0
  40. package/dist/index-BZIJTQT0.d.ts +121 -0
  41. package/dist/index-BeRV-7AX.d.ts +55 -0
  42. package/dist/{index-BaytncQc.d.ts → index-Bsx6XsC2.d.ts} +58 -55
  43. package/dist/{index-jGgfEHfQ.d.ts → index-BtWMBHeP.d.ts} +13 -9
  44. package/dist/{index-CT8ZorFd.d.ts → index-Bxzjy0d1.d.ts} +1 -1
  45. package/dist/{index-B6aSbaw2.d.ts → index-C-745li7.d.ts} +1 -1
  46. package/dist/{index-BoNNplSx.d.ts → index-C4MUKshG.d.ts} +2 -2
  47. package/dist/{index-DMBMM16q.d.ts → index-CPzvNmq9.d.ts} +35 -35
  48. package/dist/{index-D-UXGo5d.d.ts → index-CS65jqOq.d.ts} +2 -2
  49. package/dist/index-CZUtOTjh.d.ts +1 -0
  50. package/dist/index-CnEbXm_t.d.ts +130 -0
  51. package/dist/{index-CQecU53t.d.ts → index-CxA34wP1.d.ts} +32 -23
  52. package/dist/{index-C768pAfu.d.ts → index-CxpFwGvR.d.ts} +3 -3
  53. package/dist/{index-Bv5XVLjH.d.ts → index-D9LPlmbC.d.ts} +1 -1
  54. package/dist/{index-DJG0kiII.d.ts → index-DFEnA6Wa.d.ts} +28 -17
  55. package/dist/{index-B8vaT3_s.d.ts → index-DNNUeZEq.d.ts} +4 -4
  56. package/dist/{index-CXscCUg7.d.ts → index-DUXfvhxs.d.ts} +12 -12
  57. package/dist/index-DW3njUfb.d.ts +1 -0
  58. package/dist/{index-CMPUveNz.d.ts → index-DWt6yrIG.d.ts} +7 -7
  59. package/dist/index-DewGsFz5.d.ts +1 -0
  60. package/dist/{index-DLUjc7Bx.d.ts → index-DmudgrsN.d.ts} +191 -12
  61. package/dist/{index-DpeWm_vF.d.ts → index-DqXd1EeB.d.ts} +5 -5
  62. package/dist/{index-CM0ZTePs.d.ts → index-DwKr18CI.d.ts} +1 -1
  63. package/dist/{index-D6YMj82n.d.ts → index-NlPMNcqh.d.ts} +100 -100
  64. package/dist/index-Stm5u0I0.d.ts +53 -0
  65. package/dist/index-U-zp70of.d.ts +74 -0
  66. package/dist/index.d.ts +8 -8
  67. package/dist/index.js +8 -8
  68. package/dist/inventory-Dd7TazvZ.js +72 -0
  69. package/dist/inventory-Dd7TazvZ.js.map +1 -0
  70. package/dist/listBalances-BxpxBCvn.js +57 -0
  71. package/dist/listBalances-BxpxBCvn.js.map +1 -0
  72. package/dist/listCollectiblesPaginated-Cy2_qEZA.d.ts +327 -0
  73. package/dist/{listCollections-dTCq00l5.d.ts → listCollections-BB9FxKj2.d.ts} +193 -111
  74. package/dist/{looks-rare-C7cQztTR.js → looks-rare-6H--x3AM.js} +1 -1
  75. package/dist/{looks-rare-C7cQztTR.js.map → looks-rare-6H--x3AM.js.map} +1 -1
  76. package/dist/lowestListing-Cbsi6M1K.d.ts +465 -0
  77. package/dist/{magic-eden-D3r7jiBG.js → magic-eden-BoxEQ1Li.js} +1 -1
  78. package/dist/{magic-eden-D3r7jiBG.js.map → magic-eden-BoxEQ1Li.js.map} +1 -1
  79. package/dist/{manifold-DsX0CBP-.js → manifold-DycKsljb.js} +1 -1
  80. package/dist/{manifold-DsX0CBP-.js.map → manifold-DycKsljb.js.map} +1 -1
  81. package/dist/market-C3HV-awQ.js +209 -0
  82. package/dist/market-C3HV-awQ.js.map +1 -0
  83. package/dist/{marketCurrencies-Bzj8X4TL.d.ts → marketCurrencies-Bpw1bIO0.d.ts} +46 -15
  84. package/dist/marketCurrencies-sKrTX0og.js +53 -0
  85. package/dist/marketCurrencies-sKrTX0og.js.map +1 -0
  86. package/dist/{marketplace-BYY8OloA.js → marketplace-NQB-sEQL.js} +1 -1
  87. package/dist/{marketplace-BYY8OloA.js.map → marketplace-NQB-sEQL.js.map} +1 -1
  88. package/dist/{marketplace-logos-Csv2MBwf.js → marketplace-logos-D4dS1Foy.js} +21 -21
  89. package/dist/{marketplace-logos-Csv2MBwf.js.map → marketplace-logos-D4dS1Foy.js.map} +1 -1
  90. package/dist/{marketplace.gen-w2YvbEEo.js → marketplace.gen-ksUafDqS.js} +56 -5
  91. package/dist/marketplace.gen-ksUafDqS.js.map +1 -0
  92. package/dist/{marketplaceConfig-BTy75Mbf.js → marketplaceConfig-UHQMM9fq.js} +3 -3
  93. package/dist/marketplaceConfig-UHQMM9fq.js.map +1 -0
  94. package/dist/{mintify-DiOoDmO1.js → mintify-Dyqyo8jQ.js} +1 -1
  95. package/dist/{mintify-DiOoDmO1.js.map → mintify-Dyqyo8jQ.js.map} +1 -1
  96. package/dist/{nftx-CP82jNra.js → nftx-2LbFjj9Q.js} +1 -1
  97. package/dist/{nftx-CP82jNra.js.map → nftx-2LbFjj9Q.js.map} +1 -1
  98. package/dist/{okx-p9-4xRjs.js → okx-CBEWJNsR.js} +1 -1
  99. package/dist/{okx-p9-4xRjs.js.map → okx-CBEWJNsR.js.map} +1 -1
  100. package/dist/{open-sea-D2GwAmKS.js → open-sea-Dxntz_PA.js} +1 -1
  101. package/dist/{open-sea-D2GwAmKS.js.map → open-sea-Dxntz_PA.js.map} +1 -1
  102. package/dist/orders-DnFfZAXV.js +462 -0
  103. package/dist/orders-DnFfZAXV.js.map +1 -0
  104. package/dist/{primary-sale-DOmNDq2P.js → primary-sale-1u4QlPdA.js} +1 -1
  105. package/dist/{primary-sale-DOmNDq2P.js.map → primary-sale-1u4QlPdA.js.map} +1 -1
  106. package/dist/primary-sales-Dmsi6bqj.js +114 -0
  107. package/dist/primary-sales-Dmsi6bqj.js.map +1 -0
  108. package/dist/{query-BG-MA1MB.d.ts → query-BWbCsXLY.d.ts} +1 -1
  109. package/dist/{rarible-DqiiW9ki.js → rarible-CS0SupHr.js} +1 -1
  110. package/dist/{rarible-DqiiW9ki.js.map → rarible-CS0SupHr.js.map} +1 -1
  111. package/dist/react/_internal/api/index.d.ts +2 -2
  112. package/dist/react/_internal/api/index.js +3 -3
  113. package/dist/react/_internal/databeat/index.d.ts +1 -1
  114. package/dist/react/_internal/databeat/index.js +28 -17
  115. package/dist/react/_internal/index.d.ts +2 -2
  116. package/dist/react/_internal/index.js +3 -3
  117. package/dist/react/_internal/wagmi/index.d.ts +1 -1
  118. package/dist/react/hooks/config/index.d.ts +8 -8
  119. package/dist/react/hooks/config/index.js +28 -17
  120. package/dist/react/hooks/contracts/index.d.ts +6 -6
  121. package/dist/react/hooks/contracts/index.js +7 -7
  122. package/dist/react/hooks/data/collectibles/index.d.ts +10 -4
  123. package/dist/react/hooks/data/collectibles/index.js +28 -17
  124. package/dist/react/hooks/data/collections/index.d.ts +10 -10
  125. package/dist/react/hooks/data/collections/index.js +28 -17
  126. package/dist/react/hooks/data/index.d.ts +37 -29
  127. package/dist/react/hooks/data/index.js +29 -18
  128. package/dist/react/hooks/data/inventory/index.d.ts +36 -28
  129. package/dist/react/hooks/data/inventory/index.js +28 -17
  130. package/dist/react/hooks/data/market/index.d.ts +11 -5
  131. package/dist/react/hooks/data/market/index.js +28 -17
  132. package/dist/react/hooks/data/orders/index.d.ts +11 -5
  133. package/dist/react/hooks/data/orders/index.js +29 -18
  134. package/dist/react/hooks/data/primary-sales/index.d.ts +36 -28
  135. package/dist/react/hooks/data/primary-sales/index.js +28 -17
  136. package/dist/react/hooks/data/tokens/index.d.ts +4 -4
  137. package/dist/react/hooks/data/tokens/index.js +28 -17
  138. package/dist/react/hooks/index.d.ts +37 -29
  139. package/dist/react/hooks/index.js +29 -18
  140. package/dist/react/hooks/transactions/index.d.ts +2 -2
  141. package/dist/react/hooks/transactions/index.js +28 -17
  142. package/dist/react/hooks/ui/index.d.ts +4 -4
  143. package/dist/react/hooks/ui/index.js +28 -17
  144. package/dist/react/hooks/utils/index.d.ts +36 -28
  145. package/dist/react/hooks/utils/index.js +28 -17
  146. package/dist/react/index.d.ts +37 -29
  147. package/dist/react/index.js +29 -18
  148. package/dist/react/queries/collectibles/index.d.ts +11 -0
  149. package/dist/react/queries/collectibles/index.js +23 -0
  150. package/dist/react/queries/collections/index.d.ts +11 -0
  151. package/dist/react/queries/collections/index.js +20 -0
  152. package/dist/react/queries/index.d.ts +24 -16
  153. package/dist/react/queries/index.js +22 -11
  154. package/dist/react/queries/inventory/index.d.ts +3 -0
  155. package/dist/react/queries/inventory/index.js +22 -0
  156. package/dist/react/queries/market/index.d.ts +6 -0
  157. package/dist/react/queries/market/index.js +22 -0
  158. package/dist/react/queries/orders/index.d.ts +11 -0
  159. package/dist/react/queries/orders/index.js +13 -0
  160. package/dist/react/queries/primary-sales/index.d.ts +4 -0
  161. package/dist/react/queries/primary-sales/index.js +13 -0
  162. package/dist/react/queries/tokens/index.d.ts +5 -0
  163. package/dist/react/queries/tokens/index.js +14 -0
  164. package/dist/react/queries/utils/index.d.ts +4 -0
  165. package/dist/react/queries/utils/index.js +22 -0
  166. package/dist/react/ssr/index.d.ts +7 -7
  167. package/dist/react/ssr/index.js +3 -3
  168. package/dist/react/ssr/index.js.map +1 -1
  169. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +2 -2
  170. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +11 -11
  171. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +5 -5
  172. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +28 -17
  173. package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +4 -4
  174. package/dist/react/ui/components/marketplace-collectible-card/index.js +28 -17
  175. package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +2 -2
  176. package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +3 -3
  177. package/dist/react/ui/components/marketplace-logos/index.d.ts +21 -21
  178. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  179. package/dist/react/ui/icons/index.js +9 -9
  180. package/dist/react/ui/index.d.ts +4 -4
  181. package/dist/react/ui/index.js +28 -17
  182. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
  183. package/dist/react/ui/modals/_internal/components/actionModal/index.js +28 -17
  184. package/dist/react/utils/index.d.ts +3 -3
  185. package/dist/react/utils/index.js +3 -3
  186. package/dist/{react-BLJ4DkPx.js → react-DE852KeT.js} +1365 -172
  187. package/dist/react-DE852KeT.js.map +1 -0
  188. package/dist/{sequence-Bbb-TFKg.js → sequence-paCCener.js} +1 -1
  189. package/dist/{sequence-Bbb-TFKg.js.map → sequence-paCCener.js.map} +1 -1
  190. package/dist/styles/index.css +154 -0
  191. package/dist/{sudo-swap-CEPIM3Js.js → sudo-swap-9rH2EgfT.js} +1 -1
  192. package/dist/{sudo-swap-CEPIM3Js.js.map → sudo-swap-9rH2EgfT.js.map} +1 -1
  193. package/dist/{super-rare-CMEn9PoO.js → super-rare-DHIuWtRw.js} +1 -1
  194. package/dist/{super-rare-CMEn9PoO.js.map → super-rare-DHIuWtRw.js.map} +1 -1
  195. package/dist/{token-CcyLz8Z8.js → token-Cv7l2ZaL.js} +1 -1
  196. package/dist/{token-CcyLz8Z8.js.map → token-Cv7l2ZaL.js.map} +1 -1
  197. package/dist/tokenBalances-ibDerNmM.js +63 -0
  198. package/dist/tokenBalances-ibDerNmM.js.map +1 -0
  199. package/dist/tokenSupplies-Bfe8RHzI.d.ts +272 -0
  200. package/dist/tokens-cGxMadd8.js +194 -0
  201. package/dist/tokens-cGxMadd8.js.map +1 -0
  202. package/dist/types/index.d.ts +1 -1
  203. package/dist/types/index.js +1 -1
  204. package/dist/{types-D6LkVrF0.d.ts → types-D2TJ1dwv.d.ts} +3 -2
  205. package/dist/utils/abi/index.d.ts +5 -5
  206. package/dist/utils/abi/index.js +5 -5
  207. package/dist/utils/abi/marketplace/index.d.ts +1 -1
  208. package/dist/utils/abi/marketplace/index.js +1 -1
  209. package/dist/utils/abi/primary-sale/index.d.ts +1 -1
  210. package/dist/utils/abi/primary-sale/index.js +1 -1
  211. package/dist/utils/abi/token/index.d.ts +1 -1
  212. package/dist/utils/abi/token/index.js +1 -1
  213. package/dist/utils/index.d.ts +7 -7
  214. package/dist/utils/index.js +8 -8
  215. package/dist/utils-BCgNhBFR.js +112 -0
  216. package/dist/utils-BCgNhBFR.js.map +1 -0
  217. package/dist/{utils-BZEkdqWK.js → utils-BfpDVibN.js} +3 -3
  218. package/dist/{utils-BZEkdqWK.js.map → utils-BfpDVibN.js.map} +1 -1
  219. package/dist/{utils-oVZxdK0o.js → utils-BqxcalL2.js} +2 -2
  220. package/dist/{utils-oVZxdK0o.js.map → utils-BqxcalL2.js.map} +1 -1
  221. package/dist/waitForTransactionReceipt-DieAnV52.js +25 -0
  222. package/dist/waitForTransactionReceipt-DieAnV52.js.map +1 -0
  223. package/dist/{x2y2-DNe6JgtG.js → x2y2-45WDooeh.js} +1 -1
  224. package/dist/{x2y2-DNe6JgtG.js.map → x2y2-45WDooeh.js.map} +1 -1
  225. package/dist/{zora-w0Zqxxs4.js → zora-CbeBoLvQ.js} +1 -1
  226. package/dist/{zora-w0Zqxxs4.js.map → zora-CbeBoLvQ.js.map} +1 -1
  227. package/package.json +10 -5
  228. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +2 -0
  229. package/src/react/_internal/api/marketplace.gen.ts +1730 -2383
  230. package/src/react/_internal/api/query-keys.ts +14 -0
  231. package/src/react/_internal/api/services.ts +1 -1
  232. package/src/react/_internal/databeat/types.ts +1 -0
  233. package/src/react/_internal/types.ts +14 -0
  234. package/src/react/_internal/utils.ts +3 -0
  235. package/src/react/hooks/config/useMarketplaceConfig.tsx +1 -1
  236. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +1 -1
  237. package/src/react/hooks/data/collectibles/useCollectible.tsx +1 -1
  238. package/src/react/hooks/data/collectibles/useCountOfCollectables.tsx +1 -1
  239. package/src/react/hooks/data/collectibles/useListCollectibleActivities.tsx +1 -1
  240. package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -1
  241. package/src/react/hooks/data/collectibles/useListCollectiblesPaginated.tsx +1 -1
  242. package/src/react/hooks/data/collectibles/useTokenBalances.tsx +1 -1
  243. package/src/react/hooks/data/collections/useCollection.tsx +1 -1
  244. package/src/react/hooks/data/collections/useCollectionBalanceDetails.tsx +1 -1
  245. package/src/react/hooks/data/collections/useCollectionDetails.ts +1 -1
  246. package/src/react/hooks/data/collections/useListCollectionActivities.tsx +1 -1
  247. package/src/react/hooks/data/collections/useListCollections.tsx +1 -1
  248. package/src/react/hooks/data/inventory/useInventory.tsx +1 -1
  249. package/src/react/hooks/data/market/useCurrency.tsx +1 -1
  250. package/src/react/hooks/data/market/useListMarketCardData.tsx +7 -0
  251. package/src/react/hooks/data/market/useMarketCurrencies.tsx +1 -1
  252. package/src/react/hooks/data/orders/index.ts +4 -0
  253. package/src/react/hooks/data/orders/useCountItemsOrdersForCollection.tsx +90 -0
  254. package/src/react/hooks/data/orders/useCountListingsForCollectible.tsx +1 -1
  255. package/src/react/hooks/data/orders/useCountOffersForCollectible.tsx +1 -1
  256. package/src/react/hooks/data/orders/useFloorOrder.tsx +1 -1
  257. package/src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx +39 -0
  258. package/src/react/hooks/data/orders/useHighestOffer.tsx +1 -1
  259. package/src/react/hooks/data/orders/useListItemsOrdersForCollection.tsx +93 -0
  260. package/src/react/hooks/data/orders/useListItemsOrdersForCollectionPaginated.tsx +108 -0
  261. package/src/react/hooks/data/orders/useListListingsForCollectible.tsx +1 -1
  262. package/src/react/hooks/data/orders/useListOffersForCollectible.tsx +1 -1
  263. package/src/react/hooks/data/orders/useLowestListing.tsx +1 -1
  264. package/src/react/hooks/data/primary-sales/useGetCountOfPrimarySaleItems.tsx +2 -2
  265. package/src/react/hooks/data/primary-sales/useListPrimarySaleItems.tsx +1 -1
  266. package/src/react/hooks/data/tokens/useGetTokenRanges.tsx +2 -2
  267. package/src/react/hooks/data/tokens/useListBalances.tsx +2 -2
  268. package/src/react/hooks/data/tokens/useListTokenMetadata.tsx +1 -1
  269. package/src/react/hooks/data/tokens/useSearchTokenMetadata.tsx +1 -1
  270. package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -1
  271. package/src/react/hooks/transactions/useGenerateCancelTransaction.test.tsx +1 -0
  272. package/src/react/hooks/transactions/useGenerateListingTransaction.test.tsx +13 -0
  273. package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +1 -0
  274. package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +6 -0
  275. package/src/react/hooks/ui/useFilterState.tsx +72 -2
  276. package/src/react/hooks/ui/useFilters.tsx +1 -1
  277. package/src/react/hooks/utils/useCheckoutOptions.tsx +2 -2
  278. package/src/react/hooks/utils/useCheckoutOptionsSalesContract.tsx +1 -1
  279. package/src/react/hooks/utils/useComparePrices.tsx +1 -1
  280. package/src/react/hooks/utils/useConvertPriceToUSD.tsx +1 -1
  281. package/src/react/providers/analytics-provider.tsx +45 -0
  282. package/src/react/providers/index.tsx +30 -41
  283. package/src/react/providers/modal-provider.tsx +13 -2
  284. package/src/react/queries/{__tests__ → collectibles/__tests__}/balanceOfCollectible.laos.test.ts +1 -1
  285. package/src/react/queries/{__tests__ → collectibles/__tests__}/tokenBalances.laos.test.ts +1 -1
  286. package/src/react/queries/{balanceOfCollectible.ts → collectibles/balanceOfCollectible.ts} +24 -3
  287. package/src/react/queries/{collectible.ts → collectibles/collectible.ts} +20 -5
  288. package/src/react/queries/{countOfCollectables.ts → collectibles/countOfCollectables.ts} +32 -6
  289. package/src/react/queries/collectibles/index.ts +7 -0
  290. package/src/react/queries/{listCollectibleActivities.ts → collectibles/listCollectibleActivities.ts} +29 -5
  291. package/src/react/queries/{listCollectibles.ts → collectibles/listCollectibles.ts} +28 -9
  292. package/src/react/queries/{listCollectiblesPaginated.ts → collectibles/listCollectiblesPaginated.ts} +22 -5
  293. package/src/react/queries/{tokenBalances.ts → collectibles/tokenBalances.ts} +21 -3
  294. package/src/react/queries/{collection.ts → collections/collection.ts} +19 -5
  295. package/src/react/queries/{collectionBalanceDetails.ts → collections/collectionBalanceDetails.ts} +19 -4
  296. package/src/react/queries/{collectionDetails.ts → collections/collectionDetails.ts} +21 -6
  297. package/src/react/queries/collections/index.ts +5 -0
  298. package/src/react/queries/{listCollectionActivities.ts → collections/listCollectionActivities.ts} +28 -6
  299. package/src/react/queries/{listCollections.ts → collections/listCollections.ts} +17 -6
  300. package/src/react/queries/index.ts +7 -34
  301. package/src/react/queries/{__tests__ → inventory/__tests__}/inventory.laos.test.ts +4 -4
  302. package/src/react/queries/inventory/index.ts +1 -0
  303. package/src/react/queries/{inventory.ts → inventory/inventory.ts} +11 -5
  304. package/src/react/queries/{checkoutOptions.ts → market/checkoutOptions.ts} +28 -6
  305. package/src/react/queries/{checkoutOptionsSalesContract.ts → market/checkoutOptionsSalesContract.ts} +24 -5
  306. package/src/react/queries/{currency.ts → market/currency.ts} +13 -4
  307. package/src/react/queries/{filters.ts → market/filters.ts} +25 -6
  308. package/src/react/queries/market/index.ts +6 -0
  309. package/src/react/queries/{marketCurrencies.ts → market/marketCurrencies.ts} +24 -5
  310. package/src/react/queries/{marketplaceConfig.ts → market/marketplaceConfig.ts} +5 -5
  311. package/src/react/queries/orders/countItemsOrdersForCollection.ts +86 -0
  312. package/src/react/queries/{countListingsForCollectible.ts → orders/countListingsForCollectible.ts} +23 -6
  313. package/src/react/queries/{countOffersForCollectible.ts → orders/countOffersForCollectible.ts} +23 -6
  314. package/src/react/queries/{floorOrder.ts → orders/floorOrder.ts} +15 -4
  315. package/src/react/queries/orders/getCountOfFilteredOrders.ts +88 -0
  316. package/src/react/queries/{highestOffer.ts → orders/highestOffer.ts} +16 -4
  317. package/src/react/queries/orders/index.ts +11 -0
  318. package/src/react/queries/orders/listItemsOrdersForCollection.ts +90 -0
  319. package/src/react/queries/orders/listItemsOrdersForCollectionPaginated.ts +90 -0
  320. package/src/react/queries/{listListingsForCollectible.ts → orders/listListingsForCollectible.ts} +20 -5
  321. package/src/react/queries/{listOffersForCollectible.ts → orders/listOffersForCollectible.ts} +20 -5
  322. package/src/react/queries/{lowestListing.ts → orders/lowestListing.ts} +16 -4
  323. package/src/react/queries/{countOfPrimarySaleItems.ts → primary-sales/countOfPrimarySaleItems.ts} +17 -3
  324. package/src/react/queries/primary-sales/index.ts +3 -0
  325. package/src/react/queries/{primarySaleItems.ts → primary-sales/primarySaleItems.ts} +18 -4
  326. package/src/react/queries/{primarySaleItemsCount.ts → primary-sales/primarySaleItemsCount.ts} +19 -4
  327. package/src/react/queries/{getTokenRanges.ts → tokens/getTokenRanges.ts} +17 -4
  328. package/src/react/queries/tokens/index.ts +5 -0
  329. package/src/react/queries/{listBalances.ts → tokens/listBalances.ts} +18 -3
  330. package/src/react/queries/{listTokenMetadata.ts → tokens/listTokenMetadata.ts} +18 -4
  331. package/src/react/queries/{searchTokenMetadata.ts → tokens/searchTokenMetadata.ts} +18 -4
  332. package/src/react/queries/{tokenSupplies.ts → tokens/tokenSupplies.ts} +16 -4
  333. package/src/react/queries/{comparePrices.ts → utils/comparePrices.ts} +16 -4
  334. package/src/react/queries/{convertPriceToUSD.ts → utils/convertPriceToUSD.ts} +18 -5
  335. package/src/react/queries/utils/index.ts +2 -0
  336. package/src/react/ssr/create-ssr-client.ts +1 -1
  337. package/src/react/ui/components/_internals/ErrorLogBox.tsx +85 -0
  338. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +4 -0
  339. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -0
  340. package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +3 -0
  341. package/src/react/ui/components/marketplace-collectible-card/types.ts +1 -0
  342. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +3 -0
  343. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +2 -0
  344. package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +65 -3
  345. package/src/react/ui/modals/BuyModal/components/ERC721BuyModal.tsx +31 -0
  346. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC721SalePaymentParams.test.tsx +20 -1
  347. package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +7 -2
  348. package/src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts +12 -3
  349. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +11 -2
  350. package/src/react/ui/modals/BuyModal/store.ts +3 -0
  351. package/src/react/ui/modals/CreateListingModal/Modal.tsx +63 -24
  352. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +4 -0
  353. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +18 -12
  354. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +4 -1
  355. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +1 -0
  356. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +55 -8
  357. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +10 -0
  358. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +4 -1
  359. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +15 -26
  360. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +1 -0
  361. package/src/react/ui/modals/SellModal/Modal.tsx +21 -3
  362. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +2 -0
  363. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +3 -1
  364. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +13 -7
  365. package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +9 -0
  366. package/src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx +105 -0
  367. package/src/react/ui/modals/_internal/components/calendarDropdown/index.tsx +45 -12
  368. package/src/react/ui/modals/_internal/components/calendarDropdown/overrides.css +39 -0
  369. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +31 -10
  370. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +18 -9
  371. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +51 -1
  372. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +58 -10
  373. package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +481 -0
  374. package/src/react/utils/waitForTransactionReceipt.ts +26 -32
  375. package/src/styles/index.css +1 -0
  376. package/src/styles/styles.ts +155 -1
  377. package/src/types/index.ts +1 -1
  378. package/src/utils/abi/index.ts +1 -0
  379. package/src/utils/abi/mainModule.ts +158 -0
  380. package/dist/CollectibleCard-C2EWF0zo.d.ts +0 -8
  381. package/dist/api-DuLKn__v.js.map +0 -1
  382. package/dist/filters-zkMJaPey.d.ts +0 -31
  383. package/dist/index-Yobo6icm.d.ts +0 -234
  384. package/dist/listCollectiblesPaginated-Bq0QSOjJ.d.ts +0 -168
  385. package/dist/lowestListing-CB5Te-Q9.d.ts +0 -168
  386. package/dist/marketplace.gen-w2YvbEEo.js.map +0 -1
  387. package/dist/marketplaceConfig-BTy75Mbf.js.map +0 -1
  388. package/dist/queries-EMA5CcwY.js +0 -1399
  389. package/dist/queries-EMA5CcwY.js.map +0 -1
  390. package/dist/react-BLJ4DkPx.js.map +0 -1
  391. package/dist/react-F03jPjPk.css +0 -80
  392. package/dist/react-F03jPjPk.css.map +0 -1
  393. package/dist/tokenSupplies-C470zTT0.d.ts +0 -147
  394. package/dist/waitForTransactionReceipt-B08YZiDY.js +0 -26
  395. package/dist/waitForTransactionReceipt-B08YZiDY.js.map +0 -1
  396. /package/dist/{index-Cg5cFzs-.d.ts → index-6wsMChsg.d.ts} +0 -0
  397. /package/dist/{abi-DYsUABe6.js → queries-KOcILNJO.js} +0 -0
@@ -1,1399 +0,0 @@
1
- import { FilterCondition } from "./builder.gen-B9wR2nvF.js";
2
- import { LaosAPI, balanceQueries, collectableKeys, collectionKeys, currencyKeys, getIndexerClient, getMarketplaceClient, getMetadataClient, getQueryClient, tokenKeys } from "./api-DuLKn__v.js";
3
- import { OrderSide } from "./marketplace.gen-w2YvbEEo.js";
4
- import { compareAddress } from "./utils-BZEkdqWK.js";
5
- import { fetchMarketplaceConfig, marketplaceConfigOptions } from "./marketplaceConfig-BTy75Mbf.js";
6
- import { infiniteQueryOptions, queryOptions, skipToken } from "@tanstack/react-query";
7
- import { formatUnits, zeroAddress } from "viem";
8
-
9
- //#region src/react/queries/balanceOfCollectible.ts
10
- /**
11
- * Fetches the balance of a specific collectible for a user
12
- *
13
- * @param args - Arguments for the API call
14
- * @param config - SDK configuration
15
- * @returns The balance data
16
- */
17
- async function fetchBalanceOfCollectible(args, config) {
18
- if (args.isLaos721) return (await new LaosAPI().getTokenBalances({
19
- chainId: args.chainId.toString(),
20
- contractAddress: args.collectionAddress,
21
- accountAddress: args.userAddress,
22
- includeMetadata: true
23
- })).balances[0] || null;
24
- return getIndexerClient(args.chainId, config).getTokenBalances({
25
- accountAddress: args.userAddress,
26
- contractAddress: args.collectionAddress,
27
- tokenID: args.collectableId,
28
- includeMetadata: args.includeMetadata ?? false,
29
- metadataOptions: {
30
- verifiedOnly: true,
31
- includeContracts: [args.collectionAddress]
32
- }
33
- }).then((res) => res.balances[0] || null);
34
- }
35
- /**
36
- * Creates a tanstack query options object for the balance query
37
- *
38
- * @param args - The query arguments
39
- * @param config - SDK configuration
40
- * @returns Query options configuration
41
- */
42
- function balanceOfCollectibleOptions(args, config) {
43
- const enabled = !!args.userAddress && (args.query?.enabled ?? true);
44
- return queryOptions({
45
- queryKey: [...collectableKeys.userBalances, args],
46
- queryFn: enabled ? () => fetchBalanceOfCollectible({
47
- ...args,
48
- userAddress: args.userAddress
49
- }, config) : skipToken
50
- });
51
- }
52
-
53
- //#endregion
54
- //#region src/react/queries/collectible.ts
55
- /**
56
- * Fetches collectible metadata from the metadata API
57
- */
58
- async function fetchCollectible(params) {
59
- const { collectionAddress, collectibleId, chainId, config } = params;
60
- const metadataClient = getMetadataClient(config);
61
- const apiArgs = {
62
- contractAddress: collectionAddress,
63
- chainID: String(chainId),
64
- tokenIDs: [collectibleId]
65
- };
66
- return (await metadataClient.getTokenMetadata(apiArgs)).tokenMetadata[0];
67
- }
68
- function collectibleQueryOptions(params) {
69
- const enabled = Boolean(params.collectionAddress && params.collectibleId && params.chainId && params.config && (params.query?.enabled ?? true));
70
- return queryOptions({
71
- queryKey: [...collectableKeys.details, params],
72
- queryFn: () => fetchCollectible({
73
- chainId: params.chainId,
74
- collectionAddress: params.collectionAddress,
75
- collectibleId: params.collectibleId,
76
- config: params.config
77
- }),
78
- ...params.query,
79
- enabled
80
- });
81
- }
82
-
83
- //#endregion
84
- //#region src/react/queries/countOfCollectables.ts
85
- /**
86
- * Fetches count of collectibles from the marketplace API
87
- */
88
- async function fetchCountOfCollectables(params) {
89
- const { collectionAddress, chainId, config, filter, side } = params;
90
- const client = getMarketplaceClient(config);
91
- if (filter && side) {
92
- const apiArgs$1 = {
93
- contractAddress: collectionAddress,
94
- chainId: String(chainId),
95
- filter,
96
- side
97
- };
98
- return (await client.getCountOfFilteredCollectibles(apiArgs$1)).count;
99
- }
100
- const apiArgs = {
101
- contractAddress: collectionAddress,
102
- chainId: String(chainId)
103
- };
104
- return (await client.getCountOfAllCollectibles(apiArgs)).count;
105
- }
106
- function countOfCollectablesQueryOptions(params) {
107
- const enabled = Boolean(params.collectionAddress && params.chainId && params.config && (params.query?.enabled ?? true));
108
- return queryOptions({
109
- queryKey: [...collectableKeys.counts, params],
110
- queryFn: () => fetchCountOfCollectables({
111
- chainId: params.chainId,
112
- collectionAddress: params.collectionAddress,
113
- config: params.config,
114
- filter: params.filter,
115
- side: params.side
116
- }),
117
- ...params.query,
118
- enabled
119
- });
120
- }
121
-
122
- //#endregion
123
- //#region src/react/queries/listCollectibleActivities.ts
124
- /**
125
- * Fetches collectible activities from the Marketplace API
126
- */
127
- async function fetchListCollectibleActivities(params) {
128
- const { collectionAddress, chainId, config, page, pageSize, sort,...additionalApiParams } = params;
129
- const marketplaceClient = getMarketplaceClient(config);
130
- const pageParams = page || pageSize || sort ? {
131
- page: page ?? 1,
132
- pageSize: pageSize ?? 10,
133
- sort
134
- } : void 0;
135
- const apiArgs = {
136
- contractAddress: collectionAddress,
137
- chainId: String(chainId),
138
- page: pageParams,
139
- ...additionalApiParams
140
- };
141
- return await marketplaceClient.listCollectibleActivities(apiArgs);
142
- }
143
- function listCollectibleActivitiesQueryOptions(params) {
144
- const enabled = Boolean(params.collectionAddress && params.chainId && params.tokenId && params.config && (params.query?.enabled ?? true));
145
- return queryOptions({
146
- queryKey: [...collectableKeys.collectibleActivities, params],
147
- queryFn: () => fetchListCollectibleActivities({
148
- chainId: params.chainId,
149
- collectionAddress: params.collectionAddress,
150
- config: params.config,
151
- tokenId: params.tokenId,
152
- page: params.page,
153
- pageSize: params.pageSize,
154
- sort: params.sort
155
- }),
156
- ...params.query,
157
- enabled
158
- });
159
- }
160
-
161
- //#endregion
162
- //#region src/react/queries/listBalances.ts
163
- async function fetchBalances(args, config, page) {
164
- if (args.isLaos721 && args.accountAddress) return new LaosAPI().getTokenBalances({
165
- chainId: args.chainId.toString(),
166
- accountAddress: args.accountAddress,
167
- contractAddress: args.contractAddress,
168
- includeMetadata: args.includeMetadata,
169
- page: { sort: [{
170
- column: "CREATED_AT",
171
- order: "DESC"
172
- }] }
173
- });
174
- return getIndexerClient(args.chainId, config).getTokenBalances({
175
- ...args,
176
- tokenID: args.tokenId,
177
- page
178
- });
179
- }
180
- /**
181
- * Creates a tanstack infinite query options object for the balances query
182
- *
183
- * @param args - The query arguments
184
- * @param config - SDK configuration
185
- * @returns Query options configuration
186
- */
187
- function listBalancesOptions(args, config) {
188
- return infiniteQueryOptions({
189
- ...args.query,
190
- queryKey: [
191
- ...balanceQueries.lists,
192
- args,
193
- config
194
- ],
195
- queryFn: ({ pageParam }) => fetchBalances(args, config, pageParam),
196
- initialPageParam: {
197
- page: 1,
198
- pageSize: 30
199
- },
200
- getNextPageParam: (lastPage) => lastPage.page.after
201
- });
202
- }
203
-
204
- //#endregion
205
- //#region src/react/queries/listCollectibles.ts
206
- /**
207
- * Fetches a list of collectibles with pagination support from the Marketplace API
208
- */
209
- async function fetchListCollectibles(params, page) {
210
- const { collectionAddress, chainId, config,...additionalApiParams } = params;
211
- const marketplaceClient = getMarketplaceClient(config);
212
- const isMarketCollection = (await fetchMarketplaceConfig({ config }))?.market.collections.some((collection) => compareAddress(collection.itemsAddress, collectionAddress));
213
- if (params.enabled === false || !isMarketCollection) return {
214
- collectibles: [],
215
- page: {
216
- page: 1,
217
- pageSize: 30,
218
- more: false
219
- }
220
- };
221
- const apiArgs = {
222
- contractAddress: collectionAddress,
223
- chainId: String(chainId),
224
- page,
225
- ...additionalApiParams
226
- };
227
- if (params.isLaos721 && params.side === OrderSide.listing) try {
228
- const fetchBalancesArgs = {
229
- chainId: params.chainId,
230
- accountAddress: params.filter?.inAccounts?.[0],
231
- contractAddress: params.collectionAddress,
232
- page,
233
- includeMetadata: true,
234
- isLaos721: true
235
- };
236
- const balances = await fetchBalances(fetchBalancesArgs, config, page);
237
- return {
238
- collectibles: balances.balances.map((balance) => {
239
- if (!balance.tokenMetadata) throw new Error("Token metadata not found");
240
- return { metadata: {
241
- tokenId: balance.tokenID ?? "",
242
- attributes: balance.tokenMetadata.attributes,
243
- image: balance.tokenMetadata.image,
244
- name: balance.tokenMetadata.name,
245
- description: balance.tokenMetadata.description,
246
- video: balance.tokenMetadata.video,
247
- audio: balance.tokenMetadata.audio
248
- } };
249
- }),
250
- page: balances.page
251
- };
252
- } catch (error) {
253
- console.error(error);
254
- }
255
- return await marketplaceClient.listCollectibles(apiArgs);
256
- }
257
- function listCollectiblesQueryOptions(params) {
258
- const enabled = Boolean(params.collectionAddress && params.chainId && params.side && params.config && (params.query?.enabled ?? true));
259
- return infiniteQueryOptions({
260
- queryKey: [...collectableKeys.lists, params],
261
- queryFn: async ({ pageParam }) => {
262
- return fetchListCollectibles({
263
- chainId: params.chainId,
264
- collectionAddress: params.collectionAddress,
265
- config: params.config,
266
- side: params.side,
267
- filter: params.filter,
268
- isLaos721: params.isLaos721,
269
- cardType: params.cardType
270
- }, pageParam);
271
- },
272
- initialPageParam: {
273
- page: 1,
274
- pageSize: 30
275
- },
276
- getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0,
277
- ...params.query,
278
- enabled
279
- });
280
- }
281
-
282
- //#endregion
283
- //#region src/react/queries/listCollectiblesPaginated.ts
284
- /**
285
- * Fetches a list of collectibles with pagination support from the Marketplace API
286
- */
287
- async function fetchListCollectiblesPaginated(params) {
288
- const { collectionAddress, chainId, config, page = 1, pageSize = 30,...additionalApiParams } = params;
289
- const marketplaceClient = getMarketplaceClient(config);
290
- const pageParams = {
291
- page,
292
- pageSize
293
- };
294
- const apiArgs = {
295
- contractAddress: collectionAddress,
296
- chainId: String(chainId),
297
- page: pageParams,
298
- ...additionalApiParams
299
- };
300
- return await marketplaceClient.listCollectibles(apiArgs);
301
- }
302
- function listCollectiblesPaginatedQueryOptions(params) {
303
- const enabled = Boolean(params.collectionAddress && params.chainId && params.side && params.config && (params.query?.enabled ?? true));
304
- return queryOptions({
305
- queryKey: [
306
- ...collectableKeys.lists,
307
- "paginated",
308
- params
309
- ],
310
- queryFn: () => fetchListCollectiblesPaginated({
311
- chainId: params.chainId,
312
- collectionAddress: params.collectionAddress,
313
- config: params.config,
314
- side: params.side,
315
- filter: params.filter,
316
- page: params.page,
317
- pageSize: params.pageSize
318
- }),
319
- ...params.query,
320
- enabled
321
- });
322
- }
323
-
324
- //#endregion
325
- //#region src/react/queries/collection.ts
326
- /**
327
- * Fetches collection information from the metadata API
328
- */
329
- async function fetchCollection(params) {
330
- const { collectionAddress, chainId, config } = params;
331
- return (await getMetadataClient(config).getContractInfo({
332
- chainID: chainId.toString(),
333
- contractAddress: collectionAddress
334
- })).contractInfo;
335
- }
336
- function collectionQueryOptions(params) {
337
- const enabled = Boolean(params.collectionAddress && params.chainId && params.config && (params.query?.enabled ?? true));
338
- return queryOptions({
339
- queryKey: [...collectionKeys.detail, params],
340
- queryFn: () => fetchCollection({
341
- chainId: params.chainId,
342
- collectionAddress: params.collectionAddress,
343
- config: params.config
344
- }),
345
- ...params.query,
346
- enabled
347
- });
348
- }
349
-
350
- //#endregion
351
- //#region src/react/queries/collectionBalanceDetails.ts
352
- /**
353
- * Fetches detailed balance information for multiple accounts from the Indexer API
354
- */
355
- async function fetchCollectionBalanceDetails(params) {
356
- const { chainId, filter, config } = params;
357
- const indexerClient = getIndexerClient(chainId, config);
358
- const promises = filter.accountAddresses.map((accountAddress) => indexerClient.getTokenBalancesDetails({ filter: {
359
- accountAddresses: [accountAddress],
360
- contractWhitelist: filter.contractWhitelist,
361
- omitNativeBalances: filter.omitNativeBalances
362
- } }));
363
- const mergedResponse = (await Promise.all(promises)).reduce((acc, curr) => {
364
- if (!curr) return acc;
365
- return {
366
- page: curr.page,
367
- nativeBalances: [...acc.nativeBalances || [], ...curr.nativeBalances || []],
368
- balances: [...acc.balances || [], ...curr.balances || []]
369
- };
370
- }, {
371
- page: {},
372
- nativeBalances: [],
373
- balances: []
374
- });
375
- if (!mergedResponse) throw new Error("Failed to fetch collection balance details");
376
- return mergedResponse;
377
- }
378
- function collectionBalanceDetailsQueryOptions(params) {
379
- const enabled = Boolean(params.chainId && params.filter?.accountAddresses?.length && params.config && (params.query?.enabled ?? true));
380
- return queryOptions({
381
- queryKey: [
382
- "balances",
383
- "collectionBalanceDetails",
384
- params
385
- ],
386
- queryFn: () => fetchCollectionBalanceDetails({
387
- chainId: params.chainId,
388
- filter: params.filter,
389
- config: params.config
390
- }),
391
- ...params.query,
392
- enabled
393
- });
394
- }
395
-
396
- //#endregion
397
- //#region src/react/queries/collectionDetails.ts
398
- /**
399
- * Fetches collection details from the marketplace API
400
- */
401
- async function fetchCollectionDetails(params) {
402
- const { collectionAddress, chainId, config,...additionalApiParams } = params;
403
- const marketplaceClient = getMarketplaceClient(config);
404
- const apiArgs = {
405
- contractAddress: collectionAddress,
406
- chainId: String(chainId),
407
- ...additionalApiParams
408
- };
409
- return (await marketplaceClient.getCollectionDetail(apiArgs)).collection;
410
- }
411
- function collectionDetailsQueryOptions(params) {
412
- const enabled = Boolean(params.collectionAddress && params.chainId && params.config && (params.query?.enabled ?? true));
413
- return queryOptions({
414
- queryKey: [...collectionKeys.detail, params],
415
- queryFn: () => fetchCollectionDetails({
416
- chainId: params.chainId,
417
- collectionAddress: params.collectionAddress,
418
- config: params.config
419
- }),
420
- ...params.query,
421
- enabled
422
- });
423
- }
424
-
425
- //#endregion
426
- //#region src/react/queries/listCollectionActivities.ts
427
- /**
428
- * Fetches collection activities from the Marketplace API
429
- */
430
- async function fetchListCollectionActivities(params) {
431
- const { collectionAddress, chainId, config, page, pageSize, sort,...additionalApiParams } = params;
432
- const marketplaceClient = getMarketplaceClient(config);
433
- const pageParams = page || pageSize || sort ? {
434
- page: page ?? 1,
435
- pageSize: pageSize ?? 10,
436
- sort
437
- } : void 0;
438
- const apiArgs = {
439
- contractAddress: collectionAddress,
440
- chainId: String(chainId),
441
- page: pageParams,
442
- ...additionalApiParams
443
- };
444
- return await marketplaceClient.listCollectionActivities(apiArgs);
445
- }
446
- function listCollectionActivitiesQueryOptions(params) {
447
- const enabled = Boolean(params.collectionAddress && params.chainId && params.config && (params.query?.enabled ?? true));
448
- return queryOptions({
449
- queryKey: [...collectionKeys.collectionActivities, params],
450
- queryFn: () => fetchListCollectionActivities({
451
- chainId: params.chainId,
452
- collectionAddress: params.collectionAddress,
453
- config: params.config,
454
- page: params.page,
455
- pageSize: params.pageSize,
456
- sort: params.sort
457
- }),
458
- ...params.query,
459
- enabled
460
- });
461
- }
462
-
463
- //#endregion
464
- //#region src/react/queries/listCollections.ts
465
- const allCollections = (marketplaceConfig) => {
466
- return [...marketplaceConfig.market.collections, ...marketplaceConfig.shop.collections];
467
- };
468
- /**
469
- * Fetches collections from the metadata API with marketplace config filtering
470
- */
471
- async function fetchListCollections(params) {
472
- const { cardType, marketplaceConfig, config } = params;
473
- const metadataClient = getMetadataClient(config);
474
- let collections = allCollections(marketplaceConfig);
475
- if (!collections?.length) return [];
476
- if (cardType) collections = collections.filter((collection) => collection.cardType === cardType);
477
- const collectionsByChain = collections.reduce((acc, curr) => {
478
- const { chainId, itemsAddress } = curr;
479
- if (!acc[chainId]) acc[chainId] = [];
480
- acc[chainId].push(itemsAddress);
481
- return acc;
482
- }, {});
483
- const promises = Object.entries(collectionsByChain).map(([chainId, addresses]) => metadataClient.getContractInfoBatch({
484
- chainID: chainId,
485
- contractAddresses: addresses
486
- }).then((resp) => Object.values(resp.contractInfoMap)));
487
- const settled = await Promise.allSettled(promises);
488
- if (settled.every((result) => result.status === "rejected")) throw settled[0].reason;
489
- const results = settled.filter((r) => r.status === "fulfilled").flatMap((r) => r.value);
490
- return collections.map((collection) => {
491
- const metadata = results.find((result) => compareAddress(result.address, collection.itemsAddress));
492
- return {
493
- collection,
494
- metadata
495
- };
496
- }).filter((item) => item.metadata !== void 0).map(({ collection, metadata }) => ({
497
- ...collection,
498
- ...metadata
499
- }));
500
- }
501
- function listCollectionsQueryOptions(params) {
502
- const enabled = Boolean(params.marketplaceConfig && params.config && (params.query?.enabled ?? true));
503
- return queryOptions({
504
- queryKey: [...collectionKeys.list, params],
505
- queryFn: enabled ? () => fetchListCollections({
506
- marketplaceConfig: params.marketplaceConfig,
507
- config: params.config,
508
- cardType: params.cardType
509
- }) : skipToken,
510
- ...params.query,
511
- enabled
512
- });
513
- }
514
- const listCollectionsOptions = ({ cardType, marketplaceConfig, config }) => {
515
- return queryOptions({
516
- queryKey: [...collectionKeys.list, {
517
- cardType,
518
- marketplaceConfig,
519
- config
520
- }],
521
- queryFn: marketplaceConfig ? () => fetchListCollections({
522
- marketplaceConfig,
523
- config,
524
- cardType
525
- }) : skipToken,
526
- enabled: Boolean(marketplaceConfig)
527
- });
528
- };
529
-
530
- //#endregion
531
- //#region src/react/queries/currency.ts
532
- /**
533
- * Fetches currency details from the marketplace API
534
- */
535
- async function fetchCurrency(params) {
536
- const { chainId, currencyAddress, config } = params;
537
- let currencies = getQueryClient().getQueryData([...currencyKeys.lists, chainId]);
538
- if (!currencies) currencies = await getMarketplaceClient(config).listCurrencies({ chainId: String(chainId) }).then((resp) => resp.currencies);
539
- if (!currencies?.length) throw new Error("No currencies returned");
540
- const currency = currencies.find((currency$1) => currency$1.contractAddress.toLowerCase() === currencyAddress.toLowerCase());
541
- if (!currency) throw new Error("Currency not found");
542
- return currency;
543
- }
544
- function currencyQueryOptions(params) {
545
- const enabled = Boolean(params.chainId && params.currencyAddress && params.config && (params.query?.enabled ?? true));
546
- return queryOptions({
547
- queryKey: [...currencyKeys.details, params],
548
- queryFn: params.chainId && params.currencyAddress ? () => fetchCurrency({
549
- chainId: params.chainId,
550
- currencyAddress: params.currencyAddress,
551
- config: params.config
552
- }) : skipToken,
553
- ...params.query,
554
- enabled
555
- });
556
- }
557
-
558
- //#endregion
559
- //#region src/react/queries/marketCurrencies.ts
560
- /**
561
- * Fetches supported currencies for a marketplace
562
- */
563
- async function fetchMarketCurrencies(params) {
564
- const { chainId, includeNativeCurrency, collectionAddress, config } = params;
565
- const includeNativeCurrencyOption = includeNativeCurrency ?? true;
566
- let currencies = await getMarketplaceClient(config).listCurrencies({ chainId: String(chainId) }).then((resp) => resp.currencies.map((currency) => ({
567
- ...currency,
568
- contractAddress: currency.contractAddress || zeroAddress
569
- })));
570
- if (collectionAddress) {
571
- const currenciesOptions = (await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections.find((collection) => compareAddress(collection.itemsAddress, collectionAddress))?.currencyOptions;
572
- if (currenciesOptions) currencies = currencies.filter((currency) => currenciesOptions.includes(currency.contractAddress));
573
- }
574
- if (!includeNativeCurrencyOption) currencies = currencies.filter((currency) => !currency.nativeCurrency);
575
- return currencies;
576
- }
577
- function marketCurrenciesQueryOptions(params) {
578
- const enabled = Boolean(params.chainId && params.config && (params.query?.enabled ?? true));
579
- return queryOptions({
580
- queryKey: [...currencyKeys.lists, params],
581
- queryFn: () => fetchMarketCurrencies({
582
- chainId: params.chainId,
583
- config: params.config,
584
- includeNativeCurrency: params.includeNativeCurrency,
585
- collectionAddress: params.collectionAddress
586
- }),
587
- ...params.query,
588
- enabled
589
- });
590
- }
591
-
592
- //#endregion
593
- //#region src/react/queries/countListingsForCollectible.ts
594
- /**
595
- * Fetches count of listings for a collectible from the marketplace API
596
- */
597
- async function fetchCountListingsForCollectible(params) {
598
- const { collectionAddress, chainId, collectibleId, config, filter } = params;
599
- const client = getMarketplaceClient(config);
600
- const apiArgs = {
601
- contractAddress: collectionAddress,
602
- chainId: String(chainId),
603
- tokenId: collectibleId,
604
- filter
605
- };
606
- return (await client.getCountOfListingsForCollectible(apiArgs)).count;
607
- }
608
- function countListingsForCollectibleQueryOptions(params) {
609
- const enabled = Boolean(params.collectionAddress && params.chainId && params.collectibleId && params.config && (params.query?.enabled ?? true));
610
- return queryOptions({
611
- queryKey: [...collectableKeys.listingsCount, params],
612
- queryFn: () => fetchCountListingsForCollectible({
613
- chainId: params.chainId,
614
- collectionAddress: params.collectionAddress,
615
- collectibleId: params.collectibleId,
616
- config: params.config,
617
- filter: params.filter
618
- }),
619
- ...params.query,
620
- enabled
621
- });
622
- }
623
-
624
- //#endregion
625
- //#region src/react/queries/countOffersForCollectible.ts
626
- /**
627
- * Fetches count of offers for a collectible from the marketplace API
628
- */
629
- async function fetchCountOffersForCollectible(params) {
630
- const { collectionAddress, chainId, collectibleId, config, filter } = params;
631
- const client = getMarketplaceClient(config);
632
- const apiArgs = {
633
- contractAddress: collectionAddress,
634
- chainId: String(chainId),
635
- tokenId: collectibleId,
636
- filter
637
- };
638
- return (await client.getCountOfOffersForCollectible(apiArgs)).count;
639
- }
640
- function countOffersForCollectibleQueryOptions(params) {
641
- const enabled = Boolean(params.collectionAddress && params.chainId && params.collectibleId && params.config && (params.query?.enabled ?? true));
642
- return queryOptions({
643
- queryKey: [...collectableKeys.offersCount, params],
644
- queryFn: () => fetchCountOffersForCollectible({
645
- chainId: params.chainId,
646
- collectionAddress: params.collectionAddress,
647
- collectibleId: params.collectibleId,
648
- config: params.config,
649
- filter: params.filter
650
- }),
651
- ...params.query,
652
- enabled
653
- });
654
- }
655
-
656
- //#endregion
657
- //#region src/react/queries/floorOrder.ts
658
- /**
659
- * Fetches the floor order for a collection from the marketplace API
660
- */
661
- async function fetchFloorOrder(params) {
662
- const { collectionAddress, chainId, config,...additionalApiParams } = params;
663
- const marketplaceClient = getMarketplaceClient(config);
664
- const apiArgs = {
665
- contractAddress: collectionAddress,
666
- chainId: String(chainId),
667
- ...additionalApiParams
668
- };
669
- return (await marketplaceClient.getFloorOrder(apiArgs)).collectible;
670
- }
671
- function floorOrderQueryOptions(params) {
672
- const enabled = Boolean(params.collectionAddress && params.chainId && params.config && (params.query?.enabled ?? true));
673
- return queryOptions({
674
- queryKey: [...collectableKeys.floorOrders, params],
675
- queryFn: () => fetchFloorOrder({
676
- chainId: params.chainId,
677
- collectionAddress: params.collectionAddress,
678
- config: params.config,
679
- ...params.filter && { filter: params.filter } || {}
680
- }),
681
- ...params.query,
682
- enabled
683
- });
684
- }
685
-
686
- //#endregion
687
- //#region src/react/queries/highestOffer.ts
688
- /**
689
- * Fetches the highest offer for a collectible from the marketplace API
690
- */
691
- async function fetchHighestOffer(params) {
692
- const { collectionAddress, chainId, config,...additionalApiParams } = params;
693
- const marketplaceClient = getMarketplaceClient(config);
694
- const apiArgs = {
695
- contractAddress: collectionAddress,
696
- chainId: String(chainId),
697
- ...additionalApiParams
698
- };
699
- return (await marketplaceClient.getCollectibleHighestOffer(apiArgs)).order ?? null;
700
- }
701
- function highestOfferQueryOptions(params) {
702
- const enabled = Boolean(params.collectionAddress && params.chainId && params.tokenId && params.config && (params.query?.enabled ?? true));
703
- return queryOptions({
704
- queryKey: [...collectableKeys.highestOffers, params],
705
- queryFn: () => fetchHighestOffer({
706
- chainId: params.chainId,
707
- collectionAddress: params.collectionAddress,
708
- tokenId: params.tokenId,
709
- config: params.config
710
- }),
711
- ...params.query,
712
- enabled
713
- });
714
- }
715
-
716
- //#endregion
717
- //#region src/react/queries/listListingsForCollectible.ts
718
- /**
719
- * Fetches listings for a specific collectible from the Marketplace API
720
- */
721
- async function fetchListListingsForCollectible(params) {
722
- const { collectionAddress, chainId, collectibleId, config,...additionalApiParams } = params;
723
- const marketplaceClient = getMarketplaceClient(config);
724
- const apiArgs = {
725
- contractAddress: collectionAddress,
726
- chainId: String(chainId),
727
- tokenId: collectibleId,
728
- ...additionalApiParams
729
- };
730
- return await marketplaceClient.listCollectibleListings(apiArgs);
731
- }
732
- function listListingsForCollectibleQueryOptions(params) {
733
- const enabled = Boolean(params.collectionAddress && params.chainId && params.collectibleId && params.config && (params.query?.enabled ?? true));
734
- return queryOptions({
735
- queryKey: [...collectableKeys.listings, params],
736
- queryFn: () => fetchListListingsForCollectible({
737
- chainId: params.chainId,
738
- collectionAddress: params.collectionAddress,
739
- collectibleId: params.collectibleId,
740
- config: params.config,
741
- filter: params.filter,
742
- page: params.page
743
- }),
744
- ...params.query,
745
- enabled
746
- });
747
- }
748
-
749
- //#endregion
750
- //#region src/react/queries/listOffersForCollectible.ts
751
- /**
752
- * Fetches offers for a specific collectible from the Marketplace API
753
- */
754
- async function fetchListOffersForCollectible(params) {
755
- const { collectionAddress, chainId, collectibleId, config, sort, page,...additionalApiParams } = params;
756
- const marketplaceClient = getMarketplaceClient(config);
757
- const finalSort = sort || (page && "sort" in page ? page.sort : void 0);
758
- let finalPage;
759
- if (page || finalSort) finalPage = {
760
- page: page?.page ?? 1,
761
- pageSize: page?.pageSize ?? 20,
762
- ...page?.more && { more: page.more },
763
- ...finalSort && { sort: finalSort }
764
- };
765
- const apiArgs = {
766
- contractAddress: collectionAddress,
767
- chainId: String(chainId),
768
- tokenId: collectibleId,
769
- page: finalPage,
770
- ...additionalApiParams
771
- };
772
- return await marketplaceClient.listCollectibleOffers(apiArgs);
773
- }
774
- function listOffersForCollectibleQueryOptions(params) {
775
- const enabled = Boolean(params.collectionAddress && params.chainId && params.collectibleId && params.config && (params.query?.enabled ?? true));
776
- return queryOptions({
777
- queryKey: [...collectableKeys.offers, params],
778
- queryFn: () => fetchListOffersForCollectible({
779
- chainId: params.chainId,
780
- collectionAddress: params.collectionAddress,
781
- collectibleId: params.collectibleId,
782
- config: params.config,
783
- filter: params.filter,
784
- page: params.page,
785
- sort: params.sort
786
- }),
787
- ...params.query,
788
- enabled
789
- });
790
- }
791
-
792
- //#endregion
793
- //#region src/react/queries/lowestListing.ts
794
- /**
795
- * Fetches the lowest listing for a collectible from the marketplace API
796
- */
797
- async function fetchLowestListing(params) {
798
- const { collectionAddress, chainId, config,...additionalApiParams } = params;
799
- const marketplaceClient = getMarketplaceClient(config);
800
- const apiArgs = {
801
- contractAddress: collectionAddress,
802
- chainId: String(chainId),
803
- ...additionalApiParams
804
- };
805
- return (await marketplaceClient.getCollectibleLowestListing(apiArgs)).order || null;
806
- }
807
- function lowestListingQueryOptions(params) {
808
- const enabled = Boolean(params.collectionAddress && params.chainId && params.tokenId && params.config && (params.query?.enabled ?? true));
809
- return queryOptions({
810
- queryKey: [...collectableKeys.lowestListings, params],
811
- queryFn: () => fetchLowestListing({
812
- chainId: params.chainId,
813
- collectionAddress: params.collectionAddress,
814
- tokenId: params.tokenId,
815
- config: params.config
816
- }),
817
- ...params.query,
818
- enabled
819
- });
820
- }
821
-
822
- //#endregion
823
- //#region src/react/queries/checkoutOptions.ts
824
- /**
825
- * Fetches checkout options from the Marketplace API
826
- */
827
- async function fetchCheckoutOptions(params) {
828
- const { chainId, walletAddress, orders, config, additionalFee } = params;
829
- const client = getMarketplaceClient(config);
830
- const apiArgs = {
831
- chainId: String(chainId),
832
- wallet: walletAddress,
833
- orders: orders.map((order) => ({
834
- contractAddress: order.collectionAddress,
835
- orderId: order.orderId,
836
- marketplace: order.marketplace
837
- })),
838
- additionalFee: additionalFee ?? 0
839
- };
840
- return await client.checkoutOptionsMarketplace(apiArgs);
841
- }
842
- function checkoutOptionsQueryOptions(params) {
843
- const enabled = Boolean(params.chainId && params.walletAddress && params.orders?.length && params.config && (params.query?.enabled ?? true));
844
- return queryOptions({
845
- queryKey: [
846
- "checkout",
847
- "options",
848
- params
849
- ],
850
- queryFn: () => fetchCheckoutOptions({
851
- chainId: params.chainId,
852
- walletAddress: params.walletAddress,
853
- orders: params.orders,
854
- config: params.config,
855
- additionalFee: params.additionalFee ?? 0
856
- }),
857
- ...params.query,
858
- enabled
859
- });
860
- }
861
-
862
- //#endregion
863
- //#region src/react/queries/checkoutOptionsSalesContract.ts
864
- /**
865
- * Fetches checkout options for sales contract from the Marketplace API
866
- */
867
- async function fetchCheckoutOptionsSalesContract(params) {
868
- const { chainId, walletAddress, contractAddress, collectionAddress, items, config } = params;
869
- const client = getMarketplaceClient(config);
870
- const apiArgs = {
871
- chainId: String(chainId),
872
- wallet: walletAddress,
873
- contractAddress,
874
- collectionAddress,
875
- items
876
- };
877
- return await client.checkoutOptionsSalesContract(apiArgs);
878
- }
879
- function checkoutOptionsSalesContractQueryOptions(params) {
880
- const enabled = Boolean(params.chainId && params.walletAddress && params.contractAddress && params.collectionAddress && params.items?.length && params.config && (params.query?.enabled ?? true));
881
- return queryOptions({
882
- queryKey: [
883
- "checkout",
884
- "options",
885
- "salesContract",
886
- params
887
- ],
888
- queryFn: () => fetchCheckoutOptionsSalesContract({
889
- chainId: params.chainId,
890
- walletAddress: params.walletAddress,
891
- contractAddress: params.contractAddress,
892
- collectionAddress: params.collectionAddress,
893
- items: params.items,
894
- config: params.config
895
- }),
896
- ...params.query,
897
- enabled
898
- });
899
- }
900
-
901
- //#endregion
902
- //#region src/react/queries/convertPriceToUSD.ts
903
- /**
904
- * Converts a price amount from a specific currency to USD using exchange rates
905
- */
906
- async function fetchConvertPriceToUSD(params) {
907
- const { chainId, currencyAddress, amountRaw, config } = params;
908
- const currencyDetails = (await getQueryClient().fetchQuery(marketCurrenciesQueryOptions({
909
- chainId,
910
- config
911
- }))).find((c) => c.contractAddress.toLowerCase() === currencyAddress.toLowerCase());
912
- if (!currencyDetails) throw new Error("Currency not found");
913
- const usdAmount = Number(formatUnits(BigInt(amountRaw), currencyDetails.decimals)) * currencyDetails.exchangeRate;
914
- return {
915
- usdAmount,
916
- usdAmountFormatted: usdAmount.toFixed(2)
917
- };
918
- }
919
- function convertPriceToUSDQueryOptions(params) {
920
- const enabled = Boolean(params.chainId && params.currencyAddress && params.amountRaw && params.config && (params.query?.enabled ?? true));
921
- return queryOptions({
922
- queryKey: [
923
- "currency",
924
- "convertPriceToUSD",
925
- params
926
- ],
927
- queryFn: () => fetchConvertPriceToUSD({
928
- chainId: params.chainId,
929
- currencyAddress: params.currencyAddress,
930
- amountRaw: params.amountRaw,
931
- config: params.config
932
- }),
933
- ...params.query,
934
- enabled
935
- });
936
- }
937
-
938
- //#endregion
939
- //#region src/react/queries/comparePrices.ts
940
- /**
941
- * Compares prices between different currencies by converting both to USD
942
- */
943
- async function fetchComparePrices(params) {
944
- const { chainId, priceAmountRaw, priceCurrencyAddress, compareToPriceAmountRaw, compareToPriceCurrencyAddress, config } = params;
945
- const [priceUSD, compareToPriceUSD] = await Promise.all([fetchConvertPriceToUSD({
946
- chainId,
947
- currencyAddress: priceCurrencyAddress,
948
- amountRaw: priceAmountRaw,
949
- config
950
- }), fetchConvertPriceToUSD({
951
- chainId,
952
- currencyAddress: compareToPriceCurrencyAddress,
953
- amountRaw: compareToPriceAmountRaw,
954
- config
955
- })]);
956
- const difference = priceUSD.usdAmount - compareToPriceUSD.usdAmount;
957
- if (compareToPriceUSD.usdAmount === 0) throw new Error("Cannot compare to zero price");
958
- const percentageDifference = difference / compareToPriceUSD.usdAmount * 100;
959
- const isAbove = percentageDifference > 0;
960
- const isSame = percentageDifference === 0;
961
- return {
962
- percentageDifference,
963
- percentageDifferenceFormatted: Math.abs(percentageDifference).toFixed(2),
964
- status: isAbove ? "above" : isSame ? "same" : "below"
965
- };
966
- }
967
- function comparePricesQueryOptions(params) {
968
- const enabled = Boolean(params.chainId && params.priceAmountRaw && params.priceCurrencyAddress && params.compareToPriceAmountRaw && params.compareToPriceCurrencyAddress && params.config && (params.query?.enabled ?? true));
969
- return queryOptions({
970
- queryKey: [
971
- "currency",
972
- "conversion",
973
- "compare",
974
- params
975
- ],
976
- queryFn: () => fetchComparePrices({
977
- chainId: params.chainId,
978
- priceAmountRaw: params.priceAmountRaw,
979
- priceCurrencyAddress: params.priceCurrencyAddress,
980
- compareToPriceAmountRaw: params.compareToPriceAmountRaw,
981
- compareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress,
982
- config: params.config
983
- }),
984
- ...params.query,
985
- enabled
986
- });
987
- }
988
-
989
- //#endregion
990
- //#region src/react/queries/countOfPrimarySaleItems.ts
991
- async function fetchCountOfPrimarySaleItems(args, config) {
992
- const marketplaceClient = getMarketplaceClient(config);
993
- const { chainId, primarySaleContractAddress, filter } = args;
994
- return (await marketplaceClient.getCountOfPrimarySaleItems({
995
- chainId: String(chainId),
996
- primarySaleContractAddress,
997
- filter
998
- })).count;
999
- }
1000
- function countOfPrimarySaleItemsOptions(args, config) {
1001
- return queryOptions({
1002
- enabled: args.query?.enabled ?? true,
1003
- queryKey: ["countOfPrimarySaleItems", args],
1004
- queryFn: () => fetchCountOfPrimarySaleItems(args, config)
1005
- });
1006
- }
1007
-
1008
- //#endregion
1009
- //#region src/react/queries/filters.ts
1010
- /**
1011
- * Fetches collection filters from the Metadata API with optional marketplace filtering
1012
- */
1013
- async function fetchFilters(params) {
1014
- const { chainId, collectionAddress, showAllFilters, excludePropertyValues, config } = params;
1015
- const filters = await getMetadataClient(config).getTokenMetadataPropertyFilters({
1016
- chainID: chainId.toString(),
1017
- contractAddress: collectionAddress,
1018
- excludeProperties: [],
1019
- excludePropertyValues
1020
- }).then((resp) => resp.filters);
1021
- if (showAllFilters) return filters;
1022
- const collectionFilters = (await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections.find((c) => compareAddress(c.itemsAddress, collectionAddress))?.filterSettings;
1023
- const filterOrder = collectionFilters?.filterOrder;
1024
- const exclusions = collectionFilters?.exclusions;
1025
- let sortedFilters = filters;
1026
- if (filterOrder) sortedFilters = filters.toSorted((a, b) => {
1027
- const aIndex = filterOrder.indexOf(a.name) > -1 ? filterOrder.indexOf(a.name) : filterOrder.length;
1028
- const bIndex = filterOrder.indexOf(b.name) > -1 ? filterOrder.indexOf(b.name) : filterOrder.length;
1029
- return aIndex - bIndex;
1030
- });
1031
- if (exclusions) sortedFilters = sortedFilters.reduce((acc, filter) => {
1032
- const exclusionRule = exclusions.find((rule) => rule.key === filter.name);
1033
- if (!exclusionRule) {
1034
- acc.push(filter);
1035
- return acc;
1036
- }
1037
- if (exclusionRule.condition === FilterCondition.ENTIRE_KEY) return acc;
1038
- if (exclusionRule.condition === FilterCondition.SPECIFIC_VALUE && exclusionRule.value) {
1039
- const filteredValues = filter.values?.filter((value) => value !== exclusionRule.value) || [];
1040
- if (filteredValues.length > 0) acc.push({
1041
- ...filter,
1042
- values: filteredValues
1043
- });
1044
- }
1045
- return acc;
1046
- }, []);
1047
- return sortedFilters;
1048
- }
1049
- function filtersQueryOptions(params) {
1050
- const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
1051
- return queryOptions({
1052
- queryKey: ["filters", params],
1053
- queryFn: () => fetchFilters({
1054
- chainId: params.chainId,
1055
- collectionAddress: params.collectionAddress,
1056
- showAllFilters: params.showAllFilters,
1057
- excludePropertyValues: params.excludePropertyValues,
1058
- config: params.config
1059
- }),
1060
- ...params.query,
1061
- enabled
1062
- });
1063
- }
1064
-
1065
- //#endregion
1066
- //#region src/react/queries/getTokenRanges.ts
1067
- /**
1068
- * Fetches token ID ranges for a collection from the Indexer API
1069
- */
1070
- async function fetchGetTokenRanges(params) {
1071
- const { chainId, collectionAddress, config } = params;
1072
- const response = await getIndexerClient(chainId, config).getTokenIDRanges({ contractAddress: collectionAddress });
1073
- if (!response) throw new Error("Failed to fetch token ranges");
1074
- return response;
1075
- }
1076
- function getTokenRangesQueryOptions(params) {
1077
- const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
1078
- return queryOptions({
1079
- queryKey: [
1080
- "indexer",
1081
- "tokenRanges",
1082
- params
1083
- ],
1084
- queryFn: () => fetchGetTokenRanges({
1085
- chainId: params.chainId,
1086
- collectionAddress: params.collectionAddress,
1087
- config: params.config
1088
- }),
1089
- ...params.query,
1090
- enabled
1091
- });
1092
- }
1093
-
1094
- //#endregion
1095
- //#region src/react/queries/tokenBalances.ts
1096
- /**
1097
- * Fetches the token balances for a user
1098
- *
1099
- * @param args - Arguments for the API call
1100
- * @param config - SDK configuration
1101
- * @returns The balance data
1102
- */
1103
- async function fetchTokenBalances(args, config) {
1104
- if (args.isLaos721) return (await new LaosAPI().getTokenBalances({
1105
- chainId: args.chainId.toString(),
1106
- contractAddress: args.collectionAddress,
1107
- accountAddress: args.userAddress,
1108
- includeMetadata: true
1109
- })).balances || [];
1110
- return getIndexerClient(args.chainId, config).getTokenBalances({
1111
- accountAddress: args.userAddress,
1112
- contractAddress: args.collectionAddress,
1113
- includeMetadata: args.includeMetadata ?? false,
1114
- metadataOptions: {
1115
- verifiedOnly: true,
1116
- includeContracts: [args.collectionAddress]
1117
- }
1118
- }).then((res) => res.balances || []);
1119
- }
1120
- /**
1121
- * Creates a tanstack query options object for the token balances query
1122
- *
1123
- * @param args - The query arguments
1124
- * @param config - SDK configuration
1125
- * @returns Query options configuration
1126
- */
1127
- function tokenBalancesOptions(args, config) {
1128
- const enabled = !!args.userAddress && !!args.collectionAddress && (args.query?.enabled ?? true);
1129
- return queryOptions({
1130
- queryKey: [...collectableKeys.userBalances, args],
1131
- queryFn: enabled ? () => fetchTokenBalances({
1132
- ...args,
1133
- userAddress: args.userAddress
1134
- }, config) : skipToken
1135
- });
1136
- }
1137
-
1138
- //#endregion
1139
- //#region src/react/queries/inventory.ts
1140
- function collectibleFromTokenBalance(token) {
1141
- return {
1142
- metadata: {
1143
- tokenId: token.tokenID ?? "",
1144
- attributes: token.tokenMetadata?.attributes ?? [],
1145
- image: token.tokenMetadata?.image,
1146
- name: token.tokenMetadata?.name ?? "",
1147
- description: token.tokenMetadata?.description,
1148
- video: token.tokenMetadata?.video,
1149
- audio: token.tokenMetadata?.audio
1150
- },
1151
- contractInfo: token.contractInfo,
1152
- contractType: token.contractType,
1153
- balance: token.balance
1154
- };
1155
- }
1156
- async function fetchIndexerTokens(chainId, accountAddress, collectionAddress, config, isLaos721) {
1157
- return { collectibles: (await getQueryClient().fetchQuery(tokenBalancesOptions({
1158
- collectionAddress,
1159
- userAddress: accountAddress,
1160
- chainId,
1161
- isLaos721,
1162
- includeMetadata: true
1163
- }, config))).map((balance) => collectibleFromTokenBalance(balance)) };
1164
- }
1165
- async function fetchInventory(args, config, page) {
1166
- const { accountAddress, collectionAddress, chainId, isLaos721 } = args;
1167
- const isTradable = ((await fetchMarketplaceConfig({ config }))?.market.collections || []).some((collection) => compareAddress(collection.itemsAddress, collectionAddress));
1168
- const { collectibles } = await fetchIndexerTokens(chainId, accountAddress, collectionAddress, config, isLaos721);
1169
- return {
1170
- collectibles,
1171
- page: {
1172
- page: page.page,
1173
- pageSize: page.pageSize
1174
- },
1175
- isTradable
1176
- };
1177
- }
1178
- function inventoryOptions(args, config) {
1179
- const enabled = (args.query?.enabled ?? true) && !!args.accountAddress && !!args.collectionAddress;
1180
- return queryOptions({
1181
- queryKey: [
1182
- "inventory",
1183
- args.accountAddress,
1184
- args.collectionAddress,
1185
- args.chainId,
1186
- args.query?.page ?? 1,
1187
- args.query?.pageSize ?? 30
1188
- ],
1189
- queryFn: () => fetchInventory({
1190
- ...args,
1191
- isLaos721: args.isLaos721 ?? false
1192
- }, config, {
1193
- page: args.query?.page ?? 1,
1194
- pageSize: args.query?.pageSize ?? 30
1195
- }),
1196
- enabled
1197
- });
1198
- }
1199
-
1200
- //#endregion
1201
- //#region src/react/queries/listTokenMetadata.ts
1202
- /**
1203
- * Fetches token metadata from the metadata API
1204
- */
1205
- async function fetchListTokenMetadata(params) {
1206
- const { chainId, contractAddress, tokenIds, config } = params;
1207
- return (await getMetadataClient(config).getTokenMetadata({
1208
- chainID: chainId.toString(),
1209
- contractAddress,
1210
- tokenIDs: tokenIds
1211
- })).tokenMetadata;
1212
- }
1213
- function listTokenMetadataQueryOptions(params) {
1214
- const enabled = Boolean(params.chainId && params.contractAddress && params.tokenIds?.length && params.config && (params.query?.enabled ?? true));
1215
- return queryOptions({
1216
- queryKey: [...tokenKeys.metadata, params],
1217
- queryFn: () => fetchListTokenMetadata({
1218
- chainId: params.chainId,
1219
- contractAddress: params.contractAddress,
1220
- tokenIds: params.tokenIds,
1221
- config: params.config
1222
- }),
1223
- ...params.query,
1224
- enabled
1225
- });
1226
- }
1227
-
1228
- //#endregion
1229
- //#region src/react/queries/primarySaleItems.ts
1230
- /**
1231
- * Fetches primary sale items from the marketplace API
1232
- */
1233
- async function fetchPrimarySaleItems(params) {
1234
- const { chainId, primarySaleContractAddress, filter, page, config } = params;
1235
- return getMarketplaceClient(config).listPrimarySaleItems({
1236
- chainId: String(chainId),
1237
- primarySaleContractAddress,
1238
- filter,
1239
- page
1240
- });
1241
- }
1242
- const listPrimarySaleItemsQueryOptions = (params) => {
1243
- const enabled = Boolean(params.primarySaleContractAddress && params.chainId && params.config && (params.query?.enabled ?? true));
1244
- const initialPage = params.page || {
1245
- page: 1,
1246
- pageSize: 30
1247
- };
1248
- return infiniteQueryOptions({
1249
- queryKey: ["listPrimarySaleItems", params],
1250
- queryFn: async ({ pageParam }) => {
1251
- return fetchPrimarySaleItems({
1252
- chainId: params.chainId,
1253
- primarySaleContractAddress: params.primarySaleContractAddress,
1254
- filter: params.filter,
1255
- page: pageParam,
1256
- config: params.config
1257
- });
1258
- },
1259
- initialPageParam: initialPage,
1260
- getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0,
1261
- ...params.query,
1262
- enabled
1263
- });
1264
- };
1265
-
1266
- //#endregion
1267
- //#region src/react/queries/primarySaleItemsCount.ts
1268
- /**
1269
- * Fetches the count of primary sale items from the marketplace API
1270
- */
1271
- async function fetchPrimarySaleItemsCount(params) {
1272
- const { chainId, primarySaleContractAddress, filter, config } = params;
1273
- return getMarketplaceClient(config).getCountOfPrimarySaleItems({
1274
- chainId: String(chainId),
1275
- primarySaleContractAddress,
1276
- filter
1277
- });
1278
- }
1279
- const primarySaleItemsCountQueryOptions = (args) => {
1280
- const enabled = Boolean(args.primarySaleContractAddress && args.chainId && args.config && (args.query?.enabled ?? true));
1281
- return queryOptions({
1282
- queryKey: ["primarySaleItemsCount", args],
1283
- queryFn: () => fetchPrimarySaleItemsCount({
1284
- chainId: args.chainId,
1285
- primarySaleContractAddress: args.primarySaleContractAddress,
1286
- filter: args.filter,
1287
- config: args.config
1288
- }),
1289
- ...args.query,
1290
- enabled
1291
- });
1292
- };
1293
-
1294
- //#endregion
1295
- //#region src/react/queries/searchTokenMetadata.ts
1296
- /**
1297
- * Fetches token metadata from the metadata API using search filters
1298
- */
1299
- async function fetchSearchTokenMetadata(params) {
1300
- const { chainId, collectionAddress, filter, page, config } = params;
1301
- const response = await getMetadataClient(config).searchTokenMetadata({
1302
- chainID: chainId.toString(),
1303
- contractAddress: collectionAddress,
1304
- filter: filter ?? {},
1305
- page
1306
- });
1307
- return {
1308
- tokenMetadata: response.tokenMetadata,
1309
- page: response.page
1310
- };
1311
- }
1312
- function searchTokenMetadataQueryOptions(params) {
1313
- const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
1314
- const initialPageParam = {
1315
- page: 1,
1316
- pageSize: 30
1317
- };
1318
- return infiniteQueryOptions({
1319
- queryKey: [
1320
- ...tokenKeys.metadata,
1321
- "search",
1322
- params
1323
- ],
1324
- queryFn: ({ pageParam = initialPageParam }) => fetchSearchTokenMetadata({
1325
- chainId: params.chainId,
1326
- collectionAddress: params.collectionAddress,
1327
- filter: params.filter,
1328
- config: params.config,
1329
- page: pageParam
1330
- }),
1331
- initialPageParam,
1332
- getNextPageParam: (lastPage) => {
1333
- if (!lastPage.page?.more) return void 0;
1334
- return {
1335
- page: (lastPage.page.page || 1) + 1,
1336
- pageSize: lastPage.page.pageSize || 20
1337
- };
1338
- },
1339
- ...params.query,
1340
- enabled
1341
- });
1342
- }
1343
-
1344
- //#endregion
1345
- //#region src/react/queries/tokenSupplies.ts
1346
- /**
1347
- * Fetches token supplies with support for both indexer and LAOS APIs
1348
- * Uses the more efficient single-contract APIs from both services
1349
- */
1350
- async function fetchTokenSupplies(params) {
1351
- const { chainId, collectionAddress, config, isLaos721,...rest } = params;
1352
- if (isLaos721) {
1353
- const laosApi = new LaosAPI();
1354
- const laosPage = rest.page ? { sort: rest.page.sort?.map((sortBy) => ({
1355
- column: sortBy.column,
1356
- order: sortBy.order
1357
- })) || [] } : void 0;
1358
- return await laosApi.getTokenSupplies({
1359
- chainId: chainId.toString(),
1360
- contractAddress: collectionAddress,
1361
- includeMetadata: rest.includeMetadata,
1362
- page: laosPage
1363
- });
1364
- }
1365
- const indexerClient = getIndexerClient(chainId, config);
1366
- const apiArgs = {
1367
- contractAddress: collectionAddress,
1368
- ...rest
1369
- };
1370
- return await indexerClient.getTokenSupplies(apiArgs);
1371
- }
1372
- function tokenSuppliesQueryOptions(params) {
1373
- const enabled = Boolean(params.chainId && params.collectionAddress && params.config && (params.query?.enabled ?? true));
1374
- const initialPageParam = {
1375
- page: 1,
1376
- pageSize: 30
1377
- };
1378
- const queryFn = async ({ pageParam = initialPageParam }) => fetchTokenSupplies({
1379
- chainId: params.chainId,
1380
- collectionAddress: params.collectionAddress,
1381
- config: params.config,
1382
- isLaos721: params.isLaos721,
1383
- includeMetadata: params.includeMetadata,
1384
- metadataOptions: params.metadataOptions,
1385
- page: pageParam
1386
- });
1387
- return infiniteQueryOptions({
1388
- queryKey: [...tokenKeys.supplies, params],
1389
- queryFn,
1390
- initialPageParam,
1391
- getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0,
1392
- ...params.query,
1393
- enabled
1394
- });
1395
- }
1396
-
1397
- //#endregion
1398
- export { balanceOfCollectibleOptions, checkoutOptionsQueryOptions, checkoutOptionsSalesContractQueryOptions, collectibleQueryOptions, collectionBalanceDetailsQueryOptions, collectionDetailsQueryOptions, collectionQueryOptions, comparePricesQueryOptions, convertPriceToUSDQueryOptions, countListingsForCollectibleQueryOptions, countOfCollectablesQueryOptions, countOfPrimarySaleItemsOptions, countOffersForCollectibleQueryOptions, currencyQueryOptions, fetchBalanceOfCollectible, fetchBalances, fetchCheckoutOptions, fetchCheckoutOptionsSalesContract, fetchCollectible, fetchCollection, fetchCollectionBalanceDetails, fetchCollectionDetails, fetchComparePrices, fetchConvertPriceToUSD, fetchCountListingsForCollectible, fetchCountOfCollectables, fetchCountOfPrimarySaleItems, fetchCountOffersForCollectible, fetchCurrency, fetchFilters, fetchFloorOrder, fetchGetTokenRanges, fetchHighestOffer, fetchInventory, fetchListCollectibleActivities, fetchListCollectibles, fetchListCollectiblesPaginated, fetchListCollectionActivities, fetchListCollections, fetchListListingsForCollectible, fetchListOffersForCollectible, fetchListTokenMetadata, fetchLowestListing, fetchMarketCurrencies, fetchPrimarySaleItems, fetchPrimarySaleItemsCount, fetchSearchTokenMetadata, fetchTokenSupplies, filtersQueryOptions, floorOrderQueryOptions, getTokenRangesQueryOptions, highestOfferQueryOptions, inventoryOptions, listBalancesOptions, listCollectibleActivitiesQueryOptions, listCollectiblesPaginatedQueryOptions, listCollectiblesQueryOptions, listCollectionActivitiesQueryOptions, listCollectionsOptions, listCollectionsQueryOptions, listListingsForCollectibleQueryOptions, listOffersForCollectibleQueryOptions, listPrimarySaleItemsQueryOptions, listTokenMetadataQueryOptions, lowestListingQueryOptions, marketCurrenciesQueryOptions, primarySaleItemsCountQueryOptions, searchTokenMetadataQueryOptions, tokenSuppliesQueryOptions };
1399
- //# sourceMappingURL=queries-EMA5CcwY.js.map