import Transport from '@ledgerhq/hw-transport';
import BaseApp, { INSGeneric, BIP32Path } from '@zondax/ledger-js';

/** ******************************************************************************
 *  (c) 2019-2025 Zondax AG
 *
 *  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.
 ******************************************************************************* */

interface EthAddress {
    publicKey: string;
    address: string;
    chainCode?: string;
}
interface EthSignature {
    v: string;
    r: string;
    s: string;
}

interface ResponseAddress {
    compressed_pk: Buffer;
    addrByte: Buffer;
    addrString: string;
}
interface ResponseSign {
    signature_compact: Buffer;
    signature_der: Buffer;
}

/** ******************************************************************************
 *  (c) 2019-2025 Zondax AG
 *
 *  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.
 ******************************************************************************* */

declare class FilecoinApp extends BaseApp {
    static _INS: {
        GET_VERSION: number;
        GET_ADDR_SECP256K1: number;
        SIGN_SECP256K1: number;
        SIGN_RAW_BYTES: number;
        SIGN_PERSONAL_MESSAGE: number;
    };
    static _params: {
        cla: number;
        ins: INSGeneric;
        p1Values: {
            ONLY_RETRIEVE: 0;
            SHOW_ADDRESS_IN_DEVICE: 1;
        };
        chunkSize: number;
        requiredPathLengths: number[];
    };
    constructor(transport: Transport);
    private parseAddressResponse;
    getAddressAndPubKey(path: string): Promise<ResponseAddress>;
    showAddressAndPubKey(path: string): Promise<ResponseAddress>;
    private _sign;
    sign(path: BIP32Path, blob: Buffer): Promise<ResponseSign>;
    signRawBytes(path: BIP32Path, message: Buffer): Promise<ResponseSign>;
    signPersonalMessageFVM(path: BIP32Path, messageHex: Buffer): Promise<ResponseSign>;
    signETHTransaction(path: BIP32Path, rawTxHex: string, resolution?: null): Promise<EthSignature>;
    getETHAddress(path: BIP32Path, boolDisplay?: boolean, boolChaincode?: boolean): Promise<EthAddress>;
    signPersonalMessageEVM(path: BIP32Path, messageHex: string): Promise<EthSignature>;
}

declare enum P1_VALUES {
    ONLY_RETRIEVE = 0,
    SHOW_ADDRESS_IN_DEVICE = 1
}
declare const PUBKEYLEN = 65;

export { FilecoinApp, P1_VALUES, PUBKEYLEN };
export type { ResponseAddress, ResponseSign };
