@polkadot/react-query
Version:
A collection of RxJs React components the Polkadot JS API
33 lines (27 loc) • 962 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = BestFinalized;
var _react = _interopRequireDefault(require("react"));
var _reactHooks = require("@polkadot/react-hooks");
var _util = require("@polkadot/util");
// Copyright 2017-2020 @polkadot/react-query authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
function BestFinalized({
children,
className,
label,
style
}) {
const {
api
} = (0, _reactHooks.useApi)();
const bestNumberFinalized = (0, _reactHooks.useCall)(api.derive.chain.bestNumberFinalized, []);
return _react.default.createElement("div", {
className: className,
style: style
}, label || '', bestNumberFinalized ? (0, _util.formatNumber)(bestNumberFinalized) : '-', children);
}