1

The query comes as

"returnData": [
                "zWCLtKpUXZbkWNM9deAVPizTxXASOjX63ubdUHDN+vw=",
                "zWCLtKpUXZbkWNM9deAVPizTxXASOjX63ubdUHDN+vw="
            ],

How can I decode that string? I can see it is decodable base64 first, but I get a very weird string after. Can someone show me the steps to follow to receive the decoded final string?

savlo
  • 13
  • 2

1 Answers1

1

Base64 encodes binary data, which means if you send data that is not a string you won't be able to retrieve a string back. So to properly parse the return data you will need to know what data types were actually returned.

It might also be helpful to use a base64 to hex decoder first, so you get the hex representation of your data.

To give you more concrete recommendations we would need to know what data you expected, preferably showing the whole endpoint definition as well as any custom structs that might be involved.

Martin W
  • 733
  • 4
  • 12
  • I am using this VecMapper and from what I think, this should return me an array of addresses – savlo Jan 19 '22 at 15:43
  • I though have another view that return the vec.len() which should be usize, but it returns a string of "AQ==" which is decoded base64 to \x01 – savlo Jan 19 '22 at 15:45
  • I mean, I managed to see that I can get numbers instead of base64 which makes it good for AQ== but when I try to output Address types, it comes like "92894715491258734059413960822666831119993169960360744654755203888071305984764" how do you decode this outside rust? – savlo Jan 19 '22 at 19:42
  • 2
    Address is a bit more complicated because you are used to the bech32 encoding. However you get the raw bytes. You can use a bech32 convert like this: http://207.244.241.38/elrond-converters/#hex-to-bech32 or you can also use erdpy or the sdks. Example for erdpy: ```erdpy wallet bech32 --encode ``` – Martin W Jan 19 '22 at 20:22
  • That worked as intended! you are simply the best Martin, thank you very much! – savlo Jan 20 '22 at 08:27