@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
24 lines • 1.08 kB
JavaScript
import expect from "expect";
import { containsSubstringInEvent, getSendEvents } from "../speculos";
import { isTouchDevice } from "../speculosAppVersion";
import { DeviceLabels } from "../enum/DeviceLabels";
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
import { withDeviceController } from "../deviceInteraction/DeviceController";
export const sendStellar = withDeviceController(({ getButtonsController }) => async (tx) => {
const buttons = getButtonsController();
const events = await getSendEvents(tx);
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
expect(isAmountCorrect).toBeTruthy();
if (!tx.accountToCredit.address) {
throw new Error("Recipient address is not set");
}
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
expect(isAddressCorrect).toBeTruthy();
if (isTouchDevice()) {
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
}
else {
await buttons.both();
}
});
//# sourceMappingURL=stellar.js.map