Skip to content

Commit

Permalink
fix: translations for all alerts of bump fee
Browse files Browse the repository at this point in the history
Signed-off-by: Nitesh Balusu <[email protected]>
  • Loading branch information
niteshbalusu11 committed Dec 16, 2023
1 parent c4a0d6a commit 9c11d8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,14 @@
"forceCloseDelay": "Force closure delay",
"closeChannelPrompt": {
"title": "Close channel"
},
"bumpFeeAlerts": {
"enterFeeRate": "Enter fee rate (sats/vB)",
"missingChannelPoint": "Missing channel point in pending transaction",
"missingFeeRate": "Missing Fee Rate",
"invalidFeeRate": "Invalid Fee Rate",
"bumpFeeSuccess": "Fee Bumping Successful",
"bumpFeeFailed": "Fee Bumping Failed"
}
}
},
Expand Down
12 changes: 6 additions & 6 deletions src/components/PendingChannelCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ export const PendingChannelCard = ({ channel, type, alias }: IPendingChannelCard
| lnrpc.PendingChannelsResponse.IWaitingCloseChannel,
) => {
if (!channel.channel || !channel.channel.channelPoint) {
Alert.alert("Missing channel point in pending transaction");
Alert.alert(t("channel.bumpFeeAlerts.missingChannelPoint"));
return;
}

const [txid, index] = channel.channel?.channelPoint?.split(":");

Alert.prompt("Bump Fee", "Enter fee rate (sats/vB)", [
Alert.prompt(t("channel.bumpFee"), t("channel.bumpFeeAlerts.enterFeeRate"), [
{
text: t("buttons.cancel", { ns: namespaces.common }),
style: "cancel",
Expand All @@ -119,15 +119,15 @@ export const PendingChannelCard = ({ channel, type, alias }: IPendingChannelCard
text: "OK",
onPress: async (feeRate) => {
if (!feeRate) {
Alert.alert("Missing Fee Rate");
Alert.alert(t("channel.bumpFeeAlerts.missingFeeRate"));
return;
}

const feeRateNumber = Number.parseInt(feeRate);
const childIndex = Number.parseInt(index === "0" ? "1" : "0");

if (isNaN(feeRateNumber)) {
Alert.alert("Invalid fee rate");
Alert.alert(t("channel.bumpFeeAlerts.invalidFeeRate"));
return;
}

Expand All @@ -138,9 +138,9 @@ export const PendingChannelCard = ({ channel, type, alias }: IPendingChannelCard
txid,
});

Alert.alert("Bumped Fee");
Alert.alert(t("channel.bumpFeeAlerts.bumpFeeSuccess"));
} catch (err) {
Alert.alert("Failed To Bump Fee: ", err);
Alert.alert(t("channel.bumpFeeAlerts.bumpFeeFailed"), err);
console.error("Fee bump failed", err);
}
},
Expand Down

0 comments on commit 9c11d8b

Please sign in to comment.