From e52c00cd57680d3a84355cc8fa5b738dbb2c95ec Mon Sep 17 00:00:00 2001 From: alexgonmad Date: Wed, 31 May 2023 10:30:28 +0200 Subject: [PATCH] Removing everything related to UI --- GETTING_STARTED.md | 6 +- build-ui/Dockerfile | 21 ----- build-ui/constants.ts | 28 ------ build-ui/network.ts | 211 ------------------------------------------ build-ui/nginx.conf | 57 ------------ dappnode_package.json | 5 +- docker-compose.yml | 5 - 7 files changed, 4 insertions(+), 329 deletions(-) delete mode 100644 build-ui/Dockerfile delete mode 100644 build-ui/constants.ts delete mode 100644 build-ui/network.ts delete mode 100644 build-ui/nginx.conf diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index b4ac89c..ad936d3 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -1,5 +1,3 @@ -This package contains an Avalanche Node and a local WalletUI +This package contains an Avalanche Node. -**Wallet UI**: [avalanche.public.dappnode](http://avalanche.public.dappnode/) - -⚠️ **Important**: You will have to wait for your node to synchronize to connect the wallet UI to your node. Your wallet might not work until then. To see the progress on the synchronization of your node check the logs [here](http://my.dappnode/#/packages/avalanche.public.dappnode.eth/logs). +⚠️ **Important**: To see the progress on the synchronization of your node check the logs [here](http://my.dappnode/#/packages/avalanche.public.dappnode.eth/logs). diff --git a/build-ui/Dockerfile b/build-ui/Dockerfile deleted file mode 100644 index e30ca4e..0000000 --- a/build-ui/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM node:15.6-buster-slim as build-deps - -WORKDIR /usr/src/app - -RUN apt-get update && \ - apt-get install -y git g++ build-essential python && \ - git clone https://github.com/ava-labs/avalanche-wallet.git . - -COPY constants.ts /usr/src/app/src/store/modules/network/constants.ts -COPY network.ts /usr/src/app/src/store/modules/network/network.ts - -RUN yarn && \ - yarn build - -FROM nginx:stable - -COPY nginx.conf /etc/nginx/ -# Copiamos el la web del wallet a /usr/share/nginx/html ya que es la carpeta que por defecto se distribuye con el nginx en el ordenador de otro -COPY --from=build-deps /usr/src/app/dist /usr/share/nginx/html - -ENTRYPOINT nginx -g 'daemon off;' diff --git a/build-ui/constants.ts b/build-ui/constants.ts deleted file mode 100644 index 413c749..0000000 --- a/build-ui/constants.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AvaNetwork } from '@/js/AvaNetwork' - -export const MainnetConfig = new AvaNetwork( - 'Mainnet', - 'https://api.avax.network:443', - 1, - 'https://explorerapi.avax.network', - 'https://explorer-xp.avax.network', - true -) - -export const TestnetConfig = new AvaNetwork( - 'Fuji', - 'https://api.avax-test.network:443', - 5, - 'https://explorerapi.avax-test.network', - 'https://explorer-xp.avax-test.network', - true -) - -export const DappnodeConfig = new AvaNetwork( - 'DAppNode Mainnet', - 'http://avalanche.avalanche.public.dappnode:9650', - 1, - 'https://explorerapi.avax.network', - 'https://explorer.avax.network', - true -) diff --git a/build-ui/network.ts b/build-ui/network.ts deleted file mode 100644 index 638e2f8..0000000 --- a/build-ui/network.ts +++ /dev/null @@ -1,211 +0,0 @@ -import { Module } from 'vuex' -import { RootState } from '@/store/types' -import { NetworkState } from '@/store/modules/network/types' - -import { ava, avm, bintools, cChain, infoApi, pChain } from '@/AVA' -import { AvaNetwork } from '@/js/AvaNetwork' -import { explorer_api } from '@/explorer_api' -import { BN } from 'avalanche' -import { getPreferredHRP } from 'avalanche/dist/utils' -import router from '@/router' -import { web3 } from '@/evm' -import { setSocketNetwork } from '../../../providers' -import { getConfigFromUrl, setNetworkAsync } from '@avalabs/avalanche-wallet-sdk' -import { MainnetConfig, TestnetConfig } from '@/store/modules/network/constants' -import { DappnodeConfig } from './constants' -const network_module: Module = { - namespaced: true, - state: { - status: 'disconnected', // disconnected | connecting | connected - networks: [], - networksCustom: [], - selectedNetwork: null, - txFee: new BN(0), - }, - mutations: { - addNetwork(state, net: AvaNetwork) { - state.networks.push(net) - }, - }, - getters: { - allNetworks(state) { - return state.networks.concat(state.networksCustom) - }, - }, - actions: { - addCustomNetwork({ state, dispatch }, net: AvaNetwork) { - // Check if network alerady exists - const networks = state.networksCustom - // Do not add if there is a network already with the same url - for (let i = 0; i < networks.length; i++) { - const url = networks[i].url - if (net.url === url) { - return - } - } - state.networksCustom.push(net) - dispatch('save') - }, - - async removeCustomNetwork({ state, dispatch }, net: AvaNetwork) { - const index = state.networksCustom.indexOf(net) - state.networksCustom.splice(index, 1) - await dispatch('save') - }, - saveSelectedNetwork({ state }) { - const data = JSON.stringify(state.selectedNetwork?.url) - localStorage.setItem('network_selected', data) - }, - async loadSelectedNetwork({ dispatch, getters }): Promise { - const data = localStorage.getItem('network_selected') - if (!data) return false - try { - // let net: AvaNetwork = JSON.parse(data); - const nets: AvaNetwork[] = getters.allNetworks - - for (let i = 0; i < nets.length; i++) { - const net = nets[i] - if (JSON.stringify(net.url) === data) { - dispatch('setNetwork', net) - return true - } - } - return false - } catch (e) { - return false - } - }, - - // Save custom networks to local storage - save({ state }) { - const data = JSON.stringify(state.networksCustom) - localStorage.setItem('networks', data) - }, - // Load custom networks from local storage - load({ dispatch }) { - const data = localStorage.getItem('networks') - - if (data) { - const networks: AvaNetwork[] = JSON.parse(data) - - networks.forEach((n) => { - const newCustom = new AvaNetwork( - n.name, - n.url, - //@ts-ignore - parseInt(n.networkId), - n.explorerUrl, - n.explorerSiteUrl, - n.readonly - ) - dispatch('addCustomNetwork', newCustom) - }) - } - }, - async setNetwork({ state, dispatch, commit, rootState }, net: AvaNetwork) { - state.status = 'connecting' - - // Chose if the network should use credentials - await net.updateCredentials() - ava.setRequestConfig('withCredentials', net.withCredentials) - ava.setAddress(net.ip, net.port, net.protocol) - ava.setNetworkID(net.networkId) - - // Reset transaction history - commit('History/clear', null, { root: true }) - - // Query the network to get network id - const chainIdX = await infoApi.getBlockchainID('X') - const chainIdP = await infoApi.getBlockchainID('P') - const chainIdC = await infoApi.getBlockchainID('C') - - avm.refreshBlockchainID(chainIdX) - avm.setBlockchainAlias('X') - pChain.refreshBlockchainID(chainIdP) - pChain.setBlockchainAlias('P') - cChain.refreshBlockchainID(chainIdC) - cChain.setBlockchainAlias('C') - - avm.getAVAXAssetID(true) - pChain.getAVAXAssetID(true) - cChain.getAVAXAssetID(true) - - state.selectedNetwork = net - dispatch('saveSelectedNetwork') - - // Update explorer api - explorer_api.defaults.baseURL = net.explorerUrl - - // Set web3 Network Settings - const web3Provider = `${net.protocol}://${net.ip}:${net.port}/ext/bc/C/rpc` - web3.setProvider(web3Provider) - - // Set socket connections - setSocketNetwork(net) - - commit('Assets/removeAllAssets', null, { root: true }) - await dispatch('Assets/updateAvaAsset', null, { root: true }) - - // If authenticated - if (rootState.isAuth) { - // Go back to wallet page - router.replace('/wallet') - for (let i = 0; i < rootState.wallets.length; i++) { - const w = rootState.wallets[i] - w.onnetworkchange() - } - } - - await dispatch('Assets/onNetworkChange', net, { root: true }) - dispatch('Assets/updateUTXOs', null, { root: true }) - dispatch('Platform/update', null, { root: true }) - dispatch('Platform/updateMinStakeAmount', null, { root: true }) - dispatch('updateTxFee') - // Update tx history - dispatch('History/updateTransactionHistory', null, { root: true }) - - // Set the SDK Network - const sdkNetConf = await getConfigFromUrl(net.getFullURL()) - await setNetworkAsync({ - ...sdkNetConf, - explorerURL: net.explorerUrl, - explorerSiteURL: net.explorerSiteUrl, - }) - // state.isConnected = true; - state.status = 'connected' - return true - }, - - async updateTxFee({ state }) { - const txFee = await infoApi.getTxFee() - state.txFee = txFee.txFee - avm.setTxFee(txFee.txFee) - }, - - async init({ state, commit, dispatch }) { - // Load custom networks if any - try { - await dispatch('load') - } catch (e) { - console.error(e) - } - - commit('addNetwork', DappnodeConfig) - commit('addNetwork', MainnetConfig) - commit('addNetwork', TestnetConfig) - - try { - const isSet = await dispatch('loadSelectedNetwork') - if (!isSet) { - await dispatch('setNetwork', state.networks[0]) - } - return true - } catch (e) { - console.log(e) - state.status = 'disconnected' - } - }, - }, -} - -export default network_module diff --git a/build-ui/nginx.conf b/build-ui/nginx.conf deleted file mode 100644 index 43ec97d..0000000 --- a/build-ui/nginx.conf +++ /dev/null @@ -1,57 +0,0 @@ -worker_processes auto; - -error_log /var/log/nginx/error.log notice; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - - keepalive_timeout 65; - - server { - listen 80; - root /usr/share/nginx/html; - - # what file to server as index - index index.html index.htm; - - location / { - # First attempt to serve request as file, then - # as directory, then fall back to redirecting to index.html - try_files $uri $uri/ /index.html; - } - - # Media: images, icons, video, audio, HTC - location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { - expires 1M; - access_log off; - add_header Cache-Control "public"; - } - - # Javascript and CSS files - location ~* \.(?:css|js)$ { - try_files $uri =404; - expires 1y; - access_log off; - add_header Cache-Control "public"; - } - - # Any route containing a file extension (e.g. /devicesfile.js) - location ~ ^.+\..+$ { - try_files $uri =404; - } - } -} diff --git a/dappnode_package.json b/dappnode_package.json index ab84a38..6aa3c75 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -3,11 +3,10 @@ "version": "0.1.31", "upstreamVersion": "v1.10.2", "upstreamRepo": "ava-labs/avalanchego", - "shortDescription": "Avalanche Node and Wallet WebUI", - "description": "Avalanche is an open-source platform for launching highly decentralized applications, new financial primitives, and new interoperable blockchains. This package includes a full node and a local Wallet", + "shortDescription": "Avalanche Node", + "description": "Avalanche is an open-source platform for launching highly decentralized applications, new financial primitives, and new interoperable blockchains. This package includes a full node", "categories": ["Blockchain"], "license": "GPL-3.0", - "mainService": "wallet", "type": "service", "backup": [ { diff --git a/docker-compose.yml b/docker-compose.yml index fa7d4e7..e74d321 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,11 +14,6 @@ services: ports: - "9651" restart: unless-stopped - wallet: - build: - context: build-ui - image: "wallet.avalanche.public.dappnode.eth:0.1.0" - restart: unless-stopped volumes: chain: {} validator: {}