mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 15:28:10 +00:00
core/ethereum: simplify code for token list
This commit is contained in:
parent
d56de2c5fe
commit
60d1460185
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ from collections import defaultdict
|
||||
|
||||
def group_tokens(tokens):
|
||||
r = defaultdict(list)
|
||||
for t in tokens:
|
||||
for t in sorted(tokens, key=lambda t: t.chain_id):
|
||||
r[t.chain_id].append(t)
|
||||
return r
|
||||
%>
|
||||
@ -24,7 +24,7 @@ def token_by_chain_address(chain_id, address):
|
||||
pass
|
||||
% for t in tokens:
|
||||
elif address == ${black_repr(t.address_bytes)}:
|
||||
return (${t.chain_id}, ${black_repr(t.address_bytes)}, ${black_repr(t.symbol)}, ${t.decimals}) # ${t.chain} / ${t.name.strip()}
|
||||
return (chain_id, address, ${black_repr(t.symbol)}, ${t.decimals}) # ${t.chain} / ${t.name.strip()}
|
||||
% endfor
|
||||
% endfor
|
||||
# fmt: on
|
||||
|
Loading…
Reference in New Issue
Block a user