electrum server select
This commit is contained in:
@@ -849,9 +849,11 @@ window.localisation.en = {
|
|||||||
blockexplorer_public_api: 'Public API Access',
|
blockexplorer_public_api: 'Public API Access',
|
||||||
blockexplorer_public_api_desc:
|
blockexplorer_public_api_desc:
|
||||||
'Allow unauthenticated access to the block explorer API endpoints.',
|
'Allow unauthenticated access to the block explorer API endpoints.',
|
||||||
|
electrum_compatible_server: 'Electrum compatible server',
|
||||||
electrum_server_url: 'Electrum Server URL',
|
electrum_server_url: 'Electrum Server URL',
|
||||||
electrum_server_url_hint:
|
electrum_server_url_hint: 'Choose a public Electrum server or enter your own.',
|
||||||
'e.g. ssl://electrum.blockstream.info:50002 or tcp://localhost:50001',
|
electrum_server_url_custom: 'Custom Electrum Server URL',
|
||||||
|
view_public_electrum_servers: 'View public Electrum servers',
|
||||||
blockexplorer_network: 'Bitcoin Network',
|
blockexplorer_network: 'Bitcoin Network',
|
||||||
blockexplorer_network_hint:
|
blockexplorer_network_hint:
|
||||||
'The network the Electrum server is connected to, used to render addresses correctly.',
|
'The network the Electrum server is connected to, used to render addresses correctly.',
|
||||||
|
|||||||
@@ -1,4 +1,40 @@
|
|||||||
window.app.component('lnbits-admin-blockexplorer', {
|
window.app.component('lnbits-admin-blockexplorer', {
|
||||||
props: ['form-data'],
|
props: ['form-data'],
|
||||||
template: '#lnbits-admin-blockexplorer'
|
template: '#lnbits-admin-blockexplorer',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
electrumServers: [
|
||||||
|
'ssl://fulcrum.lnbits.com:443',
|
||||||
|
'ssl://mainnet.nunchuk.io:52002',
|
||||||
|
'ssl://fulcrum.grey.pw:50002',
|
||||||
|
'ssl://electrum2.bluewallet.io:443',
|
||||||
|
'ssl://electrum.acinq.co:50002',
|
||||||
|
'ssl://electrum.blockstream.info:50002',
|
||||||
|
'ssl://bitcoin.mullvad.net:5010'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
electrumServerOptions() {
|
||||||
|
return [...this.electrumServers, 'Custom']
|
||||||
|
},
|
||||||
|
electrumServerPreset: {
|
||||||
|
get() {
|
||||||
|
return this.electrumServers.includes(
|
||||||
|
this.formData.lnbits_blockexplorer_electrum_url
|
||||||
|
)
|
||||||
|
? this.formData.lnbits_blockexplorer_electrum_url
|
||||||
|
: 'Custom'
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
if (value === 'Custom') {
|
||||||
|
if (this.electrumServerPreset !== 'Custom') {
|
||||||
|
this.formData.lnbits_blockexplorer_electrum_url = ''
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.formData.lnbits_blockexplorer_electrum_url = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -46,12 +46,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-separator class="q-mb-lg q-mt-sm"></q-separator>
|
<q-separator class="q-mb-lg q-mt-sm"></q-separator>
|
||||||
|
<h6 class="q-my-none q-mb-sm">
|
||||||
|
<span v-text="$t('electrum_compatible_server')"></span>
|
||||||
|
</h6>
|
||||||
<div class="row q-col-gutter-md">
|
<div class="row q-col-gutter-md">
|
||||||
<div class="col-12 col-md-8">
|
<div class="col-12 col-md-4">
|
||||||
|
<q-select
|
||||||
|
filled
|
||||||
|
v-model="electrumServerPreset"
|
||||||
|
:options="electrumServerOptions"
|
||||||
|
:label="$t('electrum_server_url')"
|
||||||
|
:hint="$t('electrum_server_url_hint')"
|
||||||
|
></q-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-4" v-if="electrumServerPreset === 'Custom'">
|
||||||
<q-input
|
<q-input
|
||||||
filled
|
filled
|
||||||
v-model="formData.lnbits_blockexplorer_electrum_url"
|
v-model="formData.lnbits_blockexplorer_electrum_url"
|
||||||
:label="$t('electrum_server_url')"
|
:label="$t('electrum_server_url_custom')"
|
||||||
:hint="$t('electrum_server_url_hint')"
|
:hint="$t('electrum_server_url_hint')"
|
||||||
></q-input>
|
></q-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -64,6 +76,15 @@
|
|||||||
:hint="$t('blockexplorer_network_hint')"
|
:hint="$t('blockexplorer_network_hint')"
|
||||||
></q-select>
|
></q-select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<a
|
||||||
|
href="https://1209k.com/bitcoin-eye/ele.php?chain=btc"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
<span v-text="$t('view_public_electrum_servers')"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -763,7 +763,18 @@ class AddressTracker:
|
|||||||
for scripthash, address in list(subscribed.items()):
|
for scripthash, address in list(subscribed.items()):
|
||||||
if address not in still_wanted:
|
if address not in still_wanted:
|
||||||
del subscribed[scripthash]
|
del subscribed[scripthash]
|
||||||
await client.unsubscribe_scripthash(scripthash)
|
try:
|
||||||
|
await client.unsubscribe_scripthash(scripthash)
|
||||||
|
except ElectrumError:
|
||||||
|
# blockchain.scripthash.unsubscribe is part of the spec but
|
||||||
|
# many ElectrumX deployments don't implement it, returning
|
||||||
|
# "unknown method". This is expected and harmless: we've
|
||||||
|
# already dropped the scripthash from `subscribed` above,
|
||||||
|
# so if the server keeps pushing notifications for it
|
||||||
|
# anyway, on_status_change() looks it up, finds nothing,
|
||||||
|
# and drops them. Not logged since it fires on every
|
||||||
|
# untrack against these servers.
|
||||||
|
pass
|
||||||
|
|
||||||
async def _wait_for_change_or_close(self, client: ElectrumClient) -> bool:
|
async def _wait_for_change_or_close(self, client: ElectrumClient) -> bool:
|
||||||
"""Waits until addresses change or the connection closes; returns True
|
"""Waits until addresses change or the connection closes; returns True
|
||||||
|
|||||||
Reference in New Issue
Block a user