From 4cf3419d771040bb80ce960b5153327743a39a43 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 8 May 2024 13:33:10 +0200 Subject: [PATCH] stash --- www/apps/api/src/app/app.service.ts | 2 +- www/apps/api/src/main.ts | 2 +- www/apps/frontend/proxy.conf.json | 4 ---- www/apps/frontend/src/app/app.component.ts | 5 +++-- .../query-global-state.component.ts | 2 +- .../state-root-hash/state-root-hash.component.ts | 2 +- www/libs/util/config/src/config.ts | 9 +++++---- .../services/watcher/src/lib/watcher.service.ts | 13 ++----------- 8 files changed, 14 insertions(+), 25 deletions(-) diff --git a/www/apps/api/src/app/app.service.ts b/www/apps/api/src/app/app.service.ts index 9212057..b11ca9b 100644 --- a/www/apps/api/src/app/app.service.ts +++ b/www/apps/api/src/app/app.service.ts @@ -105,7 +105,7 @@ export class AppService { return; } if (speculative) { - console.log('speculative', speculative); + console.debug('speculative', speculative); return (await sdk.speculative_exec(signedDeploy)).toJson(); } return (await sdk.put_deploy(signedDeploy)).toJson(); diff --git a/www/apps/api/src/main.ts b/www/apps/api/src/main.ts index ddf2a2b..07f283c 100644 --- a/www/apps/api/src/main.ts +++ b/www/apps/api/src/main.ts @@ -19,7 +19,7 @@ async function bootstrap() { app.setGlobalPrefix(globalPrefix); app.use(json({ limit: '50mb' })); app.use(urlencoded({ extended: true, limit: '50mb' })); - app.use('/api/events/*', function (req, res, next) { + app.use('/events/*', function (req, res, next) { proxy.createProxyMiddleware({ target: resolveApiUrl(req), changeOrigin: true, diff --git a/www/apps/frontend/proxy.conf.json b/www/apps/frontend/proxy.conf.json index 2e378a5..9a639c8 100644 --- a/www/apps/frontend/proxy.conf.json +++ b/www/apps/frontend/proxy.conf.json @@ -6,9 +6,5 @@ "/events": { "target": "http://localhost:18101", "secure": false - }, - "/rpc": { - "target": "http://localhost:11101", - "secure": false } } \ No newline at end of file diff --git a/www/apps/frontend/src/app/app.component.ts b/www/apps/frontend/src/app/app.component.ts index d4a711c..c6feb9e 100644 --- a/www/apps/frontend/src/app/app.component.ts +++ b/www/apps/frontend/src/app/app.component.ts @@ -13,6 +13,7 @@ import { RouterModule } from '@angular/router'; import { RouteurHubService } from '@casper-util/routeur-hub'; import { StorageService } from '@casper-util/storage'; import { DeployerService } from '@casper-data/data-access-deployer'; +import { motesToCSPR } from 'casper-sdk'; declare global { interface Window { @@ -170,10 +171,10 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit { this.activePublicKey && (this.accountInformationSubscription = this.usersService.getBalanceOfByPublicKey(this.activePublicKey, this.apiUrl) .subscribe( (purse => { - if (JSON.parse(purse)!.name) { + if (JSON.parse(purse)?.name) { return; } - this.balance = purse; + this.balance = motesToCSPR(purse); this.changeDetectorRef.markForCheck(); this.accountInformationSubscription.unsubscribe(); }) diff --git a/www/libs/feature/deployer/src/lib/query-global-state/query-global-state.component.ts b/www/libs/feature/deployer/src/lib/query-global-state/query-global-state.component.ts index 634107f..b91b801 100644 --- a/www/libs/feature/deployer/src/lib/query-global-state/query-global-state.component.ts +++ b/www/libs/feature/deployer/src/lib/query-global-state/query-global-state.component.ts @@ -67,7 +67,7 @@ export class QueryGlobalStateComponent implements AfterViewInit, OnDestroy { this.onKeyChange(); } // if (!state.path && !state.stateRootHash) { - // console.log(state); + // console.debug(state); // this.pathElt.nativeElement.value = ""; // this.getBlockState(); // } diff --git a/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts b/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts index 82f6948..9c444e9 100644 --- a/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts +++ b/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts @@ -41,7 +41,7 @@ export class StateRootHashComponent implements OnDestroy, AfterViewInit { this.window = this.document.defaultView; this.defaults = [ this.config['default_node_localhost'], - this.config['default_node_docker'], + this.config['default_node_launcher'], this.config['default_node_testnet'], this.config['default_node_integration'], this.config['default_node_mainnet'], diff --git a/www/libs/util/config/src/config.ts b/www/libs/util/config/src/config.ts index 5456c3a..436e036 100644 --- a/www/libs/util/config/src/config.ts +++ b/www/libs/util/config/src/config.ts @@ -6,11 +6,11 @@ const sse_port = '9999'; const rpc_port_localhost = '11101'; const protocol = window.location.protocol; const currentPort = window?.location?.port || (protocol === "https:" ? "443" : "80"); -const sse_port_localhost = currentPort || '4200'; +const sse_port_localhost = currentPort || '18101'; const localhost = "http://localhost"; -const dockerhost = "http://172.17.0.1"; +const launcherhost = localhost; const default_node_localhost = [localhost, rpc_port_localhost].join(':'); -const default_node_docker = [dockerhost, rpc_port_localhost].join(':'); +const default_node_launcher = [launcherhost, rpc_port].join(':'); const default_node_testnet = "https://rpc.testnet.casperlabs.io"; const default_node_integration = "https://rpc.integration.casperlabs.io"; const default_node_mainnet = "https://rpc.mainnet.casperlabs.io"; @@ -20,11 +20,12 @@ export const config: EnvironmentConfig = { api_prefix: "/api/", rpc_port, sse_port, + sse_port_localhost, events_main_suffix, eventsUrl_localhost: [localhost, sse_port_localhost].join(':'), eventsUrl_default: events_main_suffix, default_node_localhost, - default_node_docker, + default_node_launcher, default_node_testnet, default_node_integration, default_node_mainnet, diff --git a/www/libs/util/services/watcher/src/lib/watcher.service.ts b/www/libs/util/services/watcher/src/lib/watcher.service.ts index e6aa9f8..a2aeba1 100644 --- a/www/libs/util/services/watcher/src/lib/watcher.service.ts +++ b/www/libs/util/services/watcher/src/lib/watcher.service.ts @@ -21,17 +21,8 @@ export class WatcherService { async watchDeploy(deployHash: string, apiUrl?: string) { const config = this.config; apiUrl = apiUrl?.replace(config['rpc_port'], config['sse_port']); - let eventsUrl = apiUrl?.includes(config['localhost']) ? config['eventsUrl_localhost'] : ''; - eventsUrl += apiUrl?.includes(config['localhost']) ? - config['events_main_suffix'] : - [ - config['api_prefix'].slice(0, -1), - config['events_main_suffix'], - '?', - this.api_url, - '=', apiUrl, - ].join(''); - + const eventsUrl = config['eventsUrl_localhost'] + config['events_main_suffix']; + console.debug(eventsUrl); const watcher = this.sdk.watchDeploy(eventsUrl || config['eventsUrl_default']); try {