> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evav.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Query

> Lookup items on the marketplace

### Get Item

Get a single item by marketplace id, or by collection address and token id

<CodeGroup>
  ```typescript example theme={null}
  import { Marketplace } from '@evav/marketplace'

  const item = await Marketplace.getItem('<ITEM_MARKETPLACE_ID>')

  const item = await Marketplace.getItemByCollectionAndTokenId('<COLLECTION_ADDRESS>', <TOKEN_ID>)
  ```

  ```typescript interface.ts theme={null}
  import type { MarketplaceItem } from './marketplaceItem'

  static getItem(id: string): Promise<MarketplaceItem | null>

  static getItemByCollectionAndTokenId(
    collectionAddress: Address, tokenId: bigint
  ): Promise<MarketplaceItem | null>
  ```

  ```typescript marketplaceItem.ts theme={null}
  import type { Address } from 'viem'

  export interface MarketplaceItem {
    name: string
    description: string
    category: string
    color: string
    tags: string[]
    brand?: string
    nftType: NftType
    status: ItemStatus

    images: string[]
    video?: string
    collection: Address
    id: string
    price: number | null
    quantity: number
  }

  export type NftType = 'physical' | 'digital'
  export type ItemStatus = 'listed' | 'delist'
  ```

  ```typescript config.ts (dynamic) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useDynamicContext, getAuthToken } from '@dynamic-labs/sdk-react-core'

  const { primaryWallet } = useDynamicContext()
  const walletClient = await primaryWallet?.connector?.getWalletClient()
  const publicClient = await primaryWallet?.connector?.getPublicClient()
  const [account] = await walletConnector.getConnectedAccounts()

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: account as Address,
    // Optional. If not provided, SIWE will be used instead, and you will be asked to sign a message with your wallet
    accessToken: getAuthToken(),
  })
  ```

  ```typescript config.ts (privy) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useWallets, usePrivy } from 'privy'
  import { createWalletClient, createPublicClient, custom } from 'viem'
  import { base } from 'viem/chains'

  const { wallets } = useWallets();
  const { user } = usePrivy();

  const wallet = wallets[0]; // Replace this with your desired wallet
  const provider = await wallet.getEthereumProvider()

  const walletClient = createWalletClient({
    chain: base,
    transport: custom(provider),
  })

  const publicClient = createPublicClient({
    chain: base,
    transport: custom(provider),
  })

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: user.linked_accounts[0].address // Replace with your desired account
  })
  ```
</CodeGroup>

### Get Items

Get paginated list of items with optional filters

<CodeGroup>
  ```typescript example theme={null}
  import { Marketplace } from '@evav/marketplace'

  // Get unfiltered list of items
  const { items, pageInfo } = await Marketplace.getItems()

  // Filter the items
  const { items, pageInfo } = await Marketplace.getItems({
    brand: '<BRAND_NAME>',
    collectionAddress: '<COLLECTION_ADDRESS>'
  })
  ```

  ```typescript interface.ts theme={null}
  import type { MarketplaceItem, ItemStatus } from './marketplaceItem'
  import type { PackageSize } from './packageSize'

  static getItems(query?: GetItemsQuery): Promise<GetItemsResult>

  interface GetItemsQuery {
    owner?: Address
    category?: string[]
    collectionAddress?: Address
    tokenId?: string
    color?: string
    size?: PackageSize
    brand?: string
    tags?: string[]
    mintedBy?: Address
    status?: ItemStatus
    pagination?: GetItemsPaginationInput
  }
  interface GetItemsPaginationInput {
    perPage: number
    startCursor?: string
  }


  interface GetItemsResult {
    items: MarketplaceItem[]
    pageInfo: PageInfo
  }
  interface PageInfo {
    endCursor: string
  }
  ```

  ```typescript packageSize.ts theme={null}
  export type PackageSize =
    | 'small-flat'
    | 'small-rec'
    | 'small'
    | 'medium-flat'
    | 'medium-long'
    | 'medium'
    | 'large-flat'
    | 'large-long'
    | 'large'
  ```

  ```typescript marketplaceItem.ts theme={null}
  import type { Address } from 'viem'

  export interface MarketplaceItem {
    name: string
    description: string
    category: string
    color: string
    tags: string[]
    brand?: string
    nftType: NftType
    status: ItemStatus

    images: string[]
    video?: string
    collection: Address
    id: string
    price: number | null
    quantity: number
  }

  export type NftType = 'physical' | 'digital'
  export type ItemStatus = 'listed' | 'delist'
  ```

  ```typescript config.ts (dynamic) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useDynamicContext, getAuthToken } from '@dynamic-labs/sdk-react-core'

  const { primaryWallet } = useDynamicContext()
  const walletClient = await primaryWallet?.connector?.getWalletClient()
  const publicClient = await primaryWallet?.connector?.getPublicClient()
  const [account] = await walletConnector.getConnectedAccounts()

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: account as Address,
    // Optional. If not provided, SIWE will be used instead, and you will be asked to sign a message with your wallet
    accessToken: getAuthToken(),
  })
  ```

  ```typescript config.ts (privy) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useWallets, usePrivy } from 'privy'
  import { createWalletClient, createPublicClient, custom } from 'viem'
  import { base } from 'viem/chains'

  const { wallets } = useWallets();
  const { user } = usePrivy();

  const wallet = wallets[0]; // Replace this with your desired wallet
  const provider = await wallet.getEthereumProvider()

  const walletClient = createWalletClient({
    chain: base,
    transport: custom(provider),
  })

  const publicClient = createPublicClient({
    chain: base,
    transport: custom(provider),
  })

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: user.linked_accounts[0].address // Replace with your desired account
  })
  ```
