Skip to content

Commit 70d2c9e

Browse files
committed
fix
1 parent 0ff223b commit 70d2c9e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

playground/src/components/contract/components/FunctionCard.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,19 @@ export function FunctionCard({ fn, contract, contractArtifact, onSendTxRequested
148148
return { ...step, subtotal: acc };
149149
});
150150

151-
const totalRPCCalls = Object.values(profileResult.stats.nodeRPCCalls?.perMethod ?? {}).reduce(
152-
(acc, calls) => acc + (calls?.times.length ?? 0),
153-
0,
154-
);
151+
const totalOracleCalls = profileResult.stats.timings.perFunction.reduce((acc, fnTiming) => {
152+
if (!fnTiming.oracles) {
153+
return acc;
154+
}
155+
return (
156+
acc +
157+
Object.values(fnTiming.oracles).reduce((oracleAcc, oracleTiming) => oracleAcc + oracleTiming.times.length, 0)
158+
);
159+
}, 0);
155160

156161
setProfileResults({
157162
...profileResults,
158-
...{ [name]: { success: true, ...profileResult, executionSteps, biggest, totalRPCCalls } },
163+
...{ [name]: { success: true, ...profileResult, executionSteps, biggest, totalOracleCalls } },
159164
});
160165
} catch (e) {
161166
console.error(e);
@@ -352,7 +357,7 @@ export function FunctionCard({ fn, contract, contractArtifact, onSendTxRequested
352357
</Typography>
353358
</Typography>
354359
<Typography variant="caption">
355-
Total RPC calls: {profileResults[fn.name].totalRPCCalls}
360+
Total oracle calls: {profileResults[fn.name].totalOracleCalls}
356361
</Typography>
357362
</Box>
358363
<Box sx={{ margin: '0.5rem', fontSize: '0.8rem' }}>

0 commit comments

Comments
 (0)