@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
33 lines • 1.28 kB
JavaScript
import { getMainAccount } from "@ledgerhq/coin-framework/account/helpers";
import { isEditableOperation as isEditableOperationEvm, isStuckOperation as isStuckOperationEvm, getStuckAccountAndOperation as getStuckAccountAndOperationEvm, } from "@ledgerhq/coin-evm/operation";
export * from "@ledgerhq/coin-framework/operation";
/**
* Return weather an operation is editable or not.
*/
export const isEditableOperation = ({ account, operation, }) => {
if (account.currency.family === "evm") {
return isEditableOperationEvm(account, operation);
}
return false;
};
/**
* Return weather an operation is considered stuck or not.
*/
export const isStuckOperation = ({ family, operation, }) => {
if (family === "evm") {
return isStuckOperationEvm(operation);
}
return false;
};
/**
* Return the oldest stuck pending operation and its corresponding account.
* If no stuck pending operation is found, returns undefined
*/
export const getStuckAccountAndOperation = (account, parentAccount) => {
const mainAccount = getMainAccount(account, parentAccount);
if (mainAccount.currency.family === "evm") {
return getStuckAccountAndOperationEvm(account, parentAccount);
}
return undefined;
};
//# sourceMappingURL=operation.js.map