pub struct OracleClient {
pub oracle_pubkey: String,
pub attestations: HashMap<String, NonInteractiveOracleAttestation>,
}Expand description
[AIR-3][AIS-3][BPC-3][RES-3] Oracle Client for non-interactive oracle patterns This follows official Bitcoin Improvement Proposals (BIPs) standards for oracle interactions
Fields§
§oracle_pubkey: StringOracle public key in hex format
attestations: HashMap<String, NonInteractiveOracleAttestation>Map of event IDs to attestations
Implementations§
Source§impl OracleClient
impl OracleClient
Sourcepub fn new(oracle_pubkey: &str) -> Self
pub fn new(oracle_pubkey: &str) -> Self
[AIR-3][AIS-3][BPC-3][RES-3] Create a new Oracle Client This follows official Bitcoin Improvement Proposals (BIPs) standards for oracle interactions
Sourcepub async fn get_event_info(&self, event_id: &str) -> DlcResult<OracleEvent>
pub async fn get_event_info(&self, event_id: &str) -> DlcResult<OracleEvent>
[AIR-3][AIS-3][BPC-3][RES-3] Get event information from the oracle This follows official Bitcoin Improvement Proposals (BIPs) standards for oracle interactions
Sourcepub fn verify_attestation(
&self,
_attestation: &OracleAttestation,
) -> DlcResult<bool>
pub fn verify_attestation( &self, _attestation: &OracleAttestation, ) -> DlcResult<bool>
[AIR-3][AIS-3][BPC-3][RES-3] Verify an oracle attestation This follows official Bitcoin Improvement Proposals (BIPs) standards for oracle attestations
Sourcepub async fn create_contract(
&mut self,
_contract_id: &str,
_contract_info: DlcContractInfo,
) -> Result<String, Box<dyn Error + Send + Sync>>
pub async fn create_contract( &mut self, _contract_id: &str, _contract_info: DlcContractInfo, ) -> Result<String, Box<dyn Error + Send + Sync>>
Create DLC contract with oracle
Sourcepub async fn close_contract(
&mut self,
_contract_id: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn close_contract( &mut self, _contract_id: &str, ) -> Result<(), Box<dyn Error + Send + Sync>>
Close DLC contract
Sourcepub async fn get_signature(
&self,
event_id: &str,
) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>>
pub async fn get_signature( &self, event_id: &str, ) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>>
Get oracle signature for event
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if oracle is connected
Sourcepub async fn create_dlc(
&mut self,
params: DlcParameters,
) -> Result<DlcContract, Box<dyn Error + Send + Sync>>
pub async fn create_dlc( &mut self, params: DlcParameters, ) -> Result<DlcContract, Box<dyn Error + Send + Sync>>
Create DLC with parameters
Source§impl OracleClient
[AIR-3][AIS-3][BPC-3][RES-3] Additional methods for OracleClient
impl OracleClient
[AIR-3][AIS-3][BPC-3][RES-3] Additional methods for OracleClient
Sourcepub async fn get_attestation(
&self,
event_id: &str,
) -> Result<NonInteractiveOracleAttestation, DlcError>
pub async fn get_attestation( &self, event_id: &str, ) -> Result<NonInteractiveOracleAttestation, DlcError>
Get attestation for an event [AIR-3][AIS-3][BPC-3][RES-3]
Trait Implementations§
Source§impl Clone for OracleClient
impl Clone for OracleClient
Source§fn clone(&self) -> OracleClient
fn clone(&self) -> OracleClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OracleClient
impl RefUnwindSafe for OracleClient
impl Send for OracleClient
impl Sync for OracleClient
impl Unpin for OracleClient
impl UnwindSafe for OracleClient
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> 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>
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