Function predecessor_account_id

Source
pub fn predecessor_account_id() -> AccountId
Expand description

The id of the account that was the previous contract in the chain of cross-contract calls. If this is the first contract, it is equal to signer_account_id.

ยงExamples

use near_sdk::env::predecessor_account_id;
use near_sdk::AccountId;
use std::str::FromStr;

assert_eq!(predecessor_account_id(), "bob.near".parse::<AccountId>().unwrap());