KeepKey / Trezor: client split
We're going to want to do a few things differently, such as device recovery. So move the client code to clientbase.py and create a per-plugin client.py file for the derived client class.
This commit is contained in:
14
plugins/keepkey/client.py
Normal file
14
plugins/keepkey/client.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from keepkeylib.client import proto, BaseClient, ProtocolMixin
|
||||
from ..trezor.clientbase import TrezorClientBase
|
||||
|
||||
class KeepKeyClient(TrezorClientBase, ProtocolMixin, BaseClient):
|
||||
def __init__(self, transport, handler, plugin, hid_id):
|
||||
TrezorClientBase.__init__(self, handler, plugin, hid_id, proto)
|
||||
BaseClient.__init__(self, transport)
|
||||
ProtocolMixin.__init__(self, transport)
|
||||
|
||||
def recovery_device(self, *args):
|
||||
ProtocolMixin.recovery_device(self, True, *args)
|
||||
|
||||
|
||||
TrezorClientBase.wrap_methods(KeepKeyClient)
|
||||
@@ -1,4 +1,3 @@
|
||||
from ..trezor.client import trezor_client_class
|
||||
from ..trezor.plugin import TrezorCompatiblePlugin, TrezorCompatibleWallet
|
||||
|
||||
|
||||
@@ -13,8 +12,7 @@ class KeepKeyPlugin(TrezorCompatiblePlugin):
|
||||
minimum_firmware = (1, 0, 0)
|
||||
wallet_class = KeepKeyWallet
|
||||
try:
|
||||
from keepkeylib.client import proto, BaseClient, ProtocolMixin
|
||||
client_class = trezor_client_class(ProtocolMixin, BaseClient, proto)
|
||||
from .client import KeepKeyClient as client_class
|
||||
import keepkeylib.ckd_public as ckd_public
|
||||
from keepkeylib.client import types
|
||||
from keepkeylib.transport_hid import HidTransport, DEVICE_IDS
|
||||
|
||||
Reference in New Issue
Block a user