Skip to content

Commit

Permalink
QuickJs plugin interface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asiaziola committed Feb 26, 2024
1 parent d36daf7 commit 4d12168
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/core/modules/impl/HandlerExecutorFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ export class HandlerExecutorFactory implements ExecutorFactory<HandlerApi<unknow
} else if (warp.hasPlugin('quickjs')) {
const quickJsPlugin = warp.loadPlugin<QuickJsPluginInput, HandlerApi<State>>('quickjs');
return await quickJsPlugin.process({
contractSource: contractDefinition.src,
evaluationOptions,
swGlobal: swGlobal,
contractDefinition
contractSource: contractDefinition.src
});
} else {
const contractFunction = new Function(normalizedSource);
Expand Down Expand Up @@ -361,10 +358,7 @@ export interface VM2PluginInput {

export interface QuickJsPluginInput {
contractSource: string;
evaluationOptions: EvaluationOptions;
swGlobal: SmartWeaveGlobal;
contractDefinition: ContractDefinition<unknown>;
wasmMemory?: WebAssembly.Memory;
wasmMemory?: Buffer;
}

export interface QuickJsOptions {
Expand All @@ -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;
}

0 comments on commit 4d12168

Please sign in to comment.