Skip to content

Commit

Permalink
set lsps settings via url query params
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul authored and benthecarman committed Apr 5, 2024
1 parent 996656d commit 4de5771
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions src/components/HomePrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { useSearchParams } from "@solidjs/router";
import { createEffect, createSignal, Show } from "solid-js";
import { createEffect, createSignal, onMount, Show } from "solid-js";

import { Button, InfoBox, NiceP, SimpleDialog, VStack } from "~/components";
import {
Button,
InfoBox,
NiceP,
showToast,
SimpleDialog,
VStack
} from "~/components";
import { useI18n } from "~/i18n/context";
import { setSettings } from "~/logic/mutinyWalletSetup";
import { useMegaStore } from "~/state/megaStore";
import { bech32, bech32WordsToUrl, eify } from "~/utils";

Expand Down Expand Up @@ -51,6 +59,35 @@ export function HomePrompt() {
}
});

// LSPS stuff
onMount(async () => {
if (params.lsps) {
const values = {
lsp: "",
lsps_connection_string: params.lsps,
lsps_token: params.token
};
try {
await state.mutiny_wallet?.change_lsp(
values.lsp ? values.lsp : undefined,
values.lsps_connection_string
? values.lsps_connection_string
: undefined,
values.lsps_token ? values.lsps_token : undefined
);
await setSettings(values);
setParams({ lsps: undefined, token: undefined });
showToast({
title: "Success",
description: "LSPS settings changed"
});
} catch (e) {
console.error("Error changing lsp:", e);
showToast(eify(e));
}
}
});

// Lnurl Auth stuff
const [lnurlauthResult, setLnurlauthResult] = createSignal<string>();
const [authLoading, setAuthLoading] = createSignal<boolean>(false);
Expand Down

0 comments on commit 4de5771

Please sign in to comment.