rename fill to fund.

This commit is contained in:
Christopher Jeffrey 2016-07-14 16:10:32 -07:00
parent 52c46e83ed
commit ba4ce73a8d
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
4 changed files with 18 additions and 18 deletions

View File

@ -497,7 +497,7 @@ tx.addOutput({
// Select coins from our array and add inputs.
// Calculate fee and add a change output.
tx.fill(coins, {
tx.fund(coins, {
// Use a rate of 10,000 satoshis per kb.
// With the `fullnode` object, you can
// use the fee estimator for this instead

View File

@ -1164,7 +1164,7 @@ MTX.prototype.subtractFee = function subtractFee(fee, index) {
* @returns {Object} See {@link MTX#selectCoins} return value.
*/
MTX.prototype.fill = function fill(coins, options) {
MTX.prototype.fund = function fund(coins, options) {
var result, i, change, changeAddress;
assert(this.inputs.length === 0, 'TX is already filled.');

View File

@ -685,7 +685,7 @@ Wallet.prototype.getPath = function getPath(address, callback) {
* fee from existing outputs rather than adding more inputs.
*/
Wallet.prototype.fill = function fill(tx, options, callback) {
Wallet.prototype.fund = function fund(tx, options, callback) {
var self = this;
var unlock, rate;
@ -699,7 +699,7 @@ Wallet.prototype.fill = function fill(tx, options, callback) {
// We use a lock here to ensure we
// don't end up double spending coins.
unlock = this.fillLock.lock(fill, [tx, options, callback]);
unlock = this.fillLock.lock(fund, [tx, options, callback]);
if (!unlock)
return;
@ -736,7 +736,7 @@ Wallet.prototype.fill = function fill(tx, options, callback) {
}
try {
tx.fill(coins, {
tx.fund(coins, {
selection: options.selection || 'age',
round: options.round,
confirmed: options.confirmed,
@ -790,7 +790,7 @@ Wallet.prototype.createTX = function createTX(options, callback) {
}
// Fill the inputs with unspents
this.fill(tx, options, function(err) {
this.fund(tx, options, function(err) {
if (err)
return callback(err);

View File

@ -359,7 +359,7 @@ describe('Wallet', function() {
// Create new transaction
var t2 = bcoin.mtx().addOutput(w2, 5460);
w1.fill(t2, { rate: 10000, round: true }, function(err) {
w1.fund(t2, { rate: 10000, round: true }, function(err) {
assert.ifError(err);
w1.sign(t2, function(err) {
assert.ifError(err);
@ -375,7 +375,7 @@ describe('Wallet', function() {
// Create new transaction
var t3 = bcoin.mtx().addOutput(w2, 15000);
w1.fill(t3, { rate: 10000, round: true }, function(err) {
w1.fund(t3, { rate: 10000, round: true }, function(err) {
assert(err);
assert.equal(err.requiredFunds, 25000);
cb();
@ -407,7 +407,7 @@ describe('Wallet', function() {
// Create new transaction
var t2 = bcoin.mtx().addOutput(w2, 5460);
w1.fill(t2, { rate: 10000 }, function(err) {
w1.fund(t2, { rate: 10000 }, function(err) {
assert.ifError(err);
w1.sign(t2, function(err) {
assert.ifError(err);
@ -434,7 +434,7 @@ describe('Wallet', function() {
walletdb.addTX(t2, function(err) {
assert.ifError(err);
var t3 = bcoin.mtx().addOutput(w2, 15000);
w1.fill(t3, { rate: 10000 }, function(err) {
w1.fund(t3, { rate: 10000 }, function(err) {
assert(err);
assert(balance);
assert(balance.total === 5460);
@ -664,7 +664,7 @@ describe('Wallet', function() {
var send = bcoin.mtx();
send.addOutput({ address: receive.getAddress(), value: 5460 });
assert(!send.verify(flags));
w1.fill(send, { rate: 10000, round: true }, function(err) {
w1.fund(send, { rate: 10000, round: true }, function(err) {
assert.ifError(err);
w1.sign(send, function(err) {
@ -774,7 +774,7 @@ describe('Wallet', function() {
// Create new transaction
var t2 = bcoin.mtx().addOutput(w2, 5460);
w1.fill(t2, { rate: 10000, round: true }, function(err) {
w1.fund(t2, { rate: 10000, round: true }, function(err) {
assert.ifError(err);
w1.sign(t2, function(err) {
assert.ifError(err);
@ -790,7 +790,7 @@ describe('Wallet', function() {
// Create new transaction
var t3 = bcoin.mtx().addOutput(w2, 15000);
w1.fill(t3, { rate: 10000, round: true }, function(err) {
w1.fund(t3, { rate: 10000, round: true }, function(err) {
assert(err);
assert.equal(err.requiredFunds, 25000);
w1.getAccounts(function(err, accounts) {
@ -840,11 +840,11 @@ describe('Wallet', function() {
// Should fill from `foo` and fail
var t2 = bcoin.mtx().addOutput(w1, 5460);
w1.fill(t2, { rate: 10000, round: true, account: 'foo' }, function(err) {
w1.fund(t2, { rate: 10000, round: true, account: 'foo' }, function(err) {
assert(err);
// Should fill from whole wallet and succeed
var t2 = bcoin.mtx().addOutput(w1, 5460);
w1.fill(t2, { rate: 10000, round: true }, function(err) {
w1.fund(t2, { rate: 10000, round: true }, function(err) {
assert.ifError(err);
// Coinbase
@ -859,7 +859,7 @@ describe('Wallet', function() {
assert.ifError(err);
var t2 = bcoin.mtx().addOutput(w1, 5460);
// Should fill from `foo` and succeed
w1.fill(t2, { rate: 10000, round: true, account: 'foo' }, function(err) {
w1.fund(t2, { rate: 10000, round: true, account: 'foo' }, function(err) {
assert.ifError(err);
cb();
});
@ -892,7 +892,7 @@ describe('Wallet', function() {
// Create new transaction
var t2 = bcoin.mtx().addOutput(w1, 5460);
w1.fill(t2, { rate: 10000, round: true }, function(err) {
w1.fund(t2, { rate: 10000, round: true }, function(err) {
assert.ifError(err);
// Should fail
w1.sign(t2, 'bar', function(err) {
@ -930,7 +930,7 @@ describe('Wallet', function() {
// Create new transaction
var t2 = bcoin.mtx().addOutput(w2, 21840);
w1.fill(t2, { rate: 10000, round: true, subtractFee: true }, function(err) {
w1.fund(t2, { rate: 10000, round: true, subtractFee: true }, function(err) {
assert.ifError(err);
w1.sign(t2, function(err) {
assert.ifError(err);