mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 19:18:56 +00:00
build: generate code with Mako templates
This commit is contained in:
parent
92eb6b8fe1
commit
348b99b8dc
8
Makefile
8
Makefile
@ -84,6 +84,14 @@ black:
|
||||
cstyle: ## run code style check on low-level C code
|
||||
./tools/clang-format-check $(shell find embed -type f -name *.[ch])
|
||||
|
||||
## code generation ##
|
||||
|
||||
templates: ## render Mako templates (for lists of coins, tokens, etc.)
|
||||
./tools/build_templates
|
||||
|
||||
templates_check: ## check that Mako-rendered files match their templates
|
||||
./tools/build_templates --check
|
||||
|
||||
## build commands:
|
||||
|
||||
build: build_boardloader build_bootloader build_firmware build_prodtest build_unix ## build all
|
||||
|
@ -1,3 +1,5 @@
|
||||
# generated from coininfo.py.mako
|
||||
# do not edit manually!
|
||||
from trezor.crypto.base58 import groestl512d_32, sha256d_32
|
||||
|
||||
|
||||
@ -45,19 +47,17 @@ class CoinInfo:
|
||||
self.sign_hash_double = True
|
||||
|
||||
|
||||
# generated using tools/codegen/gen_coins.py
|
||||
# do not edit manually!
|
||||
# fmt: off
|
||||
COINS = [
|
||||
CoinInfo(
|
||||
coin_name='Bitcoin',
|
||||
coin_shortcut='BTC',
|
||||
coin_name="Bitcoin",
|
||||
coin_shortcut="BTC",
|
||||
address_type=0,
|
||||
address_type_p2sh=5,
|
||||
maxfee_kb=2000000,
|
||||
signed_message_header='Bitcoin Signed Message:\n',
|
||||
signed_message_header="Bitcoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='bc',
|
||||
bech32_prefix="bc",
|
||||
cashaddr_prefix=None,
|
||||
slip44=0,
|
||||
segwit=True,
|
||||
@ -68,14 +68,14 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Testnet',
|
||||
coin_shortcut='TEST',
|
||||
coin_name="Testnet",
|
||||
coin_shortcut="TEST",
|
||||
address_type=111,
|
||||
address_type_p2sh=196,
|
||||
maxfee_kb=10000000,
|
||||
signed_message_header='Bitcoin Signed Message:\n',
|
||||
signed_message_header="Bitcoin Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix='tb',
|
||||
bech32_prefix="tb",
|
||||
cashaddr_prefix=None,
|
||||
slip44=1,
|
||||
segwit=True,
|
||||
@ -86,15 +86,15 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Bcash',
|
||||
coin_shortcut='BCH',
|
||||
coin_name="Bcash",
|
||||
coin_shortcut="BCH",
|
||||
address_type=0,
|
||||
address_type_p2sh=5,
|
||||
maxfee_kb=500000,
|
||||
signed_message_header='Bitcoin Signed Message:\n',
|
||||
signed_message_header="Bitcoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix='bitcoincash',
|
||||
cashaddr_prefix="bitcoincash",
|
||||
slip44=145,
|
||||
segwit=False,
|
||||
fork_id=0,
|
||||
@ -104,15 +104,15 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Bcash Testnet',
|
||||
coin_shortcut='TBCH',
|
||||
coin_name="Bcash Testnet",
|
||||
coin_shortcut="TBCH",
|
||||
address_type=111,
|
||||
address_type_p2sh=196,
|
||||
maxfee_kb=10000000,
|
||||
signed_message_header='Bitcoin Signed Message:\n',
|
||||
signed_message_header="Bitcoin Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix='bchtest',
|
||||
cashaddr_prefix="bchtest",
|
||||
slip44=1,
|
||||
segwit=False,
|
||||
fork_id=0,
|
||||
@ -122,14 +122,14 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Bgold',
|
||||
coin_shortcut='BTG',
|
||||
coin_name="Bgold",
|
||||
coin_shortcut="BTG",
|
||||
address_type=38,
|
||||
address_type_p2sh=23,
|
||||
maxfee_kb=500000,
|
||||
signed_message_header='Bitcoin Gold Signed Message:\n',
|
||||
signed_message_header="Bitcoin Gold Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='btg',
|
||||
bech32_prefix="btg",
|
||||
cashaddr_prefix=None,
|
||||
slip44=156,
|
||||
segwit=True,
|
||||
@ -140,12 +140,30 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Bprivate',
|
||||
coin_shortcut='BTCP',
|
||||
coin_name="Bgold Testnet",
|
||||
coin_shortcut="TBTG",
|
||||
address_type=111,
|
||||
address_type_p2sh=196,
|
||||
maxfee_kb=500000,
|
||||
signed_message_header="Bitcoin Gold Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix="tbtg",
|
||||
cashaddr_prefix=None,
|
||||
slip44=156,
|
||||
segwit=True,
|
||||
fork_id=79,
|
||||
force_bip143=True,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Bprivate",
|
||||
coin_shortcut="BTCP",
|
||||
address_type=4901,
|
||||
address_type_p2sh=5039,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header='BitcoinPrivate Signed Message:\n',
|
||||
signed_message_header="BitcoinPrivate Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -158,12 +176,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Dash',
|
||||
coin_shortcut='DASH',
|
||||
coin_name="Dash",
|
||||
coin_shortcut="DASH",
|
||||
address_type=76,
|
||||
address_type_p2sh=16,
|
||||
maxfee_kb=100000,
|
||||
signed_message_header='DarkCoin Signed Message:\n',
|
||||
signed_message_header="DarkCoin Signed Message:\n",
|
||||
xpub_magic=0x02fe52cc,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -176,14 +194,50 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='DigiByte',
|
||||
coin_shortcut='DGB',
|
||||
coin_name="Dash Testnet",
|
||||
coin_shortcut="tDASH",
|
||||
address_type=140,
|
||||
address_type_p2sh=19,
|
||||
maxfee_kb=100000,
|
||||
signed_message_header="DarkCoin Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=1,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Denarius",
|
||||
coin_shortcut="DNR",
|
||||
address_type=30,
|
||||
address_type_p2sh=90,
|
||||
maxfee_kb=100000,
|
||||
signed_message_header="Denarius Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=116,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="DigiByte",
|
||||
coin_shortcut="DGB",
|
||||
address_type=30,
|
||||
address_type_p2sh=63,
|
||||
maxfee_kb=500000,
|
||||
signed_message_header='DigiByte Signed Message:\n',
|
||||
signed_message_header="DigiByte Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='dgb',
|
||||
bech32_prefix="dgb",
|
||||
cashaddr_prefix=None,
|
||||
slip44=20,
|
||||
segwit=True,
|
||||
@ -194,12 +248,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Dogecoin',
|
||||
coin_shortcut='DOGE',
|
||||
coin_name="Dogecoin",
|
||||
coin_shortcut="DOGE",
|
||||
address_type=30,
|
||||
address_type_p2sh=22,
|
||||
maxfee_kb=1000000000,
|
||||
signed_message_header='Dogecoin Signed Message:\n',
|
||||
signed_message_header="Dogecoin Signed Message:\n",
|
||||
xpub_magic=0x02facafd,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -212,14 +266,50 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Fujicoin',
|
||||
coin_shortcut='FJC',
|
||||
coin_name="Feathercoin",
|
||||
coin_shortcut="FTC",
|
||||
address_type=14,
|
||||
address_type_p2sh=5,
|
||||
maxfee_kb=40000000,
|
||||
signed_message_header="Feathercoin Signed Message:\n",
|
||||
xpub_magic=0x0488bc26,
|
||||
bech32_prefix="fc",
|
||||
cashaddr_prefix=None,
|
||||
slip44=8,
|
||||
segwit=True,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Flashcoin",
|
||||
coin_shortcut="FLASH",
|
||||
address_type=68,
|
||||
address_type_p2sh=130,
|
||||
maxfee_kb=4000000,
|
||||
signed_message_header="Flashcoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=120,
|
||||
segwit=True,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Fujicoin",
|
||||
coin_shortcut="FJC",
|
||||
address_type=36,
|
||||
address_type_p2sh=16,
|
||||
maxfee_kb=10000000,
|
||||
signed_message_header='FujiCoin Signed Message:\n',
|
||||
signed_message_header="FujiCoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='fc',
|
||||
bech32_prefix="fc",
|
||||
cashaddr_prefix=None,
|
||||
slip44=75,
|
||||
segwit=True,
|
||||
@ -230,14 +320,14 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Groestlcoin',
|
||||
coin_shortcut='GRS',
|
||||
coin_name="Groestlcoin",
|
||||
coin_shortcut="GRS",
|
||||
address_type=36,
|
||||
address_type_p2sh=5,
|
||||
maxfee_kb=100000,
|
||||
signed_message_header='GroestlCoin Signed Message:\n',
|
||||
signed_message_header="GroestlCoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='grs',
|
||||
bech32_prefix="grs",
|
||||
cashaddr_prefix=None,
|
||||
slip44=17,
|
||||
segwit=True,
|
||||
@ -248,14 +338,14 @@ COINS = [
|
||||
curve_name='secp256k1-groestl',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Groestlcoin Testnet',
|
||||
coin_shortcut='tGRS',
|
||||
coin_name="Groestlcoin Testnet",
|
||||
coin_shortcut="tGRS",
|
||||
address_type=111,
|
||||
address_type_p2sh=196,
|
||||
maxfee_kb=100000,
|
||||
signed_message_header='GroestlCoin Signed Message:\n',
|
||||
signed_message_header="GroestlCoin Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix='tgrs',
|
||||
bech32_prefix="tgrs",
|
||||
cashaddr_prefix=None,
|
||||
slip44=1,
|
||||
segwit=True,
|
||||
@ -266,14 +356,32 @@ COINS = [
|
||||
curve_name='secp256k1-groestl',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Litecoin',
|
||||
coin_shortcut='LTC',
|
||||
coin_name="Koto",
|
||||
coin_shortcut="KOTO",
|
||||
address_type=6198,
|
||||
address_type_p2sh=6203,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header="Koto Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=510,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=0x02e7d970,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Litecoin",
|
||||
coin_shortcut="LTC",
|
||||
address_type=48,
|
||||
address_type_p2sh=50,
|
||||
maxfee_kb=40000000,
|
||||
signed_message_header='Litecoin Signed Message:\n',
|
||||
signed_message_header="Litecoin Signed Message:\n",
|
||||
xpub_magic=0x019da462,
|
||||
bech32_prefix='ltc',
|
||||
bech32_prefix="ltc",
|
||||
cashaddr_prefix=None,
|
||||
slip44=2,
|
||||
segwit=True,
|
||||
@ -284,14 +392,14 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Litecoin Testnet',
|
||||
coin_shortcut='TLTC',
|
||||
coin_name="Litecoin Testnet",
|
||||
coin_shortcut="TLTC",
|
||||
address_type=111,
|
||||
address_type_p2sh=58,
|
||||
maxfee_kb=40000000,
|
||||
signed_message_header='Litecoin Signed Message:\n',
|
||||
signed_message_header="Litecoin Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix='tltc',
|
||||
bech32_prefix="tltc",
|
||||
cashaddr_prefix=None,
|
||||
slip44=1,
|
||||
segwit=True,
|
||||
@ -302,14 +410,14 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Monacoin',
|
||||
coin_shortcut='MONA',
|
||||
coin_name="Monacoin",
|
||||
coin_shortcut="MONA",
|
||||
address_type=50,
|
||||
address_type_p2sh=55,
|
||||
maxfee_kb=5000000,
|
||||
signed_message_header='Monacoin Signed Message:\n',
|
||||
signed_message_header="Monacoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='mona',
|
||||
bech32_prefix="mona",
|
||||
cashaddr_prefix=None,
|
||||
slip44=22,
|
||||
segwit=True,
|
||||
@ -320,12 +428,48 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Namecoin',
|
||||
coin_shortcut='NMC',
|
||||
coin_name="MonetaryUnit",
|
||||
coin_shortcut="MUE",
|
||||
address_type=16,
|
||||
address_type_p2sh=76,
|
||||
maxfee_kb=100000,
|
||||
signed_message_header="MonetaryUnit Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=31,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Myriad",
|
||||
coin_shortcut="XMY",
|
||||
address_type=50,
|
||||
address_type_p2sh=9,
|
||||
maxfee_kb=2000000,
|
||||
signed_message_header="Myriadcoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=90,
|
||||
segwit=True,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Namecoin",
|
||||
coin_shortcut="NMC",
|
||||
address_type=52,
|
||||
address_type_p2sh=5,
|
||||
maxfee_kb=10000000,
|
||||
signed_message_header='Namecoin Signed Message:\n',
|
||||
signed_message_header="Namecoin Signed Message:\n",
|
||||
xpub_magic=0x019da462,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -338,14 +482,68 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Vertcoin',
|
||||
coin_shortcut='VTC',
|
||||
coin_name="Pesetacoin",
|
||||
coin_shortcut="PTC",
|
||||
address_type=47,
|
||||
address_type_p2sh=22,
|
||||
maxfee_kb=1000000000,
|
||||
signed_message_header="Pesetacoin Signed Message:\n",
|
||||
xpub_magic=0x0488c42e,
|
||||
bech32_prefix="null",
|
||||
cashaddr_prefix=None,
|
||||
slip44=109,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="SmartCash",
|
||||
coin_shortcut="SMART",
|
||||
address_type=63,
|
||||
address_type_p2sh=18,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header="SmartCash Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=224,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="SmartCash Testnet",
|
||||
coin_shortcut="tSMART",
|
||||
address_type=65,
|
||||
address_type_p2sh=21,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header="SmartCash Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
slip44=224,
|
||||
segwit=False,
|
||||
fork_id=None,
|
||||
force_bip143=False,
|
||||
version_group_id=None,
|
||||
bip115=False,
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name="Vertcoin",
|
||||
coin_shortcut="VTC",
|
||||
address_type=71,
|
||||
address_type_p2sh=5,
|
||||
maxfee_kb=40000000,
|
||||
signed_message_header='Vertcoin Signed Message:\n',
|
||||
signed_message_header="Vertcoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='vtc',
|
||||
bech32_prefix="vtc",
|
||||
cashaddr_prefix=None,
|
||||
slip44=28,
|
||||
segwit=True,
|
||||
@ -356,14 +554,14 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Viacoin',
|
||||
coin_shortcut='VIA',
|
||||
coin_name="Viacoin",
|
||||
coin_shortcut="VIA",
|
||||
address_type=71,
|
||||
address_type_p2sh=33,
|
||||
maxfee_kb=40000000,
|
||||
signed_message_header='Viacoin Signed Message:\n',
|
||||
signed_message_header="Viacoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix='via',
|
||||
bech32_prefix="via",
|
||||
cashaddr_prefix=None,
|
||||
slip44=14,
|
||||
segwit=True,
|
||||
@ -374,12 +572,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Zcash',
|
||||
coin_shortcut='ZEC',
|
||||
coin_name="Zcash",
|
||||
coin_shortcut="ZEC",
|
||||
address_type=7352,
|
||||
address_type_p2sh=7357,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header='Zcash Signed Message:\n',
|
||||
signed_message_header="Zcash Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -392,12 +590,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Zcash Testnet',
|
||||
coin_shortcut='TAZ',
|
||||
coin_name="Zcash Testnet",
|
||||
coin_shortcut="TAZ",
|
||||
address_type=7461,
|
||||
address_type_p2sh=7354,
|
||||
maxfee_kb=10000000,
|
||||
signed_message_header='Zcash Signed Message:\n',
|
||||
signed_message_header="Zcash Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -410,12 +608,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Zcoin',
|
||||
coin_shortcut='XZC',
|
||||
coin_name="Zcoin",
|
||||
coin_shortcut="XZC",
|
||||
address_type=82,
|
||||
address_type_p2sh=7,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header='Zcoin Signed Message:\n',
|
||||
signed_message_header="Zcoin Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -428,12 +626,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Zcoin Testnet',
|
||||
coin_shortcut='tXZC',
|
||||
coin_name="Zcoin Testnet",
|
||||
coin_shortcut="tXZC",
|
||||
address_type=65,
|
||||
address_type_p2sh=178,
|
||||
maxfee_kb=1000000,
|
||||
signed_message_header='Zcoin Signed Message:\n',
|
||||
signed_message_header="Zcoin Signed Message:\n",
|
||||
xpub_magic=0x043587cf,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
@ -446,12 +644,12 @@ COINS = [
|
||||
curve_name='secp256k1',
|
||||
),
|
||||
CoinInfo(
|
||||
coin_name='Zencash',
|
||||
coin_shortcut='ZEN',
|
||||
coin_name="Zencash",
|
||||
coin_shortcut="ZEN",
|
||||
address_type=8329,
|
||||
address_type_p2sh=8342,
|
||||
maxfee_kb=2000000,
|
||||
signed_message_header='Zencash Signed Message:\n',
|
||||
signed_message_header="Zencash Signed Message:\n",
|
||||
xpub_magic=0x0488b21e,
|
||||
bech32_prefix=None,
|
||||
cashaddr_prefix=None,
|
||||
|
85
src/apps/common/coininfo.py.mako
Normal file
85
src/apps/common/coininfo.py.mako
Normal file
@ -0,0 +1,85 @@
|
||||
# generated from coininfo.py.mako
|
||||
# do not edit manually!
|
||||
from trezor.crypto.base58 import groestl512d_32, sha256d_32
|
||||
|
||||
|
||||
class CoinInfo:
|
||||
def __init__(
|
||||
self,
|
||||
coin_name: str,
|
||||
coin_shortcut: str,
|
||||
address_type: int,
|
||||
address_type_p2sh: int,
|
||||
maxfee_kb: int,
|
||||
signed_message_header: str,
|
||||
xpub_magic: int,
|
||||
bech32_prefix: str,
|
||||
cashaddr_prefix: str,
|
||||
slip44: int,
|
||||
segwit: bool,
|
||||
fork_id: int,
|
||||
force_bip143: bool,
|
||||
version_group_id: int,
|
||||
bip115: bool,
|
||||
curve_name: str,
|
||||
):
|
||||
self.coin_name = coin_name
|
||||
self.coin_shortcut = coin_shortcut
|
||||
self.address_type = address_type
|
||||
self.address_type_p2sh = address_type_p2sh
|
||||
self.maxfee_kb = maxfee_kb
|
||||
self.signed_message_header = signed_message_header
|
||||
self.xpub_magic = xpub_magic
|
||||
self.bech32_prefix = bech32_prefix
|
||||
self.cashaddr_prefix = cashaddr_prefix
|
||||
self.slip44 = slip44
|
||||
self.segwit = segwit
|
||||
self.fork_id = fork_id
|
||||
self.force_bip143 = force_bip143
|
||||
self.version_group_id = version_group_id
|
||||
self.bip115 = bip115
|
||||
self.curve_name = curve_name
|
||||
if curve_name == "secp256k1-groestl":
|
||||
self.b58_hash = groestl512d_32
|
||||
self.sign_hash_double = False
|
||||
else:
|
||||
self.b58_hash = sha256d_32
|
||||
self.sign_hash_double = True
|
||||
|
||||
|
||||
# fmt: off
|
||||
<%
|
||||
def hexfmt(x):
|
||||
if x is None:
|
||||
return None
|
||||
else:
|
||||
return "0x{:08x}".format(x)
|
||||
|
||||
ATTRIBUTES = (
|
||||
("coin_name", black_repr),
|
||||
("coin_shortcut", black_repr),
|
||||
("address_type", int),
|
||||
("address_type_p2sh", int),
|
||||
("maxfee_kb", int),
|
||||
("signed_message_header", black_repr),
|
||||
("xpub_magic", hexfmt),
|
||||
("bech32_prefix", black_repr),
|
||||
("cashaddr_prefix", black_repr),
|
||||
("slip44", int),
|
||||
("segwit", bool),
|
||||
("fork_id", black_repr),
|
||||
("force_bip143", bool),
|
||||
("version_group_id", hexfmt),
|
||||
("bip115", bool),
|
||||
("curve_name", lambda r: repr(r.replace("_", "-"))),
|
||||
)
|
||||
%>\
|
||||
COINS = [
|
||||
% for coin in supported_on("trezor2", bitcoin):
|
||||
CoinInfo(
|
||||
% for attr, func in ATTRIBUTES:
|
||||
${attr}=${func(coin[attr])},
|
||||
% endfor
|
||||
),
|
||||
% endfor
|
||||
]
|
@ -1,3 +1,7 @@
|
||||
# generated from networks.py.mako
|
||||
# do not edit manually!
|
||||
|
||||
|
||||
def shortcut_by_chain_id(chain_id, tx_type=None):
|
||||
if tx_type in [1, 6] and chain_id in [1, 3]:
|
||||
return "WAN"
|
||||
@ -31,134 +35,160 @@ class NetworkInfo:
|
||||
self.rskip60 = rskip60
|
||||
|
||||
|
||||
# generated using tools/codegen/gen_eth_networks.py
|
||||
# do not edit manually!
|
||||
# fmt: off
|
||||
NETWORKS = [
|
||||
NetworkInfo(
|
||||
chain_id=1,
|
||||
slip44=60,
|
||||
shortcut='ETH',
|
||||
name='Ethereum',
|
||||
shortcut="ETH",
|
||||
name="Ethereum",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=2,
|
||||
slip44=40,
|
||||
shortcut='EXP',
|
||||
name='Expanse',
|
||||
shortcut="EXP",
|
||||
name="Expanse",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=3,
|
||||
slip44=1,
|
||||
shortcut='tETH',
|
||||
name='Ethereum Testnet Ropsten',
|
||||
shortcut="tROP",
|
||||
name="Ethereum Testnet Ropsten",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=4,
|
||||
slip44=1,
|
||||
shortcut='tETH',
|
||||
name='Ethereum Testnet Rinkeby',
|
||||
shortcut="tRIN",
|
||||
name="Ethereum Testnet Rinkeby",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=8,
|
||||
slip44=108,
|
||||
shortcut='UBQ',
|
||||
name='UBIQ',
|
||||
shortcut="UBQ",
|
||||
name="Ubiq",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=20,
|
||||
slip44=2018,
|
||||
shortcut='EOSC',
|
||||
name='EOS Classic',
|
||||
shortcut="EOSC",
|
||||
name="EOS Classic",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=28,
|
||||
slip44=1128,
|
||||
shortcut='ETSC',
|
||||
name='Ethereum Social',
|
||||
shortcut="ETSC",
|
||||
name="Ethereum Social",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=30,
|
||||
slip44=137,
|
||||
shortcut='RSK',
|
||||
name='RSK',
|
||||
shortcut="RSK",
|
||||
name="RSK",
|
||||
rskip60=True,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=31,
|
||||
slip44=37310,
|
||||
shortcut='tRSK',
|
||||
name='RSK Testnet',
|
||||
shortcut="tRSK",
|
||||
name="RSK Testnet",
|
||||
rskip60=True,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=42,
|
||||
slip44=1,
|
||||
shortcut='tETH',
|
||||
name='Ethereum Testnet Kovan',
|
||||
shortcut="tKOV",
|
||||
name="Ethereum Testnet Kovan",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=60,
|
||||
slip44=6060,
|
||||
shortcut='GO',
|
||||
name='GoChain',
|
||||
shortcut="GO",
|
||||
name="GoChain",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=61,
|
||||
slip44=61,
|
||||
shortcut='ETC',
|
||||
name='Ethereum Classic',
|
||||
shortcut="ETC",
|
||||
name="Ethereum Classic",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=62,
|
||||
slip44=1,
|
||||
shortcut='tETC',
|
||||
name='Ethereum Classic Testnet',
|
||||
shortcut="tETC",
|
||||
name="Ethereum Classic Testnet",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=64,
|
||||
slip44=163,
|
||||
shortcut='ELLA',
|
||||
name='Ellaism',
|
||||
shortcut="ELLA",
|
||||
name="Ellaism",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=820,
|
||||
slip44=820,
|
||||
shortcut='CLO',
|
||||
name='Callisto',
|
||||
shortcut="CLO",
|
||||
name="Callisto",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=1620,
|
||||
slip44=1620,
|
||||
shortcut="ATH",
|
||||
name="Atheios",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=1987,
|
||||
slip44=1987,
|
||||
shortcut='EGEM',
|
||||
name='EtherGem',
|
||||
shortcut="EGEM",
|
||||
name="EtherGem",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=31102,
|
||||
slip44=31102,
|
||||
shortcut='ESN',
|
||||
name='Ethersocial Network',
|
||||
shortcut="ESN",
|
||||
name="Ethersocial Network",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=200625,
|
||||
slip44=200625,
|
||||
shortcut='AKA',
|
||||
name='Akroma',
|
||||
shortcut="AKA",
|
||||
name="Akroma",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=1313114,
|
||||
slip44=1313114,
|
||||
shortcut="ETHO",
|
||||
name="Ether-1",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=7762959,
|
||||
slip44=184,
|
||||
shortcut="MUSIC",
|
||||
name="Musicoin",
|
||||
rskip60=False,
|
||||
),
|
||||
NetworkInfo(
|
||||
chain_id=3125659152,
|
||||
slip44=164,
|
||||
shortcut="PIRL",
|
||||
name="Pirl",
|
||||
rskip60=False,
|
||||
),
|
||||
]
|
||||
|
49
src/apps/ethereum/networks.py.mako
Normal file
49
src/apps/ethereum/networks.py.mako
Normal file
@ -0,0 +1,49 @@
|
||||
# generated from networks.py.mako
|
||||
# do not edit manually!
|
||||
|
||||
|
||||
def shortcut_by_chain_id(chain_id, tx_type=None):
|
||||
if tx_type in [1, 6] and chain_id in [1, 3]:
|
||||
return "WAN"
|
||||
else:
|
||||
n = by_chain_id(chain_id)
|
||||
return n.shortcut if n is not None else "UNKN"
|
||||
|
||||
|
||||
def by_chain_id(chain_id):
|
||||
for n in NETWORKS:
|
||||
if n.chain_id == chain_id:
|
||||
return n
|
||||
return None
|
||||
|
||||
|
||||
def by_slip44(slip44):
|
||||
for n in NETWORKS:
|
||||
if n.slip44 == slip44:
|
||||
return n
|
||||
return None
|
||||
|
||||
|
||||
class NetworkInfo:
|
||||
def __init__(
|
||||
self, chain_id: int, slip44: int, shortcut: str, name: str, rskip60: bool
|
||||
):
|
||||
self.chain_id = chain_id
|
||||
self.slip44 = slip44
|
||||
self.shortcut = shortcut
|
||||
self.name = name
|
||||
self.rskip60 = rskip60
|
||||
|
||||
|
||||
# fmt: off
|
||||
NETWORKS = [
|
||||
% for n in supported_on("trezor2", eth):
|
||||
NetworkInfo(
|
||||
chain_id=${n.chain_id},
|
||||
slip44=${n.slip44},
|
||||
shortcut="${n.shortcut}",
|
||||
name="${n.name}",
|
||||
rskip60=${n.rskip60},
|
||||
),
|
||||
% endfor
|
||||
]
|
File diff suppressed because it is too large
Load Diff
21
src/apps/ethereum/tokens.py.mako
Normal file
21
src/apps/ethereum/tokens.py.mako
Normal file
@ -0,0 +1,21 @@
|
||||
# generated from tokens.py.mako
|
||||
# do not edit manually!
|
||||
|
||||
|
||||
def token_by_chain_address(chain_id, address):
|
||||
for token in tokens:
|
||||
if chain_id == token[0] and address == token[1]:
|
||||
return token
|
||||
return UNKNOWN_TOKEN
|
||||
|
||||
|
||||
UNKNOWN_TOKEN = (None, None, None, None)
|
||||
|
||||
|
||||
# fmt: off
|
||||
tokens = [
|
||||
% for t in supported_on("trezor2", erc20):
|
||||
(${t.chain_id}, ${black_repr(t.address_bytes)}, ${black_repr(t.symbol)}, ${t.decimals}), # ${t.chain} / ${t.name.strip()}
|
||||
% endfor
|
||||
]
|
||||
# fmt: on
|
@ -1,8 +1,9 @@
|
||||
# generated using gen_nem_mosaics.py from trezor-common nem_mosaics.json - do not edit directly!
|
||||
# generated from nem_mosaics.py.mako
|
||||
# do not edit manually!
|
||||
|
||||
mosaics = [
|
||||
{
|
||||
"name": "XEM",
|
||||
"name": "NEM",
|
||||
"ticker": " XEM",
|
||||
"namespace": "nem",
|
||||
"mosaic": "xem",
|
||||
|
29
src/apps/nem/mosaic/nem_mosaics.py.mako
Normal file
29
src/apps/nem/mosaic/nem_mosaics.py.mako
Normal file
@ -0,0 +1,29 @@
|
||||
# generated from nem_mosaics.py.mako
|
||||
# do not edit manually!
|
||||
<%
|
||||
ATTRIBUTES = (
|
||||
"name",
|
||||
"ticker",
|
||||
"namespace",
|
||||
"mosaic",
|
||||
"divisibility",
|
||||
"levy",
|
||||
"fee",
|
||||
"levy_namespace",
|
||||
"levy_mosaic",
|
||||
"networks",
|
||||
)
|
||||
%>\
|
||||
|
||||
mosaics = [
|
||||
% for m in supported_on("trezor2", nem):
|
||||
<% m.ticker = " " + m.ticker %>\
|
||||
{
|
||||
% for attr in ATTRIBUTES:
|
||||
% if attr in m:
|
||||
"${attr}": ${black_repr(m[attr])},
|
||||
% endif
|
||||
% endfor
|
||||
},
|
||||
% endfor
|
||||
]
|
26
tools/build_templates
Executable file
26
tools/build_templates
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CWD=`dirname "$0"`
|
||||
RENDER="$CWD/../vendor/trezor-common/tools/cointool.py render"
|
||||
|
||||
FIND_TEMPLATES="find $CWD/../src -name *.mako"
|
||||
|
||||
check_results() {
|
||||
CHECK_FAIL=0
|
||||
for filename in $($FIND_TEMPLATES); do
|
||||
TMP=`mktemp`
|
||||
TARGET="${filename%%.mako}"
|
||||
$RENDER "$filename" -o $TMP
|
||||
if ! diff -q "$TARGET" "$TMP"; then
|
||||
CHECK_FAIL=1
|
||||
fi
|
||||
done
|
||||
exit $CHECK_FAIL
|
||||
}
|
||||
|
||||
if [ "$1" = "--check" ]; then
|
||||
check_results
|
||||
else
|
||||
$FIND_TEMPLATES | xargs $RENDER
|
||||
fi
|
@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
fields = [
|
||||
"coin_name",
|
||||
"coin_shortcut",
|
||||
"address_type",
|
||||
"address_type_p2sh",
|
||||
"maxfee_kb",
|
||||
"signed_message_header",
|
||||
"xpub_magic",
|
||||
"bech32_prefix",
|
||||
"cashaddr_prefix",
|
||||
"slip44",
|
||||
"segwit",
|
||||
"fork_id",
|
||||
"force_bip143",
|
||||
"version_group_id",
|
||||
"bip115",
|
||||
"curve_name",
|
||||
]
|
||||
|
||||
support = json.load(open("../../vendor/trezor-common/defs/support.json", "r"))
|
||||
coins = support["trezor2"].keys()
|
||||
|
||||
print("COINS = [")
|
||||
|
||||
for c in coins:
|
||||
print(" CoinInfo(")
|
||||
name = c.replace(" ", "_").lower()
|
||||
if name == "testnet":
|
||||
name = "bitcoin_testnet"
|
||||
data = json.load(open("../../vendor/trezor-common/defs/coins/%s.json" % name, "r"))
|
||||
for n in fields:
|
||||
if n in ["xpub_magic", "version_group_id"]:
|
||||
v = "0x%08x" % data[n] if data[n] is not None else "None"
|
||||
else:
|
||||
v = repr(data[n])
|
||||
if n == "curve_name":
|
||||
v = v.replace("_", "-")
|
||||
print(" %s=%s," % (n, v))
|
||||
print(" ),")
|
||||
|
||||
print("]")
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
j = json.load(open("../../vendor/trezor-common/defs/ethereum/networks.json", "r"))
|
||||
|
||||
print("NETWORKS = [")
|
||||
|
||||
for n in j:
|
||||
print(" NetworkInfo(")
|
||||
for f in ["chain_id", "slip44", "shortcut", "name", "rskip60"]:
|
||||
print(" %s=%s," % (f, repr(n[f])))
|
||||
print(" ),")
|
||||
|
||||
print("]")
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
|
||||
def format_str(value):
|
||||
return '"' + value + '"'
|
||||
|
||||
|
||||
def format_primitive(value):
|
||||
if isinstance(value, int):
|
||||
return value
|
||||
elif isinstance(value, str):
|
||||
return format_str(value)
|
||||
elif isinstance(value, list):
|
||||
return value
|
||||
else:
|
||||
raise TypeError
|
||||
|
||||
|
||||
fields = [
|
||||
"name",
|
||||
"ticker",
|
||||
"namespace",
|
||||
"mosaic",
|
||||
"divisibility",
|
||||
"levy",
|
||||
"fee",
|
||||
"levy_namespace",
|
||||
"levy_mosaic",
|
||||
"networks",
|
||||
]
|
||||
|
||||
mosaics = json.load(open("../../vendor/trezor-common/defs/nem/nem_mosaics.json", "r"))
|
||||
|
||||
print(
|
||||
"# generated using gen_nem_mosaics.py from trezor-common nem_mosaics.json - do not edit directly!"
|
||||
)
|
||||
print("")
|
||||
print("mosaics = [")
|
||||
for m in mosaics:
|
||||
print(" {")
|
||||
for name in fields:
|
||||
if name in m:
|
||||
print(" %s: %s," % (format_str(name), format_primitive(m[name])))
|
||||
# else:
|
||||
# print(' %s: None,' % format_str(name))
|
||||
print(" },")
|
||||
print("]")
|
2
vendor/trezor-common
vendored
2
vendor/trezor-common
vendored
@ -1 +1 @@
|
||||
Subproject commit 3167bd63e389f1c27fe6ae07f1b87b5fbb889a61
|
||||
Subproject commit 4c36e33425513402239530d24d093c47c162f97d
|
Loading…
Reference in New Issue
Block a user