2025-06-21 23:30:33 +03:00

22 lines
1.2 KiB
TypeScript

import { decodeMessage } from '@trezor/protobuf';
import type { TransportProtocol } from '@trezor/protocol';
import { AbstractApi } from '../api/abstract';
export declare function receive<T extends () => ReturnType<AbstractApi['read']>>(receiver: T, protocol: TransportProtocol): Promise<{
success: false;
error: "Unable to open device" | "A transfer error has occurred." | "device not found" | "device disconnected during action" | "unexpected error" | "Aborted by signal" | "Aborted by timeout";
message?: string;
} | import("../types").Success<{
messageType: string | number;
payload: Buffer;
}>>;
export declare function receiveAndParse<T extends () => ReturnType<AbstractApi['read']>>(messages: Parameters<typeof decodeMessage>[0], receiver: T, protocol: TransportProtocol): Promise<{
success: false;
error: "Unable to open device" | "A transfer error has occurred." | "device not found" | "device disconnected during action" | "unexpected error" | "Aborted by signal" | "Aborted by timeout";
message?: string;
} | import("../types").Success<{
message: {
[key: string]: any;
};
type: keyof import("@trezor/protobuf/lib/messages").MessageType;
}>>;
//# sourceMappingURL=receive.d.ts.map