Skip to content

Commit acd978e

Browse files
committed
Original Ava Labs code commit
1 parent d05b572 commit acd978e

File tree

502 files changed

+76993
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

502 files changed

+76993
-2
lines changed

.browserslistrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
> 1%
2+
last 2 versions

.env.e2e

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
USE_HTTP=true

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist/
3+
tests/

.eslintrc.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
extends: [
7+
'plugin:vue/essential',
8+
'eslint:recommended',
9+
'@vue/typescript',
10+
'plugin:prettier-vue/recommended',
11+
'prettier/vue',
12+
],
13+
parserOptions: {
14+
parser: '@typescript-eslint/parser',
15+
},
16+
rules: {
17+
'no-console': 'off',
18+
'no-unused-vars': 'off',
19+
'prefer-const': 'off',
20+
'vue/no-unused-components': 'off',
21+
'vue/multiline-html-element-content-newline': 'off',
22+
'no-unreachable': 'off',
23+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
24+
},
25+
}

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# Manually importing AVAJS
6+
avajs
7+
8+
# local env files
9+
.env
10+
.env.local
11+
.env.*.local
12+
13+
# Log files
14+
npm-debug.log*
15+
yarn-debug.log*
16+
yarn-error.log*
17+
18+
# Editor directories and files
19+
.idea
20+
.vscode
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
/cypress/videos
27+
/cypress/screenshots
28+
29+
# Snyk
30+
.dccache

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
node_modules

.prettierrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": false,
5+
"singleQuote": true,
6+
"printWidth": 100,
7+
"htmlWhitespaceSensitivity": "ignore",
8+
"expandUsers": true
9+
}

LICENSE.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2020, Ava Labs, Inc.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

LICENSE LICENSE.rekt

File renamed without changes.

README.md

+113-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,113 @@
1-
# avax-wallet
2-
A maintenance fork of the original AVAX wallet by Ava Labs
1+
# Avalanche (AVAX) Wallet Fork
2+
3+
This is a fork of the original frontend Vue.js application for the Avalanche (AVAX) Wallet.
4+
5+
It's a maintenance fork meant for local use and not meant for production.
6+
7+
## Prerequisites
8+
9+
- Yarn (https://classic.yarnpkg.com/en/docs/install/)
10+
- Recent version of npm (7.4.0)
11+
- Node v16
12+
- Gecko, Avalanche client in Golang (https://github.com/ava-labs/avalanchego)
13+
14+
## Installation
15+
16+
1. Clone the repo `git clone https://github.com/ava-labs/avalanche-wallet.git`
17+
2. Go to root of the project `cd avalanche-wallet`
18+
3. Install javascript dependencies with `yarn install`.
19+
20+
## Running The Project
21+
22+
In order for the wallet to work, it needs the Avalanche network to operate on. By default the wallet will connect to the Avalanche mainnet.
23+
24+
1. If you want to connect to a local network, make sure you have installed and able to run a AvlaancheGo node properly.
25+
2. Run the project with hot reloading `yarn serve`
26+
27+
When you go to the website on your browser, you might get a warning saying
28+
"Site is not secure". This is because we are signing our own SSL Certificates. Please ignore and continue to the website.
29+
30+
## Deployment
31+
32+
1. Compile and minify to have a production ready application with `yarn build`.
33+
2. Serve from the `/dist` directory.
34+
35+
## Changing the Network
36+
37+
By default the wallet will connect to the Avalanche tmainnet. You can change to another network by clicking the button labeled `TestNet` on the navigation bar and selecting another network, or add a custom network.
38+
39+
## Explorer API
40+
41+
A valid explorer API is required to correctly display balances for Mnemonic and Ledger type wallets.
42+
The wallet uses the Avalanche Explorer API to display wallet transaction history.
43+
44+
WARNING: This history might be out of order and incomplete.
45+
46+
## Browser Support
47+
48+
We suggest using Google Chrome to view the Avalanche Wallet website.
49+
50+
### Firefox and https
51+
52+
Firefox does not allow https requests to localhost. But the Avalanche Wallet uses https by default, so we will need to change this to http. Make this switch by editing the `vue.config.js` file in the root directory and change
53+
54+
```
55+
devServer: {
56+
https: true
57+
},
58+
```
59+
60+
to
61+
62+
```
63+
devServer: {
64+
https: false
65+
},
66+
```
67+
68+
and run `yarn serve` to reflect the change.
69+
70+
# Accounts
71+
72+
The wallet can encrypt your private keys into a secure file encrypted by a password.
73+
74+
```json
75+
{
76+
"accounts": iUserAccountEncrypted[]
77+
}
78+
```
79+
80+
# Language Setting
81+
82+
Saved into local storage as a 2 letter code.
83+
84+
```
85+
"lang": "en"
86+
```
87+
88+
# Dependencies
89+
90+
##### Avalanche Node (https://github.com/ava-labs/avalanchego)
91+
92+
To get utxos and to send transactions.
93+
94+
#### Explorer API Node (https://github.com/ava-labs/ortelius)
95+
96+
To check if an address was used before, and to get activity history.
97+
98+
# Default Connections
99+
100+
The wallet needs to connect to an Avalanche node, and an explorer node to operate properly.
101+
102+
By default, there are two network options to connect to: `Mainnet` and `Fuji`.
103+
104+
##### Mainnet
105+
106+
- Avalanche API: `https://api.avax.network:443`
107+
- Explorer API: `https://explorerapi.avax.network`
108+
109+
##### Fuji (Testnet)
110+
111+
- Avalanche API: `https://api.avax-test.network:443`
112+
- Explorer API: `https://explorerapi.avax-test.network`
113+

babel.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
presets: ['@vue/cli-plugin-babel/preset'],
3+
plugins: [
4+
['@babel/proposal-decorators', { legacy: true }],
5+
['@babel/proposal-class-properties', { loose: true }],
6+
],
7+
}

cypress.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Working Custom Network",
3+
"url": "https://api.avax.network:443"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Broken Custom Network",
3+
"url": "https://ai.avax.network:443"
4+
}

