Workflow updating files of btcwallet
This commit is contained in:
parent
021c9ae458
commit
4de88bc069
@ -1279,7 +1279,6 @@
|
|||||||
}
|
}
|
||||||
txDetailsAbortController = new AbortController();
|
txDetailsAbortController = new AbortController();
|
||||||
btcOperator.getTx(txid).then(result => {
|
btcOperator.getTx(txid).then(result => {
|
||||||
console.log(result)
|
|
||||||
const { block, time, size, fee, inputs, outputs, confirmations = 0, total_input_value, total_output_value } = result;
|
const { block, time, size, fee, inputs, outputs, confirmations = 0, total_input_value, total_output_value } = result;
|
||||||
const isUnconfirmed = block < 0 || block === null || block === undefined
|
const isUnconfirmed = block < 0 || block === null || block === undefined
|
||||||
renderElem(getRef('tx_details'), html`
|
renderElem(getRef('tx_details'), html`
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
cors: 'no-cors',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
@ -196,6 +197,43 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: 'https://coinb.in/api/?uid=1&key=12345678901234567890123456789012&setmodule=bitcoin&request=sendrawtransaction',
|
||||||
|
name: 'Coinb.in',
|
||||||
|
broadcast({ rawTxHex }) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fetch(this.url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
},
|
||||||
|
body: "rawtx=" + rawTxHex
|
||||||
|
}).then(response => {
|
||||||
|
console.log(response)
|
||||||
|
response.text().then(resultText => {
|
||||||
|
let r = resultText.match(/<result>.*<\/result>/);
|
||||||
|
if (!r)
|
||||||
|
reject(resultText);
|
||||||
|
else {
|
||||||
|
r = r.pop().replace('<result>', '').replace('</result>', '');
|
||||||
|
if (r == '1') {
|
||||||
|
let txid = resultText.match(/<txid>.*<\/txid>/).pop().replace('<txid>', '').replace('</txid>', '');
|
||||||
|
resolve(txid);
|
||||||
|
} else if (r == '0') {
|
||||||
|
let error
|
||||||
|
if (resultText.includes('<message>')) {
|
||||||
|
error = resultText.match(/<message>.*<\/message>/).pop().replace('<message>', '').replace('</message>', '');
|
||||||
|
} else {
|
||||||
|
error = resultText.match(/<response>.*<\/response>/).pop().replace('<response>', '').replace('</response>', '');
|
||||||
|
}
|
||||||
|
reject(decodeURIComponent(error.replace(/\+/g, " ")));
|
||||||
|
} else reject(resultText);
|
||||||
|
}
|
||||||
|
}).catch(error => reject(error))
|
||||||
|
}).catch(error => reject(error))
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
2
btcwallet/scripts/btcOperator.min.js
vendored
2
btcwallet/scripts/btcOperator.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user