Running insight to getUnspentUtxos for a testnet address shows the following error:
throw new TypeError('Address has mismatched network type.'); ^TypeError: Address has mismatched network type.
Code:
var Insight = require('bitcore-explorers').Insight; var insight = new Insight('testnet'); return insight.getUnspentUtxos(address, function (err, utxos) { if (err) { console.err(err) } console.log(utxos); });
Code for testnet address:
let privateKey = new bitcore.PrivateKey(), hexa = privateKey.toString(), publicKey = new bitcore.PublicKey(privateKey); address = new bitcore.Address(publicKey, Networks.testnet);
Running insight to getUnspentUtxos for a testnet address shows the following error:
throw new TypeError('Address has mismatched network type.'); ^TypeError: Address has mismatched network type.
Code:
var Insight = require('bitcore-explorers').Insight; var insight = new Insight('testnet'); return insight.getUnspentUtxos(address, function (err, utxos) { if (err) { console.err(err) } console.log(utxos); });
Code for testnet address:
let privateKey = new bitcore.PrivateKey(), hexa = privateKey.toString(), publicKey = new bitcore.PublicKey(privateKey); address = new bitcore.Address(publicKey, Networks.testnet);