obyte.js
GitHubDiscord
0.1.19
0.1.19
  • Obyte.js
  • Getting started
    • Quick start
    • Testnet
  • API
    • Get witnesses
    • Get peers
    • Get joint
    • Get last MCI
    • Get history
    • Get attestation
    • Get attestations
    • Get bots
    • Get asset metadata
    • Get definition
    • Get balances
    • Get profile units
    • Get data feed
    • Autonomous Agents
      • Dry run AA
      • Get AA state vars
      • Get AAs by base AAs
      • Get AA responses
      • Get AA response chain
      • Execute AA getter
    • Core
      • Catchup
      • Get hash tree
      • Get light props
      • Post joint
      • Pick divisible coins for amount
      • Heartbeat
  • Post
    • Address definition change
    • Attestation
    • Asset
    • Asset attestors
    • Data
    • Data feed
    • Definition
    • Definition template
    • Payment
    • Poll
    • Vote
    • Profile
    • Text
    • Multi
  • Client
    • Subscribe
    • Just saying
    • Requests
  • Utils
    • Sign a message
    • Validate signed message
    • Generate a random address
    • Get definition address
    • Is valid address
    • Keep connection alive
  • About
    • About
    • Links
    • Tutorials
Powered by GitBook
On this page
  • Example
  • Returns
  • Learn more
  1. API
  2. Autonomous Agents

Dry run AA

Calculates the predicted outcome of an Autonomous Agent with a sample transaction.

Example

const params = {
  trigger: {
    address: 'K237YYRMBYWCJBLSZGLJTXLZVVEXLI2Y', // sent from address
    outputs: {
      'base': 10000 // default AA bounce fee in bytes
    },
    data: {
      'vest': true
    }
  },
  address: 'TSDLQPZTSVDNC63G7YROC26CYCCZC4GO' // sent to AA address
};

client.api.dryRunAa(params, function(err, result) {
  if (err) return console.error(err);
  console.log(result);
});

Returns

[
  {
    mci: 1023895,
    trigger_address: 'K237YYRMBYWCJBLSZGLJTXLZVVEXLI2Y',
    trigger_initial_address: 'K237YYRMBYWCJBLSZGLJTXLZVVEXLI2Y',
    trigger_unit: 'RpENIf8NoLY/OFpJ1n2i8E38lZDH7ZsqF6Xa2Pkca5w=',
    aa_address: 'TSDLQPZTSVDNC63G7YROC26CYCCZC4GO',
    bounced: false,
    response_unit: null,
    objResponseUnit: null,
    response: {
      responseVars: {
        message: 'Vested 10000 bytes',
        amount: 10000
      },
      error: 'no messages after filtering'
    },
    updatedStateVars: {
      TSDLQPZTSVDNC63G7YROC26CYCCZC4GO: {
        vested_total: {
          value: 60000,
          old_value: 50000,
          delta: 10000
        },
        vested_K237YYRMBYWCJBLSZGLJTXLZVVEXLI2Y: {
          value: 50000,
          old_value: 40000,
          delta: 10000
        }
      }
    }
  }
]

Learn more

PreviousAutonomous AgentsNextGet AA state vars

Last updated 4 years ago

Autonomous agents documentation

Oscript editor

https://developer.obyte.org/autonomous-agents
https://oscript.org