From 4d12168761f443f0da165819c548fa51491d887a Mon Sep 17 00:00:00 2001 From: Asia Date: Mon, 26 Feb 2024 12:13:27 +0100 Subject: [PATCH] QuickJs plugin interface changes --- .../modules/impl/HandlerExecutorFactory.ts | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/core/modules/impl/HandlerExecutorFactory.ts b/src/core/modules/impl/HandlerExecutorFactory.ts index f884601c..443e4218 100644 --- a/src/core/modules/impl/HandlerExecutorFactory.ts +++ b/src/core/modules/impl/HandlerExecutorFactory.ts @@ -212,10 +212,7 @@ export class HandlerExecutorFactory implements ExecutorFactory>('quickjs'); return await quickJsPlugin.process({ - contractSource: contractDefinition.src, - evaluationOptions, - swGlobal: swGlobal, - contractDefinition + contractSource: contractDefinition.src }); } else { const contractFunction = new Function(normalizedSource); @@ -361,10 +358,7 @@ export interface VM2PluginInput { export interface QuickJsPluginInput { contractSource: string; - evaluationOptions: EvaluationOptions; - swGlobal: SmartWeaveGlobal; - contractDefinition: ContractDefinition; - wasmMemory?: WebAssembly.Memory; + wasmMemory?: Buffer; } export interface QuickJsOptions { @@ -373,3 +367,22 @@ export interface QuickJsOptions { interruptCycles?: number; timeout?: number; } + +export interface QuickJsPluginMessage { + cron: boolean; + data: string | Buffer; + epoch: number; + from: string; + id: string | undefined; + nonce: number; + owner: string; + signature: string | undefined; + tags: { + [key: string]: string | undefined; + }; + target: string; + timestamp: string; + ['Block-Height']: string; + ['Forwarded-By']: string; + ['Hash-Chain']: string; +}