Skip to main content

List an item

Listing an item will create an NFT as an identifier, it will use your most recently created collection or the specified one. Royalties are listed in basis points (BPS). 100 BPS is equal to 1%. Royalties will be paid as soon as an item has been shipped.
import { mkt } from './config'

const listing = await mkt.list(
  {
    name: 'My Item',
    description: 'This is my item',
    category: 'Clothing',
    color: 'blue',
    tags: ['sale']
    brand: 'brand',
    nftType: 'physical'
    status: 'listed'

    royalty: { 
      royaltyAmount: 300, // 3% royalty
      receiver: '0x123' 
    },
    price: 100, // $1
    quantity: 1,

    images: [File],
    video: File,

    collection: '<COLLECTION_ADDRESS>'
  }
)
import type { ListingInput, ListingResult } from './interface'

list(listingInput: ListingInput): ListingResult
export interface ListingInput {
  // ipfs metadata
  name: string
  description: string
  category: string
  color: string
  tags: string[]
  brand?: string
  nftType: NftType
  status: ItemStatus

  // onchain metadata
  royalty: RoyaltyConfig
  price: number // in cents
  quantity: number

  // files
  images: File[]
  video?: File

  collection: Address
}

export interface RoyaltyConfig {
  receiver: Address
  royaltyAmount: bigint
}
export type NftType = 'physical' | 'digital'
export type ItemStatus = 'listed' | 'delist'

export interface ListingResult {
  collectionAddress: Address
  tokenId: bigint
  marketplaceId: string
}
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
})