@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.
- package/.changeset/fluffy-jokes-lay.md +5 -0
- package/.changeset/wise-bugs-boil.md +8 -0
- package/CHANGELOG.md +43 -0
- package/dist/{chunk-FMEEJFAF.js → chunk-5C6ZZ6WX.js} +1 -1
- package/dist/{chunk-YEGD7PWE.js → chunk-5O44EPXZ.js} +2 -2
- package/dist/chunk-6CTFVBKU.js +1 -0
- package/dist/{chunk-DWTLVJAW.js → chunk-6OPMUCGX.js} +1 -1
- package/dist/chunk-6OPMUCGX.js.map +1 -0
- package/dist/{chunk-O34GCB47.js → chunk-L6KWLCER.js} +4 -4
- package/dist/chunk-L6KWLCER.js.map +1 -0
- package/dist/{chunk-4XLXOEXQ.js → chunk-LAP2CKLN.js} +78 -4
- package/dist/chunk-LAP2CKLN.js.map +1 -0
- package/dist/{chunk-Y63BOO6M.js → chunk-LECCEZAO.js} +1 -1
- package/dist/{chunk-YALXP2PW.js → chunk-N7SQWS2R.js} +3 -3
- package/dist/{chunk-KGM2WLSP.js → chunk-OAOONM4S.js} +695 -440
- package/dist/chunk-OAOONM4S.js.map +1 -0
- package/dist/chunk-Q3ECVC4F.js +811 -0
- package/dist/chunk-Q3ECVC4F.js.map +1 -0
- package/dist/chunk-QY52UADF.js +107 -0
- package/dist/chunk-QY52UADF.js.map +1 -0
- package/dist/{chunk-I2BYHDFE.js → chunk-TNAR3XEF.js} +3898 -844
- package/dist/chunk-TNAR3XEF.js.map +1 -0
- package/dist/chunk-XABYNWXO.js +549 -0
- package/dist/chunk-XABYNWXO.js.map +1 -0
- package/dist/chunk-YB5UUF2G.js +11 -0
- package/dist/chunk-YB5UUF2G.js.map +1 -0
- package/dist/{chunk-35WWD5V6.js → chunk-YWGFI4PN.js} +88 -25
- package/dist/chunk-YWGFI4PN.js.map +1 -0
- package/dist/{create-config-DwrnzwpM.d.ts → create-config-DLMvMTkZ.d.ts} +2 -2
- package/dist/index.css +7 -7
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +19 -14
- package/dist/{lowestListing-BQHIuvNF.d.ts → marketCurrencies-enNVYwBk.d.ts} +95 -3
- package/dist/{marketplace.gen-DQzWciwC.d.ts → marketplace.gen-D24veUQs.d.ts} +3 -2
- package/dist/marketplaceConfig-BwNAbLPw.d.ts +21 -0
- package/dist/new-marketplace-types-BCw19X9S.d.ts +102 -0
- package/dist/react/_internal/api/index.d.ts +4 -3
- package/dist/react/_internal/api/index.js +5 -1
- package/dist/react/_internal/databeat/index.css +2764 -0
- package/dist/react/_internal/databeat/index.css.map +1 -0
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +15 -14
- package/dist/react/_internal/index.d.ts +62 -9
- package/dist/react/_internal/index.js +7 -3
- package/dist/react/_internal/wagmi/index.d.ts +5 -6
- package/dist/react/_internal/wagmi/index.js +1 -1
- package/dist/react/hooks/index.css +2764 -0
- package/dist/react/hooks/index.css.map +1 -0
- package/dist/react/hooks/index.d.ts +74 -222
- package/dist/react/hooks/index.js +21 -22
- package/dist/react/hooks/options/index.d.ts +5 -4
- package/dist/react/hooks/options/index.js +9 -7
- package/dist/react/index.css +7 -7
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +12 -11
- package/dist/react/index.js +34 -37
- package/dist/react/queries/index.d.ts +4 -3
- package/dist/react/queries/index.js +19 -6
- package/dist/react/ssr/index.d.ts +3 -3
- package/dist/react/ssr/index.js +6 -5
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css +7 -7
- package/dist/react/ui/components/collectible-card/index.css.map +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +9 -6
- package/dist/react/ui/components/collectible-card/index.js +19 -23
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/icons/index.js +9 -8
- package/dist/react/ui/index.css +7 -7
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +2 -2
- package/dist/react/ui/index.js +17 -21
- package/dist/react/ui/modals/_internal/components/actionModal/index.css +2764 -0
- package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -0
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +15 -14
- package/dist/sdk-config-qorA0TgF.d.ts +165 -0
- package/dist/{services-BI_w8Eq4.d.ts → services-WrshxCqc.d.ts} +6 -3
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js +7 -7
- package/dist/{index-DGsVBflk.d.ts → useCollection-YAdXfVO7.d.ts} +1 -2
- package/dist/utils/abi/index.d.ts +1 -0
- package/dist/utils/abi/index.js +7 -1
- package/dist/utils/abi/primary-sale/index.d.ts +1054 -0
- package/dist/utils/abi/primary-sale/index.js +9 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +13 -6
- package/package.json +32 -32
- package/src/react/_internal/api/__mocks__/builder.msw.ts +157 -80
- package/src/react/_internal/api/builder-api.ts +2 -2
- package/src/react/_internal/api/builder.gen.ts +667 -112
- package/src/react/_internal/api/marketplace.gen.ts +1981 -1316
- package/src/react/_internal/api/services.ts +12 -1
- package/src/react/_internal/types.ts +1 -13
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +99 -84
- package/src/react/_internal/wagmi/create-config.ts +8 -4
- package/src/react/_internal/wagmi/get-connectors.ts +24 -19
- package/src/react/hooks/__tests__/__snapshots__/useListCollections.test.tsx.snap +114 -0
- package/src/react/hooks/__tests__/__snapshots__/useMarketplaceConfig.test.tsx.snap +85 -83
- package/src/react/hooks/__tests__/useFilters.test.tsx +0 -16
- package/src/react/hooks/__tests__/useInventory.test.tsx +16 -16
- package/src/react/hooks/__tests__/useListCollections.test.tsx +23 -56
- package/src/react/hooks/__tests__/{useCurrencies.test.tsx → useMarketCurrencies.test.tsx} +21 -15
- package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +2 -59
- package/src/react/hooks/index.ts +3 -1
- package/src/react/hooks/useBalanceOfCollectible.tsx +5 -3
- package/src/react/hooks/useConvertPriceToUSD.tsx +1 -1
- package/src/react/hooks/useFilters.tsx +14 -22
- package/src/react/hooks/useGetTokenSuppliesMap.ts +28 -0
- package/src/react/hooks/useInventory.tsx +4 -3
- package/src/react/hooks/useList1155SaleSupplies.tsx +62 -0
- package/src/react/hooks/useListBalances.tsx +5 -3
- package/src/react/hooks/useListCollectibles.tsx +5 -3
- package/src/react/hooks/useListCollections.tsx +14 -76
- package/src/react/hooks/useListTokenMetadata.ts +19 -0
- package/src/react/hooks/useMarketCurrencies.tsx +8 -0
- package/src/react/hooks/useMarketplaceConfig.tsx +0 -2
- package/src/react/queries/index.ts +2 -0
- package/src/react/queries/inventory.ts +1 -1
- package/src/react/queries/listCollections.ts +118 -0
- package/src/react/queries/listTokenMetadata.ts +38 -0
- package/src/react/queries/marketCurrencies.ts +77 -0
- package/src/react/queries/marketplaceConfig.ts +83 -55
- package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +85 -83
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
- package/src/react/ui/components/collectible-card/__tests__/{CollectibleAsset.test.tsx → Media.test.tsx} +48 -14
- package/src/react/ui/components/collectible-card/index.ts +1 -1
- package/src/react/ui/components/collectible-card/media/Media.tsx +211 -0
- package/src/react/ui/components/collectible-card/{collectible-asset/CollectibleAssetSkeleton.tsx → media/MediaSkeleton.tsx} +2 -2
- package/src/react/ui/components/collectible-card/media/types.ts +18 -0
- package/src/react/ui/components/collectible-card/{collectible-asset → media}/utils.ts +8 -3
- package/src/react/ui/index.ts +1 -1
- package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +9 -3
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +31 -21
- package/src/react/ui/modals/BuyModal/hooks/useFees.ts +3 -2
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +28 -3
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +3 -5
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +5 -3
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +2 -2
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +2 -3
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +4 -3
- package/src/react/ui/modals/SellModal/Modal.tsx +0 -1
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +2 -2
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +1 -1
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +0 -1
- package/src/react/ui/modals/TransferModal/index.tsx +0 -1
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +2 -2
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +7 -6
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +13 -7
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +3 -5
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +5 -3
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
- package/src/react/ui/modals/_internal/hooks/useSelectWaasFeeOptions.ts +2 -12
- package/src/types/index.ts +1 -6
- package/src/types/new-marketplace-types.ts +119 -0
- package/src/types/sdk-config.ts +19 -2
- package/src/types/types.ts +1 -0
- package/src/utils/abi/index.ts +1 -0
- package/src/utils/abi/primary-sale/index.ts +2 -0
- package/src/utils/abi/primary-sale/sequence-1155-sales-contract.ts +450 -0
- package/src/utils/abi/primary-sale/sequence-721-sales-contract.ts +352 -0
- package/src/utils/abi/token/sequence-erc1155-items.ts +454 -0
- package/src/utils/fetchContentType.ts +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-35WWD5V6.js.map +0 -1
- package/dist/chunk-4XLXOEXQ.js.map +0 -1
- package/dist/chunk-D7RVSZAQ.js +0 -332
- package/dist/chunk-D7RVSZAQ.js.map +0 -1
- package/dist/chunk-DWTLVJAW.js.map +0 -1
- package/dist/chunk-EODKQL6Y.js +0 -76
- package/dist/chunk-EODKQL6Y.js.map +0 -1
- package/dist/chunk-G3447GIP.js +0 -2880
- package/dist/chunk-G3447GIP.js.map +0 -1
- package/dist/chunk-HHYNOPPI.js +0 -53
- package/dist/chunk-HHYNOPPI.js.map +0 -1
- package/dist/chunk-I2BYHDFE.js.map +0 -1
- package/dist/chunk-JKCF7HEA.js +0 -1
- package/dist/chunk-KGM2WLSP.js.map +0 -1
- package/dist/chunk-MAD64DLJ.js +0 -81
- package/dist/chunk-MAD64DLJ.js.map +0 -1
- package/dist/chunk-N7BPFK46.js +0 -1
- package/dist/chunk-O34GCB47.js.map +0 -1
- package/dist/chunk-UISBTKFF.js +0 -1
- package/dist/chunk-UISBTKFF.js.map +0 -1
- package/dist/chunk-YBOFRP65.js +0 -128
- package/dist/chunk-YBOFRP65.js.map +0 -1
- package/dist/marketplaceConfig-B4Fdsmxu.d.ts +0 -17
- package/dist/sdk-config-txlivEKe.d.ts +0 -133
- package/dist/types-isjvwapz.d.ts +0 -68
- package/src/react/hooks/useCurrencies.tsx +0 -77
- package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAsset.tsx +0 -174
- /package/dist/{chunk-FMEEJFAF.js.map → chunk-5C6ZZ6WX.js.map} +0 -0
- /package/dist/{chunk-YEGD7PWE.js.map → chunk-5O44EPXZ.js.map} +0 -0
- /package/dist/{chunk-JKCF7HEA.js.map → chunk-6CTFVBKU.js.map} +0 -0
- /package/dist/{chunk-Y63BOO6M.js.map → chunk-LECCEZAO.js.map} +0 -0
- /package/dist/{chunk-YALXP2PW.js.map → chunk-N7SQWS2R.js.map} +0 -0
- /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
|
|
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 {
|
|
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
|
-
|
|
8
|
-
|
|
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
|
|
15
|
+
let baseMarketplace: MarketplaceConfig;
|
|
15
16
|
let baseSdkConfig: SdkConfig;
|
|
16
17
|
|
|
17
18
|
beforeEach(() => {
|
|
18
|
-
|
|
19
|
+
baseMarketplace = {
|
|
19
20
|
projectId: 1,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
...
|
|
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
|
-
...
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
...
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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 '
|
|
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.
|
|
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
|
|
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:
|
|
33
|
+
walletType: MarketplaceWalletType;
|
|
34
34
|
}): CreateConnectorFn[] {
|
|
35
35
|
const connectors = commonConnectors(marketplaceConfig, sdkConfig);
|
|
36
36
|
|
|
37
|
-
if (walletType ===
|
|
37
|
+
if (walletType === MarketplaceWalletType.UNIVERSAL) {
|
|
38
38
|
connectors.push(...getUniversalWalletConfigs(sdkConfig, marketplaceConfig));
|
|
39
|
-
} else if (walletType ===
|
|
39
|
+
} else if (walletType === MarketplaceWalletType.EMBEDDED) {
|
|
40
40
|
connectors.push(...getWaasConnectors(sdkConfig, marketplaceConfig));
|
|
41
|
-
} else if (walletType ===
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
127
|
-
|
|
128
|
-
|
|
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.
|
|
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
|
+
`;
|