UNPKG

@node-dlc/bitcoin

Version:
56 lines (55 loc) 1.93 kB
/// <reference types="node" /> import { StreamReader } from '@node-dlc/bufio'; import { HashByteOrder } from './HashByteOrder'; import { ICloneable } from './ICloneable'; export declare class HashValue implements ICloneable<HashValue> { /** * Parses a hashed value in internal byte order. This is often * referred to as little-endian due to the block target needing to * be reversed. * @param stream */ static parse(reader: StreamReader): HashValue; /** * Parses a hashed value in RPC byte order (which is the reverse) of * the natural or internal byte order. This is often referred to as * big-endian due to the reversed block target being big-endian. * @param stream */ static fromRpcStream(reader: StreamReader): HashValue; /** * Parses a hashed value in RPC byte order (which is the reverse) of * the natural or internal byte order. This is often referred to as * big-endian due to the reversed block target being big-endian. * @param value */ static fromRpc(value: string): HashValue; /** * Internal-byte-order version of the hash value */ private _value; /** * Constructs a new HashValue instance from the internal-byte-order * value provided. * @param value Interval-byte-order of a hash value */ constructor(value: Buffer); /** * Returns the hash value as a hex string. Defaults to using RPC * (reversed/big-endian) byte order. */ toString(byteOrder?: HashByteOrder): string; /** * Serializes to JSON returning a hex string. Defaults to using * RPC (reversed/big endian) byte order. */ toJSON(byteOrder?: HashByteOrder): string; /** * Serializes the hash value into an internal-byte order Buffer */ serialize(byteOrder?: HashByteOrder): Buffer; /** * Deep copy clone */ clone(): HashValue; }