UNPKG

@zondax/ledger-mina-js

Version:

Node API for the Mina App (Ledger Nano S, S+, X, Stax and Flex)

81 lines (80 loc) 3.02 kB
/** ****************************************************************************** * (c) 2019-2024 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. ******************************************************************************* */ import type Transport from "@ledgerhq/hw-transport"; import BaseApp, { INSGeneric } from "@zondax/ledger-js"; interface SignTransactionArgs { txType: number; senderAccount: number; senderAddress: string; receiverAddress: string; amount: number; fee: number; nonce: number; validUntil?: number; memo?: string; networkId: number; } interface BaseLedgerResponse { returnCode: string; statusText?: string; message?: string; } interface GetAppVersionResponse extends BaseLedgerResponse { version?: string | null; } interface GetAddressResponse extends BaseLedgerResponse { publicKey?: string | null; } interface GetAppNameResponse extends BaseLedgerResponse { name?: string; version?: string | null; } interface SignTransactionResponse extends BaseLedgerResponse { signature?: string | null; } interface SignMessageResponse extends BaseLedgerResponse { field: string | null; scalar: string | null; raw_signature?: string | null; signed_message?: string | null; } export declare class MinaApp extends BaseApp { static _INS: { GET_VERSION: number; GET_ADDR: number; SIGN_TX: number; TEST_CRYPTO: number; SIGN_MSG: number; }; static _params: { cla: number; ins: INSGeneric; p1Values: { ONLY_RETRIEVE: 0; SHOW_ADDRESS_IN_DEVICE: 1; }; chunkSize: number; requiredPathLengths: number[]; }; constructor(transport: Transport); getAppName(): Promise<GetAppNameResponse>; getAppVersion(): Promise<GetAppVersionResponse>; getAddress(account?: number, showAddrInDevice?: boolean): Promise<GetAddressResponse>; signTransaction({ txType, senderAccount, senderAddress, receiverAddress, amount, fee, nonce, validUntil, memo, networkId, }: SignTransactionArgs): Promise<SignTransactionResponse>; signMessage(account: number, networkId: number, message: string): Promise<SignMessageResponse>; createTXApdu(txType: number, senderAccount: number, senderAddress: string, receiverAddress: string, amount: number, fee: number, nonce: number, validUntil: number | undefined, memo: string | undefined, networkId: number): string; } export {};