From 131743719b679d1437d3dff3fcda4ff4181b48e4 Mon Sep 17 00:00:00 2001 From: Pedro Yves Fracari Date: Mon, 13 Jan 2025 12:03:19 -0300 Subject: [PATCH] fix: change tenderly tranasction type to optional on tenderly simulation --- .../src/SimulationRepository/SimulationRepository.ts | 2 +- .../src/SimulationRepository/SimulationRepositoryTenderly.ts | 4 ++-- libs/repositories/src/SimulationRepository/tenderlyTypes.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/repositories/src/SimulationRepository/SimulationRepository.ts b/libs/repositories/src/SimulationRepository/SimulationRepository.ts index 94aeefe2..0cd938cd 100644 --- a/libs/repositories/src/SimulationRepository/SimulationRepository.ts +++ b/libs/repositories/src/SimulationRepository/SimulationRepository.ts @@ -16,7 +16,7 @@ export interface SimulationData { // { [address: string]: { [token: string]: balanceDiff: string } } // example: { '0x123': { '0x456': '100', '0xabc': '-100' } } cumulativeBalancesDiff: Record>; - gasUsed: string; + gasUsed?: string; } export const simulationRepositorySymbol = Symbol.for('SimulationRepository'); diff --git a/libs/repositories/src/SimulationRepository/SimulationRepositoryTenderly.ts b/libs/repositories/src/SimulationRepository/SimulationRepositoryTenderly.ts index 421ceb07..7caa5728 100644 --- a/libs/repositories/src/SimulationRepository/SimulationRepositoryTenderly.ts +++ b/libs/repositories/src/SimulationRepository/SimulationRepositoryTenderly.ts @@ -52,7 +52,7 @@ export class SimulationRepositoryTenderly implements SimulationRepository { const balancesDiff = this.buildBalancesDiff( response.simulation_results.map( - (result) => result.transaction.transaction_info.asset_changes || [] + (result) => result.transaction?.transaction_info.asset_changes || [] ) ); @@ -62,7 +62,7 @@ export class SimulationRepositoryTenderly implements SimulationRepository { id: simulation_result.simulation.id, link: getTenderlySimulationLink(simulation_result.simulation.id), cumulativeBalancesDiff: balancesDiff[i], - gasUsed: simulation_result.transaction.gas_used.toString(), + gasUsed: simulation_result.transaction?.gas_used.toString(), }; }); } diff --git a/libs/repositories/src/SimulationRepository/tenderlyTypes.ts b/libs/repositories/src/SimulationRepository/tenderlyTypes.ts index f30b35b3..c3f04675 100644 --- a/libs/repositories/src/SimulationRepository/tenderlyTypes.ts +++ b/libs/repositories/src/SimulationRepository/tenderlyTypes.ts @@ -57,7 +57,7 @@ export type TenderlySimulatePayload = { // certainly not entirely accurate (and they have some interesting type names) export interface TenderlySimulation { - transaction: Transaction; + transaction?: Transaction; simulation: Simulation; contracts: TenderlyContract[]; generated_access_list: GeneratedAccessList[];