Skip to content

LedgerFilecoin

Defined in: packages/iso-filecoin/src/ledger.js:268

Ledger Filecoin app client

Constructors

Constructor

new LedgerFilecoin(transport: Transport): LedgerFilecoin;

Defined in: packages/iso-filecoin/src/ledger.js:273

Parameters

ParameterTypeDescription
transportTransportLedger transport

Returns

LedgerFilecoin

Methods

close()

close(): Promise<void>;

Defined in: packages/iso-filecoin/src/ledger.js:406

Close the transport

Returns

Promise<void>


getAddress()

getAddress(path: string, showOnDevice?: boolean): Promise<IAccount>;

Defined in: packages/iso-filecoin/src/ledger.js:323

Get the secp256k1 address for a given derivation path

Parameters

ParameterTypeDefault valueDescription
pathstringundefinedDerivation path
showOnDevice?booleanfalseWhether to show the address on the device

Returns

Promise<IAccount>

See

https://github.com/LedgerHQ/app-filecoin/blob/develop/docs/APDUSPEC.md#ins_get_addr_secp256k1


getVersion()

getVersion(): Promise<string>;

Defined in: packages/iso-filecoin/src/ledger.js:297

Get the version of the Filecoin app

Returns

Promise<string>

See

https://github.com/LedgerHQ/app-filecoin/blob/develop/docs/APDUSPEC.md#get_version

Example

import {
class LedgerFilecoin

Ledger Filecoin app client

LedgerFilecoin
} from 'iso-filecoin/ledger'
import
class TransportWebUSB

WebUSB Transport implementation

@example import TransportWebUSB from "@ledgerhq/hw-transport-webusb"; ... TransportWebUSB.create().then(transport => ...)

TransportWebUSB
from '@ledgerhq/hw-transport-webusb'
const
const transport: Transport
transport
= await
class TransportWebUSB

WebUSB Transport implementation

@example import TransportWebUSB from "@ledgerhq/hw-transport-webusb"; ... TransportWebUSB.create().then(transport => ...)

TransportWebUSB
.
Transport.create(openTimeout?: number, listenTimeout?: number): Promise<Transport>

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 => ...)

create
()
const
const ledger: LedgerFilecoin
ledger
= new
new LedgerFilecoin(transport: Transport): LedgerFilecoin

@paramtransport - Ledger transport

LedgerFilecoin
(
const transport: Transport
transport
)
const
const version: string
version
= await
const ledger: LedgerFilecoin
ledger
.
LedgerFilecoin.getVersion(): Promise<string>

Get the version of the Filecoin app

@seehttps://github.com/LedgerHQ/app-filecoin/blob/develop/docs/APDUSPEC.md#get_version

@example

import { LedgerFilecoin } from 'iso-filecoin/ledger'
import TransportWebUSB from '@ledgerhq/hw-transport-webusb'
const transport = await TransportWebUSB.create()
const ledger = new LedgerFilecoin(transport)
const version = await ledger.getVersion()
// => '1.0.0'

getVersion
()
// => '1.0.0'

sign()

sign(
path: string,
message: Uint8Array<ArrayBufferLike>,
type?: "SECP256K1" | "DATA_CAP" | "CLIENT_DEAL" | "RAW_BYTES"): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: packages/iso-filecoin/src/ledger.js:358

Sign a message

Parameters

ParameterTypeDefault valueDescription
pathstringundefinedDerivation path
messageUint8Array<ArrayBufferLike>undefinedMessage to sign in bytes
type?"SECP256K1" | "DATA_CAP" | "CLIENT_DEAL" | "RAW_BYTES"'SECP256K1'Signature type

Returns

Promise<Uint8Array<ArrayBufferLike>>


signRaw()

signRaw(path: string, message: Uint8Array<ArrayBufferLike>): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: packages/iso-filecoin/src/ledger.js:395

Sign raw bytes using prefixed message similar to EIP-191

Parameters

ParameterTypeDescription
pathstringDerivation path
messageUint8Array<ArrayBufferLike>Message to sign

Returns

Promise<Uint8Array<ArrayBufferLike>>

Properties

transport

transport: Transport;

Defined in: packages/iso-filecoin/src/ledger.js:274