mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-27 00:28:10 +00:00
52 lines
1.4 KiB
Mako
52 lines
1.4 KiB
Mako
<%
|
|
def signed_message_header(s):
|
|
return r'"\x{:02x}" {}'.format(len(s), c_str(s))
|
|
|
|
def c_bool(b):
|
|
return "true" if b else "false"
|
|
|
|
def c_int(i):
|
|
return int(i or 0)
|
|
|
|
def defined(s):
|
|
return c_bool(s is not None)
|
|
|
|
def hex(x):
|
|
return "0x{:08x}".format(c_int(x))
|
|
%>\
|
|
// This file is automatically generated from coin_info.c.mako
|
|
// DO NOT EDIT
|
|
|
|
#include "coins.h"
|
|
|
|
#include "curves.h"
|
|
#include "secp256k1.h"
|
|
|
|
const CoinInfo coins[COINS_COUNT] = {
|
|
% for c in supported_on("trezor1", bitcoin):
|
|
{
|
|
.coin_name = ${c_str(c.coin_name)},
|
|
.coin_shortcut = ${c_str(" " + c.coin_shortcut)},
|
|
.maxfee_kb = ${c_int(c.maxfee_kb)},
|
|
.signed_message_header = ${signed_message_header(c.signed_message_header)},
|
|
.has_address_type = ${defined(c.address_type)},
|
|
.has_address_type_p2sh = ${defined(c.address_type_p2sh)},
|
|
.has_segwit = ${c_bool(c.segwit)},
|
|
.has_fork_id = ${defined(c.fork_id)},
|
|
.force_bip143 = ${c_bool(c.force_bip143)},
|
|
.decred = ${c_bool(c.decred)},
|
|
.address_type = ${c.address_type},
|
|
.address_type_p2sh = ${c.address_type_p2sh},
|
|
.xpub_magic = ${hex(c.xpub_magic)},
|
|
.xpub_magic_segwit_p2sh = ${hex(c.xpub_magic_segwit_p2sh)},
|
|
.xpub_magic_segwit_native = ${hex(c.xpub_magic_segwit_native)},
|
|
.fork_id = ${c_int(c.fork_id)},
|
|
.bech32_prefix = ${c_str(c.bech32_prefix)},
|
|
.cashaddr_prefix = ${c_str(c.cashaddr_prefix)},
|
|
.coin_type = (${c_int(c.slip44)} | 0x80000000),
|
|
.curve_name = ${c.curve_name.upper()}_NAME,
|
|
.curve = &${c.curve_name}_info,
|
|
},
|
|
% endfor
|
|
};
|
|
|