mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-18 10:32:02 +00:00
add bip44 coin_type to CoinInfo
This commit is contained in:
parent
54659d49d8
commit
cc0896c334
@ -27,7 +27,8 @@ def get_fields(coin):
|
|||||||
'0x%s' % coin['xpub_magic'] if coin['xpub_magic'] is not None else '0x00000000',
|
'0x%s' % coin['xpub_magic'] if coin['xpub_magic'] is not None else '0x00000000',
|
||||||
'0x%s' % coin['xprv_magic'] if coin['xprv_magic'] is not None else '0x00000000',
|
'0x%s' % coin['xprv_magic'] if coin['xprv_magic'] is not None else '0x00000000',
|
||||||
'%d' % coin['forkid'] if coin['forkid'] else '0',
|
'%d' % coin['forkid'] if coin['forkid'] else '0',
|
||||||
'"%s"' % coin['bech32_prefix'] if coin.get('bech32_prefix') is not None else 'NULL'
|
'"%s"' % coin['bech32_prefix'] if coin.get('bech32_prefix') is not None else 'NULL',
|
||||||
|
'0x%08x' % (0x80000000 + coin['bip44']),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,16 @@ const CoinInfo *coinByAddressType(uint32_t address_type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CoinInfo *coinByCoinType(uint32_t coin_type)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < COINS_COUNT; i++) {
|
||||||
|
if (coin_type == coins[i].coin_type) {
|
||||||
|
return &(coins[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool coinExtractAddressType(const CoinInfo *coin, const char *addr, uint32_t *address_type)
|
bool coinExtractAddressType(const CoinInfo *coin, const char *addr, uint32_t *address_type)
|
||||||
{
|
{
|
||||||
if (!addr) return false;
|
if (!addr) return false;
|
||||||
|
@ -42,12 +42,14 @@ typedef struct _CoinInfo {
|
|||||||
uint32_t xprv_magic;
|
uint32_t xprv_magic;
|
||||||
uint32_t forkid;
|
uint32_t forkid;
|
||||||
const char *bech32_prefix;
|
const char *bech32_prefix;
|
||||||
|
uint32_t coin_type;
|
||||||
} CoinInfo;
|
} CoinInfo;
|
||||||
|
|
||||||
extern const CoinInfo coins[COINS_COUNT];
|
extern const CoinInfo coins[COINS_COUNT];
|
||||||
|
|
||||||
const CoinInfo *coinByName(const char *name);
|
const CoinInfo *coinByName(const char *name);
|
||||||
const CoinInfo *coinByAddressType(uint32_t address_type);
|
const CoinInfo *coinByAddressType(uint32_t address_type);
|
||||||
|
const CoinInfo *coinByCoinType(uint32_t coin_type);
|
||||||
bool coinExtractAddressType(const CoinInfo *coin, const char *addr, uint32_t *address_type);
|
bool coinExtractAddressType(const CoinInfo *coin, const char *addr, uint32_t *address_type);
|
||||||
bool coinExtractAddressTypeRaw(const CoinInfo *coin, const uint8_t *addr_raw, uint32_t *address_type);
|
bool coinExtractAddressTypeRaw(const CoinInfo *coin, const uint8_t *addr_raw, uint32_t *address_type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user