augmentedLedgerLog = truncatedLedgerLog.map(event => {
if (event.action.type === "TRANSFER_GRAIN") {
event.action.from = getAccountName(event.action.from);
event.action.to = getAccountName(event.action.to);
event.action.amount = g(event.action.amount);
}
if (event.action.type === "TOGGLE_ACTIVATION") {
event.action.identityId = getAccountName(event.action.identityId);
}
if (event.action.type === "MERGE_IDENTITIES") {
const base = getAccount(event.action.base);
event.action.base = base ? base.identity.name : "IDENTITY MERGED";
event.action.newAliases = base ? base.identity.aliases.map(a => a.description) : "ERROR";
event.action.target = getAccountName(event.action.target);
}
if (event.action.type === "DISTRIBUTE_GRAIN") {
if (event.action.distribution) {
event.action.distribution.allocations.forEach(allocation => {
allocation.policy.budget = g(allocation.policy.budget);
allocation.receipts.sort((a, b) => a.amount.padStart(30, '0') < b.amount.padStart(30, '0') ? 1 : -1);
allocation.receipts.forEach(receipt => {
receipt.id = getAccountName(receipt.id);
receipt.amount = g(receipt.amount);
});
});
}
}
event.ledgerTimestamp = new Date(event.ledgerTimestamp).toLocaleString("en", {
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
year: "2-digit",
});
return event;
})