OS Trading Engine
Platform Guide
Transactions & History
Transaction Types

Transaction Types

Nexgent AI tracks three types of transactions for each agent: DEPOSIT, SWAP, and BURN. Each transaction type serves a specific purpose and is recorded with detailed information for tracking and analytics.

Overview

All agent transactions are stored in the agent_transactions table and include metadata (ID, agent, wallet, timestamp), transaction type (DEPOSIT, SWAP, BURN), value information (USD value, token amounts, prices), and related data (signal ID, destination address).

Transactions update balances atomically and trigger cache updates for real-time dashboard display.

Transaction Types

DEPOSIT

Purpose: Add funds to an agent's wallet

AspectDescription
When it occursUser deposits funds (simulation or live)
Balance effectIncreases wallet balance
TokenTypically SOL (native token)
ExecutionSimulation: Virtual balance update
Live: On-chain balance sync

Fields: transactionType (DEPOSIT), transactionValueUsd, inputMint, inputAmount, destinationAddress

Deposit Transaction Details
Detailed view of a deposit transaction showing confirmation status and amount

SWAP

Purpose: Exchange one token for another (purchase or sale)

AspectDescription
When it occursAgent executes a token swap (purchase or sale)
Balance effectDecreases input token, increases output token
ExecutionSimulation: Mock swap result
Live: On-chain swap via Jupiter Aggregator
DetailsIncludes input/output amounts, prices, slippage, fees

Fields:

  • transactionType: "SWAP"
  • transactionValueUsd: Swap value in USD
  • inputMint: Token being sold (mint address)
  • inputSymbol: Token symbol being sold
  • inputAmount: Amount of input token
  • inputPrice: Price per unit of input token
  • outputMint: Token being bought (mint address)
  • outputSymbol: Token symbol being bought
  • outputAmount: Amount of output token received
  • outputPrice: Price per unit of output token
  • slippage: Slippage percentage
  • priceImpact: Price impact percentage
  • fees: Transaction fees (in USD)
  • isDca: Whether this is a DCA purchase
  • signalId: Signal that triggered the swap (if applicable)
  • transactionHash: On-chain transaction hash (live mode only)

Purchase swap (SOL → Token): inputMint = SOL, outputMint = Token
Sale swap (Token → SOL): inputMint = Token, outputMint = SOL

Swap Transaction Details
Detailed view of a swap transaction showing route, slippage, and price impact

BURN (simulation only)

Purpose: Destroy tokens (remove from circulation)

AspectDescription
When it occursTokens are burned/destroyed
Balance effectDecreases token balance
ExecutionOn-chain burn transaction (live mode)
Use caseToken destruction, deflationary mechanisms

Fields: transactionType (BURN), transactionValueUsd, inputMint, inputAmount, inputPrice

Transaction Structure

All transactions share common fields:

FieldTypeDescription
idstring (UUID)Unique transaction identifier
agentIdstring (UUID)Agent that owns the transaction
walletAddressstringWallet address (simulation or live)
transactionTypeenumDEPOSIT, SWAP, or BURN
transactionValueUsddecimalTransaction value in USD
transactionTimedatetimeWhen transaction occurred
destinationAddressstring (optional)Destination wallet address
signalIdnumber (optional)Signal that triggered transaction
createdAtdatetimeWhen record was created
updatedAtdatetimeLast update timestamp

SWAP-specific fields:

  • Input/output token details (mint, symbol, amount, price)
  • Slippage and price impact
  • Fees
  • Transaction hash (live mode)
  • DCA flag

Transaction Lifecycle

Creation

Transactions are created when:

  1. User action - Deposit via dashboard
  2. Agent trading - SWAP executed by agent
  3. External event - On-chain transaction detected (live deposits)

Balance Update

Transactions update balances atomically (balance update and transaction creation happen together). After commit: Redis cache updated, dashboard displays real-time balance, WebSocket notifies clients.

Guarantees: Atomicity, consistency (balances match transaction history), isolation (concurrent transactions don't interfere)

Transaction Viewing

View transactions in the dashboard:

Filtering: By type (DEPOSIT, SWAP, BURN), token, signal, date range, wallet (simulation or live)

Transaction details: Full transaction information, related signal (if applicable), input/output token details (SWAP), slippage/fees/price impact (SWAP), on-chain transaction hash (live SWAP)

Common Patterns

Purchase Flow

Trigger: Trading signal received

Steps:

  1. Agent evaluates signal (eligibility check)
  2. SWAP transaction created: SOL → Token
  3. Balances updated (SOL decreases, Token increases)
  4. Position created (if new token)
  5. Transaction recorded with signal ID

Transaction details:

  • Type: SWAP
  • Input: SOL amount
  • Output: Token amount
  • signalId: Signal that triggered purchase
  • isDca: true if DCA purchase, false otherwise

Transaction Relationships

Signals

SWAP transactions link to signals via signalId: purchase SWAPs use the signal that triggered the trade, sale SWAPs use the original purchase signal from the position. DEPOSIT and BURN are not signal-related.

Positions

Purchase SWAP: Creates new position (if token not held) or updates existing position (DCA)
Sale SWAP: Closes position and creates historical swap record

Historical Swaps

Sale SWAP transactions create historical swap records linking purchase and sale transactions (trade pairs).

Best Practices

Monitor transaction volume: Track frequency per type, identify unusual patterns, monitor balance changes.

Review transaction details: Check slippage and fees (SWAP), verify on-chain hashes (live SWAP), confirm signal associations.

Balance reconciliation: Verify transaction history matches balances, reconcile with on-chain data (live mode).

Transaction analysis: Use for performance analysis, fee tracking, strategy optimization, tax reporting.