</CodeGroup>

### Search

<CodeGroup>
  ```typescript example theme={null}
  import { Marketplace } from '@evav/marketplace'

  const items = await Marketplace.getItemsByFullTextSearch({
    text: '<SEARCH_QUERY>',
    { perPage: 10, page: 1 }
  })
  ```

  ```typescript interface.ts theme={null}
  import type { MarketplaceItem } from './marketplaceItem'

  static getItemsByFullTextSearch(input: GetItemsByFullTextSearchQuery): Promise<MarketplaceItem[]>

  interface GetItemsByFullTextSearchQuery {
    text: string
    pagination: SearchPaginationInput
  }
  interface SearchPaginationInput {
    perPage: number
    page: number
  }
  ```

  ```typescript marketplaceItem.ts theme={null}
  import type { Address } from 'viem'

  export interface MarketplaceItem {
    name: string
    description: string
    category: string
    color: string
    tags: string[]
    brand?: string
    nftType: NftType
    status: ItemStatus

    images: string[]
    video?: string
    collection: Address
    id: string
    price: number | null
    quantity: number
  }

  export type NftType = 'physical' | 'digital'
  export type ItemStatus = 'listed' | 'delist'
  ```

  ```typescript config.ts (dynamic) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useDynamicContext, getAuthToken } from '@dynamic-labs/sdk-react-core'

  const { primaryWallet } = useDynamicContext()
  const walletClient = await primaryWallet?.connector?.getWalletClient()
  const publicClient = await primaryWallet?.connector?.getPublicClient()
  const [account] = await walletConnector.getConnectedAccounts()

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: account as Address,
    // Optional. If not provided, SIWE will be used instead, and you will be asked to sign a message with your wallet
    accessToken: getAuthToken(),
  })
  ```

  ```typescript config.ts (privy) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useWallets, usePrivy } from 'privy'
  import { createWalletClient, createPublicClient, custom } from 'viem'
  import { base } from 'viem/chains'

  const { wallets } = useWallets();
  const { user } = usePrivy();

  const wallet = wallets[0]; // Replace this with your desired wallet
  const provider = await wallet.getEthereumProvider()

  const walletClient = createWalletClient({
    chain: base,
    transport: custom(provider),
  })

  const publicClient = createPublicClient({
    chain: base,
    transport: custom(provider),
  })

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: user.linked_accounts[0].address // Replace with your desired account
  })
  ```
</CodeGroup>

### Get my items

Returns all the items (listed and delisted) of the current user.
Internally calls `Marketplace.getItems({ owner: '<CURRENT_USER_ADDRESS>', status: undefined })`

<CodeGroup>
  ```typescript example theme={null}
  import { mkt } from './config'

  const items = await mkt.getMyItems()
  ```

  ```typescript interface.ts theme={null}
  import type { MarketplaceItem } from './marketplaceItem'

  getMyItems(): Promise<MarketplaceItem[]>
  ```

  ```typescript marketplaceItem.ts theme={null}
  import type { Address } from 'viem'

  export interface MarketplaceItem {
    name: string
    description: string
    category: string
    color: string
    tags: string[]
    brand?: string
    nftType: NftType
    status: ItemStatus

    images: string[]
    video?: string
    collection: Address
    id: string
    price: number | null
    quantity: number
  }

  export type NftType = 'physical' | 'digital'
  export type ItemStatus = 'listed' | 'delist'
  ```

  ```typescript config.ts (dynamic) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useDynamicContext, getAuthToken } from '@dynamic-labs/sdk-react-core'

  const { primaryWallet } = useDynamicContext()
  const walletClient = await primaryWallet?.connector?.getWalletClient()
  const publicClient = await primaryWallet?.connector?.getPublicClient()
  const [account] = await walletConnector.getConnectedAccounts()

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: account as Address,
    // Optional. If not provided, SIWE will be used instead, and you will be asked to sign a message with your wallet
    accessToken: getAuthToken(),
  })
  ```

  ```typescript config.ts (privy) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useWallets, usePrivy } from 'privy'
  import { createWalletClient, createPublicClient, custom } from 'viem'
  import { base } from 'viem/chains'

  const { wallets } = useWallets();
  const { user } = usePrivy();

  const wallet = wallets[0]; // Replace this with your desired wallet
  const provider = await wallet.getEthereumProvider()

  const walletClient = createWalletClient({
    chain: base,
    transport: custom(provider),
  })

  const publicClient = createPublicClient({
    chain: base,
    transport: custom(provider),
  })

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: user.linked_accounts[0].address // Replace with your desired account
  })
  ```
</CodeGroup>

### Get item royalty information

<CodeGroup>
  ```typescript example theme={null}
  import { mkt } from './config'

  const royaltyInfo = await mkt.getRoyaltyInfo(
    <TOKEN_ID>,
    10000n, // to get royalty persentage, pass 1 in BPS (100 BPS is equal to 1%)
    '<COLLECTON_ADDRESS>'
  )
  ```

  ```typescript interface.ts theme={null}
  import type { Address } from 'viem'

  getRoyaltyInfo(
    tokenId: string,
    price: bigint,
    collectionAddress: Address
  ): Promise<RoyaltyConfig>

  interface RoyaltyConfig {
    receiver: Address
    royaltyAmount: bigint
  }
  ```

  ```typescript config.ts (dynamic) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useDynamicContext, getAuthToken } from '@dynamic-labs/sdk-react-core'

  const { primaryWallet } = useDynamicContext()
  const walletClient = await primaryWallet?.connector?.getWalletClient()
  const publicClient = await primaryWallet?.connector?.getPublicClient()
  const [account] = await walletConnector.getConnectedAccounts()

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: account as Address,
    // Optional. If not provided, SIWE will be used instead, and you will be asked to sign a message with your wallet
    accessToken: getAuthToken(),
  })
  ```

  ```typescript config.ts (privy) theme={null}
  import { Marketplace } from '@evav/marketplace'
  import { useWallets, usePrivy } from 'privy'
  import { createWalletClient, createPublicClient, custom } from 'viem'
  import { base } from 'viem/chains'

  const { wallets } = useWallets();
  const { user } = usePrivy();

  const wallet = wallets[0]; // Replace this with your desired wallet
  const provider = await wallet.getEthereumProvider()

  const walletClient = createWalletClient({
    chain: base,
    transport: custom(provider),
  })

  const publicClient = createPublicClient({
    chain: base,
    transport: custom(provider),
  })

  // viem is required for the evav sdk
  export const mkt = new Marketplace({
    walletClient,
    publicClient,
    account: user.linked_accounts[0].address // Replace with your desired account
  })
  ```
</CodeGroup>
