Skip to main content

Transaction

Trait Transaction 

Source
pub trait Transaction: TapMessage {
    // Required methods
    fn settle(
        &self,
        creator_did: &str,
        settlement_id: &str,
        amount: Option<&str>,
    ) -> PlainMessage<Settle>;
    fn revert(
        &self,
        creator_did: &str,
        settlement_address: &str,
        reason: &str,
    ) -> PlainMessage<Revert>;
    fn add_agents(
        &self,
        creator_did: &str,
        agents: Vec<Agent>,
    ) -> PlainMessage<AddAgents>;
    fn replace_agent(
        &self,
        creator_did: &str,
        original_agent: &str,
        replacement: Agent,
    ) -> PlainMessage<ReplaceAgent>;
    fn remove_agent(
        &self,
        creator_did: &str,
        agent: &str,
    ) -> PlainMessage<RemoveAgent>;
    fn update_party(
        &self,
        creator_did: &str,
        party_type: &str,
        party: Party,
    ) -> PlainMessage<UpdateParty>;
    fn update_policies(
        &self,
        creator_did: &str,
        policies: Vec<Policy>,
    ) -> PlainMessage<UpdatePolicies>;
    fn confirm_relationship(
        &self,
        creator_did: &str,
        agent_did: &str,
        for_entity: &str,
    ) -> PlainMessage<ConfirmRelationship>;
}
Expand description

Transaction trait for managing transaction lifecycle operations.

This trait provides methods for transaction processing operations as defined in TAIPs 5-9, including agent management, party updates, policy management, and settlement.

Required Methods§

Source

fn settle( &self, creator_did: &str, settlement_id: &str, amount: Option<&str>, ) -> PlainMessage<Settle>

Create a Settle message for this object (TAIP-4).

§Arguments
  • creator_did - The DID of the agent creating this settlement
  • settlement_id - CAIP-220 identifier of the underlying settlement transaction
  • amount - Optional amount settled (must be <= original amount)
Source

fn revert( &self, creator_did: &str, settlement_address: &str, reason: &str, ) -> PlainMessage<Revert>

Create a Revert message for this object (TAIP-4).

§Arguments
  • creator_did - The DID of the agent creating this reversal request
  • settlement_address - CAIP-10 format address to return funds to
  • reason - Reason for reversal request
Source

fn add_agents( &self, creator_did: &str, agents: Vec<Agent>, ) -> PlainMessage<AddAgents>

Create an AddAgents message for this object (TAIP-5).

§Arguments
  • creator_did - The DID of the agent creating this addition
  • agents - List of agents to add
Source

fn replace_agent( &self, creator_did: &str, original_agent: &str, replacement: Agent, ) -> PlainMessage<ReplaceAgent>

Create a ReplaceAgent message for this object (TAIP-5).

§Arguments
  • creator_did - The DID of the agent creating this replacement
  • original_agent - The agent DID to replace
  • replacement - The replacement agent
Source

fn remove_agent( &self, creator_did: &str, agent: &str, ) -> PlainMessage<RemoveAgent>

Create a RemoveAgent message for this object (TAIP-5).

§Arguments
  • creator_did - The DID of the agent creating this removal
  • agent - The agent DID to remove
Source

fn update_party( &self, creator_did: &str, party_type: &str, party: Party, ) -> PlainMessage<UpdateParty>

Create an UpdateParty message for this object (TAIP-6).

§Arguments
  • creator_did - The DID of the agent creating this update
  • party_type - The type of party (“originator”, “beneficiary”, etc.)
  • party - The party information to update
Source

fn update_policies( &self, creator_did: &str, policies: Vec<Policy>, ) -> PlainMessage<UpdatePolicies>

Create an UpdatePolicies message for this object (TAIP-7).

§Arguments
  • creator_did - The DID of the agent creating this update
  • policies - New policies to apply
Source

fn confirm_relationship( &self, creator_did: &str, agent_did: &str, for_entity: &str, ) -> PlainMessage<ConfirmRelationship>

Create a ConfirmRelationship message for this object (TAIP-9).

§Arguments
  • creator_did - The DID of the agent creating this confirmation
  • agent_did - The agent DID confirming their relationship
  • for_entity - The entity this agent is acting for

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§