@0xsequence/marketplace-sdk 0.8.9 → 0.8.11

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 (196) hide show
  1. package/.changeset/fluffy-jokes-lay.md +5 -0
  2. package/.changeset/wise-bugs-boil.md +8 -0
  3. package/CHANGELOG.md +43 -0
  4. package/dist/{chunk-FMEEJFAF.js → chunk-5C6ZZ6WX.js} +1 -1
  5. package/dist/{chunk-YEGD7PWE.js → chunk-5O44EPXZ.js} +2 -2
  6. package/dist/chunk-6CTFVBKU.js +1 -0
  7. package/dist/{chunk-DWTLVJAW.js → chunk-6OPMUCGX.js} +1 -1
  8. package/dist/chunk-6OPMUCGX.js.map +1 -0
  9. package/dist/{chunk-O34GCB47.js → chunk-L6KWLCER.js} +4 -4
  10. package/dist/chunk-L6KWLCER.js.map +1 -0
  11. package/dist/{chunk-4XLXOEXQ.js → chunk-LAP2CKLN.js} +78 -4
  12. package/dist/chunk-LAP2CKLN.js.map +1 -0
  13. package/dist/{chunk-Y63BOO6M.js → chunk-LECCEZAO.js} +1 -1
  14. package/dist/{chunk-YALXP2PW.js → chunk-N7SQWS2R.js} +3 -3
  15. package/dist/{chunk-KGM2WLSP.js → chunk-OAOONM4S.js} +695 -440
  16. package/dist/chunk-OAOONM4S.js.map +1 -0
  17. package/dist/chunk-Q3ECVC4F.js +811 -0
  18. package/dist/chunk-Q3ECVC4F.js.map +1 -0
  19. package/dist/chunk-QY52UADF.js +107 -0
  20. package/dist/chunk-QY52UADF.js.map +1 -0
  21. package/dist/{chunk-I2BYHDFE.js → chunk-TNAR3XEF.js} +3898 -844
  22. package/dist/chunk-TNAR3XEF.js.map +1 -0
  23. package/dist/chunk-XABYNWXO.js +549 -0
  24. package/dist/chunk-XABYNWXO.js.map +1 -0
  25. package/dist/chunk-YB5UUF2G.js +11 -0
  26. package/dist/chunk-YB5UUF2G.js.map +1 -0
  27. package/dist/{chunk-35WWD5V6.js → chunk-YWGFI4PN.js} +88 -25
  28. package/dist/chunk-YWGFI4PN.js.map +1 -0
  29. package/dist/{create-config-DwrnzwpM.d.ts → create-config-DLMvMTkZ.d.ts} +2 -2
  30. package/dist/index.css +7 -7
  31. package/dist/index.css.map +1 -1
  32. package/dist/index.d.ts +8 -6
  33. package/dist/index.js +19 -14
  34. package/dist/{lowestListing-BQHIuvNF.d.ts → marketCurrencies-enNVYwBk.d.ts} +95 -3
  35. package/dist/{marketplace.gen-DQzWciwC.d.ts → marketplace.gen-D24veUQs.d.ts} +3 -2
  36. package/dist/marketplaceConfig-BwNAbLPw.d.ts +21 -0
  37. package/dist/new-marketplace-types-BCw19X9S.d.ts +102 -0
  38. package/dist/react/_internal/api/index.d.ts +4 -3
  39. package/dist/react/_internal/api/index.js +5 -1
  40. package/dist/react/_internal/databeat/index.css +2764 -0
  41. package/dist/react/_internal/databeat/index.css.map +1 -0
  42. package/dist/react/_internal/databeat/index.d.ts +1 -1
  43. package/dist/react/_internal/databeat/index.js +15 -14
  44. package/dist/react/_internal/index.d.ts +62 -9
  45. package/dist/react/_internal/index.js +7 -3
  46. package/dist/react/_internal/wagmi/index.d.ts +5 -6
  47. package/dist/react/_internal/wagmi/index.js +1 -1
  48. package/dist/react/hooks/index.css +2764 -0
  49. package/dist/react/hooks/index.css.map +1 -0
  50. package/dist/react/hooks/index.d.ts +74 -222
  51. package/dist/react/hooks/index.js +21 -22
  52. package/dist/react/hooks/options/index.d.ts +5 -4
  53. package/dist/react/hooks/options/index.js +9 -7
  54. package/dist/react/index.css +7 -7
  55. package/dist/react/index.css.map +1 -1
  56. package/dist/react/index.d.ts +12 -11
  57. package/dist/react/index.js +34 -37
  58. package/dist/react/queries/index.d.ts +4 -3
  59. package/dist/react/queries/index.js +19 -6
  60. package/dist/react/ssr/index.d.ts +3 -3
  61. package/dist/react/ssr/index.js +6 -5
  62. package/dist/react/ssr/index.js.map +1 -1
  63. package/dist/react/ui/components/collectible-card/index.css +7 -7
  64. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  65. package/dist/react/ui/components/collectible-card/index.d.ts +9 -6
  66. package/dist/react/ui/components/collectible-card/index.js +19 -23
  67. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  68. package/dist/react/ui/icons/index.js +9 -8
  69. package/dist/react/ui/index.css +7 -7
  70. package/dist/react/ui/index.css.map +1 -1
  71. package/dist/react/ui/index.d.ts +2 -2
  72. package/dist/react/ui/index.js +17 -21
  73. package/dist/react/ui/modals/_internal/components/actionModal/index.css +2764 -0
  74. package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -0
  75. package/dist/react/ui/modals/_internal/components/actionModal/index.js +15 -14
  76. package/dist/sdk-config-qorA0TgF.d.ts +165 -0
  77. package/dist/{services-BI_w8Eq4.d.ts → services-WrshxCqc.d.ts} +6 -3
  78. package/dist/types/index.d.ts +5 -4
  79. package/dist/types/index.js +7 -7
  80. package/dist/{index-DGsVBflk.d.ts → useCollection-YAdXfVO7.d.ts} +1 -2
  81. package/dist/utils/abi/index.d.ts +1 -0
  82. package/dist/utils/abi/index.js +7 -1
  83. package/dist/utils/abi/primary-sale/index.d.ts +1054 -0
  84. package/dist/utils/abi/primary-sale/index.js +9 -0
  85. package/dist/utils/index.d.ts +2 -1
  86. package/dist/utils/index.js +13 -6
  87. package/package.json +32 -32
  88. package/src/react/_internal/api/__mocks__/builder.msw.ts +157 -80
  89. package/src/react/_internal/api/builder-api.ts +2 -2
  90. package/src/react/_internal/api/builder.gen.ts +667 -112
  91. package/src/react/_internal/api/marketplace.gen.ts +1981 -1316
  92. package/src/react/_internal/api/services.ts +12 -1
  93. package/src/react/_internal/types.ts +1 -13
  94. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +99 -84
  95. package/src/react/_internal/wagmi/create-config.ts +8 -4
  96. package/src/react/_internal/wagmi/get-connectors.ts +24 -19
  97. package/src/react/hooks/__tests__/__snapshots__/useListCollections.test.tsx.snap +114 -0
  98. package/src/react/hooks/__tests__/__snapshots__/useMarketplaceConfig.test.tsx.snap +85 -83
  99. package/src/react/hooks/__tests__/useFilters.test.tsx +0 -16
  100. package/src/react/hooks/__tests__/useInventory.test.tsx +16 -16
  101. package/src/react/hooks/__tests__/useListCollections.test.tsx +23 -56
  102. package/src/react/hooks/__tests__/{useCurrencies.test.tsx → useMarketCurrencies.test.tsx} +21 -15
  103. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +2 -59
  104. package/src/react/hooks/index.ts +3 -1
  105. package/src/react/hooks/useBalanceOfCollectible.tsx +5 -3
  106. package/src/react/hooks/useConvertPriceToUSD.tsx +1 -1
  107. package/src/react/hooks/useFilters.tsx +14 -22
  108. package/src/react/hooks/useGetTokenSuppliesMap.ts +28 -0
  109. package/src/react/hooks/useInventory.tsx +4 -3
  110. package/src/react/hooks/useList1155SaleSupplies.tsx +62 -0
  111. package/src/react/hooks/useListBalances.tsx +5 -3
  112. package/src/react/hooks/useListCollectibles.tsx +5 -3
  113. package/src/react/hooks/useListCollections.tsx +14 -76
  114. package/src/react/hooks/useListTokenMetadata.ts +19 -0
  115. package/src/react/hooks/useMarketCurrencies.tsx +8 -0
  116. package/src/react/hooks/useMarketplaceConfig.tsx +0 -2
  117. package/src/react/queries/index.ts +2 -0
  118. package/src/react/queries/inventory.ts +1 -1
  119. package/src/react/queries/listCollections.ts +118 -0
  120. package/src/react/queries/listTokenMetadata.ts +38 -0
  121. package/src/react/queries/marketCurrencies.ts +77 -0
  122. package/src/react/queries/marketplaceConfig.ts +83 -55
  123. package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +85 -83
  124. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
  125. package/src/react/ui/components/collectible-card/__tests__/{CollectibleAsset.test.tsx → Media.test.tsx} +48 -14
  126. package/src/react/ui/components/collectible-card/index.ts +1 -1
  127. package/src/react/ui/components/collectible-card/media/Media.tsx +211 -0
  128. package/src/react/ui/components/collectible-card/{collectible-asset/CollectibleAssetSkeleton.tsx → media/MediaSkeleton.tsx} +2 -2
  129. package/src/react/ui/components/collectible-card/media/types.ts +18 -0
  130. package/src/react/ui/components/collectible-card/{collectible-asset → media}/utils.ts +8 -3
  131. package/src/react/ui/index.ts +1 -1
  132. package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +9 -3
  133. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +31 -21
  134. package/src/react/ui/modals/BuyModal/hooks/useFees.ts +3 -2
  135. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +28 -3
  136. package/src/react/ui/modals/CreateListingModal/Modal.tsx +3 -5
  137. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +5 -3
  138. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +2 -2
  139. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +2 -3
  140. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +4 -3
  141. package/src/react/ui/modals/SellModal/Modal.tsx +0 -1
  142. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +2 -2
  143. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +1 -1
  144. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +0 -1
  145. package/src/react/ui/modals/TransferModal/index.tsx +0 -1
  146. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +2 -2
  147. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +7 -6
  148. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +13 -7
  149. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +3 -5
  150. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +5 -3
  151. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
  152. package/src/react/ui/modals/_internal/hooks/useSelectWaasFeeOptions.ts +2 -12
  153. package/src/types/index.ts +1 -6
  154. package/src/types/new-marketplace-types.ts +119 -0
  155. package/src/types/sdk-config.ts +19 -2
  156. package/src/types/types.ts +1 -0
  157. package/src/utils/abi/index.ts +1 -0
  158. package/src/utils/abi/primary-sale/index.ts +2 -0
  159. package/src/utils/abi/primary-sale/sequence-1155-sales-contract.ts +450 -0
  160. package/src/utils/abi/primary-sale/sequence-721-sales-contract.ts +352 -0
  161. package/src/utils/abi/token/sequence-erc1155-items.ts +454 -0
  162. package/src/utils/fetchContentType.ts +5 -1
  163. package/tsconfig.tsbuildinfo +1 -1
  164. package/dist/chunk-35WWD5V6.js.map +0 -1
  165. package/dist/chunk-4XLXOEXQ.js.map +0 -1
  166. package/dist/chunk-D7RVSZAQ.js +0 -332
  167. package/dist/chunk-D7RVSZAQ.js.map +0 -1
  168. package/dist/chunk-DWTLVJAW.js.map +0 -1
  169. package/dist/chunk-EODKQL6Y.js +0 -76
  170. package/dist/chunk-EODKQL6Y.js.map +0 -1
  171. package/dist/chunk-G3447GIP.js +0 -2880
  172. package/dist/chunk-G3447GIP.js.map +0 -1
  173. package/dist/chunk-HHYNOPPI.js +0 -53
  174. package/dist/chunk-HHYNOPPI.js.map +0 -1
  175. package/dist/chunk-I2BYHDFE.js.map +0 -1
  176. package/dist/chunk-JKCF7HEA.js +0 -1
  177. package/dist/chunk-KGM2WLSP.js.map +0 -1
  178. package/dist/chunk-MAD64DLJ.js +0 -81
  179. package/dist/chunk-MAD64DLJ.js.map +0 -1
  180. package/dist/chunk-N7BPFK46.js +0 -1
  181. package/dist/chunk-O34GCB47.js.map +0 -1
  182. package/dist/chunk-UISBTKFF.js +0 -1
  183. package/dist/chunk-UISBTKFF.js.map +0 -1
  184. package/dist/chunk-YBOFRP65.js +0 -128
  185. package/dist/chunk-YBOFRP65.js.map +0 -1
  186. package/dist/marketplaceConfig-B4Fdsmxu.d.ts +0 -17
  187. package/dist/sdk-config-txlivEKe.d.ts +0 -133
  188. package/dist/types-isjvwapz.d.ts +0 -68
  189. package/src/react/hooks/useCurrencies.tsx +0 -77
  190. package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAsset.tsx +0 -174
  191. /package/dist/{chunk-FMEEJFAF.js.map → chunk-5C6ZZ6WX.js.map} +0 -0
  192. /package/dist/{chunk-YEGD7PWE.js.map → chunk-5O44EPXZ.js.map} +0 -0
  193. /package/dist/{chunk-JKCF7HEA.js.map → chunk-6CTFVBKU.js.map} +0 -0
  194. /package/dist/{chunk-Y63BOO6M.js.map → chunk-LECCEZAO.js.map} +0 -0
  195. /package/dist/{chunk-YALXP2PW.js.map → chunk-N7SQWS2R.js.map} +0 -0
  196. /package/dist/{chunk-N7BPFK46.js.map → utils/abi/primary-sale/index.js.map} +0 -0
