UNPKG

@zondax/ledger-substrate

Version:

TS / Node API for Substrate/Polkadot based apps running on Ledger devices

166 lines (165 loc) 4.51 kB
import type Transport from '@ledgerhq/hw-transport'; /** ****************************************************************************** * (c) 2019 - 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. ******************************************************************************* */ export type TransactionMetadataBlob = Buffer; export type TransactionBlob = Buffer; export type SS58Prefix = number; /** * @deprecated Moved to @zondax/ledger-js */ export declare const CHUNK_SIZE = 250; export declare const enum INS { GET_VERSION = 0, GET_ADDR = 1, SIGN = 2, SIGN_RAW = 3, /** * @deprecated */ ALLOWLIST_GET_PUBKEY = 144, /** * @deprecated */ ALLOWLIST_SET_PUBKEY = 145, /** * @deprecated */ ALLOWLIST_GET_HASH = 146, /** * @deprecated */ ALLOWLIST_UPLOAD = 147 } export type INS_SIGN = INS.SIGN | INS.SIGN_RAW; /** * Address lengths for different schemes */ export declare const ED25519_PUBKEY_LEN = 32; export declare const ECDSA_PUBKEY_LEN = 33; /** * @deprecated Moved to @zondax/ledger-js */ export declare const enum PAYLOAD_TYPE { INIT = 0, ADD = 1, LAST = 2 } export declare const enum P1_VALUES { ONLY_RETRIEVE = 0, SHOW_ADDRESS_IN_DEVICE = 1 } export declare const enum SCHEME { ED25519 = 0, /** * @deprecated This is deprecated and will be removed in future versions. */ SR25519 = 1, ECDSA = 2 } export declare const enum ERROR_CODE { NoError = 36864, InvalidData = 27012 } /** * @deprecated Moved to @zondax/ledger-js */ export declare const ERROR_DESCRIPTION: Record<number, string>; /** * @deprecated */ export interface SubstrateAppParams { name: string; cla: number; slip0044: number; ss58_addr_type: number; } /** * @deprecated */ export interface ResponseBase { error_message: string; return_code: number; } /** * @deprecated */ export interface ResponseAddress extends ResponseBase { address: string; pubKey: string; } export interface GenericeResponseAddress { address: string; pubKey: string; } /** * @deprecated */ export interface ResponseVersion extends ResponseBase { device_locked: boolean; major: number; minor: number; patch: number; test_mode: boolean; } /** * @deprecated */ export interface ResponseAllowlistPubKey extends ResponseBase { pubKey: string; } /** * @deprecated */ export interface ResponseAllowlistHash extends ResponseBase { hash: Buffer; } /** * @deprecated */ export interface ResponseSign extends ResponseBase { signature: Buffer; } export interface GenericResponseSign { signature: Buffer; } /** * @deprecated Moved to @zondax/ledger-js */ export declare function errorCodeToString(statusCode: number): string; /** * @deprecated Moved to @zondax/ledger-js */ export declare function processErrorResponse(response: any): any; export declare function getVersion(transport: Transport, cla: number): Promise<any>; /** * @deprecated This function is deprecated and will be removed in future versions. */ export declare function serializePath(slip0044: number, account: number, change: number, addressIndex: number): Buffer<ArrayBuffer>; /** * @deprecated This interface has been extracted from the legacy implementation * it is to ensure backwards compatibility with the old implementation */ export interface ISubstrateAppLegacy { getVersion(): Promise<ResponseVersion>; appInfo(): Promise<any>; getAddress(account: number, change: number, addressIndex: number, requireConfirmation?: boolean, scheme?: SCHEME): Promise<ResponseAddress>; sign(account: number, change: number, addressIndex: number, message: Buffer, scheme?: SCHEME): Promise<ResponseSign>; signRaw(account: number, change: number, addressIndex: number, message: Buffer, scheme?: SCHEME): Promise<ResponseSign>; } export interface TxMetadata { txMetadata: string; }