Docs
NFT Data API
Examples
Wallets

Wallets

Here are some examples of common queries related to Wallets using the NFT Data API.

Wallet Ownership

query fetchWalletOwnership(
  $where: nfts_bool_exp
  $order_by: [nfts_order_by!]
  $offset: Int
  $limit: Int!
) {
  aptos {
    nfts(where: $where, order_by: $order_by, offset: $offset, limit: $limit) {
      id
      token_id
      name
      media_url
      media_type
      ranking
      owner
      delegated_owner
      burned
      staked
      version
      collection {
        id
        title
      }
      listings(where: { listed: { _eq: true } }, order_by: { price: asc }) {
        id
        price
      }
    }
  }
}

Wallet Collections

query fetchWalletCollections(
  $where: collections_bool_exp!
  $order_by: [collections_order_by!]
) {
  aptos {
    collections(where: $where, order_by: $order_by) {
      id
      slug
      title
      cover_url
      floor
    }
  }
}

Wallet Stats

query fetchWalletStats($wallet: String!) {
  aptos {
    wallet_stats(address: $wallet) {
      holdings_listed_count
      holdings_count
      value
      usd_value
      bought_volume
      bought_usd_volume
      sold_volume
      sold_usd_volume
      realized_profit_loss
      realized_usd_profit_loss
      unrealized_profit_loss
      unrealized_usd_profit_loss
    }
  }
}

Wallet Bids

query fetchWalletBids(
  $where: bids_bool_exp!
  $order_by: [bids_order_by!]
  $offset: Int
  $limit: Int!
) {
  aptos {
    bids(where: $where, order_by: $order_by, offset: $offset, limit: $limit) {
      id
      bidder
      price
      price_str
      type
      nonce
      status
      nft {
        id
        token_id
        name
        media_url
        media_type
        ranking
      }
      collection {
        id
        title
        slug
      }
      market_contract {
        key
        name
      }
    }
  }
}

Wallet Activity

query fetchWalletActivity(
  $where: actions_bool_exp
  $offset: Int
  $limit: Int!
) {
  aptos {
    actions(
      where: $where
      order_by: [{ block_time: desc }, { tx_index: desc }]
      offset: $offset
      limit: $limit
    ) {
      id
      type
      price
      usd_price
      sender
      receiver
      tx_id
      block_time
      market_name
      collection {
        id
        slug
        title
        cover_url
      }
      nft {
        id
        token_id
        name
        media_url
        media_type
        ranking
      }
    }
  }
}

Wallet Realized P&L

query fetchWalletRealizedPnL($wallet: String!) {
  aptos {
    wallet_trades(address: $wallet) {
      acquired_at
      acquired_action_type
      acquired_price
      acquired_usd_price
      released_at
      released_action_type
      released_price
      released_usd_price
      collection {
        id
        slug
        title
        supply
      }
      nft {
        id
        token_id
        name
        media_url
        media_type
        ranking
      }
    }
    crypto_rates(
      where: { crypto: { _eq: "aptos" }, fiat: { _eq: "USD" } }
    ) {
      rate
    }
  }
}

Wallet Unrealized P&L

query fetchWalletUnrealizedPnL($wallet: String!) {
  aptos {
    wallet_holdings(address: $wallet) {
      acquired_at
      acquired_action_type
      acquired_price
      acquired_usd_price
      collection {
        id
        slug
        title
        supply
        floor
      }
      nft {
        id
        token_id
        name
        media_url
        media_type
        ranking
      }
    }
    crypto_rates(
      where: { crypto: { _eq: "aptos" }, fiat: { _eq: "USD" } }
    ) {
      rate
    }
  }
}

Wallet Portfolio Values

query fetchWalletPortfolioValues($wallet: String!, $period: WalletHistory!) {
  aptos {
    wallet_values(address: $wallet, history: $period) {
      time
      usd_value
      value
    }
  }
}