mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-09 17:10:17 +00:00
35 lines
965 B
Mako
35 lines
965 B
Mako
<%
|
|
BKSL = "\\"
|
|
|
|
networks = list(supported_on("trezor1", eth))
|
|
max_chain_id_length = 0
|
|
max_suffix_length = 0
|
|
for n in networks:
|
|
max_chain_id_length = max(len(str(n.chain_id)), max_chain_id_length)
|
|
max_suffix_length = max(len(n.shortcut), max_suffix_length)
|
|
|
|
def align_chain_id(n):
|
|
return "{:>{w}}".format(n.chain_id, w=max_chain_id_length)
|
|
|
|
def align_suffix(n):
|
|
cstr = c_str(" " + n.shortcut) + ";"
|
|
# we add two quotes, a space and a semicolon. hence +4 chars
|
|
return "{:<{w}}".format(cstr, w=max_suffix_length + 4)
|
|
|
|
%>\
|
|
// This file is automatically generated from ethereum_networks.h.mako
|
|
// DO NOT EDIT
|
|
|
|
#ifndef __ETHEREUM_NETWORKS_H__
|
|
#define __ETHEREUM_NETWORKS_H__
|
|
|
|
#define ASSIGN_ETHEREUM_SUFFIX(suffix, chain_id) ${BKSL}
|
|
switch (chain_id) { ${BKSL}
|
|
% for n in networks:
|
|
case ${align_chain_id(n)}: suffix = ${align_suffix(n)} break; /* ${n.name} */ ${BKSL}
|
|
% endfor
|
|
default: suffix = " UNKN"; break; /* unknown chain */ ${BKSL}
|
|
}
|
|
|
|
#endif
|
|
|