Implement signJSON method for all supported coins #1364
Replies: 3 comments
-
Related PR - #890 |
Beta Was this translation helpful? Give feedback.
-
the best way is to use go protobuf library to create type safe type models, see https://github.com/trustwallet/wallet-core/tree/master/samples/go/protos/bitcoin, json format is easy to mess up |
Beta Was this translation helpful? Give feedback.
-
@hewigovens I tried this approach and find it very hard to do.
JSON gives you more flexibility in terms of signing, though some things regarding JSON signing should be documented more, e.g. that for bytes data you need to base64 it certain way prior to sending as a JSON payload. Let's say you want to implement different Polkadot operations:
You'd need to add code for each operation instead of controlling simple JSON payload which you pass to Polkadot signJSON method. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I've been using wallet-core in my project which basically consists of small Go daemon which serves requests by JSON-RPC for:
Many coins right now are not supporting
signJSON
method, these the only ones that are:So I have to implement signing by forming input inside the Go program which is not very handy and also gives much more complication to my small Go daemon and gives me more room to make mistakes.
Supporting
signJSON
will give more freedom for forming transactions, though you need to know exact format (which of course can be figured out if you try very hard at reading sources and understanding certain protobuf structures).Describe the solution you'd like
add Signer::signJSON to all supported coins in wallet-core
Describe alternatives you've considered
I've been trying for days to use Polkadot signer and finally found out that it's possible to use json payload.
I've patched wallet-core with this patch:
and after many tries of forming correct JSON payload I was able to make a signing of Polkadot transaction through
signJSON
method with json payload like this:Unfortunately, I'm very bad at C++, so it's hard for me to give you the proper pull request with proper tests etc, so I'm posting this issue as a feature request with additional details.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions