Skip to content

Commit

Permalink
feat: add one-sided addresses to grpc (#6542)
Browse files Browse the repository at this point in the history
Description
---
Currently get_address grpc call only returns the interactive address.
This adds the one-sided address as well, showing both.
  • Loading branch information
SWvheerden authored Sep 10, 2024
1 parent 1f18e7d commit 0a5d20b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
3 changes: 2 additions & 1 deletion applications/minotari_app_grpc/proto/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ message GetVersionResponse {
}

message GetAddressResponse {
bytes address = 1;
bytes interactive_address = 1;
bytes one_sided_address = 2;
}

message TransferRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,19 @@ impl wallet_server::Wallet for WalletGrpcServer {
}

async fn get_address(&self, _: Request<tari_rpc::Empty>) -> Result<Response<GetAddressResponse>, Status> {
let address = self
let interactive_address = self
.wallet
.get_wallet_interactive_address()
.await
.map_err(|e| Status::internal(format!("{:?}", e)))?;
let one_sided_address = self
.wallet
.get_wallet_one_sided_address()
.await
.map_err(|e| Status::internal(format!("{:?}", e)))?;
Ok(Response::new(GetAddressResponse {
address: address.to_vec(),
interactive_address: interactive_address.to_vec(),
one_sided_address: one_sided_address.to_vec(),
}))
}

Expand Down
6 changes: 3 additions & 3 deletions integration_tests/src/merge_mining_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ impl MergeMiningProxyProcess {
let mut wallet_client = create_wallet_client(world, self.wallet_name.clone())
.await
.expect("wallet grpc client");
let wallet_public_key = &wallet_client
let wallet_address = &wallet_client
.get_address(grpc::Empty {})
.await
.unwrap()
.into_inner()
.address;
let wallet_payment_address = TariAddress::from_bytes(wallet_public_key).unwrap();
.interactive_address;
let wallet_payment_address = TariAddress::from_bytes(wallet_address).unwrap();
thread::spawn(move || {
let cli = Cli {
common: CommonCliArgs {
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/src/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ impl MinerProcess {
.await
.expect("wallet grpc client");

let wallet_public_key = &wallet_client
let wallet_adress = &wallet_client
.get_address(grpc::Empty {})
.await
.unwrap()
.into_inner()
.address;
let wallet_payment_address = TariAddress::from_bytes(wallet_public_key).unwrap();
.interactive_address;
let wallet_payment_address = TariAddress::from_bytes(wallet_adress).unwrap();

let node = world.get_node(&self.base_node_name).unwrap().grpc_port;
let temp_dir = world
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl TariWorld {
.await
.unwrap()
.into_inner()
.address
.interactive_address
},
Err(_) => {
let ffi_wallet = self.get_ffi_wallet(name).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/tests/steps/wallet_cli_steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async fn send_from_cli(world: &mut TariWorld, amount: u64, wallet_a: String, wal
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let wallet_b_address = TariAddress::from_base58(wallet_b_address.as_str()).unwrap();

Expand Down Expand Up @@ -208,7 +208,7 @@ async fn make_it_rain(
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let wallet_b_address = TariAddress::from_base58(wallet_b_address.as_str()).unwrap();

Expand Down
20 changes: 10 additions & 10 deletions integration_tests/tests/steps/wallet_steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ async fn wallet_detects_all_txs_are_at_least_in_some_status(
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let tx_ids = world.wallet_tx_ids.get(&wallet_address).unwrap();

Expand Down Expand Up @@ -347,7 +347,7 @@ async fn wallet_detects_all_txs_as_broadcast(world: &mut TariWorld, wallet_name:
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let tx_ids = world.wallet_tx_ids.get(&wallet_address).unwrap();

Expand Down Expand Up @@ -400,7 +400,7 @@ async fn wallet_detects_last_tx_as_pending(world: &mut TariWorld, wallet: String
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let tx_ids = world.wallet_tx_ids.get(&wallet_address).unwrap();
let tx_id = tx_ids.last().unwrap(); // get last transaction
Expand Down Expand Up @@ -446,7 +446,7 @@ async fn wallet_detects_last_tx_as_cancelled(world: &mut TariWorld, wallet: Stri
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let tx_ids = world.wallet_tx_ids.get(&wallet_address).unwrap();
let tx_id = tx_ids.last().unwrap(); // get last transaction
Expand Down Expand Up @@ -1116,7 +1116,7 @@ async fn stop_wallet(world: &mut TariWorld, wallet: String) {
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();
let wallet_ps = world.wallets.get_mut(&wallet).unwrap();
world.wallet_addresses.insert(wallet.clone(), wallet_address);
Expand Down Expand Up @@ -2116,7 +2116,7 @@ async fn send_one_sided_stealth_transaction(
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();

let mut receiver_client = create_wallet_client(world, receiver.clone()).await.unwrap();
Expand All @@ -2125,7 +2125,7 @@ async fn send_one_sided_stealth_transaction(
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();

let payment_recipient = PaymentRecipient {
Expand Down Expand Up @@ -2604,7 +2604,7 @@ async fn multi_send_txs_from_wallet(
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();

let mut receiver_wallet_client = create_wallet_client(world, receiver.clone()).await.unwrap();
Expand All @@ -2613,7 +2613,7 @@ async fn multi_send_txs_from_wallet(
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();

let mut transfer_res = vec![];
Expand Down Expand Up @@ -2766,7 +2766,7 @@ async fn cancel_last_transaction_in_wallet(world: &mut TariWorld, wallet: String
.await
.unwrap()
.into_inner()
.address
.interactive_address
.to_hex();

let wallet_tx_ids = world.wallet_tx_ids.get(&wallet_address).unwrap();
Expand Down

0 comments on commit 0a5d20b

Please sign in to comment.