Rc/evm signature (#249)
* feat: allow signing function only for bundled txs * fix: after ppe review * feat: add transaction verification * feat: warp plugins system * chore: removing lodash dep * feat: isEvmSigned verification * chore: useFastCopy fix in tests * feat: evm signature - minor fixes * fix: try-catch for evm sig verification * v1.2.14-beta.5 * fix: await for sig verification * v1.2.14-beta.6 * chore: restore original package version Co-authored-by: asiaziola <ziola.jm@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import { HandlerApi } from './modules/impl/HandlerExecutorFactory';
|
||||
import { InteractionsLoader } from './modules/InteractionsLoader';
|
||||
import { EvalStateResult, StateEvaluator } from './modules/StateEvaluator';
|
||||
import { WarpBuilder } from './WarpBuilder';
|
||||
import { WarpPluginType, WarpPlugin, knownWarpPlugins } from './WarpPlugin';
|
||||
|
||||
export type WarpEnvironment = 'local' | 'testnet' | 'mainnet' | 'custom';
|
||||
|
||||
@@ -31,6 +32,8 @@ export class Warp {
|
||||
readonly migrationTool: MigrationTool;
|
||||
readonly testing: Testing;
|
||||
|
||||
private readonly plugins: Map<WarpPluginType, WarpPlugin<unknown, unknown>> = new Map();
|
||||
|
||||
constructor(
|
||||
readonly arweave: Arweave,
|
||||
readonly levelDb: LevelDbCache<EvalStateResult<unknown>>,
|
||||
@@ -69,4 +72,26 @@ export class Warp {
|
||||
pst(contractTxId: string): PstContract {
|
||||
return new PstContractImpl(contractTxId, this);
|
||||
}
|
||||
|
||||
use(plugin: WarpPlugin<unknown, unknown>): Warp {
|
||||
const pluginType = plugin.type();
|
||||
if (!knownWarpPlugins.some((p) => p == pluginType)) {
|
||||
throw new Error(`Unknown plugin type ${pluginType}.`);
|
||||
}
|
||||
this.plugins.set(pluginType, plugin);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
hasPlugin(type: WarpPluginType): boolean {
|
||||
return this.plugins.has(type);
|
||||
}
|
||||
|
||||
loadPlugin<P, Q>(type: WarpPluginType): WarpPlugin<P, Q> {
|
||||
if (!this.hasPlugin(type)) {
|
||||
throw new Error(`Plugin ${type} not registered.`);
|
||||
}
|
||||
|
||||
return this.plugins.get(type) as WarpPlugin<P, Q>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user