From 7fffec80e57a97e8d867335b10948c4835314317 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Fri, 7 Oct 2022 12:52:23 +0400 Subject: [PATCH] fix(wallet/grpc): add transaction id and template_address to template_reg response --- applications/tari_app_grpc/proto/wallet.proto | 5 ++++- .../src/grpc/wallet_grpc_server.rs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/applications/tari_app_grpc/proto/wallet.proto b/applications/tari_app_grpc/proto/wallet.proto index 5a8357c637..417b9dc439 100644 --- a/applications/tari_app_grpc/proto/wallet.proto +++ b/applications/tari_app_grpc/proto/wallet.proto @@ -267,7 +267,10 @@ message CreateTemplateRegistrationRequest { uint64 fee_per_gram = 2; } -message CreateTemplateRegistrationResponse { } +message CreateTemplateRegistrationResponse { + uint64 tx_id = 1; + bytes template_address = 2; +} message CancelTransactionRequest { uint64 tx_id = 1; diff --git a/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs b/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs index 980f1052f4..80c3b91ddb 100644 --- a/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs +++ b/applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs @@ -922,12 +922,23 @@ impl wallet_server::Wallet for WalletGrpcServer { "Template registration transaction: {:?}", transaction ); - let _ = transaction_service + let reg_output = transaction + .body + .outputs() + .iter() + .find(|o| o.features.output_type == OutputType::CodeTemplateRegistration) + .unwrap(); + let template_address = reg_output.hash(); + + transaction_service .submit_transaction(tx_id, transaction, 0.into(), message) .await .map_err(|e| Status::internal(e.to_string()))?; - Ok(Response::new(CreateTemplateRegistrationResponse {})) + Ok(Response::new(CreateTemplateRegistrationResponse { + tx_id: tx_id.as_u64(), + template_address: template_address.to_vec(), + })) } async fn register_validator_node(