Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer returned by the signMessage method is not acting like a Buffer object #1626

Open
earrietadev opened this issue Nov 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@earrietadev
Copy link

What version are you using?

Wallet version: 5.24.1
Freighter CLI version: 3.0.0

What did you do?

When using the method signMessage the code says the it will return a Buffer (I assume is the NodeJS Buffer object).

But because I'm following SEP-0043 I'm converting that response to a string... But the method toString is not acting like the NodeJS Buffer so I feel is not a Buffer the response.

What did you expect to see?

A Buffer object with the features the NodeJS Buffer has

What did you see instead?

The response was an Object with the structure:

{
  data: number[]
  type: "Buffer"
}
@aristidesstaffieri
Copy link
Contributor

👋 so what we do for Buffer on the browser side is use a webpack polyfill which uses https://github.com/feross/buffer for any Buffer references, or at least it should.

After reviewing the build steps, it looks like we polyfill Buffer in the extension build but not in the freighter-api build, so on the extension side we get a reference to this buffer class which should be the class you expect but on the API side we resolve buffer to this interface.

Thanks for finding this, I'm going to try to polyfill it the same way on both builds and will test this API again and get back to you here with details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants