@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
22 lines (18 loc) • 712 B
text/typescript
import { getSendEvents } from "../speculos";
import { isTouchDevice } from "../speculosAppVersion";
import { DeviceLabels } from "../enum/DeviceLabels";
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
import { Transaction } from "../models/Transaction";
import { withDeviceController } from "../deviceInteraction/DeviceController";
export const sendSui = withDeviceController(
({ getButtonsController }) =>
async (tx: Transaction) => {
const buttons = getButtonsController();
await getSendEvents(tx);
if (isTouchDevice()) {
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
} else {
await buttons.both();
}
},
);