@0xsequence/marketplace-sdk 0.4.5 → 0.4.7

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 (291) hide show
  1. package/dist/alien_swap-4GAIV7PA.png +0 -0
  2. package/dist/alien_swap-IZONL4XB.js +8 -0
  3. package/dist/alien_swap-PMYKGY6A.js +8 -0
  4. package/dist/aqua-xyz-HLNZIFE2.js +8 -0
  5. package/dist/aqua-xyz-HLNZIFE2.js.map +1 -0
  6. package/dist/aqua-xyz-JY5QCI5L.js +8 -0
  7. package/dist/aqua-xyz-JY5QCI5L.js.map +1 -0
  8. package/dist/aqua-xyz-WU4JVU2K.png +0 -0
  9. package/dist/aura-CYKEACX2.js +8 -0
  10. package/dist/aura-CYKEACX2.js.map +1 -0
  11. package/dist/aura-HLMWKNSP.js +8 -0
  12. package/dist/aura-HLMWKNSP.js.map +1 -0
  13. package/dist/aura-RITZV42R.png +0 -0
  14. package/dist/blur-2ABQMPTL.png +0 -0
  15. package/dist/blur-MIPRQYJL.js +8 -0
  16. package/dist/blur-MIPRQYJL.js.map +1 -0
  17. package/dist/blur-XDIGHYB7.js +8 -0
  18. package/dist/blur-XDIGHYB7.js.map +1 -0
  19. package/dist/{chunk-SEISACMH.js → chunk-5UCKYAMR.js} +771 -788
  20. package/dist/chunk-5UCKYAMR.js.map +1 -0
  21. package/dist/{chunk-KILOCWY2.js → chunk-6R4G7J6Q.js} +87 -27
  22. package/dist/chunk-6R4G7J6Q.js.map +1 -0
  23. package/dist/{chunk-CKOWM2ZR.js → chunk-AQT3BQ67.js} +9 -9
  24. package/dist/chunk-AQT3BQ67.js.map +1 -0
  25. package/dist/{chunk-KL5JPUPS.js → chunk-FWN2MCLI.js} +18 -12
  26. package/dist/chunk-FWN2MCLI.js.map +1 -0
  27. package/dist/{chunk-PAZ4MQXZ.js → chunk-JEOUQFT3.js} +17 -129
  28. package/dist/chunk-JEOUQFT3.js.map +1 -0
  29. package/dist/chunk-MWDG7UTB.js +132 -0
  30. package/dist/chunk-MWDG7UTB.js.map +1 -0
  31. package/dist/{chunk-KZGDOIZY.js → chunk-R7GVMKMM.js} +154 -76
  32. package/dist/chunk-R7GVMKMM.js.map +1 -0
  33. package/dist/chunk-RK6KYMZM.js +18 -0
  34. package/dist/chunk-RK6KYMZM.js.map +1 -0
  35. package/dist/{chunk-YUETNNZQ.js → chunk-WM4RGBFQ.js} +1 -10
  36. package/dist/{chunk-YUETNNZQ.js.map → chunk-WM4RGBFQ.js.map} +1 -1
  37. package/dist/chunk-XP3WY5AX.js +174 -0
  38. package/dist/chunk-XP3WY5AX.js.map +1 -0
  39. package/dist/{chunk-ZEKRTFBU.js → chunk-YOKGP2EQ.js} +12 -2
  40. package/dist/chunk-YOKGP2EQ.js.map +1 -0
  41. package/dist/{chunk-HTFBQVLV.js → chunk-ZEH4JI2U.js} +2 -2
  42. package/dist/chunk-ZUEQGPLO.js +302 -0
  43. package/dist/chunk-ZUEQGPLO.js.map +1 -0
  44. package/dist/coinbase-MIJPE653.js +8 -0
  45. package/dist/coinbase-MIJPE653.js.map +1 -0
  46. package/dist/coinbase-MZUBBEC4.png +0 -0
  47. package/dist/coinbase-T24XHLQL.js +8 -0
  48. package/dist/coinbase-T24XHLQL.js.map +1 -0
  49. package/dist/{create-config-DMBOGsJp.d.ts → create-config-D5WqfUft.d.ts} +2 -2
  50. package/dist/element-GHIPFSB6.png +0 -0
  51. package/dist/element-MWATR3ON.js +8 -0
  52. package/dist/element-MWATR3ON.js.map +1 -0
  53. package/dist/element-X45NH4D7.js +8 -0
  54. package/dist/element-X45NH4D7.js.map +1 -0
  55. package/dist/foundation-BDJUT6CK.js +8 -0
  56. package/dist/foundation-BDJUT6CK.js.map +1 -0
  57. package/dist/foundation-FJKIXLS5.png +0 -0
  58. package/dist/foundation-Z6D6U74V.js +8 -0
  59. package/dist/foundation-Z6D6U74V.js.map +1 -0
  60. package/dist/index.d.ts +6 -5
  61. package/dist/index.js +12 -6
  62. package/dist/looks-rare-B6G3OQAP.png +0 -0
  63. package/dist/looks-rare-LBHT6EXZ.js +8 -0
  64. package/dist/looks-rare-LBHT6EXZ.js.map +1 -0
  65. package/dist/looks-rare-STS6IKI4.js +8 -0
  66. package/dist/looks-rare-STS6IKI4.js.map +1 -0
  67. package/dist/magic-eden-HA3X3P2O.png +0 -0
  68. package/dist/magic-eden-RMZ24554.js +8 -0
  69. package/dist/magic-eden-RMZ24554.js.map +1 -0
  70. package/dist/magic-eden-YMTLPKLE.js +8 -0
  71. package/dist/magic-eden-YMTLPKLE.js.map +1 -0
  72. package/dist/manifold-I4NT4V5L.png +0 -0
  73. package/dist/manifold-L7FLFDRO.js +8 -0
  74. package/dist/manifold-L7FLFDRO.js.map +1 -0
  75. package/dist/manifold-YIUSABCZ.js +8 -0
  76. package/dist/manifold-YIUSABCZ.js.map +1 -0
  77. package/dist/{marketplace-config-0Rft6_Hv.d.ts → marketplace-config-C_fDWzz0.d.ts} +2 -2
  78. package/dist/marketplace.gen-B8S8fflj.d.ts +390 -0
  79. package/dist/mintify-ARDASD5Z.js +8 -0
  80. package/dist/mintify-ARDASD5Z.js.map +1 -0
  81. package/dist/mintify-OLOGFTWQ.png +0 -0
  82. package/dist/mintify-TSZA3SQT.js +8 -0
  83. package/dist/mintify-TSZA3SQT.js.map +1 -0
  84. package/dist/nftx-67RX7ZV6.js +8 -0
  85. package/dist/nftx-67RX7ZV6.js.map +1 -0
  86. package/dist/nftx-DJIV3PYG.png +0 -0
  87. package/dist/nftx-KVJ3T3G2.js +8 -0
  88. package/dist/nftx-KVJ3T3G2.js.map +1 -0
  89. package/dist/okx-MOA2EFVR.js +8 -0
  90. package/dist/okx-MOA2EFVR.js.map +1 -0
  91. package/dist/okx-WNQRV3WE.png +0 -0
  92. package/dist/okx-WQA7H7EM.js +8 -0
  93. package/dist/okx-WQA7H7EM.js.map +1 -0
  94. package/dist/open-sea-2HWFM4P6.js +8 -0
  95. package/dist/open-sea-2HWFM4P6.js.map +1 -0
  96. package/dist/open-sea-C57XWTAR.png +0 -0
  97. package/dist/open-sea-GESD6S2M.js +8 -0
  98. package/dist/open-sea-GESD6S2M.js.map +1 -0
  99. package/dist/rarible-GHMFCPBT.js +8 -0
  100. package/dist/rarible-GHMFCPBT.js.map +1 -0
  101. package/dist/rarible-QNNAZZQC.js +8 -0
  102. package/dist/rarible-QNNAZZQC.js.map +1 -0
  103. package/dist/rarible-ZCE7U3I5.png +0 -0
  104. package/dist/react/_internal/api/index.d.ts +4 -3
  105. package/dist/react/_internal/api/index.js +6 -2
  106. package/dist/react/_internal/index.d.ts +6 -7
  107. package/dist/react/_internal/index.js +10 -4
  108. package/dist/react/_internal/wagmi/index.d.ts +3 -4
  109. package/dist/react/_internal/wagmi/index.js +2 -2
  110. package/dist/react/hooks/index.d.ts +779 -116
  111. package/dist/react/hooks/index.js +17 -7
  112. package/dist/react/index.d.ts +7 -8
  113. package/dist/react/index.js +19 -10
  114. package/dist/react/ssr/index.js +8 -30
  115. package/dist/react/ssr/index.js.map +1 -1
  116. package/dist/react/ui/components/collectible-card/index.css.map +1 -0
  117. package/dist/react/ui/components/{index.d.ts → collectible-card/index.d.ts} +4 -3
  118. package/dist/react/ui/components/collectible-card/index.js +29 -0
  119. package/dist/react/ui/components/collectible-card/index.js.map +1 -0
  120. package/dist/react/ui/components/marketplace-logos/index.d.ts +26 -0
  121. package/dist/react/ui/components/marketplace-logos/index.js +46 -0
  122. package/dist/react/ui/components/marketplace-logos/index.js.map +1 -0
  123. package/dist/react/ui/icons/index.js +0 -8
  124. package/dist/react/ui/icons/index.js.map +1 -1
  125. package/dist/react/ui/index.d.ts +6 -5
  126. package/dist/react/ui/index.js +11 -10
  127. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +4 -2
  128. package/dist/react/ui/modals/_internal/components/actionModal/index.js +9 -7
  129. package/dist/{marketplace.gen-jdKqutnd.d.ts → sdk-config-BXVH8PS2.d.ts} +91 -16
  130. package/dist/sequence-JAFBEQNI.png +0 -0
  131. package/dist/sequence-OIPVNE5P.js +8 -0
  132. package/dist/sequence-OIPVNE5P.js.map +1 -0
  133. package/dist/sequence-QNNBU34G.js +8 -0
  134. package/dist/sequence-QNNBU34G.js.map +1 -0
  135. package/dist/{services-C2O-7p_M.d.ts → services-CdXAIjt1.d.ts} +1 -2
  136. package/dist/sudo-swap-D3FAP7W4.js +8 -0
  137. package/dist/sudo-swap-D3FAP7W4.js.map +1 -0
  138. package/dist/sudo-swap-XNJ3BIUD.js +8 -0
  139. package/dist/sudo-swap-XNJ3BIUD.js.map +1 -0
  140. package/dist/sudo-swap-Y6GICQTL.png +0 -0
  141. package/dist/super-rare-VIUS3P6B.js +8 -0
  142. package/dist/super-rare-VIUS3P6B.js.map +1 -0
  143. package/dist/super-rare-WWXZ3MQL.png +0 -0
  144. package/dist/super-rare-YPU3Y7EF.js +8 -0
  145. package/dist/super-rare-YPU3Y7EF.js.map +1 -0
  146. package/dist/types/index.d.ts +3 -4
  147. package/dist/types/index.js +9 -6
  148. package/dist/types-eX4P9xju.d.ts +70 -0
  149. package/dist/utils/index.d.ts +16 -3
  150. package/dist/utils/index.js +9 -2
  151. package/dist/x2y2-CXOXXZKS.png +0 -0
  152. package/dist/x2y2-G2SXS5VR.js +8 -0
  153. package/dist/x2y2-G2SXS5VR.js.map +1 -0
  154. package/dist/x2y2-GKWTQTPB.js +8 -0
  155. package/dist/x2y2-GKWTQTPB.js.map +1 -0
  156. package/dist/zora-3DPG4KAY.png +0 -0
  157. package/dist/zora-JUDT67NX.js +8 -0
  158. package/dist/zora-JUDT67NX.js.map +1 -0
  159. package/dist/zora-Z5VR477F.js +8 -0
  160. package/dist/zora-Z5VR477F.js.map +1 -0
  161. package/package.json +33 -19
  162. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +218 -0
  163. package/src/react/_internal/api/marketplace.gen.ts +125 -42
  164. package/src/react/_internal/api/query-keys.ts +8 -0
  165. package/src/react/_internal/api/zod-schema.ts +33 -0
  166. package/src/react/_internal/test-utils.tsx +68 -0
  167. package/src/react/_internal/types.ts +51 -1
  168. package/src/react/_internal/{transaction-machine/utils.ts → utils.ts} +1 -1
  169. package/src/react/_internal/{transaction-machine → wallet}/wallet.ts +2 -2
  170. package/src/react/hooks/index.ts +2 -0
  171. package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +77 -0
  172. package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +144 -0
  173. package/src/react/hooks/useCancelOrder.tsx +22 -3
  174. package/src/react/hooks/useCancelTransactionSteps.tsx +8 -10
  175. package/src/react/hooks/useCurrencies.tsx +14 -19
  176. package/src/react/hooks/useCurrency.tsx +10 -1
  177. package/src/react/hooks/useCurrencyBalance.tsx +38 -36
  178. package/src/react/hooks/useGetReceiptFromHash.tsx +1 -1
  179. package/src/react/hooks/useListCollectibleActivities.tsx +57 -0
  180. package/src/react/hooks/useListCollectionActivities.tsx +57 -0
  181. package/src/react/ssr/create-ssr-client.ts +1 -1
  182. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
  183. package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +89 -0
  184. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +1 -1
  185. package/src/react/ui/components/collectible-card/index.ts +1 -0
  186. package/src/react/ui/components/marketplace-logos/index.ts +23 -0
  187. package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +111 -0
  188. package/src/react/ui/images/marketplaces/alien_swap.png +0 -0
  189. package/src/react/ui/images/marketplaces/aqua-xyz.png +0 -0
  190. package/src/react/ui/images/marketplaces/aura.png +0 -0
  191. package/src/react/ui/images/marketplaces/blur.png +0 -0
  192. package/src/react/ui/images/marketplaces/coinbase.png +0 -0
  193. package/src/react/ui/images/marketplaces/element.png +0 -0
  194. package/src/react/ui/images/marketplaces/foundation.png +0 -0
  195. package/src/react/ui/images/marketplaces/looks-rare.png +0 -0
  196. package/src/react/ui/images/marketplaces/magic-eden.png +0 -0
  197. package/src/react/ui/images/marketplaces/manifold.png +0 -0
  198. package/src/react/ui/images/marketplaces/mintify.png +0 -0
  199. package/src/react/ui/images/marketplaces/nftx.png +0 -0
  200. package/src/react/ui/images/marketplaces/okx.png +0 -0
  201. package/src/react/ui/images/marketplaces/open-sea.png +0 -0
  202. package/src/react/ui/images/marketplaces/rarible.png +0 -0
  203. package/src/react/ui/images/marketplaces/sequence.png +0 -0
  204. package/src/react/ui/images/marketplaces/sudo-swap.png +0 -0
  205. package/src/react/ui/images/marketplaces/super-rare.png +0 -0
  206. package/src/react/ui/images/marketplaces/x2y2.png +0 -0
  207. package/src/react/ui/images/marketplaces/zora.png +0 -0
  208. package/src/react/ui/modals/BuyModal/Modal.tsx +3 -1
  209. package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +8 -7
  210. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +1 -1
  211. package/src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx +12 -3
  212. package/src/react/ui/modals/CreateListingModal/Modal.tsx +2 -1
  213. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +208 -0
  214. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +11 -2
  215. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
  216. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +8 -22
  217. package/src/react/ui/modals/CreateListingModal/store.ts +29 -19
  218. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +17 -24
  219. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +199 -0
  220. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +2 -2
  221. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +19 -3
  222. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +9 -23
  223. package/src/react/ui/modals/MakeOfferModal/store.ts +31 -20
  224. package/src/react/ui/modals/SellModal/Modal.tsx +1 -0
  225. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +192 -0
  226. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +4 -4
  227. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +3 -3
  228. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +14 -26
  229. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +1 -1
  230. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +3 -1
  231. package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +10 -2
  232. package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +7 -1
  233. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +159 -0
  234. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +5 -2
  235. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +11 -1
  236. package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +124 -0
  237. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +51 -45
  238. package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +221 -0
  239. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +24 -5
  240. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +2 -2
  241. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +16 -2
  242. package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
  243. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +147 -0
  244. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +218 -0
  245. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +28 -11
  246. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +1 -1
  247. package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts +1 -1
  248. package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +3 -3
  249. package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +1 -1
  250. package/src/react/ui/modals/modal-provider.tsx +0 -2
  251. package/src/types/marketplace-config.ts +1 -1
  252. package/src/utils/__tests__/address.test.ts +65 -0
  253. package/src/utils/__tests__/date.test.ts +31 -0
  254. package/src/utils/__tests__/get-public-rpc-client.test.ts +109 -0
  255. package/src/utils/__tests__/getMarketplaceDetails.test.ts +134 -0
  256. package/src/utils/__tests__/price.test.ts +42 -0
  257. package/src/utils/get-public-rpc-client.ts +6 -0
  258. package/src/utils/getMarketplaceDetails.ts +110 -0
  259. package/src/utils/index.ts +1 -0
  260. package/tsconfig.tsbuildinfo +1 -1
  261. package/vitest.config.js +10 -0
  262. package/dist/chunk-6WB4GCCJ.js +0 -38
  263. package/dist/chunk-6WB4GCCJ.js.map +0 -1
  264. package/dist/chunk-CKOWM2ZR.js.map +0 -1
  265. package/dist/chunk-CP2IVRMX.js +0 -85
  266. package/dist/chunk-CP2IVRMX.js.map +0 -1
  267. package/dist/chunk-FT3J32ZV.js +0 -86
  268. package/dist/chunk-FT3J32ZV.js.map +0 -1
  269. package/dist/chunk-KILOCWY2.js.map +0 -1
  270. package/dist/chunk-KL5JPUPS.js.map +0 -1
  271. package/dist/chunk-KZGDOIZY.js.map +0 -1
  272. package/dist/chunk-MJ4YU7RW.js +0 -2
  273. package/dist/chunk-PAZ4MQXZ.js.map +0 -1
  274. package/dist/chunk-SEISACMH.js.map +0 -1
  275. package/dist/chunk-ZEKRTFBU.js.map +0 -1
  276. package/dist/react/ui/components/index.css.map +0 -1
  277. package/dist/react/ui/components/index.js +0 -28
  278. package/dist/sdk-config-xWkdBdrL.d.ts +0 -24
  279. package/dist/types-DZb7GsfL.d.ts +0 -28
  280. package/src/react/_internal/transaction-machine/execute-transaction.ts +0 -676
  281. package/src/react/_internal/transaction-machine/useTransactionMachine.ts +0 -140
  282. package/src/react/ui/components/index.ts +0 -1
  283. package/src/react/ui/modals/Account/index.tsx +0 -29
  284. package/src/react/ui/modals/_internal/components/priceInput/hooks/useBalanceCheck.ts +0 -67
  285. package/src/react/ui/modals/_internal/components/priceInput/hooks/usePriceInput.ts +0 -54
  286. /package/dist/{chunk-MJ4YU7RW.js.map → alien_swap-IZONL4XB.js.map} +0 -0
  287. /package/dist/{react/ui/components/index.js.map → alien_swap-PMYKGY6A.js.map} +0 -0
  288. /package/dist/{chunk-HTFBQVLV.js.map → chunk-ZEH4JI2U.js.map} +0 -0
  289. /package/dist/react/ui/components/{index.css → collectible-card/index.css} +0 -0
  290. /package/src/react/_internal/{transaction-machine/logger.ts → logger.ts} +0 -0
  291. /package/src/react/_internal/{transaction-machine → wallet}/useWallet.ts +0 -0
