Skip to main content

Class: TransportWalletAPI

Wallet API Transport implementation

Hierarchy

  • default

    TransportWalletAPI

Constructors

constructor

new TransportWalletAPI(walletApi, transportId)

Parameters

NameType
walletApiWalletAPIClient
transportIdstring

Overrides

Transport.constructor

Defined in

packages/client/src/TransportWalletAPI.ts:16

Properties

_appAPIlock

_appAPIlock: null | string

Inherited from

Transport._appAPIlock

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:150


_events

_events: EventEmitter

Inherited from

Transport._events

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:104


deviceModel

deviceModel: undefined | null | DeviceModel

Inherited from

Transport.deviceModel

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:43


exchangeAtomicImpl

exchangeAtomicImpl: (f: () => Promise<void | Buffer>) => Promise<void | Buffer>

Type declaration

▸ (f): Promise<void | Buffer>

Parameters
NameType
f() => Promise<void | Buffer>
Returns

Promise<void | Buffer>

Inherited from

Transport.exchangeAtomicImpl

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:148


exchangeBusyPromise

exchangeBusyPromise: undefined | null | Promise<void>

Inherited from

Transport.exchangeBusyPromise

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:147


exchangeTimeout

exchangeTimeout: number

Inherited from

Transport.exchangeTimeout

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:41


send

send: (cla: number, ins: number, p1: number, p2: number, data?: Buffer, statusList?: number[]) => Promise<Buffer>

Type declaration

▸ (cla, ins, p1, p2, data?, statusList?): Promise<Buffer>

wrapper on top of exchange to simplify work of the implementation.

Parameters
NameTypeDescription
clanumber
insnumber
p1number
p2number
data?Buffer
statusList?number[]is a list of accepted status code (shorts). [0x9000] by default
Returns

Promise<Buffer>

a Promise of response buffer

Inherited from

Transport.send

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:138


transportId

transportId: string

Defined in

packages/client/src/TransportWalletAPI.ts:14


unresponsiveTimeout

unresponsiveTimeout: number

Inherited from

Transport.unresponsiveTimeout

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:42


walletApi

walletApi: WalletAPIClient

Defined in

packages/client/src/TransportWalletAPI.ts:12


ErrorMessage_ListenTimeout

Static ErrorMessage_ListenTimeout: string

Inherited from

Transport.ErrorMessage_ListenTimeout

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:152


ErrorMessage_NoDeviceFound

Static ErrorMessage_NoDeviceFound: string

Inherited from

Transport.ErrorMessage_NoDeviceFound

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:153

Methods

close

close(): Promise<void>

Close the current transport communication.

Throws

RpcError if an error occured on server side

Returns

Promise<void>

Overrides

Transport.close

Defined in

packages/client/src/TransportWalletAPI.ts:79


decorateAppAPIMethod

decorateAppAPIMethod<R, A>(methodName, f, ctx, scrambleKey): (...args: A) => Promise<R>

Type parameters

NameType
RR
Aextends any[]

Parameters

NameType
methodNamestring
f(...args: A) => Promise<R>
ctxany
scrambleKeystring

Returns

fn

▸ (...args): Promise<R>

Parameters
NameType
...argsA
Returns

Promise<R>

Inherited from

Transport.decorateAppAPIMethod

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:151


decorateAppAPIMethods

decorateAppAPIMethods(self, methods, scrambleKey): void

Parameters

NameType
selfRecord<string, any>
methodsstring[]
scrambleKeystring

Returns

void

Inherited from

Transport.decorateAppAPIMethods

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:149


emit

emit(event, ...args): void

Parameters

NameType
eventstring
...argsany

Returns

void

Inherited from

Transport.emit

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:115


exchange

exchange(apdu): Promise<Buffer>

Exchange with the device using APDU protocol.

Throws

RpcError if an error occured on server side

Parameters

NameType
apduBuffer

Returns

Promise<Buffer>

a promise of apdu response

Overrides

Transport.exchange

Defined in

packages/client/src/TransportWalletAPI.ts:55


off

off(eventName, cb): void

Stop listening to an event on an instance of transport.

Parameters

NameType
eventNamestring
cb(...args: any[]) => any

Returns

void

Inherited from

Transport.off

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:114


on

on(eventName, cb): void

Listen to an event on an instance of transport. Transport implementation can have specific events. Here is the common events:

  • "disconnect" : triggered if Transport is disconnected

Parameters

NameType
eventNamestring
cb(...args: any[]) => any

Returns

void

Inherited from

Transport.on

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:110


setDebugMode

setDebugMode(): void

Enable or not logs of the binary exchange

Returns

void

Inherited from

Transport.setDebugMode

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:119


setExchangeTimeout

setExchangeTimeout(exchangeTimeout): void

Set a timeout (in milliseconds) for the exchange call. Only some transport might implement it. (e.g. U2F)

Parameters

NameType
exchangeTimeoutnumber

Returns

void

Inherited from

Transport.setExchangeTimeout

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:123


setExchangeUnresponsiveTimeout

setExchangeUnresponsiveTimeout(unresponsiveTimeout): void

Define the delay before emitting "unresponsive" on an exchange that does not respond

Parameters

NameType
unresponsiveTimeoutnumber

Returns

void

Inherited from

Transport.setExchangeUnresponsiveTimeout

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:127


setScrambleKey

setScrambleKey(): void

Returns

void

Overrides

Transport.setScrambleKey

Defined in

packages/client/src/TransportWalletAPI.ts:72


create

Static create(openTimeout?, listenTimeout?): Promise<default>

create() allows to open the first descriptor available or throw if there is none or if timeout is reached. This is a light helper, alternative to using listen() and open() (that you may need for any more advanced usecase)

Example

TransportFoo.create().then(transport => ...)

Parameters

NameType
openTimeout?number
listenTimeout?number

Returns

Promise<default>

Inherited from

Transport.create

Defined in

node_modules/.pnpm/@ledgerhq+hw-transport@6.27.10/node_modules/@ledgerhq/hw-transport/lib/Transport.d.ts:146


isSupported

Static isSupported(): Promise<boolean>

Check if Wallet API transport is supported.

Returns

Promise<boolean>

Overrides

Transport.isSupported

Defined in

packages/client/src/TransportWalletAPI.ts:25


list

Static list(): Promise<never[]>

This transport is not discoverable

Returns

Promise<never[]>

Overrides

Transport.list

Defined in

packages/client/src/TransportWalletAPI.ts:30


listen

Static listen(_observer): Object

Parameters

NameType
_observerunknown

Returns

Object

NameType
unsubscribe() => void

Overrides

Transport.listen

Defined in

packages/client/src/TransportWalletAPI.ts:32


open

Static open(«destructured»): Promise<default>

Create a Ledger transport with the Wallet API transport

Parameters

NameType
«destructured»Object
› transportIdstring
› walletApiWalletAPIClient

Returns

Promise<default>

Overrides

Transport.open

Defined in

packages/client/src/TransportWalletAPI.ts:39