operate-bsv / op_agent-js

Operate JavaScript agent used to load and run Bitcoin programs.
https://www.operatebsv.org
MIT License
4 stars 3 forks source link

Implement top level Operate class #4

Closed libitx closed 4 years ago

libitx commented 4 years ago

The latest commit includes some scaffold code for the Operate class: https://github.com/libitx/op_agent-js/blob/master/lib/index.js

This issue broadly includes:

Config

The way I envisage global config being edited is something like this:

// Any passed options are merged into the global config
Operate.config.set({
  aliases: {
    'abcdef': 'ffeedd'
  }
})

Loading tapes

For loadTape() and loadTapesBy() refer to the elixir implementation for reference: https://github.com/operate-bsv/op_agent/blob/master/lib/operate.ex

Both functions can be passed an options object which will override the global config. Both functions will return a Promise which will resolve to a Tape instance (or array or Tapes).

Testing

The above work should allow you to implement two pending tests which you can refer to in Elixir: https://github.com/operate-bsv/op_agent/blob/master/test/operate_test.exs

If you can think of any more tests that make sense to add then please do.