UNPKG

@radixdlt/hardware-ledger

Version:
61 lines 1.89 kB
/// <reference types="node" /> import { Observable } from 'rxjs'; export declare enum LedgerInstruction { GET_VERSION = 3, GET_APP_NAME = 4, GET_PUBLIC_KEY = 5, DO_SIGN_TX = 6, DO_SIGN_HASH = 7, DO_KEY_EXCHANGE = 8 } export declare enum LedgerResponseCodes { ERR_CMD_SIGN_TX_UNSUPPORTED_INSTRUCTION_TYPE = 50696, ERR_COMMON_BAD_STATE = 57345, ERR_ASSERTION_FAILED = 57346, ERR_FATAL_ERROR = 57347, SW_DENY = 27013, SW_WRONG_P1P2 = 27270, SW_WRONG_DATA_LENGTH = 27271, SW_INS_NOT_SUPPORTED = 27904, SW_CLA_NOT_SUPPORTED = 28160, SW_OK = 36864 } export declare const prettifyLedgerResponseCode: (code: LedgerResponseCodes) => string; export declare type CreateLedgerNanoTransportInput = Readonly<{ openTimeout?: number; listenTimeout?: number; }>; export declare const radixCLA: number; export declare type APDUT = Readonly<{ cla: number; ins: number; p1: number; p2: number; data?: Buffer; requiredResponseStatusCodeFromDevice: LedgerResponseCodes[]; }>; export declare type PartialAPDUT = Omit<APDUT, 'p1' | 'p2' | 'requiredResponseStatusCodeFromDevice'> & Readonly<{ p1?: number; p2?: number; requiredResponseStatusCodeFromDevice?: LedgerResponseCodes[]; }>; export declare type RadixAPDUT = APDUT & Readonly<{ cla: typeof radixCLA; ins: LedgerInstruction; }>; export declare type LedgerNanoT = Readonly<{ sendAPDUToDevice: (apdu: RadixAPDUT) => Observable<Buffer>; }>; export declare type Device = { send: (cla: number, ins: number, p1: number, p2: number, data?: Buffer, statusList?: ReadonlyArray<number>) => Promise<Buffer>; device: { getDeviceInfo: () => void; }; }; export declare type ConnectionEvent = { type: 'add' | 'remove'; descriptor: string; deviceModel: string; device: any; }; //# sourceMappingURL=_types.d.ts.map