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,
};
// 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
Implementation of Authorizable for Transfer
impl Authorizable for Transfer
Implementation of Authorizable for Transfer
Source§fn confirm_relationship(
&self,
transaction_id: String,
agent_id: String,
for_id: String,
role: Option<String>,
) -> ConfirmRelationship
fn confirm_relationship( &self, transaction_id: String, agent_id: String, for_id: String, role: Option<String>, ) -> ConfirmRelationship
Confirms a relationship between agents, creating a ConfirmRelationship message as a response
§Arguments
transfer_id- ID of the transfer related to this messageagent_id- DID of the agent whose relationship is being confirmedfor_id- DID of the entity that the agent acts on behalf ofrole- Optional role of the agent in the transaction
§Returns
A new ConfirmRelationship message body
Source§fn update_party(
&self,
transaction_id: String,
party_type: String,
party: Participant,
note: Option<String>,
) -> UpdateParty
fn update_party( &self, transaction_id: String, party_type: String, party: Participant, note: Option<String>, ) -> UpdateParty
Updates a party in the transaction, creating an UpdateParty message as a response
§Arguments
transfer_id- ID of the transaction this update relates toparty_type- Type of party being updated (e.g., ‘originator’, ‘beneficiary’)party- Updated party informationnote- Optional note about the update
§Returns
A new UpdateParty message body
Source§fn update_policies(
&self,
transaction_id: String,
policies: Vec<Policy>,
) -> UpdatePolicies
fn update_policies( &self, transaction_id: String, policies: Vec<Policy>, ) -> UpdatePolicies
Source§fn add_agents(
&self,
transaction_id: String,
agents: Vec<Participant>,
) -> AddAgents
fn add_agents( &self, transaction_id: String, agents: Vec<Participant>, ) -> AddAgents
Source§fn replace_agent(
&self,
transaction_id: String,
original: String,
replacement: Participant,
) -> ReplaceAgent
fn replace_agent( &self, transaction_id: String, original: String, replacement: Participant, ) -> ReplaceAgent
Replaces an agent in this message, creating a ReplaceAgent message as a response
§Arguments
transaction_id- ID of the transaction to replace agent inoriginal- DID of the original agent to be replacedreplacement- New participant replacing the original agent
§Returns
A new ReplaceAgent message body