Skip to content

Commit

Permalink
refactor: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Jan 20, 2024
1 parent dcab682 commit ecaa082
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,24 +180,25 @@ const wallet = new Wallet(process.env.NFT_CLAIMER_PRIVATE_KEY as string);

function refreshProviderTiming() {
Object.values(networks).forEach(async network => {
const end = providersTiming.startTimer({ network: network.key });
const { key, multicall } = network;
const end = providersTiming.startTimer({ network: key });
let status = 0;

try {
const provider = snapshot.utils.getProvider(network.key);
const provider = snapshot.utils.getProvider(key);
await snapshot.utils.multicall(
network.key,
key,
provider,
abi,
[wallet.address].map(adr => [network.multicall, 'getEthBalance', [adr]]),
[wallet.address].map(adr => [multicall, 'getEthBalance', [adr]]),
{
blockTag: 'latest'
}
);
status = 1;
providersResponseCode.set({ network: network.key }, 200);
providersResponseCode.set({ network: key }, 200);
} catch (e: any) {
providersResponseCode.set({ network: network.key }, parseInt(e?.error?.status || 0));
providersResponseCode.set({ network: key }, parseInt(e?.error?.status || 0));
} finally {
end({ status });
}
Expand Down

0 comments on commit ecaa082

Please sign in to comment.