pub struct TransactionHandle<T: Device> { /* private fields */ }
Expand description

Handle to a hardware wallet configured for transaction execution

See DeviceHandle::transaction to create a TransactionHandle

Implementations§

source§

impl<T: Device> TransactionHandle<T>

source

pub async fn key_image( &self, subaddress_index: u64, tx_out_public_key: &TxOutPublic ) -> Result<KeyImage, Error>

Asynchronously compute key image for a given subaddress and tx_out_public_key.

See [KeyImageComputer] for the public blocking API

source§

impl<T: Device> TransactionHandle<T>

source

pub async fn memo_sign( &self, sender_subaddress_index: u64, tx_public_key: &TxOutPublic, target_subaddress: PublicSubaddress, memo_type: &[u8; 2], memo_data_sans_hmac: &[u8; 48] ) -> Result<[u8; 16], Error>

Asynchronously compute the HMAC signature for the provided memo and target address.

See [MemoHmacSigner] for the public blocking API.

source§

impl<T: Device> TransactionHandle<T>

source

pub async fn ring_sign( &self, _message: &[u8], signable_ring: &SignableInputRing, pseudo_output_blinding: Scalar ) -> Result<RingMLSAG, Error>

Asynchronously execute a ring signing operation on ledger hardware.

See [RingSigner] trait for public / blocking API

source§

impl<T: Device> TransactionHandle<T>

source

pub async fn view_subaddress(&self, index: u64) -> Result<ViewSubaddress, Error>

Asynchronously fetch a view subaddress by subaddress index, inheriting the account index from the transaction context.

See [Subaddress] trait for public (blocking) API

source§

impl<T: Device + Send> TransactionHandle<T>

source

pub async fn set_tx_summary( &mut self, block_version: BlockVersion, message: &[u8], summary: &TxSummary, unblinding: &TxSummaryUnblindingData ) -> Result<(), Error>

Load tx summary for signing operation, alternative to set_message for block versions > 3

source§

impl<T: Device + Send> TransactionHandle<T>

source

pub async fn new( info: TxConfig, transport: Arc<Mutex<T>> ) -> Result<Self, Error>

Initialise a new transaction over the provided device

source

pub async fn set_message(&mut self, m: &[u8]) -> Result<(), Error>

Set message for transaction

source

pub async fn await_approval(&mut self, timeout_s: u32) -> Result<(), Error>

Await on-device transaction approval

source

pub async fn complete(self) -> Result<(), Error>

Signal transaction completion

Trait Implementations§

source§

impl<T: Device + Send> Device for TransactionHandle<T>

Exchange impl on transaction context

source§

fn request<'a, 'b, 'life0, 'async_trait, RESP>( &'life0 mut self, request: impl 'async_trait + ApduReq<'a> + Send, buff: &'b mut [u8], timeout: Duration ) -> Pin<Box<dyn Future<Output = Result<RESP, Error>> + Send + 'async_trait>>where RESP: 'async_trait + ApduBase<'b>, Self: 'async_trait, 'a: 'async_trait, 'b: 'async_trait, 'life0: 'async_trait,

Helper for executing transactions with the device

§

fn app_info<'life0, 'async_trait>( &'life0 mut self, timeout: Duration ) -> Pin<Box<dyn Future<Output = Result<AppInfo, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,

Fetch application information
§

fn device_info<'life0, 'async_trait>( &'life0 mut self, timeout: Duration ) -> Pin<Box<dyn Future<Output = Result<DeviceInfo, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,

Fetch device information
source§

impl<T: Device> KeyImageComputer for TransactionHandle<T>

Sync [KeyImageComputer] implementation for TransactionHandle

Note: this MUST be called from a tokio context

source§

fn compute_key_image( &self, subaddress_index: u64, tx_out_public_key: &TxOutPublic ) -> Result<KeyImage, Self::Error>

Compute key image for a given subaddress and tx_out_public_key

§

type Error = Error

[KeyImageComputer] error
source§

impl<T: Device> MemoHmacSigner for TransactionHandle<T>

Sync [MemoHmacSigner] implementation for TransactionHandle

Note: this MUST be called from a tokio context

source§

fn compute_memo_hmac_sig( &self, sender_subaddress_index: u64, tx_public_key: &TxOutPublic, target_subaddress: PublicSubaddress, memo_type: &[u8; 2], memo_data_sans_hmac: &[u8; 48] ) -> Result<[u8; 16], Self::Error>

Compute the HMAC signature for the provided memo and target address

§

type Error = Error

[MemoHmacSigner] error
source§

impl<T: Device> RingSigner for TransactionHandle<T>

Sync [RingSigner] implementation for TransactionHandle

Note: this MUST be called from a tokio context

source§

fn sign( &self, message: &[u8], signable_ring: &SignableInputRing, pseudo_output_blinding: Scalar, _rng: &mut dyn CryptoRngCore ) -> Result<RingMLSAG, SignerError>

Execute ring signing operation on ledger hw

source§

impl<T: Device> Subaddress for TransactionHandle<T>

Sync [Subaddress] implementation for TransactionHandle

Note: this MUST be called from a tokio context

source§

fn subaddress(&self, index: u64) -> Self::Output

Fetch view subaddress by subaddress index, inheriting the account index from the transaction context.

§

type Output = Result<ViewSubaddress, Error>

Subaddress type

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for TransactionHandle<T>

§

impl<T> Send for TransactionHandle<T>where T: Send,

§

impl<T> !Sync for TransactionHandle<T>

§

impl<T> Unpin for TransactionHandle<T>

§

impl<T> !UnwindSafe for TransactionHandle<T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

source§

impl<T> Instrument for T

source§

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

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

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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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