Skip to content

stbx-service-rest: Decode and save transactions into the tx store #271

@epost

Description

@epost

This will be based on the code Marco introduced in #230.

  • Create new spago package stbx-tx-store and move stuff from stbx-service-rest in there.
  • Decode POST requests to /tx from hex instead of JSON, like the real tx service does.
    • Make Stbx.decode work from PureScript.
      • Fix tests for Statebox.Core, Statebox.Core.Execution, and Statebox.Transaction.Codec.
    • Decode POSTed { tx :: HexStr }'s tx field JSON
    • Decode this JSON to a TxSum
    • Define and use sendTxTxSum instead of Express's dynamically typed sendJson
    • Also compute the hash using Stbx
  • Eliminate ExampleData.purs and its dependencies.
  • tests
    • Add actual transactions to curl tests in scripts/test.sh.
    • Make them work using tx hex instead of expanded JSON
    • Replace by node.js tests in PureScript / JavaScript.
    • Introduce a test loader/runner that installs Stbx from stbx-js in the global scope.
    • Travis CI check passes even if a test suite in scripts/test.sh fails.
  • Implement basic version of StateboxException from Jelle's https://github.com/statebox/cloud code.
    • Define corresponding TxError ADT with corresponding String-valued error codes, etc
    • Hook into some points
    • Create a dedicated sendTxError function instead of Express's untyped sendJson.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions