Skip to main content

caller

Function caller 

Source
pub fn caller() -> Result<AccountId>
Expand description

Returns the account ID of the transaction sender.

This is the original caller who initiated the transaction, not necessarily the immediate caller in case of cross-contract calls.

§Returns

The 32-byte account ID of the caller.

§Example

let caller = context::caller()?;
if caller == owner {
    // Caller is the owner
}