Skip to content

Commit

Permalink
feat: add payment id to notify script (#6586)
Browse files Browse the repository at this point in the history
Description
---
Adds payment_id to the notify scripts
  • Loading branch information
SWvheerden authored Sep 26, 2024
1 parent ea5bf17 commit 7f282d9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions applications/minotari_console_wallet/src/notifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ use minotari_wallet::{
WalletSqlite,
};
use tari_common_types::transaction::TxId;
use tari_core::transactions::transaction_components::encrypted_data::PaymentId;
use tari_utilities::hex::Hex;
use tokio::{runtime::Handle, sync::broadcast::Sender};

pub const LOG_TARGET: &str = "wallet::notifier";
pub const RECEIVED: &str = "received";
pub const SENT: &str = "sent";
Expand Down Expand Up @@ -287,6 +289,7 @@ fn args_from_complete(tx: &CompletedTransaction, event: &str, confirmations: Opt
let amount = format!("{}", tx.amount);
let status = format!("{}", tx.status);
let direction = format!("{}", tx.direction);
let payment_id = format!("{}", tx.payment_id.clone().unwrap_or(PaymentId::Empty));

let kernel = tx.transaction.body.kernels().first();
let (excess, public_nonce, signature) = match kernel {
Expand All @@ -311,6 +314,7 @@ fn args_from_complete(tx: &CompletedTransaction, event: &str, confirmations: Opt
amount,
tx.tx_id.to_string(),
tx.message.clone(),
payment_id,
tx.source_address.to_base58(),
tx.destination_address.to_base58(),
status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
# $2 = amount,
# $3 = tx_id
# $4 = message
# $5 = source address public key
# $6 = destination address public key
# $7 = status
# $8 = excess,
# $9 = public_nonce,
# $10 = signature,
# $11 = number of confirmations (if applicable, otherwise empty string)
# $12 = direction
# $5 = payment_id
# $6 = source address public key
# $7 = destination address public key
# $8 = status
# $9 = excess,
# $10 = public_nonce,
# $11 = signature,
# $12 = number of confirmations (if applicable, otherwise empty string)
# $13 = direction

# 2.
# For transaction "sent" event, we only have the pending outbound transaction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Display for PaymentId {
PaymentId::U64(v) => write!(f, "{}", v),
PaymentId::U256(v) => write!(f, "{}", v),
PaymentId::Address(v) => write!(f, "{}", v.to_emoji_string()),
PaymentId::Open(v) => write!(f, "byte vector of len: {}", v.len()),
PaymentId::Open(v) => write!(f, "byte vector: {}", v.to_hex()),
PaymentId::AddressAndData(v, d) => write!(f, "From {} with data: {:?}", v.to_emoji_string(), d),
}
}
Expand Down
1 change: 0 additions & 1 deletion base_layer/tari_mining_helper_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ tari_utilities = { version = "0.7" }
libc = "0.2.65"
thiserror = "1.0.26"
borsh = "1.2"
hex = "0.4.2"
tokio = { version = "1.36", features = ["rt"] }

[dev-dependencies]
Expand Down

0 comments on commit 7f282d9

Please sign in to comment.