bitcoin-s-ts icon indicating copy to clipboard operation
bitcoin-s-ts copied to clipboard

Move oracle-server-ui initialization into oracle-server-ts

Open user411 opened this issue 3 years ago • 9 comments

This moves the startup polling loop and state initialization for the oracleServer to the oracle-server-ts library and binds those values at the UI. "Any Javascript UI" should be able to use the oracle-server-ts to bind through a backend proxy and interact with the oracleServer.

Added copy to clipboard buttons on top level UI fields for public key and bitcoin staking address.

Screen Shot 2022-10-03 at 1 34 49 PM

user411 avatar Oct 03 '22 19:10 user411

CI fails

Christewart avatar Oct 04 '22 23:10 Christewart

This may not work with Node 15.x

user411 avatar Oct 04 '22 23:10 user411

When running npm run build inside of oracle-electron-ts on c18e60fcc891fa670ebe40c610e0b1fb17fff37c with node v16.14.0

ERROR in ../oracle-server-ts/dist/mjs/index.js 8:0-32
Module not found: Error: Can't resolve 'common-ts/index' in '/home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/mjs'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'common-ts/index' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve 'common-ts/index' in '/home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/mjs'
  Parsed request is a module
  using description file: /home/chris/dev/bitcoin-s-ts/oracle-server-ts/package.json (relative path: ./dist/mjs)
    resolve as module
      /home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/mjs/node_modules doesn't exist or is not a directory
      /home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/node_modules doesn't exist or is not a directory
      /home/chris/dev/bitcoin-s-ts/oracle-server-ts/node_modules doesn't exist or is not a directory
      looking for modules in /home/chris/dev/bitcoin-s-ts/node_modules
        existing directory /home/chris/dev/bitcoin-s-ts/node_modules/common-ts
          using description file: /home/chris/dev/bitcoin-s-ts/node_modules/common-ts/package.json (relative path: .)
            using exports field: ./dist/mjs/index
              using description file: /home/chris/dev/bitcoin-s-ts/node_modules/common-ts/package.json (relative path: ./dist/mjs/index)
                /home/chris/dev/bitcoin-s-ts/node_modules/common-ts/dist/mjs/index doesn't exist
      /home/chris/dev/node_modules doesn't exist or is not a directory
      /home/chris/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./middleware/download.ts 3:0-69 21:4-27
 @ ./routes/proxy.ts 4:0-99 15:59-73 16:68-91 17:61-77
 @ ./routes/index.ts 3:0-48 6:16-27
 @ ./server.ts 33:0-40 34:26-32

webpack 5.74.0 compiled with 1 error and 2 warnings in 5022 ms

Christewart avatar Oct 04 '22 23:10 Christewart

Minimum Node version is 16.15 to use fetch, which we need.

user411 avatar Oct 04 '22 23:10 user411

What i see when using node v16.15.1

ERROR in ../oracle-server-ts/dist/mjs/index.js 8:0-32
Module not found: Error: Can't resolve 'common-ts/index' in '/home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/mjs'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'common-ts/index' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve 'common-ts/index' in '/home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/mjs'
  Parsed request is a module
  using description file: /home/chris/dev/bitcoin-s-ts/oracle-server-ts/package.json (relative path: ./dist/mjs)
    resolve as module
      /home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/mjs/node_modules doesn't exist or is not a directory
      /home/chris/dev/bitcoin-s-ts/oracle-server-ts/dist/node_modules doesn't exist or is not a directory
      /home/chris/dev/bitcoin-s-ts/oracle-server-ts/node_modules doesn't exist or is not a directory
      looking for modules in /home/chris/dev/bitcoin-s-ts/node_modules
        existing directory /home/chris/dev/bitcoin-s-ts/node_modules/common-ts
          using description file: /home/chris/dev/bitcoin-s-ts/node_modules/common-ts/package.json (relative path: .)
            using exports field: ./dist/mjs/index
              using description file: /home/chris/dev/bitcoin-s-ts/node_modules/common-ts/package.json (relative path: ./dist/mjs/index)
                /home/chris/dev/bitcoin-s-ts/node_modules/common-ts/dist/mjs/index doesn't exist
      /home/chris/dev/node_modules doesn't exist or is not a directory
      /home/chris/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./middleware/download.ts 3:0-69 21:4-27
 @ ./routes/proxy.ts 4:0-99 15:59-73 16:68-91 17:61-77
 @ ./routes/index.ts 3:0-48 6:16-27
 @ ./server.ts 33:0-40 34:26-32

webpack 5.74.0 compiled with 1 error and 2 warnings in 5179 ms
npm ERR! Lifecycle script `webpack` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: [email protected]
npm ERR!   at location: /home/chris/dev/bitcoin-s-ts/oracle-server-ui-proxy

Christewart avatar Oct 04 '22 23:10 Christewart

683a64b fixes the build for me.

Now when i start the electron app with npm run start, logging in seems to never occur automatically. It sits at the login screen spinning forever.

Screenshot from 2022-10-04 18-57-38

Christewart avatar Oct 04 '22 23:10 Christewart

I think there probably need to be different config values to run through electron vs how I’m testing in dev. I will debug through and report back.

user411 avatar Oct 05 '22 00:10 user411

It seems pretty consistently I get this error in the console

Screenshot from 2022-10-04 19-09-40

Christewart avatar Oct 05 '22 00:10 Christewart

This should withstand startup in Electron now. Screen Shot 2022-10-06 at 11 08 29 AM

user411 avatar Oct 06 '22 17:10 user411