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

New Data Type: Bitcoin address #722

Open
benkeen opened this issue Dec 9, 2021 · 2 comments
Open

New Data Type: Bitcoin address #722

benkeen opened this issue Dec 9, 2021 · 2 comments

Comments

@benkeen
Copy link
Owner

benkeen commented Dec 9, 2021

Suggested by someone at work. Quick & easy addition!

@benkeen
Copy link
Owner Author

benkeen commented Dec 28, 2021

Not so quick. Logic to generate valid ones is fiddly. Removing from 4.0.12.

@benkeen benkeen removed this from the 4.0.12 milestone Dec 28, 2021
@benkeen
Copy link
Owner Author

benkeen commented Mar 8, 2022

I gave this another stab tonight. No luck yet, but a few notes.

  1. First the rollup build needs to be altered to target IIFE instead of es. This allows generating actual bundles for the worker files rather than just dumb files as now. To this point, none of the Data Types needs importing external libraries other than the worker utils which are injected dynamically, so it hasn't been a problem.

I was able to get it going just fine with IIFE with only a small change to the source generator file: altering export const onmessage to self.onmessage. That then references the top-level WorkerGlobalScope from within the IIFE. That then breaks the tests, but should be easily solveable. Plus TBH the worker-related boilerplate will need to be separated from the actual generation code so down the road when this thing is a node package as well as a web app, the execution code can be called from both contexts.

  1. Bitcoin generation! This was the problem. I was using bitcoinjs-lib and followed their examples, but would consistently get ecc library invalid errors on the ECPairFactory creation step when running a test.

No-one else complains about this. I couldn't reproduce it on their own repo when checking out (node 14 too). I suspect it's something to do with the jest / TS/JS build target... not sure. I did try changing the tsconfig target to ES2020 like in their repo but got the same thing. Need to isolate it in a separate repo & if there's still problems open up a ticket.

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

No branches or pull requests

1 participant