Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 @@
return await wallet!.estimate_sweep_federation_fee(amount);
}

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

Check failure on line 1564 in src/workers/walletWorker.ts

View workflow job for this annotation

GitHub Actions / code_quality

Property 'resync_lightning_address' does not exist on type 'MutinyWallet'.

Check failure on line 1564 in src/workers/walletWorker.ts

View workflow job for this annotation

GitHub Actions / Build iOS

Property 'resync_lightning_address' does not exist on type 'MutinyWallet'.

Check failure on line 1564 in src/workers/walletWorker.ts

View workflow job for this annotation

GitHub Actions / Build APK

Property 'resync_lightning_address' does not exist on type 'MutinyWallet'.
}

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