/vegawallet-desktop

Desktop application for Vega Protocol's wallet

Primary LanguageTypeScriptMIT LicenseMIT

Vega Wallet desktop app

The Vega Wallet desktop app provides a graphical user interface for Vega Protocol's wallet for Windows, macOS and Linux.

Latest release: Download the latest release from the releases section.

Wallet documentation: Read the quick-start guide for tips on using the desktop wallet app.

Supported platforms

macOS: >= 10.13 (High Sierra) Windows: >= 8 Linux: Supported, but the minimum version is unknown.

Dependencies

Golang

You will need to go 1.21.

Wails

This project uses Wails to build the desktop app. To install Wails, follow the instruction on its Getting started page.

Be sure to have the following environment variables set:

  • CGO_ENABLED=1
  • GO111MODULE=on
go install github.com/wailsapp/wails/v2/cmd/wails@v2.8.0

To check if you have the correct dependencies installed, use the following command:

wails doctor

Frontend

To be able to compile the frontend, you'll also need to install:

  • nodejs >= v18.12.0
  • yarn >= v1.22.19

Platform Specific Dependencies

Be sure to follow the installation guide from Wails. Specific dependencies need to be installed.

For more details, see https://wails.io/docs/gettingstarted/installation#platform-specific-dependencies

Build

This will compile your project and save the production-ready binary in the build/bin directory.

Note, this application can be bundle specifically for fairground or mainnet.

Using the script build.sh

There are scripts that ease the switch between fairground and mainnet:

For fairground:

WALLET_OPTIMIZED_FOR=fairground ./build.sh

For mainnet:

WALLET_OPTIMIZED_FOR=mainnet ./build.sh

Ensure you set the executable mode on the scripts:

chmod +x build-*.sh

Using wails

Compile the project using the wails build command. This will produce a software optimized for mainnet.

wails build -f -clean

To compile the optimization for fairground:

wails build -f -clean -tags fairground

Note that this step alone won't correctly bundle the application for fairground. Hacks must be performed to have the right bundle name, metadata and icon. See build.sh script for more detail.

More at the Wails documentation.

Development

The backend embeds files from the frontend/dist folder. On a new environment, the frontend/dist folder is not populated, and will result of the following failure if wails is run first:

pattern frontend/dist: cannot embed directory frontend/dist: contains no embeddable files

As a result, we need to run the frontend first, so wails can embed actual files for start up the app for the first time.

cd frontend
yarn build

Then run

wails dev

This will start the app running on localhost:34115, as well as starting up Vite to handle watching for any changes and hot reloading the frontend. See wails.json for further configuration options. For more details on developing the frontend code, check out the frontend readme.

Feature flags

These flags are passed as environment variables to the app. They are used to enable/disable features. For example:

VITE_FEATURE_MODE='fairground' wails dev

or

VITE_FEATURE_MODE='fairground' wails build

A full list of these can be found below:

Flag Description
VITE_FEATURE_NETWORK_WARNING Enable warning the user if the network is a different version for the one configured for the
VITE_FEATURE_TELEMETRY_CHECK Enable users being asked if they would like to send bug reports for the application
VITE_FEATURE_MODE Build the app in fairground mode with different styling/messaging that is mode specific

More commands

To generate the go bindings for the frontend, you can run:

wails generate module

Common issues

Too many open files
Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:204:21)

It is raised on macOS. It is fixed by installing watchman:

brew install watchman

Testing

Backend

To launch the backend tests, use the following commands:

go test ./...

End to end

Check out the frontend guide to see how to run the end-to-end tests.

Support

Documentation

Get API reference documentation and learn more about how Vega works.

Wallet documentation

Read a quick-start guide for tips on using the desktop wallet app.

Feedback

Raise issues and see what others have raised.

Discord

Ask us for help, find out about scheduled open sessions, and keep up with Vega generally.

About Vega

Vega is a protocol for creating and trading derivatives on a fully decentralized network. The network, secured with proof-of-stake, will facilitate fully automated, end-to-end margin trading and execution of complex financial products. Anyone will be able to build decentralized markets using the protocol.

Read more at https://vega.xyz.