Proposal: log binary data for Solidity
The program_id is not needed on "Program return data: " because it always preceeded by the program invoke message, so no need to repeat the program id. Also rename this to "Program return: " since "data" is redundant.
This commit is contained in:
@@ -85,6 +85,23 @@ extern "C" {
|
||||
fn sol_log_64_(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64);
|
||||
}
|
||||
|
||||
/// Print some slices as base64
|
||||
///
|
||||
/// @param data - The slices to print
|
||||
pub fn sol_log_data(data: &[&[u8]]) {
|
||||
#[cfg(target_arch = "bpf")]
|
||||
{
|
||||
extern "C" {
|
||||
fn sol_log_data(data: *const u8, data_len: u64);
|
||||
}
|
||||
|
||||
unsafe { sol_log_data(data as *const _ as *const u8, data.len() as u64) };
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
crate::program_stubs::sol_log_data(data);
|
||||
}
|
||||
|
||||
/// Print the hexadecimal representation of a slice
|
||||
///
|
||||
/// @param slice - The array to print
|
||||
|
Reference in New Issue
Block a user