cypress/fixtures/example.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

cypress/fixtures/keystore_v5.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"5.0","salt":"35U2Bkavb7s9tx1uiFym4oHMufr6","pass_hash":"jqS7bny1Zx2xBSNvuzxR9oEdDLGvTBCVb4xPsWjRkhS32FEwd","keys":[{"key":"4VeLbSytCaFQfkWfJ4aWgT27J8eAg8SdEMkqVX1pgxLQFReHuMS1SGd6RTQdLv452b5woXLxPaPijybvA8rBUjhtF4oGRDzEcq167NsjUaZYNv2WyYHaL9QhCeRQwJYeksQkkqYGY832Jfmk1hPK7P8z7z3mHtK6z8CTPnCnz4mZ2EqP6MPmfC7qddRjb9Q6qKPVNz9oE5ivKaSpMKF8DD4sYT1Pvxjhgh","iv":"5y74DCBoyZcEeZUynDhZKw"}]}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { expect } from 'chai'
2+
3+
const NETWORK_SWITCHER_BUTTON = '[data-cy="network-switcher"]'
4+
5+
describe('Basic Functionality', () => {
6+
before(() => {
7+
cy.visit('/')
8+
// Reject the analytics tracking
9+
cy.get('[data-cy="reject_analytics"]').click()
10+
// Disable banner
11+
cy.get('[data-cy="dismiss_banner"]').click()
12+
})
13+
14+
it('has access/create wallet options', () => {
15+
cy.get('[data-cy=create]').should('have.length', 2)
16+
cy.get('[data-cy=access]').should('have.length', 2)
17+
})
18+
19+
describe('Network Switcher', () => {
20+
beforeEach(() => {
21+
cy.get(NETWORK_SWITCHER_BUTTON).click()
22+
})
23+
24+
afterEach(() => {
25+
cy.get(NETWORK_SWITCHER_BUTTON).click()
26+
})
27+
28+
it('can add custom network option', () => {
29+
cy.get('[data-cy="custom-network-option"]').should('have.length', 1)
30+
cy.get('[data-cy="create-custom-option"]', { timeout: 10000 })
31+
.should('have.length', 1)
32+
.click()
33+
34+
cy.fixture('custom_networks/basic_network.json').then((info) => {
35+
cy.get('[data-cy="custom-network-name"]').clear().type(info.name)
36+
cy.get('[data-cy="custom-network-url"]').clear().type(info.url)
37+
cy.get('[data-cy="custom-network-add"]').click()
38+
cy.get('[data-cy="network-item"]').should('have.length', 3)
39+
})
40+
})
41+
})
42+
})

cypress/plugins/index.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Rather then have a bunch of configs for each environment we simply
3+
* create a object here, dynamically change it based on various environment variables
4+
* and pass it to cypress just before it starts.
5+
*/
6+
const CYPRESS_BASE_CONFIG = {
7+
nodeVersion: 'system',
8+
}
9+
10+
const CYPRESS_CONFIG_PROD = {
11+
...CYPRESS_BASE_CONFIG,
12+
baseUrl: 'https://wallet.avax.network/',
13+
}
14+
15+
const CYPRESS_CONFIG_LOCAL = {
16+
...CYPRESS_BASE_CONFIG,
17+
baseUrl: `${!process.env.USE_HTTP ? 'https' : 'http'}://localhost:5000/`,
18+
}
19+
20+
/**
21+
* @type {Cypress.PluginConfig}
22+
*/
23+
module.exports = () => {
24+
return process.env.runProduction ? CYPRESS_CONFIG_PROD : CYPRESS_CONFIG_LOCAL
25+
}

cypress/support/commands.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add("login", (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

cypress/support/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)