> ## 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.

# Shipping

> Get the shipping status and shipping label

### Get Shipping Label

Name, email, and phone are necessary for a shipping label and optional if your account address has already shipped an item.

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

  const pdfLink = await mkt.ship({
    orderId: '<ORDER_ID>',
    mailingAddress: {
      name: "John Doe",
      phone: "+12024564545", // US or Canada phone number
      street1: "123 Main St",
      city: "Anytown",
      state: "CA",
      country: "USA",
      zip: "12345"
    },
    email: "email@email.com",
    weight: 10, // OZ
    size: "small-flat"
  })

  ```

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

  ship(input: ShipInput): Promise<string>

  interface ShipInput {
    orderId: string
    mailingAddress: MailingAddress | undefined
    email: string | undefined
    weight: number
    size: PackageSize
  }
  interface MailingAddress {
    name: string
    phone: string
    street1: string
    street2: string
    city: string
    state: string
    country: string
    zip: 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 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>

### Add tracking code

Instead of generating shipping label automatically, a tracking code can be added directly

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

  await mkt.addTrackingCode({
    orderId: '<ORDER_ID>'
    trackingCode: '<TRACKING_CODE>'
    courier: 'USPS'
  })
  ```

  ```typescript interface.ts theme={null}
  addTrackingCode(input: TrackingCodeInput): Promise<void>

  export interface TrackingCodeInput {
    orderId: string
    trackingCode: string
    courier: string
  }
  ```

  ```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>
