Contract

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: AztecAddress

The deployed contract’s address.

§artifact: ContractArtifact

The contract’s ABI artifact.

Implementations§

§

impl<W> Contract<W>
where W: Wallet,

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>

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>

Create a deployment interaction with custom public keys.

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>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more