@0xsequence/marketplace-sdk 0.5.6 → 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 (240) hide show
  1. package/dist/chunk-2J7JIOW5.js +2 -0
  2. package/dist/chunk-2J7JIOW5.js.map +1 -0
  3. package/dist/{chunk-Y75XGZOB.js → chunk-5O3ZAEEX.js} +4 -2
  4. package/dist/chunk-5O3ZAEEX.js.map +1 -0
  5. package/dist/{chunk-J6F5QOW5.js → chunk-6MYDUGVO.js} +28 -77
  6. package/dist/chunk-6MYDUGVO.js.map +1 -0
  7. package/dist/chunk-6WMO5YM5.js +94 -0
  8. package/dist/chunk-6WMO5YM5.js.map +1 -0
  9. package/dist/{chunk-AIGFG26L.js → chunk-A5ICXOCZ.js} +183 -250
  10. package/dist/chunk-A5ICXOCZ.js.map +1 -0
  11. package/dist/{chunk-4YR6AIXG.js → chunk-C42WHQRT.js} +6 -8
  12. package/dist/chunk-C42WHQRT.js.map +1 -0
  13. package/dist/{chunk-ZBLU3Q22.js → chunk-DLB2EQRX.js} +2 -2
  14. package/dist/{chunk-ZBLU3Q22.js.map → chunk-DLB2EQRX.js.map} +1 -1
  15. package/dist/{chunk-YOKGP2EQ.js → chunk-FG2BBP3P.js} +1 -1
  16. package/dist/{chunk-YOKGP2EQ.js.map → chunk-FG2BBP3P.js.map} +1 -1
  17. package/dist/{chunk-UZIAX32Y.js → chunk-GMWUIMX4.js} +10 -8
  18. package/dist/{chunk-UZIAX32Y.js.map → chunk-GMWUIMX4.js.map} +1 -1
  19. package/dist/{chunk-7C7ADZ2H.js → chunk-NKHM2AIS.js} +28 -44
  20. package/dist/chunk-NKHM2AIS.js.map +1 -0
  21. package/dist/{chunk-RIGIV5XT.js → chunk-NXORBVUS.js} +10 -4
  22. package/dist/chunk-NXORBVUS.js.map +1 -0
  23. package/dist/{chunk-7FN62HOP.js → chunk-UMYRZJVY.js} +11 -3
  24. package/dist/chunk-UMYRZJVY.js.map +1 -0
  25. package/dist/{chunk-E2V2BMF6.js → chunk-UZ3GJXBR.js} +2979 -3037
  26. package/dist/chunk-UZ3GJXBR.js.map +1 -0
  27. package/dist/{chunk-6YHHCGGY.js → chunk-VPJHNXZ2.js} +50 -74
  28. package/dist/chunk-VPJHNXZ2.js.map +1 -0
  29. package/dist/{create-config-CtFGrwXc.d.ts → create-config-CILyA_Hy.d.ts} +1 -1
  30. package/dist/index-BwDj_3at.d.ts +72 -0
  31. package/dist/index.css +12 -6
  32. package/dist/index.d.ts +7 -6
  33. package/dist/index.js +175 -85
  34. package/dist/react/_internal/api/index.d.ts +2 -2
  35. package/dist/react/_internal/databeat/index.css.map +1 -1
  36. package/dist/react/_internal/databeat/index.js +9 -8
  37. package/dist/react/_internal/index.d.ts +5 -5
  38. package/dist/react/_internal/index.js +2 -2
  39. package/dist/react/_internal/wagmi/index.d.ts +2 -2
  40. package/dist/react/_internal/wagmi/index.js +1 -1
  41. package/dist/react/hooks/index.css.map +1 -1
  42. package/dist/react/hooks/index.d.ts +10 -79
  43. package/dist/react/hooks/index.js +10 -10
  44. package/dist/react/hooks/options/index.d.ts +8 -0
  45. package/dist/react/hooks/options/index.js +17 -0
  46. package/dist/react/hooks/options/index.js.map +1 -0
  47. package/dist/react/index.css +52 -35
  48. package/dist/react/index.css.map +1 -1
  49. package/dist/react/index.d.ts +6 -5
  50. package/dist/react/index.js +19 -14
  51. package/dist/react/ssr/index.d.ts +1 -0
  52. package/dist/react/ssr/index.js +10 -2
  53. package/dist/react/ssr/index.js.map +1 -1
  54. package/dist/react/ui/components/collectible-card/index.css +52 -35
  55. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  56. package/dist/react/ui/components/collectible-card/index.d.ts +4 -3
  57. package/dist/react/ui/components/collectible-card/index.js +14 -12
  58. package/dist/react/ui/components/marketplace-logos/index.d.ts +1 -1
  59. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  60. package/dist/react/ui/icons/index.css.map +1 -1
  61. package/dist/react/ui/icons/index.js +1 -1
  62. package/dist/react/ui/index.css +52 -35
  63. package/dist/react/ui/index.css.map +1 -1
  64. package/dist/react/ui/index.d.ts +2 -2
  65. package/dist/react/ui/index.js +14 -12
  66. package/dist/react/ui/modals/_internal/components/actionModal/index.css +48 -48
  67. package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
  68. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
  69. package/dist/react/ui/modals/_internal/components/actionModal/index.js +9 -8
  70. package/dist/react/ui/styles/index.css.map +1 -1
  71. package/dist/{sdk-config-xWkdBdrL.d.ts → sdk-config-Bs3H_le_.d.ts} +1 -0
  72. package/dist/{services-Cled3TJr.d.ts → services-C3lzi1sL.d.ts} +1 -1
  73. package/dist/styles/index.css +12 -6
  74. package/dist/styles/index.css.map +1 -1
  75. package/dist/styles/index.d.ts +3 -2
  76. package/dist/styles/index.js +3 -1
  77. package/dist/types/index.d.ts +1 -1
  78. package/dist/types/index.js +2 -2
  79. package/dist/{types-C4oGsbnK.d.ts → types-CPl0DH-A.d.ts} +2 -2
  80. package/dist/utils/abi/index.js +5 -5
  81. package/dist/utils/index.d.ts +10 -9
  82. package/dist/utils/index.js +13 -11
  83. package/package.json +19 -15
  84. package/src/consts.ts +2 -0
  85. package/src/react/__tests__/provider.test.tsx +4 -4
  86. package/src/react/_internal/api/__mocks__/indexer.msw.ts +5 -5
  87. package/src/react/_internal/api/__mocks__/metadata.msw.ts +2 -2
  88. package/src/react/_internal/api/zod-schema.ts +2 -2
  89. package/src/react/_internal/databeat/index.ts +11 -3
  90. package/src/react/_internal/types.ts +2 -2
  91. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +6 -6
  92. package/src/react/_internal/wagmi/create-config.ts +11 -2
  93. package/src/react/_internal/wallet/__tests__/wallet.test.ts +343 -0
  94. package/src/react/_internal/wallet/useWallet.ts +22 -15
  95. package/src/react/_internal/wallet/wallet.ts +17 -11
  96. package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +8 -12
  97. package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +6 -13
  98. package/src/react/hooks/__tests__/useCancelOrder.test.tsx +59 -155
  99. package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +21 -20
  100. package/src/react/hooks/__tests__/useCollectible.test.tsx +6 -7
  101. package/src/react/hooks/__tests__/useCollection.test.tsx +5 -6
  102. package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +8 -16
  103. package/src/react/hooks/__tests__/useCollectionDetails.test.tsx +7 -6
  104. package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +8 -12
  105. package/src/react/hooks/__tests__/useComparePrices.test.tsx +1 -2
  106. package/src/react/hooks/__tests__/useConvertPriceToUSD.test.tsx +2 -3
  107. package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +4 -5
  108. package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +6 -7
  109. package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +4 -5
  110. package/src/react/hooks/__tests__/useCurrencies.test.tsx +3 -4
  111. package/src/react/hooks/__tests__/useCurrency.test.tsx +4 -6
  112. package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +78 -84
  113. package/src/react/hooks/__tests__/useFilters.test.tsx +5 -6
  114. package/src/react/hooks/__tests__/useFloorOrder.test.tsx +5 -6
  115. package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +6 -7
  116. package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +11 -67
  117. package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +6 -17
  118. package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +6 -16
  119. package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +7 -17
  120. package/src/react/hooks/__tests__/useHighestOffer.test.tsx +6 -7
  121. package/src/react/hooks/__tests__/useListBalances.test.tsx +4 -9
  122. package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +5 -11
  123. package/src/react/hooks/__tests__/useListCollectibles.test.tsx +6 -7
  124. package/src/react/hooks/__tests__/useListCollectiblesPaginated.test.tsx +2 -3
  125. package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +6 -12
  126. package/src/react/hooks/__tests__/useListCollections.test.tsx +5 -14
  127. package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +6 -7
  128. package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +6 -7
  129. package/src/react/hooks/__tests__/useLowestListing.test.tsx +6 -7
  130. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +5 -14
  131. package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +46 -78
  132. package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +9 -4
  133. package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +3 -4
  134. package/src/react/hooks/options/collectionOptions.ts +42 -0
  135. package/src/react/hooks/options/index.ts +2 -0
  136. package/src/react/hooks/useCancelOrder.tsx +3 -3
  137. package/src/react/hooks/useCancelTransactionSteps.tsx +11 -11
  138. package/src/react/hooks/useCollection.tsx +6 -37
  139. package/src/react/hooks/useCollectionBalanceDetails.tsx +3 -3
  140. package/src/react/hooks/useCollectionDetailsPolling.tsx +1 -1
  141. package/src/react/hooks/useCurrencies.tsx +1 -1
  142. package/src/react/hooks/useCurrencyBalance.tsx +4 -5
  143. package/src/react/hooks/useGenerateListingTransaction.tsx +1 -1
  144. package/src/react/hooks/useGenerateOfferTransaction.tsx +1 -1
  145. package/src/react/hooks/useGetReceiptFromHash.tsx +1 -1
  146. package/src/react/hooks/useListCollectibleActivities.tsx +1 -1
  147. package/src/react/hooks/useListCollectionActivities.tsx +1 -1
  148. package/src/react/hooks/useRoyaltyPercentage.tsx +16 -8
  149. package/src/react/index.ts +1 -0
  150. package/src/react/provider.tsx +2 -2
  151. package/src/react/ssr/__tests__/create-ssr-client.test.ts +97 -0
  152. package/src/react/ssr/create-ssr-client.ts +1 -1
  153. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +3 -3
  154. package/src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx +2 -2
  155. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -4
  156. package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +2 -2
  157. package/src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts +1 -1
  158. package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +2 -7
  159. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +33 -7
  160. package/src/react/ui/components/collectible-card/Footer.tsx +47 -8
  161. package/src/react/ui/components/collectible-card/styles.css.ts +26 -2
  162. package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +1 -1
  163. package/src/react/ui/icons/index.ts +2 -5
  164. package/src/react/ui/{icons/DiamondEye.tsx → images/marketplaces/LooksRare.tsx} +1 -1
  165. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +10 -11
  166. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +343 -0
  167. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +8 -31
  168. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +4 -4
  169. package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +9 -36
  170. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +3 -3
  171. package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +1 -1
  172. package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +25 -15
  173. package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +2 -2
  174. package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +209 -242
  175. package/src/react/ui/modals/CreateListingModal/Modal.tsx +3 -2
  176. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +5 -11
  177. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
  178. package/src/react/ui/modals/CreateListingModal/index.tsx +1 -1
  179. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +1 -1
  180. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +46 -49
  181. package/src/react/ui/modals/SellModal/Modal.tsx +1 -0
  182. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +9 -28
  183. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +2 -2
  184. package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +3 -3
  185. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +4 -4
  186. package/src/react/ui/modals/_internal/components/actionModal/store.ts +1 -1
  187. package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +2 -3
  188. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +4 -4
  189. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
  190. package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -8
  191. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +9 -5
  192. package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +4 -10
  193. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +2 -2
  194. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +1 -1
  195. package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +9 -3
  196. package/src/react/ui/modals/_internal/components/transaction-footer/transactionFooter.css.ts +11 -0
  197. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +8 -7
  198. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +4 -9
  199. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +3 -3
  200. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +4 -4
  201. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +1 -1
  202. package/src/react/ui/modals/modal-provider.tsx +2 -2
  203. package/src/types/sdk-config.ts +1 -0
  204. package/src/utils/__tests__/address.test.ts +1 -1
  205. package/src/utils/__tests__/getMarketplaceDetails.test.ts +4 -4
  206. package/src/utils/getMarketplaceDetails.ts +7 -7
  207. package/src/utils/index.ts +1 -1
  208. package/src/utils/networkconfigToWagmiChain.ts +17 -0
  209. package/src/utils/price.ts +8 -0
  210. package/test/const.ts +35 -0
  211. package/test/globalSetup.ts +15 -0
  212. package/test/index.ts +1 -0
  213. package/{src/react/_internal/test → test}/mocks/wallet.ts +5 -5
  214. package/test/setup.ts +20 -0
  215. package/test/test-utils.tsx +157 -0
  216. package/tsconfig.json +7 -1
  217. package/tsconfig.tsbuildinfo +1 -1
  218. package/vitest.config.js +5 -3
  219. package/dist/chunk-4YR6AIXG.js.map +0 -1
  220. package/dist/chunk-6YHHCGGY.js.map +0 -1
  221. package/dist/chunk-7C7ADZ2H.js.map +0 -1
  222. package/dist/chunk-7FN62HOP.js.map +0 -1
  223. package/dist/chunk-AIGFG26L.js.map +0 -1
  224. package/dist/chunk-E2V2BMF6.js.map +0 -1
  225. package/dist/chunk-J6F5QOW5.js.map +0 -1
  226. package/dist/chunk-RIGIV5XT.js.map +0 -1
  227. package/dist/chunk-Y75XGZOB.js.map +0 -1
  228. package/src/react/_internal/test/mocks/publicClient.ts +0 -39
  229. package/src/react/_internal/test/mocks/wagmi.ts +0 -61
  230. package/src/react/_internal/test/setup.ts +0 -28
  231. package/src/react/_internal/test-utils.tsx +0 -97
  232. package/src/react/ui/icons/ArrowUp.tsx +0 -32
  233. package/src/react/ui/icons/InventoryIcon.tsx +0 -44
  234. package/src/react/ui/icons/MinusIcon.tsx +0 -34
  235. package/src/react/ui/icons/PlusIcon.tsx +0 -32
  236. package/src/react/ui/icons/PositiveCircleIcon.tsx +0 -38
  237. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx.bak +0 -379
  238. package/src/utils/__tests__/get-public-rpc-client.test.ts +0 -111
  239. package/src/utils/get-public-rpc-client.ts +0 -41
  240. /package/src/react/ui/icons/{Bell.tsx → BellIcon.tsx} +0 -0
