Skip to content

Commit

Permalink
Merge PR #818 from 'nodech/fix-wallet-http-revealall'
Browse files Browse the repository at this point in the history
  • Loading branch information
nodech committed May 31, 2023
2 parents 5387e3a + bd3ea9f commit 5bed384
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/wallet/http.js
Expand Up @@ -1152,12 +1152,13 @@ class HTTP extends Server {
options
);

if (broadcastBid)
auctionTxs.bid = await req.wallet.sendMTX(auctionTxs.bid, passphrase);

if (sign) {
if (broadcastBid) {
auctionTxs.bid = await req.wallet.sendMTX(auctionTxs.bid, passphrase);
} else {
if (!broadcastBid)
await req.wallet.sign(auctionTxs.bid, passphrase);
}

await req.wallet.sign(auctionTxs.reveal, passphrase);
}

Expand Down Expand Up @@ -1185,14 +1186,16 @@ class HTTP extends Server {

enforce(broadcast ? sign : true, 'Must sign when broadcasting.');

const options = TransactionOptions.fromValidator(valid);

let mtx;

if (!name) {
const tx = await req.wallet.sendRevealAll();
return res.json(200, tx.getJSON(this.network));
mtx = await req.wallet.createRevealAll(options);
} else {
mtx = await req.wallet.createReveal(name, options);
}

const options = TransactionOptions.fromValidator(valid);
const mtx = await req.wallet.createReveal(name, options);

if (broadcast) {
const tx = await req.wallet.sendMTX(mtx, passphrase);
return res.json(200, tx.getJSON(this.network));
Expand Down

0 comments on commit 5bed384

Please sign in to comment.