@0xsequence/marketplace-sdk 1.1.1 → 1.2.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 (381) hide show
  1. package/CHANGELOG.md +54 -3
  2. package/dist/{BellIcon-ByhygxBO.js → BellIcon.js} +4 -4
  3. package/dist/BellIcon.js.map +1 -0
  4. package/dist/{CartIcon-Bt3rQYGk.js → CartIcon.js} +7 -7
  5. package/dist/CartIcon.js.map +1 -0
  6. package/dist/CollectibleCard.d.ts +8 -0
  7. package/dist/{_internal-DkS2VUn5.js → _internal.js} +2 -2
  8. package/dist/_internal.js.map +1 -0
  9. package/dist/{abi-fa-o9gH3.js → abi.js} +2 -2
  10. package/dist/abi.js.map +1 -0
  11. package/dist/{alien_swap-DoY6XfMA.js → alien_swap.js} +1 -1
  12. package/dist/alien_swap.js.map +1 -0
  13. package/dist/{api-BoO0V5aJ.js → api.js} +13 -64
  14. package/dist/api.js.map +1 -0
  15. package/dist/{aqua-xyz-BBDxnG14.js → aqua-xyz.js} +1 -1
  16. package/dist/aqua-xyz.js.map +1 -0
  17. package/dist/{aura-DGx2zwvF.js → aura.js} +1 -1
  18. package/dist/aura.js.map +1 -0
  19. package/dist/{blur-D8GKrRrq.js → blur.js} +1 -1
  20. package/dist/blur.js.map +1 -0
  21. package/dist/{builder-api-BFuZNOaN.js → builder-api.js} +3 -3
  22. package/dist/builder-api.js.map +1 -0
  23. package/dist/{builder.gen-B9wR2nvF.js → builder.gen.js} +3 -6
  24. package/dist/builder.gen.js.map +1 -0
  25. package/dist/{coinbase-DOry4PXY.js → coinbase.js} +1 -1
  26. package/dist/coinbase.js.map +1 -0
  27. package/dist/{collectibles-C_H8jMGH.js → collectibles.js} +9 -48
  28. package/dist/collectibles.js.map +1 -0
  29. package/dist/{collections-CKummc-R.js → collections.js} +79 -8
  30. package/dist/collections.js.map +1 -0
  31. package/dist/{components-CosnX7F9.js → components.js} +12 -14
  32. package/dist/components.js.map +1 -0
  33. package/dist/{contracts-BP_0vX48.js → contracts.js} +4 -4
  34. package/dist/contracts.js.map +1 -0
  35. package/dist/{create-config-ZOB7i4ZJ.d.ts → create-config.d.ts} +47 -60
  36. package/dist/{create-config-CIfejoCk.js → create-config.js} +10 -13
  37. package/dist/create-config.js.map +1 -0
  38. package/dist/{element-ciybd_VF.js → element.js} +1 -1
  39. package/dist/element.js.map +1 -0
  40. package/dist/{filters-V-V8Dn8f.d.ts → filters.d.ts} +7 -7
  41. package/dist/{foundation-Bq4lRz4x.js → foundation.js} +1 -1
  42. package/dist/foundation.js.map +1 -0
  43. package/dist/index.d.ts +8 -8
  44. package/dist/index.js +16 -16
  45. package/dist/{index-DUXfvhxs.d.ts → index10.d.ts} +14 -29
  46. package/dist/{index-CxA34wP1.d.ts → index11.d.ts} +101 -23
  47. package/dist/{index-BtWMBHeP.d.ts → index12.d.ts} +11 -9
  48. package/dist/{index-DmudgrsN.d.ts → index13.d.ts} +16 -16
  49. package/dist/{index-U-zp70of.d.ts → index14.d.ts} +9 -13
  50. package/dist/{index-Stm5u0I0.d.ts → index16.d.ts} +7 -10
  51. package/dist/{index-BZIJTQT0.d.ts → index17.d.ts} +9 -9
  52. package/dist/{index-CnEbXm_t.d.ts → index19.d.ts} +50 -12
  53. package/dist/{index-C-745li7.d.ts → index2.d.ts} +2 -2
  54. package/dist/{index-BOiHR01C.d.ts → index21.d.ts} +9 -9
  55. package/dist/{index-Bsx6XsC2.d.ts → index23.d.ts} +100 -59
  56. package/dist/{index-CPzvNmq9.d.ts → index24.d.ts} +36 -36
  57. package/dist/{index-DFEnA6Wa.d.ts → index25.d.ts} +18 -18
  58. package/dist/{index-DqXd1EeB.d.ts → index26.d.ts} +14 -7
  59. package/dist/{index-NlPMNcqh.d.ts → index27.d.ts} +102 -114
  60. package/dist/{index-DWt6yrIG.d.ts → index28.d.ts} +8 -8
  61. package/dist/{index-C4MUKshG.d.ts → index29.d.ts} +3 -3
  62. package/dist/{index-BeRV-7AX.d.ts → index3.d.ts} +2 -2
  63. package/dist/{index-Bxzjy0d1.d.ts → index4.d.ts} +2 -2
  64. package/dist/{index-DwKr18CI.d.ts → index5.d.ts} +2 -2
  65. package/dist/{index-D9LPlmbC.d.ts → index6.d.ts} +2 -2
  66. package/dist/{index-CS65jqOq.d.ts → index7.d.ts} +19 -3
  67. package/dist/index8.d.ts +18 -0
  68. package/dist/{index-CxpFwGvR.d.ts → index9.d.ts} +4 -4
  69. package/dist/{inventory-Dd7TazvZ.js → inventory.js} +11 -15
  70. package/dist/inventory.js.map +1 -0
  71. package/dist/{listCollectiblesPaginated-Cy2_qEZA.d.ts → listCollectiblesPaginated.d.ts} +24 -29
  72. package/dist/{listCollections-BB9FxKj2.d.ts → listCollections.d.ts} +170 -100
  73. package/dist/{looks-rare-6H--x3AM.js → looks-rare.js} +1 -1
  74. package/dist/looks-rare.js.map +1 -0
  75. package/dist/{lowestListing-Cbsi6M1K.d.ts → lowestListing.d.ts} +28 -28
  76. package/dist/{magic-eden-BoxEQ1Li.js → magic-eden.js} +1 -1
  77. package/dist/magic-eden.js.map +1 -0
  78. package/dist/{manifold-DycKsljb.js → manifold.js} +1 -1
  79. package/dist/manifold.js.map +1 -0
  80. package/dist/{market-C3HV-awQ.js → market.js} +7 -9
  81. package/dist/market.js.map +1 -0
  82. package/dist/{marketCurrencies-Bpw1bIO0.d.ts → marketCurrencies.d.ts} +19 -9
  83. package/dist/{marketCurrencies-sKrTX0og.js → marketCurrencies.js} +10 -7
  84. package/dist/marketCurrencies.js.map +1 -0
  85. package/dist/{marketplace-logos-D4dS1Foy.js → marketplace-logos.js} +23 -23
  86. package/dist/marketplace-logos.js.map +1 -0
  87. package/dist/{marketplace.gen-ksUafDqS.js → marketplace.gen.js} +25 -9
  88. package/dist/marketplace.gen.js.map +1 -0
  89. package/dist/{marketplace-NQB-sEQL.js → marketplace.js} +2 -2
  90. package/dist/marketplace.js.map +1 -0
  91. package/dist/{marketplaceConfig-UHQMM9fq.js → marketplaceConfig.js} +3 -3
  92. package/dist/marketplaceConfig.js.map +1 -0
  93. package/dist/{mintify-Dyqyo8jQ.js → mintify.js} +1 -1
  94. package/dist/mintify.js.map +1 -0
  95. package/dist/{network-DtmiMhcg.js → network.js} +3 -3
  96. package/dist/network.js.map +1 -0
  97. package/dist/{networkconfigToWagmiChain-DbUf6HiO.js → networkconfigToWagmiChain.js} +4 -3
  98. package/dist/networkconfigToWagmiChain.js.map +1 -0
  99. package/dist/{nftx-2LbFjj9Q.js → nftx.js} +1 -1
  100. package/dist/nftx.js.map +1 -0
  101. package/dist/{okx-CBEWJNsR.js → okx.js} +1 -1
  102. package/dist/okx.js.map +1 -0
  103. package/dist/{open-sea-Dxntz_PA.js → open-sea.js} +1 -1
  104. package/dist/open-sea.js.map +1 -0
  105. package/dist/{orders-DnFfZAXV.js → orders.js} +10 -10
  106. package/dist/orders.js.map +1 -0
  107. package/dist/{primary-sale-1u4QlPdA.js → primary-sale.js} +2 -2
  108. package/dist/primary-sale.js.map +1 -0
  109. package/dist/{primary-sales-Dmsi6bqj.js → primary-sales.js} +41 -3
  110. package/dist/primary-sales.js.map +1 -0
  111. package/dist/{query-BWbCsXLY.d.ts → query.d.ts} +2 -2
  112. package/dist/{rarible-CS0SupHr.js → rarible.js} +1 -1
  113. package/dist/rarible.js.map +1 -0
  114. package/dist/react/_internal/api/index.d.ts +2 -2
  115. package/dist/react/_internal/api/index.js +7 -7
  116. package/dist/react/_internal/databeat/index.d.ts +1 -1
  117. package/dist/react/_internal/databeat/index.js +37 -38
  118. package/dist/react/_internal/index.d.ts +2 -2
  119. package/dist/react/_internal/index.js +11 -11
  120. package/dist/react/_internal/wagmi/index.d.ts +1 -1
  121. package/dist/react/_internal/wagmi/index.js +5 -5
  122. package/dist/react/hooks/config/index.d.ts +8 -8
  123. package/dist/react/hooks/config/index.js +37 -38
  124. package/dist/react/hooks/contracts/index.d.ts +6 -6
  125. package/dist/react/hooks/contracts/index.js +15 -15
  126. package/dist/react/hooks/data/collectibles/index.d.ts +4 -10
  127. package/dist/react/hooks/data/collectibles/index.js +37 -38
  128. package/dist/react/hooks/data/collections/index.d.ts +11 -11
  129. package/dist/react/hooks/data/collections/index.js +38 -39
  130. package/dist/react/hooks/data/index.d.ts +37 -37
  131. package/dist/react/hooks/data/index.js +38 -39
  132. package/dist/react/hooks/data/inventory/index.d.ts +36 -36
  133. package/dist/react/hooks/data/inventory/index.js +37 -38
  134. package/dist/react/hooks/data/market/index.d.ts +5 -11
  135. package/dist/react/hooks/data/market/index.js +37 -38
  136. package/dist/react/hooks/data/orders/index.d.ts +4 -10
  137. package/dist/react/hooks/data/orders/index.js +37 -38
  138. package/dist/react/hooks/data/primary-sales/index.d.ts +37 -37
  139. package/dist/react/hooks/data/primary-sales/index.js +38 -39
  140. package/dist/react/hooks/data/tokens/index.d.ts +4 -4
  141. package/dist/react/hooks/data/tokens/index.js +37 -38
  142. package/dist/react/hooks/index.d.ts +37 -37
  143. package/dist/react/hooks/index.js +38 -39
  144. package/dist/react/hooks/transactions/index.d.ts +2 -2
  145. package/dist/react/hooks/transactions/index.js +37 -38
  146. package/dist/react/hooks/ui/index.d.ts +4 -4
  147. package/dist/react/hooks/ui/index.js +37 -38
  148. package/dist/react/hooks/utils/index.d.ts +36 -36
  149. package/dist/react/hooks/utils/index.js +37 -38
  150. package/dist/react/index.d.ts +37 -37
  151. package/dist/react/index.js +38 -39
  152. package/dist/react/queries/collectibles/index.d.ts +4 -10
  153. package/dist/react/queries/collectibles/index.js +20 -21
  154. package/dist/react/queries/collections/index.d.ts +11 -11
  155. package/dist/react/queries/collections/index.js +19 -19
  156. package/dist/react/queries/index.d.ts +24 -24
  157. package/dist/react/queries/index.js +30 -31
  158. package/dist/react/queries/inventory/index.d.ts +2 -2
  159. package/dist/react/queries/inventory/index.js +20 -20
  160. package/dist/react/queries/market/index.d.ts +5 -5
  161. package/dist/react/queries/market/index.js +20 -20
  162. package/dist/react/queries/orders/index.d.ts +4 -10
  163. package/dist/react/queries/orders/index.js +11 -11
  164. package/dist/react/queries/primary-sales/index.d.ts +4 -4
  165. package/dist/react/queries/primary-sales/index.js +12 -12
  166. package/dist/react/queries/tokens/index.d.ts +4 -4
  167. package/dist/react/queries/tokens/index.js +11 -12
  168. package/dist/react/queries/utils/index.d.ts +3 -3
  169. package/dist/react/queries/utils/index.js +20 -20
  170. package/dist/react/ssr/index.d.ts +7 -7
  171. package/dist/react/ssr/index.js +13 -16
  172. package/dist/react/ssr/index.js.map +1 -1
  173. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +2 -2
  174. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +20 -20
  175. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +7 -10
  176. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +37 -38
  177. package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +4 -4
  178. package/dist/react/ui/components/marketplace-collectible-card/index.js +37 -38
  179. package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +2 -2
  180. package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +11 -11
  181. package/dist/react/ui/components/marketplace-logos/index.d.ts +21 -21
  182. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  183. package/dist/react/ui/icons/index.js +14 -14
  184. package/dist/react/ui/index.d.ts +4 -4
  185. package/dist/react/ui/index.js +37 -38
  186. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
  187. package/dist/react/ui/modals/_internal/components/actionModal/index.js +37 -38
  188. package/dist/react/utils/index.d.ts +1 -1
  189. package/dist/react/utils/index.js +7 -7
  190. package/dist/{react-DE852KeT.js → react.js} +720 -926
  191. package/dist/react.js.map +1 -0
  192. package/dist/{sequence-paCCener.js → sequence.js} +1 -1
  193. package/dist/sequence.js.map +1 -0
  194. package/dist/{src-Dz2CfBL0.js → src.js} +2 -2
  195. package/dist/src.js.map +1 -0
  196. package/dist/styles/index.css +1 -1
  197. package/dist/{sudo-swap-9rH2EgfT.js → sudo-swap.js} +1 -1
  198. package/dist/sudo-swap.js.map +1 -0
  199. package/dist/{super-rare-DHIuWtRw.js → super-rare.js} +1 -1
  200. package/dist/super-rare.js.map +1 -0
  201. package/dist/{token-Cv7l2ZaL.js → token.js} +2 -2
  202. package/dist/token.js.map +1 -0
  203. package/dist/{tokenBalances-ibDerNmM.js → tokenBalances.js} +4 -11
  204. package/dist/tokenBalances.js.map +1 -0
  205. package/dist/{tokenSupplies-Bfe8RHzI.d.ts → tokenSupplies.d.ts} +19 -30
  206. package/dist/{tokens-cGxMadd8.js → tokens.js} +47 -22
  207. package/dist/tokens.js.map +1 -0
  208. package/dist/{transaction-DZUW5RHu.js → transaction.js} +2 -2
  209. package/dist/transaction.js.map +1 -0
  210. package/dist/types/index.d.ts +1 -1
  211. package/dist/types/index.js +3 -3
  212. package/dist/{types-D2TJ1dwv.d.ts → types.d.ts} +3 -3
  213. package/dist/{types-B_-cnkcP.js → types.js} +2 -2
  214. package/dist/types.js.map +1 -0
  215. package/dist/utils/abi/index.d.ts +4 -4
  216. package/dist/utils/abi/index.js +4 -4
  217. package/dist/utils/abi/marketplace/index.d.ts +1 -1
  218. package/dist/utils/abi/marketplace/index.js +1 -1
  219. package/dist/utils/abi/primary-sale/index.d.ts +1 -1
  220. package/dist/utils/abi/primary-sale/index.js +1 -1
  221. package/dist/utils/abi/token/index.d.ts +1 -1
  222. package/dist/utils/abi/token/index.js +1 -1
  223. package/dist/utils/index.d.ts +7 -7
  224. package/dist/utils/index.js +13 -13
  225. package/dist/{utils-BfpDVibN.js → utils.js} +42 -4
  226. package/dist/utils.js.map +1 -0
  227. package/dist/{utils-BCgNhBFR.js → utils2.js} +11 -5
  228. package/dist/utils2.js.map +1 -0
  229. package/dist/{utils-BqxcalL2.js → utils3.js} +3 -3
  230. package/dist/utils3.js.map +1 -0
  231. package/dist/{waitForTransactionReceipt-DieAnV52.js → waitForTransactionReceipt.js} +3 -3
  232. package/dist/waitForTransactionReceipt.js.map +1 -0
  233. package/dist/{x2y2-45WDooeh.js → x2y2.js} +1 -1
  234. package/dist/x2y2.js.map +1 -0
  235. package/dist/{zora-CbeBoLvQ.js → zora.js} +1 -1
  236. package/dist/zora.js.map +1 -0
  237. package/package.json +42 -42
  238. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +13 -0
  239. package/src/react/_internal/api/index.ts +0 -1
  240. package/src/react/_internal/api/marketplace.gen.ts +70 -26
  241. package/src/react/_internal/api/query-keys.ts +9 -0
  242. package/src/react/_internal/wagmi/get-connectors.ts +12 -1
  243. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +0 -9
  244. package/src/react/hooks/data/collectibles/useListCollectibles.tsx +1 -16
  245. package/src/react/hooks/data/collectibles/useTokenBalances.tsx +0 -9
  246. package/src/react/hooks/data/collections/index.ts +2 -0
  247. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +112 -0
  248. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx +74 -0
  249. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +110 -0
  250. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx +74 -0
  251. package/src/react/hooks/data/inventory/useInventory.tsx +1 -10
  252. package/src/react/hooks/data/market/useMarketCurrencies.test.tsx +31 -2
  253. package/src/react/hooks/data/primary-sales/index.ts +1 -0
  254. package/src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx +71 -0
  255. package/src/react/hooks/data/tokens/useListBalances.tsx +1 -10
  256. package/src/react/hooks/data/tokens/useTokenSupplies.ts +1 -13
  257. package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +2 -0
  258. package/src/react/hooks/transactions/useProcessStep.test.tsx +8 -6
  259. package/src/react/hooks/transactions/useProcessStep.ts +8 -6
  260. package/src/react/hooks/utils/useComparePrices.test.tsx +1 -1
  261. package/src/react/providers/modal-provider.tsx +2 -1
  262. package/src/react/queries/collectibles/balanceOfCollectible.ts +1 -15
  263. package/src/react/queries/collectibles/listCollectibles.ts +1 -54
  264. package/src/react/queries/collectibles/tokenBalances.ts +1 -15
  265. package/src/react/queries/collections/activeListingsCurrencies.ts +84 -0
  266. package/src/react/queries/collections/activeOffersCurrencies.ts +84 -0
  267. package/src/react/queries/collections/index.ts +2 -0
  268. package/src/react/queries/inventory/inventory.ts +2 -9
  269. package/src/react/queries/market/marketCurrencies.ts +8 -1
  270. package/src/react/queries/primary-sales/index.ts +1 -0
  271. package/src/react/queries/primary-sales/primarySaleItem.ts +80 -0
  272. package/src/react/queries/tokens/listBalances.ts +1 -21
  273. package/src/react/queries/tokens/tokenSupplies.ts +2 -31
  274. package/src/react/queries/utils/comparePrices.ts +13 -1
  275. package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +2 -0
  276. package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +4 -18
  277. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +2 -2
  278. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +0 -2
  279. package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +3 -0
  280. package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +152 -141
  281. package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +1 -0
  282. package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +44 -60
  283. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155SalePaymentParams.test.tsx +381 -0
  284. package/src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts +257 -0
  285. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +0 -23
  286. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +22 -2
  287. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +2 -0
  288. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +2 -0
  289. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +2 -0
  290. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +1 -1
  291. package/src/react/ui/modals/TransferModal/index.tsx +24 -2
  292. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +15 -12
  293. package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +2 -0
  294. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +1 -1
  295. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +148 -11
  296. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
  297. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +2 -0
  298. package/src/styles/styles.ts +2 -2
  299. package/src/utils/networkconfigToWagmiChain.ts +7 -0
  300. package/src/utils/price.ts +58 -0
  301. package/test/const.ts +2 -0
  302. package/test/server-setup.ts +0 -2
  303. package/tsdown.config.ts +1 -0
  304. package/.changeset/honest-peas-arrive.md +0 -5
  305. package/.changeset/real-tips-stick.md +0 -8
  306. package/.changeset/tall-pandas-wear.md +0 -8
  307. package/dist/BellIcon-ByhygxBO.js.map +0 -1
  308. package/dist/CartIcon-Bt3rQYGk.js.map +0 -1
  309. package/dist/CollectibleCard-CVpdgXA8.d.ts +0 -8
  310. package/dist/_internal-DkS2VUn5.js.map +0 -1
  311. package/dist/abi-fa-o9gH3.js.map +0 -1
  312. package/dist/alien_swap-DoY6XfMA.js.map +0 -1
  313. package/dist/api-BoO0V5aJ.js.map +0 -1
  314. package/dist/aqua-xyz-BBDxnG14.js.map +0 -1
  315. package/dist/aura-DGx2zwvF.js.map +0 -1
  316. package/dist/blur-D8GKrRrq.js.map +0 -1
  317. package/dist/builder-api-BFuZNOaN.js.map +0 -1
  318. package/dist/builder.gen-B9wR2nvF.js.map +0 -1
  319. package/dist/coinbase-DOry4PXY.js.map +0 -1
  320. package/dist/collectibles-C_H8jMGH.js.map +0 -1
  321. package/dist/collections-CKummc-R.js.map +0 -1
  322. package/dist/components-CosnX7F9.js.map +0 -1
  323. package/dist/contracts-BP_0vX48.js.map +0 -1
  324. package/dist/create-config-CIfejoCk.js.map +0 -1
  325. package/dist/element-ciybd_VF.js.map +0 -1
  326. package/dist/foundation-Bq4lRz4x.js.map +0 -1
  327. package/dist/index-DNNUeZEq.d.ts +0 -18
  328. package/dist/inventory-Dd7TazvZ.js.map +0 -1
  329. package/dist/listBalances-BxpxBCvn.js +0 -57
  330. package/dist/listBalances-BxpxBCvn.js.map +0 -1
  331. package/dist/looks-rare-6H--x3AM.js.map +0 -1
  332. package/dist/magic-eden-BoxEQ1Li.js.map +0 -1
  333. package/dist/manifold-DycKsljb.js.map +0 -1
  334. package/dist/market-C3HV-awQ.js.map +0 -1
  335. package/dist/marketCurrencies-sKrTX0og.js.map +0 -1
  336. package/dist/marketplace-NQB-sEQL.js.map +0 -1
  337. package/dist/marketplace-logos-D4dS1Foy.js.map +0 -1
  338. package/dist/marketplace.gen-ksUafDqS.js.map +0 -1
  339. package/dist/marketplaceConfig-UHQMM9fq.js.map +0 -1
  340. package/dist/mintify-Dyqyo8jQ.js.map +0 -1
  341. package/dist/network-DtmiMhcg.js.map +0 -1
  342. package/dist/networkconfigToWagmiChain-DbUf6HiO.js.map +0 -1
  343. package/dist/nftx-2LbFjj9Q.js.map +0 -1
  344. package/dist/okx-CBEWJNsR.js.map +0 -1
  345. package/dist/open-sea-Dxntz_PA.js.map +0 -1
  346. package/dist/orders-DnFfZAXV.js.map +0 -1
  347. package/dist/primary-sale-1u4QlPdA.js.map +0 -1
  348. package/dist/primary-sales-Dmsi6bqj.js.map +0 -1
  349. package/dist/rarible-CS0SupHr.js.map +0 -1
  350. package/dist/react-DE852KeT.js.map +0 -1
  351. package/dist/sequence-paCCener.js.map +0 -1
  352. package/dist/src-Dz2CfBL0.js.map +0 -1
  353. package/dist/sudo-swap-9rH2EgfT.js.map +0 -1
  354. package/dist/super-rare-DHIuWtRw.js.map +0 -1
  355. package/dist/token-Cv7l2ZaL.js.map +0 -1
  356. package/dist/tokenBalances-ibDerNmM.js.map +0 -1
  357. package/dist/tokens-cGxMadd8.js.map +0 -1
  358. package/dist/transaction-DZUW5RHu.js.map +0 -1
  359. package/dist/types-B_-cnkcP.js.map +0 -1
  360. package/dist/utils-BCgNhBFR.js.map +0 -1
  361. package/dist/utils-BfpDVibN.js.map +0 -1
  362. package/dist/utils-BqxcalL2.js.map +0 -1
  363. package/dist/waitForTransactionReceipt-DieAnV52.js.map +0 -1
  364. package/dist/x2y2-45WDooeh.js.map +0 -1
  365. package/dist/zora-CbeBoLvQ.js.map +0 -1
  366. package/src/react/_internal/api/__mocks__/laos.msw.ts +0 -387
  367. package/src/react/_internal/api/__tests__/laos-api.test.ts +0 -756
  368. package/src/react/_internal/api/laos-api.ts +0 -106
  369. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.laos.test.tsx +0 -367
  370. package/src/react/queries/collectibles/__tests__/balanceOfCollectible.laos.test.ts +0 -123
  371. package/src/react/queries/collectibles/__tests__/tokenBalances.laos.test.ts +0 -123
  372. package/src/react/queries/inventory/__tests__/inventory.laos.test.ts +0 -499
  373. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155Checkout.test.tsx +0 -395
  374. package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +0 -103
  375. package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +0 -481
  376. /package/dist/{index-6wsMChsg.d.ts → index15.d.ts} +0 -0
  377. /package/dist/{index-CZUtOTjh.d.ts → index18.d.ts} +0 -0
  378. /package/dist/{index-DW3njUfb.d.ts → index20.d.ts} +0 -0
  379. /package/dist/{index-DewGsFz5.d.ts → index22.d.ts} +0 -0
  380. /package/dist/{queries-KOcILNJO.js → queries.js} +0 -0
  381. /package/dist/{wagmi-Bseovd6Q.js → wagmi.js} +0 -0
