refactor: replace callback comments.
This commit is contained in:
parent
3b14525d17
commit
f0a37f3e5e
@ -181,7 +181,7 @@ Chain.prototype._init = function _init() {
|
||||
/**
|
||||
* Open the chain, wait for the database to load.
|
||||
* @alias Chain#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype._open = co(function* open() {
|
||||
@ -228,7 +228,7 @@ Chain.prototype._open = co(function* open() {
|
||||
/**
|
||||
* Close the chain, wait for the database to close.
|
||||
* @alias Chain#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype._close = function close() {
|
||||
@ -240,7 +240,7 @@ Chain.prototype._close = function close() {
|
||||
* @private
|
||||
* @param {Block|MerkleBlock} block
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.verifyContext = co(function* verifyContext(block, prev) {
|
||||
@ -275,7 +275,7 @@ Chain.prototype.isGenesis = function isGenesis(block) {
|
||||
* @private
|
||||
* @param {Block|MerkleBlock} block
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback - Returns
|
||||
* @returns {Promise}
|
||||
* [{@link VerifyError}, {@link VerifyFlags}].
|
||||
*/
|
||||
|
||||
@ -405,7 +405,7 @@ Chain.prototype.verify = co(function* verify(block, prev) {
|
||||
* @param {Block} block
|
||||
* @param {ChainEntry} prev
|
||||
* @param {ChainEntry[]} ancestors
|
||||
* @param {Function} callback - Returns
|
||||
* @returns {Promise}
|
||||
* [{@link VerifyError}, {@link DeploymentState}].
|
||||
*/
|
||||
|
||||
@ -515,7 +515,7 @@ Chain.prototype.getDeployments = co(function* getDeployments(block, prev, ancest
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki
|
||||
* @param {Block|MerkleBlock} block
|
||||
* @param {ChainEntry} prev
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.checkDuplicates = co(function* checkDuplicates(block, prev) {
|
||||
@ -556,7 +556,7 @@ Chain.prototype.checkDuplicates = co(function* checkDuplicates(block, prev) {
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki
|
||||
* @param {Block|MerkleBlock} block
|
||||
* @param {ChainEntry} prev
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.findDuplicates = co(function* findDuplicates(block, prev) {
|
||||
@ -595,7 +595,7 @@ Chain.prototype.findDuplicates = co(function* findDuplicates(block, prev) {
|
||||
* @param {Block} block
|
||||
* @param {ChainEntry} prev
|
||||
* @param {DeploymentState} state
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.checkInputs = co(function* checkInputs(block, prev, state) {
|
||||
@ -719,7 +719,7 @@ Chain.prototype._getCachedHeight = function _getCachedHeight(hash) {
|
||||
* @private
|
||||
* @param {ChainEntry} fork - The current chain.
|
||||
* @param {ChainEntry} longer - The competing chain.
|
||||
* @param {Function} callback - Returns [{@link Error}, {@link ChainEntry}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.findFork = co(function* findFork(fork, longer) {
|
||||
@ -749,7 +749,7 @@ Chain.prototype.findFork = co(function* findFork(fork, longer) {
|
||||
* @private
|
||||
* @param {ChainEntry} entry - The competing chain's tip.
|
||||
* @param {Block|MerkleBlock} block - The being being added.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.reorganize = co(function* reorganize(entry, block) {
|
||||
@ -795,7 +795,7 @@ Chain.prototype.reorganize = co(function* reorganize(entry, block) {
|
||||
/**
|
||||
* Disconnect an entry from the chain (updates the tip).
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.disconnect = co(function* disconnect(entry) {
|
||||
@ -821,7 +821,7 @@ Chain.prototype.disconnect = co(function* disconnect(entry) {
|
||||
* (necessary because we cannot validate the inputs
|
||||
* in alternate chains when they come in).
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.reconnect = co(function* reconnect(entry) {
|
||||
@ -868,7 +868,7 @@ Chain.prototype.reconnect = co(function* reconnect(entry) {
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Block|MerkleBlock} block
|
||||
* @param {ChainEntry} prev
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.setBestChain = co(function* setBestChain(entry, block, prev) {
|
||||
@ -916,7 +916,7 @@ Chain.prototype.setBestChain = co(function* setBestChain(entry, block, prev) {
|
||||
* is useful for replaying the blockchain download
|
||||
* for SPV.
|
||||
* @param {Number} height
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.reset = co(function* reset(height) {
|
||||
@ -932,7 +932,7 @@ Chain.prototype.reset = co(function* reset(height) {
|
||||
* Reset the chain to the desired height without a lock.
|
||||
* @private
|
||||
* @param {Number} height
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype._reset = co(function* reset(height) {
|
||||
@ -951,7 +951,7 @@ Chain.prototype._reset = co(function* reset(height) {
|
||||
* hours). This is useful for replaying the blockchain
|
||||
* download for SPV.
|
||||
* @param {Number} ts - Timestamp.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.resetTime = co(function* resetTime(ts) {
|
||||
@ -967,7 +967,7 @@ Chain.prototype.resetTime = co(function* resetTime(ts) {
|
||||
* Reset the chain to the desired timestamp without a lock.
|
||||
* @private
|
||||
* @param {Number} ts - Timestamp.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype._resetTime = co(function* resetTime(ts) {
|
||||
@ -982,7 +982,7 @@ Chain.prototype._resetTime = co(function* resetTime(ts) {
|
||||
/**
|
||||
* Wait for the chain to drain (finish processing
|
||||
* all of the blocks in its queue).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.onDrain = function onDrain() {
|
||||
@ -1003,7 +1003,7 @@ Chain.prototype.isBusy = function isBusy() {
|
||||
/**
|
||||
* Add a block to the chain, perform all necessary verification.
|
||||
* @param {Block|MerkleBlock|MemBlock} block
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype.add = co(function* add(block) {
|
||||
@ -1023,7 +1023,7 @@ Chain.prototype.add = co(function* add(block) {
|
||||
* Add a block to the chain without a lock.
|
||||
* @private
|
||||
* @param {Block|MerkleBlock|MemBlock} block
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype._add = co(function* add(block) {
|
||||
@ -1354,7 +1354,7 @@ Chain.prototype.pruneOrphans = function pruneOrphans() {
|
||||
/**
|
||||
* Test the chain to see if it has a block, orphan, or pending block.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.has = co(function* has(hash) {
|
||||
@ -1373,7 +1373,7 @@ Chain.prototype.has = co(function* has(hash) {
|
||||
/**
|
||||
* Find a block entry by timestamp.
|
||||
* @param {Number} ts - Timestamp.
|
||||
* @param {Function} callback - Returns [Error, {@link ChainEntry}].
|
||||
* @returns {Promise} - Returns {@link ChainEntry}.
|
||||
*/
|
||||
|
||||
Chain.prototype.byTime = co(function* byTime(ts) {
|
||||
@ -1411,7 +1411,7 @@ Chain.prototype.byTime = co(function* byTime(ts) {
|
||||
/**
|
||||
* Test the chain to see if it contains a block.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.hasBlock = function hasBlock(hash) {
|
||||
@ -1421,7 +1421,7 @@ Chain.prototype.hasBlock = function hasBlock(hash) {
|
||||
/**
|
||||
* Test the chain to see if it contains an orphan.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.hasOrphan = function hasOrphan(hash) {
|
||||
@ -1431,7 +1431,7 @@ Chain.prototype.hasOrphan = function hasOrphan(hash) {
|
||||
/**
|
||||
* Test the chain to see if it contains a pending block in its queue.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.hasPending = function hasPending(hash) {
|
||||
@ -1441,7 +1441,7 @@ Chain.prototype.hasPending = function hasPending(hash) {
|
||||
/**
|
||||
* Find the corresponding block entry by hash or height.
|
||||
* @param {Hash|Number} hash/height
|
||||
* @param {Function} callback - Returns [Error, {@link ChainEntry}].
|
||||
* @returns {Promise} - Returns {@link ChainEntry}.
|
||||
*/
|
||||
|
||||
Chain.prototype.getEntry = function getEntry(hash, callback) {
|
||||
@ -1512,7 +1512,7 @@ Chain.prototype.getProgress = function getProgress() {
|
||||
* @param {(Number|Hash)?} start - Height or hash to treat as the tip.
|
||||
* The current tip will be used if not present. Note that this can be a
|
||||
* non-existent hash, which is useful for headers-first locators.
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
Chain.prototype.getLocator = co(function* getLocator(start) {
|
||||
@ -1528,7 +1528,7 @@ Chain.prototype.getLocator = co(function* getLocator(start) {
|
||||
* Calculate chain locator without a lock.
|
||||
* @private
|
||||
* @param {(Number|Hash)?} start
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Chain.prototype._getLocator = co(function* getLocator(start) {
|
||||
@ -1613,7 +1613,7 @@ Chain.prototype.getOrphanRoot = function getOrphanRoot(hash) {
|
||||
|
||||
/**
|
||||
* Calculate the next target based on the chain tip.
|
||||
* @param {Function} callback - returns [Error, Number]
|
||||
* @returns {Promise} - returns Number
|
||||
* (target is in compact/mantissa form).
|
||||
*/
|
||||
|
||||
@ -1627,7 +1627,7 @@ Chain.prototype.getCurrentTarget = co(function* getCurrentTarget() {
|
||||
* Calculate the target based on the passed-in chain entry.
|
||||
* @param {ChainEntry} prev - Previous entry.
|
||||
* @param {Block|MerkleBlock|null} - Current block.
|
||||
* @param {Function} callback - returns [Error, Number]
|
||||
* @returns {Promise} - returns Number
|
||||
* (target is in compact/mantissa form).
|
||||
*/
|
||||
|
||||
@ -1649,7 +1649,7 @@ Chain.prototype.getTargetAsync = co(function* getTargetAsync(block, prev) {
|
||||
* have ancestors pre-allocated.
|
||||
* @param {Block|MerkleBlock|null} - Current block.
|
||||
* @param {ChainEntry} prev - Previous entry.
|
||||
* @param {Function} callback - returns [Error, Number]
|
||||
* @returns {Promise} - returns Number
|
||||
* (target is in compact/mantissa form).
|
||||
*/
|
||||
|
||||
@ -1722,7 +1722,7 @@ Chain.prototype.retarget = function retarget(prev, first) {
|
||||
/**
|
||||
* Find a locator. Analagous to bitcoind's `FindForkInGlobalIndex()`.
|
||||
* @param {Hash[]} locator - Hashes.
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}] (the
|
||||
* @returns {Promise} - Returns {@link Hash} (the
|
||||
* hash of the latest known block).
|
||||
*/
|
||||
|
||||
@ -1747,7 +1747,7 @@ Chain.prototype.findLocator = co(function* findLocator(locator) {
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
||||
* @param {ChainEntry} prev - Previous chain entry.
|
||||
* @param {String} id - Deployment id.
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
Chain.prototype.isActive = co(function* isActive(prev, id) {
|
||||
@ -1768,7 +1768,7 @@ Chain.prototype.isActive = co(function* isActive(prev, id) {
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
||||
* @param {ChainEntry} prev - Previous chain entry.
|
||||
* @param {String} id - Deployment id.
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
Chain.prototype.getState = co(function* getState(prev, id) {
|
||||
@ -1884,7 +1884,7 @@ Chain.prototype.getState = co(function* getState(prev, id) {
|
||||
* Compute the version for a new block (BIP9: versionbits).
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
|
||||
* @param {ChainEntry} prev - Previous chain entry (usually the tip).
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
Chain.prototype.computeBlockVersion = co(function* computeBlockVersion(prev) {
|
||||
@ -1912,7 +1912,7 @@ Chain.prototype.computeBlockVersion = co(function* computeBlockVersion(prev) {
|
||||
/**
|
||||
* Get the current deployment state of the chain. Called on load.
|
||||
* @private
|
||||
* @param {Function} callback - Returns [Error, {@link DeploymentState}].
|
||||
* @returns {Promise} - Returns {@link DeploymentState}.
|
||||
*/
|
||||
|
||||
Chain.prototype.getDeploymentState = co(function* getDeploymentState() {
|
||||
@ -1937,7 +1937,7 @@ Chain.prototype.getDeploymentState = co(function* getDeploymentState() {
|
||||
* @param {ChainEntry} prev - Previous chain entry.
|
||||
* @param {TX} tx
|
||||
* @param {LockFlags} flags
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.checkFinal = co(function* checkFinal(prev, tx, flags) {
|
||||
@ -1961,7 +1961,7 @@ Chain.prototype.checkFinal = co(function* checkFinal(prev, tx, flags) {
|
||||
* @param {TX} tx
|
||||
* @param {LockFlags} flags
|
||||
* @param {ChainEntry} prev
|
||||
* @param {Function} callback - Returns
|
||||
* @returns {Promise}
|
||||
* [Error, Number(minTime), Number(minHeight)].
|
||||
*/
|
||||
|
||||
@ -2011,7 +2011,7 @@ Chain.prototype.getLocks = co(function* getLocks(prev, tx, flags) {
|
||||
* @param {ChainEntry} prev
|
||||
* @param {Number} minHeight
|
||||
* @param {Number} minTime
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.evalLocks = co(function* evalLocks(prev, minHeight, minTime) {
|
||||
@ -2036,7 +2036,7 @@ Chain.prototype.evalLocks = co(function* evalLocks(prev, minHeight, minTime) {
|
||||
* @param {TX} tx
|
||||
* @param {LockFlags} flags
|
||||
* @param {ChainEntry} prev
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Chain.prototype.checkLocks = co(function* checkLocks(prev, tx, flags) {
|
||||
|
||||
@ -212,7 +212,7 @@ ChainDB.layout = layout;
|
||||
/**
|
||||
* Open the chain db, wait for the database to load.
|
||||
* @alias ChainDB#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype._open = co(function* open() {
|
||||
@ -250,7 +250,7 @@ ChainDB.prototype._open = co(function* open() {
|
||||
/**
|
||||
* Close the chain db, wait for the database to close.
|
||||
* @alias ChainDB#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype._close = function close() {
|
||||
@ -316,7 +316,7 @@ ChainDB.prototype.drop = function drop() {
|
||||
|
||||
/**
|
||||
* Commit current batch.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype.commit = co(function* commit() {
|
||||
@ -387,7 +387,7 @@ ChainDB.prototype.getCache = function getCache(hash) {
|
||||
/**
|
||||
* Get the height of a block by hash.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getHeight = co(function* getHeight(hash) {
|
||||
@ -418,7 +418,7 @@ ChainDB.prototype.getHeight = co(function* getHeight(hash) {
|
||||
* Get the hash of a block by height. Note that this
|
||||
* will only return hashes in the main chain.
|
||||
* @param {Number} height
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}].
|
||||
* @returns {Promise} - Returns {@link Hash}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getHash = co(function* getHash(height) {
|
||||
@ -444,7 +444,7 @@ ChainDB.prototype.getHash = co(function* getHash(height) {
|
||||
|
||||
/**
|
||||
* Get the current chain height from the tip record.
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getChainHeight = co(function* getChainHeight() {
|
||||
@ -458,7 +458,7 @@ ChainDB.prototype.getChainHeight = co(function* getChainHeight() {
|
||||
/**
|
||||
* Get both hash and height depending on the value passed in.
|
||||
* @param {Hash|Number} block - Can be a has or height.
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}, Number].
|
||||
* @returns {Promise} - Returns {@link Hash}, Number.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getBoth = co(function* getBoth(block) {
|
||||
@ -491,7 +491,7 @@ ChainDB.prototype.getBoth = co(function* getBoth(block) {
|
||||
/**
|
||||
* Retrieve a chain entry but do _not_ add it to the LRU cache.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link ChainEntry}].
|
||||
* @returns {Promise} - Returns {@link ChainEntry}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getEntry = co(function* getEntry(hash) {
|
||||
@ -520,7 +520,7 @@ ChainDB.prototype.getEntry = co(function* getEntry(hash) {
|
||||
/**
|
||||
* Retrieve a chain entry and add it to the LRU cache.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link ChainEntry}].
|
||||
* @returns {Promise} - Returns {@link ChainEntry}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.get = co(function* get(hash) {
|
||||
@ -547,7 +547,7 @@ ChainDB.prototype.get = co(function* get(hash) {
|
||||
* @param {CoinView} view
|
||||
* @param {Boolean} connect - Whether to connect the
|
||||
* block's inputs and add it as a tip.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype.save = co(function* save(entry, block, view, connect) {
|
||||
@ -591,7 +591,7 @@ ChainDB.prototype.save = co(function* save(entry, block, view, connect) {
|
||||
|
||||
/**
|
||||
* Retrieve the chain state.
|
||||
* @param {Function} callback - Returns [Error, {@link ChainState}].
|
||||
* @returns {Promise} - Returns {@link ChainState}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.initState = co(function* initState() {
|
||||
@ -609,7 +609,7 @@ ChainDB.prototype.initState = co(function* initState() {
|
||||
|
||||
/**
|
||||
* Retrieve the tip entry from the tip record.
|
||||
* @param {Function} callback - Returns [Error, {@link ChainEntry}].
|
||||
* @returns {Promise} - Returns {@link ChainEntry}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getTip = function getTip() {
|
||||
@ -621,7 +621,7 @@ ChainDB.prototype.getTip = function getTip() {
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Block} block
|
||||
* @param {CoinView} view
|
||||
* @param {Function} callback -
|
||||
* @returns {Promise} -
|
||||
* Returns [Error, {@link ChainEntry}, {@link Block}].
|
||||
*/
|
||||
|
||||
@ -653,7 +653,7 @@ ChainDB.prototype.reconnect = co(function* reconnect(entry, block, view) {
|
||||
/**
|
||||
* Disconnect block from the chain.
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback -
|
||||
* @returns {Promise} -
|
||||
* Returns [Error, {@link ChainEntry}, {@link Block}].
|
||||
*/
|
||||
|
||||
@ -701,7 +701,7 @@ ChainDB.prototype.disconnect = co(function* disconnect(entry) {
|
||||
/**
|
||||
* Get the _next_ block hash (does not work by height).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}].
|
||||
* @returns {Promise} - Returns {@link Hash}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getNextHash = co(function* getNextHash(hash) {
|
||||
@ -716,7 +716,7 @@ ChainDB.prototype.getNextHash = co(function* getNextHash(hash) {
|
||||
/**
|
||||
* Check to see if a block is on the main chain.
|
||||
* @param {ChainEntry|Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.isMainChain = co(function* isMainChain(hash) {
|
||||
@ -747,7 +747,7 @@ ChainDB.prototype.isMainChain = co(function* isMainChain(hash) {
|
||||
* Reset the chain to a height or hash. Useful for replaying
|
||||
* the blockchain download for SPV.
|
||||
* @param {Hash|Number} block - hash/height
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype.reset = co(function* reset(block) {
|
||||
@ -792,7 +792,7 @@ ChainDB.prototype.reset = co(function* reset(block) {
|
||||
* main chain or an alternate chain. Alternate chains will only
|
||||
* be tested if the lookup is done by hash.
|
||||
* @param {Hash|Number} height - Hash or height.
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.has = co(function* has(height) {
|
||||
@ -811,7 +811,7 @@ ChainDB.prototype.has = co(function* has(height) {
|
||||
* database and potentially connect the inputs.
|
||||
* @param {Block} block
|
||||
* @param {Boolean} connect - Whether to connect the inputs.
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.saveBlock = co(function* saveBlock(block, view, connect) {
|
||||
@ -832,7 +832,7 @@ ChainDB.prototype.saveBlock = co(function* saveBlock(block, view, connect) {
|
||||
* Remove a block (not an entry) to the database.
|
||||
* Disconnect inputs.
|
||||
* @param {Block|Hash} block - {@link Block} or hash.
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.removeBlock = co(function* removeBlock(hash) {
|
||||
@ -849,7 +849,7 @@ ChainDB.prototype.removeBlock = co(function* removeBlock(hash) {
|
||||
/**
|
||||
* Connect block inputs.
|
||||
* @param {Block} block
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.connectBlock = co(function* connectBlock(block, view) {
|
||||
@ -948,7 +948,7 @@ ChainDB.prototype.connectBlock = co(function* connectBlock(block, view) {
|
||||
/**
|
||||
* Disconnect block inputs.
|
||||
* @param {Block|Hash} block - {@link Block} or hash.
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.disconnectBlock = co(function* disconnectBlock(block) {
|
||||
@ -1042,7 +1042,7 @@ ChainDB.prototype.disconnectBlock = co(function* disconnectBlock(block) {
|
||||
/**
|
||||
* Fill a transaction with coins (only unspents).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.fillCoins = co(function* fillCoins(tx) {
|
||||
@ -1069,7 +1069,7 @@ ChainDB.prototype.fillCoins = co(function* fillCoins(tx) {
|
||||
/**
|
||||
* Fill a transaction with coins (all historical coins).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.fillHistory = co(function* fillHistory(tx) {
|
||||
@ -1100,7 +1100,7 @@ ChainDB.prototype.fillHistory = co(function* fillHistory(tx) {
|
||||
* Get a coin (unspents only).
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}].
|
||||
* @returns {Promise} - Returns {@link Coin}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getCoin = co(function* getCoin(hash, index) {
|
||||
@ -1122,7 +1122,7 @@ ChainDB.prototype.getCoin = co(function* getCoin(hash, index) {
|
||||
/**
|
||||
* Get coins (unspents only).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Coins}].
|
||||
* @returns {Promise} - Returns {@link Coins}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getCoins = co(function* getCoins(hash) {
|
||||
@ -1146,7 +1146,7 @@ ChainDB.prototype.getCoins = co(function* getCoins(hash) {
|
||||
* @param {Hash} start - Block hash to start at.
|
||||
* @param {Hash[]} hashes - Address hashes.
|
||||
* @param {Function} iter - Iterator. Accepts ({@link TX}, {@link Function}).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype.scan = co(function* scan(start, filter, iter) {
|
||||
@ -1205,7 +1205,7 @@ ChainDB.prototype.scan = co(function* scan(start, filter, iter) {
|
||||
/**
|
||||
* Retrieve a transaction (not filled with coins).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getTX = co(function* getTX(hash) {
|
||||
@ -1224,7 +1224,7 @@ ChainDB.prototype.getTX = co(function* getTX(hash) {
|
||||
|
||||
/**
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.hasTX = function hasTX(hash) {
|
||||
@ -1237,7 +1237,7 @@ ChainDB.prototype.hasTX = function hasTX(hash) {
|
||||
/**
|
||||
* Get all coins pertinent to an address.
|
||||
* @param {Address[]} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getCoinsByAddress = co(function* getCoinsByAddress(addresses) {
|
||||
@ -1277,7 +1277,7 @@ ChainDB.prototype.getCoinsByAddress = co(function* getCoinsByAddress(addresses)
|
||||
|
||||
/**
|
||||
* Get all entries.
|
||||
* @param {Function} callback - Returns [Error, {@link ChainEntry}[]].
|
||||
* @returns {Promise} - Returns {@link ChainEntry}[].
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getEntries = function getEntries() {
|
||||
@ -1296,7 +1296,7 @@ ChainDB.prototype.getEntries = function getEntries() {
|
||||
/**
|
||||
* Get all transaction hashes to an address.
|
||||
* @param {Address[]} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getHashesByAddress = co(function* getHashesByAddress(addresses) {
|
||||
@ -1329,7 +1329,7 @@ ChainDB.prototype.getHashesByAddress = co(function* getHashesByAddress(addresses
|
||||
/**
|
||||
* Get all transactions pertinent to an address.
|
||||
* @param {Address[]} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getTXByAddress = co(function* getTXByAddress(addresses) {
|
||||
@ -1357,7 +1357,7 @@ ChainDB.prototype.getTXByAddress = co(function* getTXByAddress(addresses) {
|
||||
/**
|
||||
* Get a transaction and fill it with coins (historical).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getFullTX = co(function* getFullTX(hash) {
|
||||
@ -1379,7 +1379,7 @@ ChainDB.prototype.getFullTX = co(function* getFullTX(hash) {
|
||||
/**
|
||||
* Get a block and fill it with coins (historical).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getFullBlock = co(function* getFullBlock(hash) {
|
||||
@ -1397,7 +1397,7 @@ ChainDB.prototype.getFullBlock = co(function* getFullBlock(hash) {
|
||||
/**
|
||||
* Get a view of the existing coins necessary to verify a block.
|
||||
* @param {Block} block
|
||||
* @param {Function} callback - Returns [Error, {@link CoinView}].
|
||||
* @returns {Promise} - Returns {@link CoinView}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getCoinView = co(function* getCoinView(block, callback) {
|
||||
@ -1418,7 +1418,7 @@ ChainDB.prototype.getCoinView = co(function* getCoinView(block, callback) {
|
||||
/**
|
||||
* Get coins necessary to be resurrected during a reorg.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getUndoCoins = co(function* getUndoCoins(hash) {
|
||||
@ -1442,7 +1442,7 @@ ChainDB.prototype.getUndoCoins = co(function* getUndoCoins(hash) {
|
||||
* well as the coins to be resurrected for a reorg.
|
||||
* (Note: fills block with undo coins).
|
||||
* @param {Block} block
|
||||
* @param {Function} callback - Returns [Error, {@link CoinView}].
|
||||
* @returns {Promise} - Returns {@link CoinView}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getUndoView = co(function* getUndoView(block) {
|
||||
@ -1476,7 +1476,7 @@ ChainDB.prototype.getUndoView = co(function* getUndoView(block) {
|
||||
/**
|
||||
* Retrieve a block from the database (not filled with coins).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.getBlock = co(function* getBlock(hash) {
|
||||
@ -1504,7 +1504,7 @@ ChainDB.prototype.getBlock = co(function* getBlock(hash) {
|
||||
* Check whether coins are still unspent. Necessary for bip30.
|
||||
* @see https://bitcointalk.org/index.php?topic=67738.0
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
ChainDB.prototype.hasCoins = function hasCoins(hash) {
|
||||
@ -1516,7 +1516,7 @@ ChainDB.prototype.hasCoins = function hasCoins(hash) {
|
||||
* add current block to the prune queue.
|
||||
* @private
|
||||
* @param {Block}
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainDB.prototype.pruneBlock = co(function* pruneBlock(block) {
|
||||
|
||||
@ -158,7 +158,7 @@ ChainEntry.prototype.isGenesis = function isGenesis() {
|
||||
* majority window. These ancestors will be stored
|
||||
* in the `ancestors` array and enable use of synchronous
|
||||
* ChainEntry methods.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors() {
|
||||
@ -175,7 +175,7 @@ ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors() {
|
||||
/**
|
||||
* Collect ancestors.
|
||||
* @param {Number} max - Number of ancestors.
|
||||
* @param {Function} callback - Returns [Error, ChainEntry[]].
|
||||
* @returns {Promise} - Returns ChainEntry[].
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getAncestors = co(function* getAncestors(max) {
|
||||
@ -218,7 +218,7 @@ ChainEntry.prototype.getAncestors = co(function* getAncestors(max) {
|
||||
|
||||
/**
|
||||
* Test whether the entry is in the main chain.
|
||||
* @param {Function} callback - Return [Error, Boolean].
|
||||
* @returns {Promise} - Return Boolean.
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.isMainChain = function isMainChain() {
|
||||
@ -228,7 +228,7 @@ ChainEntry.prototype.isMainChain = function isMainChain() {
|
||||
/**
|
||||
* Collect ancestors up to `height`.
|
||||
* @param {Number} height
|
||||
* @param {Function} callback - Returns [Error, ChainEntry[]].
|
||||
* @returns {Promise} - Returns ChainEntry[].
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getAncestorByHeight = co(function* getAncestorByHeight(height) {
|
||||
@ -278,7 +278,7 @@ ChainEntry.prototype.getAncestor = co(function* getAncestor(index) {
|
||||
|
||||
/**
|
||||
* Get previous entry.
|
||||
* @param {Function} callback - Returns [Error, ChainEntry].
|
||||
* @returns {Promise} - Returns ChainEntry.
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getPrevious = function getPrevious() {
|
||||
@ -287,7 +287,7 @@ ChainEntry.prototype.getPrevious = function getPrevious() {
|
||||
|
||||
/**
|
||||
* Get next entry.
|
||||
* @param {Function} callback - Returns [Error, ChainEntry].
|
||||
* @returns {Promise} - Returns ChainEntry.
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getNext = co(function* getNext() {
|
||||
@ -320,7 +320,7 @@ ChainEntry.prototype.getMedianTime = function getMedianTime(ancestors) {
|
||||
|
||||
/**
|
||||
* Get median time past asynchronously (see {@link ChainEntry#getMedianTime}).
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getMedianTimeAsync = co(function* getMedianTimeAsync() {
|
||||
@ -345,7 +345,7 @@ ChainEntry.prototype.isOutdated = function isOutdated(version, ancestors) {
|
||||
/**
|
||||
* Check {@link ChainEntry#isUpgraded asynchronously}.
|
||||
* @param {Number} version
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
@ -370,7 +370,7 @@ ChainEntry.prototype.isUpgraded = function isUpgraded(version, ancestors) {
|
||||
/**
|
||||
* Check {@link ChainEntry#isUpgraded} asynchronously.
|
||||
* @param {Number} version
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
@ -406,7 +406,7 @@ ChainEntry.prototype.isSuperMajority = function isSuperMajority(version, require
|
||||
* Calculate {@link ChainEntry#isSuperMajority asynchronously}.
|
||||
* @param {Number} version
|
||||
* @param {Number} required
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ crypto.pbkdf2 = function pbkdf2(key, salt, iter, len, alg) {
|
||||
* @param {Number} iter
|
||||
* @param {Number} len
|
||||
* @param {String} alg
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
crypto.pbkdf2Async = function pbkdf2Async(key, salt, iter, len, alg) {
|
||||
@ -230,7 +230,7 @@ crypto.scrypt = function _scrypt(passwd, salt, N, r, p, len) {
|
||||
* @param {Number} r
|
||||
* @param {Number} p
|
||||
* @param {Number} len
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
crypto.scryptAsync = function _scrypt(passwd, salt, N, r, p, len) {
|
||||
@ -248,7 +248,7 @@ crypto.scryptAsync = function _scrypt(passwd, salt, N, r, p, len) {
|
||||
/**
|
||||
* Derive a key using pbkdf2 with 50,000 iterations.
|
||||
* @param {Buffer|String} passphrase
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
crypto.derive = function derive(passphrase) {
|
||||
@ -260,7 +260,7 @@ crypto.derive = function derive(passphrase) {
|
||||
* @param {Buffer} data
|
||||
* @param {Buffer|String} passphrase
|
||||
* @param {Buffer} iv - 128 bit initialization vector.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
crypto.encrypt = co(function* encrypt(data, passphrase, iv) {
|
||||
@ -311,7 +311,7 @@ crypto.encipher = function encipher(data, key, iv) {
|
||||
* @param {Buffer} data
|
||||
* @param {Buffer|String} passphrase
|
||||
* @param {Buffer} iv - 128 bit initialization vector.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
crypto.decrypt = co(function* decrypt(data, passphrase, iv) {
|
||||
|
||||
@ -60,7 +60,7 @@ utils.inherits(LowlevelUp, AsyncObject);
|
||||
/**
|
||||
* Open the database (recallable).
|
||||
* @alias LowlevelUp#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype._open = function open() {
|
||||
@ -73,7 +73,7 @@ LowlevelUp.prototype._open = function open() {
|
||||
/**
|
||||
* Close the database (recallable).
|
||||
* @alias LowlevelUp#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype._close = function close() {
|
||||
@ -85,7 +85,7 @@ LowlevelUp.prototype._close = function close() {
|
||||
|
||||
/**
|
||||
* Destroy the database.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.destroy = function destroy() {
|
||||
@ -104,7 +104,7 @@ LowlevelUp.prototype.destroy = function destroy() {
|
||||
|
||||
/**
|
||||
* Repair the database.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.repair = function repair() {
|
||||
@ -124,7 +124,7 @@ LowlevelUp.prototype.repair = function repair() {
|
||||
/**
|
||||
* Backup the database.
|
||||
* @param {String} path
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.backup = function backup(path) {
|
||||
@ -146,7 +146,7 @@ LowlevelUp.prototype.backup = function backup(path) {
|
||||
* Retrieve a record from the database.
|
||||
* @param {String} key
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback - Returns [Error, Buffer].
|
||||
* @returns {Promise} - Returns Buffer.
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.get = function get(key, options) {
|
||||
@ -171,7 +171,7 @@ LowlevelUp.prototype.get = function get(key, options) {
|
||||
* @param {String} key
|
||||
* @param {Buffer} value
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.put = function put(key, value, options) {
|
||||
@ -186,7 +186,7 @@ LowlevelUp.prototype.put = function put(key, value, options) {
|
||||
* Remove a record from the database.
|
||||
* @param {String} key
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.del = function del(key, options) {
|
||||
@ -201,7 +201,7 @@ LowlevelUp.prototype.del = function del(key, options) {
|
||||
* Create an atomic batch.
|
||||
* @param {Array?} ops
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Leveldown.Batch}
|
||||
*/
|
||||
|
||||
@ -270,7 +270,7 @@ LowlevelUp.prototype.getProperty = function getProperty(name) {
|
||||
* Calculate approximate database size.
|
||||
* @param {String} start - Start key.
|
||||
* @param {String} end - End key.
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.approximateSize = function approximateSize(start, end) {
|
||||
@ -288,7 +288,7 @@ LowlevelUp.prototype.approximateSize = function approximateSize(start, end) {
|
||||
/**
|
||||
* Test whether a key exists.
|
||||
* @param {String} key
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.has = co(function* has(key) {
|
||||
@ -299,7 +299,7 @@ LowlevelUp.prototype.has = co(function* has(key) {
|
||||
/**
|
||||
* Collect all keys from iterator options.
|
||||
* @param {Object} options - Iterator options.
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.iterate = co(function* iterate(options) {
|
||||
@ -329,7 +329,7 @@ LowlevelUp.prototype.iterate = co(function* iterate(options) {
|
||||
/**
|
||||
* Write and assert a version number for the database.
|
||||
* @param {Number} version
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.checkVersion = co(function* checkVersion(key, version) {
|
||||
@ -351,7 +351,7 @@ LowlevelUp.prototype.checkVersion = co(function* checkVersion(key, version) {
|
||||
/**
|
||||
* Clone the database.
|
||||
* @param {String} path
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LowlevelUp.prototype.clone = co(function* clone(path) {
|
||||
|
||||
@ -572,7 +572,7 @@ RBT.prototype.range = function range(gte, lte) {
|
||||
/**
|
||||
* Open the database (leveldown method).
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
RBT.prototype.open = function open(options, callback) {
|
||||
@ -591,7 +591,7 @@ RBT.prototype.open = function open(options, callback) {
|
||||
|
||||
/**
|
||||
* Close the database (leveldown method).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
RBT.prototype.close = function close(callback) {
|
||||
@ -602,7 +602,7 @@ RBT.prototype.close = function close(callback) {
|
||||
* Retrieve a record (leveldown method).
|
||||
* @param {Buffer|String} key
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback - Returns [Error, Buffer].
|
||||
* @returns {Promise} - Returns Buffer.
|
||||
*/
|
||||
|
||||
RBT.prototype.get = function get(key, options, callback) {
|
||||
@ -636,7 +636,7 @@ RBT.prototype.get = function get(key, options, callback) {
|
||||
* @param {Buffer|String} key
|
||||
* @param {Buffer} value
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
RBT.prototype.put = function put(key, value, options, callback) {
|
||||
@ -654,7 +654,7 @@ RBT.prototype.put = function put(key, value, options, callback) {
|
||||
* Remove a record (leveldown method).
|
||||
* @param {Buffer|String} key
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
RBT.prototype.del = function del(key, options, callback) {
|
||||
@ -673,7 +673,7 @@ RBT.prototype.del = function del(key, options, callback) {
|
||||
* @see Leveldown.Batch
|
||||
* @param {Object[]?} ops
|
||||
* @param {Object?} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Leveldown.Batch}
|
||||
*/
|
||||
|
||||
@ -722,7 +722,7 @@ RBT.prototype.getProperty = function getProperty(name) {
|
||||
* Calculate approximate database size (leveldown method).
|
||||
* @param {Buffer|String} start - Start key.
|
||||
* @param {Buffer|String} end - End key.
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
RBT.prototype.approximateSize = function approximateSize(start, end, callback) {
|
||||
@ -742,7 +742,7 @@ RBT.prototype.approximateSize = function approximateSize(start, end, callback) {
|
||||
/**
|
||||
* Destroy the database (leveldown function) (NOP).
|
||||
* @param {String} location
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
RBT.destroy = function destroy(location, callback) {
|
||||
@ -752,7 +752,7 @@ RBT.destroy = function destroy(location, callback) {
|
||||
/**
|
||||
* Repair the database (leveldown function) (NOP).
|
||||
* @param {String} location
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
RBT.repair = function repair(location, callback) {
|
||||
@ -934,7 +934,7 @@ Batch.prototype.del = function del(key) {
|
||||
|
||||
/**
|
||||
* Commit the batch.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Batch.prototype.write = function write(callback) {
|
||||
@ -1023,7 +1023,7 @@ function Iterator(tree, options) {
|
||||
|
||||
/**
|
||||
* Seek to the next key.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Iterator.prototype.next = function(callback) {
|
||||
|
||||
@ -208,7 +208,7 @@ HTTPBase.prototype._initIO = function _initIO() {
|
||||
/**
|
||||
* Open the server.
|
||||
* @alias HTTPBase#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPBase.prototype._open = function open() {
|
||||
@ -219,7 +219,7 @@ HTTPBase.prototype._open = function open() {
|
||||
/**
|
||||
* Close the server.
|
||||
* @alias HTTPBase#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPBase.prototype._close = function close(callback) {
|
||||
@ -245,7 +245,7 @@ HTTPBase.prototype._close = function close(callback) {
|
||||
* @param {HTTPRequest} req
|
||||
* @param {HTTPResponse} res
|
||||
* @param {Function} _send
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @private
|
||||
*/
|
||||
|
||||
@ -384,7 +384,7 @@ HTTPBase.prototype.address = function address() {
|
||||
* Listen on port and host.
|
||||
* @param {Number} port
|
||||
* @param {String?} host
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPBase.prototype.listen = function listen(port, host) {
|
||||
|
||||
@ -54,7 +54,7 @@ utils.inherits(HTTPClient, AsyncObject);
|
||||
/**
|
||||
* Open the client, wait for socket to connect.
|
||||
* @alias HTTPClient#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._open = co(function* _open() {
|
||||
@ -142,7 +142,7 @@ HTTPClient.prototype._sendAuth = function _sendAuth() {
|
||||
/**
|
||||
* Close the client, wait for the socket to close.
|
||||
* @alias HTTPClient#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._close = function close() {
|
||||
@ -161,7 +161,7 @@ HTTPClient.prototype._close = function close() {
|
||||
* @param {String} method
|
||||
* @param {String} endpoint - Path.
|
||||
* @param {Object} json - Body or query depending on method.
|
||||
* @param {Function} callback - Returns [Error, Object?].
|
||||
* @returns {Promise} - Returns Object?.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._request = co(function* _request(method, endpoint, json) {
|
||||
@ -220,7 +220,7 @@ HTTPClient.prototype._request = co(function* _request(method, endpoint, json) {
|
||||
* @private
|
||||
* @param {String} endpoint - Path.
|
||||
* @param {Object} json - Querystring.
|
||||
* @param {Function} callback - Returns [Error, Object?].
|
||||
* @returns {Promise} - Returns Object?.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._get = function _get(endpoint, json) {
|
||||
@ -232,7 +232,7 @@ HTTPClient.prototype._get = function _get(endpoint, json) {
|
||||
* @private
|
||||
* @param {String} endpoint - Path.
|
||||
* @param {Object} json - Body.
|
||||
* @param {Function} callback - Returns [Error, Object?].
|
||||
* @returns {Promise} - Returns Object?.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._post = function _post(endpoint, json) {
|
||||
@ -244,7 +244,7 @@ HTTPClient.prototype._post = function _post(endpoint, json) {
|
||||
* @private
|
||||
* @param {String} endpoint - Path.
|
||||
* @param {Object} json - Body.
|
||||
* @param {Function} callback - Returns [Error, Object?].
|
||||
* @returns {Promise} - Returns Object?.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._put = function _put(endpoint, json) {
|
||||
@ -256,7 +256,7 @@ HTTPClient.prototype._put = function _put(endpoint, json) {
|
||||
* @private
|
||||
* @param {String} endpoint - Path.
|
||||
* @param {Object} json - Body.
|
||||
* @param {Function} callback - Returns [Error, Object?].
|
||||
* @returns {Promise} - Returns Object?.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype._del = function _del(endpoint, json) {
|
||||
@ -265,7 +265,7 @@ HTTPClient.prototype._del = function _del(endpoint, json) {
|
||||
|
||||
/**
|
||||
* Get a mempool snapshot.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getMempool = function getMempool() {
|
||||
@ -274,7 +274,7 @@ HTTPClient.prototype.getMempool = function getMempool() {
|
||||
|
||||
/**
|
||||
* Get some info about the server (network and version).
|
||||
* @param {Function} callback - Returns [Error, Object].
|
||||
* @returns {Promise} - Returns Object.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getInfo = function getInfo() {
|
||||
@ -285,7 +285,7 @@ HTTPClient.prototype.getInfo = function getInfo() {
|
||||
* Get coins that pertain to an address from the mempool or chain database.
|
||||
* Takes into account spent coins in the mempool.
|
||||
* @param {Base58Address|Base58Address[]} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getCoinsByAddress = function getCoinsByAddress(address) {
|
||||
@ -298,7 +298,7 @@ HTTPClient.prototype.getCoinsByAddress = function getCoinsByAddress(address) {
|
||||
* Takes into account spent coins in the mempool.
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}].
|
||||
* @returns {Promise} - Returns {@link Coin}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getCoin = function getCoin(hash, index) {
|
||||
@ -309,7 +309,7 @@ HTTPClient.prototype.getCoin = function getCoin(hash, index) {
|
||||
* Retrieve transactions pertaining to an
|
||||
* address from the mempool or chain database.
|
||||
* @param {Base58Address|Base58Address[]} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getTXByAddress = function getTXByAddress(address) {
|
||||
@ -320,7 +320,7 @@ HTTPClient.prototype.getTXByAddress = function getTXByAddress(address) {
|
||||
/**
|
||||
* Retrieve a transaction from the mempool or chain database.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getTX = function getTX(hash) {
|
||||
@ -330,7 +330,7 @@ HTTPClient.prototype.getTX = function getTX(hash) {
|
||||
/**
|
||||
* Retrieve a block from the chain database.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getBlock = function getBlock(hash) {
|
||||
@ -340,7 +340,7 @@ HTTPClient.prototype.getBlock = function getBlock(hash) {
|
||||
/**
|
||||
* Add a transaction to the mempool and broadcast it.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.broadcast = function broadcast(tx) {
|
||||
@ -409,7 +409,7 @@ HTTPClient.prototype.none = function none() {
|
||||
* Request the raw wallet JSON (will create wallet if it does not exist).
|
||||
* @private
|
||||
* @param {Object} options - See {@link Wallet}.
|
||||
* @param {Function} callback - Returns [Error, Object].
|
||||
* @returns {Promise} - Returns Object.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.createWallet = function createWallet(options) {
|
||||
@ -420,7 +420,7 @@ HTTPClient.prototype.createWallet = function createWallet(options) {
|
||||
* Get the raw wallet JSON.
|
||||
* @private
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback - Returns [Error, Object].
|
||||
* @returns {Promise} - Returns Object.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getWallet = function getWallet(id) {
|
||||
@ -430,7 +430,7 @@ HTTPClient.prototype.getWallet = function getWallet(id) {
|
||||
/**
|
||||
* Get wallet transaction history.
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getHistory = function getHistory(id, account) {
|
||||
@ -441,7 +441,7 @@ HTTPClient.prototype.getHistory = function getHistory(id, account) {
|
||||
/**
|
||||
* Get wallet coins.
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getCoins = function getCoins(id, account) {
|
||||
@ -452,7 +452,7 @@ HTTPClient.prototype.getCoins = function getCoins(id, account) {
|
||||
/**
|
||||
* Get all unconfirmed transactions.
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getUnconfirmed = function getUnconfirmed(id, account) {
|
||||
@ -463,7 +463,7 @@ HTTPClient.prototype.getUnconfirmed = function getUnconfirmed(id, account) {
|
||||
/**
|
||||
* Calculate wallet balance.
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback - Returns [Error, {@link Balance}].
|
||||
* @returns {Promise} - Returns {@link Balance}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getBalance = function getBalance(id, account) {
|
||||
@ -475,7 +475,7 @@ HTTPClient.prototype.getBalance = function getBalance(id, account) {
|
||||
* Get last N wallet transactions.
|
||||
* @param {WalletID} id
|
||||
* @param {Number} limit - Max number of transactions.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getLast = function getLast(id, account, limit) {
|
||||
@ -491,7 +491,7 @@ HTTPClient.prototype.getLast = function getLast(id, account, limit) {
|
||||
* @param {Number} options.end - End time.
|
||||
* @param {Number?} options.limit - Max number of records.
|
||||
* @param {Boolean?} options.reverse - Reverse order.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getRange = function getRange(id, account, options) {
|
||||
@ -510,7 +510,7 @@ HTTPClient.prototype.getRange = function getRange(id, account, options) {
|
||||
* is available in the wallet history).
|
||||
* @param {WalletID} id
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getWalletTX = function getWalletTX(id, account, hash) {
|
||||
@ -524,7 +524,7 @@ HTTPClient.prototype.getWalletTX = function getWalletTX(id, account, hash) {
|
||||
* @param {WalletID} id
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getWalletCoin = function getWalletCoin(id, account, hash, index) {
|
||||
@ -539,7 +539,7 @@ HTTPClient.prototype.getWalletCoin = function getWalletCoin(id, account, hash, i
|
||||
* @param {Object} options
|
||||
* @param {Base58Address} options.address
|
||||
* @param {Amount} options.value
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.send = function send(id, options) {
|
||||
@ -563,7 +563,7 @@ HTTPClient.prototype.send = function send(id, options) {
|
||||
/**
|
||||
* Generate a new token.
|
||||
* @param {(String|Buffer)?} passphrase
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.retoken = co(function* retoken(id, passphrase) {
|
||||
@ -576,7 +576,7 @@ HTTPClient.prototype.retoken = co(function* retoken(id, passphrase) {
|
||||
* Change or set master key's passphrase.
|
||||
* @param {(String|Buffer)?} old
|
||||
* @param {String|Buffer} new_
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.setPassphrase = function setPassphrase(id, old, new_) {
|
||||
@ -588,7 +588,7 @@ HTTPClient.prototype.setPassphrase = function setPassphrase(id, old, new_) {
|
||||
* Create a transaction, fill.
|
||||
* @param {WalletID} id
|
||||
* @param {Object} options
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.createTX = function createTX(id, options) {
|
||||
@ -613,7 +613,7 @@ HTTPClient.prototype.createTX = function createTX(id, options) {
|
||||
* @param {WalletID} id
|
||||
* @param {TX} tx
|
||||
* @param {Object} options
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.sign = function sign(id, tx, options) {
|
||||
@ -631,7 +631,7 @@ HTTPClient.prototype.sign = function sign(id, tx, options) {
|
||||
/**
|
||||
* Fill a transaction with coins.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.fillCoins = function fillCoins(id, tx) {
|
||||
@ -643,7 +643,7 @@ HTTPClient.prototype.fillCoins = function fillCoins(id, tx) {
|
||||
* @param {WalletID} id
|
||||
* @param {Number} now - Current time.
|
||||
* @param {Number} age - Age delta (delete transactions older than `now - age`).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.zap = function zap(id, account, age) {
|
||||
@ -661,7 +661,7 @@ HTTPClient.prototype.zap = function zap(id, account, age) {
|
||||
* @param {(String|Number)?} account
|
||||
* @param {HDPublicKey|Base58String} key - Account (bip44) or
|
||||
* Purpose (bip45) key (can be in base58 form).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.addKey = function addKey(id, account, key) {
|
||||
@ -679,7 +679,7 @@ HTTPClient.prototype.addKey = function addKey(id, account, key) {
|
||||
* @param {(String|Number)?} account
|
||||
* @param {HDPublicKey|Base58String} key - Account (bip44) or Purpose
|
||||
* (bip45) key (can be in base58 form).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.removeKey = function removeKey(id, account, key) {
|
||||
@ -694,7 +694,7 @@ HTTPClient.prototype.removeKey = function removeKey(id, account, key) {
|
||||
/**
|
||||
* Get wallet accounts.
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getAccounts = function getAccounts(id) {
|
||||
@ -706,7 +706,7 @@ HTTPClient.prototype.getAccounts = function getAccounts(id) {
|
||||
* Get wallet account.
|
||||
* @param {WalletID} id
|
||||
* @param {String} account
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.getAccount = function getAccount(id, account) {
|
||||
@ -718,7 +718,7 @@ HTTPClient.prototype.getAccount = function getAccount(id, account) {
|
||||
* Create account.
|
||||
* @param {WalletID} id
|
||||
* @param {Object} options
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.createAccount = function createAccount(id, options) {
|
||||
@ -739,7 +739,7 @@ HTTPClient.prototype.createAccount = function createAccount(id, options) {
|
||||
* Create address.
|
||||
* @param {WalletID} id
|
||||
* @param {Object} options
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
HTTPClient.prototype.createAddress = function createAddress(id, options) {
|
||||
|
||||
@ -42,7 +42,7 @@ function RPCClient(options) {
|
||||
* @private
|
||||
* @param {String} method - RPC method name.
|
||||
* @param {Array} params - RPC parameters.
|
||||
* @param {Function} callback - Returns [Error, Object?].
|
||||
* @returns {Promise} - Returns Object?.
|
||||
*/
|
||||
|
||||
RPCClient.prototype.call = co(function* call(method, params) {
|
||||
|
||||
@ -996,7 +996,7 @@ HTTPServer.prototype._initIO = function _initIO() {
|
||||
|
||||
/**
|
||||
* Open the server, wait for socket.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPServer.prototype.open = co(function* open() {
|
||||
@ -1014,7 +1014,7 @@ HTTPServer.prototype.open = co(function* open() {
|
||||
|
||||
/**
|
||||
* Close the server, wait for server socket to close.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPServer.prototype.close = function close() {
|
||||
|
||||
@ -87,7 +87,7 @@ HTTPWallet.prototype._init = function _init() {
|
||||
/**
|
||||
* Open the client and get a wallet.
|
||||
* @alias HTTPWallet#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPWallet.prototype.open = co(function* open(options) {
|
||||
@ -114,7 +114,7 @@ HTTPWallet.prototype.open = co(function* open(options) {
|
||||
/**
|
||||
* Open the client and create a wallet.
|
||||
* @alias HTTPWallet#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPWallet.prototype.create = co(function* create(options) {
|
||||
@ -130,7 +130,7 @@ HTTPWallet.prototype.create = co(function* create(options) {
|
||||
/**
|
||||
* Close the client, wait for the socket to close.
|
||||
* @alias HTTPWallet#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HTTPWallet.prototype.close = function close() {
|
||||
|
||||
@ -118,7 +118,7 @@ utils.inherits(Mempool, AsyncObject);
|
||||
/**
|
||||
* Open the chain, wait for the database to load.
|
||||
* @alias Mempool#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype._open = co(function* open() {
|
||||
@ -130,7 +130,7 @@ Mempool.prototype._open = co(function* open() {
|
||||
/**
|
||||
* Close the chain, wait for the database to close.
|
||||
* @alias Mempool#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype._close = function close() {
|
||||
@ -142,7 +142,7 @@ Mempool.prototype._close = function close() {
|
||||
* in (removes all transactions contained in the
|
||||
* block from the mempool).
|
||||
* @param {Block} block
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.addBlock = co(function* addBlock(block) {
|
||||
@ -159,7 +159,7 @@ Mempool.prototype.addBlock = co(function* addBlock(block) {
|
||||
* has come without a lock.
|
||||
* @private
|
||||
* @param {Block} block
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype._addBlock = co(function* addBlock(block) {
|
||||
@ -203,7 +203,7 @@ Mempool.prototype._addBlock = co(function* addBlock(block) {
|
||||
* Notify the mempool that a block has been disconnected
|
||||
* from the main chain (reinserts transactions into the mempool).
|
||||
* @param {Block} block
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.removeBlock = co(function* removeBlock(block) {
|
||||
@ -220,7 +220,7 @@ Mempool.prototype.removeBlock = co(function* removeBlock(block) {
|
||||
* has been disconnected without a lock.
|
||||
* @private
|
||||
* @param {Block} block
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype._removeBlock = co(function* removeBlock(block) {
|
||||
@ -249,7 +249,7 @@ Mempool.prototype._removeBlock = co(function* removeBlock(block) {
|
||||
/**
|
||||
* Ensure the size of the mempool stays below 300mb.
|
||||
* @param {Hash} entryHash - TX that initiated the trim.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.limitMempoolSize = function limitMempoolSize(entryHash) {
|
||||
@ -542,7 +542,7 @@ Mempool.prototype.hasReject = function hasReject(hash) {
|
||||
* will lock the mempool until the transaction is
|
||||
* fully processed.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.addTX = co(function* addTX(tx) {
|
||||
@ -572,7 +572,7 @@ Mempool.prototype.addTX = co(function* addTX(tx) {
|
||||
* Add a transaction to the mempool without a lock.
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype._addTX = co(function* _addTX(tx) {
|
||||
@ -692,7 +692,7 @@ Mempool.prototype._addTX = co(function* _addTX(tx) {
|
||||
* This function will also resolve orphans if possible (the
|
||||
* resolved orphans _will_ be validated).
|
||||
* @param {MempoolEntry} entry
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.addUnchecked = co(function* addUnchecked(entry) {
|
||||
@ -708,7 +708,7 @@ Mempool.prototype.addUnchecked = co(function* addUnchecked(entry) {
|
||||
* Add a transaction to the mempool without a lock.
|
||||
* @private
|
||||
* @param {MempoolEntry} entry
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype._addUnchecked = co(function* addUnchecked(entry) {
|
||||
@ -839,7 +839,7 @@ Mempool.prototype.getMinRate = function getMinRate() {
|
||||
/**
|
||||
* Verify a transaction with mempool standards.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [{@link VerifyError}].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.verify = co(function* verify(entry) {
|
||||
@ -995,7 +995,7 @@ Mempool.prototype.verify = co(function* verify(entry) {
|
||||
* instead of an error based on success.
|
||||
* @param {TX} tx
|
||||
* @param {VerifyFlags} flags
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.checkResult = co(function* checkResult(tx, flags) {
|
||||
@ -1014,7 +1014,7 @@ Mempool.prototype.checkResult = co(function* checkResult(tx, flags) {
|
||||
* _and_ mandatory flags on failure.
|
||||
* @param {TX} tx
|
||||
* @param {VerifyFlags} flags
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.checkInputs = co(function* checkInputs(tx, flags) {
|
||||
@ -1421,7 +1421,7 @@ Mempool.prototype.removeOrphan = function removeOrphan(tx) {
|
||||
* except that it will also fill with coins
|
||||
* from the blockchain as well.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Mempool.prototype.fillAllHistory = function fillAllHistory(tx) {
|
||||
@ -1439,7 +1439,7 @@ Mempool.prototype.fillAllHistory = function fillAllHistory(tx) {
|
||||
* except that it will also fill with coins
|
||||
* from the blockchain as well.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Mempool.prototype.fillAllCoins = co(function* fillAllCoins(tx) {
|
||||
@ -1481,7 +1481,7 @@ Mempool.prototype.getSnapshot = function getSnapshot() {
|
||||
* Check sequence locks on a transaction against the current tip.
|
||||
* @param {TX} tx
|
||||
* @param {LockFlags} flags
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Mempool.prototype.checkLocks = function checkLocks(tx, flags) {
|
||||
@ -1495,7 +1495,7 @@ Mempool.prototype.checkLocks = function checkLocks(tx, flags) {
|
||||
* the blockchain does not maintain a spent list. The transaction will
|
||||
* be seen as an orphan rather than a double spend.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Mempool.prototype.isDoubleSpend = function isDoubleSpend(tx) {
|
||||
@ -1515,7 +1515,7 @@ Mempool.prototype.isDoubleSpend = function isDoubleSpend(tx) {
|
||||
* Calculate bitcoinj-style confidence.
|
||||
* @see http://bit.ly/1OVQwlO
|
||||
* @param {TX|Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
Mempool.prototype.getConfidence = co(function* getConfidence(hash) {
|
||||
@ -1644,7 +1644,7 @@ Mempool.prototype.untrackEntry = function untrackEntry(entry) {
|
||||
* @private
|
||||
* @param {MempoolEntry} entry
|
||||
* @param {Boolean} limit
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Mempool.prototype.removeSpenders = function removeSpenders(entry) {
|
||||
|
||||
@ -132,7 +132,7 @@ Miner.prototype._init = function _init() {
|
||||
/**
|
||||
* Open the miner, wait for the chain and mempool to load.
|
||||
* @alias Miner#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Miner.prototype._open = co(function* open() {
|
||||
@ -148,7 +148,7 @@ Miner.prototype._open = co(function* open() {
|
||||
/**
|
||||
* Close the miner.
|
||||
* @alias Miner#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Miner.prototype._close = function close() {
|
||||
@ -234,7 +234,7 @@ Miner.prototype.stop = function stop() {
|
||||
/**
|
||||
* Create a block "attempt".
|
||||
* @param {Number?} version - Custom block version.
|
||||
* @param {Function} callback - Returns [Error, {@link MinerBlock}].
|
||||
* @returns {Promise} - Returns {@link MinerBlock}.
|
||||
*/
|
||||
|
||||
Miner.prototype.createBlock = co(function* createBlock(tip) {
|
||||
@ -287,7 +287,7 @@ Miner.prototype.createBlock = co(function* createBlock(tip) {
|
||||
/**
|
||||
* Mine a single block.
|
||||
* @param {Number?} version - Custom block version.
|
||||
* @param {Function} callback - Returns [Error, [{@link Block}]].
|
||||
* @returns {Promise} - Returns [{@link Block}].
|
||||
*/
|
||||
|
||||
Miner.prototype.mineBlock = co(function* mineBlock(tip) {
|
||||
|
||||
@ -347,7 +347,7 @@ MinerBlock.prototype.sendStatus = function sendStatus() {
|
||||
/**
|
||||
* Mine until the block is found. Will take a breather
|
||||
* for 100ms every time the nonce overflows.
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
MinerBlock.prototype.mine = co(function* mine() {
|
||||
@ -389,7 +389,7 @@ MinerBlock.prototype.mineSync = function mineSync() {
|
||||
|
||||
/**
|
||||
* Attempt to mine the block on the worker pool.
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
MinerBlock.prototype.mineAsync = co(function* mineAsync() {
|
||||
|
||||
@ -453,7 +453,7 @@ BIP151.prototype.complete = function complete(err) {
|
||||
/**
|
||||
* Set a timeout and wait for handshake to complete.
|
||||
* @param {Number} timeout - Timeout in ms.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
BIP151.prototype.wait = function wait(timeout) {
|
||||
|
||||
@ -816,7 +816,7 @@ Peer.prototype.error = function error(err, keep) {
|
||||
* Wait for a packet to be received from peer.
|
||||
* @private
|
||||
* @param {String} cmd - Packet name.
|
||||
* @param {Function} callback - Returns [Error, Object(payload)].
|
||||
* @returns {Promise} - Returns Object(payload).
|
||||
* Executed on timeout or once packet is received.
|
||||
*/
|
||||
|
||||
@ -1458,7 +1458,7 @@ Peer.prototype._handleMempool = function _handleMempool(packet) {
|
||||
/**
|
||||
* Get a block/tx either from the broadcast map, mempool, or blockchain.
|
||||
* @param {InvItem} item
|
||||
* @param {Function} callback - Returns
|
||||
* @returns {Promise}
|
||||
* [Error, {@link Block}|{@link MempoolEntry}].
|
||||
*/
|
||||
|
||||
@ -2375,7 +2375,7 @@ Peer.prototype.reject = function reject(obj, code, reason, score) {
|
||||
* locator and resolving orphan root.
|
||||
* @param {Hash} tip - Tip to build chain locator from.
|
||||
* @param {Hash} orphan - Orphan hash to resolve.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Peer.prototype.resolveOrphan = co(function* resolveOrphan(tip, orphan) {
|
||||
@ -2399,7 +2399,7 @@ Peer.prototype.resolveOrphan = co(function* resolveOrphan(tip, orphan) {
|
||||
* Send `getheaders` to peer after building locator.
|
||||
* @param {Hash} tip - Tip to build chain locator from.
|
||||
* @param {Hash?} stop
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Peer.prototype.getHeaders = co(function* getHeaders(tip, stop) {
|
||||
@ -2411,7 +2411,7 @@ Peer.prototype.getHeaders = co(function* getHeaders(tip, stop) {
|
||||
* Send `getblocks` to peer after building locator.
|
||||
* @param {Hash} tip - Tip hash to build chain locator from.
|
||||
* @param {Hash?} stop
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Peer.prototype.getBlocks = co(function* getBlocks(tip, stop) {
|
||||
@ -2421,7 +2421,7 @@ Peer.prototype.getBlocks = co(function* getBlocks(tip, stop) {
|
||||
|
||||
/**
|
||||
* Start syncing from peer.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Peer.prototype.sync = function sync() {
|
||||
|
||||
@ -279,7 +279,7 @@ Pool.prototype._init = function _init() {
|
||||
/**
|
||||
* Open the pool, wait for the chain to load.
|
||||
* @alias Pool#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._open = co(function* _open() {
|
||||
@ -318,7 +318,7 @@ Pool.prototype._open = co(function* _open() {
|
||||
/**
|
||||
* Close and destroy the pool.
|
||||
* @alias Pool#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._close = co(function* close() {
|
||||
@ -392,7 +392,7 @@ Pool.prototype.connect = function connect() {
|
||||
|
||||
/**
|
||||
* Start listening on a server socket.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.listen = function listen() {
|
||||
@ -428,7 +428,7 @@ Pool.prototype.listen = function listen() {
|
||||
|
||||
/**
|
||||
* Stop listening on server socket.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.unlisten = function unlisten() {
|
||||
@ -709,7 +709,7 @@ Pool.prototype.stopSync = function stopSync() {
|
||||
* @private
|
||||
* @param {Headers[]} headers
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._handleHeaders = co(function* _handleHeaders(headers, peer) {
|
||||
@ -727,7 +727,7 @@ Pool.prototype._handleHeaders = co(function* _handleHeaders(headers, peer) {
|
||||
* @private
|
||||
* @param {Headers[]} headers
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.__handleHeaders = co(function* _handleHeaders(headers, peer) {
|
||||
@ -790,7 +790,7 @@ Pool.prototype.__handleHeaders = co(function* _handleHeaders(headers, peer) {
|
||||
* @private
|
||||
* @param {Hash[]} hashes
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._handleBlocks = co(function* _handleBlocks(hashes, peer) {
|
||||
@ -858,7 +858,7 @@ Pool.prototype._handleBlocks = co(function* _handleBlocks(hashes, peer) {
|
||||
* @private
|
||||
* @param {Hash[]} hashes
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._handleInv = co(function* _handleInv(hashes, peer) {
|
||||
@ -875,7 +875,7 @@ Pool.prototype._handleInv = co(function* _handleInv(hashes, peer) {
|
||||
* @private
|
||||
* @param {Hash[]} hashes
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.__handleInv = co(function* _handleInv(hashes, peer) {
|
||||
@ -903,7 +903,7 @@ Pool.prototype.__handleInv = co(function* _handleInv(hashes, peer) {
|
||||
* @private
|
||||
* @param {MemBlock|MerkleBlock} block
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._handleBlock = co(function* _handleBlock(block, peer) {
|
||||
@ -1323,7 +1323,7 @@ Pool.prototype.hasReject = function hasReject(hash) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {Peer} peer
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype._handleTX = co(function* _handleTX(tx, peer) {
|
||||
@ -1534,7 +1534,7 @@ Pool.prototype.watchAddress = function watchAddress(address) {
|
||||
* @param {Peer} peer
|
||||
* @param {Number} type - `getdata` type (see {@link constants.inv}).
|
||||
* @param {Hash} hash - {@link Block} or {@link TX} hash.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.getData = co(function* getData(peer, type, hash) {
|
||||
@ -1580,7 +1580,7 @@ Pool.prototype.getData = co(function* getData(peer, type, hash) {
|
||||
* @param {Peer} peer
|
||||
* @param {InvType} type
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Pool.prototype.has = co(function* has(peer, type, hash) {
|
||||
@ -1611,7 +1611,7 @@ Pool.prototype.has = co(function* has(peer, type, hash) {
|
||||
* Test whether the chain or mempool has seen an item.
|
||||
* @param {InvType} type
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Pool.prototype.exists = function exists(type, hash) {
|
||||
@ -1713,7 +1713,7 @@ Pool.prototype.fulfill = function fulfill(data) {
|
||||
/**
|
||||
* Broadcast a transaction or block.
|
||||
* @param {TX|Block|InvItem} msg
|
||||
* @param {Function} callback - Returns [Error]. Executes on request, reject,
|
||||
* @returns {Promise}
|
||||
* or timeout.
|
||||
* @returns {BroadcastItem}
|
||||
*/
|
||||
@ -1867,7 +1867,7 @@ Pool.prototype.isIgnored = function isIgnored(addr) {
|
||||
|
||||
/**
|
||||
* Attempt to retrieve external IP from icanhazip.com.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.getIP = co(function* getIP() {
|
||||
@ -1899,7 +1899,7 @@ Pool.prototype.getIP = co(function* getIP() {
|
||||
|
||||
/**
|
||||
* Attempt to retrieve external IP from dyndns.org.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Pool.prototype.getIP2 = co(function* getIP2() {
|
||||
@ -2283,7 +2283,7 @@ HostList.prototype.addSeed = function addSeed(hostname) {
|
||||
* @param {Peer} peer
|
||||
* @param {Number} type - `getdata` type (see {@link constants.inv}).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
function LoadRequest(pool, peer, type, hash, callback) {
|
||||
@ -2330,7 +2330,7 @@ LoadRequest.prototype._onTimeout = function _onTimeout() {
|
||||
|
||||
/**
|
||||
* Add a callback to be executed when item is received.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
LoadRequest.prototype.addCallback = function addCallback(callback) {
|
||||
@ -2465,7 +2465,7 @@ utils.inherits(BroadcastItem, EventEmitter);
|
||||
|
||||
/**
|
||||
* Add a callback to be executed on ack, timeout, or reject.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
BroadcastItem.prototype.addCallback = function addCallback(callback) {
|
||||
|
||||
@ -220,7 +220,7 @@ Fullnode.prototype._init = function _init() {
|
||||
* Open the node and all its child objects,
|
||||
* wait for the database to load.
|
||||
* @alias Fullnode#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Fullnode.prototype._open = co(function* open() {
|
||||
@ -248,7 +248,7 @@ Fullnode.prototype._open = co(function* open() {
|
||||
/**
|
||||
* Close the node, wait for the database to close.
|
||||
* @alias Fullnode#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Fullnode.prototype._close = co(function* close() {
|
||||
@ -268,7 +268,7 @@ Fullnode.prototype._close = co(function* close() {
|
||||
|
||||
/**
|
||||
* Rescan for any missed transactions.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Fullnode.prototype.rescan = function rescan() {
|
||||
@ -289,7 +289,7 @@ Fullnode.prototype.rescan = function rescan() {
|
||||
* by the mempool - use with care, lest you get banned from
|
||||
* bitcoind nodes).
|
||||
* @param {TX|Block} item
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Fullnode.prototype.broadcast = function broadcast(item, callback) {
|
||||
@ -360,7 +360,7 @@ Fullnode.prototype.stopSync = function stopSync() {
|
||||
/**
|
||||
* Retrieve a block from the chain database.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getBlock = function getBlock(hash) {
|
||||
@ -370,7 +370,7 @@ Fullnode.prototype.getBlock = function getBlock(hash) {
|
||||
/**
|
||||
* Retrieve a block from the chain database, filled with coins.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link Block}].
|
||||
* @returns {Promise} - Returns {@link Block}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getFullBlock = function getFullBlock(hash) {
|
||||
@ -382,7 +382,7 @@ Fullnode.prototype.getFullBlock = function getFullBlock(hash) {
|
||||
* Takes into account spent coins in the mempool.
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}].
|
||||
* @returns {Promise} - Returns {@link Coin}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getCoin = function getCoin(hash, index) {
|
||||
@ -401,7 +401,7 @@ Fullnode.prototype.getCoin = function getCoin(hash, index) {
|
||||
* Get coins that pertain to an address from the mempool or chain database.
|
||||
* Takes into account spent coins in the mempool.
|
||||
* @param {Address} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getCoinsByAddress = co(function* getCoinsByAddress(addresses) {
|
||||
@ -425,7 +425,7 @@ Fullnode.prototype.getCoinsByAddress = co(function* getCoinsByAddress(addresses)
|
||||
* Retrieve transactions pertaining to an
|
||||
* address from the mempool or chain database.
|
||||
* @param {Address} addresses
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getTXByAddress = co(function* getTXByAddress(addresses) {
|
||||
@ -437,7 +437,7 @@ Fullnode.prototype.getTXByAddress = co(function* getTXByAddress(addresses) {
|
||||
/**
|
||||
* Retrieve a transaction from the mempool or chain database.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getTX = function getTX(hash) {
|
||||
@ -452,7 +452,7 @@ Fullnode.prototype.getTX = function getTX(hash) {
|
||||
/**
|
||||
* Test whether the mempool or chain contains a transaction.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.hasTX = function hasTX(hash) {
|
||||
@ -466,7 +466,7 @@ Fullnode.prototype.hasTX = function hasTX(hash) {
|
||||
* Check whether a coin has been spent.
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.isSpent = function isSpent(hash, index) {
|
||||
@ -480,7 +480,7 @@ Fullnode.prototype.isSpent = function isSpent(hash, index) {
|
||||
* Fill a transaction with coins from the mempool
|
||||
* and chain database (unspent only).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.fillCoins = function fillCoins(tx) {
|
||||
@ -491,7 +491,7 @@ Fullnode.prototype.fillCoins = function fillCoins(tx) {
|
||||
* Fill a transaction with all historical coins
|
||||
* from the mempool and chain database.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.fillHistory = function fillHistory(tx) {
|
||||
@ -501,7 +501,7 @@ Fullnode.prototype.fillHistory = function fillHistory(tx) {
|
||||
/**
|
||||
* Return bitcoinj-style confidence for a transaction.
|
||||
* @param {Hash|TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link Confidence}].
|
||||
* @returns {Promise} - Returns {@link Confidence}.
|
||||
*/
|
||||
|
||||
Fullnode.prototype.getConfidence = function getConfidence(tx) {
|
||||
|
||||
@ -231,7 +231,7 @@ Node.prototype.location = function location(name) {
|
||||
|
||||
/**
|
||||
* Open and ensure primary wallet.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Node.prototype.openWallet = co(function* openWallet() {
|
||||
@ -262,7 +262,7 @@ Node.prototype.openWallet = co(function* openWallet() {
|
||||
|
||||
/**
|
||||
* Resend all pending transactions.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Node.prototype.resend = function resend() {
|
||||
|
||||
@ -145,7 +145,7 @@ SPVNode.prototype._init = function _init() {
|
||||
* Open the node and all its child objects,
|
||||
* wait for the database to load.
|
||||
* @alias SPVNode#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
SPVNode.prototype._open = co(function* open(callback) {
|
||||
@ -174,7 +174,7 @@ SPVNode.prototype._open = co(function* open(callback) {
|
||||
/**
|
||||
* Close the node, wait for the database to close.
|
||||
* @alias SPVNode#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
SPVNode.prototype._close = co(function* close() {
|
||||
@ -188,7 +188,7 @@ SPVNode.prototype._close = co(function* close() {
|
||||
|
||||
/**
|
||||
* Initialize p2p bloom filter for address watching.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
SPVNode.prototype.openFilter = co(function* openFilter() {
|
||||
@ -205,7 +205,7 @@ SPVNode.prototype.openFilter = co(function* openFilter() {
|
||||
/**
|
||||
* Rescan for any missed transactions.
|
||||
* Note that this will replay the blockchain sync.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
SPVNode.prototype.rescan = function rescan() {
|
||||
@ -230,7 +230,7 @@ SPVNode.prototype.rescan = function rescan() {
|
||||
* by the mempool - use with care, lest you get banned from
|
||||
* bitcoind nodes).
|
||||
* @param {TX|Block} item
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
SPVNode.prototype.broadcast = function broadcast(item) {
|
||||
@ -242,7 +242,7 @@ SPVNode.prototype.broadcast = function broadcast(item) {
|
||||
* by the mempool - use with care, lest you get banned from
|
||||
* bitcoind nodes).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
SPVNode.prototype.sendTX = function sendTX(tx) {
|
||||
|
||||
@ -391,7 +391,7 @@ MTX.prototype.scriptVector = function scriptVector(prev, vector, ring) {
|
||||
* @param {Number} index
|
||||
* @param {Buffer} key
|
||||
* @param {SighashType?} type
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
MTX.prototype.signInputAsync = function signInputAsync(index, key, type) {
|
||||
@ -909,7 +909,7 @@ MTX.prototype.sign = function sign(ring, type) {
|
||||
* (if workers are enabled).
|
||||
* @param {KeyRing} ring
|
||||
* @param {SighashType?} type
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Boolean} Whether the inputs are valid.
|
||||
*/
|
||||
|
||||
|
||||
@ -709,7 +709,7 @@ TX.prototype.verifyInput = function verifyInput(index, flags) {
|
||||
* Verify the transaction inputs on the worker pool
|
||||
* (if workers are enabled).
|
||||
* @param {VerifyFlags?} [flags=STANDARD_VERIFY_FLAGS]
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Boolean} Whether the inputs are valid.
|
||||
*/
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ utils.inherits(AsyncObject, EventEmitter);
|
||||
|
||||
/**
|
||||
* Open the object (recallable).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
AsyncObject.prototype._onOpen = function _onOpen() {
|
||||
@ -98,7 +98,7 @@ AsyncObject.prototype.open = co(function* open() {
|
||||
|
||||
/**
|
||||
* Close the object (recallable).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
AsyncObject.prototype.close = co(function* close() {
|
||||
@ -146,7 +146,7 @@ AsyncObject.prototype.close = co(function* close() {
|
||||
/**
|
||||
* Close the object (recallable).
|
||||
* @method
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
AsyncObject.prototype.destroy = AsyncObject.prototype.close;
|
||||
@ -173,7 +173,7 @@ AsyncObject.prototype._error = function _error(event, err) {
|
||||
/**
|
||||
* Initialize the object.
|
||||
* @private
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
AsyncObject.prototype._open = function _open(callback) {
|
||||
@ -183,7 +183,7 @@ AsyncObject.prototype._open = function _open(callback) {
|
||||
/**
|
||||
* Close the object.
|
||||
* @private
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
AsyncObject.prototype._close = function _close(callback) {
|
||||
|
||||
@ -145,7 +145,7 @@ function con(generator) {
|
||||
* Wait for promise to resolve and
|
||||
* execute a node.js style callback.
|
||||
* @param {Promise} promise
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
function cb(promise, callback) {
|
||||
|
||||
@ -310,7 +310,7 @@ utils.equal = function equal(a, b) {
|
||||
* or `setInterval` depending.
|
||||
* @name nextTick
|
||||
* @function
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
if (utils.isBrowser)
|
||||
@ -328,7 +328,7 @@ if (typeof setImmediate === 'function') {
|
||||
|
||||
/**
|
||||
* Wrap a function in a `nextTick`.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Function} Asyncified function.
|
||||
*/
|
||||
|
||||
@ -353,7 +353,7 @@ utils.asyncify = function asyncify(callback) {
|
||||
|
||||
/**
|
||||
* Ensure a callback exists, return a NOP if not.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Function}
|
||||
*/
|
||||
|
||||
@ -1639,7 +1639,7 @@ utils.icmp = function icmp(target, data, start) {
|
||||
* @param {Number} from
|
||||
* @param {Number} to
|
||||
* @param {Function} iter
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.forRange = function forRange(from, to, iter, callback) {
|
||||
@ -1667,7 +1667,7 @@ utils.forRange = function forRange(from, to, iter, callback) {
|
||||
* Asynchronously iterate over an array in parallel.
|
||||
* @param {Array} obj
|
||||
* @param {Function} iter
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.forEach = function forEach(obj, iter, callback) {
|
||||
@ -1697,7 +1697,7 @@ utils.forEach = function forEach(obj, iter, callback) {
|
||||
* @param {Number} from
|
||||
* @param {Number} to
|
||||
* @param {Function} iter
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.forRangeSerial = function forRangeSerial(from, to, iter, callback) {
|
||||
@ -1726,7 +1726,7 @@ utils.forRangeSerial = function forRangeSerial(from, to, iter, callback) {
|
||||
* Asynchronously iterate over an array in serial.
|
||||
* @param {Array} obj
|
||||
* @param {Function} iter
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.forEachSerial = function forEachSerial(obj, iter, callback) {
|
||||
@ -1759,7 +1759,7 @@ utils.forEachSerial = function forEachSerial(obj, iter, callback) {
|
||||
* member of an array in parallel.
|
||||
* @param {Array} obj
|
||||
* @param {Function} iter
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.every = function every(obj, iter, callback) {
|
||||
@ -1795,7 +1795,7 @@ utils.every = function every(obj, iter, callback) {
|
||||
* member of an array in serial.
|
||||
* @param {Array} obj
|
||||
* @param {Function} iter
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.everySerial = function everySerial(obj, iter, callback) {
|
||||
@ -1875,7 +1875,7 @@ utils.inherits = function inherits(obj, from) {
|
||||
|
||||
/**
|
||||
* Wrap a callback to ensure it is only called once.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Function} Wrapped callback.
|
||||
*/
|
||||
|
||||
@ -1994,7 +1994,7 @@ utils.hex32 = function hex32(num) {
|
||||
/**
|
||||
* Wrap a callback with an `unlock` callback.
|
||||
* @see Locker
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @param {Function} unlock
|
||||
* @returns {Function} Wrapped callback.
|
||||
*/
|
||||
@ -2010,7 +2010,7 @@ utils.wrap = function wrap(callback, unlock) {
|
||||
/**
|
||||
* Execute a stack of functions in parallel.
|
||||
* @param {Function[]} stack
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.parallel = function parallel(stack, callback) {
|
||||
@ -2051,7 +2051,7 @@ utils.parallel = function parallel(stack, callback) {
|
||||
/**
|
||||
* Execute a stack of functions in serial.
|
||||
* @param {Function[]} stack
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
utils.serial = function serial(stack, callback) {
|
||||
|
||||
@ -202,7 +202,7 @@ Account.MAX_LOOKAHEAD = 5;
|
||||
* the first addresses along with the lookahead
|
||||
* addresses). Called automatically from the
|
||||
* walletdb.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype.init = co(function* init() {
|
||||
@ -222,7 +222,7 @@ Account.prototype.init = co(function* init() {
|
||||
|
||||
/**
|
||||
* Open the account (done after retrieval).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype.open = function open() {
|
||||
@ -302,7 +302,7 @@ Account.prototype.spliceKey = function spliceKey(key) {
|
||||
* Add a public account key to the account (multisig).
|
||||
* Saves the key in the wallet database.
|
||||
* @param {HDPublicKey} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype.addKey = co(function* addKey(key) {
|
||||
@ -331,7 +331,7 @@ Account.prototype.addKey = co(function* addKey(key) {
|
||||
/**
|
||||
* Ensure accounts are not sharing keys.
|
||||
* @private
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype._checkKeys = co(function* _checkKeys() {
|
||||
@ -358,7 +358,7 @@ Account.prototype._checkKeys = co(function* _checkKeys() {
|
||||
* Remove a public account key from the account (multisig).
|
||||
* Remove the key from the wallet database.
|
||||
* @param {HDPublicKey} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype.removeKey = function removeKey(key) {
|
||||
@ -396,7 +396,7 @@ Account.prototype.createChange = function createChange() {
|
||||
/**
|
||||
* Create a new address (increments depth).
|
||||
* @param {Boolean} change
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}].
|
||||
* @returns {Promise} - Returns {@link KeyRing}.
|
||||
*/
|
||||
|
||||
Account.prototype.createAddress = co(function* createAddress(change) {
|
||||
@ -536,7 +536,7 @@ Account.prototype.deriveAddress = function deriveAddress(change, index, master,
|
||||
/**
|
||||
* Save the account to the database. Necessary
|
||||
* when address depth and keys change.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype.save = function save() {
|
||||
@ -546,7 +546,7 @@ Account.prototype.save = function save() {
|
||||
/**
|
||||
* Save addresses to path map.
|
||||
* @param {KeyRing[]} rings
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Account.prototype.saveAddress = function saveAddress(rings) {
|
||||
@ -558,7 +558,7 @@ Account.prototype.saveAddress = function saveAddress(rings) {
|
||||
* Allocate all addresses up to depth. Note that this also allocates
|
||||
* new lookahead addresses.
|
||||
* @param {Number} depth
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}, {@link KeyRing}].
|
||||
* @returns {Promise} - Returns {@link KeyRing}, {@link KeyRing}.
|
||||
*/
|
||||
|
||||
Account.prototype.setDepth = co(function* setDepth(receiveDepth, changeDepth) {
|
||||
|
||||
@ -227,7 +227,7 @@ TXDB.layout = layout;
|
||||
|
||||
/**
|
||||
* Open TXDB.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.open = co(function* open() {
|
||||
@ -338,7 +338,7 @@ TXDB.prototype.has = function has(key) {
|
||||
/**
|
||||
* Iterate.
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.iterate = function iterate(options) {
|
||||
@ -351,7 +351,7 @@ TXDB.prototype.iterate = function iterate(options) {
|
||||
|
||||
/**
|
||||
* Commit current batch.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.commit = co(function* commit() {
|
||||
@ -368,7 +368,7 @@ TXDB.prototype.commit = co(function* commit() {
|
||||
/**
|
||||
* Map a transactions' addresses to wallet IDs.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link PathInfo}].
|
||||
* @returns {Promise} - Returns {@link PathInfo}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getInfo = function getInfo(tx) {
|
||||
@ -381,7 +381,7 @@ TXDB.prototype.getInfo = function getInfo(tx) {
|
||||
* @private
|
||||
* @param {Outpoint} prevout - Required coin hash & index.
|
||||
* @param {Buffer} input - Spender input hash and index.
|
||||
* @param {Function} callback - Returns [Error, Buffer].
|
||||
* @returns {Promise} - Returns Buffer.
|
||||
*/
|
||||
|
||||
TXDB.prototype.addOrphan = co(function* addOrphan(prevout, input) {
|
||||
@ -402,7 +402,7 @@ TXDB.prototype.addOrphan = co(function* addOrphan(prevout, input) {
|
||||
* @private
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Orphan}].
|
||||
* @returns {Promise} - Returns {@link Orphan}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getOrphans = co(function* getOrphans(hash, index) {
|
||||
@ -435,7 +435,7 @@ TXDB.prototype.getOrphans = co(function* getOrphans(hash, index) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.verify = co(function* verify(tx, info) {
|
||||
@ -514,7 +514,7 @@ TXDB.prototype.verify = co(function* verify(tx, info) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {Number} index
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.resolveOrphans = co(function* resolveOrphans(tx, index) {
|
||||
@ -566,7 +566,7 @@ TXDB.prototype.resolveOrphans = co(function* resolveOrphans(tx, index) {
|
||||
* Add transaction, runs `confirm()` and `verify()`.
|
||||
* @param {TX} tx
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.add = co(function* add(tx, info) {
|
||||
@ -583,7 +583,7 @@ TXDB.prototype.add = co(function* add(tx, info) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype._add = co(function* add(tx, info) {
|
||||
@ -725,7 +725,7 @@ TXDB.prototype._add = co(function* add(tx, info) {
|
||||
* @private
|
||||
* @param {Hash} hash
|
||||
* @param {TX} ref - Reference tx, the tx that double-spent.
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
TXDB.prototype.removeConflict = co(function* removeConflict(hash, ref) {
|
||||
@ -767,7 +767,7 @@ TXDB.prototype.removeConflict = co(function* removeConflict(hash, ref) {
|
||||
* remove all of its spenders.
|
||||
* @private
|
||||
* @param {TX} tx - Transaction to be removed.
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
TXDB.prototype.removeRecursive = co(function* removeRecursive(tx) {
|
||||
@ -813,7 +813,7 @@ TXDB.prototype.removeRecursive = co(function* removeRecursive(tx) {
|
||||
* Test an entire transaction to see
|
||||
* if any of its outpoints are a double-spend.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
TXDB.prototype.isDoubleSpend = co(function* isDoubleSpend(tx) {
|
||||
@ -834,7 +834,7 @@ TXDB.prototype.isDoubleSpend = co(function* isDoubleSpend(tx) {
|
||||
* Test a whether a coin has been spent.
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
TXDB.prototype.isSpent = co(function* isSpent(hash, index) {
|
||||
@ -852,7 +852,7 @@ TXDB.prototype.isSpent = co(function* isSpent(hash, index) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {AddressMap} info
|
||||
* @param {Function} callback - Returns [Error, Boolean]. `false` if
|
||||
* @returns {Promise} - Returns Boolean. `false` if
|
||||
* the transaction should be added to the database, `true` if the
|
||||
* transaction was confirmed, or should be ignored.
|
||||
*/
|
||||
@ -948,7 +948,7 @@ TXDB.prototype.confirm = co(function* confirm(tx, info) {
|
||||
/**
|
||||
* Remove a transaction from the database. Disconnect inputs.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.remove = co(function* remove(hash) {
|
||||
@ -964,7 +964,7 @@ TXDB.prototype.remove = co(function* remove(hash) {
|
||||
* Remove a transaction without a lock.
|
||||
* @private
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype._remove = co(function* remove(hash) {
|
||||
@ -987,7 +987,7 @@ TXDB.prototype._remove = co(function* remove(hash) {
|
||||
* look up the transaction. Use the passed-in transaction
|
||||
* to disconnect.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.lazyRemove = co(function* lazyRemove(tx) {
|
||||
@ -1003,7 +1003,7 @@ TXDB.prototype.lazyRemove = co(function* lazyRemove(tx) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {AddressMap} info
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.__remove = co(function* remove(tx, info) {
|
||||
@ -1093,7 +1093,7 @@ TXDB.prototype.__remove = co(function* remove(tx, info) {
|
||||
/**
|
||||
* Unconfirm a transaction. This is usually necessary after a reorg.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.unconfirm = co(function* unconfirm(hash) {
|
||||
@ -1109,7 +1109,7 @@ TXDB.prototype.unconfirm = co(function* unconfirm(hash) {
|
||||
* Unconfirm a transaction without a lock.
|
||||
* @private
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype._unconfirm = co(function* unconfirm(hash) {
|
||||
@ -1142,7 +1142,7 @@ TXDB.prototype._unconfirm = co(function* unconfirm(hash) {
|
||||
* Unconfirm a transaction. This is usually necessary after a reorg.
|
||||
* @param {Hash} hash
|
||||
* @param {AddressMap} info
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.__unconfirm = co(function* unconfirm(tx, info) {
|
||||
@ -1302,7 +1302,7 @@ TXDB.prototype.getLocked = function getLocked() {
|
||||
/**
|
||||
* Get hashes of all transactions in the database.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getHistoryHashes = function getHistoryHashes(account) {
|
||||
@ -1327,7 +1327,7 @@ TXDB.prototype.getHistoryHashes = function getHistoryHashes(account) {
|
||||
/**
|
||||
* Get hashes of all unconfirmed transactions in the database.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getUnconfirmedHashes = function getUnconfirmedHashes(account) {
|
||||
@ -1352,7 +1352,7 @@ TXDB.prototype.getUnconfirmedHashes = function getUnconfirmedHashes(account) {
|
||||
/**
|
||||
* Get all coin hashes in the database.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getCoinHashes = function getCoinHashes(account) {
|
||||
@ -1382,7 +1382,7 @@ TXDB.prototype.getCoinHashes = function getCoinHashes(account) {
|
||||
* @param {Number} options.end - End height.
|
||||
* @param {Number?} options.limit - Max number of records.
|
||||
* @param {Boolean?} options.reverse - Reverse order.
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getHeightRangeHashes = function getHeightRangeHashes(account, options) {
|
||||
@ -1419,7 +1419,7 @@ TXDB.prototype.getHeightRangeHashes = function getHeightRangeHashes(account, opt
|
||||
/**
|
||||
* Get TX hashes by height.
|
||||
* @param {Number} height
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getHeightHashes = function getHeightHashes(height) {
|
||||
@ -1434,7 +1434,7 @@ TXDB.prototype.getHeightHashes = function getHeightHashes(height) {
|
||||
* @param {Number} options.end - End height.
|
||||
* @param {Number?} options.limit - Max number of records.
|
||||
* @param {Boolean?} options.reverse - Reverse order.
|
||||
* @param {Function} callback - Returns [Error, {@link Hash}[]].
|
||||
* @returns {Promise} - Returns {@link Hash}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getRangeHashes = function getRangeHashes(account, options) {
|
||||
@ -1476,7 +1476,7 @@ TXDB.prototype.getRangeHashes = function getRangeHashes(account, options) {
|
||||
* @param {Number} options.end - End time.
|
||||
* @param {Number?} options.limit - Max number of records.
|
||||
* @param {Boolean?} options.reverse - Reverse order.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getRange = co(function* getRange(account, options) {
|
||||
@ -1507,7 +1507,7 @@ TXDB.prototype.getRange = co(function* getRange(account, options) {
|
||||
* Get last N transactions.
|
||||
* @param {Number?} account
|
||||
* @param {Number} limit - Max number of transactions.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getLast = function getLast(account, limit) {
|
||||
@ -1522,7 +1522,7 @@ TXDB.prototype.getLast = function getLast(account, limit) {
|
||||
/**
|
||||
* Get all transactions.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getHistory = function getHistory(account) {
|
||||
@ -1545,7 +1545,7 @@ TXDB.prototype.getHistory = function getHistory(account) {
|
||||
/**
|
||||
* Get all account transactions.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getAccountHistory = co(function* getAccountHistory(account) {
|
||||
@ -1570,7 +1570,7 @@ TXDB.prototype.getAccountHistory = co(function* getAccountHistory(account) {
|
||||
/**
|
||||
* Get unconfirmed transactions.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getUnconfirmed = co(function* getUnconfirmed(account) {
|
||||
@ -1595,7 +1595,7 @@ TXDB.prototype.getUnconfirmed = co(function* getUnconfirmed(account) {
|
||||
/**
|
||||
* Get coins.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getCoins = function getCoins(account) {
|
||||
@ -1627,7 +1627,7 @@ TXDB.prototype.getCoins = function getCoins(account) {
|
||||
/**
|
||||
* Get coins by account.
|
||||
* @param {Number} account
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
TXDB.prototype.getAccountCoins = co(function* getCoins(account) {
|
||||
@ -1652,7 +1652,7 @@ TXDB.prototype.getAccountCoins = co(function* getCoins(account) {
|
||||
/**
|
||||
* Fill a transaction with coins (all historical coins).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.fillHistory = function fillHistory(tx) {
|
||||
@ -1681,7 +1681,7 @@ TXDB.prototype.fillHistory = function fillHistory(tx) {
|
||||
/**
|
||||
* Fill a transaction with coins.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.fillCoins = co(function* fillCoins(tx) {
|
||||
@ -1709,7 +1709,7 @@ TXDB.prototype.fillCoins = co(function* fillCoins(tx) {
|
||||
/**
|
||||
* Get transaction.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getTX = co(function* getTX(hash) {
|
||||
@ -1724,7 +1724,7 @@ TXDB.prototype.getTX = co(function* getTX(hash) {
|
||||
/**
|
||||
* Get transaction details.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TXDetails}].
|
||||
* @returns {Promise} - Returns {@link TXDetails}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getDetails = co(function* getDetails(hash) {
|
||||
@ -1739,7 +1739,7 @@ TXDB.prototype.getDetails = co(function* getDetails(hash) {
|
||||
/**
|
||||
* Convert transaction to transaction details.
|
||||
* @param {TX|TX[]} tx
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.toDetails = co(function* toDetails(tx) {
|
||||
@ -1775,7 +1775,7 @@ TXDB.prototype.toDetails = co(function* toDetails(tx) {
|
||||
/**
|
||||
* Test whether the database has a transaction.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
TXDB.prototype.hasTX = function hasTX(hash) {
|
||||
@ -1786,7 +1786,7 @@ TXDB.prototype.hasTX = function hasTX(hash) {
|
||||
* Get coin.
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}].
|
||||
* @returns {Promise} - Returns {@link Coin}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getCoin = co(function* getCoin(hash, index) {
|
||||
@ -1819,7 +1819,7 @@ TXDB.prototype.getCoin = co(function* getCoin(hash, index) {
|
||||
* Get spender coin.
|
||||
* @param {Outpoint} spent
|
||||
* @param {Outpoint} prevout
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}].
|
||||
* @returns {Promise} - Returns {@link Coin}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getSpentCoin = co(function* getSpentCoin(spent, prevout) {
|
||||
@ -1839,7 +1839,7 @@ TXDB.prototype.getSpentCoin = co(function* getSpentCoin(spent, prevout) {
|
||||
* Update spent coin height in storage.
|
||||
* @param {TX} tx - Sending transaction.
|
||||
* @param {Number} index
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.updateSpentCoin = co(function* updateSpentCoin(tx, i) {
|
||||
@ -1863,7 +1863,7 @@ TXDB.prototype.updateSpentCoin = co(function* updateSpentCoin(tx, i) {
|
||||
/**
|
||||
* Test whether the database has a transaction.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
TXDB.prototype.hasCoin = function hasCoin(hash, index) {
|
||||
@ -1878,7 +1878,7 @@ TXDB.prototype.hasCoin = function hasCoin(hash, index) {
|
||||
/**
|
||||
* Calculate balance.
|
||||
* @param {Number?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Balance}].
|
||||
* @returns {Promise} - Returns {@link Balance}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getBalance = co(function* getBalance(account) {
|
||||
@ -1916,7 +1916,7 @@ TXDB.prototype.getBalance = co(function* getBalance(account) {
|
||||
/**
|
||||
* Calculate balance by account.
|
||||
* @param {Number} account
|
||||
* @param {Function} callback - Returns [Error, {@link Balance}].
|
||||
* @returns {Promise} - Returns {@link Balance}.
|
||||
*/
|
||||
|
||||
TXDB.prototype.getAccountBalance = co(function* getBalance(account) {
|
||||
@ -1952,7 +1952,7 @@ TXDB.prototype.getAccountBalance = co(function* getBalance(account) {
|
||||
* Zap pending transactions older than `age`.
|
||||
* @param {Number?} account
|
||||
* @param {Number} age - Age delta (delete transactions older than `now - age`).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.zap = co(function* zap(account, age) {
|
||||
@ -1969,7 +1969,7 @@ TXDB.prototype.zap = co(function* zap(account, age) {
|
||||
* @private
|
||||
* @param {Number?} account
|
||||
* @param {Number} age
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype._zap = co(function* zap(account, age) {
|
||||
@ -1997,7 +1997,7 @@ TXDB.prototype._zap = co(function* zap(account, age) {
|
||||
/**
|
||||
* Abandon transaction.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
TXDB.prototype.abandon = co(function* abandon(hash) {
|
||||
|
||||
@ -158,7 +158,7 @@ Wallet.fromOptions = function fromOptions(db, options) {
|
||||
* the first addresses along with the lookahead
|
||||
* addresses). Called automatically from the
|
||||
* walletdb.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.init = co(function* init(options) {
|
||||
@ -182,7 +182,7 @@ Wallet.prototype.init = co(function* init(options) {
|
||||
|
||||
/**
|
||||
* Open wallet (done after retrieval).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.open = co(function* open() {
|
||||
@ -204,7 +204,7 @@ Wallet.prototype.open = co(function* open() {
|
||||
|
||||
/**
|
||||
* Close the wallet, unregister with the database.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.destroy = co(function* destroy() {
|
||||
@ -223,7 +223,7 @@ Wallet.prototype.destroy = co(function* destroy() {
|
||||
* Add a public account key to the wallet (multisig).
|
||||
* Saves the key in the wallet database.
|
||||
* @param {HDPublicKey} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.addKey = co(function* addKey(account, key) {
|
||||
@ -239,7 +239,7 @@ Wallet.prototype.addKey = co(function* addKey(account, key) {
|
||||
* Add a public account key to the wallet without a lock.
|
||||
* @private
|
||||
* @param {HDPublicKey} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype._addKey = co(function* addKey(account, key) {
|
||||
@ -275,7 +275,7 @@ Wallet.prototype._addKey = co(function* addKey(account, key) {
|
||||
/**
|
||||
* Remove a public account key from the wallet (multisig).
|
||||
* @param {HDPublicKey} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.removeKey = co(function* removeKey(account, key) {
|
||||
@ -291,7 +291,7 @@ Wallet.prototype.removeKey = co(function* removeKey(account, key) {
|
||||
* Remove a public account key from the wallet (multisig).
|
||||
* @private
|
||||
* @param {HDPublicKey} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype._removeKey = co(function* removeKey(account, key) {
|
||||
@ -328,7 +328,7 @@ Wallet.prototype._removeKey = co(function* removeKey(account, key) {
|
||||
* Change or set master key's passphrase.
|
||||
* @param {(String|Buffer)?} old
|
||||
* @param {String|Buffer} new_
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.setPassphrase = co(function* setPassphrase(old, new_) {
|
||||
@ -345,7 +345,7 @@ Wallet.prototype.setPassphrase = co(function* setPassphrase(old, new_) {
|
||||
* @private
|
||||
* @param {(String|Buffer)?} old
|
||||
* @param {String|Buffer} new_
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype._setPassphrase = co(function* setPassphrase(old, new_) {
|
||||
@ -369,7 +369,7 @@ Wallet.prototype._setPassphrase = co(function* setPassphrase(old, new_) {
|
||||
/**
|
||||
* Generate a new token.
|
||||
* @param {(String|Buffer)?} passphrase
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.retoken = co(function* retoken(passphrase) {
|
||||
@ -385,7 +385,7 @@ Wallet.prototype.retoken = co(function* retoken(passphrase) {
|
||||
* Generate a new token without a lock.
|
||||
* @private
|
||||
* @param {(String|Buffer)?} passphrase
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype._retoken = co(function* retoken(passphrase) {
|
||||
@ -485,7 +485,7 @@ Wallet.prototype.getToken = function getToken(master, nonce) {
|
||||
/**
|
||||
* Create an account. Requires passphrase if master key is encrypted.
|
||||
* @param {Object} options - See {@link Account} options.
|
||||
* @param {Function} callback - Returns [Error, {@link Account}].
|
||||
* @returns {Promise} - Returns {@link Account}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.createAccount = co(function* createAccount(options) {
|
||||
@ -500,7 +500,7 @@ Wallet.prototype.createAccount = co(function* createAccount(options) {
|
||||
/**
|
||||
* Create an account without a lock.
|
||||
* @param {Object} options - See {@link Account} options.
|
||||
* @param {Function} callback - Returns [Error, {@link Account}].
|
||||
* @returns {Promise} - Returns {@link Account}.
|
||||
*/
|
||||
|
||||
Wallet.prototype._createAccount = co(function* createAccount(options) {
|
||||
@ -553,7 +553,7 @@ Wallet.prototype._createAccount = co(function* createAccount(options) {
|
||||
/**
|
||||
* Ensure an account. Requires passphrase if master key is encrypted.
|
||||
* @param {Object} options - See {@link Account} options.
|
||||
* @param {Function} callback - Returns [Error, {@link Account}].
|
||||
* @returns {Promise} - Returns {@link Account}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.ensureAccount = co(function* ensureAccount(options) {
|
||||
@ -573,7 +573,7 @@ Wallet.prototype.ensureAccount = co(function* ensureAccount(options) {
|
||||
|
||||
/**
|
||||
* List account names and indexes from the db.
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getAccounts = function getAccounts() {
|
||||
@ -582,7 +582,7 @@ Wallet.prototype.getAccounts = function getAccounts() {
|
||||
|
||||
/**
|
||||
* Get all wallet address hashes.
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getAddressHashes = function getAddressHashes() {
|
||||
@ -592,7 +592,7 @@ Wallet.prototype.getAddressHashes = function getAddressHashes() {
|
||||
/**
|
||||
* Retrieve an account from the database.
|
||||
* @param {Number|String} account
|
||||
* @param {Function} callback - Returns [Error, {@link Account}].
|
||||
* @returns {Promise} - Returns {@link Account}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getAccount = co(function* getAccount(account) {
|
||||
@ -615,7 +615,7 @@ Wallet.prototype.getAccount = co(function* getAccount(account) {
|
||||
/**
|
||||
* Test whether an account exists.
|
||||
* @param {Number|String} account
|
||||
* @param {Function} callback - Returns [Error, {@link Boolean}].
|
||||
* @returns {Promise} - Returns {@link Boolean}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.hasAccount = function hasAccount(account) {
|
||||
@ -625,7 +625,7 @@ Wallet.prototype.hasAccount = function hasAccount(account) {
|
||||
/**
|
||||
* Create a new receiving address (increments receiveDepth).
|
||||
* @param {(Number|String)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}].
|
||||
* @returns {Promise} - Returns {@link KeyRing}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.createReceive = function createReceive(account) {
|
||||
@ -635,7 +635,7 @@ Wallet.prototype.createReceive = function createReceive(account) {
|
||||
/**
|
||||
* Create a new change address (increments receiveDepth).
|
||||
* @param {(Number|String)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}].
|
||||
* @returns {Promise} - Returns {@link KeyRing}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.createChange = function createChange(account) {
|
||||
@ -646,7 +646,7 @@ Wallet.prototype.createChange = function createChange(account) {
|
||||
* Create a new address (increments depth).
|
||||
* @param {(Number|String)?} account
|
||||
* @param {Boolean} change
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}].
|
||||
* @returns {Promise} - Returns {@link KeyRing}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.createAddress = co(function* createAddress(account, change) {
|
||||
@ -662,7 +662,7 @@ Wallet.prototype.createAddress = co(function* createAddress(account, change) {
|
||||
* Create a new address (increments depth) without a lock.
|
||||
* @param {(Number|String)?} account
|
||||
* @param {Boolean} change
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}].
|
||||
* @returns {Promise} - Returns {@link KeyRing}.
|
||||
*/
|
||||
|
||||
Wallet.prototype._createAddress = co(function* createAddress(account, change) {
|
||||
@ -698,7 +698,7 @@ Wallet.prototype._createAddress = co(function* createAddress(account, change) {
|
||||
/**
|
||||
* Save the wallet to the database. Necessary
|
||||
* when address depth and keys change.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.save = function save() {
|
||||
@ -725,7 +725,7 @@ Wallet.prototype.drop = function drop() {
|
||||
|
||||
/**
|
||||
* Save batch.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.commit = function commit() {
|
||||
@ -735,7 +735,7 @@ Wallet.prototype.commit = function commit() {
|
||||
/**
|
||||
* Test whether the wallet possesses an address.
|
||||
* @param {Address|Hash} address
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Wallet.prototype.hasAddress = function hasAddress(address) {
|
||||
@ -748,7 +748,7 @@ Wallet.prototype.hasAddress = function hasAddress(address) {
|
||||
/**
|
||||
* Get path by address hash.
|
||||
* @param {Address|Hash} address
|
||||
* @param {Function} callback - Returns [Error, {@link Path}].
|
||||
* @returns {Promise} - Returns {@link Path}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getPath = co(function* getPath(address) {
|
||||
@ -771,7 +771,7 @@ Wallet.prototype.getPath = co(function* getPath(address) {
|
||||
/**
|
||||
* Get all wallet paths.
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Path}].
|
||||
* @returns {Promise} - Returns {@link Path}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getPaths = co(function* getPaths(account) {
|
||||
@ -798,7 +798,7 @@ Wallet.prototype.getPaths = co(function* getPaths(account) {
|
||||
* @param {(String|Number)?} account
|
||||
* @param {KeyRing} ring
|
||||
* @param {(String|Buffer)?} passphrase
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.importKey = co(function* importKey(account, ring, passphrase) {
|
||||
@ -816,7 +816,7 @@ Wallet.prototype.importKey = co(function* importKey(account, ring, passphrase) {
|
||||
* @param {(String|Number)?} account
|
||||
* @param {KeyRing} ring
|
||||
* @param {(String|Buffer)?} passphrase
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype._importKey = co(function* importKey(account, ring, passphrase) {
|
||||
@ -968,7 +968,7 @@ Wallet.prototype._fund = co(function* fund(tx, options) {
|
||||
* and template it.
|
||||
* @param {Object} options - See {@link Wallet#fund options}.
|
||||
* @param {Object[]} options.outputs - See {@link MTX#addOutput}.
|
||||
* @param {Function} callback - Returns [Error, {@link MTX}].
|
||||
* @returns {Promise} - Returns {@link MTX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.createTX = co(function* createTX(options, force) {
|
||||
@ -1019,7 +1019,7 @@ Wallet.prototype.createTX = co(function* createTX(options, force) {
|
||||
* coins from being double spent.
|
||||
* @param {Object} options - See {@link Wallet#fund options}.
|
||||
* @param {Object[]} options.outputs - See {@link MTX#addOutput}.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.send = co(function* send(options) {
|
||||
@ -1036,7 +1036,7 @@ Wallet.prototype.send = co(function* send(options) {
|
||||
* @private
|
||||
* @param {Object} options - See {@link Wallet#fund options}.
|
||||
* @param {Object[]} options.outputs - See {@link MTX#addOutput}.
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype._send = co(function* send(options) {
|
||||
@ -1059,7 +1059,7 @@ Wallet.prototype._send = co(function* send(options) {
|
||||
|
||||
/**
|
||||
* Resend pending wallet transactions.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.resend = co(function* resend() {
|
||||
@ -1079,7 +1079,7 @@ Wallet.prototype.resend = co(function* resend() {
|
||||
* Derive necessary addresses for signing a transaction.
|
||||
* @param {TX|Input} tx
|
||||
* @param {Number?} index - Input index.
|
||||
* @param {Function} callback - Returns [Error, {@link KeyRing}[]].
|
||||
* @returns {Promise} - Returns {@link KeyRing}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.deriveInputs = co(function* deriveInputs(tx) {
|
||||
@ -1107,7 +1107,7 @@ Wallet.prototype.deriveInputs = co(function* deriveInputs(tx) {
|
||||
/**
|
||||
* Retrieve a single keyring by address.
|
||||
* @param {Address|Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.getKeyRing = co(function* getKeyRing(address) {
|
||||
@ -1133,7 +1133,7 @@ Wallet.prototype.getKeyRing = co(function* getKeyRing(address) {
|
||||
/**
|
||||
* Map input addresses to paths.
|
||||
* @param {TX|Input} tx
|
||||
* @param {Function} callback - Returns [Error, {@link Path}[]].
|
||||
* @returns {Promise} - Returns {@link Path}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getInputPaths = co(function* getInputPaths(tx) {
|
||||
@ -1171,7 +1171,7 @@ Wallet.prototype.getInputPaths = co(function* getInputPaths(tx) {
|
||||
/**
|
||||
* Map output addresses to paths.
|
||||
* @param {TX|Output} tx
|
||||
* @param {Function} callback - Returns [Error, {@link Path}[]].
|
||||
* @returns {Promise} - Returns {@link Path}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getOutputPaths = co(function* getOutputPaths(tx) {
|
||||
@ -1202,7 +1202,7 @@ Wallet.prototype.getOutputPaths = co(function* getOutputPaths(tx) {
|
||||
* This is used for deriving new addresses when
|
||||
* a confirmed transaction is seen.
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback - Returns [Error, Boolean]
|
||||
* @returns {Promise} - Returns Boolean
|
||||
* (true if new addresses were allocated).
|
||||
*/
|
||||
|
||||
@ -1219,7 +1219,7 @@ Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(info) {
|
||||
* Sync address depths without a lock.
|
||||
* @private
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback - Returns [Error, Boolean]
|
||||
* @returns {Promise} - Returns Boolean
|
||||
*/
|
||||
|
||||
Wallet.prototype._syncOutputDepth = co(function* syncOutputDepth(info) {
|
||||
@ -1291,7 +1291,7 @@ Wallet.prototype._syncOutputDepth = co(function* syncOutputDepth(info) {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.updateBalances = co(function* updateBalances() {
|
||||
@ -1313,7 +1313,7 @@ Wallet.prototype.updateBalances = co(function* updateBalances() {
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {PathInfo} info
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.handleTX = co(function* handleTX(info) {
|
||||
@ -1346,7 +1346,7 @@ Wallet.prototype.getRedeem = co(function* getRedeem(hash) {
|
||||
* sign, only creates signature slots). Only builds scripts
|
||||
* for inputs that are redeemable by this wallet.
|
||||
* @param {MTX} tx
|
||||
* @param {Function} callback - Returns [Error, Number]
|
||||
* @returns {Promise} - Returns Number
|
||||
* (total number of scripts built).
|
||||
*/
|
||||
|
||||
@ -1360,7 +1360,7 @@ Wallet.prototype.template = co(function* template(tx) {
|
||||
* to build/sign inputs that are redeemable by this wallet.
|
||||
* @param {MTX} tx
|
||||
* @param {Object|String|Buffer} options - Options or passphrase.
|
||||
* @param {Function} callback - Returns [Error, Number] (total number
|
||||
* @returns {Promise} - Returns Number (total number
|
||||
* of inputs scripts built and signed).
|
||||
*/
|
||||
|
||||
@ -1383,7 +1383,7 @@ Wallet.prototype.sign = co(function* sign(tx, options) {
|
||||
/**
|
||||
* Fill transaction with coins (accesses db).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.fillCoins = function fillCoins(tx) {
|
||||
@ -1393,7 +1393,7 @@ Wallet.prototype.fillCoins = function fillCoins(tx) {
|
||||
/**
|
||||
* Fill transaction with historical coins (accesses db).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.fillHistory = function fillHistory(tx) {
|
||||
@ -1403,7 +1403,7 @@ Wallet.prototype.fillHistory = function fillHistory(tx) {
|
||||
/**
|
||||
* Fill transaction with historical coins (accesses db).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.toDetails = function toDetails(tx) {
|
||||
@ -1413,7 +1413,7 @@ Wallet.prototype.toDetails = function toDetails(tx) {
|
||||
/**
|
||||
* Fill transaction with historical coins (accesses db).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getDetails = function getDetails(tx) {
|
||||
@ -1424,7 +1424,7 @@ Wallet.prototype.getDetails = function getDetails(tx) {
|
||||
* Get a coin from the wallet (accesses db).
|
||||
* @param {Hash} hash
|
||||
* @param {Number} index
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}].
|
||||
* @returns {Promise} - Returns {@link Coin}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getCoin = function getCoin(hash, index) {
|
||||
@ -1434,7 +1434,7 @@ Wallet.prototype.getCoin = function getCoin(hash, index) {
|
||||
/**
|
||||
* Get a transaction from the wallet (accesses db).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
* @returns {Promise} - Returns {@link TX}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getTX = function getTX(hash) {
|
||||
@ -1444,7 +1444,7 @@ Wallet.prototype.getTX = function getTX(hash) {
|
||||
/**
|
||||
* Add a transaction to the wallets TX history (accesses db).
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.addTX = function addTX(tx) {
|
||||
@ -1454,7 +1454,7 @@ Wallet.prototype.addTX = function addTX(tx) {
|
||||
/**
|
||||
* Get all transactions in transaction history (accesses db).
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getHistory = co(function* getHistory(account) {
|
||||
@ -1465,7 +1465,7 @@ Wallet.prototype.getHistory = co(function* getHistory(account) {
|
||||
/**
|
||||
* Get all available coins (accesses db).
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Coin}[]].
|
||||
* @returns {Promise} - Returns {@link Coin}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getCoins = co(function* getCoins(account) {
|
||||
@ -1476,7 +1476,7 @@ Wallet.prototype.getCoins = co(function* getCoins(account) {
|
||||
/**
|
||||
* Get all pending/unconfirmed transactions (accesses db).
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getUnconfirmed = co(function* getUnconfirmed(account) {
|
||||
@ -1487,7 +1487,7 @@ Wallet.prototype.getUnconfirmed = co(function* getUnconfirmed(account) {
|
||||
/**
|
||||
* Get wallet balance (accesses db).
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Balance}].
|
||||
* @returns {Promise} - Returns {@link Balance}.
|
||||
*/
|
||||
|
||||
Wallet.prototype.getBalance = co(function* getBalance(account) {
|
||||
@ -1501,7 +1501,7 @@ Wallet.prototype.getBalance = co(function* getBalance(account) {
|
||||
* @param {Object} options
|
||||
* @param {Number} options.start
|
||||
* @param {Number} options.end
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getRange = co(function* getRange(account, options) {
|
||||
@ -1517,7 +1517,7 @@ Wallet.prototype.getRange = co(function* getRange(account, options) {
|
||||
* Get the last N transactions (accesses db).
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Number} limit
|
||||
* @param {Function} callback - Returns [Error, {@link TX}[]].
|
||||
* @returns {Promise} - Returns {@link TX}[].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getLast = co(function* getLast(account, limit) {
|
||||
@ -1529,7 +1529,7 @@ Wallet.prototype.getLast = co(function* getLast(account, limit) {
|
||||
* Zap stale TXs from wallet (accesses db).
|
||||
* @param {(Number|String)?} account
|
||||
* @param {Number} age - Age threshold (unix time, default=72 hours).
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.zap = co(function* zap(account, age) {
|
||||
@ -1540,7 +1540,7 @@ Wallet.prototype.zap = co(function* zap(account, age) {
|
||||
/**
|
||||
* Abandon transaction (accesses db).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype.abandon = function abandon(hash) {
|
||||
@ -1552,7 +1552,7 @@ Wallet.prototype.abandon = function abandon(hash) {
|
||||
* @private
|
||||
* @param {(Number|String)?} account
|
||||
* @param {Function} errback - Returns [Error].
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Wallet.prototype._getIndex = co(function* _getIndex(account) {
|
||||
@ -2019,7 +2019,7 @@ MasterKey.fromOptions = function fromOptions(options) {
|
||||
* Decrypt the key and set a timeout to destroy decrypted data.
|
||||
* @param {Buffer|String} passphrase - Zero this yourself.
|
||||
* @param {Number} [timeout=60000] timeout in ms.
|
||||
* @param {Function} callback - Returns [Error, {@link HDPrivateKey}].
|
||||
* @returns {Promise} - Returns {@link HDPrivateKey}.
|
||||
*/
|
||||
|
||||
MasterKey.prototype.unlock = co(function* _unlock(passphrase, timeout) {
|
||||
@ -2036,7 +2036,7 @@ MasterKey.prototype.unlock = co(function* _unlock(passphrase, timeout) {
|
||||
* @private
|
||||
* @param {Buffer|String} passphrase - Zero this yourself.
|
||||
* @param {Number} [timeout=60000] timeout in ms.
|
||||
* @param {Function} callback - Returns [Error, {@link HDPrivateKey}].
|
||||
* @returns {Promise} - Returns {@link HDPrivateKey}.
|
||||
*/
|
||||
|
||||
MasterKey.prototype._unlock = co(function* _unlock(passphrase, timeout) {
|
||||
@ -2157,7 +2157,7 @@ MasterKey.prototype.destroy = function destroy() {
|
||||
/**
|
||||
* Decrypt the key permanently.
|
||||
* @param {Buffer|String} passphrase - Zero this yourself.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
MasterKey.prototype.decrypt = co(function* decrypt(passphrase) {
|
||||
@ -2173,7 +2173,7 @@ MasterKey.prototype.decrypt = co(function* decrypt(passphrase) {
|
||||
* Decrypt the key permanently without a lock.
|
||||
* @private
|
||||
* @param {Buffer|String} passphrase - Zero this yourself.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
MasterKey.prototype._decrypt = co(function* decrypt(passphrase) {
|
||||
@ -2200,7 +2200,7 @@ MasterKey.prototype._decrypt = co(function* decrypt(passphrase) {
|
||||
/**
|
||||
* Encrypt the key permanently.
|
||||
* @param {Buffer|String} passphrase - Zero this yourself.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
MasterKey.prototype.encrypt = co(function* encrypt(passphrase) {
|
||||
@ -2216,7 +2216,7 @@ MasterKey.prototype.encrypt = co(function* encrypt(passphrase) {
|
||||
* Encrypt the key permanently without a lock.
|
||||
* @private
|
||||
* @param {Buffer|String} passphrase - Zero this yourself.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
MasterKey.prototype._encrypt = co(function* encrypt(passphrase) {
|
||||
|
||||
@ -186,7 +186,7 @@ WalletDB.prototype._init = function _init() {
|
||||
/**
|
||||
* Open the walletdb, wait for the database to load.
|
||||
* @alias WalletDB#open
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype._open = co(function* open() {
|
||||
@ -206,7 +206,7 @@ WalletDB.prototype._open = co(function* open() {
|
||||
/**
|
||||
* Close the walletdb, wait for the database to close.
|
||||
* @alias WalletDB#close
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype._close = co(function* close() {
|
||||
@ -225,7 +225,7 @@ WalletDB.prototype._close = co(function* close() {
|
||||
/**
|
||||
* Backup the wallet db.
|
||||
* @param {String} path
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.backup = function backup(path) {
|
||||
@ -235,7 +235,7 @@ WalletDB.prototype.backup = function backup(path) {
|
||||
/**
|
||||
* Get current wallet wid depth.
|
||||
* @private
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getDepth = co(function* getDepth() {
|
||||
@ -311,7 +311,7 @@ WalletDB.prototype.batch = function batch(wid) {
|
||||
* Save batch.
|
||||
* @private
|
||||
* @param {WalletID} wid
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.commit = function commit(wid) {
|
||||
@ -323,7 +323,7 @@ WalletDB.prototype.commit = function commit(wid) {
|
||||
/**
|
||||
* Load the bloom filter into memory.
|
||||
* @private
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.loadFilter = function loadFilter() {
|
||||
@ -365,7 +365,7 @@ WalletDB.prototype.testFilter = function testFilter(hashes) {
|
||||
|
||||
/**
|
||||
* Dump database (for debugging).
|
||||
* @param {Function} callback - Returns [Error, Object].
|
||||
* @returns {Promise} - Returns Object.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.dump = co(function* dump() {
|
||||
@ -405,7 +405,7 @@ WalletDB.prototype.unregister = function unregister(wallet) {
|
||||
/**
|
||||
* Map wallet label to wallet id.
|
||||
* @param {String} label
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getWalletID = co(function* getWalletID(id) {
|
||||
@ -437,7 +437,7 @@ WalletDB.prototype.getWalletID = co(function* getWalletID(id) {
|
||||
/**
|
||||
* Get a wallet from the database, setup watcher.
|
||||
* @param {WalletID} wid
|
||||
* @param {Function} callback - Returns [Error, {@link Wallet}].
|
||||
* @returns {Promise} - Returns {@link Wallet}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.get = co(function* get(wid) {
|
||||
@ -465,7 +465,7 @@ WalletDB.prototype.get = co(function* get(wid) {
|
||||
* Get a wallet from the database without a lock.
|
||||
* @private
|
||||
* @param {WalletID} wid
|
||||
* @param {Function} callback - Returns [Error, {@link Wallet}].
|
||||
* @returns {Promise} - Returns {@link Wallet}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype._get = co(function* get(wid) {
|
||||
@ -502,7 +502,7 @@ WalletDB.prototype.save = function save(wallet) {
|
||||
* Test an api key against a wallet's api key.
|
||||
* @param {WalletID} wid
|
||||
* @param {String} token
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.auth = co(function* auth(wid, token) {
|
||||
@ -526,7 +526,7 @@ WalletDB.prototype.auth = co(function* auth(wid, token) {
|
||||
/**
|
||||
* Create a new wallet, save to database, setup watcher.
|
||||
* @param {Object} options - See {@link Wallet}.
|
||||
* @param {Function} callback - Returns [Error, {@link Wallet}].
|
||||
* @returns {Promise} - Returns {@link Wallet}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.create = co(function* create(options) {
|
||||
@ -546,7 +546,7 @@ WalletDB.prototype.create = co(function* create(options) {
|
||||
* Create a new wallet, save to database without a lock.
|
||||
* @private
|
||||
* @param {Object} options - See {@link Wallet}.
|
||||
* @param {Function} callback - Returns [Error, {@link Wallet}].
|
||||
* @returns {Promise} - Returns {@link Wallet}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype._create = co(function* create(options) {
|
||||
@ -571,7 +571,7 @@ WalletDB.prototype._create = co(function* create(options) {
|
||||
/**
|
||||
* Test for the existence of a wallet.
|
||||
* @param {WalletID} id
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.has = co(function* has(id) {
|
||||
@ -582,7 +582,7 @@ WalletDB.prototype.has = co(function* has(id) {
|
||||
/**
|
||||
* Attempt to create wallet, return wallet if already exists.
|
||||
* @param {Object} options - See {@link Wallet}.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.ensure = co(function* ensure(options) {
|
||||
@ -596,7 +596,7 @@ WalletDB.prototype.ensure = co(function* ensure(options) {
|
||||
* Get an account from the database.
|
||||
* @param {WalletID} wid
|
||||
* @param {String|Number} name - Account name/index.
|
||||
* @param {Function} callback - Returns [Error, {@link Wallet}].
|
||||
* @returns {Promise} - Returns {@link Wallet}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAccount = co(function* getAccount(wid, name) {
|
||||
@ -621,7 +621,7 @@ WalletDB.prototype.getAccount = co(function* getAccount(wid, name) {
|
||||
* @private
|
||||
* @param {WalletID} wid
|
||||
* @param {Number} index - Account index.
|
||||
* @param {Function} callback - Returns [Error, {@link Wallet}].
|
||||
* @returns {Promise} - Returns {@link Wallet}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype._getAccount = co(function* getAccount(wid, index) {
|
||||
@ -647,7 +647,7 @@ WalletDB.prototype._getAccount = co(function* getAccount(wid, index) {
|
||||
/**
|
||||
* List account names and indexes from the db.
|
||||
* @param {WalletID} wid
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
* @returns {Promise} - Returns Array.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAccounts = co(function* getAccounts(wid) {
|
||||
@ -680,7 +680,7 @@ WalletDB.prototype.getAccounts = co(function* getAccounts(wid) {
|
||||
* Lookup the corresponding account name's index.
|
||||
* @param {WalletID} wid
|
||||
* @param {String|Number} name - Account name/index.
|
||||
* @param {Function} callback - Returns [Error, Number].
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAccountIndex = co(function* getAccountIndex(wid, name) {
|
||||
@ -706,7 +706,7 @@ WalletDB.prototype.getAccountIndex = co(function* getAccountIndex(wid, name) {
|
||||
/**
|
||||
* Save an account to the database.
|
||||
* @param {Account} account
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.saveAccount = function saveAccount(account) {
|
||||
@ -725,7 +725,7 @@ WalletDB.prototype.saveAccount = function saveAccount(account) {
|
||||
/**
|
||||
* Create an account.
|
||||
* @param {Object} options - See {@link Account} options.
|
||||
* @param {Function} callback - Returns [Error, {@link Account}].
|
||||
* @returns {Promise} - Returns {@link Account}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.createAccount = co(function* createAccount(options) {
|
||||
@ -751,7 +751,7 @@ WalletDB.prototype.createAccount = co(function* createAccount(options) {
|
||||
* Test for the existence of an account.
|
||||
* @param {WalletID} wid
|
||||
* @param {String|Number} account
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.hasAccount = co(function* hasAccount(wid, account) {
|
||||
@ -779,7 +779,7 @@ WalletDB.prototype.hasAccount = co(function* hasAccount(wid, account) {
|
||||
* `p/[address-hash] -> {walletid1=path1, walletid2=path2, ...}`
|
||||
* @param {WalletID} wid
|
||||
* @param {KeyRing[]} rings
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.saveAddress = co(function* saveAddress(wid, rings) {
|
||||
@ -806,7 +806,7 @@ WalletDB.prototype.saveAddress = co(function* saveAddress(wid, rings) {
|
||||
* @param {WalletID} wid
|
||||
* @param {KeyRing} rings
|
||||
* @param {Path} path
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.writeAddress = co(function* writeAddress(wid, address, path) {
|
||||
@ -837,7 +837,7 @@ WalletDB.prototype.writeAddress = co(function* writeAddress(wid, address, path)
|
||||
/**
|
||||
* Retrieve paths by hash.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAddressPaths = co(function* getAddressPaths(hash) {
|
||||
@ -868,7 +868,7 @@ WalletDB.prototype.getAddressPaths = co(function* getAddressPaths(hash) {
|
||||
* path map and is relevant to the wallet id.
|
||||
* @param {WalletID} wid
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.hasAddress = co(function* hasAddress(wid, hash) {
|
||||
@ -883,7 +883,7 @@ WalletDB.prototype.hasAddress = co(function* hasAddress(wid, hash) {
|
||||
/**
|
||||
* Get all address hashes.
|
||||
* @param {WalletID} wid
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAddressHashes = function getAddressHashes(wid) {
|
||||
@ -905,7 +905,7 @@ WalletDB.prototype.getAddressHashes = function getAddressHashes(wid) {
|
||||
/**
|
||||
* Get all paths for a wallet.
|
||||
* @param {WalletID} wid
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getWalletPaths = function getWalletPaths(wid) {
|
||||
@ -928,7 +928,7 @@ WalletDB.prototype.getWalletPaths = function getWalletPaths(wid) {
|
||||
|
||||
/**
|
||||
* Get all wallet ids.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getWallets = function getWallets() {
|
||||
@ -945,7 +945,7 @@ WalletDB.prototype.getWallets = function getWallets() {
|
||||
* Rescan the blockchain.
|
||||
* @param {ChainDB} chaindb
|
||||
* @param {Number} height
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.rescan = co(function* rescan(chaindb, height) {
|
||||
@ -962,7 +962,7 @@ WalletDB.prototype.rescan = co(function* rescan(chaindb, height) {
|
||||
* @private
|
||||
* @param {ChainDB} chaindb
|
||||
* @param {Number} height
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype._rescan = co(function* rescan(chaindb, height) {
|
||||
@ -984,7 +984,7 @@ WalletDB.prototype._rescan = co(function* rescan(chaindb, height) {
|
||||
/**
|
||||
* Get keys of all pending transactions
|
||||
* in the wallet db (for resending).
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getPendingKeys = function getPendingKeys() {
|
||||
@ -1017,7 +1017,7 @@ WalletDB.prototype.getPendingKeys = function getPendingKeys() {
|
||||
|
||||
/**
|
||||
* Resend all pending transactions.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.resend = co(function* resend() {
|
||||
@ -1044,7 +1044,7 @@ WalletDB.prototype.resend = co(function* resend() {
|
||||
/**
|
||||
* Map a transactions' addresses to wallet IDs.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link PathInfo[]}].
|
||||
* @returns {Promise} - Returns {@link PathInfo[}].
|
||||
*/
|
||||
|
||||
WalletDB.prototype.mapWallets = co(function* mapWallets(tx) {
|
||||
@ -1065,7 +1065,7 @@ WalletDB.prototype.mapWallets = co(function* mapWallets(tx) {
|
||||
/**
|
||||
* Map a transactions' addresses to wallet IDs.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error, {@link PathInfo}].
|
||||
* @returns {Promise} - Returns {@link PathInfo}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getPathInfo = co(function* getPathInfo(wallet, tx) {
|
||||
@ -1085,7 +1085,7 @@ WalletDB.prototype.getPathInfo = co(function* getPathInfo(wallet, tx) {
|
||||
/**
|
||||
* Map address hashes to paths.
|
||||
* @param {Hash[]} hashes - Address hashes.
|
||||
* @param {Function} callback - Returns [Error, {@link AddressTable}].
|
||||
* @returns {Promise} - Returns {@link AddressTable}.
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getTable = co(function* getTable(hashes) {
|
||||
@ -1122,7 +1122,7 @@ WalletDB.prototype.getTable = co(function* getTable(hashes) {
|
||||
|
||||
/**
|
||||
* Write the genesis block as the best hash.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.writeGenesis = co(function* writeGenesis() {
|
||||
@ -1137,7 +1137,7 @@ WalletDB.prototype.writeGenesis = co(function* writeGenesis() {
|
||||
|
||||
/**
|
||||
* Get the best block hash.
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getTip = co(function* getTip() {
|
||||
@ -1153,7 +1153,7 @@ WalletDB.prototype.getTip = co(function* getTip() {
|
||||
* Write the best block hash.
|
||||
* @param {Hash} hash
|
||||
* @param {Number} height
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.setTip = co(function* setTip(hash, height) {
|
||||
@ -1168,7 +1168,7 @@ WalletDB.prototype.setTip = co(function* setTip(hash, height) {
|
||||
/**
|
||||
* Connect a block.
|
||||
* @param {WalletBlock} block
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.writeBlock = function writeBlock(block, matches) {
|
||||
@ -1194,7 +1194,7 @@ WalletDB.prototype.writeBlock = function writeBlock(block, matches) {
|
||||
/**
|
||||
* Disconnect a block.
|
||||
* @param {WalletBlock} block
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.unwriteBlock = function unwriteBlock(block) {
|
||||
@ -1210,7 +1210,7 @@ WalletDB.prototype.unwriteBlock = function unwriteBlock(block) {
|
||||
/**
|
||||
* Get a wallet block (with hashes).
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getBlock = co(function* getBlock(hash) {
|
||||
@ -1225,7 +1225,7 @@ WalletDB.prototype.getBlock = co(function* getBlock(hash) {
|
||||
/**
|
||||
* Get a TX->Wallet map.
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getWalletsByTX = co(function* getWalletsByTX(hash) {
|
||||
@ -1240,7 +1240,7 @@ WalletDB.prototype.getWalletsByTX = co(function* getWalletsByTX(hash) {
|
||||
/**
|
||||
* Add a block's transactions and write the new best hash.
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.addBlock = co(function* addBlock(entry, txs) {
|
||||
@ -1256,7 +1256,7 @@ WalletDB.prototype.addBlock = co(function* addBlock(entry, txs) {
|
||||
* Add a block's transactions without a lock.
|
||||
* @private
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype._addBlock = co(function* addBlock(entry, txs) {
|
||||
@ -1305,7 +1305,7 @@ WalletDB.prototype._addBlock = co(function* addBlock(entry, txs) {
|
||||
* Unconfirm a block's transactions
|
||||
* and write the new best hash (SPV version).
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.removeBlock = co(function* removeBlock(entry) {
|
||||
@ -1321,7 +1321,7 @@ WalletDB.prototype.removeBlock = co(function* removeBlock(entry) {
|
||||
* Unconfirm a block's transactions.
|
||||
* @private
|
||||
* @param {ChainEntry} entry
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype._removeBlock = co(function* removeBlock(entry) {
|
||||
@ -1374,7 +1374,7 @@ WalletDB.prototype._removeBlock = co(function* removeBlock(entry) {
|
||||
* to wallet IDs, potentially store orphans, resolve
|
||||
* orphans, or confirm a transaction.
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.addTX = co(function* addTX(tx, force) {
|
||||
@ -1390,7 +1390,7 @@ WalletDB.prototype.addTX = co(function* addTX(tx, force) {
|
||||
* Add a transaction to the database without a lock.
|
||||
* @private
|
||||
* @param {TX} tx
|
||||
* @param {Function} callback - Returns [Error].
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype._addTX = co(function* addTX(tx, force) {
|
||||
@ -1432,7 +1432,7 @@ WalletDB.prototype._addTX = co(function* addTX(tx, force) {
|
||||
* Get the corresponding path for an address hash.
|
||||
* @param {WalletID} wid
|
||||
* @param {Hash} hash
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAddressPath = co(function* getAddressPath(wid, hash) {
|
||||
|
||||
@ -214,7 +214,7 @@ Workers.prototype.destroy = function destroy() {
|
||||
* Call a method for a worker to execute.
|
||||
* @param {String} method - Method name.
|
||||
* @param {Array} args - Arguments.
|
||||
* @param {Function} callback - Returns whatever
|
||||
* @returns {Promise}
|
||||
* the worker method specifies.
|
||||
*/
|
||||
|
||||
@ -233,7 +233,7 @@ Workers.prototype.execute = function execute(method, args, timeout) {
|
||||
* Execute the tx verification job (default timeout).
|
||||
* @param {TX} tx
|
||||
* @param {VerifyFlags} flags
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Workers.prototype.verify = function verify(tx, flags) {
|
||||
@ -245,7 +245,7 @@ Workers.prototype.verify = function verify(tx, flags) {
|
||||
* @param {TX} tx
|
||||
* @param {Number} index
|
||||
* @param {VerifyFlags} flags
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
* @returns {Promise} - Returns Boolean.
|
||||
*/
|
||||
|
||||
Workers.prototype.verifyInput = function verifyInput(tx, index, flags) {
|
||||
@ -257,7 +257,7 @@ Workers.prototype.verifyInput = function verifyInput(tx, index, flags) {
|
||||
* @param {MTX} tx
|
||||
* @param {KeyRing[]} ring
|
||||
* @param {SighashType} type
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Workers.prototype.sign = co(function* sign(tx, ring, type) {
|
||||
@ -284,7 +284,7 @@ Workers.prototype.sign = co(function* sign(tx, ring, type) {
|
||||
* @param {Number} index
|
||||
* @param {Buffer} key
|
||||
* @param {SighashType} type
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Workers.prototype.signInput = co(function* signInput(tx, index, key, type) {
|
||||
@ -305,7 +305,7 @@ Workers.prototype.signInput = co(function* signInput(tx, index, key, type) {
|
||||
* @param {Buffer} msg
|
||||
* @param {Buffer} sig - DER formatted.
|
||||
* @param {Buffer} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Workers.prototype.ecVerify = function ecVerify(msg, sig, key) {
|
||||
@ -316,7 +316,7 @@ Workers.prototype.ecVerify = function ecVerify(msg, sig, key) {
|
||||
* Execute the ec signing job (no timeout).
|
||||
* @param {Buffer} msg
|
||||
* @param {Buffer} key
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
Workers.prototype.ecSign = function ecSign(msg, key) {
|
||||
@ -326,7 +326,7 @@ Workers.prototype.ecSign = function ecSign(msg, key) {
|
||||
/**
|
||||
* Execute the mining job (no timeout).
|
||||
* @param {MinerBlock} attempt
|
||||
* @param {Function} callback - Returns [Error, {@link MinerBlock}].
|
||||
* @returns {Promise} - Returns {@link MinerBlock}.
|
||||
*/
|
||||
|
||||
Workers.prototype.mine = function mine(attempt) {
|
||||
@ -341,7 +341,7 @@ Workers.prototype.mine = function mine(attempt) {
|
||||
* @param {Number} r
|
||||
* @param {Number} p
|
||||
* @param {Number} len
|
||||
* @param {Function} callback
|
||||
* @returns {Promise}
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
|
||||
@ -579,7 +579,7 @@ Worker.prototype.destroy = function destroy() {
|
||||
* @param {Number} job - Job ID.
|
||||
* @param {String} method - Method name.
|
||||
* @param {Array} args - Arguments.
|
||||
* @param {Function} callback - Returns whatever
|
||||
* @returns {Promise}
|
||||
* the worker method specifies.
|
||||
*/
|
||||
|
||||
@ -626,7 +626,7 @@ Worker.prototype._execute = function _execute(method, args, timeout, callback) {
|
||||
* @param {Number} job - Job ID.
|
||||
* @param {String} method - Method name.
|
||||
* @param {Array} args - Arguments.
|
||||
* @param {Function} callback - Returns whatever
|
||||
* @returns {Promise}
|
||||
* the worker method specifies.
|
||||
*/
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user