How do decode an encoded transaction note using the Javascript SDK? For example, to send a note to the chain, the note is encoded as
algosdk.encodeObj(“monthly payment”);
Is there a complementary function to decode this encoded text using the SDKs?
A note can contain arbitrary bytes.
The applications can choose to use the format of their choice, such as JSON, msgpack, … or a proprietary format.
However, using algosdk.encodeObj
is indeed recommended (which is a canonical version of msgpack).
The reverse operation is algosdk.decodeObj
.
JasonW
January 27, 2021, 7:50pm
3
In addition to what Fabrice said, if you intend to use the indexer to search this note, encoding the note should not be done though, if using the js sdk. You can just convert to uint8 array.