forked from polkadot-js/apps
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea0aba5
commit 25467cd
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2017-2024 @polkadot/react-query authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import React from 'react'; | ||
|
||
import { useApi, useCall } from '@polkadot/react-hooks'; | ||
|
||
import FormatBalance from './FormatBalance.js'; | ||
|
||
interface Props { | ||
children?: React.ReactNode; | ||
className?: string; | ||
label?: React.ReactNode; | ||
} | ||
|
||
function TotalIssuance ({ children, className = '', label }: Props): React.ReactElement<Props> | null { | ||
const { api } = useApi(); | ||
const azeroCap = useCall<string>(api.query.aleph.azeroCap); | ||
|
||
return ( | ||
<div className={className}> | ||
{label || ''} | ||
<FormatBalance | ||
className={azeroCap ? '' : '--tmp'} | ||
value={azeroCap} | ||
withSi | ||
/> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
export default React.memo(TotalIssuance); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters