Skip to main content

Crate wasm_neovm

Crate wasm_neovm 

Source
Expand description

wasm-neovm: WebAssembly to NeoVM translator

This crate provides functionality to translate WebAssembly modules into Neo N3 compatible NEF (Neo Executable Format) files.

§Module Organization

§Core Modules

  • core: Core abstractions and shared traits
  • types: Type-safe identifiers and primitive wrappers
  • config: Centralized configuration management

§Translation Modules

  • translator: Core WASM to NeoVM translation logic
  • adapters: Cross-chain compilation adapters (Solana, Move)

§Output Modules

  • manifest: Neo N3 contract manifest generation
  • metadata: NEF metadata extraction and handling
  • nef: NEF file format utilities

§Definition Modules

§Example

use wasm_neovm::{translate_module, write_nef};

let wasm_bytes = std::fs::read("contract.wasm")?;
let translation = translate_module(&wasm_bytes, "MyContract")?;
write_nef(&translation.script, "contract.nef")?;

Re-exports§

pub use adapters::SourceChain;
pub use config::BehaviorConfig;
pub use config::DebugConfig;
pub use config::OutputConfig;
pub use config::TranslationConfig;
pub use core::traits;
pub use logging::LogLevel;
pub use manifest::RenderedManifest;
pub use metadata::extract_nef_metadata;
pub use metadata::NefMetadata;
pub use nef::encode_nef;
pub use nef::encode_nef_with_metadata;
pub use nef::write_nef;
pub use nef::write_nef_with_metadata;
pub use nef::MethodToken;
pub use translator::translate_module;
pub use translator::translate_with_config;
pub use translator::ManifestOverlay;
pub use translator::Translation;
pub use types::BytecodeOffset;
pub use types::ContractName;
pub use types::GlobalIndex;
pub use types::LocalIndex;
pub use types::MemoryOffset;
pub use types::MethodIndex;
pub use types::SyscallDescriptor;
pub use types::WasmValueType;

Modules§

adapters
Chain-specific adapters for cross-chain compilation
api
API consistency layer
config
Centralized configuration management
core
Core abstractions and shared traits
logging
Standardized logging for wasm-neovm
manifest
Contract manifest generation for Neo N3
metadata
NEF metadata extraction and manipulation
nef
NEF (Neo Executable Format) file generation
neo_syscalls
Neo-specific syscall aliases and fingerprint mappings Neo N3 syscall mappings for WASM imports.
numeric
Numeric encoding utilities for NeoVM scripts
opcodes
NeoVM opcode definitions and lookup tables
prelude
Commonly used types and traits
syscalls
NeoVM syscall definitions and lookup functions
translator
Core WASM to NeoVM translation engine
types
Type definitions and newtype wrappers for type-safe identifiers

Macros§

log_adapter
Log an adapter event at debug level
log_codegen
Log a codegen event at debug level
log_manifest
Log a manifest event at info level
log_parse
Log a parsing event at debug level
log_runtime
Log a runtime event at trace level
log_translation
Log a translation event at info level
pgo_record_opcode
Round 90: Macro for recording opcode in PGO histogram
profile_scope
Macro for scoped profiling (only evaluates when feature enabled)
wlog
Standardized logging function

Constants§

VERSION
Version information for the wasm-neovm crate

Functions§

version_info
Get version information as a formatted string