Skip to content

Commit

Permalink
feat(transport): load protobuf definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonlesisz committed Oct 24, 2024
1 parent de37729 commit a0a7f06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/transport/src/transports/abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -447,6 +447,10 @@ export abstract class AbstractTransport extends TransportEmitter {
this.messages = protobuf.Root.fromJSON(messages);
}

public loadMessages(packageName: string, packageLoader: Parameters<typeof loadDefinitions>[2]) {
return loadDefinitions(this.messages, packageName, packageLoader);
}

protected success<T>(payload: T): Success<T> {
return success(payload);
}
Expand Down

0 comments on commit a0a7f06

Please sign in to comment.