@ledgerhq/coin-canton
Version:
26 lines • 968 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCantonAccountEmpty = isCantonAccountEmpty;
exports.isAccountEmpty = isAccountEmpty;
const serialization_1 = require("./bridge/serialization");
function isCantonAccountEmpty(account) {
return (account.operationsCount === 0 &&
account.balance.isZero() &&
!account.subAccounts?.length &&
!account.cantonResources?.pendingTransferProposals?.length);
}
/**
* Check if a Canton account is empty (has no operations, no balance, and no pending transfer proposals)
* @param account - The account to check (must be a Canton account)
* @returns true if the account is empty, false otherwise
*/
function isAccountEmpty(account) {
if (account.type !== "Account") {
return false;
}
if (!(0, serialization_1.isCantonAccount)(account)) {
return false;
}
return isCantonAccountEmpty(account);
}
//# sourceMappingURL=helpers.js.map