mirror of
https://github.com/OutCast3k/coinbin.git
synced 2026-01-03 23:07:59 +01:00
commit
b4df0693cd
@ -1300,9 +1300,10 @@
|
||||
<label for="sighashType">Sig Hash Type</label>
|
||||
|
||||
<select id="sighashType" class="form-control">
|
||||
<option value="1" rel="SIGHASH_ALL: Signs all the inputs and outputs, protecting everything against modification.">ALL (default)</option>
|
||||
<option value="1" rel="SIGHASH_ALL: Signs all the inputs and outputs, protecting everything against modification.">ALL</option>
|
||||
<option value="2" rel="SIGHASH_NONE: Signs all of the inputs but none of the outputs, allowing anyone to change where the satoshis are going unless other signatures using other signature hash flags protect the outputs.">NONE</option>
|
||||
<option value="3" rel="SIGHASH_SINGLE: The only output signed is the one corresponding to this input, ensuring nobody can change your part of the transaction but allowing other signers to change their part of the transaction.">SINGLE</option>
|
||||
<option value="65" rel="SIGHASH_ALL|SIGHASH_FORKID: Signs all the inputs and outputs, protecting everything against modification." selected>ALL|FORKID (default)</option>
|
||||
<option value="129" rel="SIGHASH_ALL|SIGHASH_ANYONECANPAY: Signs all of the outputs but only this one input, it allows anyone to add or remove other inputs, so anyone can contribute additional satoshis but they cannot change how many satoshis are sent nor where they go.">ALL|ANYONECANPAY</option>
|
||||
<option value="130" rel="SIGHASH_NONE|SIGHASH_ANYONECANPAY: Signs only this one input and allows anyone to add or remove other inputs or outputs, so anyone who gets a copy of this input can spend it however they'd like.">NONE|ANYONECANPAY</option>
|
||||
<option value="131" rel="SIGHASH_SINGLE|SIGHASH_ANYONECANPAY: Signs this one input and its corresponding output. Allows anyone to add or remove other inputs.">SINGLE|ANYONECANPAY</option>
|
||||
|
||||
14
js/coin.js
14
js/coin.js
@ -22,10 +22,8 @@
|
||||
coinjs.developer = '33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G'; // Bitcoin
|
||||
|
||||
/* bit(coinb.in) api vars */
|
||||
coinjs.hostname = ((document.location.hostname.split(".")[(document.location.hostname.split(".")).length-1]) == 'onion') ? 'coinbin3ravkwb24f7rmxx6w3snkjw45jhs5lxbh3yfeg3vpt6janwqd.onion' : 'coinb.in';
|
||||
coinjs.host = ('https:'==document.location.protocol?'https://':'http://')+coinjs.hostname+'/api/';
|
||||
coinjs.uid = '1';
|
||||
coinjs.key = '12345678901234567890123456789012';
|
||||
coinjs.hostname = ((document.location.hostname.split(".")[(document.location.hostname.split(".")).length-1]) == 'onion') ? 'coinbin3ravkwb24f7rmxx6w3snkjw45jhs5lxbh3yfeg3vpt6janwqd.onion' : 'api.avn.network';
|
||||
coinjs.host = ('https:'==document.location.protocol?'https://':'https://')+coinjs.hostname;
|
||||
|
||||
/* start of address functions */
|
||||
|
||||
@ -321,7 +319,7 @@
|
||||
|
||||
/* retreive the balance from a given address */
|
||||
coinjs.addressBalance = function(address, callback){
|
||||
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=addresses&request=bal&address='+address+'&r='+Math.random(), callback, "GET");
|
||||
coinjs.ajax(coinjs.host+'/balance/='+address, callback, "GET");
|
||||
}
|
||||
|
||||
/* decompress an compressed public key */
|
||||
@ -1064,12 +1062,12 @@
|
||||
|
||||
/* list unspent transactions */
|
||||
r.listUnspent = function(address, callback) {
|
||||
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=addresses&request=unspent&address='+address+'&r='+Math.random(), callback, "GET");
|
||||
coinjs.ajax(coinjs.host+'/unspent/'+address+'?amount=1', callback, "GET");
|
||||
}
|
||||
|
||||
/* list transaction data */
|
||||
r.getTransaction = function(txid, callback) {
|
||||
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=avian&request=gettransaction&txid='+txid+'&r='+Math.random(), callback, "GET");
|
||||
coinjs.ajax(coinjs.host+'/transaction/'+txid, callback, "GET");
|
||||
}
|
||||
|
||||
/* add unspent to transaction */
|
||||
@ -1140,7 +1138,7 @@
|
||||
/* broadcast a transaction */
|
||||
r.broadcast = function(callback, txhex){
|
||||
var tx = txhex || this.serialize();
|
||||
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=avian&request=sendrawtransaction', callback, "POST", ["rawtx="+tx]);
|
||||
coinjs.ajax(coinjs.host+'/broadcast/', callback, "POST", ["raw="+tx]);
|
||||
}
|
||||
|
||||
/* generate the transaction hash to sign from a transaction input */
|
||||
|
||||
@ -4,7 +4,7 @@ $(document).ready(function() {
|
||||
|
||||
var explorer_tx = "https://explorer.avn.network/tx/"
|
||||
var explorer_addr = "https://explorer.avn.network/addr/"
|
||||
var explorer_block = "https:/explorer.avn.network/block/"
|
||||
var explorer_block = "https://explorer.avn.network/block/"
|
||||
|
||||
var wallet_timer = false;
|
||||
|
||||
@ -1083,9 +1083,10 @@ $(document).ready(function() {
|
||||
if(redeem.addr) {
|
||||
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
|
||||
$.each($(data).find("unspent").children(), function(i,o){
|
||||
var tx = $(o).find("tx_hash").text();
|
||||
var n = $(o).find("tx_output_n").text();
|
||||
let results = JSON.parse(data);
|
||||
$.each($(data.result).find().children(), function(i,o){
|
||||
var tx = $(o).find("txid").text();
|
||||
var n = $(o).find("index").text();
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : $(o).find("script").text();
|
||||
var amount = (($(o).find("value").text()*1)/100000000).toFixed(8);
|
||||
|
||||
@ -1112,9 +1113,16 @@ $(document).ready(function() {
|
||||
success: function(data) {
|
||||
if(data.result && data.error == null){
|
||||
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
data.result.forEach(i => {
|
||||
addOutput(i.txid, i.index+1, i.script, (i.value/100000000));
|
||||
});
|
||||
for(var i in data.result){
|
||||
var o = data.result[i];
|
||||
var tx = ((""+o.txid).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
if(tx.match(/^[a-f0-9]+$/)){
|
||||
var n = o.index;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script;
|
||||
var amount = o.value;
|
||||
addOutput(tx, n, script, amount);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs.');
|
||||
}
|
||||
@ -1168,6 +1176,7 @@ $(document).ready(function() {
|
||||
function totalFee(){
|
||||
var fee = (($("#totalInput").html()*1) - ($("#totalOutput").html()*1)).toFixed(8);
|
||||
$("#transactionFee").val((fee>0)?fee:'0.00');
|
||||
$("#transactionFee").val('0.001');
|
||||
}
|
||||
|
||||
$(".optionsCollapse").click(function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user