@0xsequence/marketplace-sdk 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.changeset/seven-doors-taste.md +5 -0
  4. package/CHANGELOG.md +13 -0
  5. package/dist/{chunk-MPBN3E54.js → chunk-2VHHJNXY.js} +3 -3
  6. package/dist/{chunk-FBUMNJQ4.js → chunk-3II5GLHE.js} +2 -2
  7. package/dist/chunk-3JU7SQVE.js +182 -0
  8. package/dist/chunk-3JU7SQVE.js.map +1 -0
  9. package/dist/{chunk-XTGMMNV5.js → chunk-A5ACY5YV.js} +2 -2
  10. package/dist/chunk-ABSYNRT5.js +128 -0
  11. package/dist/chunk-ABSYNRT5.js.map +1 -0
  12. package/dist/{chunk-XNA64MZQ.js → chunk-BCO4CYE4.js} +2 -2
  13. package/dist/{chunk-HTFORA4Q.js → chunk-BN36GABQ.js} +1883 -1010
  14. package/dist/chunk-BN36GABQ.js.map +1 -0
  15. package/dist/{chunk-4XK7XNJ7.js → chunk-BNAUZXPV.js} +73 -2
  16. package/dist/chunk-BNAUZXPV.js.map +1 -0
  17. package/dist/{chunk-Q5URKSC4.js → chunk-FMEEJFAF.js} +1 -1
  18. package/dist/{chunk-BBASZVT3.js → chunk-GBQVYNCD.js} +5 -6
  19. package/dist/chunk-GBQVYNCD.js.map +1 -0
  20. package/dist/{chunk-3AKOPSON.js → chunk-IZ44XPBH.js} +2 -9
  21. package/dist/chunk-IZ44XPBH.js.map +1 -0
  22. package/dist/{chunk-EAJ5K7QV.js → chunk-Q5RKAMYF.js} +3 -4
  23. package/dist/chunk-Q5RKAMYF.js.map +1 -0
  24. package/dist/{chunk-RBEPPVLT.js → chunk-X3QNSQER.js} +145 -355
  25. package/dist/chunk-X3QNSQER.js.map +1 -0
  26. package/dist/{index-CzTANLaA.d.ts → index-CnaFSNE9.d.ts} +6 -7
  27. package/dist/index.css +113 -31
  28. package/dist/index.css.map +1 -1
  29. package/dist/index.d.ts +2 -4
  30. package/dist/index.js +4 -4
  31. package/dist/listCollectibles-B0tbqnRd.d.ts +155 -0
  32. package/dist/react/_internal/api/index.d.ts +28 -2
  33. package/dist/react/_internal/api/index.js +3 -1
  34. package/dist/react/_internal/databeat/index.js +10 -9
  35. package/dist/react/_internal/index.d.ts +2 -3
  36. package/dist/react/_internal/index.js +4 -4
  37. package/dist/react/_internal/wagmi/index.js +2 -2
  38. package/dist/react/hooks/index.d.ts +259 -674
  39. package/dist/react/hooks/index.js +11 -20
  40. package/dist/react/hooks/options/index.d.ts +1 -2
  41. package/dist/react/hooks/options/index.js +4 -4
  42. package/dist/react/index.d.ts +7 -7
  43. package/dist/react/index.js +15 -24
  44. package/dist/react/queries/index.d.ts +25 -0
  45. package/dist/react/queries/index.js +48 -0
  46. package/dist/react/queries/index.js.map +1 -0
  47. package/dist/react/ssr/index.js +3 -3
  48. package/dist/react/ui/components/collectible-card/index.d.ts +1 -6
  49. package/dist/react/ui/components/collectible-card/index.js +13 -12
  50. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  51. package/dist/react/ui/icons/index.js +6 -6
  52. package/dist/react/ui/index.d.ts +18 -22
  53. package/dist/react/ui/index.js +13 -12
  54. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +6 -11
  55. package/dist/react/ui/modals/_internal/components/actionModal/index.js +10 -9
  56. package/dist/types/index.js +2 -2
  57. package/dist/{types-Ct1uCT3M.d.ts → types-o_pKUpQG.d.ts} +2 -5
  58. package/dist/utils/index.d.ts +1 -5
  59. package/dist/utils/index.js +4 -4
  60. package/package.json +22 -16
  61. package/src/react/_internal/api/__mocks__/indexer.msw.ts +3 -1
  62. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +1 -1
  63. package/src/react/_internal/api/__mocks__/metadata.msw.ts +14 -12
  64. package/src/react/_internal/api/index.ts +1 -0
  65. package/src/react/_internal/api/laos-api.ts +103 -0
  66. package/src/react/_internal/api/zod-schema.ts +3 -3
  67. package/src/react/_internal/types.ts +1 -10
  68. package/src/react/_internal/wallet/__tests__/wallet.test.ts +43 -0
  69. package/src/react/_internal/wallet/useWallet.ts +6 -3
  70. package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +1 -1
  71. package/src/react/hooks/__tests__/useCancelOrder.test.tsx +1 -1
  72. package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +1 -1
  73. package/src/react/hooks/__tests__/useCollectible.test.tsx +2 -2
  74. package/src/react/hooks/__tests__/useCollection.test.tsx +2 -2
  75. package/src/react/hooks/__tests__/useComparePrices.test.tsx +1 -1
  76. package/src/react/hooks/__tests__/useConvertPriceToUSD.test.tsx +1 -1
  77. package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +1 -1
  78. package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +2 -2
  79. package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +1 -1
  80. package/src/react/hooks/__tests__/useCurrencies.test.tsx +2 -2
  81. package/src/react/hooks/__tests__/useCurrency.test.tsx +2 -2
  82. package/src/react/hooks/__tests__/useFilters.test.tsx +2 -2
  83. package/src/react/hooks/__tests__/useFloorOrder.test.tsx +2 -2
  84. package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +1 -1
  85. package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +1 -1
  86. package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +1 -1
  87. package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +1 -1
  88. package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +2 -2
  89. package/src/react/hooks/__tests__/useListCollectibles.test.tsx +3 -2
  90. package/src/react/hooks/__tests__/useListCollectiblesPaginated.test.tsx +1 -1
  91. package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +1 -1
  92. package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +1 -1
  93. package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +1 -1
  94. package/src/react/hooks/__tests__/useLowestListing.test.tsx +1 -1
  95. package/src/react/hooks/__tests__/useRoyalty.test.tsx +1 -2
  96. package/src/react/hooks/index.ts +0 -1
  97. package/src/react/hooks/options/collectionOptions.ts +2 -3
  98. package/src/react/hooks/useAutoSelectFeeOption.tsx +1 -1
  99. package/src/react/hooks/useCancelOrder.tsx +3 -3
  100. package/src/react/hooks/useCancelTransactionSteps.tsx +1 -1
  101. package/src/react/hooks/useCheckoutOptions.tsx +1 -2
  102. package/src/react/hooks/useCollectible.tsx +2 -3
  103. package/src/react/hooks/useCollectionBalanceDetails.tsx +1 -2
  104. package/src/react/hooks/useComparePrices.tsx +2 -9
  105. package/src/react/hooks/useConvertPriceToUSD.tsx +1 -4
  106. package/src/react/hooks/useCountListingsForCollectible.tsx +1 -2
  107. package/src/react/hooks/useCountOfCollectables.tsx +1 -2
  108. package/src/react/hooks/useCountOffersForCollectible.tsx +1 -2
  109. package/src/react/hooks/useCurrencies.tsx +1 -4
  110. package/src/react/hooks/useCurrency.tsx +3 -8
  111. package/src/react/hooks/useFilters.tsx +5 -4
  112. package/src/react/hooks/useFloorOrder.tsx +1 -2
  113. package/src/react/hooks/useGenerateCancelTransaction.tsx +3 -6
  114. package/src/react/hooks/useGenerateListingTransaction.tsx +2 -3
  115. package/src/react/hooks/useGenerateOfferTransaction.tsx +2 -3
  116. package/src/react/hooks/useGenerateSellTransaction.tsx +3 -6
  117. package/src/react/hooks/useHighestOffer.tsx +1 -1
  118. package/src/react/hooks/useListCollectibles.tsx +33 -61
  119. package/src/react/hooks/useListCollectiblesPaginated.tsx +2 -6
  120. package/src/react/hooks/useListListingsForCollectible.tsx +1 -2
  121. package/src/react/hooks/useListOffersForCollectible.tsx +1 -2
  122. package/src/react/hooks/useLowestListing.tsx +1 -2
  123. package/src/react/hooks/useRoyalty.tsx +3 -8
  124. package/src/react/hooks/useTransferTokens.tsx +2 -2
  125. package/src/react/queries/balanceOfCollectible.ts +9 -32
  126. package/src/react/queries/getTokenSupplies.ts +38 -0
  127. package/src/react/queries/index.ts +5 -0
  128. package/src/react/queries/listCollectibles.ts +96 -0
  129. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
  130. package/src/react/ui/components/_internals/action-button/__tests__/ActionButton.test.tsx +1 -1
  131. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -3
  132. package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +1 -1
  133. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -3
  134. package/src/react/ui/components/collectible-card/__tests__/CollectibleCard.test.tsx +1 -1
  135. package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +127 -0
  136. package/src/react/ui/modals/BuyModal/Modal.tsx +70 -85
  137. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +85 -226
  138. package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +140 -0
  139. package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +67 -76
  140. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +1 -60
  141. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +1 -1
  142. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +29 -13
  143. package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +26 -21
  144. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +200 -0
  145. package/src/react/ui/modals/BuyModal/index.tsx +4 -14
  146. package/src/react/ui/modals/BuyModal/store.ts +71 -76
  147. package/src/react/ui/modals/CreateListingModal/Modal.tsx +71 -7
  148. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +2 -2
  149. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +1 -1
  150. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
  151. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +9 -5
  152. package/src/react/ui/modals/CreateListingModal/store.ts +7 -2
  153. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +103 -6
  154. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +1 -1
  155. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +1 -1
  156. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +1 -1
  157. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +8 -4
  158. package/src/react/ui/modals/MakeOfferModal/store.ts +5 -3
  159. package/src/react/ui/modals/SellModal/Modal.tsx +76 -4
  160. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +1 -1
  161. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +1 -1
  162. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +1 -1
  163. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +16 -8
  164. package/src/react/ui/modals/SellModal/store.ts +5 -3
  165. package/src/react/ui/modals/TransferModal/_store.ts +15 -3
  166. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +58 -0
  167. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TransferButton.tsx +56 -0
  168. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +50 -0
  169. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +94 -66
  170. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +22 -14
  171. package/src/react/ui/modals/TransferModal/index.tsx +72 -38
  172. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +43 -42
  173. package/src/react/ui/modals/_internal/components/actionModal/store.ts +1 -2
  174. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -2
  175. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +9 -1
  176. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +27 -12
  177. package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -1
  178. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +19 -3
  179. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +3 -0
  180. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/ActionButtons.tsx +60 -0
  181. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/BalanceIndicator.tsx +30 -0
  182. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +126 -0
  183. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts +25 -0
  184. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +74 -0
  185. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +1 -2
  186. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +1 -2
  187. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -1
  188. package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +4 -7
  189. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
  190. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +1 -1
  191. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +1 -1
  192. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +1 -1
  193. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +6 -1
  194. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +2 -2
  195. package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +10 -31
  196. package/src/react/ui/modals/_internal/hooks/useSelectWaasFeeOptions.ts +53 -0
  197. package/src/react/ui/modals/_internal/types.ts +2 -1
  198. package/src/types/waas-types.ts +38 -0
  199. package/src/utils/network.ts +2 -4
  200. package/test/const.ts +1 -1
  201. package/test/setup.ts +10 -0
  202. package/test/test-utils.tsx +31 -5
  203. package/tsconfig.tsbuildinfo +1 -1
  204. package/dist/chunk-3AKOPSON.js.map +0 -1
  205. package/dist/chunk-4XK7XNJ7.js.map +0 -1
  206. package/dist/chunk-BBASZVT3.js.map +0 -1
  207. package/dist/chunk-EAJ5K7QV.js.map +0 -1
  208. package/dist/chunk-HTFORA4Q.js.map +0 -1
  209. package/dist/chunk-OFY7OFTL.js +0 -458
  210. package/dist/chunk-OFY7OFTL.js.map +0 -1
  211. package/dist/chunk-RBEPPVLT.js.map +0 -1
  212. package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +0 -172
  213. package/src/react/hooks/useGenerateBuyTransaction.tsx +0 -80
  214. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +0 -349
  215. package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +0 -185
  216. package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +0 -170
  217. package/src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx +0 -47
  218. package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +0 -140
  219. package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +0 -162
  220. package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +0 -327
  221. package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/index.tsx +0 -124
  222. package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/store.ts +0 -12
  223. /package/dist/{chunk-MPBN3E54.js.map → chunk-2VHHJNXY.js.map} +0 -0
  224. /package/dist/{chunk-FBUMNJQ4.js.map → chunk-3II5GLHE.js.map} +0 -0
  225. /package/dist/{chunk-XTGMMNV5.js.map → chunk-A5ACY5YV.js.map} +0 -0
  226. /package/dist/{chunk-XNA64MZQ.js.map → chunk-BCO4CYE4.js.map} +0 -0
  227. /package/dist/{chunk-Q5URKSC4.js.map → chunk-FMEEJFAF.js.map} +0 -0
