Skip to content

Commit 0f0465b

Browse files
committed
timings
1 parent 922a49a commit 0f0465b

File tree

14 files changed

+343
-50
lines changed

14 files changed

+343
-50
lines changed

app/src/ipc/wallet-internal-interface.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export type InternalWalletInterface = Omit<Wallet, "getAccounts"> & {
9090
getInteractions(): Promise<WalletInteraction<WalletInteractionType>[]>;
9191
getExecutionTrace(
9292
interactionId: string
93-
): Promise<DecodedExecutionTrace | undefined>;
93+
): Promise<{ trace?: DecodedExecutionTrace; stats?: any } | undefined>;
9494
resolveAuthorization(response: AuthorizationResponse): void;
9595
onWalletUpdate(callback: OnWalletUpdateListener): void;
9696
onAuthorizationRequest(callback: OnAuthorizationRequestListener): void;
@@ -148,7 +148,10 @@ export const InternalWalletInterfaceSchema: ApiSchemaFor<InternalWalletInterface
148148
getExecutionTrace: z
149149
.function()
150150
.args(z.string())
151-
.returns(DecodedExecutionTraceSchema.optional()),
151+
.returns(z.object({
152+
trace: DecodedExecutionTraceSchema.optional(),
153+
stats: z.any().optional(),
154+
}).optional()),
152155
// @ts-ignore
153156
resolveAuthorization: z.function().args(
154157
z.object({

app/src/ui/components/authorization/AuthorizeSimulateTxContent.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export function AuthorizeSimulateTxContent({
2020
callAuthorizations?: ReadableCallAuthorization[];
2121
executionTrace?: DecodedExecutionTrace | any;
2222
isUtility?: boolean;
23+
stats?: any;
2324
};
2425
const callAuthorizations = params.callAuthorizations || [];
2526
const executionTrace = params.executionTrace;
2627
const isUtility = params.isUtility || request.method === "simulateUtility";
28+
const stats = params.stats;
2729

2830
return (
2931
<>
@@ -43,6 +45,7 @@ export function AuthorizeSimulateTxContent({
4345
<ExecutionTraceDisplay
4446
trace={executionTrace}
4547
callAuthorizations={callAuthorizations}
48+
stats={stats}
4649
/>
4750
</Box>
4851
)}

app/src/ui/components/dialogs/ExecutionTraceDialog.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ interface ExecutionTraceDialogProps {
1212
open: boolean;
1313
onClose: () => void;
1414
trace: DecodedExecutionTrace | null;
15+
stats?: any;
1516
}
1617

1718
export function ExecutionTraceDialog({
1819
open,
1920
onClose,
2021
trace,
22+
stats,
2123
}: ExecutionTraceDialogProps) {
2224
if (!trace) return null;
2325

@@ -55,6 +57,7 @@ export function ExecutionTraceDialog({
5557
<ExecutionTraceDisplay
5658
trace={trace}
5759
accordionBgColor="background.default"
60+
stats={stats}
5861
/>
5962
</DialogContent>
6063
<DialogActions>

app/src/ui/components/sections/authorized-apps/components/AppAuthorizationCard.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ export function AppAuthorizationCard({
154154
setSelectedSimulationHash(payloadHash);
155155

156156
// Payload hash IS the interaction ID for simulations
157-
const trace = await walletAPI.getExecutionTrace(payloadHash);
158-
if (trace) {
159-
setExecutionTrace(trace);
157+
const result = await walletAPI.getExecutionTrace(payloadHash);
158+
if (result) {
159+
setExecutionTrace(result);
160160
setTraceDialogOpen(true);
161161
} else {
162162
alert("Execution trace not found for this simulation");
@@ -454,7 +454,8 @@ export function AppAuthorizationCard({
454454
{executionTrace && (
455455
<ExecutionTraceDialog
456456
open={traceDialogOpen}
457-
trace={executionTrace}
457+
trace={executionTrace.trace}
458+
stats={executionTrace.stats}
458459
onClose={() => {
459460
setTraceDialogOpen(false);
460461
setExecutionTrace(null);

app/src/ui/components/sections/interactions/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export function InteractionsList({
106106
const { walletAPI } = useContext(WalletContext);
107107
const [selectedTrace, setSelectedTrace] =
108108
useState<DecodedExecutionTrace | null>(null);
109+
const [selectedStats, setSelectedStats] = useState<any | null>(null);
109110
const [traceDialogOpen, setTraceDialogOpen] = useState(false);
110111

111112
const handleInteractionClick = async (
@@ -118,9 +119,10 @@ export function InteractionsList({
118119
interaction.type === "simulateUtility"
119120
) {
120121
try {
121-
const trace = await walletAPI.getExecutionTrace(interaction.id);
122-
if (trace) {
123-
setSelectedTrace(trace);
122+
const result = await walletAPI.getExecutionTrace(interaction.id);
123+
if (result?.trace) {
124+
setSelectedTrace(result.trace);
125+
setSelectedStats(result.stats);
124126
setTraceDialogOpen(true);
125127
}
126128
} catch (error) {
@@ -320,6 +322,7 @@ export function InteractionsList({
320322
open={traceDialogOpen}
321323
onClose={() => setTraceDialogOpen(false)}
322324
trace={selectedTrace}
325+
stats={selectedStats}
323326
/>
324327
</Box>
325328
);

0 commit comments

Comments
 (0)