Skip to content

Commit

Permalink
add resync ln address to kitchen sink
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Jun 6, 2024
1 parent 0da0dce commit e17feab
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
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();

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

0 comments on commit e17feab

Please sign in to comment.