Reactive Execution

Use Case: Monitor on-chain wallets, addresses, or smart contracts and trigger trades or logic based on specific activity. How Treza Helps: Agents can listen for state changes (e.g., whale deposits, token unlocks) and react within sub-seconds by executing logic inside trusted enclaves.

Examples:

  • Copy-trading top wallets in real time

  • React to DAO proposals or governance actions

  • Exit positions based on smart contract events

import { TrezaClient } from '@treza/sdk'

const client = new TrezaClient({
  apiKey: process.env.TREZA_API_KEY,
})

// Agent listens for wallet activity and reacts to large deposits
const task = {
  taskName: '0xwallet_monitor_v2', // pre-deployed reactive strategy
  inputs: {
    watchAddress: '9xWhale123...', // target wallet to monitor
    triggerCondition: {
      token: 'USDC',
      threshold: 50000, // trigger on $50k+ deposit
    },
    action: {
      type: 'copyTrade',
      pair: 'SOL/USDC',
      amountPct: 0.1, // copy with 10% size of detected trade
    },
  },
  mode: 'watch', // special mode for long-running monitoring tasks
}

async function startMonitoring() {
  const result = await client.submitTask(task)
  console.log('Monitoring initiated:', result)
}

startMonitoring()

🔁 Use mode: 'watch' for tasks that stay live and respond to on-chain events. Treza handles the infra and execution logic trustlessly.

Last updated