@0xsequence/marketplace-sdk 0.5.7 → 0.6.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 (199) hide show
  1. package/dist/chunk-2J7JIOW5.js +2 -0
  2. package/dist/{chunk-3OU7BADC.js → chunk-6MYDUGVO.js} +21 -4
  3. package/dist/chunk-6MYDUGVO.js.map +1 -0
  4. package/dist/chunk-6WMO5YM5.js +94 -0
  5. package/dist/chunk-6WMO5YM5.js.map +1 -0
  6. package/dist/{chunk-YA3DWLDC.js → chunk-A5ICXOCZ.js} +156 -227
  7. package/dist/chunk-A5ICXOCZ.js.map +1 -0
  8. package/dist/{chunk-G2T7HCWE.js → chunk-C42WHQRT.js} +3 -3
  9. package/dist/{chunk-G2T7HCWE.js.map → chunk-C42WHQRT.js.map} +1 -1
  10. package/dist/{chunk-ZBLU3Q22.js → chunk-DLB2EQRX.js} +2 -2
  11. package/dist/{chunk-ZBLU3Q22.js.map → chunk-DLB2EQRX.js.map} +1 -1
  12. package/dist/{chunk-YOKGP2EQ.js → chunk-FG2BBP3P.js} +1 -1
  13. package/dist/{chunk-YOKGP2EQ.js.map → chunk-FG2BBP3P.js.map} +1 -1
  14. package/dist/{chunk-Y56IIYDF.js → chunk-GMWUIMX4.js} +5 -5
  15. package/dist/{chunk-Y56IIYDF.js.map → chunk-GMWUIMX4.js.map} +1 -1
  16. package/dist/{chunk-OMCWTRBR.js → chunk-NKHM2AIS.js} +21 -4
  17. package/dist/chunk-NKHM2AIS.js.map +1 -0
  18. package/dist/{chunk-YYBU45PK.js → chunk-NXORBVUS.js} +2 -2
  19. package/dist/{chunk-L2K4DBH2.js → chunk-UZ3GJXBR.js} +3003 -3124
  20. package/dist/chunk-UZ3GJXBR.js.map +1 -0
  21. package/dist/{chunk-6YHHCGGY.js → chunk-VPJHNXZ2.js} +50 -74
  22. package/dist/chunk-VPJHNXZ2.js.map +1 -0
  23. package/dist/index-BwDj_3at.d.ts +72 -0
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +175 -88
  26. package/dist/react/_internal/databeat/index.js +7 -6
  27. package/dist/react/_internal/index.d.ts +2 -2
  28. package/dist/react/_internal/index.js +1 -1
  29. package/dist/react/hooks/index.d.ts +3 -65
  30. package/dist/react/hooks/index.js +8 -8
  31. package/dist/react/hooks/options/index.d.ts +8 -0
  32. package/dist/react/hooks/options/index.js +17 -0
  33. package/dist/react/hooks/options/index.js.map +1 -0
  34. package/dist/react/index.css +40 -29
  35. package/dist/react/index.css.map +1 -1
  36. package/dist/react/index.d.ts +3 -2
  37. package/dist/react/index.js +17 -13
  38. package/dist/react/ssr/index.js.map +1 -1
  39. package/dist/react/ui/components/collectible-card/index.css +40 -29
  40. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  41. package/dist/react/ui/components/collectible-card/index.d.ts +3 -2
  42. package/dist/react/ui/components/collectible-card/index.js +12 -11
  43. package/dist/react/ui/components/marketplace-logos/index.d.ts +1 -1
  44. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  45. package/dist/react/ui/icons/index.js +1 -1
  46. package/dist/react/ui/index.css +40 -29
  47. package/dist/react/ui/index.css.map +1 -1
  48. package/dist/react/ui/index.d.ts +1 -1
  49. package/dist/react/ui/index.js +12 -11
  50. package/dist/react/ui/modals/_internal/components/actionModal/index.css +48 -48
  51. package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
  52. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +1 -1
  53. package/dist/react/ui/modals/_internal/components/actionModal/index.js +7 -6
  54. package/dist/styles/index.js +2 -2
  55. package/dist/types/index.js +1 -1
  56. package/dist/utils/index.d.ts +9 -7
  57. package/dist/utils/index.js +5 -3
  58. package/package.json +9 -5
  59. package/src/react/__tests__/provider.test.tsx +4 -4
  60. package/src/react/_internal/api/__mocks__/indexer.msw.ts +5 -5
  61. package/src/react/_internal/api/__mocks__/metadata.msw.ts +2 -2
  62. package/src/react/_internal/api/zod-schema.ts +2 -2
  63. package/src/react/_internal/types.ts +2 -2
  64. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +6 -6
  65. package/src/react/_internal/wallet/__tests__/wallet.test.ts +1 -1
  66. package/src/react/_internal/wallet/wallet.ts +6 -2
  67. package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +8 -12
  68. package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +5 -4
  69. package/src/react/hooks/__tests__/useCancelOrder.test.tsx +13 -6
  70. package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +6 -7
  71. package/src/react/hooks/__tests__/useCollectible.test.tsx +6 -7
  72. package/src/react/hooks/__tests__/useCollection.test.tsx +5 -6
  73. package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +5 -4
  74. package/src/react/hooks/__tests__/useCollectionDetails.test.tsx +7 -6
  75. package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +5 -4
  76. package/src/react/hooks/__tests__/useComparePrices.test.tsx +1 -2
  77. package/src/react/hooks/__tests__/useConvertPriceToUSD.test.tsx +2 -3
  78. package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +4 -5
  79. package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +6 -7
  80. package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +4 -5
  81. package/src/react/hooks/__tests__/useCurrencies.test.tsx +3 -4
  82. package/src/react/hooks/__tests__/useCurrency.test.tsx +4 -6
  83. package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +12 -7
  84. package/src/react/hooks/__tests__/useFilters.test.tsx +5 -6
  85. package/src/react/hooks/__tests__/useFloorOrder.test.tsx +5 -6
  86. package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +6 -7
  87. package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +1 -2
  88. package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +2 -3
  89. package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +1 -2
  90. package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +1 -2
  91. package/src/react/hooks/__tests__/useHighestOffer.test.tsx +6 -7
  92. package/src/react/hooks/__tests__/useListBalances.test.tsx +1 -1
  93. package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +2 -3
  94. package/src/react/hooks/__tests__/useListCollectibles.test.tsx +6 -7
  95. package/src/react/hooks/__tests__/useListCollectiblesPaginated.test.tsx +2 -3
  96. package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +3 -4
  97. package/src/react/hooks/__tests__/useListCollections.test.tsx +1 -2
  98. package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +6 -7
  99. package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +6 -7
  100. package/src/react/hooks/__tests__/useLowestListing.test.tsx +6 -7
  101. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +1 -2
  102. package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +1 -1
  103. package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +3 -4
  104. package/src/react/hooks/options/collectionOptions.ts +42 -0
  105. package/src/react/hooks/options/index.ts +2 -0
  106. package/src/react/hooks/useCancelOrder.tsx +3 -3
  107. package/src/react/hooks/useCancelTransactionSteps.tsx +11 -11
  108. package/src/react/hooks/useCollection.tsx +6 -37
  109. package/src/react/hooks/useCollectionBalanceDetails.tsx +3 -3
  110. package/src/react/hooks/useCollectionDetailsPolling.tsx +1 -1
  111. package/src/react/hooks/useCurrencies.tsx +1 -1
  112. package/src/react/hooks/useGenerateListingTransaction.tsx +1 -1
  113. package/src/react/hooks/useGenerateOfferTransaction.tsx +1 -1
  114. package/src/react/hooks/useGetReceiptFromHash.tsx +1 -1
  115. package/src/react/hooks/useListCollectibleActivities.tsx +1 -1
  116. package/src/react/hooks/useListCollectionActivities.tsx +1 -1
  117. package/src/react/index.ts +1 -0
  118. package/src/react/provider.tsx +2 -2
  119. package/src/react/ssr/__tests__/create-ssr-client.test.ts +1 -22
  120. package/src/react/ssr/create-ssr-client.ts +1 -1
  121. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +3 -3
  122. package/src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx +2 -2
  123. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -4
  124. package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +2 -2
  125. package/src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts +1 -1
  126. package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +2 -7
  127. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +9 -2
  128. package/src/react/ui/components/collectible-card/Footer.tsx +1 -1
  129. package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +1 -1
  130. package/src/react/ui/icons/index.ts +2 -5
  131. package/src/react/ui/{icons/DiamondEye.tsx → images/marketplaces/LooksRare.tsx} +1 -1
  132. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +10 -11
  133. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +343 -0
  134. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +2 -7
  135. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +4 -4
  136. package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +1 -1
  137. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +3 -3
  138. package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +1 -1
  139. package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +23 -24
  140. package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +2 -2
  141. package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +209 -242
  142. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +5 -11
  143. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
  144. package/src/react/ui/modals/CreateListingModal/index.tsx +1 -1
  145. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +1 -1
  146. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +46 -49
  147. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +9 -28
  148. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +2 -2
  149. package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +3 -3
  150. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +4 -4
  151. package/src/react/ui/modals/_internal/components/actionModal/store.ts +1 -1
  152. package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +2 -3
  153. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +4 -4
  154. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
  155. package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -8
  156. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +9 -5
  157. package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +4 -10
  158. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +2 -2
  159. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +1 -1
  160. package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +9 -3
  161. package/src/react/ui/modals/_internal/components/transaction-footer/transactionFooter.css.ts +11 -0
  162. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +4 -9
  163. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +3 -3
  164. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +4 -4
  165. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +1 -1
  166. package/src/react/ui/modals/modal-provider.tsx +2 -2
  167. package/src/utils/__tests__/address.test.ts +1 -1
  168. package/src/utils/__tests__/getMarketplaceDetails.test.ts +4 -4
  169. package/src/utils/getMarketplaceDetails.ts +7 -7
  170. package/src/utils/index.ts +1 -0
  171. package/src/utils/networkconfigToWagmiChain.ts +17 -0
  172. package/src/utils/price.ts +2 -5
  173. package/test/const.ts +35 -0
  174. package/test/globalSetup.ts +15 -0
  175. package/test/index.ts +1 -0
  176. package/{src/react/_internal/test → test}/mocks/wallet.ts +5 -5
  177. package/test/setup.ts +20 -0
  178. package/test/test-utils.tsx +157 -0
  179. package/tsconfig.json +7 -1
  180. package/tsconfig.tsbuildinfo +1 -1
  181. package/vitest.config.js +5 -3
  182. package/dist/chunk-3OU7BADC.js.map +0 -1
  183. package/dist/chunk-6YHHCGGY.js.map +0 -1
  184. package/dist/chunk-GFADBQPX.js +0 -2
  185. package/dist/chunk-L2K4DBH2.js.map +0 -1
  186. package/dist/chunk-OMCWTRBR.js.map +0 -1
  187. package/dist/chunk-YA3DWLDC.js.map +0 -1
  188. package/src/react/_internal/test/setup.ts +0 -28
  189. package/src/react/_internal/test-utils.tsx +0 -97
  190. package/src/react/ui/icons/ArrowUp.tsx +0 -32
  191. package/src/react/ui/icons/InventoryIcon.tsx +0 -44
  192. package/src/react/ui/icons/MinusIcon.tsx +0 -34
  193. package/src/react/ui/icons/PlusIcon.tsx +0 -32
  194. package/src/react/ui/icons/PositiveCircleIcon.tsx +0 -38
  195. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx.bak +0 -379
  196. package/dist/{chunk-GFADBQPX.js.map → chunk-2J7JIOW5.js.map} +0 -0
  197. package/dist/{chunk-YYBU45PK.js.map → chunk-NXORBVUS.js.map} +0 -0
  198. package/dist/{types-BVD42zE_.d.ts → types-CPl0DH-A.d.ts} +1 -1
  199. /package/src/react/ui/icons/{Bell.tsx → BellIcon.tsx} +0 -0
