@0xsequence/marketplace-sdk 0.8.6 → 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 +32 -0
- package/dist/chunk-2PSNAIAT.js +1 -0
- package/dist/chunk-2PSNAIAT.js.map +1 -0
- package/dist/{chunk-WXKV5N4T.js → chunk-35WWD5V6.js} +3 -3
- package/dist/{chunk-ZSCZLHKX.js → chunk-4XLXOEXQ.js} +2 -2
- package/dist/{chunk-TGFX3TMV.js → chunk-7IYKUVC3.js} +314 -147
- package/dist/chunk-7IYKUVC3.js.map +1 -0
- package/dist/{chunk-BB2PTJHI.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-SJU6QZHM.js → chunk-EODKQL6Y.js} +2 -2
- package/dist/{chunk-6SEJI7YS.js → chunk-G3447GIP.js} +39 -20
- package/dist/chunk-G3447GIP.js.map +1 -0
- package/dist/{chunk-QMWMJVTX.js → chunk-HHYNOPPI.js} +2 -2
- package/dist/{chunk-ALICO7NG.js → chunk-KGM2WLSP.js} +15 -158
- 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-LDZZUYG7.js → chunk-YALXP2PW.js} +3 -3
- package/dist/{chunk-V3NVAVHV.js → chunk-YBOFRP65.js} +2 -2
- package/dist/{chunk-BGY4WXER.js → chunk-YEGD7PWE.js} +3 -2
- package/dist/{chunk-BGY4WXER.js.map → chunk-YEGD7PWE.js.map} +1 -1
- package/dist/{create-config-qDML4ZNn.d.ts → create-config-DwrnzwpM.d.ts} +2 -2
- package/dist/{index-DtWR0b_l.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 +14 -6
- package/dist/{lowestListing-W7P4EkC3.d.ts → lowestListing-BQHIuvNF.d.ts} +2 -2
- package/dist/{marketplace.gen-DS-MmGEB.d.ts → marketplace.gen-DQzWciwC.d.ts} +5 -4
- 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 +13 -9
- 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 +12 -8
- 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 +19 -14
- 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 +17 -12
- package/dist/react/ui/icons/index.js +8 -5
- 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 +17 -12
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +13 -9
- package/dist/sdk-config-txlivEKe.d.ts +133 -0
- package/dist/{services-BOX67E7W.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-CJLhc2VZ.d.ts → types-isjvwapz.d.ts} +3 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +6 -3
- 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/marketplace.gen.ts +6 -6
- 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/getMarketplaceDetails.ts +2 -1
- 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-BY6eD6vD.d.ts +0 -82
- package/dist/chunk-6SEJI7YS.js.map +0 -1
- package/dist/chunk-ALICO7NG.js.map +0 -1
- package/dist/chunk-BB2PTJHI.js.map +0 -1
- package/dist/chunk-HGKWWZWY.js +0 -58
- package/dist/chunk-HGKWWZWY.js.map +0 -1
- package/dist/chunk-TGFX3TMV.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-WXKV5N4T.js.map → chunk-35WWD5V6.js.map} +0 -0
- /package/dist/{chunk-ZSCZLHKX.js.map → chunk-4XLXOEXQ.js.map} +0 -0
- /package/dist/{chunk-SJU6QZHM.js.map → chunk-EODKQL6Y.js.map} +0 -0
- /package/dist/{chunk-QMWMJVTX.js.map → chunk-HHYNOPPI.js.map} +0 -0
- /package/dist/{chunk-LDZZUYG7.js.map → chunk-YALXP2PW.js.map} +0 -0
- /package/dist/{chunk-V3NVAVHV.js.map → chunk-YBOFRP65.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/marketplace-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css"
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"0xsequence": "^2.3.8",
|
|
57
57
|
"@0xsequence/api": "^2.3.8",
|
|
58
|
-
"@0xsequence/checkout": "^5.
|
|
59
|
-
"@0xsequence/connect": "^5.
|
|
58
|
+
"@0xsequence/checkout": "^5.2.2",
|
|
59
|
+
"@0xsequence/connect": "^5.2.2",
|
|
60
60
|
"@0xsequence/design-system": "^2.1.6",
|
|
61
61
|
"@0xsequence/indexer": "^2.3.8",
|
|
62
62
|
"@0xsequence/metadata": "^2.3.8",
|
package/src/index.ts
CHANGED
|
@@ -2,15 +2,64 @@ import { http, HttpResponse } from 'msw';
|
|
|
2
2
|
import { zeroAddress } from 'viem';
|
|
3
3
|
import {
|
|
4
4
|
FilterCondition,
|
|
5
|
+
type LookupMarketplaceConfigReturn,
|
|
5
6
|
type MarketplaceConfig,
|
|
6
7
|
MarketplaceType,
|
|
7
8
|
MarketplaceWallet,
|
|
8
9
|
OrderbookKind,
|
|
9
10
|
} from '../../../../types';
|
|
10
|
-
import { mockCurrencies } from '
|
|
11
|
+
import { mockCurrencies } from './marketplace.msw';
|
|
12
|
+
|
|
13
|
+
export const mockCollections = [
|
|
14
|
+
{
|
|
15
|
+
address: zeroAddress,
|
|
16
|
+
chainId: 1,
|
|
17
|
+
marketplaceType: MarketplaceType.ORDERBOOK,
|
|
18
|
+
currencyOptions: mockCurrencies.map((c) => c.contractAddress),
|
|
19
|
+
exchanges: [],
|
|
20
|
+
bannerUrl: '',
|
|
21
|
+
feePercentage: 3.5,
|
|
22
|
+
destinationMarketplace: OrderbookKind.sequence_marketplace_v2,
|
|
23
|
+
filterSettings: {
|
|
24
|
+
filterOrder: ['Type', 'Rarity'],
|
|
25
|
+
exclusions: [
|
|
26
|
+
{
|
|
27
|
+
key: 'Type',
|
|
28
|
+
condition: FilterCondition.SPECIFIC_VALUE,
|
|
29
|
+
value: 'Sample',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
address: '0x1234567890123456789012345678901234567890',
|
|
36
|
+
chainId: 137,
|
|
37
|
+
marketplaceType: MarketplaceType.ORDERBOOK,
|
|
38
|
+
currencyOptions: [mockCurrencies[0].contractAddress],
|
|
39
|
+
exchanges: [],
|
|
40
|
+
bannerUrl: 'https://example.com/collection-banner.png',
|
|
41
|
+
feePercentage: 2.5,
|
|
42
|
+
destinationMarketplace: OrderbookKind.opensea,
|
|
43
|
+
filterSettings: {
|
|
44
|
+
filterOrder: ['Category', 'Level', 'Element'],
|
|
45
|
+
exclusions: [
|
|
46
|
+
{
|
|
47
|
+
key: 'Category',
|
|
48
|
+
condition: FilterCondition.ENTIRE_KEY,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: 'Level',
|
|
52
|
+
condition: FilterCondition.SPECIFIC_VALUE,
|
|
53
|
+
value: 'Legendary',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
11
59
|
|
|
12
60
|
// Mock data
|
|
13
61
|
export const mockConfig: MarketplaceConfig = {
|
|
62
|
+
projectId: 1,
|
|
14
63
|
publisherId: 'test-publisher',
|
|
15
64
|
title: 'Test Marketplace',
|
|
16
65
|
shortDescription: 'A test marketplace',
|
|
@@ -31,52 +80,7 @@ export const mockConfig: MarketplaceConfig = {
|
|
|
31
80
|
connectors: ['coinbase', 'walletconnect'],
|
|
32
81
|
includeEIP6963Wallets: true,
|
|
33
82
|
},
|
|
34
|
-
collections:
|
|
35
|
-
{
|
|
36
|
-
address: zeroAddress,
|
|
37
|
-
chainId: 1,
|
|
38
|
-
marketplaceType: MarketplaceType.ORDERBOOK,
|
|
39
|
-
currencyOptions: mockCurrencies.map((c) => c.contractAddress),
|
|
40
|
-
exchanges: [],
|
|
41
|
-
bannerUrl: '',
|
|
42
|
-
feePercentage: 3.5,
|
|
43
|
-
destinationMarketplace: OrderbookKind.sequence_marketplace_v2,
|
|
44
|
-
filterSettings: {
|
|
45
|
-
filterOrder: ['Type', 'Rarity'],
|
|
46
|
-
exclusions: [
|
|
47
|
-
{
|
|
48
|
-
key: 'Type',
|
|
49
|
-
condition: FilterCondition.SPECIFIC_VALUE,
|
|
50
|
-
value: 'Sample',
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
address: '0x1234567890123456789012345678901234567890',
|
|
57
|
-
chainId: 137,
|
|
58
|
-
marketplaceType: MarketplaceType.ORDERBOOK,
|
|
59
|
-
currencyOptions: [mockCurrencies[0].contractAddress],
|
|
60
|
-
exchanges: [],
|
|
61
|
-
bannerUrl: 'https://example.com/collection-banner.png',
|
|
62
|
-
feePercentage: 2.5,
|
|
63
|
-
destinationMarketplace: OrderbookKind.opensea,
|
|
64
|
-
filterSettings: {
|
|
65
|
-
filterOrder: ['Category', 'Level', 'Element'],
|
|
66
|
-
exclusions: [
|
|
67
|
-
{
|
|
68
|
-
key: 'Category',
|
|
69
|
-
condition: FilterCondition.ENTIRE_KEY,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
key: 'Level',
|
|
73
|
-
condition: FilterCondition.SPECIFIC_VALUE,
|
|
74
|
-
value: 'Legendary',
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
],
|
|
83
|
+
collections: mockCollections,
|
|
80
84
|
landingPageLayout: 'default',
|
|
81
85
|
cssString: '',
|
|
82
86
|
manifestUrl: '',
|
|
@@ -108,12 +112,23 @@ const debugLog = (endpoint: string, request: Request, response: Response) => {
|
|
|
108
112
|
}
|
|
109
113
|
};
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
export const mockLookupMarketplaceConfigError = () => {
|
|
116
|
+
return HttpResponse.json(
|
|
117
|
+
{ code: 3000, msg: 'Project not found' },
|
|
118
|
+
{ status: 404 },
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const createLookupMarketplaceConfigHandler = (config = mockConfig) =>
|
|
123
|
+
http.post('*/rpc/Builder/LookupMarketplaceConfig', () => {
|
|
124
|
+
return HttpResponse.json({
|
|
125
|
+
settings: config,
|
|
126
|
+
} satisfies LookupMarketplaceConfigReturn);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export const createLookupMarketplaceConfigErrorHandler = () =>
|
|
130
|
+
http.post('*/rpc/Builder/LookupMarketplaceConfig', () => {
|
|
131
|
+
return mockLookupMarketplaceConfigError();
|
|
117
132
|
});
|
|
118
133
|
|
|
119
134
|
export const createStylesHandler = (styles = mockStyles) =>
|
|
@@ -125,14 +140,6 @@ export const createStylesHandler = (styles = mockStyles) =>
|
|
|
125
140
|
return response;
|
|
126
141
|
});
|
|
127
142
|
|
|
128
|
-
export const createErrorHandler = () =>
|
|
129
|
-
http.get('*/marketplace/*/settings.json', () => {
|
|
130
|
-
return HttpResponse.json(
|
|
131
|
-
{ code: 3000, msg: 'Project not found' },
|
|
132
|
-
{ status: 404 },
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
143
|
export const createStylesErrorHandler = () =>
|
|
137
144
|
http.get('*/marketplace/*/styles.css', () => {
|
|
138
145
|
return new HttpResponse('', { status: 500 });
|
|
@@ -140,8 +147,8 @@ export const createStylesErrorHandler = () =>
|
|
|
140
147
|
|
|
141
148
|
// Default handlers
|
|
142
149
|
export const handlers = [
|
|
143
|
-
|
|
150
|
+
createLookupMarketplaceConfigHandler(),
|
|
151
|
+
createLookupMarketplaceConfigErrorHandler(),
|
|
144
152
|
createStylesHandler(),
|
|
145
|
-
createErrorHandler(),
|
|
146
153
|
createStylesErrorHandler(),
|
|
147
154
|
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ContractInfo,
|
|
3
|
+
type GetContractInfoBatchArgs,
|
|
3
4
|
type Metadata,
|
|
4
5
|
type PropertyFilter,
|
|
5
6
|
PropertyType,
|
|
@@ -28,8 +29,7 @@ const debugLog = (endpoint: string, request: unknown, response: unknown) => {
|
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
export const mockContractInfo: ContractInfo = {
|
|
32
|
+
export const mockEthCollection: ContractInfo = {
|
|
33
33
|
address: zeroAddress,
|
|
34
34
|
chainId: 1,
|
|
35
35
|
name: 'Mock Collection',
|
|
@@ -38,7 +38,7 @@ export const mockContractInfo: ContractInfo = {
|
|
|
38
38
|
status: ResourceStatus.AVAILABLE,
|
|
39
39
|
type: 'ERC721',
|
|
40
40
|
deployed: true,
|
|
41
|
-
updatedAt: new Date().toISOString(),
|
|
41
|
+
updatedAt: new Date('2025-05-01T04:39:56.936Z').toISOString(),
|
|
42
42
|
bytecodeHash: '0x1234567890',
|
|
43
43
|
extensions: {
|
|
44
44
|
description: 'A mock collection for testing',
|
|
@@ -57,6 +57,14 @@ export const mockContractInfo: ContractInfo = {
|
|
|
57
57
|
logoURI: 'https://example.com/logo.png',
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
export const mockPolCollection: ContractInfo = {
|
|
61
|
+
...mockEthCollection,
|
|
62
|
+
address: '0x1234567890123456789012345678901234567890',
|
|
63
|
+
chainId: 137,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const mockCollections = [mockEthCollection, mockPolCollection];
|
|
67
|
+
|
|
60
68
|
export const mockTokenMetadata: TokenMetadata = {
|
|
61
69
|
tokenId: '1',
|
|
62
70
|
name: 'Mock NFT #1',
|
|
@@ -77,7 +85,7 @@ export const mockTokenMetadata: TokenMetadata = {
|
|
|
77
85
|
background_color: '#ffffff',
|
|
78
86
|
animation_url: 'https://example.com/nft/1/animation',
|
|
79
87
|
decimals: 0,
|
|
80
|
-
updatedAt: new Date().toISOString(),
|
|
88
|
+
updatedAt: new Date('2025-05-01T04:39:56.936Z').toISOString(),
|
|
81
89
|
assets: [
|
|
82
90
|
{
|
|
83
91
|
id: 1,
|
|
@@ -90,7 +98,7 @@ export const mockTokenMetadata: TokenMetadata = {
|
|
|
90
98
|
mimeType: 'image/png',
|
|
91
99
|
width: 1000,
|
|
92
100
|
height: 1000,
|
|
93
|
-
updatedAt: new Date().toISOString(),
|
|
101
|
+
updatedAt: new Date('2025-05-01T04:39:56.936Z').toISOString(),
|
|
94
102
|
},
|
|
95
103
|
],
|
|
96
104
|
source: '',
|
|
@@ -145,7 +153,7 @@ export const mockMetadataHandler = <E extends Endpoint>(
|
|
|
145
153
|
// MSW handlers
|
|
146
154
|
export const handlers = [
|
|
147
155
|
mockMetadataHandler('GetContractInfo', {
|
|
148
|
-
contractInfo:
|
|
156
|
+
contractInfo: mockEthCollection,
|
|
149
157
|
}),
|
|
150
158
|
|
|
151
159
|
mockMetadataHandler('GetTokenMetadata', {
|
|
@@ -156,9 +164,21 @@ export const handlers = [
|
|
|
156
164
|
filters: mockPropertyFilters,
|
|
157
165
|
}),
|
|
158
166
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
http.post(mockMetadataEndpoint('GetContractInfoBatch'), async (request) => {
|
|
168
|
+
const body = (await request.request.json()) as GetContractInfoBatchArgs;
|
|
169
|
+
const chainId = Number(body.chainID);
|
|
170
|
+
const contractAddresses = body.contractAddresses;
|
|
171
|
+
|
|
172
|
+
const response = {
|
|
173
|
+
contractInfoMap: mockCollections.filter((collection) => {
|
|
174
|
+
return (
|
|
175
|
+
collection.chainId === chainId &&
|
|
176
|
+
contractAddresses.includes(collection.address)
|
|
177
|
+
);
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
debugLog('GetContractInfoBatch', request, response);
|
|
182
|
+
return HttpResponse.json(response);
|
|
163
183
|
}),
|
|
164
184
|
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { API } from './builder.gen';
|
|
2
|
+
|
|
3
|
+
export class BuilderAPI extends API {
|
|
4
|
+
constructor(
|
|
5
|
+
hostname: string,
|
|
6
|
+
public projectAccessKey?: string,
|
|
7
|
+
public jwtAuth?: string,
|
|
8
|
+
) {
|
|
9
|
+
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
10
|
+
this.fetch = this._fetch;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
_fetch = (input: RequestInfo, init?: RequestInit): Promise<Response> => {
|
|
14
|
+
const headers: Record<string, string> = {};
|
|
15
|
+
|
|
16
|
+
const jwtAuth = this.jwtAuth;
|
|
17
|
+
const projectAccessKey = this.projectAccessKey;
|
|
18
|
+
|
|
19
|
+
if (jwtAuth && jwtAuth.length > 0) {
|
|
20
|
+
headers.Authorization = `BEARER ${jwtAuth}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
24
|
+
headers['X-Access-Key'] = projectAccessKey;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const requestInit = init || {};
|
|
28
|
+
requestInit.headers = { ...init?.headers, ...headers };
|
|
29
|
+
|
|
30
|
+
return fetch(input, requestInit);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// Importing OrderbookKind from marketplace.gen, to avoid multiple enums
|
|
2
|
+
import { OrderbookKind } from "./marketplace.gen";
|
|
3
|
+
|
|
4
|
+
// Extracted from builder webrpc
|
|
5
|
+
|
|
6
|
+
export interface LookupMarketplaceConfigArgs {
|
|
7
|
+
projectId?: number;
|
|
8
|
+
hostname?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LookupMarketplaceConfigReturn {
|
|
12
|
+
settings: MarketplaceSettings;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MarketplaceSettings {
|
|
16
|
+
projectId: number;
|
|
17
|
+
publisherId: string;
|
|
18
|
+
title: string;
|
|
19
|
+
shortDescription: string;
|
|
20
|
+
socials: MarketplaceSocials;
|
|
21
|
+
faviconUrl: string;
|
|
22
|
+
landingBannerUrl: string;
|
|
23
|
+
collections: Array<MarketplaceCollection>;
|
|
24
|
+
walletOptions: MarketplaceWalletOptions;
|
|
25
|
+
landingPageLayout: string;
|
|
26
|
+
logoUrl: string;
|
|
27
|
+
bannerUrl: string;
|
|
28
|
+
fontUrl?: string;
|
|
29
|
+
ogImage?: string;
|
|
30
|
+
accessKey?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MarketplaceSocials {
|
|
34
|
+
twitter: string;
|
|
35
|
+
discord: string;
|
|
36
|
+
website: string;
|
|
37
|
+
tiktok: string;
|
|
38
|
+
instagram: string;
|
|
39
|
+
youtube: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface MarketplaceCollection {
|
|
43
|
+
marketplaceType: MarketplaceType;
|
|
44
|
+
chainId: number;
|
|
45
|
+
address: string;
|
|
46
|
+
exchanges: Array<string>;
|
|
47
|
+
bannerUrl: string;
|
|
48
|
+
feePercentage: number;
|
|
49
|
+
currencyOptions: Array<string>;
|
|
50
|
+
destinationMarketplace: OrderbookKind;
|
|
51
|
+
filterSettings?: CollectionFilterSettings;
|
|
52
|
+
isLAOSERC721?: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface CollectionFilterSettings {
|
|
56
|
+
filterOrder: Array<string>;
|
|
57
|
+
exclusions: Array<MetadataFilterRule>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface OpenIdProvider {
|
|
61
|
+
iss: string;
|
|
62
|
+
aud: Array<string>;
|
|
63
|
+
}
|
|
64
|
+
export interface MetadataFilterRule {
|
|
65
|
+
key: string;
|
|
66
|
+
condition: FilterCondition;
|
|
67
|
+
value?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface MarketplaceWalletWaasSettings {
|
|
71
|
+
tenantKey: string;
|
|
72
|
+
emailEnabled: boolean;
|
|
73
|
+
providers: Array<OpenIdProvider>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface MarketplaceWalletOptions {
|
|
77
|
+
walletType: MarketplaceWallet;
|
|
78
|
+
oidcIssuers: { [key: string]: string };
|
|
79
|
+
connectors: Array<string>;
|
|
80
|
+
includeEIP6963Wallets: boolean;
|
|
81
|
+
ecosystem?: EcosystemWalletSettings;
|
|
82
|
+
waas?: MarketplaceWalletWaasSettings;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface EcosystemWalletSettings {
|
|
86
|
+
walletUrl: string;
|
|
87
|
+
walletAppName: string;
|
|
88
|
+
logoLightUrl?: string;
|
|
89
|
+
logoDarkUrl?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export enum MarketplaceWallet {
|
|
93
|
+
UNIVERSAL = "UNIVERSAL",
|
|
94
|
+
EMBEDDED = "EMBEDDED",
|
|
95
|
+
ECOSYSTEM = "ECOSYSTEM",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export enum MarketplaceType {
|
|
99
|
+
AMM = "AMM",
|
|
100
|
+
P2P = "P2P",
|
|
101
|
+
SEQUENCE = "SEQUENCE",
|
|
102
|
+
ORDERBOOK = "ORDERBOOK",
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export enum FilterCondition {
|
|
106
|
+
ENTIRE_KEY = "ENTIRE_KEY",
|
|
107
|
+
SPECIFIC_VALUE = "SPECIFIC_VALUE",
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type Fetch = (
|
|
111
|
+
input: RequestInfo,
|
|
112
|
+
init?: RequestInit
|
|
113
|
+
) => Promise<Response>;
|
|
114
|
+
|
|
115
|
+
export class WebrpcRequestFailedError extends Error {
|
|
116
|
+
name: string;
|
|
117
|
+
code: number;
|
|
118
|
+
message: string;
|
|
119
|
+
status: number;
|
|
120
|
+
cause?: string;
|
|
121
|
+
|
|
122
|
+
constructor(
|
|
123
|
+
name = "WebrpcRequestFailed",
|
|
124
|
+
code = -1,
|
|
125
|
+
message = `request failed`,
|
|
126
|
+
status = 0,
|
|
127
|
+
cause?: string
|
|
128
|
+
) {
|
|
129
|
+
super(message);
|
|
130
|
+
this.name = name;
|
|
131
|
+
this.code = code;
|
|
132
|
+
this.message = message;
|
|
133
|
+
this.status = status;
|
|
134
|
+
this.cause = cause;
|
|
135
|
+
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
139
|
+
static new(payload: any): WebrpcRequestFailedError {
|
|
140
|
+
return new WebrpcRequestFailedError(
|
|
141
|
+
payload.name,
|
|
142
|
+
payload.code,
|
|
143
|
+
payload.msg || payload.message,
|
|
144
|
+
payload.status,
|
|
145
|
+
payload.cause
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const createHTTPRequest = (
|
|
151
|
+
body: object = {},
|
|
152
|
+
headers: object = {},
|
|
153
|
+
signal: AbortSignal | null = null
|
|
154
|
+
): object => {
|
|
155
|
+
return {
|
|
156
|
+
method: "POST",
|
|
157
|
+
headers: {
|
|
158
|
+
Accept: "application/json",
|
|
159
|
+
"Content-Type": "application/json",
|
|
160
|
+
...headers,
|
|
161
|
+
},
|
|
162
|
+
body: JSON.stringify(body || {}),
|
|
163
|
+
mode: "cors",
|
|
164
|
+
signal: signal || null,
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const buildResponse = (res: Response): Promise<any> => {
|
|
169
|
+
if (!res.ok) {
|
|
170
|
+
return res.json().then((errData) => {
|
|
171
|
+
throw WebrpcRequestFailedError.new(errData);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return res.json();
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export class API {
|
|
178
|
+
protected hostname: string;
|
|
179
|
+
protected fetch: Fetch;
|
|
180
|
+
protected path = "/rpc/Builder/";
|
|
181
|
+
|
|
182
|
+
constructor(hostname: string, fetch: Fetch) {
|
|
183
|
+
this.hostname = hostname;
|
|
184
|
+
this.fetch = fetch;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private url(name: string): string {
|
|
188
|
+
return this.hostname + this.path + name;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
lookupMarketplaceConfig = (
|
|
192
|
+
args: LookupMarketplaceConfigArgs,
|
|
193
|
+
headers?: object,
|
|
194
|
+
signal?: AbortSignal
|
|
195
|
+
): Promise<LookupMarketplaceConfigReturn> => {
|
|
196
|
+
return this.fetch(
|
|
197
|
+
this.url("LookupMarketplaceConfig"),
|
|
198
|
+
createHTTPRequest(args, headers, signal)
|
|
199
|
+
).then(
|
|
200
|
+
(res) => {
|
|
201
|
+
return buildResponse(res).then((_data) => {
|
|
202
|
+
return {
|
|
203
|
+
projectId: <number>_data.projectId,
|
|
204
|
+
settings: <MarketplaceSettings>_data.settings,
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
(error) => {
|
|
209
|
+
throw WebrpcRequestFailedError.new({
|
|
210
|
+
cause: `fetch(): ${error.message || ""}`,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// marketplace-api
|
|
2
|
+
// marketplace-api 27c5a642f4eb523c04af2f1a45e4a2ab1f370fcd
|
|
3
3
|
// --
|
|
4
4
|
// Code generated by webrpc-gen@v0.25.1 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
export const WebrpcHeader = "Webrpc"
|
|
9
9
|
|
|
10
|
-
export const WebrpcHeaderValue = "webrpc@v0.25.1;gen-typescript@v0.17.0;marketplace-api@v0.0.0-
|
|
10
|
+
export const WebrpcHeaderValue = "webrpc@v0.25.1;gen-typescript@v0.17.0;marketplace-api@v0.0.0-27c5a642f4eb523c04af2f1a45e4a2ab1f370fcd"
|
|
11
11
|
|
|
12
12
|
// WebRPC description and code-gen version
|
|
13
13
|
export const WebRPCVersion = "v1"
|
|
@@ -16,7 +16,7 @@ export const WebRPCVersion = "v1"
|
|
|
16
16
|
export const WebRPCSchemaVersion = ""
|
|
17
17
|
|
|
18
18
|
// Schema hash generated from your RIDL schema
|
|
19
|
-
export const WebRPCSchemaHash = "
|
|
19
|
+
export const WebRPCSchemaHash = "27c5a642f4eb523c04af2f1a45e4a2ab1f370fcd"
|
|
20
20
|
|
|
21
21
|
type WebrpcGenVersions = {
|
|
22
22
|
webrpcGenVersion: string;
|
|
@@ -126,7 +126,8 @@ export enum MarketplaceKind {
|
|
|
126
126
|
x2y2 = 'x2y2',
|
|
127
127
|
alienswap = 'alienswap',
|
|
128
128
|
payment_processor = 'payment_processor',
|
|
129
|
-
mintify = 'mintify'
|
|
129
|
+
mintify = 'mintify',
|
|
130
|
+
magic_eden = 'magic_eden'
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
export enum OrderbookKind {
|
|
@@ -2177,5 +2178,4 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
2177
2178
|
[9999]: NotImplementedError,
|
|
2178
2179
|
}
|
|
2179
2180
|
|
|
2180
|
-
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
2181
|
-
|
|
2181
|
+
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
@@ -10,7 +10,8 @@ const SERVICES = {
|
|
|
10
10
|
metadata: 'https://${prefix}metadata.sequence.app',
|
|
11
11
|
indexer: 'https://${prefix}${network}-indexer.sequence.app',
|
|
12
12
|
marketplaceApi: 'https://${prefix}marketplace-api.sequence.app/${network}',
|
|
13
|
-
|
|
13
|
+
builderRpcApi: 'https://${prefix}api.sequence.build',
|
|
14
|
+
//Used for fetching css and manifest
|
|
14
15
|
builderMarketplaceApi:
|
|
15
16
|
'https://${prefix}api.sequence.build/marketplace/${projectId}',
|
|
16
17
|
};
|
|
@@ -29,7 +30,6 @@ const getNetwork = (nameOrId: ChainNameOrId) => {
|
|
|
29
30
|
throw new MissingConfigError(`Network configuration for chain ${nameOrId}`);
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export const imageProxy = stringTemplate(SERVICES.imageProxy, {});
|
|
33
33
|
const metadataURL = (env: Env = 'production') => {
|
|
34
34
|
const prefix = getPrefix(env);
|
|
35
35
|
return stringTemplate(SERVICES.metadata, { prefix });
|
|
@@ -39,11 +39,18 @@ const indexerURL = (chain: ChainNameOrId, env: Env = 'production') => {
|
|
|
39
39
|
const network = getNetwork(chain).name;
|
|
40
40
|
return stringTemplate(SERVICES.indexer, { network: network, prefix });
|
|
41
41
|
};
|
|
42
|
+
|
|
42
43
|
const marketplaceApiURL = (chain: ChainNameOrId, env: Env = 'production') => {
|
|
43
44
|
const prefix = getPrefix(env);
|
|
44
45
|
const network = getNetwork(chain).name;
|
|
45
46
|
return stringTemplate(SERVICES.marketplaceApi, { network: network, prefix });
|
|
46
47
|
};
|
|
48
|
+
|
|
49
|
+
export const builderRpcApi = (env: Env = 'production') => {
|
|
50
|
+
const prefix = getPrefix(env);
|
|
51
|
+
return stringTemplate(SERVICES.builderRpcApi, { prefix });
|
|
52
|
+
};
|
|
53
|
+
|
|
47
54
|
export const builderMarketplaceApi = (
|
|
48
55
|
projectId: string,
|
|
49
56
|
env: Env = 'production',
|