add rpc port constants.

This commit is contained in:
Christopher Jeffrey 2016-05-04 16:08:49 -07:00
parent 1b3d2ddaaa
commit a4b1bc5a23
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
5 changed files with 24 additions and 28 deletions

View File

@ -3,11 +3,16 @@
var argv = parseArg(process.argv);
var bcoin = require('../')(argv.network);
var network = bcoin.protocol.network;
var utils = bcoin.utils;
var assert = utils.assert;
var Client = bcoin.http.client;
var client = new Client(argv.url || process.env.BCOIN_URL || 'localhost:8080');
var client = new Client(
argv.url
|| process.env.BCOIN_URL
|| 'localhost:' + network.rpcPort
);
function getID() {
if (argv.id)

View File

@ -1,25 +0,0 @@
#!/bin/bash
_utxo() {
if test "$1" = 'address'; then
curl -s "http://localhost:8080/utxo/address/$2"
else
curl -s "http://localhost:8080/utxo/$1/$2"
fi
}
_tx() {
if test "$1" = 'address'; then
curl -s "http://localhost:8080/tx/address/$2"
else
curl -s "http://localhost:8080/tx/$1"
fi
}
_block() {
curl -s "http://localhost:8080/block/$1"
}
cmd=$1
shift
"_${cmd}" "$@"

View File

@ -107,7 +107,7 @@ Fullnode.prototype._init = function _init() {
node: this,
key: this.options.sslKey,
cert: this.options.sslCert,
port: this.options.httpPort || 8080,
port: this.options.httpPort || network.rpcPort,
host: this.options.httpHost || '0.0.0.0'
});

View File

@ -418,6 +418,14 @@ main.address.versionsByVal = utils.revMap(main.address.versions);
main.requireStandard = true;
/**
* Default http port.
* @const {Number}
* @default
*/
main.rpcPort = 8332;
/*
* Testnet (v3)
* https://en.bitcoin.it/wiki/Testnet
@ -554,6 +562,8 @@ testnet.address.versionsByVal = utils.revMap(testnet.address.versions);
testnet.requireStandard = false;
testnet.rpcPort = 18332;
/*
* Regtest
*/
@ -683,6 +693,8 @@ regtest.address.versionsByVal = utils.revMap(regtest.address.versions);
regtest.requireStandard = false;
regtest.rpcPort = 18332;
/*
* segnet3
*/
@ -795,6 +807,8 @@ segnet3.address.versionsByVal = utils.revMap(segnet3.address.versions);
segnet3.requireStandard = false;
segnet3.rpcPort = 28332;
/*
* segnet4
*/
@ -920,3 +934,5 @@ segnet4.address.prefixesByVal = utils.revMap(segnet4.address.prefixes);
segnet4.address.versionsByVal = utils.revMap(segnet4.address.versions);
segnet4.requireStandard = false;
segnet4.rpcPort = 28902;

View File

@ -74,7 +74,7 @@ SPVNode.prototype._init = function _init() {
node: this,
key: this.options.sslKey,
cert: this.options.sslCert,
port: this.options.httpPort || 8080,
port: this.options.httpPort || network.rpcPort,
host: '0.0.0.0'
});