UNPKG

nanocurrency

Version:

A toolkit for the Nano cryptocurrency, allowing you to derive keys, generate seeds, hashes, signatures, proofs of work and blocks.

62 lines (61 loc) 2.06 kB
export interface CommonBlockData { /** The PoW. You can give it a `null` if you want to fill this field later */ work: string | null; /** The resulting balance */ balance: string; /** The representative address */ representative: string; } export interface OpenBlockData { /** Open block, previous is `null` */ previous: null; /** Open block, link is the pairing send block hash, in hexadecimal format */ link: string; } export interface ChangeBlockData { /** Change block, previous is the hash of the previous block on the account chain, in hexadecimal format */ previous: string; /** Change block, link is `null` */ link: null; } export interface SendBlockData { /** Send block, previous is the hash of the previous block on the account chain, in hexadecimal format */ previous: string; /** Send block, link is the destination address, in address format */ link: string; } export interface ReceiveBlockData { /** Receive block, previous is the hash of the previous block on the account chain, in hexadecimal format */ previous: string; /** Receive block, link is the pairing send block hash, in hexadecimal format */ link: string; } /** State block data. */ export declare type BlockData = CommonBlockData & (OpenBlockData | ChangeBlockData | SendBlockData | ReceiveBlockData); /** State block representation. */ export interface BlockRepresentation { type: 'state'; account: string; previous: string; representative: string; balance: string; link: string; link_as_account: string; work: string | null; signature: string; } /** State block. */ export interface Block { /** The block hash */ hash: string; /** The block representation */ block: BlockRepresentation; } /** * Create a state block. * * @param secretKey - The secret key to create the block from, in hexadecimal format * @param data - Block data * @returns Block */ export declare function createBlock(secretKey: string, data: BlockData): Block;