@0xsequence/marketplace-sdk 0.4.6 → 0.4.7
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/dist/alien_swap-4GAIV7PA.png +0 -0
- package/dist/alien_swap-IZONL4XB.js +8 -0
- package/dist/alien_swap-PMYKGY6A.js +8 -0
- package/dist/aqua-xyz-HLNZIFE2.js +8 -0
- package/dist/aqua-xyz-HLNZIFE2.js.map +1 -0
- package/dist/aqua-xyz-JY5QCI5L.js +8 -0
- package/dist/aqua-xyz-JY5QCI5L.js.map +1 -0
- package/dist/aqua-xyz-WU4JVU2K.png +0 -0
- package/dist/aura-CYKEACX2.js +8 -0
- package/dist/aura-CYKEACX2.js.map +1 -0
- package/dist/aura-HLMWKNSP.js +8 -0
- package/dist/aura-HLMWKNSP.js.map +1 -0
- package/dist/aura-RITZV42R.png +0 -0
- package/dist/blur-2ABQMPTL.png +0 -0
- package/dist/blur-MIPRQYJL.js +8 -0
- package/dist/blur-MIPRQYJL.js.map +1 -0
- package/dist/blur-XDIGHYB7.js +8 -0
- package/dist/blur-XDIGHYB7.js.map +1 -0
- package/dist/{chunk-2FOUCP2R.js → chunk-5UCKYAMR.js} +724 -737
- package/dist/chunk-5UCKYAMR.js.map +1 -0
- package/dist/{chunk-QVOUL555.js → chunk-6R4G7J6Q.js} +86 -26
- package/dist/chunk-6R4G7J6Q.js.map +1 -0
- package/dist/{chunk-RD7HPANB.js → chunk-AQT3BQ67.js} +9 -9
- package/dist/chunk-AQT3BQ67.js.map +1 -0
- package/dist/{chunk-3C2MT5TM.js → chunk-FWN2MCLI.js} +12 -6
- package/dist/chunk-FWN2MCLI.js.map +1 -0
- package/dist/{chunk-5D3ARFFZ.js → chunk-JEOUQFT3.js} +17 -129
- package/dist/chunk-JEOUQFT3.js.map +1 -0
- package/dist/chunk-MWDG7UTB.js +132 -0
- package/dist/chunk-MWDG7UTB.js.map +1 -0
- package/dist/{chunk-36NGHJH5.js → chunk-R7GVMKMM.js} +124 -37
- package/dist/chunk-R7GVMKMM.js.map +1 -0
- package/dist/chunk-RK6KYMZM.js +18 -0
- package/dist/chunk-RK6KYMZM.js.map +1 -0
- package/dist/{chunk-LTHX6RXH.js → chunk-XP3WY5AX.js} +90 -2
- package/dist/chunk-XP3WY5AX.js.map +1 -0
- package/dist/{chunk-DNVERQ5J.js → chunk-YOKGP2EQ.js} +1 -1
- package/dist/chunk-YOKGP2EQ.js.map +1 -0
- package/dist/chunk-ZUEQGPLO.js +302 -0
- package/dist/chunk-ZUEQGPLO.js.map +1 -0
- package/dist/coinbase-MIJPE653.js +8 -0
- package/dist/coinbase-MIJPE653.js.map +1 -0
- package/dist/coinbase-MZUBBEC4.png +0 -0
- package/dist/coinbase-T24XHLQL.js +8 -0
- package/dist/coinbase-T24XHLQL.js.map +1 -0
- package/dist/{create-config-BBTTSJyp.d.ts → create-config-D5WqfUft.d.ts} +2 -2
- package/dist/element-GHIPFSB6.png +0 -0
- package/dist/element-MWATR3ON.js +8 -0
- package/dist/element-MWATR3ON.js.map +1 -0
- package/dist/element-X45NH4D7.js +8 -0
- package/dist/element-X45NH4D7.js.map +1 -0
- package/dist/foundation-BDJUT6CK.js +8 -0
- package/dist/foundation-BDJUT6CK.js.map +1 -0
- package/dist/foundation-FJKIXLS5.png +0 -0
- package/dist/foundation-Z6D6U74V.js +8 -0
- package/dist/foundation-Z6D6U74V.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +10 -4
- package/dist/looks-rare-B6G3OQAP.png +0 -0
- package/dist/looks-rare-LBHT6EXZ.js +8 -0
- package/dist/looks-rare-LBHT6EXZ.js.map +1 -0
- package/dist/looks-rare-STS6IKI4.js +8 -0
- package/dist/looks-rare-STS6IKI4.js.map +1 -0
- package/dist/magic-eden-HA3X3P2O.png +0 -0
- package/dist/magic-eden-RMZ24554.js +8 -0
- package/dist/magic-eden-RMZ24554.js.map +1 -0
- package/dist/magic-eden-YMTLPKLE.js +8 -0
- package/dist/magic-eden-YMTLPKLE.js.map +1 -0
- package/dist/manifold-I4NT4V5L.png +0 -0
- package/dist/manifold-L7FLFDRO.js +8 -0
- package/dist/manifold-L7FLFDRO.js.map +1 -0
- package/dist/manifold-YIUSABCZ.js +8 -0
- package/dist/manifold-YIUSABCZ.js.map +1 -0
- package/dist/{marketplace-config-vioKvBQe.d.ts → marketplace-config-C_fDWzz0.d.ts} +2 -2
- package/dist/marketplace.gen-B8S8fflj.d.ts +390 -0
- package/dist/mintify-ARDASD5Z.js +8 -0
- package/dist/mintify-ARDASD5Z.js.map +1 -0
- package/dist/mintify-OLOGFTWQ.png +0 -0
- package/dist/mintify-TSZA3SQT.js +8 -0
- package/dist/mintify-TSZA3SQT.js.map +1 -0
- package/dist/nftx-67RX7ZV6.js +8 -0
- package/dist/nftx-67RX7ZV6.js.map +1 -0
- package/dist/nftx-DJIV3PYG.png +0 -0
- package/dist/nftx-KVJ3T3G2.js +8 -0
- package/dist/nftx-KVJ3T3G2.js.map +1 -0
- package/dist/okx-MOA2EFVR.js +8 -0
- package/dist/okx-MOA2EFVR.js.map +1 -0
- package/dist/okx-WNQRV3WE.png +0 -0
- package/dist/okx-WQA7H7EM.js +8 -0
- package/dist/okx-WQA7H7EM.js.map +1 -0
- package/dist/open-sea-2HWFM4P6.js +8 -0
- package/dist/open-sea-2HWFM4P6.js.map +1 -0
- package/dist/open-sea-C57XWTAR.png +0 -0
- package/dist/open-sea-GESD6S2M.js +8 -0
- package/dist/open-sea-GESD6S2M.js.map +1 -0
- package/dist/rarible-GHMFCPBT.js +8 -0
- package/dist/rarible-GHMFCPBT.js.map +1 -0
- package/dist/rarible-QNNAZZQC.js +8 -0
- package/dist/rarible-QNNAZZQC.js.map +1 -0
- package/dist/rarible-ZCE7U3I5.png +0 -0
- package/dist/react/_internal/api/index.d.ts +4 -2
- package/dist/react/_internal/api/index.js +5 -1
- package/dist/react/_internal/index.d.ts +5 -5
- package/dist/react/_internal/index.js +6 -2
- package/dist/react/_internal/wagmi/index.d.ts +3 -3
- package/dist/react/hooks/index.d.ts +668 -5
- package/dist/react/hooks/index.js +15 -5
- package/dist/react/index.d.ts +7 -7
- package/dist/react/index.js +17 -8
- package/dist/react/ssr/index.js +8 -30
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css.map +1 -0
- package/dist/react/ui/components/{index.d.ts → collectible-card/index.d.ts} +3 -3
- package/dist/react/ui/components/collectible-card/index.js +29 -0
- package/dist/react/ui/components/collectible-card/index.js.map +1 -0
- package/dist/react/ui/components/marketplace-logos/index.d.ts +26 -0
- package/dist/react/ui/components/marketplace-logos/index.js +46 -0
- package/dist/react/ui/components/marketplace-logos/index.js.map +1 -0
- package/dist/react/ui/icons/index.js +0 -8
- package/dist/react/ui/icons/index.js.map +1 -1
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +9 -8
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +4 -3
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +7 -5
- package/dist/{sdk-config-CasNGLz4.d.ts → sdk-config-BXVH8PS2.d.ts} +68 -16
- package/dist/sequence-JAFBEQNI.png +0 -0
- package/dist/sequence-OIPVNE5P.js +8 -0
- package/dist/sequence-OIPVNE5P.js.map +1 -0
- package/dist/sequence-QNNBU34G.js +8 -0
- package/dist/sequence-QNNBU34G.js.map +1 -0
- package/dist/{services-CbsurKYr.d.ts → services-CdXAIjt1.d.ts} +1 -1
- package/dist/sudo-swap-D3FAP7W4.js +8 -0
- package/dist/sudo-swap-D3FAP7W4.js.map +1 -0
- package/dist/sudo-swap-XNJ3BIUD.js +8 -0
- package/dist/sudo-swap-XNJ3BIUD.js.map +1 -0
- package/dist/sudo-swap-Y6GICQTL.png +0 -0
- package/dist/super-rare-VIUS3P6B.js +8 -0
- package/dist/super-rare-VIUS3P6B.js.map +1 -0
- package/dist/super-rare-WWXZ3MQL.png +0 -0
- package/dist/super-rare-YPU3Y7EF.js +8 -0
- package/dist/super-rare-YPU3Y7EF.js.map +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +7 -4
- package/dist/{types-rupsBCjv.d.ts → types-eX4P9xju.d.ts} +2 -2
- package/dist/utils/index.d.ts +16 -4
- package/dist/utils/index.js +8 -1
- package/dist/x2y2-CXOXXZKS.png +0 -0
- package/dist/x2y2-G2SXS5VR.js +8 -0
- package/dist/x2y2-G2SXS5VR.js.map +1 -0
- package/dist/x2y2-GKWTQTPB.js +8 -0
- package/dist/x2y2-GKWTQTPB.js.map +1 -0
- package/dist/zora-3DPG4KAY.png +0 -0
- package/dist/zora-JUDT67NX.js +8 -0
- package/dist/zora-JUDT67NX.js.map +1 -0
- package/dist/zora-Z5VR477F.js +8 -0
- package/dist/zora-Z5VR477F.js.map +1 -0
- package/package.json +33 -19
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +218 -0
- package/src/react/_internal/api/marketplace.gen.ts +125 -42
- package/src/react/_internal/api/query-keys.ts +8 -0
- package/src/react/_internal/api/zod-schema.ts +33 -0
- package/src/react/_internal/test-utils.tsx +68 -0
- package/src/react/_internal/types.ts +3 -3
- package/src/react/hooks/index.ts +2 -0
- package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +77 -0
- package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +144 -0
- package/src/react/hooks/useCancelOrder.tsx +1 -1
- package/src/react/hooks/useCancelTransactionSteps.tsx +6 -6
- package/src/react/hooks/useCurrencies.tsx +2 -5
- package/src/react/hooks/useCurrency.tsx +10 -1
- package/src/react/hooks/useCurrencyBalance.tsx +38 -36
- package/src/react/hooks/useGetReceiptFromHash.tsx +1 -1
- package/src/react/hooks/useListCollectibleActivities.tsx +57 -0
- package/src/react/hooks/useListCollectionActivities.tsx +57 -0
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +89 -0
- package/src/react/ui/components/collectible-card/index.ts +1 -0
- package/src/react/ui/components/marketplace-logos/index.ts +23 -0
- package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +111 -0
- package/src/react/ui/images/marketplaces/alien_swap.png +0 -0
- package/src/react/ui/images/marketplaces/aqua-xyz.png +0 -0
- package/src/react/ui/images/marketplaces/aura.png +0 -0
- package/src/react/ui/images/marketplaces/blur.png +0 -0
- package/src/react/ui/images/marketplaces/coinbase.png +0 -0
- package/src/react/ui/images/marketplaces/element.png +0 -0
- package/src/react/ui/images/marketplaces/foundation.png +0 -0
- package/src/react/ui/images/marketplaces/looks-rare.png +0 -0
- package/src/react/ui/images/marketplaces/magic-eden.png +0 -0
- package/src/react/ui/images/marketplaces/manifold.png +0 -0
- package/src/react/ui/images/marketplaces/mintify.png +0 -0
- package/src/react/ui/images/marketplaces/nftx.png +0 -0
- package/src/react/ui/images/marketplaces/okx.png +0 -0
- package/src/react/ui/images/marketplaces/open-sea.png +0 -0
- package/src/react/ui/images/marketplaces/rarible.png +0 -0
- package/src/react/ui/images/marketplaces/sequence.png +0 -0
- package/src/react/ui/images/marketplaces/sudo-swap.png +0 -0
- package/src/react/ui/images/marketplaces/super-rare.png +0 -0
- package/src/react/ui/images/marketplaces/x2y2.png +0 -0
- package/src/react/ui/images/marketplaces/zora.png +0 -0
- package/src/react/ui/modals/BuyModal/Modal.tsx +3 -1
- package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +1 -0
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +2 -1
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +208 -0
- package/src/react/ui/modals/CreateListingModal/store.ts +26 -16
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +2 -2
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +199 -0
- package/src/react/ui/modals/MakeOfferModal/store.ts +27 -16
- package/src/react/ui/modals/SellModal/Modal.tsx +1 -0
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +192 -0
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +3 -3
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +3 -3
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +8 -8
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +2 -0
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +7 -1
- package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +7 -1
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +159 -0
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +4 -5
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +124 -0
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +48 -45
- package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +221 -0
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +24 -5
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +2 -2
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +16 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +147 -0
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +218 -0
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +27 -10
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +1 -1
- package/src/react/ui/modals/modal-provider.tsx +0 -2
- package/src/types/marketplace-config.ts +1 -1
- package/src/utils/__tests__/address.test.ts +65 -0
- package/src/utils/__tests__/date.test.ts +31 -0
- package/src/utils/__tests__/get-public-rpc-client.test.ts +109 -0
- package/src/utils/__tests__/getMarketplaceDetails.test.ts +134 -0
- package/src/utils/__tests__/price.test.ts +42 -0
- package/src/utils/get-public-rpc-client.ts +6 -0
- package/src/utils/getMarketplaceDetails.ts +110 -0
- package/src/utils/index.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.js +10 -0
- package/dist/chunk-2FOUCP2R.js.map +0 -1
- package/dist/chunk-36NGHJH5.js.map +0 -1
- package/dist/chunk-3C2MT5TM.js.map +0 -1
- package/dist/chunk-5D3ARFFZ.js.map +0 -1
- package/dist/chunk-6WB4GCCJ.js +0 -38
- package/dist/chunk-6WB4GCCJ.js.map +0 -1
- package/dist/chunk-CP2IVRMX.js +0 -85
- package/dist/chunk-CP2IVRMX.js.map +0 -1
- package/dist/chunk-DNVERQ5J.js.map +0 -1
- package/dist/chunk-LTHX6RXH.js.map +0 -1
- package/dist/chunk-MJ4YU7RW.js +0 -2
- package/dist/chunk-QVOUL555.js.map +0 -1
- package/dist/chunk-RD7HPANB.js.map +0 -1
- package/dist/react/ui/components/index.css.map +0 -1
- package/dist/react/ui/components/index.js +0 -28
- package/src/react/ui/components/index.ts +0 -1
- package/src/react/ui/modals/Account/index.tsx +0 -29
- package/src/react/ui/modals/_internal/components/priceInput/hooks/useBalanceCheck.ts +0 -67
- package/src/react/ui/modals/_internal/components/priceInput/hooks/usePriceInput.ts +0 -54
- /package/dist/{chunk-MJ4YU7RW.js.map → alien_swap-IZONL4XB.js.map} +0 -0
- /package/dist/{react/ui/components/index.js.map → alien_swap-PMYKGY6A.js.map} +0 -0
- /package/dist/react/ui/components/{index.css → collectible-card/index.css} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// marketplace-api
|
|
2
|
+
// marketplace-api fde5cccee73a952c6b2c70e0fb424d7d3eb23f1c
|
|
3
3
|
// --
|
|
4
|
-
// Code generated by webrpc-gen@v0.22.
|
|
4
|
+
// Code generated by webrpc-gen@v0.22.1 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
6
|
// webrpc-gen -schema=marketplace.ridl -target=typescript -client -out=./clients/marketplace.gen.ts
|
|
7
7
|
|
|
8
8
|
export const WebrpcHeader = "Webrpc"
|
|
9
9
|
|
|
10
|
-
export const WebrpcHeaderValue = "webrpc@v0.22.
|
|
10
|
+
export const WebrpcHeaderValue = "webrpc@v0.22.1;gen-typescript@v0.16.2;marketplace-api@v0.0.0-fde5cccee73a952c6b2c70e0fb424d7d3eb23f1c"
|
|
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 = "fde5cccee73a952c6b2c70e0fb424d7d3eb23f1c"
|
|
20
20
|
|
|
21
21
|
type WebrpcGenVersions = {
|
|
22
22
|
webrpcGenVersion: string;
|
|
@@ -126,7 +126,9 @@ export enum MarketplaceKind {
|
|
|
126
126
|
x2y2 = 'x2y2',
|
|
127
127
|
alienswap = 'alienswap',
|
|
128
128
|
payment_processor = 'payment_processor',
|
|
129
|
-
mintify = 'mintify'
|
|
129
|
+
mintify = 'mintify',
|
|
130
|
+
element_erc721 = 'element_erc721',
|
|
131
|
+
element_erc1155 = 'element_erc1155'
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
export enum OrderbookKind {
|
|
@@ -159,7 +161,8 @@ export enum OrderStatus {
|
|
|
159
161
|
inactive = 'inactive',
|
|
160
162
|
expired = 'expired',
|
|
161
163
|
cancelled = 'cancelled',
|
|
162
|
-
filled = 'filled'
|
|
164
|
+
filled = 'filled',
|
|
165
|
+
decimals_missing = 'decimals_missing'
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
export enum ContractType {
|
|
@@ -169,6 +172,12 @@ export enum ContractType {
|
|
|
169
172
|
ERC1155 = 'ERC1155'
|
|
170
173
|
}
|
|
171
174
|
|
|
175
|
+
export enum CollectionPriority {
|
|
176
|
+
low = 'low',
|
|
177
|
+
normal = 'normal',
|
|
178
|
+
high = 'high'
|
|
179
|
+
}
|
|
180
|
+
|
|
172
181
|
export enum CollectionStatus {
|
|
173
182
|
unknown = 'unknown',
|
|
174
183
|
created = 'created',
|
|
@@ -239,6 +248,17 @@ export enum ExecuteType {
|
|
|
239
248
|
order = 'order'
|
|
240
249
|
}
|
|
241
250
|
|
|
251
|
+
export enum ActivityAction {
|
|
252
|
+
unknown = 'unknown',
|
|
253
|
+
listing = 'listing',
|
|
254
|
+
offer = 'offer',
|
|
255
|
+
mint = 'mint',
|
|
256
|
+
sale = 'sale',
|
|
257
|
+
listingCancel = 'listingCancel',
|
|
258
|
+
offerCancel = 'offerCancel',
|
|
259
|
+
transfer = 'transfer'
|
|
260
|
+
}
|
|
261
|
+
|
|
242
262
|
export interface Page {
|
|
243
263
|
page: number
|
|
244
264
|
pageSize: number
|
|
@@ -328,23 +348,12 @@ export interface OrderFilter {
|
|
|
328
348
|
currencies?: Array<string>
|
|
329
349
|
}
|
|
330
350
|
|
|
331
|
-
export interface Activity {
|
|
332
|
-
type: string
|
|
333
|
-
fromAddress: string
|
|
334
|
-
toAddress: string
|
|
335
|
-
txHash: string
|
|
336
|
-
timestamp: number
|
|
337
|
-
tokenId: string
|
|
338
|
-
tokenImage: string
|
|
339
|
-
tokenName: string
|
|
340
|
-
currency?: Currency
|
|
341
|
-
}
|
|
342
|
-
|
|
343
351
|
export interface Collection {
|
|
344
352
|
status: CollectionStatus
|
|
345
353
|
chainId: number
|
|
346
354
|
contractAddress: string
|
|
347
355
|
contractType: ContractType
|
|
356
|
+
priority: CollectionPriority
|
|
348
357
|
tokenQuantityDecimals: number
|
|
349
358
|
config: CollectionConfig
|
|
350
359
|
createdAt: string
|
|
@@ -355,6 +364,8 @@ export interface Collection {
|
|
|
355
364
|
export interface CollectionConfig {
|
|
356
365
|
lastSynced: {[key: string]: CollectionLastSynced}
|
|
357
366
|
collectiblesSynced: string
|
|
367
|
+
activitiesSynced: string
|
|
368
|
+
activitiesSyncedContinuity: string
|
|
358
369
|
}
|
|
359
370
|
|
|
360
371
|
export interface CollectionLastSynced {
|
|
@@ -377,6 +388,7 @@ export interface Collectible {
|
|
|
377
388
|
contractAddress: string
|
|
378
389
|
status: CollectibleStatus
|
|
379
390
|
tokenId: string
|
|
391
|
+
decimals: number
|
|
380
392
|
createdAt: string
|
|
381
393
|
updatedAt: string
|
|
382
394
|
deletedAt?: string
|
|
@@ -469,6 +481,27 @@ export interface CheckoutOptions {
|
|
|
469
481
|
onRamp: Array<TransactionOnRampProvider>
|
|
470
482
|
}
|
|
471
483
|
|
|
484
|
+
export interface Activity {
|
|
485
|
+
chainId: number
|
|
486
|
+
contractAddress: string
|
|
487
|
+
tokenId: string
|
|
488
|
+
action: ActivityAction
|
|
489
|
+
txHash: string
|
|
490
|
+
from: string
|
|
491
|
+
to?: string
|
|
492
|
+
quantity: string
|
|
493
|
+
quantityDecimals: number
|
|
494
|
+
priceAmount?: string
|
|
495
|
+
priceAmountFormatted?: string
|
|
496
|
+
priceCurrencyAddress?: string
|
|
497
|
+
priceDecimals?: number
|
|
498
|
+
activityCreatedAt: string
|
|
499
|
+
uniqueHash: string
|
|
500
|
+
createdAt: string
|
|
501
|
+
updatedAt: string
|
|
502
|
+
deletedAt?: string
|
|
503
|
+
}
|
|
504
|
+
|
|
472
505
|
export interface Admin {
|
|
473
506
|
createCollection(args: CreateCollectionArgs, headers?: object, signal?: AbortSignal): Promise<CreateCollectionReturn>
|
|
474
507
|
getCollection(args: GetCollectionArgs, headers?: object, signal?: AbortSignal): Promise<GetCollectionReturn>
|
|
@@ -586,6 +619,8 @@ export interface Marketplace {
|
|
|
586
619
|
getCountOfAllCollectibles(args: GetCountOfAllCollectiblesArgs, headers?: object, signal?: AbortSignal): Promise<GetCountOfAllCollectiblesReturn>
|
|
587
620
|
getCountOfFilteredCollectibles(args: GetCountOfFilteredCollectiblesArgs, headers?: object, signal?: AbortSignal): Promise<GetCountOfFilteredCollectiblesReturn>
|
|
588
621
|
getFloorOrder(args: GetFloorOrderArgs, headers?: object, signal?: AbortSignal): Promise<GetFloorOrderReturn>
|
|
622
|
+
listCollectionActivities(args: ListCollectionActivitiesArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectionActivitiesReturn>
|
|
623
|
+
listCollectibleActivities(args: ListCollectibleActivitiesArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectibleActivitiesReturn>
|
|
589
624
|
listCollectiblesWithLowestListing(args: ListCollectiblesWithLowestListingArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectiblesWithLowestListingReturn>
|
|
590
625
|
listCollectiblesWithHighestOffer(args: ListCollectiblesWithHighestOfferArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectiblesWithHighestOfferReturn>
|
|
591
626
|
syncOrder(args: SyncOrderArgs, headers?: object, signal?: AbortSignal): Promise<SyncOrderReturn>
|
|
@@ -845,6 +880,25 @@ export interface GetFloorOrderArgs {
|
|
|
845
880
|
export interface GetFloorOrderReturn {
|
|
846
881
|
collectible: CollectibleOrder
|
|
847
882
|
}
|
|
883
|
+
export interface ListCollectionActivitiesArgs {
|
|
884
|
+
contractAddress: string
|
|
885
|
+
page?: Page
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
export interface ListCollectionActivitiesReturn {
|
|
889
|
+
activities: Array<Activity>
|
|
890
|
+
page?: Page
|
|
891
|
+
}
|
|
892
|
+
export interface ListCollectibleActivitiesArgs {
|
|
893
|
+
contractAddress: string
|
|
894
|
+
tokenId: string
|
|
895
|
+
page?: Page
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export interface ListCollectibleActivitiesReturn {
|
|
899
|
+
activities: Array<Activity>
|
|
900
|
+
page?: Page
|
|
901
|
+
}
|
|
848
902
|
export interface ListCollectiblesWithLowestListingArgs {
|
|
849
903
|
contractAddress: string
|
|
850
904
|
filter?: CollectiblesFilter
|
|
@@ -1452,6 +1506,36 @@ export class Marketplace implements Marketplace {
|
|
|
1452
1506
|
})
|
|
1453
1507
|
}
|
|
1454
1508
|
|
|
1509
|
+
listCollectionActivities = (args: ListCollectionActivitiesArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectionActivitiesReturn> => {
|
|
1510
|
+
return this.fetch(
|
|
1511
|
+
this.url('ListCollectionActivities'),
|
|
1512
|
+
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1513
|
+
return buildResponse(res).then(_data => {
|
|
1514
|
+
return {
|
|
1515
|
+
activities: <Array<Activity>>(_data.activities),
|
|
1516
|
+
page: <Page>(_data.page),
|
|
1517
|
+
}
|
|
1518
|
+
})
|
|
1519
|
+
}, (error) => {
|
|
1520
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1521
|
+
})
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
listCollectibleActivities = (args: ListCollectibleActivitiesArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectibleActivitiesReturn> => {
|
|
1525
|
+
return this.fetch(
|
|
1526
|
+
this.url('ListCollectibleActivities'),
|
|
1527
|
+
createHTTPRequest(args, headers, signal)).then((res) => {
|
|
1528
|
+
return buildResponse(res).then(_data => {
|
|
1529
|
+
return {
|
|
1530
|
+
activities: <Array<Activity>>(_data.activities),
|
|
1531
|
+
page: <Page>(_data.page),
|
|
1532
|
+
}
|
|
1533
|
+
})
|
|
1534
|
+
}, (error) => {
|
|
1535
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
1536
|
+
})
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1455
1539
|
listCollectiblesWithLowestListing = (args: ListCollectiblesWithLowestListingArgs, headers?: object, signal?: AbortSignal): Promise<ListCollectiblesWithLowestListingReturn> => {
|
|
1456
1540
|
return this.fetch(
|
|
1457
1541
|
this.url('ListCollectiblesWithLowestListing'),
|
|
@@ -1622,7 +1706,7 @@ export class WebrpcEndpointError extends WebrpcError {
|
|
|
1622
1706
|
constructor(
|
|
1623
1707
|
name: string = 'WebrpcEndpoint',
|
|
1624
1708
|
code: number = 0,
|
|
1625
|
-
message: string =
|
|
1709
|
+
message: string = `endpoint error`,
|
|
1626
1710
|
status: number = 0,
|
|
1627
1711
|
cause?: string
|
|
1628
1712
|
) {
|
|
@@ -1635,7 +1719,7 @@ export class WebrpcRequestFailedError extends WebrpcError {
|
|
|
1635
1719
|
constructor(
|
|
1636
1720
|
name: string = 'WebrpcRequestFailed',
|
|
1637
1721
|
code: number = -1,
|
|
1638
|
-
message: string =
|
|
1722
|
+
message: string = `request failed`,
|
|
1639
1723
|
status: number = 0,
|
|
1640
1724
|
cause?: string
|
|
1641
1725
|
) {
|
|
@@ -1648,7 +1732,7 @@ export class WebrpcBadRouteError extends WebrpcError {
|
|
|
1648
1732
|
constructor(
|
|
1649
1733
|
name: string = 'WebrpcBadRoute',
|
|
1650
1734
|
code: number = -2,
|
|
1651
|
-
message: string =
|
|
1735
|
+
message: string = `bad route`,
|
|
1652
1736
|
status: number = 0,
|
|
1653
1737
|
cause?: string
|
|
1654
1738
|
) {
|
|
@@ -1661,7 +1745,7 @@ export class WebrpcBadMethodError extends WebrpcError {
|
|
|
1661
1745
|
constructor(
|
|
1662
1746
|
name: string = 'WebrpcBadMethod',
|
|
1663
1747
|
code: number = -3,
|
|
1664
|
-
message: string =
|
|
1748
|
+
message: string = `bad method`,
|
|
1665
1749
|
status: number = 0,
|
|
1666
1750
|
cause?: string
|
|
1667
1751
|
) {
|
|
@@ -1674,7 +1758,7 @@ export class WebrpcBadRequestError extends WebrpcError {
|
|
|
1674
1758
|
constructor(
|
|
1675
1759
|
name: string = 'WebrpcBadRequest',
|
|
1676
1760
|
code: number = -4,
|
|
1677
|
-
message: string =
|
|
1761
|
+
message: string = `bad request`,
|
|
1678
1762
|
status: number = 0,
|
|
1679
1763
|
cause?: string
|
|
1680
1764
|
) {
|
|
@@ -1687,7 +1771,7 @@ export class WebrpcBadResponseError extends WebrpcError {
|
|
|
1687
1771
|
constructor(
|
|
1688
1772
|
name: string = 'WebrpcBadResponse',
|
|
1689
1773
|
code: number = -5,
|
|
1690
|
-
message: string =
|
|
1774
|
+
message: string = `bad response`,
|
|
1691
1775
|
status: number = 0,
|
|
1692
1776
|
cause?: string
|
|
1693
1777
|
) {
|
|
@@ -1700,7 +1784,7 @@ export class WebrpcServerPanicError extends WebrpcError {
|
|
|
1700
1784
|
constructor(
|
|
1701
1785
|
name: string = 'WebrpcServerPanic',
|
|
1702
1786
|
code: number = -6,
|
|
1703
|
-
message: string =
|
|
1787
|
+
message: string = `server panic`,
|
|
1704
1788
|
status: number = 0,
|
|
1705
1789
|
cause?: string
|
|
1706
1790
|
) {
|
|
@@ -1713,7 +1797,7 @@ export class WebrpcInternalErrorError extends WebrpcError {
|
|
|
1713
1797
|
constructor(
|
|
1714
1798
|
name: string = 'WebrpcInternalError',
|
|
1715
1799
|
code: number = -7,
|
|
1716
|
-
message: string =
|
|
1800
|
+
message: string = `internal error`,
|
|
1717
1801
|
status: number = 0,
|
|
1718
1802
|
cause?: string
|
|
1719
1803
|
) {
|
|
@@ -1726,7 +1810,7 @@ export class WebrpcClientDisconnectedError extends WebrpcError {
|
|
|
1726
1810
|
constructor(
|
|
1727
1811
|
name: string = 'WebrpcClientDisconnected',
|
|
1728
1812
|
code: number = -8,
|
|
1729
|
-
message: string =
|
|
1813
|
+
message: string = `client disconnected`,
|
|
1730
1814
|
status: number = 0,
|
|
1731
1815
|
cause?: string
|
|
1732
1816
|
) {
|
|
@@ -1739,7 +1823,7 @@ export class WebrpcStreamLostError extends WebrpcError {
|
|
|
1739
1823
|
constructor(
|
|
1740
1824
|
name: string = 'WebrpcStreamLost',
|
|
1741
1825
|
code: number = -9,
|
|
1742
|
-
message: string =
|
|
1826
|
+
message: string = `stream lost`,
|
|
1743
1827
|
status: number = 0,
|
|
1744
1828
|
cause?: string
|
|
1745
1829
|
) {
|
|
@@ -1752,7 +1836,7 @@ export class WebrpcStreamFinishedError extends WebrpcError {
|
|
|
1752
1836
|
constructor(
|
|
1753
1837
|
name: string = 'WebrpcStreamFinished',
|
|
1754
1838
|
code: number = -10,
|
|
1755
|
-
message: string =
|
|
1839
|
+
message: string = `stream finished`,
|
|
1756
1840
|
status: number = 0,
|
|
1757
1841
|
cause?: string
|
|
1758
1842
|
) {
|
|
@@ -1768,7 +1852,7 @@ export class UnauthorizedError extends WebrpcError {
|
|
|
1768
1852
|
constructor(
|
|
1769
1853
|
name: string = 'Unauthorized',
|
|
1770
1854
|
code: number = 1000,
|
|
1771
|
-
message: string =
|
|
1855
|
+
message: string = `Unauthorized access`,
|
|
1772
1856
|
status: number = 0,
|
|
1773
1857
|
cause?: string
|
|
1774
1858
|
) {
|
|
@@ -1781,7 +1865,7 @@ export class PermissionDeniedError extends WebrpcError {
|
|
|
1781
1865
|
constructor(
|
|
1782
1866
|
name: string = 'PermissionDenied',
|
|
1783
1867
|
code: number = 1001,
|
|
1784
|
-
message: string =
|
|
1868
|
+
message: string = `Permission denied`,
|
|
1785
1869
|
status: number = 0,
|
|
1786
1870
|
cause?: string
|
|
1787
1871
|
) {
|
|
@@ -1794,7 +1878,7 @@ export class SessionExpiredError extends WebrpcError {
|
|
|
1794
1878
|
constructor(
|
|
1795
1879
|
name: string = 'SessionExpired',
|
|
1796
1880
|
code: number = 1002,
|
|
1797
|
-
message: string =
|
|
1881
|
+
message: string = `Session expired`,
|
|
1798
1882
|
status: number = 0,
|
|
1799
1883
|
cause?: string
|
|
1800
1884
|
) {
|
|
@@ -1807,7 +1891,7 @@ export class MethodNotFoundError extends WebrpcError {
|
|
|
1807
1891
|
constructor(
|
|
1808
1892
|
name: string = 'MethodNotFound',
|
|
1809
1893
|
code: number = 1003,
|
|
1810
|
-
message: string =
|
|
1894
|
+
message: string = `Method not found`,
|
|
1811
1895
|
status: number = 0,
|
|
1812
1896
|
cause?: string
|
|
1813
1897
|
) {
|
|
@@ -1820,7 +1904,7 @@ export class TimeoutError extends WebrpcError {
|
|
|
1820
1904
|
constructor(
|
|
1821
1905
|
name: string = 'Timeout',
|
|
1822
1906
|
code: number = 2000,
|
|
1823
|
-
message: string =
|
|
1907
|
+
message: string = `Request timed out`,
|
|
1824
1908
|
status: number = 0,
|
|
1825
1909
|
cause?: string
|
|
1826
1910
|
) {
|
|
@@ -1833,7 +1917,7 @@ export class InvalidArgumentError extends WebrpcError {
|
|
|
1833
1917
|
constructor(
|
|
1834
1918
|
name: string = 'InvalidArgument',
|
|
1835
1919
|
code: number = 2001,
|
|
1836
|
-
message: string =
|
|
1920
|
+
message: string = `Invalid argument`,
|
|
1837
1921
|
status: number = 0,
|
|
1838
1922
|
cause?: string
|
|
1839
1923
|
) {
|
|
@@ -1846,7 +1930,7 @@ export class NotFoundError extends WebrpcError {
|
|
|
1846
1930
|
constructor(
|
|
1847
1931
|
name: string = 'NotFound',
|
|
1848
1932
|
code: number = 3000,
|
|
1849
|
-
message: string =
|
|
1933
|
+
message: string = `Resource not found`,
|
|
1850
1934
|
status: number = 0,
|
|
1851
1935
|
cause?: string
|
|
1852
1936
|
) {
|
|
@@ -1859,7 +1943,7 @@ export class UserNotFoundError extends WebrpcError {
|
|
|
1859
1943
|
constructor(
|
|
1860
1944
|
name: string = 'UserNotFound',
|
|
1861
1945
|
code: number = 3001,
|
|
1862
|
-
message: string =
|
|
1946
|
+
message: string = `User not found`,
|
|
1863
1947
|
status: number = 0,
|
|
1864
1948
|
cause?: string
|
|
1865
1949
|
) {
|
|
@@ -1872,7 +1956,7 @@ export class ProjectNotFoundError extends WebrpcError {
|
|
|
1872
1956
|
constructor(
|
|
1873
1957
|
name: string = 'ProjectNotFound',
|
|
1874
1958
|
code: number = 3002,
|
|
1875
|
-
message: string =
|
|
1959
|
+
message: string = `Project not found`,
|
|
1876
1960
|
status: number = 0,
|
|
1877
1961
|
cause?: string
|
|
1878
1962
|
) {
|
|
@@ -1885,7 +1969,7 @@ export class InvalidTierError extends WebrpcError {
|
|
|
1885
1969
|
constructor(
|
|
1886
1970
|
name: string = 'InvalidTier',
|
|
1887
1971
|
code: number = 3003,
|
|
1888
|
-
message: string =
|
|
1972
|
+
message: string = `Invalid subscription tier`,
|
|
1889
1973
|
status: number = 0,
|
|
1890
1974
|
cause?: string
|
|
1891
1975
|
) {
|
|
@@ -1898,7 +1982,7 @@ export class ProjectLimitReachedError extends WebrpcError {
|
|
|
1898
1982
|
constructor(
|
|
1899
1983
|
name: string = 'ProjectLimitReached',
|
|
1900
1984
|
code: number = 3005,
|
|
1901
|
-
message: string =
|
|
1985
|
+
message: string = `Project limit reached`,
|
|
1902
1986
|
status: number = 0,
|
|
1903
1987
|
cause?: string
|
|
1904
1988
|
) {
|
|
@@ -1911,7 +1995,7 @@ export class NotImplementedError extends WebrpcError {
|
|
|
1911
1995
|
constructor(
|
|
1912
1996
|
name: string = 'NotImplemented',
|
|
1913
1997
|
code: number = 9999,
|
|
1914
|
-
message: string =
|
|
1998
|
+
message: string = `Not Implemented`,
|
|
1915
1999
|
status: number = 0,
|
|
1916
2000
|
cause?: string
|
|
1917
2001
|
) {
|
|
@@ -2000,4 +2084,3 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
2000
2084
|
}
|
|
2001
2085
|
|
|
2002
2086
|
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
2003
|
-
|
|
@@ -29,6 +29,10 @@ class CollectableKeys {
|
|
|
29
29
|
static listingsCount = [...CollectableKeys.all, 'listingsCount'] as const;
|
|
30
30
|
static filter = [...CollectableKeys.all, 'filter'] as const;
|
|
31
31
|
static counts = [...CollectableKeys.all, 'counts'] as const;
|
|
32
|
+
static collectibleActivities = [
|
|
33
|
+
...CollectableKeys.all,
|
|
34
|
+
'collectibleActivities',
|
|
35
|
+
] as const;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
// biome-ignore lint/complexity/noStaticOnlyClass:
|
|
@@ -36,6 +40,10 @@ class CollectionKeys {
|
|
|
36
40
|
static all = ['collections'] as const;
|
|
37
41
|
static list = [...CollectionKeys.all, 'list'] as const;
|
|
38
42
|
static detail = [...CollectionKeys.all, 'detail'] as const;
|
|
43
|
+
static collectionActivities = [
|
|
44
|
+
...CollectionKeys.all,
|
|
45
|
+
'collectionActivities',
|
|
46
|
+
] as const;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
// biome-ignore lint/complexity/noStaticOnlyClass:
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
TransactionSwapProvider,
|
|
23
23
|
WalletKind,
|
|
24
24
|
} from './marketplace.gen';
|
|
25
|
+
import { ChainIdSchema, CollectableIdSchema } from '../types';
|
|
26
|
+
import { AddressSchema } from '../types';
|
|
25
27
|
|
|
26
28
|
export const assetSchema = z.object({
|
|
27
29
|
id: z.number(),
|
|
@@ -521,6 +523,37 @@ export const listOffersForCollectibleReturnSchema = z.object({
|
|
|
521
523
|
page: pageSchema.optional(),
|
|
522
524
|
});
|
|
523
525
|
|
|
526
|
+
export const getListCollectibleActivitiesArgsSchema = z.object({
|
|
527
|
+
chainId: ChainIdSchema.pipe(z.coerce.string()),
|
|
528
|
+
collectionAddress: AddressSchema,
|
|
529
|
+
tokenId: CollectableIdSchema.pipe(z.coerce.string()),
|
|
530
|
+
query: pageSchema
|
|
531
|
+
.extend({
|
|
532
|
+
enabled: z.boolean().optional(),
|
|
533
|
+
})
|
|
534
|
+
.optional(),
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
export const getListCollectibleActivitiesReturnSchema = z.object({
|
|
538
|
+
activities: z.array(activitySchema),
|
|
539
|
+
page: pageSchema.optional(),
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
export const getListCollectionActivitiesArgsSchema = z.object({
|
|
543
|
+
chainId: ChainIdSchema.pipe(z.coerce.string()),
|
|
544
|
+
collectionAddress: AddressSchema,
|
|
545
|
+
query: pageSchema
|
|
546
|
+
.extend({
|
|
547
|
+
enabled: z.boolean().optional(),
|
|
548
|
+
})
|
|
549
|
+
.optional(),
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
export const getListCollectionActivitiesReturnSchema = z.object({
|
|
553
|
+
activities: z.array(activitySchema),
|
|
554
|
+
page: pageSchema.optional(),
|
|
555
|
+
});
|
|
556
|
+
|
|
524
557
|
export const getCollectibleLowestOfferReturnSchema = z.object({
|
|
525
558
|
order: orderSchema.optional(),
|
|
526
559
|
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
2
|
+
import { render as rtlRender } from '@testing-library/react';
|
|
3
|
+
import type { RenderOptions } from '@testing-library/react';
|
|
4
|
+
import type { ReactElement } from 'react';
|
|
5
|
+
import { createConfig, http, WagmiProvider } from 'wagmi';
|
|
6
|
+
import { mainnet, sepolia } from 'wagmi/chains';
|
|
7
|
+
import { mock } from 'wagmi/connectors';
|
|
8
|
+
|
|
9
|
+
const createTestQueryClient = () =>
|
|
10
|
+
new QueryClient({
|
|
11
|
+
defaultOptions: {
|
|
12
|
+
queries: {
|
|
13
|
+
retry: false,
|
|
14
|
+
staleTime: 0,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const config = createConfig({
|
|
20
|
+
chains: [mainnet, sepolia],
|
|
21
|
+
connectors: [
|
|
22
|
+
mock({
|
|
23
|
+
accounts: [
|
|
24
|
+
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
25
|
+
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
26
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
27
|
+
],
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
transports: {
|
|
31
|
+
[mainnet.id]: http(),
|
|
32
|
+
[sepolia.id]: http(),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function renderWithClient(
|
|
37
|
+
ui: ReactElement,
|
|
38
|
+
options?: Omit<RenderOptions, 'wrapper'>,
|
|
39
|
+
) {
|
|
40
|
+
const testQueryClient = createTestQueryClient();
|
|
41
|
+
|
|
42
|
+
const { rerender, ...result } = rtlRender(ui, {
|
|
43
|
+
wrapper: ({ children }) => (
|
|
44
|
+
<WagmiProvider config={config}>
|
|
45
|
+
<QueryClientProvider client={testQueryClient}>
|
|
46
|
+
{children}
|
|
47
|
+
</QueryClientProvider>
|
|
48
|
+
</WagmiProvider>
|
|
49
|
+
),
|
|
50
|
+
...options,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
...result,
|
|
55
|
+
rerender: (rerenderUi: ReactElement) =>
|
|
56
|
+
rerender(
|
|
57
|
+
<WagmiProvider config={config}>
|
|
58
|
+
<QueryClientProvider client={testQueryClient}>
|
|
59
|
+
{rerenderUi}
|
|
60
|
+
</QueryClientProvider>
|
|
61
|
+
</WagmiProvider>,
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export * from '@testing-library/react';
|
|
67
|
+
|
|
68
|
+
export { renderWithClient as render };
|
|
@@ -2,9 +2,9 @@ import { ChainId as NetworkChainId } from '@0xsequence/network';
|
|
|
2
2
|
import type { Address } from 'viem';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import type { ContractType, CreateReq } from '../../types';
|
|
5
|
-
import { Chain } from 'viem';
|
|
6
|
-
import { MarketplaceKind, OrderbookKind } from './api';
|
|
7
|
-
import { SdkConfig, MarketplaceConfig } from '../../types';
|
|
5
|
+
import type { Chain } from 'viem';
|
|
6
|
+
import type { MarketplaceKind, OrderbookKind } from './api';
|
|
7
|
+
import type { SdkConfig, MarketplaceConfig } from '../../types';
|
|
8
8
|
|
|
9
9
|
export const QueryArgSchema = z
|
|
10
10
|
.object({
|
package/src/react/hooks/index.ts
CHANGED
|
@@ -10,7 +10,9 @@ export * from './useFilters';
|
|
|
10
10
|
export * from './useFloorOrder';
|
|
11
11
|
export * from './useHighestOffer';
|
|
12
12
|
export * from './useListBalances';
|
|
13
|
+
export * from './useListCollectibleActivities';
|
|
13
14
|
export * from './useListCollectibles';
|
|
15
|
+
export * from './useListCollectionActivities';
|
|
14
16
|
export * from './useListOffersForCollectible';
|
|
15
17
|
export * from './useCountOffersForCollectible';
|
|
16
18
|
export * from './useListListingsForCollectible';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { http, HttpResponse } from 'msw';
|
|
2
|
+
import { WalletOptions, type MarketplaceConfig } from '../../../../types';
|
|
3
|
+
|
|
4
|
+
// Mock data
|
|
5
|
+
export const mockConfig: MarketplaceConfig = {
|
|
6
|
+
projectId: 123,
|
|
7
|
+
publisherId: 'test-publisher',
|
|
8
|
+
title: 'Test Marketplace',
|
|
9
|
+
shortDescription: 'A test marketplace',
|
|
10
|
+
faviconUrl: 'https://example.com/favicon.png',
|
|
11
|
+
landingBannerUrl: 'https://example.com/banner.png',
|
|
12
|
+
logoUrl: 'https://example.com/logo.png',
|
|
13
|
+
titleTemplate: '%s | Test Marketplace',
|
|
14
|
+
walletOptions: [WalletOptions.Sequence],
|
|
15
|
+
collections: [],
|
|
16
|
+
landingPageLayout: 'default',
|
|
17
|
+
cssString: '',
|
|
18
|
+
manifestUrl: '',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const mockStyles = `
|
|
22
|
+
.marketplace-theme {
|
|
23
|
+
--primary-color: #000000;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
// Debug configuration
|
|
28
|
+
export let isDebugEnabled = false;
|
|
29
|
+
export const enableDebug = () => {
|
|
30
|
+
isDebugEnabled = true;
|
|
31
|
+
};
|
|
32
|
+
export const disableDebug = () => {
|
|
33
|
+
isDebugEnabled = false;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Debug logger function
|
|
37
|
+
const debugLog = (endpoint: string, request: Request, response: Response) => {
|
|
38
|
+
if (isDebugEnabled) {
|
|
39
|
+
console.log(`[MSW Debug] ${endpoint}:`, {
|
|
40
|
+
request,
|
|
41
|
+
response,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// MSW handlers
|
|
47
|
+
export const createConfigHandler = (config = mockConfig) =>
|
|
48
|
+
http.get('*/marketplace/*/config.json', ({ request }) => {
|
|
49
|
+
const response = HttpResponse.json(config);
|
|
50
|
+
debugLog('config.json', request, response);
|
|
51
|
+
return response;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const createStylesHandler = (styles = mockStyles) =>
|
|
55
|
+
http.get('*/marketplace/*/styles.css', ({ request }) => {
|
|
56
|
+
const response = new HttpResponse(styles, {
|
|
57
|
+
headers: { 'Content-Type': 'text/css' },
|
|
58
|
+
});
|
|
59
|
+
debugLog('styles.css', request, response);
|
|
60
|
+
return response;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const createErrorHandler = () =>
|
|
64
|
+
http.get('*/marketplace/*/config.json', () => {
|
|
65
|
+
return HttpResponse.json(
|
|
66
|
+
{ code: 3000, msg: 'Project not found' },
|
|
67
|
+
{ status: 404 },
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const createStylesErrorHandler = () =>
|
|
72
|
+
http.get('*/marketplace/*/styles.css', () => {
|
|
73
|
+
return new HttpResponse('', { status: 500 });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Default handlers
|
|
77
|
+
export const handlers = [createConfigHandler(), createStylesHandler()];
|