Skip to content

[FEATURE] Export Noir contract globals in artifacts #21761

@shiqicao

Description

@shiqicao

Problem Statement

Global constants defined in a Noir contract are not included in the generated artifact. This forces consumers (e.g. TypeScript clients) to manually duplicate those values, which can silently drift out of sync with the contract.

Proposed Solution

Export Noir contract globals in the artifact so that consumers can read them directly at runtime, without having to hardcode the values themselves.

Example Use Case

// Instead of duplicating:
const PURPOSE_AUTHORIZE_AZTEC_TRANSACTION = "Authorize Aztec Transaction";

// Read directly from the artifact:
const { PURPOSE_AUTHORIZE_AZTEC_TRANSACTION } = MyContractArtifact.globals;

Alternative Solutions

Manually keeping the TypeScript constants in sync with the Noir globals — error-prone and requires discipline across every change.

Additional Context

This came up when building an account contract that defines purpose strings as Noir globals. The TypeScript signing code needs the same strings to construct EIP-712 typed data, but currently has no way to obtain them from the artifact.

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