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

popm/wasm: improve and tidy up Go code #144

Merged
merged 7 commits into from
Jun 17, 2024
Merged

Commits on Jun 7, 2024

  1. popm/wasm: improve and tidy up Go code

    This splits the web/popminer/popminer.go file into 5 files:
     - dispatch.go: Contains all methods that can be dispatched from JS
     - network.go: Contains network settings
     - network_local.go: Contains localnet settings (behind build tag)
     - popminer.go: Contains the main function and core
     - util.go: Contains utilities for working with JS
    
    This contains a lot of miscellaneous improvements, however the notable
    ones are:
     - Invoke Promise resolve function with js.Value instead of marshaled
       JSON, meaning that the result can be used directly without the need
       to encode/decode JSON.
    
     - All errors use a common format containing the error message, a
       timestamp, and the debug stack, allowing for easier debugging.
    
     - Replace 'wasmPing' with 'version' - wasmPing is not very useful and
       was only used for testing the connection between JS and WASM. version
       returns useful version information and allows the same testing.
    
     - Add "Object" type that can be used to easily create JS Objects from
       Go. Calling Object.Value() will create a js.Value representing the
       object, converting each contained value to a js.Value. This also has
       the benefit of breaking the build if a key changes, preventing
       breaks in the JS API.
    
     - Move network configurations into a separate file and use constants. I
       think this is cleaner than the previous solution, and allows localnet
       to only be available when built with the 'hemi_localnet' build tag.
    joshuasing committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    a10c9bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d110ec4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    29cb3f3 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. Configuration menu
    Copy the full SHA
    6b03f79 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2024

  1. Configuration menu
    Copy the full SHA
    5826501 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    34052a9 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2024

  1. Configuration menu
    Copy the full SHA
    396b6ea View commit details
    Browse the repository at this point in the history