UNPKG

@citadeldao/hw-app-alamgu

Version:

Common ledgerJS routines for Alamgu apps

79 lines 3.31 kB
/// <reference types="node" /> /******************************************************************************** * Ledger Node JS API * (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"; export type GetPublicKeyResult = { publicKey: Uint8Array; address: Uint8Array | null; }; export type SignTransactionResult = { signature: Uint8Array; }; export type GetVersionResult = { major: number; minor: number; patch: number; }; /** * Common API for ledger apps * * @example * import Kadena from "hw-app-kda"; * const kda = new Kadena(transport) */ export declare class Common { transport: Transport; appName: string | null; verbose: boolean | null; constructor(transport: Transport, scrambleKey: string, appName?: string | null, verbosity?: boolean | null); /** * Retrieves the public key associated with a particular BIP32 path from the ledger app. * * @param path - the path to retrieve. */ getPublicKey(path: string): Promise<GetPublicKeyResult>; /** * Sign a transaction with the key at a BIP32 path. * * @param txn - The transaction; this can be any of a node Buffer, Uint8Array, or a hexadecimal string, encoding the form of the transaction appropriate for hashing and signing. * @param path - the path to use when signing the transaction. */ signTransaction(path: string, txn: string | Buffer | Uint8Array): Promise<SignTransactionResult>; /** * Retrieve the app version on the attached ledger device. * @alpha TODO this doesn't exist yet */ getVersion(): Promise<GetVersionResult>; /** * Send a raw payload as chunks to a particular APDU instruction. * * @remarks * * This is intended to be used to implement a more useful API in this class and subclasses of it, not for end use. */ sendChunks(cla: number, ins: number, p1: number, p2: number, payload: Buffer | Buffer[]): Promise<Buffer>; /** * Convert a raw payload into what is essentially a singly-linked list of chunks, which allows the ledger to re-seek the data in a secure fashion. */ sendWithBlocks(cla: number, ins: number, p1: number, p2: number, payload: Buffer | Buffer[], extraData?: Map<String, Buffer>): Promise<Buffer>; handleBlocksProtocol(cla: number, ins: number, p1: number, p2: number, initialPayload: Buffer, data: Map<String, Buffer>): Promise<Buffer>; log(...args: any[]): void; } export declare function buildBip32KeyPayload(path: string): Buffer; export declare function splitPath(path: string): number[]; //# sourceMappingURL=Common.d.ts.map