diff --git a/lib/blockchain/chainentry.js b/lib/blockchain/chainentry.js index 60362919..0dae696d 100644 --- a/lib/blockchain/chainentry.js +++ b/lib/blockchain/chainentry.js @@ -39,7 +39,7 @@ const ZERO = new BN(0); * @property {Number} nonce * @property {Number} height * @property {BN} chainwork - * @property {ReversedHash} rhash + * @property {Hash} rhash */ class ChainEntry { diff --git a/lib/net/packets.js b/lib/net/packets.js index ed51797f..a4b3a63a 100644 --- a/lib/net/packets.js +++ b/lib/net/packets.js @@ -1777,7 +1777,7 @@ RejectPacket.codes = { /** * Reject codes by value. - * @const {RevMap} + * @const {Object} */ RejectPacket.codesByVal = { diff --git a/lib/net/pool.js b/lib/net/pool.js index be5caf14..12759a28 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -3250,7 +3250,7 @@ class Pool extends EventEmitter { /** * Add an address to the bloom filter (SPV-only). - * @param {Address|Base58Address} address + * @param {Address|AddressString} address */ watchAddress(address) { diff --git a/lib/primitives/abstractblock.js b/lib/primitives/abstractblock.js index 7cd1e709..0559a65d 100644 --- a/lib/primitives/abstractblock.js +++ b/lib/primitives/abstractblock.js @@ -50,7 +50,7 @@ class AbstractBlock { /** * Inject properties from options object. * @private - * @param {NakedBlock} options + * @param {Object} options */ parseOptions(options) { diff --git a/lib/primitives/address.js b/lib/primitives/address.js index a82f3a38..f2c4799a 100644 --- a/lib/primitives/address.js +++ b/lib/primitives/address.js @@ -202,7 +202,7 @@ class Address { /** * Compile the address object to a base58 address. * @param {{NetworkType|Network)?} network - * @returns {Base58Address} + * @returns {AddressString} * @throws Error on bad hash/prefix. */ @@ -271,7 +271,7 @@ class Address { /** * Convert the Address to a string. * @param {(Network|NetworkType)?} network - * @returns {Base58Address} + * @returns {AddressString} */ toString(network) { @@ -343,7 +343,7 @@ class Address { /** * Inject properties from base58 address. * @private - * @param {Base58Address} data + * @param {AddressString} data * @param {Network?} network * @throws Parse error */ @@ -359,7 +359,7 @@ class Address { /** * Create an address object from a base58 address. - * @param {Base58Address} data + * @param {AddressString} data * @param {Network?} network * @returns {Address} * @throws Parse error. @@ -867,7 +867,7 @@ Address.types = { /** * Address types by value. - * @const {RevMap} + * @const {Object} */ Address.typesByVal = [ diff --git a/lib/primitives/input.js b/lib/primitives/input.js index 9731bb9f..b8ad59cf 100644 --- a/lib/primitives/input.js +++ b/lib/primitives/input.js @@ -69,7 +69,7 @@ class Input { /** * Instantiate an Input from options object. - * @param {NakedInput} options + * @param {Object} options * @returns {Input} */ diff --git a/lib/primitives/invitem.js b/lib/primitives/invitem.js index b077c2e7..5a8af709 100644 --- a/lib/primitives/invitem.js +++ b/lib/primitives/invitem.js @@ -174,7 +174,7 @@ InvItem.types = { /** * Inv types by value. - * @const {RevMap} + * @const {Object} */ InvItem.typesByVal = { diff --git a/lib/primitives/keyring.js b/lib/primitives/keyring.js index a4225789..8ed4a3bb 100644 --- a/lib/primitives/keyring.js +++ b/lib/primitives/keyring.js @@ -424,7 +424,7 @@ class KeyRing { /** * Get address' scripthash address for witness program. * @param {String?} enc - `"base58"` or `null`. - * @returns {Address|Base58Address} + * @returns {Address|AddressString} */ getNestedAddress(enc, network) { @@ -497,7 +497,7 @@ class KeyRing { /** * Get scripthash address. * @param {String?} enc - `"base58"` or `null`. - * @returns {Address|Base58Address} + * @returns {Address|AddressString} */ getScriptAddress(enc, network) { @@ -543,7 +543,7 @@ class KeyRing { /** * Get pubkeyhash address. * @param {String?} enc - `"base58"` or `null`. - * @returns {Address|Base58Address} + * @returns {Address|AddressString} */ getKeyAddress(enc, network) { @@ -587,7 +587,7 @@ class KeyRing { /** * Get base58 address. * @param {String?} enc - `"base58"` or `null`. - * @returns {Address|Base58Address} + * @returns {Address|AddressString} */ getAddress(enc, network) { diff --git a/lib/primitives/merkleblock.js b/lib/primitives/merkleblock.js index 72f92f63..db36514b 100644 --- a/lib/primitives/merkleblock.js +++ b/lib/primitives/merkleblock.js @@ -48,7 +48,7 @@ class MerkleBlock extends AbstractBlock { /** * Inject properties from options object. * @private - * @param {NakedBlock} options + * @param {Object} options */ fromOptions(options) { @@ -83,7 +83,7 @@ class MerkleBlock extends AbstractBlock { /** * Instantiate merkle block from options object. - * @param {NakedBlock} options + * @param {Object} options * @returns {MerkleBlock} */ diff --git a/lib/primitives/output.js b/lib/primitives/output.js index 0d285266..03e208bb 100644 --- a/lib/primitives/output.js +++ b/lib/primitives/output.js @@ -41,7 +41,7 @@ class Output { /** * Inject properties from options object. * @private - * @param {NakedOutput} options + * @param {Object} options */ fromOptions(options) { @@ -64,7 +64,7 @@ class Output { /** * Instantiate output from options object. - * @param {NakedOutput} options + * @param {Object} options * @returns {Output} */ diff --git a/lib/primitives/tx.js b/lib/primitives/tx.js index ee81d340..62ad0bda 100644 --- a/lib/primitives/tx.js +++ b/lib/primitives/tx.js @@ -70,7 +70,7 @@ class TX { /** * Inject properties from options object. * @private - * @param {NakedTX} options + * @param {Object} options */ fromOptions(options) { @@ -105,7 +105,7 @@ class TX { /** * Instantiate TX from options object. - * @param {NakedTX} options + * @param {Object} options * @returns {TX} */ diff --git a/lib/protocol/networks.js b/lib/protocol/networks.js index c0a6889f..feda58b5 100644 --- a/lib/protocol/networks.js +++ b/lib/protocol/networks.js @@ -121,7 +121,7 @@ main.halvingInterval = 210000; /** * Genesis block header. - * @const {NakedBlock} + * @const {Object} */ main.genesis = { diff --git a/lib/script/common.js b/lib/script/common.js index 0adc7f07..98f1a7ab 100644 --- a/lib/script/common.js +++ b/lib/script/common.js @@ -159,7 +159,7 @@ exports.opcodes = { /** * Opcodes by value. - * @const {RevMap} + * @const {Object} */ exports.opcodesByVal = { @@ -423,7 +423,7 @@ exports.hashType = { /** * Sighash types by value. - * @const {RevMap} + * @const {Object} */ exports.hashTypeByVal = { @@ -452,7 +452,7 @@ exports.types = { /** * Output script types by value. - * @const {RevMap} + * @const {Object} */ exports.typesByVal = { diff --git a/lib/script/script.js b/lib/script/script.js index b78575eb..c9eda48e 100644 --- a/lib/script/script.js +++ b/lib/script/script.js @@ -1611,7 +1611,7 @@ class Script { /** * Inject properties from an address. * @private - * @param {Address|Base58Address} address + * @param {Address|AddressString} address */ fromAddress(address) { @@ -1634,7 +1634,7 @@ class Script { /** * Create an output script from an address. - * @param {Address|Base58Address} address + * @param {Address|AddressString} address * @returns {Script} */ diff --git a/lib/types.js b/lib/types.js index 6787ce4a..d7a7ac48 100644 --- a/lib/types.js +++ b/lib/types.js @@ -1,8 +1,4 @@ -/** - * An inverse enum. Retrieves key by value. - * @typedef {Object} RevMap - * @global - */ +'use strict'; /** * One of {@link module:constants.inv}. @@ -36,18 +32,6 @@ * @global */ -/** - * Unix time (seconds). - * @typedef {Number} Seconds - * @global - */ - -/** - * Unix time (milliseconds). - * @typedef {Number} Milliseconds - * @global - */ - /** * Base58 string. * @typedef {String} Base58String @@ -55,8 +39,14 @@ */ /** - * Base58 address. - * @typedef {String} Base58Address + * Bech32 string. + * @typedef {String} Bech32String + * @global + */ + +/** + * Serialized address. + * @typedef {Base58String|Bech32String} AddressString * @global */ @@ -66,12 +56,6 @@ * @global */ -/** - * Reversed hex-string hash (uint256le). - * @typedef {String} ReversedHash - * @global - */ - /** * Signature hash type. One of `all`, `single`, `none`, or * one of {@link constants.hashType}. @@ -107,76 +91,6 @@ * @global */ -/** - * @typedef {Object} NakedCoin - * @property {Number} version - Transaction version. - * @property {Number} height - Transaction height (-1 if unconfirmed). - * @property {Amount} value - Output value in satoshis. - * @property {Script} script - Output script. - * @property {Boolean} coinbase - Whether the containing - * transaction is a coinbase. - * @property {Hash} hash - Transaction hash. - * @property {Number} index - Output index. - * @global - */ - -/** - * @typedef {Object} NakedBlock - * @property {Number} version - Transaction version. Note that BCoin reads - * versions as unsigned even though they are signed at the protocol level. - * This value will never be negative. - * @property {Hash} prevBlock - * @property {Hash} merkleRoot - * @property {Number} time - * @property {Number} bits - * @property {Number} nonce - * @property {Number} height - * @property {Number} totalTX - * @property {NakedTX[]?} txs - Only present on blocks. - * @property {Hash[]?} hashes - Only present on merkleblocks. - * @property {Buffer?} flags - Only present on merkleblocks. - * @global - */ - -/** - * @typedef {Object} NakedInput - * @property {Outpoint} prevout - * @property {NakedScript} script - Input script. - * @property {Number} sequence - nSequence. - * @property {NakedWitness} witness - Witness. - * @global - */ - -/** - * @typedef {Object} NakedOutput - * @property {Amount} value - Value in satoshis. - * @property {NakedScript} script - Output script. - * @global - */ - -/** - * @typedef {Object} NakedTX - * @property {Number} version - * @property {Number} flag - * @property {NakedInput[]} inputs - * @property {NakedOutput[]} outputs - * @property {Number} locktime - * @global - */ - -/** - * @typedef {Object} NakedScript - * @property {Buffer} raw - Raw code. - * @property {Array} code - Parsed code. - * @global - */ - -/** - * @typedef {Object} NakedWitness - * @property {Buffer[]} items - Stack items. - * @global - */ - /** * One of `main`, `testnet`, `regtest`, `segnet3`, `segnet4`. * @typedef {String} NetworkType diff --git a/lib/wallet/account.js b/lib/wallet/account.js index 7f4a7fe4..feb9be56 100644 --- a/lib/wallet/account.js +++ b/lib/wallet/account.js @@ -950,7 +950,7 @@ Account.types = { /** * Account types by value. - * @const {RevMap} + * @const {Object} */ Account.typesByVal = [