@@ -1,106 +0,0 @@
1
- import type {
2
- GetTokenBalancesReturn,
3
- GetTokenSuppliesReturn,
4
- } from '@0xsequence/indexer';
5
-
6
- export type SortOption = {
7
- column: string;
8
- order: 'ASC' | 'DESC';
9
- };
10
-
11
- export type PaginationOptions = {
12
- sort: SortOption[];
13
- };
14
-
15
- export type TokenSuppliesParams = {
16
- chainId: string;
17
- contractAddress: string;
18
- includeMetadata?: boolean;
19
- page?: PaginationOptions;
20
- };
21
-
22
- export type TokenBalancesParams = {
23
- chainId: string;
24
- accountAddress: string;
25
- contractAddress: string;
26
- includeMetadata?: boolean;
27
- page?: PaginationOptions;
28
- };
29
-
30
- export class LaosAPI {
31
- private baseUrl = 'https://extensions.api.laosnetwork.io';
32
-
33
- constructor(baseUrl?: string) {
34
- if (baseUrl) {
35
- this.baseUrl = baseUrl;
36
- }
37
- }
38
-
39
- async getTokenSupplies({
40
- chainId,
41
- contractAddress,
42
- includeMetadata = true,
43
- page = {
44
- sort: [
45
- {
46
- column: 'CREATED_AT',
47
- order: 'DESC',
48
- },
49
- ],
50
- },
51
- }: TokenSuppliesParams): Promise<GetTokenSuppliesReturn> {
52
- const response = await fetch(`${this.baseUrl}/token/GetTokenSupplies`, {
53
- method: 'POST',
54
- headers: {
55
- 'Content-Type': 'application/json',
56
- },
57
- body: JSON.stringify({
58
- chainId,
59
- contractAddress,
60
- includeMetadata,
61
- page,
62
- }),
63
- });
64
-
65
- if (!response.ok) {
66
- throw new Error(`Failed to get token supplies: ${response.statusText}`);
67
- }
68
-
69
- return await response.json();
70
- }
71
-
72
- async getTokenBalances({
73
- chainId,
74
- accountAddress,
75
- contractAddress,
76
- includeMetadata = true,
77
- page = {
78
- sort: [
79
- {
80
- column: 'CREATED_AT',
81
- order: 'DESC',
82
- },
83
- ],
84
- },
85
- }: TokenBalancesParams): Promise<GetTokenBalancesReturn> {
86
- const response = await fetch(`${this.baseUrl}/token/GetTokenBalances`, {
87
- method: 'POST',
88
- headers: {
89
- 'Content-Type': 'application/json',
90
- },
91
- body: JSON.stringify({
92
- chainId,
93
- accountAddress,
94
- contractAddress,
95
- includeMetadata,
96
- page,
97
- }),
98
- });
99
-
100
- if (!response.ok) {
101
- throw new Error(`Failed to get token balances: ${response.statusText}`);
102
- }
103
-
104
- return await response.json();
105
- }
106
- }
@@ -1,367 +0,0 @@
1
- import { renderHook, server, waitFor } from '@test';
2
- import { HttpResponse, http } from 'msw';
3
- import { afterEach, describe, expect, it } from 'vitest';
4
- import { ContractType } from '../../../_internal';
5
- import {
6
- mockIndexerEndpoint,
7
- mockTokenBalance,
8
- } from '../../../_internal/api/__mocks__/indexer.msw';
9
- import {
10
- laosHandlers,
11
- mockTokenBalancesResponse,
12
- } from '../../../_internal/api/__mocks__/laos.msw';
13
- import { useBalanceOfCollectible } from './useBalanceOfCollectible';
14
-
15
- describe('useBalanceOfCollectible with LAOS', () => {
16
- const defaultArgs = {
17
- collectionAddress:
18
- '0x1234567890123456789012345678901234567890' as `0x${string}`,
19
- collectableId: '1',
20
- userAddress:
21
- '0xuser1234567890123456789012345678901234567890' as `0x${string}`,
22
- chainId: 11155111,
23
- };
24
-
25
- // Mock marketplace config API response with LAOS collection
26
- const laosMarketplaceConfigResponse = {
27
- marketplace: {
28
- projectId: 1,
29
- settings: {
30
- style: {},
31
- publisherId: 'test-publisher',
32
- title: 'Test Marketplace',
33
- socials: {
34
- twitter: '',
35
- discord: '',
36
- website: '',
37
- tiktok: '',
38
- instagram: '',
39
- youtube: '',
40
- },
41
- faviconUrl: '',
42
- walletOptions: {
43
- walletType: 'UNIVERSAL',
44
- oidcIssuers: {},
45
- connectors: [],
46
- includeEIP6963Wallets: false,
47
- },
48
- logoUrl: '',
49
- fontUrl: '',
50
- },
51
- market: {
52
- enabled: true,
53
- title: 'Test Market',
54
- bannerUrl: 'https://example.com/banner.png',
55
- ogImage: 'https://example.com/og.png',
56
- },
57
- shop: {
58
- enabled: false,
59
- title: '',
60
- bannerUrl: '',
61
- ogImage: '',
62
- },
63
- },
64
- marketCollections: [
65
- {
66
- id: 1,
67
- projectId: 1,
68
- chainId: 11155111,
69
- itemsAddress: '0x1234567890123456789012345678901234567890',
70
- contractType: ContractType.LAOS_ERC_721,
71
- bannerUrl: 'https://example.com/banner.png',
72
- feePercentage: 0,
73
- currencyOptions: [],
74
- destinationMarketplace: 'sequence_marketplace_v2',
75
- },
76
- {
77
- id: 2,
78
- projectId: 1,
79
- chainId: 11155111,
80
- itemsAddress: '0x9876543210987654321098765432109876543210',
81
- contractType: ContractType.ERC721,
82
- bannerUrl: 'https://example.com/banner2.png',
83
- feePercentage: 0,
84
- currencyOptions: [],
85
- destinationMarketplace: 'sequence_marketplace_v2',
86
- },
87
- ],
88
- shopCollections: [],
89
- };
90
-
91
- // Setup handlers for LAOS and marketplace config
92
- afterEach(() => {
93
- server.resetHandlers();
94
- });
95
-
96
- it('should use LAOS API when collection is LAOS_ERC_721', async () => {
97
- // Add LAOS handlers and marketplace config handler
98
- server.use(
99
- ...laosHandlers,
100
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
101
- return HttpResponse.json(laosMarketplaceConfigResponse);
102
- }),
103
- );
104
-
105
- const { result } = renderHook(() => useBalanceOfCollectible(defaultArgs));
106
-
107
- // Initially loading
108
- expect(result.current.isLoading).toBe(true);
109
-
110
- // Wait for the query to complete
111
- await waitFor(() => {
112
- expect(result.current.isSuccess).toBe(true);
113
- });
114
-
115
- // Should return LAOS API response (array of balances)
116
- expect(result.current.data).toEqual(mockTokenBalancesResponse.balances[0]);
117
- expect(result.current.data?.balance).toBe('5');
118
- expect(result.current.data?.contractInfo?.type).toBe('LAOS-ERC-721');
119
- });
120
-
121
- it('should use indexer API when collection is regular ERC_721', async () => {
122
- const regularCollectionArgs = {
123
- ...defaultArgs,
124
- collectionAddress:
125
- '0x9876543210987654321098765432109876543210' as `0x${string}`,
126
- };
127
-
128
- server.use(
129
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
130
- return HttpResponse.json(laosMarketplaceConfigResponse);
131
- }),
132
- http.post(mockIndexerEndpoint('GetTokenBalances'), () => {
133
- return HttpResponse.json({
134
- page: { page: 1, pageSize: 10, more: false },
135
- balances: [mockTokenBalance],
136
- });
137
- }),
138
- );
139
-
140
- const { result } = renderHook(() =>
141
- useBalanceOfCollectible(regularCollectionArgs),
142
- );
143
-
144
- await waitFor(() => {
145
- expect(result.current.isSuccess).toBe(true);
146
- });
147
-
148
- // Should return indexer API response
149
- expect(result.current.data).toEqual(mockTokenBalance);
150
- expect(result.current.data?.contractInfo?.type).toBe('ERC721');
151
- });
152
-
153
- it('should handle LAOS API errors gracefully', async () => {
154
- const errorArgs = {
155
- ...defaultArgs,
156
- userAddress:
157
- '0x0000000000000000000000000000000000000001' as `0x${string}`, // Special address for 500 error
158
- };
159
-
160
- server.use(
161
- ...laosHandlers,
162
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
163
- return HttpResponse.json(laosMarketplaceConfigResponse);
164
- }),
165
- );
166
-
167
- const { result } = renderHook(() => useBalanceOfCollectible(errorArgs));
168
-
169
- await waitFor(() => {
170
- expect(result.current.isError).toBe(true);
171
- });
172
-
173
- expect(result.current.error).toBeDefined();
174
- });
175
-
176
- it('should return null when LAOS API returns empty balances', async () => {
177
- const emptyBalanceArgs = {
178
- ...defaultArgs,
179
- userAddress:
180
- '0x0000000000000000000000000000000000000003' as `0x${string}`, // Special address for empty response
181
- };
182
-
183
- server.use(
184
- ...laosHandlers,
185
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
186
- return HttpResponse.json(laosMarketplaceConfigResponse);
187
- }),
188
- );
189
-
190
- const { result } = renderHook(() =>
191
- useBalanceOfCollectible(emptyBalanceArgs),
192
- );
193
-
194
- await waitFor(() => {
195
- expect(result.current.isSuccess).toBe(true);
196
- });
197
-
198
- expect(result.current.data).toEqual(null);
199
- });
200
-
201
- it('should auto-detect LAOS from marketplace config', async () => {
202
- server.use(
203
- ...laosHandlers,
204
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
205
- return HttpResponse.json(laosMarketplaceConfigResponse);
206
- }),
207
- );
208
-
209
- const { result } = renderHook(() => useBalanceOfCollectible(defaultArgs));
210
-
211
- await waitFor(() => {
212
- expect(result.current.isSuccess).toBe(true);
213
- });
214
-
215
- // Verify it used LAOS API (returns LAOS-specific data structure)
216
- expect(result.current.data?.contractInfo?.type).toBe('LAOS-ERC-721');
217
- expect(result.current.data?.tokenMetadata).toBeDefined();
218
- });
219
-
220
- it('should fallback to indexer when marketplace config is unavailable', async () => {
221
- // No marketplace config handler - should fallback to indexer
222
- server.use(
223
- http.post(mockIndexerEndpoint('GetTokenBalances'), () => {
224
- return HttpResponse.json({
225
- page: { page: 1, pageSize: 10, more: false },
226
- balances: [mockTokenBalance],
227
- });
228
- }),
229
- );
230
-
231
- const { result } = renderHook(() => useBalanceOfCollectible(defaultArgs));
232
-
233
- await waitFor(() => {
234
- expect(result.current.isSuccess).toBe(true);
235
- });
236
-
237
- // Should use indexer since no marketplace config to determine LAOS
238
- expect(result.current.data).toEqual(mockTokenBalance);
239
- expect(result.current.data?.contractInfo?.type).toBe('ERC721');
240
- });
241
-
242
- it('should handle collection not found in marketplace config', async () => {
243
- const unknownCollectionArgs = {
244
- ...defaultArgs,
245
- collectionAddress:
246
- '0x0000000000000000000000000000000000000999' as `0x${string}`, // Unknown collection
247
- };
248
-
249
- server.use(
250
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
251
- return HttpResponse.json(laosMarketplaceConfigResponse);
252
- }),
253
- http.post(mockIndexerEndpoint('GetTokenBalances'), () => {
254
- return HttpResponse.json({
255
- page: { page: 1, pageSize: 10, more: false },
256
- balances: [mockTokenBalance],
257
- });
258
- }),
259
- );
260
-
261
- const { result } = renderHook(() =>
262
- useBalanceOfCollectible(unknownCollectionArgs),
263
- );
264
-
265
- await waitFor(() => {
266
- expect(result.current.isSuccess).toBe(true);
267
- });
268
-
269
- // Should fallback to indexer when collection not found in config
270
- expect(result.current.data).toEqual(mockTokenBalance);
271
- expect(result.current.data?.contractInfo?.type).toBe('ERC721');
272
- });
273
-
274
- it('should respect enabled query option for LAOS collections', () => {
275
- server.use(
276
- ...laosHandlers,
277
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
278
- return HttpResponse.json(laosMarketplaceConfigResponse);
279
- }),
280
- );
281
-
282
- const { result } = renderHook(() =>
283
- useBalanceOfCollectible({
284
- ...defaultArgs,
285
- query: {
286
- enabled: false,
287
- },
288
- }),
289
- );
290
-
291
- expect(result.current.isLoading).toBe(false);
292
- expect(result.current.data).toBeUndefined();
293
- });
294
-
295
- it('should handle LAOS metadata correctly', async () => {
296
- server.use(
297
- ...laosHandlers,
298
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
299
- return HttpResponse.json(laosMarketplaceConfigResponse);
300
- }),
301
- );
302
-
303
- const { result } = renderHook(() => useBalanceOfCollectible(defaultArgs));
304
-
305
- await waitFor(() => {
306
- expect(result.current.isSuccess).toBe(true);
307
- });
308
-
309
- const balance = result.current.data;
310
- expect(balance?.tokenMetadata).toBeDefined();
311
- expect(balance?.tokenMetadata?.name).toBe('Test Token 1');
312
- expect(balance?.tokenMetadata?.description).toBe(
313
- 'A test token for LAOS testing',
314
- );
315
- expect(balance?.tokenMetadata?.image).toBe(
316
- 'https://example.com/token1.png',
317
- );
318
- expect(balance?.tokenMetadata?.attributes).toEqual([
319
- {
320
- trait_type: 'Rarity',
321
- value: 'Common',
322
- },
323
- ]);
324
- });
325
-
326
- it('should pass correct parameters to LAOS API', async () => {
327
- let capturedRequestBody: Record<string, unknown> = {};
328
-
329
- server.use(
330
- http.post('*/rpc/MarketplaceService/LookupMarketplace', () => {
331
- return HttpResponse.json(laosMarketplaceConfigResponse);
332
- }),
333
- http.post(
334
- 'https://extensions.api.laosnetwork.io/token/GetTokenBalances',
335
- async ({ request }) => {
336
- const body = await request.json();
337
- capturedRequestBody = body as Record<string, unknown>;
338
- return HttpResponse.json(mockTokenBalancesResponse);
339
- },
340
- ),
341
- );
342
-
343
- const { result } = renderHook(() => useBalanceOfCollectible(defaultArgs));
344
-
345
- await waitFor(() => {
346
- expect(result.current.isSuccess).toBe(true);
347
- });
348
-
349
- // Verify LAOS API was called with correct parameters
350
- expect(capturedRequestBody).toMatchInlineSnapshot(`
351
- {
352
- "accountAddress": "0xuser1234567890123456789012345678901234567890",
353
- "chainId": "11155111",
354
- "contractAddress": "0x1234567890123456789012345678901234567890",
355
- "includeMetadata": true,
356
- "page": {
357
- "sort": [
358
- {
359
- "column": "CREATED_AT",
360
- "order": "DESC",
361
- },
362
- ],
363
- },
364
- }
365
- `);
366
- });
367
- });
@@ -1,123 +0,0 @@
1
- import { server } from '@test';
2
- import { afterEach, describe, expect, it } from 'vitest';
3
- import {
4
- laosHandlers,
5
- mockTokenBalancesResponse,
6
- } from '../../../_internal/api/__mocks__/laos.msw';
7
- import { fetchBalanceOfCollectible } from '../balanceOfCollectible';
8
-
9
- describe('fetchBalanceOfCollectible with LAOS', () => {
10
- const mockConfig = {
11
- projectAccessKey: 'test-key',
12
- projectId: '1',
13
- chainId: 11155111,
14
- apiUrl: 'https://marketplace-api.sequence.app',
15
- isDev: false,
16
- };
17
-
18
- afterEach(() => {
19
- server.resetHandlers();
20
- });
21
-
22
- it('should use LAOS API when isLaos721=true', async () => {
23
- server.use(...laosHandlers);
24
-
25
- const result = await fetchBalanceOfCollectible(
26
- {
27
- collectionAddress: '0x1234567890123456789012345678901234567890',
28
- collectableId: '1',
29
- userAddress: '0xuser1234567890123456789012345678901234567890',
30
- chainId: 11155111,
31
- isLaos721: true,
32
- },
33
- mockConfig,
34
- );
35
-
36
- // Should return array of balances from LAOS API response
37
- expect(result).toEqual(mockTokenBalancesResponse.balances[0]);
38
- expect(result?.balance).toBe('5');
39
- expect(result?.contractInfo?.type).toBe('LAOS-ERC-721');
40
- expect(result?.tokenMetadata?.name).toBe('Test Token 1');
41
- });
42
-
43
- it('should handle LAOS API errors', async () => {
44
- server.use(...laosHandlers);
45
-
46
- await expect(
47
- fetchBalanceOfCollectible(
48
- {
49
- collectionAddress: '0x1234567890123456789012345678901234567890',
50
- collectableId: '1',
51
- userAddress: '0x0000000000000000000000000000000000000001', // Special address for 500 error
52
- chainId: 11155111,
53
- isLaos721: true,
54
- },
55
- mockConfig,
56
- ),
57
- ).rejects.toThrow('Failed to get token balances: Internal Server Error');
58
- });
59
-
60
- it('should return null when LAOS API returns empty balances', async () => {
61
- server.use(...laosHandlers);
62
-
63
- const result = await fetchBalanceOfCollectible(
64
- {
65
- collectionAddress: '0x1234567890123456789012345678901234567890',
66
- collectableId: '1',
67
- userAddress: '0x0000000000000000000000000000000000000003', // Special address for empty response
68
- chainId: 11155111,
69
- isLaos721: true,
70
- },
71
- mockConfig,
72
- );
73
-
74
- expect(result).toEqual(null);
75
- });
76
-
77
- it('should include metadata in LAOS response', async () => {
78
- server.use(...laosHandlers);
79
-
80
- const result = await fetchBalanceOfCollectible(
81
- {
82
- collectionAddress: '0x1234567890123456789012345678901234567890',
83
- collectableId: '1',
84
- userAddress: '0xuser1234567890123456789012345678901234567890',
85
- chainId: 11155111,
86
- isLaos721: true,
87
- },
88
- mockConfig,
89
- );
90
-
91
- expect(result?.tokenMetadata).toBeDefined();
92
- expect(result?.tokenMetadata?.name).toBe('Test Token 1');
93
- expect(result?.tokenMetadata?.description).toBe(
94
- 'A test token for LAOS testing',
95
- );
96
- expect(result?.tokenMetadata?.image).toBe('https://example.com/token1.png');
97
- expect(result?.tokenMetadata?.attributes).toEqual([
98
- {
99
- trait_type: 'Rarity',
100
- value: 'Common',
101
- },
102
- ]);
103
- });
104
-
105
- it('should handle different pagination orders', async () => {
106
- server.use(...laosHandlers);
107
-
108
- const result = await fetchBalanceOfCollectible(
109
- {
110
- collectionAddress: '0x1234567890123456789012345678901234567890',
111
- collectableId: '1',
112
- userAddress: '0xuser1234567890123456789012345678901234567890',
113
- chainId: 11155111,
114
- isLaos721: true,
115
- },
116
- mockConfig,
117
- );
118
-
119
- // Should return array of balances regardless of sort order
120
- expect(result).toBeDefined();
121
- expect(result?.balance).toBeDefined();
122
- });
123
- });
@@ -1,123 +0,0 @@
1
- import { server } from '@test';
2
- import { afterEach, describe, expect, it } from 'vitest';
3
- import {
4
- laosHandlers,
5
- mockTokenBalancesResponse,
6
- } from '../../../_internal/api/__mocks__/laos.msw';
7
- import { fetchTokenBalances } from '../tokenBalances';
8
-
9
- describe('fetchTokenBalances with LAOS', () => {
10
- const mockConfig = {
11
- projectAccessKey: 'test-key',
12
- projectId: '1',
13
- chainId: 11155111,
14
- apiUrl: 'https://marketplace-api.sequence.app',
15
- isDev: false,
16
- };
17
-
18
- afterEach(() => {
19
- server.resetHandlers();
20
- });
21
-
22
- it('should use LAOS API when isLaos721=true', async () => {
23
- server.use(...laosHandlers);
24
-
25
- const result = await fetchTokenBalances(
26
- {
27
- collectionAddress: '0x1234567890123456789012345678901234567890',
28
- userAddress: '0xuser1234567890123456789012345678901234567890',
29
- chainId: 11155111,
30
- isLaos721: true,
31
- },
32
- mockConfig,
33
- );
34
-
35
- // Should return array of balances from LAOS API response
36
- expect(result).toEqual(mockTokenBalancesResponse.balances);
37
- expect(result[0]?.balance).toBe('5');
38
- expect(result[0]?.contractInfo?.type).toBe('LAOS-ERC-721');
39
- expect(result[0]?.tokenMetadata?.name).toBe('Test Token 1');
40
- });
41
-
42
- it('should handle LAOS API errors', async () => {
43
- server.use(...laosHandlers);
44
-
45
- await expect(
46
- fetchTokenBalances(
47
- {
48
- collectionAddress: '0x1234567890123456789012345678901234567890',
49
- userAddress: '0x0000000000000000000000000000000000000001', // Special address for 500 error
50
- chainId: 11155111,
51
- isLaos721: true,
52
- },
53
- mockConfig,
54
- ),
55
- ).rejects.toThrow('Failed to get token balances: Internal Server Error');
56
- });
57
-
58
- it('should return empty array when LAOS API returns empty balances', async () => {
59
- server.use(...laosHandlers);
60
-
61
- const result = await fetchTokenBalances(
62
- {
63
- collectionAddress: '0x1234567890123456789012345678901234567890',
64
- userAddress: '0x0000000000000000000000000000000000000003', // Special address for empty response
65
- chainId: 11155111,
66
- isLaos721: true,
67
- },
68
- mockConfig,
69
- );
70
-
71
- expect(result).toEqual([]);
72
- });
73
-
74
- it('should include metadata in LAOS response', async () => {
75
- server.use(...laosHandlers);
76
-
77
- const result = await fetchTokenBalances(
78
- {
79
- collectionAddress: '0x1234567890123456789012345678901234567890',
80
- userAddress: '0xuser1234567890123456789012345678901234567890',
81
- chainId: 11155111,
82
- isLaos721: true,
83
- },
84
- mockConfig,
85
- );
86
-
87
- expect(result[0]?.tokenMetadata).toBeDefined();
88
- expect(result[0]?.tokenMetadata?.name).toBe('Test Token 1');
89
- expect(result[0]?.tokenMetadata?.description).toBe(
90
- 'A test token for LAOS testing',
91
- );
92
- expect(result[0]?.tokenMetadata?.image).toBe(
93
- 'https://example.com/token1.png',
94
- );
95
- expect(result[0]?.tokenMetadata?.attributes).toEqual([
96
- {
97
- trait_type: 'Rarity',
98
- value: 'Common',
99
- },
100
- ]);
101
- });
102
-
103
- it('should handle different pagination orders', async () => {
104
- server.use(...laosHandlers);
105
-
106
- const result = await fetchTokenBalances(
107
- {
108
- collectionAddress: '0x1234567890123456789012345678901234567890',
109
- userAddress: '0xuser1234567890123456789012345678901234567890',
110
- chainId: 11155111,
111
- isLaos721: true,
112
- },
113
- mockConfig,
114
- );
115
-
116
- // Should return array of balances regardless of sort order
117
- expect(result).toBeDefined();
118
- expect(Array.isArray(result)).toBe(true);
119
- expect(result.every((balance) => typeof balance.balance === 'string')).toBe(
120
- true,
121
- );
122
- });
123
- });