comments. docs.
This commit is contained in:
parent
e75e040d2b
commit
5ac4621b0e
@ -153,4 +153,8 @@ AbstractBlock.prototype.__defineGetter__('rhash', function() {
|
||||
return utils.revHex(this.hash('hex'));
|
||||
});
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = AbstractBlock;
|
||||
|
||||
@ -467,4 +467,9 @@ Address.getHash = function getHash(data) {
|
||||
|
||||
return hash.toString('hex');
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Address;
|
||||
|
||||
@ -426,7 +426,7 @@ Block.prototype.getCoinbaseHeight = function getCoinbaseHeight() {
|
||||
|
||||
/**
|
||||
* Calculate the block reward.
|
||||
* @returns {BN} reward
|
||||
* @returns {Amount} reward
|
||||
*/
|
||||
|
||||
Block.prototype.getReward = function getReward(network) {
|
||||
@ -457,7 +457,7 @@ Block.prototype.getReward = function getReward(network) {
|
||||
|
||||
/**
|
||||
* Get the "claimed" reward by the coinbase.
|
||||
* @returns {BN} claimed
|
||||
* @returns {Amount} claimed
|
||||
*/
|
||||
|
||||
Block.prototype.getClaimed = function getClaimed() {
|
||||
@ -469,7 +469,7 @@ Block.prototype.getClaimed = function getClaimed() {
|
||||
/**
|
||||
* Calculate block subsidy.
|
||||
* @param {Number} height - Reward era by height.
|
||||
* @returns {BN}
|
||||
* @returns {Amount}
|
||||
*/
|
||||
|
||||
Block.reward = function _reward(height, network) {
|
||||
@ -682,4 +682,8 @@ Block.isBlock = function isBlock(obj) {
|
||||
&& typeof obj.toCompact === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Block;
|
||||
|
||||
@ -236,4 +236,8 @@ function murmur(data, seed) {
|
||||
|
||||
Bloom.hash = murmur;
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Bloom;
|
||||
|
||||
@ -716,4 +716,8 @@ function clone(node) {
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = BST;
|
||||
|
||||
@ -2502,4 +2502,8 @@ Chain.prototype.checkLocks = function checkLocks(prev, tx, flags, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Chain;
|
||||
|
||||
@ -1464,6 +1464,12 @@ ChainDB.prototype._pruneBlock = function _pruneBlock(block, batch, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* A null cache. Every method is a NOP.
|
||||
* @constructor
|
||||
* @param {Number} size
|
||||
*/
|
||||
|
||||
function NullCache(size) {}
|
||||
|
||||
NullCache.prototype.set = function set(key, value) {};
|
||||
@ -1472,4 +1478,8 @@ NullCache.prototype.get = function get(key) {};
|
||||
NullCache.prototype.has = function has(key) {};
|
||||
NullCache.prototype.reset = function reset() {};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = ChainDB;
|
||||
|
||||
@ -487,4 +487,8 @@ ChainEntry.isChainEntry = function isChainEntry(obj) {
|
||||
&& typeof obj.getMedianTime === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = ChainEntry;
|
||||
|
||||
@ -22,7 +22,7 @@ var assert = utils.assert;
|
||||
* @param {Number?} index - Output index.
|
||||
* @property {Number} version - Transaction version.
|
||||
* @property {Number} height - Transaction height (-1 if unconfirmed).
|
||||
* @property {BN} value - Output value in satoshis.
|
||||
* @property {Amount} value - Output value in satoshis.
|
||||
* @property {Script} script - Output script.
|
||||
* @property {Boolean} coinbase - Whether the containing
|
||||
* transaction is a coinbase.
|
||||
@ -280,4 +280,8 @@ Coin.isCoin = function isCoin(obj) {
|
||||
&& typeof obj.getConfirmations === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Coin;
|
||||
|
||||
@ -273,4 +273,8 @@ Coins.fromRaw = function fromRaw(buf, hash) {
|
||||
return new Coins(Coins.parseRaw(buf), hash);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Coins;
|
||||
|
||||
@ -161,4 +161,8 @@ CoinView.prototype.toArray = function toArray() {
|
||||
return out;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = CoinView;
|
||||
|
||||
@ -116,4 +116,8 @@ CompactBlock.isCompactBlock = function isCompactBlock(obj) {
|
||||
return obj && typeof obj.toBlock === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = CompactBlock;
|
||||
|
||||
@ -109,5 +109,9 @@ function ScriptError(code, op, ip) {
|
||||
|
||||
utils.inherits(ScriptError, Error);
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
exports.VerifyError = VerifyError;
|
||||
exports.ScriptError = ScriptError;
|
||||
|
||||
@ -601,4 +601,8 @@ Fullnode.prototype.getConfidence = function getConfidence(tx, callback) {
|
||||
return this.mempool.getConfidence(tx, callback);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Fullnode;
|
||||
|
||||
@ -154,4 +154,8 @@ Headers.isHeaders = function isHeaders(obj) {
|
||||
&& typeof obj.toBlock !== 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Headers;
|
||||
|
||||
@ -506,4 +506,8 @@ function unescape(str) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = HTTPBase;
|
||||
|
||||
@ -769,7 +769,7 @@ HTTPClient.prototype.broadcast = function broadcast(tx, callback) {
|
||||
* @param {WalletID} id
|
||||
* @param {Object} options
|
||||
* @param {Base58Address} options.address
|
||||
* @param {BN} options.value
|
||||
* @param {Amount} options.value
|
||||
* @param {Function} callback - Returns [Error, {@link TX}].
|
||||
*/
|
||||
|
||||
@ -913,4 +913,8 @@ HTTPClient.prototype.getInfo = function getInfo(callback) {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = HTTPClient;
|
||||
|
||||
@ -202,4 +202,8 @@ HTTPProvider.prototype.zap = function zap(now, age, callback) {
|
||||
return this.client.zapWallet(this.id, now, age, callback);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = HTTPProvider;
|
||||
|
||||
@ -336,4 +336,8 @@ ReqStream.prototype.destroy = function destroy() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = request;
|
||||
|
||||
@ -785,4 +785,8 @@ HTTPServer.prototype.listen = function listen(port, host, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = HTTPServer;
|
||||
|
||||
@ -429,4 +429,8 @@ Input.isInput = function isInput(obj) {
|
||||
&& typeof obj.getAddress === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Input;
|
||||
|
||||
@ -276,4 +276,8 @@ KeyPair.fromJSON = function fromJSON(json, passphrase) {
|
||||
return new KeyPair(KeyPair.parseJSON(json, passphrase));
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = KeyPair;
|
||||
|
||||
@ -659,4 +659,8 @@ KeyRing.fromJSON = function fromJSON(json, passphrase) {
|
||||
return w;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = KeyRing;
|
||||
|
||||
@ -127,7 +127,13 @@ function repair(options, callback) {
|
||||
backend.repair(file, callback);
|
||||
}
|
||||
|
||||
ldb.destroy = destroy;
|
||||
ldb.repair = repair;
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = ldb;
|
||||
exports = ldb;
|
||||
|
||||
exports.destroy = destroy;
|
||||
exports.repair = repair;
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
@ -164,4 +164,8 @@ Locker.prototype.onFlush = function onFlush(callback) {
|
||||
this.once('flush', callback);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Locker;
|
||||
|
||||
@ -338,4 +338,8 @@ LowlevelUp.prototype.lookup = function lookup(options, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = LowlevelUp;
|
||||
|
||||
@ -305,4 +305,8 @@ LRU.prototype.toArray = function toArray() {
|
||||
return items;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = LRU;
|
||||
|
||||
@ -32,6 +32,7 @@ var DUMMY = new Buffer([0]);
|
||||
* @param {String?} options.db - Database backend (`"memory"` by default).
|
||||
* @param {Boolean?} options.limitFree
|
||||
* @param {Number?} options.limitFreeRelay
|
||||
* @param {Number?} options.maxSize - Max pool size (default ~300mb).
|
||||
* @param {Boolean?} options.relayPriority
|
||||
* @param {Boolean?} options.requireStandard
|
||||
* @param {Boolean?} options.rejectAbsurdFees
|
||||
@ -43,6 +44,12 @@ var DUMMY = new Buffer([0]);
|
||||
* @property {Locker} locker
|
||||
* @property {Number} freeCount
|
||||
* @property {Number} lastTime
|
||||
* @property {Number} maxSize
|
||||
* @property {Boolean} blockSinceBump
|
||||
* @property {Number} lastFeeUpdate
|
||||
* @property {Rate} minFeeRate
|
||||
* @property {Rate} minReasonableFee
|
||||
* @property {Rate} minRelayFee
|
||||
* @emits Mempool#open
|
||||
* @emits Mempool#error
|
||||
* @emits Mempool#tx
|
||||
@ -92,9 +99,9 @@ function Mempool(options) {
|
||||
this.accurateMemory = !!this.options.accurateMemory;
|
||||
|
||||
this.maxSize = options.maxSize || constants.mempool.MAX_MEMPOOL_SIZE;
|
||||
this.minFeeRate = 0;
|
||||
this.blockSinceBump = false;
|
||||
this.lastFeeUpdate = utils.now();
|
||||
this.minFeeRate = 0;
|
||||
this.minReasonableFee = constants.tx.MIN_RELAY;
|
||||
this.minRelayFee = constants.tx.MIN_RELAY;
|
||||
|
||||
@ -861,7 +868,7 @@ Mempool.prototype.removeUnchecked = function removeUnchecked(entry, limit, callb
|
||||
|
||||
/**
|
||||
* Calculate and update the minimum rolling fee rate.
|
||||
* @returns {Number} Rate.
|
||||
* @returns {Rate} Rate.
|
||||
*/
|
||||
|
||||
Mempool.prototype.getMinRate = function getMinRate() {
|
||||
@ -1789,20 +1796,20 @@ Mempool.prototype.getSize = function getSize() {
|
||||
* @param {Object} options
|
||||
* @param {TX} options.tx - Transaction in mempool.
|
||||
* @param {Number} options.height - Entry height.
|
||||
* @param {BN} options.priority - Entry priority.
|
||||
* @param {Number} options.priority - Entry priority.
|
||||
* @param {Number} options.ts - Entry time.
|
||||
* @param {BN} options.chainValue - Value of on-chain coins.
|
||||
* @param {Amount} options.chainValue - Value of on-chain coins.
|
||||
* @param {Number} options.count - Number of descendants (includes tx).
|
||||
* @param {Number} options.size - TX and descendant modified size.
|
||||
* @param {BN} options.fees - TX and descendant delta-applied fees.
|
||||
* @param {Amount} options.fees - TX and descendant delta-applied fees.
|
||||
* @property {TX} tx
|
||||
* @property {Number} height
|
||||
* @property {BN} priority
|
||||
* @property {Number} priority
|
||||
* @property {Number} ts
|
||||
* @property {BN} chainValue
|
||||
* @property {Amount} chainValue
|
||||
* @property {Number} count
|
||||
* @property {Number} size
|
||||
* @property {BN} fees
|
||||
* @property {Amount} fees
|
||||
*/
|
||||
|
||||
function MempoolEntry(options) {
|
||||
@ -1890,7 +1897,7 @@ MempoolEntry.fromRaw = function fromRaw(data) {
|
||||
* the entry height delta, modified size,
|
||||
* and chain value.
|
||||
* @param {Number} height
|
||||
* @returns {BN} Priority.
|
||||
* @returns {Number} Priority.
|
||||
*/
|
||||
|
||||
MempoolEntry.prototype.getPriority = function getPriority(height) {
|
||||
@ -1953,4 +1960,8 @@ function mallocUsage(alloc) {
|
||||
|
||||
Mempool.MempoolEntry = MempoolEntry;
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Mempool;
|
||||
|
||||
@ -402,4 +402,8 @@ MerkleBlock.isMerkleBlock = function isMerkleBlock(obj) {
|
||||
&& typeof obj.verifyPartial === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = MerkleBlock;
|
||||
|
||||
@ -674,4 +674,8 @@ function rcmp(a, b) {
|
||||
|
||||
Miner.MinerBlock = MinerBlock;
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Miner;
|
||||
|
||||
@ -784,7 +784,7 @@ MTX.prototype.sign = function sign(index, addr, type) {
|
||||
* tx.addOutput(receivingWallet, utils.satoshi('0.1'));
|
||||
* @param {Wallet|Address|Object} obj - Wallet, Address,
|
||||
* or options (see {@link Script.createOutputScript} for options).
|
||||
* @param {BN?} value - Only needs to be present for non-options.
|
||||
* @param {Amount?} value - Only needs to be present for non-options.
|
||||
*/
|
||||
|
||||
MTX.prototype.addOutput = function addOutput(address, value) {
|
||||
@ -1053,7 +1053,8 @@ MTX.prototype.maxSize = function maxSize(options, force) {
|
||||
* @param {Boolean} options.confirmed - Select only confirmed coins.
|
||||
* @param {Boolean} options.free - Do not apply a fee if the
|
||||
* transaction priority is high enough to be considered free.
|
||||
* @param {BN?} options.fee - Use a hard fee rather than calculating one.
|
||||
* @param {Amount?} options.fee - Use a hard fee rather than calculating one.
|
||||
* @param {Rate?} options.rate - Rate used for fee calculation.
|
||||
* @param {Number|Boolean} options.subtractFee - Whether to subtract the
|
||||
* fee from * existing outputs rather than adding more inputs.
|
||||
* @returns {CoinSelection}
|
||||
@ -1423,4 +1424,8 @@ MTX.isMTX = function isMTX(obj) {
|
||||
&& typeof obj.scriptInput === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = MTX;
|
||||
|
||||
@ -15,8 +15,8 @@ var network = require('./protocol/network');
|
||||
* @constructor
|
||||
* @param {Object|String} options - See {@link module:network}.
|
||||
* @property {Number} height
|
||||
* @property {Number} feeRate
|
||||
* @property {Number} minRelay
|
||||
* @property {Rate} feeRate
|
||||
* @property {Rate} minRelay
|
||||
*/
|
||||
|
||||
function Network(options) {
|
||||
@ -66,7 +66,7 @@ Network.prototype.updateHeight = function updateHeight(height) {
|
||||
|
||||
/**
|
||||
* Update the estimated fee rate of the network.
|
||||
* @param {Number} rate
|
||||
* @param {Rate} rate
|
||||
*/
|
||||
|
||||
Network.prototype.updateRate = function updateRate(rate) {
|
||||
@ -75,7 +75,7 @@ Network.prototype.updateRate = function updateRate(rate) {
|
||||
|
||||
/**
|
||||
* Update the minimum relay rate (reject rate) of the network.
|
||||
* @param {Number} rate
|
||||
* @param {Rate} rate
|
||||
*/
|
||||
|
||||
Network.prototype.updateMinRelay = function updateMinRelay(rate) {
|
||||
@ -85,7 +85,7 @@ Network.prototype.updateMinRelay = function updateMinRelay(rate) {
|
||||
/**
|
||||
* Calculate the minimum relay rate. If the network is
|
||||
* inactive (height=-1), return the default minimum relay.
|
||||
* @return {Number} Rate
|
||||
* @return {Rate} Rate
|
||||
*/
|
||||
|
||||
Network.prototype.getMinRelay = function getMinRelay() {
|
||||
@ -98,7 +98,7 @@ Network.prototype.getMinRelay = function getMinRelay() {
|
||||
/**
|
||||
* Calculate the normal relay rate. If the network is
|
||||
* inactive (height=-1), return the default rate.
|
||||
* @return {Number} Rate
|
||||
* @return {Rate} Rate
|
||||
*/
|
||||
|
||||
Network.prototype.getRate = function getRate() {
|
||||
@ -161,4 +161,8 @@ Network.prototype.inspect = function inspect() {
|
||||
return '<Network: ' + this.type + '>';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Network;
|
||||
|
||||
@ -39,4 +39,8 @@ function Node(options) {
|
||||
|
||||
utils.inherits(Node, EventEmitter);
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Node;
|
||||
|
||||
@ -18,7 +18,7 @@ var Framer = bcoin.protocol.framer;
|
||||
* @constructor
|
||||
* @param {NakedOutput} options
|
||||
* @param {Boolean?} mutable
|
||||
* @property {BN} value - Value in satoshis.
|
||||
* @property {Amount} value - Value in satoshis.
|
||||
* @property {Script} script
|
||||
* @property {String} type - Script type.
|
||||
* @property {String?} address - Input address.
|
||||
@ -151,8 +151,8 @@ Output.prototype.toJSON = function toJSON() {
|
||||
/**
|
||||
* Calculate the dust threshold for this
|
||||
* output, based on serialize size and rate.
|
||||
* @param {Number?} rate
|
||||
* @returns {BN}
|
||||
* @param {Rate?} rate
|
||||
* @returns {Amount}
|
||||
*/
|
||||
|
||||
Output.prototype.getDustThreshold = function getDustThreshold(rate) {
|
||||
@ -172,7 +172,7 @@ Output.prototype.getDustThreshold = function getDustThreshold(rate) {
|
||||
|
||||
/**
|
||||
* Test whether the output should be considered dust.
|
||||
* @param {Number?} rate
|
||||
* @param {Rate?} rate
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
@ -259,4 +259,8 @@ Output.isOutput = function isOutput(obj) {
|
||||
&& typeof obj.getAddress === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Output;
|
||||
|
||||
@ -1445,4 +1445,8 @@ Peer.prototype.sendReject = function sendReject(obj, code, reason, score) {
|
||||
return this.pool.reject(this, obj, code, reason, score);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Peer;
|
||||
|
||||
@ -2321,4 +2321,8 @@ LoadRequest.prototype.finish = function finish() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Pool;
|
||||
|
||||
@ -301,7 +301,7 @@ exports.opcodesByVal = utils.revMap(exports.opcodes);
|
||||
|
||||
/**
|
||||
* One bitcoin in satoshis.
|
||||
* @const {BN}
|
||||
* @const {Amount}
|
||||
* @default
|
||||
*/
|
||||
|
||||
@ -309,7 +309,7 @@ exports.COIN = 100000000;
|
||||
|
||||
/**
|
||||
* One bitcoin / 100.
|
||||
* @const {BN}
|
||||
* @const {Amount}
|
||||
* @default
|
||||
*/
|
||||
|
||||
@ -317,7 +317,7 @@ exports.CENT = 1000000;
|
||||
|
||||
/**
|
||||
* Maximum amount of money in satoshis (1btc * 21million)
|
||||
* @const {BN}
|
||||
* @const {Amount}
|
||||
* @default
|
||||
*/
|
||||
|
||||
|
||||
@ -1514,4 +1514,8 @@ Framer.tx.cost = function txCost(tx) {
|
||||
return base * (scale - 1) + sizes.size;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Framer;
|
||||
|
||||
@ -416,7 +416,7 @@ main.rpcPort = 8332;
|
||||
|
||||
/**
|
||||
* Default min relay rate (the rate for mempoolRejectFee).
|
||||
* @const {Number}
|
||||
* @const {Rate}
|
||||
* @default
|
||||
*/
|
||||
|
||||
@ -424,7 +424,7 @@ main.minRelay = 10000;
|
||||
|
||||
/**
|
||||
* Default normal relay rate.
|
||||
* @const {Number}
|
||||
* @const {Rate}
|
||||
* @default
|
||||
*/
|
||||
|
||||
@ -432,7 +432,7 @@ main.feeRate = 40000;
|
||||
|
||||
/**
|
||||
* Default min rate.
|
||||
* @const {Number}
|
||||
* @const {Rate}
|
||||
* @default
|
||||
*/
|
||||
|
||||
@ -440,7 +440,7 @@ main.minRate = 10000;
|
||||
|
||||
/**
|
||||
* Default max rate.
|
||||
* @const {Number}
|
||||
* @const {Rate}
|
||||
* @default
|
||||
*/
|
||||
|
||||
|
||||
@ -1227,4 +1227,8 @@ Parser.parseAlert = function parseAlert(p) {
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Parser;
|
||||
|
||||
@ -545,4 +545,8 @@ BufferReader.prototype.verifyChecksum = function verifyChecksum() {
|
||||
return checksum;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = BufferReader;
|
||||
|
||||
@ -4205,7 +4205,14 @@ Script.isScript = function isScript(obj) {
|
||||
&& typeof obj.getSubscript === 'function';
|
||||
};
|
||||
|
||||
Script.Witness = Witness;
|
||||
Script.Stack = Stack;
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Script;
|
||||
exports = Script;
|
||||
|
||||
exports.Script = Script;
|
||||
exports.Witness = Witness;
|
||||
exports.Stack = Stack;
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
@ -296,4 +296,8 @@ SPVNode.prototype.getWallet = function getWallet(id, passphrase, callback) {
|
||||
return this.walletdb.get(id, passphrase, callback);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = SPVNode;
|
||||
|
||||
@ -103,8 +103,16 @@ TimeData.prototype.now = function now() {
|
||||
return utils.now() + this.offset;
|
||||
};
|
||||
|
||||
/*
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
function compare(a, b) {
|
||||
return a - b;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = TimeData;
|
||||
|
||||
@ -660,7 +660,7 @@ TX.prototype.isCoinbase = function isCoinbase() {
|
||||
|
||||
/**
|
||||
* Calculate the fee for the transaction.
|
||||
* @returns {BN} fee (zero if not all coins are available).
|
||||
* @returns {Amount} fee (zero if not all coins are available).
|
||||
*/
|
||||
|
||||
TX.prototype.getFee = function getFee() {
|
||||
@ -672,7 +672,7 @@ TX.prototype.getFee = function getFee() {
|
||||
|
||||
/**
|
||||
* Calculate the total input value.
|
||||
* @returns {BN} value
|
||||
* @returns {Amount} value
|
||||
*/
|
||||
|
||||
TX.prototype.getInputValue = function getInputValue() {
|
||||
@ -696,7 +696,7 @@ TX.prototype.getInputValue = function getInputValue() {
|
||||
|
||||
/**
|
||||
* Calculate the total output value.
|
||||
* @returns {BN} value
|
||||
* @returns {Amount} value
|
||||
*/
|
||||
|
||||
TX.prototype.getOutputValue = function getOutputValue() {
|
||||
@ -1411,7 +1411,7 @@ TX.prototype.getModifiedSize = function getModifiedSize(size) {
|
||||
* @param {Number?} size - Size to calculate priority
|
||||
* based on. If not present, modified size will be
|
||||
* calculated and used.
|
||||
* @returns {BN} priority
|
||||
* @returns {Number} priority
|
||||
*/
|
||||
|
||||
TX.prototype.getPriority = function getPriority(height, size) {
|
||||
@ -1485,8 +1485,8 @@ TX.prototype.isFree = function isFree(height, size) {
|
||||
* to be relayable (not the constant min relay fee).
|
||||
* @param {Number?} size - If not present, max size
|
||||
* estimation will be calculated and used.
|
||||
* @param {Number?} rate - Rate of satoshi per kB.
|
||||
* @returns {BN} fee
|
||||
* @param {Rate?} rate - Rate of satoshi per kB.
|
||||
* @returns {Amount} fee
|
||||
*/
|
||||
|
||||
TX.prototype.getMinFee = function getMinFee(size, rate) {
|
||||
@ -1499,8 +1499,8 @@ TX.prototype.getMinFee = function getMinFee(size, rate) {
|
||||
/**
|
||||
* Calculate minimum fee based on rate and size.
|
||||
* @param {Number?} size
|
||||
* @param {Number?} rate - Rate of satoshi per kB.
|
||||
* @returns {BN} fee
|
||||
* @param {Rate?} rate - Rate of satoshi per kB.
|
||||
* @returns {Amount} fee
|
||||
*/
|
||||
|
||||
TX.getMinFee = function getMinFee(size, rate) {
|
||||
@ -1523,8 +1523,8 @@ TX.getMinFee = function getMinFee(size, rate) {
|
||||
* when taking into account size.
|
||||
* @param {Number?} size - If not present, max size
|
||||
* estimation will be calculated and used.
|
||||
* @param {Number?} rate - Rate of satoshi per kB.
|
||||
* @returns {BN} fee
|
||||
* @param {Rate?} rate - Rate of satoshi per kB.
|
||||
* @returns {Amount} fee
|
||||
*/
|
||||
|
||||
TX.prototype.getMaxFee = function getMaxFee(size, rate) {
|
||||
@ -1917,4 +1917,9 @@ TX.isTX = function isTX(obj) {
|
||||
&& typeof obj.getVirtualSize === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
|
||||
module.exports = TX;
|
||||
|
||||
@ -1735,4 +1735,8 @@ TXDB.prototype.zap = function zap(address, now, age, callback, force) {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = TXDB;
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
/**
|
||||
* @typedef {Object} ParsedURI
|
||||
* @property {Base58Address} address
|
||||
* @property {BN?} amount? - Amount in satoshis.
|
||||
* @property {Amount?} amount? - Amount in satoshis.
|
||||
* @property {String?} label
|
||||
* @property {String?} message
|
||||
* @property {String?} request - Payment request URL.
|
||||
@ -105,9 +105,25 @@
|
||||
/**
|
||||
* Wallet balance.
|
||||
* @typedef {Object} Balance
|
||||
* @property {BN} confirmed
|
||||
* @property {BN} unconfirmed
|
||||
* @property {BN} total
|
||||
* @property {Amount} confirmed
|
||||
* @property {Amount} unconfirmed
|
||||
* @property {Amount} total
|
||||
* @global
|
||||
*/
|
||||
|
||||
/**
|
||||
* A satoshi amount. This is technically a
|
||||
* JS double float, but it is regularly
|
||||
* enforced to be less than 53 bits and
|
||||
* less than MAX_MONEY regularly in
|
||||
* various functions.
|
||||
* @typedef {Number} Amount
|
||||
* @global
|
||||
*/
|
||||
|
||||
/**
|
||||
* Rate of satoshis per kB.
|
||||
* @typedef {Amount} Rate
|
||||
* @global
|
||||
*/
|
||||
|
||||
@ -143,9 +159,9 @@
|
||||
/**
|
||||
* @typedef {Object} CoinSelection
|
||||
* @property {Coin[]?} chosen - Selected coins.
|
||||
* @property {BN} change - Amount of change to add.
|
||||
* @property {BN} fee - Estimated fee.
|
||||
* @property {BN} total - Total value.
|
||||
* @property {Amount} change - Amount of change to add.
|
||||
* @property {Amount} fee - Estimated fee.
|
||||
* @property {Amount} total - Total value.
|
||||
* @global
|
||||
*/
|
||||
|
||||
@ -202,7 +218,7 @@
|
||||
* @typedef {Object} NakedCoin
|
||||
* @property {Number} version - Transaction version.
|
||||
* @property {Number} height - Transaction height (-1 if unconfirmed).
|
||||
* @property {BN} value - Output value in satoshis.
|
||||
* @property {Amount} value - Output value in satoshis.
|
||||
* @property {Script} script - Output script.
|
||||
* @property {Boolean} coinbase - Whether the containing
|
||||
* transaction is a coinbase.
|
||||
@ -295,7 +311,7 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} NakedOutput
|
||||
* @property {BN} value - Value in satoshis.
|
||||
* @property {Amount} value - Value in satoshis.
|
||||
* @property {NakedScript} script - Output script.
|
||||
* @global
|
||||
*/
|
||||
@ -304,7 +320,7 @@
|
||||
* @typedef {Object} NakedCoin
|
||||
* @property {Number} version - Transaction version.
|
||||
* @property {Number} height - Transaction height (-1 if unconfirmed).
|
||||
* @property {BN} value - Output value in satoshis.
|
||||
* @property {Amount} value - Output value in satoshis.
|
||||
* @property {Script} script - Output script.
|
||||
* @property {Boolean} coinbase - Whether the containing
|
||||
* transaction is a coinbase.
|
||||
|
||||
@ -52,7 +52,7 @@ exports.validate = function validate(uri) {
|
||||
/**
|
||||
* Encode data as a bitcoin URI.
|
||||
* @param {ParsedURI|Base58Address} data/address
|
||||
* @param {BN?} amount
|
||||
* @param {Amount?} amount
|
||||
* @returns {String} URI
|
||||
* @throws when no address provided
|
||||
*/
|
||||
|
||||
@ -651,7 +651,7 @@ utils.assert.fatal = function fatal(value, message) {
|
||||
* Safely convert satoshis to a BTC string.
|
||||
* This function explicitly avoids any
|
||||
* floating point arithmetic.
|
||||
* @param {Number} value - Satoshis.
|
||||
* @param {Amount} value - Satoshis.
|
||||
* @returns {String} BTC string.
|
||||
*/
|
||||
|
||||
@ -701,7 +701,7 @@ utils.btc = function btc(value) {
|
||||
* extra validation to ensure the resulting
|
||||
* Number will be 53 bits or less.
|
||||
* @param {String} value - BTC
|
||||
* @returns {Number} Satoshis.
|
||||
* @returns {Amount} Satoshis.
|
||||
* @throws on parse error
|
||||
*/
|
||||
|
||||
@ -777,7 +777,7 @@ utils.isFloat = function isFloat(value) {
|
||||
|
||||
/**
|
||||
* Test whether an object is a finite number and int.
|
||||
* @param {BN?} value
|
||||
* @param {Number?} value
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
@ -1272,16 +1272,14 @@ utils.time = function time(date) {
|
||||
|
||||
/**
|
||||
* UINT32_MAX
|
||||
* @type BN
|
||||
* @const
|
||||
* @const {BN}
|
||||
*/
|
||||
|
||||
utils.U32 = new bn(0xffffffff);
|
||||
|
||||
/**
|
||||
* UINT64_MAX
|
||||
* @type BN
|
||||
* @const
|
||||
* @const {BN}
|
||||
*/
|
||||
|
||||
utils.U64 = new bn('ffffffffffffffff', 'hex');
|
||||
@ -1640,17 +1638,15 @@ utils.writeU64NBE = function writeU64NBE(dst, num, off) {
|
||||
|
||||
/**
|
||||
* Max safe integer (53 bits).
|
||||
* @type Number
|
||||
* @const
|
||||
* @const {Number}
|
||||
*/
|
||||
|
||||
utils.MAX_SAFE_INTEGER = 0x1fffffffffffff;
|
||||
|
||||
/**
|
||||
* Max 52 bit integer (safe for additions).
|
||||
* (MAX_SAFE_INTEGER - 1) / 2
|
||||
* @type Number
|
||||
* @const
|
||||
* `(MAX_SAFE_INTEGER - 1) / 2`
|
||||
* @const {Number}
|
||||
*/
|
||||
|
||||
utils.MAX_SAFE_ADDITION = 0xfffffffffffff;
|
||||
|
||||
@ -679,10 +679,11 @@ Wallet.prototype.ownOutput = function ownOutput(tx, index) {
|
||||
* @param {Boolean} options.accurate - Whether to use "accurate"
|
||||
* fee calculatation rather than rounding to the nearest kilobyte.
|
||||
* See {@link TX#getMinFee} vs. {@link TX#getMaxFee}.
|
||||
* @param {Rate} options.rate - Rate used for fee calculation.
|
||||
* @param {Boolean} options.confirmed - Select only confirmed coins.
|
||||
* @param {Boolean} options.free - Do not apply a fee if the
|
||||
* transaction priority is high enough to be considered free.
|
||||
* @param {BN?} options.fee - Use a hard fee rather than calculating one.
|
||||
* @param {Amount?} options.fee - Use a hard fee rather than calculating one.
|
||||
* @param {Number|Boolean} options.subtractFee - Whether to subtract the
|
||||
* fee from existing outputs rather than adding more inputs.
|
||||
*/
|
||||
@ -1778,4 +1779,8 @@ Wallet.isWallet = function isWallet(obj) {
|
||||
&& obj.deriveAddress === 'function';
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Wallet;
|
||||
|
||||
@ -1169,6 +1169,12 @@ Provider.prototype.zap = function zap(now, age, callback) {
|
||||
return this.db.zapWallet(this.id, now, age, callback);
|
||||
};
|
||||
|
||||
WalletDB.Provider = Provider;
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = WalletDB;
|
||||
exports = WalletDB;
|
||||
|
||||
exports.Provider = Provider;
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
@ -882,10 +882,17 @@ function getCores() {
|
||||
return os.cpus().length;
|
||||
}
|
||||
|
||||
Workers.Worker = Worker;
|
||||
Workers.Master = Master;
|
||||
Workers.Framer = Framer;
|
||||
Workers.Parser = Parser;
|
||||
Workers.listen = Master.listen;
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = Workers;
|
||||
exports = Workers;
|
||||
|
||||
exports.Workers = Workers;
|
||||
exports.Worker = Worker;
|
||||
exports.Master = Master;
|
||||
exports.Framer = Framer;
|
||||
exports.Parser = Parser;
|
||||
exports.listen = Master.listen;
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
@ -350,4 +350,8 @@ BufferWriter.prototype.fill = function fill(value, size) {
|
||||
this.data.push(['bytes', buf]);
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = BufferWriter;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user