This commit is contained in:
sairaj mote 2023-02-18 01:06:03 +05:30
parent e92c813a23
commit 07a3384eba

View File

@ -1375,8 +1375,6 @@
}); });
function retrieveBtcAddr() { function retrieveBtcAddr() {
let wif = getRef('retrieve_btc_addr_field').value.trim(); let wif = getRef('retrieve_btc_addr_field').value.trim();
// addressForm['legacy'].value = btcOperator.address(wif);
// addressForm['segwit'].value = btcOperator.segwitAddress(wif);
getRef('recovered_btc_addr_wrapper').classList.remove('hidden') getRef('recovered_btc_addr_wrapper').classList.remove('hidden')
getRef('recovered_btc_addr').value = btcOperator.bech32Address(wif); getRef('recovered_btc_addr').value = btcOperator.bech32Address(wif);
} }
@ -1553,14 +1551,20 @@
} }
function calculateApproxFee() { function calculateApproxFee() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('https://bitcoiner.live/api/fees/estimates/latest').then(res => res.json()).then(data => { fetch('https://bitcoiner.live/api/fees/estimates/latest')
const satPerByte = data.estimates['60'].sat_per_vbyte; .then(res => {
const legacyBytes = 200; res.json()
const segwitBytes = 77; .then(data => {
resolve((legacyBytes * satPerByte + (0.25 * satPerByte) * segwitBytes) / Math.pow(10, 8)); const satPerByte = data.estimates['60'].sat_per_vbyte;
}).catch(e => { const legacyBytes = 200;
reject(e) const segwitBytes = 77;
}) resolve((legacyBytes * satPerByte + (0.25 * satPerByte) * segwitBytes) / Math.pow(10, 8));
}).catch(e => {
reject(e)
})
}).catch(e => {
reject(e)
})
}) })
} }
function calculateExactFee() { function calculateExactFee() {