diff --git a/lib/wallet/http.js b/lib/wallet/http.js index 6f60391e..c0f68fcb 100644 --- a/lib/wallet/http.js +++ b/lib/wallet/http.js @@ -636,7 +636,7 @@ HTTPServer.prototype.initRouter = function initRouter() { // Locked coins this.get('/:id/locked', async (req, res) => { - const locked = this.wallet.getLocked(); + const locked = await req.wallet.getLocked(); const result = []; for (const outpoint of locked) @@ -655,8 +655,8 @@ HTTPServer.prototype.initRouter = function initRouter() { enforce(index != null, 'Index is required.'); const outpoint = new Outpoint(hash, index); - - this.wallet.lockCoin(outpoint); + await req.wallet.lockCoin(outpoint); + res.send(200, { success: true }); }); // Unlock coin @@ -670,7 +670,8 @@ HTTPServer.prototype.initRouter = function initRouter() { const outpoint = new Outpoint(hash, index); - this.wallet.unlockCoin(outpoint); + await req.wallet.unlockCoin(outpoint); + res.send(200, { success: true }); }); // Wallet Coin