pub struct ContractManager { /* private fields */ }Expand description
Registry and persistence layer for built-in and custom Ark contracts.
ContractManager is a public extension point: consumers can register custom
ContractSpec implementations while reusing the SDK’s validation, persistence, and spend
selection plumbing. The low-level row APIs expose stored contracts keyed by script;
wallet-facing code should prefer semantic annotated outputs such as AnnotatedVtxo and
AnnotatedBoardingOutput.
Implementations§
Source§impl ContractManager
impl ContractManager
pub fn new(network: Network, store: Box<dyn ContractStore>) -> Self
pub fn new_with_builtins( network: Network, store: Box<dyn ContractStore>, ) -> Result<Self, Error>
pub fn in_memory(network: Network) -> Self
pub fn in_memory_with_builtins(network: Network) -> Result<Self, Error>
pub fn network(&self) -> Network
pub fn register<T: ContractSpec>(&mut self) -> Result<(), Error>
pub fn register_builtins(&mut self) -> Result<(), Error>
pub fn insert<T: ContractSpec>( &mut self, contract: T, state: ContractState, key_index: Option<u32>, ) -> Result<StoredContract, Error>
pub fn insert_or_get<T: ContractSpec>( &mut self, contract: T, state: ContractState, key_index: Option<u32>, ) -> Result<StoredContract, Error>
pub fn insert_stored(&mut self, stored: StoredContract) -> Result<(), Error>
pub fn get( &self, script_pubkey: &Script, ) -> Result<Option<StoredContract>, Error>
pub fn get_typed<T: ContractSpec>( &self, script_pubkey: &Script, ) -> Result<Option<T>, Error>
pub fn list(&self) -> Result<Vec<StoredContract>, Error>
pub fn list_by_type( &self, contract_type: ContractType, ) -> Result<Vec<StoredContract>, Error>
pub fn list_active_by_type( &self, contract_type: ContractType, ) -> Result<Vec<StoredContract>, Error>
pub fn update_state( &mut self, script_pubkey: &Script, state: ContractState, ) -> Result<(), Error>
pub fn spendable_selections( &self, stored: &StoredContract, ) -> Result<Vec<SpendSelection>, Error>
pub fn annotate_vtxos( &self, vtxos: Vec<VirtualTxOutPoint>, ) -> Result<Vec<AnnotatedVtxo>, Error>
pub fn annotated_boarding_outputs( &self, ) -> Result<Vec<AnnotatedBoardingOutput>, Error>
Auto Trait Implementations§
impl !RefUnwindSafe for ContractManager
impl !UnwindSafe for ContractManager
impl Freeze for ContractManager
impl Send for ContractManager
impl Sync for ContractManager
impl Unpin for ContractManager
impl UnsafeUnpin for ContractManager
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request