From 9e9b755290f234ec7b0a404feca01e6487034955 Mon Sep 17 00:00:00 2001 From: Emmo00 Date: Tue, 20 Jan 2026 13:50:08 +0100 Subject: [PATCH 1/2] refactor: update configuration in README to include prune_sync module and correct streamId format --- README.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6ad68be..a04dea3 100644 --- a/README.md +++ b/README.md @@ -71,20 +71,25 @@ Both systems use a config-driven approach where modules are loaded dynamically f ```json { - "modules": [ - "core/arweave", - "core/prover", - "core/streamr", - "core/is_on", - "core/prune_sync" - ], - "uiModules": { - "streamr": "core/streamr/ui" - }, - "streamr": { - "streamId": ["0x.../m3tering/test"], - "cronSchedule": "0 * * * *" - } + "modules": [ + "core/arweave", + "core/prover", + "core/streamr", + "core/is_on", + "core/prune_sync" + ], + "uiModules": { + "streamr": "core/streamr/ui" + }, + "streamr": { + "streamId": [ + "0x567853282663b601bfdb9203819b1fbb3fe18926/m3tering/test" + ], + "cronSchedule": "0 * * * *" + }, + "prune_sync": { + "cronSchedule": "0 * * * *" + } } ``` From 9afdc7730a4e64cca5ef716fa9014f940f746112 Mon Sep 17 00:00:00 2001 From: Emmo00 Date: Fri, 23 Jan 2026 15:22:24 +0100 Subject: [PATCH 2/2] refactor: implement retry logic for Streamr stream retrieval and enhance code formatting --- src/lib/core/streamr/index.ts | 11 +++++++++-- src/lib/utils.ts | 22 ++++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/lib/core/streamr/index.ts b/src/lib/core/streamr/index.ts index 90b72fd..6bf7b42 100644 --- a/src/lib/core/streamr/index.ts +++ b/src/lib/core/streamr/index.ts @@ -53,11 +53,18 @@ export default class implements Hooks { }); try { - const stream = await streamrClient.getStream(STREAMR_STREAM_ID!); + const stream = await retry( + () => streamrClient.getStream(STREAMR_STREAM_ID!), + 3, + 2000 + ); + await new Promise((resolve) => setTimeout(resolve, 2000)); + const batchPayload = buildBatchPayload(pendingTransactions); - await stream.publish(batchPayload); + + await new Promise((resolve) => setTimeout(resolve, 2000)); } catch (error) { console.error(`Failed to publish to Streamr: ${(error as Error).message}`); throw error; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index e3bfdcc..3835826 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,12 +1,24 @@ import fs from "fs"; import path from "path"; import { createPublicKey, verify } from "crypto"; -import type { TransactionRecord, BatchTransactionPayload, Hooks, AppConfig, UIHooks, UIAppIcon, UIAppWindow, UIAction } from "../types"; +import type { + TransactionRecord, + BatchTransactionPayload, + Hooks, + AppConfig, + UIHooks, + UIAppIcon, + UIAppWindow, + UIAction, +} from "../types"; const extensions: Hooks[] = []; const uiExtensions: Map = new Map(); export const defaultConfigurations: AppConfig = { modules: ["core/arweave", "core/prover", "core/streamr", "core/is_on", "core/prune_sync"], + uiModules: { + streamr: "core/streamr/ui", + }, streamr: { streamId: ["0x567853282663b601bfdb9203819b1fbb3fe18926/m3tering/test"], cronSchedule: "0 * * * *", @@ -21,7 +33,7 @@ export function loadConfigurations(configPath: string = "console.config.json"): const config: AppConfig = JSON.parse(fs.readFileSync(configPath, "utf-8")); return config; } catch (error) { - console.warn(`Could not load configuration from ${configPath}, using default configurations.` ); + console.warn(`Could not load configuration from ${configPath}, using default configurations.`); return defaultConfigurations; } } @@ -63,7 +75,9 @@ export async function runHook(hook: K, ...args: Parameter * Load UI extensions from configuration file * Looks for 'uiModules' key in config, which maps module IDs to their paths */ -export async function loadUIExtensionsFromConfig(configPath: string = "console.config.json"): Promise> { +export async function loadUIExtensionsFromConfig( + configPath: string = "console.config.json", +): Promise> { const config = loadConfigurations(configPath) as AppConfig & { uiModules?: Record }; if (!config.uiModules) { @@ -132,7 +146,7 @@ export function getUIExtension(moduleId: string): UIHooks | undefined { */ export async function invokeUIAction( moduleId: string, - actionId: string + actionId: string, ): Promise<{ success: boolean; message?: string; data?: any }> { const ext = uiExtensions.get(moduleId); if (!ext) {