humanReadableLedgerLog = JSON.parse(JSON.stringify(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") {
event.action.base = getAccountName(event.action.base);
}
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) => BigInt(a.amount) < BigInt(b.amount) ? 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;
})