@0xsequence/marketplace-sdk 1.1.1 → 1.2.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 (327) hide show
  1. package/CHANGELOG.md +34 -3
  2. package/dist/{BellIcon-ByhygxBO.js → BellIcon-DMKEumAz.js} +2 -2
  3. package/dist/BellIcon-DMKEumAz.js.map +1 -0
  4. package/dist/{CartIcon-Bt3rQYGk.js → CartIcon-UyB4NYKt.js} +3 -3
  5. package/dist/CartIcon-UyB4NYKt.js.map +1 -0
  6. package/dist/CollectibleCard-z05qWzKE.d.ts +8 -0
  7. package/dist/_internal-DkS2VUn5.js.map +1 -1
  8. package/dist/abi-fa-o9gH3.js.map +1 -1
  9. package/dist/{alien_swap-DoY6XfMA.js → alien_swap-Cq8LuElo.js} +1 -1
  10. package/dist/{alien_swap-DoY6XfMA.js.map → alien_swap-Cq8LuElo.js.map} +1 -1
  11. package/dist/{api-BoO0V5aJ.js → api-GwTR0dBA.js} +8 -49
  12. package/dist/api-GwTR0dBA.js.map +1 -0
  13. package/dist/{aqua-xyz-BBDxnG14.js → aqua-xyz-0yye_c-Z.js} +1 -1
  14. package/dist/{aqua-xyz-BBDxnG14.js.map → aqua-xyz-0yye_c-Z.js.map} +1 -1
  15. package/dist/{aura-DGx2zwvF.js → aura-TaxFvTFQ.js} +1 -1
  16. package/dist/{aura-DGx2zwvF.js.map → aura-TaxFvTFQ.js.map} +1 -1
  17. package/dist/{blur-D8GKrRrq.js → blur-BupOTobO.js} +1 -1
  18. package/dist/{blur-D8GKrRrq.js.map → blur-BupOTobO.js.map} +1 -1
  19. package/dist/{builder-api-BFuZNOaN.js → builder-api-m4JAA6ee.js} +3 -3
  20. package/dist/builder-api-m4JAA6ee.js.map +1 -0
  21. package/dist/{builder.gen-B9wR2nvF.js → builder.gen--XD71cNL.js} +2 -2
  22. package/dist/builder.gen--XD71cNL.js.map +1 -0
  23. package/dist/{coinbase-DOry4PXY.js → coinbase-DTgZ4wDT.js} +1 -1
  24. package/dist/{coinbase-DOry4PXY.js.map → coinbase-DTgZ4wDT.js.map} +1 -1
  25. package/dist/{collectibles-C_H8jMGH.js → collectibles-CZ6i8sXK.js} +15 -49
  26. package/dist/collectibles-CZ6i8sXK.js.map +1 -0
  27. package/dist/{collections-CKummc-R.js → collections-5NcU-7ZR.js} +92 -10
  28. package/dist/collections-5NcU-7ZR.js.map +1 -0
  29. package/dist/{components-CosnX7F9.js → components-CY8kx2kb.js} +13 -9
  30. package/dist/components-CY8kx2kb.js.map +1 -0
  31. package/dist/{contracts-BP_0vX48.js → contracts-DRJHF89h.js} +4 -3
  32. package/dist/{contracts-BP_0vX48.js.map → contracts-DRJHF89h.js.map} +1 -1
  33. package/dist/{create-config-CIfejoCk.js → create-config-BxyfYCEk.js} +6 -5
  34. package/dist/create-config-BxyfYCEk.js.map +1 -0
  35. package/dist/{create-config-ZOB7i4ZJ.d.ts → create-config-CFBeD8CB.d.ts} +47 -60
  36. package/dist/{element-ciybd_VF.js → element-D4dDznlu.js} +1 -1
  37. package/dist/{element-ciybd_VF.js.map → element-D4dDznlu.js.map} +1 -1
  38. package/dist/{filters-V-V8Dn8f.d.ts → filters-B5niI_fX.d.ts} +7 -7
  39. package/dist/{foundation-Bq4lRz4x.js → foundation-GHZOKAzN.js} +1 -1
  40. package/dist/{foundation-Bq4lRz4x.js.map → foundation-GHZOKAzN.js.map} +1 -1
  41. package/dist/{index-BeRV-7AX.d.ts → index-8scPf0CS.d.ts} +2 -2
  42. package/dist/index-9qsplZ8r.d.ts +18 -0
  43. package/dist/{index-BZIJTQT0.d.ts → index-BIuYTMc2.d.ts} +10 -9
  44. package/dist/{index-C4MUKshG.d.ts → index-BNrz99xy.d.ts} +3 -3
  45. package/dist/{index-Bsx6XsC2.d.ts → index-BYQOPS8e.d.ts} +116 -62
  46. package/dist/{index-DUXfvhxs.d.ts → index-BkZ7SPLc.d.ts} +19 -29
  47. package/dist/{index-NlPMNcqh.d.ts → index-BnUku_aF.d.ts} +109 -114
  48. package/dist/{index-Stm5u0I0.d.ts → index-BtDAHMW_.d.ts} +9 -12
  49. package/dist/{index-BOiHR01C.d.ts → index-C-c_M_sE.d.ts} +10 -9
  50. package/dist/{index-DWt6yrIG.d.ts → index-CNIiC8Z_.d.ts} +11 -8
  51. package/dist/{index-DmudgrsN.d.ts → index-CbERNN3s.d.ts} +26 -16
  52. package/dist/{index-CxpFwGvR.d.ts → index-CsfxsN0t.d.ts} +4 -4
  53. package/dist/{index-CxA34wP1.d.ts → index-DASjaiJL.d.ts} +105 -19
  54. package/dist/{index-Bxzjy0d1.d.ts → index-DD7Vc4cE.d.ts} +2 -2
  55. package/dist/{index-DqXd1EeB.d.ts → index-DIc8OqWV.d.ts} +7 -6
  56. package/dist/{index-CnEbXm_t.d.ts → index-DVI_vggD.d.ts} +53 -12
  57. package/dist/{index-CPzvNmq9.d.ts → index-DqxQeYT2.d.ts} +39 -36
  58. package/dist/{index-CS65jqOq.d.ts → index-Dsf9FRtr.d.ts} +19 -3
  59. package/dist/{index-DFEnA6Wa.d.ts → index-DxAReMEO.d.ts} +34 -34
  60. package/dist/{index-U-zp70of.d.ts → index-UXRoZmd_.d.ts} +8 -12
  61. package/dist/{index-DwKr18CI.d.ts → index-isFvc5gd.d.ts} +2 -2
  62. package/dist/{index-BtWMBHeP.d.ts → index-j3nuJWyJ.d.ts} +13 -9
  63. package/dist/{index-C-745li7.d.ts → index-nVb7o0hc.d.ts} +2 -2
  64. package/dist/{index-D9LPlmbC.d.ts → index-pbE88Tt7.d.ts} +2 -2
  65. package/dist/index.d.ts +8 -8
  66. package/dist/index.js +9 -9
  67. package/dist/{inventory-Dd7TazvZ.js → inventory--t6Zu55O.js} +21 -18
  68. package/dist/inventory--t6Zu55O.js.map +1 -0
  69. package/dist/{listCollectiblesPaginated-Cy2_qEZA.d.ts → listCollectiblesPaginated-BlE5mSzh.d.ts} +32 -32
  70. package/dist/{listCollections-BB9FxKj2.d.ts → listCollections-DWyqFSQ3.d.ts} +143 -66
  71. package/dist/{looks-rare-6H--x3AM.js → looks-rare-2HBhMpOf.js} +1 -1
  72. package/dist/{looks-rare-6H--x3AM.js.map → looks-rare-2HBhMpOf.js.map} +1 -1
  73. package/dist/{lowestListing-Cbsi6M1K.d.ts → lowestListing-DsunDO1c.d.ts} +38 -28
  74. package/dist/{magic-eden-BoxEQ1Li.js → magic-eden-BYdTp-uk.js} +1 -1
  75. package/dist/{magic-eden-BoxEQ1Li.js.map → magic-eden-BYdTp-uk.js.map} +1 -1
  76. package/dist/{manifold-DycKsljb.js → manifold-yE0x6ZmO.js} +1 -1
  77. package/dist/{manifold-DycKsljb.js.map → manifold-yE0x6ZmO.js.map} +1 -1
  78. package/dist/{market-C3HV-awQ.js → market-DuBpFsDg.js} +27 -17
  79. package/dist/market-DuBpFsDg.js.map +1 -0
  80. package/dist/{marketCurrencies-Bpw1bIO0.d.ts → marketCurrencies-BgwmbGFk.d.ts} +20 -9
  81. package/dist/{marketCurrencies-sKrTX0og.js → marketCurrencies-Bolonndy.js} +13 -7
  82. package/dist/marketCurrencies-Bolonndy.js.map +1 -0
  83. package/dist/marketplace-NQB-sEQL.js.map +1 -1
  84. package/dist/{marketplace-logos-D4dS1Foy.js → marketplace-logos-Cz9RrtQo.js} +21 -21
  85. package/dist/marketplace-logos-Cz9RrtQo.js.map +1 -0
  86. package/dist/{marketplace.gen-ksUafDqS.js → marketplace.gen-906FrJQJ.js} +24 -5
  87. package/dist/marketplace.gen-906FrJQJ.js.map +1 -0
  88. package/dist/{marketplaceConfig-UHQMM9fq.js → marketplaceConfig-Bqjo7NYO.js} +8 -4
  89. package/dist/marketplaceConfig-Bqjo7NYO.js.map +1 -0
  90. package/dist/{mintify-Dyqyo8jQ.js → mintify-BXQx3mZB.js} +1 -1
  91. package/dist/{mintify-Dyqyo8jQ.js.map → mintify-BXQx3mZB.js.map} +1 -1
  92. package/dist/{network-DtmiMhcg.js → network-DwdZ_5-7.js} +2 -2
  93. package/dist/network-DwdZ_5-7.js.map +1 -0
  94. package/dist/{networkconfigToWagmiChain-DbUf6HiO.js → networkconfigToWagmiChain-Ct-hGq8M.js} +4 -3
  95. package/dist/networkconfigToWagmiChain-Ct-hGq8M.js.map +1 -0
  96. package/dist/{nftx-2LbFjj9Q.js → nftx-B929_3Ce.js} +1 -1
  97. package/dist/{nftx-2LbFjj9Q.js.map → nftx-B929_3Ce.js.map} +1 -1
  98. package/dist/{okx-CBEWJNsR.js → okx-sZ0-Udny.js} +1 -1
  99. package/dist/{okx-CBEWJNsR.js.map → okx-sZ0-Udny.js.map} +1 -1
  100. package/dist/{open-sea-Dxntz_PA.js → open-sea-DO9PhTrz.js} +1 -1
  101. package/dist/{open-sea-Dxntz_PA.js.map → open-sea-DO9PhTrz.js.map} +1 -1
  102. package/dist/{orders-DnFfZAXV.js → orders-DH76ym2e.js} +16 -9
  103. package/dist/orders-DH76ym2e.js.map +1 -0
  104. package/dist/primary-sale-1u4QlPdA.js.map +1 -1
  105. package/dist/{primary-sales-Dmsi6bqj.js → primary-sales-CECrqatg.js} +49 -7
  106. package/dist/primary-sales-CECrqatg.js.map +1 -0
  107. package/dist/{query-BWbCsXLY.d.ts → query-brXxOcH0.d.ts} +1 -1
  108. package/dist/{rarible-CS0SupHr.js → rarible-Ccb2hs7y.js} +1 -1
  109. package/dist/{rarible-CS0SupHr.js.map → rarible-Ccb2hs7y.js.map} +1 -1
  110. package/dist/react/_internal/api/index.d.ts +2 -2
  111. package/dist/react/_internal/api/index.js +6 -6
  112. package/dist/react/_internal/databeat/index.d.ts +1 -1
  113. package/dist/react/_internal/databeat/index.js +28 -29
  114. package/dist/react/_internal/index.d.ts +2 -2
  115. package/dist/react/_internal/index.js +8 -8
  116. package/dist/react/_internal/wagmi/index.d.ts +1 -1
  117. package/dist/react/_internal/wagmi/index.js +3 -3
  118. package/dist/react/hooks/config/index.d.ts +8 -8
  119. package/dist/react/hooks/config/index.js +28 -29
  120. package/dist/react/hooks/contracts/index.d.ts +6 -6
  121. package/dist/react/hooks/contracts/index.js +8 -8
  122. package/dist/react/hooks/data/collectibles/index.d.ts +10 -10
  123. package/dist/react/hooks/data/collectibles/index.js +28 -29
  124. package/dist/react/hooks/data/collections/index.d.ts +11 -11
  125. package/dist/react/hooks/data/collections/index.js +29 -30
  126. package/dist/react/hooks/data/index.d.ts +37 -37
  127. package/dist/react/hooks/data/index.js +29 -30
  128. package/dist/react/hooks/data/inventory/index.d.ts +36 -36
  129. package/dist/react/hooks/data/inventory/index.js +28 -29
  130. package/dist/react/hooks/data/market/index.d.ts +11 -11
  131. package/dist/react/hooks/data/market/index.js +28 -29
  132. package/dist/react/hooks/data/orders/index.d.ts +10 -10
  133. package/dist/react/hooks/data/orders/index.js +28 -29
  134. package/dist/react/hooks/data/primary-sales/index.d.ts +37 -37
  135. package/dist/react/hooks/data/primary-sales/index.js +29 -30
  136. package/dist/react/hooks/data/tokens/index.d.ts +4 -4
  137. package/dist/react/hooks/data/tokens/index.js +28 -29
  138. package/dist/react/hooks/index.d.ts +37 -37
  139. package/dist/react/hooks/index.js +29 -30
  140. package/dist/react/hooks/transactions/index.d.ts +2 -2
  141. package/dist/react/hooks/transactions/index.js +28 -29
  142. package/dist/react/hooks/ui/index.d.ts +4 -4
  143. package/dist/react/hooks/ui/index.js +28 -29
  144. package/dist/react/hooks/utils/index.d.ts +36 -36
  145. package/dist/react/hooks/utils/index.js +28 -29
  146. package/dist/react/index.d.ts +37 -37
  147. package/dist/react/index.js +29 -30
  148. package/dist/react/queries/collectibles/index.d.ts +10 -10
  149. package/dist/react/queries/collectibles/index.js +12 -13
  150. package/dist/react/queries/collections/index.d.ts +11 -11
  151. package/dist/react/queries/collections/index.js +11 -11
  152. package/dist/react/queries/index.d.ts +24 -24
  153. package/dist/react/queries/index.js +22 -23
  154. package/dist/react/queries/inventory/index.d.ts +2 -2
  155. package/dist/react/queries/inventory/index.js +12 -12
  156. package/dist/react/queries/market/index.d.ts +5 -5
  157. package/dist/react/queries/market/index.js +12 -12
  158. package/dist/react/queries/orders/index.d.ts +10 -10
  159. package/dist/react/queries/orders/index.js +8 -8
  160. package/dist/react/queries/primary-sales/index.d.ts +4 -4
  161. package/dist/react/queries/primary-sales/index.js +9 -9
  162. package/dist/react/queries/tokens/index.d.ts +4 -4
  163. package/dist/react/queries/tokens/index.js +8 -9
  164. package/dist/react/queries/utils/index.d.ts +3 -3
  165. package/dist/react/queries/utils/index.js +12 -12
  166. package/dist/react/ssr/index.d.ts +7 -7
  167. package/dist/react/ssr/index.js +8 -8
  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 +12 -12
  171. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +7 -10
  172. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +28 -29
  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 -29
  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 +8 -8
  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 +8 -8
  180. package/dist/react/ui/index.d.ts +4 -4
  181. package/dist/react/ui/index.js +28 -29
  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 -29
  184. package/dist/react/utils/index.d.ts +1 -1
  185. package/dist/react/utils/index.js +6 -6
  186. package/dist/{react-DE852KeT.js → react-CBsgOdVP.js} +608 -735
  187. package/dist/react-CBsgOdVP.js.map +1 -0
  188. package/dist/{sequence-paCCener.js → sequence-CRdb1yEs.js} +1 -1
  189. package/dist/{sequence-paCCener.js.map → sequence-CRdb1yEs.js.map} +1 -1
  190. package/dist/styles/index.css +1 -1
  191. package/dist/{sudo-swap-9rH2EgfT.js → sudo-swap-BIklG2gq.js} +1 -1
  192. package/dist/{sudo-swap-9rH2EgfT.js.map → sudo-swap-BIklG2gq.js.map} +1 -1
  193. package/dist/{super-rare-DHIuWtRw.js → super-rare-h8645_5E.js} +1 -1
  194. package/dist/{super-rare-DHIuWtRw.js.map → super-rare-h8645_5E.js.map} +1 -1
  195. package/dist/token-Cv7l2ZaL.js.map +1 -1
  196. package/dist/{tokenBalances-ibDerNmM.js → tokenBalances-CouzNX4j.js} +6 -12
  197. package/dist/tokenBalances-CouzNX4j.js.map +1 -0
  198. package/dist/{tokenSupplies-Bfe8RHzI.d.ts → tokenSupplies-C3zJll0M.d.ts} +32 -39
  199. package/dist/{tokens-cGxMadd8.js → tokens-BvIRUCGG.js} +58 -27
  200. package/dist/tokens-BvIRUCGG.js.map +1 -0
  201. package/dist/transaction-DZUW5RHu.js.map +1 -1
  202. package/dist/types/index.d.ts +1 -1
  203. package/dist/types/index.js +2 -2
  204. package/dist/types-B_-cnkcP.js.map +1 -1
  205. package/dist/{types-D2TJ1dwv.d.ts → types-CMDwfhfR.d.ts} +5 -5
  206. package/dist/utils/abi/index.d.ts +4 -4
  207. package/dist/utils/abi/marketplace/index.d.ts +1 -1
  208. package/dist/utils/abi/primary-sale/index.d.ts +1 -1
  209. package/dist/utils/abi/token/index.d.ts +1 -1
  210. package/dist/utils/index.d.ts +7 -7
  211. package/dist/utils/index.js +7 -7
  212. package/dist/{utils-BfpDVibN.js → utils-9ToOvt-c.js} +50 -7
  213. package/dist/utils-9ToOvt-c.js.map +1 -0
  214. package/dist/{utils-BqxcalL2.js → utils-B6di6O-C.js} +2 -2
  215. package/dist/utils-B6di6O-C.js.map +1 -0
  216. package/dist/{utils-BCgNhBFR.js → utils-BCYTEOvy.js} +17 -7
  217. package/dist/utils-BCYTEOvy.js.map +1 -0
  218. package/dist/{waitForTransactionReceipt-DieAnV52.js → waitForTransactionReceipt-CbSeUSXe.js} +5 -4
  219. package/dist/{waitForTransactionReceipt-DieAnV52.js.map → waitForTransactionReceipt-CbSeUSXe.js.map} +1 -1
  220. package/dist/{x2y2-45WDooeh.js → x2y2-OvF__ugj.js} +1 -1
  221. package/dist/{x2y2-45WDooeh.js.map → x2y2-OvF__ugj.js.map} +1 -1
  222. package/dist/{zora-CbeBoLvQ.js → zora-DzCeu-eE.js} +1 -1
  223. package/dist/{zora-CbeBoLvQ.js.map → zora-DzCeu-eE.js.map} +1 -1
  224. package/package.json +38 -38
  225. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +13 -0
  226. package/src/react/_internal/api/index.ts +0 -1
  227. package/src/react/_internal/api/marketplace.gen.ts +70 -26
  228. package/src/react/_internal/api/query-keys.ts +9 -0
  229. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +0 -9
  230. package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -16
  231. package/src/react/hooks/data/collectibles/useTokenBalances.tsx +0 -9
  232. package/src/react/hooks/data/collections/index.ts +2 -0
  233. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +112 -0
  234. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx +74 -0
  235. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +110 -0
  236. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx +74 -0
  237. package/src/react/hooks/data/inventory/useInventory.tsx +1 -10
  238. package/src/react/hooks/data/market/useMarketCurrencies.test.tsx +31 -2
  239. package/src/react/hooks/data/primary-sales/index.ts +1 -0
  240. package/src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx +71 -0
  241. package/src/react/hooks/data/tokens/useListBalances.tsx +1 -10
  242. package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -13
  243. package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +2 -0
  244. package/src/react/hooks/transactions/useProcessStep.test.tsx +8 -6
  245. package/src/react/hooks/transactions/useProcessStep.ts +8 -6
  246. package/src/react/hooks/utils/useComparePrices.test.tsx +1 -1
  247. package/src/react/providers/modal-provider.tsx +2 -1
  248. package/src/react/queries/collectibles/balanceOfCollectible.ts +1 -15
  249. package/src/react/queries/collectibles/listCollectibles.ts +1 -54
  250. package/src/react/queries/collectibles/tokenBalances.ts +1 -15
  251. package/src/react/queries/collections/activeListingsCurrencies.ts +84 -0
  252. package/src/react/queries/collections/activeOffersCurrencies.ts +84 -0
  253. package/src/react/queries/collections/index.ts +2 -0
  254. package/src/react/queries/inventory/inventory.ts +2 -9
  255. package/src/react/queries/market/marketCurrencies.ts +8 -1
  256. package/src/react/queries/primary-sales/index.ts +1 -0
  257. package/src/react/queries/primary-sales/primarySaleItem.ts +80 -0
  258. package/src/react/queries/tokens/listBalances.ts +1 -21
  259. package/src/react/queries/tokens/tokenSupplies.ts +2 -31
  260. package/src/react/queries/utils/comparePrices.ts +13 -1
  261. package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +2 -0
  262. package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +4 -18
  263. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +2 -2
  264. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +0 -2
  265. package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +3 -0
  266. package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +1 -0
  267. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +0 -23
  268. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +22 -2
  269. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +2 -0
  270. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +2 -0
  271. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +2 -0
  272. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +15 -12
  273. package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +2 -0
  274. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +1 -1
  275. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +148 -11
  276. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
  277. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +2 -0
  278. package/src/styles/styles.ts +1 -1
  279. package/src/utils/networkconfigToWagmiChain.ts +7 -0
  280. package/src/utils/price.ts +58 -0
  281. package/test/const.ts +2 -0
  282. package/test/server-setup.ts +0 -2
  283. package/.changeset/honest-peas-arrive.md +0 -5
  284. package/.changeset/real-tips-stick.md +0 -8
  285. package/.changeset/tall-pandas-wear.md +0 -8
  286. package/dist/BellIcon-ByhygxBO.js.map +0 -1
  287. package/dist/CartIcon-Bt3rQYGk.js.map +0 -1
  288. package/dist/CollectibleCard-CVpdgXA8.d.ts +0 -8
  289. package/dist/api-BoO0V5aJ.js.map +0 -1
  290. package/dist/builder-api-BFuZNOaN.js.map +0 -1
  291. package/dist/builder.gen-B9wR2nvF.js.map +0 -1
  292. package/dist/collectibles-C_H8jMGH.js.map +0 -1
  293. package/dist/collections-CKummc-R.js.map +0 -1
  294. package/dist/components-CosnX7F9.js.map +0 -1
  295. package/dist/create-config-CIfejoCk.js.map +0 -1
  296. package/dist/index-DNNUeZEq.d.ts +0 -18
  297. package/dist/inventory-Dd7TazvZ.js.map +0 -1
  298. package/dist/listBalances-BxpxBCvn.js +0 -57
  299. package/dist/listBalances-BxpxBCvn.js.map +0 -1
  300. package/dist/market-C3HV-awQ.js.map +0 -1
  301. package/dist/marketCurrencies-sKrTX0og.js.map +0 -1
  302. package/dist/marketplace-logos-D4dS1Foy.js.map +0 -1
  303. package/dist/marketplace.gen-ksUafDqS.js.map +0 -1
  304. package/dist/marketplaceConfig-UHQMM9fq.js.map +0 -1
  305. package/dist/network-DtmiMhcg.js.map +0 -1
  306. package/dist/networkconfigToWagmiChain-DbUf6HiO.js.map +0 -1
  307. package/dist/orders-DnFfZAXV.js.map +0 -1
  308. package/dist/primary-sales-Dmsi6bqj.js.map +0 -1
  309. package/dist/react-DE852KeT.js.map +0 -1
  310. package/dist/tokenBalances-ibDerNmM.js.map +0 -1
  311. package/dist/tokens-cGxMadd8.js.map +0 -1
  312. package/dist/utils-BCgNhBFR.js.map +0 -1
  313. package/dist/utils-BfpDVibN.js.map +0 -1
  314. package/dist/utils-BqxcalL2.js.map +0 -1
  315. package/src/react/_internal/api/__mocks__/laos.msw.ts +0 -387
  316. package/src/react/_internal/api/__tests__/laos-api.test.ts +0 -756
  317. package/src/react/_internal/api/laos-api.ts +0 -106
  318. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +0 -367
  319. package/src/react/queries/collectibles/__tests__/balanceOfCollectible.laos.test.ts +0 -123
  320. package/src/react/queries/collectibles/__tests__/tokenBalances.laos.test.ts +0 -123
  321. package/src/react/queries/inventory/__tests__/inventory.laos.test.ts +0 -499
  322. package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +0 -481
  323. /package/dist/{index-6wsMChsg.d.ts → index-CCggO_hw.d.ts} +0 -0
  324. /package/dist/{index-CZUtOTjh.d.ts → index-CKefEBrI.d.ts} +0 -0
  325. /package/dist/{index-DW3njUfb.d.ts → index-DgsCqh_P.d.ts} +0 -0
  326. /package/dist/{index-DewGsFz5.d.ts → index-xpO4AQyS.d.ts} +0 -0
  327. /package/dist/{queries-KOcILNJO.js → queries-CyajGg_O.js} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenBalances-ibDerNmM.js","names":[],"sources":["../src/react/queries/collectibles/tokenBalances.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 UseTokenBalancesArgs = {\n\tcollectionAddress: Address;\n\tuserAddress: Address | undefined;\n\tchainId: number;\n\tisLaos721?: boolean;\n\tincludeMetadata?: boolean;\n\tquery?: UseQueryParameters;\n};\n\n/**\n * Fetches the token balances 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 fetchTokenBalances(\n\targs: Omit<UseTokenBalancesArgs, '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 || [];\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\tincludeMetadata: args.includeMetadata ?? 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 || []);\n}\n\nexport function getTokenBalancesQueryKey(args: UseTokenBalancesArgs) {\n\tconst apiArgs = {\n\t\tchainId: args.chainId,\n\t\taccountAddress: args.userAddress,\n\t\tcontractAddress: args.collectionAddress,\n\t\tincludeMetadata: args.includeMetadata,\n\t\tmetadataOptions: args.userAddress\n\t\t\t? {\n\t\t\t\t\tverifiedOnly: true,\n\t\t\t\t\tincludeContracts: [args.collectionAddress],\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisLaos721: args.isLaos721,\n\t};\n\n\treturn [...collectableKeys.userBalances, apiArgs] as const;\n}\n\n/**\n * Creates a tanstack query options object for the token balances query\n *\n * @param args - The query arguments\n * @param config - SDK configuration\n * @returns Query options configuration\n */\nexport function tokenBalancesOptions(\n\targs: UseTokenBalancesArgs,\n\tconfig: SdkConfig,\n) {\n\tconst enabled =\n\t\t!!args.userAddress &&\n\t\t!!args.collectionAddress &&\n\t\t(args.query?.enabled ?? true);\n\n\treturn queryOptions({\n\t\tqueryKey: getTokenBalancesQueryKey(args),\n\t\tqueryFn: enabled\n\t\t\t? () =>\n\t\t\t\t\tfetchTokenBalances(\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"],"mappings":";;;;;;;;;;;AAsBA,eAAsB,mBACrB,MAGA,QACC;AACD,KAAI,KAAK,UASR,SAPiB,MADD,IAAI,SAAS,CACE,iBAAiB;EAC/C,SAAS,KAAK,QAAQ,UAAU;EAChC,iBAAiB,KAAK;EACtB,gBAAgB,KAAK;EACrB,iBAAiB;EACjB,CAAC,EAEc,YAAY,EAAE;AAI/B,QADsB,iBAAiB,KAAK,SAAS,OAAO,CAE1D,iBAAiB;EACjB,gBAAgB,KAAK;EACrB,iBAAiB,KAAK;EACtB,iBAAiB,KAAK,mBAAmB;EACzC,iBAAiB;GAChB,cAAc;GACd,kBAAkB,CAAC,KAAK,kBAAkB;GAC1C;EACD,CAAC,CACD,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;;AAGpC,SAAgB,yBAAyB,MAA4B;CACpE,MAAM,UAAU;EACf,SAAS,KAAK;EACd,gBAAgB,KAAK;EACrB,iBAAiB,KAAK;EACtB,iBAAiB,KAAK;EACtB,iBAAiB,KAAK,cACnB;GACA,cAAc;GACd,kBAAkB,CAAC,KAAK,kBAAkB;GAC1C,GACA;EACH,WAAW,KAAK;EAChB;AAED,QAAO,CAAC,GAAG,gBAAgB,cAAc,QAAQ;;;;;;;;;AAUlD,SAAgB,qBACf,MACA,QACC;CACD,MAAM,UACL,CAAC,CAAC,KAAK,eACP,CAAC,CAAC,KAAK,sBACN,KAAK,OAAO,WAAW;AAEzB,QAAO,aAAa;EACnB,UAAU,yBAAyB,KAAK;EACxC,SAAS,gBAEN,mBACC;GACC,GAAG;GAEH,aAAa,KAAK;GAClB,EACD,OACA,GACD;EACH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens-cGxMadd8.js","names":["apiArgs: GetTokenSuppliesArgs"],"sources":["../src/react/queries/tokens/getTokenRanges.ts","../src/react/queries/tokens/listTokenMetadata.ts","../src/react/queries/tokens/searchTokenMetadata.ts","../src/react/queries/tokens/tokenSupplies.ts"],"sourcesContent":["import type { GetTokenIDRangesReturn } from '@0xsequence/indexer';\nimport { queryOptions } from '@tanstack/react-query';\nimport type { Address } from 'viem';\nimport type { SdkConfig } from '../../../types';\nimport {\n\tgetIndexerClient,\n\ttokenKeys,\n\ttype ValuesOptional,\n} 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 getTokenRangesQueryKey(params: GetTokenRangesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId!,\n\t\tcontractAddress: params.collectionAddress!,\n\t};\n\n\treturn [...tokenKeys.ranges, apiArgs] as const;\n}\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: getTokenRangesQueryKey(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 { GetTokenMetadataArgs } from '@0xsequence/metadata';\nimport { queryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../../types';\nimport {\n\tgetMetadataClient,\n\ttype QueryKeyArgs,\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 getListTokenMetadataQueryKey(\n\tparams: ListTokenMetadataQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainID: String(params.chainId),\n\t\tcontractAddress: params.contractAddress,\n\t\ttokenIDs: params.tokenIds,\n\t} satisfies QueryKeyArgs<GetTokenMetadataArgs>;\n\n\treturn [...tokenKeys.metadata, apiArgs] as const;\n}\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: getListTokenMetadataQueryKey(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 type {\n\tFilter,\n\tPage,\n\tSearchTokenMetadataArgs,\n\tSearchTokenMetadataReturn,\n} from '@0xsequence/metadata';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport type { SdkConfig } from '../../../types';\nimport {\n\tgetMetadataClient,\n\ttype QueryKeyArgs,\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 getSearchTokenMetadataQueryKey(\n\tparams: SearchTokenMetadataQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainID: String(params.chainId!),\n\t\tcontractAddress: params.collectionAddress!,\n\t\tfilter: params.filter,\n\t} satisfies QueryKeyArgs<Omit<SearchTokenMetadataArgs, 'page'>>;\n\n\treturn [...tokenKeys.metadata, 'search', apiArgs] as const;\n}\n\nexport function searchTokenMetadataQueryOptions(\n\tparams: SearchTokenMetadataQueryOptions,\n) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\tconst initialPageParam = { page: 1, pageSize: 30 };\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: getSearchTokenMetadataQueryKey(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 getTokenSuppliesQueryKey(params: TokenSuppliesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId!,\n\t\tcontractAddress: params.collectionAddress!,\n\t\tincludeMetadata: params.includeMetadata,\n\t\tmetadataOptions: params.metadataOptions,\n\t\tisLaos721: params.isLaos721,\n\t};\n\n\treturn [...tokenKeys.supplies, apiArgs] as const;\n}\n\nexport function tokenSuppliesQueryOptions(params: TokenSuppliesQueryOptions) {\n\tconst enabled = Boolean(\n\t\tparams.chainId &&\n\t\t\tparams.collectionAddress &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\tconst initialPageParam = { 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: getTokenSuppliesQueryKey(params),\n\t\tqueryFn,\n\t\tinitialPageParam,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more ? lastPage.page : undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n}\n"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-BCgNhBFR.js","names":[],"sources":["../src/react/queries/utils/convertPriceToUSD.ts","../src/react/queries/utils/comparePrices.ts"],"sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { type Address, formatUnits } from 'viem';\nimport type { SdkConfig } from '../../../types';\nimport {\n\ttype Currency,\n\tcurrencyKeys,\n\tgetQueryClient,\n\ttype ValuesOptional,\n} from '../../_internal';\nimport type { StandardQueryOptions } from '../../types/query';\nimport { marketCurrenciesQueryOptions } from '../market/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 getConvertPriceToUSDQueryKey(\n\tparams: ConvertPriceToUSDQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId!,\n\t\tcurrencyAddress: params.currencyAddress!,\n\t\tamountRaw: params.amountRaw!,\n\t};\n\n\treturn [...currencyKeys.conversion, 'usd', apiArgs] as const;\n}\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: getConvertPriceToUSDQueryKey(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 { currencyKeys, 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 getComparePricesQueryKey(params: ComparePricesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId!,\n\t\tpriceAmountRaw: params.priceAmountRaw!,\n\t\tpriceCurrencyAddress: params.priceCurrencyAddress!,\n\t\tcompareToPriceAmountRaw: params.compareToPriceAmountRaw!,\n\t\tcompareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress!,\n\t};\n\n\treturn [...currencyKeys.conversion, 'compare', apiArgs] as const;\n}\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: getComparePricesQueryKey(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"],"mappings":";;;;;;;;;AA2BA,eAAsB,uBACrB,QACmC;CACnC,MAAM,EAAE,SAAS,iBAAiB,WAAW,WAAW;CAUxD,MAAM,mBAPc,MADA,gBAAgB,CACE,WACrC,6BAA6B;EAC5B;EACA;EACA,CAAC,CACF,EAEkC,MACjC,MACA,EAAE,gBAAgB,aAAa,KAAK,gBAAgB,aAAa,CAClE;AAED,KAAI,CAAC,gBACJ,OAAM,IAAI,MAAM,qBAAqB;CAMtC,MAAM,YAHgB,OACrB,YAAY,OAAO,UAAU,EAAE,gBAAgB,SAAS,CACxD,GACiC,gBAAgB;AAElD,QAAO;EACN;EACA,oBAAoB,UAAU,QAAQ,EAAE;EACxC;;AAQF,SAAgB,6BACf,QACC;CACD,MAAM,UAAU;EACf,SAAS,OAAO;EAChB,iBAAiB,OAAO;EACxB,WAAW,OAAO;EAClB;AAED,QAAO;EAAC,GAAG,aAAa;EAAY;EAAO;EAAQ;;AAGpD,SAAgB,8BACf,QACC;CACD,MAAM,UAAU,QACf,OAAO,WACN,OAAO,mBACP,OAAO,aACP,OAAO,WACN,OAAO,OAAO,WAAW,MAC3B;AAED,QAAO,aAAa;EACnB,UAAU,6BAA6B,OAAO;EAC9C,eACC,uBAAuB;GAEtB,SAAS,OAAO;GAEhB,iBAAiB,OAAO;GAExB,WAAW,OAAO;GAElB,QAAQ,OAAO;GACf,CAAC;EACH,GAAG,OAAO;EACV;EACA,CAAC;;;;;;;;AC5EH,eAAsB,mBACrB,QAC+B;CAC/B,MAAM,EACL,SACA,gBACA,sBACA,yBACA,+BACA,WACG;CAEJ,MAAM,CAAC,UAAU,qBAAqB,MAAM,QAAQ,IAAI,CACvD,uBAAuB;EACtB;EACA,iBAAiB;EACjB,WAAW;EACX;EACA,CAAC,EACF,uBAAuB;EACtB;EACA,iBAAiB;EACjB,WAAW;EACX;EACA,CAAC,CACF,CAAC;CAEF,MAAM,aAAa,SAAS,YAAY,kBAAkB;AAE1D,KAAI,kBAAkB,cAAc,EACnC,OAAM,IAAI,MAAM,+BAA+B;CAGhD,MAAM,uBAAwB,aAAa,kBAAkB,YAAa;CAC1E,MAAM,UAAU,uBAAuB;CACvC,MAAM,SAAS,yBAAyB;AAExC,QAAO;EACN;EACA,+BAA+B,KAAK,IAAI,qBAAqB,CAAC,QAAQ,EAAE;EACxE,QAAQ,UAAU,UAAU,SAAS,SAAS;EAC9C;;AAQF,SAAgB,yBAAyB,QAAmC;CAC3E,MAAM,UAAU;EACf,SAAS,OAAO;EAChB,gBAAgB,OAAO;EACvB,sBAAsB,OAAO;EAC7B,yBAAyB,OAAO;EAChC,+BAA+B,OAAO;EACtC;AAED,QAAO;EAAC,GAAG,aAAa;EAAY;EAAW;EAAQ;;AAGxD,SAAgB,0BAA0B,QAAmC;CAC5E,MAAM,UAAU,QACf,OAAO,WACN,OAAO,kBACP,OAAO,wBACP,OAAO,2BACP,OAAO,iCACP,OAAO,WACN,OAAO,OAAO,WAAW,MAC3B;AAED,QAAO,aAAa;EACnB,UAAU,yBAAyB,OAAO;EAC1C,eACC,mBAAmB;GAElB,SAAS,OAAO;GAEhB,gBAAgB,OAAO;GAEvB,sBAAsB,OAAO;GAE7B,yBAAyB,OAAO;GAEhC,+BAA+B,OAAO;GAEtC,QAAQ,OAAO;GACf,CAAC;EACH,GAAG,OAAO;EACV;EACA,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-BfpDVibN.js","names":["MARKETPLACES: Record<string, Marketplace>","KIND_TO_MARKETPLACE: Partial<\n\tRecord<MarketplaceKind, keyof typeof MARKETPLACES>\n>"],"sources":["../src/utils/address.ts","../src/utils/cn.ts","../src/utils/getMarketplaceDetails.ts","../src/utils/price.ts"],"sourcesContent":["export const truncateMiddle = (\n\taddress: string,\n\tminPrefix = 20,\n\tminSuffix = 3,\n): string => {\n\tif (minPrefix + minSuffix >= 40) {\n\t\treturn address;\n\t}\n\treturn `${address.substring(0, 2 + minPrefix)}…${address.substring(address.length - minSuffix)}`;\n};\n\nexport const truncateEnd = (text: string | undefined, truncateAt: number) => {\n\tif (!text) return '';\n\n\tlet finalText = text;\n\n\tif (text.length >= truncateAt) {\n\t\tfinalText = `${text.slice(0, truncateAt)}...`;\n\t}\n\n\treturn finalText;\n};\n\nexport const compareAddress = (a = '', b = '') => {\n\treturn a.toLowerCase() === b.toLowerCase();\n};\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import type { Image } from '@0xsequence/design-system';\nimport type { ComponentType } from 'react';\nimport {\n\tAlienSwapLogo,\n\tBlurLogo,\n\tLooksRareLogo,\n\tMagicEdenLogo,\n\tMintifyLogo,\n\tOpenSeaLogo,\n\tSequenceLogo,\n\tX2y2Logo,\n} from '../react/ui/components/marketplace-logos';\nimport { MarketplaceKind } from '../types';\n\ninterface Marketplace {\n\tlogo: ComponentType<React.ComponentProps<typeof Image>>;\n\tdisplayName: string;\n}\n\nconst MARKETPLACES: Record<string, Marketplace> = {\n\tsequence: {\n\t\tlogo: SequenceLogo,\n\t\tdisplayName: 'Sequence',\n\t},\n\topensea: {\n\t\tlogo: OpenSeaLogo,\n\t\tdisplayName: 'OpenSea',\n\t},\n\tmagiceden: {\n\t\tlogo: MagicEdenLogo,\n\t\tdisplayName: 'Magic Eden',\n\t},\n\tmintify: {\n\t\tlogo: MintifyLogo,\n\t\tdisplayName: 'Mintify',\n\t},\n\tlooksrare: {\n\t\tlogo: LooksRareLogo,\n\t\tdisplayName: 'Looks Rare',\n\t},\n\tx2y2: {\n\t\tlogo: X2y2Logo,\n\t\tdisplayName: 'X2Y2',\n\t},\n\tblur: {\n\t\tlogo: BlurLogo,\n\t\tdisplayName: 'Blur',\n\t},\n\talienswap: {\n\t\tlogo: AlienSwapLogo,\n\t\tdisplayName: 'AlienSwap',\n\t},\n} as const;\n\nconst KIND_TO_MARKETPLACE: Partial<\n\tRecord<MarketplaceKind, keyof typeof MARKETPLACES>\n> = {\n\t[MarketplaceKind.sequence_marketplace_v1]: 'sequence',\n\t[MarketplaceKind.sequence_marketplace_v2]: 'sequence',\n\t[MarketplaceKind.opensea]: 'opensea',\n\t[MarketplaceKind.mintify]: 'mintify',\n\t[MarketplaceKind.looks_rare]: 'looksrare',\n\t[MarketplaceKind.x2y2]: 'x2y2',\n\t[MarketplaceKind.blur]: 'blur',\n\t[MarketplaceKind.magic_eden]: 'magiceden',\n};\n\ntype MarketplaceDetailsProp = {\n\toriginName: string;\n\tkind: MarketplaceKind;\n};\n\n// TODO: add support for more marketplaces and improve detection of marketplace\nexport function getMarketplaceDetails({\n\toriginName,\n\tkind,\n}: MarketplaceDetailsProp) {\n\tif (\n\t\tkind === MarketplaceKind.sequence_marketplace_v1 ||\n\t\tkind === MarketplaceKind.sequence_marketplace_v2\n\t) {\n\t\treturn MARKETPLACES.sequence;\n\t}\n\n\tlet name = originName.toLowerCase();\n\n\ttry {\n\t\t//Check if the name can be parsed as a url\n\t\tnew URL(name);\n\t\t// if it can we are naively trying to extract the root domain\n\t\tname = getRootDomain(name) || name;\n\t} catch {}\n\n\tname = name.replace(/ /g, '');\n\n\tconst details = MARKETPLACES[name];\n\n\tif (details) {\n\t\treturn details;\n\t}\n\n\tif (KIND_TO_MARKETPLACE[kind]) {\n\t\treturn MARKETPLACES[KIND_TO_MARKETPLACE[kind]];\n\t}\n}\n\nfunction getRootDomain(url: string) {\n\tconst domain = url.replace(/^(https?:\\/\\/)?(www\\.)?/, '');\n\tconst parts = domain.split('.');\n\treturn parts[parts.length - 2] || parts[0];\n}\n","import * as dn from 'dnum';\nimport { formatUnits } from 'viem';\n\ntype CalculatePriceDifferencePercentageArgs = {\n\tinputPriceRaw: bigint;\n\tbasePriceRaw: bigint;\n\tdecimals: number;\n};\n\n/**\n * Calculates the percentage difference between two prices\n * @param args - Object containing input price, base price, and decimals\n * @returns The percentage difference as a string with 2 decimal places\n * @example\n * ```ts\n * const diff = calculatePriceDifferencePercentage({\n * inputPriceRaw: 1000000n,\n * basePriceRaw: 900000n,\n * decimals: 6\n * }); // Returns \"11.11\"\n * ```\n */\nexport const calculatePriceDifferencePercentage = ({\n\tinputPriceRaw,\n\tbasePriceRaw,\n\tdecimals,\n}: CalculatePriceDifferencePercentageArgs) => {\n\tconst inputPrice = Number(formatUnits(inputPriceRaw, decimals));\n\tconst basePrice = Number(formatUnits(basePriceRaw, decimals));\n\tconst difference = inputPrice - basePrice;\n\tconst percentageDifference = (difference / basePrice) * 100;\n\n\treturn percentageDifference.toFixed(2);\n};\n\n/**\n * Formats a raw price amount with the specified number of decimal places\n * @param amount - The raw price amount as a bigint\n * @param decimals - Number of decimal places to format to\n * @returns Formatted price string with proper decimal and thousands separators\n * @example\n * ```ts\n * const formatted = formatPrice(1000000n, 6); // Returns \"1.000000\"\n * ```\n */\nexport const formatPrice = (amount: bigint, decimals: number): string => {\n\tconst formattedUnits = Number(formatUnits(amount, decimals));\n\treturn formattedUnits.toLocaleString('en-US', {\n\t\tminimumFractionDigits: 0,\n\t\tmaximumFractionDigits: decimals,\n\t});\n};\n\n/**\n * Calculates the final earnings amount after applying multiple fee percentages\n * @param amount - The raw amount as a bigint (e.g., from a blockchain transaction)\n * @param decimals - The number of decimal places for the currency (e.g., 18 for ETH, 6 for USDC)\n * @param fees - Array of fee percentages to apply (e.g., [2.5, 1.0] for 2.5% and 1% fees)\n * @returns Formatted string representing the final earnings after all fees are applied\n * @throws Will return '0' if there's an error in calculation\n * @example\n * ```ts\n * const earnings = calculateEarningsAfterFees(\n * 1000000000000000000n, // 1 ETH\n * 18, // ETH decimals\n * [2.5, 1.0] // 2.5% and 1% fees\n * ); // Returns \"0.96525\" (1 ETH after 2.5% and 1% fees)\n * ```\n */\nexport const calculateEarningsAfterFees = (\n\tamount: bigint,\n\tdecimals: number,\n\tfees: number[],\n): string => {\n\ttry {\n\t\tconst decimalAmount = Number(formatUnits(amount, decimals));\n\t\tlet earnings = dn.from(decimalAmount.toString(), decimals);\n\n\t\tfor (const fee of fees) {\n\t\t\tif (fee > 0) {\n\t\t\t\tconst feeMultiplier = dn.from((1 - fee / 100).toString(), decimals);\n\t\t\t\tearnings = dn.multiply(earnings, feeMultiplier);\n\t\t\t}\n\t\t}\n\n\t\treturn dn.format(earnings, {\n\t\t\tdigits: decimals,\n\t\t\ttrailingZeros: false,\n\t\t\tlocale: 'en-US',\n\t\t});\n\t} catch (error) {\n\t\tconsole.error('Error calculating earnings after fees:', error);\n\t\treturn '0';\n\t}\n};\n\n/**\n * Formats a price amount with fee applied\n * @param amount - The raw price amount as a bigint\n * @param decimals - Number of decimal places for the currency\n * @param feePercentage - Fee percentage to apply (e.g., 3.5 for 3.5%)\n * @returns Formatted price string with fee applied and proper decimal/thousands separators\n * @example\n * ```ts\n * const priceWithFee = formatPriceWithFee(1000000n, 6, 3.5); // Returns \"1.035\"\n * ```\n */\nexport const formatPriceWithFee = (\n\tamount: bigint,\n\tdecimals: number,\n\tfeePercentage: number,\n): string => {\n\ttry {\n\t\tconst decimalAmount = Number(formatUnits(amount, decimals));\n\t\tconst price = dn.from(decimalAmount.toString(), decimals);\n\t\tconst feeMultiplier = dn.from(\n\t\t\t(1 + feePercentage / 100).toString(),\n\t\t\tdecimals,\n\t\t);\n\t\tconst totalPrice = dn.multiply(price, feeMultiplier);\n\n\t\treturn dn.format(totalPrice, {\n\t\t\tdigits: decimals,\n\t\t\ttrailingZeros: false,\n\t\t\tlocale: 'en-US',\n\t\t});\n\t} catch (error) {\n\t\tconsole.error('Error formatting price with fee:', error);\n\t\treturn '0';\n\t}\n};\n"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-BqxcalL2.js","names":[],"sources":["../src/react/ui/components/marketplace-collectible-card/utils/formatPrice.ts","../src/react/ui/components/marketplace-collectible-card/utils/supplyStatus.ts"],"sourcesContent":["import { formatUnits } from 'viem';\n\nexport const OVERFLOW_PRICE = 100000000;\nexport const UNDERFLOW_PRICE = 0.0001;\n\nexport const formatPriceNumber = (\n\tamount: string,\n\tdecimals: number,\n): {\n\tformattedNumber: string;\n\tisUnderflow: boolean;\n\tisOverflow: boolean;\n} => {\n\tconst formattedPrice = formatUnits(BigInt(amount), decimals);\n\tconst numericPrice = Number.parseFloat(formattedPrice);\n\n\tif (numericPrice < UNDERFLOW_PRICE) {\n\t\treturn {\n\t\t\tformattedNumber: UNDERFLOW_PRICE.toString(),\n\t\t\tisUnderflow: true,\n\t\t\tisOverflow: false,\n\t\t};\n\t}\n\n\tif (numericPrice > OVERFLOW_PRICE) {\n\t\treturn {\n\t\t\tformattedNumber: OVERFLOW_PRICE.toLocaleString('en-US', {\n\t\t\t\tmaximumFractionDigits: 2,\n\t\t\t}),\n\t\t\tisUnderflow: false,\n\t\t\tisOverflow: true,\n\t\t};\n\t}\n\n\tconst maxDecimals = numericPrice < 0.01 ? 6 : 4;\n\n\treturn {\n\t\tformattedNumber: numericPrice.toLocaleString('en-US', {\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: maxDecimals,\n\t\t}),\n\t\tisUnderflow: false,\n\t\tisOverflow: false,\n\t};\n};\n","import { ContractType } from '../../../../_internal';\n\nexport const getSupplyStatusText = ({\n\tquantityRemaining,\n\tcollectionType,\n\tunlimitedSupply,\n}: {\n\tquantityRemaining: string | undefined;\n\tcollectionType: ContractType;\n\tunlimitedSupply?: boolean;\n}): string => {\n\tif (unlimitedSupply) {\n\t\treturn 'Unlimited Supply';\n\t}\n\n\tif (\n\t\tcollectionType === ContractType.ERC721 &&\n\t\tquantityRemaining === undefined\n\t) {\n\t\treturn 'Out of stock';\n\t}\n\n\tif (\n\t\tcollectionType === ContractType.ERC1155 &&\n\t\t!unlimitedSupply &&\n\t\tquantityRemaining === '0'\n\t) {\n\t\treturn 'Out of stock';\n\t}\n\n\tif (quantityRemaining && Number(quantityRemaining) > 0) {\n\t\treturn `Supply: ${quantityRemaining}`;\n\t}\n\n\treturn 'Out of stock';\n};\n"],"mappings":";;;;AAEA,MAAa,iBAAiB;AAC9B,MAAa,kBAAkB;AAE/B,MAAa,qBACZ,QACA,aAKI;CACJ,MAAM,iBAAiB,YAAY,OAAO,OAAO,EAAE,SAAS;CAC5D,MAAM,eAAe,OAAO,WAAW,eAAe;AAEtD,KAAI,eAAe,gBAClB,QAAO;EACN,iBAAiB,gBAAgB,UAAU;EAC3C,aAAa;EACb,YAAY;EACZ;AAGF,KAAI,eAAe,eAClB,QAAO;EACN,iBAAiB,eAAe,eAAe,SAAS,EACvD,uBAAuB,GACvB,CAAC;EACF,aAAa;EACb,YAAY;EACZ;CAGF,MAAM,cAAc,eAAe,MAAO,IAAI;AAE9C,QAAO;EACN,iBAAiB,aAAa,eAAe,SAAS;GACrD,uBAAuB;GACvB,uBAAuB;GACvB,CAAC;EACF,aAAa;EACb,YAAY;EACZ;;;;;ACzCF,MAAa,uBAAuB,EACnC,mBACA,gBACA,sBAKa;AACb,KAAI,gBACH,QAAO;AAGR,KACC,mBAAmB,aAAa,UAChC,sBAAsB,OAEtB,QAAO;AAGR,KACC,mBAAmB,aAAa,WAChC,CAAC,mBACD,sBAAsB,IAEtB,QAAO;AAGR,KAAI,qBAAqB,OAAO,kBAAkB,GAAG,EACpD,QAAO,WAAW;AAGnB,QAAO"}
@@ -1,387 +0,0 @@
1
- import type {
2
- GetTokenBalancesReturn,
3
- GetTokenSuppliesReturn,
4
- } from '@0xsequence/indexer';
5
- import { ResourceStatus } from '@0xsequence/metadata';
6
- import { HttpResponse, http } from 'msw';
7
-
8
- const mockTokenSuppliesResponse: GetTokenSuppliesReturn = {
9
- page: {
10
- pageSize: 50,
11
- more: false,
12
- sort: [
13
- {
14
- column: 'CREATED_AT',
15
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
16
- order: 'DESC' as any,
17
- },
18
- ],
19
- },
20
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
21
- contractType: 'LAOS-ERC-721' as any,
22
- tokenIDs: [
23
- {
24
- tokenID: '1',
25
- supply: '1000',
26
- chainId: 11155111,
27
- contractInfo: {
28
- chainId: 11155111,
29
- address: '0x1234567890123456789012345678901234567890',
30
- name: 'Test LAOS Collection',
31
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
32
- type: 'LAOS-ERC-721' as any,
33
- symbol: 'TLC',
34
- decimals: 0,
35
- logoURI: 'https://example.com/logo.png',
36
- deployed: true,
37
- bytecodeHash: '0xhash123',
38
- source: 'laos',
39
- updatedAt: '2023-01-01T00:00:00.000Z',
40
- status: ResourceStatus.AVAILABLE,
41
- // @ts-expect-error - LAOS extensions
42
- extensions: {
43
- link: 'https://example.com',
44
- description: 'Test LAOS collection for testing',
45
- ogImage: 'https://example.com/og.png',
46
- originChainId: 11155111,
47
- originAddress: '0x1234567890123456789012345678901234567890',
48
- categories: [],
49
- ogName: 'LAOS Test',
50
- },
51
- },
52
-
53
- tokenMetadata: {
54
- tokenId: '1',
55
- contractAddress: '0x1234567890123456789012345678901234567890',
56
- name: 'Test Token 1',
57
- description: 'A test token for LAOS testing',
58
- image: 'https://example.com/token1.png',
59
- decimals: 0,
60
- properties: {},
61
- attributes: [
62
- {
63
- trait_type: 'Rarity',
64
- value: 'Common',
65
- },
66
- ],
67
- source: '',
68
- status: ResourceStatus.NOT_AVAILABLE,
69
- },
70
- },
71
- {
72
- tokenID: '2',
73
- supply: '500',
74
- chainId: 11155111,
75
- contractInfo: {
76
- chainId: 11155111,
77
- address: '0x1234567890123456789012345678901234567890',
78
- name: 'Test LAOS Collection',
79
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
80
- type: 'LAOS-ERC-721' as any,
81
- symbol: 'TLC',
82
- decimals: 0,
83
- logoURI: 'https://example.com/logo.png',
84
- deployed: true,
85
- bytecodeHash: '0xhash123',
86
- source: 'laos',
87
- updatedAt: '2023-01-01T00:00:00.000Z',
88
- status: ResourceStatus.AVAILABLE,
89
- extensions: {
90
- link: 'https://example.com',
91
- description: 'Test LAOS collection for testing',
92
- ogImage: 'https://example.com/og.png',
93
- originChainId: 11155111,
94
- originAddress: '0x1234567890123456789012345678901234567890',
95
- categories: [],
96
- ogName: 'LAOS Test',
97
- blacklist: false,
98
- verified: true,
99
- verifiedBy: 'system',
100
- featured: false,
101
- featureIndex: 0,
102
- },
103
- },
104
- tokenMetadata: {
105
- tokenId: '2',
106
- contractAddress: '0x1234567890123456789012345678901234567890',
107
- name: 'Test Token 2',
108
- description: 'Another test token for LAOS testing',
109
- image: 'https://example.com/token2.png',
110
- decimals: 0,
111
- properties: {},
112
- attributes: [
113
- {
114
- trait_type: 'Rarity',
115
- value: 'Rare',
116
- },
117
- ],
118
- source: '',
119
- status: ResourceStatus.NOT_AVAILABLE,
120
- },
121
- },
122
- ],
123
- };
124
-
125
- const mockTokenBalancesResponse: GetTokenBalancesReturn = {
126
- page: {
127
- pageSize: 50,
128
- more: false,
129
- sort: [
130
- {
131
- column: 'CREATED_AT',
132
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
133
- order: 'DESC' as any,
134
- },
135
- ],
136
- },
137
- balances: [
138
- {
139
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
140
- contractType: 'LAOS-ERC-721' as any,
141
- contractAddress: '0x1234567890123456789012345678901234567890',
142
- accountAddress: '0xuser1234567890123456789012345678901234567890',
143
- tokenID: '1',
144
- balance: '5',
145
- blockHash: '0xblock123',
146
- blockNumber: 12345,
147
- chainId: 11155111,
148
- uniqueCollectibles: '1',
149
- isSummary: false,
150
- contractInfo: {
151
- chainId: 11155111,
152
- address: '0x1234567890123456789012345678901234567890',
153
- name: 'Test LAOS Collection',
154
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
155
- type: 'LAOS-ERC-721' as any,
156
- symbol: 'TLC',
157
- decimals: 0,
158
- logoURI: 'https://example.com/logo.png',
159
- deployed: true,
160
- bytecodeHash: '0xhash123',
161
- source: 'laos',
162
- updatedAt: '2023-01-01T00:00:00.000Z',
163
- status: ResourceStatus.AVAILABLE,
164
- extensions: {
165
- link: 'https://example.com',
166
- description: 'Test LAOS collection for testing',
167
- ogImage: 'https://example.com/og.png',
168
- originChainId: 11155111,
169
- originAddress: '0x1234567890123456789012345678901234567890',
170
- categories: [],
171
- ogName: 'LAOS Test',
172
- blacklist: false,
173
- verified: true,
174
- verifiedBy: 'system',
175
- featured: false,
176
- featureIndex: 0,
177
- },
178
- },
179
- tokenMetadata: {
180
- tokenId: '1',
181
- contractAddress: '0x1234567890123456789012345678901234567890',
182
- name: 'Test Token 1',
183
- description: 'A test token for LAOS testing',
184
- image: 'https://example.com/token1.png',
185
- decimals: 0,
186
- properties: {},
187
- source: 'onchain',
188
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
189
- status: 'verified' as any,
190
- attributes: [
191
- {
192
- trait_type: 'Rarity',
193
- value: 'Common',
194
- },
195
- ],
196
- },
197
- },
198
- {
199
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
200
- contractType: 'LAOS-ERC-721' as any,
201
- contractAddress: '0x1234567890123456789012345678901234567890',
202
- accountAddress: '0xuser1234567890123456789012345678901234567890',
203
- tokenID: '2',
204
- balance: '2',
205
- blockHash: '0xblock124',
206
- blockNumber: 12346,
207
- chainId: 11155111,
208
- uniqueCollectibles: '1',
209
- isSummary: false,
210
- contractInfo: {
211
- chainId: 11155111,
212
- address: '0x1234567890123456789012345678901234567890',
213
- name: 'Test LAOS Collection',
214
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
215
- type: 'LAOS-ERC-721' as any,
216
- symbol: 'TLC',
217
- decimals: 0,
218
- logoURI: 'https://example.com/logo.png',
219
- deployed: true,
220
- bytecodeHash: '0xhash123',
221
- source: 'laos',
222
- updatedAt: '2023-01-01T00:00:00.000Z',
223
- status: ResourceStatus.AVAILABLE,
224
- extensions: {
225
- link: 'https://example.com',
226
- description: 'Test LAOS collection for testing',
227
- ogImage: 'https://example.com/og.png',
228
- originChainId: 11155111,
229
- originAddress: '0x1234567890123456789012345678901234567890',
230
- categories: [],
231
- ogName: 'LAOS Test',
232
- blacklist: false,
233
- verified: true,
234
- verifiedBy: 'system',
235
- featured: false,
236
- featureIndex: 0,
237
- },
238
- },
239
- tokenMetadata: {
240
- tokenId: '2',
241
- contractAddress: '0x1234567890123456789012345678901234567890',
242
- name: 'Test Token 2',
243
- description: 'Another test token for LAOS testing',
244
- image: 'https://example.com/token2.png',
245
- decimals: 0,
246
- properties: {},
247
- attributes: [
248
- {
249
- trait_type: 'Rarity',
250
- value: 'Rare',
251
- },
252
- ],
253
- source: '',
254
- status: ResourceStatus.NOT_AVAILABLE,
255
- },
256
- },
257
- ],
258
- };
259
-
260
- export const laosHandlers = [
261
- // Mock GetTokenSupplies endpoint
262
- http.post(
263
- 'https://extensions.api.laosnetwork.io/token/GetTokenSupplies',
264
- async ({ request }) => {
265
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
266
- const body = (await request.json()) as Record<string, any>;
267
-
268
- // Handle error scenarios for testing
269
- if (
270
- body.contractAddress === '0x0000000000000000000000000000000000000000'
271
- ) {
272
- return new HttpResponse(null, { status: 404 });
273
- }
274
-
275
- if (
276
- body.contractAddress === '0x0000000000000000000000000000000000000001'
277
- ) {
278
- return new HttpResponse('Internal Server Error', { status: 500 });
279
- }
280
-
281
- if (
282
- body.contractAddress === '0x0000000000000000000000000000000000000002'
283
- ) {
284
- return new HttpResponse('Bad Request', { status: 400 });
285
- }
286
-
287
- // Handle empty results for testing
288
- if (
289
- body.contractAddress === '0x0000000000000000000000000000000000000003'
290
- ) {
291
- return HttpResponse.json({
292
- ...mockTokenSuppliesResponse,
293
- tokenIDs: [],
294
- });
295
- }
296
-
297
- // Handle pagination testing
298
- if (body.page?.sort?.[0]?.order === 'ASC') {
299
- const reversedSupplies = [
300
- ...mockTokenSuppliesResponse.tokenIDs,
301
- ].reverse();
302
- return HttpResponse.json({
303
- ...mockTokenSuppliesResponse,
304
- tokenIDs: reversedSupplies,
305
- page: {
306
- ...mockTokenSuppliesResponse.page,
307
- sort: [
308
- {
309
- column: 'CREATED_AT',
310
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
311
- order: 'ASC' as any,
312
- },
313
- ],
314
- },
315
- });
316
- }
317
-
318
- // Default successful response
319
- return HttpResponse.json(mockTokenSuppliesResponse);
320
- },
321
- ),
322
-
323
- // Mock GetTokenBalances endpoint
324
- http.post(
325
- 'https://extensions.api.laosnetwork.io/token/GetTokenBalances',
326
- async ({ request }) => {
327
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
328
- const body = (await request.json()) as Record<string, any>;
329
-
330
- // Handle error scenarios for testing
331
- if (
332
- body.accountAddress === '0x0000000000000000000000000000000000000000'
333
- ) {
334
- return new HttpResponse(null, { status: 404 });
335
- }
336
-
337
- if (
338
- body.accountAddress === '0x0000000000000000000000000000000000000001'
339
- ) {
340
- return new HttpResponse('Internal Server Error', { status: 500 });
341
- }
342
-
343
- if (
344
- body.accountAddress === '0x0000000000000000000000000000000000000002'
345
- ) {
346
- return new HttpResponse('Bad Request', { status: 400 });
347
- }
348
-
349
- // Handle empty balances for testing
350
- if (
351
- body.accountAddress === '0x0000000000000000000000000000000000000003'
352
- ) {
353
- return HttpResponse.json({
354
- ...mockTokenBalancesResponse,
355
- balances: [],
356
- });
357
- }
358
-
359
- // Handle pagination testing
360
- if (body.page?.sort?.[0]?.order === 'ASC') {
361
- const reversedBalances = [
362
- ...mockTokenBalancesResponse.balances,
363
- ].reverse();
364
- return HttpResponse.json({
365
- ...mockTokenBalancesResponse,
366
- balances: reversedBalances,
367
- page: {
368
- ...mockTokenBalancesResponse.page,
369
- sort: [
370
- {
371
- column: 'CREATED_AT',
372
- // biome-ignore lint/suspicious/noExplicitAny: Mock data requires any type for LAOS extensions
373
- order: 'ASC' as any,
374
- },
375
- ],
376
- },
377
- });
378
- }
379
-
380
- // Default successful response
381
- return HttpResponse.json(mockTokenBalancesResponse);
382
- },
383
- ),
384
- ];
385
-
386
- // Export mock data for use in tests
387
- export { mockTokenSuppliesResponse, mockTokenBalancesResponse };