Answers for "armanriazi•substrate•call•dispatchable•func#ensure_signed#frame_system"

0

armanriazi•substrate•call•dispatchable•func#ensure_signed#frame_system

///ensure_signed
///ensure that the caller of the function was a regular user who owns a private key. This function also returns who that caller was. We store the caller's identity in the caller variable.
/// Ensure that the caller is a regular keypair account

pub fn say_hello(origin) -> DispatchResult {
    // Ensure that the caller is a regular keypair account
    let caller = ensure_signed(origin)?;

    // Print a message
    print("Hello World");
    // Inspecting variables
    debug::info!("Request sent by: {:?}", caller);

    // Indicate that this call succeeded
    Ok(())
}
Posted by: Guest on April-19-2022

Code answers related to "armanriazi•substrate•call•dispatchable•func#ensure_signed#frame_system"

Browse Popular Code Answers by Language