Skip to content

Commit

Permalink
use toJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellorigotti committed May 29, 2024
1 parent 8cd878e commit 5eb1db8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/metrics/chainflip/gaugeFeeDeficit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ export const gaugeFeeDeficit = async (context: Context): Promise<void> => {

// ARB fees balance
const feeWitheldArb = Number(
(await api.query.arbitrumIngressEgress.withheldTransactionFees('ArbEth'))
.toHuman()
.replace(/,/g, ''),
(await api.query.arbitrumIngressEgress.withheldTransactionFees('ArbEth')).toJSON(),
);
const feeSpentArb = await api.query.arbitrumBroadcaster.transactionFeeDeficit.entries();
totalSpent = 0;
feeSpentArb.forEach(([key, element]: [any, any]) => {
totalSpent += Number(element.toHuman().replace(/,/g, ''));
totalSpent += Number(element.toJSON());
});
const deficitArb = (feeWitheldArb - totalSpent) / 1e18;
metric.labels('arbitrum').set(deficitArb);
Expand Down
4 changes: 1 addition & 3 deletions src/metrics/chainflip/guageExternalChainsBlockHeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export const gaugeExternalChainsBlockHeight = async (context: Context) => {

// Arbitrum
const arbBlockHeight = Number(
(await api.query.arbitrumChainTracking.currentChainState())
.toHuman()
.blockHeight.replace(/,/g, ''),
(await api.query.arbitrumChainTracking.currentChainState()).toJSON().blockHeight,
);
global.arbHeight = arbBlockHeight;
metric.labels('arbitrum').set(arbBlockHeight);
Expand Down

0 comments on commit 5eb1db8

Please sign in to comment.