Skip to content

Commit

Permalink
http: use Address instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxcanfly committed Aug 24, 2018
1 parent 0e799eb commit 175ff79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/node/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const sha256 = require('bcrypto/lib/sha256');
const random = require('bcrypto/lib/random');
const ccmp = require('bcrypto/lib/ccmp');
const util = require('../utils/util');
const Address = require('../primitives/address');
const TX = require('../primitives/tx');
const Outpoint = require('../primitives/outpoint');
const Network = require('../protocol/network');
Expand Down Expand Up @@ -156,7 +157,8 @@ class HTTP extends Server {
enforce(address, 'Address is required.');
enforce(!this.chain.options.spv, 'Cannot get coins in SPV mode.');

const coins = await this.node.getCoinsByAddress(address);
const addr = Address.fromString(address, this.network);
const coins = await this.node.getCoinsByAddress(addr);
const result = [];

for (const coin of coins)
Expand Down Expand Up @@ -230,7 +232,8 @@ class HTTP extends Server {
enforce(address, 'Address is required.');
enforce(!this.chain.options.spv, 'Cannot get TX in SPV mode.');

const metas = await this.node.getMetaByAddress(address);
const addr = Address.fromString(address, this.network);
const metas = await this.node.getMetaByAddress(addr);
const result = [];

for (const meta of metas) {
Expand Down

0 comments on commit 175ff79

Please sign in to comment.