mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-10-25 04:35:01 +00:00
PoolSize: add the private pool, not the system pool twice
privatePool was read from systemPoolSize. The storage item is an Option<StatusRecord>, which is now the type it is read as.
This commit is contained in:
1 parent
e2c83baac9
commit
a235ddbc7b
1 file changed
+6
-12
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2026 @pezkuwi/react-query authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Option } from '@pezkuwi/types';
|
||||
import type { PezpalletBrokerStatusRecord } from '@pezkuwi/types/lookup';
|
||||
|
||||
import React from 'react';
|
||||
@@ -14,18 +15,11 @@ interface Props {
|
||||
|
||||
function PoolSize ({ children, className = '' }: Props): React.ReactElement<Props> {
|
||||
const { api } = useApi();
|
||||
const status = useCall<PezpalletBrokerStatusRecord>(api.query.broker?.status);
|
||||
let systemPool = 0;
|
||||
let privatePool = 0;
|
||||
let poolSize = '';
|
||||
|
||||
if (status === undefined) {
|
||||
poolSize = '0';
|
||||
} else {
|
||||
systemPool = status.toJSON().systemPoolSize as number;
|
||||
privatePool = status.toJSON().systemPoolSize as number;
|
||||
poolSize = (systemPool + privatePool).toString();
|
||||
}
|
||||
const status = useCall<Option<PezpalletBrokerStatusRecord>>(api.query.broker?.status);
|
||||
const record = status?.unwrapOr(null);
|
||||
const poolSize = record
|
||||
? record.systemPoolSize.add(record.privatePoolSize).toString()
|
||||
: '0';
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
|
||||
Reference in new issue
Block a user