@@ -1,3 +1,4 @@
1
+ import { renderHook, server, waitFor } from '@test';
1
2
  import { http, HttpResponse } from 'msw';
2
3
  import { zeroAddress } from 'viem';
3
4
  import { describe, expect, it } from 'vitest';
@@ -5,12 +6,10 @@ import {
5
6
  mockActivity,
6
7
  mockMarketplaceEndpoint,
7
8
  } from '../../_internal/api/__mocks__/marketplace.msw';
8
- import { SortOrder } from '../../_internal/api/marketplace.gen';
9
9
  import type { ListCollectionActivitiesArgs } from '../../_internal/api/marketplace.gen';
10
- import { renderHook, waitFor } from '../../_internal/test-utils';
11
- import { server } from '../../_internal/test/setup';
12
- import { useListCollectionActivities } from '../useListCollectionActivities';
10
+ import { SortOrder } from '../../_internal/api/marketplace.gen';
13
11
  import type { UseListCollectionActivitiesArgs } from '../useListCollectionActivities';
12
+ import { useListCollectionActivities } from '../useListCollectionActivities';
14
13
 
15
14
  describe('useListCollectionActivities', () => {
16
15
  const defaultArgs: UseListCollectionActivitiesArgs = {
@@ -1,10 +1,9 @@
1
1
  import { ResourceStatus } from '@0xsequence/metadata';
2
+ import { renderHook, server, waitFor } from '@test';
2
3
  import { http, HttpResponse } from 'msw';
3
4
  import { describe, expect, it } from 'vitest';
4
5
  import { MarketplaceType, OrderbookKind } from '../../../types';
5
6
  import { mockContractInfo } from '../../_internal/api/__mocks__/metadata.msw';
6
- import { renderHook, waitFor } from '../../_internal/test-utils';
7
- import { server } from '../../_internal/test/setup';
8
7
  import {
9
8
  createConfigHandler,
10
9
  mockConfig,
@@ -1,14 +1,13 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { useListListingsForCollectible } from '../useListListingsForCollectible';
3
- import { renderHook, waitFor } from '../../_internal/test-utils';
4
- import { zeroAddress } from 'viem';
5
- import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
1
+ import { renderHook, server, waitFor } from '@test';
6
2
  import { http, HttpResponse } from 'msw';
3
+ import { zeroAddress } from 'viem';
4
+ import { describe, expect, it } from 'vitest';
7
5
  import {
8
- mockOrder,
9
6
  mockMarketplaceEndpoint,
7
+ mockOrder,
10
8
  } from '../../_internal/api/__mocks__/marketplace.msw';
11
- import { server } from '../../_internal/test/setup';
9
+ import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
10
+ import { useListListingsForCollectible } from '../useListListingsForCollectible';
12
11
 
13
12
  describe('useListListingsForCollectible', () => {
14
13
  const defaultArgs = {
@@ -1,14 +1,13 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { useListOffersForCollectible } from '../useListOffersForCollectible';
3
- import { renderHook, waitFor } from '../../_internal/test-utils';
4
- import { zeroAddress } from 'viem';
5
- import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
1
+ import { renderHook, server, waitFor } from '@test';
6
2
  import { http, HttpResponse } from 'msw';
3
+ import { zeroAddress } from 'viem';
4
+ import { describe, expect, it } from 'vitest';
7
5
  import {
8
- mockOrder,
9
6
  mockMarketplaceEndpoint,
7
+ mockOrder,
10
8
  } from '../../_internal/api/__mocks__/marketplace.msw';
11
- import { server } from '../../_internal/test/setup';
9
+ import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
10
+ import { useListOffersForCollectible } from '../useListOffersForCollectible';
12
11
 
13
12
  describe('useListOffersForCollectible', () => {
14
13
  const defaultArgs = {
@@ -1,14 +1,13 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { useLowestListing } from '../useLowestListing';
3
- import { renderHook, waitFor } from '../../_internal/test-utils';
4
- import { zeroAddress } from 'viem';
5
- import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
1
+ import { renderHook, server, waitFor } from '@test';
6
2
  import { http, HttpResponse } from 'msw';
3
+ import { zeroAddress } from 'viem';
4
+ import { describe, expect, it } from 'vitest';
7
5
  import {
8
- mockOrder,
9
6
  mockMarketplaceEndpoint,
7
+ mockOrder,
10
8
  } from '../../_internal/api/__mocks__/marketplace.msw';
11
- import { server } from '../../_internal/test/setup';
9
+ import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
10
+ import { useLowestListing } from '../useLowestListing';
12
11
 
13
12
  describe('useLowestListing', () => {
14
13
  const defaultArgs = {
@@ -1,6 +1,5 @@
1
+ import { renderHook, server, waitFor } from '@test';
1
2
  import { describe, expect, it } from 'vitest';
2
- import { renderHook, waitFor } from '../../_internal/test-utils';
3
- import { server } from '../../_internal/test/setup';
4
3
  import {
5
4
  createConfigHandler,
6
5
  createErrorHandler,
@@ -1,5 +1,5 @@
1
+ import { renderHook, waitFor } from '@test';
1
2
  import { beforeEach, describe, expect, it, vi } from 'vitest';
2
- import { renderHook, waitFor } from '../../_internal/test-utils';
3
3
  import { useRoyaltyPercentage } from '../useRoyaltyPercentage';
4
4
 
5
5
  describe('useRoyaltyPercentage', () => {
@@ -1,14 +1,13 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { marketplaceConfigOptions } from '../marketplaceConfigOptions';
3
- import { renderHook, waitFor } from '../../../_internal/test-utils';
4
1
  import type { QueryFunctionContext } from '@tanstack/react-query';
2
+ import { renderHook, server, waitFor } from '@test';
3
+ import { describe, expect, it } from 'vitest';
5
4
  import {
6
5
  createErrorHandler,
7
6
  createStylesErrorHandler,
8
7
  mockConfig,
9
8
  mockStyles,
10
9
  } from '../__mocks__/marketplaceConfig.msw';
11
- import { server } from '../../../_internal/test/setup';
10
+ import { marketplaceConfigOptions } from '../marketplaceConfigOptions';
12
11
 
13
12
  type MarketplaceConfigQueryKey = ['configs', 'marketplace', string, string];
14
13
  type MarketplaceConfigContext = QueryFunctionContext<MarketplaceConfigQueryKey>;
@@ -0,0 +1,42 @@
1
+ import { queryOptions } from '@tanstack/react-query';
2
+ import { z } from 'zod';
3
+ import type { SdkConfig } from '../../../types';
4
+ import {
5
+ AddressSchema,
6
+ ChainIdSchema,
7
+ QueryArgSchema,
8
+ collectionKeys,
9
+ getMetadataClient,
10
+ } from '../../_internal';
11
+ import type { UseCollectionArgs } from '../useCollection';
12
+
13
+ export const UseCollectionSchema = z.object({
14
+ chainId: ChainIdSchema.pipe(z.coerce.string()),
15
+ collectionAddress: AddressSchema,
16
+ query: QueryArgSchema,
17
+ });
18
+
19
+ export const fetchCollection = async (
20
+ args: UseCollectionArgs,
21
+ config: SdkConfig,
22
+ ) => {
23
+ const parsedArgs = UseCollectionSchema.parse(args);
24
+ const metadataClient = getMetadataClient(config);
25
+ return metadataClient
26
+ .getContractInfo({
27
+ chainID: parsedArgs.chainId,
28
+ contractAddress: parsedArgs.collectionAddress,
29
+ })
30
+ .then((resp) => resp.contractInfo);
31
+ };
32
+
33
+ export const collectionOptions = (
34
+ args: UseCollectionArgs,
35
+ config: SdkConfig,
36
+ ) => {
37
+ return queryOptions({
38
+ ...args.query,
39
+ queryKey: [...collectionKeys.detail, args, config],
40
+ queryFn: () => fetchCollection(args, config),
41
+ });
42
+ };
@@ -0,0 +1,2 @@
1
+ export { fetchCollection, collectionOptions } from './collectionOptions';
2
+ export * from './marketplaceConfigOptions';
@@ -1,8 +1,8 @@
1
- import { useState, useEffect } from 'react';
2
- import { useCancelTransactionSteps } from './useCancelTransactionSteps';
3
- import type { MarketplaceKind } from '../../types';
4
1
  import { useWaasFeeOptions } from '@0xsequence/kit';
2
+ import { useEffect, useState } from 'react';
3
+ import type { MarketplaceKind } from '../../types';
5
4
  import { useAutoSelectFeeOption } from './useAutoSelectFeeOption';
5
+ import { useCancelTransactionSteps } from './useCancelTransactionSteps';
6
6
 
7
7
  interface UseCancelOrderArgs {
8
8
  collectionAddress: string;
@@ -1,26 +1,26 @@
1
+ import type { Hex } from 'viem';
2
+ import {
3
+ ChainSwitchUserRejectedError,
4
+ WalletInstanceNotFoundError,
5
+ } from '../../utils/_internal/error/transaction';
1
6
  import {
2
7
  ExecuteType,
3
- getMarketplaceClient,
4
- getQueryClient,
5
8
  type MarketplaceKind,
6
9
  type Step,
7
10
  StepType,
11
+ getMarketplaceClient,
12
+ getQueryClient,
8
13
  } from '../_internal';
9
- import { useWallet } from '../_internal/wallet/useWallet';
10
- import type { ModalCallbacks } from '../ui/modals/_internal/types';
11
- import { useConfig } from './useConfig';
12
- import { useGenerateCancelTransaction } from './useGenerateCancelTransaction';
13
14
  import type {
14
15
  SignatureStep,
15
16
  TransactionStep as walletTransactionStep,
16
17
  } from '../_internal/utils';
17
- import type { Hex } from 'viem';
18
+ import { useWallet } from '../_internal/wallet/useWallet';
18
19
  import { useSwitchChainModal } from '../ui/modals/_internal/components/switchChainModal';
19
- import {
20
- ChainSwitchUserRejectedError,
21
- WalletInstanceNotFoundError,
22
- } from '../../utils/_internal/error/transaction';
20
+ import type { ModalCallbacks } from '../ui/modals/_internal/types';
23
21
  import type { TransactionStep } from './useCancelOrder';
22
+ import { useConfig } from './useConfig';
23
+ import { useGenerateCancelTransaction } from './useGenerateCancelTransaction';
24
24
 
25
25
  interface UseCancelTransactionStepsArgs {
26
26
  collectionAddress: string;
@@ -1,47 +1,16 @@
1
- import { queryOptions, useQuery } from '@tanstack/react-query';
2
- import { z } from 'zod';
3
- import type { SdkConfig } from '../../types';
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import type { z } from 'zod';
4
3
  import {
5
- AddressSchema,
6
- ChainIdSchema,
7
- QueryArgSchema,
8
- collectionKeys,
9
- getMetadataClient,
10
- } from '../_internal';
4
+ type UseCollectionSchema,
5
+ collectionOptions,
6
+ type fetchCollection,
7
+ } from './options/collectionOptions';
11
8
  import { useConfig } from './useConfig';
12
9
 
13
- const UseCollectionSchema = z.object({
14
- chainId: ChainIdSchema.pipe(z.coerce.string()),
15
- collectionAddress: AddressSchema,
16
- query: QueryArgSchema,
17
- });
18
-
19
10
  export type UseCollectionArgs = z.input<typeof UseCollectionSchema>;
20
11
 
21
12
  export type UseCollectionReturn = Awaited<ReturnType<typeof fetchCollection>>;
22
13
 
23
- const fetchCollection = async (args: UseCollectionArgs, config: SdkConfig) => {
24
- const parsedArgs = UseCollectionSchema.parse(args);
25
- const metadataClient = getMetadataClient(config);
26
- return metadataClient
27
- .getContractInfo({
28
- chainID: parsedArgs.chainId,
29
- contractAddress: parsedArgs.collectionAddress,
30
- })
31
- .then((resp) => resp.contractInfo);
32
- };
33
-
34
- export const collectionOptions = (
35
- args: UseCollectionArgs,
36
- config: SdkConfig,
37
- ) => {
38
- return queryOptions({
39
- ...args.query,
40
- queryKey: [...collectionKeys.detail, args, config],
41
- queryFn: () => fetchCollection(args, config),
42
- });
43
- };
44
-
45
14
  export const useCollection = (args: UseCollectionArgs) => {
46
15
  const config = useConfig();
47
16
  return useQuery(collectionOptions(args, config));
@@ -1,4 +1,7 @@
1
+ import type { GetTokenBalancesDetailsReturn } from '@0xsequence/indexer';
2
+ import { queryOptions, useQuery } from '@tanstack/react-query';
1
3
  import { z } from 'zod';
4
+ import type { SdkConfig } from '../../types';
2
5
  import {
3
6
  AddressSchema,
4
7
  ChainIdSchema,
@@ -6,10 +9,7 @@ import {
6
9
  balanceQueries,
7
10
  getIndexerClient,
8
11
  } from '../_internal';
9
- import { queryOptions, useQuery } from '@tanstack/react-query';
10
12
  import { useConfig } from './useConfig';
11
- import type { GetTokenBalancesDetailsReturn } from '@0xsequence/indexer';
12
- import type { SdkConfig } from '../../types';
13
13
 
14
14
  const filterSchema = z.object({
15
15
  accountAddresses: z.array(AddressSchema),
@@ -1,8 +1,8 @@
1
1
  import { queryOptions, useQuery } from '@tanstack/react-query';
2
2
  import type { SdkConfig } from '../../types';
3
3
  import { CollectionStatus } from '../_internal/api/marketplace.gen';
4
- import { useConfig } from './useConfig';
5
4
  import { collectionDetailsOptions } from './useCollectionDetails';
5
+ import { useConfig } from './useConfig';
6
6
 
7
7
  type UseCollectionDetailsPolling = {
8
8
  collectionAddress: string;
@@ -5,10 +5,10 @@ import type { SdkConfig } from '../../types';
5
5
  import {
6
6
  AddressSchema,
7
7
  ChainIdSchema,
8
+ QueryArgSchema,
8
9
  currencyKeys,
9
10
  getMarketplaceClient,
10
11
  getQueryClient,
11
- QueryArgSchema,
12
12
  } from '../_internal';
13
13
  import { useConfig } from './useConfig';
14
14
  import { marketplaceConfigOptions } from './useMarketplaceConfig';
@@ -7,6 +7,7 @@ export type UseGenerateListingTransactionArgs = {
7
7
  };
8
8
 
9
9
  import type { SdkConfig } from '../../types';
10
+ import { dateToUnixTime } from '../../utils/date';
10
11
  import {
11
12
  type ChainId,
12
13
  type CreateReq,
@@ -14,7 +15,6 @@ import {
14
15
  type Step,
15
16
  getMarketplaceClient,
16
17
  } from '../_internal';
17
- import { dateToUnixTime } from '../../utils/date';
18
18
 
19
19
  export type CreateReqWithDateExpiry = Omit<CreateReq, 'expiry'> & {
20
20
  expiry: Date;
@@ -1,5 +1,6 @@
1
1
  import { useMutation } from '@tanstack/react-query';
2
2
  import type { SdkConfig } from '../../types';
3
+ import { dateToUnixTime } from '../../utils/date';
3
4
  import {
4
5
  type ChainId,
5
6
  type CreateReq,
@@ -8,7 +9,6 @@ import {
8
9
  getMarketplaceClient,
9
10
  } from '../_internal';
10
11
  import { useConfig } from './useConfig';
11
- import { dateToUnixTime } from '../../utils/date';
12
12
 
13
13
  export type UseGenerateOfferTransactionArgs = {
14
14
  chainId: ChainId;
@@ -1,6 +1,6 @@
1
+ import { useCallback } from 'react';
1
2
  import type { Hex } from 'viem';
2
3
  import { usePublicClient } from 'wagmi';
3
- import { useCallback } from 'react';
4
4
 
5
5
  /**
6
6
  * @returns a function to wait for a transaction receipt and the receipt
@@ -2,11 +2,11 @@ import { queryOptions, useQuery } from '@tanstack/react-query';
2
2
  import type { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import { collectableKeys, getMarketplaceClient } from '../_internal';
5
- import { useConfig } from './useConfig';
6
5
  import type {
7
6
  getListCollectibleActivitiesArgsSchema,
8
7
  getListCollectibleActivitiesReturnSchema,
9
8
  } from '../_internal/api/zod-schema';
9
+ import { useConfig } from './useConfig';
10
10
 
11
11
  export type UseListCollectibleActivitiesArgs = z.infer<
12
12
  typeof getListCollectibleActivitiesArgsSchema
@@ -3,11 +3,11 @@ import type { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import { getMarketplaceClient } from '../_internal';
5
5
  import { collectionKeys } from '../_internal/api';
6
- import { useConfig } from './useConfig';
7
6
  import type {
8
7
  getListCollectionActivitiesArgsSchema,
9
8
  getListCollectionActivitiesReturnSchema,
10
9
  } from '../_internal/api/zod-schema';
10
+ import { useConfig } from './useConfig';
11
11
 
12
12
  export type UseListCollectionActivitiesArgs = z.infer<
13
13
  typeof getListCollectionActivitiesArgsSchema
@@ -1,5 +1,6 @@
1
1
  export * from './provider';
2
2
  export * from './hooks';
3
+ export * from './hooks/options';
3
4
  export * from './_internal/api/get-query-client';
4
5
  export * from './_internal/wagmi/create-config';
5
6
  export * from './ui/index';
@@ -4,9 +4,9 @@ import { QueryClientProvider } from '@tanstack/react-query';
4
4
  import { createContext } from 'react';
5
5
  import '@0xsequence/design-system/styles.css';
6
6
  import type { SdkConfig } from '../types';
7
- import { PROVIDER_ID } from './_internal/get-provider';
8
- import { getQueryClient } from './_internal/api/get-query-client';
9
7
  import { InvalidProjectAccessKeyError } from '../utils/_internal/error/config';
8
+ import { getQueryClient } from './_internal/api/get-query-client';
9
+ import { PROVIDER_ID } from './_internal/get-provider';
10
10
 
11
11
  export const MarketplaceSdkContext = createContext({} as SdkConfig);
12
12
 
@@ -1,20 +1,9 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
- import { setupServer } from 'msw/node';
3
- import {
4
- afterAll,
5
- beforeAll,
6
- beforeEach,
7
- describe,
8
- expect,
9
- it,
10
- vi,
11
- } from 'vitest';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
12
3
  import type { SdkConfig } from '../../../types';
13
4
  import { mockConfig } from '../../hooks/options/__mocks__/marketplaceConfig.msw';
14
5
  import { createSSRClient } from '../create-ssr-client';
15
6
 
16
- const server = setupServer();
17
-
18
7
  vi.mock('wagmi', () => ({
19
8
  cookieToInitialState: vi.fn().mockReturnValue({
20
9
  data: { account: { address: '0x123' } },
@@ -25,16 +14,6 @@ describe('createSSRClient', () => {
25
14
  let queryClient: QueryClient;
26
15
  let config: SdkConfig;
27
16
 
28
- beforeAll(() => {
29
- // Start MSW server once before all tests
30
- server.listen({ onUnhandledRequest: 'error' });
31
- });
32
-
33
- afterAll(() => {
34
- // Clean up after all tests are done
35
- server.close();
36
- });
37
-
38
17
  beforeEach(() => {
39
18
  // Reset QueryClient
40
19
  queryClient = new QueryClient({
@@ -1,8 +1,8 @@
1
+ import type { QueryClient } from '@tanstack/react-query';
1
2
  import { type State, cookieToInitialState } from 'wagmi';
2
3
  import type { SdkConfig } from '../../types/sdk-config';
3
4
  import { createWagmiConfig } from '../_internal/wagmi/create-config';
4
5
  import { marketplaceConfigOptions } from '../hooks/options/marketplaceConfigOptions';
5
- import type { QueryClient } from '@tanstack/react-query';
6
6
 
7
7
  type InitSSRClientArgs = {
8
8
  cookie: string;
@@ -3,10 +3,10 @@
3
3
  import { observer } from '@legendapp/state/react';
4
4
  import type { Hex } from 'viem';
5
5
  import type { Order, OrderbookKind } from '../../../../_internal';
6
- import type { CollectibleCardAction } from './types';
7
- import { useActionButtonLogic } from './hooks/useActionButtonLogic';
8
- import { OwnerActions } from './components/OwnerActions';
9
6
  import { NonOwnerActions } from './components/NonOwnerActions';
7
+ import { OwnerActions } from './components/OwnerActions';
8
+ import { useActionButtonLogic } from './hooks/useActionButtonLogic';
9
+ import type { CollectibleCardAction } from './types';
10
10
 
11
11
  type ActionButtonProps = {
12
12
  chainId: string;
@@ -1,9 +1,9 @@
1
1
  import { Button } from '@0xsequence/design-system';
2
- import { useAccount } from 'wagmi';
3
2
  import { useOpenConnectModal } from '@0xsequence/kit';
4
- import type { CollectibleCardAction } from '../types';
3
+ import { useAccount } from 'wagmi';
5
4
  import { setPendingAction } from '../store';
6
5
  import { actionButton } from '../styles.css';
6
+ import type { CollectibleCardAction } from '../types';
7
7
 
8
8
  type ActionButtonBodyProps = {
9
9
  label: 'Buy now' | 'Sell' | 'Make an offer' | 'Create listing' | 'Transfer';
@@ -1,11 +1,11 @@
1
1
  import type { Hex } from 'viem';
2
+ import { InvalidStepError } from '../../../../../../utils/_internal/error/transaction';
2
3
  import type { Order, OrderbookKind } from '../../../../../_internal';
3
- import { CollectibleCardAction } from '../types';
4
- import { ActionButtonBody } from './ActionButtonBody';
4
+ import SvgCartIcon from '../../../../icons/CartIcon';
5
5
  import { useBuyModal } from '../../../../modals/BuyModal';
6
6
  import { useMakeOfferModal } from '../../../../modals/MakeOfferModal';
7
- import { InvalidStepError } from '../../../../../../utils/_internal/error/transaction';
8
- import SvgCartIcon from '../../../../icons/CartIcon';
7
+ import { CollectibleCardAction } from '../types';
8
+ import { ActionButtonBody } from './ActionButtonBody';
9
9
 
10
10
  type NonOwnerActionsProps = {
11
11
  action: CollectibleCardAction;
@@ -1,10 +1,10 @@
1
1
  import type { Hex } from 'viem';
2
2
  import type { Order, OrderbookKind } from '../../../../../_internal';
3
- import { CollectibleCardAction } from '../types';
4
- import { ActionButtonBody } from './ActionButtonBody';
5
3
  import { useCreateListingModal } from '../../../../modals/CreateListingModal';
6
4
  import { useSellModal } from '../../../../modals/SellModal';
7
5
  import { useTransferModal } from '../../../../modals/TransferModal';
6
+ import { CollectibleCardAction } from '../types';
7
+ import { ActionButtonBody } from './ActionButtonBody';
8
8
 
9
9
  type OwnerActionsProps = {
10
10
  action: CollectibleCardAction;
@@ -1,11 +1,11 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useAccount } from 'wagmi';
3
- import { CollectibleCardAction } from '../types';
4
3
  import {
5
4
  actionButtonStore,
6
5
  clearPendingAction,
7
6
  executePendingActionIfExists,
8
7
  } from '../store';
8
+ import { CollectibleCardAction } from '../types';
9
9
 
10
10
  type UseActionButtonLogicProps = {
11
11
  tokenId: string;
@@ -1,11 +1,6 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
1
+ import { cleanup, fireEvent, render, screen } from '@test';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
3
  import { CustomSelect, type SelectItem } from '../CustomSelect';
3
- import {
4
- cleanup,
5
- render,
6
- screen,
7
- fireEvent,
8
- } from '../../../../../_internal/test-utils';
9
4
 
10
5
  describe('CustomSelect', () => {
11
6
  const mockItems: SelectItem[] = [
@@ -10,8 +10,8 @@ import type {
10
10
  OrderbookKind,
11
11
  } from '../../../_internal';
12
12
  import { useCurrency } from '../../../hooks';
13
- import SvgDiamondEyeIcon from '../../icons/DiamondEye';
14
13
  import ChessTileImage from '../../images/chess-tile.png';
14
+ import SvgDiamondEyeIcon from '../../images/marketplaces/LooksRare';
15
15
  import { ActionButton } from '../_internals/action-button/ActionButton';
16
16
  import { CollectibleCardAction } from '../_internals/action-button/types';
17
17
  import { Footer } from './Footer';
@@ -60,6 +60,7 @@ type CollectibleCardProps = {
60
60
  lowestListing: CollectibleOrder | undefined;
61
61
  onCollectibleClick?: (tokenId: string) => void;
62
62
  onOfferClick?: ({ order }: { order?: Order }) => void;
63
+ imageSrcPrefixUrl?: string;
63
64
  balance?: string;
64
65
  cardLoading?: boolean;
65
66
  /**
@@ -93,6 +94,7 @@ export function CollectibleCard({
93
94
  balance,
94
95
  cardLoading,
95
96
  onCannotPerformAction,
97
+ imageSrcPrefixUrl,
96
98
  }: CollectibleCardProps) {
97
99
  const collectibleMetadata = lowestListing?.metadata;
98
100
  const highestOffer = lowestListing?.offer;
@@ -123,6 +125,7 @@ export function CollectibleCard({
123
125
  const name = collectibleMetadata?.name;
124
126
  const image = collectibleMetadata?.image;
125
127
  const externalUrl = collectibleMetadata?.external_url;
128
+ const proxiedImage = `${imageSrcPrefixUrl}/${image}`;
126
129
 
127
130
  return (
128
131
  <Box
@@ -183,7 +186,11 @@ export function CollectibleCard({
183
186
  />
184
187
  )}
185
188
  <img
186
- src={imageLoadingError ? ChessTileImage : image || ChessTileImage}
189
+ src={
190
+ imageLoadingError
191
+ ? ChessTileImage
192
+ : (imageSrcPrefixUrl ? proxiedImage : image) || ChessTileImage
193
+ }
187
194
  alt={name}
188
195
  className={
189
196
  imageLoading
@@ -8,7 +8,7 @@ import {
8
8
  } from '@0xsequence/design-system';
9
9
  import { formatUnits } from 'viem';
10
10
  import { ContractType, type Currency, type Order } from '../../../_internal';
11
- import SvgBellIcon from '../../icons/Bell';
11
+ import SvgBellIcon from '../../icons/BellIcon';
12
12
  import { footer, footerPriceChevron, offerBellButton } from './styles.css';
13
13
 
14
14
  const OVERFLOW_PRICE = 100000000;
@@ -1,5 +1,5 @@
1
- import { type ComponentProps, lazy, Suspense } from 'react';
2
1
  import { Image } from '@0xsequence/design-system';
2
+ import { type ComponentProps, Suspense, lazy } from 'react';
3
3
 
4
4
  /* @__PURE__ */
5
5
  const createMarketplaceLogo = (
@@ -1,7 +1,4 @@
1
+ export * from './BellIcon';
1
2
  export * from './CalendarIcon';
2
- export * from './InventoryIcon';
3
- export * from './MinusIcon';
4
- export * from './PlusIcon';
5
- export * from './ArrowUp';
3
+ export * from './CartIcon';
6
4
  export * from './InfoIcon';
7
- export * from './PositiveCircleIcon';
@@ -1,5 +1,5 @@
1
1
  import { Box, type IconProps } from '@0xsequence/design-system';
2
- import { iconVariants } from './styles.css';
2
+ import { iconVariants } from '../../icons/styles.css';
3
3
 
4
4
  const Svg = () => (
5
5
  <svg