mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-17 06:14:21 +01:00
Correctly display the currently in use LSP
This commit is contained in:
committed by
Paul Miller
parent
5bcfb550ca
commit
f6d97cfb24
@@ -9,6 +9,7 @@ import {
|
||||
ExternalLink,
|
||||
LargeHeader,
|
||||
LoadingShimmer,
|
||||
MutinyWalletGuard,
|
||||
NavBar,
|
||||
NiceP,
|
||||
showToast,
|
||||
@@ -255,7 +256,19 @@ function SettingsStringsEditor(props: {
|
||||
}
|
||||
|
||||
function AsyncSettingsEditor() {
|
||||
const [settings] = createResource<MutinyWalletSettingStrings>(getSettings);
|
||||
const [_state, _actions, sw] = useMegaStore();
|
||||
|
||||
const [settings] = createResource<MutinyWalletSettingStrings>(async () => {
|
||||
const settings = await getSettings();
|
||||
|
||||
// set the lsp to what the node manager is using
|
||||
const lsp = await sw.get_configured_lsp();
|
||||
settings.lsp = lsp.url;
|
||||
settings.lsps_connection_string = lsp.connection_string;
|
||||
settings.lsps_token = lsp.token;
|
||||
|
||||
return settings;
|
||||
});
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
@@ -272,13 +285,15 @@ function AsyncSettingsEditor() {
|
||||
export function Servers() {
|
||||
const i18n = useI18n();
|
||||
return (
|
||||
<DefaultMain>
|
||||
<BackLink href="/settings" title={i18n.t("settings.header")} />
|
||||
<LargeHeader>{i18n.t("settings.servers.title")}</LargeHeader>
|
||||
<Suspense fallback={<LoadingShimmer />}>
|
||||
<AsyncSettingsEditor />
|
||||
</Suspense>
|
||||
<NavBar activeTab="settings" />
|
||||
</DefaultMain>
|
||||
<MutinyWalletGuard>
|
||||
<DefaultMain>
|
||||
<BackLink href="/settings" title={i18n.t("settings.header")} />
|
||||
<LargeHeader>{i18n.t("settings.servers.title")}</LargeHeader>
|
||||
<Suspense fallback={<LoadingShimmer />}>
|
||||
<AsyncSettingsEditor />
|
||||
</Suspense>
|
||||
<NavBar activeTab="settings" />
|
||||
</DefaultMain>
|
||||
</MutinyWalletGuard>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -612,6 +612,7 @@ export async function estimate_tx_fee(
|
||||
const fee = await wallet!.estimate_tx_fee(address, amount, feeRate);
|
||||
return fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls upon a LNURL to get the parameters for it.
|
||||
* This contains what kind of LNURL it is (pay, withdrawal, auth, etc).
|
||||
@@ -1245,6 +1246,21 @@ export async function change_lsp(
|
||||
await wallet!.change_lsp(lsp_url, lsp_connection_string, lsps_token);
|
||||
}
|
||||
|
||||
type LspConfig = {
|
||||
url?: string;
|
||||
connection_string?: string;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the configured LSP for the node manager.
|
||||
*
|
||||
* @returns {Promise<LspConfig>}
|
||||
*/
|
||||
export async function get_configured_lsp(): Promise<LspConfig> {
|
||||
return await wallet!.get_configured_lsp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets BDK's keychain tracker. This will require a re-sync of the blockchain.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user