Welcome to Lunie.io!
👋 Welcome to Lunie. We're making staking easy and accessible for everyone. This is the repo for the Lunie web and mobile apps.
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 nvm to install the correct version. Now to install the Node.js version run:
nvm install 10.*
With Node installed, you're ready to check out the source code. Afterwards install the dependencies for this repository:
git clone https://github.com/luniehq/lunie.git
cd lunie
yarn
You can simply start the frontend:
yarn serve
The front end will run on its own, however if you want to interact with real data, please read on below.
Lunie requires a GraphQL API to work as expected. You can use our API for local development:
VUE_APP_GRAPHQL_URL=https://staging-api.lunie.io yarn serve
If you would like to use the API in production email us at hello [at] lunie.io.
IMPORTANT: Only use Ledger devices that you bought factory new or trust fully.
Lunie supports sending transactions through the Cosmos
app for Ledger Nano 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
All code needs to conform to our linting rules. This will be tested in our continuous integration.
To test if your code conforms to the rules run:
yarn lint
To fix linting errors automatically (as long as this is possible) run:
yarn lint --fix
Create the bundle to deploy Lunie you can run:
yarn build
Dependencies:
- Android Studio
- Gradle updated to 5.1.1 (Android Studio > File > Project Structure)
You will probably also want a virtual Android device which you can create from inside the Android Studio.
To run the Android version of Lunie in development:
$ yarn build:mobile
$ yarn remove @capacitor/core @capacitor/android
$ npm install @capacitor/core @capacitor/android
$ npx cap sync android
$ npx cap open android
Dependencies:
To open Lunie in Xcode:
- Build Lunie for production
$ yarn build:mobile
or ...
- Build Lunie for development
$ yarn build:mobile:dev
- After a new build, you need to run the following command. This step can take up to 20 minutes to complete if you've never used Cocoapods before.
$ npx cap sync ios
- This will open Xcode with Lunie loaded
$ npx cap open ios
Once Xcode is open, just click the Play button to run Lunie on your preferred Simulator or Device.
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:
yarn test:unit PageValidator
To check test coverage locally run following after having run unit tests. It will spin up a webserver and provide you with a link to the coverage report web page.
yarn test:coverage
Start Lunie locally, then run the tests:
yarn test:e2e:local --fe=http://localhost:9080 --api=https://staging-api.lunie.io
To run only some tests, provide the name of the e2e test file you want to run (i.e. for send.spec.js
):
yarn test:e2e:local --fe=http://localhost:9080 --api=https://staging-api.lunie.io --filter=*send*
To run the e2e tests on multiple browsers use Browserstack. You must set the environment variables BROWSERSTACK_USERNAME
and BROWSERSTACK_ACCESS_KEY
aquired from Browserstack first.
yarn test:e2e:browserstack --fe=https://app.lunie.io --api=https://staging-api.lunie.io --filter=*send*
To run the e2e tests on the Westend network (our chosen Substrate testnet network) it suffices to add the network
flag to the prior command:
yarn test:e2e:browserstack --fe=https://app.lunie.io --api=https://staging-api.lunie.io --network="polkadot-testnet"
A list of all environment variables and their purpose:
Variable | Values | default | Purpose |
---|---|---|---|
NODE_ENV |
production , development |
||
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. |
VUE_APP_GRAPHQL_URL |
http://localhost:4000 |
URL of the Lunie Backend GraphQL API. | |
VUE_APP_E2E |
true , false |
false |
Switches Lunie to run/build in e2e test mode. Disables some tracking. |
GOOGLE_ANALYTICS_UID |
Google Analytics UID to be used in production builds. | ||
MOBILE_APP |
true , false |
false |
Build for mobile. Handles some interactions differently. |