pub struct BitcoinAdapter { /* private fields */ }Expand description
[AIR-3][AIS-3][BPC-3][RES-3] Bitcoin adapter for Bitcoin implementation
Implementations§
Source§impl BitcoinAdapter
impl BitcoinAdapter
Sourcepub async fn new(config: BitcoinConfig) -> Result<Self, Box<dyn Error>>
pub async fn new(config: BitcoinConfig) -> Result<Self, Box<dyn Error>>
Create a new Bitcoin adapter
Sourcepub fn get_implementation(&self) -> Arc<dyn BitcoinInterface>
pub fn get_implementation(&self) -> Arc<dyn BitcoinInterface>
Get the Bitcoin implementation
Trait Implementations§
Source§impl BitcoinInterface for BitcoinAdapter
Implementation of BitcoinInterface following hexagonal architecture pattern
[AIR-3][AIS-3][BPC-3][RES-3] Using async_trait for async interface implementation
impl BitcoinInterface for BitcoinAdapter
Implementation of BitcoinInterface following hexagonal architecture pattern [AIR-3][AIS-3][BPC-3][RES-3] Using async_trait for async interface implementation
Source§fn get_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
txid: &'life1 str,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
txid: &'life1 str,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Get transaction by ID
Source§fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Block>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Block>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Get block by hash
Source§fn get_block_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BitcoinResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BitcoinResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Get current block height
Source§fn generate_address<'life0, 'async_trait>(
&'life0 self,
address_type: AddressType,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Address>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_address<'life0, 'async_trait>(
&'life0 self,
address_type: AddressType,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Address>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Generate address of specified type
Source§fn create_transaction<'life0, 'async_trait>(
&'life0 self,
outputs: Vec<(String, u64)>,
fee_rate: u64,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_transaction<'life0, 'async_trait>(
&'life0 self,
outputs: Vec<(String, u64)>,
fee_rate: u64,
) -> Pin<Box<dyn Future<Output = BitcoinResult<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Create transaction with outputs and fee rate
Source§fn broadcast_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = BitcoinResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn broadcast_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = BitcoinResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Broadcast transaction to network
Source§fn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 Address,
) -> Pin<Box<dyn Future<Output = BitcoinResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 Address,
) -> Pin<Box<dyn Future<Output = BitcoinResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Get balance for address
Source§fn estimate_fee<'life0, 'async_trait>(
&'life0 self,
target_blocks: u8,
) -> Pin<Box<dyn Future<Output = BitcoinResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn estimate_fee<'life0, 'async_trait>(
&'life0 self,
target_blocks: u8,
) -> Pin<Box<dyn Future<Output = BitcoinResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Estimate fee for target confirmation blocks
Source§fn get_block_header<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = BitcoinResult<BlockHeader>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_block_header<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = BitcoinResult<BlockHeader>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Get block header by hash
Source§fn verify_merkle_proof<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tx_hash: &'life1 str,
block_header: &'life2 BlockHeader,
) -> Pin<Box<dyn Future<Output = BitcoinResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_merkle_proof<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tx_hash: &'life1 str,
block_header: &'life2 BlockHeader,
) -> Pin<Box<dyn Future<Output = BitcoinResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Verify merkle proof for transaction
Source§fn send_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = BitcoinResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = BitcoinResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
[AIR-3][AIS-3][BPC-3][RES-3] Send transaction to network
Source§fn implementation_type(&self) -> BitcoinImplementationType
fn implementation_type(&self) -> BitcoinImplementationType
Auto Trait Implementations§
impl Freeze for BitcoinAdapter
impl !RefUnwindSafe for BitcoinAdapter
impl Send for BitcoinAdapter
impl Sync for BitcoinAdapter
impl Unpin for BitcoinAdapter
impl !UnwindSafe for BitcoinAdapter
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
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>
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