@@ -1,3 +1,4 @@
1
+ import { SequenceAPIClient } from '@0xsequence/api';
1
2
  import { SequenceIndexer } from '@0xsequence/indexer';
2
3
  import { SequenceMetadata } from '@0xsequence/metadata';
3
4
  import { networks, stringTemplate } from '@0xsequence/network';
@@ -6,7 +7,7 @@ import { MissingConfigError } from '../../../utils/_internal/error/transaction';
6
7
  import { SequenceMarketplace } from './marketplace-api';
7
8
 
8
9
  const SERVICES = {
9
- sequenceApi: 'https://api.sequence.app',
10
+ sequenceApi: 'https://${prefix}api.sequence.app',
10
11
  metadata: 'https://${prefix}metadata.sequence.app',
11
12
  indexer: 'https://${prefix}${network}-indexer.sequence.app',
12
13
  marketplaceApi: 'https://${prefix}marketplace-api.sequence.app/${network}',
@@ -51,6 +52,11 @@ export const builderRpcApi = (env: Env = 'production') => {
51
52
  return stringTemplate(SERVICES.builderRpcApi, { prefix });
52
53
  };
53
54
 
55
+ export const sequenceApiUrl = (env: Env = 'production') => {
56
+ const prefix = getPrefix(env);
57
+ return stringTemplate(SERVICES.sequenceApi, { prefix });
58
+ };
59
+
54
60
  export const builderMarketplaceApi = (
55
61
  projectId: string,
56
62
  env: Env = 'production',
@@ -82,6 +88,11 @@ export const getMarketplaceClient = (
82
88
  projectAccessKey,
83
89
  );
84
90
  };
91
+ export const getSequenceApiClient = (config: SdkConfig) => {
92
+ const env = config._internal?.sequenceApiEnv || 'production';
93
+ const projectAccessKey = getAccessKey({ env, config });
94
+ return new SequenceAPIClient(sequenceApiUrl(env), projectAccessKey);
95
+ };
85
96
  const getAccessKey = ({ env, config }: { env: Env; config: SdkConfig }) => {
86
97
  switch (env) {
87
98
  case 'development':
@@ -1,9 +1,7 @@
1
1
  import type { Address } from 'viem';
2
- import type { Chain } from 'viem';
3
2
  import { z } from 'zod';
4
3
  import type { ContractType, CreateReq } from '../../types';
5
- import type { MarketplaceConfig, SdkConfig } from '../../types';
6
- import type { MarketplaceKind, OrderbookKind } from './api';
4
+ import type { MarketplaceKind } from './api';
7
5
 
8
6
  export const QueryArgSchema = z
9
7
  .object({
@@ -50,16 +48,6 @@ export enum TransactionType {
50
48
  CANCEL = 'CANCEL',
51
49
  }
52
50
 
53
- export interface TransactionConfig {
54
- type: TransactionType;
55
- chainId: number;
56
- chains: readonly Chain[];
57
- collectionAddress: string;
58
- sdkConfig: SdkConfig;
59
- marketplaceConfig: MarketplaceConfig;
60
- orderbookKind?: OrderbookKind;
61
- }
62
-
63
51
  export interface BuyInput {
64
52
  orderId: string;
65
53
  collectableDecimals: number;
@@ -1,64 +1,72 @@
1
1
  import { polygon } from 'viem/chains';
2
2
  import { beforeEach, describe, expect, it } from 'vitest';
3
3
  import { type Config, cookieStorage } from 'wagmi';
4
+ import type { SdkConfig } from '../../../../types';
5
+ import { ContractType, OrderbookKind } from '../../../../types';
4
6
  import {
7
+ type MarketCollection,
5
8
  type MarketplaceConfig,
6
9
  MarketplaceType,
7
- MarketplaceWallet,
8
- OrderbookKind,
9
- type SdkConfig,
10
- } from '../../../../types';
10
+ } from '../../../../types/new-marketplace-types';
11
+ import { MarketplaceWalletType } from '../../api/builder.gen';
11
12
  import { createWagmiConfig } from '../create-config';
12
13
 
13
14
  describe('createWagmiConfig', () => {
14
- let baseMarketplaceConfig: MarketplaceConfig;
15
+ let baseMarketplace: MarketplaceConfig;
15
16
  let baseSdkConfig: SdkConfig;
16
17
 
17
18
  beforeEach(() => {
18
- baseMarketplaceConfig = {
19
+ baseMarketplace = {
19
20
  projectId: 1,
20
- cssString: '',
21
- manifestUrl: '',
22
- publisherId: 'test-publisher',
23
- title: 'Test Marketplace',
24
- shortDescription: 'Test Description',
25
- socials: {
26
- twitter: '',
27
- discord: '',
28
- website: '',
29
- tiktok: '',
30
- instagram: '',
31
- youtube: '',
21
+ settings: {
22
+ publisherId: 'test-publisher',
23
+ title: 'Test Marketplace',
24
+ socials: {
25
+ twitter: '',
26
+ discord: '',
27
+ website: '',
28
+ tiktok: '',
29
+ instagram: '',
30
+ youtube: '',
31
+ },
32
+ faviconUrl: 'https://test.com/favicon.ico',
33
+ walletOptions: {
34
+ walletType: MarketplaceWalletType.UNIVERSAL,
35
+ oidcIssuers: {},
36
+ connectors: [],
37
+ includeEIP6963Wallets: false,
38
+ },
39
+ logoUrl: '',
40
+ fontUrl: '',
41
+ accessKey: undefined,
32
42
  },
33
- faviconUrl: 'https://test.com/favicon.ico',
34
- landingBannerUrl: 'https://test.com/banner.jpg',
35
- walletOptions: {
36
- walletType: MarketplaceWallet.UNIVERSAL,
37
- oidcIssuers: {},
38
- connectors: [],
39
- includeEIP6963Wallets: false,
43
+ market: {
44
+ enabled: true,
45
+ bannerUrl: 'https://test.com/banner.jpg',
46
+ ogImage: '',
47
+ collections: [
48
+ {
49
+ contractType: ContractType.ERC721,
50
+ marketplaceType: MarketplaceType.MARKET,
51
+ chainId: polygon.id,
52
+ bannerUrl: '',
53
+ itemsAddress: '0x1234567890123456789012345678901234567890',
54
+ filterSettings: {
55
+ filterOrder: [],
56
+ exclusions: [],
57
+ },
58
+ feePercentage: 0,
59
+ destinationMarketplace: OrderbookKind.sequence_marketplace_v2,
60
+ currencyOptions: [],
61
+ } as MarketCollection,
62
+ ],
63
+ },
64
+ shop: {
65
+ enabled: false,
66
+ bannerUrl: '',
67
+ ogImage: '',
68
+ collections: [],
40
69
  },
41
- collections: [
42
- {
43
- address: '0x1234567890123456789012345678901234567890',
44
- chainId: polygon.id,
45
- marketplaceType: MarketplaceType.ORDERBOOK,
46
- currencyOptions: [],
47
- destinationMarketplace: OrderbookKind.sequence_marketplace_v2,
48
- filterSettings: {
49
- filterOrder: [],
50
- exclusions: [],
51
- },
52
- exchanges: [],
53
- bannerUrl: '',
54
- feePercentage: 0,
55
- },
56
- ],
57
- landingPageLayout: 'default',
58
- logoUrl: '',
59
- bannerUrl: '',
60
- fontUrl: '',
61
- ogImage: '',
62
70
  };
63
71
 
64
72
  baseSdkConfig = {
@@ -71,8 +79,9 @@ describe('createWagmiConfig', () => {
71
79
  it('should create config with empty collections', () => {
72
80
  const configWithEmptyCollections = createWagmiConfig(
73
81
  {
74
- ...baseMarketplaceConfig,
75
- collections: [],
82
+ ...baseMarketplace,
83
+ market: { ...baseMarketplace.market, collections: [] },
84
+ shop: { ...baseMarketplace.shop, collections: [] },
76
85
  },
77
86
  baseSdkConfig,
78
87
  );
@@ -85,12 +94,15 @@ describe('createWagmiConfig', () => {
85
94
 
86
95
  it('should create config with universal wallet setup', () => {
87
96
  const marketplaceConfig: MarketplaceConfig = {
88
- ...baseMarketplaceConfig,
89
- walletOptions: {
90
- connectors: ['walletconnect', 'coinbase'],
91
- includeEIP6963Wallets: true,
92
- walletType: MarketplaceWallet.UNIVERSAL,
93
- oidcIssuers: {},
97
+ ...baseMarketplace,
98
+ settings: {
99
+ ...baseMarketplace.settings,
100
+ walletOptions: {
101
+ connectors: ['walletconnect', 'coinbase'],
102
+ includeEIP6963Wallets: true,
103
+ walletType: MarketplaceWalletType.UNIVERSAL,
104
+ oidcIssuers: {},
105
+ },
94
106
  },
95
107
  };
96
108
 
@@ -105,25 +117,22 @@ describe('createWagmiConfig', () => {
105
117
  });
106
118
 
107
119
  it('should create config with embedded wallet setup', () => {
108
- // Valid waas tenant key format - base64 encoded JSON string containing the actual key
109
- const waasTenantKey = btoa(
110
- JSON.stringify({
111
- key: 'valid-waas-tenant-key',
112
- projectId: 'test-project-id',
113
- }),
114
- );
120
+ const waasTenantKey = 'test-waas-tenant-key';
115
121
 
116
122
  const marketplaceConfig: MarketplaceConfig = {
117
- ...baseMarketplaceConfig,
118
- walletOptions: {
119
- connectors: ['walletconnect'],
120
- includeEIP6963Wallets: false,
121
- walletType: MarketplaceWallet.EMBEDDED,
122
- oidcIssuers: {},
123
- waas: {
124
- tenantKey: waasTenantKey,
125
- emailEnabled: false,
126
- providers: [],
123
+ ...baseMarketplace,
124
+ settings: {
125
+ ...baseMarketplace.settings,
126
+ walletOptions: {
127
+ connectors: ['walletconnect'],
128
+ includeEIP6963Wallets: false,
129
+ walletType: MarketplaceWalletType.EMBEDDED,
130
+ oidcIssuers: {},
131
+ embedded: {
132
+ tenantKey: waasTenantKey,
133
+ emailEnabled: false,
134
+ providers: [],
135
+ },
127
136
  },
128
137
  },
129
138
  };
@@ -140,12 +149,15 @@ describe('createWagmiConfig', () => {
140
149
 
141
150
  it('should respect EIP6963 wallet inclusion setting', () => {
142
151
  const marketplaceConfig: MarketplaceConfig = {
143
- ...baseMarketplaceConfig,
144
- walletOptions: {
145
- connectors: ['walletconnect'],
146
- includeEIP6963Wallets: false,
147
- walletType: MarketplaceWallet.UNIVERSAL,
148
- oidcIssuers: {},
152
+ ...baseMarketplace,
153
+ settings: {
154
+ ...baseMarketplace.settings,
155
+ walletOptions: {
156
+ connectors: ['walletconnect'],
157
+ includeEIP6963Wallets: false,
158
+ walletType: MarketplaceWalletType.UNIVERSAL,
159
+ oidcIssuers: {},
160
+ },
149
161
  },
150
162
  };
151
163
 
@@ -156,7 +168,7 @@ describe('createWagmiConfig', () => {
156
168
 
157
169
  it('should create SSR compatible config when ssr flag is true', async () => {
158
170
  const config = createWagmiConfig(
159
- baseMarketplaceConfig,
171
+ baseMarketplace,
160
172
  baseSdkConfig,
161
173
  true,
162
174
  ) as Config;
@@ -177,12 +189,15 @@ describe('createWagmiConfig', () => {
177
189
  describe('failure cases', () => {
178
190
  it('should still create config when walletConnectProjectId is missing', () => {
179
191
  const marketplaceConfig: MarketplaceConfig = {
180
- ...baseMarketplaceConfig,
181
- walletOptions: {
182
- connectors: ['walletconnect'],
183
- includeEIP6963Wallets: true,
184
- walletType: MarketplaceWallet.UNIVERSAL,
185
- oidcIssuers: {},
192
+ ...baseMarketplace,
193
+ settings: {
194
+ ...baseMarketplace.settings,
195
+ walletOptions: {
196
+ connectors: ['walletconnect'],
197
+ includeEIP6963Wallets: true,
198
+ walletType: MarketplaceWalletType.UNIVERSAL,
199
+ oidcIssuers: {},
200
+ },
186
201
  },
187
202
  };
188
203
 
@@ -3,7 +3,7 @@ import { allNetworks, findNetworkConfig } from '@0xsequence/network';
3
3
  import type { Chain, Transport } from 'viem';
4
4
  import { http, cookieStorage, createConfig, createStorage } from 'wagmi';
5
5
  import type { Env, SdkConfig } from '../../../types';
6
- import type { MarketplaceConfig } from '../../queries/marketplaceConfig';
6
+ import type { MarketplaceConfig } from '../../../types/new-marketplace-types';
7
7
  import { DEFAULT_NETWORK } from '../consts';
8
8
  import { getConnectors } from './get-connectors';
9
9
 
@@ -20,7 +20,7 @@ export const createWagmiConfig = (
20
20
  nodeGatewayEnv,
21
21
  );
22
22
 
23
- const walletType = marketplaceConfig.walletOptions.walletType;
23
+ const walletType = marketplaceConfig.settings.walletOptions.walletType;
24
24
 
25
25
  const connectors = getConnectors({
26
26
  marketplaceConfig,
@@ -29,7 +29,7 @@ export const createWagmiConfig = (
29
29
  });
30
30
 
31
31
  const multiInjectedProviderDiscovery =
32
- marketplaceConfig.walletOptions.includeEIP6963Wallets;
32
+ marketplaceConfig.settings.walletOptions.includeEIP6963Wallets;
33
33
 
34
34
  return createConfig({
35
35
  connectors,
@@ -45,9 +45,13 @@ export const createWagmiConfig = (
45
45
  });
46
46
  };
47
47
 
48
+ function getAllCollections(marketConfig: MarketplaceConfig) {
49
+ return [...marketConfig.market.collections, ...marketConfig.shop.collections];
50
+ }
51
+
48
52
  function getChainConfigs(marketConfig: MarketplaceConfig): [Chain, ...Chain[]] {
49
53
  const supportedChainIds = new Set(
50
- marketConfig.collections.map((c) => c.chainId),
54
+ getAllCollections(marketConfig).map((c) => c.chainId),
51
55
  );
52
56
 
53
57
  if (supportedChainIds.size === 0) {
@@ -18,9 +18,9 @@ import {
18
18
  import React, { type FunctionComponent } from 'react';
19
19
  import type { CreateConnectorFn } from 'wagmi';
20
20
  import type { Env, SdkConfig } from '../../../types';
21
+ import type { MarketplaceConfig } from '../../../types/new-marketplace-types';
21
22
  import { MissingConfigError } from '../../../utils/_internal/error/transaction';
22
- import type { MarketplaceConfig } from '../../queries/marketplaceConfig';
23
- import { MarketplaceWallet } from '../api/builder.gen';
23
+ import { MarketplaceWalletType } from '../api/builder.gen';
24
24
  import { DEFAULT_NETWORK } from '../consts';
25
25
 
26
26
  export function getConnectors({
@@ -30,15 +30,15 @@ export function getConnectors({
30
30
  }: {
31
31
  marketplaceConfig: MarketplaceConfig;
32
32
  sdkConfig: SdkConfig;
33
- walletType: MarketplaceWallet;
33
+ walletType: MarketplaceWalletType;
34
34
  }): CreateConnectorFn[] {
35
35
  const connectors = commonConnectors(marketplaceConfig, sdkConfig);
36
36
 
37
- if (walletType === MarketplaceWallet.UNIVERSAL) {
37
+ if (walletType === MarketplaceWalletType.UNIVERSAL) {
38
38
  connectors.push(...getUniversalWalletConfigs(sdkConfig, marketplaceConfig));
39
- } else if (walletType === MarketplaceWallet.EMBEDDED) {
39
+ } else if (walletType === MarketplaceWalletType.EMBEDDED) {
40
40
  connectors.push(...getWaasConnectors(sdkConfig, marketplaceConfig));
41
- } else if (walletType === MarketplaceWallet.ECOSYSTEM) {
41
+ } else if (walletType === MarketplaceWalletType.ECOSYSTEM) {
42
42
  connectors.push(getEcosystemConnector(marketplaceConfig, sdkConfig));
43
43
  } else {
44
44
  throw new Error('Invalid wallet type');
@@ -52,8 +52,8 @@ function commonConnectors(
52
52
  sdkConfig: SdkConfig,
53
53
  ) {
54
54
  const wallets = [];
55
- const { title: appName } = marketplaceConfig;
56
- const walletOptions = marketplaceConfig.walletOptions;
55
+ const { title: appName } = marketplaceConfig.settings;
56
+ const walletOptions = marketplaceConfig.settings.walletOptions;
57
57
  const walletConnectProjectId = sdkConfig.walletConnectProjectId;
58
58
 
59
59
  if (walletOptions.connectors.includes('coinbase')) {
@@ -90,9 +90,10 @@ function getUniversalWalletConfigs(
90
90
  defaultNetwork: DEFAULT_NETWORK,
91
91
  connect: {
92
92
  projectAccessKey,
93
- app: marketplaceConfig.title,
93
+ app: marketplaceConfig.settings.title,
94
94
  settings: {
95
- bannerUrl: marketplaceConfig.ogImage,
95
+ // TODO: make a separate config for this?
96
+ bannerUrl: marketplaceConfig.market.ogImage,
96
97
  },
97
98
  },
98
99
  } satisfies SequenceOptions;
@@ -113,23 +114,25 @@ export function getWaasConnectors(
113
114
  ): Wallet[] {
114
115
  const { projectAccessKey } = config;
115
116
 
116
- const waasConfigKey = marketplaceConfig.walletOptions.waas?.tenantKey;
117
+ const waasConfigKey =
118
+ marketplaceConfig.settings.walletOptions.embedded?.tenantKey;
117
119
 
118
120
  if (!waasConfigKey)
119
121
  throw new MissingConfigError(
120
122
  'Embedded wallet config is missing, please check your access key',
121
123
  );
122
124
 
123
- const waasOptions = marketplaceConfig.walletOptions.oidcIssuers;
125
+ const waasOptions = marketplaceConfig.settings.walletOptions.oidcIssuers;
124
126
  const googleClientId = waasOptions.google;
125
127
  const appleClientId = waasOptions.apple;
126
- const appleRedirectURI = globalThis.window
127
- ? `https://${globalThis.window?.location?.origin}${globalThis.window?.location?.pathname}`
128
- : undefined;
128
+ const appleRedirectURI =
129
+ typeof window !== 'undefined'
130
+ ? `${window.location.origin}${window.location.pathname}`
131
+ : undefined;
129
132
 
130
133
  const wallets: Wallet[] = [];
131
134
 
132
- if (marketplaceConfig.walletOptions.waas?.emailEnabled) {
135
+ if (marketplaceConfig.settings.walletOptions.embedded?.emailEnabled) {
133
136
  wallets.push(
134
137
  emailWaas({
135
138
  projectAccessKey,
@@ -168,7 +171,7 @@ export function getEcosystemConnector(
168
171
  marketplaceConfig: MarketplaceConfig,
169
172
  sdkConfig: SdkConfig,
170
173
  ): Wallet {
171
- const ecosystemOptions = marketplaceConfig.walletOptions.ecosystem;
174
+ const ecosystemOptions = marketplaceConfig.settings.walletOptions.ecosystem;
172
175
  if (!ecosystemOptions) throw new MissingConfigError('ecosystem');
173
176
  const { walletAppName, walletUrl, logoDarkUrl, logoLightUrl } =
174
177
  ecosystemOptions;
@@ -198,9 +201,11 @@ function getSequenceWalletURL(env: Env) {
198
201
  switch (env) {
199
202
  case 'development':
200
203
  return 'https://dev.sequence.app';
201
- case 'production':
202
- return 'https://sequence.app';
203
204
  case 'next':
204
205
  return 'https://next.sequence.app';
206
+ // biome-ignore lint/complexity/noUselessSwitchCase: Production case kept for readability alongside other environments
207
+ case 'production':
208
+ default:
209
+ return 'https://sequence.app';
205
210
  }
206
211
  }
@@ -0,0 +1,114 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`useListCollections > should fetch collections successfully 1`] = `
4
+ [
5
+ {
6
+ "address": "0x0000000000000000000000000000000000000000",
7
+ "bannerUrl": "https://example.com/market-banner.png",
8
+ "bytecodeHash": "0x1234567890",
9
+ "chainId": 1,
10
+ "contractType": "ERC721",
11
+ "currencyOptions": [
12
+ "0x0000000000000000000000000000000000000000",
13
+ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
14
+ ],
15
+ "deployed": true,
16
+ "destinationMarketplace": "sequence_marketplace_v2",
17
+ "extensions": {
18
+ "blacklist": false,
19
+ "categories": [
20
+ "Mock",
21
+ ],
22
+ "description": "A mock collection for testing",
23
+ "featureIndex": 0,
24
+ "featured": true,
25
+ "link": "https://example.com",
26
+ "ogImage": "https://example.com/image.png",
27
+ "ogName": "Mock Collection",
28
+ "originAddress": "0x0000000000000000000000000000000000000000",
29
+ "originChainId": 1,
30
+ "verified": true,
31
+ "verifiedBy": "0x",
32
+ },
33
+ "feePercentage": 3.5,
34
+ "filterSettings": {
35
+ "exclusions": [
36
+ {
37
+ "condition": "SPECIFIC_VALUE",
38
+ "key": "Type",
39
+ "value": "Sample",
40
+ },
41
+ ],
42
+ "filterOrder": [
43
+ "Type",
44
+ "Rarity",
45
+ ],
46
+ },
47
+ "itemsAddress": "0x0000000000000000000000000000000000000000",
48
+ "logoURI": "https://example.com/logo.png",
49
+ "marketplaceType": "MARKET",
50
+ "name": "Mock Collection",
51
+ "source": "https://example.com/source",
52
+ "status": "AVAILABLE",
53
+ "symbol": "MOCK",
54
+ "type": "ERC721",
55
+ "updatedAt": "2025-05-01T04:39:56.936Z",
56
+ },
57
+ {
58
+ "address": "0x1234567890123456789012345678901234567890",
59
+ "bannerUrl": "https://example.com/collection-banner.png",
60
+ "bytecodeHash": "0x1234567890",
61
+ "chainId": 137,
62
+ "contractType": "ERC1155",
63
+ "currencyOptions": [
64
+ "0x0000000000000000000000000000000000000000",
65
+ ],
66
+ "deployed": true,
67
+ "destinationMarketplace": "opensea",
68
+ "extensions": {
69
+ "blacklist": false,
70
+ "categories": [
71
+ "Mock",
72
+ ],
73
+ "description": "A mock collection for testing",
74
+ "featureIndex": 0,
75
+ "featured": true,
76
+ "link": "https://example.com",
77
+ "ogImage": "https://example.com/image.png",
78
+ "ogName": "Mock Collection",
79
+ "originAddress": "0x0000000000000000000000000000000000000000",
80
+ "originChainId": 1,
81
+ "verified": true,
82
+ "verifiedBy": "0x",
83
+ },
84
+ "feePercentage": 2.5,
85
+ "filterSettings": {
86
+ "exclusions": [
87
+ {
88
+ "condition": "ENTIRE_KEY",
89
+ "key": "Category",
90
+ },
91
+ {
92
+ "condition": "SPECIFIC_VALUE",
93
+ "key": "Level",
94
+ "value": "Legendary",
95
+ },
96
+ ],
97
+ "filterOrder": [
98
+ "Category",
99
+ "Level",
100
+ "Element",
101
+ ],
102
+ },
103
+ "itemsAddress": "0x1234567890123456789012345678901234567890",
104
+ "logoURI": "https://example.com/logo.png",
105
+ "marketplaceType": "MARKET",
106
+ "name": "Mock Collection",
107
+ "source": "https://example.com/source",
108
+ "status": "AVAILABLE",
109
+ "symbol": "MOCK",
110
+ "type": "ERC721",
111
+ "updatedAt": "2025-05-01T04:39:56.936Z",
112
+ },
113
+ ]
114
+ `;