@polkadot/types/interfaces#Bid TypeScript Examples

The following examples show how to use @polkadot/types/interfaces#Bid. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bids.tsx    From crust-apps with Apache License 2.0 6 votes vote down vote up
function Bids ({ className }: Props): React.ReactElement<Props> {
  const { t } = useTranslation();
  const { api } = useApi();
  const bids = useCall<Bid[]>(api.query.society.bids);

  const headerRef = useRef([
    [t('bids'), 'start'],
    [t('bid kind'), 'start', 2],
    [t('value')],
    []
  ]);

  return (
    <Table
      className={className}
      empty={bids && t<string>('No bids')}
      header={headerRef.current}
    >
      {bids?.map((bid, index): React.ReactNode => (
        <BidRow
          index={index}
          key={bid.who.toString()}
          value={bid}
        />
      ))}
    </Table>
  );
}
Example #2
Source File: useCounter.ts    From crust-apps with Apache License 2.0 5 votes vote down vote up
export default function useCounter (): number {
  const { api } = useApi();
  const bids = useCall<Bid[]>(api.query.society?.candidates);

  return bids?.length || 0;
}