statebox/purescript-studio

Transaction decoding differs from `stbx-core-js`

marcosh opened this issue · 0 comments

if you use https://github.com/statebox/stbx-core-js and run the following test

let txH = `0a0022200a1e47756172616e746565642d456e7472616e63652d546f6b656e2e74657374`

let Stbx = require("..")

let tx = Stbx.decode(txH)

console.log(tx)

you get

{
  root: {
    message: '47756172616e746565642d456e7472616e63652d546f6b656e2e74657374'
  },
  previous: 'z'
}

on the other hand, if you use the studio service as follows:

  • add a console.log(x) to https://github.com/statebox/purescript-studio/blob/7fc06047f7a36d94ba699039199a382b8490de3a/stbx-core/src/Statebox/Core.js#L7
  • recompile stbx-core
  • recompile stbx-service-rest
  • run stbx-service-rest with npm run serve
  • call the service with
curl -X POST \
  http://localhost:8080/tx \
  -H 'Content-Type: application/json' \
  -d '{
	"tx": "0a0022200a1e47756172616e746565642d456e7472616e63652d546f6b656e2e74657374"
}'

you get the following printed in the console

{
  root: {
    message: '47756172616e746565642d456e7472616e63652d546f6b656e2e74657374'
  }
}

which is missing the previous: 'z' field

It looks like I'm using the correct version of stbx-core-js (0.0.31, see here)