1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

defs: add more fields to coin definitions

This commit is contained in:
Pavol Rusnak 2018-05-21 15:14:48 +02:00
parent ef5240bccc
commit f54cf5073c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
38 changed files with 112 additions and 36 deletions

View File

@ -30,6 +30,7 @@ for coin in json.load(open('coins.json')):
assert isinstance(coin['decred'], bool)
assert coin['forkid'] is None or isinstance(coin['forkid'], int)
assert isinstance(coin['force_bip143'], bool)
assert coin['version_group_id'] is None or is_hex(coin['version_group_id'])
assert isinstance(coin['default_fee_b'], dict)
assert isinstance(coin['dust_limit'], int)
assert isinstance(coin['blocktime_minutes'], int) or isinstance(coin['blocktime_minutes'], float)

View File

@ -20,6 +20,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,
@ -58,6 +59,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},
@ -93,6 +95,7 @@
"decred": false,
"forkid": 0,
"force_bip143": true,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,
@ -130,6 +133,7 @@
"decred": false,
"forkid": 0,
"force_bip143": true,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},
@ -162,6 +166,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},
@ -194,6 +199,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 1000
},
@ -228,6 +234,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},
@ -260,6 +267,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},
@ -295,6 +303,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},
@ -329,6 +338,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": "03c48270",
"default_fee_b": {
"Normal": 10
},
@ -361,6 +371,7 @@
"decred": false,
"forkid": 79,
"force_bip143": true,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,
@ -398,6 +409,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,
@ -435,6 +447,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 100000
},
@ -469,6 +482,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 100000,
"Economy": 200000,
@ -506,6 +520,7 @@
"decred": false,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 1000
},
@ -538,6 +553,7 @@
"decred": true,
"forkid": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 145,
"segwit": false,
"decred": false,
"forkid": 0,
"fork_id": 0,
"force_bip143": true,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": false,
"decred": false,
"forkid": 0,
"fork_id": 0,
"force_bip143": true,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 156,
"segwit": true,
"decred": false,
"forkid": 79,
"fork_id": 79,
"force_bip143": true,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,

View File

@ -21,8 +21,9 @@
"slip44": 0,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 0,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 183,
"segwit": false,
"decred": false,
"forkid": 42,
"fork_id": 42,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 72,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 5,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 42,
"segwit": false,
"decred": true,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": false,
"decred": true,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 116,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 20,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,

View File

@ -21,8 +21,9 @@
"slip44": 3,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 8,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 1000
},

View File

@ -21,8 +21,9 @@
"slip44": 120,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 0
},

View File

@ -21,8 +21,9 @@
"slip44": 75,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 100000,
"Economy": 200000,

View File

@ -21,8 +21,9 @@
"slip44": 17,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 510,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 2,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 1000
},

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 22,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 100000
},

View File

@ -21,8 +21,9 @@
"slip44": 5,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 90,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 10,
"Economy": 70,

View File

@ -21,8 +21,9 @@
"slip44": 7,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 0,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -69,8 +69,9 @@ def validate_coin(coin):
assert check_type(coin['slip44'], int)
assert check_type(coin['segwit'], bool)
assert check_type(coin['decred'], bool)
assert check_type(coin['forkid'], int, nullable=True)
assert check_type(coin['fork_id'], int, nullable=True)
assert check_type(coin['force_bip143'], bool)
assert check_type(coin['version_group_id'], int, nullable=True)
assert check_type(coin['default_fee_b'], dict)
assert check_type(coin['dust_limit'], int)
assert check_type(coin['blocktime_seconds'], int)

View File

@ -27,4 +27,9 @@ message CoinDef {
optional uint32 min_address_length = 24;
optional uint32 max_address_length = 25;
optional bytes icon = 26;
optional uint32 version_group_id = 27;
optional string website = 28;
optional string github = 29;
optional string maintainer = 30;
optional uint32 blocktime_seconds = 31;
}

View File

@ -30,6 +30,11 @@ class CoinDef(p.MessageType):
24: ('min_address_length', p.UVarintType, 0),
25: ('max_address_length', p.UVarintType, 0),
26: ('icon', p.BytesType, 0),
27: ('version_group_id', p.UVarintType, 0),
28: ('website', p.UnicodeType, 0),
29: ('github', p.UnicodeType, 0),
30: ('maintainer', p.UnicodeType, 0),
31: ('blocktime_seconds', p.UVarintType, 0),
}
def __init__(
@ -60,7 +65,14 @@ class CoinDef(p.MessageType):
min_address_length: int = None,
max_address_length: int = None,
icon: bytes = None,
**kwargs
version_group_id: int = None,
website: str = None,
github: str = None,
maintainer: str = None,
blocktime_seconds: int = None,
default_fee_b: dict = None,
bitcore: dict = None,
blockbook: dict = None
):
self.coin_name = coin_name
self.coin_shortcut = coin_shortcut
@ -88,4 +100,12 @@ class CoinDef(p.MessageType):
self.min_address_length = min_address_length
self.max_address_length = max_address_length
self.icon = icon
p.MessageType.__init__(self, **kwargs)
self.version_group_id = version_group_id
self.website = website
self.github = github
self.maintainer = maintainer
self.blocktime_seconds = blocktime_seconds
self.default_fee_b = default_fee_b
self.bitcore = bitcore
self.blockbook = blockbook
p.MessageType.__init__(self)

View File

@ -21,8 +21,9 @@
"slip44": 28,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 1000
},

View File

@ -21,8 +21,9 @@
"slip44": 14,
"segwit": true,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 1000,
"Economy": 7000,

View File

@ -21,8 +21,9 @@
"slip44": 133,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": 63210096,
"default_fee_b": {
"Normal": 10
},

View File

@ -21,8 +21,9 @@
"slip44": 136,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 1,
"Economy": 10,

View File

@ -21,8 +21,9 @@
"slip44": 1,
"segwit": false,
"decred": false,
"forkid": null,
"fork_id": null,
"force_bip143": false,
"version_group_id": null,
"default_fee_b": {
"Low": 1,
"Economy": 10,