Welcome to Lunie.io!
👋 Welcome to Lunie, the official wallet and UI for the Cosmos Hub.
Install the following dependencies if you wish to run lunie on developer mode or contribute.
Lunie requires Node.js >=10.13.0
. If you have a different version of Node.js installed, you can use n
to install the correct version. The following command will use n
to install it alongside your current version of Node.js.
npm i -g n && n 10.13.0
Yarn is a JS package manager we use to manage Lunie's dependencies. Download it here.
Building Lunie and its dependencies requires Docker installed. You can download it here.
IMPORTANT: Only use Ledger devices that you bought factory new or trust fully.
Lunie supports sending transactions through the Cøsmos
app for Ledger Nano S hardware wallet. To install the Cøsmos
app on your device you'll have to:
- Download the Ledger Live app here
- Connect your Ledger via USB and update to the latest firmware
- Go to the Ledger Live App Store, and download the
Cøsmos
application (this can take a while). Note: You may have to enableDev Mode
in the Ledger Live Settings to be able to download theCøsmos
application - Navigate to the
Cøsmos
app on your Ledger device
With Node, Yarn and Docker installed, you're ready to check out the source code:
git clone https://github.com/luniehq/lunie.git
cd lunie
yarn install
Since Lunie runs on top of the Cosmos Hub blockchain, you'll also need to install Gaia (the Cosmos Hub application) and download the supported testnets.
Open the Docker App and build the Gaia CLI (gaiacli
) and the full node (gaiad
), which are part of the Cosmos SDK, with the following command:
yarn build:gaia
The version built is specified in tasks/build/Gaia/VERSION
and the programs are placed in the builds/Gaia
directory.
Currently we need a proxy to enable easy local development. We use Caddy. To download run:
curl https://getcaddy.com | bash -s personal http.cors
Sometimes you may want to run a local node, i.e. in the case there is no available network. To do so first Build Gaia, then use our automatic script or the manual process to set up your node.
If you want to have a predictable environment for Lunie please generate some ssl certificates:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout server_dev.key -out server_dev.crt \
-subj "/C=US/ST=CA/L=Irvine/O=Acme Inc./CN=localhost" \
-reqexts v3_req -reqexts SAN -extensions SAN \
-config \
<(echo -e '
[req]\n
distinguished_name=req_distinguished_name\n
[req_distinguished_name]\n
[SAN]\n
subjectKeyIdentifier=hash\n
authorityKeyIdentifier=keyid:always,issuer:always\n
basicConstraints=CA:TRUE\n
subjectAltName=@alt_names
[alt_names]
DNS.1 = localhost
')
Afterwards you can use:
yarn backend:fixed-https
yarn frontend:fixed-https
Create the bundle to deploy Lunie you can run:
yarn build:ui
If you want to set a particular Stargate
(Cosmos SDK REST API) or Tendermint's RPC
endpoints:
STARGATE=<https://StargateAddress:port> RPC=<https://RPCAddress:port> yarn build:ui
Lunie has a automated release process. Every night the CI creates a new release PR. To release manually, run
yarn release
You can create a local account to run Lunie's local-testnet on development mode by using:
yarn start:new
This will print a newly generated account on the console, such as the following:
Created Account: {
name: 'account-with-funds',
type: 'local',
address: 'cosmos1...',
pub_key: 'cosmospub1...',
mnemonic: '...'
}
To import the account to Lunie, go to the Import with seed
option on the Sign in
, and paste the mnemonic
value from above on the Seed Phrase
field.
Note: Running yarn start:new
overwrites all previously generated local accounts, meaning that you will have to import the account every time ! Use yarn start
if you want to keep your account.
Once you've generated a local account, run Lunie on the default local-testnet
:
yarn start
Start a full node for the network that you want to connect to (See guide).
Then start Lunie without the local testnet:
yarn frontend & yarn connect
If you would like to run all the tests you can run:
yarn test
Lunie uses Jest to run unit tests. You can run all the unit tests with the following command:
yarn test:unit
For a single test file (e.g. PageValidator.spec.js
) run the unit tests like this to watch the tests whenever there are changes:
yarn watch PageValidator
End to end testing will be soon restored thanks to: Browserstack
If you want to run them locally build the UI and serve the files so the E2E tests can access them:
yarn build:ui
./node_modules/.bin/http-server /dist -p 8081
Then run the actual tests:
yarn test:e2e
To check test coverage locally run following. It will spin up a webserver and provide you with a link to the coverage report web page.
yarn test:coverage
A list of all environment variables and their purpose:
Variable | Values | default | Purpose |
---|---|---|---|
NODE_ENV |
production , development |
||
CI |
true , false |
false |
Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). |
ALLOW_CONSOLE |
true , false |
false |
Unit tests fail if they use console.error or console.warn . To see the initial use/occurences of those callings, you can escape this behavior using this flag. |