Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync FFI and Console Wallet payment Id display options #6419

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl TransactionsTab {
Some(v) => {
if let PaymentId::Open(bytes) = v {
String::from_utf8(bytes)
.unwrap_or_else(|_| "Invalid".to_string())
.unwrap_or_else(|_| "Invalid string".to_string())
.to_string()
} else {
format!("#{}", v)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,8 @@ impl AppState {
let payment_id = if payment_id_str.is_empty() {
PaymentId::Empty
} else {
let payment_id_u64: u64 = payment_id_str
.parse::<u64>()
.map_err(|_| UiError::HexError("Could not convert payment_id to bytes".to_string()))?;
PaymentId::U64(payment_id_u64)
let bytes = payment_id_str.as_bytes().to_vec();
PaymentId::Open(bytes)
};

let output_features = OutputFeatures { ..Default::default() };
Expand Down
6 changes: 2 additions & 4 deletions base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7100,7 +7100,6 @@ pub unsafe extern "C" fn wallet_send_transaction(
ptr::swap(error_out, &mut error as *mut c_int);
return 0;
}

if destination.is_null() {
error = LibWalletError::from(InterfaceError::NullError("dest_public_key".to_string())).code;
ptr::swap(error_out, &mut error as *mut c_int);
Expand All @@ -7121,8 +7120,6 @@ pub unsafe extern "C" fn wallet_send_transaction(

let message_string;
if message.is_null() {
error = LibWalletError::from(InterfaceError::NullError("message".to_string())).code;
ptr::swap(error_out, &mut error as *mut c_int);
message_string = CString::new("")
.expect("Blank CString will not fail")
.to_str()
Expand All @@ -7147,7 +7144,8 @@ pub unsafe extern "C" fn wallet_send_transaction(
} else {
match CStr::from_ptr(payment_id_string).to_str() {
Ok(v) => {
let bytes = v.as_bytes().to_vec();
let rust_str = v.to_owned();
let bytes = rust_str.as_bytes().to_vec();
PaymentId::Open(bytes)
},
_ => {
Expand Down
Loading