UNPKG

@zondax/ledger-substrate

Version:

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

102 lines (101 loc) 4.92 kB
/** ****************************************************************************** * (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. ******************************************************************************* */ import Transport from '@ledgerhq/hw-transport'; import { ISubstrateAppLegacy, ResponseAddress, ResponseSign, ResponseVersion, SCHEME, TransactionBlob } from './common'; import { PolkadotGenericApp } from './generic_app'; /** * Class representing a legacy Polkadot generic application. * Implements the ISubstrateAppLegacy interface. * @deprecated Use PolkadotGenericApp from generic_app.ts instead. */ export declare class PolkadotGenericAppLegacy implements ISubstrateAppLegacy { genericApp: PolkadotGenericApp; ss58prefix: number; /** * Constructs a new PolkadotGenericAppLegacy instance. * @param transport - The transport instance. * @param ss58prefix - The SS58 prefix. * @param txMetadataChainId - The chain ID in the transaction metadata service. * @param txMetadataSrvUrl - The optional transaction metadata service URL. * @deprecated Use PolkadotGenericApp constructor from generic_app.ts instead. */ constructor(transport: Transport, ss58prefix: number, txMetadataChainId: string, txMetadataSrvUrl: string | undefined); /** * Converts a ResponseError to a legacy ResponseBase format. * @param e - The ResponseError instance. * @returns The legacy ResponseBase object. * @deprecated */ private convertToLegacyError; /** * Converts account, change, and addressIndex to a BIP32Path. * @param account - The account number. * @param change - The change number. * @param addressIndex - The address index. * @returns The BIP32Path. * @deprecated */ private convertLegacyPath; /** * Retrieves the version of the application. * @returns A promise that resolves to a ResponseVersion object. * @deprecated Use getVersion method from PolkadotGenericApp in generic_app.ts instead. */ getVersion(): Promise<ResponseVersion>; /** * Retrieves application information. * @returns A promise that resolves to an object containing application information. * @deprecated Use appInfo method from PolkadotGenericApp in generic_app.ts instead. */ appInfo(): Promise<any>; /** * Retrieves the address for a given account, change, and address index. * @param account - The account number. * @param change - The change number. * @param addressIndex - The address index. * @param requireConfirmation - Whether to require confirmation on the device. * @param scheme - The cryptographic scheme. * @returns A promise that resolves to a ResponseAddress object. * @throws {ResponseError} If the scheme is not supported. * @deprecated Use getAddress method from PolkadotGenericApp in generic_app.ts instead. */ getAddress(account: number, change: number, addressIndex: number, requireConfirmation?: boolean, scheme?: SCHEME): Promise<ResponseAddress>; /** * Signs a transaction blob. * @param account - The account number. * @param change - The change number. * @param addressIndex - The address index. * @param message - The transaction blob. * @param scheme - The cryptographic scheme. * @returns A promise that resolves to a ResponseSign object. * @throws {ResponseError} If the scheme is not supported. * @deprecated Use sign method from PolkadotGenericApp in generic_app.ts instead. */ sign(account: number, change: number, addressIndex: number, message: TransactionBlob, scheme?: SCHEME): Promise<ResponseSign>; /** * Signs a raw transaction blob. * @param account - The account number. * @param change - The change number. * @param addressIndex - The address index. * @param message - The transaction blob. * @param scheme - The cryptographic scheme. * @returns A promise that resolves to a ResponseSign object. * @throws {ResponseError} If the scheme is not supported. * @deprecated Use signRaw method from PolkadotGenericApp in generic_app.ts instead. */ signRaw(account: number, change: number, addressIndex: number, message: TransactionBlob, scheme?: SCHEME): Promise<ResponseSign>; }