A basic project built with 5IVE VM.
- Node.js 18+
- Local monorepo CLI build:
node ../five-cli/dist/index.js --help
# Compile the project
npm run build
# Compile with optimizations
npm run build:release
# Compile with debug information
npm run build:debug5IVE CLI automatically discovers test functions from your .v files:
# Run all tests
npm test
# Run with watch mode for continuous testing
node ../five-cli/dist/index.js test --watch
# Run specific tests by filter
node ../five-cli/dist/index.js test --filter "test_add"
# Run with verbose output
node ../five-cli/dist/index.js test --verbose
# Run with JSON output for CI/CD
node ../five-cli/dist/index.js test --format jsonTest functions in your .v files use the pub test_* naming convention and include @test-params comments:
// @test-params 10 20 30
pub test_add(a: u64, b: u64) -> u64 {
return a + b;
}
// @test-params 5 2 10
pub test_multiply(a: u64, b: u64) -> u64 {
return a * b;
}The @test-params comment specifies the parameters to pass and expected result. The test runner will:
- Discover test functions automatically
- Compile the source file
- Execute with the specified parameters
- Validate the result matches
# Watch for changes and auto-compile
npm run watch# Deploy to devnet
npm run deploysrc/- 5IVE VM source files (.v)tests/- Test files (.v files with test_* functions)build/- Compiled bytecodedocs/- Documentationfive.toml- Project configurationSCENARIOS.md- Canonical local/on-chain run paths
If your project uses multiple modules with use or import statements, 5IVE CLI automatically handles:
# Automatic discovery of imported modules
node ../five-cli/dist/index.js compile src/main.v --auto-discover
# Or use the build command which respects five.toml configuration
node ../five-cli/dist/index.js build --project .- Supported account serializers:
raw,borsh,bincode. - Default account serializer is
raw. - Precedence is: parameter
@serializer(...)override > account type@serializer(...)> interface/program default. anchoris not a serializer keyword.- For typed account metadata, use
acct.ctx.*(for exampleacct.ctx.key), notacct.key. - For external state reads, prefer namespaced account types such as
spl_token::Mintandspl_token::TokenAccountwith explicit@serializer("raw")where needed.
MIT