Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed May 8, 2024
1 parent fabe91c commit 4cf3419
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion www/apps/api/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions www/apps/frontend/proxy.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@
"/events": {
"target": "http://localhost:18101",
"secure": false
},
"/rpc": {
"target": "http://localhost:11101",
"secure": false
}
}
5 changes: 3 additions & 2 deletions www/apps/frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
9 changes: 5 additions & 4 deletions www/libs/util/config/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand Down
13 changes: 2 additions & 11 deletions www/libs/util/services/watcher/src/lib/watcher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4cf3419

Please sign in to comment.