diff --git a/assets/erc-7730/erc7730-v1.schema.json b/assets/erc-7730/erc7730-v1.schema.json index 598a20540aa..6159ec29363 100644 --- a/assets/erc-7730/erc7730-v1.schema.json +++ b/assets/erc-7730/erc7730-v1.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "description": "ERC7730 Clear Signing Specification Schema. Specification located at https://github.com/LedgerHQ/clear-signing-erc7730-registry/tree/master/specs", @@ -12,6 +12,12 @@ "description": "The schema that the document should conform to. This should be the URL of a version of the clear signing JSON schemas available under https://github.com/LedgerHQ/clear-signing-erc7730-registry/tree/master/specs" }, + "$comment": { + "title": "Schema", + "type": "string", + "description": "An optional comment string that can be used to document the purpose of the file." + }, + "includes": { "title": "External includes", "type": "string", @@ -53,7 +59,7 @@ "$ref": "#/$context/EIP712" } ], - "unresolvedProperties": false + "unevaluatedProperties": false }, "contract": { @@ -459,17 +465,17 @@ "$ref": "#/$format/field" }, { - "$ref": "#/$display/nestedFields" + "$ref": "#/$display/fieldGroup" }, { "$ref": "#/$display/reference" } ] }, - "unresolvedProperties": false + "unevaluatedProperties": false }, - "nestedFields": { - "title": "A single set of field formats, allowing recursivity in the schema", + "fieldGroup": { + "title": "A group of field formats, allowing recursivity in the schema and control over grouping and iteration.", "description": "A set of field formats used to group whole definitions for structures for instance. This allows nesting definitions of formats, but note that support for deep nesting will be device dependent.", "type": "object", @@ -477,6 +483,17 @@ "path": { "$ref": "#/$format/path" }, + "label": { + "title": "Group Label", + "description": "The group label of the field group, that will be displayed to the user in front of the formatted field values.", + "type": "string" + }, + "iteration": { + "title": "Array iteration mode", + "description": "Specifies how iteration over arrays in the group should be handled. Sequential mode displays elements grouped by array, ie arr_0[0] ... arr_0[N] arr_1[0] ... arr_1[M]. Bundled mode displays elements of the arrays grouped by index, ie arr_0[0] arr_1[0] arr_0[1] arr_1[1] ... arr_0[N] arr_1[N]. In bundled mode, all arrays MUST be of the same length.", + "type": "string", + "enum": [ "sequential", "bundled" ] + }, "fields": { "$ref": "#/$display/fields" } @@ -602,7 +619,7 @@ } }, { - "if": { "properties": { "format": { "const": "percentage" } } }, + "if": { "properties": { "format": { "const": "unit" } } }, "then": { "properties": { "params": { "$ref": "#/$format/unitParameters" } @@ -618,7 +635,7 @@ } } ], - "unresolvedProperties": false + "unevaluatedProperties": false }, "names": { "anyOf": [ @@ -868,7 +885,7 @@ "properties": { "base": { "title": "Unit base symbol", - "type": "integer", + "type": "string", "description": "The base symbol of the unit, displayed after the converted value. It can be an SI unit symbol or acceptable dimensionless symbols like % or bps." }, "decimals": { diff --git a/assets/erc-7730/example-erc20.json b/assets/erc-7730/example-erc20.json index b6f560dc8f9..0a59aff98b1 100644 --- a/assets/erc-7730/example-erc20.json +++ b/assets/erc-7730/example-erc20.json @@ -1,4 +1,8 @@ { + "$schema": "./erc7730-v1.schema.json", + + "$comment": "This is an example of ERC-7730 display definition for an ERC-20 token contract, intended as an interface definition to be included in other files.", + "display": { "formats": { "approve(address spender,uint256 value)": { diff --git a/assets/erc-7730/example-include.json b/assets/erc-7730/example-include.json index 928d393153a..58a44c09ee5 100644 --- a/assets/erc-7730/example-include.json +++ b/assets/erc-7730/example-include.json @@ -1,4 +1,9 @@ { + + "$schema": "./erc7730-v1.schema.json", + + "$comment": "This is an example of ERC-7730 display definition that includes another definition file to demonstrate reusability for common interfaces such as ERC-20.", + "context": { "$id": "Example USD", "contract" : { @@ -29,10 +34,10 @@ "display": { "formats": { - "approve(address _spender,uint256 _value)": { + "approve(address spender,uint256 value)": { "fields": [ { - "path": "_value", + "path": "value", "params" : { "threshold": "0xFFFFFFFFFFFFFFFFFF" } diff --git a/assets/erc-7730/example-main.json b/assets/erc-7730/example-main.json index 6fc3c03c272..dfb2d18a654 100644 --- a/assets/erc-7730/example-main.json +++ b/assets/erc-7730/example-main.json @@ -1,5 +1,7 @@ { - "$schema": "https://eips.ethereum.org/assets/eip-7730/erc7730-v1.schema.json", + "$schema": "./erc7730-v1.schema.json", + + "$comment": "This is a simple example of an ERC-7730 display definition.", "context": { "$id": "Example ERC-20", @@ -32,17 +34,17 @@ "display": { "formats": { - "transfer(address _to,uint256 _value)": { + "transfer(address to,uint256 value)": { "intent": "Send", - "interpolatedIntent": "Send {_value} to {_to}", + "interpolatedIntent": "Send {value} to {to}", "fields": [ { - "path": "_to", + "path": "to", "label": "To", - "format": "addressOrName" + "format": "addressName" }, { - "path": "_value", + "path": "value", "label": "Amount", "format": "tokenAmount", "params": { @@ -50,7 +52,7 @@ } } ], - "required": ["_to", "_value"], + "required": ["to", "value"], "excluded": [] } }