diff --git a/lnbits/core/wasm_ext/wasm/component.py b/lnbits/core/wasm_ext/wasm/component.py index 9c1f7ffd6..5e712c259 100644 --- a/lnbits/core/wasm_ext/wasm/component.py +++ b/lnbits/core/wasm_ext/wasm/component.py @@ -3,6 +3,8 @@ from __future__ import annotations from functools import lru_cache from typing import Any +from wasmtime import Config, Engine + from .loader import WasmExtension @@ -12,14 +14,6 @@ def warm_wasm_extension(extension: WasmExtension) -> None: @lru_cache(maxsize=1) def _wasm_engine() -> Any: - try: - from wasmtime import Config, Engine - except ImportError as exc: - raise RuntimeError( - "WASM extension runtime is not installed. Install the 'wasmtime' " - "Python package to run WASM extensions." - ) from exc - config = Config() config.wasm_component_model = True return Engine(config) diff --git a/lnbits/core/wasm_ext/wasm/host.py b/lnbits/core/wasm_ext/wasm/host.py index fd9e3e5ba..e89779a70 100644 --- a/lnbits/core/wasm_ext/wasm/host.py +++ b/lnbits/core/wasm_ext/wasm/host.py @@ -5,6 +5,8 @@ import re from collections.abc import Mapping from typing import Any +from wasmtime import component + from ..api.models import EmptyRequest from ..api.registry import list_extension_api_methods from ..api.runtime import ExtensionAPIHost @@ -73,7 +75,6 @@ def _component_payload_to_dict(value: Any) -> dict[str, Any]: def _dict_to_component_record(value: Mapping[str, Any]) -> Any: - from wasmtime import component record = component.Record() for key, item in value.items():