Get Item
Get a single item by marketplace id, or by collection address and token idimport { Marketplace } from '@evav/marketplace'
const item = await Marketplace.getItem('<ITEM_MARKETPLACE_ID>')
const item = await Marketplace.getItemByCollectionAndTokenId('<COLLECTION_ADDRESS>', <TOKEN_ID>)
import type { MarketplaceItem } from './marketplaceItem'
static getItem(id: string): Promise<MarketplaceItem | null>
static getItemByCollectionAndTokenId(
collectionAddress: Address, tokenId: bigint
): Promise<MarketplaceItem | 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'
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(),
})
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
})
Get Items
Get paginated list of items with optional filtersimport { 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>'
})
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
}
export type PackageSize =
| 'small-flat'
| 'small-rec'
| 'small'
| 'medium-flat'
| 'medium-long'
| 'medium'
| 'large-flat'
| 'large-long'
| 'large'
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'
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(),
})
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
})
Search
import { Marketplace } from '@evav/marketplace'
const items = await Marketplace.getItemsByFullTextSearch({
text: '<SEARCH_QUERY>',
{ perPage: 10, page: 1 }
})
import type { MarketplaceItem } from './marketplaceItem'
static getItemsByFullTextSearch(input: GetItemsByFullTextSearchQuery): Promise<MarketplaceItem[]>
interface GetItemsByFullTextSearchQuery {
text: string
pagination: SearchPaginationInput
}
interface SearchPaginationInput {
perPage: number
page: number
}
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'
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(),
})
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
})
Get my items
Returns all the items (listed and delisted) of the current user. Internally callsMarketplace.getItems({ owner: '<CURRENT_USER_ADDRESS>', status: undefined })
import { mkt } from './config'
const items = await mkt.getMyItems()
import type { MarketplaceItem } from './marketplaceItem'
getMyItems(): Promise<MarketplaceItem[]>
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'
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(),
})
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
})
Get item royalty information
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>'
)
import type { Address } from 'viem'
getRoyaltyInfo(
tokenId: string,
price: bigint,
collectionAddress: Address
): Promise<RoyaltyConfig>
interface RoyaltyConfig {
receiver: Address
royaltyAmount: bigint
}
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(),
})
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
})