@ledgerhq/coin-algorand
Version:
Ledger Algorand Coin integration
18 lines (15 loc) • 528 B
text/typescript
import { BlockInfo } from "@ledgerhq/coin-module-framework/api/types";
import { getTransactionParams, getBlock } from "../network";
/**
* Get the last confirmed block info
* @returns Block info with current round (height), hash, and time
*/
export async function lastBlock(): Promise<BlockInfo> {
const params = await getTransactionParams();
const blockData = await getBlock(params.lastRound);
return {
height: params.lastRound,
hash: blockData.block.gh,
time: new Date(blockData.block.ts * 1000),
};
}