-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbitcoin-block.d.ts
More file actions
48 lines (48 loc) · 1.89 KB
/
Copy pathbitcoin-block.d.ts
File metadata and controls
48 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @template T
* @typedef {import('multiformats/codecs/interface').ByteView<T>} ByteView
*/
/** @typedef {import('./interface').BitcoinHeader} BitcoinHeader */
/** @typedef {import('./interface').BitcoinBlockCID} BitcoinBlockCID */
/**
* **`bitcoin-block` / `0xb0` codec**: Encodes an IPLD node representing a
* Bitcoin header object into byte form.
*
* @param {BitcoinHeader} node
* @returns {ByteView<BitcoinHeader>}
* @name BitcoinBlock.encode()
*/
export function encode(node: BitcoinHeader): ByteView<BitcoinHeader>;
/**
* **`bitcoin-block` / `0xb0` codec**: Decodes a bytes form of a Bitcoin header
* into an IPLD node representation.
*
* @param {ByteView<BitcoinHeader>} data
* @returns {BitcoinHeader}
* @name BitcoinBlock.decode()
*/
export function decode(data: ByteView<BitcoinHeader>): BitcoinHeader;
/**
* Convert a Bitcoin block identifier (hash) to a CID. The identifier should be in big-endian form, i.e. with leading zeros.
*
* The process of converting to a CID involves reversing the hash (to little-endian form), encoding as a `dbl-sha2-256` multihash and encoding as a `bitcoin-block` multicodec. This process is reversable, see {@link cidToHash}.
*
* @param {string} blockHash a string form of a block hash
* @returns {BitcoinBlockCID} a CID object representing this block identifier.
* @name BitcoinBlock.blockHashToCID()
*/
export function blockHashToCID(blockHash: string): BitcoinBlockCID;
/**
* **`bitcoin-block` / `0xb0` codec**: the codec name
* @name BitcoinBlock.name
*/
export const name: "bitcoin-block";
/**
* **`bitcoin-block` / `0xb0` codec**: the codec code
* @name BitcoinBlock.code
*/
export const code: 176;
export type ByteView<T> = import('multiformats/codecs/interface').ByteView<T>;
export type BitcoinHeader = import('./interface').BitcoinHeader;
export type BitcoinBlockCID = import('./interface').BitcoinBlockCID;
//# sourceMappingURL=bitcoin-block.d.ts.map