usePublicationRevenue

usePublicationRevenue is a React hook used to query the revenue from a publication.

const { data: publicationRevenue, loading } = usePublicationRevenue(args)

Usage

import { usePublicationRevenue } from '@lens-protocol/react';

function PublicationRevenue() {
  const { data: revenue, loading } = usePublicationRevenue({
    publicationId: '0x4f90-0x02',
  });
  
  if (loading) return 'Loading...';

  return (
    <article>
      <p>{`Currency: ${revenue.total.asset.name}`}</p>
      <p>{`Symbol: ${revenue.total.asset.symbol}`}</p>
      <p>{`Amount: ${revenue.total.value}`}</p>
    </article>
  );
}

Reference

usePublicationRevenue(args)

Parameters

  • publicationId (required)

The id of the publication for which to query the revenue

Returns

{
  data: RevenueAggregateFragment[],
  loading: boolean
}