@@ -1,15 +1,8 @@
1
- import {
2
- render,
3
- screen,
4
- cleanup,
5
- waitFor,
6
- fireEvent,
7
- } from '../../../../_internal/test-utils';
8
- import { describe, it, expect, vi, beforeEach } from 'vitest';
1
+ import { cleanup, render, screen } from '@test';
2
+ import { zeroAddress } from 'viem';
3
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
9
4
  import { MakeOfferModal } from '../Modal';
10
5
  import { makeOfferModal$ } from '../store';
11
- import { zeroAddress } from 'viem';
12
- import * as hooks from '../../../../hooks';
13
6
 
14
7
  // TODO: This should be moved to a shared test file
15
8
  vi.mock(import('../../../../hooks'), async (importOriginal) => {
@@ -24,6 +17,10 @@ vi.mock(import('../../../../hooks'), async (importOriginal) => {
24
17
  };
25
18
  });
26
19
 
20
+ vi.mock('@0xsequence/kit', () => ({
21
+ useWaasFeeOptions: vi.fn().mockReturnValue([]),
22
+ }));
23
+
27
24
  const defaultArgs = {
28
25
  collectionAddress: zeroAddress,
29
26
  chainId: '1',
@@ -43,36 +40,36 @@ describe('MakeOfferModal', () => {
43
40
  expect(screen.queryByText('Make an offer')).toBeNull();
44
41
  });
45
42
 
46
- it('should render loading state', () => {
47
- makeOfferModal$.open(defaultArgs);
43
+ // it('should render loading state', () => {
44
+ // makeOfferModal$.open(defaultArgs);
48
45
 
49
- render(<MakeOfferModal />);
50
- const loadingModal = screen.getByTestId('loading-modal');
51
- expect(loadingModal).toBeVisible();
52
- });
46
+ // render(<MakeOfferModal />);
47
+ // const loadingModal = screen.getByTestId('loading-modal');
48
+ // expect(loadingModal).toBeVisible();
49
+ // });
53
50
 
54
- it('should render error state', async () => {
55
- // @ts-expect-error - TODO: Add a common mock object with the correct shape
56
- vi.mocked(hooks.useCollection).mockReturnValue({
57
- data: undefined,
58
- isLoading: false,
59
- isError: true,
60
- });
51
+ // it('should render error state', async () => {
52
+ // // @ts-expect-error - TODO: Add a common mock object with the correct shape
53
+ // vi.mocked(hooks.useCollection).mockReturnValue({
54
+ // data: undefined,
55
+ // isLoading: false,
56
+ // isError: true,
57
+ // });
61
58
 
62
- makeOfferModal$.open(defaultArgs);
59
+ // makeOfferModal$.open(defaultArgs);
63
60
 
64
- render(<MakeOfferModal />);
65
- const errorModal = await screen.findByTestId('error-modal');
66
- expect(errorModal).toBeVisible();
67
- });
61
+ // render(<MakeOfferModal />);
62
+ // const errorModal = await screen.findByTestId('error-modal');
63
+ // expect(errorModal).toBeVisible();
64
+ // });
68
65
 
69
- it('should render main form when data is loaded', async () => {
70
- makeOfferModal$.open(defaultArgs);
66
+ // it('should render main form when data is loaded', async () => {
67
+ // makeOfferModal$.open(defaultArgs);
71
68
 
72
- render(<MakeOfferModal />);
69
+ // render(<MakeOfferModal />);
73
70
 
74
- expect(await screen.findByText('Enter price')).toBeInTheDocument();
75
- });
71
+ // expect(await screen.findByText('Enter price')).toBeInTheDocument();
72
+ // });
76
73
 
77
74
  it('should reset store values when modal is closed and reopened', () => {
78
75
  // Open modal first time
@@ -97,26 +94,26 @@ describe('MakeOfferModal', () => {
97
94
  expect(makeOfferModal$.expiry.get()).toBeDefined();
98
95
  });
99
96
 
100
- it('should update state based on price input', async () => {
101
- makeOfferModal$.open(defaultArgs);
97
+ // it('should update state based on price input', async () => {
98
+ // makeOfferModal$.open(defaultArgs);
102
99
 
103
- render(<MakeOfferModal />);
100
+ // render(<MakeOfferModal />);
104
101
 
105
- // Initial price should be 0
106
- expect(makeOfferModal$.offerPrice.amountRaw.get()).toBe('0');
102
+ // // Initial price should be 0
103
+ // expect(makeOfferModal$.offerPrice.amountRaw.get()).toBe('0');
107
104
 
108
- // Find and interact with price input
105
+ // // Find and interact with price input
109
106
 
110
- const priceInput = await screen.findByRole('textbox', {
111
- name: 'Enter price',
112
- });
113
- expect(priceInput).toBeInTheDocument();
107
+ // const priceInput = await screen.findByRole('textbox', {
108
+ // name: 'Enter price',
109
+ // });
110
+ // expect(priceInput).toBeInTheDocument();
114
111
 
115
- fireEvent.change(priceInput, { target: { value: '1.5' } });
112
+ // fireEvent.change(priceInput, { target: { value: '1.5' } });
116
113
 
117
- // Wait for the state to update and verify it's not 0 anymore
118
- await waitFor(() => {
119
- expect(makeOfferModal$.offerPrice.amountRaw.get()).not.toBe('0');
120
- });
121
- });
114
+ // // Wait for the state to update and verify it's not 0 anymore
115
+ // await waitFor(() => {
116
+ // expect(makeOfferModal$.offerPrice.amountRaw.get()).not.toBe('0');
117
+ // });
118
+ // });
122
119
  });
@@ -133,6 +133,7 @@ const Modal = observer(() => {
133
133
  collectibleId={tokenId}
134
134
  collectionAddress={collectionAddress}
135
135
  chainId={chainId}
136
+ includeMarketplaceFee={true}
136
137
  price={
137
138
  currency
138
139
  ? {
@@ -1,26 +1,14 @@
1
- import { render, screen, cleanup } from '../../../../_internal/test-utils';
2
- import {
3
- describe,
4
- it,
5
- expect,
6
- vi,
7
- beforeEach,
8
- beforeAll,
9
- afterAll,
10
- } from 'vitest';
1
+ import { cleanup, render, screen } from '@test';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
+ import { useCollection, useCurrency } from '../../../../hooks';
11
4
  import { SellModal } from '../Modal';
12
5
  import { type OpenSellModalArgs, sellModal$ } from '../store';
13
- import { useCollection, useCurrency } from '../../../../hooks';
14
6
 
15
7
  import { MarketplaceKind, type Order } from '../../../../_internal';
16
8
 
17
- import { setupServer } from 'msw/node';
18
- import {
19
- handlers,
20
- mockMarketplaceEndpoint,
21
- } from '../../../../_internal/api/__mocks__/marketplace.msw';
22
- import { delay, http, HttpResponse } from 'msw';
23
- import { afterEach } from 'node:test';
9
+ import { server } from '@test';
10
+ import { http, HttpResponse, delay } from 'msw';
11
+ import { mockMarketplaceEndpoint } from '../../../../_internal/api/__mocks__/marketplace.msw';
24
12
 
25
13
  // Test data
26
14
  const mockOrder = {
@@ -49,16 +37,9 @@ vi.mock(import('../../../../hooks'), async (importOriginal) => {
49
37
  };
50
38
  });
51
39
 
52
- // Setup MSW Server
53
- const server = setupServer(...handlers);
54
-
55
- // Enable API mocking before tests
56
- beforeAll(() => server.listen());
57
-
58
- // Disable API mocking after the tests are done
59
- afterAll(() => server.close());
60
-
61
- afterEach(() => server.resetHandlers());
40
+ vi.mock('@0xsequence/kit', () => ({
41
+ useWaasFeeOptions: vi.fn().mockReturnValue([]),
42
+ }));
62
43
 
63
44
  beforeEach(() => {
64
45
  cleanup();
@@ -1,11 +1,11 @@
1
+ import { skipToken, useQuery } from '@tanstack/react-query';
1
2
  import {
2
3
  type GenerateSellTransactionArgs,
3
- getMarketplaceClient,
4
4
  type MarketplaceKind,
5
5
  type OrderData,
6
6
  StepType,
7
+ getMarketplaceClient,
7
8
  } from '../../../../_internal';
8
- import { skipToken, useQuery } from '@tanstack/react-query';
9
9
  import { useWallet } from '../../../../_internal/wallet/useWallet';
10
10
  import { useConfig } from '../../../../hooks/useConfig';
11
11
  import { useFees } from '../../BuyModal/hooks/useFees';
@@ -1,8 +1,8 @@
1
- import { render, screen, cleanup } from '../../../../_internal/test-utils';
2
- import { describe, it, expect, vi, beforeEach } from 'vitest';
1
+ import { cleanup, render, screen } from '@test';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
3
  import SuccessfulPurchaseModal, { useSuccessfulPurchaseModal } from '..';
4
- import { successfulPurchaseModal$ } from '../_store';
5
4
  import type { ModalCallbacks } from '../../_internal/types';
5
+ import { successfulPurchaseModal$ } from '../_store';
6
6
 
7
7
  describe('SuccessfulPurchaseModal', () => {
8
8
  beforeEach(() => {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import type React from 'react';
4
- import { useState, type ComponentProps } from 'react';
4
+ import { type ComponentProps, useState } from 'react';
5
5
 
6
6
  import {
7
7
  Box,
@@ -21,15 +21,15 @@ import {
21
21
  Title,
22
22
  } from '@radix-ui/react-dialog';
23
23
  import { getProviderEl } from '../../../../../_internal';
24
+ import { useWallet } from '../../../../../_internal/wallet/useWallet';
25
+ import { useSwitchChainModal } from '../switchChainModal';
26
+ import WaasFeeOptionsBox from '../waasFeeOptionsBox';
24
27
  import {
25
28
  closeButton,
26
29
  cta as ctaStyle,
27
30
  dialogContent,
28
31
  dialogOverlay,
29
32
  } from './styles.css';
30
- import WaasFeeOptionsBox from '../waasFeeOptionsBox';
31
- import { useSwitchChainModal } from '../switchChainModal';
32
- import { useWallet } from '../../../../../_internal/wallet/useWallet';
33
33
 
34
34
  export interface ActionModalProps {
35
35
  isOpen: boolean;
@@ -1,6 +1,6 @@
1
1
  import { type Observable, observable } from '@legendapp/state';
2
- import type { ChainId } from '../../../../../_internal';
3
2
  import type { Address } from 'viem';
3
+ import type { ChainId } from '../../../../../_internal';
4
4
 
5
5
  export interface ActionModalState {
6
6
  isOpen: boolean;
@@ -1,7 +1,6 @@
1
1
  import { Box, Text, WarningIcon } from '@0xsequence/design-system';
2
- import SvgInfoIcon from '../../../../icons/InfoIcon';
2
+ import InfoIcon from '../../../../icons/InfoIcon';
3
3
  import { alertMessageBox, alertMessageBoxVariants } from './styles.css';
4
-
5
4
  type AlertMessageProps = {
6
5
  message: string;
7
6
  type: 'warning' | 'info';
@@ -20,7 +19,7 @@ export default function AlertMessage({ message, type }: AlertMessageProps) {
20
19
  </Text>
21
20
 
22
21
  {type === 'warning' && <WarningIcon size="sm" color="white" />}
23
- {type === 'info' && <SvgInfoIcon size="sm" color="white" />}
22
+ {type === 'info' && <InfoIcon size="sm" color="white" />}
24
23
  </Box>
25
24
  );
26
25
  }
@@ -1,12 +1,12 @@
1
- import { screen, cleanup, fireEvent, waitFor } from '@testing-library/react';
2
- import { describe, it, expect, vi, beforeEach } from 'vitest';
3
1
  import { observable } from '@legendapp/state';
4
2
  import type { UseQueryResult } from '@tanstack/react-query';
3
+ import { render } from '@test';
4
+ import { cleanup, fireEvent, screen, waitFor } from '@testing-library/react';
5
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
5
6
  import CurrencyOptionsSelect from '..';
6
7
  import type { Currency } from '../../../../../../_internal';
7
- import { useCurrencies } from '../../../../../../hooks';
8
8
  import { mockCurrencies } from '../../../../../../_internal/api/__mocks__/marketplace.msw';
9
- import { render } from '../../../../../../_internal/test-utils';
9
+ import { useCurrencies } from '../../../../../../hooks';
10
10
 
11
11
  // Mock the hooks
12
12
  vi.mock('../../../../../../hooks', () => ({
@@ -2,9 +2,9 @@ import { Box, Skeleton, Text } from '@0xsequence/design-system';
2
2
  import type { Observable } from '@legendapp/state';
3
3
  import { observer } from '@legendapp/state/react';
4
4
  import { addDays } from 'date-fns';
5
+ import { useState } from 'react';
5
6
  import { CustomSelect } from '../../../../components/_internals/custom-select/CustomSelect';
6
7
  import CalendarPopover from '../calendarPopover';
7
- import { useState } from 'react';
8
8
 
9
9
  const setToEndOfDay = (date: Date): Date => {
10
10
  const endOfDay = new Date(date);
@@ -1,16 +1,9 @@
1
1
  import { observable } from '@legendapp/state';
2
+ import { act, cleanup, fireEvent, render, screen, waitFor } from '@test';
2
3
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
4
  import PriceInput from '..';
4
5
  import type { Currency, Price } from '../../../../../../../types';
5
6
  import { CurrencyStatus } from '../../../../../../_internal';
6
- import {
7
- act,
8
- cleanup,
9
- fireEvent,
10
- render,
11
- screen,
12
- waitFor,
13
- } from '../../../../../../_internal/test-utils';
14
7
 
15
8
  vi.mock('../hooks/usePriceInput', () => ({
16
9
  usePriceInput: vi.fn(({ onPriceChange }) => ({
@@ -1,7 +1,11 @@
1
- import { Box, IconButton, NumericInput } from '@0xsequence/design-system';
1
+ import {
2
+ AddIcon,
3
+ Box,
4
+ IconButton,
5
+ NumericInput,
6
+ SubtractIcon,
7
+ } from '@0xsequence/design-system';
2
8
  import type { Observable } from '@legendapp/state';
3
- import SvgMinusIcon from '../../../../icons/MinusIcon';
4
- import SvgPlusIcon from '../../../../icons/PlusIcon';
5
9
  import { quantityInputWrapper } from './styles.css';
6
10
 
7
11
  type QuantityInputProps = {
@@ -105,7 +109,7 @@ export default function QuantityInput({
105
109
  onClick={handleDecrement}
106
110
  background={'buttonGlass'}
107
111
  size="xs"
108
- icon={SvgMinusIcon}
112
+ icon={SubtractIcon}
109
113
  />
110
114
 
111
115
  <IconButton
@@ -113,7 +117,7 @@ export default function QuantityInput({
113
117
  onClick={handleIncrement}
114
118
  background={'buttonGlass'}
115
119
  size="xs"
116
- icon={SvgPlusIcon}
120
+ icon={AddIcon}
117
121
  />
118
122
  </Box>
119
123
  }
@@ -1,15 +1,9 @@
1
- import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
2
- import {
3
- cleanup,
4
- render,
5
- screen,
6
- fireEvent,
7
- waitFor,
8
- } from '../../../../../../_internal/test-utils';
1
+ import { cleanup, fireEvent, render, screen, waitFor } from '@test';
9
2
  import * as matchers from '@testing-library/jest-dom/matchers';
10
- import SwitchChainModal, { useSwitchChainModal } from '../index';
11
- import { switchChainModal$, initialState } from '../store';
12
3
  import type { SwitchChainError } from 'viem';
4
+ import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
5
+ import SwitchChainModal, { useSwitchChainModal } from '../index';
6
+ import { initialState, switchChainModal$ } from '../store';
13
7
 
14
8
  expect.extend(matchers);
15
9
 
@@ -7,9 +7,10 @@ import {
7
7
  } from '@0xsequence/design-system';
8
8
  import { observer } from '@legendapp/state/react';
9
9
  import { Close, Content, Overlay, Portal, Root } from '@radix-ui/react-dialog';
10
+ import type { SwitchChainError } from 'viem';
10
11
  import { useSwitchChain } from 'wagmi';
11
12
  import { getPresentableChainName } from '../../../../../../utils/network';
12
- import { getProviderEl, type ChainId } from '../../../../../_internal';
13
+ import { type ChainId, getProviderEl } from '../../../../../_internal';
13
14
  import AlertMessage from '../alertMessage';
14
15
  import { switchChainModal$ } from './store';
15
16
  import {
@@ -18,7 +19,6 @@ import {
18
19
  switchChainCta,
19
20
  switchChainModalContent,
20
21
  } from './styles.css';
21
- import type { SwitchChainError } from 'viem';
22
22
 
23
23
  export type ShowSwitchChainModalArgs = {
24
24
  chainIdToSwitchTo: ChainId;
@@ -1,7 +1,7 @@
1
1
  import { observable } from '@legendapp/state';
2
+ import type { SwitchChainError } from 'viem';
2
3
  import type { ShowSwitchChainModalArgs } from '.';
3
4
  import type { ChainId } from '../../../../../_internal';
4
- import type { SwitchChainError } from 'viem';
5
5
 
6
6
  export interface SwitchChainModalState {
7
7
  isOpen: boolean;
@@ -1,8 +1,8 @@
1
+ import { Box, CheckmarkIcon, Spinner, Text } from '@0xsequence/design-system';
1
2
  import { type ChainId, networks } from '@0xsequence/network';
2
3
  import type { Hex } from 'viem';
3
- import { Box, Text, Spinner } from '@0xsequence/design-system';
4
4
  import { truncateMiddle } from '../../../../../../utils';
5
- import SvgPositiveCircleIcon from '../../../../icons/PositiveCircleIcon';
5
+ import { positiveCircle } from './transactionFooter.css';
6
6
 
7
7
  type TransactionFooterProps = {
8
8
  transactionHash: Hex | undefined;
@@ -24,7 +24,7 @@ export default function TransactionFooter({
24
24
  chainId,
25
25
  }: TransactionFooterProps) {
26
26
  const icon =
27
- ((isConfirmed || orderId) && <SvgPositiveCircleIcon size="md" />) ||
27
+ ((isConfirmed || orderId) && <PositiveCircle />) ||
28
28
  (isConfirming && <Spinner size="md" />);
29
29
 
30
30
  const title =
@@ -73,3 +73,9 @@ export default function TransactionFooter({
73
73
  </Box>
74
74
  );
75
75
  }
76
+
77
+ export const PositiveCircle = () => (
78
+ <div className={positiveCircle}>
79
+ <CheckmarkIcon size="xs" color="white" />
80
+ </div>
81
+ );
@@ -0,0 +1,11 @@
1
+ import { style } from '@vanilla-extract/css';
2
+
3
+ export const positiveCircle = style({
4
+ width: '20px',
5
+ height: '20px',
6
+ backgroundColor: '#35a554',
7
+ borderRadius: '50%',
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ justifyContent: 'center',
11
+ });
@@ -1,5 +1,6 @@
1
1
  import { Box, Image, Skeleton, Text } from '@0xsequence/design-system';
2
2
  import { type Hex, formatUnits } from 'viem';
3
+ import { DEFAULT_MARKETPLACE_FEE_PERCENTAGE } from '../../../../../../consts';
3
4
  import type { Price } from '../../../../../../types';
4
5
  import {
5
6
  useMarketplaceConfig,
@@ -12,27 +13,27 @@ type TransactionDetailsProps = {
12
13
  chainId: string;
13
14
  price?: Price;
14
15
  currencyImageUrl?: string;
16
+ includeMarketplaceFee: boolean;
15
17
  // We use a placeholder price for create listing modal
16
18
  showPlaceholderPrice?: boolean;
17
19
  };
18
20
 
19
- //TODO: Move this
20
- const DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
21
-
22
21
  export default function TransactionDetails({
23
22
  collectibleId,
24
23
  collectionAddress,
25
24
  chainId,
25
+ includeMarketplaceFee,
26
26
  price,
27
27
  showPlaceholderPrice,
28
28
  currencyImageUrl,
29
29
  }: TransactionDetailsProps) {
30
30
  const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
31
31
 
32
- const marketplaceFeePercentage =
33
- data?.collections.find(
34
- (collection) => collection.address === collectionAddress,
35
- )?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
32
+ const marketplaceFeePercentage = includeMarketplaceFee
33
+ ? data?.collections.find(
34
+ (collection) => collection.address === collectionAddress,
35
+ )?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE
36
+ : 0;
36
37
  const { data: royaltyPercentage, isLoading: royaltyPercentageLoading } =
37
38
  useRoyaltyPercentage({
38
39
  chainId,
@@ -1,15 +1,10 @@
1
- import {
2
- render,
3
- cleanup,
4
- screen,
5
- waitFor,
6
- } from '../../../../../../_internal/test-utils';
1
+ import { cleanup, render, screen, waitFor } from '@test';
7
2
 
3
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
+ import { TransactionType } from '../../../../../../_internal/types';
8
5
  import TransactionStatusModal from '../index';
9
- import { transactionStatusModal$ } from '../store';
10
6
  import type { ShowTransactionStatusModalArgs } from '../index';
11
- import { TransactionType } from '../../../../../../_internal/types';
12
- import { beforeEach, describe, expect, it, vi, afterEach } from 'vitest';
7
+ import { transactionStatusModal$ } from '../store';
13
8
 
14
9
  const mockTransactionArgs: ShowTransactionStatusModalArgs = {
15
10
  hash: '0x123' as `0x${string}`,
@@ -1,13 +1,13 @@
1
1
  import { describe, expect, it } from 'vitest';
2
+ import { CurrencyStatus } from '../../../../../../_internal';
2
3
  import { TransactionType } from '../../../../../../_internal/types';
4
+ import type { TransactionStatus } from '../store';
3
5
  import { getFormattedType } from '../util/getFormattedType';
4
6
  import { getTransactionStatusModalMessage } from '../util/getMessage';
5
7
  import {
6
- getTransactionStatusModalTitle,
7
8
  getTransactionStatusModalSpinnerTitle,
9
+ getTransactionStatusModalTitle,
8
10
  } from '../util/getTitle';
9
- import type { TransactionStatus } from '../store';
10
- import { CurrencyStatus } from '../../../../../../_internal';
11
11
 
12
12
  describe('Transaction Status Modal Utils', () => {
13
13
  describe('getFormattedType', () => {
@@ -1,10 +1,10 @@
1
- import { skipToken, useQuery } from '@tanstack/react-query';
2
- import { useWallet } from '../../../../../../_internal/wallet/useWallet';
3
- import type { TransactionStatus } from '../store';
4
1
  import { TransactionStatus as IndexerTransactionStatus } from '@0xsequence/indexer';
2
+ import { skipToken, useQuery } from '@tanstack/react-query';
3
+ import { useEffect, useState } from 'react';
5
4
  import { type Hex, WaitForTransactionReceiptTimeoutError } from 'viem';
5
+ import { useWallet } from '../../../../../../_internal/wallet/useWallet';
6
6
  import type { ModalCallbacks } from '../../../types';
7
- import { useState, useEffect } from 'react';
7
+ import type { TransactionStatus } from '../store';
8
8
 
9
9
  const useTransactionStatus = (
10
10
  hash: Hex | undefined,
@@ -23,6 +23,7 @@ import { useCollectible } from '../../../../../hooks';
23
23
  import type { ModalCallbacks } from '../../types';
24
24
  import TransactionFooter from '../transaction-footer';
25
25
  import TransactionPreview from '../transactionPreview';
26
+ import useTransactionStatus from './hooks/useTransactionStatus';
26
27
  import { transactionStatusModal$ } from './store';
27
28
  import {
28
29
  closeButton,
@@ -31,7 +32,6 @@ import {
31
32
  } from './styles.css';
32
33
  import { getTransactionStatusModalMessage } from './util/getMessage';
33
34
  import { getTransactionStatusModalTitle } from './util/getTitle';
34
- import useTransactionStatus from './hooks/useTransactionStatus';
35
35
 
36
36
  export type ShowTransactionStatusModalArgs = {
37
37
  hash?: Hex;
@@ -1,4 +1,6 @@
1
1
  import { observer } from '@legendapp/state/react';
2
+ import { BuyModal } from './BuyModal/Modal';
3
+ import { CreateListingModal } from './CreateListingModal/Modal';
2
4
  import { MakeOfferModal } from './MakeOfferModal/Modal';
3
5
  import { SellModal } from './SellModal/Modal';
4
6
  import SuccessfulPurchaseModal from './SuccessfulPurchaseModal';
@@ -6,8 +8,6 @@ import { TransferModal } from './TransferModal';
6
8
  import SwitchChainModal from './_internal/components/switchChainModal';
7
9
  import TransactionStatusModal from './_internal/components/transactionStatusModal';
8
10
  import { _accountModalOpen$ } from './_internal/stores/accountModal';
9
- import { CreateListingModal } from './CreateListingModal/Modal';
10
- import { BuyModal } from './BuyModal/Modal';
11
11
 
12
12
  export const ModalProvider = observer(() => {
13
13
  return (
@@ -17,6 +17,7 @@ export type SdkConfig = {
17
17
  nextAccessKey?: string;
18
18
  builderEnv?: Env;
19
19
  marketplaceEnv?: Env;
20
+ nodeGatewayEnv?: Env;
20
21
  metadataEnv?: Env;
21
22
  indexerEnv?: Env;
22
23
  };
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from 'vitest';
2
- import { truncateMiddle, truncateEnd, compareAddress } from '../address';
2
+ import { compareAddress, truncateEnd, truncateMiddle } from '../address';
3
3
 
4
4
  describe('address utils', () => {
5
5
  describe('truncateMiddle', () => {
@@ -1,11 +1,11 @@
1
1
  import { describe, expect, test } from 'vitest';
2
- import { getMarketplaceDetails } from '../getMarketplaceDetails';
3
- import { MarketplaceKind } from '../../types';
4
2
  import {
5
- SequenceLogo,
6
- OpenSeaLogo,
7
3
  MagicEdenLogo,
4
+ OpenSeaLogo,
5
+ SequenceLogo,
8
6
  } from '../../react/ui/components/marketplace-logos';
7
+ import { MarketplaceKind } from '../../types';
8
+ import { getMarketplaceDetails } from '../getMarketplaceDetails';
9
9
 
10
10
  describe('getMarketplaceDetails', () => {
11
11
  describe('detection by marketplace kind', () => {
@@ -1,16 +1,16 @@
1
- import { MarketplaceKind } from '../types';
2
- import type { ComponentType } from 'react';
3
1
  import type { Image } from '@0xsequence/design-system';
2
+ import type { ComponentType } from 'react';
4
3
  import {
5
- SequenceLogo,
6
- OpenSeaLogo,
4
+ AlienSwapLogo,
5
+ BlurLogo,
6
+ LooksRareLogo,
7
7
  MagicEdenLogo,
8
8
  MintifyLogo,
9
- LooksRareLogo,
9
+ OpenSeaLogo,
10
+ SequenceLogo,
10
11
  X2y2Logo,
11
- BlurLogo,
12
- AlienSwapLogo,
13
12
  } from '../react/ui/components/marketplace-logos';
13
+ import { MarketplaceKind } from '../types';
14
14
 
15
15
  interface Marketplace {
16
16
  logo: ComponentType<React.ComponentProps<typeof Image>>;