Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions assets/erc-7730/erc7730-v1.schema.json
Original file line number Diff line number Diff line change
@@ -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",

Expand All @@ -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",
Expand Down Expand Up @@ -53,7 +59,7 @@
"$ref": "#/$context/EIP712"
}
],
"unresolvedProperties": false
"unevaluatedProperties": false
},

"contract": {
Expand Down Expand Up @@ -459,24 +465,35 @@
"$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",

"properties": {
"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"
}
Expand Down Expand Up @@ -602,7 +619,7 @@
}
},
{
"if": { "properties": { "format": { "const": "percentage" } } },
"if": { "properties": { "format": { "const": "unit" } } },
"then": {
"properties": {
"params": { "$ref": "#/$format/unitParameters" }
Expand All @@ -618,7 +635,7 @@
}
}
],
"unresolvedProperties": false
"unevaluatedProperties": false
},
"names": {
"anyOf": [
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions assets/erc-7730/example-erc20.json
Original file line number Diff line number Diff line change
@@ -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)": {
Expand Down
9 changes: 7 additions & 2 deletions assets/erc-7730/example-include.json
Original file line number Diff line number Diff line change
@@ -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" : {
Expand Down Expand Up @@ -29,10 +34,10 @@

"display": {
"formats": {
"approve(address _spender,uint256 _value)": {
"approve(address spender,uint256 value)": {
"fields": [
{
"path": "_value",
"path": "value",
"params" : {
"threshold": "0xFFFFFFFFFFFFFFFFFF"
}
Expand Down
16 changes: 9 additions & 7 deletions assets/erc-7730/example-main.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -32,25 +34,25 @@

"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": {
"tokenPath": "@.to"
}
}
],
"required": ["_to", "_value"],
"required": ["to", "value"],
"excluded": []
}
}
Expand Down
Loading