api: Calling addSignature errors out

Error message

REGISTRY: [Error: Cannot map Enum JSON, unable to find '010ae36681df50970a22ce55defe0775b3772bf05b08e6106954b42b5717ef082200a5445357ec345f7ec50151c4c41fb6fc432bef0461a19f5bc0efb1dc1c0f8c' in ed25519, sr25519, ecdsa]

Context

Currently packing the tx signing payload into a QR code and using parity signer to sign the transaction. Parity signer is able to recognize the QR payload and deliver back a signature which looks like the following. And I’m using the data field.

However getting constantly the error msg. It would be helpful that anyone could provide me any direction to dig further.

{
   "bounds":{
      "origin":{
         "x":"25.452043",
         "y":"37.084819"
      },
      "size":{
         "height":"133.498951",
         "width":"135.724164"
      }
   },
   "data":"017acb926608839c110332f59c3761ce6caa01785b4ccca2691a3677555229066ad8f7d501995b3e1ea3b40978b0f163a08cdb13326e8a64f08d32a88fc9c5a989",
   "rawData":"482303137616362393236363038383339633131303333326635396333373631636536636161303137383562346363636132363931613336373735353532323930363661643866376435303139393562336531656133623430393738623066313633613038636462313333323665386136346630386433326138386663396335613938390ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11",
   "target":3929,
   "type":"org.iso.QRCode"
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 33 (15 by maintainers)

Most upvoted comments

The API registry is the one actually decorated with the signedExtensions and all recent types. So the way to access a registry -

  • on the api itself (these actually get swapped depending on specVersion)
  • on any type (hence using tx.registry in my sample) - this is the latest registry used to create the type

You should really never create these standalone - the apps UI does, but that is just due to historic reasons, there are still a couple of low-impact areas left where it was not done properly. (It comes from the age before isolated types, so it used to have everything global - so it still have some warts and holes)

Since you are on RN, this thread may be of use - https://github.com/polkadot-js/apps/issues/2906 (discrepancies between what the signer expects and what is easy to generate and read in that environment)

Since you are construction manually, you are missing the transactionVersion field in the payload. Scratch that, it gets pulled from runtimeVersion.

Ok, will need to wade through the stuff above and compare.

Something missing seems to be the signedExtensions in the payload. (When that is empty, the data won’t go to the correct places - that basically is the format for how the payload hex should look like)

All hex should have a 0x prefix. The signer returns it without. Add it before trying to addSignature.