import { WireReader, WireWriter, BoltFFIModule, instantiateBoltFFI, wireStringSize } from "@boltffi/runtime";
import type { Duration, WireCodec, BoltFFIImports, BoltFFIExports } from "@boltffi/runtime";

const EXPECTED_ABI_VERSION = {{ abi_version }};

let _module: BoltFFIModule;
let _exports: BoltFFIExports;
const _callbackImports: Record<string, WebAssembly.ImportValue> = {};

export default async function init(source: BufferSource | Response): Promise<void> {
  _module = await instantiateBoltFFI(source, EXPECTED_ABI_VERSION, { env: _callbackImports });
  _exports = _module.exports;
}
