create_transaction_for_address_with_shared_secret takes optional message

This commit is contained in:
Sosthene 2024-05-14 22:22:17 +02:00
parent 62d135925e
commit 6bf80eb0a5

View File

@ -38,7 +38,7 @@ use crate::crypto::AnkSharedSecret;
pub fn create_transaction_for_address_with_shared_secret(
sp_address: SilentPaymentAddress,
sp_wallet: &SpWallet,
message: String,
message: Option<String>,
fee_rate: Amount,
) -> Result<(Transaction, AnkSharedSecret)> {
let available_outpoints = sp_wallet.get_outputs().to_spendable_list();
@ -70,7 +70,7 @@ pub fn create_transaction_for_address_with_shared_secret(
let mut new_psbt = sp_wallet.get_client().create_new_psbt(
inputs,
vec![recipient],
Some(message.as_bytes()),
message.as_ref().map(|m| m.as_bytes()),
)?;
let change_addr = sp_wallet.get_client().sp_receiver.get_change_address();