mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
docs: organize suite-desktop.md chapters
This commit is contained in:
committed by
Jiri Zbytovsky
parent
2d399ebc44
commit
b93f71b05a
@@ -33,7 +33,9 @@
|
||||
- [@trezor/suite](./packages/suite/index.md)
|
||||
- [send form](./packages/suite/send.md)
|
||||
- [send form architecture](./packages/suite/send/ARCHITECTURE.md)
|
||||
- [@trezor/suite-desktop](./packages/suite-desktop.md)
|
||||
- [@trezor/suite-desktop](./packages/suite-desktop/index.md)
|
||||
- [debugging](./packages/suite-desktop/debugging.md)
|
||||
- [runtime flags](./packages/suite-desktop/runtime-flags.md)
|
||||
- [creating new package](./packages/creating-packages.md)
|
||||
- [Features](./features/index.md)
|
||||
- [coin handler](./features/protocols/coin-handler.md)
|
||||
|
||||
@@ -13,7 +13,7 @@ All messages with an inferior level to the selected one will be displayed. For e
|
||||
|
||||
## How to enable logging
|
||||
|
||||
Logging can be enabled by running Suite with the command line flag `--log-level=LEVEL` (replace _LEVEL_ with _error_, _warn_, _info_ or _debug_ based on the logging you wish to display). Additional command line flags can be found on the [Suite-Desktop page](../packages/suite-desktop.md).
|
||||
Logging can be enabled by running Suite with the command line flag `--log-level=LEVEL` (replace _LEVEL_ with _error_, _warn_, _info_ or _debug_ based on the logging you wish to display). Additional command line flags can be found on the [Suite-Desktop page](../packages/suite-desktop/index.md).
|
||||
|
||||
If you activate Debug menu, logging to file is automatically started. When you deactivate Debug menu, logging stopped if the app is not running with the command line flag. If you run the app with `--log-write` flag and then activate the Debug menu, logging just continue with the same file.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This directory contains description of various Trezor Suite packages.
|
||||
|
||||
[@trezor/connect](./connect/index.md)
|
||||
[@trezor/suite](./suite/index.md)
|
||||
[@trezor/suite-desktop](./suite-desktop.md)
|
||||
[creating new package](./creating-packages.md)
|
||||
- [@trezor/connect](./connect/index.md)
|
||||
- [@trezor/suite](./suite/index.md)
|
||||
- [@trezor/suite-desktop](./suite-desktop/index.md)
|
||||
- [creating new package](./creating-packages.md)
|
||||
|
||||
41
docs/packages/suite-desktop/debugging.md
Normal file
41
docs/packages/suite-desktop/debugging.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Suite Desktop debugging
|
||||
|
||||
## Debugging main process (Chrome dev tools)
|
||||
|
||||
[Source](https://www.electronjs.org/docs/latest/tutorial/debugging-main-process)
|
||||
|
||||
Open chrome and go to `chrome://inspect`
|
||||
|
||||
In "Devices" tab make sure that "Discover network targets" is enabled and "localhost:5858" is added (use Configure button)
|
||||
|
||||
## dev mode
|
||||
|
||||
modify packages/suite-desktop/package.json
|
||||
|
||||
```
|
||||
"dev:run": "electron ."
|
||||
// to
|
||||
"dev:run": "electron --inspect=5858 ."
|
||||
```
|
||||
|
||||
## prod mode
|
||||
|
||||
Run production build with `--inspect=5858` runtime flag
|
||||
|
||||
## Debugging build
|
||||
|
||||
#### Linux
|
||||
|
||||
`./Trezor-Suite-22.7.2.AppImage --log-level=debug`
|
||||
|
||||
#### MacOS
|
||||
|
||||
`./Trezor\ Suite.app/Contents/MacOS/Trezor\ Suite --log-level=debug`
|
||||
|
||||
#### NixOS
|
||||
|
||||
`appimage-run ./Trezor-Suite.AppImage --log-level=debug`
|
||||
|
||||
#### Windows
|
||||
|
||||
`"C:\Users\[user-name]\AppData\Local\Programs\Trezor Suite\Trezor Suite.exe" --log-level=debug`
|
||||
75
docs/packages/suite-desktop/index.md
Normal file
75
docs/packages/suite-desktop/index.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Suite Desktop
|
||||
|
||||
## Main differences between suite-web and suite-desktop builds
|
||||
|
||||
- @trezor/connect API
|
||||
- suite-web
|
||||
- `@trezor/connect` is part of the JavaScript bundle as a regular module.
|
||||
- `@trezor/connect` imports from `@trezor/suite` are replaced to `@trezor/connect-web` see [webpack config](https://github.com/trezor/trezor-suite/blob/develop/packages/suite-build/configs/web.webpack.config.ts)
|
||||
- suite-desktop
|
||||
- `@trezor/connect` is installed as regular node_module and works in nodejs context (electron main process).
|
||||
- `@trezor/connect` files are **not** hosted on the electron renderer context.
|
||||
- On the renderer context all `@trezor/connect` methods from are replaced by `@trezor/ipc-proxy` methods. see [index](https://github.com/trezor/trezor-suite/blob/develop/packages/suite-desktop/src/Main.tsx)
|
||||
- Firmware binaries
|
||||
- suite-web
|
||||
- newest firmware binaries are hosted at `[url]/build/static/connect/data/firmware` and they are downloaded using regular `fetch` API.
|
||||
- suite-desktop
|
||||
- firmware binaries are bundled as application resources in `bin` directory, full path depends on OS but it could be found on the as level as `app.asar` file, and they are downloaded using `fs.readFile` API. see @trezor/connect/src/utils/assets
|
||||
- Trezor Bridge (trezord)
|
||||
- Tor
|
||||
- Bluetooth transport
|
||||
|
||||
## App ID and name by environment
|
||||
|
||||
| Environment | App ID | App name | User data dir name |
|
||||
| --------------------- | ---------------------- | -------------------- | ----------------------------- |
|
||||
| production (codesign) | `com.trezor.suite` | `Trezor Suite` | `@trezor/suite-desktop` |
|
||||
| development (sldev) | `com.trezor.suite.dev` | `Trezor Suite Dev` | `@trezor/suite-desktop-dev` |
|
||||
| local dev server | `com.github.Electron` | `Trezor Suite Local` | `@trezor/suite-desktop-local` |
|
||||
|
||||
Suite app name and ID are set by the environment so that Suite uses different user data dir and it's not mixed between environments. The main benefit is that you can switch back and forth between Suite dev versions without losing your remembered production wallets. One disadvantage of this solution is checking of other instance running is not so straightforward between environments.
|
||||
|
||||
Same concept (user data separated by environment) works on web out of the box (storage per domain name).
|
||||
|
||||
Note that locally built Suite is "development (sldev)", while "local dev server" is for `yarn suite:dev:desktop`.
|
||||
|
||||
## Debugging
|
||||
|
||||
See separate documentation for [debugging](./debugging.md) with debugging instructions.
|
||||
|
||||
## Logging
|
||||
|
||||
Logging can be enabled by running Suite with the command line flag `--log-level=LEVEL` (replace _LEVEL_ with _error_, _warn_, _info_ or _debug_ based on the logging you wish to display). Additional command line flags can be found [here](./runtime-flags.md).
|
||||
|
||||
More technical information can be found on the [Desktop Logger page](../features/desktop-logger.md).
|
||||
|
||||
## Shortcuts
|
||||
|
||||
Available shortcuts as provided by Electron:
|
||||
|
||||
| name | commands |
|
||||
| --------------- | ---------------------------------------------------- |
|
||||
| Reload app | F5, Ctrl+R, Cmd+R |
|
||||
| Hard Reload app | Shift+F5, Shift+Ctrl+R, Shift+Cmd+R |
|
||||
| Restart app | Alt+F5, Option+F5, Alt+Shift+R, Option+Shift+R |
|
||||
| Open DevTools | F12, Cmd+Shift+I,Ctrl+Shift+I, Cmd+Alt+I, Ctrl+Alt+I |
|
||||
|
||||
## Runtime flags
|
||||
|
||||
See separate documentation for [runtime-flags](./runtime-flags.md) with runtime flags.
|
||||
|
||||
## Extract application
|
||||
|
||||
#### MacOS
|
||||
|
||||
`npx @electron/asar extract ./Trezor\ Suite.app/Contents/Resources/app.asar ./decompiled`
|
||||
|
||||
#### NixOS
|
||||
|
||||
Run application to get mount-id like:
|
||||
|
||||
```
|
||||
Trezor-Suite.AppImage installed in ~/.cache/appimage-run/e4f67ae8624c4079527c669d8a3c4bbc1dd00b83b2e1d15807a5863b11bd4f38
|
||||
```
|
||||
|
||||
`npx @electron/asar extract ~/.cache/appimage-run/[mount-id]/resources/app.asar ./decompiled`
|
||||
@@ -1,91 +1,4 @@
|
||||
# Suite Desktop
|
||||
|
||||
## Main differences between suite-web and suite-desktop builds
|
||||
|
||||
### - @trezor/connect API
|
||||
|
||||
- suite-web
|
||||
|
||||
`@trezor/connect` is part of the JavaScript bundle as a regular module.
|
||||
|
||||
`@trezor/connect` imports from `@trezor/suite` are replaced to `@trezor/connect-web` see [webpack config](https://github.com/trezor/trezor-suite/blob/develop/packages/suite-build/configs/web.webpack.config.ts)
|
||||
|
||||
- suite-desktop
|
||||
|
||||
`@trezor/connect` is installed as regular node_module and works in nodejs context (electron main process).
|
||||
|
||||
`@trezor/connect` files are **not** hosted on the electron renderer context.
|
||||
|
||||
On the renderer context all `@trezor/connect` methods from are replaced by `@trezor/ipc-proxy` methods. see [index](https://github.com/trezor/trezor-suite/blob/develop/packages/suite-desktop/src/Main.tsx)
|
||||
|
||||
### - Firmware binaries
|
||||
|
||||
- suite-web
|
||||
|
||||
newest firmware binaries are hosted at `[url]/build/static/connect/data/firmware` and they are downloaded using regular `fetch` API.
|
||||
|
||||
- suite-desktop
|
||||
|
||||
firmware binaries are bundled as application resources in `bin` directory, full path depends on OS but it could be found on the as level as `app.asar` file, and they are downloaded using `fs.readFile` API. see @trezor/connect/src/utils/assets
|
||||
|
||||
### - Trezor Bridge (trezord)
|
||||
|
||||
### - Tor
|
||||
|
||||
## App ID and name by environment
|
||||
|
||||
| Environment | App ID | App name | User data dir name |
|
||||
| --------------------- | ---------------------- | -------------------- | ----------------------------- |
|
||||
| production (codesign) | `com.trezor.suite` | `Trezor Suite` | `@trezor/suite-desktop` |
|
||||
| development (sldev) | `com.trezor.suite.dev` | `Trezor Suite Dev` | `@trezor/suite-desktop-dev` |
|
||||
| local dev server | `com.github.Electron` | `Trezor Suite Local` | `@trezor/suite-desktop-local` |
|
||||
|
||||
Suite app name and ID are set by the environment so that Suite uses different user data dir and it's not mixed between environments. The main benefit is that you can switch back and forth between Suite dev versions without losing your remembered production wallets. One disadvantage of this solution is checking of other instance running is not so straightforward between environments.
|
||||
|
||||
Same concept (user data separated by environment) works on web out of the box (storage per domain name).
|
||||
|
||||
Note that locally built Suite is "development (sldev)", while "local dev server" is for `yarn suite:dev:desktop`.
|
||||
|
||||
## Debugging main process (Chrome dev tools)
|
||||
|
||||
[Source](https://www.electronjs.org/docs/latest/tutorial/debugging-main-process)
|
||||
|
||||
Open chrome and go to `chrome://inspect`
|
||||
|
||||
In "Devices" tab make sure that "Discover network targets" is enabled and "localhost:5858" is added (use Configure button)
|
||||
|
||||
### dev mode
|
||||
|
||||
modify packages/suite-desktop/package.json
|
||||
|
||||
```
|
||||
"dev:run": "electron ."
|
||||
// to
|
||||
"dev:run": "electron --inspect=5858 ."
|
||||
```
|
||||
|
||||
### prod mode
|
||||
|
||||
Run production build with `--inspect=5858` runtime flag
|
||||
|
||||
## Logging
|
||||
|
||||
Logging can be enabled by running Suite with the command line flag `--log-level=LEVEL` (replace _LEVEL_ with _error_, _warn_, _info_ or _debug_ based on the logging you wish to display). Additional command line flags can be found [below](#runtime-flags).
|
||||
|
||||
More technical information can be found on the [Desktop Logger page](../features/desktop-logger.md).
|
||||
|
||||
## Shortcuts
|
||||
|
||||
Available shortcuts as provided by Electron:
|
||||
|
||||
| name | commands |
|
||||
| --------------- | ---------------------------------------------------- |
|
||||
| Reload app | F5, Ctrl+R, Cmd+R |
|
||||
| Hard Reload app | Shift+F5, Shift+Ctrl+R, Shift+Cmd+R |
|
||||
| Restart app | Alt+F5, Option+F5, Alt+Shift+R, Option+Shift+R |
|
||||
| Open DevTools | F12, Cmd+Shift+I,Ctrl+Shift+I, Cmd+Alt+I, Ctrl+Alt+I |
|
||||
|
||||
## Runtime flags
|
||||
# Suite Desktop runtime flags
|
||||
|
||||
Runtime flags can be used when running the Suite Desktop executable, enabling or disabling certain features. For example: `./Trezor-Suite-22.7.2.AppImage --open-devtools` will run with this flag turned on, which will result in opening DevTools on app launch.
|
||||
The table below lists only the custom flags defined by Suite. For a full list, see also flags exposed by
|
||||
@@ -113,37 +26,3 @@ Available flags:
|
||||
| `--log-no-print` | Suppress console logs |
|
||||
| `--remove-user-data-on-start` | Removes user data directory on start (used for E2E testing) |
|
||||
| `--expose-connect-ws` | Expose Connect websocket even on production build |
|
||||
|
||||
## Debugging build
|
||||
|
||||
#### Linux
|
||||
|
||||
`./Trezor-Suite-22.7.2.AppImage --log-level=debug`
|
||||
|
||||
#### MacOS
|
||||
|
||||
`./Trezor\ Suite.app/Contents/MacOS/Trezor\ Suite --log-level=debug`
|
||||
|
||||
#### NixOS
|
||||
|
||||
`appimage-run ./Trezor-Suite.AppImage --log-level=debug`
|
||||
|
||||
#### Windows
|
||||
|
||||
`"C:\Users\[user-name]\AppData\Local\Programs\Trezor Suite\Trezor Suite.exe" --log-level=debug`
|
||||
|
||||
## Extract application
|
||||
|
||||
#### MacOS
|
||||
|
||||
`npx @electron/asar extract ./Trezor\ Suite.app/Contents/Resources/app.asar ./decompiled`
|
||||
|
||||
#### NixOS
|
||||
|
||||
Run application to get mount-id like:
|
||||
|
||||
```
|
||||
Trezor-Suite.AppImage installed in ~/.cache/appimage-run/e4f67ae8624c4079527c669d8a3c4bbc1dd00b83b2e1d15807a5863b11bd4f38
|
||||
```
|
||||
|
||||
`npx @electron/asar extract ~/.cache/appimage-run/[mount-id]/resources/app.asar ./decompiled`
|
||||
@@ -14,7 +14,7 @@ Both `dependencies` and `devDependencies` defined in `package.json` of this pack
|
||||
yarn workspace @trezor/suite-desktop dev
|
||||
```
|
||||
|
||||
[Read more about development and debugging](../../docs/packages/suite-desktop.md)
|
||||
[Read more about development and debugging](../../docs/packages/suite-desktop/index.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -82,7 +82,7 @@ Location of data directory depends on platform:
|
||||
| macOS | `~/Library/Application Support/` |
|
||||
| Windows | `C:\Users\<user>\AppData\Roaming\` |
|
||||
|
||||
Name of data directory [depends on environment](../../docs/packages/suite-desktop.md/#app-id-and-name-by-environment) and it's `@trezor/suite-desktop`, `@trezor/suite-desktop-dev` or `@trezor/suite-desktop-local`.
|
||||
Name of data directory [depends on environment](../../docs/packages/suite-desktop/index.md/#app-id-and-name-by-environment) and it's `@trezor/suite-desktop`, `@trezor/suite-desktop-dev` or `@trezor/suite-desktop-local`.
|
||||
|
||||
You can open current user data dir directly in Suite debug settings via the link in "Wipe app data" description.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user