pub struct SchnorrAccountContract { /* private fields */ }Expand description
A Schnorr-based account contract.
This is the primary account contract implementation, equivalent to the TS
SchnorrAccountContract. It uses a Grumpkin signing key for Schnorr
signatures and routes transactions through the DefaultAccountEntrypoint.
§Example
use aztec_rs::account::{AccountManager, SchnorrAccountContract};
use aztec_rs::types::Fr;
use aztec_rs::wallet::{ChainInfo, MockWallet};
let wallet = MockWallet::new(ChainInfo {
chain_id: Fr::from(31337u64),
version: Fr::from(1u64),
});
let secret_key = Fr::from(12345u64);
let contract = SchnorrAccountContract::new(secret_key);
let manager = AccountManager::create(wallet, secret_key, Box::new(contract), None::<Fr>).await?;Implementations§
Source§impl SchnorrAccountContract
impl SchnorrAccountContract
Sourcepub fn new(secret_key: Fr) -> SchnorrAccountContract
pub fn new(secret_key: Fr) -> SchnorrAccountContract
Create a new Schnorr account contract from a secret key.
Derives the signing key pair from the secret key using the standard Aztec key derivation.
Sourcepub fn new_with_signing_key(
secret_key: Fr,
signing_key: Fq,
) -> SchnorrAccountContract
pub fn new_with_signing_key( secret_key: Fr, signing_key: Fq, ) -> SchnorrAccountContract
Create a new Schnorr account contract with an explicit signing key.
Unlike new, this does not derive the signing key
from the secret key. This is the Rust equivalent of the TS
new SchnorrAccountContract(signingKey) + getSchnorrAccountContractAddress(secret, salt, signingKey).
Use this when multiple accounts share the same encryption key (secret) but have different signing keys.
Sourcepub fn signing_public_key(&self) -> &Point
pub fn signing_public_key(&self) -> &Point
Returns the Schnorr signing public key.
Sourcepub fn secret_key(&self) -> Fr
pub fn secret_key(&self) -> Fr
Returns the secret key used for key derivation.
Trait Implementations§
Source§impl AccountContract for SchnorrAccountContract
impl AccountContract for SchnorrAccountContract
Source§fn contract_artifact<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ContractArtifact, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
SchnorrAccountContract: 'async_trait,
fn contract_artifact<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ContractArtifact, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
SchnorrAccountContract: 'async_trait,
Source§fn initialization_function_and_args<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InitializationSpec>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
SchnorrAccountContract: 'async_trait,
fn initialization_function_and_args<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InitializationSpec>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
SchnorrAccountContract: 'async_trait,
Source§fn account(&self, address: CompleteAddress) -> Box<dyn Account>
fn account(&self, address: CompleteAddress) -> Box<dyn Account>
Account instance for the given address.Source§fn auth_witness_provider(
&self,
_address: CompleteAddress,
) -> Box<dyn AuthorizationProvider>
fn auth_witness_provider( &self, _address: CompleteAddress, ) -> Box<dyn AuthorizationProvider>
AuthorizationProvider for the given address.Auto Trait Implementations§
impl Freeze for SchnorrAccountContract
impl RefUnwindSafe for SchnorrAccountContract
impl Send for SchnorrAccountContract
impl Sync for SchnorrAccountContract
impl Unpin for SchnorrAccountContract
impl UnwindSafe for SchnorrAccountContract
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more