Skip to main content

Account

Trait Account 

Source
pub trait Account: Send + Sync {
    // Required methods
    fn address(&self) -> AccountAddress;
    fn authentication_key(&self) -> AuthenticationKey;
    fn sign(&self, message: &[u8]) -> AptosResult<Vec<u8>>;
    fn public_key_bytes(&self) -> Vec<u8> ;
    fn signature_scheme(&self) -> u8;
}
Expand description

Trait for account types that can sign transactions.

This trait provides a common interface for different account types (Ed25519, Secp256k1, multi-sig, keyless, etc.).

Required Methods§

Source

fn address(&self) -> AccountAddress

Returns the account address.

Source

fn authentication_key(&self) -> AuthenticationKey

Returns the authentication key.

Source

fn sign(&self, message: &[u8]) -> AptosResult<Vec<u8>>

Signs a message and returns the signature bytes.

§Errors

May return an error if signing fails (e.g., insufficient signatures for multi-sig accounts).

Source

fn public_key_bytes(&self) -> Vec<u8>

Returns the public key bytes.

Source

fn signature_scheme(&self) -> u8

Returns the scheme identifier for this account type.

Implementors§

Source§

impl Account for AnyAccount

Source§

impl Account for Ed25519Account

Available on crate feature ed25519 only.
Source§

impl Account for Ed25519SingleKeyAccount

Available on crate feature ed25519 only.
Source§

impl Account for KeylessAccount

Available on crate feature keyless only.
Source§

impl Account for MultiEd25519Account

Available on crate feature ed25519 only.
Source§

impl Account for MultiKeyAccount

Source§

impl Account for Secp256k1Account

Available on crate feature secp256k1 only.
Source§

impl Account for Secp256r1Account

Available on crate feature secp256r1 only.