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

experiment: demo electron integration #999

Closed
wants to merge 1 commit into from

Conversation

buck54321
Copy link
Member

This PR is to demonstrate a deep Electron app integration. Key points are

  1. Core is compiled and imported as a node module (see, for example, this tutorial), precluding the need to run a separate executable and allowing us to use Core directly in the Electron main process.
  2. You can work with Core before even starting an HTTP server, e.g. initialization, wallet creation, dex registration. Once all of that is done, you can start the server and point your window at it. With some minor changes, we could probably even get around HTTP altogether by implementing a custom net.Listener and net.Conn for the Server to use.

The demo is for Linux, but should be portable without too much effort. To run, go to client/cmd/electron-demo and run make build run

On some Linux, you may see a message about a file called chrome-sandbox. You'll need to tighten permissions.

chmod 4755 node_modules/electron/dist/chrome-sandbox
sudo chown root:root node_modules/electron/dist/chrome-sandbox

If you have the dcrdex simnet harnesses running for dcrdex, dcr, and btc, you can also use the full demo where the Electron app prepares the wallets and registers with the DEX. Just make build run-simnet.

This is just for demo for now, but I can clean this up for merging if desired.

I'm using node version v15.8.0

let net = Mainnet
const args = fetchIPC('cmdArgs', '')
if (args.indexOf('--simnet') > -1) net = Simnet
else if (args.indexOf('--testnet') > -1) net = Simnet
Copy link
Member

Choose a reason for hiding this comment

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

Testnet

@buck54321 buck54321 closed this Jun 9, 2021
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

2 participants