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

Prod 0.6.6 #1080

Merged
merged 5 commits into from
Apr 18, 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 57
versionName "0.6.5"
versionCode 58
versionName "0.6.6"
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.6.5;
MARKETING_VERSION = 1.6.6;
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.6.5;
MARKETING_VERSION = 1.6.6;
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.6.5",
"version": "0.6.6",
"license": "MIT",
"packageManager": "[email protected]",
"scripts": {
Expand Down Expand Up @@ -54,7 +54,7 @@
"@capacitor/toast": "^5.0.6",
"@kobalte/core": "^0.12.6",
"@kobalte/tailwindcss": "^0.9.0",
"@mutinywallet/mutiny-wasm": "0.6.5",
"@mutinywallet/mutiny-wasm": "0.6.6",
"@modular-forms/solid": "^0.20.0",
"@solid-primitives/upload": "^0.0.117",
"@solidjs/meta": "^0.29.3",
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.

32 changes: 30 additions & 2 deletions src/components/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import {

import { GenericItem } from "./GenericItem";

const ZAPPLE_PAY_NPUB =
"npub1wxl6njlcgygduct7jkgzrvyvd9fylj4pqvll6p32h59wyetm5fxqjchcan";

export type HackActivityType =
| "Lightning"
| "OnChain"
Expand Down Expand Up @@ -85,7 +88,12 @@ export function UnifiedActivityItem(props: {
if (props.item.contacts.length === 0) {
return undefined;
}
return props.item.contacts[0];
// if it's a zapple pay, don't show the contact, parse the label
const contact = props.item.contacts[0];
if (contact.npub && contact.npub === ZAPPLE_PAY_NPUB) {
return undefined;
}
return contact;
});

const getContact = cache(async (npub) => {
Expand All @@ -108,6 +116,25 @@ export function UnifiedActivityItem(props: {
}
}
}
} else if (
// if zapple pay, handle it specially
props.item.contacts[0].npub === ZAPPLE_PAY_NPUB
) {
if (props.item.labels) {
const label = props.item.labels.find((l) =>
l.startsWith("From: nostr:npub")
);
if (label) {
// get the npub from the label
const npub = label.split("From: nostr:")[1];
await new Promise((r) => setTimeout(r, 1000));
try {
return await getContact(npub.trim());
} catch (e) {
console.error(e);
}
}
}
}
return undefined;
});
Expand All @@ -118,7 +145,8 @@ export function UnifiedActivityItem(props: {
(l) =>
l !== "SWAP" &&
!l.startsWith("LN Channel:") &&
!l.startsWith("npub")
!l.startsWith("npub") &&
!l.startsWith("From: nostr:npub")
);
if (filtered.length === 0) {
return undefined;
Expand Down
27 changes: 2 additions & 25 deletions src/components/BalanceBox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { A, useNavigate } from "@solidjs/router";
import { Shuffle, Users } from "lucide-solid";
import { useNavigate } from "@solidjs/router";
import { Users } from "lucide-solid";
import { Match, Show, Switch } from "solid-js";

import {
Expand Down Expand Up @@ -43,9 +43,6 @@ export function LoadingShimmer(props: { center?: boolean; small?: boolean }) {
);
}

const STYLE =
"px-2 py-1 rounded-xl text-sm flex gap-2 items-center font-semibold";

export function BalanceBox(props: { loading?: boolean; small?: boolean }) {
const [state, _actions] = useMegaStore();
const navigate = useNavigate();
Expand All @@ -56,9 +53,6 @@ export function BalanceBox(props: { loading?: boolean; small?: boolean }) {
(state.balance?.unconfirmed || 0n) +
(state.balance?.force_close || 0n);

const usableOnchain = () =>
(state.balance?.confirmed || 0n) + (state.balance?.unconfirmed || 0n);

return (
<VStack>
<Switch>
Expand Down Expand Up @@ -90,16 +84,6 @@ export function BalanceBox(props: { loading?: boolean; small?: boolean }) {
/>
</div>
</div>

<Show
when={state.balance?.federation || 0n > 0n}
>
<div class="self-end justify-self-end">
<A href="/swaplightning" class={STYLE}>
<Shuffle class="h-6 w-6" />
</A>
</div>
</Show>
</div>
</Show>
</FancyCard>
Expand Down Expand Up @@ -184,13 +168,6 @@ export function BalanceBox(props: { loading?: boolean; small?: boolean }) {
<Show when={state.balance?.unconfirmed === 0n}>
<div />
</Show>
<Show when={usableOnchain() > 0n}>
<div class="self-end justify-self-end">
<A href="/swap" class={STYLE}>
<Shuffle class="h-6 w-6" />
</A>
</div>
</Show>
</div>
</div>
</Show>
Expand Down
6 changes: 3 additions & 3 deletions src/components/KitchenSink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function PeerItem(props: { peer: MutinyPeer; refetchPeers: RefetchPeersType }) {
</Collapsible.Trigger>
<Collapsible.Content>
<VStack>
<pre class="overflow-x-auto whitespace-pre-wrap break-all">
<pre class="!select-text overflow-x-auto whitespace-pre-wrap break-all">
{JSON.stringify(props.peer, null, 2)}
</pre>
<Button
Expand Down Expand Up @@ -209,7 +209,7 @@ function ChannelItem(props: { channel: MutinyChannel; network?: Network }) {
</Collapsible.Trigger>
<Collapsible.Content>
<VStack>
<pre class="overflow-x-auto whitespace-pre-wrap break-all">
<pre class="!select-text overflow-x-auto whitespace-pre-wrap break-all">
{JSON.stringify(props.channel, null, 2)}
</pre>
<ExternalLink
Expand Down Expand Up @@ -399,7 +399,7 @@ function OpenChannel(props: { refetchChannels: RefetchChannelsListType }) {
</form>
</InnerCard>
<Show when={newChannel()}>
<pre class="overflow-x-auto whitespace-pre-wrap break-all">
<pre class="!select-text overflow-x-auto whitespace-pre-wrap break-all">
{JSON.stringify(newChannel()?.outpoint, null, 2)}
</pre>
<pre>{newChannel()?.outpoint}</pre>
Expand Down
8 changes: 6 additions & 2 deletions src/logic/mutinyWalletSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export async function setupMutinyWallet(
password?: string,
safeMode?: boolean,
shouldZapHodl?: boolean
): Promise<MutinyWallet> {
): Promise<MutinyWallet | undefined> {
console.log("Starting setup...");

// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API
Expand Down Expand Up @@ -350,5 +350,9 @@ export async function setupMutinyWallet(

sessionStorage.setItem("MUTINY_WALLET_INITIALIZED", Date.now().toString());

return mutinyWallet;
if (mutinyWallet) {
return mutinyWallet;
} else {
return undefined;
}
}
30 changes: 30 additions & 0 deletions src/state/megaStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,43 @@ export const Provider: ParentComponent = (props) => {
await setSettings(settings);
}

// 60 seconds to load or we bail
const start = Date.now();
const MAX_LOAD_TIME = 60000;
const interval = setInterval(() => {
console.log("Running setup", Date.now() - start);
if (Date.now() - start > MAX_LOAD_TIME) {
clearInterval(interval);
// Have to set state error here because throwing doesn't work if WASM panics
setState({
setup_error: new Error(
"Load timed out, please try again"
)
});
return;
}
}, 1000);

const mutinyWallet = await setupMutinyWallet(
settings,
password,
state.safe_mode,
state.should_zap_hodl
);

// Done with the timeout shenanigans
clearInterval(interval);

// I've never managed to trigger this but it's just some extra safety I guess
if (!mutinyWallet) {
setState({
setup_error: new Error(
"Failed to initialize Mutiny Wallet"
)
});
return;
}

// Give other components access to settings via the store
setState({ settings: settings });

Expand Down
Loading