diff --git a/index.html b/index.html
index 84ab5fa..8d90d3b 100644
--- a/index.html
+++ b/index.html
@@ -238,18 +238,28 @@
-
-
-
-
+
+
+
+
+
+
+
@@ -1381,20 +1391,31 @@
getRef('btc_private').value = btc_wif;
getRef('priv_key_bech32').value = btc_api.bech32Address(btc_wif);
}
- getRef('convert_flo_btc').onclick = evt => {
- const flo_addr = getRef('convert_flo_input').value.trim();
+ getRef('convert_to_flo').onclick = evt => {
const btc_bech = getRef('convert_btc_input').value.trim();
- if (btc_bech === '' && flo_addr === '') {
- notify('Please enter either FLO or BTC address', 'error');
- return;
+ if (btc_bech === '') {
+ getRef('convert_btc_input').focusIn()
+ return notify('Please enter BTC address', 'error');
}
- console.log(flo_addr, btc_bech)
- if (flo_addr !== '') {
- getRef('convert_btc_input').value = btc_api.convert.legacy2bech(flo_addr);
- } else {
+ const type = coinjs.addressDecode(btc_bech).type
+ const isLegacy = /\w{34,35}$/.test(btc_bech)
+ if (type === 'standard') {
+ getRef('convert_flo_input').value = btc_api.convert.legacy2legacy(btc_bech, 0x23);
+ } else if (type === 'bech32') {
getRef('convert_flo_input').value = btc_api.convert.bech2legacy(btc_bech, 0x23);
+ } else {
+ getRef('convert_flo_input').value = '';
+ notify(`Multisig address can't be converted to FLO`, 'error');
}
}
+ getRef('convert_to_btc').onclick = evt => {
+ const flo_addr = getRef('convert_flo_input').value.trim();
+ if (flo_addr === '') {
+ getRef('convert_flo_input').focusIn();
+ return notify('Please enter FLO address', 'error');
+ }
+ getRef('convert_btc_input').value = btc_api.convert.legacy2bech(flo_addr);
+ }
const txParticipantsObserver = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.type === 'childList') {