Skip to content

[Enhancement] Support multiple simultaneous MockToken registrations via with_tokens() builder method #779

Description

@ekelemepraise-code

Summary

Setting up several tokens in a fixture requires repeated .with_token() calls:

let env = MockEnv::builder()
    .with_token("USDC", 6)
    .with_token("EURC", 6)
    .with_token("BTC",  8)
    .with_token("ETH",  18)
    .build();

A bulk registration method would reduce noise in fixture setup code.

Proposed API

let env = MockEnv::builder()
    .with_tokens([
        ("USDC", 6),
        ("EURC", 6),
        ("BTC",  8),
        ("ETH",  18),
    ])
    .build();

Or using a typed enum for well-known assets:

.with_tokens([WellKnownAsset::USDC, WellKnownAsset::EURC])

Acceptance Criteria

  • with_tokens() accepts any IntoIterator<Item = (&str, u32)>
  • All tokens accessible via env.token("USDC") after build
  • WellKnownAsset enum added with USDC, EURC, XLM variants (optional, feature-gated)
  • Existing with_token() unchanged

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions