Skip to content

Commit

Permalink
feat: add get tari address to wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Cifko committed Dec 29, 2022
1 parent 0032367 commit 1b0ed0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions applications/tari_app_grpc/proto/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ service Wallet {
rpc CheckForUpdates (Empty) returns (SoftwareUpdate);
// This returns the identity information
rpc Identify (GetIdentityRequest) returns (GetIdentityResponse);
// This returns the tari address
rpc GetAddress (Empty) returns (GetAddressResponse);
// This returns a coinbase transaction
rpc GetCoinbase (GetCoinbaseRequest) returns (GetCoinbaseResponse);
// Send Tari to a number of recipients
Expand Down Expand Up @@ -87,6 +89,10 @@ message GetVersionResponse {
string version = 1;
}

message GetAddressResponse {
bytes address = 1;
}

message TransferRequest {
repeated PaymentRecipient recipients = 1;
}
Expand Down
10 changes: 10 additions & 0 deletions applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use tari_app_grpc::{
CreateBurnTransactionResponse,
CreateTemplateRegistrationRequest,
CreateTemplateRegistrationResponse,
GetAddressResponse,
GetBalanceRequest,
GetBalanceResponse,
GetCoinbaseRequest,
Expand Down Expand Up @@ -226,6 +227,15 @@ impl wallet_server::Wallet for WalletGrpcServer {
}))
}

async fn get_address(&self, _: Request<tari_rpc::Empty>) -> Result<Response<GetAddressResponse>, Status> {
let network = self.wallet.network.as_network();
let pk = self.wallet.comms.node_identity().public_key().clone();
let address = TariAddress::new(pk, network);
Ok(Response::new(GetAddressResponse {
address: address.to_bytes().to_vec(),
}))
}

async fn set_base_node(
&self,
request: Request<SetBaseNodeRequest>,
Expand Down

0 comments on commit 1b0ed0b

Please sign in to comment.