Standalone CLI for testing Open-Audit translation registry blueprints offline.
open-audit-cli lets you test a draft blueprint spec against raw hex event
data before registering it in the production registry. The key guarantee:
A spec that passes
open-audit-cli testuses the exact same validation and builder logic as production registration.
Both the CLI and lib/translator/registry.ts consume the shared
validateBlueprintSpec() and buildBlueprintFromSpec() functions from
lib/translator/blueprint-spec.ts. There is no parallel reimplementation.
--spec file (CLI) |
lib/translator/blueprints/*.ts (registry) |
|
|---|---|---|
| Format | JSON or YAML | TypeScript |
| Type | BlueprintSpec |
TranslationBlueprint |
| Validated by | validateBlueprintSpec() |
TypeScript compiler + same validator |
| Builder | buildBlueprintFromSpec() |
Same function |
| Versioning | validFromLedger field |
VersionedTranslationBlueprint |
Both paths produce an identical TranslationBlueprint object at runtime.
The only difference is that production blueprints are written in TypeScript
directly (for complex matching logic) while spec files are declarative
JSON/YAML (for simpler event patterns and community submissions).
npm run build:cliopen-audit-cli test --hex <raw_hex_data> --spec <path_to_spec>| Flag | Description | Default |
|---|---|---|
-x, --hex |
Raw hex-encoded event data | required |
-s, --spec |
Path to blueprint spec file (.json or .yaml) | required |
-c, --contract |
Stellar contract ID (C...) | test address |
-l, --lang |
Output language: en, es, fr, zh | en |
-t, --topics |
Separate topic hex strings (space-separated) | auto-parsed |
--ledger |
Ledger sequence number | 1000000 |
--verbose |
Enable verbose output | false |
{
"contractId": "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
"contractName": "My Token Contract",
"version": "1.0.0",
"validFromLedger": 0,
"events": [
{
"name": "Transfer",
"template": "{from} sent {amount} to {to}",
"topics": [
{ "index": 0, "includes": "74726e73" }
],
"fields": [
{ "name": "from", "source": "topic", "index": 1, "type": "address" },
{ "name": "to", "source": "topic", "index": 2, "type": "address" },
{ "name": "amount", "source": "data", "type": "amount", "format": "USDC" }
]
}
]
}| Type | Description |
|---|---|
address |
Stellar address, shortened to GABC...1234 |
amount / u128 / i128 |
Numeric amount, formatted with symbol |
string / symbol |
UTF-8 decoded from hex |
hex / bytes |
Truncated hex string |
Run all committed blueprint specs through the shared validator:
npm run validate:blueprintsThis is the same check that runs in CI on every change to
lib/translator/blueprints/. A spec that passes here is guaranteed to use
the same validation and builder logic as production registration.
The following properties are tested by the shared validator and CI:
contractIdstarts withC(valid Stellar contract address format)contractNameis a non-empty stringeventsarray has at least one entry- Every event has
name,template, and at least onefieldsentry - Every field has
name,source(topicordata), and a supportedtype versionis a string if presentvalidFromLedgeris a number if present
The following are designed but not automatically verified by the CLI:
- That
validFromLedgermatches the actual on-chain ledger of a contract upgrade - That topic hex values in
equals/includesmatchers are correctly encoded XDR - That
formatsymbols match the asset symbol registered in the production SAC map - That the human-readable
templatestring is accurate and grammatically correct
Always verify these manually before submitting a blueprint for production registration.