@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
22 lines • 1.08 kB
JavaScript
import expect from "expect";
import { pressBoth, pressUntilTextFound, containsSubstringInEvent, getDelegateEvents, getSpeculosModel, } from "../speculos";
import { DeviceLabels } from "../enum/DeviceLabels";
import { Device } from "../enum/Device";
import { DeviceModelId } from "@ledgerhq/types-devices";
export async function delegateSolana(delegatingAccount) {
await getDelegateEvents(delegatingAccount);
await pressBoth();
}
export async function sendSolana(tx) {
const events = getSpeculosModel() !== DeviceModelId.nanoS
? await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION)
: await pressUntilTextFound(DeviceLabels.APPROVE);
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
expect(isAmountCorrect).toBeTruthy();
if (process.env.SPECULOS_DEVICE !== Device.LNS) {
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.parentAccount?.address ?? tx.accountToCredit.address, events);
expect(isAddressCorrect).toBeTruthy();
}
await pressBoth();
}
//# sourceMappingURL=solana.js.map