chaingraph icon indicating copy to clipboard operation
chaingraph copied to clipboard

send_transaction mutation returns non-encoded txid

Open elderapo opened this issue 2 years ago • 1 comments

The following graphl query:

mutation SendTx {
  send_transaction(
    request: {
      encoded_hex: "0100000001f17ebad1a9324ff82faf9b5054066bc5172bc6cf3ea78219400648a61015eb07000000006441cbed835372fca913a22b41fa1f54a62fcf2d66de86b59444bd8fbf3d4ba4056c2ceb58e34fa5d7222535a4759d465fa7fc4bcf474e1d938f32ccfe5b5816de8141210277ca380aff06f4cb50047c14a4ec192b0c9d30d5caad7fc9b4002bc0a69ecd59feffffff0239590000000000001976a914fe0d9c981cd67b0181d5f994ac77b391fe74244988ac97c57900000000001976a9146aef70d3eb17970780647492589deb34b18eab6f88ac87f90b00"
      node_internal_id: 3
    }
  ) {
    transaction_hash
    validation_success
    transmission_success
    transmission_error_message
    transmission_error_message
  }
}

returns:

{
  "data": {
    "send_transaction": {
      "transaction_hash": "8d800122aa869bb081f8308aebdad74fc96ae8e565af600c6dace2454533e237",
      "validation_success": true,
      "transmission_success": true
    }
  }
}

but for consistency I think it should return:

{
  "data": {
    "send_transaction": {
      "transaction_hash": "\\x8d800122aa869bb081f8308aebdad74fc96ae8e565af600c6dace2454533e237",
      "validation_success": true,
      "transmission_success": true
    }
  }
}

elderapo avatar Mar 21 '23 11:03 elderapo

Thanks for the issue!

Yes, there are several places where the returned result is just a hex string rather than Postgres' bytea hex encoding. My preferred solution would be to fix https://github.com/bitauth/chaingraph/issues/48 such that all hex-encoded values are returned without the escape sequence.

I'm not able to focus on this currently, but I would love to merge a PR if you're interested!

bitjson avatar Mar 27 '23 20:03 bitjson