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

Copy over everything from web-components #68

Merged

Conversation

SvenDowideit
Copy link
Member

@SvenDowideit SvenDowideit commented Mar 31, 2022

so this is just a copy of the web-components code.

(The only difference in the first commit is the BrowserRouter to HashRouter change in index.tsx)

This PR upgrades to react-router v6, uses local storage for user data (for the web-app, i'm thinking we can sync that to a server based on a solana account / wallet identity)

I need to bring back:

  • Validator page
    • show validator container logs
    • RUN validator button
  • Anchor page
  • toast - replaced the custom code with https://github.com/fkhadra/react-toastify
  • fix the eslinting - it seems I'm using a totally different eslint style,
    • 7 problems (0 errors, 7 warnings)
  • remove the IPC code for the solana web3 requests as they're in the renderer code now
  • DEFERRED-TO-LATER-PR rearrange the dir structure so we can build both the electron app, and the web app from the one repo, and share the common-renderer components

Some of these may be a follow on PR...

image

@SvenDowideit SvenDowideit changed the title [DONTMERGE] Copy over everything from web-components Copy over everything from web-components Apr 2, 2022
@SvenDowideit SvenDowideit force-pushed the web-workbench/sync-web3clientside-and-lru-redux branch from cd7b00d to 3715350 Compare April 2, 2022 09:11
@SvenDowideit
Copy link
Member Author

@nathanleclaire ok, this is very ready for review&merge

@SvenDowideit
Copy link
Member Author

mmm, yeah, i'm going to need you to tell me about the config serialisation - I'm confused why this compiles, considering i've removed the WBAccount type definition :/

@SvenDowideit
Copy link
Member Author

and I've started to prototype "Transfer SOL" and "Airdrop SOL" buttons with pop-overs:

image

src/renderer/App.tsx Outdated Show resolved Hide resolved
src/renderer/App.tsx Outdated Show resolved Hide resolved
src/main/transactionLogs.ts Show resolved Hide resolved
src/renderer/App.tsx Outdated Show resolved Hide resolved
src/renderer/components/AccountListItem.tsx Outdated Show resolved Hide resolved

const HEXDUMP_BYTES = 512;

// TODO: make a gloabal state of "current slot number"
Copy link
Contributor

Choose a reason for hiding this comment

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

i need this for transaction following (which I think I want to make replace program changes) as well

src/renderer/data/localstorage.ts Outdated Show resolved Hide resolved
src/renderer/nav/Account.tsx Outdated Show resolved Hide resolved
src/renderer/nav/Account.tsx Show resolved Hide resolved
src/renderer/store.ts Outdated Show resolved Hide resolved
@nathanleclaire
Copy link
Contributor

Whew! Massive PR! Nicely done, I really like the Airdrop/Transfer buttons and I think web workbench is going to be huge. We need to start making a list of what's broken now (hell, even main has a bunch of regressions, sadly).

@nathanleclaire
Copy link
Contributor

nathanleclaire commented Apr 4, 2022

mmm, yeah, i'm going to need you to tell me about the config serialisation - I'm confused why this compiles, considering i've removed the WBAccount type definition :/

You mean the config file persisted to disk?

edit: Ah OK this is odd. Looking into it...

@nathanleclaire
Copy link
Contributor

So isn't using localStorage for accounts going to blow away all the users' stateful stuff when they update the Electron app? We'll fix that in our follow-up(s) to make the tool backend agnostic I guess?

@nathanleclaire
Copy link
Contributor

... hm, mine complains about it
Screen Shot 2022-04-04 at 2 03 05 PM

@nathanleclaire
Copy link
Contributor

You're using Microsoft ESLint plugin right?

@SvenDowideit
Copy link
Member Author

I need my cli build tooling to at minimum have the errors and warnings the editor shows - in this PR's case, I basically missed the main issues because i didn't open them - I was expecting (really stupidly) that the npm would tell me about issues in files i didn't have open - and was using npx eslint --fix src to tell me where I needed to fix next.

@SvenDowideit SvenDowideit force-pushed the web-workbench/sync-web3clientside-and-lru-redux branch from 5f38d3c to f52ff1d Compare April 5, 2022 04:06
@nathanleclaire
Copy link
Contributor

Alright I suspect you will get these CI errors ironed out soon, if you get the green today ahead and merge, if not, give it a second and I'll look at them in AM to see if I can help troubleshoot! LGTM once npm exec tsc fixed

@SvenDowideit
Copy link
Member Author

half way through re-making the config slice on the render side - its close, but not complete - tomorrow!

@SvenDowideit
Copy link
Member Author

SvenDowideit commented Apr 5, 2022

ok, what remains needs more careful work - they're all because I moved all the account selection state info to client side state only using localStorage, and we need to work out a good time, place and method for pushing that back to the main loop

sven@p1:~/src/cryptoworkbench/solana-workbench$ npm exec tsc
src/main/accounts.ts:7:3 - error TS2305: Module '"../types/types"' has no exported member 'AccountsResponse'.

7   AccountsResponse,
    ~~~~~~~~~~~~~~~~

src/main/accounts.ts:9:3 - error TS2305: Module '"../types/types"' has no exported member 'GetAccountResponse'.

9   GetAccountResponse,
    ~~~~~~~~~~~~~~~~~~

src/main/accounts.ts:14:3 - error TS2305: Module '"../types/types"' has no exported member 'WBAccount'.

14   WBAccount,
     ~~~~~~~~~

src/main/db.ts:5:26 - error TS2305: Module '"types/types"' has no exported member 'WBAccount'.

5 import { Net, ConfigMap, WBAccount } from 'types/types';
                           ~~~~~~~~~


Found 4 errors in 2 files.

Errors  Files
     3  src/main/accounts.ts:7
     1  src/main/db.ts:5

I kinda wonder if the json file creation maybe should happen client side too - so the web version can allow the user to download the json file to give solana - but its 10pm, so i'll bunt to tomorrow :D

and by god this is so much easier when you know you need all three commands npm start, npx eslint --fix src and npm exec tsc - hopefully in a few weeks, we can get that same output from just npm start :)

