As a Public Account with the type PublicAccount, which represents the publicly available portion of an account.
struct PublicAccount {
let address: Address
// Storage operations
fun getCapability<T>(_ path: Path): Capability<T>?
fun getLinkTarget(_ path: Path): Path?
}
Any code can get the PublicAccount for an account address using the built-in getAccount function:
fun getAccount(_ address: Address): PublicAccount
As an Authorized Account with type AuthAccount, which represents the authorized portion of an account.
Access to an AuthAccount means having full access to its storage, public keys, and code.
Only signed transactions can get the AuthAccount for an account. For each script signer of the transaction, the corresponding AuthAccount is passed to the prepare phase of the transaction.
struct AuthAccount {
let address: Address
// Contract code
fun setCode(_ code: [UInt8], ... contractInitializerArguments)
// Key management
fun addPublicKey(_ publicKey: [UInt8])
fun removePublicKey(_ index: Int)
// Storage operations
fun save<T>(_ value: T, to: Path)
fun load<T>(from: Path): T?
fun copy<T: AnyStruct>(from: Path): T?
fun borrow<T: &Any>(from: Path): T?
fun link<T: &Any>(_ newCapabilityPath: Path, target: Path): Capability<T>?
fun getLinkTarget(_ path: Path): Path?
fun unlink(_ path: Path)
fun getCapability<T: &Any>(_ path Path): Capability<T>?
}