@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
18 lines • 559 B
JavaScript
export function getStatusError(errors, key) {
if (!errors)
return undefined;
return errors[key];
}
export function pickBlockingError(errors) {
if (!errors)
return undefined;
// Prefer errors that are commonly tied to amount validity on UTXO chains.
const priorityKeys = ["dustLimit", "recipient", "fees", "transaction"];
for (const key of priorityKeys) {
const err = errors[key];
if (err)
return err;
}
return Object.values(errors).find(Boolean);
}
//# sourceMappingURL=errors.js.map