fragment QuickTokenBalanceParts on TokenBalance {
  id
  quantity
  denominatedValue {
    id
    value
    currency
  }
  token {
    id
    address
    chain
    standard
  }
}

fragment PortfolioTokenBalanceParts on TokenBalance {
  id
  quantity
  denominatedValue {
    id
    currency
    value
  }
  token {
    ...SimpleTokenDetails
    id
    address
    chain
    symbol
    name
    decimals
    standard
    project {
      id
      name
      logo {
        id
        url
      }
      safetyLevel
      logoUrl
      isSpam
    }
  }
  tokenProjectMarket {
    id
    pricePercentChange(duration: DAY) {
      id
      value
    }
    tokenProject {
      id
      logoUrl
      isSpam
    }
  }
}

query PortfolioBalancesWeb(
  $ownerAddress: String!
  $chains: [Chain!]!
  $includeSmallBalances: Boolean = false
  $includeSpamTokens: Boolean = false
) {
  portfolios(
    ownerAddresses: [$ownerAddress]
    chains: $chains
    valueModifiers: [
      {
        ownerAddress: $ownerAddress
        includeSpamTokens: $includeSpamTokens
        includeSmallBalances: $includeSmallBalances
      }
    ]
  ) {
    id
    tokensTotalDenominatedValue {
      id
      value
    }
    tokensTotalDenominatedValueChange(duration: DAY) {
      absolute {
        id
        value
      }
      percentage {
        id
        value
      }
    }
    tokenBalances {
      ...PortfolioTokenBalanceParts
    }
  }
}

# Query only returns basic token, quantity, and denominated value.
query QuickTokenBalancesWeb($ownerAddress: String!, $chains: [Chain!]!) {
  portfolios(ownerAddresses: [$ownerAddress], chains: $chains) {
    id
    tokenBalances {
      ...QuickTokenBalanceParts
    }
  }
}
