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

Init commit create react app with react-app-rewired #12

Closed
wants to merge 63 commits into from

Conversation

bonomat
Copy link
Member

@bonomat bonomat commented Dec 1, 2020

What is this?

This adds a new waves folder which is a react app using a rust wasm library combined with webpack.

my-app was creating using create-react-app.
However, this would not let us configure webpack (which is the reason we went for create-react-app in the first place).
Hence we use react-app-rewired and created a config-override.js
The library wasm_lib was created using wasm-pack new.
It showcases a single method to return hello world and a function to initialize a logger.

Issues

So far I like the setup, it has one caveat though: if we want to add native as a dependency in package.toml then a rebuild is not automatically reloaded. File-based import work though.

How to

Go into my-app and type

yarn install

followed by

yarn start

to start in development mode. You can then make changes in the rust library under native and the code should automatically rebuild and reload.

Enjoy :)

luckysori and others added 30 commits November 16, 2020 14:17
By spending to a wallet address. The node must be started with
`-blindedaddresses=1`. I've configured it to be the default value
since we are always working with confidential transactions.

Doing the same for non-Bitcoin outputs is left as a TODO.
This is helpful because we sometimes need to peek at the next value
to deserialize the right thing.
The previous model was to flexible in that it allowed to express
states that were not actually possible (like explicit value but
confidential asset).
thomaseizinger and others added 7 commits November 19, 2020 11:40
Instead of accepting free-form entropy, we pass an rng argument
that makes it obvious that this function depends on randomness to
produce sane outputs.
This is more concise than calling `ok_or_else` if we are always
constructing an anyhow::Error anyway.
Format everything with dprint
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this bootstrapped!

I think we should also add CI scripts right away to make sure we are not accidentally breaking stuff again.

waves/.gitignore Outdated Show resolved Hide resolved
waves/config-overrides.js Outdated Show resolved Hide resolved
Cargo.toml Outdated
@@ -1,2 +1,2 @@
[workspace]
members = [ "elements-harness", "swap", "elements-fun" ]
members = [ "elements-harness", "swap", "elements-fun", "waves/src/native" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is waves really such a good name considering there is a whole blockchain ecosystem named like that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to rename it :) Back to Greek god names?

waves/src/App.tsx Outdated Show resolved Hide resolved
waves/src/native/src/lib.rs Outdated Show resolved Hide resolved
waves/src/native/Cargo.toml Outdated Show resolved Hide resolved
waves/src/App.test.tsx Outdated Show resolved Hide resolved
Comment on lines +17 to +20
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be interested in keeping this! Can we pass console.log here so that we can see how the usage of wasm affects performance? Might also be interesting in regards to the async/sync import story.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces quite some noise in the logs though. I'll leave it for now to keep the console clean.

@bonomat bonomat force-pushed the create-react-webpack-wasm-app branch 3 times, most recently from 8e4dc08 to 9ed3f4e Compare December 2, 2020 00:44
@bonomat
Copy link
Member Author

bonomat commented Dec 2, 2020

superseded by: #13

@bonomat bonomat closed this Dec 2, 2020
@thomaseizinger
Copy link
Contributor

superseded by: #13

Why not just rebase onto latest master instead of closing?

@bonomat bonomat deleted the create-react-webpack-wasm-app branch December 2, 2020 03:17
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

Successfully merging this pull request may close these issues.

None yet

3 participants