@@ -13,6 +13,7 @@ enum DefinitionType {
1313 ETHEREUM_NETWORK = 0 ;
1414 ETHEREUM_TOKEN = 1 ;
1515 SOLANA_TOKEN = 2 ;
16+ ETHEREUM_ERC7730_DISPLAY_FORMAT = 3 ;
1617}
1718
1819// ****** CROSS-PARSEABILITY NOTE ******
@@ -23,9 +24,13 @@ enum DefinitionType {
2324//
2425// To achieve that, we vary the wire types of the fields in order:
2526//
26- // * EthereumNetworkInfo: varint, length-delimited, ...
27+ // * EthereumNetworkInfo: varint, length-delimited, varint, ...
2728// * EthereumTokenInfo: length-delimited, varint, ...
2829// * SolanaTokenInfo: length-delimited, length-delimited, ...
30+ // * EthereumERC7730DisplayFormat: varint, length-delimited, length-delimited, ...
31+
32+
33+ // ****** ETHEREUM_NETWORK ******
2934
3035/**
3136 * Ethereum network definition.
@@ -38,6 +43,9 @@ message EthereumNetworkInfo {
3843 required string name = 4 ;
3944}
4045
46+
47+ // ****** ETHEREUM_TOKEN ******
48+
4149/**
4250 * Ethereum token definition.
4351 * @embed
@@ -50,6 +58,9 @@ message EthereumTokenInfo {
5058 required string name = 5 ;
5159}
5260
61+
62+ // ****** SOLANA_TOKEN ******
63+
5364/**
5465 * Solana token definition.
5566 * @embed
@@ -59,3 +70,101 @@ message SolanaTokenInfo {
5970 required string symbol = 2 ;
6071 required string name = 3 ;
6172}
73+
74+
75+ // ****** ETHEREUM_ERC7730_DISPLAY_FORMAT ******
76+
77+ /**
78+ * Solidity types.
79+ * @embed
80+ */
81+ enum EthereumABIType {
82+ ABI_ADDRESS = 0 ;
83+ ABI_BOOL = 1 ;
84+ ABI_BYTES = 2 ;
85+ ABI_BYTES4 = 3 ;
86+ ABI_BYTES8 = 4 ;
87+ ABI_BYTES32 = 5 ;
88+ ABI_STRING = 6 ;
89+ ABI_UINT8 = 7 ;
90+ ABI_UINT16 = 8 ;
91+ ABI_UINT24 = 9 ;
92+ ABI_UINT32 = 10 ;
93+ ABI_UINT64 = 11 ;
94+ ABI_UINT128 = 12 ;
95+ ABI_UINT160 = 13 ;
96+ ABI_UINT256 = 14 ;
97+ ABI_INT64 = 15 ;
98+ }
99+
100+ /**
101+ * Solidity struct / tuple.
102+ * @embed
103+ */
104+ message EthereumABIStruct {
105+ repeated EthereumABIType fields = 1 ; // struct member types (leaf only)
106+ required bool is_dynamic = 2 ;
107+ }
108+
109+ /**
110+ * Ethereum ERC-20 function parameter.
111+ * @embed
112+ */
113+ message EthereumERC20ABIValue {
114+ // Exactly one of the following should be set:
115+ optional EthereumABIType atomic = 1 ; // Atomic(parser)
116+ optional EthereumABIType dynamic = 2 ; // Dynamic(parser)
117+ optional EthereumABIStruct struct = 3 ; // Struct(fields, is_dynamic)
118+ optional EthereumABIType atomic_array = 4 ; // Array(Atomic(type))
119+ optional EthereumABIType dynamic_array = 5 ; // Array(Dynamic(type))
120+ optional EthereumABIStruct struct_array = 6 ; // Array(Struct(...))
121+ }
122+
123+ /**
124+ * All available ERC-7730 field formatters.
125+ * @embed
126+ */
127+ enum EthereumERC7730FieldFormatterType {
128+ FORMATTER_ADDRESS_NAME = 0 ;
129+ FORMATTER_AMOUNT = 1 ;
130+ FORMATTER_TOKEN_AMOUNT = 2 ;
131+ FORMATTER_UNIT = 3 ;
132+ }
133+
134+ /**
135+ * Definition of a single field according to ERC-7730.
136+ * @embed
137+ */
138+ message EthereumERC7730Field {
139+ // Path: either a ContainerPath or index tuple — mutually exclusive
140+ optional uint32 container_path = 1 ; // ContainerPath: From=1, Value=2, To=3, ChainId=4 - needs to match `ContainerPath` in `clear_signing.py`
141+ repeated uint32 path = 2 ; // eg. (0,) = [0], (1, 2) = [1, 2], etc.
142+
143+ // User-readable label
144+ required string label = 3 ;
145+
146+ required EthereumERC7730FieldFormatterType formatter = 4 ;
147+
148+ // TokenAmountFormatter params
149+ optional uint32 token_container_path = 6 ; // if token_path is a ContainerPath
150+ repeated uint32 token_path = 5 ; // token_path if it is a tuple
151+ optional bytes threshold = 7 ; // 32-byte big-endian threshold
152+
153+ // UnitFormatter params
154+ optional uint32 decimals = 8 ;
155+ optional string base = 9 ;
156+ optional bool prefix = 10 ;
157+ }
158+
159+ /**
160+ * Ethereum ERC-7730 display format - corresponding to `DisplayFormat` in `clear_signing.py`.
161+ * @embed
162+ */
163+ message EthereumERC7730DisplayFormat {
164+ required uint64 chain_id = 1 ;
165+ required bytes address = 2 ;
166+ required bytes func_sig = 3 ;
167+ required string intent = 4 ;
168+ repeated EthereumERC20ABIValue parameter_definitions = 5 ;
169+ repeated EthereumERC7730Field field_definitions = 6 ;
170+ }
0 commit comments