@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
24 lines (20 loc) • 713 B
text/typescript
import {
getDelegateEvents,
getDeviceLabels,
getSpeculosModel,
pressBoth,
pressUntilTextFound,
} from "../speculos";
import { Delegate } from "../models/Delegate";
import { DeviceModelId } from "@ledgerhq/types-devices";
import { DeviceLabels } from "../enum/DeviceLabels";
export async function delegateTezos(delegatingAccount: Delegate) {
const { delegateConfirmLabel } = getDeviceLabels(delegatingAccount.account.currency.speculosApp);
await getDelegateEvents(delegatingAccount);
await pressUntilTextFound(delegateConfirmLabel);
await pressBoth();
if (getSpeculosModel() == DeviceModelId.nanoS) {
await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND);
await pressBoth();
}
}