@SvenDowideit
Copy link
Member Author

REBASING - squashing first, cos rebasing 52 times is horrible

@SvenDowideit SvenDowideit force-pushed the web-workbench/sync-web3clientside-and-lru-redux branch 2 times, most recently from 3aa04e0 to 148da1b Compare April 6, 2022 02:19
@SvenDowideit
Copy link
Member Author

wow, so

sven@p1:~/src/cryptoworkbench/solana-workbench$ npm run package

> package
> ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never


> build
> concurrently "npm run build:main" "npm run build:renderer"

[0] 
[0] > build:main
[0] > cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.main.prod.ts
[0] 
[1] 
[1] > build:renderer
[1] > cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.renderer.prod.ts
[1] 
[0] [webpack-cli] Failed to load '/home/sven/src/cryptoworkbench/solana-workbench/.erb/configs/webpack.config.main.prod.ts' config
[0] [webpack-cli] .erb/configs/webpack.config.main.prod.ts(9,38): error TS7016: Could not find a declaration file for module 'webpack-bundle-analyzer'. '/home/sven/src/cryptoworkbench/solana-workbench/node_modules/webpack-bundle-analyzer/lib/index.js' implicitly has an 'any' type.
[0]   Try `npm i --save-dev @types/webpack-bundle-analyzer` if it exists or add a new declaration (.d.ts) file containing `declare module 'webpack-bundle-analyzer';`
[0] 
[0] npm run build:main exited with code 2
[1] [webpack-cli] Failed to load '/home/sven/src/cryptoworkbench/solana-workbench/.erb/configs/webpack.config.renderer.prod.ts' config
[1] [webpack-cli] .erb/configs/webpack.config.renderer.prod.ts(9,38): error TS7016: Could not find a declaration file for module 'webpack-bundle-analyzer'. '/home/sven/src/cryptoworkbench/solana-workbench/node_modules/webpack-bundle-analyzer/lib/index.js' implicitly has an 'any' type.
[1]   Try `npm i --save-dev @types/webpack-bundle-analyzer` if it exists or add a new declaration (.d.ts) file containing `declare module 'webpack-bundle-analyzer';`
[1] 
[1] npm run build:renderer exited with code 2

so another command that can trip you up, even when npm start is happy :(

@SvenDowideit SvenDowideit force-pushed the web-workbench/sync-web3clientside-and-lru-redux branch from 148da1b to 1243bed Compare April 6, 2022 02:26
@nathanleclaire
Copy link
Contributor

nathanleclaire commented Apr 6, 2022

I think you need to do npm install? Probably cause of the updated changes in #76 . This works fine on my computer w/ your branch and npm run package is part of the CI which is passing.

Not much we can do about errors on run/package if the correct modules haven't been installed.

LGTM

@nathanleclaire nathanleclaire merged commit cfe9787 into main Apr 6, 2022
@nathanleclaire nathanleclaire deleted the web-workbench/sync-web3clientside-and-lru-redux branch April 6, 2022 18:58
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.

2 participants