Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (network == null) {
network = API.default.network;
}
var token = this.server.config.CP.API.tokens.cryptoapis;
if ((network == "main") || (network == "livenet")) {
network = "mainnet";
}
if ((network == "test") || (network == "test3")) {
network = "testnet";
}
switch (network) {
case "mainnet":
var addressCash = new bitcoreCash.Address(address, bitcoreCash.livenet);
break;
case "testnet":
var addressCash = new bitcoreCash.Address(address, bitcoreCash.testnet);
break;
default:
throw (new Error("Unrecognized network \""+network+"\""));
break;
}
addressCash = addressCash.toString();
var addressCashShort = addressCash.split(":")[1];
url = url.split("%network%").join(network).split("%address%").join(addressCashShort);
this.server.request({
url: url,
method: "GET",
json: true,
headers: {
"Content-Type": "application/json",
"X-API-Key": token
}
var url = API.urls.bitcoincom.gettxs;
if (network == null) {
network = API.default.network;
}
if ((network == "main") || (network == "mainnet") || (network == "livenet") || (network == "rest")) {
network = "mainnet";
}
if ((network == "test") || (network == "test3") || (network == "testnet") || (network == "trest")) {
network = "testnet";
}
switch (network) {
case "mainnet":
var addressCash = new bitcoreCash.Address(address, bitcoreCash.livenet);
break;
case "testnet":
var addressCash = new bitcoreCash.Address(address, bitcoreCash.testnet);
break;
default:
throw (new Error("Unrecognized network \""+network+"\""));
break;
}
addressCash = addressCash.toString();
if ((network == "main") || (network == "mainnet") || (network == "livenet")) {
network = "rest";
}
if ((network == "test") || (network == "test3") || (network == "testnet")) {
network = "trest";
}
url = url.split("%network%").join(network).split("%address%").join(addressCash);
this.server.request({
url: url,
method: "GET",