mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 23:38:09 +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):
|
def group_tokens(tokens):
|
||||||
r = defaultdict(list)
|
r = defaultdict(list)
|
||||||
for t in tokens:
|
for t in sorted(tokens, key=lambda t: t.chain_id):
|
||||||
r[t.chain_id].append(t)
|
r[t.chain_id].append(t)
|
||||||
return r
|
return r
|
||||||
%>
|
%>
|
||||||
@ -24,7 +24,7 @@ def token_by_chain_address(chain_id, address):
|
|||||||
pass
|
pass
|
||||||
% for t in tokens:
|
% for t in tokens:
|
||||||
elif address == ${black_repr(t.address_bytes)}:
|
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
|
||||||
% endfor
|
% endfor
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
Loading…
Reference in New Issue
Block a user