Transaction Management

The Transaction Management system in OADA-UI handles all aspects of Cardano blockchain transactions, including creation, signing, UTxO management, and fee calculation. This section details the core components and their implementations.

Core Types and Interfaces

The transaction management system is built on several key types and interfaces that define the structure of transactions and UTxOs.

The WalletUtxoMap type defines the structure for tracking wallet UTxOs and their relationships:

// src/utils/wallet-stuff.ts
// Maps wallet UTxOs to their corresponding transaction outputs
// Maintains three key mappings:
// 1. outputUtxosRefByWalletUtxoId: Maps wallet inputs to transaction outputs
// 2. outputUtxosByOutputUtxosRef: Maps output references to UTxO details
// 3. walletUtxoIdsByOutputUtxosRef: Maps outputs back to wallet inputs
export type WalletUtxoMap = {
  outputUtxosRefByWalletUtxoId: {
    [walletUtxoId: string]: string;
  };
  outputUtxosByOutputUtxosRef: {
    [outputUtxosRef: string]: Server.Utxo[];
  };
  walletUtxoIdsByOutputUtxosRef: {
    [outputUtxosRef: string]: Set<string>;
  };
};

The VirtualWalletUtxoMap type defines the structure for tracking virtual UTxOs during transaction processing:

Key features of the Transaction Management system include:

  1. UTxO Management

    • Tracking wallet UTxOs and their relationships

    • Managing virtual UTxOs for pending transactions

    • Pruning on-chain UTxOs from the wallet map

  2. Transaction Creation

    • Converting between different transaction formats

    • Creating virtual UTxO maps for pending transactions

    • Handling transaction inputs and outputs

  3. Transaction Monitoring

    • Tracking transaction status

    • Updating UTxO maps with known transaction IDs

    • Managing latest UTxO states

  4. Fee Calculation

    • Dynamic fee calculation based on transaction size

    • Handling protocol-specific fees

    • Managing fee addresses

The system provides a comprehensive interface for managing Cardano blockchain transactions, with support for various transaction types and real-time UTxO tracking.

Last updated