@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,133 +0,0 @@
|
|
|
1
|
-
import { O as OrderbookKind } from './marketplace.gen-DQzWciwC.js';
|
|
2
|
-
|
|
3
|
-
interface LookupMarketplaceConfigArgs {
|
|
4
|
-
projectId?: number;
|
|
5
|
-
hostname?: string;
|
|
6
|
-
}
|
|
7
|
-
interface LookupMarketplaceConfigReturn {
|
|
8
|
-
settings: MarketplaceSettings;
|
|
9
|
-
}
|
|
10
|
-
interface MarketplaceSettings {
|
|
11
|
-
projectId: number;
|
|
12
|
-
publisherId: string;
|
|
13
|
-
title: string;
|
|
14
|
-
shortDescription: string;
|
|
15
|
-
socials: MarketplaceSocials;
|
|
16
|
-
faviconUrl: string;
|
|
17
|
-
landingBannerUrl: string;
|
|
18
|
-
collections: Array<MarketplaceCollection>;
|
|
19
|
-
walletOptions: MarketplaceWalletOptions;
|
|
20
|
-
landingPageLayout: string;
|
|
21
|
-
logoUrl: string;
|
|
22
|
-
bannerUrl: string;
|
|
23
|
-
fontUrl?: string;
|
|
24
|
-
ogImage?: string;
|
|
25
|
-
accessKey?: string;
|
|
26
|
-
}
|
|
27
|
-
interface MarketplaceSocials {
|
|
28
|
-
twitter: string;
|
|
29
|
-
discord: string;
|
|
30
|
-
website: string;
|
|
31
|
-
tiktok: string;
|
|
32
|
-
instagram: string;
|
|
33
|
-
youtube: string;
|
|
34
|
-
}
|
|
35
|
-
interface MarketplaceCollection {
|
|
36
|
-
marketplaceType: MarketplaceType;
|
|
37
|
-
chainId: number;
|
|
38
|
-
address: string;
|
|
39
|
-
exchanges: Array<string>;
|
|
40
|
-
bannerUrl: string;
|
|
41
|
-
feePercentage: number;
|
|
42
|
-
currencyOptions: Array<string>;
|
|
43
|
-
destinationMarketplace: OrderbookKind;
|
|
44
|
-
filterSettings?: CollectionFilterSettings;
|
|
45
|
-
isLAOSERC721?: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface CollectionFilterSettings {
|
|
48
|
-
filterOrder: Array<string>;
|
|
49
|
-
exclusions: Array<MetadataFilterRule>;
|
|
50
|
-
}
|
|
51
|
-
interface OpenIdProvider {
|
|
52
|
-
iss: string;
|
|
53
|
-
aud: Array<string>;
|
|
54
|
-
}
|
|
55
|
-
interface MetadataFilterRule {
|
|
56
|
-
key: string;
|
|
57
|
-
condition: FilterCondition;
|
|
58
|
-
value?: string;
|
|
59
|
-
}
|
|
60
|
-
interface MarketplaceWalletWaasSettings {
|
|
61
|
-
tenantKey: string;
|
|
62
|
-
emailEnabled: boolean;
|
|
63
|
-
providers: Array<OpenIdProvider>;
|
|
64
|
-
}
|
|
65
|
-
interface MarketplaceWalletOptions {
|
|
66
|
-
walletType: MarketplaceWallet;
|
|
67
|
-
oidcIssuers: {
|
|
68
|
-
[key: string]: string;
|
|
69
|
-
};
|
|
70
|
-
connectors: Array<string>;
|
|
71
|
-
includeEIP6963Wallets: boolean;
|
|
72
|
-
ecosystem?: EcosystemWalletSettings;
|
|
73
|
-
waas?: MarketplaceWalletWaasSettings;
|
|
74
|
-
}
|
|
75
|
-
interface EcosystemWalletSettings {
|
|
76
|
-
walletUrl: string;
|
|
77
|
-
walletAppName: string;
|
|
78
|
-
logoLightUrl?: string;
|
|
79
|
-
logoDarkUrl?: string;
|
|
80
|
-
}
|
|
81
|
-
declare enum MarketplaceWallet {
|
|
82
|
-
UNIVERSAL = "UNIVERSAL",
|
|
83
|
-
EMBEDDED = "EMBEDDED",
|
|
84
|
-
ECOSYSTEM = "ECOSYSTEM"
|
|
85
|
-
}
|
|
86
|
-
declare enum MarketplaceType {
|
|
87
|
-
AMM = "AMM",
|
|
88
|
-
P2P = "P2P",
|
|
89
|
-
SEQUENCE = "SEQUENCE",
|
|
90
|
-
ORDERBOOK = "ORDERBOOK"
|
|
91
|
-
}
|
|
92
|
-
declare enum FilterCondition {
|
|
93
|
-
ENTIRE_KEY = "ENTIRE_KEY",
|
|
94
|
-
SPECIFIC_VALUE = "SPECIFIC_VALUE"
|
|
95
|
-
}
|
|
96
|
-
type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
97
|
-
declare class WebrpcRequestFailedError extends Error {
|
|
98
|
-
name: string;
|
|
99
|
-
code: number;
|
|
100
|
-
message: string;
|
|
101
|
-
status: number;
|
|
102
|
-
cause?: string;
|
|
103
|
-
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string);
|
|
104
|
-
static new(payload: any): WebrpcRequestFailedError;
|
|
105
|
-
}
|
|
106
|
-
declare class API {
|
|
107
|
-
protected hostname: string;
|
|
108
|
-
protected fetch: Fetch;
|
|
109
|
-
protected path: string;
|
|
110
|
-
constructor(hostname: string, fetch: Fetch);
|
|
111
|
-
private url;
|
|
112
|
-
lookupMarketplaceConfig: (args: LookupMarketplaceConfigArgs, headers?: object, signal?: AbortSignal) => Promise<LookupMarketplaceConfigReturn>;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
type Env = 'development' | 'next' | 'production';
|
|
116
|
-
type SdkConfig = {
|
|
117
|
-
projectAccessKey: string;
|
|
118
|
-
projectId: string;
|
|
119
|
-
walletConnectProjectId?: string;
|
|
120
|
-
_internal?: {
|
|
121
|
-
prefetchedMarketplaceSettings?: MarketplaceSettings;
|
|
122
|
-
devAccessKey?: string;
|
|
123
|
-
nextAccessKey?: string;
|
|
124
|
-
builderEnv?: Env;
|
|
125
|
-
marketplaceEnv?: Env;
|
|
126
|
-
nodeGatewayEnv?: Env;
|
|
127
|
-
metadataEnv?: Env;
|
|
128
|
-
indexerEnv?: Env;
|
|
129
|
-
sequenceWalletEnv?: Env;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export { API as A, type CollectionFilterSettings as C, type Env as E, FilterCondition as F, type LookupMarketplaceConfigArgs as L, type MarketplaceSettings as M, type OpenIdProvider as O, type SdkConfig as S, WebrpcRequestFailedError as W, MarketplaceWallet as a, MarketplaceType as b, type LookupMarketplaceConfigReturn as c, type MarketplaceSocials as d, type MarketplaceCollection as e, type MetadataFilterRule as f, type MarketplaceWalletWaasSettings as g, type MarketplaceWalletOptions as h, type EcosystemWalletSettings as i, type Fetch as j };
|
package/dist/types-isjvwapz.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { C as ContractType, O as OrderbookKind, M as MarketplaceKind, a as CreateReq } from './marketplace.gen-DQzWciwC.js';
|
|
4
|
-
import { S as SdkConfig } from './sdk-config-txlivEKe.js';
|
|
5
|
-
import { M as MarketplaceConfig } from './marketplaceConfig-B4Fdsmxu.js';
|
|
6
|
-
|
|
7
|
-
declare const QueryArgSchema: z.ZodOptional<z.ZodObject<{
|
|
8
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
enabled?: boolean | undefined;
|
|
11
|
-
}, {
|
|
12
|
-
enabled?: boolean | undefined;
|
|
13
|
-
}>>;
|
|
14
|
-
type QueryArg = z.infer<typeof QueryArgSchema>;
|
|
15
|
-
declare const CollectableIdSchema: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
16
|
-
declare const AddressSchema: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
17
|
-
type CollectionType = ContractType.ERC1155 | ContractType.ERC721;
|
|
18
|
-
type TransactionStep = {
|
|
19
|
-
exist: boolean;
|
|
20
|
-
isExecuting: boolean;
|
|
21
|
-
execute: () => Promise<void>;
|
|
22
|
-
};
|
|
23
|
-
type TransactionSteps = {
|
|
24
|
-
approval: TransactionStep;
|
|
25
|
-
transaction: TransactionStep;
|
|
26
|
-
};
|
|
27
|
-
declare enum TransactionType {
|
|
28
|
-
BUY = "BUY",
|
|
29
|
-
SELL = "SELL",
|
|
30
|
-
LISTING = "LISTING",
|
|
31
|
-
OFFER = "OFFER",
|
|
32
|
-
TRANSFER = "TRANSFER",
|
|
33
|
-
CANCEL = "CANCEL"
|
|
34
|
-
}
|
|
35
|
-
interface TransactionConfig {
|
|
36
|
-
type: TransactionType;
|
|
37
|
-
chainId: number;
|
|
38
|
-
chains: readonly Chain[];
|
|
39
|
-
collectionAddress: string;
|
|
40
|
-
sdkConfig: SdkConfig;
|
|
41
|
-
marketplaceConfig: MarketplaceConfig;
|
|
42
|
-
orderbookKind?: OrderbookKind;
|
|
43
|
-
}
|
|
44
|
-
interface BuyInput {
|
|
45
|
-
orderId: string;
|
|
46
|
-
collectableDecimals: number;
|
|
47
|
-
marketplace: MarketplaceKind;
|
|
48
|
-
quantity: string;
|
|
49
|
-
}
|
|
50
|
-
interface SellInput {
|
|
51
|
-
orderId: string;
|
|
52
|
-
marketplace: MarketplaceKind;
|
|
53
|
-
quantity?: string;
|
|
54
|
-
}
|
|
55
|
-
interface ListingInput {
|
|
56
|
-
contractType: ContractType;
|
|
57
|
-
listing: CreateReq;
|
|
58
|
-
}
|
|
59
|
-
interface OfferInput {
|
|
60
|
-
contractType: ContractType;
|
|
61
|
-
offer: CreateReq;
|
|
62
|
-
}
|
|
63
|
-
interface CancelInput {
|
|
64
|
-
orderId: string;
|
|
65
|
-
marketplace: MarketplaceKind;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { AddressSchema as A, type BuyInput as B, CollectableIdSchema as C, type ListingInput as L, type OfferInput as O, QueryArgSchema as Q, type SellInput as S, type TransactionSteps as T, type QueryArg as a, type CollectionType as b, TransactionType as c, type TransactionConfig as d, type CancelInput as e };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { queryOptions, useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { zeroAddress } from 'viem';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import type { SdkConfig } from '../../types';
|
|
5
|
-
import {
|
|
6
|
-
AddressSchema,
|
|
7
|
-
QueryArgSchema,
|
|
8
|
-
currencyKeys,
|
|
9
|
-
getMarketplaceClient,
|
|
10
|
-
getQueryClient,
|
|
11
|
-
} from '../_internal';
|
|
12
|
-
import { useConfig } from './useConfig';
|
|
13
|
-
import { marketplaceConfigOptions } from './useMarketplaceConfig';
|
|
14
|
-
|
|
15
|
-
const UseCurrenciesArgsSchema = z.object({
|
|
16
|
-
chainId: z.number(),
|
|
17
|
-
includeNativeCurrency: z.boolean().optional().default(true),
|
|
18
|
-
collectionAddress: AddressSchema.optional(),
|
|
19
|
-
query: QueryArgSchema,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
type UseCurrenciesArgs = z.input<typeof UseCurrenciesArgsSchema>;
|
|
23
|
-
|
|
24
|
-
export type UseCurrenciesReturn = Awaited<ReturnType<typeof fetchCurrencies>>;
|
|
25
|
-
|
|
26
|
-
const fetchCurrencies = async (args: UseCurrenciesArgs, config: SdkConfig) => {
|
|
27
|
-
const parsedArgs = UseCurrenciesArgsSchema.parse(args);
|
|
28
|
-
const marketplaceClient = getMarketplaceClient(parsedArgs.chainId, config);
|
|
29
|
-
|
|
30
|
-
let currencies = await marketplaceClient.listCurrencies().then((resp) =>
|
|
31
|
-
resp.currencies.map((currency) => ({
|
|
32
|
-
...currency,
|
|
33
|
-
contractAddress: currency.contractAddress || zeroAddress,
|
|
34
|
-
})),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
if (parsedArgs.collectionAddress) {
|
|
38
|
-
const queryClient = getQueryClient();
|
|
39
|
-
const marketplaceConfig = await queryClient.fetchQuery(
|
|
40
|
-
marketplaceConfigOptions(config),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const currenciesOptions = marketplaceConfig.collections.find(
|
|
44
|
-
(collection) => collection.address === args.collectionAddress,
|
|
45
|
-
)?.currencyOptions;
|
|
46
|
-
|
|
47
|
-
// Filter currencies based on collection currency options
|
|
48
|
-
if (currenciesOptions) {
|
|
49
|
-
currencies = currencies.filter((currency) =>
|
|
50
|
-
currenciesOptions.includes(currency.contractAddress),
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!parsedArgs.includeNativeCurrency) {
|
|
56
|
-
currencies = currencies.filter((currency) => !currency.nativeCurrency);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return currencies;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const currenciesOptions = (
|
|
63
|
-
args: UseCurrenciesArgs,
|
|
64
|
-
config: SdkConfig,
|
|
65
|
-
) => {
|
|
66
|
-
return queryOptions({
|
|
67
|
-
...args.query,
|
|
68
|
-
queryKey: [...currencyKeys.lists, args],
|
|
69
|
-
queryFn: () => fetchCurrencies(args, config),
|
|
70
|
-
enabled: args.query?.enabled,
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const useCurrencies = (args: UseCurrenciesArgs) => {
|
|
75
|
-
const config = useConfig();
|
|
76
|
-
return useQuery(currenciesOptions(args, config));
|
|
77
|
-
};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { cn } from '../../../../../utils';
|
|
5
|
-
import { fetchContentType } from '../../../../../utils/fetchContentType';
|
|
6
|
-
import ChessTileImage from '../../../images/chess-tile.png';
|
|
7
|
-
import ModelViewer from '../../ModelViewer';
|
|
8
|
-
import CollectibleAssetSkeleton from './CollectibleAssetSkeleton';
|
|
9
|
-
import { getContentType } from './utils';
|
|
10
|
-
|
|
11
|
-
type CollectibleImageProps = {
|
|
12
|
-
name?: string;
|
|
13
|
-
assets?: (string | undefined)[];
|
|
14
|
-
assetSrcPrefixUrl?: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @description This component is used to display a collectible asset.
|
|
20
|
-
* It will display the first valid asset from the assets array.
|
|
21
|
-
* If no valid asset is found, it will display the placeholder image.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* <CollectibleAsset
|
|
25
|
-
* name="Collectible"
|
|
26
|
-
* assets={[undefined, "some-image-url", undefined]} // undefined assets will be ignored, "some-image-url" will be rendered
|
|
27
|
-
* assetSrcPrefixUrl="https://example.com/"
|
|
28
|
-
* className="w-full h-full"
|
|
29
|
-
* />
|
|
30
|
-
*/
|
|
31
|
-
export function CollectibleAsset({
|
|
32
|
-
name,
|
|
33
|
-
assets,
|
|
34
|
-
assetSrcPrefixUrl,
|
|
35
|
-
className,
|
|
36
|
-
}: CollectibleImageProps) {
|
|
37
|
-
const [assetLoadFailed, setAssetLoadFailed] = useState(false);
|
|
38
|
-
const [assetLoading, setAssetLoading] = useState(true);
|
|
39
|
-
const [contentType, setContentType] = useState<{
|
|
40
|
-
type: 'image' | 'video' | 'html' | '3d-model' | null;
|
|
41
|
-
loading: boolean;
|
|
42
|
-
failed: boolean;
|
|
43
|
-
}>({ type: null, loading: true, failed: false });
|
|
44
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
45
|
-
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
46
|
-
|
|
47
|
-
const placeholderImage = ChessTileImage;
|
|
48
|
-
const assetUrl = assets?.find((asset) => asset) || placeholderImage;
|
|
49
|
-
const proxiedAssetUrl = assetSrcPrefixUrl
|
|
50
|
-
? `${assetSrcPrefixUrl}${assetUrl}` // assetSrcPrefixUrl must have a trailing slash at the end
|
|
51
|
-
: assetUrl;
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
getContentType(proxiedAssetUrl)
|
|
55
|
-
.then((contentType) => {
|
|
56
|
-
setContentType({ type: contentType, loading: false, failed: false });
|
|
57
|
-
})
|
|
58
|
-
.catch(() => {
|
|
59
|
-
fetchContentType(proxiedAssetUrl)
|
|
60
|
-
.then((contentType) => {
|
|
61
|
-
setContentType({
|
|
62
|
-
type: contentType,
|
|
63
|
-
loading: false,
|
|
64
|
-
failed: false,
|
|
65
|
-
});
|
|
66
|
-
})
|
|
67
|
-
.catch(() => {
|
|
68
|
-
setContentType({ type: null, loading: false, failed: true });
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}, [proxiedAssetUrl]);
|
|
72
|
-
|
|
73
|
-
if (contentType.type === 'html' && !assetLoadFailed) {
|
|
74
|
-
return (
|
|
75
|
-
<div
|
|
76
|
-
className={cn(
|
|
77
|
-
'flex aspect-square w-full items-center justify-center overflow-hidden rounded-lg bg-background-secondary',
|
|
78
|
-
className,
|
|
79
|
-
)}
|
|
80
|
-
>
|
|
81
|
-
{(assetLoading || contentType.loading) && <CollectibleAssetSkeleton />}
|
|
82
|
-
|
|
83
|
-
<iframe
|
|
84
|
-
title={name || 'Collectible'}
|
|
85
|
-
className="aspect-square w-full"
|
|
86
|
-
src={proxiedAssetUrl}
|
|
87
|
-
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
|
88
|
-
sandbox="allow-scripts"
|
|
89
|
-
style={{
|
|
90
|
-
border: '0px',
|
|
91
|
-
}}
|
|
92
|
-
onError={() => setAssetLoadFailed(true)}
|
|
93
|
-
onLoad={() => setAssetLoading(false)}
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (contentType.type === '3d-model' && !assetLoadFailed) {
|
|
100
|
-
return (
|
|
101
|
-
<div className="h-full w-full">
|
|
102
|
-
<ModelViewer
|
|
103
|
-
src={proxiedAssetUrl}
|
|
104
|
-
posterSrc={placeholderImage}
|
|
105
|
-
onLoad={() => setAssetLoading(false)}
|
|
106
|
-
onError={() => setAssetLoadFailed(true)}
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
if (contentType.type === 'video' && !assetLoadFailed) {
|
|
112
|
-
return (
|
|
113
|
-
<div
|
|
114
|
-
className={cn(
|
|
115
|
-
'relative flex aspect-square w-full items-center justify-center overflow-hidden rounded-lg bg-background-secondary',
|
|
116
|
-
className,
|
|
117
|
-
)}
|
|
118
|
-
>
|
|
119
|
-
{(assetLoading || contentType.loading) && <CollectibleAssetSkeleton />}
|
|
120
|
-
|
|
121
|
-
<video
|
|
122
|
-
ref={videoRef}
|
|
123
|
-
className={cn(
|
|
124
|
-
`absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover ${
|
|
125
|
-
assetLoading ? 'invisible' : 'visible'
|
|
126
|
-
}`,
|
|
127
|
-
// we can't hide the video controls in safari, when user hovers over the video they show up. `pointer-events-none` is the only way to hide them on hover
|
|
128
|
-
isSafari && 'pointer-events-none',
|
|
129
|
-
)}
|
|
130
|
-
autoPlay
|
|
131
|
-
loop
|
|
132
|
-
controls
|
|
133
|
-
playsInline
|
|
134
|
-
muted
|
|
135
|
-
controlsList="nodownload noremoteplayback nofullscreen "
|
|
136
|
-
onError={() => {
|
|
137
|
-
setAssetLoadFailed(true);
|
|
138
|
-
}}
|
|
139
|
-
onLoadedMetadata={() => {
|
|
140
|
-
setAssetLoading(false);
|
|
141
|
-
}}
|
|
142
|
-
data-testid="collectible-asset-video"
|
|
143
|
-
>
|
|
144
|
-
<source src={proxiedAssetUrl} />
|
|
145
|
-
</video>
|
|
146
|
-
</div>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<div
|
|
152
|
-
className={cn(
|
|
153
|
-
'relative aspect-square overflow-hidden bg-background-secondary',
|
|
154
|
-
className,
|
|
155
|
-
)}
|
|
156
|
-
>
|
|
157
|
-
{(assetLoading || contentType.loading) && <CollectibleAssetSkeleton />}
|
|
158
|
-
|
|
159
|
-
<img
|
|
160
|
-
src={
|
|
161
|
-
assetLoadFailed || contentType.failed
|
|
162
|
-
? placeholderImage
|
|
163
|
-
: proxiedAssetUrl
|
|
164
|
-
}
|
|
165
|
-
alt={name || 'Collectible'}
|
|
166
|
-
className={`absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover ${
|
|
167
|
-
assetLoading || contentType.loading ? 'invisible' : 'visible'
|
|
168
|
-
}`}
|
|
169
|
-
onError={() => setAssetLoadFailed(true)}
|
|
170
|
-
onLoad={() => setAssetLoading(false)}
|
|
171
|
-
/>
|
|
172
|
-
</div>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|