-
Currently, there is no support for logging msgs in Solana Programs from Poseidon.
-
When transpiling Poseidon code to Anchor, the logging functionality provided by console.log! calls is not preserved and not converted to msg! in Anchor.
Example Poseidon code -
import { Account, Pubkey, Result, u32 } from "@solanaturbine/poseidon";
export default class ProcessingInstructionsProgram {
static PROGRAM_ID = new Pubkey(
"DgoL5J44aspizyUs9fcnpGEUJjWTLJRCfx8eYtUMYczf"
);
go_to_park(height: u32, name: String): Result {
// Display a welcome message
console.log("Welcome to the park,", name);
// Check if the height is above the threshold
if (Number(height) > 5) {
console.log("You are tall enough to ride this ride. Congratulations.");
} else {
console.log("You are NOT tall enough to ride this ride. Sorry mate.");
}
}
}
and the transpiled Anchor code:
use anchor_lang::prelude::*;
declare_id!("DgoL5J44aspizyUs9fcnpGEUJjWTLJRCfx8eYtUMYczf");
#[program]
pub mod processing_instructions_program {
use super::*;
pub fn go_to_park(
ctx: Context<GoToParkContext>,
height: u32,
name: String,
) -> Result<()> {
Ok(())
}
}
#[derive(Accounts)]
pub struct GoToParkContext<'info> {}
Adding this msg! logging feature can be particularly useful for displaying informational messages, such as whether a user meets certain conditions.
Currently, there is no support for logging msgs in Solana Programs from Poseidon.
When transpiling Poseidon code to Anchor, the logging functionality provided by console.log! calls is not preserved and not converted to msg! in Anchor.
Example Poseidon code -
and the transpiled Anchor code:
Adding this msg! logging feature can be particularly useful for displaying informational messages, such as whether a user meets certain conditions.