UNPKG

@zondax/ledger-lisk

Version:

Node API for the Lisk App (Ledger Nano S/X/S+)

76 lines (75 loc) 2.97 kB
/// <reference types="node" /> /** ****************************************************************************** * (c) 2018 - 2022 Zondax AG * (c) 2016-2017 Ledger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* */ import type Transport from "@ledgerhq/hw-transport"; import { type ResponseMultipleAddresses, type ResponseAddress, type ResponseAppInfo, type ResponseDeviceInfo, type ResponseSign, type ResponseVersion } from "./types"; import { LedgerError } from "./common"; import { INS } from "./config"; export { LedgerError }; export * from "./types"; export declare class LiskApp { private readonly transport; constructor(transport: Transport); static prepareChunks(serializedPathBuffer: Buffer, message: Buffer): Buffer[]; signGetChunks(path: string, message: Buffer): Promise<Buffer[]>; getVersion(): Promise<ResponseVersion>; getAppInfo(): Promise<ResponseAppInfo>; deviceInfo(): Promise<ResponseDeviceInfo>; getAddressAndPubKey(path: string): Promise<ResponseAddress>; getMultipleAddresses(indexes: number[]): Promise<ResponseMultipleAddresses>; showAddressAndPubKey(path: string): Promise<ResponseAddress>; signSendChunk(chunkIdx: number, chunkNum: number, chunk: Buffer, ins: INS): Promise<ResponseSign>; private signImpl; sign(path: string, message: Buffer): Promise<any>; signMessage(path: string, message: Buffer): Promise<any>; claimMessage(path: string, message: Buffer): Promise<any>; } /** * Class to specify An account used to query the ledger. */ declare enum SupportedCoin { /** * @see https://lisk.io */ LISK = 134 } export declare class LedgerAccount { private _account; private _coinIndex; /** * Specify the account number * @param {number} newAccount * @returns {this} */ account(newAccount: number): this; /** * Specify the coin index. At the moment will force alwais Lisk. * @see https://github.com/satoshilabs/slips/blob/master/slip-0044.md * @param {number} newIndex * @returns {this} */ coinIndex(newIndex: SupportedCoin): this; /** * Derive the path using hardened entries. * @returns {string} defines the path in buffer form. */ derivePath(): string; /** * Asserts that the given param is a valid path (integer > 0) */ private assertValidPath; }