Skip to content
Agentmart
Submit a tool

mvx-scenario-migration

Migrate legacy .scen.json scenario tests to Rust blackbox tests using `sc-meta scen-blackbox`.

Skill by multiversx

IndexedMIT★ 12
Write a review

Chalk Labs

Need help deploying mvx-scenario-migration?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/multiversx-mvx-scenario-migration

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Migrate legacy .scen.json scenario tests to Rust blackbox tests using `sc-meta scen-blackbox`. Use when a MultiversX smart contract project has existing scenario JSON files that need to be converted to the modern typed Rust test format.

Use cases: documents, testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mvx-scenario-migration

What's inside

Skill name
mvx-scenario-migration
Description
Migrate legacy .scen.json scenario tests to Rust blackbox tests using `sc-meta scen-blackbox`. Use when a MultiversX smart contract project has existing scenario JSON files that need to be converted to the modern typed Rust test format.
License
MIT
Instructions
116 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Migrating Scenario JSON Tests to Rust Blackbox Tests

Use `sc-meta scen-blackbox` to auto-generate Rust blackbox tests from existing `.scen.json` scenario files. The generated code serves as a starting point that must be reviewed and refined before committing.

## Running the Generator

```bash
sc-meta scen-blackbox
```

This reads all `.scen.json` files in the contract's `scenarios/` directory and produces a Rust test file.

## Generated Code Structure

The generator produces a Rust file with this structure:

```rust
use multiversx_sc_scenario::imports::*;

use my_contract::*;

const CODE_PATH: MxscPath = MxscPath::new("output/my-contract.mxsc.json");
const SOME_ADDRESS: TestAddress = TestAddress::new("some-address");
const SOME_SC: TestSCAddress = TestSCAddress::new("some-sc");
const MY_TOKEN: TestTokenId = TestTokenId::new("MYTOKEN-123456");

fn world() -> ScenarioWorld { ... }

#[test]
fn my_scenario_scen() {
    let mut world = world();
    my_scenario_scen_steps(&mut world);
}

pub fn my_scenario_scen_steps(world: &mut ScenarioWorld) {
    // Accounts are set up inline; contracts with pre-existing code skip deploy tx
    world.account(SOME_ADDRESS).nonce(0u64).balance(1_000u64);
    world.account(SOME_SC).nonce(0u64).balance(0u64).code(CODE_PATH);

    world
        .tx()
        .id("my-tx")
        .from(SOME_ADDRESS)
        .to(SOME_SC)
        .typed(my_contract_proxy::MyContractProxy)
        .my_endpoint(arg1, arg2)
        .payment(Payment::try_new(TestTokenId::EGLD_000000, 0, 1_000u64).unwrap())
        // Generator placeholder – replace with a typed value, e.g.:
        // .returns(ExpectValue(42u64))
        .run();
}
```

## Key Observations

- Each scenario file produces **one `*_scen()` test** and one **`pub fn *_scen_steps()`** function. This separation allows hand-written tests to **compose generated step functions** for more complex scenarios.
- Accounts with pre-loaded code (i.e., not deployed by the test) are set up via `world.account(...).code(CODE_PATH)` directly, skipping a deploy transaction.
- All token constants use `TestTokenId`.
- Payments use `Payment::try_new(token_id, nonce, amount).unwrap()`.
- When the generator cannot infer the return type it emits `ScenarioValueRaw` as a placeholder. **Always replace these with properly typed Rust values** before committing the test.
- Transaction IDs exactly mirror the IDs in the `.scen.json` file; empty IDs (`""`) are allowed.

## Reusing Auto-Generated Steps in Hand-Written Tests

```rust
#[test]
fn complex_scenario() {
    let mut world = world();
    // Reuse generated setup
    generated::fund_egld_scen_steps(&mut world);
    // Then add more steps
    world.tx()...run();
}
```

## Required Post-Generation Cleanup

### Replace `ScenarioValueRaw` Placeholders

`ScenarioValueRaw` is emitted by the auto-generator when it cannot infer the correct Rust return type. It is a **placeholder** that must be replaced before the test is considered complete:

```rust
// ❌ Generator placeholder – needs replacement
// .returns(ExpectValue(ScenarioValueRaw::new("nested:str:EGLD-000000|u64:0|biguint:1000")))

// ✅ After replacement – use a typed value
.returns(ExpectValue(Payment::try_new(TOKEN_ID, 0, 1000u32).unwrap()))

// ✅ Or use a query-based assertion instead
let deposit = world
    .query()
    .to(SC_ADDRESS)
    .typed(my_proxy::MyProxy)
    .get_deposit(&key)
    .returns(ReturnsResultUnmanaged)
    .run();
assert_eq!(deposit.amount, 1000u64);
```

## Auto-Generator Conventions Reference

When reading or writing generated files, these conventions apply:

| Element | Convention |
|---|---|
| Token type | `TestTokenId` |
| Per-test function | `fn {name}_scen()` → calls `{name}_scen_steps()` |
| Steps function | `pub fn {name}_scen_steps(world: &mut ScenarioWorld)` |
| Account setup | `world.account(ADDR).nonce(0u64).balance(100u64)` |
| Payment | `Payment::try_new(TOKEN, nonce, amount).unwrap()` |
| Expected return value | `ExpectValue(ScenarioValueRaw::new(...))` – **placeholder, must be replaced** |
| Error expectation | `.with_result(ExpectError(4, "message"))` |
| Transaction ID | mirrors `.scen.json` step `"id"` field verbatim (may be `""`) |
| Pre-existing SC | `world.account(SC_ADDRESS).nonce(0u64).code(CODE_PATH)` – no deploy tx |

From multiversx/mx-ai-skills, MIT.

More from multiversx/mx-ai-skills

Signals

Stars
12
Forks
4
Open issues
0
Last commit (this folder)
Jul 2, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from multiversx

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get mvx-scenario-migration running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying mvx-scenario-migration?

CallGet help
Cite this page

mvx-scenario-migration skill. Agent Mart. https://agentmart.dev/skills/multiversx-mvx-scenario-migration (last updated 2026-10-24)