@polkadot/react-query
Version:
A collection of RxJs React components the Polkadot JS API
32 lines (26 loc) • 949 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Nonce;
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 Nonce({
children,
className,
label,
params
}) {
const {
api
} = (0, _reactHooks.useApi)();
const allBalances = (0, _reactHooks.useCall)(api.derive.balances.all, [params]);
return _react.default.createElement("div", {
className: className
}, label || '', (0, _util.formatNumber)(allBalances === null || allBalances === void 0 ? void 0 : allBalances.accountNonce), children);
}