|
|
@ -243,23 +243,39 @@ class TrezorCompatiblePlugin(HW_PluginBase): |
|
|
|
raw = bh2u(signed_tx) |
|
|
|
tx.update_signatures(raw) |
|
|
|
|
|
|
|
def show_address(self, wallet, address): |
|
|
|
client = self.get_client(wallet.keystore) |
|
|
|
def show_address(self, wallet, keystore, address): |
|
|
|
client = self.get_client(keystore) |
|
|
|
if not client.atleast_version(1, 3): |
|
|
|
wallet.keystore.handler.show_error(_("Your device firmware is too old")) |
|
|
|
keystore.handler.show_error(_("Your device firmware is too old")) |
|
|
|
return |
|
|
|
change, index = wallet.get_address_index(address) |
|
|
|
derivation = wallet.keystore.derivation |
|
|
|
derivation = keystore.derivation |
|
|
|
address_path = "%s/%d/%d"%(derivation, change, index) |
|
|
|
address_n = client.expand_path(address_path) |
|
|
|
script_gen = wallet.keystore.get_script_gen() |
|
|
|
if script_gen == SCRIPT_GEN_NATIVE_SEGWIT: |
|
|
|
script_type = self.types.InputScriptType.SPENDWITNESS |
|
|
|
elif script_gen == SCRIPT_GEN_P2SH_SEGWIT: |
|
|
|
script_type = self.types.InputScriptType.SPENDP2SHWITNESS |
|
|
|
xpubs = wallet.get_master_public_keys() |
|
|
|
if len(xpubs) == 1: |
|
|
|
script_gen = keystore.get_script_gen() |
|
|
|
if script_gen == SCRIPT_GEN_NATIVE_SEGWIT: |
|
|
|
script_type = self.types.InputScriptType.SPENDWITNESS |
|
|
|
elif script_gen == SCRIPT_GEN_P2SH_SEGWIT: |
|
|
|
script_type = self.types.InputScriptType.SPENDP2SHWITNESS |
|
|
|
else: |
|
|
|
script_type = self.types.InputScriptType.SPENDADDRESS |
|
|
|
client.get_address(self.get_coin_name(), address_n, True, script_type=script_type) |
|
|
|
else: |
|
|
|
script_type = self.types.InputScriptType.SPENDADDRESS |
|
|
|
client.get_address(self.get_coin_name(), address_n, True, script_type=script_type) |
|
|
|
def f(xpub): |
|
|
|
node = self.ckd_public.deserialize(xpub) |
|
|
|
return self.types.HDNodePathType(node=node, address_n=[change, index]) |
|
|
|
pubkeys = wallet.get_public_keys(address) |
|
|
|
# sort xpubs using the order of pubkeys |
|
|
|
sorted_pubkeys, sorted_xpubs = zip(*sorted(zip(pubkeys, xpubs))) |
|
|
|
pubkeys = list(map(f, sorted_xpubs)) |
|
|
|
multisig = self.types.MultisigRedeemScriptType( |
|
|
|
pubkeys=pubkeys, |
|
|
|
signatures=[b''] * wallet.n, |
|
|
|
m=wallet.m, |
|
|
|
) |
|
|
|
client.get_address(self.get_coin_name(), address_n, True, multisig=multisig) |
|
|
|
|
|
|
|
def tx_inputs(self, tx, for_sig=False, script_gen=SCRIPT_GEN_LEGACY): |
|
|
|
inputs = [] |
|
|
|