diff --git a/src/routes/settings/Servers.tsx b/src/routes/settings/Servers.tsx index 9600d9f..75b3d4d 100644 --- a/src/routes/settings/Servers.tsx +++ b/src/routes/settings/Servers.tsx @@ -9,6 +9,7 @@ import { ExternalLink, LargeHeader, LoadingShimmer, + MutinyWalletGuard, NavBar, NiceP, showToast, @@ -255,7 +256,19 @@ function SettingsStringsEditor(props: { } function AsyncSettingsEditor() { - const [settings] = createResource(getSettings); + const [_state, _actions, sw] = useMegaStore(); + + const [settings] = createResource(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 ( @@ -272,13 +285,15 @@ function AsyncSettingsEditor() { export function Servers() { const i18n = useI18n(); return ( - - - {i18n.t("settings.servers.title")} - }> - - - - + + + + {i18n.t("settings.servers.title")} + }> + + + + + ); } diff --git a/src/workers/walletWorker.ts b/src/workers/walletWorker.ts index 6ee55ee..338b510 100644 --- a/src/workers/walletWorker.ts +++ b/src/workers/walletWorker.ts @@ -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} + */ +export async function get_configured_lsp(): Promise { + return await wallet!.get_configured_lsp(); +} + /** * Resets BDK's keychain tracker. This will require a re-sync of the blockchain. *