Skip to content

Commit b010abc

Browse files
committed
wallet-client: rename createAuctionTxs to createAuctionTXs.
Make style consistent for methods and variables.
1 parent ceab2a8 commit b010abc

File tree

10 files changed

+56
-55
lines changed

10 files changed

+56
-55
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ process and allows parallel rescans.
7171
- All transaction sending endpoints now fundlock/queue tx creation. (no more
7272
conflicting transactions)
7373
- Add options to `getNames` for passing `own`.
74+
- Rename `createAuctionTxs` to `createAuctionTXs`.
7475

7576

7677
## v6.0.0

bin/hsw-cli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class CLI {
372372
this.log(tx);
373373
}
374374

375-
async createAuctionTxs() {
375+
async createAuctionTXs() {
376376
const options = {
377377
name: this.config.str([0, 'name']),
378378
bid: this.config.ufixed([1, 'bid'], EXP),
@@ -381,7 +381,7 @@ class CLI {
381381
passphrase: this.config.str('passphrase')
382382
};
383383

384-
const txs = await this.wallet.createAuctionTxs(options);
384+
const txs = await this.wallet.createAuctionTXs(options);
385385

386386
this.log(txs);
387387
}
@@ -650,7 +650,7 @@ class CLI {
650650
await this.getMaster();
651651
break;
652652
case 'mkauctiontxs':
653-
await this.createAuctionTxs();
653+
await this.createAuctionTXs();
654654
break;
655655
case 'mktx':
656656
await this.createTX();

lib/client/wallet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ class WalletClient extends Client {
506506
* @returns {Promise}
507507
*/
508508

509-
createAuctionTxs(id, options) {
509+
createAuctionTXs(id, options) {
510510
return this.post(`/wallet/${id}/auction`, options);
511511
}
512512

@@ -1226,8 +1226,8 @@ class Wallet extends EventEmitter {
12261226
* @returns {Promise}
12271227
*/
12281228

1229-
createAuctionTxs(options) {
1230-
return this.client.createAuctionTxs(this.id, options);
1229+
createAuctionTXs(options) {
1230+
return this.client.createAuctionTXs(this.id, options);
12311231
}
12321232

12331233
/**

lib/wallet/http.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,29 +1151,29 @@ class HTTP extends Server {
11511151
enforce(broadcastBid ? sign : true, 'Must sign when broadcasting.');
11521152

11531153
const options = TransactionOptions.fromValidator(valid);
1154-
const auctionTxs = await req.wallet.createAuctionTxs(
1154+
const auctionTXs = await req.wallet.createAuctionTXs(
11551155
name,
11561156
bid,
11571157
lockup,
11581158
options
11591159
);
11601160

11611161
if (broadcastBid)
1162-
auctionTxs.bid = await req.wallet.sendMTX(auctionTxs.bid, passphrase);
1162+
auctionTXs.bid = await req.wallet.sendMTX(auctionTXs.bid, passphrase);
11631163

11641164
if (sign) {
11651165
if (!broadcastBid)
1166-
await req.wallet.sign(auctionTxs.bid, passphrase);
1166+
await req.wallet.sign(auctionTXs.bid, passphrase);
11671167

1168-
await req.wallet.sign(auctionTxs.reveal, passphrase);
1168+
await req.wallet.sign(auctionTXs.reveal, passphrase);
11691169
}
11701170

1171-
const jsonBid = auctionTxs.bid.getJSON(this.network);
1172-
const jsonReveal = auctionTxs.reveal.getJSON(this.network);
1171+
const jsonBid = auctionTXs.bid.getJSON(this.network);
1172+
const jsonReveal = auctionTXs.reveal.getJSON(this.network);
11731173

11741174
if (options.paths) {
1175-
await this.addOutputPaths(jsonBid, auctionTxs.bid, req.wallet);
1176-
await this.addOutputPaths(jsonReveal, auctionTxs.reveal, req.wallet);
1175+
await this.addOutputPaths(jsonBid, auctionTXs.bid, req.wallet);
1176+
await this.addOutputPaths(jsonReveal, auctionTXs.reveal, req.wallet);
11771177
}
11781178

11791179
return res.json(200, {

lib/wallet/wallet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,10 +1897,10 @@ class Wallet extends EventEmitter {
18971897
* @returns {MTX} output.reveal
18981898
*/
18991899

1900-
async createAuctionTxs(name, value, lockup, options) {
1900+
async createAuctionTXs(name, value, lockup, options) {
19011901
const unlock = await this.fundLock.lock();
19021902
try {
1903-
return await this._createAuctionTxs(name, value, lockup, options);
1903+
return await this._createAuctionTXs(name, value, lockup, options);
19041904
} finally {
19051905
unlock();
19061906
}
@@ -1918,7 +1918,7 @@ class Wallet extends EventEmitter {
19181918
* @returns {MTX} output.reveal
19191919
*/
19201920

1921-
async _createAuctionTxs(name, value, lockup, options) {
1921+
async _createAuctionTXs(name, value, lockup, options) {
19221922
const bid = await this._createBid(name, value, lockup, options);
19231923

19241924
const bidOuputIndex = bid.outputs.findIndex(o => o.covenant.isBid());

lib/wallet/walletdb.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,7 +2445,7 @@ class WalletDB extends EventEmitter {
24452445
return null;
24462446
}
24472447

2448-
const walletTxs = [];
2448+
const walletTXs = [];
24492449
let filterUpdated = false;
24502450

24512451
try {
@@ -2459,7 +2459,7 @@ class WalletDB extends EventEmitter {
24592459
const txadded = await this._addTX(tx, tip);
24602460

24612461
if (txadded) {
2462-
walletTxs.push(tx);
2462+
walletTXs.push(tx);
24632463

24642464
if (txadded.filterUpdated)
24652465
filterUpdated = true;
@@ -2468,20 +2468,20 @@ class WalletDB extends EventEmitter {
24682468

24692469
// Sync the state to the new tip.
24702470
// If we encountered wallet txs, we also trigger mark check.
2471-
await this.setTip(tip, walletTxs.length > 0);
2471+
await this.setTip(tip, walletTXs.length > 0);
24722472
} finally {
24732473
this.confirming = false;
24742474
}
24752475

2476-
if (walletTxs.length > 0) {
2476+
if (walletTXs.length > 0) {
24772477
this.logger.info('Connected WalletDB block %x (tx=%d).',
2478-
tip.hash, walletTxs.length);
2478+
tip.hash, walletTXs.length);
24792479
}
24802480

2481-
this.emit('block connect', entry, walletTxs);
2481+
this.emit('block connect', entry, walletTXs);
24822482

24832483
return {
2484-
txs: walletTxs.length,
2484+
txs: walletTXs.length,
24852485
filterUpdated: filterUpdated
24862486
};
24872487
}

test/node-rescan-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ describe('Node Rescan Interactive API', function() {
290290
const {node} = nodeCtx;
291291
const startHeight = nodeCtx.height - RESCAN_DEPTH + 1;
292292

293-
const filterAndTxs = tests.slice();
294-
let test = filterAndTxs.shift();
293+
const filterAndTXs = tests.slice();
294+
let test = filterAndTXs.shift();
295295

296296
// initial run is the first filter test.
297297
let count = 0;
@@ -304,14 +304,14 @@ describe('Node Rescan Interactive API', function() {
304304
// we are testing against the current filter.
305305
assert(test.txCountCheck(entry.height, txs));
306306

307-
if (filterAndTxs.length === 0) {
307+
if (filterAndTXs.length === 0) {
308308
return {
309309
type: scanActions.ABORT
310310
};
311311
}
312312

313313
// next test
314-
test = filterAndTxs.shift();
314+
test = filterAndTXs.shift();
315315

316316
return {
317317
type: scanActions.REPEAT_SET,
@@ -710,8 +710,8 @@ describe('Node Rescan Interactive API', function() {
710710
it('should rescan the same block with update filters (REPEAT_SET)', async () => {
711711
const startHeight = nodeCtx.height - RESCAN_DEPTH + 1;
712712

713-
const filterAndTxs = tests.slice();
714-
let test = filterAndTxs.shift();
713+
const filterAndTXs = tests.slice();
714+
let test = filterAndTXs.shift();
715715

716716
let count = 0;
717717

@@ -723,13 +723,13 @@ describe('Node Rescan Interactive API', function() {
723723
assert.strictEqual(entry.height, startHeight);
724724
assert(test.txCountCheck(entry.height, txs));
725725

726-
if (filterAndTxs.length === 0) {
726+
if (filterAndTXs.length === 0) {
727727
return {
728728
type: scanActions.ABORT
729729
};
730730
}
731731

732-
test = filterAndTxs.shift();
732+
test = filterAndTXs.shift();
733733

734734
return {
735735
type: scanActions.REPEAT_SET,

test/wallet-chainstate-test.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ describe('WalletDB ChainState', function() {
266266
await progressWithNoTX(wdb);
267267

268268
for (let i = 0; i < blocksPerAction; i++) {
269-
const blockAndTxs = await progressWithNoTX(wdb);
270-
removeBlocks.push(blockAndTxs);
269+
const blockAndTXs = await progressWithNoTX(wdb);
270+
removeBlocks.push(blockAndTXs);
271271
}
272272

273273
assert.strictEqual(wdb.state.startHeight, 0);
@@ -277,11 +277,11 @@ describe('WalletDB ChainState', function() {
277277
assert.strictEqual(wdb.state.marked, false);
278278

279279
for (let i = 0; i < blocksPerAction; i++) {
280-
const blockAndTxs = await progressWithTX(wdb);
281-
removeBlocks.push(blockAndTxs);
280+
const blockAndTXs = await progressWithTX(wdb);
281+
removeBlocks.push(blockAndTXs);
282282

283283
if (!firstBlock)
284-
firstBlock = blockAndTxs.block;
284+
firstBlock = blockAndTXs.block;
285285

286286
assert.strictEqual(wdb.state.startHeight, firstBlock.height);
287287
assert.bufferEqual(wdb.state.startHash, firstBlock.hash);
@@ -389,10 +389,10 @@ describe('WalletDB ChainState', function() {
389389
removeBlocks.push(await progressWithNoTX(wdb));
390390

391391
for (let i = 0; i < blocksPerAction; i++) {
392-
const blockAndTxs = await progressWithTX(wdb);
392+
const blockAndTXs = await progressWithTX(wdb);
393393
if (!firstBlock)
394-
firstBlock = blockAndTxs.block;
395-
removeBlocks.push(blockAndTxs);
394+
firstBlock = blockAndTXs.block;
395+
removeBlocks.push(blockAndTXs);
396396
}
397397

398398
assert.strictEqual(wdb.state.startHeight, firstBlock.height);
@@ -416,10 +416,10 @@ describe('WalletDB ChainState', function() {
416416
firstBlock = null;
417417

418418
for (let i = 0; i < blocksPerAction; i++) {
419-
const blockAndTxs = await progressWithTX(wdb);
419+
const blockAndTXs = await progressWithTX(wdb);
420420

421421
if (!firstBlock)
422-
firstBlock = blockAndTxs.block;
422+
firstBlock = blockAndTXs.block;
423423

424424
assert.strictEqual(wdb.state.startHeight, firstBlock.height);
425425
assert.strictEqual(wdb.state.startHash, firstBlock.hash);
@@ -445,10 +445,10 @@ describe('WalletDB ChainState', function() {
445445
await progressWithNoTX(wdb);
446446

447447
for (let i = 0; i < blocksPerAction * 2; i++) {
448-
const blockAndTxs = await progressWithTX(wdb);
448+
const blockAndTXs = await progressWithTX(wdb);
449449
if (!firstBlock)
450-
firstBlock = blockAndTxs.block;
451-
removeBlocks.push(blockAndTxs);
450+
firstBlock = blockAndTXs.block;
451+
removeBlocks.push(blockAndTXs);
452452
}
453453

454454
assert.strictEqual(wdb.state.startHeight, firstBlock.height);
@@ -487,10 +487,10 @@ describe('WalletDB ChainState', function() {
487487
firstBlock = null;
488488

489489
for (let i = 0; i < blocksPerAction; i++) {
490-
const blockAndTxs = await progressWithTX(wdb);
490+
const blockAndTXs = await progressWithTX(wdb);
491491
if (!firstBlock)
492-
firstBlock = blockAndTxs.block;
493-
removeBlocks.push(blockAndTxs);
492+
firstBlock = blockAndTXs.block;
493+
removeBlocks.push(blockAndTXs);
494494

495495
assert.strictEqual(wdb.state.startHeight, firstBlock.height);
496496
assert.strictEqual(wdb.state.startHash, firstBlock.hash);

test/wallet-http-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ describe('Wallet HTTP', function() {
11901190
const bidValue = 1000000;
11911191
const lockupValue = 5000000;
11921192

1193-
const auctionTxs = await wallet.client.post(
1193+
const auctionTXs = await wallet.client.post(
11941194
`/wallet/${wallet.id}/auction`,
11951195
{
11961196
name: name,
@@ -1204,7 +1204,7 @@ describe('Wallet HTTP', function() {
12041204

12051205
let walletAuction = await wallet.getAuctionByName(name);
12061206
const bidFromWallet = walletAuction.bids.find(
1207-
b => b.prevout.hash === auctionTxs.bid.hash
1207+
b => b.prevout.hash === auctionTXs.bid.hash
12081208
);
12091209
assert(bidFromWallet);
12101210

@@ -1216,15 +1216,15 @@ describe('Wallet HTTP', function() {
12161216
assert.equal(b5.lockedConfirmed - lockConfirmedBeforeTest, lockupValue);
12171217
assert.equal(b5.lockedUnconfirmed - lockUnconfirmedBeforeTest, lockupValue);
12181218

1219-
await nclient.broadcast(auctionTxs.reveal.hex);
1219+
await nclient.broadcast(auctionTXs.reveal.hex);
12201220
await nodeCtx.mineBlocks(1, cbAddress);
12211221

12221222
// Confirmed REVEAL with highest bid makes wallet the owner
12231223
ownedNames.push(name);
12241224

12251225
walletAuction = await wallet.getAuctionByName(name);
12261226
const revealFromWallet = walletAuction.reveals.find(
1227-
b => b.prevout.hash === auctionTxs.reveal.hash
1227+
b => b.prevout.hash === auctionTXs.reveal.hash
12281228
);
12291229
assert(revealFromWallet);
12301230

test/wallet-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,11 +3300,11 @@ describe('Wallet', function() {
33003300
assert.strictEqual(bal.ulocked, lockup);
33013301
assert.strictEqual(bal.clocked, lockup);
33023302

3303-
const auctionsTxs = await wallet.createAuctionTxs(name, value, lockup, {
3303+
const auctionsTXs = await wallet.createAuctionTXs(name, value, lockup, {
33043304
hardFee: fee
33053305
});
3306-
const winningBidUnsent = auctionsTxs.bid;
3307-
unsentReveal = auctionsTxs.reveal;
3306+
const winningBidUnsent = auctionsTXs.bid;
3307+
unsentReveal = auctionsTXs.reveal;
33083308

33093309
const winningBid = await wallet.sendMTX(winningBidUnsent, null);
33103310
uTXCount++;

0 commit comments

Comments
 (0)