Struct Contract
pub struct Contract<W> {
pub address: AztecAddress,
pub artifact: ContractArtifact,
/* private fields */
}Expand description
A handle to a deployed contract at a specific address.
Provides dynamic method lookup and call construction driven by the
contract artifact (ABI). Use Contract::at to create a handle.
Fields§
§address: AztecAddressThe deployed contract’s address.
artifact: ContractArtifactThe contract’s ABI artifact.
Implementations§
§impl<W> Contract<W>where
W: Wallet,
impl<W> Contract<W>where
W: Wallet,
pub const fn at(
address: AztecAddress,
artifact: ContractArtifact,
wallet: W,
) -> Contract<W>
pub const fn at( address: AztecAddress, artifact: ContractArtifact, wallet: W, ) -> Contract<W>
Create a contract handle at the given address.
pub fn deploy<'a>(
wallet: &'a W,
artifact: ContractArtifact,
args: Vec<AbiValue>,
constructor_name: Option<&str>,
) -> Result<DeployMethod<'a, W>, Error>
pub fn deploy<'a>( wallet: &'a W, artifact: ContractArtifact, args: Vec<AbiValue>, constructor_name: Option<&str>, ) -> Result<DeployMethod<'a, W>, Error>
Create a deployment interaction for the given artifact and constructor args.
Uses default (empty) public keys. For custom public keys, use
deploy_with_public_keys.
pub fn deploy_with_public_keys<'a>(
public_keys: PublicKeys,
wallet: &'a W,
artifact: ContractArtifact,
args: Vec<AbiValue>,
constructor_name: Option<&str>,
) -> Result<DeployMethod<'a, W>, Error>
pub fn deploy_with_public_keys<'a>( public_keys: PublicKeys, wallet: &'a W, artifact: ContractArtifact, args: Vec<AbiValue>, constructor_name: Option<&str>, ) -> Result<DeployMethod<'a, W>, Error>
Create a deployment interaction with custom public keys.
pub fn with_wallet<W2>(self, wallet: W2) -> Contract<W2>where
W2: Wallet,
pub fn with_wallet<W2>(self, wallet: W2) -> Contract<W2>where
W2: Wallet,
Return a new Contract handle using a different wallet.
pub fn method(
&self,
name: &str,
args: Vec<AbiValue>,
) -> Result<ContractFunctionInteraction<'_, W>, Error>
pub fn method( &self, name: &str, args: Vec<AbiValue>, ) -> Result<ContractFunctionInteraction<'_, W>, Error>
Look up a function by name and build a call interaction.
The function’s type (Private, Public, Utility) and is_static
flag are taken from the artifact metadata. The selector must be present
in the artifact; if missing, an error is returned.
Auto Trait Implementations§
impl<W> Freeze for Contract<W>where
W: Freeze,
impl<W> RefUnwindSafe for Contract<W>where
W: RefUnwindSafe,
impl<W> Send for Contract<W>where
W: Send,
impl<W> Sync for Contract<W>where
W: Sync,
impl<W> Unpin for Contract<W>where
W: Unpin,
impl<W> UnwindSafe for Contract<W>where
W: UnwindSafe,
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