How to use the @ledgerhq/hw-transport.open function in @ledgerhq/hw-transport

To help you get started, we’ve selected a few @ledgerhq/hw-transport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / ledgerhq__hw-transport / ledgerhq__hw-transport-tests.ts View on Github external
import Transport from '@ledgerhq/hw-transport';

// $ExpectType Promise
Transport.isSupported();
// $ExpectType Promise>
Transport.list();
// $ExpectType Promise>
Transport.open('test');

const test = Transport.open('test').then(transport => {
    // $ExpectType void
    transport.setScrambleKey('test');

    // $ExpectType Promise
    transport.exchange(Buffer.from('test', 'hex'));

    // $ExpectType Promise
    transport.send(0, 1, 2, 3);
    // $ExpectType Promise
    transport.send(0, 1, 2, 3, Buffer.from('abcd', 'hex'));
    // $ExpectType Promise
    transport.send(0, 1, 2, 3, Buffer.from('abcd', 'hex'), [0x1111, 0x9000]);

    // $ExpectType Promise
github DefinitelyTyped / DefinitelyTyped / types / ledgerhq__hw-transport / ledgerhq__hw-transport-tests.ts View on Github external
import Transport from '@ledgerhq/hw-transport';

// $ExpectType Promise
Transport.isSupported();
// $ExpectType Promise>
Transport.list();
// $ExpectType Promise>
Transport.open('test');

const test = Transport.open('test').then(transport => {
    // $ExpectType void
    transport.setScrambleKey('test');

    // $ExpectType Promise
    transport.exchange(Buffer.from('test', 'hex'));

    // $ExpectType Promise
    transport.send(0, 1, 2, 3);
    // $ExpectType Promise
    transport.send(0, 1, 2, 3, Buffer.from('abcd', 'hex'));
    // $ExpectType Promise
    transport.send(0, 1, 2, 3, Buffer.from('abcd', 'hex'), [0x1111, 0x9000]);

    // $ExpectType Promise
    transport.close();
});