stellar / js-stellar-base

The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr
https://stellar.github.io/js-stellar-base/
Apache License 2.0
108 stars 137 forks source link

memo only accepts string in typescript, but code and comments allow for array #695

Closed acharb closed 1 year ago

acharb commented 1 year ago

Describe the bug in the memo code and comment it says can give an array to Memo.hash , but the type definition only allows for string

not a blocker because can just do buffer.toString('hex'), but it was a little confusing to me for a bit

What version are you on?

10.0.0-beta.1

To Reproduce Steps to reproduce the behavior: // in typescript code

const buffer = Buffer.from("AAAAAAAAAAAAAAAAAAAAAMAP+8deo0TViBD09TfOBY0=", "base64"); const memo = Memo.hash(buffer); // throws error

const memo = Memo.hash(buffer as any as string); // no error thrown, so code handles it fine

Expected behavior

no error

Additional context Add any other context about the problem here.