pub struct Lock {
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
Lock message for holding assets on behalf of parties (TAIP-17).
A Lock 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>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 locks.
Either asset OR currency MUST be present.
amount: StringAmount to be held in escrow (decimal string).
originator: PartyParty whose assets will be placed in escrow.
beneficiary: PartyParty who will receive the assets when released.
expiry: StringTimestamp after which the lock automatically expires and funds are released back to the originator.
agreement: Option<String>URL or URI referencing the terms and conditions of the lock.
agents: Vec<Agent>Agents involved in the lock. Exactly one agent MUST have role “EscrowAgent”.
metadata: HashMap<String, Value>Additional metadata.
Implementations§
Source§impl Lock
impl Lock
Sourcepub fn new_with_asset(
asset: String,
amount: String,
originator: Party,
beneficiary: Party,
expiry: String,
agents: Vec<Agent>,
) -> Self
pub fn new_with_asset( asset: String, amount: String, originator: Party, beneficiary: Party, expiry: String, agents: Vec<Agent>, ) -> Self
Create a new Lock for cryptocurrency assets.
Sourcepub fn new_with_currency(
currency: String,
amount: String,
originator: Party,
beneficiary: Party,
expiry: String,
agents: Vec<Agent>,
) -> Self
pub fn new_with_currency( currency: String, amount: String, originator: Party, beneficiary: Party, expiry: String, agents: Vec<Agent>, ) -> Self
Create a new Lock for fiat currency.
Sourcepub fn with_agreement(self, agreement: String) -> Self
pub fn with_agreement(self, agreement: String) -> Self
Set the agreement URL.
Sourcepub fn with_metadata(self, key: String, value: Value) -> Self
pub fn with_metadata(self, key: String, value: Value) -> Self
Add metadata.
Sourcepub fn escrow_agent(&self) -> Option<&Agent>
pub fn escrow_agent(&self) -> Option<&Agent>
Find the escrow agent (the agent with role == "EscrowAgent") in the
agents list.
Find agents that can authorise release (agents acting for the beneficiary).