diff --git a/cmd/soroban-cli/src/rpc/mod.rs b/cmd/soroban-cli/src/rpc/mod.rs index db5cc72f28..14ef5341c5 100644 --- a/cmd/soroban-cli/src/rpc/mod.rs +++ b/cmd/soroban-cli/src/rpc/mod.rs @@ -626,7 +626,7 @@ soroban config identity fund {address} --helper-url "# pub async fn prepare_transaction( &self, tx: &Transaction, - ) -> Result<(Transaction, Option), Error> { + ) -> Result<(Transaction, Option, Vec), Error> { tracing::trace!(?tx); let sim_response = self .simulate_transaction(&TransactionEnvelope::Tx(TransactionV1Envelope { @@ -634,7 +634,18 @@ soroban config identity fund {address} --helper-url "# signatures: VecM::default(), })) .await?; - Ok((assemble(tx, &sim_response)?, sim_response.restore_preamble)) + let events = sim_response + .events + .iter() + .map(DiagnosticEvent::from_xdr_base64) + .collect::, _>>()?; + Ok(( + assemble(tx, &sim_response)?, + sim_response + .restore_preamble + .filter(|p| !p.transaction_data.is_empty()), + events, + )) } pub async fn prepare_and_send_transaction( @@ -647,7 +658,7 @@ soroban config identity fund {address} --helper-url "# log_resources: Option, ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { let GetLatestLedgerResponse { sequence, .. } = self.get_latest_ledger().await?; - let (mut unsigned_tx, restore_preamble) = + let (mut unsigned_tx, restore_preamble, events) = self.prepare_transaction(tx_without_preflight).await?; if let Some(restore) = restore_preamble { // Build and submit the restore transaction @@ -694,7 +705,7 @@ soroban config identity fund {address} --helper-url "# .. } = &fee_ready_txn.operations[0] { - log(&resources.footprint, &[auth.clone()], &[]); + log(&resources.footprint, &[auth.clone()], &events); } } if let Some(log) = log_resources {