1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

common/protob: add GetAddress.ignore_xpub_magic field

This commit is contained in:
Pavol Rusnak 2021-01-13 22:55:50 +01:00
parent bf2e4023d8
commit 6689b9c22f
4 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,7 @@ message GetAddress {
optional bool show_display = 3; // optionally show on display before sending the result
optional MultisigRedeemScriptType multisig = 4; // filled if we are showing a multisig address
optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional bool ignore_xpub_magic = 6; // ignore SLIP-0132 XPUB magic, use xpub/tpub prefix for all account types
}
/**

View File

@ -24,12 +24,14 @@ class GetAddress(p.MessageType):
show_display: bool = None,
multisig: MultisigRedeemScriptType = None,
script_type: EnumTypeInputScriptType = 0,
ignore_xpub_magic: bool = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.coin_name = coin_name
self.show_display = show_display
self.multisig = multisig
self.script_type = script_type
self.ignore_xpub_magic = ignore_xpub_magic
@classmethod
def get_fields(cls) -> Dict:
@ -39,4 +41,5 @@ class GetAddress(p.MessageType):
3: ('show_display', p.BoolType, None),
4: ('multisig', MultisigRedeemScriptType, None),
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -88,6 +88,7 @@ def get_address(
show_display=False,
multisig=None,
script_type=messages.InputScriptType.SPENDADDRESS,
ignore_xpub_magic=False,
):
return client.call(
messages.GetAddress(
@ -96,6 +97,7 @@ def get_address(
show_display=show_display,
multisig=multisig,
script_type=script_type,
ignore_xpub_magic=ignore_xpub_magic,
)
)

View File

@ -24,12 +24,14 @@ class GetAddress(p.MessageType):
show_display: bool = None,
multisig: MultisigRedeemScriptType = None,
script_type: EnumTypeInputScriptType = 0,
ignore_xpub_magic: bool = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.coin_name = coin_name
self.show_display = show_display
self.multisig = multisig
self.script_type = script_type
self.ignore_xpub_magic = ignore_xpub_magic
@classmethod
def get_fields(cls) -> Dict:
@ -39,4 +41,5 @@ class GetAddress(p.MessageType):
3: ('show_display', p.BoolType, None),
4: ('multisig', MultisigRedeemScriptType, None),
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}