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
Parameter | Type | Description |
---|---|---|
transport | Transport | Ledger 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
Parameter | Type | Default value | Description |
---|---|---|---|
path | string | undefined | Derivation path |
showOnDevice ? | boolean | false | Whether to show the address on the device |
Returns
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
TransportWebUSB from '@ledgerhq/hw-transport-webusb'
const const transport: Transport
transport = await class TransportWebUSB
WebUSB Transport implementation
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)
create()const const ledger: LedgerFilecoin
ledger = new new LedgerFilecoin(transport: Transport): LedgerFilecoin
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
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
Parameter | Type | Default value | Description |
---|---|---|---|
path | string | undefined | Derivation path |
message | Uint8Array <ArrayBufferLike > | undefined | Message 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
Parameter | Type | Description |
---|---|---|
path | string | Derivation path |
message | Uint8Array <ArrayBufferLike > | Message to sign |
Returns
Promise
<Uint8Array
<ArrayBufferLike
>>
Properties
transport
transport: Transport;
Defined in: packages/iso-filecoin/src/ledger.js:274