mmgen-tool: add eth_checksummed_addr command

This commit is contained in:
The MMGen Project 2022-04-23 14:36:10 +00:00
commit aecc03e2a2
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 12 additions and 0 deletions

View file

@ -82,6 +82,7 @@ mods = {
'b6dtohex',
'bytespec',
'bytestob58',
'eth_checksummed_addr',
'hash160',
'hash256',
'hexdump',

View file

@ -173,3 +173,8 @@ class tool_cmd(tool_cmd_base):
from ..baseconv import baseconv
from ..util import remove_whitespace
return baseconv('b6d').tohex( remove_whitespace(b6d_num), pad )
def eth_checksummed_addr(self,addr:'sstr'):
"create a checksummed Ethereum address"
from ..protocol import init_proto
return init_proto('eth').checksummed_addr(addr)

View file

@ -316,6 +316,12 @@ tests = {
( ['nbytes=16'], {'boolfunc':is_b58_str}, ['-r0'] ),
( ['nbytes=12','pad=0'], is_b58_str, ['-r0'] ),
],
'eth_checksummed_addr': [
( ['00a329c0648769a73afac7f9381e08fb43dbea72'], '00a329c0648769A73afAc7F9381E08FB43dBEA72' ),
( ['deadbeef'*5], 'DeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF' ),
( ['ffffffff'*5], 'FFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF' ),
( ['0'*39 + '1'], '0'*39 + '1' ),
],
},
'Wallet': {
'gen_key': [