pub struct TransactionRequest { /* private fields */ }
Expand description
A ZIP321 transaction request.
A ZIP 321 request may include one or more such requests for payment. When constructing a transaction in response to such a request, a separate output should be added to the transaction for each payment value in the request.
Implementations§
Source§impl TransactionRequest
impl TransactionRequest
Sourcepub fn new(payments: Vec<Payment>) -> Result<TransactionRequest, Zip321Error>
pub fn new(payments: Vec<Payment>) -> Result<TransactionRequest, Zip321Error>
Constructs a new transaction request that obeys the ZIP-321 invariants.
Sourcepub fn from_indexed(
payments: BTreeMap<usize, Payment>,
) -> Result<TransactionRequest, Zip321Error>
pub fn from_indexed( payments: BTreeMap<usize, Payment>, ) -> Result<TransactionRequest, Zip321Error>
Constructs a new transaction request from the provided map from payment index to payment.
Payment index 0 will be mapped to the empty payment index.
Sourcepub fn payments(&self) -> &BTreeMap<usize, Payment>
pub fn payments(&self) -> &BTreeMap<usize, Payment>
Returns the map of payments that make up this request.
This is a map from payment index to payment. Payment index 0
is used to denote
the empty payment index in the returned values.
Sourcepub fn total(&self) -> Result<Zatoshis, BalanceError>
pub fn total(&self) -> Result<Zatoshis, BalanceError>
Returns the total value of payments to be made.
Returns Err
in the case of overflow, or if the value is
outside the range 0..=MAX_MONEY
zatoshis.
Sourcepub fn to_uri(&self) -> String
pub fn to_uri(&self) -> String
Convert this request to a URI string.
Returns None if the payment request is empty.
Sourcepub fn from_uri(uri: &str) -> Result<Self, Zip321Error>
pub fn from_uri(uri: &str) -> Result<Self, Zip321Error>
Parse the provided URI to a payment request value.
Trait Implementations§
Source§impl Clone for TransactionRequest
impl Clone for TransactionRequest
Source§fn clone(&self) -> TransactionRequest
fn clone(&self) -> TransactionRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TransactionRequest
impl Debug for TransactionRequest
Source§impl PartialEq for TransactionRequest
impl PartialEq for TransactionRequest
impl Eq for TransactionRequest
impl StructuralPartialEq for TransactionRequest
Auto Trait Implementations§
impl Freeze for TransactionRequest
impl RefUnwindSafe for TransactionRequest
impl Send for TransactionRequest
impl Sync for TransactionRequest
impl Unpin for TransactionRequest
impl UnwindSafe for TransactionRequest
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> 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