outlayer 0.1.0

SDK for OutLayer off-chain WASM execution on NEAR
Documentation

OutLayer SDK for WASM components

This crate provides a high-level API for OutLayer off-chain WASM execution on NEAR.

Features

  • Storage: Persistent encrypted storage across executions
  • Environment: Access to execution context (signer, input/output)

Requirements

OutLayer SDK requires wasm32-wasip2 target (WASI Preview 2 / Component Model). WASI Preview 1 (wasm32-wasip1) is NOT supported for storage and RPC features.

Quick Start

use outlayer::{storage, env};

fn main() {
    // Get input from execution request
    let input = env::input();

    // Use persistent storage
    storage::set("counter", b"42").unwrap();
    let value = storage::get("counter").unwrap();

    // Return output
    env::output(b"result");
}

Compile-Time Target Check

This crate will fail to compile if you target wasm32-wasip1:

# Correct - will work:
cargo build --target wasm32-wasip2 --release

# Wrong - will fail to compile:
cargo build --target wasm32-wasip1 --release