From a0a7f0672b5890737532e14e66c9056e18371faa Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 24 Oct 2024 12:38:42 +0200 Subject: [PATCH] feat(transport): load protobuf definitions --- packages/transport/src/transports/abstract.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/transport/src/transports/abstract.ts b/packages/transport/src/transports/abstract.ts index b4587a79a23..bd1870a8b5a 100644 --- a/packages/transport/src/transports/abstract.ts +++ b/packages/transport/src/transports/abstract.ts @@ -13,7 +13,7 @@ import { TransportProtocolState, thp as protocolThp, } from '@trezor/protocol'; -import type { MessageFromTrezor as ProtobufMessageType } from '@trezor/protobuf'; +import { MessageFromTrezor as ProtobufMessageType, loadDefinitions } from '@trezor/protobuf'; import { Session, @@ -447,6 +447,10 @@ export abstract class AbstractTransport extends TransportEmitter { this.messages = protobuf.Root.fromJSON(messages); } + public loadMessages(packageName: string, packageLoader: Parameters[2]) { + return loadDefinitions(this.messages, packageName, packageLoader); + } + protected success(payload: T): Success { return success(payload); }