Merge commit 'f151eb81c812a62d1d5c57ee91620a3dd9ae5068' into simon/angular-universal

* commit 'f151eb81c812a62d1d5c57ee91620a3dd9ae5068':
  Upgrade angular from 10.0.4 to 10.2.3, typescript from 3.9.7 to 4.0.5
  Modify /bisq/api/v1/markets/markets to only return active markets
  Remove unnecessary @types/axios dependency.
  Same npm fix for running `tsc` from `./node_modules` for backend
  Set npm to run `ng` and `tsc` binaries from `./node_modules/` path

# Conflicts:
#	frontend/package-lock.json
#	frontend/package.json
This commit is contained in:
softsimon 2020-11-28 02:21:12 +07:00
commit f9c2bc1fb5
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
6 changed files with 34763 additions and 31502 deletions

View File

@ -9,7 +9,6 @@
"version": "2.0.0", "version": "2.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/axios": "^0.14.0",
"axios": "^0.21.0", "axios": "^0.21.0",
"express": "^4.17.1", "express": "^4.17.1",
"locutus": "^2.0.12", "locutus": "^2.0.12",
@ -52,15 +51,6 @@
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
} }
}, },
"node_modules/@types/axios": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz",
"integrity": "sha1-7CMA++fX3d1+udOr+HmZlkyvzkY=",
"deprecated": "This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed!",
"dependencies": {
"axios": "*"
}
},
"node_modules/@types/body-parser": { "node_modules/@types/body-parser": {
"version": "1.19.0", "version": "1.19.0",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz",
@ -969,14 +959,6 @@
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
} }
}, },
"@types/axios": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz",
"integrity": "sha1-7CMA++fX3d1+udOr+HmZlkyvzkY=",
"requires": {
"axios": "*"
}
},
"@types/body-parser": { "@types/body-parser": {
"version": "1.19.0", "version": "1.19.0",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz",

View File

@ -20,12 +20,13 @@
], ],
"main": "index.ts", "main": "index.ts",
"scripts": { "scripts": {
"build": "tsc", "ng": "./node_modules/@angular/cli/bin/ng",
"tsc": "./node_modules/typescript/bin/tsc",
"build": "npm run tsc",
"start": "node --max-old-space-size=4096 dist/index.js", "start": "node --max-old-space-size=4096 dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"dependencies": { "dependencies": {
"@types/axios": "^0.14.0",
"axios": "^0.21.0", "axios": "^0.21.0",
"express": "^4.17.1", "express": "^4.17.1",
"locutus": "^2.0.12", "locutus": "^2.0.12",

View File

@ -6,6 +6,8 @@ import * as datetime from 'locutus/php/datetime';
class BisqMarketsApi { class BisqMarketsApi {
private cryptoCurrencyData: Currency[] = []; private cryptoCurrencyData: Currency[] = [];
private fiatCurrencyData: Currency[] = []; private fiatCurrencyData: Currency[] = [];
private activeCryptoCurrencyData: Currency[] = [];
private activeFiatCurrencyData: Currency[] = [];
private offersData: OffersData[] = []; private offersData: OffersData[] = [];
private tradesData: TradesData[] = []; private tradesData: TradesData[] = [];
private fiatCurrenciesIndexed: { [code: string]: true } = {}; private fiatCurrenciesIndexed: { [code: string]: true } = {};
@ -32,9 +34,11 @@ class BisqMarketsApi {
}); });
} }
setCurrencyData(cryptoCurrency: Currency[], fiatCurrency: Currency[]) { setCurrencyData(cryptoCurrency: Currency[], fiatCurrency: Currency[], activeCryptoCurrency: Currency[], activeFiatCurrency: Currency[]) {
this.cryptoCurrencyData = cryptoCurrency, this.cryptoCurrencyData = cryptoCurrency,
this.fiatCurrencyData = fiatCurrency; this.fiatCurrencyData = fiatCurrency,
this.activeCryptoCurrencyData = activeCryptoCurrency,
this.activeFiatCurrencyData = activeFiatCurrency;
this.fiatCurrenciesIndexed = {}; this.fiatCurrenciesIndexed = {};
this.allCurrenciesIndexed = {}; this.allCurrenciesIndexed = {};
@ -56,7 +60,7 @@ class BisqMarketsApi {
} }
getCurrencies( getCurrencies(
type: 'crypto' | 'fiat' | 'all' = 'all', type: 'crypto' | 'fiat' | 'active' | 'all' = 'all',
): Currencies { ): Currencies {
let currencies: Currency[]; let currencies: Currency[];
@ -67,6 +71,9 @@ class BisqMarketsApi {
case 'crypto': case 'crypto':
currencies = this.cryptoCurrencyData; currencies = this.cryptoCurrencyData;
break; break;
case 'active':
currencies = this.activeCryptoCurrencyData.concat(this.activeFiatCurrencyData);
break;
case 'all': case 'all':
default: default:
currencies = this.cryptoCurrencyData.concat(this.fiatCurrencyData); currencies = this.cryptoCurrencyData.concat(this.fiatCurrencyData);
@ -136,9 +143,10 @@ class BisqMarketsApi {
getMarkets(): Markets { getMarkets(): Markets {
const allCurrencies = this.getCurrencies(); const allCurrencies = this.getCurrencies();
const activeCurrencies = this.getCurrencies('active');
const markets = {}; const markets = {};
for (const currency of Object.keys(allCurrencies)) { for (const currency of Object.keys(activeCurrencies)) {
if (allCurrencies[currency].code === 'BTC') { if (allCurrencies[currency].code === 'BTC') {
continue; continue;
} }

View File

@ -8,6 +8,8 @@ class Bisq {
private static FOLDER_WATCH_CHANGE_DETECTION_DEBOUNCE = 4000; private static FOLDER_WATCH_CHANGE_DETECTION_DEBOUNCE = 4000;
private static MARKET_JSON_PATH = config.BISQ_MARKETS.DATA_PATH; private static MARKET_JSON_PATH = config.BISQ_MARKETS.DATA_PATH;
private static MARKET_JSON_FILE_PATHS = { private static MARKET_JSON_FILE_PATHS = {
activeCryptoCurrency: '/active_crypto_currency_list.json',
activeFiatCurrency: '/active_fiat_currency_list.json',
cryptoCurrency: '/crypto_currency_list.json', cryptoCurrency: '/crypto_currency_list.json',
fiatCurrency: '/fiat_currency_list.json', fiatCurrency: '/fiat_currency_list.json',
offers: '/offers_statistics.json', offers: '/offers_statistics.json',
@ -66,8 +68,10 @@ class Bisq {
if (cryptoMtime > this.cryptoCurrencyLastMtime || fiatMtime > this.fiatCurrencyLastMtime) { if (cryptoMtime > this.cryptoCurrencyLastMtime || fiatMtime > this.fiatCurrencyLastMtime) {
const cryptoCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.cryptoCurrency); const cryptoCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.cryptoCurrency);
const fiatCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.fiatCurrency); const fiatCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.fiatCurrency);
const activeCryptoCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.activeCryptoCurrency);
const activeFiatCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.activeFiatCurrency);
logger.debug('Updating Bisq Market Currency Data'); logger.debug('Updating Bisq Market Currency Data');
bisqMarket.setCurrencyData(cryptoCurrencyData, fiatCurrencyData); bisqMarket.setCurrencyData(cryptoCurrencyData, fiatCurrencyData, activeCryptoCurrencyData, activeFiatCurrencyData);
if (cryptoMtime > this.cryptoCurrencyLastMtime) { if (cryptoMtime > this.cryptoCurrencyLastMtime) {
this.cryptoCurrencyLastMtime = cryptoMtime; this.cryptoCurrencyLastMtime = cryptoMtime;
} }

66195
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@
], ],
"main": "index.ts", "main": "index.ts",
"scripts": { "scripts": {
"ng": "ng", "ng": "./node_modules/@angular/cli/bin/ng",
"tsc": "./node_modules/typescript/bin/tsc",
"serve": "ng serve --proxy-config proxy.conf.json", "serve": "ng serve --proxy-config proxy.conf.json",
"start": "npm run generate-config && npm run sync-assets-dev && ng serve --proxy-config proxy.conf.json", "start": "npm run generate-config && npm run sync-assets-dev && ng serve --proxy-config proxy.conf.json",
"build": "npm run generate-config && ng build --prod && npm run sync-assets", "build": "npm run generate-config && ng build --prod && npm run sync-assets",
@ -36,16 +37,16 @@
"prerender": "ng run mempool:prerender" "prerender": "ng run mempool:prerender"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "~10.2.2", "@angular/animations": "~10.2.3",
"@angular/common": "~10.2.2", "@angular/common": "~10.2.3",
"@angular/compiler": "~10.2.2", "@angular/compiler": "~10.2.3",
"@angular/core": "~10.2.2", "@angular/core": "~10.2.3",
"@angular/forms": "~10.2.2", "@angular/forms": "~10.2.3",
"@angular/localize": "^10.2.2", "@angular/localize": "^10.2.3",
"@angular/platform-browser": "~10.2.2", "@angular/platform-browser": "~10.2.3",
"@angular/platform-browser-dynamic": "~10.2.2", "@angular/platform-browser-dynamic": "~10.2.3",
"@angular/platform-server": "~10.2.2", "@angular/platform-server": "~10.2.2",
"@angular/router": "~10.2.2", "@angular/router": "~10.2.3",
"@fortawesome/angular-fontawesome": "^0.7.0", "@fortawesome/angular-fontawesome": "^0.7.0",
"@fortawesome/fontawesome-common-types": "^0.2.30", "@fortawesome/fontawesome-common-types": "^0.2.30",
"@fortawesome/fontawesome-svg-core": "^1.2.30", "@fortawesome/fontawesome-svg-core": "^1.2.30",
@ -71,7 +72,7 @@
"@angular/cli": "~10.2.0", "@angular/cli": "~10.2.0",
"@angular/compiler-cli": "~10.2.2", "@angular/compiler-cli": "~10.2.2",
"@angular/language-service": "~10.2.2", "@angular/language-service": "~10.2.2",
"@nguniversal/builders": "^10.0.1", "@nguniversal/builders": "^10.1.0",
"@types/express": "^4.17.0", "@types/express": "^4.17.0",
"@types/jasmine": "~3.3.8", "@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
@ -88,6 +89,6 @@
"protractor": "~7.0.0", "protractor": "~7.0.0",
"ts-node": "~7.0.0", "ts-node": "~7.0.0",
"tslint": "~6.1.0", "tslint": "~6.1.0",
"typescript": "~3.9.7" "typescript": "~4.0.5"
} }
} }