From 270feadf74ddfc89204c6ca9e4fc32d5ea779357 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 28 Apr 2016 04:11:57 -0700 Subject: [PATCH] move jsdoc types. --- lib/bcoin/address.js | 15 -- lib/bcoin/chain.js | 6 - lib/bcoin/peer.js | 14 -- lib/bcoin/protocol/constants.js | 6 - lib/bcoin/protocol/framer.js | 14 -- lib/bcoin/protocol/parser.js | 227 -------------------- lib/bcoin/script.js | 21 -- lib/bcoin/txdb.js | 27 --- lib/bcoin/types.js | 368 ++++++++++++++++++++++++++++++++ lib/bcoin/uri.js | 9 - lib/bcoin/wallet.js | 40 ---- lib/bcoin/walletdb.js | 6 - 12 files changed, 368 insertions(+), 385 deletions(-) create mode 100644 lib/bcoin/types.js diff --git a/lib/bcoin/address.js b/lib/bcoin/address.js index 6b125a49..69f77ac6 100644 --- a/lib/bcoin/address.js +++ b/lib/bcoin/address.js @@ -599,14 +599,6 @@ Address.sha256 = function sha256(key) { return utils.sha256(key); }; -/** - * Can be `pubkeyhash`, `scripthash`, `witnesspubkeyhash`, - * or `witnessscripthash`, or an address prefix - * (see {@link network.address}). - * @global - * @typedef {String|Number} AddressType - */ - /** * Compile a hash to an address. * @param {Hash|Buffer} hash @@ -669,13 +661,6 @@ Address.compileData = function compileData(data, type, version) { return Address.compileHash(data, type, version); }; -/** - * @typedef {Object} ParsedAddress - * @property {Number?} version - Witness program version (-1 if not present). - * @property {AddressType} type - * @property {Buffer} hash - */ - /** * Parse a base58 address. * @param {Base58Address} address diff --git a/lib/bcoin/chain.js b/lib/bcoin/chain.js index 76984fd5..8b6ccb17 100644 --- a/lib/bcoin/chain.js +++ b/lib/bcoin/chain.js @@ -2408,12 +2408,6 @@ Chain.prototype._getInitialState = function _getInitialState(callback) { }); }; -/** - * A bitfield containing locktime flags. - * @global - * @typedef {Number} LockFlags - */ - /** * Check transaction finality, taking into account MEDIAN_TIME_PAST * if it is present in the lock flags. diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index 9fdfa30d..652188c6 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -14,13 +14,6 @@ var assert = utils.assert; var constants = bcoin.protocol.constants; var network = bcoin.protocol.network; -/** - * @typedef {Object} Seed - * @global - * @property {String} host - * @property {Number} port - */ - /** * Represents a remote peer. * @exports Peer @@ -284,13 +277,6 @@ Peer.prototype.createSocket = function createSocket(port, host) { return socket; }; -/** - * @typedef {EventEmitter} BroadcastPromise - * @emits BroadcastPromise#ack - * @emits BroadcastPromise#timeout - * @emits BroadcastPromise#reject - */ - /** * Broadcast items to peer (transactions or blocks). * @param {TX|Block|TX[]|Block[]} items diff --git a/lib/bcoin/protocol/constants.js b/lib/bcoin/protocol/constants.js index 4751e980..e31fd1ff 100644 --- a/lib/bcoin/protocol/constants.js +++ b/lib/bcoin/protocol/constants.js @@ -92,12 +92,6 @@ exports.inv = { WITNESS_FILTERED_BLOCK: 3 | (1 << 30) }; -/** - * An inverse enum. Retrieves key by value. - * @global - * @typedef {Object} RevMap - */ - /** * Inv types by value. * @const {RevMap} diff --git a/lib/bcoin/protocol/framer.js b/lib/bcoin/protocol/framer.js index 247ee8f6..03902ff3 100644 --- a/lib/bcoin/protocol/framer.js +++ b/lib/bcoin/protocol/framer.js @@ -486,13 +486,6 @@ Framer._inv = function _inv(items, writer) { return p; }; -/** - * @typedef {Object} InvItem - * @global - * @property {Number|String} type - Inv type. See {@link constants.inv}. - * @property {Hash|Buffer} hash - */ - /** * Create an inv packet (without a header). * @param {InvItem[]} items @@ -1165,13 +1158,6 @@ Framer.getAddr = function getAddr() { return DUMMY; }; -/** - * @typedef {Object} Outpoint - * @global - * @property {Hash} hash - * @property {Number} index - */ - /** * Create a getutxos packet (without a header). * @param {GetUTXOsPacket} data diff --git a/lib/bcoin/protocol/parser.js b/lib/bcoin/protocol/parser.js index 7d776579..e62e935b 100644 --- a/lib/bcoin/protocol/parser.js +++ b/lib/bcoin/protocol/parser.js @@ -158,14 +158,6 @@ Parser.parseMempool = function parseMempool(p) { return {}; }; -/** - * @typedef {Object} SubmitOrderPacket - * @global - * @property {Hash} hash - * @property {NakedTX} tx - * @property {Number} _size - */ - /** * Parse submitorder packet. * @param {Buffer|BufferReader} p @@ -193,15 +185,6 @@ Parser.parseCheckOrder = function parseCheckOrder(p) { return Parser.parseSubmitOrder(p); }; -/** - * @typedef {Object} ReplyPacket - * @global - * @property {Hash} hash - * @property {Number} code - * @property {Buffer} publicKey - * @property {Number} _size - */ - /** * Parse reply packet. * @param {Buffer|BufferReader} p @@ -250,17 +233,6 @@ Parser.parseGetAddr = function parseGetAddr(p) { return {}; }; -/** - * @typedef {Object} FilterLoadPacket - * @global - * @see Bloom - * @property {Buffer} filter - Serialized bloom filter. - * @property {Number} n - Number of hash functions. - * @property {Number} tweak - Bloom filter seed. - * @property {String|Number} update (See {@link constants.filterFlags}). - * @property {Number} _size - */ - /** * Parse filterload packet. * @param {Buffer|BufferReader} p @@ -289,14 +261,6 @@ Parser.parseFilterLoad = function parseFilterLoad(p) { }; }; -/** - * @typedef {Object} FilterAddPacket - * @global - * @see Bloom - * @property {Buffer} data - Data to add to filter. - * @property {Number} _size - */ - /** * Parse filteradd packet. * @param {Buffer|BufferReader} p @@ -393,14 +357,6 @@ Parser.prototype.parsePayload = function parsePayload(cmd, p) { } }; -/** - * @typedef {Object} GetUTXOsPacket - * @global - * @property {Boolean} mempool - Check mempool. - * @property {Outpoint[]} prevout - Outpoints. - * @property {Number} _size - */ - /** * Parse getutxos packet. * @param {Buffer|BufferReader} p @@ -431,31 +387,6 @@ Parser.parseGetUTXOs = function parseGetUTXOs(p) { }; }; -/** - * @typedef {Object} NakedCoin - * @global - * @property {Number} version - Transaction version. - * @property {Number} height - Transaction height (-1 if unconfirmed). - * @property {BN} 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. - */ - -/** - * @typedef {Object} UTXOsPacket - * @global - * @property {Array?} data.hits - Hits (array of - * 1s and 0s representing a bit mask). - * @property {Buffer?} data.map - Hit map. - * @property {Object} data.height - Chain height. - * @property {Hash} data.tip - Chain tip hash. - * @property {NakedCoin[]} data.coins - * @property {Number} _size - */ - /** * Parse utxos packet. * @param {Buffer|BufferReader} p @@ -504,13 +435,6 @@ Parser.parseUTXOs = function parseUTXOs(p) { }; }; -/** - * @typedef {Object} PingPacket - * @global - * @property {BN} nonce - * @property {Number} _size - */ - /** * Parse ping packet. * @param {Buffer|BufferReader} p @@ -543,37 +467,6 @@ Parser.parsePong = function parsePong(p) { }; }; -/** - * @typedef {Object} NetworkAddress - * @global - * @property {Number?} ts - Timestamp. - * @property {Number?} services - Service bits. - * @property {Buffer?} ipv4 - IPv4 address. - * @property {Buffer?} ipv6 - IPv6 address. - * @property {Number?} port - Port. - * @property {Boolean?} network - Whether network services are enabled. - * @property {Boolean?} getutxo - Whether peer supports getutxos. - * @property {Boolean?} bloom - Whether peer supports serving FILTERED_BLOCKs. - * @property {Boolean?} witness - Whether peer supports segwit. - * @property {Number} _size - */ - -/** - * @typedef {Object} VersionPacket - * @global - * @property {Number} version - Protocol version. - * @property {Number} services - Service bits. - * @property {Number} ts - Timestamp of discovery. - * @property {NetworkAddress} local - Our address. - * @property {NetworkAddress} remote - Their address. - * @property {BN} nonce - * @property {String} agent - User agent string. - * @property {Number} height - Chain height. - * @property {Boolean} relay - Whether transactions - * should be relayed immediately. - * @property {Number} _size - */ - /** * Parse version packet. * @param {Buffer|BufferReader} p @@ -652,15 +545,6 @@ Parser.parseGetData = function parseGetData(p) { return Parser.parseInv(p); }; -/** - * @typedef {Object} GetBlocksPacket - * @global - * @property {Number} version - Protocol version. - * @property {Hash[]} locator - Chain locator. - * @property {Hash} stop - Hash to stop at. - * @property {Number} _size - */ - Parser._parseGetBlocks = function _parseGetBlocks(p) { var version, count, locator, i, stop; @@ -878,26 +762,6 @@ Parser.parseBlock = function parseBlock(p) { }; }; -/** - * @typedef {Object} NakedBlock - * @global - * @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} ts - * @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. - * @property {Number?} coinbaseHeight - Only present on compactblocks. - * @property {Number} _size - */ - /** * Parse block packet. * @param {Buffer|BufferReader} p @@ -959,16 +823,6 @@ Parser.parseBlockCompact = function parseBlockCompact(p) { }; }; -/** - * @typedef {Object} NakedInput - * @global - * @property {Outpoint} prevout - * @property {NakedScript} script - Input script. - * @property {Number} sequence - nSequence. - * @property {NakedWitness} witness - Witness. - * @property {Number} _size - */ - /** * Parse serialized input. * @param {Buffer|BufferReader} p @@ -998,14 +852,6 @@ Parser.parseInput = function parseInput(p) { }; }; -/** - * @typedef {Object} NakedOutput - * @global - * @property {BN} value - Value in satoshis. - * @property {NakedScript} script - Output script. - * @property {Number} _size - */ - /** * Parse serialized output. * @param {Buffer|BufferReader} p @@ -1028,20 +874,6 @@ Parser.parseOutput = function parseOutput(p) { }; }; -/** - * @typedef {Object} NakedCoin - * @global - * @property {Number} version - Transaction version. - * @property {Number} height - Transaction height (-1 if unconfirmed). - * @property {BN} 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. - * @property {Number} _size - */ - /** * Parse serialized coin. * @param {Buffer|BufferReader} p @@ -1081,17 +913,6 @@ Parser.parseCoin = function parseCoin(p, extended) { }; }; -/** - * @typedef {Object} NakedTX - * @global - * @property {Number} version - * @property {Number} flag - * @property {NakedInput[]} inputs - * @property {NakedOutput[]} outputs - * @property {Number} locktime - * @property {Number} _size - */ - /** * Parse tx packet (will automatically switch to witness * parsing if a witness transaction is detected). @@ -1213,14 +1034,6 @@ Parser.parseWitnessTX = function parseWitnessTX(p) { }; }; -/** - * @typedef {Object} NakedScript - * @global - * @property {Buffer} raw - Raw code. - * @property {Array} code - Parsed code. - * @property {Number} _size - */ - /** * Parse serialized script (with varint length). * @param {Buffer|BufferReader} p @@ -1241,13 +1054,6 @@ Parser.parseScript = function parseScript(p) { }; }; -/** - * @typedef {Object} NakedWitness - * @global - * @param {Buffer[]} items - Stack items. - * @property {Number} _size - */ - /** * Parse serialized witness. * @param {Buffer|BufferReader} p @@ -1272,17 +1078,6 @@ Parser.parseWitness = function parseWitness(p) { }; }; -/** - * @typedef {Object} RejectPacket - * @global - * @param {(Number|String)?} ccode - Code - * (see {@link constants.reject}). - * @param {String?} msg - Message. - * @param {String?} reason - Reason. - * @param {(Hash|Buffer)?} data - Transaction or block hash. - * @property {Number} _size - */ - /** * Parse reject packet. * @param {Buffer|BufferReader} p @@ -1383,28 +1178,6 @@ Parser.parseMempool = function parseMempool(p) { return {}; }; -/** - * @typedef {Object} AlertPacket - * @global - * @property {Number} version - * @property {Number} relayUntil - * @property {Number} expiration - * @property {Number} id - * @property {Number} cancel - * @property {Number[]} cancels - * @property {Number} minVer - * @property {Number} maxVer - * @property {String[]} subVers - * @property {Number} priority - * @property {String} comment - * @property {String} statusBar - * @property {String?} reserved - * @property {Buffer?} payload - Payload. - * @property {Buffer?} signature - Payload signature. - * @property {Buffer?} key - Private key to sign with. - * @property {Number} _size - */ - /** * Parse alert packet. * @param {Buffer|BufferReader} p diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index b5ab951e..5ee0579b 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -18,18 +18,6 @@ var STACK_TRUE = new Buffer([1]); var STACK_FALSE = new Buffer([]); var STACK_NEGATE = new Buffer([0x81]); -/** - * A big number (bn.js) - * @global - * @typedef {Object} BN - */ - -/** - * A bitfield containing script verify flags. - * @global - * @typedef {Number} VerifyFlags - */ - /** * Refers to the witness field of segregated witness transactions. * @exports Witness @@ -2722,15 +2710,6 @@ Script.prototype.isWitnessProgram = function isWitnessProgram() { && this.code[1].length >= 2 && this.code[1].length <= 32; }; -/** - * @typedef {Object} Program - * @property {Number} version - Ranges from 0 to 16. - * @property {String|null} type - Null if malformed. `unknown` if unknown - * version (treated as anyone-can-spend). Otherwise one of `witnesspubkeyhash` - * or `witnessscripthash`. - * @property {Buffer} data - Usually the hash. - */ - /** * Get the witness program if present. * @returns {Program|null} diff --git a/lib/bcoin/txdb.js b/lib/bcoin/txdb.js index 70a3ae4b..16ea8a4d 100644 --- a/lib/bcoin/txdb.js +++ b/lib/bcoin/txdb.js @@ -58,27 +58,6 @@ TXDB.prototype._lock = function _lock(func, args, force) { return this.locker.lock(func, args, force); }; -/** - * The wallet ID (when mapAddress is enabled) - * or a {@link Base58Address} otherwise. - * @typedef {String} WalletID - */ - -/** - * Table of address->id. - * @global - * @typedef {Object} AddressTable - */ - -/** - * @typedef {Object} AddressMap - * @global - * @property {Object} table - Table of address->id. - * @property {String[]} input - Input IDs. - * @property {String[]} output - Output IDs. - * @property {String[]} all - Both input and output IDs. - */ - /** * Map a transactions' addresses to wallet IDs. * @param {TX} tx @@ -232,12 +211,6 @@ TXDB.prototype._addOrphan = function _addOrphan(key, hash, index, callback) { }); }; -/** - * @typedef {Object} Orphan - * @property {Hash} hash - Orphan TX hash. - * @property {Number} index - Orphan input index. - */ - /** * Retrieve orphan list by coin ID. * @private diff --git a/lib/bcoin/types.js b/lib/bcoin/types.js new file mode 100644 index 00000000..e0b6ee2f --- /dev/null +++ b/lib/bcoin/types.js @@ -0,0 +1,368 @@ +/** + * An inverse enum. Retrieves key by value. + * @global + * @typedef {Object} RevMap + */ + +/** + * @typedef {Object} InvItem + * @global + * @property {Number|String} type - Inv type. See {@link constants.inv}. + * @property {Hash|Buffer} hash + */ + +/** + * @typedef {Object} Outpoint + * @global + * @property {Hash} hash + * @property {Number} index + */ + +/** + * Can be `pubkeyhash`, `scripthash`, `witnesspubkeyhash`, + * or `witnessscripthash`, or an address prefix + * (see {@link network.address}). + * @global + * @typedef {String|Number} AddressType + */ + +/** + * @typedef {Object} ParsedAddress + * @global + * @property {Number?} version - Witness program version (-1 if not present). + * @property {AddressType} type + * @property {Buffer} hash + */ + +/** + * A bitfield containing locktime flags. + * @global + * @typedef {Number} LockFlags + */ + +/** + * @typedef {Object} Seed + * @global + * @property {String} host + * @property {Number} port + */ + +/** + * @typedef {EventEmitter} BroadcastPromise + * @global + * @emits BroadcastPromise#ack + * @emits BroadcastPromise#timeout + * @emits BroadcastPromise#reject + */ + +/** + * @typedef {Object} ParsedURI + * @global + * @property {Base58Address} address + * @property {BN?} amount? - Amount in satoshis. + * @property {String?} label + * @property {String?} message + * @property {String?} request - Payment request URL. + */ + +/** + * Wallet ID + * @global + * @typedef {String} WalletID + */ + +/** + * Base58 string. + * @global + * @typedef {String} Base58String + */ + +/** + * Base58 address. + * @global + * @typedef {String} Base58Address + */ + +/** + * Hex-string hash. + * @global + * @typedef {String} Hash + */ + +/** + * Reversed hex-string hash (uint256le). + * @global + * @typedef {String} ReversedHash + */ + +/** + * Signature hash type. One of `all`, `single`, `none`, or + * one of {@link constants.hashType}. + * @global + * @typedef {String|Number} SighashType + */ + +/** + * Wallet balance. + * @global + * @typedef {Object} Balance + * @property {BN} confirmed + * @property {BN} unconfirmed + * @property {BN} total + */ + +/** + * A big number (bn.js) + * @global + * @typedef {Object} BN + */ + +/** + * A bitfield containing script verify flags. + * @global + * @typedef {Number} VerifyFlags + */ + +/** + * @typedef {Object} Program + * @property {Number} version - Ranges from 0 to 16. + * @property {String|null} type - Null if malformed. `unknown` if unknown + * version (treated as anyone-can-spend). Otherwise one of `witnesspubkeyhash` + * or `witnessscripthash`. + * @property {Buffer} data - Usually the hash. + */ + +/** + * @typedef {Object} Orphan + * @property {Hash} hash - Orphan TX hash. + * @property {Number} index - Orphan input index. + */ + +/** + * @typedef {Object} SubmitOrderPacket + * @global + * @property {Hash} hash + * @property {NakedTX} tx + * @property {Number} _size + */ + +/** + * @typedef {Object} ReplyPacket + * @global + * @property {Hash} hash + * @property {Number} code + * @property {Buffer} publicKey + * @property {Number} _size + */ + +/** + * @typedef {Object} FilterLoadPacket + * @global + * @see Bloom + * @property {Buffer} filter - Serialized bloom filter. + * @property {Number} n - Number of hash functions. + * @property {Number} tweak - Bloom filter seed. + * @property {String|Number} update (See {@link constants.filterFlags}). + * @property {Number} _size + */ + + +/** + * @typedef {Object} FilterAddPacket + * @global + * @see Bloom + * @property {Buffer} data - Data to add to filter. + * @property {Number} _size + */ + + +/** + * @typedef {Object} GetUTXOsPacket + * @global + * @property {Boolean} mempool - Check mempool. + * @property {Outpoint[]} prevout - Outpoints. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedCoin + * @global + * @property {Number} version - Transaction version. + * @property {Number} height - Transaction height (-1 if unconfirmed). + * @property {BN} 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. + */ + +/** + * @typedef {Object} UTXOsPacket + * @global + * @property {Array?} data.hits - Hits (array of + * 1s and 0s representing a bit mask). + * @property {Buffer?} data.map - Hit map. + * @property {Object} data.height - Chain height. + * @property {Hash} data.tip - Chain tip hash. + * @property {NakedCoin[]} data.coins + * @property {Number} _size + */ + +/** + * @typedef {Object} PingPacket + * @global + * @property {BN} nonce + * @property {Number} _size + */ + +/** + * @typedef {Object} NetworkAddress + * @global + * @property {Number?} ts - Timestamp. + * @property {Number?} services - Service bits. + * @property {Buffer?} ipv4 - IPv4 address. + * @property {Buffer?} ipv6 - IPv6 address. + * @property {Number?} port - Port. + * @property {Boolean?} network - Whether network services are enabled. + * @property {Boolean?} getutxo - Whether peer supports getutxos. + * @property {Boolean?} bloom - Whether peer supports serving FILTERED_BLOCKs. + * @property {Boolean?} witness - Whether peer supports segwit. + * @property {Number} _size + */ + +/** + * @typedef {Object} VersionPacket + * @global + * @property {Number} version - Protocol version. + * @property {Number} services - Service bits. + * @property {Number} ts - Timestamp of discovery. + * @property {NetworkAddress} local - Our address. + * @property {NetworkAddress} remote - Their address. + * @property {BN} nonce + * @property {String} agent - User agent string. + * @property {Number} height - Chain height. + * @property {Boolean} relay - Whether transactions + * should be relayed immediately. + * @property {Number} _size + */ + +/** + * @typedef {Object} GetBlocksPacket + * @global + * @property {Number} version - Protocol version. + * @property {Hash[]} locator - Chain locator. + * @property {Hash} stop - Hash to stop at. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedBlock + * @global + * @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} ts + * @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. + * @property {Number?} coinbaseHeight - Only present on compactblocks. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedInput + * @global + * @property {Outpoint} prevout + * @property {NakedScript} script - Input script. + * @property {Number} sequence - nSequence. + * @property {NakedWitness} witness - Witness. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedOutput + * @global + * @property {BN} value - Value in satoshis. + * @property {NakedScript} script - Output script. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedCoin + * @global + * @property {Number} version - Transaction version. + * @property {Number} height - Transaction height (-1 if unconfirmed). + * @property {BN} 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. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedTX + * @global + * @property {Number} version + * @property {Number} flag + * @property {NakedInput[]} inputs + * @property {NakedOutput[]} outputs + * @property {Number} locktime + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedScript + * @global + * @property {Buffer} raw - Raw code. + * @property {Array} code - Parsed code. + * @property {Number} _size + */ + +/** + * @typedef {Object} NakedWitness + * @global + * @param {Buffer[]} items - Stack items. + * @property {Number} _size + */ + +/** + * @typedef {Object} RejectPacket + * @global + * @param {(Number|String)?} ccode - Code + * (see {@link constants.reject}). + * @param {String?} msg - Message. + * @param {String?} reason - Reason. + * @param {(Hash|Buffer)?} data - Transaction or block hash. + * @property {Number} _size + */ + +/** + * @typedef {Object} AlertPacket + * @global + * @property {Number} version + * @property {Number} relayUntil + * @property {Number} expiration + * @property {Number} id + * @property {Number} cancel + * @property {Number[]} cancels + * @property {Number} minVer + * @property {Number} maxVer + * @property {String[]} subVers + * @property {Number} priority + * @property {String} comment + * @property {String} statusBar + * @property {String?} reserved + * @property {Buffer?} payload - Payload. + * @property {Buffer?} signature - Payload signature. + * @property {Buffer?} key - Private key to sign with. + * @property {Number} _size + */ diff --git a/lib/bcoin/uri.js b/lib/bcoin/uri.js index e71c07b2..b244c32b 100644 --- a/lib/bcoin/uri.js +++ b/lib/bcoin/uri.js @@ -9,15 +9,6 @@ var url = require('url'); var querystring = require('querystring'); var utils = require('./utils'); -/** - * @typedef {Object} ParsedURI - * @property {Base58Address} address - * @property {BN?} amount? - Amount in satoshis. - * @property {String?} label - * @property {String?} message - * @property {String?} request - Payment request URL. - */ - /** * Parse a bitcoin URI. * @param {String} uri - Bitcoin URI. diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 9b47a670..d85baddc 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -7,37 +7,6 @@ module.exports = function(bcoin) { -/** - * Base58 string. - * @global - * @typedef {String} Base58String - */ - -/** - * Base58 address. - * @global - * @typedef {String} Base58Address - */ - -/** - * Hex-string hash. - * @global - * @typedef {String} Hash - */ - -/** - * Reversed hex-string hash (uint256le). - * @global - * @typedef {String} ReversedHash - */ - -/** - * Signature hash type. One of `all`, `single`, `none`, or - * one of {@link constants.hashType}. - * @global - * @typedef {String|Number} SighashType - */ - var EventEmitter = require('events').EventEmitter; var utils = require('./utils'); var assert = utils.assert; @@ -1298,15 +1267,6 @@ Wallet.prototype.getUnconfirmed = function getUnconfirmed(callback) { return this.provider.getUnconfirmed(callback); }; -/** - * Wallet balance. - * @global - * @typedef {Object} Balance - * @property {BN} confirmed - * @property {BN} unconfirmed - * @property {BN} total - */ - /** * Get wallet balance (accesses provider). * @param {Function} callback - Returns [Error, {@link Balance}]. diff --git a/lib/bcoin/walletdb.js b/lib/bcoin/walletdb.js index 94ead451..855f2340 100644 --- a/lib/bcoin/walletdb.js +++ b/lib/bcoin/walletdb.js @@ -204,12 +204,6 @@ WalletDB.prototype.destroy = function destroy(callback) { this.db.close(callback); }; -/** - * Wallet ID - * @global - * @typedef {String} WalletID - */ - /** * Sync address depths based on a transaction's outputs. * This is used for deriving new addresses when