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

Fedimint sweep #862

Merged
merged 5 commits into from
Feb 6, 2024
Merged
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: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.mutinywallet.mutinywallet"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 48
versionName "0.5.7"
versionCode 49
versionName "0.5.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.5.7;
MARKETING_VERSION = 1.5.8;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -387,7 +387,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.5.7;
MARKETING_VERSION = 1.5.8;
PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mutiny-wallet",
"version": "0.5.7",
"version": "0.5.8",
"license": "MIT",
"packageManager": "[email protected]",
"scripts": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"@kobalte/core": "^0.9.8",
"@kobalte/tailwindcss": "^0.5.0",
"@modular-forms/solid": "^0.18.1",
"@mutinywallet/mutiny-wasm": "0.5.7",
"@mutinywallet/mutiny-wasm": "0.5.8",
"@mutinywallet/waila-wasm": "^0.2.6",
"@solid-primitives/upload": "^0.0.111",
"@solidjs/meta": "^0.29.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 31 additions & 14 deletions src/components/BalanceBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,38 @@ export function BalanceBox(props: { loading?: boolean }) {
<Show when={state.federations && state.federations.length}>
<Show when={!props.loading} fallback={<LoadingShimmer />}>
<hr class="my-2 border-m-grey-750" />
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={state.balance?.federation || 0}
icon="community"
denominationSize="lg"
isFederation
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={state.balance?.federation || 0n}
denominationSize="sm"
/>
<div class="flex justify-between">
<div class="flex flex-col gap-1">
<div class="text-2xl">
<AmountSats
amountSats={
state.balance?.federation || 0
}
icon="community"
denominationSize="lg"
isFederation
/>
</div>
<div class="text-lg text-white/70">
<AmountFiat
amountSats={
state.balance?.federation || 0n
}
denominationSize="sm"
/>
</div>
</div>
<Show when={state.balance?.federation || 0n > 0n}>
<div class="self-end justify-self-end">
<A href="/swaplightning" class={STYLE}>
<img
src={shuffle}
alt="swaplightning"
class="h-6 w-6"
/>
</A>
</div>
</Show>
</div>
</Show>
</Show>
Expand Down
41 changes: 41 additions & 0 deletions src/components/Failure.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { A } from "@solidjs/router";
import { Match, Switch } from "solid-js";

import { InfoBox, MegaClock, MegaEx } from "~/components";
import { useI18n } from "~/i18n/context";

export function Failure(props: { reason: string }) {
const i18n = useI18n();

return (
<Switch>
<Match when={props.reason === "Payment timed out."}>
<MegaClock />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.payment_pending")}
</h1>
<InfoBox accent="white">
{i18n.t("send.payment_pending_description")}
</InfoBox>
</Match>
<Match
when={props.reason === "Channel reserve amount is too high."}
>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.error_channel_reserves")}
</h1>
<InfoBox accent="white">
{i18n.t("send.error_channel_reserves_explained")}{" "}
<A href="/settings/channels">{i18n.t("common.why")}</A>
</InfoBox>
</Match>
<Match when={true}>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{props.reason}
</h1>
</Match>
</Switch>
);
}
7 changes: 5 additions & 2 deletions src/components/ReceiveWarnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { FeesModal } from "~/components/MoreInfoModal";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";

export function ReceiveWarnings(props: { amountSats: string | bigint }) {
export function ReceiveWarnings(props: {
amountSats: string | bigint;
from_fedi_to_ln: boolean;
}) {
const i18n = useI18n();
const [state, _actions] = useMegaStore();

Expand All @@ -26,7 +29,7 @@ export function ReceiveWarnings(props: { amountSats: string | bigint }) {
});

const warningText = () => {
if (state.federations?.length !== 0) {
if (state.federations?.length !== 0 && props.from_fedi_to_ln != true) {
return undefined;
}
if ((state.balance?.lightning || 0n) === 0n) {
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export * from "./Restart";
export * from "./ResyncOnchain";
export * from "./SeedWords";
export * from "./SetupErrorDisplay";
export * from "./Failure";
export * from "./ShareCard";
export * from "./Toaster";
export * from "./NostrActivity";
Expand Down
13 changes: 13 additions & 0 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,19 @@ export default {
connecting: "Connecting...",
confirm_swap: "Confirm Swap"
},
swap_lightning: {
insufficient_funds: "You don't have enough funds to swap to lightning",
header: "Swap to Lightning",
header_preview: "Preview Swap",
completed: "Swap Completed",
too_small:
"Invalid amount entered. You need to swap at least 100k sats.",
sats_added:
"+{{amount}} sats have been added to your Lightning balance",
sats_fee: "+{{amount}} sats fee",
confirm_swap: "Confirm Swap",
preview_swap: "Preview Swap Fee"
},
reload: {
mutiny_update: "Mutiny Update",
new_version_description:
Expand Down
4 changes: 3 additions & 1 deletion src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
Scanner,
Search,
Send,
Swap
Swap,
SwapLightning
} from "~/routes";
import {
Admin,
Expand Down Expand Up @@ -101,6 +102,7 @@ export function Router() {
<Route path="/scanner" component={Scanner} />
<Route path="/send" component={Send} />
<Route path="/swap" component={Swap} />
<Route path="/swaplightning" component={SwapLightning} />
<Route path="/search" component={Search} />
<Route path="/settings">
<Route path="/" component={Settings} />
Expand Down
5 changes: 4 additions & 1 deletion src/routes/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ export function Receive() {
setAmountSats={setAmount}
onSubmit={getQr}
/>
<ReceiveWarnings amountSats={amount() || "0"} />
<ReceiveWarnings
amountSats={amount() || "0"}
from_fedi_to_ln={false}
/>
</VStack>
<div class="flex-1" />
<VStack>
Expand Down
41 changes: 2 additions & 39 deletions src/routes/Send.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MutinyInvoice, TagItem } from "@mutinywallet/mutiny-wasm";
import { A, useNavigate, useSearchParams } from "@solidjs/router";
import { useNavigate, useSearchParams } from "@solidjs/router";
import {
createEffect,
createMemo,
Expand All @@ -25,15 +25,14 @@ import {
BackPop,
Button,
DefaultMain,
Failure,
Fee,
FeeDisplay,
HackActivityType,
InfoBox,
LabelCircle,
LoadingShimmer,
MegaCheck,
MegaClock,
MegaEx,
MethodChoice,
MutinyWalletGuard,
NavBar,
Expand Down Expand Up @@ -190,42 +189,6 @@ function DestinationItem(props: {
);
}

function Failure(props: { reason: string }) {
const i18n = useI18n();

return (
<Switch>
<Match when={props.reason === "Payment timed out."}>
<MegaClock />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.payment_pending")}
</h1>
<InfoBox accent="white">
{i18n.t("send.payment_pending_description")}
</InfoBox>
</Match>
<Match
when={props.reason === "Channel reserve amount is too high."}
>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{i18n.t("send.error_channel_reserves")}
</h1>
<InfoBox accent="white">
{i18n.t("send.error_channel_reserves_explained")}{" "}
<A href="/settings/channels">{i18n.t("common.why")}</A>
</InfoBox>
</Match>
<Match when={true}>
<MegaEx />
<h1 class="mb-2 mt-4 w-full text-center text-2xl font-semibold md:text-3xl">
{props.reason}
</h1>
</Match>
</Switch>
);
}

export function Send() {
const [state, actions] = useMegaStore();
const navigate = useNavigate();
Expand Down
Loading
Loading