accept feeLevel on createTx

This commit is contained in:
Ivan Socolsky 2016-03-04 10:25:12 -03:00
parent 443be97580
commit 37f87e4793
3 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ TxProposal.create = function(opts) {
x.actions = [];
x.fee = opts.fee;
x.feePerKb = opts.feePerKb;
x.feeLevel = opts.feeLevel;
x.excludeUnconfirmedUtxos = opts.excludeUnconfirmedUtxos;
x.addressType = opts.addressType || (x.walletN > 1 ? Constants.SCRIPT_TYPES.P2SH : Constants.SCRIPT_TYPES.P2PKH);
@ -95,6 +96,7 @@ TxProposal.fromObj = function(obj) {
x.outputOrder = obj.outputOrder;
x.fee = obj.fee;
x.feePerKb = obj.feePerKb;
x.feeLevel = obj.feeLevel;
x.excludeUnconfirmedUtxos = obj.excludeUnconfirmedUtxos;
x.addressType = obj.addressType;
x.customData = obj.customData;

View File

@ -1546,6 +1546,7 @@ WalletService.prototype.createTxLegacy = function(opts, cb) {
* @param {Array} opts.inputs - Optional. Inputs for this TX
* @param {string} opts.fee - Optional. Use an alternative fee for this TX (mutually exclusive with feePerKb)
* @param {string} opts.feePerKb - Optional. Use an alternative fee per KB for this TX (mutually exclusive with fee)
* @param {string} opts.feeLevel - Optional. Specify the fee level used to compute feePerKb for this txp.
* @param {string} opts.payProUrl - Optional. Paypro URL for peers to verify TX
* @param {string} opts.excludeUnconfirmedUtxos[=false] - Optional. Do not use UTXOs of unconfirmed transactions as inputs
* @param {string} opts.validateOutputs[=true] - Optional. Perform validation on outputs.
@ -1595,6 +1596,7 @@ WalletService.prototype.createTx = function(opts, cb) {
changeAddress: wallet.createAddress(true),
fee: opts.fee,
feePerKb: opts.feePerKb,
feeLevel: opts.feeLevel,
payProUrl: opts.payProUrl,
walletM: wallet.m,
walletN: wallet.n,

View File

@ -2718,6 +2718,7 @@ describe('Wallet service', function() {
}],
message: 'some message',
customData: 'some custom data',
feeLevel: 'priority',
};
server.createTx(txOpts, function(err, tx) {
should.not.exist(err);
@ -2731,6 +2732,7 @@ describe('Wallet service', function() {
tx.isPending().should.equal.true;
tx.isTemporary().should.equal.true;
tx.amount.should.equal(helpers.toSatoshi(0.8));
tx.feeLevel.should.equal('priority');
server.getPendingTxs({}, function(err, txs) {
should.not.exist(err);
txs.should.be.empty;