@0xsequence/marketplace-sdk 2.0.0 → 2.0.1
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 +8 -0
- package/dist/BellIcon.js +1 -1
- package/dist/Card.js +1 -1
- package/dist/ShopCard.d.ts +4 -4
- package/dist/collectible.js +2 -2
- package/dist/collectible.js.map +1 -1
- package/dist/collection.js +1 -1
- package/dist/create-config.d.ts +8 -8
- package/dist/currency.js +3 -3
- package/dist/currency.js.map +1 -1
- package/dist/expirationDateSelect.js +1 -1
- package/dist/filters.d.ts +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index10.d.ts +2 -2
- package/dist/index11.d.ts +14 -14
- package/dist/index12.d.ts +25 -25
- package/dist/index14.d.ts +2 -2
- package/dist/index16.d.ts +2 -2
- package/dist/index17.d.ts +85 -85
- package/dist/index18.d.ts +36 -36
- package/dist/index21.d.ts +14 -14
- package/dist/index22.d.ts +4 -4
- package/dist/index23.d.ts +11 -11
- package/dist/index26.d.ts +3 -3
- package/dist/index27.d.ts +3 -3
- package/dist/index28.d.ts +9 -9
- package/dist/index31.d.ts +4 -4
- package/dist/index33.d.ts +2 -2
- package/dist/index34.d.ts +3 -3
- package/dist/index36.d.ts +2 -2
- package/dist/index37.d.ts +2 -0
- package/dist/index38.d.ts +3 -3
- package/dist/index4.d.ts +458 -458
- package/dist/index40.d.ts +2 -2
- package/dist/index8.d.ts +10 -2
- package/dist/inventory.d.ts +3 -3
- package/dist/inventory.js +2 -2
- package/dist/inventory.js.map +1 -1
- package/dist/marketplace2.js +2 -2
- package/dist/marketplace2.js.map +1 -1
- package/dist/metadata.d.ts +72 -72
- package/dist/primary-sale-checkout-options.d.ts +3 -3
- package/dist/quantityInput.js +1 -1
- package/dist/ranges.d.ts +16 -16
- package/dist/react/ssr/index.d.ts +2 -2
- package/dist/react/ssr/index.js +2 -2
- package/dist/react/ui/components/marketplace-logos/index.d.ts +21 -21
- package/dist/react/ui/modals/_internal/components/baseModal/index.d.ts +6 -6
- package/dist/react/ui/modals/_internal/components/calendarDropdown/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/currencyImage/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/floorPriceText/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/priceInput/index.d.ts +2 -4
- package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/timeAgo/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/tokenPreview/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/transaction-footer/index.d.ts +3 -3
- package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.d.ts +2 -2
- package/dist/react.js +114 -43
- package/dist/react.js.map +1 -1
- package/dist/styles/index.css +15 -0
- package/dist/token-balances.d.ts +27 -27
- package/dist/transaction-footer.js +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/utils.js +12 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/react/hooks/currency/list.test.tsx +23 -2
- package/src/react/hooks/transactions/useMarketTransactionSteps.tsx +55 -15
- package/src/react/queries/collectible/market-list.ts +5 -3
- package/src/react/queries/currency/list.ts +8 -5
- package/src/react/queries/inventory/inventory.ts +5 -3
- package/src/react/queries/marketplace/filters.ts +5 -3
- package/src/react/ui/modals/BuyModal/components/BuyModalContent.tsx +40 -6
- package/src/react/ui/modals/BuyModal/hooks/useMarketPlatformFee.ts +5 -5
- package/src/react/ui/modals/CreateListingModal/internal/store.ts +5 -2
- package/src/react/ui/modals/MakeOfferModal/internal/context.ts +20 -1
- package/src/react/ui/modals/MakeOfferModal/internal/helpers/validation.ts +16 -1
- package/src/react/ui/modals/MakeOfferModal/internal/store.ts +5 -2
- package/src/react/ui/modals/SellModal/internal/store.ts +5 -2
- package/src/react/ui/modals/_internal/components/baseModal/errors/ModalInitializationError.tsx +8 -6
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +2 -9
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +5 -2
- package/src/styles/styles.ts +18 -0
- package/src/utils/collection.ts +19 -0
- package/src/utils/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @0xsequence/marketplace-sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
**Fix multi-chain collection lookup**: Collections deployed on multiple chains could resolve to the wrong configuration (currencies, fees, filters, orderbook). Lookups now match on both address and chain ID.
|
|
8
|
+
**Fix OpenSea minimum offer price validation**: The `useConvertPriceToUSD` hook was always disabled, so the $0.01 USD minimum for OpenSea offers was never enforced. Validation now runs correctly in the MakeOfferModal.
|
|
9
|
+
**Improve buy modal reliability**: The `generateBuyTransaction` call now polls until data is available, preventing the modal from hanging on slow responses. Added a progressive loading indicator.
|
|
10
|
+
|
|
3
11
|
## 2.0.0
|
|
4
12
|
|
|
5
13
|
### Major Release
|
package/dist/BellIcon.js
CHANGED
package/dist/Card.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { t as ContractType } from "./dist.js";
|
|
4
4
|
import { t as CollectibleCardAction } from "./types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { l as cn$1, u as compareAddress } from "./utils.js";
|
|
6
6
|
import { t as BellIcon_default } from "./BellIcon.js";
|
|
7
7
|
import { useAccount } from "wagmi";
|
|
8
8
|
import { Suspense, forwardRef, lazy, useEffect, useRef, useState } from "react";
|
package/dist/ShopCard.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as MarketCollectibleCardProps, l as ShopCollectibleCardProps, n as CollectibleCardProps } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime51 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/react/ui/components/marketplace-collectible-card/CollectibleCard.d.ts
|
|
5
|
-
declare function CollectibleCard(props: CollectibleCardProps):
|
|
5
|
+
declare function CollectibleCard(props: CollectibleCardProps): react_jsx_runtime51.JSX.Element | undefined;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/react/ui/components/marketplace-collectible-card/variants/MarketCard.d.ts
|
|
8
8
|
/**
|
|
@@ -39,7 +39,7 @@ declare function MarketCard({
|
|
|
39
39
|
prioritizeOwnerActions,
|
|
40
40
|
hideQuantitySelector,
|
|
41
41
|
classNames
|
|
42
|
-
}: MarketCollectibleCardProps):
|
|
42
|
+
}: MarketCollectibleCardProps): react_jsx_runtime51.JSX.Element | null;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/react/ui/components/marketplace-collectible-card/variants/ShopCard.d.ts
|
|
45
45
|
/**
|
|
@@ -77,7 +77,7 @@ declare function ShopCard({
|
|
|
77
77
|
unlimitedSupply,
|
|
78
78
|
hideQuantitySelector,
|
|
79
79
|
classNames
|
|
80
|
-
}: ShopCollectibleCardProps):
|
|
80
|
+
}: ShopCollectibleCardProps): react_jsx_runtime51.JSX.Element | null;
|
|
81
81
|
//#endregion
|
|
82
82
|
export { MarketCard as n, CollectibleCard as r, ShopCard as t };
|
|
83
83
|
//# sourceMappingURL=ShopCard.d.ts.map
|
package/dist/collectible.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as findMarketCollection } from "./utils.js";
|
|
2
2
|
import { i as getMetadataClient, n as getIndexerClient, r as getMarketplaceClient } from "./api.js";
|
|
3
3
|
import { n as buildInfiniteQueryOptions, r as buildQueryOptions } from "./_internal.js";
|
|
4
4
|
import { i as createCollectibleQueryKey } from "./token-balances.js";
|
|
@@ -164,7 +164,7 @@ function normalizePriceFilters(filters) {
|
|
|
164
164
|
async function fetchListCollectibles(params, page) {
|
|
165
165
|
const { chainId, collectionAddress, config, filter, ...additionalApiParams } = params;
|
|
166
166
|
const marketplaceClient = getMarketplaceClient(config);
|
|
167
|
-
const isMarketCollection = (await fetchMarketplaceConfig({ config }))?.market.collections
|
|
167
|
+
const isMarketCollection = !!findMarketCollection((await fetchMarketplaceConfig({ config }))?.market.collections ?? [], collectionAddress, chainId);
|
|
168
168
|
if (params.enabled === false || !isMarketCollection) return {
|
|
169
169
|
collectibles: [],
|
|
170
170
|
page: {
|
package/dist/collectible.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectible.js","names":["apiArgs: GetCountOfFilteredCollectiblesRequest","apiArgs","apiArgs: GetCountOfAllCollectiblesRequest","apiArgs: GetTokenMetadataArgs","initialPage: PageParam"],"sources":["../src/react/queries/collectible/balance.ts","../src/react/queries/collectible/market-count.ts","../src/react/queries/collectible/market-highest-offer.ts","../src/react/utils/normalizePriceFilters.ts","../src/react/queries/collectible/market-list.ts","../src/react/queries/collectible/market-list-paginated.ts","../src/react/queries/collectible/market-listings.ts","../src/react/queries/collectible/market-listings-count.ts","../src/react/queries/collectible/market-lowest-listing.ts","../src/react/queries/collectible/market-offers.ts","../src/react/queries/collectible/market-offers-count.ts","../src/react/queries/collectible/metadata.ts","../src/react/queries/collectible/primary-sale-item.ts","../src/react/queries/collectible/primary-sale-items.ts","../src/react/queries/collectible/primary-sale-items-count.ts"],"sourcesContent":["import type { GetBalanceOfCollectibleRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetIndexerClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createCollectibleQueryKey } from './queryKeys';\n\nexport type FetchBalanceOfCollectibleParams = GetBalanceOfCollectibleRequest;\n\nexport type BalanceOfCollectibleQueryOptions =\n\tSdkQueryParams<FetchBalanceOfCollectibleParams>;\n\n/**\n * Fetches the balance of a specific collectible for a user\n *\n * @param params - Parameters for the API call\n * @returns The balance data\n */\nexport async function fetchBalanceOfCollectible(\n\tparams: WithRequired<\n\t\tBalanceOfCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'userAddress' | 'config'\n\t>,\n) {\n\tconst {\n\t\tchainId,\n\t\tuserAddress,\n\t\tcollectionAddress,\n\t\ttokenId,\n\t\tincludeMetadata,\n\t\tconfig,\n\t} = params;\n\tconst indexerClient = getIndexerClient(chainId, config);\n\tconst shouldIncludeMetadata = includeMetadata ?? false;\n\treturn indexerClient\n\t\t.getTokenBalances({\n\t\t\taccountAddress: userAddress,\n\t\t\tcontractAddress: collectionAddress,\n\t\t\ttokenId,\n\t\t\tincludeMetadata: shouldIncludeMetadata,\n\t\t\t...(shouldIncludeMetadata && {\n\t\t\t\tmetadataOptions: {\n\t\t\t\t\tverifiedOnly: true,\n\t\t\t\t},\n\t\t\t}),\n\t\t})\n\t\t.then((res) => res.balances[0] || null);\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'balance', { chainId, accountAddress, contractAddress, tokenID }]\n */\nexport function getBalanceOfCollectibleQueryKey(\n\tparams: BalanceOfCollectibleQueryOptions,\n) {\n\tconst shouldIncludeMetadata = params.includeMetadata ?? false;\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\taccountAddress: params.userAddress,\n\t\tcontractAddress: params.collectionAddress,\n\t\ttokenId: params.tokenId,\n\t\tincludeMetadata: shouldIncludeMetadata,\n\t\t...(shouldIncludeMetadata && {\n\t\t\tmetadataOptions: {\n\t\t\t\tverifiedOnly: true,\n\t\t\t},\n\t\t}),\n\t};\n\n\treturn createCollectibleQueryKey('balance', apiArgs);\n}\n\n/**\n * Creates a tanstack query options object for the balance query\n *\n * @param params - The query parameters\n * @returns Query options configuration\n */\nexport function balanceOfCollectibleOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tBalanceOfCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'userAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getBalanceOfCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'userAddress',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'chainId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchBalanceOfCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress &&\n\t\t\t\tisAddress(p.collectionAddress) &&\n\t\t\t\tp.tokenId !== undefined &&\n\t\t\t\tp.tokenId >= 0n &&\n\t\t\t\t!!p.userAddress &&\n\t\t\t\tisAddress(p.userAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tGetCountOfAllCollectiblesRequest,\n\tGetCountOfFilteredCollectiblesRequest,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCountOfCollectablesParams = GetCountOfAllCollectiblesRequest &\n\tPartial<Pick<GetCountOfFilteredCollectiblesRequest, 'filter' | 'side'>>;\n\nexport type CountOfCollectablesQueryOptions =\n\tSdkQueryParams<FetchCountOfCollectablesParams>;\n\n/**\n * Fetches count of collectibles from the marketplace API\n */\nexport async function fetchCountOfCollectables(\n\tparams: WithRequired<\n\t\tCountOfCollectablesQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'config'\n\t>,\n) {\n\tconst { collectionAddress, chainId, config, filter, side } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tif (filter && side) {\n\t\tconst apiArgs: GetCountOfFilteredCollectiblesRequest = {\n\t\t\tcollectionAddress,\n\t\t\tchainId,\n\t\t\tfilter,\n\t\t\tside,\n\t\t};\n\n\t\tconst result = await client.getCountOfFilteredCollectibles(apiArgs);\n\t\treturn result.count;\n\t}\n\n\tconst apiArgs: GetCountOfAllCollectiblesRequest = {\n\t\tcollectionAddress,\n\t\tchainId,\n\t};\n\n\tconst result = await client.getCountOfAllCollectibles(apiArgs);\n\treturn result.count;\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'market-count', { chainId, contractAddress, filter?, side? }]\n */\nexport function getCountOfCollectablesQueryKey(\n\tparams: CountOfCollectablesQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\tfilter: params.filter,\n\t\t\tside: params.side,\n\t\t},\n\t] as const;\n}\n\nexport function countOfCollectablesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCountOfCollectablesQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCountOfCollectablesQueryKey,\n\t\t\trequiredParams: ['chainId', 'collectionAddress', 'config'] as const,\n\t\t\tfetcher: fetchCountOfCollectables,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Order } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype GetHighestPriceOfferForCollectibleRequest,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type HighestOfferQueryOptions =\n\tSdkQueryParams<GetHighestPriceOfferForCollectibleRequest>;\n\nexport async function fetchHighestOffer(\n\tparams: WithRequired<\n\t\tHighestOfferQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<Order | null> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\tconst result =\n\t\tawait marketplaceClient.getHighestPriceOfferForCollectible(apiParams);\n\t// TanStack Query v5 requires non-undefined return values\n\treturn result.order ?? null;\n}\n\nexport function getHighestOfferQueryKey(params: HighestOfferQueryOptions) {\n\treturn [\n\t\t'collectible',\n\t\t'market-highest-offer',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function highestOfferQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tHighestOfferQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n): ReturnType<\n\ttypeof buildQueryOptions<\n\t\tWithRequired<\n\t\t\tHighestOfferQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>,\n\t\tOrder | null,\n\t\treadonly ['chainId', 'collectionAddress', 'tokenId', 'config']\n\t>\n> {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getHighestOfferQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchHighestOffer,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { PriceFilter } from '../ssr';\n\ntype PriceLike = {\n\tcontractAddress: string;\n\tmin?: string | bigint;\n\tmax?: string | bigint;\n};\n\nfunction normalizePriceFilters(\n\tfilters?: PriceLike[],\n): PriceFilter[] | undefined {\n\tif (!filters) return undefined;\n\n\treturn filters.map(({ contractAddress, min, max }) => ({\n\t\tcontractAddress,\n\t\t...(min !== undefined && {\n\t\t\tmin: typeof min === 'bigint' ? min : BigInt(min),\n\t\t}),\n\t\t...(max !== undefined && {\n\t\t\tmax: typeof max === 'bigint' ? max : BigInt(max),\n\t\t}),\n\t}));\n}\n\nexport { normalizePriceFilters };\n","import { isAddress } from 'viem';\nimport type { Page } from '../../../types';\nimport type { CardType } from '../../../types/types';\nimport { compareAddress } from '../../../utils';\nimport type {\n\tListCollectiblesRequest,\n\tListCollectiblesResponse,\n} from '../../_internal';\nimport {\n\tbuildInfiniteQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkInfiniteQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { normalizePriceFilters } from '../../utils/normalizePriceFilters';\nimport { fetchMarketplaceConfig } from '../marketplace/config';\n\nexport type ListCollectiblesQueryOptions = SdkInfiniteQueryParams<\n\tListCollectiblesRequest & {\n\t\tcardType?: CardType;\n\t\tenabled?: boolean;\n\t}\n>;\n\n/**\n * Fetches a list of collectibles with pagination support from the Marketplace API\n */\nexport async function fetchListCollectibles(\n\tparams: WithRequired<\n\t\tListCollectiblesQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'side' | 'config'\n\t>,\n\tpage: Page,\n): Promise<ListCollectiblesResponse> {\n\tconst { chainId, collectionAddress, config, filter, ...additionalApiParams } =\n\t\tparams;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\tconst marketplaceConfig = await fetchMarketplaceConfig({ config });\n\tconst isMarketCollection = marketplaceConfig?.market.collections.some(\n\t\t(collection) => compareAddress(collection.itemsAddress, collectionAddress),\n\t);\n\n\t// If it's not a market collection, return an empty list. those collections are not compatible with the ListCollectibles endpoint.\n\tif (params.enabled === false || !isMarketCollection) {\n\t\treturn {\n\t\t\tcollectibles: [],\n\t\t\tpage: {\n\t\t\t\tpage: 1,\n\t\t\t\tpageSize: 30,\n\t\t\t\tmore: false,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Transform price filters from strings to BigInt for API\n\tconst transformedFilter = filter\n\t\t? {\n\t\t\t\t...filter,\n\t\t\t\tprices: normalizePriceFilters(filter.prices),\n\t\t\t}\n\t\t: undefined;\n\n\treturn await marketplaceClient.listCollectibles({\n\t\tchainId,\n\t\tcollectionAddress,\n\t\tpage,\n\t\tfilter: transformedFilter,\n\t\t...additionalApiParams,\n\t});\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'market-list', { chainId, contractAddress, side, filter }]\n */\nexport function getListCollectiblesQueryKey(\n\tparams: ListCollectiblesQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-list',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\tside: params.side,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function listCollectiblesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListCollectiblesQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'side' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildInfiniteQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListCollectiblesQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'side',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListCollectibles,\n\t\t\tgetPageInfo: (response) => response.page,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import { isAddress } from 'viem';\nimport type {\n\tListCollectiblesRequest,\n\tListCollectiblesResponse,\n} from '../../_internal';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { normalizePriceFilters } from '../../utils/normalizePriceFilters';\n\nexport type FetchListCollectiblesPaginatedParams = Omit<\n\tListCollectiblesRequest,\n\t'page'\n> & {\n\tpage?: number;\n\tpageSize?: number;\n};\n\nexport type ListCollectiblesPaginatedQueryOptions =\n\tSdkQueryParams<FetchListCollectiblesPaginatedParams>;\n\n/**\n * Fetches a list of collectibles with pagination support from the Marketplace API\n */\nexport async function fetchListCollectiblesPaginated(\n\tparams: WithRequired<\n\t\tListCollectiblesPaginatedQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'side' | 'config'\n\t>,\n): Promise<ListCollectiblesResponse> {\n\tconst {\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tconfig,\n\t\tpage = 1,\n\t\tpageSize = 30,\n\t\tfilter,\n\t\t...additionalApiParams\n\t} = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\t// Transform price filters from strings to BigInt for API\n\tconst transformedFilter = filter\n\t\t? {\n\t\t\t\t...filter,\n\t\t\t\tprices: normalizePriceFilters(filter.prices),\n\t\t\t}\n\t\t: undefined;\n\n\treturn await marketplaceClient.listCollectibles({\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tpage: {\n\t\t\tpage,\n\t\t\tpageSize,\n\t\t},\n\t\tfilter: transformedFilter,\n\t\t...additionalApiParams,\n\t});\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'market-list-paginated', { chainId, contractAddress, side, filter, page }]\n */\nexport function getListCollectiblesPaginatedQueryKey(\n\tparams: ListCollectiblesPaginatedQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-list-paginated',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\tside: params.side,\n\t\t\tfilter: params.filter,\n\t\t\tpage: params.page,\n\t\t\tpageSize: params.pageSize,\n\t\t},\n\t] as const;\n}\n\nexport function listCollectiblesPaginatedQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListCollectiblesPaginatedQueryOptions,\n\t\t\t'collectionAddress' | 'chainId' | 'side' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListCollectiblesPaginatedQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'collectionAddress',\n\t\t\t\t'chainId',\n\t\t\t\t'side',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListCollectiblesPaginated,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tListCollectibleListingsResponse,\n\tListListingsForCollectibleRequest,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type ListListingsForCollectibleQueryOptions =\n\tSdkQueryParams<ListListingsForCollectibleRequest>;\n\n/**\n * Fetches listings for a specific collectible from the Marketplace API\n */\nexport async function fetchListListingsForCollectible(\n\tparams: WithRequired<\n\t\tListListingsForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<ListCollectibleListingsResponse> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn await marketplaceClient.listListingsForCollectible(apiParams);\n}\n\nexport function getListListingsForCollectibleQueryKey(\n\tparams: ListListingsForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-listings',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t\tpage: params.page,\n\t\t},\n\t] as const;\n}\n\nexport function listListingsForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListListingsForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListListingsForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListListingsForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { GetCountOfListingsForCollectibleRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCountListingsForCollectibleParams =\n\tGetCountOfListingsForCollectibleRequest;\n\nexport type CountListingsForCollectibleQueryOptions =\n\tSdkQueryParams<FetchCountListingsForCollectibleParams>;\n\n/**\n * Fetches count of listings for a collectible from the marketplace API\n */\nexport async function fetchCountListingsForCollectible(\n\tparams: WithRequired<\n\t\tCountListingsForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n) {\n\tconst { config, ...apiParams } = params;\n\tconst client = getMarketplaceClient(config);\n\tconst result = await client.getCountOfListingsForCollectible(apiParams);\n\treturn result.count;\n}\n\nexport function getCountListingsForCollectibleQueryKey(\n\tparams: CountListingsForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-listings-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function countListingsForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCountListingsForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCountListingsForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchCountListingsForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Order } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype GetLowestPriceListingForCollectibleRequest,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type LowestListingQueryOptions =\n\tSdkQueryParams<GetLowestPriceListingForCollectibleRequest>;\n\nexport async function fetchLowestListing(\n\tparams: WithRequired<\n\t\tLowestListingQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<Order | null> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\tconst result =\n\t\tawait marketplaceClient.getLowestPriceListingForCollectible(apiParams);\n\t// TanStack Query v5 requires non-undefined return values\n\treturn result.order ?? null;\n}\n\nexport function getLowestListingQueryKey(params: LowestListingQueryOptions) {\n\treturn [\n\t\t'collectible',\n\t\t'market-lowest-listing',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function lowestListingQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tLowestListingQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n): ReturnType<\n\ttypeof buildQueryOptions<\n\t\tWithRequired<\n\t\t\tLowestListingQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>,\n\t\tOrder | null,\n\t\treadonly ['chainId', 'collectionAddress', 'tokenId', 'config']\n\t>\n> {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getLowestListingQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchLowestListing,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import { isAddress } from 'viem';\nimport type {\n\tListCollectibleOffersResponse,\n\tListOffersForCollectibleRequest,\n\tPage,\n\tSortBy,\n\tWithOptionalParams,\n} from '../../_internal';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type ListOffersForCollectibleQueryOptions = SdkQueryParams<\n\tListOffersForCollectibleRequest & {\n\t\tsort?: Array<SortBy>;\n\t}\n>;\n\n/**\n * Fetches offers for a specific collectible from the Marketplace API\n */\nexport async function fetchListOffersForCollectible(\n\tparams: WithRequired<\n\t\tListOffersForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<ListCollectibleOffersResponse> {\n\tconst { config, sort, page, ...additionalApiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst effectiveSort =\n\t\tsort || (page && 'sort' in page ? page.sort : undefined);\n\n\treturn await marketplaceClient.listOffersForCollectible({\n\t\t...additionalApiParams,\n\t\tpage:\n\t\t\tpage || effectiveSort\n\t\t\t\t? ({\n\t\t\t\t\t\tpage: page?.page ?? 1,\n\t\t\t\t\t\tpageSize: page?.pageSize ?? 20,\n\t\t\t\t\t\t...(page?.more && { more: page.more }),\n\t\t\t\t\t\t...(effectiveSort && { sort: effectiveSort }),\n\t\t\t\t\t} as Page)\n\t\t\t\t: undefined,\n\t});\n}\n\nexport function getListOffersForCollectibleQueryKey(\n\tparams: ListOffersForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-offers',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t\tpage: params.page,\n\t\t},\n\t] as const;\n}\n\nexport function listOffersForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListOffersForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListOffersForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListOffersForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { GetCountOfOffersForCollectibleRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCountOffersForCollectibleParams =\n\tGetCountOfOffersForCollectibleRequest;\n\nexport type CountOffersForCollectibleQueryOptions =\n\tSdkQueryParams<FetchCountOffersForCollectibleParams>;\n\n/**\n * Fetches count of offers for a collectible from the marketplace API\n */\nexport async function fetchCountOffersForCollectible(\n\tparams: WithRequired<\n\t\tCountOffersForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n) {\n\tconst { config, ...apiParams } = params;\n\tconst client = getMarketplaceClient(config);\n\tconst result = await client.getCountOfOffersForCollectible(apiParams);\n\treturn result.count;\n}\n\nexport function getCountOffersForCollectibleQueryKey(\n\tparams: CountOffersForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-offers-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function countOffersForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCountOffersForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCountOffersForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchCountOffersForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tGetSingleTokenMetadataArgs,\n\tGetTokenMetadataArgs,\n\tTokenMetadata,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMetadataClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createCollectibleQueryKey } from './queryKeys';\n\nexport type FetchCollectibleParams = GetSingleTokenMetadataArgs;\n\nexport type CollectibleQueryOptions = SdkQueryParams<FetchCollectibleParams>;\n\n/**\n * Fetches collectible metadata from the metadata API\n */\nexport async function fetchCollectible(\n\tparams: WithRequired<\n\t\tCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<TokenMetadata | undefined> {\n\tconst { tokenId, chainId, collectionAddress, config } = params;\n\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst apiArgs: GetTokenMetadataArgs = {\n\t\tchainId,\n\t\tcontractAddress: collectionAddress,\n\t\ttokenIds: [tokenId],\n\t};\n\n\tconst result = await metadataClient.getTokenMetadata(apiArgs);\n\t// TanStack Query v5 requires non-undefined return values\n\treturn result.tokenMetadata[0] ?? null;\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'metadata', { chainId, contractAddress, tokenIds }]\n */\nexport function getCollectibleQueryKey(params: CollectibleQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcontractAddress: params.collectionAddress,\n\t\ttokenIds: params.tokenId !== undefined ? [params.tokenId] : [],\n\t};\n\n\treturn createCollectibleQueryKey('metadata', apiArgs);\n}\n\nexport function collectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.chainId &&\n\t\t\t\tp.chainId > 0 &&\n\t\t\t\t!!p.collectionAddress &&\n\t\t\t\tisAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tCollectiblePrimarySaleItem,\n\tGetPrimarySaleItemRequest,\n\tGetPrimarySaleItemResponse,\n\tTokenId,\n} from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createCollectibleQueryKey } from './queryKeys';\n\nexport type FetchPrimarySaleItemParams = Omit<\n\tGetPrimarySaleItemRequest,\n\t'tokenId'\n> & {\n\ttokenId: TokenId | string;\n};\n\nexport type PrimarySaleItemQueryOptions =\n\tSdkQueryParams<FetchPrimarySaleItemParams>;\n\n/**\n * Fetches a single primary sale item from the marketplace API\n */\nexport async function fetchPrimarySaleItem(\n\tparams: WithRequired<\n\t\tPrimarySaleItemQueryOptions,\n\t\t'chainId' | 'primarySaleContractAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<GetPrimarySaleItemResponse> {\n\tconst { chainId, primarySaleContractAddress, tokenId, config } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn marketplaceClient.getPrimarySaleItem({\n\t\tchainId,\n\t\tprimarySaleContractAddress,\n\t\ttokenId: BigInt(tokenId),\n\t});\n}\n\nexport function getPrimarySaleItemQueryKey(\n\tparams: PrimarySaleItemQueryOptions,\n) {\n\treturn createCollectibleQueryKey('primary-sale-item', {\n\t\tchainId: params.chainId ?? 0,\n\t\tprimarySaleContractAddress: params.primarySaleContractAddress ?? '',\n\t\ttokenId: params.tokenId?.toString() ?? '',\n\t});\n}\n\nexport function primarySaleItemQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tPrimarySaleItemQueryOptions,\n\t\t\t'chainId' | 'primarySaleContractAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getPrimarySaleItemQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'primarySaleContractAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchPrimarySaleItem,\n\t\t},\n\t\tparams,\n\t);\n}\n\nexport type { CollectiblePrimarySaleItem, GetPrimarySaleItemResponse };\n","import type {\n\tListPrimarySaleItemsRequest,\n\tListPrimarySaleItemsResponse,\n} from '@0xsequence/api-client';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport {\n\tgetMarketplaceClient,\n\ttype SdkInfiniteQueryParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchPrimarySaleItemsParams = ListPrimarySaleItemsRequest;\n\nexport type ListPrimarySaleItemsQueryOptions =\n\tSdkInfiniteQueryParams<FetchPrimarySaleItemsParams>;\n\n/**\n * Fetches primary sale items from the marketplace API\n */\nexport async function fetchPrimarySaleItems(\n\tparams: WithRequired<\n\t\tListPrimarySaleItemsQueryOptions,\n\t\t'chainId' | 'primarySaleContractAddress' | 'config'\n\t>,\n): Promise<ListPrimarySaleItemsResponse> {\n\tconst { chainId, primarySaleContractAddress, filter, page, config } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn marketplaceClient.listPrimarySaleItems({\n\t\tchainId,\n\t\tprimarySaleContractAddress,\n\t\tfilter,\n\t\tpage,\n\t});\n}\n\nexport function getPrimarySaleItemsQueryKey(\n\tparams: ListPrimarySaleItemsQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'primary-sale-items',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tprimarySaleContractAddress: params.primarySaleContractAddress ?? '',\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport const primarySaleItemsQueryOptions = (\n\tparams: ListPrimarySaleItemsQueryOptions,\n) => {\n\tconst enabled = Boolean(\n\t\tparams.primarySaleContractAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\ttype PageParam = { page: number; pageSize: number };\n\tconst initialPage: PageParam = params.page || { page: 1, pageSize: 30 };\n\n\tconst queryFn = async ({ pageParam }: { pageParam: PageParam }) => {\n\t\tconst requiredParams = params as WithRequired<\n\t\t\tListPrimarySaleItemsQueryOptions,\n\t\t\t'chainId' | 'primarySaleContractAddress' | 'config'\n\t\t>;\n\t\treturn fetchPrimarySaleItems({\n\t\t\tchainId: requiredParams.chainId,\n\t\t\tprimarySaleContractAddress: requiredParams.primarySaleContractAddress,\n\t\t\tfilter: params.filter,\n\t\t\tpage: pageParam,\n\t\t\tconfig: requiredParams.config,\n\t\t});\n\t};\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: getPrimarySaleItemsQueryKey(params),\n\t\tqueryFn,\n\t\tinitialPageParam: initialPage,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more\n\t\t\t\t? {\n\t\t\t\t\t\tpage: lastPage.page.page + 1,\n\t\t\t\t\t\tpageSize: lastPage.page.pageSize,\n\t\t\t\t\t\tmore: true,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n};\n\nexport type { ListPrimarySaleItemsRequest, ListPrimarySaleItemsResponse };\n","import type {\n\tGetCountOfPrimarySaleItemsRequest,\n\tGetCountOfPrimarySaleItemsResponse,\n} from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchPrimarySaleItemsCountParams =\n\tGetCountOfPrimarySaleItemsRequest;\n\nexport type PrimarySaleItemsCountQueryOptions =\n\tSdkQueryParams<FetchPrimarySaleItemsCountParams>;\n\n/**\n * Fetches the count of primary sale items from the marketplace API\n */\nexport async function fetchPrimarySaleItemsCount(\n\tparams: WithRequired<\n\t\tPrimarySaleItemsCountQueryOptions,\n\t\t'chainId' | 'primarySaleContractAddress' | 'config'\n\t>,\n): Promise<GetCountOfPrimarySaleItemsResponse> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\treturn marketplaceClient.getCountOfPrimarySaleItems(apiParams);\n}\n\nexport function getPrimarySaleItemsCountQueryKey(\n\tparams: PrimarySaleItemsCountQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'primary-sale-items-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tprimarySaleContractAddress: params.primarySaleContractAddress ?? '',\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport const primarySaleItemsCountQueryOptions = (\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tPrimarySaleItemsCountQueryOptions,\n\t\t\t'primarySaleContractAddress' | 'chainId' | 'config'\n\t\t>\n\t>,\n) => {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getPrimarySaleItemsCountQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'primarySaleContractAddress',\n\t\t\t\t'chainId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchPrimarySaleItemsCount,\n\t\t},\n\t\tparams,\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,eAAsB,0BACrB,QAIC;CACD,MAAM,EACL,SACA,aACA,mBACA,SACA,iBACA,WACG;CACJ,MAAM,gBAAgB,iBAAiB,SAAS,OAAO;CACvD,MAAM,wBAAwB,mBAAmB;AACjD,QAAO,cACL,iBAAiB;EACjB,gBAAgB;EAChB,iBAAiB;EACjB;EACA,iBAAiB;EACjB,GAAI,yBAAyB,EAC5B,iBAAiB,EAChB,cAAc,MACd,EACD;EACD,CAAC,CACD,MAAM,QAAQ,IAAI,SAAS,MAAM,KAAK;;;;;;AAOzC,SAAgB,gCACf,QACC;CACD,MAAM,wBAAwB,OAAO,mBAAmB;AAcxD,QAAO,0BAA0B,WAbjB;EACf,SAAS,OAAO;EAChB,gBAAgB,OAAO;EACvB,iBA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ACA;EACA,CAAC;;AAGH,SAAgB,4BACf,QACC;AACD,QAAO;EACN;EACA;EACA;GACC,SAAS,OAAO,WAAW;GAC3B,4BAA4B,OAAO,8BAA8B;GACjE,QAAQ,OAAO;GACf;EACD;;AAGF,MAAa,gCACZ,WACI;CACJ,MAAM,UAAU,QACf,OAAO,8BACN,OAAO,WACP,OAAO,WACN,OAAO,OAAO,WAAW,MAC3B;CAGD,MAAMC,cAAyB,OAAO,QAAQ;EAAE,MAAM;EAAG,UAAU;EAAI;CAEvE,MAAM,UAAU,OAAO,EAAE,gBAA0C;EAClE,MAAM,iBAAiB;AAIvB,SAAO,sBAAsB;GAC5B,SAAS,eAAe;GACxB,4BAA4B,eAAe;GAC3C,QAAQ,OAAO;GACf,MAAM;GACN,QAAQ,eAAe;GACvB,CAAC;;AAGH,QAAO,qBAAqB;EAC3B,UAAU,4BAA4B,OAAO;EAC7C;EACA,kBAAkB;EAClB,mBAAmB,aAClB,SAAS,MAAM,OACZ;GACA,MAAM,SAAS,KAAK,OAAO;GAC3B,UAAU,SAAS,KAAK;GACxB,MAAM;GACN,GACA;EACJ,GAAG,OAAO;EACV;EACA,CAAC;;;;;;;;ACvEH,eAAsB,2BACrB,QAI8C;CAC9C,MAAM,EAAE,QAAQ,GAAG,cAAc;AAEjC,QAD0B,qBAAqB,OAAO,CAC7B,2BAA2B,UAAU;;AAG/D,SAAgB,iCACf,QACC;AACD,QAAO;EACN;EACA;EACA;GACC,SAAS,OAAO,WAAW;GAC3B,4BAA4B,OAAO,8BAA8B;GACjE,QAAQ,OAAO;GACf;EACD;;AAGF,MAAa,qCACZ,WAMI;AACJ,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GACf;GACA;GACA;GACA;EACD,SAAS;EACT,EACD,OACA"}
|
|
1
|
+
{"version":3,"file":"collectible.js","names":["apiArgs: GetCountOfFilteredCollectiblesRequest","apiArgs","apiArgs: GetCountOfAllCollectiblesRequest","apiArgs: GetTokenMetadataArgs","initialPage: PageParam"],"sources":["../src/react/queries/collectible/balance.ts","../src/react/queries/collectible/market-count.ts","../src/react/queries/collectible/market-highest-offer.ts","../src/react/utils/normalizePriceFilters.ts","../src/react/queries/collectible/market-list.ts","../src/react/queries/collectible/market-list-paginated.ts","../src/react/queries/collectible/market-listings.ts","../src/react/queries/collectible/market-listings-count.ts","../src/react/queries/collectible/market-lowest-listing.ts","../src/react/queries/collectible/market-offers.ts","../src/react/queries/collectible/market-offers-count.ts","../src/react/queries/collectible/metadata.ts","../src/react/queries/collectible/primary-sale-item.ts","../src/react/queries/collectible/primary-sale-items.ts","../src/react/queries/collectible/primary-sale-items-count.ts"],"sourcesContent":["import type { GetBalanceOfCollectibleRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetIndexerClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createCollectibleQueryKey } from './queryKeys';\n\nexport type FetchBalanceOfCollectibleParams = GetBalanceOfCollectibleRequest;\n\nexport type BalanceOfCollectibleQueryOptions =\n\tSdkQueryParams<FetchBalanceOfCollectibleParams>;\n\n/**\n * Fetches the balance of a specific collectible for a user\n *\n * @param params - Parameters for the API call\n * @returns The balance data\n */\nexport async function fetchBalanceOfCollectible(\n\tparams: WithRequired<\n\t\tBalanceOfCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'userAddress' | 'config'\n\t>,\n) {\n\tconst {\n\t\tchainId,\n\t\tuserAddress,\n\t\tcollectionAddress,\n\t\ttokenId,\n\t\tincludeMetadata,\n\t\tconfig,\n\t} = params;\n\tconst indexerClient = getIndexerClient(chainId, config);\n\tconst shouldIncludeMetadata = includeMetadata ?? false;\n\treturn indexerClient\n\t\t.getTokenBalances({\n\t\t\taccountAddress: userAddress,\n\t\t\tcontractAddress: collectionAddress,\n\t\t\ttokenId,\n\t\t\tincludeMetadata: shouldIncludeMetadata,\n\t\t\t...(shouldIncludeMetadata && {\n\t\t\t\tmetadataOptions: {\n\t\t\t\t\tverifiedOnly: true,\n\t\t\t\t},\n\t\t\t}),\n\t\t})\n\t\t.then((res) => res.balances[0] || null);\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'balance', { chainId, accountAddress, contractAddress, tokenID }]\n */\nexport function getBalanceOfCollectibleQueryKey(\n\tparams: BalanceOfCollectibleQueryOptions,\n) {\n\tconst shouldIncludeMetadata = params.includeMetadata ?? false;\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\taccountAddress: params.userAddress,\n\t\tcontractAddress: params.collectionAddress,\n\t\ttokenId: params.tokenId,\n\t\tincludeMetadata: shouldIncludeMetadata,\n\t\t...(shouldIncludeMetadata && {\n\t\t\tmetadataOptions: {\n\t\t\t\tverifiedOnly: true,\n\t\t\t},\n\t\t}),\n\t};\n\n\treturn createCollectibleQueryKey('balance', apiArgs);\n}\n\n/**\n * Creates a tanstack query options object for the balance query\n *\n * @param params - The query parameters\n * @returns Query options configuration\n */\nexport function balanceOfCollectibleOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tBalanceOfCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'userAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getBalanceOfCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'userAddress',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'chainId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchBalanceOfCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress &&\n\t\t\t\tisAddress(p.collectionAddress) &&\n\t\t\t\tp.tokenId !== undefined &&\n\t\t\t\tp.tokenId >= 0n &&\n\t\t\t\t!!p.userAddress &&\n\t\t\t\tisAddress(p.userAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tGetCountOfAllCollectiblesRequest,\n\tGetCountOfFilteredCollectiblesRequest,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCountOfCollectablesParams = GetCountOfAllCollectiblesRequest &\n\tPartial<Pick<GetCountOfFilteredCollectiblesRequest, 'filter' | 'side'>>;\n\nexport type CountOfCollectablesQueryOptions =\n\tSdkQueryParams<FetchCountOfCollectablesParams>;\n\n/**\n * Fetches count of collectibles from the marketplace API\n */\nexport async function fetchCountOfCollectables(\n\tparams: WithRequired<\n\t\tCountOfCollectablesQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'config'\n\t>,\n) {\n\tconst { collectionAddress, chainId, config, filter, side } = params;\n\n\tconst client = getMarketplaceClient(config);\n\n\tif (filter && side) {\n\t\tconst apiArgs: GetCountOfFilteredCollectiblesRequest = {\n\t\t\tcollectionAddress,\n\t\t\tchainId,\n\t\t\tfilter,\n\t\t\tside,\n\t\t};\n\n\t\tconst result = await client.getCountOfFilteredCollectibles(apiArgs);\n\t\treturn result.count;\n\t}\n\n\tconst apiArgs: GetCountOfAllCollectiblesRequest = {\n\t\tcollectionAddress,\n\t\tchainId,\n\t};\n\n\tconst result = await client.getCountOfAllCollectibles(apiArgs);\n\treturn result.count;\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'market-count', { chainId, contractAddress, filter?, side? }]\n */\nexport function getCountOfCollectablesQueryKey(\n\tparams: CountOfCollectablesQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\tfilter: params.filter,\n\t\t\tside: params.side,\n\t\t},\n\t] as const;\n}\n\nexport function countOfCollectablesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCountOfCollectablesQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCountOfCollectablesQueryKey,\n\t\t\trequiredParams: ['chainId', 'collectionAddress', 'config'] as const,\n\t\t\tfetcher: fetchCountOfCollectables,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Order } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype GetHighestPriceOfferForCollectibleRequest,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type HighestOfferQueryOptions =\n\tSdkQueryParams<GetHighestPriceOfferForCollectibleRequest>;\n\nexport async function fetchHighestOffer(\n\tparams: WithRequired<\n\t\tHighestOfferQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<Order | null> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\tconst result =\n\t\tawait marketplaceClient.getHighestPriceOfferForCollectible(apiParams);\n\t// TanStack Query v5 requires non-undefined return values\n\treturn result.order ?? null;\n}\n\nexport function getHighestOfferQueryKey(params: HighestOfferQueryOptions) {\n\treturn [\n\t\t'collectible',\n\t\t'market-highest-offer',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function highestOfferQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tHighestOfferQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n): ReturnType<\n\ttypeof buildQueryOptions<\n\t\tWithRequired<\n\t\t\tHighestOfferQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>,\n\t\tOrder | null,\n\t\treadonly ['chainId', 'collectionAddress', 'tokenId', 'config']\n\t>\n> {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getHighestOfferQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchHighestOffer,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { PriceFilter } from '../ssr';\n\ntype PriceLike = {\n\tcontractAddress: string;\n\tmin?: string | bigint;\n\tmax?: string | bigint;\n};\n\nfunction normalizePriceFilters(\n\tfilters?: PriceLike[],\n): PriceFilter[] | undefined {\n\tif (!filters) return undefined;\n\n\treturn filters.map(({ contractAddress, min, max }) => ({\n\t\tcontractAddress,\n\t\t...(min !== undefined && {\n\t\t\tmin: typeof min === 'bigint' ? min : BigInt(min),\n\t\t}),\n\t\t...(max !== undefined && {\n\t\t\tmax: typeof max === 'bigint' ? max : BigInt(max),\n\t\t}),\n\t}));\n}\n\nexport { normalizePriceFilters };\n","import { isAddress } from 'viem';\nimport type { Page } from '../../../types';\nimport type { CardType } from '../../../types/types';\nimport { findMarketCollection } from '../../../utils';\nimport type {\n\tListCollectiblesRequest,\n\tListCollectiblesResponse,\n} from '../../_internal';\nimport {\n\tbuildInfiniteQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkInfiniteQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { normalizePriceFilters } from '../../utils/normalizePriceFilters';\nimport { fetchMarketplaceConfig } from '../marketplace/config';\n\nexport type ListCollectiblesQueryOptions = SdkInfiniteQueryParams<\n\tListCollectiblesRequest & {\n\t\tcardType?: CardType;\n\t\tenabled?: boolean;\n\t}\n>;\n\n/**\n * Fetches a list of collectibles with pagination support from the Marketplace API\n */\nexport async function fetchListCollectibles(\n\tparams: WithRequired<\n\t\tListCollectiblesQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'side' | 'config'\n\t>,\n\tpage: Page,\n): Promise<ListCollectiblesResponse> {\n\tconst { chainId, collectionAddress, config, filter, ...additionalApiParams } =\n\t\tparams;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\tconst marketplaceConfig = await fetchMarketplaceConfig({ config });\n\tconst isMarketCollection = !!findMarketCollection(\n\t\tmarketplaceConfig?.market.collections ?? [],\n\t\tcollectionAddress,\n\t\tchainId,\n\t);\n\n\t// If it's not a market collection, return an empty list. those collections are not compatible with the ListCollectibles endpoint.\n\tif (params.enabled === false || !isMarketCollection) {\n\t\treturn {\n\t\t\tcollectibles: [],\n\t\t\tpage: {\n\t\t\t\tpage: 1,\n\t\t\t\tpageSize: 30,\n\t\t\t\tmore: false,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Transform price filters from strings to BigInt for API\n\tconst transformedFilter = filter\n\t\t? {\n\t\t\t\t...filter,\n\t\t\t\tprices: normalizePriceFilters(filter.prices),\n\t\t\t}\n\t\t: undefined;\n\n\treturn await marketplaceClient.listCollectibles({\n\t\tchainId,\n\t\tcollectionAddress,\n\t\tpage,\n\t\tfilter: transformedFilter,\n\t\t...additionalApiParams,\n\t});\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'market-list', { chainId, contractAddress, side, filter }]\n */\nexport function getListCollectiblesQueryKey(\n\tparams: ListCollectiblesQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-list',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\tside: params.side,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function listCollectiblesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListCollectiblesQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'side' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildInfiniteQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListCollectiblesQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'side',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListCollectibles,\n\t\t\tgetPageInfo: (response) => response.page,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import { isAddress } from 'viem';\nimport type {\n\tListCollectiblesRequest,\n\tListCollectiblesResponse,\n} from '../../_internal';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { normalizePriceFilters } from '../../utils/normalizePriceFilters';\n\nexport type FetchListCollectiblesPaginatedParams = Omit<\n\tListCollectiblesRequest,\n\t'page'\n> & {\n\tpage?: number;\n\tpageSize?: number;\n};\n\nexport type ListCollectiblesPaginatedQueryOptions =\n\tSdkQueryParams<FetchListCollectiblesPaginatedParams>;\n\n/**\n * Fetches a list of collectibles with pagination support from the Marketplace API\n */\nexport async function fetchListCollectiblesPaginated(\n\tparams: WithRequired<\n\t\tListCollectiblesPaginatedQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'side' | 'config'\n\t>,\n): Promise<ListCollectiblesResponse> {\n\tconst {\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tconfig,\n\t\tpage = 1,\n\t\tpageSize = 30,\n\t\tfilter,\n\t\t...additionalApiParams\n\t} = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\t// Transform price filters from strings to BigInt for API\n\tconst transformedFilter = filter\n\t\t? {\n\t\t\t\t...filter,\n\t\t\t\tprices: normalizePriceFilters(filter.prices),\n\t\t\t}\n\t\t: undefined;\n\n\treturn await marketplaceClient.listCollectibles({\n\t\tcollectionAddress,\n\t\tchainId,\n\t\tpage: {\n\t\t\tpage,\n\t\t\tpageSize,\n\t\t},\n\t\tfilter: transformedFilter,\n\t\t...additionalApiParams,\n\t});\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'market-list-paginated', { chainId, contractAddress, side, filter, page }]\n */\nexport function getListCollectiblesPaginatedQueryKey(\n\tparams: ListCollectiblesPaginatedQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-list-paginated',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\tside: params.side,\n\t\t\tfilter: params.filter,\n\t\t\tpage: params.page,\n\t\t\tpageSize: params.pageSize,\n\t\t},\n\t] as const;\n}\n\nexport function listCollectiblesPaginatedQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListCollectiblesPaginatedQueryOptions,\n\t\t\t'collectionAddress' | 'chainId' | 'side' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListCollectiblesPaginatedQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'collectionAddress',\n\t\t\t\t'chainId',\n\t\t\t\t'side',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListCollectiblesPaginated,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tListCollectibleListingsResponse,\n\tListListingsForCollectibleRequest,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type ListListingsForCollectibleQueryOptions =\n\tSdkQueryParams<ListListingsForCollectibleRequest>;\n\n/**\n * Fetches listings for a specific collectible from the Marketplace API\n */\nexport async function fetchListListingsForCollectible(\n\tparams: WithRequired<\n\t\tListListingsForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<ListCollectibleListingsResponse> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn await marketplaceClient.listListingsForCollectible(apiParams);\n}\n\nexport function getListListingsForCollectibleQueryKey(\n\tparams: ListListingsForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-listings',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t\tpage: params.page,\n\t\t},\n\t] as const;\n}\n\nexport function listListingsForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListListingsForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListListingsForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListListingsForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { GetCountOfListingsForCollectibleRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCountListingsForCollectibleParams =\n\tGetCountOfListingsForCollectibleRequest;\n\nexport type CountListingsForCollectibleQueryOptions =\n\tSdkQueryParams<FetchCountListingsForCollectibleParams>;\n\n/**\n * Fetches count of listings for a collectible from the marketplace API\n */\nexport async function fetchCountListingsForCollectible(\n\tparams: WithRequired<\n\t\tCountListingsForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n) {\n\tconst { config, ...apiParams } = params;\n\tconst client = getMarketplaceClient(config);\n\tconst result = await client.getCountOfListingsForCollectible(apiParams);\n\treturn result.count;\n}\n\nexport function getCountListingsForCollectibleQueryKey(\n\tparams: CountListingsForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-listings-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function countListingsForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCountListingsForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCountListingsForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchCountListingsForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Order } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype GetLowestPriceListingForCollectibleRequest,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type LowestListingQueryOptions =\n\tSdkQueryParams<GetLowestPriceListingForCollectibleRequest>;\n\nexport async function fetchLowestListing(\n\tparams: WithRequired<\n\t\tLowestListingQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<Order | null> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\tconst result =\n\t\tawait marketplaceClient.getLowestPriceListingForCollectible(apiParams);\n\t// TanStack Query v5 requires non-undefined return values\n\treturn result.order ?? null;\n}\n\nexport function getLowestListingQueryKey(params: LowestListingQueryOptions) {\n\treturn [\n\t\t'collectible',\n\t\t'market-lowest-listing',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function lowestListingQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tLowestListingQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n): ReturnType<\n\ttypeof buildQueryOptions<\n\t\tWithRequired<\n\t\t\tLowestListingQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>,\n\t\tOrder | null,\n\t\treadonly ['chainId', 'collectionAddress', 'tokenId', 'config']\n\t>\n> {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getLowestListingQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchLowestListing,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import { isAddress } from 'viem';\nimport type {\n\tListCollectibleOffersResponse,\n\tListOffersForCollectibleRequest,\n\tPage,\n\tSortBy,\n\tWithOptionalParams,\n} from '../../_internal';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type ListOffersForCollectibleQueryOptions = SdkQueryParams<\n\tListOffersForCollectibleRequest & {\n\t\tsort?: Array<SortBy>;\n\t}\n>;\n\n/**\n * Fetches offers for a specific collectible from the Marketplace API\n */\nexport async function fetchListOffersForCollectible(\n\tparams: WithRequired<\n\t\tListOffersForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<ListCollectibleOffersResponse> {\n\tconst { config, sort, page, ...additionalApiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tconst effectiveSort =\n\t\tsort || (page && 'sort' in page ? page.sort : undefined);\n\n\treturn await marketplaceClient.listOffersForCollectible({\n\t\t...additionalApiParams,\n\t\tpage:\n\t\t\tpage || effectiveSort\n\t\t\t\t? ({\n\t\t\t\t\t\tpage: page?.page ?? 1,\n\t\t\t\t\t\tpageSize: page?.pageSize ?? 20,\n\t\t\t\t\t\t...(page?.more && { more: page.more }),\n\t\t\t\t\t\t...(effectiveSort && { sort: effectiveSort }),\n\t\t\t\t\t} as Page)\n\t\t\t\t: undefined,\n\t});\n}\n\nexport function getListOffersForCollectibleQueryKey(\n\tparams: ListOffersForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-offers',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t\tpage: params.page,\n\t\t},\n\t] as const;\n}\n\nexport function listOffersForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tListOffersForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getListOffersForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchListOffersForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { GetCountOfOffersForCollectibleRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCountOffersForCollectibleParams =\n\tGetCountOfOffersForCollectibleRequest;\n\nexport type CountOffersForCollectibleQueryOptions =\n\tSdkQueryParams<FetchCountOffersForCollectibleParams>;\n\n/**\n * Fetches count of offers for a collectible from the marketplace API\n */\nexport async function fetchCountOffersForCollectible(\n\tparams: WithRequired<\n\t\tCountOffersForCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n) {\n\tconst { config, ...apiParams } = params;\n\tconst client = getMarketplaceClient(config);\n\tconst result = await client.getCountOfOffersForCollectible(apiParams);\n\treturn result.count;\n}\n\nexport function getCountOffersForCollectibleQueryKey(\n\tparams: CountOffersForCollectibleQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'market-offers-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tcollectionAddress: params.collectionAddress ?? '',\n\t\t\ttokenId: params.tokenId ?? 0n,\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport function countOffersForCollectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCountOffersForCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCountOffersForCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchCountOffersForCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.collectionAddress && isAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tGetSingleTokenMetadataArgs,\n\tGetTokenMetadataArgs,\n\tTokenMetadata,\n} from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\tgetMetadataClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createCollectibleQueryKey } from './queryKeys';\n\nexport type FetchCollectibleParams = GetSingleTokenMetadataArgs;\n\nexport type CollectibleQueryOptions = SdkQueryParams<FetchCollectibleParams>;\n\n/**\n * Fetches collectible metadata from the metadata API\n */\nexport async function fetchCollectible(\n\tparams: WithRequired<\n\t\tCollectibleQueryOptions,\n\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<TokenMetadata | undefined> {\n\tconst { tokenId, chainId, collectionAddress, config } = params;\n\n\tconst metadataClient = getMetadataClient(config);\n\n\tconst apiArgs: GetTokenMetadataArgs = {\n\t\tchainId,\n\t\tcontractAddress: collectionAddress,\n\t\ttokenIds: [tokenId],\n\t};\n\n\tconst result = await metadataClient.getTokenMetadata(apiArgs);\n\t// TanStack Query v5 requires non-undefined return values\n\treturn result.tokenMetadata[0] ?? null;\n}\n\n/**\n * Query key structure: [resource, operation, params]\n * @example ['collectible', 'metadata', { chainId, contractAddress, tokenIds }]\n */\nexport function getCollectibleQueryKey(params: CollectibleQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcontractAddress: params.collectionAddress,\n\t\ttokenIds: params.tokenId !== undefined ? [params.tokenId] : [],\n\t};\n\n\treturn createCollectibleQueryKey('metadata', apiArgs);\n}\n\nexport function collectibleQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tCollectibleQueryOptions,\n\t\t\t'chainId' | 'collectionAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCollectibleQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'collectionAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchCollectible,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.chainId &&\n\t\t\t\tp.chainId > 0 &&\n\t\t\t\t!!p.collectionAddress &&\n\t\t\t\tisAddress(p.collectionAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n","import type {\n\tCollectiblePrimarySaleItem,\n\tGetPrimarySaleItemRequest,\n\tGetPrimarySaleItemResponse,\n\tTokenId,\n} from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { createCollectibleQueryKey } from './queryKeys';\n\nexport type FetchPrimarySaleItemParams = Omit<\n\tGetPrimarySaleItemRequest,\n\t'tokenId'\n> & {\n\ttokenId: TokenId | string;\n};\n\nexport type PrimarySaleItemQueryOptions =\n\tSdkQueryParams<FetchPrimarySaleItemParams>;\n\n/**\n * Fetches a single primary sale item from the marketplace API\n */\nexport async function fetchPrimarySaleItem(\n\tparams: WithRequired<\n\t\tPrimarySaleItemQueryOptions,\n\t\t'chainId' | 'primarySaleContractAddress' | 'tokenId' | 'config'\n\t>,\n): Promise<GetPrimarySaleItemResponse> {\n\tconst { chainId, primarySaleContractAddress, tokenId, config } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn marketplaceClient.getPrimarySaleItem({\n\t\tchainId,\n\t\tprimarySaleContractAddress,\n\t\ttokenId: BigInt(tokenId),\n\t});\n}\n\nexport function getPrimarySaleItemQueryKey(\n\tparams: PrimarySaleItemQueryOptions,\n) {\n\treturn createCollectibleQueryKey('primary-sale-item', {\n\t\tchainId: params.chainId ?? 0,\n\t\tprimarySaleContractAddress: params.primarySaleContractAddress ?? '',\n\t\ttokenId: params.tokenId?.toString() ?? '',\n\t});\n}\n\nexport function primarySaleItemQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tPrimarySaleItemQueryOptions,\n\t\t\t'chainId' | 'primarySaleContractAddress' | 'tokenId' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getPrimarySaleItemQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'primarySaleContractAddress',\n\t\t\t\t'tokenId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchPrimarySaleItem,\n\t\t},\n\t\tparams,\n\t);\n}\n\nexport type { CollectiblePrimarySaleItem, GetPrimarySaleItemResponse };\n","import type {\n\tListPrimarySaleItemsRequest,\n\tListPrimarySaleItemsResponse,\n} from '@0xsequence/api-client';\nimport { infiniteQueryOptions } from '@tanstack/react-query';\nimport {\n\tgetMarketplaceClient,\n\ttype SdkInfiniteQueryParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchPrimarySaleItemsParams = ListPrimarySaleItemsRequest;\n\nexport type ListPrimarySaleItemsQueryOptions =\n\tSdkInfiniteQueryParams<FetchPrimarySaleItemsParams>;\n\n/**\n * Fetches primary sale items from the marketplace API\n */\nexport async function fetchPrimarySaleItems(\n\tparams: WithRequired<\n\t\tListPrimarySaleItemsQueryOptions,\n\t\t'chainId' | 'primarySaleContractAddress' | 'config'\n\t>,\n): Promise<ListPrimarySaleItemsResponse> {\n\tconst { chainId, primarySaleContractAddress, filter, page, config } = params;\n\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\treturn marketplaceClient.listPrimarySaleItems({\n\t\tchainId,\n\t\tprimarySaleContractAddress,\n\t\tfilter,\n\t\tpage,\n\t});\n}\n\nexport function getPrimarySaleItemsQueryKey(\n\tparams: ListPrimarySaleItemsQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'primary-sale-items',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tprimarySaleContractAddress: params.primarySaleContractAddress ?? '',\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport const primarySaleItemsQueryOptions = (\n\tparams: ListPrimarySaleItemsQueryOptions,\n) => {\n\tconst enabled = Boolean(\n\t\tparams.primarySaleContractAddress &&\n\t\t\tparams.chainId &&\n\t\t\tparams.config &&\n\t\t\t(params.query?.enabled ?? true),\n\t);\n\n\ttype PageParam = { page: number; pageSize: number };\n\tconst initialPage: PageParam = params.page || { page: 1, pageSize: 30 };\n\n\tconst queryFn = async ({ pageParam }: { pageParam: PageParam }) => {\n\t\tconst requiredParams = params as WithRequired<\n\t\t\tListPrimarySaleItemsQueryOptions,\n\t\t\t'chainId' | 'primarySaleContractAddress' | 'config'\n\t\t>;\n\t\treturn fetchPrimarySaleItems({\n\t\t\tchainId: requiredParams.chainId,\n\t\t\tprimarySaleContractAddress: requiredParams.primarySaleContractAddress,\n\t\t\tfilter: params.filter,\n\t\t\tpage: pageParam,\n\t\t\tconfig: requiredParams.config,\n\t\t});\n\t};\n\n\treturn infiniteQueryOptions({\n\t\tqueryKey: getPrimarySaleItemsQueryKey(params),\n\t\tqueryFn,\n\t\tinitialPageParam: initialPage,\n\t\tgetNextPageParam: (lastPage) =>\n\t\t\tlastPage.page?.more\n\t\t\t\t? {\n\t\t\t\t\t\tpage: lastPage.page.page + 1,\n\t\t\t\t\t\tpageSize: lastPage.page.pageSize,\n\t\t\t\t\t\tmore: true,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t...params.query,\n\t\tenabled,\n\t});\n};\n\nexport type { ListPrimarySaleItemsRequest, ListPrimarySaleItemsResponse };\n","import type {\n\tGetCountOfPrimarySaleItemsRequest,\n\tGetCountOfPrimarySaleItemsResponse,\n} from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchPrimarySaleItemsCountParams =\n\tGetCountOfPrimarySaleItemsRequest;\n\nexport type PrimarySaleItemsCountQueryOptions =\n\tSdkQueryParams<FetchPrimarySaleItemsCountParams>;\n\n/**\n * Fetches the count of primary sale items from the marketplace API\n */\nexport async function fetchPrimarySaleItemsCount(\n\tparams: WithRequired<\n\t\tPrimarySaleItemsCountQueryOptions,\n\t\t'chainId' | 'primarySaleContractAddress' | 'config'\n\t>,\n): Promise<GetCountOfPrimarySaleItemsResponse> {\n\tconst { config, ...apiParams } = params;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\treturn marketplaceClient.getCountOfPrimarySaleItems(apiParams);\n}\n\nexport function getPrimarySaleItemsCountQueryKey(\n\tparams: PrimarySaleItemsCountQueryOptions,\n) {\n\treturn [\n\t\t'collectible',\n\t\t'primary-sale-items-count',\n\t\t{\n\t\t\tchainId: params.chainId ?? 0,\n\t\t\tprimarySaleContractAddress: params.primarySaleContractAddress ?? '',\n\t\t\tfilter: params.filter,\n\t\t},\n\t] as const;\n}\n\nexport const primarySaleItemsCountQueryOptions = (\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tPrimarySaleItemsCountQueryOptions,\n\t\t\t'primarySaleContractAddress' | 'chainId' | 'config'\n\t\t>\n\t>,\n) => {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getPrimarySaleItemsCountQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'primarySaleContractAddress',\n\t\t\t\t'chainId',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchPrimarySaleItemsCount,\n\t\t},\n\t\tparams,\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,eAAsB,0BACrB,QAIC;CACD,MAAM,EACL,SACA,aACA,mBACA,SACA,iBACA,WACG;CACJ,MAAM,gBAAgB,iBAAiB,SAAS,OAAO;CACvD,MAAM,wBAAwB,mBAAmB;AACjD,QAAO,cACL,iBAAiB;EACjB,gBAAgB;EAChB,iBAAiB;EACjB;EACA,iBAAiB;EACjB,GAAI,yBAAyB,EAC5B,iBAAiB,EAChB,cAAc,MACd,EACD;EACD,CAAC,CACD,MAAM,QAAQ,IAAI,SAAS,MAAM,KAAK;;;;;;AAOzC,SAAgB,gCACf,QACC;CACD,MAAM,wBAAwB,OAAO,mBAAmB;AAcxD,QAAO,0BAA0B,WAbjB;EACf,SAAS,OAAO;EAChB,gBAAgB,OAAO;EACvB,iBAAiB,OAAO;EACxB,SAAS,OAAO;EAChB,iBAAiB;EACjB,GAAI,yBAAyB,EAC5B,iBAAiB,EAChB,cAAc,MACd,EACD;EACD,CAEmD;;;;;;;;AASrD,SAAgB,4BACf,QAMC;AACD,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GACf;GACA;GACA;GACA;GACA;GACA;EACD,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,qBACJ,UAAU,EAAE,kBAAkB,IAC9B,EAAE,YAAY,UACd,EAAE,WAAW,MACb,CAAC,CAAC,EAAE,eACJ,UAAU,EAAE,YAAY;EACzB,EACD,OACA;;;;;;;;ACzFF,eAAsB,yBACrB,QAIC;CACD,MAAM,EAAE,mBAAmB,SAAS,QAAQ,QAAQ,SAAS;CAE7D,MAAM,SAAS,qBAAqB,OAAO;AAE3C,KAAI,UAAU,MAA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AA4B,OAAO;EAC7C;EACA,kBAAkB;EAClB,mBAAmB,aAClB,SAAS,MAAM,OACZ;GACA,MAAM,SAAS,KAAK,OAAO;GAC3B,UAAU,SAAS,KAAK;GACxB,MAAM;GACN,GACA;EACJ,GAAG,OAAO;EACV;EACA,CAAC;;;;;;;;ACvEH,eAAsB,2BACrB,QAI8C;CAC9C,MAAM,EAAE,QAAQ,GAAG,cAAc;AAEjC,QAD0B,qBAAqB,OAAO,CAC7B,2BAA2B,UAAU;;AAG/D,SAAgB,iCACf,QACC;AACD,QAAO;EACN;EACA;EACA;GACC,SAAS,OAAO,WAAW;GAC3B,4BAA4B,OAAO,8BAA8B;GACjE,QAAQ,OAAO;GACf;EACD;;AAGF,MAAa,qCACZ,WAMI;AACJ,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GACf;GACA;GACA;GACA;EACD,SAAS;EACT,EACD,OACA"}
|
package/dist/collection.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as compareAddress } from "./utils.js";
|
|
2
2
|
import { h as serializeBigInts, i as getMetadataClient, n as getIndexerClient, r as getMarketplaceClient } from "./api.js";
|
|
3
3
|
import { n as buildInfiniteQueryOptions, r as buildQueryOptions } from "./_internal.js";
|
|
4
4
|
import { isAddress } from "viem";
|
package/dist/create-config.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { CreateConnectorFn, State } from "wagmi";
|
|
|
8
8
|
import React$1, { ComponentType, FunctionComponent, JSX, ReactNode, SVGProps } from "react";
|
|
9
9
|
import "react/jsx-runtime";
|
|
10
10
|
import { AddEthereumChainParameter, Address, BaseError, BaseErrorType, Chain, Client, EIP1193RequestFn, Hex, ProviderConnectInfo, ProviderMessage, PublicClient, Transport } from "viem";
|
|
11
|
-
import * as
|
|
11
|
+
import * as _tanstack_react_query418 from "@tanstack/react-query";
|
|
12
12
|
import { QueryClient, QueryKey, UseQueryResult } from "@tanstack/react-query";
|
|
13
13
|
import { SequenceAPIClient } from "@0xsequence/api";
|
|
14
14
|
import { VariantProps } from "class-variance-authority";
|
|
@@ -41,8 +41,8 @@ declare const fetchMarketplaceConfig: ({
|
|
|
41
41
|
config: SdkConfig;
|
|
42
42
|
prefetchedMarketplaceSettings?: index_d_exports.LookupMarketplaceReturn;
|
|
43
43
|
}) => Promise<MarketplaceConfig>;
|
|
44
|
-
declare const marketplaceConfigOptions: (config: SdkConfig) =>
|
|
45
|
-
queryFn?:
|
|
44
|
+
declare const marketplaceConfigOptions: (config: SdkConfig) => _tanstack_react_query418.OmitKeyof<_tanstack_react_query418.UseQueryOptions<MarketplaceConfig, Error, MarketplaceConfig, readonly ["marketplace", string, {}]>, "queryFn"> & {
|
|
45
|
+
queryFn?: _tanstack_react_query418.QueryFunction<MarketplaceConfig, readonly ["marketplace", string, {}], never> | undefined;
|
|
46
46
|
} & {
|
|
47
47
|
queryKey: readonly ["marketplace", string, {}] & {
|
|
48
48
|
[dataTagSymbol]: MarketplaceConfig;
|
|
@@ -277,8 +277,8 @@ declare function buildQueryOptions<TParams extends BaseQueryParams, TData, const
|
|
|
277
277
|
requiredParams: TKeys & (RequiredKeys<TParams> extends TKeys[number] ? TKeys : never);
|
|
278
278
|
fetcher: (params: TParams) => Promise<TData>;
|
|
279
279
|
customValidation?: (params: WithOptionalParams<TParams>) => boolean;
|
|
280
|
-
}, params: WithOptionalParams<TParams>):
|
|
281
|
-
queryFn?:
|
|
280
|
+
}, params: WithOptionalParams<TParams>): _tanstack_react_query418.OmitKeyof<_tanstack_react_query418.UseQueryOptions<TData, Error, TData, readonly unknown[]>, "queryFn"> & {
|
|
281
|
+
queryFn?: _tanstack_react_query418.QueryFunction<TData, readonly unknown[], never> | undefined;
|
|
282
282
|
} & {
|
|
283
283
|
queryKey: readonly unknown[] & {
|
|
284
284
|
[dataTagSymbol]: TData;
|
|
@@ -296,11 +296,11 @@ declare function buildInfiniteQueryOptions<TParams extends BaseInfiniteQueryPara
|
|
|
296
296
|
fetcher: (params: TParams, page: Page$2) => Promise<TResponse>;
|
|
297
297
|
getPageInfo: (response: TResponse) => Page$2 | undefined;
|
|
298
298
|
customValidation?: (params: WithOptionalInfiniteParams<TParams>) => boolean;
|
|
299
|
-
}, params: WithOptionalInfiniteParams<TParams>):
|
|
300
|
-
queryFn?:
|
|
299
|
+
}, params: WithOptionalInfiniteParams<TParams>): _tanstack_react_query418.OmitKeyof<_tanstack_react_query418.UseInfiniteQueryOptions<TResponse, Error, _tanstack_react_query418.InfiniteData<TResponse, unknown>, readonly unknown[], Page$2>, "queryFn"> & {
|
|
300
|
+
queryFn?: _tanstack_react_query418.QueryFunction<TResponse, readonly unknown[], Page$2> | undefined;
|
|
301
301
|
} & {
|
|
302
302
|
queryKey: readonly unknown[] & {
|
|
303
|
-
[dataTagSymbol]:
|
|
303
|
+
[dataTagSymbol]: _tanstack_react_query418.InfiniteData<TResponse, unknown>;
|
|
304
304
|
[dataTagErrorSymbol]: Error;
|
|
305
305
|
};
|
|
306
306
|
};
|
package/dist/currency.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as findMarketCollection, u as compareAddress } from "./utils.js";
|
|
2
2
|
import { g as getQueryClient, r as getMarketplaceClient } from "./api.js";
|
|
3
3
|
import { r as buildQueryOptions } from "./_internal.js";
|
|
4
4
|
import { n as marketplaceConfigOptions } from "./config.js";
|
|
@@ -16,8 +16,8 @@ async function fetchMarketCurrencies(params) {
|
|
|
16
16
|
contractAddress: currency.contractAddress || zeroAddress
|
|
17
17
|
})));
|
|
18
18
|
if (collectionAddress) {
|
|
19
|
-
const currenciesOptions = (await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections
|
|
20
|
-
if (currenciesOptions) currencies = currencies.filter((currency) => currenciesOptions.
|
|
19
|
+
const currenciesOptions = findMarketCollection((await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections, collectionAddress, chainId)?.currencyOptions;
|
|
20
|
+
if (currenciesOptions) currencies = currencies.filter((currency) => currenciesOptions.some((option) => compareAddress(option, currency.contractAddress)));
|
|
21
21
|
}
|
|
22
22
|
if (!includeNativeCurrencyOption) currencies = currencies.filter((currency) => !currency.nativeCurrency);
|
|
23
23
|
return currencies;
|
package/dist/currency.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","names":["currency"],"sources":["../src/react/queries/currency/list.ts","../src/react/queries/currency/convert-to-usd.ts","../src/react/queries/currency/compare-prices.ts","../src/react/queries/currency/currency.ts"],"sourcesContent":["import type {\n\tAddress,\n\tCurrency,\n\tListCurrenciesRequest,\n} from '@0xsequence/api-client';\nimport { zeroAddress } from 'viem';\nimport { compareAddress } from '../../../utils';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketplaceConfigOptions } from '../marketplace/config';\n\nexport type FetchMarketCurrenciesParams = ListCurrenciesRequest & {\n\tincludeNativeCurrency?: boolean;\n\tcollectionAddress?: Address;\n};\n\nexport type MarketCurrenciesQueryOptions =\n\tSdkQueryParams<FetchMarketCurrenciesParams>;\n\n/**\n * Fetches supported currencies for a marketplace\n */\nexport async function fetchMarketCurrencies(\n\tparams: WithRequired<MarketCurrenciesQueryOptions, 'chainId' | 'config'>,\n): Promise<Currency[]> {\n\tconst { chainId, includeNativeCurrency, collectionAddress, config } = params;\n\tconst includeNativeCurrencyOption = includeNativeCurrency ?? true;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tlet currencies = await marketplaceClient\n\t\t.listCurrencies({\n\t\t\tchainId,\n\t\t})\n\t\t.then((resp) =>\n\t\t\tresp.currencies.map((currency) => ({\n\t\t\t\t...currency,\n\t\t\t\tcontractAddress: currency.contractAddress || zeroAddress,\n\t\t\t})),\n\t\t);\n\n\tif (collectionAddress) {\n\t\tconst queryClient = getQueryClient();\n\t\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\t\tmarketplaceConfigOptions(config),\n\t\t);\n\n\t\tconst currenciesOptions = marketplaceConfig.market.collections.find(\n\t\t\t(collection) =>\n\t\t\t\tcompareAddress(collection.itemsAddress, collectionAddress),\n\t\t)?.currencyOptions;\n\n\t\t// Filter currencies based on collection currency options\n\t\tif (currenciesOptions) {\n\t\t\tcurrencies = currencies.filter((currency) =>\n\t\t\t\tcurrenciesOptions.includes(currency.contractAddress),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!includeNativeCurrencyOption) {\n\t\tcurrencies = currencies.filter((currency) => !currency.nativeCurrency);\n\t}\n\n\treturn currencies;\n}\n\nexport function getMarketCurrenciesQueryKey(\n\tparams: MarketCurrenciesQueryOptions,\n) {\n\treturn [\n\t\t'currency',\n\t\t'list',\n\t\t{\n\t\t\tchainId: params.chainId,\n\t\t\tincludeNativeCurrency: params.includeNativeCurrency,\n\t\t\tcollectionAddress: params.collectionAddress,\n\t\t},\n\t] as const;\n}\n\nexport function marketCurrenciesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<MarketCurrenciesQueryOptions, 'chainId' | 'config'>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getMarketCurrenciesQueryKey,\n\t\t\trequiredParams: ['chainId', 'config'] as const,\n\t\t\tfetcher: fetchMarketCurrencies,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ChainId } from '@0xsequence/api-client';\nimport { formatUnits } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype Currency,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketCurrenciesQueryOptions } from './list';\n\nexport type FetchConvertPriceToUSDParams = {\n\tchainId: ChainId;\n\tcurrencyAddress: Address;\n\tamountRaw: string;\n};\n\nexport type ConvertPriceToUSDReturn = {\n\tusdAmount: number;\n\tusdAmountFormatted: string;\n};\n\nexport type ConvertPriceToUSDQueryOptions =\n\tSdkQueryParams<FetchConvertPriceToUSDParams>;\n\n/**\n * Converts a price amount from a specific currency to USD using exchange rates\n */\nexport async function fetchConvertPriceToUSD(\n\tparams: WithRequired<\n\t\tConvertPriceToUSDQueryOptions,\n\t\t'chainId' | 'currencyAddress' | 'amountRaw' | 'config'\n\t>,\n): Promise<ConvertPriceToUSDReturn> {\n\tconst { chainId, currencyAddress, amountRaw, config } = params;\n\n\tconst queryClient = getQueryClient();\n\tconst currencies = await queryClient.fetchQuery(\n\t\tmarketCurrenciesQueryOptions({\n\t\t\tchainId,\n\t\t\tconfig,\n\t\t}),\n\t);\n\n\tconst currencyDetails = currencies.find(\n\t\t(c: Currency) =>\n\t\t\tc.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currencyDetails) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\tconst amountDecimal = Number(\n\t\tformatUnits(BigInt(amountRaw), currencyDetails.decimals),\n\t);\n\tconst usdAmount = amountDecimal * currencyDetails.exchangeRate;\n\n\treturn {\n\t\tusdAmount,\n\t\tusdAmountFormatted: usdAmount.toFixed(2),\n\t};\n}\n\nexport function getConvertPriceToUSDQueryKey(\n\tparams: ConvertPriceToUSDQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcurrencyAddress: params.currencyAddress,\n\t\tamountRaw: params.amountRaw,\n\t};\n\n\treturn ['currency', 'convert-to-usd', apiArgs] as const;\n}\n\nexport function convertPriceToUSDQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tConvertPriceToUSDQueryOptions,\n\t\t\t'chainId' | 'currencyAddress' | 'amountRaw' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getConvertPriceToUSDQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'currencyAddress',\n\t\t\t\t'amountRaw',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchConvertPriceToUSD,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ChainId } from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { fetchConvertPriceToUSD } from './convert-to-usd';\n\nexport type FetchComparePricesParams = {\n\tchainId?: ChainId;\n\tpriceAmountRaw?: string;\n\tpriceCurrencyAddress?: Address;\n\tcompareToPriceAmountRaw?: string;\n\tcompareToPriceCurrencyAddress?: Address;\n};\n\nexport type ComparePricesReturn = {\n\tpercentageDifference: number;\n\tpercentageDifferenceFormatted: string;\n\tstatus: 'above' | 'same' | 'below';\n};\n\nexport type ComparePricesQueryOptions =\n\tSdkQueryParams<FetchComparePricesParams>;\n\n/**\n * Compares prices between different currencies by converting both to USD\n */\nexport async function fetchComparePrices(\n\tparams: WithRequired<\n\t\tComparePricesQueryOptions,\n\t\t| 'chainId'\n\t\t| 'priceAmountRaw'\n\t\t| 'priceCurrencyAddress'\n\t\t| 'compareToPriceAmountRaw'\n\t\t| 'compareToPriceCurrencyAddress'\n\t\t| 'config'\n\t>,\n): Promise<ComparePricesReturn> {\n\tconst {\n\t\tchainId,\n\t\tpriceAmountRaw,\n\t\tpriceCurrencyAddress,\n\t\tcompareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress,\n\t\tconfig,\n\t} = params;\n\n\tconst [priceUSD, compareToPriceUSD] = await Promise.all([\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: priceCurrencyAddress,\n\t\t\tamountRaw: priceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: compareToPriceCurrencyAddress,\n\t\t\tamountRaw: compareToPriceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t]);\n\n\tconst difference = priceUSD.usdAmount - compareToPriceUSD.usdAmount;\n\n\tif (compareToPriceUSD.usdAmount === 0) {\n\t\tthrow new Error('Cannot compare to zero price');\n\t}\n\n\tconst percentageDifference = (difference / compareToPriceUSD.usdAmount) * 100;\n\tconst isAbove = percentageDifference > 0;\n\tconst isSame = percentageDifference === 0;\n\n\treturn {\n\t\tpercentageDifference,\n\t\tpercentageDifferenceFormatted: Math.abs(percentageDifference).toFixed(2),\n\t\tstatus: isAbove ? 'above' : isSame ? 'same' : 'below',\n\t};\n}\n\nexport function getComparePricesQueryKey(params: ComparePricesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tpriceAmountRaw: params.priceAmountRaw,\n\t\tpriceCurrencyAddress: params.priceCurrencyAddress,\n\t\tcompareToPriceAmountRaw: params.compareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress,\n\t};\n\n\treturn ['currency', 'compare-prices', apiArgs] as const;\n}\n\nexport function comparePricesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tComparePricesQueryOptions,\n\t\t\t| 'chainId'\n\t\t\t| 'priceAmountRaw'\n\t\t\t| 'priceCurrencyAddress'\n\t\t\t| 'compareToPriceAmountRaw'\n\t\t\t| 'compareToPriceCurrencyAddress'\n\t\t\t| 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getComparePricesQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'priceAmountRaw',\n\t\t\t\t'priceCurrencyAddress',\n\t\t\t\t'compareToPriceAmountRaw',\n\t\t\t\t'compareToPriceCurrencyAddress',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchComparePrices,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ListCurrenciesRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype Currency,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCurrencyParams = ListCurrenciesRequest & {\n\tcurrencyAddress: Address;\n};\n\n/**\n * Fetches currency details from the marketplace API\n */\nexport async function fetchCurrency(\n\tparams: WithRequired<\n\t\tCurrencyQueryOptions,\n\t\t'chainId' | 'currencyAddress' | 'config'\n\t>,\n): Promise<Currency | undefined> {\n\tconst { chainId, currencyAddress, config } = params;\n\tconst queryClient = getQueryClient();\n\n\tlet currencies = queryClient.getQueryData<Currency[]>([\n\t\t'currency',\n\t\t'list',\n\t\tchainId,\n\t]);\n\n\tif (!currencies) {\n\t\tconst marketplaceClient = getMarketplaceClient(config);\n\t\tconst response = await marketplaceClient.listCurrencies({ chainId });\n\t\tcurrencies = response.currencies;\n\t}\n\n\tif (!currencies?.length) {\n\t\tthrow new Error('No currencies returned');\n\t}\n\tconst currency = currencies.find(\n\t\t(currency) =>\n\t\t\tcurrency.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currency) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\treturn currency;\n}\n\nexport type CurrencyQueryOptions = SdkQueryParams<FetchCurrencyParams>;\n\nexport function getCurrencyQueryKey(params: CurrencyQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId ?? 0),\n\t\tcurrencyAddress: params.currencyAddress ?? '',\n\t};\n\n\treturn ['currency', 'currency', apiArgs] as const;\n}\n\nexport function currencyQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<CurrencyQueryOptions, 'chainId' | 'currencyAddress' | 'config'>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCurrencyQueryKey,\n\t\t\trequiredParams: ['chainId', 'currencyAddress', 'config'] as const,\n\t\t\tfetcher: fetchCurrency,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.currencyA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,cACrB,QAIgC;CAChC,MAAM,EAAE,SAAS,iBAAiB,WAAW;CAG7C,IAAI,aAFgB,gBAAgB,CAEP,aAAyB;EACrD;EACA;EACA;EACA,CAAC;AAEF,KAAI,CAAC,WAGJ,eADiB,MADS,qBAAqB,OAAO,CACb,eAAe,EAAE,SAAS,CAAC,EAC9C;AAGvB,KAAI,CAAC,YAAY,OAChB,OAAM,IAAI,MAAM,yBAAyB;CAE1C,MAAM,WAAW,WAAW,MAC1B,eACAA,WAAS,gBAAgB,aAAa,KAAK,gBAAgB,aAAa,CACzE;AAED,KAAI,CAAC,SACJ,OAAM,IAAI,MAAM,qBAAqB;AAGtC,QAAO;;AAKR,SAAgB,oBAAoB,QAA8B;AAMjE,QAAO;EAAC;EAAY;EALJ;GACf,SAAS,OAAO,OAAO,WAAW,EAAE;GACpC,iBAAiB,OAAO,mBAAmB;GAC3C;EAEuC;;AAGzC,SAAgB,qBACf,QAGC;AACD,QAAO,kBACN;EACC,aAAa;EACb,gBAAgB;GAAC;GAAW;GAAmB;GAAS;EACxD,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,mBAAmB,UAAU,EAAE,gBAAgB;EACpD,EACD,OACA"}
|
|
1
|
+
{"version":3,"file":"currency.js","names":["currency"],"sources":["../src/react/queries/currency/list.ts","../src/react/queries/currency/convert-to-usd.ts","../src/react/queries/currency/compare-prices.ts","../src/react/queries/currency/currency.ts"],"sourcesContent":["import type {\n\tAddress,\n\tCurrency,\n\tListCurrenciesRequest,\n} from '@0xsequence/api-client';\nimport { zeroAddress } from 'viem';\nimport { compareAddress, findMarketCollection } from '../../../utils';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketplaceConfigOptions } from '../marketplace/config';\n\nexport type FetchMarketCurrenciesParams = ListCurrenciesRequest & {\n\tincludeNativeCurrency?: boolean;\n\tcollectionAddress?: Address;\n};\n\nexport type MarketCurrenciesQueryOptions =\n\tSdkQueryParams<FetchMarketCurrenciesParams>;\n\n/**\n * Fetches supported currencies for a marketplace\n */\nexport async function fetchMarketCurrencies(\n\tparams: WithRequired<MarketCurrenciesQueryOptions, 'chainId' | 'config'>,\n): Promise<Currency[]> {\n\tconst { chainId, includeNativeCurrency, collectionAddress, config } = params;\n\tconst includeNativeCurrencyOption = includeNativeCurrency ?? true;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tlet currencies = await marketplaceClient\n\t\t.listCurrencies({\n\t\t\tchainId,\n\t\t})\n\t\t.then((resp) =>\n\t\t\tresp.currencies.map((currency) => ({\n\t\t\t\t...currency,\n\t\t\t\tcontractAddress: currency.contractAddress || zeroAddress,\n\t\t\t})),\n\t\t);\n\n\tif (collectionAddress) {\n\t\tconst queryClient = getQueryClient();\n\t\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\t\tmarketplaceConfigOptions(config),\n\t\t);\n\n\t\tconst currenciesOptions = findMarketCollection(\n\t\t\tmarketplaceConfig.market.collections,\n\t\t\tcollectionAddress,\n\t\t\tchainId,\n\t\t)?.currencyOptions;\n\n\t\t// Filter currencies based on collection currency options\n\t\tif (currenciesOptions) {\n\t\t\tcurrencies = currencies.filter((currency) =>\n\t\t\t\tcurrenciesOptions.some((option) =>\n\t\t\t\t\tcompareAddress(option, currency.contractAddress),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!includeNativeCurrencyOption) {\n\t\tcurrencies = currencies.filter((currency) => !currency.nativeCurrency);\n\t}\n\n\treturn currencies;\n}\n\nexport function getMarketCurrenciesQueryKey(\n\tparams: MarketCurrenciesQueryOptions,\n) {\n\treturn [\n\t\t'currency',\n\t\t'list',\n\t\t{\n\t\t\tchainId: params.chainId,\n\t\t\tincludeNativeCurrency: params.includeNativeCurrency,\n\t\t\tcollectionAddress: params.collectionAddress,\n\t\t},\n\t] as const;\n}\n\nexport function marketCurrenciesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<MarketCurrenciesQueryOptions, 'chainId' | 'config'>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getMarketCurrenciesQueryKey,\n\t\t\trequiredParams: ['chainId', 'config'] as const,\n\t\t\tfetcher: fetchMarketCurrencies,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ChainId } from '@0xsequence/api-client';\nimport { formatUnits } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype Currency,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketCurrenciesQueryOptions } from './list';\n\nexport type FetchConvertPriceToUSDParams = {\n\tchainId: ChainId;\n\tcurrencyAddress: Address;\n\tamountRaw: string;\n};\n\nexport type ConvertPriceToUSDReturn = {\n\tusdAmount: number;\n\tusdAmountFormatted: string;\n};\n\nexport type ConvertPriceToUSDQueryOptions =\n\tSdkQueryParams<FetchConvertPriceToUSDParams>;\n\n/**\n * Converts a price amount from a specific currency to USD using exchange rates\n */\nexport async function fetchConvertPriceToUSD(\n\tparams: WithRequired<\n\t\tConvertPriceToUSDQueryOptions,\n\t\t'chainId' | 'currencyAddress' | 'amountRaw' | 'config'\n\t>,\n): Promise<ConvertPriceToUSDReturn> {\n\tconst { chainId, currencyAddress, amountRaw, config } = params;\n\n\tconst queryClient = getQueryClient();\n\tconst currencies = await queryClient.fetchQuery(\n\t\tmarketCurrenciesQueryOptions({\n\t\t\tchainId,\n\t\t\tconfig,\n\t\t}),\n\t);\n\n\tconst currencyDetails = currencies.find(\n\t\t(c: Currency) =>\n\t\t\tc.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currencyDetails) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\tconst amountDecimal = Number(\n\t\tformatUnits(BigInt(amountRaw), currencyDetails.decimals),\n\t);\n\tconst usdAmount = amountDecimal * currencyDetails.exchangeRate;\n\n\treturn {\n\t\tusdAmount,\n\t\tusdAmountFormatted: usdAmount.toFixed(2),\n\t};\n}\n\nexport function getConvertPriceToUSDQueryKey(\n\tparams: ConvertPriceToUSDQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcurrencyAddress: params.currencyAddress,\n\t\tamountRaw: params.amountRaw,\n\t};\n\n\treturn ['currency', 'convert-to-usd', apiArgs] as const;\n}\n\nexport function convertPriceToUSDQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tConvertPriceToUSDQueryOptions,\n\t\t\t'chainId' | 'currencyAddress' | 'amountRaw' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getConvertPriceToUSDQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'currencyAddress',\n\t\t\t\t'amountRaw',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchConvertPriceToUSD,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ChainId } from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { fetchConvertPriceToUSD } from './convert-to-usd';\n\nexport type FetchComparePricesParams = {\n\tchainId?: ChainId;\n\tpriceAmountRaw?: string;\n\tpriceCurrencyAddress?: Address;\n\tcompareToPriceAmountRaw?: string;\n\tcompareToPriceCurrencyAddress?: Address;\n};\n\nexport type ComparePricesReturn = {\n\tpercentageDifference: number;\n\tpercentageDifferenceFormatted: string;\n\tstatus: 'above' | 'same' | 'below';\n};\n\nexport type ComparePricesQueryOptions =\n\tSdkQueryParams<FetchComparePricesParams>;\n\n/**\n * Compares prices between different currencies by converting both to USD\n */\nexport async function fetchComparePrices(\n\tparams: WithRequired<\n\t\tComparePricesQueryOptions,\n\t\t| 'chainId'\n\t\t| 'priceAmountRaw'\n\t\t| 'priceCurrencyAddress'\n\t\t| 'compareToPriceAmountRaw'\n\t\t| 'compareToPriceCurrencyAddress'\n\t\t| 'config'\n\t>,\n): Promise<ComparePricesReturn> {\n\tconst {\n\t\tchainId,\n\t\tpriceAmountRaw,\n\t\tpriceCurrencyAddress,\n\t\tcompareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress,\n\t\tconfig,\n\t} = params;\n\n\tconst [priceUSD, compareToPriceUSD] = await Promise.all([\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: priceCurrencyAddress,\n\t\t\tamountRaw: priceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: compareToPriceCurrencyAddress,\n\t\t\tamountRaw: compareToPriceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t]);\n\n\tconst difference = priceUSD.usdAmount - compareToPriceUSD.usdAmount;\n\n\tif (compareToPriceUSD.usdAmount === 0) {\n\t\tthrow new Error('Cannot compare to zero price');\n\t}\n\n\tconst percentageDifference = (difference / compareToPriceUSD.usdAmount) * 100;\n\tconst isAbove = percentageDifference > 0;\n\tconst isSame = percentageDifference === 0;\n\n\treturn {\n\t\tpercentageDifference,\n\t\tpercentageDifferenceFormatted: Math.abs(percentageDifference).toFixed(2),\n\t\tstatus: isAbove ? 'above' : isSame ? 'same' : 'below',\n\t};\n}\n\nexport function getComparePricesQueryKey(params: ComparePricesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tpriceAmountRaw: params.priceAmountRaw,\n\t\tpriceCurrencyAddress: params.priceCurrencyAddress,\n\t\tcompareToPriceAmountRaw: params.compareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress,\n\t};\n\n\treturn ['currency', 'compare-prices', apiArgs] as const;\n}\n\nexport function comparePricesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tComparePricesQueryOptions,\n\t\t\t| 'chainId'\n\t\t\t| 'priceAmountRaw'\n\t\t\t| 'priceCurrencyAddress'\n\t\t\t| 'compareToPriceAmountRaw'\n\t\t\t| 'compareToPriceCurrencyAddress'\n\t\t\t| 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getComparePricesQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'priceAmountRaw',\n\t\t\t\t'priceCurrencyAddress',\n\t\t\t\t'compareToPriceAmountRaw',\n\t\t\t\t'compareToPriceCurrencyAddress',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchComparePrices,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ListCurrenciesRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype Currency,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCurrencyParams = ListCurrenciesRequest & {\n\tcurrencyAddress: Address;\n};\n\n/**\n * Fetches currency details from the marketplace API\n */\nexport async function fetchCurrency(\n\tparams: WithRequired<\n\t\tCurrencyQueryOptions,\n\t\t'chainId' | 'currencyAddress' | 'config'\n\t>,\n): Promise<Currency | undefined> {\n\tconst { chainId, currencyAddress, config } = params;\n\tconst queryClient = getQueryClient();\n\n\tlet currencies = queryClient.getQueryData<Currency[]>([\n\t\t'currency',\n\t\t'list',\n\t\tchainId,\n\t]);\n\n\tif (!currencies) {\n\t\tconst marketplaceClient = getMarketplaceClient(config);\n\t\tconst response = await marketplaceClient.listCurrencies({ chainId });\n\t\tcurrencies = response.currencies;\n\t}\n\n\tif (!currencies?.length) {\n\t\tthrow new Error('No currencies returned');\n\t}\n\tconst currency = currencies.find(\n\t\t(currency) =>\n\t\t\tcurrency.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currency) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\treturn currency;\n}\n\nexport type CurrencyQueryOptions = SdkQueryParams<FetchCurrencyParams>;\n\nexport function getCurrencyQueryKey(params: CurrencyQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId ?? 0),\n\t\tcurrencyAddress: params.currencyAddress ?? '',\n\t};\n\n\treturn ['currency', 'currency', apiArgs] as const;\n}\n\nexport function currencyQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<CurrencyQueryOptions, 'chainId' | 'currencyAddress' | 'config'>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCurrencyQueryKey,\n\t\t\trequiredParams: ['chainId', 'currencyAddress', 'config'] as const,\n\t\t\tfetcher: fetchCurrency,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.currencyAddress && isAddress(p.currencyAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n"],"mappings":";;;;;;;;;;AA4BA,eAAsB,sBACrB,QACsB;CACtB,MAAM,EAAE,SAAS,uBAAuB,mBAAmB,WAAW;CACtE,MAAM,8BAA8B,yBAAyB;CAG7D,IAAI,aAAa,MAFS,qBAAqB,OAAO,CAGpD,eAAe,EACf,SACA,CAAC,CACD,MAAM,SACN,KAAK,WAAW,KAAK,cAAc;EAClC,GAAG;EACH,iBAAiB,SAAS,mBAAmB;EAC7C,EAAE,CACH;AAEF,KAAI,mBAAmB;EAMtB,MAAM,oBAAoB,sBAJA,MADN,gBAAgB,CACQ,WAC3C,yBAAyB,OAAO,CAChC,EAGkB,OAAO,aACzB,mBACA,QACA,EAAE;AAGH,MAAI,kBACH,cAAa,WAAW,QAAQ,aAC/B,kBAAkB,MAAM,WACvB,eAAe,QAAQ,SAAS,gBAAgB,CAChD,CACD;;AAIH,KAAI,CAAC,4BACJ,cAAa,WAAW,QAAQ,aAAa,CAAC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mB;GAAS;EACxD,SAAS;EACT,mBAAmB,MAClB,CAAC,CAAC,EAAE,mBAAmB,UAAU,EAAE,gBAAgB;EACpD,EACD,OACA"}
|
package/dist/filters.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gn as PropertyFilter, mt as GetFiltersArgs } from "./index2.js";
|
|
2
2
|
import { W as SdkQueryParams, X as WithRequired, it as WithOptionalParams } from "./create-config.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _tanstack_react_query415 from "@tanstack/react-query";
|
|
4
4
|
|
|
5
5
|
//#region src/react/queries/marketplace/filters.d.ts
|
|
6
6
|
type FetchFiltersParams = GetFiltersArgs;
|
|
@@ -16,8 +16,8 @@ declare function getFiltersQueryKey(params: FiltersQueryOptions): readonly ["mar
|
|
|
16
16
|
excludeProperties: undefined;
|
|
17
17
|
excludePropertyValues: boolean | undefined;
|
|
18
18
|
}];
|
|
19
|
-
declare function filtersQueryOptions(params: WithOptionalParams<WithRequired<FiltersQueryOptions, 'chainId' | 'collectionAddress' | 'config'>>):
|
|
20
|
-
queryFn?:
|
|
19
|
+
declare function filtersQueryOptions(params: WithOptionalParams<WithRequired<FiltersQueryOptions, 'chainId' | 'collectionAddress' | 'config'>>): _tanstack_react_query415.OmitKeyof<_tanstack_react_query415.UseQueryOptions<PropertyFilter[], Error, PropertyFilter[], readonly unknown[]>, "queryFn"> & {
|
|
20
|
+
queryFn?: _tanstack_react_query415.QueryFunction<PropertyFilter[], readonly unknown[], never> | undefined;
|
|
21
21
|
} & {
|
|
22
22
|
queryKey: readonly unknown[] & {
|
|
23
23
|
[dataTagSymbol]: PropertyFilter[];
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import { n as getMarketplaceABI, r as getSaleContractABI, t as MAIN_MODULE_ABI }
|
|
|
7
7
|
import { n as SequenceMarketplaceV1_ABI, r as EIP2981_ABI, t as SequenceMarketplaceV2_ABI } from "./index5.js";
|
|
8
8
|
import { i as ERC721_SALE_ABI_V0, n as ERC1155_SALES_CONTRACT_ABI_V0, r as ERC721_SALE_ABI_V1, t as ERC1155_SALES_CONTRACT_ABI_V1 } from "./index6.js";
|
|
9
9
|
import { i as ERC20_ABI, n as ERC1155_ABI, r as ERC721_ABI, t as SEQUENCE_1155_ITEMS_ABI } from "./index7.js";
|
|
10
|
-
import { a as formatPriceWithFee, c as getNetwork, d as
|
|
10
|
+
import { a as formatPriceWithFee, c as getNetwork, d as findMarketCollection, f as cn, h as truncateMiddle, i as formatPrice, l as getPresentableChainName, m as truncateEnd, n as calculatePriceDifferencePercentage, o as validateOpenseaOfferDecimals, p as compareAddress, r as calculateTotalOfferCost, s as networkToWagmiChain, t as calculateEarningsAfterFees, u as getMarketplaceDetails } from "./index8.js";
|
|
11
11
|
import "./index9.js";
|
|
12
|
-
export { AdditionalFee, ApiConfig, BuilderAPI, CardType, CheckoutMode, CheckoutOptions, CheckoutOptionsItem, Collectible, CollectibleCardAction, CollectibleOrder, CollectiblesFilter, Collection, CollectionFilterSettings, CollectionStatus, ContractInfo$1 as ContractInfo, ContractType, CreateReq, Currency, DEFAULT_MARKETPLACE_FEE_PERCENTAGE, EIP2981_ABI, ERC1155_ABI, ERC1155_SALES_CONTRACT_ABI_V0, ERC1155_SALES_CONTRACT_ABI_V1, ERC20_ABI, ERC721_ABI, ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1, EcosystemWalletSettings, Env, Filter, FilterCondition, TokenBalance$1 as IndexerTokenBalance, MAIN_MODULE_ABI, MarketCollection, MarketPage, MarketplaceCollection, MarketplaceConfig, MarketplaceKind, MarketplaceSdkContext, MarketplaceWallet, MarketplaceWalletOptions, MarketplaceWalletWaasSettings, MetadataFilterRule, Order, OrderData, OrderFilter, OrderSide, OrderStatus, OrderbookKind, Page, PostRequest, Price, PriceFilter, PropertyFilter, PropertyType, SEQUENCE_1155_ITEMS_ABI, SEQUENCE_MARKET_V1_ADDRESS, SEQUENCE_MARKET_V2_ADDRESS, SdkConfig, SequenceMarketplaceV1_ABI, SequenceMarketplaceV2_ABI, ShopCollection, ShopPage, Signature, SortBy, SortOrder, Step, StepType, TokenMetadata$1 as TokenMetadata, TransactionCrypto, TransactionType, WalletKind, calculateEarningsAfterFees, calculatePriceDifferencePercentage, calculateTotalOfferCost, cn, compareAddress, createWagmiConfig, fetchMarketplaceConfig, formatPrice, formatPriceWithFee, getMarketplaceABI, getMarketplaceDetails, getNetwork, getPresentableChainName, getSaleContractABI, getWagmiChainsAndTransports, isMarketCollection, isShopCollection, marketplaceConfigOptions, networkToWagmiChain, truncateEnd, truncateMiddle, validateOpenseaOfferDecimals };
|
|
12
|
+
export { AdditionalFee, ApiConfig, BuilderAPI, CardType, CheckoutMode, CheckoutOptions, CheckoutOptionsItem, Collectible, CollectibleCardAction, CollectibleOrder, CollectiblesFilter, Collection, CollectionFilterSettings, CollectionStatus, ContractInfo$1 as ContractInfo, ContractType, CreateReq, Currency, DEFAULT_MARKETPLACE_FEE_PERCENTAGE, EIP2981_ABI, ERC1155_ABI, ERC1155_SALES_CONTRACT_ABI_V0, ERC1155_SALES_CONTRACT_ABI_V1, ERC20_ABI, ERC721_ABI, ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1, EcosystemWalletSettings, Env, Filter, FilterCondition, TokenBalance$1 as IndexerTokenBalance, MAIN_MODULE_ABI, MarketCollection, MarketPage, MarketplaceCollection, MarketplaceConfig, MarketplaceKind, MarketplaceSdkContext, MarketplaceWallet, MarketplaceWalletOptions, MarketplaceWalletWaasSettings, MetadataFilterRule, Order, OrderData, OrderFilter, OrderSide, OrderStatus, OrderbookKind, Page, PostRequest, Price, PriceFilter, PropertyFilter, PropertyType, SEQUENCE_1155_ITEMS_ABI, SEQUENCE_MARKET_V1_ADDRESS, SEQUENCE_MARKET_V2_ADDRESS, SdkConfig, SequenceMarketplaceV1_ABI, SequenceMarketplaceV2_ABI, ShopCollection, ShopPage, Signature, SortBy, SortOrder, Step, StepType, TokenMetadata$1 as TokenMetadata, TransactionCrypto, TransactionType, WalletKind, calculateEarningsAfterFees, calculatePriceDifferencePercentage, calculateTotalOfferCost, cn, compareAddress, createWagmiConfig, fetchMarketplaceConfig, findMarketCollection, formatPrice, formatPriceWithFee, getMarketplaceABI, getMarketplaceDetails, getNetwork, getPresentableChainName, getSaleContractABI, getWagmiChainsAndTransports, isMarketCollection, isShopCollection, marketplaceConfigOptions, networkToWagmiChain, truncateEnd, truncateMiddle, validateOpenseaOfferDecimals };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { n as SequenceMarketplaceV1_ABI, r as EIP2981_ABI, t as SequenceMarketpl
|
|
|
8
8
|
import { i as ERC721_SALE_ABI_V0, n as ERC1155_SALES_CONTRACT_ABI_V0, r as ERC721_SALE_ABI_V1, t as ERC1155_SALES_CONTRACT_ABI_V1 } from "./primary-sale.js";
|
|
9
9
|
import { n as getMarketplaceABI, r as getSaleContractABI, t as MAIN_MODULE_ABI } from "./abi.js";
|
|
10
10
|
import { i as ERC20_ABI, n as ERC1155_ABI, r as ERC721_ABI, t as SEQUENCE_1155_ITEMS_ABI } from "./token.js";
|
|
11
|
-
import { a as formatPriceWithFee, c as
|
|
11
|
+
import { a as formatPriceWithFee, c as findMarketCollection, d as truncateEnd, f as truncateMiddle, i as formatPrice, l as cn, n as calculatePriceDifferencePercentage, o as validateOpenseaOfferDecimals, r as calculateTotalOfferCost, s as getMarketplaceDetails, t as calculateEarningsAfterFees, u as compareAddress } from "./utils.js";
|
|
12
12
|
import { n as getPresentableChainName, t as getNetwork } from "./network.js";
|
|
13
13
|
|
|
14
|
-
export { BuilderAPI, CollectibleCardAction, CollectionStatus, ContractType, DEFAULT_MARKETPLACE_FEE_PERCENTAGE, EIP2981_ABI, ERC1155_ABI, ERC1155_SALES_CONTRACT_ABI_V0, ERC1155_SALES_CONTRACT_ABI_V1, ERC20_ABI, ERC721_ABI, ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1, FilterCondition, MAIN_MODULE_ABI, MarketplaceKind, OrderSide, OrderStatus, OrderbookKind, PropertyType, SEQUENCE_1155_ITEMS_ABI, SEQUENCE_MARKET_V1_ADDRESS, SEQUENCE_MARKET_V2_ADDRESS, SequenceMarketplaceV1_ABI, SequenceMarketplaceV2_ABI, SortOrder, StepType, TransactionCrypto, TransactionType, WalletKind, calculateEarningsAfterFees, calculatePriceDifferencePercentage, calculateTotalOfferCost, cn, compareAddress, createWagmiConfig, formatPrice, formatPriceWithFee, getMarketplaceABI, getMarketplaceDetails, getNetwork, getPresentableChainName, getSaleContractABI, getWagmiChainsAndTransports, isMarketCollection, isShopCollection, networkToWagmiChain, truncateEnd, truncateMiddle, validateOpenseaOfferDecimals };
|
|
14
|
+
export { BuilderAPI, CollectibleCardAction, CollectionStatus, ContractType, DEFAULT_MARKETPLACE_FEE_PERCENTAGE, EIP2981_ABI, ERC1155_ABI, ERC1155_SALES_CONTRACT_ABI_V0, ERC1155_SALES_CONTRACT_ABI_V1, ERC20_ABI, ERC721_ABI, ERC721_SALE_ABI_V0, ERC721_SALE_ABI_V1, FilterCondition, MAIN_MODULE_ABI, MarketplaceKind, OrderSide, OrderStatus, OrderbookKind, PropertyType, SEQUENCE_1155_ITEMS_ABI, SEQUENCE_MARKET_V1_ADDRESS, SEQUENCE_MARKET_V2_ADDRESS, SequenceMarketplaceV1_ABI, SequenceMarketplaceV2_ABI, SortOrder, StepType, TransactionCrypto, TransactionType, WalletKind, calculateEarningsAfterFees, calculatePriceDifferencePercentage, calculateTotalOfferCost, cn, compareAddress, createWagmiConfig, findMarketCollection, formatPrice, formatPriceWithFee, getMarketplaceABI, getMarketplaceDetails, getNetwork, getPresentableChainName, getSaleContractABI, getWagmiChainsAndTransports, isMarketCollection, isShopCollection, networkToWagmiChain, truncateEnd, truncateMiddle, validateOpenseaOfferDecimals };
|
package/dist/index10.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ut as CheckoutOptionsSalesContractResponse, n as CheckoutOptionsItem } from "./index2.js";
|
|
2
2
|
import { L as HookParamsFromApiRequest } from "./create-config.js";
|
|
3
3
|
import { n as PrimarySaleCheckoutOptionsQueryOptions, r as fetchPrimarySaleCheckoutOptions, t as FetchPrimarySaleCheckoutOptionsParams } from "./primary-sale-checkout-options.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _tanstack_react_query307 from "@tanstack/react-query";
|
|
5
5
|
import { skipToken } from "@tanstack/react-query";
|
|
6
6
|
|
|
7
7
|
//#region src/react/hooks/checkout/primary-sale-checkout-options.d.ts
|
|
@@ -48,7 +48,7 @@ type UsePrimarySaleCheckoutOptionsParams = Omit<HookParamsFromApiRequest<FetchPr
|
|
|
48
48
|
* )
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
declare function usePrimarySaleCheckoutOptions(params: UsePrimarySaleCheckoutOptionsParams | typeof skipToken):
|
|
51
|
+
declare function usePrimarySaleCheckoutOptions(params: UsePrimarySaleCheckoutOptionsParams | typeof skipToken): _tanstack_react_query307.UseQueryResult<CheckoutOptionsSalesContractResponse, Error>;
|
|
52
52
|
type UsePrimarySaleCheckoutOptionsArgs = {
|
|
53
53
|
chainId: number;
|
|
54
54
|
contractAddress: string;
|