Skip to content

Commit 38d5c48

Browse files
authored
Sending multiple zkapps (#775)
1 parent 45ecf1a commit 38d5c48

File tree

15 files changed

+27
-1312
lines changed

15 files changed

+27
-1312
lines changed

frontend/src/app/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class AppService {
3232
.pipe(
3333
map((data: NodeDetailsResponse) => ({
3434
status: this.getStatus(data),
35-
blockHeight: data.transition_frontier.best_tip.height,
35+
blockHeight: data.transition_frontier.best_tip?.height,
3636
blockTime: data.transition_frontier.sync.time,
3737
peers: data.peers.filter(p => p.connection_status === 'Connected').length,
3838
download: 0,

frontend/src/app/features/benchmarks/wallets/benchmarks-wallets-zk.service.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { BehaviorSubject, filter, map, Observable, switchMap } from 'rxjs';
2+
import { BehaviorSubject, catchError, filter, forkJoin, map, Observable, of, switchMap } from 'rxjs';
33
import { BenchmarksZkapp } from '@shared/types/benchmarks/transactions/benchmarks-zkapp.type';
44
import { fromPromise } from 'rxjs/internal/observable/innerFrom';
55
import { CONFIG } from '@shared/constants/config';
@@ -24,17 +24,29 @@ export class BenchmarksWalletsZkService {
2424
return this.o1jsInterface.pipe(
2525
filter(Boolean),
2626
switchMap((o1js: any) => {
27-
// return fromPromise(o1js.deployZkApp(CONFIG.globalConfig?.graphQL, zkApps[0], this.updates));
28-
return fromPromise(o1js.updateZkApp(CONFIG.globalConfig?.graphQL, zkApps[0], this.updates));
27+
const executeSequentially = async (): Promise<any[]> => {
28+
const results: any[] = [];
29+
for (const zkApp of zkApps) {
30+
const response = await o1js.updateZkApp(CONFIG.globalConfig?.graphQL, zkApp, this.updates);
31+
results.push(response);
32+
}
33+
return results;
34+
};
35+
36+
return fromPromise(executeSequentially());
2937
}),
30-
map((response: any) => {
31-
if (response.errors[0]) {
32-
let error = new Error(response.errors[0]);
33-
error.name = response.status;
38+
map((responses: any[]) => {
39+
const errors = responses.filter(response => response.errors && response.errors[0]);
40+
if (errors.length > 0) {
41+
let error = new Error(errors[0].errors[0]);
42+
error.name = errors[0].status;
3443
return { error, zkApps };
3544
}
3645
return { zkApps };
3746
}),
47+
catchError((error: Error) => {
48+
return of({ error, zkApps });
49+
}),
3850
);
3951
}
4052

frontend/src/app/features/benchmarks/wallets/benchmarks-wallets-zkapp-toolbar/benchmarks-wallets-zkapp-toolbar.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
</div>
4242
</button>
4343
<div class="tertiary text-italic ml-10" *ngIf="updates$ | async as updates">
44-
{{ updates.step }} <span class="secondary">{{ updates.duration }}<span *ngIf="updates.duration">s</span></span>
44+
<ng-container *ngIf="updates.step">
45+
{{ updates.step }} <span class="secondary">{{ updates.duration }}<span
46+
*ngIf="updates.duration">s</span></span>
47+
</ng-container>
4548
</div>
4649
</form>
4750
</div>

frontend/src/app/features/benchmarks/wallets/benchmarks-wallets.reducer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ export function reducer(state: BenchmarksWalletsState = initialState, action: Be
227227

228228
case BENCHMARKS_WALLETS_GET_ALL_TXS_SUCCESS: {
229229
const allTxs = [...action.payload.mempoolTxs, ...action.payload.includedTxs];
230-
console.log(allTxs);
231230
return {
232231
...state,
233232
wallets: state.wallets.map((w: BenchmarksWallet) => {

frontend/src/assets/o1js/o1jsWrapper.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit a371c609e65ed37d7870eb23d129e101108fa1d8

frontend/src/assets/webnode/pkg/openmina_node_web.d.ts

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)