btcOperator v1.0.10a: broadcastTx resolves txid
- When broadcast is successful, txid is resolved - sendTx also resolves txid due to the above change
This commit is contained in:
parent
084ffe10e2
commit
7d84ded426
@ -1,4 +1,4 @@
|
|||||||
(function(EXPORTS) { //btcOperator v1.0.10
|
(function(EXPORTS) { //btcOperator v1.0.10a
|
||||||
/* BTC Crypto and API Operator */
|
/* BTC Crypto and API Operator */
|
||||||
const btcOperator = EXPORTS;
|
const btcOperator = EXPORTS;
|
||||||
|
|
||||||
@ -31,16 +31,16 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const broadcast = btcOperator.broadcast = rawtx => new Promise((resolve, reject) => {
|
const broadcastTx = btcOperator.broadcastTx = rawTxHex => new Promise((resolve, reject) => {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: URL + "send_tx/BTC/",
|
url: URL + "send_tx/BTC/",
|
||||||
data: {
|
data: {
|
||||||
"tx_hex": rawtx
|
"tx_hex": rawTxHex
|
||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
error: e => reject(e.responseJSON),
|
error: e => reject(e.responseJSON),
|
||||||
success: r => r.status === "success" ? resolve(r.data) : reject(r)
|
success: r => r.status === "success" ? resolve(r.data.txid) : reject(r)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -485,8 +485,8 @@
|
|||||||
new Set(wif_keys).forEach(key => console.debug("Signing key:", key, tx.sign(key, 1 /*sighashtype*/ ))); //Sign the tx using private key WIF
|
new Set(wif_keys).forEach(key => console.debug("Signing key:", key, tx.sign(key, 1 /*sighashtype*/ ))); //Sign the tx using private key WIF
|
||||||
console.debug("Signed:", tx.serialize());
|
console.debug("Signed:", tx.serialize());
|
||||||
debugger;
|
debugger;
|
||||||
broadcast(tx.serialize())
|
broadcastTx(tx.serialize())
|
||||||
.then(result => resolve(result))
|
.then(txid => resolve(txid))
|
||||||
.catch(error => reject(error));
|
.catch(error => reject(error));
|
||||||
}).catch(error => reject(error));
|
}).catch(error => reject(error));
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user