Exemple #1
0
    def display_address(self, keypath, p2sh_p2wpkh, bech32):
        self.device.check_mitm()
        keypath = keypath.replace('h', '\'')
        keypath = keypath.replace('H', '\'')

        if p2sh_p2wpkh:
            format = AF_P2WPKH_P2SH
        elif bech32:
            format = AF_P2WPKH
        else:
            format = AF_CLASSIC
        address = self.device.send_recv(CCProtocolPacker.show_address(
            keypath, format),
                                        timeout=None)
        if self.device.is_simulator:
            self.device.send_recv(CCProtocolPacker.sim_keypress(b'y'))
        return {'address': address}
Exemple #2
0
def show_address(path, quiet=False, segwit=False, wrap=False):
    """Show the human version of an address"""
    with get_device() as dev:
        if wrap:
            addr_fmt = AF_P2WPKH_P2SH
        elif segwit:
            addr_fmt = AF_P2WPKH
        else:
            addr_fmt = AF_CLASSIC

        addr = dev.send_recv(CCProtocolPacker.show_address(path, addr_fmt),
                             timeout=None)

        if quiet:
            click.echo(addr)
        else:
            click.echo('Displaying address:\n\n%s\n' % addr)
def show_address(path, quiet=False, segwit=False, wrap=False):
    "Show the human version of an address"

    dev = ColdcardDevice(sn=force_serial)

    if wrap:
        addr_fmt = AF_P2WPKH_P2SH
    elif segwit:
        addr_fmt = AF_P2WPKH
    else:
        addr_fmt = AF_CLASSIC

    addr = dev.send_recv(CCProtocolPacker.show_address(path, addr_fmt), timeout=None)

    if quiet:
        print(addr)
    else:
        print('Displaying address:\n\n%s\n' % addr)
Exemple #4
0
 def show_address(self, path, addr_fmt):
     # prompt user w/ address, also returns it immediately.
     return self.dev.send_recv(CCProtocolPacker.show_address(
         path, addr_fmt),
                               timeout=None)
Exemple #5
0
 def show_address(self, path, addr_fmt):
     # prompt user w/ addres, also returns it immediately.
     return self.dev.send_recv(CCProtocolPacker.show_address(path, addr_fmt), timeout=None)