Skip to content

Commit 1c334c5

Browse files
committed
Move device specific things to devices sub folder
1 parent f45b8e7 commit 1c334c5

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

hwilib/commands.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ def get_client(device_type, device_path, password=None):
4040

4141
# Make a client
4242
if device_type == 'trezor':
43-
from . import trezori
44-
client = trezori.TrezorClient(device=device, path=device_path)
43+
from .devices import trezor
44+
client = trezor.TrezorClient(device=device, path=device_path)
4545
elif device_type == 'keepkey':
46-
from . import keepkeyi
47-
client = keepkeyi.KeepKeyClient(device=device, path=device_path)
46+
from .devices import keepkey
47+
client = keepkey.KeepKeyClient(device=device, path=device_path)
4848
elif device_type == 'ledger':
49-
from . import ledgeri
50-
client = ledgeri.LedgerClient(device=device)
49+
from .devices import ledger
50+
client = ledger.LedgerClient(device=device)
5151
elif device_type == 'digitalbitbox':
5252
if not password:
5353
raise NoPasswordError('Password must be supplied for digital BitBox')
54-
from . import digitalbitboxi
55-
client = digitalbitboxi.DigitalBitboxClient(device=device, password=password)
54+
from .devices import digitalbitbox
55+
client = digitalbitbox.DigitalBitboxClient(device=device, password=password)
5656
elif device_type == 'coldcard':
57-
from . import coldcardi
58-
client = coldcardi.ColdCardClient(device=device)
57+
from .devices import coldcard
58+
client = coldcard.ColdCardClient(device=device)
5959
else:
6060
raise UnknownDeviceError('Unknown device type specified')
6161
return client

hwilib/devices/__init__.py

Whitespace-only changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Trezor interaction script
22

3-
from .hwwclient import HardwareWalletClient
3+
from ..hwwclient import HardwareWalletClient
44
from ckcc.client import ColdcardDevice
55
from ckcc.protocol import CCProtocolPacker
66
from ckcc.constants import MAX_BLK_LEN
7-
from .base58 import xpub_main_2_test
7+
from ..base58 import xpub_main_2_test
88
from hashlib import sha256
99

1010
import base64
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
import binascii
1111
import logging
1212

13-
from .hwwclient import HardwareWalletClient
14-
from .serializations import CTransaction, PSBT, hash256, hash160, ser_sig_der, ser_sig_compact, ser_compact_size
15-
from .base58 import get_xpub_fingerprint, decode, to_address, xpub_main_2_test
13+
from ..hwwclient import HardwareWalletClient
14+
from ..serializations import CTransaction, PSBT, hash256, hash160, ser_sig_der, ser_sig_compact, ser_compact_size
15+
from ..base58 import get_xpub_fingerprint, decode, to_address, xpub_main_2_test
1616

1717
applen = 225280 # flash size minus bootloader length
1818
chunksize = 8*512
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# KeepKey interaction script
22

3-
from .hwwclient import HardwareWalletClient
3+
from ..hwwclient import HardwareWalletClient
44
from keepkeylib.transport_hid import HidTransport
55
from keepkeylib.client import KeepKeyClient as KeepKey
66
from keepkeylib import tools
77
from keepkeylib import messages_pb2, types_pb2 as proto
88
from keepkeylib.tx_api import TxApi
9-
from .base58 import get_xpub_fingerprint, decode, to_address, xpub_main_2_test
10-
from .serializations import ser_uint256, uint256_from_str
9+
from ..base58 import get_xpub_fingerprint, decode, to_address, xpub_main_2_test
10+
from ..serializations import ser_uint256, uint256_from_str
1111

1212
import binascii
1313
import json
@@ -175,7 +175,7 @@ def sign_tx(self, tx):
175175

176176
# Must return a base64 encoded string with the signed message
177177
# The message can be any string
178-
def sign_message(self, message):
178+
def sign_message(self, message, keypath):
179179
raise NotImplementedError('The HardwareWalletClient base class does not '
180180
'implement this method')
181181

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Ledger interaction script
22

3-
from .hwwclient import HardwareWalletClient
3+
from ..hwwclient import HardwareWalletClient
44
from btchip.btchip import *
55
from btchip.btchipUtils import *
66
import base64
77
import json
88
import struct
9-
from . import base58
10-
from .serializations import hash256, hash160, ser_uint256, PSBT, CTransaction, HexToBase64
9+
from .. import base58
10+
from ..serializations import hash256, hash160, ser_uint256, PSBT, CTransaction, HexToBase64
1111
import binascii
1212
import logging
1313

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Trezor interaction script
22

3-
from .hwwclient import HardwareWalletClient
3+
from ..hwwclient import HardwareWalletClient
44
from trezorlib.client import TrezorClient as Trezor
55
from trezorlib.transport import get_transport
66
from trezorlib import protobuf, tools
77
from trezorlib import messages as proto
88
from trezorlib.tx_api import TxApi
9-
from .base58 import get_xpub_fingerprint, decode, to_address, xpub_main_2_test
10-
from .serializations import ser_uint256, uint256_from_str
11-
from . import bech32
9+
from ..base58 import get_xpub_fingerprint, decode, to_address, xpub_main_2_test
10+
from ..serializations import ser_uint256, uint256_from_str
11+
from .. import bech32
1212

1313
import binascii
1414
import json
@@ -173,7 +173,7 @@ def sign_tx(self, tx):
173173

174174
# Must return a base64 encoded string with the signed message
175175
# The message can be any string
176-
def sign_message(self, message):
176+
def sign_message(self, message, keypath):
177177
raise NotImplementedError('The HardwareWalletClient base class does not '
178178
'implement this method')
179179

0 commit comments

Comments
 (0)