Skip to content

Commit 15cdd63

Browse files
committed
web: Add contract balance to NeoFS section, closes #121
Signed-off-by: Mikhail Petrov <mike@nspcc.ru>
1 parent f85eec5 commit 15cdd63

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

get_webstat_metrics.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ async def main():
102102
"node_map": [],
103103
"contract": {
104104
"mainnet": {
105+
"balance": "unknown",
105106
"address": "NNxVrKjLsRkWsmGgmuNXLcMswtxTGaNQLk",
106107
"script_hash": "2cafa46838e8b564468ebd868dcafdd99dce6221",
107108
},
108109
"testnet": {
110+
"balance": "unknown",
109111
"address": "NZAUkYbJ1Cb2HrNmwZ1pg9xYHBhm2FgtKV",
110112
"script_hash": "3c3f4b84773ef0141576e48c3ff60e5078235891",
111113
}
@@ -167,6 +169,8 @@ async def main():
167169
node_mainnet_count = 0
168170

169171
for family in text_string_to_metric_families(requests.get(args.url_main).content.decode('utf-8')):
172+
if family.name == 'neo_exporter_fs_chain_supply':
173+
output['contract']['mainnet']['balance'] = family.samples[0].value
170174
if family.name == 'neo_exporter_epoch':
171175
output['network_epoch']['mainnet'] = family.samples[0].value
172176
if family.name == 'neo_exporter_containers_number':
@@ -203,6 +207,8 @@ async def main():
203207
node_testnet_count = 0
204208

205209
for family in text_string_to_metric_families(requests.get(args.url_test).content.decode('utf-8')):
210+
if family.name == 'neo_exporter_fs_chain_supply':
211+
output['contract']['mainnet']['balance'] = family.samples[0].value
206212
if family.name == 'neo_exporter_epoch':
207213
output['network_epoch']['testnet'] = family.samples[0].value
208214
if family.name == 'neo_exporter_containers_number':

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ export interface Data {
4848
"node_map": NodeMap[]
4949
"contract": {
5050
"mainnet": {
51+
"balance": number | string
5152
"address": string
5253
"script_hash": string
5354
}
5455
"testnet": {
56+
"balance": number | string
5557
"address": string
5658
"script_hash": string
5759
}

src/Home.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ const Home = ({
282282
color="grey"
283283
>
284284
<Heading subtitle weight="semibold">NeoFS contract</Heading>
285+
<Heading subtitle size={6}>
286+
<span>{`Balance: `}</span>
287+
288+
{`${data.contract && data.contract[activeNet].balance} GAS`}
289+
</Heading>
285290
<Heading subtitle size={6}>
286291
<span>{`Address: `}</span>
287292
{data.contract && data.contract[activeNet].address}

0 commit comments

Comments
 (0)