Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
update API source
Browse files Browse the repository at this point in the history
Switch from smartbit api to blockchair api for UTXOs due to recent testnet outages at smartbit
  • Loading branch information
coinables committed Nov 19, 2019
1 parent 5d1d5db commit a468209
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bech32/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ <h2>Sweep a Bech32 Private Key</h2>
//create key pair from WIF
var netselect = $("#network").val();
var NETWORKB = netselect === "test" ? b.bitcoin.networks.testnet : b.bitcoin.networks.bitcoin;
var NETWORKAPI = netselect === "test" ? "testnet-api" : "api";
var NETWORKAPI = netselect === "test" ? "testnet/" : "";
//var thiswifinput = "cMqQP9fo8p6JXBhcrT7TYQaHfDadeMdHDUZgWjGJN5jZx39FSnQB";
var thiswifinput = $("#inputwif").val();
var keyPair = b.bitcoin.ECPair.fromWIF(thiswifinput, NETWORKB);
Expand All @@ -346,14 +346,14 @@ <h2>Sweep a Bech32 Private Key</h2>
$.ajax({
async: true,
type: "GET",
url: "https://"+NETWORKAPI+".smartbit.com.au/v1/blockchain/address/"+bech32address+"/unspent",
url: "https://api.blockchair.com/bitcoin/"+NETWORKAPI+"dashboards/address/"+bech32address,
success: function(result) {
console.log(result.unspent.length + " utxos found");
data = result.unspent.map(function(item){
console.log(result.data[bech32address].utxo.length + " utxos found");
data = result.data[bech32address].utxo.map(function(item){
return {
"txid": item.txid,
"vout": item.n,
"satoshis": item.value_int
"txid": item.transaction_hash,
"vout": item.index,
"satoshis": item.value
}
})
//output response into the inputdata element
Expand Down

0 comments on commit a468209

Please sign in to comment.