@@ -0,0 +1,77 @@
1
+ import { http, HttpResponse } from 'msw';
2
+ import { WalletOptions, type MarketplaceConfig } from '../../../../types';
3
+
4
+ // Mock data
5
+ export const mockConfig: MarketplaceConfig = {
6
+ projectId: 123,
7
+ publisherId: 'test-publisher',
8
+ title: 'Test Marketplace',
9
+ shortDescription: 'A test marketplace',
10
+ faviconUrl: 'https://example.com/favicon.png',
11
+ landingBannerUrl: 'https://example.com/banner.png',
12
+ logoUrl: 'https://example.com/logo.png',
13
+ titleTemplate: '%s | Test Marketplace',
14
+ walletOptions: [WalletOptions.Sequence],
15
+ collections: [],
16
+ landingPageLayout: 'default',
17
+ cssString: '',
18
+ manifestUrl: '',
19
+ };
20
+
21
+ export const mockStyles = `
22
+ .marketplace-theme {
23
+ --primary-color: #000000;
24
+ }
25
+ `;
26
+
27
+ // Debug configuration
28
+ export let isDebugEnabled = false;
29
+ export const enableDebug = () => {
30
+ isDebugEnabled = true;
31
+ };
32
+ export const disableDebug = () => {
33
+ isDebugEnabled = false;
34
+ };
35
+
36
+ // Debug logger function
37
+ const debugLog = (endpoint: string, request: Request, response: Response) => {
38
+ if (isDebugEnabled) {
39
+ console.log(`[MSW Debug] ${endpoint}:`, {
40
+ request,
41
+ response,
42
+ });
43
+ }
44
+ };
45
+
46
+ // MSW handlers
47
+ export const createConfigHandler = (config = mockConfig) =>
48
+ http.get('*/marketplace/*/config.json', ({ request }) => {
49
+ const response = HttpResponse.json(config);
50
+ debugLog('config.json', request, response);
51
+ return response;
52
+ });
53
+
54
+ export const createStylesHandler = (styles = mockStyles) =>
55
+ http.get('*/marketplace/*/styles.css', ({ request }) => {
56
+ const response = new HttpResponse(styles, {
57
+ headers: { 'Content-Type': 'text/css' },
58
+ });
59
+ debugLog('styles.css', request, response);
60
+ return response;
61
+ });
62
+
63
+ export const createErrorHandler = () =>
64
+ http.get('*/marketplace/*/config.json', () => {
65
+ return HttpResponse.json(
66
+ { code: 3000, msg: 'Project not found' },
67
+ { status: 404 },
68
+ );
69
+ });
70
+
71
+ export const createStylesErrorHandler = () =>
72
+ http.get('*/marketplace/*/styles.css', () => {
73
+ return new HttpResponse('', { status: 500 });
74
+ });
75
+
76
+ // Default handlers
77
+ export const handlers = [createConfigHandler(), createStylesHandler()];
@@ -0,0 +1,144 @@
1
+ import { describe, it, expect, beforeAll, afterAll, afterEach } from 'vitest';
2
+ import { setupServer } from 'msw/node';
3
+ import { marketplaceConfigOptions } from '../marketplaceConfigOptions';
4
+ import { renderHook, waitFor } from '../../../_internal/test-utils';
5
+ import type { QueryFunctionContext } from '@tanstack/react-query';
6
+ import {
7
+ handlers,
8
+ createErrorHandler,
9
+ createStylesErrorHandler,
10
+ mockConfig,
11
+ mockStyles,
12
+ } from '../__mocks__/marketplaceConfig.msw';
13
+
14
+ type MarketplaceConfigQueryKey = ['configs', 'marketplace', string, string];
15
+ type MarketplaceConfigContext = QueryFunctionContext<MarketplaceConfigQueryKey>;
16
+
17
+ // Create MSW server with default handlers
18
+ const server = setupServer(...handlers);
19
+
20
+ // Setup test environment
21
+ beforeAll(() => server.listen());
22
+ afterEach(() => server.resetHandlers());
23
+ afterAll(() => server.close());
24
+
25
+ describe('marketplaceConfigOptions', () => {
26
+ it('should fetch marketplace config and styles successfully', async () => {
27
+ const { result } = renderHook(() =>
28
+ marketplaceConfigOptions({
29
+ projectId: 'test-project',
30
+ }),
31
+ );
32
+
33
+ await waitFor(() => {
34
+ expect(result.current.queryKey).toEqual([
35
+ 'configs',
36
+ 'marketplace',
37
+ 'production',
38
+ 'test-project',
39
+ ]);
40
+ expect(result.current.queryFn).toBeDefined();
41
+ });
42
+
43
+ const data = await result.current.queryFn?.({
44
+ queryKey: ['configs', 'marketplace', 'production', 'test-project'],
45
+ } as MarketplaceConfigContext);
46
+ expect(data).toEqual({
47
+ ...mockConfig,
48
+ cssString: mockStyles.replaceAll(/['"]/g, ''),
49
+ manifestUrl: expect.stringContaining('/manifest.json'),
50
+ });
51
+ });
52
+
53
+ it('should use custom environment and dev access key when provided', async () => {
54
+ const { result } = renderHook(() =>
55
+ marketplaceConfigOptions({
56
+ projectId: 'test-project',
57
+ _internal: {
58
+ builderEnv: 'development',
59
+ devAccessKey: 'test-dev-access-key',
60
+ },
61
+ }),
62
+ );
63
+
64
+ await waitFor(() => {
65
+ expect(result.current.queryKey).toEqual([
66
+ 'configs',
67
+ 'marketplace',
68
+ 'development',
69
+ 'test-project',
70
+ ]);
71
+ expect(result.current.queryFn).toBeDefined();
72
+ });
73
+
74
+ const data = await result.current.queryFn?.({
75
+ queryKey: ['configs', 'marketplace', 'development', 'test-project'],
76
+ } as MarketplaceConfigContext);
77
+ expect(data).toEqual({
78
+ ...mockConfig,
79
+ cssString: mockStyles.replaceAll(/['"]/g, ''),
80
+ manifestUrl: expect.stringContaining('/manifest.json'),
81
+ });
82
+ });
83
+
84
+ it('should handle error responses', async () => {
85
+ // Override handler to return an error
86
+ server.use(createErrorHandler());
87
+
88
+ const { result } = renderHook(() =>
89
+ marketplaceConfigOptions({
90
+ projectId: 'non-existent-project',
91
+ }),
92
+ );
93
+
94
+ await waitFor(() => {
95
+ expect(result.current.queryKey).toEqual([
96
+ 'configs',
97
+ 'marketplace',
98
+ 'production',
99
+ 'non-existent-project',
100
+ ]);
101
+ expect(result.current.queryFn).toBeDefined();
102
+ });
103
+
104
+ await expect(
105
+ result.current.queryFn?.({
106
+ queryKey: [
107
+ 'configs',
108
+ 'marketplace',
109
+ 'production',
110
+ 'non-existent-project',
111
+ ],
112
+ } as MarketplaceConfigContext),
113
+ ).rejects.toThrow('Project not found');
114
+ });
115
+
116
+ it('should handle network errors when fetching styles', async () => {
117
+ server.use(createStylesErrorHandler());
118
+
119
+ const { result } = renderHook(() =>
120
+ marketplaceConfigOptions({
121
+ projectId: 'test-project',
122
+ }),
123
+ );
124
+
125
+ await waitFor(() => {
126
+ expect(result.current.queryKey).toEqual([
127
+ 'configs',
128
+ 'marketplace',
129
+ 'production',
130
+ 'test-project',
131
+ ]);
132
+ expect(result.current.queryFn).toBeDefined();
133
+ });
134
+
135
+ const data = await result.current.queryFn?.({
136
+ queryKey: ['configs', 'marketplace', 'production', 'test-project'],
137
+ } as MarketplaceConfigContext);
138
+ expect(data).toEqual({
139
+ ...mockConfig,
140
+ cssString: '',
141
+ manifestUrl: expect.stringContaining('/manifest.json'),
142
+ });
143
+ });
144
+ });
@@ -1,5 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { useCancelTransactionSteps } from './useCancelTransactionSteps';
3
+ import type { MarketplaceKind } from '../../types';
3
4
 
4
5
  interface UseCancelOrderArgs {
5
6
  collectionAddress: string;
@@ -25,17 +26,35 @@ export const useCancelOrder = ({
25
26
  isExecuting: false,
26
27
  execute: () => Promise.resolve(),
27
28
  });
29
+ const [cancellingOrderId, setCancellingOrderId] = useState<string | null>(
30
+ null,
31
+ );
28
32
 
29
- const { cancelOrder } = useCancelTransactionSteps({
33
+ const { cancelOrder: cancelOrderBase } = useCancelTransactionSteps({
30
34
  collectionAddress,
31
35
  chainId,
32
- onSuccess,
33
- onError,
36
+ onSuccess: (result) => {
37
+ setCancellingOrderId(null);
38
+ onSuccess?.(result);
39
+ },
40
+ onError: (error) => {
41
+ setCancellingOrderId(null);
42
+ onError?.(error);
43
+ },
34
44
  setSteps,
35
45
  });
36
46
 
47
+ const cancelOrder = async (params: {
48
+ orderId: string;
49
+ marketplace: MarketplaceKind;
50
+ }) => {
51
+ setCancellingOrderId(params.orderId);
52
+ return cancelOrderBase(params);
53
+ };
54
+
37
55
  return {
38
56
  cancelOrder,
39
57
  isExecuting: steps.isExecuting,
58
+ cancellingOrderId,
40
59
  };
41
60
  };
@@ -2,18 +2,17 @@ import {
2
2
  ExecuteType,
3
3
  getMarketplaceClient,
4
4
  getQueryClient,
5
- MarketplaceKind,
6
- Step,
5
+ type MarketplaceKind,
6
+ type Step,
7
7
  StepType,
8
8
  } from '../_internal';
9
- import { useWallet } from '../_internal/transaction-machine/useWallet';
10
- import { ModalCallbacks } from '../ui/modals/_internal/types';
9
+ import { useWallet } from '../_internal/wallet/useWallet';
10
+ import type { ModalCallbacks } from '../ui/modals/_internal/types';
11
11
  import { useConfig } from './useConfig';
12
12
  import { useGenerateCancelTransaction } from './useGenerateCancelTransaction';
13
- import { TransactionStep } from './useCancelOrder';
14
- import { SignatureStep } from '../_internal/transaction-machine/utils';
15
- import { useGetReceiptFromHash } from './useGetReceiptFromHash';
16
- import { Hex } from 'viem';
13
+ import type { TransactionStep } from './useCancelOrder';
14
+ import type { SignatureStep } from '../_internal/utils';
15
+ import type { Hex } from 'viem';
17
16
  import { useSwitchChainModal } from '../ui/modals/_internal/components/switchChainModal';
18
17
  import {
19
18
  ChainSwitchUserRejectedError,
@@ -42,7 +41,6 @@ export const useCancelTransactionSteps = ({
42
41
  const walletIsInitialized = wallet && !isLoading && !isError;
43
42
  const sdkConfig = useConfig();
44
43
  const marketplaceClient = getMarketplaceClient(chainId, sdkConfig);
45
- const { waitForReceipt } = useGetReceiptFromHash();
46
44
  const { generateCancelTransactionAsync } = useGenerateCancelTransaction({
47
45
  chainId,
48
46
  });
@@ -147,7 +145,7 @@ export const useCancelTransactionSteps = ({
147
145
  hash = await executeTransaction({ transactionStep });
148
146
 
149
147
  if (hash) {
150
- await waitForReceipt(hash);
148
+ await wallet.handleConfirmTransactionStep(hash, Number(chainId));
151
149
 
152
150
  if (onSuccess && typeof onSuccess === 'function') {
153
151
  onSuccess({ hash });
@@ -1,8 +1,7 @@
1
1
  import { queryOptions, useQuery } from '@tanstack/react-query';
2
- import { toHex, zeroAddress } from 'viem';
2
+ import { zeroAddress } from 'viem';
3
3
  import { z } from 'zod';
4
4
  import type { SdkConfig } from '../../types';
5
- import { InvalidCurrencyOptionsError } from '../../utils/_internal/error/transaction';
6
5
  import {
7
6
  AddressSchema,
8
7
  type ChainId,
@@ -41,27 +40,23 @@ const fetchCurrencies = async (chainId: ChainId, config: SdkConfig) => {
41
40
 
42
41
  const selectCurrencies = (data: Currency[], args: UseCurrenciesArgs) => {
43
42
  const argsParsed = UseCurrenciesArgsSchema.parse(args);
44
- // if collectionAddress is passed, filter currencies based on collection currency options
43
+
44
+ let filteredData = data;
45
+
46
+ if (!argsParsed.includeNativeCurrency) {
47
+ filteredData = filteredData.filter((currency) => !currency.nativeCurrency);
48
+ }
49
+
45
50
  if (argsParsed.currencyOptions) {
46
- if (!argsParsed.currencyOptions) {
47
- throw new InvalidCurrencyOptionsError(argsParsed.currencyOptions);
48
- }
51
+ const lowerCaseCurrencyOptions = argsParsed.currencyOptions.map((option) =>
52
+ option.toLowerCase(),
53
+ );
49
54
 
50
- return data.filter(
51
- (currency) =>
52
- argsParsed.currencyOptions?.includes(toHex(currency.contractAddress)) ||
53
- // biome-ignore lint/suspicious/noDoubleEquals: <explanation>
54
- currency.nativeCurrency == argsParsed.includeNativeCurrency ||
55
- currency.defaultChainCurrency,
55
+ filteredData = filteredData.filter((currency) =>
56
+ lowerCaseCurrencyOptions.includes(currency.contractAddress.toLowerCase()),
56
57
  );
57
58
  }
58
- // if includeNativeCurrency is true, return all currencies
59
- if (argsParsed.includeNativeCurrency) {
60
- return data;
61
- }
62
-
63
- // if includeNativeCurrency is false or undefined, filter out native currencies
64
- return data.filter((currency) => !currency.nativeCurrency);
59
+ return filteredData;
65
60
  };
66
61
 
67
62
  export const currenciesOptions = (
@@ -44,10 +44,19 @@ const fetchCurrency = async (
44
44
  .then((resp) => resp.currencies);
45
45
  }
46
46
 
47
- return currencies?.find(
47
+ if (!currencies?.length) {
48
+ throw new Error('No currencies returned');
49
+ }
50
+ const currency = currencies.find(
48
51
  (currency) =>
49
52
  currency.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),
50
53
  );
54
+
55
+ if (!currency) {
56
+ throw new Error('Currency not found');
57
+ }
58
+
59
+ return currency;
51
60
  };
52
61
 
53
62
  export const currencyOptions = (args: UseCurrencyArgs, config: SdkConfig) => {
@@ -1,4 +1,4 @@
1
- import { useQuery } from '@tanstack/react-query';
1
+ import { skipToken, useQuery } from '@tanstack/react-query';
2
2
  import { type Address, erc20Abi, formatUnits, zeroAddress } from 'viem';
3
3
  import { getPublicRpcClient } from '../../utils';
4
4
 
@@ -7,46 +7,48 @@ export function useCurrencyBalance({
7
7
  chainId,
8
8
  userAddress,
9
9
  }: {
10
- currencyAddress: Address;
11
- chainId: number;
12
- userAddress: Address;
10
+ currencyAddress: Address | undefined;
11
+ chainId: number | undefined;
12
+ userAddress: Address | undefined;
13
13
  }) {
14
- const publicClient = getPublicRpcClient(chainId);
15
-
16
14
  return useQuery({
17
15
  queryKey: ['balance', currencyAddress, chainId, userAddress],
18
- queryFn: async () => {
19
- if (!userAddress) return null;
16
+ queryFn:
17
+ !!userAddress && !!chainId && !!currencyAddress
18
+ ? async () => {
19
+ if (!userAddress) return null;
20
+
21
+ const publicClient = getPublicRpcClient(chainId);
20
22
 
21
- if (currencyAddress === zeroAddress) {
22
- const balance = await publicClient.getBalance({
23
- address: userAddress,
24
- });
25
- return {
26
- value: balance,
27
- formatted: formatUnits(balance, 18),
28
- };
29
- }
23
+ if (currencyAddress === zeroAddress) {
24
+ const balance = await publicClient.getBalance({
25
+ address: userAddress,
26
+ });
27
+ return {
28
+ value: balance,
29
+ formatted: formatUnits(balance, 18),
30
+ };
31
+ }
30
32
 
31
- const [balance, decimals] = await Promise.all([
32
- publicClient.readContract({
33
- address: currencyAddress,
34
- abi: erc20Abi,
35
- functionName: 'balanceOf',
36
- args: [userAddress],
37
- }),
38
- publicClient.readContract({
39
- address: currencyAddress,
40
- abi: erc20Abi,
41
- functionName: 'decimals',
42
- }),
43
- ]);
33
+ const [balance, decimals] = await Promise.all([
34
+ publicClient.readContract({
35
+ address: currencyAddress,
36
+ abi: erc20Abi,
37
+ functionName: 'balanceOf',
38
+ args: [userAddress],
39
+ }),
40
+ publicClient.readContract({
41
+ address: currencyAddress,
42
+ abi: erc20Abi,
43
+ functionName: 'decimals',
44
+ }),
45
+ ]);
44
46
 
45
- return {
46
- value: balance,
47
- formatted: formatUnits(balance, decimals),
48
- };
49
- },
50
- enabled: !!userAddress && !!chainId && !!currencyAddress,
47
+ return {
48
+ value: balance,
49
+ formatted: formatUnits(balance, decimals),
50
+ };
51
+ }
52
+ : skipToken,
51
53
  });
52
54
  }
@@ -1,4 +1,4 @@
1
- import { Hex } from 'viem';
1
+ import type { Hex } from 'viem';
2
2
  import { usePublicClient } from 'wagmi';
3
3
  import { useCallback } from 'react';
4
4
 
@@ -0,0 +1,57 @@
1
+ import { queryOptions, useQuery } from '@tanstack/react-query';
2
+ import type { z } from 'zod';
3
+ import type { SdkConfig } from '../../types';
4
+ import { collectableKeys, getMarketplaceClient } from '../_internal';
5
+ import { useConfig } from './useConfig';
6
+ import type {
7
+ getListCollectibleActivitiesArgsSchema,
8
+ getListCollectibleActivitiesReturnSchema,
9
+ } from '../_internal/api/zod-schema';
10
+
11
+ export type UseListCollectibleActivitiesArgs = z.infer<
12
+ typeof getListCollectibleActivitiesArgsSchema
13
+ >;
14
+
15
+ export type UseListCollectibleActivitiesReturn = z.infer<
16
+ typeof getListCollectibleActivitiesReturnSchema
17
+ >;
18
+
19
+ const fetchCollectibleActivities = async (
20
+ args: UseListCollectibleActivitiesArgs,
21
+ config: SdkConfig,
22
+ ) => {
23
+ const marketplaceClient = getMarketplaceClient(args.chainId, config);
24
+ return marketplaceClient
25
+ .listCollectibleActivities({
26
+ contractAddress: args.collectionAddress,
27
+ tokenId: args.tokenId,
28
+ page: args.query?.enabled
29
+ ? {
30
+ page: args.query.page ?? 1,
31
+ pageSize: args.query.pageSize ?? 10,
32
+ sort: args.query.sort,
33
+ }
34
+ : undefined,
35
+ })
36
+ .then((data) => ({
37
+ activities: data.activities,
38
+ page: data.page,
39
+ }));
40
+ };
41
+
42
+ export const listCollectibleActivitiesOptions = (
43
+ args: UseListCollectibleActivitiesArgs,
44
+ config: SdkConfig,
45
+ ) => {
46
+ return queryOptions({
47
+ queryKey: [...collectableKeys.collectibleActivities, args, config],
48
+ queryFn: () => fetchCollectibleActivities(args, config),
49
+ });
50
+ };
51
+
52
+ export const useListCollectibleActivities = (
53
+ args: UseListCollectibleActivitiesArgs,
54
+ ) => {
55
+ const config = useConfig();
56
+ return useQuery(listCollectibleActivitiesOptions(args, config));
57
+ };
@@ -0,0 +1,57 @@
1
+ import { queryOptions, useQuery } from '@tanstack/react-query';
2
+ import type { z } from 'zod';
3
+ import type { SdkConfig } from '../../types';
4
+ import { getMarketplaceClient } from '../_internal';
5
+ import { collectionKeys } from '../_internal/api';
6
+ import { useConfig } from './useConfig';
7
+ import type {
8
+ getListCollectionActivitiesArgsSchema,
9
+ getListCollectionActivitiesReturnSchema,
10
+ } from '../_internal/api/zod-schema';
11
+
12
+ export type UseListCollectionActivitiesArgs = z.infer<
13
+ typeof getListCollectionActivitiesArgsSchema
14
+ >;
15
+
16
+ export type UseListCollectionActivitiesReturn = z.infer<
17
+ typeof getListCollectionActivitiesReturnSchema
18
+ >;
19
+
20
+ const fetchListCollectionActivities = async (
21
+ args: UseListCollectionActivitiesArgs,
22
+ config: SdkConfig,
23
+ ) => {
24
+ const marketplaceClient = getMarketplaceClient(args.chainId, config);
25
+ return marketplaceClient
26
+ .listCollectionActivities({
27
+ contractAddress: args.collectionAddress,
28
+ page: args.query?.enabled
29
+ ? {
30
+ page: args.query.page ?? 1,
31
+ pageSize: args.query.pageSize ?? 10,
32
+ sort: args.query.sort,
33
+ }
34
+ : undefined,
35
+ })
36
+ .then((data) => ({
37
+ activities: data.activities,
38
+ page: data.page,
39
+ }));
40
+ };
41
+
42
+ export const listCollectionActivitiesOptions = (
43
+ args: UseListCollectionActivitiesArgs,
44
+ config: SdkConfig,
45
+ ) => {
46
+ return queryOptions({
47
+ queryKey: [...collectionKeys.collectionActivities, args, config],
48
+ queryFn: () => fetchListCollectionActivities(args, config),
49
+ });
50
+ };
51
+
52
+ export const useListCollectionActivities = (
53
+ args: UseListCollectionActivitiesArgs,
54
+ ) => {
55
+ const config = useConfig();
56
+ return useQuery(listCollectionActivitiesOptions(args, config));
57
+ };
@@ -2,7 +2,7 @@ import { type State, cookieToInitialState } from 'wagmi';
2
2
  import type { SdkConfig } from '../../types/sdk-config';
3
3
  import { createWagmiConfig } from '../_internal/wagmi/create-config';
4
4
  import { marketplaceConfigOptions } from '../hooks/options/marketplaceConfigOptions';
5
- import { QueryClient } from '@tanstack/react-query';
5
+ import type { QueryClient } from '@tanstack/react-query';
6
6
 
7
7
  type InitSSRClientArgs = {
8
8
  cookie: string;
@@ -17,7 +17,7 @@ type ActionButtonProps = {
17
17
  chainId: string;
18
18
  collectionAddress: Hex;
19
19
  tokenId: string;
20
- orderbookKind: OrderbookKind;
20
+ orderbookKind?: OrderbookKind;
21
21
  isTransfer?: boolean;
22
22
  action: CollectibleCardAction;
23
23
  isOwned: boolean;