pub struct Transfer {
pub asset: AssetId,
pub originator: Participant,
pub beneficiary: Option<Participant>,
pub amount: String,
pub agents: Vec<Participant>,
pub memo: Option<String>,
pub settlement_id: Option<String>,
pub transaction_id: String,
pub metadata: HashMap<String, Value>,
}Expand description
Transfer message body (TAIP-3).
Fields§
§asset: AssetIdNetwork asset identifier (CAIP-19 format).
originator: ParticipantOriginator information.
beneficiary: Option<Participant>Beneficiary information (optional).
amount: StringTransfer amount.
agents: Vec<Participant>Agents involved in the transfer.
memo: Option<String>Memo for the transfer (optional).
settlement_id: Option<String>Settlement identifier (optional).
transaction_id: StringTransaction identifier (not stored in the struct but accessible via the TapMessage trait).
metadata: HashMap<String, Value>Additional metadata for the transfer.
Implementations§
Source§impl Transfer
impl Transfer
Sourcepub fn builder() -> TransferBuilder
pub fn builder() -> TransferBuilder
Create a new Transfer
§Example
use tap_msg::message::Transfer;
use tap_caip::{AssetId, ChainId};
use tap_msg::message::Participant;
use std::collections::HashMap;
// Create chain ID and asset ID
let chain_id = ChainId::new("eip155", "1").unwrap();
let asset = AssetId::new(chain_id, "erc20", "0x6b175474e89094c44da98b954eedeac495271d0f").unwrap();
// Create participant
let originator = Participant {
id: "did:example:alice".to_string(),
role: Some("originator".to_string()),
policies: None,
leiCode: None, name: None,
};
// Create a transfer with required fields
let transfer = Transfer::builder()
.asset(asset)
.originator(originator)
.amount("100".to_string())
.build();Sourcepub fn message_id(&self) -> String
pub fn message_id(&self) -> String
Generates a unique message ID for authorization, rejection, or settlement
Trait Implementations§
Source§impl Authorizable for Transfer
impl Authorizable for Transfer
Create an Authorize message for this object.
Source§fn update_policies(
&self,
transaction_id: String,
policies: Vec<Policy>,
) -> UpdatePolicies
fn update_policies( &self, transaction_id: String, policies: Vec<Policy>, ) -> UpdatePolicies
Create an UpdatePolicies message for this object.
Source§fn replace_agent(
&self,
transaction_id: String,
original_agent: String,
replacement: Participant,
) -> ReplaceAgent
fn replace_agent( &self, transaction_id: String, original_agent: String, replacement: Participant, ) -> ReplaceAgent
Create a ReplaceAgent message for this object.
Source§fn remove_agent(&self, transaction_id: String, agent: String) -> RemoveAgent
fn remove_agent(&self, transaction_id: String, agent: String) -> RemoveAgent
Create a RemoveAgent message for this object.
Source§impl Connectable for Transfer
impl Connectable for Transfer
Source§fn with_connection(&mut self, connect_id: &str) -> &mut Self
fn with_connection(&mut self, connect_id: &str) -> &mut Self
Connect this message to a prior Connect message by setting the parent thread ID (pthid). Read more
Source§fn has_connection(&self) -> bool
fn has_connection(&self) -> bool
Check if this message is connected to a prior Connect message. Read more
Source§impl<'de> Deserialize<'de> for Transfer
impl<'de> Deserialize<'de> for Transfer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 TapMessage for Transfer
impl TapMessage for Transfer
Source§fn is_tap_message(&self) -> bool
fn is_tap_message(&self) -> bool
Checks if this message is a TAP message.
Source§fn get_tap_type(&self) -> Option<String>
fn get_tap_type(&self) -> Option<String>
Gets the TAP message type from this message.
Source§fn body_as<T: TapMessageBody>(&self) -> Result<T>
fn body_as<T: TapMessageBody>(&self) -> Result<T>
Extract a specific message body type from this message. Read more
Source§fn get_all_participants(&self) -> Vec<String>
fn get_all_participants(&self) -> Vec<String>
Get all participant DIDs from this message. Read more
Source§fn create_reply<T: TapMessageBody>(
&self,
body: &T,
creator_did: &str,
) -> Result<PlainMessage>
fn create_reply<T: TapMessageBody>( &self, body: &T, creator_did: &str, ) -> Result<PlainMessage>
Create a reply to this message. Read more
Source§fn message_type(&self) -> &'static str
fn message_type(&self) -> &'static str
Get the message type for this message
Source§fn parent_thread_id(&self) -> Option<&str>
fn parent_thread_id(&self) -> Option<&str>
Get the parent thread ID for this message
Source§fn message_id(&self) -> &str
fn message_id(&self) -> &str
Get the message ID for this message
Source§impl TapMessageBody for Transfer
impl TapMessageBody for Transfer
Source§fn message_type() -> &'static str
fn message_type() -> &'static str
Get the message type string for this body type.
Source§fn to_didcomm(&self, from: &str) -> Result<PlainMessage>
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>,
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,
fn from_didcomm(message: &PlainMessage) -> Result<Self>where
Self: Sized,
Extract this body type from a DIDComm message.
Auto Trait Implementations§
impl Freeze for Transfer
impl RefUnwindSafe for Transfer
impl Send for Transfer
impl Sync for Transfer
impl Unpin for Transfer
impl UnwindSafe for Transfer
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
Mutably borrows from an owned value. Read more