Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

add resync ln address to kitchen sink #1194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion public/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,9 @@
},
"resync": {
"incorrect_balance": "On-chain balance seems incorrect? Try re-syncing the on-chain wallet.",
"resync_wallet": "Resync wallet"
"resync_wallet": "Resync on-chain",
"resync_ln": "Resync address",
"lightning_address": "Missing payments to your lightning address? Try resyncing. This could take a while, so be patient!"
},
"on_boot": {
"existing_tab": {
Expand Down
3 changes: 3 additions & 0 deletions src/components/KitchenSink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
InnerCard,
MiniStringShower,
Restart,
ResyncLnAddress,
ResyncOnchain,
showToast,
SimpleErrorDisplay,
Expand Down Expand Up @@ -570,6 +571,8 @@ export function KitchenSink() {
<Hr />
<ResyncOnchain />
<Hr />
<ResyncLnAddress />
<Hr />
<Restart />
<Hr />
</>
Expand Down
32 changes: 32 additions & 0 deletions src/components/ResyncLnAddress.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { createSignal } from "solid-js";

import { Button, InnerCard, NiceP, VStack } from "~/components";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";

export function ResyncLnAddress() {
const i18n = useI18n();
const [_state, _actions, sw] = useMegaStore();
const [loading, setLoading] = createSignal(false);

async function resync() {
try {
setLoading(true);
await sw.resync_lightning_address();
} catch (e) {
console.error(e);
}
setLoading(false);
}

return (
<InnerCard>
<VStack>
<NiceP>{i18n.t("error.resync.lightning_address")}</NiceP>
<Button intent="red" onClick={resync} loading={loading()}>
{i18n.t("error.resync.resync_ln")}
</Button>
</VStack>
</InnerCard>
);
}
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ export * from "./ImportNsecForm";
export * from "./LightningAddressShower";
export * from "./FederationInviteShower";
export * from "./FederationPopup";
export * from "./ResyncLnAddress";
4 changes: 4 additions & 0 deletions src/workers/walletWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,10 @@ export async function estimate_sweep_federation_fee(
return await wallet!.estimate_sweep_federation_fee(amount);
}

export async function resync_lightning_address(): Promise<void> {
await wallet!.resync_lightning_address();
}

export async function parse_params(params: string): Promise<PaymentParams> {
const paramsResult = await new PaymentParams(params);
// PAIN just another object rebuild
Expand Down