@types/ledgerhq__hw-transport
TypeScript icon, indicating that this package has built-in type declarations

4.21.8 • Public • Published

Installation

npm install --save @types/ledgerhq__hw-transport

Summary

This package contains type definitions for @ledgerhq/hw-transport (https://github.com/LedgerHQ/ledgerjs/tree/master/packages/hw-transport).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ledgerhq__hw-transport.

index.d.ts

/// <reference types="node" />

declare class Transport<TDescriptor extends Descriptor = string> {
    constructor();
    static isSupported(): Promise<boolean>;
    static list(): Promise<readonly Descriptor[]>;
    static listen(observer: Observer<DescriptorEvent<Descriptor>>): Subscription;
    static open(descriptor: Descriptor, timeout?: number): Promise<Transport<typeof descriptor>>;
    static create(openTimeout?: number, listenTimeout?: number): Promise<Transport<Descriptor>>;
    exchange(apdu: Buffer): Promise<Buffer>;
    setScrambleKey(key: string): void;
    close(): Promise<void>;
    on(eventName: string, cb: any): void;
    off(eventName: string, cb: any): void;
    setDebugMode(debug: boolean | ((log: string) => void)): void;
    setExchangeTimeout(exchangeTimeout: number): void;
    /**
     * A wrapper around exchange to simplify work of the implementation.
     * @param data The data to be sent. Defaults to a zero-length Buffer.
     * @param statusList A list of accepted status code (shorts). [0x9000] by default.
     * @return A Promise of the response Buffer
     */
    send(
        cla: number,
        ins: number,
        p1: number,
        p2: number,
        data?: Buffer,
        statusList?: readonly number[],
    ): Promise<Buffer>;
    decorateAppAPIMethods(self: any, methods: string[], scrambleKey: string): void;
}

export type Device = any;
export type Descriptor = string; // ?
export interface DescriptorEvent<Descriptor> {
    type: "add" | "remove";
    descriptor: Descriptor;
    device?: Device | undefined;
}
export interface Observer<Ev> {
    readonly next: (event: Ev) => any;
    readonly error: (e: any) => any;
    readonly complete: () => any;
}
export interface Subscription {
    readonly unsubscribe: () => void;
}
export function getAltStatusMessage(code: number): string;
export const StatusCodes: { [k in string]: number };

export default Transport;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Daniel Byrne.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/ledgerhq__hw-transport

Weekly Downloads

10,752

Version

4.21.8

License

MIT

Unpacked Size

6.61 kB

Total Files

5

Last publish

Collaborators

  • types