Parsed, validated representation of an ERC-7730 clear-signing descriptor.
An ERC-7730 descriptor is a JSON document with three top-level sections:
context— the binding constraints: either acontract(deployments + ABI) or aneip712(domain + typed-data schemas) context.metadata— owner, constants, enums, and optional token info.display—formatskeyed by function signature (contract) or primary type (EIP-712), each carrying an ordered list of displayfields.
parse/1 turns the decoded JSON map into a t/0 struct, validating the
structural rules. The original decoded JSON is retained in :raw so that
$.-rooted paths (e.g. $.metadata.constants.tokenAddress) resolve against
the document.
Scope
This first pass keeps the structure faithful to the spec but does not resolve
includes / $ref-to-external-document references — descriptors are expected
to be self-contained (the registry-side resolution of shared ercs/* includes
is out of scope, per Task 74).
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
parse | 1 | Parse and structurally validate a decoded ERC-7730 JSON map. | raw: value |
Summary
Functions
Parse and structurally validate a decoded ERC-7730 JSON map.
Types
@type context() :: {:contract, %{ deployments: [deployment()], abi: term() | nil, address_matcher: String.t() | nil }} | {:eip712, %{ deployments: [deployment()], domain: map() | nil, domain_separator: String.t() | nil, schemas: term() | nil }}
@type deployment() :: %{chain_id: non_neg_integer(), address: <<_::160>>}
Functions
Parse and structurally validate a decoded ERC-7730 JSON map.
Parameters
raw- Decoded JSON map (string keys) of an ERC-7730 descriptor (value)
Returns
Validated descriptor struct, or an error: :missing_context, :invalid_context, :no_deployments, :invalid_address, :missing_display, :invalid_field ({:ok, t()} | {:error, {tag, reason}})
# descripex:contract
%{
params: %{
raw: %{
description: "Decoded JSON map (string keys) of an ERC-7730 descriptor",
kind: :value
}
},
returns: %{
type: "{:ok, t()} | {:error, {tag, reason}}",
description: "Validated descriptor struct, or an error: :missing_context, :invalid_context, :no_deployments, :invalid_address, :missing_display, :invalid_field"
}
}