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

Use type Buffer instead of Uint8Array for BTC scripts #432

Open
sisou opened this issue Jul 19, 2021 · 0 comments
Open

Use type Buffer instead of Uint8Array for BTC scripts #432

sisou opened this issue Jul 19, 2021 · 0 comments
Assignees

Comments

@sisou
Copy link
Member

sisou commented Jul 19, 2021

Currently the ParsedBitcoinTransactionInput is typed with Uint8Array for its scripts, instead of the NodeJS-native Buffer which all BitcoinJS methods require.

This was done because Buffer is not available in a browser and the browerify-ed Buffer port uses a Uint8Array underneath anyway.

Currently this leads to type errors whenever a BitcoinJS-method is called with a Uint8Array-typed object and requires a // @ts-ignore comment.

Maybe it would be better if the objects were typed with Buffer, preventing the type errors when a method is called (everywhere in the code) and replacing them with type errors where these objects are created (in limited locations in the code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant