Skip to main content

Escrow

Struct Escrow 

Source
pub struct Escrow {
    pub asset: Option<String>,
    pub currency: Option<String>,
    pub amount: String,
    pub originator: Party,
    pub beneficiary: Party,
    pub expiry: String,
    pub agreement: Option<String>,
    pub agents: Vec<Agent>,
    pub metadata: HashMap<String, Value>,
}
Expand description

Escrow message for holding assets on behalf of parties

The Escrow message allows one agent to request another agent to hold a specified amount of currency or asset from a party in escrow on behalf of another party.

Fields§

§asset: Option<String>

The specific cryptocurrency asset to be held in escrow (CAIP-19 identifier) Either asset OR currency MUST be present

§currency: Option<String>

ISO 4217 currency code (e.g. “USD”, “EUR”) for fiat-denominated escrows Either asset OR currency MUST be present

§amount: String

The amount to be held in escrow (string decimal)

§originator: Party

The party whose assets will be placed in escrow

§beneficiary: Party

The party who will receive the assets when released

§expiry: String

Timestamp after which the escrow automatically expires and funds are released back to the originator

§agreement: Option<String>

URL or URI referencing the terms and conditions of the escrow

§agents: Vec<Agent>

Array of agents involved in the escrow. Exactly one agent MUST have role “EscrowAgent”

§metadata: HashMap<String, Value>

Additional metadata

Implementations§

Source§

impl Escrow

Source

pub fn new_with_asset( asset: String, amount: String, originator: Party, beneficiary: Party, expiry: String, agents: Vec<Agent>, ) -> Self

Create a new Escrow message for cryptocurrency assets

Source

pub fn new_with_currency( currency: String, amount: String, originator: Party, beneficiary: Party, expiry: String, agents: Vec<Agent>, ) -> Self

Create a new Escrow message for fiat currency

Source

pub fn with_agreement(self, agreement: String) -> Self

Set the agreement URL

Source

pub fn with_metadata(self, key: String, value: Value) -> Self

Add metadata

Source

pub fn escrow_agent(&self) -> Option<&Agent>

Find the escrow agent in the agents list

Source

pub fn authorizing_agents(&self) -> Vec<&Agent>

Find agents that can authorize release (agents acting for the beneficiary)

Trait Implementations§

Source§

impl Clone for Escrow

Source§

fn clone(&self) -> Escrow

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Escrow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Escrow

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Escrow

Source§

fn eq(&self, other: &Escrow) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Escrow

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TapMessageBody for Escrow

Source§

fn message_type() -> &'static str

Get the message type string for this body type.
Source§

fn validate(&self) -> Result<()>

Validate the message body.
Source§

fn to_didcomm(&self, from: &str) -> Result<PlainMessage>

Convert this body to a DIDComm message.
Source§

fn to_didcomm_with_route<'a, I>( &self, from: &str, to: I, ) -> Result<PlainMessage>
where I: IntoIterator<Item = &'a str>,

Convert this body to a DIDComm message with a custom routing path. Read more
Source§

fn from_didcomm(message: &PlainMessage) -> Result<Self>
where Self: Sized,

Extract this body type from a DIDComm message.
Source§

impl StructuralPartialEq for Escrow

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,