2016-09-21 12:24:12 +00:00
|
|
|
from trezor.wire import register_type, protobuf_handler
|
|
|
|
from trezor.utils import unimport
|
|
|
|
from trezor.messages.wire_types import \
|
2016-11-18 13:19:03 +00:00
|
|
|
GetPublicKey, GetAddress, SignTx, EstimateTxSize, \
|
|
|
|
SignMessage, VerifyMessage, \
|
|
|
|
SignIdentity
|
2016-05-25 12:27:22 +00:00
|
|
|
|
|
|
|
|
2016-09-21 12:24:12 +00:00
|
|
|
@unimport
|
|
|
|
def dispatch_GetPublicKey(*args, **kwargs):
|
2016-05-31 11:55:23 +00:00
|
|
|
from .layout_get_public_key import layout_get_public_key
|
2016-09-21 12:24:12 +00:00
|
|
|
return layout_get_public_key(*args, **kwargs)
|
2016-06-09 14:06:37 +00:00
|
|
|
|
|
|
|
|
2016-10-20 13:04:29 +00:00
|
|
|
@unimport
|
|
|
|
def dispatch_GetAddress(*args, **kwargs):
|
|
|
|
from .layout_get_address import layout_get_address
|
|
|
|
return layout_get_address(*args, **kwargs)
|
|
|
|
|
|
|
|
|
2016-11-11 10:27:10 +00:00
|
|
|
@unimport
|
|
|
|
def dispatch_SignTx(*args, **kwargs):
|
|
|
|
from .layout_sign_tx import layout_sign_tx
|
|
|
|
return layout_sign_tx(*args, **kwargs)
|
|
|
|
|
|
|
|
|
2016-11-15 17:29:46 +00:00
|
|
|
@unimport
|
|
|
|
async def dispatch_EstimateTxSize(msg, session_id):
|
|
|
|
from trezor.messages.TxSize import TxSize
|
2016-11-16 00:21:25 +00:00
|
|
|
from ..common.signtx import estimate_tx_size
|
2016-11-15 17:29:46 +00:00
|
|
|
m = TxSize()
|
2016-11-16 00:21:25 +00:00
|
|
|
m.tx_size = estimate_tx_size(msg.inputs_count, msg.outputs_count)
|
2016-11-15 17:29:46 +00:00
|
|
|
return m
|
|
|
|
|
|
|
|
|
2016-09-21 12:24:12 +00:00
|
|
|
@unimport
|
|
|
|
def dispatch_SignMessage(*args, **kwargs):
|
2016-06-09 15:34:43 +00:00
|
|
|
from .layout_sign_message import layout_sign_message
|
2016-09-21 12:24:12 +00:00
|
|
|
return layout_sign_message(*args, **kwargs)
|
2016-06-09 15:34:43 +00:00
|
|
|
|
|
|
|
|
2016-11-16 21:55:11 +00:00
|
|
|
@unimport
|
|
|
|
def dispatch_VerifyMessage(*args, **kwargs):
|
|
|
|
from .layout_verify_message import layout_verify_message
|
|
|
|
return layout_verify_message(*args, **kwargs)
|
|
|
|
|
|
|
|
|
2016-11-18 13:19:03 +00:00
|
|
|
@unimport
|
|
|
|
def dispatch_SignIdentity(*args, **kwargs):
|
|
|
|
from .layout_sign_identity import layout_sign_identity
|
|
|
|
return layout_sign_identity(*args, **kwargs)
|
|
|
|
|
|
|
|
|
2016-05-25 12:27:22 +00:00
|
|
|
def boot():
|
2016-09-21 12:24:12 +00:00
|
|
|
register_type(GetPublicKey, protobuf_handler, dispatch_GetPublicKey)
|
2016-10-20 13:04:29 +00:00
|
|
|
register_type(GetAddress, protobuf_handler, dispatch_GetAddress)
|
2016-11-11 10:27:10 +00:00
|
|
|
register_type(SignTx, protobuf_handler, dispatch_SignTx)
|
2016-11-15 17:29:46 +00:00
|
|
|
register_type(EstimateTxSize, protobuf_handler, dispatch_EstimateTxSize)
|
2016-09-21 12:24:12 +00:00
|
|
|
register_type(SignMessage, protobuf_handler, dispatch_SignMessage)
|
2016-11-16 21:55:11 +00:00
|
|
|
register_type(VerifyMessage, protobuf_handler, dispatch_VerifyMessage)
|
2016-11-18 13:19:03 +00:00
|
|
|
register_type(SignIdentity, protobuf_handler, dispatch_SignIdentity)
|