@0xsequence/marketplace-sdk 0.8.7 → 0.8.8
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/CHANGELOG.md +26 -0
- package/dist/chunk-2PSNAIAT.js +1 -0
- package/dist/chunk-2PSNAIAT.js.map +1 -0
- package/dist/{chunk-7FVZD2LL.js → chunk-4XLXOEXQ.js} +2 -2
- package/dist/{chunk-Y6AOCO3Q.js → chunk-7IYKUVC3.js} +312 -145
- package/dist/chunk-7IYKUVC3.js.map +1 -0
- package/dist/{chunk-5HEZNTSU.js → chunk-D7RVSZAQ.js} +131 -83
- package/dist/chunk-D7RVSZAQ.js.map +1 -0
- package/dist/chunk-DWTLVJAW.js +42 -0
- package/dist/chunk-DWTLVJAW.js.map +1 -0
- package/dist/{chunk-YAUZLETY.js → chunk-G3447GIP.js} +37 -18
- package/dist/chunk-G3447GIP.js.map +1 -0
- package/dist/{chunk-O6GWM7C3.js → chunk-HHYNOPPI.js} +2 -2
- package/dist/{chunk-KTT27YUN.js → chunk-KGM2WLSP.js} +12 -156
- package/dist/chunk-KGM2WLSP.js.map +1 -0
- package/dist/chunk-MAD64DLJ.js +81 -0
- package/dist/chunk-MAD64DLJ.js.map +1 -0
- package/dist/chunk-N7BPFK46.js +1 -0
- package/dist/chunk-N7BPFK46.js.map +1 -0
- package/dist/chunk-NX52D7NX.js +135 -0
- package/dist/chunk-NX52D7NX.js.map +1 -0
- package/dist/chunk-O34GCB47.js +32 -0
- package/dist/chunk-O34GCB47.js.map +1 -0
- package/dist/{chunk-Q2DA477S.js → chunk-YALXP2PW.js} +3 -3
- package/dist/{chunk-A6V7XDY4.js → chunk-YBOFRP65.js} +2 -2
- package/dist/{create-config-CdooE7aU.d.ts → create-config-DwrnzwpM.d.ts} +2 -2
- package/dist/{index-ClKHzm0B.d.ts → index-DGsVBflk.d.ts} +3 -12
- package/dist/index.css +7 -5
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.js +13 -5
- package/dist/{lowestListing-kFyrUGha.d.ts → lowestListing-BQHIuvNF.d.ts} +2 -2
- package/dist/{marketplace.gen-BU6T6f0m.d.ts → marketplace.gen-DQzWciwC.d.ts} +1 -1
- package/dist/marketplaceConfig-B4Fdsmxu.d.ts +17 -0
- package/dist/react/_internal/api/index.d.ts +3 -3
- package/dist/react/_internal/api/index.js +4 -3
- package/dist/react/_internal/databeat/index.d.ts +2 -1
- package/dist/react/_internal/databeat/index.js +11 -7
- package/dist/react/_internal/index.d.ts +6 -6
- package/dist/react/_internal/index.js +13 -10
- package/dist/react/_internal/wagmi/index.d.ts +6 -5
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +9 -8
- package/dist/react/hooks/index.js +10 -6
- package/dist/react/hooks/options/index.d.ts +4 -4
- package/dist/react/hooks/options/index.js +7 -4
- package/dist/react/index.css +2650 -0
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +8 -8
- package/dist/react/index.js +16 -11
- package/dist/react/queries/index.d.ts +3 -3
- package/dist/react/queries/index.js +6 -3
- package/dist/react/ssr/index.d.ts +3 -3
- package/dist/react/ssr/index.js +6 -3
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css +2650 -0
- package/dist/react/ui/components/collectible-card/index.css.map +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +1 -1
- package/dist/react/ui/components/collectible-card/index.js +14 -9
- package/dist/react/ui/icons/index.js +5 -2
- package/dist/react/ui/index.css +2650 -0
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +2 -1
- package/dist/react/ui/index.js +14 -9
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +11 -7
- package/dist/sdk-config-txlivEKe.d.ts +133 -0
- package/dist/{services-9ApY0U-o.d.ts → services-BI_w8Eq4.d.ts} +4 -4
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js +9 -6
- package/dist/{types-DsTwmKG-.d.ts → types-isjvwapz.d.ts} +3 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +5 -2
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/react/{hooks/options/__mocks__/marketplaceConfig.msw.ts → _internal/api/__mocks__/builder.msw.ts} +70 -63
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +30 -10
- package/src/react/_internal/api/builder-api.ts +32 -0
- package/src/react/_internal/api/builder.gen.ts +215 -0
- package/src/react/_internal/api/services.ts +9 -2
- package/src/react/_internal/databeat/types.ts +1 -0
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +16 -41
- package/src/react/_internal/wagmi/create-config.ts +3 -16
- package/src/react/_internal/wagmi/get-connectors.ts +31 -21
- package/src/react/_internal/wallet/__tests__/wallet.test.ts +30 -0
- package/src/react/_internal/wallet/wallet.ts +25 -2
- package/src/react/hooks/__tests__/__snapshots__/useMarketplaceConfig.test.tsx.snap +96 -0
- package/src/react/hooks/__tests__/useCollection.test.tsx +4 -5
- package/src/react/hooks/__tests__/useCurrencies.test.tsx +1 -1
- package/src/react/hooks/__tests__/useInventory.test.tsx +15 -16
- package/src/react/hooks/__tests__/useListCollections.test.tsx +18 -163
- package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +10 -11
- package/src/react/hooks/options/index.ts +1 -1
- package/src/react/hooks/useAutoSelectFeeOption.tsx +1 -0
- package/src/react/hooks/useMarketplaceConfig.tsx +2 -2
- package/src/react/queries/marketplaceConfig.ts +101 -0
- package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +1 -0
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
- package/src/react/ui/components/collectible-card/__tests__/CollectibleAsset.test.tsx +72 -42
- package/src/react/ui/components/collectible-card/{CollectibleAsset.tsx → collectible-asset/CollectibleAsset.tsx} +44 -44
- package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAssetSkeleton.tsx +14 -0
- package/src/react/ui/components/collectible-card/collectible-asset/utils.ts +36 -0
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +6 -1
- package/src/react/ui/modals/BuyModal/store.ts +1 -0
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +20 -2
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +17 -1
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +4 -0
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +7 -1
- package/src/types/index.ts +7 -1
- package/src/types/sdk-config.ts +4 -9
- package/src/utils/fetchContentType.ts +101 -0
- package/src/utils/getSequenceMarketRequestId.ts +32 -0
- package/test/mocks/wallet.ts +3 -1
- package/test/test-utils.tsx +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/builder-types-D5HgAUWR.d.ts +0 -82
- package/dist/chunk-5HEZNTSU.js.map +0 -1
- package/dist/chunk-KTT27YUN.js.map +0 -1
- package/dist/chunk-N7E37ENQ.js +0 -58
- package/dist/chunk-N7E37ENQ.js.map +0 -1
- package/dist/chunk-Y6AOCO3Q.js.map +0 -1
- package/dist/chunk-YAUZLETY.js.map +0 -1
- package/dist/sdk-config-DIzJk_tI.d.ts +0 -26
- package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +0 -134
- package/src/react/hooks/options/marketplaceConfigOptions.ts +0 -71
- package/src/types/builder-types.ts +0 -88
- /package/dist/{chunk-7FVZD2LL.js.map → chunk-4XLXOEXQ.js.map} +0 -0
- /package/dist/{chunk-O6GWM7C3.js.map → chunk-HHYNOPPI.js.map} +0 -0
- /package/dist/{chunk-Q2DA477S.js.map → chunk-YALXP2PW.js.map} +0 -0
- /package/dist/{chunk-A6V7XDY4.js.map → chunk-YBOFRP65.js.map} +0 -0
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { queryOptions } from '@tanstack/react-query';
|
|
2
|
-
import type {
|
|
3
|
-
Env,
|
|
4
|
-
MarketplaceConfig,
|
|
5
|
-
MarketplaceSettings,
|
|
6
|
-
SdkConfig,
|
|
7
|
-
} from '../../../types';
|
|
8
|
-
import {
|
|
9
|
-
MarketplaceConfigFetchError,
|
|
10
|
-
ProjectNotFoundError,
|
|
11
|
-
} from '../../../utils/_internal/error/transaction';
|
|
12
|
-
import { builderMarketplaceApi, configKeys } from '../../_internal';
|
|
13
|
-
|
|
14
|
-
const fetchBuilderConfig = async (projectId: string, env: Env) => {
|
|
15
|
-
const url = `${builderMarketplaceApi(projectId, env)}`;
|
|
16
|
-
const response = await fetch(`${url}/settings.json`);
|
|
17
|
-
|
|
18
|
-
const json = await response.json();
|
|
19
|
-
if (!response.ok) {
|
|
20
|
-
console.error('Failed to fetch marketplace config:', response.status, json);
|
|
21
|
-
//@ts-ignore
|
|
22
|
-
switch (json.code) {
|
|
23
|
-
case 3000: // Throws 3000 if the project is not found
|
|
24
|
-
throw new ProjectNotFoundError(projectId, url);
|
|
25
|
-
default:
|
|
26
|
-
//@ts-ignore
|
|
27
|
-
throw new MarketplaceConfigFetchError(json.msg);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return json as MarketplaceSettings;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const fetchStyles = async (projectId: string, env: Env) => {
|
|
34
|
-
const response = await fetch(
|
|
35
|
-
`${builderMarketplaceApi(projectId, env)}/styles.css`,
|
|
36
|
-
);
|
|
37
|
-
const styles = await response.text();
|
|
38
|
-
// React sanitizes this string, so we need to remove all quotes, they are not needed anyway
|
|
39
|
-
return styles.replaceAll(/['"]/g, '');
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const fetchMarketplaceConfig = async (
|
|
43
|
-
env: Env,
|
|
44
|
-
projectId: string,
|
|
45
|
-
): Promise<MarketplaceConfig> => {
|
|
46
|
-
const [marketplaceConfig, cssString] = await Promise.all([
|
|
47
|
-
fetchBuilderConfig(projectId, env),
|
|
48
|
-
fetchStyles(projectId, env),
|
|
49
|
-
]);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
...marketplaceConfig,
|
|
53
|
-
cssString,
|
|
54
|
-
manifestUrl: `${builderMarketplaceApi(projectId, env)}/manifest.json`,
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const marketplaceConfigOptions = (
|
|
59
|
-
config: Pick<SdkConfig, 'projectId'> | SdkConfig,
|
|
60
|
-
) => {
|
|
61
|
-
let env: Env = 'production';
|
|
62
|
-
if ('_internal' in config && config._internal !== undefined) {
|
|
63
|
-
env = config._internal.builderEnv ?? env;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const projectId = config.projectId;
|
|
67
|
-
return queryOptions({
|
|
68
|
-
queryKey: [...configKeys.marketplace, env, projectId],
|
|
69
|
-
queryFn: () => fetchMarketplaceConfig(env, projectId),
|
|
70
|
-
});
|
|
71
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { OrderbookKind } from '../react/_internal/api/marketplace.gen';
|
|
2
|
-
|
|
3
|
-
// Manual copy of the types from builder
|
|
4
|
-
export enum MarketplaceWallet {
|
|
5
|
-
UNIVERSAL = 'UNIVERSAL',
|
|
6
|
-
EMBEDDED = 'EMBEDDED',
|
|
7
|
-
ECOSYSTEM = 'ECOSYSTEM',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum FilterCondition {
|
|
11
|
-
ENTIRE_KEY = 'ENTIRE_KEY',
|
|
12
|
-
SPECIFIC_VALUE = 'SPECIFIC_VALUE',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export enum MarketplaceType { // This is only used for marketplace v1
|
|
16
|
-
AMM = 'AMM',
|
|
17
|
-
P2P = 'P2P',
|
|
18
|
-
SEQUENCE = 'SEQUENCE',
|
|
19
|
-
ORDERBOOK = 'ORDERBOOK',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface EcosystemWalletSettings {
|
|
23
|
-
walletUrl: string;
|
|
24
|
-
walletAppName: string;
|
|
25
|
-
logoLightUrl?: string;
|
|
26
|
-
logoDarkUrl?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface MarketplaceWalletOptions {
|
|
29
|
-
walletType: MarketplaceWallet;
|
|
30
|
-
oidcIssuers: { [key: string]: string };
|
|
31
|
-
connectors: Array<string>;
|
|
32
|
-
includeEIP6963Wallets: boolean;
|
|
33
|
-
ecosystem?: EcosystemWalletSettings;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface MetadataFilterRule {
|
|
37
|
-
key: string;
|
|
38
|
-
condition: FilterCondition;
|
|
39
|
-
value?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface CollectionFilterSettings {
|
|
43
|
-
filterOrder: Array<string>;
|
|
44
|
-
exclusions: Array<MetadataFilterRule>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface MarketplaceCollection {
|
|
48
|
-
marketplaceType: MarketplaceType;
|
|
49
|
-
chainId: number;
|
|
50
|
-
address: string;
|
|
51
|
-
exchanges: Array<string>;
|
|
52
|
-
bannerUrl: string;
|
|
53
|
-
feePercentage: number;
|
|
54
|
-
currencyOptions: Array<string>;
|
|
55
|
-
destinationMarketplace: OrderbookKind;
|
|
56
|
-
filterSettings?: CollectionFilterSettings;
|
|
57
|
-
isLAOSERC721?: boolean;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface MarketplaceSocials {
|
|
61
|
-
twitter: string;
|
|
62
|
-
discord: string;
|
|
63
|
-
website: string;
|
|
64
|
-
tiktok: string;
|
|
65
|
-
instagram: string;
|
|
66
|
-
youtube: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface MarketplaceSettings {
|
|
70
|
-
publisherId: string;
|
|
71
|
-
title: string;
|
|
72
|
-
shortDescription: string;
|
|
73
|
-
socials: MarketplaceSocials;
|
|
74
|
-
faviconUrl: string;
|
|
75
|
-
landingBannerUrl: string;
|
|
76
|
-
collections: Array<MarketplaceCollection>;
|
|
77
|
-
walletOptions: MarketplaceWalletOptions;
|
|
78
|
-
landingPageLayout: string;
|
|
79
|
-
logoUrl: string;
|
|
80
|
-
bannerUrl: string;
|
|
81
|
-
fontUrl?: string;
|
|
82
|
-
ogImage?: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface MarketplaceConfig extends MarketplaceSettings {
|
|
86
|
-
cssString: string;
|
|
87
|
-
manifestUrl: string;
|
|
88
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|