mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
listener for blocks and 6 confirmations
This commit is contained in:
parent
3cb084cdd1
commit
c4c5a1945d
1 changed files with 2 additions and 58 deletions
60
index.html
60
index.html
|
@ -461,64 +461,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
function existsTransactionInBlock(blockhash, txid) {
|
|
||||||
|
|
||||||
$.getJSON(apiserversocket + 'insight-api-dash/txs/?block=' + blockhash, function(data) {
|
|
||||||
var txs = data.txs;
|
|
||||||
var found;
|
|
||||||
var numOfTxs = txs.length;
|
|
||||||
for (var i = 0; i < numOfTxs; i++) {
|
|
||||||
console.log('txs' + i + ': ' + txs[i].txid);
|
|
||||||
if (txs[i].txid === txid) {
|
|
||||||
console.log('found tx!');
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
console.log('all good. ');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('txid not in new block');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}).fail(function(jqXHR) {
|
|
||||||
if (jqXHR.status == 400) {
|
|
||||||
// there seems to be a problem with your feeTxid because txid is not found in api
|
|
||||||
console.log('block hash not found in api!');
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
console.log('There seems to be a problem with the api connection. Maybe endpoint resyncing?');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getConfirmationsForTxid(txid) {
|
|
||||||
|
|
||||||
var jqxhr = $.ajax({
|
|
||||||
url: apiserversocket + 'insight-api-dash/tx/' + txid,
|
|
||||||
async: 'false'
|
|
||||||
}).done(function() {
|
|
||||||
alert( "success" );
|
|
||||||
})
|
|
||||||
.fail(function(jqXHR) {
|
|
||||||
if (jqXHR.status == 400) {
|
|
||||||
// there seems to be a problem with your feeTxid because txid is not found in api
|
|
||||||
console.log('block hash not found in api!');
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
console.log('There seems to be a problem with the api connection. Maybe endpoint resyncing?');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue