pub struct DefaultTransactionDependencyProvider {
pub inner: Arc<Mutex<DefaultTxDepProviderInner>>,
}Expand description
A transaction dependency provider use ckb rpc client as backend, and with LRU cache supported
Fields§
§inner: Arc<Mutex<DefaultTxDepProviderInner>>Implementations§
Source§impl DefaultTransactionDependencyProvider
impl DefaultTransactionDependencyProvider
Sourcepub fn new(
url: &str,
cache_capacity: usize,
) -> DefaultTransactionDependencyProvider
pub fn new( url: &str, cache_capacity: usize, ) -> DefaultTransactionDependencyProvider
Arguments:
urlis the ckb http jsonrpc server url- When
cache_capacityis 0 for not using cache.
pub fn apply_tx( &mut self, tx: Transaction, tip_block_number: u64, ) -> Result<(), TransactionDependencyError>
pub async fn apply_tx_async( &mut self, tx: Transaction, tip_block_number: u64, ) -> Result<(), TransactionDependencyError>
pub fn get_cell_with_data( &self, out_point: &OutPoint, ) -> Result<(CellOutput, Bytes), TransactionDependencyError>
pub async fn get_cell_with_data_async( &self, out_point: &OutPoint, ) -> Result<(CellOutput, Bytes), TransactionDependencyError>
Trait Implementations§
Source§impl Clone for DefaultTransactionDependencyProvider
impl Clone for DefaultTransactionDependencyProvider
Source§fn clone(&self) -> DefaultTransactionDependencyProvider
fn clone(&self) -> DefaultTransactionDependencyProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl TransactionDependencyProvider for DefaultTransactionDependencyProvider
impl TransactionDependencyProvider for DefaultTransactionDependencyProvider
fn get_transaction_async<'life0, 'life1, 'async_trait>(
&'life0 self,
tx_hash: &'life1 Byte32,
) -> Pin<Box<dyn Future<Output = Result<TransactionView, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_cell_async<'life0, 'life1, 'async_trait>(
&'life0 self,
out_point: &'life1 OutPoint,
) -> Pin<Box<dyn Future<Output = Result<CellOutput, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_cell_async<'life0, 'life1, 'async_trait>(
&'life0 self,
out_point: &'life1 OutPoint,
) -> Pin<Box<dyn Future<Output = Result<CellOutput, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
For get the output information of inputs or cell_deps, those cell should be live cell
Source§fn get_cell_data_async<'life0, 'life1, 'async_trait>(
&'life0 self,
out_point: &'life1 OutPoint,
) -> Pin<Box<dyn Future<Output = Result<Bytes, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_cell_data_async<'life0, 'life1, 'async_trait>(
&'life0 self,
out_point: &'life1 OutPoint,
) -> Pin<Box<dyn Future<Output = Result<Bytes, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
For get the output data information of inputs or cell_deps
Source§fn get_header_async<'life0, 'life1, 'async_trait>(
&'life0 self,
block_hash: &'life1 Byte32,
) -> Pin<Box<dyn Future<Output = Result<HeaderView, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_header_async<'life0, 'life1, 'async_trait>(
&'life0 self,
block_hash: &'life1 Byte32,
) -> Pin<Box<dyn Future<Output = Result<HeaderView, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
For get the header information of header_deps
Source§fn get_block_extension_async<'life0, 'life1, 'async_trait>(
&'life0 self,
block_hash: &'life1 Byte32,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_block_extension_async<'life0, 'life1, 'async_trait>(
&'life0 self,
block_hash: &'life1 Byte32,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, TransactionDependencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
For get_block_extension
Source§fn get_transaction(
&self,
tx_hash: &Byte32,
) -> Result<TransactionView, TransactionDependencyError>
fn get_transaction( &self, tx_hash: &Byte32, ) -> Result<TransactionView, TransactionDependencyError>
For verify certain cell belong to certain transaction
Source§fn get_cell(
&self,
out_point: &OutPoint,
) -> Result<CellOutput, TransactionDependencyError>
fn get_cell( &self, out_point: &OutPoint, ) -> Result<CellOutput, TransactionDependencyError>
For get the output information of inputs or cell_deps, those cell should be live cell
Source§fn get_cell_data(
&self,
out_point: &OutPoint,
) -> Result<Bytes, TransactionDependencyError>
fn get_cell_data( &self, out_point: &OutPoint, ) -> Result<Bytes, TransactionDependencyError>
For get the output data information of inputs or cell_deps
Source§fn get_header(
&self,
block_hash: &Byte32,
) -> Result<HeaderView, TransactionDependencyError>
fn get_header( &self, block_hash: &Byte32, ) -> Result<HeaderView, TransactionDependencyError>
For get the header information of header_deps
Source§fn get_block_extension(
&self,
block_hash: &Byte32,
) -> Result<Option<Bytes>, TransactionDependencyError>
fn get_block_extension( &self, block_hash: &Byte32, ) -> Result<Option<Bytes>, TransactionDependencyError>
For get_block_extension
Auto Trait Implementations§
impl Freeze for DefaultTransactionDependencyProvider
impl !RefUnwindSafe for DefaultTransactionDependencyProvider
impl Send for DefaultTransactionDependencyProvider
impl Sync for DefaultTransactionDependencyProvider
impl Unpin for DefaultTransactionDependencyProvider
impl !UnwindSafe for DefaultTransactionDependencyProvider
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
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 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>
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