@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
72 lines • 3.43 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { SpeculosTransport } from "../load/speculos";
import { DeviceModelId } from "@ledgerhq/devices";
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
import { Account } from "./enum/Account";
import { NFTTransaction, Transaction } from "./models/Transaction";
import { Delegate } from "./models/Delegate";
import { Swap } from "./models/Swap";
import { AppInfos } from "./enum/AppInfos";
export type Spec = {
currency?: CryptoCurrency;
appQuery: {
model: DeviceModelId;
appName: string;
};
/** @deprecated */
dependency?: string;
dependencies?: Dependency[];
onSpeculosDeviceCreated?: (device: Device) => Promise<void>;
};
export type Dependency = {
name: string;
appVersion?: string;
};
export type SpeculosDevice = {
id: string;
port: number;
};
export declare function setExchangeDependencies(dependencies: Dependency[]): void;
export declare function getSpeculosModel(): DeviceModelId.nanoS | DeviceModelId.nanoSP | DeviceModelId.nanoX;
type Specs = {
[key: string]: Spec;
};
export type Device = {
transport: SpeculosTransport;
id: string;
appPath: string;
};
export declare const specs: Specs;
export declare function startSpeculos(testName: string, spec: Specs[keyof Specs]): Promise<SpeculosDevice | undefined>;
export declare function stopSpeculos(deviceId: string | undefined): Promise<void>;
export declare function waitFor(text: string, maxAttempts?: number): Promise<string>;
export declare function pressBoth(): Promise<void>;
export declare function pressUntilTextFound(targetText: string, strictMatch?: boolean): Promise<string[]>;
export declare function pressRightButton(): Promise<void>;
export declare function containsSubstringInEvent(targetString: string, events: string[]): boolean;
export declare function takeScreenshot(port?: number): Promise<Buffer | undefined>;
export declare function waitForTimeOut(ms: number): Promise<unknown>;
export declare function removeMemberLedgerSync(): Promise<void>;
export declare function activateLedgerSync(): Promise<void>;
export declare function activateExpertMode(): Promise<void>;
export declare function activateContractData(): Promise<void>;
export declare function goToSettings(): Promise<void>;
export declare function providePublicKey(): Promise<void>;
type DeviceLabelsReturn = {
delegateConfirmLabel: string;
delegateVerifyLabel: string;
receiveConfirmLabel: string;
receiveVerifyLabel: string;
};
export declare function getDeviceLabels(appInfo: AppInfos): DeviceLabelsReturn;
export declare function expectValidAddressDevice(account: Account, addressDisplayed: string): Promise<void>;
export declare function signSendTransaction(tx: Transaction): Promise<void>;
export declare function signSendNFTTransaction(tx: NFTTransaction): Promise<void>;
export declare function signDelegationTransaction(delegatingAccount: Delegate): Promise<void>;
export declare function getDelegateEvents(delegatingAccount: Delegate): Promise<string[]>;
export declare function verifyAmountsAndAcceptSwap(swap: Swap, amount: string): Promise<void>;
export declare function verifyAmountsAndAcceptSwapForDifferentSeed(swap: Swap, amount: string): Promise<void>;
export declare function verifyAmountsAndRejectSwap(swap: Swap, amount: string): Promise<void>;
export {};
//# sourceMappingURL=speculos.d.ts.map