@@ -9,7 +9,7 @@ import { useCountOfCollectables } from '../useCountOfCollectables';
9
9
 
10
10
  describe('useCountOfCollectables', () => {
11
11
  const defaultArgs: UseCountOfCollectablesArgs = {
12
- chainId: '1',
12
+ chainId: 1,
13
13
  collectionAddress: zeroAddress,
14
14
  query: {},
15
15
  };
@@ -110,7 +110,7 @@ describe('useCountOfCollectables', () => {
110
110
 
111
111
  it('should handle undefined query params', async () => {
112
112
  const argsWithoutQuery: UseCountOfCollectablesArgs = {
113
- chainId: '1',
113
+ chainId: 1,
114
114
  collectionAddress: zeroAddress,
115
115
  };
116
116
 
@@ -7,7 +7,7 @@ import { useCountOffersForCollectible } from '../useCountOffersForCollectible';
7
7
 
8
8
  describe('useCountOffersForCollectible', () => {
9
9
  const defaultArgs = {
10
- chainId: '1',
10
+ chainId: 1,
11
11
  collectionAddress: zeroAddress,
12
12
  collectibleId: '1',
13
13
  query: {},
@@ -11,7 +11,7 @@ import { useCurrencies } from '../useCurrencies';
11
11
 
12
12
  describe('useCurrencies', () => {
13
13
  const defaultArgs = {
14
- chainId: '1',
14
+ chainId: 1,
15
15
  };
16
16
 
17
17
  it('should fetch currencies successfully', async () => {
@@ -100,7 +100,7 @@ describe('useCurrencies', () => {
100
100
  // Change chainId and rerender
101
101
  const newArgs = {
102
102
  ...defaultArgs,
103
- chainId: '5',
103
+ chainId: 5,
104
104
  };
105
105
 
106
106
  rerender(() => useCurrencies(newArgs));
@@ -9,7 +9,7 @@ import {
9
9
  import { useCurrency } from '../useCurrency';
10
10
  describe('useCurrency', () => {
11
11
  const defaultArgs = {
12
- chainId: '1',
12
+ chainId: 1,
13
13
  currencyAddress: USDC_ADDRESS,
14
14
  };
15
15
 
@@ -93,7 +93,7 @@ describe('useCurrency', () => {
93
93
  // Change chainId and rerender
94
94
  const newArgs = {
95
95
  ...defaultArgs,
96
- chainId: '5',
96
+ chainId: 5,
97
97
  };
98
98
 
99
99
  rerender(() => useCurrency(newArgs));
@@ -8,7 +8,7 @@ import { useFilters } from '../useFilters';
8
8
 
9
9
  describe('useFilters', () => {
10
10
  const defaultArgs: UseFiltersArgs = {
11
- chainId: '1',
11
+ chainId: 1,
12
12
  collectionAddress: zeroAddress,
13
13
  };
14
14
 
@@ -31,7 +31,7 @@ describe('useFilters', () => {
31
31
  it('should handle error states', async () => {
32
32
  // Override the handler for this test to return an error
33
33
  server.use(
34
- http.post(mockMetadataEndpoint('TokenCollectionFilters'), () => {
34
+ http.post(mockMetadataEndpoint('GetTokenMetadataPropertyFilters'), () => {
35
35
  return HttpResponse.json(
36
36
  { error: { message: 'Failed to fetch filters' } },
37
37
  { status: 500 },
@@ -11,7 +11,7 @@ import type { UseFloorOrderArgs } from '../useFloorOrder';
11
11
 
12
12
  describe('useFloorOrder', () => {
13
13
  const defaultArgs: UseFloorOrderArgs = {
14
- chainId: '1',
14
+ chainId: 1,
15
15
  collectionAddress: zeroAddress,
16
16
  query: {},
17
17
  };
@@ -83,7 +83,7 @@ describe('useFloorOrder', () => {
83
83
 
84
84
  it('should handle undefined query params', async () => {
85
85
  const argsWithoutQuery: UseFloorOrderArgs = {
86
- chainId: '1',
86
+ chainId: 1,
87
87
  collectionAddress: zeroAddress,
88
88
  query: {},
89
89
  };
@@ -10,7 +10,7 @@ import { MarketplaceKind } from '../../_internal/api/marketplace.gen';
10
10
  import { useGenerateCancelTransaction } from '../useGenerateCancelTransaction';
11
11
 
12
12
  const defaultArgs = {
13
- chainId: '1',
13
+ chainId: 1,
14
14
  orderId: '0x9876543210987654321098765432109876543210',
15
15
  marketplace: MarketplaceKind.sequence_marketplace_v2,
16
16
  collectionAddress: zeroAddress,
@@ -34,7 +34,7 @@ describe('useGenerateListingTransaction', () => {
34
34
  };
35
35
 
36
36
  const defaultArgs = {
37
- chainId: '1',
37
+ chainId: 1,
38
38
  onSuccess: mockOnSuccess,
39
39
  };
40
40
 
@@ -29,7 +29,7 @@ describe('useGenerateOfferTransaction', () => {
29
29
  };
30
30
 
31
31
  const defaultArgs = {
32
- chainId: '1',
32
+ chainId: 1,
33
33
  onSuccess: mockOnSuccess,
34
34
  };
35
35
 
@@ -32,7 +32,7 @@ describe('useGenerateSellTransaction', () => {
32
32
  };
33
33
 
34
34
  const defaultArgs = {
35
- chainId: '1',
35
+ chainId: 1,
36
36
  onSuccess: mockOnSuccess,
37
37
  };
38
38
 
@@ -11,7 +11,7 @@ import { useListCollectibleActivities } from '../useListCollectibleActivities';
11
11
 
12
12
  describe('useListCollectibleActivities', () => {
13
13
  const defaultArgs: UseListCollectibleActivitiesArgs = {
14
- chainId: '1',
14
+ chainId: 1,
15
15
  collectionAddress: zeroAddress,
16
16
  tokenId: '1',
17
17
  query: {
@@ -99,7 +99,7 @@ describe('useListCollectibleActivities', () => {
99
99
 
100
100
  // Change args and rerender
101
101
  currentArgs = {
102
- chainId: '1',
102
+ chainId: 1,
103
103
  tokenId: '2',
104
104
  collectionAddress:
105
105
  '0x1234567890123456789012345678901234567890' as `0x${string}`,
@@ -11,12 +11,13 @@ import {
11
11
  MarketplaceKind,
12
12
  OrderSide,
13
13
  } from '../../_internal/api/marketplace.gen';
14
- import type { UseListCollectiblesArgs } from '../useListCollectibles';
14
+
15
+ import type { UseListCollectiblesArgs } from '../../queries/listCollectibles';
15
16
  import { useListCollectibles } from '../useListCollectibles';
16
17
 
17
18
  describe('useListCollectibles', () => {
18
19
  const defaultArgs: UseListCollectiblesArgs = {
19
- chainId: '1',
20
+ chainId: 1,
20
21
  collectionAddress: zeroAddress,
21
22
  side: OrderSide.listing,
22
23
  query: {
@@ -13,7 +13,7 @@ import { useListCollectiblesPaginated } from '../useListCollectiblesPaginated';
13
13
 
14
14
  describe('useListCollectiblesPaginated', () => {
15
15
  const defaultArgs: UseListCollectiblesPaginatedArgs = {
16
- chainId: '1',
16
+ chainId: 1,
17
17
  collectionAddress: zeroAddress,
18
18
  side: OrderSide.listing,
19
19
  query: {
@@ -13,7 +13,7 @@ import { useListCollectionActivities } from '../useListCollectionActivities';
13
13
 
14
14
  describe('useListCollectionActivities', () => {
15
15
  const defaultArgs: UseListCollectionActivitiesArgs = {
16
- chainId: '1',
16
+ chainId: 1,
17
17
  collectionAddress: zeroAddress,
18
18
  query: {
19
19
  enabled: true,
@@ -11,7 +11,7 @@ import { useListListingsForCollectible } from '../useListListingsForCollectible'
11
11
 
12
12
  describe('useListListingsForCollectible', () => {
13
13
  const defaultArgs = {
14
- chainId: '1',
14
+ chainId: 1,
15
15
  collectionAddress: zeroAddress,
16
16
  collectibleId: '1',
17
17
  page: {
@@ -11,7 +11,7 @@ import { useListOffersForCollectible } from '../useListOffersForCollectible';
11
11
 
12
12
  describe('useListOffersForCollectible', () => {
13
13
  const defaultArgs = {
14
- chainId: '1',
14
+ chainId: 1,
15
15
  collectionAddress: zeroAddress,
16
16
  collectibleId: '1',
17
17
  page: {
@@ -11,7 +11,7 @@ import { useLowestListing } from '../useLowestListing';
11
11
 
12
12
  describe('useLowestListing', () => {
13
13
  const defaultArgs = {
14
- chainId: '1',
14
+ chainId: 1,
15
15
  collectionAddress: zeroAddress as `0x${string}`,
16
16
  tokenId: '1',
17
17
  query: {},
@@ -1,7 +1,6 @@
1
1
  import { renderHook, waitFor } from '@test';
2
2
  import { describe, expect, it } from 'vitest';
3
3
  import { TEST_COLLECTIBLE } from '../../../../test/const';
4
- import type { ChainId } from '../../_internal';
5
4
  import { useRoyalty } from '../useRoyalty';
6
5
 
7
6
  describe('useRoyaltyPercentage', () => {
@@ -30,7 +29,7 @@ describe('useRoyaltyPercentage', () => {
30
29
  it('should handle invalid args', async () => {
31
30
  const invalidArgs = {
32
31
  collectionAddress: 'invalid-collection-address' as `0x${string}`,
33
- chainId: 'invalid-chain-id' as ChainId,
32
+ chainId: 'invalid-chain-id',
34
33
  collectibleId: '1',
35
34
  };
36
35
 
@@ -31,7 +31,6 @@ export * from './useGenerateCancelTransaction';
31
31
  export * from './useTransferTokens';
32
32
  export * from './useCheckoutOptions';
33
33
  export * from './useListCollections';
34
- export * from './useGenerateBuyTransaction';
35
34
  export * from './useCancelOrder';
36
35
  export * from './useCollectionDetails';
37
36
  export * from './useCollectionDetailsPolling';
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../../types';
4
4
  import {
5
5
  AddressSchema,
6
- ChainIdSchema,
7
6
  QueryArgSchema,
8
7
  collectionKeys,
9
8
  getMetadataClient,
@@ -11,7 +10,7 @@ import {
11
10
  import type { UseCollectionArgs } from '../useCollection';
12
11
 
13
12
  export const UseCollectionSchema = z.object({
14
- chainId: ChainIdSchema.pipe(z.coerce.string()),
13
+ chainId: z.number(),
15
14
  collectionAddress: AddressSchema,
16
15
  query: QueryArgSchema,
17
16
  });
@@ -24,7 +23,7 @@ export const fetchCollection = async (
24
23
  const metadataClient = getMetadataClient(config);
25
24
  return metadataClient
26
25
  .getContractInfo({
27
- chainID: parsedArgs.chainId,
26
+ chainID: parsedArgs.chainId.toString(),
28
27
  contractAddress: parsedArgs.collectionAddress,
29
28
  })
30
29
  .then((resp) => resp.contractInfo);
@@ -3,7 +3,7 @@ import { type Address, zeroAddress } from 'viem';
3
3
  import { useChain } from '@0xsequence/connect';
4
4
  import { useCallback } from 'react';
5
5
  import { useAccount } from 'wagmi';
6
- import type { FeeOption } from '../ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect';
6
+ import type { FeeOption } from '../../types/waas-types';
7
7
  import { useCollectionBalanceDetails } from './useCollectionBalanceDetails';
8
8
 
9
9
  enum AutoSelectFeeOptionError {
@@ -7,7 +7,7 @@ import { useCancelTransactionSteps } from './useCancelTransactionSteps';
7
7
 
8
8
  interface UseCancelOrderArgs {
9
9
  collectionAddress: string;
10
- chainId: string;
10
+ chainId: number;
11
11
  onSuccess?: ({ hash, orderId }: { hash?: string; orderId?: string }) => void;
12
12
  onError?: (error: Error) => void;
13
13
  }
@@ -47,12 +47,12 @@ export const useCancelOrder = ({
47
47
  tokenID: opt.token.tokenID || null,
48
48
  },
49
49
  })),
50
- chainId: Number(chainId),
50
+ chainId,
51
51
  }
52
52
  : {
53
53
  id: '',
54
54
  options: undefined,
55
- chainId: Number(chainId),
55
+ chainId,
56
56
  },
57
57
  });
58
58
 
@@ -24,7 +24,7 @@ import { useGenerateCancelTransaction } from './useGenerateCancelTransaction';
24
24
 
25
25
  interface UseCancelTransactionStepsArgs {
26
26
  collectionAddress: string;
27
- chainId: string;
27
+ chainId: number;
28
28
  callbacks?: ModalCallbacks;
29
29
  setSteps: React.Dispatch<React.SetStateAction<TransactionStep>>;
30
30
  onSuccess?: ({ hash, orderId }: { hash?: string; orderId?: string }) => void;
@@ -5,7 +5,6 @@ import { z } from 'zod';
5
5
  import type { SdkConfig } from '../../types';
6
6
  import {
7
7
  AddressSchema,
8
- ChainIdSchema,
9
8
  MarketplaceKind,
10
9
  QueryArgSchema,
11
10
  getMarketplaceClient,
@@ -13,7 +12,7 @@ import {
13
12
  import { useConfig } from './useConfig';
14
13
 
15
14
  const UseCheckoutOptionsSchema = z.object({
16
- chainId: ChainIdSchema.pipe(z.coerce.string()),
15
+ chainId: z.number(),
17
16
  orders: z.array(
18
17
  z.object({
19
18
  collectionAddress: AddressSchema,
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
5
  AddressSchema,
6
- ChainIdSchema,
7
6
  QueryArgSchema,
8
7
  collectableKeys,
9
8
  getMetadataClient,
@@ -11,7 +10,7 @@ import {
11
10
  import { useConfig } from './useConfig';
12
11
 
13
12
  const UseCollectibleSchema = z.object({
14
- chainId: ChainIdSchema.pipe(z.coerce.string()),
13
+ chainId: z.number(),
15
14
  collectionAddress: AddressSchema,
16
15
  collectibleId: z.string().optional(),
17
16
  query: QueryArgSchema,
@@ -31,7 +30,7 @@ const fetchCollectible = async (
31
30
 
32
31
  return metadataClient
33
32
  .getTokenMetadata({
34
- chainID: parsedArgs.chainId,
33
+ chainID: parsedArgs.chainId.toString(),
35
34
  contractAddress: parsedArgs.collectionAddress,
36
35
  tokenIDs: tokenIds,
37
36
  })
@@ -4,7 +4,6 @@ import { z } from 'zod';
4
4
  import type { SdkConfig } from '../../types';
5
5
  import {
6
6
  AddressSchema,
7
- ChainIdSchema,
8
7
  QueryArgSchema,
9
8
  balanceQueries,
10
9
  getIndexerClient,
@@ -18,7 +17,7 @@ const filterSchema = z.object({
18
17
  });
19
18
 
20
19
  const useCollectionBalanceDetailsArgsSchema = z.object({
21
- chainId: ChainIdSchema.pipe(z.coerce.number()),
20
+ chainId: z.number(),
22
21
  filter: filterSchema,
23
22
  query: QueryArgSchema.optional(),
24
23
  });
@@ -1,19 +1,12 @@
1
1
  import { queryOptions, useQuery } from '@tanstack/react-query';
2
2
  import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
- import {
5
- AddressSchema,
6
- ChainIdSchema,
7
- QueryArgSchema,
8
- currencyKeys,
9
- } from '../_internal';
4
+ import { AddressSchema, QueryArgSchema, currencyKeys } from '../_internal';
10
5
  import { useConfig } from './useConfig';
11
6
  import { convertPriceToUSD } from './useConvertPriceToUSD';
12
7
 
13
- const ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
14
-
15
8
  const UseComparePricesArgsSchema = z.object({
16
- chainId: ChainIdCoerce,
9
+ chainId: z.number(),
17
10
  // First price details
18
11
  priceAmountRaw: z.string(),
19
12
  priceCurrencyAddress: AddressSchema,
@@ -4,7 +4,6 @@ import { z } from 'zod';
4
4
  import type { SdkConfig } from '../../types';
5
5
  import {
6
6
  AddressSchema,
7
- ChainIdSchema,
8
7
  QueryArgSchema,
9
8
  currencyKeys,
10
9
  getQueryClient,
@@ -12,10 +11,8 @@ import {
12
11
  import { useConfig } from './useConfig';
13
12
  import { currenciesOptions } from './useCurrencies';
14
13
 
15
- const ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
16
-
17
14
  const UseConvertPriceToUSDArgsSchema = z.object({
18
- chainId: ChainIdCoerce,
15
+ chainId: z.number(),
19
16
  currencyAddress: AddressSchema,
20
17
  amountRaw: z.string(),
21
18
  query: QueryArgSchema,
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
5
  AddressSchema,
6
- ChainIdSchema,
7
6
  QueryArgSchema,
8
7
  collectableKeys,
9
8
  getMarketplaceClient,
@@ -20,7 +19,7 @@ const UseCountListingsForCollectibleArgsSchema =
20
19
  .extend({
21
20
  collectionAddress: AddressSchema,
22
21
  collectibleId: z.string(),
23
- chainId: ChainIdSchema.pipe(z.coerce.string()),
22
+ chainId: z.number(),
24
23
  query: QueryArgSchema,
25
24
  });
26
25
 
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
5
  AddressSchema,
6
- ChainIdSchema,
7
6
  OrderSide,
8
7
  QueryArgSchema,
9
8
  collectableKeys,
@@ -13,7 +12,7 @@ import { collectiblesFilterSchema } from '../_internal/api/zod-schema';
13
12
  import { useConfig } from './useConfig';
14
13
 
15
14
  const BaseSchema = z.object({
16
- chainId: ChainIdSchema.pipe(z.coerce.string()),
15
+ chainId: z.number(),
17
16
  collectionAddress: AddressSchema,
18
17
  query: QueryArgSchema,
19
18
  });
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
5
  AddressSchema,
6
- ChainIdSchema,
7
6
  QueryArgSchema,
8
7
  collectableKeys,
9
8
  getMarketplaceClient,
@@ -20,7 +19,7 @@ const UseCountOffersForCollectibleArgsSchema =
20
19
  .extend({
21
20
  collectionAddress: AddressSchema,
22
21
  collectibleId: z.string(),
23
- chainId: ChainIdSchema.pipe(z.coerce.string()),
22
+ chainId: z.number(),
24
23
  query: QueryArgSchema,
25
24
  });
26
25
 
@@ -4,7 +4,6 @@ import { z } from 'zod';
4
4
  import type { SdkConfig } from '../../types';
5
5
  import {
6
6
  AddressSchema,
7
- ChainIdSchema,
8
7
  QueryArgSchema,
9
8
  currencyKeys,
10
9
  getMarketplaceClient,
@@ -13,10 +12,8 @@ import {
13
12
  import { useConfig } from './useConfig';
14
13
  import { marketplaceConfigOptions } from './useMarketplaceConfig';
15
14
 
16
- const ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
17
-
18
15
  const UseCurrenciesArgsSchema = z.object({
19
- chainId: ChainIdCoerce,
16
+ chainId: z.number(),
20
17
  includeNativeCurrency: z.boolean().optional().default(true),
21
18
  collectionAddress: AddressSchema.optional(),
22
19
  query: QueryArgSchema,
@@ -3,8 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
5
  AddressSchema,
6
- type ChainId,
7
- ChainIdSchema,
8
6
  type Currency,
9
7
  QueryArgSchema,
10
8
  currencyKeys,
@@ -13,10 +11,8 @@ import {
13
11
  } from '../_internal';
14
12
  import { useConfig } from './useConfig';
15
13
 
16
- const ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
17
-
18
14
  const UseCurrencyArgsSchema = z.object({
19
- chainId: ChainIdCoerce,
15
+ chainId: z.number(),
20
16
  currencyAddress: AddressSchema.optional(),
21
17
  query: QueryArgSchema,
22
18
  });
@@ -26,11 +22,10 @@ type UseCurrencyArgs = z.input<typeof UseCurrencyArgsSchema>;
26
22
  export type UseCurrencyReturn = Currency | undefined;
27
23
 
28
24
  const fetchCurrency = async (
29
- chainId: ChainId,
25
+ chainId: number,
30
26
  currencyAddress: string,
31
27
  config: SdkConfig,
32
28
  ): Promise<Currency | undefined> => {
33
- const parsedChainId = ChainIdCoerce.parse(chainId);
34
29
  const queryClient = getQueryClient();
35
30
 
36
31
  let currencies = queryClient.getQueryData([...currencyKeys.lists, chainId]) as
@@ -38,7 +33,7 @@ const fetchCurrency = async (
38
33
  | undefined;
39
34
 
40
35
  if (!currencies) {
41
- const marketplaceClient = getMarketplaceClient(parsedChainId, config);
36
+ const marketplaceClient = getMarketplaceClient(chainId, config);
42
37
  currencies = await marketplaceClient
43
38
  .listCurrencies()
44
39
  .then((resp) => resp.currencies);
@@ -5,7 +5,6 @@ import { FilterCondition, type SdkConfig } from '../../types';
5
5
  import { compareAddress } from '../../utils';
6
6
  import {
7
7
  AddressSchema,
8
- ChainIdSchema,
9
8
  QueryArgSchema,
10
9
  collectableKeys,
11
10
  getMetadataClient,
@@ -15,7 +14,7 @@ import { useConfig } from './useConfig';
15
14
  import { marketplaceConfigOptions } from './useMarketplaceConfig';
16
15
 
17
16
  const UseFiltersSchema = z.object({
18
- chainId: ChainIdSchema.pipe(z.coerce.string()),
17
+ chainId: z.number(),
19
18
  collectionAddress: AddressSchema,
20
19
  showAllFilters: z.boolean().default(false).optional(),
21
20
  query: QueryArgSchema,
@@ -28,10 +27,12 @@ export type UseFilterReturn = Awaited<ReturnType<typeof fetchFilters>>;
28
27
  export const fetchFilters = async (args: UseFiltersArgs, config: SdkConfig) => {
29
28
  const parsedArgs = UseFiltersSchema.parse(args);
30
29
  const metadataClient = getMetadataClient(config);
30
+
31
31
  const filters = await metadataClient
32
- .tokenCollectionFilters({
33
- chainID: parsedArgs.chainId,
32
+ .getTokenMetadataPropertyFilters({
33
+ chainID: parsedArgs.chainId.toString(),
34
34
  contractAddress: parsedArgs.collectionAddress,
35
+ excludeProperties: [], // TODO: We can leverage this for some of the exclusion logic
35
36
  })
36
37
  .then((resp) => resp.filters);
37
38
 
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
5
  AddressSchema,
6
- ChainIdSchema,
7
6
  QueryArgSchema,
8
7
  collectableKeys,
9
8
  getMarketplaceClient,
@@ -11,7 +10,7 @@ import {
11
10
  import { useConfig } from './useConfig';
12
11
 
13
12
  const UseFloorOrderSchema = z.object({
14
- chainId: ChainIdSchema.pipe(z.coerce.string()),
13
+ chainId: z.number(),
15
14
  collectionAddress: AddressSchema,
16
15
  query: QueryArgSchema,
17
16
  });
@@ -2,8 +2,6 @@ import { useMutation } from '@tanstack/react-query';
2
2
  import { z } from 'zod';
3
3
  import type { SdkConfig } from '../../types';
4
4
  import {
5
- type ChainId,
6
- ChainIdSchema,
7
5
  type GenerateCancelTransactionArgs,
8
6
  getMarketplaceClient,
9
7
  } from '../_internal';
@@ -11,7 +9,7 @@ import { stepSchema } from '../_internal/api/zod-schema';
11
9
  import { useConfig } from './useConfig';
12
10
 
13
11
  const UserGenerateCancelTransactionArgsSchema = z.object({
14
- chainId: ChainIdSchema.pipe(z.coerce.string()),
12
+ chainId: z.number(),
15
13
  onSuccess: z.function().args(stepSchema.array().optional()).optional(),
16
14
  });
17
15
 
@@ -22,10 +20,9 @@ type UseGenerateCancelTransactionArgs = z.infer<
22
20
  export const generateCancelTransaction = async (
23
21
  args: GenerateCancelTransactionArgs,
24
22
  config: SdkConfig,
25
- chainId: ChainId,
23
+ chainId: number,
26
24
  ) => {
27
- const parsedChainId = ChainIdSchema.pipe(z.coerce.string()).parse(chainId);
28
- const marketplaceClient = getMarketplaceClient(parsedChainId, config);
25
+ const marketplaceClient = getMarketplaceClient(chainId, config);
29
26
  return marketplaceClient
30
27
  .generateCancelTransaction(args)
31
28
  .then((data) => data.steps);
@@ -2,14 +2,13 @@ import { useMutation } from '@tanstack/react-query';
2
2
  import { useConfig } from './useConfig';
3
3
 
4
4
  export type UseGenerateListingTransactionArgs = {
5
- chainId: ChainId;
5
+ chainId: number;
6
6
  onSuccess?: (data?: Step[]) => void;
7
7
  };
8
8
 
9
9
  import type { SdkConfig } from '../../types';
10
10
  import { dateToUnixTime } from '../../utils/date';
11
11
  import {
12
- type ChainId,
13
12
  type CreateReq,
14
13
  type GenerateListingTransactionArgs,
15
14
  type Step,
@@ -30,7 +29,7 @@ export type GenerateListingTransactionProps = Omit<
30
29
  export const generateListingTransaction = async (
31
30
  params: GenerateListingTransactionProps,
32
31
  config: SdkConfig,
33
- chainId: ChainId,
32
+ chainId: number,
34
33
  ) => {
35
34
  const args = {
36
35
  ...params,